noteloom 0.3.3 β†’ 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (104) hide show
  1. package/README.md +284 -55
  2. package/bin/noteloom.mjs +139 -0
  3. package/dist/canvas.cjs +2 -0
  4. package/dist/canvas.cjs.map +1 -0
  5. package/dist/canvas.d.ts +2 -0
  6. package/dist/canvas.js +5 -0
  7. package/dist/canvas.js.map +1 -0
  8. package/dist/collab.cjs +2 -0
  9. package/dist/collab.cjs.map +1 -0
  10. package/dist/collab.d.ts +19 -0
  11. package/dist/collab.js +379 -0
  12. package/dist/collab.js.map +1 -0
  13. package/dist/comments.cjs +2 -0
  14. package/dist/comments.cjs.map +1 -0
  15. package/dist/comments.d.ts +17 -0
  16. package/dist/comments.js +19 -0
  17. package/dist/comments.js.map +1 -0
  18. package/dist/index.cjs +2 -0
  19. package/dist/index.cjs.map +1 -0
  20. package/dist/index.d.ts +372 -33
  21. package/dist/index.js +3983 -0
  22. package/dist/index.js.map +1 -0
  23. package/dist/persistence.cjs +2 -0
  24. package/dist/persistence.cjs.map +1 -0
  25. package/dist/persistence.d.ts +11 -0
  26. package/dist/persistence.js +12 -0
  27. package/dist/persistence.js.map +1 -0
  28. package/dist/shared/CommentAvatar-TKqsM8vG.js +53 -0
  29. package/dist/shared/CommentAvatar-TKqsM8vG.js.map +1 -0
  30. package/dist/shared/CommentAvatar-V457IgoQ.cjs +2 -0
  31. package/dist/shared/CommentAvatar-V457IgoQ.cjs.map +1 -0
  32. package/dist/shared/CommentThreadCard-CAJ3oPdr.cjs +2 -0
  33. package/dist/shared/CommentThreadCard-CAJ3oPdr.cjs.map +1 -0
  34. package/dist/shared/CommentThreadCard-Cxf8GwHJ.js +213 -0
  35. package/dist/shared/CommentThreadCard-Cxf8GwHJ.js.map +1 -0
  36. package/dist/shared/CommentsPanel-BwVVyMOC.js +76 -0
  37. package/dist/shared/CommentsPanel-BwVVyMOC.js.map +1 -0
  38. package/dist/shared/CommentsPanel-CES4uzye.cjs +2 -0
  39. package/dist/shared/CommentsPanel-CES4uzye.cjs.map +1 -0
  40. package/dist/shared/VersionHistory-Bg6fufP5.js +1120 -0
  41. package/dist/shared/VersionHistory-Bg6fufP5.js.map +1 -0
  42. package/dist/shared/VersionHistory-DELa2Wbq.cjs +12 -0
  43. package/dist/shared/VersionHistory-DELa2Wbq.cjs.map +1 -0
  44. package/dist/shared/VoiceListeningIndicator-BOfVmLK0.js +338 -0
  45. package/dist/shared/VoiceListeningIndicator-BOfVmLK0.js.map +1 -0
  46. package/dist/shared/VoiceListeningIndicator-DNX8JlQM.cjs +2 -0
  47. package/dist/shared/VoiceListeningIndicator-DNX8JlQM.cjs.map +1 -0
  48. package/dist/shared/fieldRegistry-BoYyW3GH.cjs +2 -0
  49. package/dist/shared/fieldRegistry-BoYyW3GH.cjs.map +1 -0
  50. package/dist/shared/fieldRegistry-PjJWXFoB.js +223 -0
  51. package/dist/shared/fieldRegistry-PjJWXFoB.js.map +1 -0
  52. package/dist/shared/icons-C1_s0jKK.js +4269 -0
  53. package/dist/shared/icons-C1_s0jKK.js.map +1 -0
  54. package/dist/shared/icons-DtCsXuU6.cjs +3531 -0
  55. package/dist/shared/icons-DtCsXuU6.cjs.map +1 -0
  56. package/dist/shared/index-B9jyyL8u.js +2145 -0
  57. package/dist/shared/index-B9jyyL8u.js.map +1 -0
  58. package/dist/shared/index-D9WEXpYM.cjs +2 -0
  59. package/dist/shared/index-D9WEXpYM.cjs.map +1 -0
  60. package/dist/shared/indexedDbPersistence-BKlGPFTP.js +112 -0
  61. package/dist/shared/indexedDbPersistence-BKlGPFTP.js.map +1 -0
  62. package/dist/shared/indexedDbPersistence-BWJ1h5Vp.cjs +2 -0
  63. package/dist/shared/indexedDbPersistence-BWJ1h5Vp.cjs.map +1 -0
  64. package/dist/shared/leafBlockFactory-A9eUhSe-.js +335 -0
  65. package/dist/shared/leafBlockFactory-A9eUhSe-.js.map +1 -0
  66. package/dist/shared/leafBlockFactory-Dp382eP8.cjs +2 -0
  67. package/dist/shared/leafBlockFactory-Dp382eP8.cjs.map +1 -0
  68. package/dist/shared/serialize-DWEfk0vU.cjs +3 -0
  69. package/dist/shared/serialize-DWEfk0vU.cjs.map +1 -0
  70. package/dist/shared/serialize-T9Odwx24.js +86 -0
  71. package/dist/shared/serialize-T9Odwx24.js.map +1 -0
  72. package/dist/shared/starter-kit-CY5wzYDf.js +4980 -0
  73. package/dist/shared/starter-kit-CY5wzYDf.js.map +1 -0
  74. package/dist/shared/starter-kit-lPN-NpJ5.cjs +27 -0
  75. package/dist/shared/starter-kit-lPN-NpJ5.cjs.map +1 -0
  76. package/dist/shared/usePopoverEdgeClamp-CDG26jBM.cjs +2 -0
  77. package/dist/shared/usePopoverEdgeClamp-CDG26jBM.cjs.map +1 -0
  78. package/dist/shared/usePopoverEdgeClamp-gmFm0CnI.js +109 -0
  79. package/dist/shared/usePopoverEdgeClamp-gmFm0CnI.js.map +1 -0
  80. package/dist/shared/useServiceWorkerUpdate-BduabXv6.js +94 -0
  81. package/dist/shared/useServiceWorkerUpdate-BduabXv6.js.map +1 -0
  82. package/dist/shared/useServiceWorkerUpdate-DQboGesi.cjs +2 -0
  83. package/dist/shared/useServiceWorkerUpdate-DQboGesi.cjs.map +1 -0
  84. package/dist/starter-kit.cjs +2 -0
  85. package/dist/starter-kit.cjs.map +1 -0
  86. package/dist/starter-kit.d.ts +9 -0
  87. package/dist/starter-kit.js +10 -0
  88. package/dist/starter-kit.js.map +1 -0
  89. package/dist/style.css +3529 -3283
  90. package/dist/versions.cjs +2 -0
  91. package/dist/versions.cjs.map +1 -0
  92. package/dist/versions.d.ts +11 -0
  93. package/dist/versions.js +13 -0
  94. package/dist/versions.js.map +1 -0
  95. package/dist/voice.cjs +2 -0
  96. package/dist/voice.cjs.map +1 -0
  97. package/dist/voice.d.ts +7 -0
  98. package/dist/voice.js +8 -0
  99. package/dist/voice.js.map +1 -0
  100. package/package.json +159 -92
  101. package/dist/noteloom.cjs +0 -3292
  102. package/dist/noteloom.cjs.map +0 -1
  103. package/dist/noteloom.es.js +0 -15047
  104. package/dist/noteloom.es.js.map +0 -1
package/dist/index.cjs ADDED
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const H=require("./shared/VersionHistory-DELa2Wbq.cjs"),m=require("./shared/icons-DtCsXuU6.cjs"),pe=require("./shared/fieldRegistry-BoYyW3GH.cjs"),Q=require("./collab.cjs"),K=require("./shared/indexedDbPersistence-BWJ1h5Vp.cjs"),Be=require("./shared/useServiceWorkerUpdate-DQboGesi.cjs"),g=require("react"),d=require("react/jsx-runtime"),z=require("./shared/CommentThreadCard-CAJ3oPdr.cjs"),xe=require("./shared/CommentsPanel-CES4uzye.cjs"),Jt=require("./shared/CommentAvatar-V457IgoQ.cjs"),$=require("./shared/index-D9WEXpYM.cjs"),y=require("./shared/starter-kit-lPN-NpJ5.cjs"),E=require("./shared/leafBlockFactory-Dp382eP8.cjs"),X=require("react-dom"),se=require("./shared/serialize-DWEfk0vU.cjs"),G=require("./shared/VoiceListeningIndicator-DNX8JlQM.cjs"),Z=require("./shared/usePopoverEdgeClamp-CDG26jBM.cjs"),Xt=500;function Qt(e,t){const n=e??"",o=t??"";let s=0;const r=Math.min(n.length,o.length);for(;s<r&&n[s]===o[s];)s+=1;let a=n.length,l=o.length;for(;a>s&&l>s&&n[a-1]===o[l-1];)a-=1,l-=1;return{beforeOffset:a,afterOffset:l}}function Ke(e){var t;if((e==null?void 0:e.type)==="updateRun"&&typeof((t=e.patch)==null?void 0:t.value)=="string")return e.patch.value;if((e==null?void 0:e.type)==="editRunChars"&&typeof e.previousValue=="string")return e.previousValue}function Pe(e){var l;if(!e.ops.length||!e.inverses.length)return null;const t=e.ops[0],n=e.ops[e.ops.length-1];if(t.type!=="updateRun"||n.type!=="updateRun"||t.id!==n.id||typeof((l=n.patch)==null?void 0:l.value)!="string")return null;const o=e.inverses[e.inverses.length-1],s=Ke(o);if(s===void 0)return null;const{beforeOffset:r,afterOffset:a}=Qt(s,n.patch.value);return{runId:t.id,beforeOffset:r,afterOffset:a}}function _e(e){const t=[],n=o=>{var s;o&&((s=o.block)!=null&&s.id&&t.push(o.block.id),o.blockId&&t.push(o.blockId),o.id&&t.push(o.id),o.parentId&&t.push(o.parentId),o.toParentId&&t.push(o.toParentId))};for(const o of e.ops)n(o);for(const o of e.inverses)n(o);return[...new Set(t)]}class Ve{constructor(t,{idleMs:n=Xt,trackChanges:o=!1,maxChangeLogSize:s=500,defaultActorId:r=null}={}){this.store=t,this.idleMs=n,this.defaultActorId=r,this.undoStack=[],this.redoStack=[],this.currentBatch=null,this.idleTimer=null,this.historyLog=[],this._listeners=new Set,this._undoRedoSnapshot={canUndo:!1,canRedo:!1},this._pendingSelection=null,this._pendingAffectedBlockIds=[],this.trackChanges=o,this.maxChangeLogSize=s,this.changeLog=[]}_recordChange(t,n,o){var a;if(!this.trackChanges)return;const s=t.patch!==void 0&&(n==null?void 0:n.patch)!==void 0,r=s?void 0:Ke(n);this.changeLog.push({opType:t.type,id:t.id??t.blockId??((a=t.block)==null?void 0:a.id),before:s?n.patch:r!==void 0?{value:r}:void 0,after:s||r!==void 0?t.patch:void 0,actorId:o.actorId??null,timestamp:o.timestamp??Date.now()}),this.changeLog.length>this.maxChangeLogSize&&this.changeLog.shift()}getChangeLog(){return[...this.changeLog]}getPendingSelection(){return this._pendingSelection}getPendingAffectedBlockIds(){return this._pendingAffectedBlockIds}getUndoRedoSnapshot(){const t=this.canUndo(),n=this.canRedo();return(this._undoRedoSnapshot.canUndo!==t||this._undoRedoSnapshot.canRedo!==n)&&(this._undoRedoSnapshot={canUndo:t,canRedo:n}),this._undoRedoSnapshot}getBlock(t){return this.store.getBlock(t)}getRun(t){return this.store.getRun(t)}getRootId(){return this.store.getRootId()}getFieldTypes(){return this.store.getFieldTypes()}getFieldType(t){return this.store.getFieldType(t)}getComments(){return this.store.getComments()}getComment(t){return this.store.getComment(t)}getPeople(){return this.store.getPeople()}getPerson(t){return this.store.getPerson(t)}getAllRunIds(){return this.store.getAllRunIds()}subscribe(t,n){return this.store.subscribe(t,n)}subscribeAll(t){return this.store.subscribeAll(t)}getTombstoneCount(){return this.store.getTombstoneCount()}pruneTombstones(t){return this.store.pruneTombstones(t)}toJSON(){return this.store.toJSON()}applyOperation(t,n={}){return this.perform(t,n)}applyOperations(t,n={}){return t.map(o=>this.perform(o,n))}setDefaultActorId(t){this.defaultActorId=t}performBatch(t,n={}){var a;const o=n.actorId??this.defaultActorId,s=n.timestamp??Date.now();this._commitCurrentBatch();const r=[];for(const l of t){const u=this.store.applyOperation(l);r.unshift(u),this.historyLog.push({opType:l.type,id:l.id??l.blockId??((a=l.block)==null?void 0:a.id),actorId:o,timestamp:s}),this._recordChange(l,u,{actorId:o,timestamp:s})}this.redoStack=[],this.undoStack.push({ops:[...t],inverses:r,batchKey:null,actorId:o,timestamp:s,lastTimestamp:s,boundaryHit:!0}),this._notify()}perform(t,n={}){const o=n.actorId??this.defaultActorId,s=n.timestamp??Date.now(),r=this.store.applyOperation(t);return this._record(t,r,{actorId:o,timestamp:s}),r}_batchKeyFor(t){return t.type==="updateRun"?`run:${t.id}`:null}_isWordBoundary(t){var o;if(t.type!=="updateRun")return!1;const n=(o=t.patch)==null?void 0:o.value;return typeof n!="string"||n.length===0?!1:/\s/.test(n[n.length-1])}_record(t,n,o){var l;this.redoStack=[];const s=this._batchKeyFor(t),r=this.currentBatch&&o.timestamp-this.currentBatch.lastTimestamp<=this.idleMs;this.currentBatch&&s!==null&&this.currentBatch.batchKey===s&&r&&!this.currentBatch.boundaryHit?(this.currentBatch.ops.push(t),this.currentBatch.inverses.unshift(n),this.currentBatch.lastTimestamp=o.timestamp,this._isWordBoundary(t)&&(this.currentBatch.boundaryHit=!0)):(this._commitCurrentBatch(),this.currentBatch={ops:[t],inverses:[n],batchKey:s,actorId:o.actorId,timestamp:o.timestamp,lastTimestamp:o.timestamp,boundaryHit:this._isWordBoundary(t)}),this._resetIdleTimer(),this.historyLog.push({opType:t.type,id:t.id??((l=t.block)==null?void 0:l.id),actorId:o.actorId,timestamp:o.timestamp}),this._recordChange(t,n,o),this._notify()}_resetIdleTimer(){this.idleTimer&&clearTimeout(this.idleTimer),this.idleTimer=setTimeout(()=>{this._commitCurrentBatch(),this._notify()},this.idleMs)}_commitCurrentBatch(){this.currentBatch&&(this.undoStack.push(this.currentBatch),this.currentBatch=null,this.idleTimer&&(clearTimeout(this.idleTimer),this.idleTimer=null))}flush(){this._commitCurrentBatch(),this._notify()}undo(){this._commitCurrentBatch();const t=this.undoStack.pop();if(!t)return!1;for(const o of t.inverses)this.store.applyOperation(o);this.redoStack.push(t);const n=Pe(t);return this._pendingSelection=n?{runId:n.runId,offset:n.beforeOffset}:null,this._pendingAffectedBlockIds=_e(t),this._notify(),!0}redo(){const t=this.redoStack.pop();if(!t)return!1;for(const o of t.ops)this.store.applyOperation(o);this.undoStack.push(t);const n=Pe(t);return this._pendingSelection=n?{runId:n.runId,offset:n.afterOffset}:null,this._pendingAffectedBlockIds=_e(t),this._notify(),!0}canUndo(){return this.undoStack.length>0||this.currentBatch!==null}canRedo(){return this.redoStack.length>0}getHistoryLog(){return[...this.historyLog]}subscribeToHistory(t){return this._listeners.add(t),()=>this._listeners.delete(t)}_notify(){for(const t of this._listeners)t()}}function Zt({scope:e}={}){const[t,n]=g.useState([]),[o,s]=g.useState(!1),r=g.useCallback(()=>(s(!1),K.listTemplates().then(a=>{n(e?a.filter(l=>l.scope===e):a),s(!0)})),[e]);return g.useEffect(()=>{let a=!1;return s(!1),K.listTemplates().then(l=>{a||(n(e?l.filter(u=>u.scope===e):l),s(!0))}),()=>{a=!0}},[e]),{templates:t,isLoaded:o,refresh:r}}function en({templates:e,onSelect:t,emptyLabel:n="No templates yet."}){return e.length===0?d.jsx("p",{className:"be-template-picker-empty",children:n}):d.jsx("ul",{className:"be-template-picker",role:"list",children:e.map(o=>d.jsxs("li",{className:"be-template-card",children:[d.jsxs("div",{className:"be-template-card-body",children:[d.jsx("span",{className:"be-template-card-name",children:o.name}),o.description&&d.jsx("span",{className:"be-template-card-description",children:o.description})]}),d.jsx("button",{type:"button",className:"be-template-card-select",onClick:()=>t(o),children:"Use"})]},o.id))})}function tn(e,{name:t,color:n}){const o=m.genId();return e.applyOperation(m.addPerson({id:o,name:t,color:n})),o}function nn(e,t,n){e.applyOperation(m.updatePerson(t,n))}function on(e,t){e.applyOperation(m.removePerson(t))}const sn="$people";function rn(){const e=m.useEditorStore(),t=g.useCallback(o=>e.subscribe(sn,o),[e]),n=g.useCallback(()=>e.getPeople(),[e]);return g.useSyncExternalStore(t,n)}class ze{constructor(){this._types=new Map}register(t,n){this._types.set(t,n)}get(t){return this._types.get(t)}isLeaf(t){var n;return!!((n=this._types.get(t))!=null&&n.isLeaf)}listSlashCommands(){const t=[];for(const n of this._types.values())n.slashCommand&&t.push(n.slashCommand),n.slashCommands&&t.push(...n.slashCommands);return t}listHtmlMatchers(){return[...this._types.values()].filter(t=>t.fromHTML)}}function qe(){return new ze}class We{constructor(){this._types=new Map}register(t,n){this._types.set(t,n)}unregister(t){this._types.delete(t)}get(t){return this._types.get(t)}listHtmlMatchers(){return[...this._types.values()].filter(t=>t.fromHTML)}listSlashCommands(){const t=[];for(const n of this._types.values())n.slashCommand&&t.push(n.slashCommand),n.slashCommands&&t.push(...n.slashCommands);return t}listAtCommands(){const t=[];for(const n of this._types.values())n.atCommand&&t.push(n.atCommand),n.atCommands&&t.push(...n.atCommands);return t}}function Ge(){return new We}function Ye(e){Je(e,{paragraph:y.paragraphBlockType,heading:y.headingBlockType,listItem:y.listItemBlockType,...Xe,...Qe,divider:y.dividerBlockType,callout:y.calloutBlockType,blockquote:y.blockquoteBlockType,code:y.codeBlockType,toggleHeading:y.toggleHeadingBlockType,button:y.buttonBlockType,embed:y.embedBlockType,canvas:$.canvasBlockType})}function Je(e,t){for(const[n,o]of Object.entries(t))e.register(n,o)}const Xe={table:y.tableBlockType,tableRow:y.tableRowBlockType,tableCell:y.tableCellBlockType},Qe={layout:y.layoutBlockType,layoutColumn:y.layoutColumnBlockType};function Ze(e){et(e,{select:y.selectInlineType,date:y.dateInlineType,checkbox:y.checkboxInlineType,...tt,emoji:y.emojiInlineType})}function et(e,t){for(const[n,o]of Object.entries(t))e.register(n,o)}const tt={tableSelect:y.tableSelectInlineType},ge={'"':{open:"β€œ",close:"”"},"'":{open:"β€˜",close:"’"}};function ln(e,t){const n=ge[e];return t===void 0||/[\s([{β€œβ€˜]/.test(t)?n.open:n.close}function nt(e){return e.inputType!=="insertText"||!e.data||e.data.length!==1?null:e.data}function re(e,t,n){var o;return((o=e.getBlock(t))==null?void 0:o.type)===n}function an(){return $.defineExtension({name:"smart-quotes",onBeforeInput(e,t){const n=nt(t);if(!n||!ge[n])return!1;const o=ge[n],s=e.getSelection();if(s){if(re(e,s.blockId,"code"))return!1;const c=e.getRun(s.runId);if(!c||c.type!=="text")return!1;const i=c.value??"",f=i.slice(0,s.startOffset)+o.open+i.slice(s.startOffset,s.endOffset)+o.close+i.slice(s.endOffset);return e.applyOperation(m.updateRun(c.id,{value:f})),e.setCaret(c.id,s.endOffset+2),!0}const r=e.getCaret();if(!r||re(e,r.blockId,"code"))return!1;const a=e.getRun(r.runId);if(!a||a.type!=="text")return!1;const l=a.value??"",u=ln(n,l[r.offset-1]);return e.applyOperation(m.updateRun(a.id,{value:l.slice(0,r.offset)+u+l.slice(r.offset)})),e.setCaret(a.id,r.offset+1),!0}})}const ot={"(":")","[":"]","{":"}"},cn=new Set(Object.values(ot));function un(){return $.defineExtension({name:"auto-pair-brackets",onBeforeInput(e,t){const n=nt(t);if(!n)return!1;const o=ot[n];if(o){const s=e.getSelection();if(s){if(re(e,s.blockId,"code"))return!1;const u=e.getRun(s.runId);if(!u||u.type!=="text")return!1;const c=u.value??"",i=c.slice(0,s.startOffset)+n+c.slice(s.startOffset,s.endOffset)+o+c.slice(s.endOffset);return e.applyOperation(m.updateRun(u.id,{value:i})),e.setCaret(u.id,s.endOffset+2),!0}const r=e.getCaret();if(!r||re(e,r.blockId,"code"))return!1;const a=e.getRun(r.runId);if(!a||a.type!=="text")return!1;const l=a.value??"";return e.applyOperation(m.updateRun(a.id,{value:l.slice(0,r.offset)+n+o+l.slice(r.offset)})),e.setCaret(a.id,r.offset+1),!0}if(cn.has(n)){const s=e.getCaret();if(!s||re(e,s.blockId,"code"))return!1;const r=e.getRun(s.runId);if(!r||r.type!=="text")return!1;if((r.value??"")[s.offset]===n)return e.setCaret(r.id,s.offset+1),!0}return!1}})}const st={heading:["level"],listItem:["ordered","checked","collapsed"],toggleHeading:["level","collapsed"],code:["language"],button:["href","color","customAttrs"],embed:["kind","src","name","alt","mimeType","align","width"],callout:["icon"]},rt=new Set(["listItem","toggleHeading"]),lt=new Set(["divider","embed"]);function at(e,t,n,o){var l,u,c;const s=n.type,r={};for(const i of st[s]??[])((l=n.props)==null?void 0:l[i])!==void 0&&(r[i]=n.props[i]);if(s==="table"){const i=n.contentIds[0]&&e.getBlock(n.contentIds[0]);return r.columns=y.resolveColumns(n,((u=i==null?void 0:i.contentIds)==null?void 0:u.length)??0),r.rows=n.contentIds.map(f=>e.getBlock(f).contentIds.map(b=>{const p=e.getBlock(b);return $.runsToHTML(p.contentIds.map(k=>e.getRun(k)),o)})),{id:n.id,type:s,data:r}}if(rt.has(s)){const i=((c=n.props)==null?void 0:c.titleRunIds)??[];r.text=$.runsToHTML(i.map(f=>e.getRun(f)),o)}else t.isLeaf(s)&&!lt.has(s)&&(r.text=$.runsToHTML(n.contentIds.map(i=>e.getRun(i)),o));const a={id:n.id,type:s,data:r};return t.isLeaf(s)||(a.children=n.contentIds.map(i=>at(e,t,e.getBlock(i),o))),a}function Se(e,t,n,{pretty:o=!0}={}){const s={store:e,registry:t,inlineRegistry:n},a=e.getBlock(e.getRootId()).contentIds.map(l=>at(e,t,e.getBlock(l),s));return JSON.stringify({version:1,blocks:a},null,o?2:0)}function ke(e,t){const n=new DOMParser().parseFromString(`<div>${e??""}</div>`,"text/html");return y.domInlineToRuns(n.body.firstChild,t)}function dn(e,t,n,o,s){const{id:r=m.genId(),data:a={}}=e,l=(a.rows??[]).map(c=>{const i=m.genId(),f=c.map(h=>{const b=m.genId(),p=ke(h,s);return o.push(...p),n.push({id:b,type:"tableCell",parentId:i,contentIds:p.map(k=>k.id),props:{}}),b});return n.push({id:i,type:"tableRow",parentId:t,contentIds:f,props:{}}),i}),u={id:r,type:"table",parentId:t,contentIds:l,props:{columns:a.columns??[]}};return n.push(u),u}function ye(e,t,n,o,s,r){const{id:a=m.genId(),type:l,data:u={},children:c=[]}=e;if(l==="table")return dn(e,t,s,r,o);const i={};for(const h of st[l]??[])u[h]!==void 0&&(i[h]=u[h]);const f={id:a,type:l,parentId:t,contentIds:[],props:i};if(s.push(f),rt.has(l)){const h=ke(u.text,o);r.push(...h),f.props.titleRunIds=h.map(b=>b.id),f.contentIds=c.map(b=>ye(b,a,n,o,s,r).id)}else if(n.isLeaf(l)){if(!lt.has(l)){const h=ke(u.text,o);r.push(...h),f.contentIds=h.map(b=>b.id)}}else f.contentIds=c.map(h=>ye(h,a,n,o,s,r).id);return f}function ct(e){return!!e&&typeof e=="object"&&Array.isArray(e.blocks)&&e.rootId===void 0&&e.runs===void 0}function it(e,t,n){const o=typeof e=="string"?JSON.parse(e):e,s={registry:t,inlineRegistry:n},r=m.genId(),a=[],l=[],u=(o.blocks??[]).map(c=>ye(c,r,t,s,a,l).id);return a.push({id:r,type:"page",parentId:null,contentIds:u,props:{}}),{rootId:r,blocks:a,runs:l}}function fn(){const e="root",t=m.genId(),n=m.genId();return{rootId:e,blocks:[{id:e,type:"page",parentId:null,contentIds:[t],props:{}},{id:t,type:"paragraph",parentId:e,contentIds:[n],props:{}}],runs:[{id:n,type:"text",value:"",marks:{}}]}}function pn({doc:e,history:t=!0,currentUserId:n=null,extensions:o,registerBlocks:s,registerInlineTypes:r}={}){return g.useMemo(()=>{const a=qe(),l=Ge();o!=null&&$.registerExtensions(o,{registry:a,inlineRegistry:l}),s?s(a):o==null&&Ye(a),r?r(l):o==null&&Ze(l);const u=e==null?fn():ct(e)?it(e,a,l):e,c=new H.EditorStore(u),i=t?new Ve(c,{defaultActorId:n}):c;return{store:i,registry:a,inlineRegistry:l,extensions:o!=null?o.flat(1/0):[],toJSON:({format:f="simple"}={})=>f==="internal"?i.toJSON():JSON.parse(Se(i,a,l))}},[])}function ut({minHeight:e=180,className:t="be-trailing-space"}){const n=m.useEditorStore(),[o]=m.usePreviewMode(),s=g.useCallback(()=>{var c;if(o)return;const r=n.getRootId(),a=n.getBlock(r),l=(c=a==null?void 0:a.contentIds)==null?void 0:c[a.contentIds.length-1];if(!l){const i=y.ensureRootNonEmpty(n);i&&E.focusBlockEnd(n,i);return}const u=n.getBlock(l);(u==null?void 0:u.type)==="paragraph"?E.focusBlockEnd(n,l):E.insertSiblingAfterAndFocus(n,l,E.createTextLeafBlock("paragraph"))},[n,o]);return d.jsx("div",{className:t,style:{minHeight:e},onClick:s})}async function Ie(e,t,n,o){var a,l,u;const{html:s,text:r}=se.serializeBlockRange(e,t,o,n);if(typeof ClipboardItem<"u"&&((a=navigator.clipboard)!=null&&a.write)){await navigator.clipboard.write([new ClipboardItem({"text/plain":new Blob([r],{type:"text/plain"}),"text/html":new Blob([s],{type:"text/html"})})]);return}await((u=(l=navigator.clipboard)==null?void 0:l.writeText)==null?void 0:u.call(l,r))}function Re(e,t){if(typeof e.performBatch=="function")e.performBatch(t);else for(const n of t)e.applyOperation(n)}function le(e,t){t.length!==0&&Re(e,t.map(n=>m.removeBlock(n)))}function dt(e,t){if(t.length===0)return!1;const n=e.getBlock(t[0]);if(!n)return!1;const o=e.getBlock(n.parentId);if(!o)return!1;const s=o.contentIds.indexOf(t[0]),r=o.contentIds.indexOf(t[t.length-1]);if(s<=0)return!1;const a=o.contentIds[s-1];return e.applyOperation(m.moveBlock(a,n.parentId,r)),!0}function ft(e,t){if(t.length===0)return!1;const n=e.getBlock(t[0]);if(!n)return!1;const o=e.getBlock(n.parentId);if(!o)return!1;const s=o.contentIds.indexOf(t[0]),r=o.contentIds.indexOf(t[t.length-1]);if(r===-1||r>=o.contentIds.length-1)return!1;const a=o.contentIds[r+1];return e.applyOperation(m.moveBlock(a,n.parentId,s)),!0}function pt(e,t){return t.length>0&&t.every(n=>{var o,s;return!!((s=(o=e.getBlock(n))==null?void 0:o.props)!=null&&s.hidden)})}function mt(e,t,n){t.length!==0&&Re(e,t.map(o=>m.updateBlockProps(o,{hidden:n})))}function mn(e,t,n,o){const s=n.filter(a=>{var l;return y.isTurnIntoEligible((l=e.getBlock(a))==null?void 0:l.type)});if(s.length===0)return;const r=s.flatMap(a=>y.turnBlockInto(e,t,a,o).ops);Re(e,r)}function hn(e,t){if(t.length===0)return[];const n=e.getBlock(t[0]),o=n&&e.getBlock(n.parentId);if(!o)return t;const s=new Set(t);return o.contentIds.filter(r=>s.has(r))}function ht(){const e=m.useEditorStore(),t=m.useBlockRegistry(),n=m.useInlineRegistry(),[o,s]=m.useBlockRangeSelection(),[r,a]=g.useState(null),l=g.useRef(null),u=g.useRef(null),c=o.length>0,i=y.useAutoAdjustedPosition(l,c,(r==null?void 0:r.bottom)!=null?r.bottom+4:null,r==null?void 0:r.left),f=g.useCallback(()=>s([]),[s]);y.useMenuKeyboardNav(l,c,f,void 0),g.useEffect(()=>{if(!c){a(null);return}const T=()=>{const j=o[o.length-1],L=document.querySelector(`[data-block-row-id="${j}"]`);a((L==null?void 0:L.getBoundingClientRect())??null)};return T(),window.addEventListener("scroll",T,!0),window.addEventListener("resize",T),()=>{window.removeEventListener("scroll",T,!0),window.removeEventListener("resize",T)}},[c,o]),g.useEffect(()=>{if(!c)return;const T=L=>{var w,O,x,A;(w=l.current)!=null&&w.contains(L.target)||(O=u.current)!=null&&O.contains(L.target)||(A=(x=L.target).closest)!=null&&A.call(x,".be-block-gutter")||f()},j=L=>{L.key==="Escape"?f():(L.key==="Delete"||L.key==="Backspace")&&(L.preventDefault(),le(e,o),f())};return document.addEventListener("mousedown",T),document.addEventListener("keydown",j),()=>{document.removeEventListener("mousedown",T),document.removeEventListener("keydown",j)}},[c,e,o,f]);const h=T=>T===1?"block":"blocks",b=g.useCallback(()=>{Ie(e,t,n,o),y.announce(`${o.length} ${h(o.length)} copied`),f()},[e,t,n,o,f]),p=g.useCallback(async()=>{await Ie(e,t,n,o);const T=o.length;le(e,o),y.announce(`${T} ${h(T)} cut`),f()},[e,t,n,o,f]),k=g.useCallback(()=>{const T=o.length;le(e,o),y.announce(`${T} ${h(T)} deleted`),f()},[e,o,f]),C=g.useCallback(()=>{dt(e,o)&&y.announce(`${o.length} ${h(o.length)} moved up`),f()},[e,o,f]),v=g.useCallback(()=>{ft(e,o)&&y.announce(`${o.length} ${h(o.length)} moved down`),f()},[e,o,f]),I=pt(e,o),B=g.useCallback(()=>{mt(e,o,!I),y.announce(I?`${o.length} ${h(o.length)} shown in preview`:`${o.length} ${h(o.length)} hidden in preview`),f()},[e,o,I,f]),R=o.some(T=>{var j;return y.isTurnIntoEligible((j=e.getBlock(T))==null?void 0:j.type)}),S=g.useCallback(T=>{const j=o.length;mn(e,t,o,T),y.announce(`${j} ${h(j)} turned into ${T.label}`),f()},[e,t,o,f]);return!c||!i?null:X.createPortal(d.jsxs("div",{ref:l,role:"menu","aria-label":"Selected blocks options",className:"be-block-range-menu",style:{position:"fixed",top:i.top,left:i.left},children:[d.jsxs("button",{type:"button",role:"menuitem",className:"be-block-range-menu-item",onClick:b,children:[d.jsx(m.CopyIcon,{size:15})," Copy"]}),d.jsxs("button",{type:"button",role:"menuitem",className:"be-block-range-menu-item",onClick:p,children:[d.jsx(m.ScissorsIcon,{size:15})," Cut"]}),d.jsxs("button",{type:"button",role:"menuitem",className:"be-block-range-menu-item",onClick:C,children:[d.jsx(m.ArrowUpIcon,{size:15})," Move up"]}),d.jsxs("button",{type:"button",role:"menuitem",className:"be-block-range-menu-item",onClick:v,children:[d.jsx(m.ArrowDownIcon,{size:15})," Move down"]}),d.jsxs("button",{type:"button",role:"menuitem",className:"be-block-range-menu-item",onClick:B,children:[I?d.jsx(m.EyeIcon,{size:15}):d.jsx(m.EyeOffIcon,{size:15}),I?"Show in preview":"Hide in preview"]}),R&&d.jsx(y.TurnIntoSubmenu,{onSelect:S,onClose:()=>{},containerRef:u,menuClassName:"be-block-range-menu",itemClassName:"be-block-range-menu-item"}),d.jsxs("button",{type:"button",role:"menuitem",className:"be-block-range-menu-item be-block-range-menu-item-danger",onClick:k,children:[d.jsx(m.TrashIcon,{size:15})," Delete"]})]}),document.body)}const ie="application/x-block-editor-blocks+json";function we(e){return e.split(/\r\n|\r|\n/).filter(t=>t.length>0).map(t=>{const n=m.genId();return{block:{id:m.genId(),type:"paragraph",parentId:null,contentIds:[n],props:{}},runs:[{id:n,type:"text",value:t,marks:{}}]}})}function bt(e,t,n){const o=new DOMParser().parseFromString(e,"text/html"),s={registry:t,inlineRegistry:n},r=t.listHtmlMatchers(),a=[],l=c=>{var h;const i=c.tagName==="OL",f=[];for(const b of c.children){if(b.tagName!=="LI")continue;const p=(h=t.get("listItem"))==null?void 0:h.fromHTML(b,s);p&&(p.block.props.ordered=i,f.push(p))}return f},u=c=>{var f;const i=Array.from(c.children).filter(h=>h.tagName==="P");if(i.length===0){const h=(f=t.get("blockquote"))==null?void 0:f.fromHTML(c,s);return h?[h]:[]}return i.map(h=>{const b=y.domInlineToRuns(h,s);return{block:{id:m.genId(),type:"blockquote",parentId:null,contentIds:b.map(p=>p.id),props:{}},runs:b}})};for(const c of o.body.childNodes){if(c.nodeType===3){const f=c.textContent.trim();f&&a.push(...we(f));continue}if(c.nodeType!==1)continue;if(c.tagName==="UL"||c.tagName==="OL"){a.push(...l(c));continue}if(c.tagName==="BLOCKQUOTE"){a.push(...u(c));continue}let i=null;for(const f of r){const h=f.fromHTML(c,s);if(h){i=h;break}}if(i)a.push(i);else if(c.textContent.trim()){const f=y.domInlineToRuns(c,s);a.push({block:{id:m.genId(),type:"paragraph",parentId:null,contentIds:f.map(h=>h.id),props:{}},runs:f})}}return a}function gt(e,t,n){const o=e.types??[];if(o.includes(ie)){const r=e.getData(ie);if(r)return bn(r)}if(o.includes("text/html")){const r=e.getData("text/html");if(r)return bt(r,t,n)}const s=e.getData("text/plain")??"";return we(s)}function bn(e){return JSON.parse(e).blocks.map(n=>se.remapSubtreeIds(n))}function Ce(e,t){var o;const n=e.getBlock(t);return((o=n.props)==null?void 0:o.titleRunIds)??n.contentIds}function ae(){return{id:m.genId(),type:"text",value:"",marks:{}}}function ve(e,t){if(typeof e.performBatch=="function")e.performBatch(t);else for(const n of t)e.applyOperation(n)}function Te(e,t,n){const{startRunId:o,startOffset:s,endRunId:r,endOffset:a}=n,l=Ce(e,t),u=l.indexOf(o),c=l.indexOf(r);if(u===-1||c===-1)return null;const[i,f]=u<=c?[u,c]:[c,u],h=u<=c?s:a,b=u<=c?a:s,p=l.slice(0,i).map(S=>e.getRun(S)),k=l.slice(f+1).map(S=>e.getRun(S)),C=l.slice(i,f+1).map(S=>e.getRun(S)),v=[];let I=null,B=0;if(i===f){const S=C[0];if(S.type==="text"){const T=Math.max(0,Math.min(h,b)),j=Math.min(S.value.length,Math.max(h,b)),L={...S,value:S.value.slice(0,T)+S.value.slice(j)};v.push(L),I=L.id,B=T}}else C.forEach((S,T)=>{if(S.type!=="text")return;const j=T===0,L=T===C.length-1,w=j?S.value.slice(0,h):"";if(j&&w){const O={...S,value:w};v.push(O),I=O.id,B=w.length}if(L&&!j){const O=S.value.slice(b);if(O){const x={id:m.genId(),type:"text",value:O,marks:S.marks};v.push(x),I===null&&(I=x.id,B=0)}}});let R=[...p,...v,...k];if(R.length===0){const S=ae();R=[S],I=S.id,B=0}else if(I===null){const S=p[p.length-1];S?(I=S.id,B=S.type==="text"?S.value.length:0):k[0]&&(I=k[0].id,B=0)}return e.applyOperation(m.setBlockRuns(t,R)),{blockId:t,runId:I,offset:B}}function Ee(e,t){const{blockIds:n,startBlockId:o,startRunId:s,startOffset:r,endBlockId:a,endRunId:l,endOffset:u}=t;if(!n||n.length===0)return null;const c=n.indexOf(o),i=n.indexOf(a);if(c===-1||i===-1)return null;const[f,h]=c<=i?[c,i]:[i,c],b=c<=i,p=b?s:l,k=b?r:u,C=b?l:s,v=b?u:r;if(f===h)return Te(e,n[f],{startRunId:p,startOffset:k,endRunId:C,endOffset:v});const I=n[f],B=n[h],R=e.getBlock(I),S=e.getBlock(B),T=Ce(e,I),j=T.indexOf(p),L=T.slice(0,j).map(U=>e.getRun(U)),w=e.getRun(p),O=w.type==="text"&&k>0?{...w,value:w.value.slice(0,k)}:null,x=Ce(e,B),A=x.indexOf(C),D=x.slice(A+1).map(U=>e.getRun(U)),N=e.getRun(C),_=N.type==="text"&&v<N.value.length?{id:m.genId(),type:"text",value:N.value.slice(v),marks:N.marks}:null,F=[...L,...O?[O]:[]],M=[..._?[_]:[],...D],P=[];for(let U=f+1;U<h;U+=1)P.push(m.removeBlock(n[U]));const V=y.canMergeTypes(R.type,S.type),J=e.getBlock(R.parentId),Wt=h-f-1+(V?1:0),Gt=J&&J.contentIds.length-Wt===1;let q,W,me;if(V){const U=[...F,...M];if(U.length===0&&Gt&&R.type!=="paragraph"){const{block:Y,runs:Yt}=E.createTextLeafBlock("paragraph")(J.id);return P.push({type:"insertBlock",block:Y,parentId:J.id,index:0,subtree:{blocks:[Y],runs:Yt}}),P.push(m.removeBlock(I)),P.push(m.removeBlock(B)),ve(e,P),{blockId:Y.id,runId:Y.contentIds[0],offset:0}}const ee=U.length?U:[ae()];if(P.push(m.setBlockRuns(I,ee)),P.push(m.removeBlock(B)),me=I,O)q=O.id,W=O.value.length;else if(L.length){const Y=L[L.length-1];q=Y.id,W=Y.type==="text"?Y.value.length:0}else _?(q=_.id,W=0):D.length?(q=D[0].id,W=0):(q=ee[0].id,W=0)}else{const U=F.length?F:[ae()];if(P.push(m.setBlockRuns(I,U)),P.push(m.setBlockRuns(B,M.length?M:[ae()])),me=I,O)q=O.id,W=O.value.length;else if(L.length){const ee=L[L.length-1];q=ee.id,W=ee.type==="text"?ee.value.length:0}else q=U[0].id,W=0}return ve(e,P),{blockId:me,runId:q,offset:W}}function ue(e,t=""){var l;const n=e.getRootId(),o=((l=e.getBlock(n))==null?void 0:l.contentIds)??[];if(o.length===0)return null;const s=o.map(u=>m.removeBlock(u)),{block:r,runs:a}=E.createTextLeafBlock("paragraph")(n);return t&&(a[0].value=t),s.push(m.insertBlock(r,n,0,{blocks:[r],runs:a})),ve(e,s),{blockId:r.id,runId:r.contentIds[0],offset:t.length}}function he(e){return(e==null?void 0:e.tagName)==="INPUT"||(e==null?void 0:e.tagName)==="TEXTAREA"}function de(e){var n;let t=(e==null?void 0:e.nodeType)===1?e:e==null?void 0:e.parentElement;for(;t&&typeof t.hasAttribute=="function"&&!t.hasAttribute("data-block-id");)t=t.parentElement;return((n=t==null?void 0:t.getAttribute)==null?void 0:n.call(t,"data-block-id"))??null}function gn(e){var f;const t=(f=window.getSelection)==null?void 0:f.call(window);if(!t||t.rangeCount===0)return[];const n=de(t.anchorNode),o=de(t.focusNode);if(!n)return[];if(!o||n===o)return[n];const s=e.getBlock(n),r=s&&e.getBlock(s.parentId);if(!r)return[n];const a=r.contentIds,l=a.indexOf(n),u=a.indexOf(o);if(l===-1||u===-1)return[n];const[c,i]=l<=u?[l,u]:[u,l];return a.slice(c,i+1)}function be(e){const t=E.resolveMultiRunSelection();if(t)return Te(e,t.blockId,t);const n=E.resolveCrossBlockSelection(e);return n?Ee(e,n):null}function kn(e,t,n){const o=e.getRun(t.runId);if(!o||o.type!=="text")return null;const s=o.value??"",r=s.slice(0,t.offset)+n+s.slice(t.offset);return e.applyOperation(m.updateRun(o.id,{value:r})),{blockId:t.blockId,runId:o.id,offset:t.offset+n.length}}function te(e,t){if(typeof e.performBatch=="function")e.performBatch(t);else for(const n of t)e.applyOperation(n)}function kt(){const e=m.useEditorStore(),t=m.useBlockRegistry(),n=m.useInlineRegistry(),{uploadFile:o,maxFileSize:s}=m.useFileUpload(),[r,a]=m.useWholeDocumentSelection(),[l,u]=m.useBlockRangeSelection(),c=g.useCallback(b=>{var I;if(he(b.target))return;const p=r?((I=e.getBlock(e.getRootId()))==null?void 0:I.contentIds)??[]:l.length>0?l:gn(e);if(p.length===0)return;const{html:k,text:C,json:v}=se.serializeBlockRange(e,t,p,n);b.clipboardData.setData("text/plain",C),b.clipboardData.setData("text/html",k),b.clipboardData.setData(ie,v),b.preventDefault()},[e,t,n,r,l]),i=g.useCallback(b=>{if(he(b.target))return;if(c(b),r){const k=ue(e);a(!1),k!=null&&k.runId&&E.focusRunAtOffset(k.runId,k.offset);return}if(l.length>0){le(e,l),u([]);return}const p=be(e);p!=null&&p.runId&&E.focusRunAtOffset(p.runId,p.offset)},[c,e,r,a,l,u]),f=g.useCallback(async b=>{var T,j,L;const k=(await Promise.allSettled(b.map(w=>y.resolveFileToEmbedInsert(w,{uploadFile:o,maxFileSize:s})))).filter(w=>w.status==="fulfilled").map(w=>w.value);if(k.length===0)return;if(r){const w=e.getRootId(),x=(((T=e.getBlock(w))==null?void 0:T.contentIds)??[]).map(D=>m.removeBlock(D));let A=0;for(const{block:D,runs:N,subtreeBlocks:_=[]}of k)D.parentId=w,x.push(m.insertBlock(D,w,A,{blocks:[D,..._],runs:N})),A+=1;te(e,x),a(!1);return}if(l.length>0){const w=e.getBlock(l[0]),O=(w==null?void 0:w.parentId)??null,x=O&&e.getBlock(O);let A=x?x.contentIds.indexOf(l[0]):0;const D=l.map(N=>m.removeBlock(N));for(const{block:N,runs:_,subtreeBlocks:F=[]}of k)N.parentId=O,D.push(m.insertBlock(N,O,A,{blocks:[N,...F],runs:_})),A+=1;te(e,D),u([]);return}const C=be(e),v=(C==null?void 0:C.blockId)??de((L=(j=window.getSelection)==null?void 0:j.call(window))==null?void 0:L.anchorNode);if(!v)return;const I=e.getBlock(v);if(!I)return;let R=e.getBlock(I.parentId).contentIds.indexOf(v)+1;const S=[];for(const{block:w,runs:O,subtreeBlocks:x=[]}of k)w.parentId=I.parentId,S.push(m.insertBlock(w,I.parentId,R,{blocks:[w,...x],runs:O})),R+=1;te(e,S)},[e,o,s,r,a,l,u]),h=g.useCallback(b=>{var j,L,w,O;if(he(b.target))return;const p=Array.from(((j=b.clipboardData)==null?void 0:j.files)??[]);if(p.length>0){b.preventDefault(),f(p);return}const k=gt(b.clipboardData,t,n);if(k.length===0)return;if(r){const x=e.getRootId(),D=(((L=e.getBlock(x))==null?void 0:L.contentIds)??[]).map(_=>m.removeBlock(_));let N=0;for(const{block:_,runs:F,subtreeBlocks:M=[]}of k)_.parentId=x,D.push(m.insertBlock(_,x,N,{blocks:[_,...M],runs:F})),N+=1;te(e,D),a(!1),b.preventDefault();return}if(l.length>0){const x=e.getBlock(l[0]),A=(x==null?void 0:x.parentId)??null,D=A&&e.getBlock(A);let N=D?D.contentIds.indexOf(l[0]):0;const _=l.map(F=>m.removeBlock(F));for(const{block:F,runs:M,subtreeBlocks:P=[]}of k)F.parentId=A,_.push(m.insertBlock(F,A,N,{blocks:[F,...P],runs:M})),N+=1;te(e,_),u([]),b.preventDefault();return}const C=be(e);if(k.length===1&&k[0].runs.every(x=>x.type==="text")&&(k[0].subtreeBlocks??[]).length===0){const x=C?{blockId:C.blockId,runId:C.runId,offset:C.offset}:E.resolveCollapsedCaret();if(x){const A=k[0].runs.map(N=>N.value).join(""),D=kn(e,x,A);if(D){E.focusRunAtOffset(D.runId,D.offset),b.preventDefault();return}}}const I=(C==null?void 0:C.blockId)??de((O=(w=window.getSelection)==null?void 0:w.call(window))==null?void 0:O.anchorNode);if(!I)return;const B=e.getBlock(I);if(!B)return;let S=e.getBlock(B.parentId).contentIds.indexOf(I)+1;const T=[];for(const{block:x,runs:A,subtreeBlocks:D=[]}of k)x.parentId=B.parentId,T.push(m.insertBlock(x,B.parentId,S,{blocks:[x,...D],runs:A})),S+=1;te(e,T),b.preventDefault()},[e,t,n,r,a,l,u,f]);return{onCopy:c,onCut:i,onPaste:h}}const yn=["bold","italic","underline","strike","subscript","superscript","code"],In=["color","highlight","link"];function ne(e,t){var o;const n=e.getBlock(t);return((o=n.props)==null?void 0:o.titleRunIds)??n.contentIds}function Cn(e,t){return e===t?!0:e&&t&&typeof e=="object"?JSON.stringify(e)===JSON.stringify(t):!1}function yt(e){var n;const t={};if(e.length===0)return t;for(const o of yn)t[o]=e.every(s=>{var r;return(r=s.marks)==null?void 0:r[o]});for(const o of In){const s=((n=e[0].marks)==null?void 0:n[o])??null;t[o]=e.every(r=>{var a;return Cn(((a=r.marks)==null?void 0:a[o])??null,s)})?s:null}return t}function Oe(e,t,n){const{startRunId:o,startOffset:s,endRunId:r,endOffset:a}=n,l=ne(e,t),u=l.indexOf(o),c=l.indexOf(r);if(u===-1||c===-1)return{};const[i,f]=u<=c?[u,c]:[c,u],h=l.slice(i,f+1).map(b=>e.getRun(b)).filter(b=>b&&b.type==="text");return yt(h)}function Le(e,t){const{blockIds:n,startBlockId:o,endBlockId:s}=t,r=n.indexOf(o),a=n.indexOf(s);if(r===-1||a===-1)return{};const[l,u]=r<=a?[r,a]:[a,r],c=[];for(let i=l;i<=u;i+=1)for(const f of ne(e,n[i])){const h=e.getRun(f);h&&h.type==="text"&&c.push(h)}return yt(c)}function It(e,t){const n={...e};for(const[o,s]of Object.entries(t))s!=null?n[o]=s:delete n[o];return n}function Ct(e,t,n,o,s,r){const a=It(n.marks,r);if(o===0&&s===n.value.length)return e.applyOperation({type:"updateRun",id:n.id,patch:{marks:a}}),n.id;const l=n.value.slice(0,o),u=n.value.slice(o,s),c=n.value.slice(s),i=[];l&&i.push({id:m.genId(),type:"text",value:l,marks:{...n.marks}});const f={id:m.genId(),type:"text",value:u,marks:a};return i.push(f),c&&i.push({id:m.genId(),type:"text",value:c,marks:{...n.marks}}),e.applyOperation(m.replaceRunSpan(t,[n.id],i)),f.id}function vn(e,t,n,o){const{startRunId:s,startOffset:r,endRunId:a,endOffset:l}=n,u=ne(e,t),c=u.indexOf(s),i=u.indexOf(a);if(c===-1||i===-1)return null;const[f,h]=c<=i?[c,i]:[i,c],b=c<=i?r:l,p=c<=i?l:r,k=u.slice(f,h+1),C=k.map(B=>e.getRun(B));if(f===h){const B=C[0];if(B.type!=="text")return B.id;const R=Math.max(0,Math.min(b,p)),S=Math.min(B.value.length,Math.max(b,p));return R===S?B.id:Ct(e,t,B,R,S,o)}const v=[];let I=null;return C.forEach((B,R)=>{if(B.type!=="text"){v.push(B),I=B.id;return}const S=R===0,T=R===C.length-1,j=S?b:0,L=T?p:B.value.length,w=B.value.slice(0,j),O=B.value.slice(j,L),x=B.value.slice(L);w&&v.push({id:m.genId(),type:"text",value:w,marks:{...B.marks}});const A={id:m.genId(),type:"text",value:O,marks:It(B.marks,o)};v.push(A),I=A.id,x&&v.push({id:m.genId(),type:"text",value:x,marks:{...B.marks}})}),e.applyOperation(m.replaceRunSpan(t,k,v)),I}function Bn(e,t,n,o){var p;const{startRunId:s,startOffset:r,endRunId:a,endOffset:l}=n,u=ne(e,t),c=u.indexOf(s),i=u.indexOf(a);if(c===-1||i===-1)return!0;const[f,h]=c<=i?[c,i]:[i,c],b=u.slice(f,h+1).map(k=>e.getRun(k)).filter(k=>k.type==="text");if(b.length===0)return!0;if(f===h){const k=Math.max(0,Math.min(r,l)),C=Math.min(b[0].value.length,Math.max(r,l));if(k===C)return!((p=b[0].marks)!=null&&p[o])}return!b.every(k=>{var C;return(C=k.marks)==null?void 0:C[o]})}function xn(e,t,n,o,s,r){var f;const a=e.getRun(n),l=a.value??"",u=Math.max(0,Math.min(o,s)),c=Math.min(l.length,Math.max(o,s));if(u===c)return n;const i=!((f=a.marks)!=null&&f[r]);return Ct(e,t,a,u,c,{[r]:i?!0:null})}function oe(e,t,n,o){return vn(e,t,n,o)}function Me(e,t,n,o){const s=Bn(e,t,n,o);return oe(e,t,n,{[o]:s?!0:null})}function je(e,t,n){return fe(e,t,o=>({[n]:o?null:!0}),n)}function fe(e,t,n,o){var T;const{blockIds:s,startBlockId:r,startRunId:a,startOffset:l,endBlockId:u,endRunId:c,endOffset:i}=t;if(!s||s.length===0)return null;const f=s.indexOf(r),h=s.indexOf(u);if(f===-1||h===-1)return null;const[b,p]=f<=h?[f,h]:[h,f],k=f<=h,C=k?a:c,v=k?l:i,I=k?c:a,B=k?i:l;let R=n;if(typeof n=="function"){let j=!1,L=!0;for(let w=b;w<=p;w+=1){const O=ne(e,s[w]).map(x=>e.getRun(x)).filter(x=>x.type==="text");O.length!==0&&(j=!0,O.every(x=>{var A;return(A=x.marks)==null?void 0:A[o]})||(L=!1))}R=n(j&&L)}if(b===p)return oe(e,s[b],{startRunId:C,startOffset:v,endRunId:I,endOffset:B},R);let S=null;for(let j=b;j<=p;j+=1){const L=s[j],w=ne(e,L),O=w[0],x=w[w.length-1],A=e.getRun(x),D=((T=A==null?void 0:A.value)==null?void 0:T.length)??0;let N;j===b&&j===p?N={startRunId:C,startOffset:v,endRunId:I,endOffset:B}:j===b?N={startRunId:C,startOffset:v,endRunId:x,endOffset:D}:j===p?N={startRunId:O,startOffset:0,endRunId:I,endOffset:B}:N={startRunId:O,startOffset:0,endRunId:x,endOffset:D},S=oe(e,L,N,R)}return S}function vt(e,t){var o;const n=e.getBlock(t);return((o=n==null?void 0:n.props)==null?void 0:o.titleRunIds)??(n==null?void 0:n.contentIds)??[]}function Bt(e){const t=E.resolveMultiRunSelection();if(!t)return!1;const{blockId:n,startRunId:o,startOffset:s,endRunId:r,endOffset:a}=t,l=vt(e,n);if(l.length===0)return!1;const u=l.indexOf(o),c=l.indexOf(r);if(u===-1||c===-1)return!1;const[i,f]=u<=c?[u,c]:[c,u],h=u<=c?s:a,b=u<=c?a:s;if(i!==0||f!==l.length-1||h!==0)return!1;const p=e.getRun(l[l.length-1]),k=(p==null?void 0:p.type)==="text"?(p.value??"").length:1;return b===k}function Sn(e){const t=E.resolveCollapsedCaret();return t?y.isRunsEmpty(e,vt(e,t.blockId)):!1}function Rn(e,t,n){var b,p;const o=e.getBlock(t);if(!o){n(null);return}const s=e.getBlock(o.parentId),r=s?s.contentIds.indexOf(t):-1,a=r>0?s.contentIds[r-1]:null,l=r!==-1&&r<s.contentIds.length-1?s.contentIds[r+1]:null;e.applyOperation(m.removeBlock(t)),n(null);const u=y.ensureRootNonEmpty(e),c=a??l??u;if(!c)return;const i=e.getBlock(c);if(y.isContentlessBlock(e,i)){n(c),requestAnimationFrame(()=>{var k;return(k=document.querySelector(`[data-block-id="${c}"]`))==null?void 0:k.focus()});return}const f=(b=i==null?void 0:i.props)==null?void 0:b.titleRunIds,h=((p=i==null?void 0:i.contentIds)==null?void 0:p[i.contentIds.length-1])??(f==null?void 0:f[f.length-1]);h&&E.focusRunEnd(h)}const Fe={b:"bold",i:"italic",u:"underline"};function xt(e){const t=m.useEditorStore(),[n,o]=m.useWholeDocumentSelection(),{getSelectedBlockId:s,setSelectedBlockId:r}=m.useSelectedBlock();g.useEffect(()=>{const a=e.current;if(!a)return;const l=c=>{var f,h;if(s()&&(c.key==="Backspace"||c.key==="Delete")&&!c.defaultPrevented){c.preventDefault(),c.stopPropagation(),Rn(t,s(),r);return}if(s()&&c.key!=="Backspace"&&c.key!=="Delete"&&r(null),c.metaKey||c.ctrlKey){const b=c.key.toLowerCase();if(b==="z"&&!c.shiftKey){c.preventDefault(),(f=t.undo)!=null&&f.call(t)&&G.restoreSelectionAfterHistoryChange(t);return}if(b==="z"&&c.shiftKey||b==="y"){c.preventDefault(),(h=t.redo)!=null&&h.call(t)&&G.restoreSelectionAfterHistoryChange(t);return}if(b==="a"){if(n)return;(Bt(t)||Sn(t))&&(c.preventDefault(),o(!0));return}if(Fe[b]){if(n)return;c.preventDefault();const p=Fe[b],k=E.resolveMultiRunSelection();if(k){const v=Me(t,k.blockId,k,p);v&&E.focusRunEnd(v);return}const C=E.resolveCrossBlockSelection(t);if(C){const v=je(t,C,p);v&&E.focusRunEnd(v)}}return}if(n){if(c.key==="Backspace"||c.key==="Delete"){c.preventDefault(),c.stopPropagation();const b=ue(t);o(!1),b!=null&&b.runId&&E.focusRunAtOffset(b.runId,b.offset);return}if(c.key.length===1){c.preventDefault(),c.stopPropagation();const b=ue(t,c.key);o(!1),b!=null&&b.runId&&E.focusRunAtOffset(b.runId,b.offset);return}if(o(!1),c.key==="Escape")return}if(c.key==="Backspace"||c.key==="Delete"){const b=E.resolveCrossBlockSelection(t);if(!b)return;c.preventDefault(),c.stopPropagation();const p=Ee(t,b);p!=null&&p.runId&&E.focusRunAtOffset(p.runId,p.offset)}},u=()=>{n&&o(!1),s()&&r(null)};return a.addEventListener("keydown",l),a.addEventListener("mousedown",u),()=>{a.removeEventListener("keydown",l),a.removeEventListener("mousedown",u)}},[e,t,n,o,s,r])}function wn(e,t){const n=m.useEditorStore(),o=m.useBlockRegistry(),s=m.useInlineRegistry(),r=g.useMemo(()=>(e??[]).filter(l=>l&&(l.keymap||l.onBeforeInput||l.onPaste||l.setup)),[e]),a=g.useMemo(()=>({store:n,registry:o,inlineRegistry:s,get container(){return t.current},getBlock:l=>n.getBlock(l),getRun:l=>n.getRun(l),getRootId:()=>n.getRootId(),applyOperation:l=>X.flushSync(()=>n.applyOperation(l)),applyOperations:l=>X.flushSync(()=>{if(typeof n.performBatch=="function")n.performBatch(l);else for(const u of l)n.applyOperation(u)}),getSelection:()=>E.resolveRunSelection(),getCaret:()=>E.resolveCollapsedCaret(),setCaret:(l,u)=>E.setCaretSync(l,u),subscribe:l=>n.subscribeAll(l)}),[n,o,s,t]);g.useEffect(()=>{const l=t.current;if(!l||r.length===0)return;const u=r.filter(p=>p.keymap),c=r.filter(p=>p.onBeforeInput),i=r.filter(p=>p.onPaste),f=p=>{for(const k of u)for(const[C,v]of Object.entries(k.keymap))if(Tn(p,C)&&v(a,p)){p.preventDefault(),p.stopImmediatePropagation();return}},h=p=>{for(const k of c)if(k.onBeforeInput(a,p)){p.preventDefault(),p.stopImmediatePropagation();return}},b=p=>{for(const k of i)if(k.onPaste(a,p)){p.preventDefault(),p.stopImmediatePropagation();return}};return u.length&&l.addEventListener("keydown",f),c.length&&l.addEventListener("beforeinput",h),i.length&&l.addEventListener("paste",b),()=>{l.removeEventListener("keydown",f),l.removeEventListener("beforeinput",h),l.removeEventListener("paste",b)}},[r,t,a]),g.useEffect(()=>{const l=r.filter(u=>u.setup).map(u=>u.setup(a)).filter(u=>typeof u=="function");return()=>{for(const u of l)u()}},[r,a])}function Tn(e,t){const n=String(t).split("-"),o=n.pop().toLowerCase(),s=new Set(n.map(a=>a.toLowerCase())),r=e.metaKey||e.ctrlKey;return s.has("mod")!==r||s.has("shift")!==e.shiftKey||s.has("alt")!==e.altKey?!1:e.key.toLowerCase()===o}const En=4;function On(e,t,n){const o=e.getBlock(t);if(!o)return[];const s=e.getBlock(o.parentId);if(!s)return[t];const r=s.contentIds,a=r.indexOf(t),l=n?r.indexOf(n):a;if(a===-1)return[t];const[u,c]=l===-1?[a,a]:[Math.min(a,l),Math.max(a,l)];return r.slice(u,c+1)}function Ln(){var e,t;return typeof window<"u"&&((t=(e=window.matchMedia)==null?void 0:e.call(window,"(pointer: coarse)"))==null?void 0:t.matches)===!0}function St(e){const t=m.useEditorStore(),[,n]=m.useBlockRangeSelection(),o=g.useRef(null),s=g.useRef(!1),r=g.useRef(null),a=g.useCallback(i=>{var b,p,k,C,v;if(!o.current)return;if(!s.current){const{x:I,y:B}=r.current??{x:i.clientX,y:i.clientY};if(Math.hypot(i.clientX-I,i.clientY-B)<En)return;s.current=!0,document.documentElement.classList.add("be-block-range-dragging"),(p=(b=window.getSelection)==null?void 0:b.call(window))==null||p.removeAllRanges()}(C=(k=window.getSelection)==null?void 0:k.call(window))==null||C.removeAllRanges(),i.preventDefault();const f=(v=document.elementFromPoint(i.clientX,i.clientY))==null?void 0:v.closest("[data-block-row-id]"),h=(f==null?void 0:f.getAttribute("data-block-row-id"))??null;n(On(t,o.current,h))},[t,n]),l=g.useCallback(()=>{o.current=null,s.current=!1,r.current=null,document.documentElement.classList.remove("be-block-range-dragging")},[]),u=g.useCallback((i,f)=>{o.current=i,s.current=!1,r.current={x:f.clientX,y:f.clientY}},[]),c=g.useCallback(i=>{var k,C;if(i.button!==0||Ln()||(C=(k=i.target).closest)!=null&&C.call(k,"button, input, textarea, select"))return;const f=i.target.closest("[data-block-row-id]");if(f){if(i.target.closest(".be-block-row-content"))return;u(f.getAttribute("data-block-row-id"),i);return}const h=e==null?void 0:e.current;if(!h)return;const p=[...h.querySelectorAll("[data-block-row-id]")].find(v=>{const I=v.getBoundingClientRect();return i.clientY>=I.top&&i.clientY<=I.bottom});p&&u(p.getAttribute("data-block-row-id"),i)},[e,u]);g.useEffect(()=>(document.addEventListener("mousedown",c),document.addEventListener("mousemove",a),document.addEventListener("mouseup",l),()=>{document.removeEventListener("mousedown",c),document.removeEventListener("mousemove",a),document.removeEventListener("mouseup",l),document.documentElement.classList.remove("be-block-range-dragging")}),[c,a,l])}const Mn=340;function jn(e,t,n,o){g.useEffect(()=>{if(!e||!t)return;const s=document.querySelector(`[data-run-id="${t}"]`);if(s)return s.setAttribute("aria-expanded","true"),s.setAttribute("aria-haspopup","listbox"),s.setAttribute("aria-controls",o),n&&s.setAttribute("aria-activedescendant",n),()=>{s.removeAttribute("aria-expanded"),s.removeAttribute("aria-haspopup"),s.removeAttribute("aria-controls"),s.removeAttribute("aria-activedescendant")}},[e,t,n,o])}function ce({isOpen:e,rect:t,commands:n,runId:o,onSelect:s,onClose:r,menuId:a="be-slash-menu",ariaLabel:l="Slash commands"}){const[u,c]=g.useState(0),i=g.useRef(null),f=g.useRef(null),h=y.useVirtualKeyboardInset(),b=Z.useHorizontalAutoAdjustedLeft(f,e&&n.length>0&&!!t,t==null?void 0:t.left);g.useEffect(()=>{c(0)},[n.length]),g.useEffect(()=>{var B,R;(R=(B=i.current)==null?void 0:B.scrollIntoView)==null||R.call(B,{block:"nearest"})},[u]),g.useEffect(()=>{if(!e)return;const B=R=>{R.key==="ArrowDown"?(R.preventDefault(),R.stopPropagation(),c(S=>Math.min(S+1,Math.max(n.length-1,0)))):R.key==="ArrowUp"?(R.preventDefault(),R.stopPropagation(),c(S=>Math.max(S-1,0))):R.key==="Enter"?(R.preventDefault(),R.stopPropagation(),n[u]&&s(n[u])):R.key==="Escape"&&(R.preventDefault(),R.stopPropagation(),r())};return document.addEventListener("keydown",B,!0),()=>document.removeEventListener("keydown",B,!0)},[e,n,u,s,r]);const k=n[u]?`${a}-option-${u}`:null;if(jn(e,o,k,a),!e||n.length===0||!t||b==null)return null;const C=window.innerHeight-h,I=t.bottom+Mn>C?{bottom:window.innerHeight-t.top+4}:{top:t.bottom+4};return d.jsx("div",{ref:f,id:a,role:"listbox","aria-label":l,className:"be-slash-menu",style:{position:"fixed",left:b,zIndex:1e3,...I},children:n.map((B,R)=>{const S=B.icon;return d.jsxs("div",{ref:R===u?i:void 0,id:`${a}-option-${R}`,role:"option","aria-selected":R===u,className:`be-slash-menu-item${R===u?" be-slash-menu-item-active":""}`,onMouseDown:T=>{T.preventDefault(),s(B)},onMouseEnter:()=>c(R),children:[S&&d.jsx("span",{className:"be-slash-menu-item-icon",children:d.jsx(S,{size:16})}),d.jsx("span",{className:"be-slash-menu-item-label",children:B.label})]},B.label)})})}function An(e,t){var o;if(!t)return!0;const n=t.toLowerCase();return e.label.toLowerCase().includes(n)||((o=e.keywords)==null?void 0:o.some(s=>s.toLowerCase().includes(n)))}function Dn(e,t){const n=t.anchorNode,o=t.anchorOffset;let s;if(n===e){s="";for(let r=0;r<o&&r<e.childNodes.length;r+=1)s+=e.childNodes[r].textContent??""}else n&&n.parentElement===e?s=(n.textContent??"").slice(0,o):s=e.textContent??"";return E.stripEmptyRunPlaceholder(s).length}function Ae(e,t,n){const o=m.useEditorStore(),[s,r]=g.useState(null);g.useEffect(()=>{const c=e.current;if(!c)return;const i=()=>{var S,T,j,L;const h=(S=window.getSelection)==null?void 0:S.call(window),b=h==null?void 0:h.anchorNode;let p=(b==null?void 0:b.nodeType)===1?b:b==null?void 0:b.parentElement;for(;p&&typeof p.hasAttribute=="function"&&!p.hasAttribute("data-run-id");)p=p.parentElement;const k=(T=p==null?void 0:p.getAttribute)==null?void 0:T.call(p,"data-run-id");if(!k||!h){r(null);return}const C=Dn(p,h),v=E.stripEmptyRunPlaceholder(p.textContent).slice(0,C),I=t.exec(v);if(!I){r(null);return}const B=(L=(j=p.closest)==null?void 0:j.call(p,"[data-block-id]"))==null?void 0:L.getAttribute("data-block-id");if(!B){r(null);return}const R=I.index+I[1].length;r({query:I[2],blockId:B,runId:k,sliceStart:R,sliceEnd:C,rect:p.getBoundingClientRect()})},f=h=>{h.key==="Escape"&&r(null)};return c.addEventListener("input",i),c.addEventListener("keydown",f),()=>{c.removeEventListener("input",i),c.removeEventListener("keydown",f)}},[e,t]);const a=s?n().filter(c=>An(c,s.query)):[],l=g.useCallback(c=>{s&&(c.run(o,{blockId:s.blockId,runId:s.runId,sliceStart:s.sliceStart,sliceEnd:s.sliceEnd}),r(null))},[s,o]),u=g.useCallback(()=>r(null),[]);return{isOpen:!!s,query:(s==null?void 0:s.query)??"",rect:(s==null?void 0:s.rect)??null,runId:(s==null?void 0:s.runId)??null,commands:a,selectCommand:l,close:u}}const Nn=/(^|\s)\/(\w*)$/;function Rt(e){const t=m.useBlockRegistry(),n=m.useInlineRegistry(),o=g.useCallback(()=>[...t.listSlashCommands(),...(n==null?void 0:n.listSlashCommands())??[]],[t,n]);return Ae(e,Nn,o)}const Pn=[{char:"πŸ˜€",name:"grinning face",keywords:["smile","happy"]},{char:"πŸ˜‚",name:"face with tears of joy",keywords:["laugh","lol"]},{char:"😍",name:"heart eyes",keywords:["love","crush"]},{char:"😎",name:"cool",keywords:["sunglasses"]},{char:"πŸ€”",name:"thinking face",keywords:["hmm"]},{char:"πŸ˜‰",name:"winking face",keywords:["wink"]},{char:"😒",name:"crying face",keywords:["sad","tear"]},{char:"😑",name:"angry face",keywords:["mad","rage"]},{char:"😱",name:"screaming face",keywords:["shock","scared"]},{char:"πŸ₯³",name:"party face",keywords:["celebrate","birthday"]},{char:"πŸ™",name:"folded hands",keywords:["please","pray","thanks"]},{char:"πŸ‘",name:"thumbs up",keywords:["approve","yes","like"]},{char:"πŸ‘Ž",name:"thumbs down",keywords:["disapprove","no"]},{char:"πŸ‘",name:"clapping hands",keywords:["applause","congrats"]},{char:"πŸ™Œ",name:"raised hands",keywords:["hooray","yay"]},{char:"πŸ‘‹",name:"waving hand",keywords:["hello","bye"]},{char:"✌️",name:"victory hand",keywords:["peace"]},{char:"πŸ’ͺ",name:"flexed biceps",keywords:["strong","muscle"]},{char:"🀝",name:"handshake",keywords:["deal","agree"]},{char:"❀️",name:"red heart",keywords:["love"]},{char:"πŸ”₯",name:"fire",keywords:["hot","lit"]},{char:"⭐",name:"star",keywords:["favorite"]},{char:"✨",name:"sparkles",keywords:["shiny","magic"]},{char:"πŸŽ‰",name:"party popper",keywords:["celebrate","congrats"]},{char:"🎊",name:"confetti ball",keywords:["celebrate"]},{char:"πŸ’‘",name:"light bulb",keywords:["idea","tip"]},{char:"βœ…",name:"check mark",keywords:["done","yes","complete"]},{char:"❌",name:"cross mark",keywords:["no","wrong","delete"]},{char:"⚠️",name:"warning",keywords:["caution","alert"]},{char:"❓",name:"question mark",keywords:["question","help"]},{char:"❗",name:"exclamation mark",keywords:["important","alert"]},{char:"πŸš€",name:"rocket",keywords:["launch","fast","ship"]},{char:"πŸ›",name:"bug",keywords:["bug","issue"]},{char:"πŸ”§",name:"wrench",keywords:["fix","tool","settings"]},{char:"πŸ“Œ",name:"pushpin",keywords:["pin","note"]},{char:"πŸ“Ž",name:"paperclip",keywords:["attachment","clip"]},{char:"πŸ“…",name:"calendar",keywords:["date","schedule"]},{char:"⏰",name:"alarm clock",keywords:["time","reminder"]},{char:"πŸ“ˆ",name:"chart increasing",keywords:["growth","stats"]},{char:"πŸ“‰",name:"chart decreasing",keywords:["decline","stats"]},{char:"πŸ’°",name:"money bag",keywords:["money","cash"]},{char:"πŸ’¬",name:"speech balloon",keywords:["comment","chat"]},{char:"πŸ“",name:"memo",keywords:["note","write"]},{char:"πŸ“š",name:"books",keywords:["reading","docs"]},{char:"πŸ”—",name:"link",keywords:["url","chain"]},{char:"πŸ”’",name:"locked",keywords:["private","secure"]},{char:"πŸ”‘",name:"key",keywords:["password","access"]},{char:"β˜•",name:"coffee",keywords:["coffee","break"]},{char:"πŸ•",name:"pizza",keywords:["food"]},{char:"πŸŽ‚",name:"birthday cake",keywords:["birthday","cake"]},{char:"🎁",name:"gift",keywords:["present"]},{char:"🌟",name:"glowing star",keywords:["star","shiny"]},{char:"🌈",name:"rainbow",keywords:["colorful"]},{char:"β˜€οΈ",name:"sun",keywords:["sunny","weather"]},{char:"🌧️",name:"rain cloud",keywords:["rainy","weather"]},{char:"🐢",name:"dog face",keywords:["dog","pet"]},{char:"🐱",name:"cat face",keywords:["cat","pet"]},{char:"🌍",name:"globe",keywords:["world","earth"]},{char:"🎯",name:"direct hit",keywords:["target","goal"]},{char:"πŸ†",name:"trophy",keywords:["win","award"]},{char:"πŸ•",name:"clock",keywords:["time"]},{char:"πŸ“£",name:"megaphone",keywords:["announce","shout"]},{char:"🧠",name:"brain",keywords:["smart","idea","mind"]},{char:"πŸ‘€",name:"eyes",keywords:["look","watching"]}];function _n(e,{runId:t,sliceStart:n,sliceEnd:o},s){const r=e.getRun(t),a=(r==null?void 0:r.value)??"",l=a.slice(0,n)+s+a.slice(o);e.applyOperation(m.updateRun(t,{value:l})),E.focusRunAtOffset(t,n+s.length)}const Fn=Pn.map(({char:e,name:t,keywords:n})=>({label:`${e} ${t}`,keywords:n,run:(o,s)=>_n(o,s,e)})),Hn=/(^|\s):(\w*)$/,$n=()=>Fn;function wt(e){return Ae(e,Hn,$n)}const Un=/(^|\s)@(\w*)$/;function Tt(e){const t=m.useInlineRegistry(),n=g.useCallback(()=>(t==null?void 0:t.listAtCommands())??[],[t]);return Ae(e,Un,n)}function De(e,t,n,o,s){const[r,a]=g.useState(!1),l=g.useCallback(C=>{const v=t==="same-block"?oe(e,n.blockId,n,C):fe(e,o,C);return v&&E.focusRunEnd(v),v},[e,t,n,o]),u=g.useCallback(C=>{const v=t==="same-block"?Me(e,n.blockId,n,C):je(e,o,C);v&&E.focusRunEnd(v)},[e,t,n,o]),c=g.useCallback(C=>{const v=C==="subscript"?"superscript":"subscript",I=!s[C];l({[C]:I?!0:null,[v]:null})},[s,l]),i=g.useRef(null),f=g.useCallback(()=>{i.current={kind:t,selection:n,crossSelection:o},a(!0)},[t,n,o]),h=g.useCallback(()=>a(!1),[]),b=g.useCallback(C=>{const v=i.current;if(!v)return;const I=v.kind==="same-block"?oe(e,v.selection.blockId,v.selection,C):fe(e,v.crossSelection,C);I&&E.focusRunEnd(I),a(!1)},[e]),p=g.useCallback((C,v)=>b({link:{href:C,target:v}}),[b]),k=g.useCallback(()=>b({link:null}),[b]);return{applyPatch:l,toggleBoolean:u,setSubSuper:c,isLinkModalOpen:r,openLinkModal:f,closeLinkModal:h,handleSaveLink:p,handleRemoveLink:k}}const Kn="be-touch-input";function Vn(){var e,t;return typeof window<"u"&&((t=(e=window.matchMedia)==null?void 0:e.call(window,"(pointer: coarse)"))==null?void 0:t.matches)===!0}function Ne(){const[e,t]=g.useState(Vn);return g.useEffect(()=>{if(typeof window>"u")return;const n=o=>{t(o.pointerType==="touch"||o.pointerType==="pen")};return window.addEventListener("pointerdown",n,{passive:!0}),()=>window.removeEventListener("pointerdown",n)},[]),g.useEffect(()=>{var n;(n=document.documentElement)==null||n.classList.toggle(Kn,e)},[e]),e}const zn=[{markName:"bold",Icon:m.BoldIcon,title:"Bold (Ctrl+B)"},{markName:"italic",Icon:m.ItalicIcon,title:"Italic (Ctrl+I)"},{markName:"underline",Icon:m.UnderlineIcon,title:"Underline (Ctrl+U)"},{markName:"strike",Icon:m.StrikethroughIcon,title:"Strikethrough"}],qn=[{label:"Default",value:null},{label:"Red",value:"#e03131"},{label:"Orange",value:"#e8590c"},{label:"Green",value:"#2f9e44"},{label:"Blue",value:"#1971c2"},{label:"Purple",value:"#9c36b5"}],Wn=[{label:"None",value:null},{label:"Yellow",value:"#fff3bf"},{label:"Green",value:"#d3f9d8"},{label:"Blue",value:"#d0ebff"},{label:"Pink",value:"#ffdeeb"},{label:"Gray",value:"#e9ecef"}];function Et({isOpen:e,rect:t,kind:n,selection:o,crossSelection:s,marks:r,store:a,onComment:l,commentAuthorId:u}){var _,F;const c=Ne(),[i,f]=g.useState(null),[h,b]=g.useState(null),p=g.useRef(null),{applyPatch:k,toggleBoolean:C,setSubSuper:v,isLinkModalOpen:I,openLinkModal:B,closeLinkModal:R,handleSaveLink:S,handleRemoveLink:T}=De(a,n,o,s,r),j=g.useRef(null);j.current=h;function L(){var M,P,V,J;(P=(M=document.activeElement)==null?void 0:M.blur)==null||P.call(M),(J=(V=window.getSelection)==null?void 0:V.call(window))==null||J.removeAllRanges()}function w(){if(!o)return;const M=m.genId(),P=z.addCommentMarkOverRange(a,o,M);P&&a.applyOperation(P),b({commentId:M}),f("comment")}function O(){const M=j.current;if(M){for(const P of z.removeCommentMarkEverywhere(a,M.commentId))a.applyOperation(P);b(null),L()}}function x(M){!h||!o||(a.applyOperation(m.addCommentThread({id:h.commentId,blockId:o.blockId,anchorRunIds:[o.startRunId,o.endRunId],resolved:!1,messages:[{id:m.genId(),authorId:u,text:M,createdAt:Date.now()}]})),b(null),f(null),L())}function A(){O(),f(null)}g.useEffect(()=>{if(!e||n!=="same-block"||!(l||u))return;const M=P=>{(P.metaKey||P.ctrlKey)&&P.altKey&&P.code==="KeyM"&&(P.preventDefault(),l?l(o):w())};return document.addEventListener("keydown",M),()=>document.removeEventListener("keydown",M)},[e,n,l,u,o]),g.useEffect(()=>{if(!i)return;const M=V=>{p.current&&!p.current.contains(V.target)&&(O(),f(null))},P=V=>{V.key==="Escape"&&(O(),f(null))};return document.addEventListener("mousedown",M),document.addEventListener("keydown",P),()=>{document.removeEventListener("mousedown",M),document.removeEventListener("keydown",P)}},[i]),g.useEffect(()=>{O(),f(null)},[t,n]);const D=Z.useAutoAdjustedCenteredLeft(p,!!(e&&t),t?t.left+t.width/2:null);if(c||(!e||!t)&&!I)return null;const N=!l&&i==="comment";return d.jsxs(d.Fragment,{children:[e&&t&&D!=null&&N&&d.jsxs("div",{ref:p,className:"be-floating-toolbar be-floating-toolbar-comment-standalone",role:"dialog","aria-label":"Add comment",style:{position:"fixed",top:t.top-44,left:D,transform:"translateX(-50%)"},onMouseDown:M=>{M.target.tagName!=="TEXTAREA"&&M.preventDefault()},children:[d.jsx(y.CommentPopoverHeader,{title:"Add comment",onClose:A}),d.jsx(z.CommentComposer,{authorId:u,autoFocus:!0,onSubmit:x,onCancel:A})]}),e&&t&&D!=null&&!N&&d.jsxs("div",{ref:p,className:"be-floating-toolbar",role:"toolbar","aria-label":"Text formatting",style:{position:"fixed",top:t.top-44,left:D,transform:"translateX(-50%)"},onMouseDown:M=>{M.target.tagName!=="TEXTAREA"&&M.preventDefault()},children:[zn.map(({markName:M,Icon:P,title:V})=>d.jsx("button",{type:"button",className:`be-floating-toolbar-btn${r[M]?" be-floating-toolbar-btn-active":""}`,title:V,"aria-label":V,"aria-pressed":!!r[M],onClick:()=>C(M),children:d.jsx(P,{})},M)),d.jsx("button",{type:"button",className:`be-floating-toolbar-btn${r.subscript?" be-floating-toolbar-btn-active":""}`,title:"Subscript","aria-pressed":!!r.subscript,onClick:()=>v("subscript"),children:"Xβ‚‚"}),d.jsx("button",{type:"button",className:`be-floating-toolbar-btn${r.superscript?" be-floating-toolbar-btn-active":""}`,title:"Superscript","aria-pressed":!!r.superscript,onClick:()=>v("superscript"),children:"XΒ²"}),d.jsx("span",{className:"be-floating-toolbar-divider"}),d.jsxs("div",{className:"be-floating-toolbar-picker-wrap",children:[d.jsx("button",{type:"button",className:"be-floating-toolbar-btn",title:"Text color","aria-haspopup":"true","aria-expanded":i==="color",onClick:()=>f(M=>M==="color"?null:"color"),children:d.jsx("span",{style:{color:r.color||"inherit",fontWeight:700},children:"A"})}),i==="color"&&d.jsx("div",{className:"be-floating-toolbar-picker",role:"menu","aria-label":"Text color",children:qn.map(M=>d.jsx("button",{type:"button",role:"menuitem",className:"be-floating-toolbar-swatch",title:M.label,onClick:()=>{k({color:M.value}),f(null)},children:d.jsx("span",{style:{color:M.value||"#1a1a1a",fontWeight:700},children:"A"})},M.label))})]}),d.jsxs("div",{className:"be-floating-toolbar-picker-wrap",children:[d.jsx("button",{type:"button",className:"be-floating-toolbar-btn",title:"Highlight","aria-haspopup":"true","aria-expanded":i==="highlight",onClick:()=>f(M=>M==="highlight"?null:"highlight"),children:d.jsx("span",{style:{backgroundColor:r.highlight||"transparent",padding:"0 2px",borderRadius:2},children:"H"})}),i==="highlight"&&d.jsx("div",{className:"be-floating-toolbar-picker",role:"menu","aria-label":"Highlight color",children:Wn.map(M=>d.jsx("button",{type:"button",role:"menuitem",className:"be-floating-toolbar-swatch",style:{backgroundColor:M.value||"transparent"},title:M.label,onClick:()=>{k({highlight:M.value}),f(null)}},M.label))})]}),d.jsx("span",{className:"be-floating-toolbar-divider"}),d.jsx("button",{type:"button",className:`be-floating-toolbar-btn${r.link?" be-floating-toolbar-btn-active":""}`,title:"Link","aria-label":"Link","aria-pressed":!!r.link,onClick:B,children:d.jsx(m.LinkIcon,{})}),(l||u)&&n==="same-block"&&d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"be-floating-toolbar-divider"}),d.jsx("button",{type:"button",className:"be-floating-toolbar-btn",title:"Comment (Ctrl+Alt+M)","aria-label":"Comment",onClick:()=>l?l(o):w(),children:d.jsx(m.CommentIcon,{})})]})]}),d.jsx(y.LinkEditModal,{isOpen:I,initialHref:((_=r.link)==null?void 0:_.href)??"",initialTarget:((F=r.link)==null?void 0:F.target)??"_self",hasExistingLink:!!r.link,onSave:S,onRemove:T,onClose:R})]})}function Ot(e){const t=m.useEditorStore(),[n,o]=g.useState(null);return g.useEffect(()=>{const s=e.current;if(!s)return;const r=()=>{var i,f,h,b,p;if((f=(i=document.activeElement)==null?void 0:i.closest)!=null&&f.call(i,".be-floating-toolbar"))return;const a=(h=window.getSelection)==null?void 0:h.call(window);if(!a||a.rangeCount===0||a.isCollapsed){o(null);return}if(!s.contains(a.anchorNode)||!s.contains(a.focusNode)){o(null);return}const l=((p=(b=a.getRangeAt(0)).getBoundingClientRect)==null?void 0:p.call(b))??{top:0,left:0,right:0,bottom:0,width:0,height:0},u=E.resolveMultiRunSelection();if(u){o({kind:"same-block",rect:l,selection:u,marks:Oe(t,u.blockId,u)});return}const c=E.resolveCrossBlockSelection(t);if(c){o({kind:"cross-block",rect:l,crossSelection:c,marks:Le(t,c)});return}o(null)};return document.addEventListener("selectionchange",r),window.addEventListener("scroll",r,!0),window.addEventListener("resize",r),()=>{document.removeEventListener("selectionchange",r),window.removeEventListener("scroll",r,!0),window.removeEventListener("resize",r)}},[e,t]),{isOpen:!!n,rect:(n==null?void 0:n.rect)??null,kind:(n==null?void 0:n.kind)??null,selection:(n==null?void 0:n.selection)??null,crossSelection:(n==null?void 0:n.crossSelection)??null,marks:(n==null?void 0:n.marks)??{},close:()=>o(null)}}function Lt({isOpen:e,close:t,query:n,setQuery:o,caseSensitive:s,setCaseSensitive:r,wholeWord:a,setWholeWord:l,isReplaceOpen:u,setIsReplaceOpen:c,replacement:i,setReplacement:f,matches:h,currentIndex:b,next:p,prev:k,replaceCurrent:C,replaceAll:v,queryInputRef:I}){if(!e)return null;const B=S=>{S.key==="Enter"?(S.preventDefault(),S.shiftKey?k():p()):S.key==="Escape"&&(S.preventDefault(),t())},R=S=>{S.key==="Enter"?(S.preventDefault(),C()):S.key==="Escape"&&(S.preventDefault(),t())};return d.jsxs("div",{className:"be-find-bar",contentEditable:!1,children:[d.jsxs("div",{className:"be-find-bar-row",children:[d.jsx("button",{type:"button",className:`be-find-bar-replace-toggle${u?" be-find-bar-replace-toggle-open":""}`,onClick:()=>c(!u),"aria-expanded":u,"aria-label":"Toggle replace",children:d.jsx(m.ChevronRightIcon,{size:12})}),d.jsx("input",{ref:I,type:"text",className:"be-find-bar-input",placeholder:"Find",value:n,onChange:S=>o(S.target.value),onKeyDown:B,"aria-label":"Find in document"}),d.jsx("span",{className:"be-find-bar-count",children:h.length===0?"0/0":`${b+1}/${h.length}`}),d.jsx("button",{type:"button",className:`be-find-bar-toggle${s?" be-find-bar-toggle-active":""}`,onClick:()=>r(!s),"aria-pressed":s,title:"Match case","aria-label":"Match case",children:"Aa"}),d.jsx("button",{type:"button",className:`be-find-bar-toggle${a?" be-find-bar-toggle-active":""}`,onClick:()=>l(!a),"aria-pressed":a,title:"Whole word","aria-label":"Whole word",children:"[Ab]"}),d.jsx("button",{type:"button",className:"be-find-bar-nav",onClick:k,disabled:h.length===0,"aria-label":"Previous match",children:d.jsx(m.ArrowUpIcon,{size:14})}),d.jsx("button",{type:"button",className:"be-find-bar-nav",onClick:p,disabled:h.length===0,"aria-label":"Next match",children:d.jsx(m.ArrowDownIcon,{size:14})}),d.jsx("button",{type:"button",className:"be-find-bar-close",onClick:t,"aria-label":"Close find bar",children:d.jsx(m.XIcon,{size:14})})]}),u&&d.jsxs("div",{className:"be-find-bar-row be-find-bar-replace-row",children:[d.jsx("input",{type:"text",className:"be-find-bar-input",placeholder:"Replace",value:i,onChange:S=>f(S.target.value),onKeyDown:R,"aria-label":"Replace with"}),d.jsx("button",{type:"button",className:"be-find-bar-replace-btn",onClick:C,disabled:h.length===0,children:"Replace"}),d.jsx("button",{type:"button",className:"be-find-bar-replace-btn",onClick:v,disabled:h.length===0,children:"Replace All"})]})]})}function He(e){return e!=null&&/[\w]/.test(e)}function Gn(e,t,n){const o=e[t-1],s=e[t+n];return!He(o)&&!He(s)}function $e(e,t,n,o,s,r,a){const l=a??e.getRun(n);if(!l||l.type!=="text"||!l.value)return;const u=s.caseSensitive?l.value:l.value.toLowerCase();let c=0;for(;;){const i=u.indexOf(o,c);if(i===-1)break;(!s.wholeWord||Gn(u,i,o.length))&&r.push({blockId:t,runId:n,offset:i,length:o.length}),c=i+o.length}}function Mt(e,t,n,o,s){var a;const r=e.getBlock(t);if(r){for(const l of((a=r.props)==null?void 0:a.titleRunIds)??[])$e(e,t,l,n,o,s);for(const l of r.contentIds){const u=e.getRun(l);u?$e(e,t,l,n,o,s,u):Mt(e,l,n,o,s)}}}function jt(e,t,{caseSensitive:n=!1,wholeWord:o=!1}={}){const s=[];if(!t)return s;const r=n?t:t.toLowerCase();return Mt(e,e.getRootId(),r,{caseSensitive:n,wholeWord:o},s),s}function At(e,t,n){const o=e.getRun(t.runId);if(!o)return;const s=o.value??"",r=s.slice(0,t.offset)+n+s.slice(t.offset+t.length);e.applyOperation(m.updateRun(t.runId,{value:r}))}function Dt(e,t,n){const o=new Map;for(const r of t)o.has(r.runId)||o.set(r.runId,[]),o.get(r.runId).push(r);const s=[];for(const[r,a]of o){const l=e.getRun(r);if(!l)continue;let u=l.value??"";const c=[...a].sort((i,f)=>f.offset-i.offset);for(const i of c)u=u.slice(0,i.offset)+n+u.slice(i.offset+i.length);s.push(m.updateRun(r,{value:u}))}if(s.length!==0)if(typeof e.performBatch=="function")e.performBatch(s);else for(const r of s)e.applyOperation(r)}const Yn=200;function Jn(e){const t=document.querySelector(`[data-run-id="${e.runId}"]`),n=t==null?void 0:t.firstChild;if(!n||n.nodeType!==3)return null;const o=Math.min(e.offset,n.length),s=Math.min(e.offset+e.length,n.length);if(o>=s)return null;const r=document.createRange();return r.setStart(n,o),r.setEnd(n,s),r}function Nt(e){const t=m.useEditorStore(),[n,o]=g.useState(!1),[s,r]=g.useState(""),[a,l]=g.useState(!1),[u,c]=g.useState(!1),[i,f]=g.useState(!1),[h,b]=g.useState(""),[p,k]=g.useState([]),[C,v]=g.useState(0),I=g.useRef(null),B=g.useRef(null),R=g.useCallback(()=>{const x=jt(t,s,{caseSensitive:a,wholeWord:u});k(x),v(A=>x.length===0?0:Math.min(A,x.length-1))},[t,s,a,u]);g.useEffect(()=>{n&&(v(0),R())},[n,s,a,u]),g.useEffect(()=>{if(!n)return;let x=null;const A=t.subscribeAll(()=>{x&&clearTimeout(x),x=setTimeout(R,Yn)});return()=>{x&&clearTimeout(x),A()}},[n,t,R]),g.useEffect(()=>{var D;if(!n||typeof Highlight>"u"||!CSS.highlights)return;const x=[];let A=null;if(p.forEach((N,_)=>{const F=Jn(N);F&&(_===C?A=F:x.push(F))}),CSS.highlights.set("be-find-match",new Highlight(...x)),A){CSS.highlights.set("be-find-current",new Highlight(A));const N=document.querySelector(`[data-run-id="${(D=p[C])==null?void 0:D.runId}"]`);N==null||N.scrollIntoView({block:"center",behavior:"smooth"})}else CSS.highlights.delete("be-find-current");return()=>{CSS.highlights.delete("be-find-match"),CSS.highlights.delete("be-find-current")}},[n,p,C]);const S=g.useCallback(()=>{var x;if(n){(x=B.current)==null||x.select();return}I.current=document.activeElement,o(!0)},[n]),T=g.useCallback(()=>{var x,A;o(!1),f(!1),typeof Highlight<"u"&&CSS.highlights&&(CSS.highlights.delete("be-find-match"),CSS.highlights.delete("be-find-current")),(A=(x=I.current)==null?void 0:x.focus)==null||A.call(x),I.current=null},[]);g.useEffect(()=>{var x;n&&((x=B.current)==null||x.focus())},[n]),g.useEffect(()=>{const x=e.current;if(!x)return;const A=D=>{(D.metaKey||D.ctrlKey)&&D.key.toLowerCase()==="f"&&(D.preventDefault(),S())};return x.addEventListener("keydown",A),()=>x.removeEventListener("keydown",A)},[e,S]);const j=g.useCallback(()=>{p.length!==0&&v(x=>(x+1)%p.length)},[p.length]),L=g.useCallback(()=>{p.length!==0&&v(x=>(x-1+p.length)%p.length)},[p.length]),w=g.useCallback(()=>{const x=p[C];x&&At(t,x,h)},[t,p,C,h]),O=g.useCallback(()=>{p.length!==0&&Dt(t,p,h)},[t,p,h]);return{isOpen:n,open:S,close:T,query:s,setQuery:r,caseSensitive:a,setCaseSensitive:l,wholeWord:u,setWholeWord:c,isReplaceOpen:i,setIsReplaceOpen:f,replacement:h,setReplacement:b,matches:p,currentIndex:C,next:j,prev:L,replaceCurrent:w,replaceAll:O,queryInputRef:B}}function Xn({store:e,rootId:t,extensions:n,onComment:o,commentAuthorId:s}){const r=g.useRef(null),{onCopy:a,onCut:l,onPaste:u}=kt(),c=Rt(r),i=wt(r),f=Tt(r),h=Ot(r),b=Nt(r);return wn(n,r),xt(r),St(r),d.jsxs("div",{ref:r,role:"document","aria-label":"Document editor",onCopy:a,onCut:l,onPaste:u,children:[d.jsx(Lt,{...b}),d.jsx(ht,{}),d.jsx(y.BlockChildren,{parentId:t,isTopLevel:!0}),d.jsx(ut,{}),d.jsx(ce,{isOpen:c.isOpen,rect:c.rect,commands:c.commands,runId:c.runId,onSelect:c.selectCommand,onClose:c.close}),d.jsx(ce,{isOpen:i.isOpen,rect:i.rect,commands:i.commands,runId:i.runId,onSelect:i.selectCommand,onClose:i.close,menuId:"be-emoji-menu",ariaLabel:"Emoji"}),d.jsx(ce,{isOpen:f.isOpen,rect:f.rect,commands:f.commands,runId:f.runId,onSelect:f.selectCommand,onClose:f.close,menuId:"be-at-menu",ariaLabel:"Mention"}),d.jsx(Et,{isOpen:h.isOpen,rect:h.rect,kind:h.kind,selection:h.selection,crossSelection:h.crossSelection,marks:h.marks,store:e,onComment:o,commentAuthorId:s})]})}function Qn({editor:e,className:t,style:n,theme:o,getBlockClassName:s,onComment:r,commentAuthorId:a,showCommentsPanel:l,uploadFile:u,maxFileSize:c,children:i}){const{store:f,registry:h,inlineRegistry:b,extensions:p}=e,k=f.getRootId();return d.jsxs(m.EditorProvider,{store:f,registry:h,inlineRegistry:b,history:f,className:t,style:n,theme:o,getBlockClassName:s,commentAuthorId:a,uploadFile:u,maxFileSize:c,children:[d.jsx(Xn,{store:f,rootId:k,extensions:p,onComment:r,commentAuthorId:a}),l&&d.jsx(xe.CommentsPanel,{authorId:a}),i]})}const Zn={canUndo:!1,canRedo:!1};function Pt(){const{history:e}=m.useEditorContext(),t=g.useCallback(s=>e?e.subscribeToHistory(s):()=>{},[e]),n=g.useCallback(()=>e?e.getUndoRedoSnapshot():Zn,[e]),o=g.useSyncExternalStore(t,n);return e?{...o,undo:()=>{const s=e.undo();return s&&G.restoreSelectionAfterHistoryChange(e),s},redo:()=>{const s=e.redo();return s&&G.restoreSelectionAfterHistoryChange(e),s},getHistoryLog:()=>e.getHistoryLog()}:null}function eo(e){const[t,n]=g.useState(()=>(e==null?void 0:e.getPresence())??new Map);return g.useEffect(()=>{if(!e){n(new Map);return}return n(e.getPresence()),e.onPresenceChange(n)},[e]),t}const _t={'"':{open:"β€œ",close:"”"},"'":{open:"β€˜",close:"’"}};function to(e,t){const n=_t[e];return t===void 0||/[\s([{β€œβ€˜]/.test(t)?n.open:n.close}function no(e,{enabled:t=!0}={}){const n=m.useEditorStore();g.useEffect(()=>{if(!t)return;const o=e.current;if(!o)return;function s(a){var l;return((l=n.getBlock(a))==null?void 0:l.type)==="code"}function r(a){if(a.inputType!=="insertText"||!a.data||a.data.length!==1)return;const l=a.data,u=_t[l];if(!u)return;const c=E.resolveRunSelection();if(c){if(s(c.blockId))return;const k=n.getRun(c.runId);if(!k||k.type!=="text")return;a.preventDefault();const C=k.value??"",v=C.slice(0,c.startOffset)+u.open+C.slice(c.startOffset,c.endOffset)+u.close+C.slice(c.endOffset);X.flushSync(()=>n.applyOperation(m.updateRun(k.id,{value:v}))),E.setCaretSync(k.id,c.endOffset+2);return}const i=E.resolveCollapsedCaret();if(!i||s(i.blockId))return;const f=n.getRun(i.runId);if(!f||f.type!=="text")return;a.preventDefault();const h=f.value??"",b=to(l,h[i.offset-1]),p=h.slice(0,i.offset)+b+h.slice(i.offset);X.flushSync(()=>n.applyOperation(m.updateRun(f.id,{value:p}))),E.setCaretSync(f.id,i.offset+1)}return o.addEventListener("beforeinput",r),()=>o.removeEventListener("beforeinput",r)},[e,n,t])}const Ft={"(":")","[":"]","{":"}"},oo=new Set(Object.values(Ft));function so(e,{enabled:t=!0}={}){const n=m.useEditorStore();g.useEffect(()=>{if(!t)return;const o=e.current;if(!o)return;function s(a){var l;return((l=n.getBlock(a))==null?void 0:l.type)==="code"}function r(a){if(a.inputType!=="insertText"||!a.data||a.data.length!==1)return;const l=a.data,u=Ft[l];if(u){const c=E.resolveRunSelection();if(c){if(s(c.blockId))return;const p=n.getRun(c.runId);if(!p||p.type!=="text")return;a.preventDefault();const k=p.value??"",C=k.slice(0,c.startOffset)+l+k.slice(c.startOffset,c.endOffset)+u+k.slice(c.endOffset);X.flushSync(()=>n.applyOperation(m.updateRun(p.id,{value:C}))),E.setCaretSync(p.id,c.endOffset+2);return}const i=E.resolveCollapsedCaret();if(!i||s(i.blockId))return;const f=n.getRun(i.runId);if(!f||f.type!=="text")return;a.preventDefault();const h=f.value??"",b=h.slice(0,i.offset)+l+u+h.slice(i.offset);X.flushSync(()=>n.applyOperation(m.updateRun(f.id,{value:b}))),E.setCaretSync(f.id,i.offset+1);return}if(oo.has(l)){const c=E.resolveCollapsedCaret();if(!c||s(c.blockId))return;const i=n.getRun(c.runId);if(!i||i.type!=="text")return;(i.value??"")[c.offset]===l&&(a.preventDefault(),E.setCaretSync(i.id,c.offset+1))}}return o.addEventListener("beforeinput",r),()=>o.removeEventListener("beforeinput",r)},[e,n,t])}function Ht({isOpen:e,onClose:t,onSelectCommand:n}){const o=m.useBlockRegistry(),s=m.useInlineRegistry(),r=g.useMemo(()=>[...(o==null?void 0:o.listSlashCommands())??[],...(s==null?void 0:s.listSlashCommands())??[]],[o,s]);return d.jsx(Z.Modal,{isOpen:e,onClose:t,title:"Add a block",variant:"sheet",children:d.jsx("div",{className:"be-mobile-picker-list",role:"listbox","aria-label":"Insertable blocks",children:r.map(a=>{const l=a.icon;return d.jsxs("button",{type:"button",role:"option",className:"be-mobile-picker-item",onClick:()=>n(a),children:[l&&d.jsx("span",{className:"be-mobile-picker-item-icon",children:d.jsx(l,{size:18})}),d.jsx("span",{className:"be-mobile-picker-item-label",children:a.label})]},a.label)})})})}function $t({isOpen:e,onClose:t,store:n,blockId:o}){var l;const s=o?n.getBlock(o):null,r=!!((l=s==null?void 0:s.props)!=null&&l.hidden),a=g.useCallback(u=>{u(),t()},[t]);return d.jsx(Z.Modal,{isOpen:e,onClose:t,title:"Block options",variant:"sheet",children:d.jsxs("div",{className:"be-mobile-picker-list",role:"menu","aria-label":"Block options",children:[d.jsxs("button",{type:"button",role:"menuitem",className:"be-mobile-picker-item",onClick:()=>a(()=>{y.duplicateBlock(n,o),y.announce("Block duplicated")}),children:[d.jsx("span",{className:"be-mobile-picker-item-icon",children:d.jsx(m.CopyIcon,{size:18})}),d.jsx("span",{className:"be-mobile-picker-item-label",children:"Duplicate"})]}),d.jsxs("button",{type:"button",role:"menuitem",className:"be-mobile-picker-item",onClick:()=>a(()=>{y.moveBlockUp(n,o)&&y.announce("Block moved up")}),children:[d.jsx("span",{className:"be-mobile-picker-item-icon",children:d.jsx(m.ArrowUpIcon,{size:18})}),d.jsx("span",{className:"be-mobile-picker-item-label",children:"Move up"})]}),d.jsxs("button",{type:"button",role:"menuitem",className:"be-mobile-picker-item",onClick:()=>a(()=>{y.moveBlockDown(n,o)&&y.announce("Block moved down")}),children:[d.jsx("span",{className:"be-mobile-picker-item-icon",children:d.jsx(m.ArrowDownIcon,{size:18})}),d.jsx("span",{className:"be-mobile-picker-item-label",children:"Move down"})]}),d.jsxs("button",{type:"button",role:"menuitem",className:"be-mobile-picker-item",onClick:()=>a(()=>{n.applyOperation(m.updateBlockProps(o,{hidden:!r})),y.announce(r?"Block shown in preview":"Block hidden in preview")}),children:[d.jsx("span",{className:"be-mobile-picker-item-icon",children:r?d.jsx(m.EyeIcon,{size:18}):d.jsx(m.EyeOffIcon,{size:18})}),d.jsx("span",{className:"be-mobile-picker-item-label",children:r?"Show in preview":"Hide in preview"})]}),d.jsxs("button",{type:"button",role:"menuitem",className:"be-mobile-picker-item be-mobile-picker-item-danger",onClick:()=>a(()=>{y.deleteBlockAndFocusSibling(n,o),y.announce("Block deleted")}),children:[d.jsx("span",{className:"be-mobile-picker-item-icon",children:d.jsx(m.TrashIcon,{size:18})}),d.jsx("span",{className:"be-mobile-picker-item-label",children:"Delete"})]})]})})}const ro=y.LANGUAGES.map(e=>({value:e,label:e}));function lo(e,t){const[n,o]=g.useState(!1),[s,r]=g.useState(null),[a,l]=g.useState(null),[u,c]=g.useState(null);return g.useEffect(()=>{const i=e.current;if(!i)return;const f=()=>o(!0),h=b=>{i.contains(b.relatedTarget)||o(!1)};return i.addEventListener("focusin",f),i.addEventListener("focusout",h),()=>{i.removeEventListener("focusin",f),i.removeEventListener("focusout",h)}},[e]),g.useEffect(()=>{if(!n){r(null);return}const i=()=>{var p;const f=e.current,h=(p=window.getSelection)==null?void 0:p.call(window);if(!f||!h||h.rangeCount===0){r(null);return}if(!h.isCollapsed){if(!f.contains(h.anchorNode)||!f.contains(h.focusNode)){r(null);return}const k=E.resolveMultiRunSelection();if(k){l({kind:"same-block",selection:k,crossSelection:null,marks:Oe(t,k.blockId,k)}),r("selection");return}const C=E.resolveCrossBlockSelection(t);if(C){l({kind:"cross-block",selection:null,crossSelection:C,marks:Le(t,C)}),r("selection");return}r(null);return}const b=E.resolveCollapsedCaret();if(!b||!f.contains(h.anchorNode)){r(null);return}c(b),r("caret")};return i(),document.addEventListener("selectionchange",i),()=>document.removeEventListener("selectionchange",i)},[n,t,e]),{isFocused:n,mode:s,selectionState:a,caretState:u}}function ao({store:e,selectionState:t}){const{kind:n,selection:o,crossSelection:s,marks:r}=t,{toggleBoolean:a,openLinkModal:l}=De(e,n,o,s,r);return d.jsxs(d.Fragment,{children:[d.jsx("button",{type:"button",className:`be-mobile-bar-btn${r.bold?" be-mobile-bar-btn-active":""}`,"aria-label":"Bold",onClick:()=>a("bold"),children:d.jsx(m.BoldIcon,{size:18})}),d.jsx("button",{type:"button",className:`be-mobile-bar-btn${r.italic?" be-mobile-bar-btn-active":""}`,"aria-label":"Italic",onClick:()=>a("italic"),children:d.jsx(m.ItalicIcon,{size:18})}),d.jsx("button",{type:"button",className:`be-mobile-bar-btn${r.underline?" be-mobile-bar-btn-active":""}`,"aria-label":"Underline",onClick:()=>a("underline"),children:d.jsx(m.UnderlineIcon,{size:18})}),d.jsx("button",{type:"button",className:`be-mobile-bar-btn${r.link?" be-mobile-bar-btn-active":""}`,"aria-label":"Link",onClick:l,children:d.jsx(m.LinkIcon,{size:18})})]})}function co({store:e,blockId:t}){const n=g.useCallback(()=>{const s=e.getBlock(t),r=s&&e.getBlock(s.parentId);r&&y.insertRowAfter(e,r.id)},[e,t]),o=g.useCallback(()=>{const s=e.getBlock(t),r=s&&e.getBlock(s.parentId),a=r&&e.getBlock(r.parentId);if(!a||!r)return;const l=r.contentIds.indexOf(t);l!==-1&&y.insertColumnAfter(e,a.id,l)},[e,t]);return d.jsxs(d.Fragment,{children:[d.jsx("button",{type:"button",className:"be-mobile-bar-btn","aria-label":"Insert row below",onClick:n,children:"+ Row"}),d.jsx("button",{type:"button",className:"be-mobile-bar-btn","aria-label":"Insert column right",onClick:o,children:"+ Column"})]})}function io({store:e,blockId:t}){var s;const n=e.getBlock(t),o=g.useCallback(r=>e.applyOperation(m.updateBlockProps(t,{language:r})),[e,t]);return d.jsx(y.Select,{className:"be-mobile-bar-select",value:((s=n==null?void 0:n.props)==null?void 0:s.language)??"plaintext",options:ro,onChange:o,ariaLabel:"Code language"})}function uo({store:e,blockId:t}){var s;const n=e.getBlock(t),o=(s=n==null?void 0:n.props)==null?void 0:s.color;return d.jsx("div",{className:"be-mobile-bar-swatches",children:y.CALLOUT_COLORS.map(r=>d.jsx("button",{type:"button",className:`be-callout-color-option be-callout-color-option-${r.value}${r.value===o?" be-callout-color-option-active":""}`,"aria-label":r.label,title:r.label,onClick:()=>e.applyOperation(m.updateBlockProps(t,{color:r.value}))},r.value))})}const Ut={tableCell:co,code:io,callout:uo};function fo(e,t){let n=e.getBlock(t);for(;n;){if(Ut[n.type])return n;n=n.parentId?e.getBlock(n.parentId):null}return null}function po(e,t){const n=e.getRootId();let o=e.getBlock(t);for(;o&&o.parentId!==n;)o=e.getBlock(o.parentId);return o}function mo({containerRef:e}){var j,L;const t=m.useEditorStore(),n=Pt(),o=Ne(),s=y.useVirtualKeyboardInset(),{isFocused:r,mode:a,selectionState:l,caretState:u}=lo(e,t),[c,i]=g.useState(!1),[f,h]=g.useState(!1),b=g.useCallback(()=>i(!0),[]),p=g.useCallback(()=>i(!1),[]),k=g.useCallback(()=>h(!0),[]),C=g.useCallback(()=>h(!1),[]),v=g.useCallback(w=>{const O=E.resolveCollapsedCaret()??u;O&&(w.run(t,{blockId:O.blockId,runId:O.runId,sliceStart:O.offset,sliceEnd:O.offset}),p())},[t,u,p]),I=g.useCallback(()=>{var w,O;(O=(w=document.activeElement)==null?void 0:w.blur)==null||O.call(w)},[]);if(!o||!r)return null;const B=a==="caret"&&u?fo(t,u.blockId):null,R=B?Ut[B.type]:null,S=a==="caret"&&u?u.blockId:((j=l==null?void 0:l.selection)==null?void 0:j.blockId)??((L=l==null?void 0:l.crossSelection)==null?void 0:L.startBlockId)??null,T=S?po(t,S):null;return d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"be-mobile-action-bar",role:"toolbar","aria-label":"Editor actions",style:{bottom:s},onMouseDown:w=>w.preventDefault(),children:[a==="selection"&&l&&d.jsx(ao,{store:t,selectionState:l}),a!=="selection"&&d.jsxs(d.Fragment,{children:[d.jsx("button",{type:"button",className:"be-mobile-bar-btn","aria-label":"Add block",onClick:b,children:d.jsx(m.PlusIcon,{size:18})}),R&&B&&d.jsx(R,{store:t,blockId:B.id}),n&&d.jsxs(d.Fragment,{children:[d.jsx("button",{type:"button",className:"be-mobile-bar-btn","aria-label":"Undo",disabled:!n.canUndo,onClick:n.undo,children:"β†Ά"}),d.jsx("button",{type:"button",className:"be-mobile-bar-btn","aria-label":"Redo",disabled:!n.canRedo,onClick:n.redo,children:"β†·"})]})]}),d.jsx("span",{className:"be-mobile-bar-spacer"}),T&&d.jsx("button",{type:"button",className:"be-mobile-bar-btn","aria-label":"Block options",onClick:k,children:d.jsx(m.MoreHorizontalIcon,{size:18})}),d.jsx("button",{type:"button",className:"be-mobile-bar-btn","aria-label":"Dismiss keyboard",onClick:I,children:d.jsx(m.ChevronDownIcon,{size:18})})]}),d.jsx(Ht,{isOpen:c,onClose:p,onSelectCommand:v}),d.jsx($t,{isOpen:f,onClose:C,store:t,blockId:T==null?void 0:T.id})]})}const ho=[{value:"json",label:"JSON"},{value:"simpleJson",label:"Simple JSON"},{value:"html",label:"HTML"},{value:"markdown",label:"Markdown"},{value:"text",label:"Text"}];function bo({label:e="View source",className:t=""}){const n=m.useEditorStore(),o=m.useBlockRegistry(),s=m.useInlineRegistry(),[r,a]=g.useState(!1),[l,u]=g.useState("json"),[c,i]=g.useState(!1),f=g.useCallback(()=>{i(!1),a(!0)},[]),h=g.useCallback(()=>a(!1),[]),b=g.useMemo(()=>r?l==="json"?H.exportDocumentJSON(n):l==="simpleJson"?Se(n,o,s):l==="html"?H.exportDocumentHTML(n,o,s):l==="markdown"?H.exportDocumentMarkdown(n,o,s):H.exportDocumentText(n,o,s):"",[r,l,n,o,s]),p=g.useCallback(async()=>{try{await navigator.clipboard.writeText(b),i(!0),setTimeout(()=>i(!1),1500)}catch{}},[b]),k=g.useCallback(()=>{const v=H.exportDocumentWordHTML(n,o,s),I=document.createElement("a");I.href=`data:application/msword;charset=utf-8,${encodeURIComponent(v)}`,I.download="document.doc",document.body.appendChild(I),I.click(),document.body.removeChild(I)},[n,o,s]),C=g.useCallback(()=>{window.print()},[]);return d.jsxs(d.Fragment,{children:[d.jsxs("button",{type:"button",className:`be-export-trigger ${t}`.trim(),onClick:f,children:[d.jsx(m.CodeIcon,{size:14})," ",e]}),d.jsxs(Z.Modal,{isOpen:r,onClose:h,title:"Document source",size:"large",children:[d.jsx("div",{className:"be-export-tabs",role:"tablist",children:ho.map(v=>d.jsx("button",{type:"button",role:"tab","aria-selected":l===v.value,className:`be-export-tab${l===v.value?" be-export-tab-active":""}`,onClick:()=>u(v.value),children:v.label},v.value))}),d.jsx("pre",{className:"be-export-pre",children:d.jsx("code",{children:b})}),d.jsxs("div",{className:"be-modal-actions",children:[d.jsx("button",{type:"button",className:"be-modal-cancel",onClick:h,children:"Close"}),d.jsx("button",{type:"button",className:"be-export-download",onClick:C,children:"Print / Save as PDF"}),d.jsx("button",{type:"button",className:"be-export-download",onClick:k,children:"Download Word (.doc)"}),d.jsx("button",{type:"button",className:"be-modal-save",onClick:p,children:c?"Copied!":"Copy"})]})]})]})}function go({id:e,blockId:t,label:n,placeholder:o,variant:s,options:r,onManage:a,mention:l=!1}){const u=m.useEditorStore(),c=$.useRun(e),i=g.useRef(null);i.current===null&&(i.current=y.consumePendingAutoOpen(e));const f=g.useCallback((k,C)=>{u.applyOperation(m.updateRun(e,{data:{selectedValue:k,selectedLabel:(C==null?void 0:C.label)??"",selectedColor:C==null?void 0:C.color}})),i.current&&y.focusAfterChip(u,t,e)},[u,e,t]);if(!c)return null;const{selectedValue:h="",selectedLabel:b="",selectedColor:p}=c.data??{};return d.jsx("span",{className:"be-inline-select",onMouseDown:k=>{k.preventDefault(),k.stopPropagation()},onKeyDown:k=>k.stopPropagation(),children:d.jsx(y.Select,{value:h,selectedLabel:b,selectedColor:p,options:r,onChange:f,placeholder:o,variant:s,ariaLabel:n,onManageOptions:a,mention:l,autoOpen:i.current})})}function Kt(e){return String(e).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Ue(e){return Kt(e).replace(/"/g,"&quot;")}function Vt({type:e,label:t,placeholder:n="Select…",variant:o="default",icon:s,options:r,onManage:a,triggers:l=["slash"],mention:u=l.includes("at")}){function c(p){var v,I;const k=((v=p.data)==null?void 0:v.selectedLabel)||"",C=u&&k?`@${k}`:k;return`<span data-inline-type="${Ue(e)}" data-selected-value="${Ue(((I=p.data)==null?void 0:I.selectedValue)??"")}">${Kt(C)}</span>`}function i(p){var C;const k=((C=p.data)==null?void 0:C.selectedLabel)??"";return u&&k?`@${k}`:k}function f(p){var v;if(((v=p.getAttribute)==null?void 0:v.call(p,"data-inline-type"))!==e)return null;const k=p.textContent??"",C=u&&k.startsWith("@")?k.slice(1):k;return{id:m.genId(),type:e,value:"",marks:{},data:{selectedValue:p.getAttribute("data-selected-value")??"",selectedLabel:C}}}function h({id:p,blockId:k}){return d.jsx(go,{id:p,blockId:k,label:t,placeholder:n,variant:o,options:r,onManage:a,mention:u})}const b={label:t,icon:s??m.SelectIcon,keywords:[t.toLowerCase(),"select","field"],run:(p,{blockId:k,runId:C,sliceStart:v,sliceEnd:I})=>y.insertInlineRunAtCursor(p,{blockId:k,runId:C,sliceStart:v,sliceEnd:I},()=>({id:m.genId(),type:e,value:"",marks:{},data:{selectedValue:"",selectedLabel:"",selectedColor:void 0}}),{autoOpen:!0})};return{component:h,isAtomic:!0,toHTML:c,toPlainText:i,fromHTML:f,slashCommand:l.includes("slash")?b:void 0,atCommand:l.includes("at")?b:void 0}}function zt(e,t,{onManage:n}={}){for(const o of e.getFieldTypes())t.register(o.id,Vt({type:o.id,label:o.label,placeholder:o.placeholder,variant:o.variant,options:o.options??[],triggers:o.mentionable?["slash","at"]:["slash"],onManage:n?()=>n(o.id):void 0}))}function qt(){const e=m.useEditorStore(),t=m.useInlineRegistry(),n=y.useFieldTypes(),{openEdit:o}=m.useFieldTypeEditor(),s=g.useRef([]);g.useEffect(()=>{if(!t)return;const r=new Set(n.map(a=>a.id));for(const a of s.current)r.has(a)||t.unregister(a);zt(e,t,{onManage:o}),s.current=[...r]},[e,t,n,o])}function ko(){qt();const e=m.useEditorStore(),{target:t,close:n}=m.useFieldTypeEditor(),o=t!==null,s=o&&t!=="new",[r,a]=g.useState(""),[l,u]=g.useState([]),[c,i]=g.useState(""),[f,h]=g.useState(!1);g.useEffect(()=>{if(o){if(s){const I=e.getFieldType(t);a((I==null?void 0:I.label)??""),u((I==null?void 0:I.options)??[]),h(!!(I!=null&&I.mentionable))}else a(""),u([]),h(!1);i("")}},[o,s,t,e]);const b=g.useCallback((I,B)=>{u(R=>R.map(S=>S.value===I?{...S,label:B}:S))},[]),p=g.useCallback(I=>{u(B=>B.filter(R=>R.value!==I))},[]),k=g.useCallback(()=>{const I=c.trim();i(""),I&&u(B=>[...B,{value:m.genId(),label:I,color:y.pickTagColor(B.length)}])},[c]),C=g.useCallback(()=>{const I=r.trim();I&&(s?e.applyOperation(m.updateFieldType(t,{label:I,options:l,mentionable:f})):e.applyOperation(m.addFieldType({id:m.genId(),label:I,placeholder:"Select…",variant:"tag",options:l,mentionable:f})),n())},[e,s,t,r,l,f,n]),v=g.useCallback(()=>{s&&e.applyOperation(m.removeFieldType(t)),n()},[e,s,t,n]);return d.jsxs(Z.Modal,{isOpen:o,onClose:n,title:s?"Edit field type":"New field type",children:[d.jsxs("label",{className:"be-modal-field",children:[d.jsx("span",{children:"Name"}),d.jsx("input",{type:"text",value:r,onChange:I=>a(I.target.value),placeholder:"e.g. Priority, Status…",autoFocus:!0})]}),d.jsxs("div",{className:"be-modal-field",children:[d.jsx("span",{children:"Options"}),l.map((I,B)=>d.jsxs("div",{className:"be-table-header-menu-option-row",children:[d.jsx("span",{className:"be-table-header-menu-option-swatch",style:{background:(I.color??y.pickTagColor(B)).bg},"aria-hidden":"true"}),d.jsx("input",{className:"be-table-header-menu-option-input",value:I.label,onChange:R=>b(I.value,R.target.value),"aria-label":`Rename option ${I.label}`}),d.jsx("button",{type:"button",className:"be-table-header-menu-option-remove",onClick:()=>p(I.value),"aria-label":`Remove option ${I.label}`,children:d.jsx(m.XIcon,{size:14})})]},I.value)),d.jsxs("div",{className:"be-table-header-menu-option-row",children:[d.jsx("input",{className:"be-table-header-menu-option-input",value:c,onChange:I=>i(I.target.value),placeholder:"New option…",onKeyDown:I=>{I.key==="Enter"&&(I.preventDefault(),k())}}),d.jsx("button",{type:"button",className:"be-table-header-menu-option-add",onClick:k,"aria-label":"Add option",children:"+"})]})]}),d.jsxs("label",{className:"be-modal-field be-modal-field-checkbox",children:[d.jsx("input",{type:"checkbox",checked:f,onChange:I=>h(I.target.checked)}),d.jsx("span",{children:"Also show in @ mentions"})]}),d.jsxs("div",{className:"be-modal-actions",children:[s&&d.jsx("button",{type:"button",className:"be-modal-delete",onClick:v,children:"Delete field type"}),d.jsx("button",{type:"button",className:"be-modal-cancel",onClick:n,children:"Cancel"}),d.jsx("button",{type:"button",className:"be-modal-save",onClick:C,children:"Save"})]})]})}exports.EditorStore=H.EditorStore;exports.VersionHistory=H.VersionHistory;exports.applyDocumentTemplate=H.applyDocumentTemplate;exports.captureBlockTemplate=H.captureBlockTemplate;exports.createAutoVersionHistory=H.createAutoVersionHistory;exports.diffDocumentsHTML=H.diffDocumentsHTML;exports.exportDocumentHTML=H.exportDocumentHTML;exports.exportDocumentJSON=H.exportDocumentJSON;exports.exportDocumentMarkdown=H.exportDocumentMarkdown;exports.exportDocumentText=H.exportDocumentText;exports.exportDocumentWordHTML=H.exportDocumentWordHTML;exports.insertBlockTemplate=H.insertBlockTemplate;exports.registerBlockTemplates=H.registerBlockTemplates;exports.useDocumentVersions=H.useDocumentVersions;exports.EditorProvider=m.EditorProvider;exports.injectDefaultStyles=m.injectDefaultStyles;exports.operations=m.operations;exports.useBlockClassName=m.useBlockClassName;exports.useBlockRangeSelection=m.useBlockRangeSelection;exports.useBlockRegistry=m.useBlockRegistry;exports.useCommentAuthorId=m.useCommentAuthorId;exports.useEditorStore=m.useEditorStore;exports.useFieldTypeEditor=m.useFieldTypeEditor;exports.useFileUpload=m.useFileUpload;exports.useInlineRegistry=m.useInlineRegistry;exports.usePreviewMode=m.usePreviewMode;exports.useSelectedBlock=m.useSelectedBlock;exports.useShowLineNumbers=m.useShowLineNumbers;exports.useWholeDocumentSelection=m.useWholeDocumentSelection;exports.FieldClockRegistry=pe.FieldClockRegistry;exports.HLC=pe.HLC;exports.ListCrdtState=pe.ListCrdtState;exports.genPeerId=pe.genPeerId;exports.CollabSession=Q.CollabSession;exports.MESSAGE_TYPE=Q.MESSAGE_TYPE;exports.PeerConnection=Q.PeerConnection;exports.createPeriodicTombstoneGC=Q.createPeriodicTombstoneGC;exports.createWebSocketSignaling=Q.createWebSocketSignaling;exports.decodeMessage=Q.decodeMessage;exports.encodeMessage=Q.encodeMessage;exports.deleteDocumentVersion=K.deleteDocumentVersion;exports.deletePersistedDocument=K.deletePersistedDocument;exports.deleteTemplate=K.deleteTemplate;exports.listDocumentVersions=K.listDocumentVersions;exports.listPersistedDocumentIds=K.listPersistedDocumentIds;exports.listTemplates=K.listTemplates;exports.loadDocumentVersion=K.loadDocumentVersion;exports.loadPersistedDocument=K.loadPersistedDocument;exports.loadTemplate=K.loadTemplate;exports.saveDocumentVersion=K.saveDocumentVersion;exports.savePersistedDocument=K.savePersistedDocument;exports.saveTemplate=K.saveTemplate;exports.createAutoPersistence=Be.createAutoPersistence;exports.usePersistedDocument=Be.usePersistedDocument;exports.useServiceWorkerUpdate=Be.useServiceWorkerUpdate;exports.CommentComposer=z.CommentComposer;exports.CommentThreadCard=z.CommentThreadCard;exports.addComment=z.addComment;exports.addCommentMarkOverRange=z.addCommentMarkOverRange;exports.deleteComment=z.deleteComment;exports.removeCommentMarkEverywhere=z.removeCommentMarkEverywhere;exports.replyToComment=z.replyToComment;exports.resolveComment=z.resolveComment;exports.CommentsPanel=xe.CommentsPanel;exports.useComments=xe.useComments;exports.CommentAvatar=Jt.CommentAvatar;exports.canvasBlockType=$.canvasBlockType;exports.defineBlock=$.defineBlock;exports.defineExtension=$.defineExtension;exports.defineInline=$.defineInline;exports.registerExtensions=$.registerExtensions;exports.useBlock=$.useBlock;exports.useRun=$.useRun;exports.AGGREGATE_LABELS=y.AGGREGATE_LABELS;exports.AGGREGATE_TYPES=y.AGGREGATE_TYPES;exports.BlockChildren=y.BlockChildren;exports.BlockErrorBoundary=y.BlockErrorBoundary;exports.BlockGutterRow=y.BlockGutterRow;exports.BlockRenderer=y.BlockRenderer;exports.COLUMN_TYPES=y.COLUMN_TYPES;exports.DEFAULT_COLUMN_TYPE=y.DEFAULT_COLUMN_TYPE;exports.DEFAULT_COLUMN_WIDTH=y.DEFAULT_COLUMN_WIDTH;exports.EditableBlockContent=y.EditableBlockContent;exports.MIN_COLUMN_WIDTH=y.MIN_COLUMN_WIDTH;exports.Select=y.Select;exports.TableHeaderRow=y.TableHeaderRow;exports.blankRunForType=y.blankRunForType;exports.blockquoteBlockType=y.blockquoteBlockType;exports.buttonBlockType=y.buttonBlockType;exports.calloutBlockType=y.calloutBlockType;exports.checkboxInlineType=y.checkboxInlineType;exports.codeBlockType=y.codeBlockType;exports.computeColumnAggregate=y.computeColumnAggregate;exports.convertRunToType=y.convertRunToType;exports.createCellForColumn=y.createCellForColumn;exports.createDefaultColumns=y.createDefaultColumns;exports.dateInlineType=y.dateInlineType;exports.deleteBlockAndFocusSibling=y.deleteBlockAndFocusSibling;exports.deleteColumn=y.deleteColumn;exports.deleteRow=y.deleteRow;exports.dividerBlockType=y.dividerBlockType;exports.duplicateBlock=y.duplicateBlock;exports.embedBlockType=y.embedBlockType;exports.emojiInlineType=y.emojiInlineType;exports.ensureRootNonEmpty=y.ensureRootNonEmpty;exports.formatAggregateValue=y.formatAggregateValue;exports.headingBlockType=y.headingBlockType;exports.insertColumnAfter=y.insertColumnAfter;exports.insertRowAfter=y.insertRowAfter;exports.layoutBlockType=y.layoutBlockType;exports.layoutColumnBlockType=y.layoutColumnBlockType;exports.listItemBlockType=y.listItemBlockType;exports.moveBlockDown=y.moveBlockDown;exports.moveBlockUp=y.moveBlockUp;exports.paragraphBlockType=y.paragraphBlockType;exports.renameColumn=y.renameColumn;exports.resolveColumns=y.resolveColumns;exports.selectInlineType=y.selectInlineType;exports.setColumnAggregate=y.setColumnAggregate;exports.setColumnOptions=y.setColumnOptions;exports.setColumnType=y.setColumnType;exports.setColumnWidth=y.setColumnWidth;exports.sortTableByColumn=y.sortTableByColumn;exports.starterKit=y.starterKit;exports.tableBlockType=y.tableBlockType;exports.tableCellBlockType=y.tableCellBlockType;exports.tableRowBlockType=y.tableRowBlockType;exports.tableSelectInlineType=y.tableSelectInlineType;exports.toggleHeadingBlockType=y.toggleHeadingBlockType;exports.useBlockChildren=y.useBlockChildren;exports.useFieldTypes=y.useFieldTypes;exports.useVirtualKeyboardInset=y.useVirtualKeyboardInset;exports.focusRunAtOffset=E.focusRunAtOffset;exports.focusRunEnd=E.focusRunEnd;exports.focusRunStart=E.focusRunStart;exports.resolveCollapsedCaret=E.resolveCollapsedCaret;exports.resolveCrossBlockSelection=E.resolveCrossBlockSelection;exports.resolveMultiRunSelection=E.resolveMultiRunSelection;exports.resolveRunSelection=E.resolveRunSelection;exports.captureSubtree=se.captureSubtree;exports.remapSubtreeIds=se.remapSubtreeIds;exports.serializeBlockRange=se.serializeBlockRange;exports.VoiceListeningIndicator=G.VoiceListeningIndicator;exports.VoicePermissionModal=G.VoicePermissionModal;exports.listVoiceCommands=G.listVoiceCommands;exports.useCaretRect=G.useCaretRect;exports.useVoiceTyping=G.useVoiceTyping;exports.Modal=Z.Modal;exports.APP_MIME=ie;exports.BlockRangeActionMenu=ht;exports.BlockRegistry=ze;exports.DocumentExportButton=bo;exports.EditorTrailingSpace=ut;exports.FieldTypeEditorModal=ko;exports.FindBar=Lt;exports.FloatingToolbar=Et;exports.History=Ve;exports.InlineRegistry=We;exports.LAYOUT_BLOCKS=Qe;exports.MobileActionBar=mo;exports.MobileBlockOptionsSheet=$t;exports.MobileBlockPickerSheet=Ht;exports.NoteloomEditor=Qn;exports.SlashMenu=ce;exports.TABLE_BLOCKS=Xe;exports.TABLE_SELECT_INLINE_TYPES=tt;exports.TemplatePicker=en;exports.addPerson=tn;exports.autoPairBrackets=un;exports.copyBlockRangeToClipboard=Ie;exports.createBlockRegistry=qe;exports.createInlineRegistry=Ge;exports.createSelectFieldType=Vt;exports.deleteBlockRange=le;exports.deleteEntireDocument=ue;exports.deleteOverBlockRange=Ee;exports.deleteRunRangeInBlock=Te;exports.deserializeClipboard=gt;exports.exportDocumentSimpleJSON=Se;exports.findMatches=jt;exports.getMarksSummaryOverBlockRange=Le;exports.getMarksSummaryOverSelection=Oe;exports.importDocumentSimpleJSON=it;exports.isEntireBlockRangeHidden=pt;exports.isEntireBlockSelected=Bt;exports.isSimpleDocument=ct;exports.moveBlockRangeDown=ft;exports.moveBlockRangeUp=dt;exports.registerBlocks=Je;exports.registerBuiltInBlocks=Ye;exports.registerBuiltInInlineTypes=Ze;exports.registerInlineTypes=et;exports.registerStoredFieldTypes=zt;exports.removePerson=on;exports.reorderBlockRangeFromStore=hn;exports.replaceAllMatches=Dt;exports.replaceMatch=At;exports.setBlockRangeHidden=mt;exports.setMarksOverBlockRange=fe;exports.setMarksOverSelection=oe;exports.smartQuotes=an;exports.textToParagraphs=we;exports.toggleMarkOnRunRange=xn;exports.toggleMarkOverBlockRange=je;exports.toggleMarkOverSelection=Me;exports.updatePerson=nn;exports.useAtMenuTrigger=Tt;exports.useAutoPairBrackets=so;exports.useBlockRangeDrag=St;exports.useClipboardHandlers=kt;exports.useCoarsePointer=Ne;exports.useEditor=pn;exports.useEditorKeyboardShortcuts=xt;exports.useEmojiMenuTrigger=wt;exports.useFindInDocument=Nt;exports.useFloatingToolbarTrigger=Ot;exports.useHistory=Pt;exports.usePeople=rn;exports.usePresence=eo;exports.useRegisterFieldTypes=qt;exports.useSlashMenuTrigger=Rt;exports.useSmartQuotes=no;exports.useTemplates=Zt;exports.useTextFormattingActions=De;exports.walkDomToBlocks=bt;
2
+ //# sourceMappingURL=index.cjs.map