noteloom 0.1.3 → 0.1.5

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.
package/dist/noteloom.cjs CHANGED
@@ -1,1888 +1,2046 @@
1
- "use strict";var pr=Object.defineProperty;var fr=(e,n,t)=>n in e?pr(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t;var tt=(e,n,t)=>fr(e,typeof n!="symbol"?n+"":n,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),f=require("react"),Le=require("react-dom"),F={INSERT_BLOCK:"insertBlock",REMOVE_BLOCK:"removeBlock",MOVE_BLOCK:"moveBlock",UPDATE_BLOCK_PROPS:"updateBlockProps",UPDATE_RUN:"updateRun",SET_BLOCK_CONTENT_IDS:"setBlockContentIds",REPLACE_RUN_SPAN:"replaceRunSpan",SET_BLOCK_RUNS:"setBlockRuns",ADD_FIELD_TYPE:"addFieldType",UPDATE_FIELD_TYPE:"updateFieldType",REMOVE_FIELD_TYPE:"removeFieldType"};function G(e,n,t,o){return{type:F.INSERT_BLOCK,block:e,parentId:n,index:t,subtree:o}}function _(e){return{type:F.REMOVE_BLOCK,id:e}}function ke(e,n,t){return{type:F.MOVE_BLOCK,id:e,toParentId:n,toIndex:t}}function z(e,n){return{type:F.UPDATE_BLOCK_PROPS,id:e,patch:n}}function J(e,n){return{type:F.UPDATE_RUN,id:e,patch:n}}function je(e,n){return{type:F.SET_BLOCK_CONTENT_IDS,blockId:e,contentIds:n}}function qe(e,n,t){return{type:F.REPLACE_RUN_SPAN,blockId:e,oldRunIds:n,newRuns:t}}function se(e,n){return{type:F.SET_BLOCK_RUNS,blockId:e,runs:n}}function Sn(e){return{type:F.ADD_FIELD_TYPE,fieldType:e}}function En(e,n){return{type:F.UPDATE_FIELD_TYPE,id:e,patch:n}}function On(e){return{type:F.REMOVE_FIELD_TYPE,id:e}}const br=Object.freeze(Object.defineProperty({__proto__:null,OP:F,addFieldType:Sn,insertBlock:G,moveBlock:ke,removeBlock:_,removeFieldType:On,replaceRunSpan:qe,setBlockContentIds:je,setBlockRuns:se,updateBlockProps:z,updateFieldType:En,updateRun:J},Symbol.toStringTag,{value:"Module"})),kn="$fieldTypes";class Ln{constructor(n){this.blocks=new Map(((n==null?void 0:n.blocks)??[]).map(t=>[t.id,t])),this.runs=new Map(((n==null?void 0:n.runs)??[]).map(t=>[t.id,t])),this.rootId=(n==null?void 0:n.rootId)??null,this.fieldTypes=new Map(((n==null?void 0:n.fieldTypes)??[]).map(t=>[t.id,t])),this._fieldTypesSnapshot=null,this._listeners=new Map}getBlock(n){return this.blocks.get(n)}getRun(n){return this.runs.get(n)}getFieldTypes(){return this._fieldTypesSnapshot||(this._fieldTypesSnapshot=[...this.fieldTypes.values()]),this._fieldTypesSnapshot}getFieldType(n){return this.fieldTypes.get(n)}getRootId(){return this.rootId}subscribe(n,t){let o=this._listeners.get(n);return o||(o=new Set,this._listeners.set(n,o)),o.add(t),()=>{o.delete(t),o.size===0&&this._listeners.delete(n)}}_notify(n){for(const t of n){const o=this._listeners.get(t);if(o)for(const r of[...o])r()}}_captureSubtree(n){const t=[],o=[],r=l=>{var c;if(this.runs.has(l)){o.push(this.runs.get(l));return}const s=this.blocks.get(l);if(s){t.push(s);for(const i of s.contentIds)r(i);for(const i of((c=s.props)==null?void 0:c.titleRunIds)??[])r(i)}};return r(n),{blocks:t,runs:o}}_deleteSubtree(n){const t=o=>{var l;if(this.runs.has(o)){this.runs.delete(o);return}const r=this.blocks.get(o);if(r){for(const s of r.contentIds)t(s);for(const s of((l=r.props)==null?void 0:l.titleRunIds)??[])t(s);this.blocks.delete(o)}};t(n)}applyOperation(n){var t;switch(n.type){case F.UPDATE_RUN:{const o=this.runs.get(n.id),r={};for(const l of Object.keys(n.patch))r[l]=o[l];return this.runs.set(n.id,{...o,...n.patch}),this._notify([n.id]),J(n.id,r)}case F.UPDATE_BLOCK_PROPS:{const o=this.blocks.get(n.id),r={};for(const l of Object.keys(n.patch))r[l]=o.props[l];return this.blocks.set(n.id,{...o,props:{...o.props,...n.patch}}),this._notify([n.id]),z(n.id,r)}case F.INSERT_BLOCK:{if(n.subtree){for(const s of n.subtree.blocks)this.blocks.set(s.id,s);for(const s of n.subtree.runs)this.runs.set(s.id,s)}else this.blocks.set(n.block.id,n.block);const o=this.blocks.get(n.parentId),r=[...o.contentIds],l=n.index??r.length;return r.splice(l,0,n.block.id),this.blocks.set(n.parentId,{...o,contentIds:r}),this._notify([n.block.id,n.parentId]),_(n.block.id)}case F.REMOVE_BLOCK:{const o=this.blocks.get(n.id),r=o.parentId,l=this.blocks.get(r),s=l.contentIds.indexOf(n.id),c=this._captureSubtree(n.id);this._deleteSubtree(n.id);const i=l.contentIds.filter(u=>u!==n.id);return this.blocks.set(r,{...l,contentIds:i}),this._notify([r]),{type:F.INSERT_BLOCK,block:o,parentId:r,index:s,subtree:c}}case F.MOVE_BLOCK:{const r=this.blocks.get(n.id).parentId,l=this.blocks.get(r),s=l.contentIds.indexOf(n.id),c=l.contentIds.filter(d=>d!==n.id);this.blocks.set(r,{...l,contentIds:c});const i=n.toParentId===r?this.blocks.get(r):this.blocks.get(n.toParentId),u=[...i.contentIds];u.splice(n.toIndex??u.length,0,n.id),this.blocks.set(n.toParentId,{...i,contentIds:u}),this.blocks.set(n.id,{...this.blocks.get(n.id),parentId:n.toParentId});const p=new Set([n.id,r,n.toParentId]);return this._notify(p),ke(n.id,r,s)}case F.SET_BLOCK_CONTENT_IDS:{const o=this.blocks.get(n.blockId),r=o.contentIds;return this.blocks.set(n.blockId,{...o,contentIds:n.contentIds}),this._notify([n.blockId]),je(n.blockId,r)}case F.REPLACE_RUN_SPAN:{const o=this.blocks.get(n.blockId),r=o.contentIds.indexOf(n.oldRunIds[0])!==-1,l=r?o.contentIds:((t=o.props)==null?void 0:t.titleRunIds)??[],s=l.indexOf(n.oldRunIds[0]),c=n.oldRunIds.map(u=>this.runs.get(u));for(const u of n.oldRunIds)this.runs.delete(u);for(const u of n.newRuns)this.runs.set(u.id,u);const i=[...l];return i.splice(s,n.oldRunIds.length,...n.newRuns.map(u=>u.id)),r?this.blocks.set(n.blockId,{...o,contentIds:i}):this.blocks.set(n.blockId,{...o,props:{...o.props,titleRunIds:i}}),this._notify([n.blockId,...n.oldRunIds,...n.newRuns.map(u=>u.id)]),qe(n.blockId,n.newRuns.map(u=>u.id),c)}case F.SET_BLOCK_RUNS:{const o=this.blocks.get(n.blockId),r=o.props&&"titleRunIds"in o.props,l=r?o.props.titleRunIds:o.contentIds,s=l.map(i=>this.runs.get(i)).filter(Boolean);for(const i of l)this.runs.delete(i);for(const i of n.runs)this.runs.set(i.id,i);const c=n.runs.map(i=>i.id);return r?this.blocks.set(n.blockId,{...o,props:{...o.props,titleRunIds:c}}):this.blocks.set(n.blockId,{...o,contentIds:c}),this._notify([n.blockId,...l,...c]),se(n.blockId,s)}case F.ADD_FIELD_TYPE:return this.fieldTypes.set(n.fieldType.id,n.fieldType),this._fieldTypesSnapshot=null,this._notify([kn]),On(n.fieldType.id);case F.UPDATE_FIELD_TYPE:{const o=this.fieldTypes.get(n.id),r={};for(const l of Object.keys(n.patch))r[l]=o[l];return this.fieldTypes.set(n.id,{...o,...n.patch}),this._fieldTypesSnapshot=null,this._notify([kn]),En(n.id,r)}case F.REMOVE_FIELD_TYPE:{const o=this.fieldTypes.get(n.id);return this.fieldTypes.delete(n.id),this._fieldTypesSnapshot=null,this._notify([kn]),Sn(o)}default:throw new Error(`Unknown operation type: ${n.type}`)}}applyOperations(n){return n.map(t=>this.applyOperation(t))}toJSON(){return{blocks:[...this.blocks.values()],runs:[...this.runs.values()],rootId:this.rootId,fieldTypes:[...this.fieldTypes.values()]}}static fromJSON(n){return new Ln(n)}}const mr=500;class hr{constructor(n,{idleMs:t=mr}={}){this.store=n,this.idleMs=t,this.undoStack=[],this.redoStack=[],this.currentBatch=null,this.idleTimer=null,this.historyLog=[],this._listeners=new Set,this._undoRedoSnapshot={canUndo:!1,canRedo:!1}}getUndoRedoSnapshot(){const n=this.canUndo(),t=this.canRedo();return(this._undoRedoSnapshot.canUndo!==n||this._undoRedoSnapshot.canRedo!==t)&&(this._undoRedoSnapshot={canUndo:n,canRedo:t}),this._undoRedoSnapshot}getBlock(n){return this.store.getBlock(n)}getRun(n){return this.store.getRun(n)}getRootId(){return this.store.getRootId()}getFieldTypes(){return this.store.getFieldTypes()}getFieldType(n){return this.store.getFieldType(n)}subscribe(n,t){return this.store.subscribe(n,t)}toJSON(){return this.store.toJSON()}applyOperation(n,t={}){return this.perform(n,t)}applyOperations(n,t={}){return n.map(o=>this.perform(o,t))}performBatch(n,t={}){var s;const o=t.actorId??null,r=t.timestamp??Date.now();this._commitCurrentBatch();const l=[];for(const c of n)l.unshift(this.store.applyOperation(c)),this.historyLog.push({opType:c.type,id:c.id??c.blockId??((s=c.block)==null?void 0:s.id),actorId:o,timestamp:r});this.redoStack=[],this.undoStack.push({ops:[...n],inverses:l,batchKey:null,actorId:o,timestamp:r,lastTimestamp:r,boundaryHit:!0}),this._notify()}perform(n,t={}){const o=t.actorId??null,r=t.timestamp??Date.now(),l=this.store.applyOperation(n);return this._record(n,l,{actorId:o,timestamp:r}),l}_batchKeyFor(n){return n.type==="updateRun"?`run:${n.id}`:null}_isWordBoundary(n){var o;if(n.type!=="updateRun")return!1;const t=(o=n.patch)==null?void 0:o.value;return typeof t!="string"||t.length===0?!1:/\s/.test(t[t.length-1])}_record(n,t,o){var c;this.redoStack=[];const r=this._batchKeyFor(n),l=this.currentBatch&&o.timestamp-this.currentBatch.lastTimestamp<=this.idleMs;this.currentBatch&&r!==null&&this.currentBatch.batchKey===r&&l&&!this.currentBatch.boundaryHit?(this.currentBatch.ops.push(n),this.currentBatch.inverses.unshift(t),this.currentBatch.lastTimestamp=o.timestamp,this._isWordBoundary(n)&&(this.currentBatch.boundaryHit=!0)):(this._commitCurrentBatch(),this.currentBatch={ops:[n],inverses:[t],batchKey:r,actorId:o.actorId,timestamp:o.timestamp,lastTimestamp:o.timestamp,boundaryHit:this._isWordBoundary(n)}),this._resetIdleTimer(),this.historyLog.push({opType:n.type,id:n.id??((c=n.block)==null?void 0:c.id),actorId:o.actorId,timestamp:o.timestamp}),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 n=this.undoStack.pop();if(!n)return!1;for(const t of n.inverses)this.store.applyOperation(t);return this.redoStack.push(n),this._notify(),!0}redo(){const n=this.redoStack.pop();if(!n)return!1;for(const t of n.ops)this.store.applyOperation(t);return this.undoStack.push(n),this._notify(),!0}canUndo(){return this.undoStack.length>0||this.currentBatch!==null}canRedo(){return this.redoStack.length>0}getHistoryLog(){return[...this.historyLog]}subscribeToHistory(n){return this._listeners.add(n),()=>this._listeners.delete(n)}_notify(){for(const n of this._listeners)n()}}class yt{constructor(){this._types=new Map}register(n,t){this._types.set(n,t)}get(n){return this._types.get(n)}isLeaf(n){var t;return!!((t=this._types.get(n))!=null&&t.isLeaf)}listSlashCommands(){const n=[];for(const t of this._types.values())t.slashCommand&&n.push(t.slashCommand),t.slashCommands&&n.push(...t.slashCommands);return n}listHtmlMatchers(){return[...this._types.values()].filter(n=>n.fromHTML)}}function gr(){return new yt}class vt{constructor(){this._types=new Map}register(n,t){this._types.set(n,t)}unregister(n){this._types.delete(n)}get(n){return this._types.get(n)}listHtmlMatchers(){return[...this._types.values()].filter(n=>n.fromHTML)}listSlashCommands(){const n=[];for(const t of this._types.values())t.slashCommand&&n.push(t.slashCommand),t.slashCommands&&n.push(...t.slashCommands);return n}listAtCommands(){const n=[];for(const t of this._types.values())t.atCommand&&n.push(t.atCommand),t.atCommands&&n.push(...t.atCommands);return n}}function xr(){return new vt}const kr=`/*
2
- * noteloom's default theme — minimal, clean, Notion/Linear-adjacent.
3
- *
4
- * Ships as plain CSS custom properties on :root (not scoped to a wrapper
5
- * element) deliberately: several of this package's own pieces — Select's
6
- * popover, SlashMenu, FloatingToolbar, the table header menu, the block
7
- * gutter/range menus, Modal — are portaled to document.body, so they are
8
- * NOT DOM descendants of whatever element renders the editor itself.
9
- * Scoping variables to a wrapper class would silently fail to reach any
10
- * of those. \`--noteloom-*\` is a distinctive enough prefix that defining
11
- * these on :root won't collide with a host app's own custom properties.
12
- *
13
- * This file is auto-injected at runtime by <EditorProvider> (see
14
- * react/injectDefaultStyles.js) — you do NOT need to import this
15
- * yourself. It's still published standalone at \`noteloom/style.css\` for:
16
- * - passing \`theme="none"\` to <EditorProvider> and importing this
17
- * explicitly instead (e.g. to control load order, or for SSR/CSP
18
- * setups where runtime <style> injection isn't allowed)
19
- * - copying as a starting point for your own from-scratch theme
20
- *
21
- * Retheme by overriding these variables in your own CSS (after the
22
- * default theme loads) — every rule below reads from them, nothing is
23
- * hardcoded. Override individual \`.be-*\` classes too, same as any other
24
- * library's default styles.
25
- */
26
-
27
- :root {
28
- --noteloom-font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Inter, sans-serif;
29
- --noteloom-text: #0f172a;
30
- --noteloom-text-muted: #64748b;
31
- --noteloom-text-faint: #94a3b8;
32
- --noteloom-bg: #ffffff;
33
- --noteloom-bg-subtle: #f8fafc;
34
- --noteloom-bg-hover: #f1f5f9;
35
- --noteloom-border: #e2e8f0;
36
- --noteloom-accent: #6366f1;
37
- --noteloom-accent-text: #ffffff;
38
- --noteloom-accent-soft: rgba(99, 102, 241, 0.1);
39
- --noteloom-accent-soft-hover: rgba(99, 102, 241, 0.16);
40
- --noteloom-danger: #dc2626;
41
- --noteloom-danger-soft: #fef2f2;
42
- --noteloom-radius-sm: 6px;
43
- --noteloom-radius-md: 8px;
44
- --noteloom-radius-lg: 12px;
45
- --noteloom-radius-xl: 16px;
46
- --noteloom-shadow: 0 12px 24px -8px rgba(15, 23, 42, 0.12), 0 4px 8px -4px rgba(15, 23, 42, 0.06);
47
- --noteloom-code-bg: #0f172a;
48
- --noteloom-code-text: #e2e8f0;
49
- }
50
-
51
- @media (prefers-color-scheme: dark) {
52
- :root {
53
- --noteloom-text: #f1f5f9;
54
- --noteloom-text-muted: #94a3b8;
55
- --noteloom-text-faint: #64748b;
56
- --noteloom-bg: #1c1932;
57
- --noteloom-bg-subtle: rgba(255, 255, 255, 0.03);
58
- --noteloom-bg-hover: rgba(255, 255, 255, 0.06);
59
- --noteloom-border: rgba(255, 255, 255, 0.1);
60
- --noteloom-accent-soft: rgba(99, 102, 241, 0.18);
61
- --noteloom-accent-soft-hover: rgba(99, 102, 241, 0.26);
62
- --noteloom-danger-soft: rgba(220, 38, 38, 0.15);
63
- --noteloom-code-bg: #13111f;
64
- }
65
- }
66
-
67
- /* Explicit overrides win either direction — a host toggling dark mode via
68
- a class rather than the OS setting can set [data-theme="dark"/"light"]
69
- on any ancestor (e.g. <html>), overriding the media query above. */
70
- [data-theme='dark'] {
71
- --noteloom-text: #f1f5f9;
72
- --noteloom-text-muted: #94a3b8;
73
- --noteloom-text-faint: #64748b;
74
- --noteloom-bg: #1c1932;
75
- --noteloom-bg-subtle: rgba(255, 255, 255, 0.03);
76
- --noteloom-bg-hover: rgba(255, 255, 255, 0.06);
77
- --noteloom-border: rgba(255, 255, 255, 0.1);
78
- --noteloom-accent-soft: rgba(99, 102, 241, 0.18);
79
- --noteloom-accent-soft-hover: rgba(99, 102, 241, 0.26);
80
- --noteloom-danger-soft: rgba(220, 38, 38, 0.15);
81
- --noteloom-code-bg: #13111f;
82
- }
83
-
84
- [data-theme='light'] {
85
- --noteloom-text: #0f172a;
86
- --noteloom-text-muted: #64748b;
87
- --noteloom-text-faint: #94a3b8;
88
- --noteloom-bg: #ffffff;
89
- --noteloom-bg-subtle: #f8fafc;
90
- --noteloom-bg-hover: #f1f5f9;
91
- --noteloom-border: #e2e8f0;
92
- --noteloom-accent-soft: rgba(99, 102, 241, 0.1);
93
- --noteloom-accent-soft-hover: rgba(99, 102, 241, 0.16);
94
- --noteloom-danger-soft: #fef2f2;
95
- --noteloom-code-bg: #0f172a;
96
- }
97
-
98
- .be-root {
99
- font-family: var(--noteloom-font);
100
- color: var(--noteloom-text);
101
- }
102
-
103
- .be-editable {
104
- outline: none;
105
- }
106
-
107
- /* --- basic leaf blocks --- */
108
-
109
- .be-paragraph {
110
- position: relative;
111
- margin: 0.25rem 0;
112
- line-height: 1.6;
113
- outline: none;
114
- }
115
-
116
- .be-heading {
117
- position: relative;
118
- font-weight: 600;
119
- margin: 1.25rem 0 0.25rem;
120
- outline: none;
121
- letter-spacing: -0.01em;
122
- }
123
-
124
- .be-divider {
125
- border: none;
126
- border-top: 1px solid var(--noteloom-border);
127
- margin: 1.5em 0;
128
- cursor: default;
129
- }
130
-
131
- .be-blockquote {
132
- position: relative;
133
- margin: 0.5em 0;
134
- padding-left: 0.9em;
135
- border-left: 3px solid var(--noteloom-border);
136
- color: var(--noteloom-text-muted);
137
- outline: none;
138
- }
139
-
140
- /* --- callout --- */
141
-
142
- .be-callout {
143
- position: relative;
144
- display: flex;
145
- gap: 0.7em;
146
- align-items: flex-start;
147
- background: var(--noteloom-bg-subtle);
148
- border-radius: var(--noteloom-radius-lg);
149
- padding: 0.9em 1em;
150
- margin: 0.5em 0;
151
- }
152
-
153
- .be-callout[data-color='gray'] { background: rgba(148, 163, 184, 0.16); }
154
- .be-callout[data-color='blue'] { background: rgba(99, 102, 241, 0.12); }
155
- .be-callout[data-color='green'] { background: rgba(34, 197, 94, 0.14); }
156
- .be-callout[data-color='yellow'] { background: rgba(234, 179, 8, 0.16); }
157
- .be-callout[data-color='orange'] { background: rgba(249, 115, 22, 0.14); }
158
- .be-callout[data-color='red'] { background: rgba(239, 68, 68, 0.13); }
159
- .be-callout[data-color='purple'] { background: rgba(168, 85, 247, 0.13); }
160
- .be-callout[data-color='pink'] { background: rgba(236, 72, 153, 0.13); }
161
-
162
- .be-callout-icon-wrap {
163
- flex: none;
164
- }
165
-
166
- .be-callout-icon-input,
167
- .be-callout-icon {
168
- width: 2em;
169
- height: 2em;
170
- border: none;
171
- background: var(--noteloom-bg);
172
- border-radius: var(--noteloom-radius-md);
173
- box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
174
- font-size: 1.15em;
175
- display: flex;
176
- align-items: center;
177
- justify-content: center;
178
- padding: 0;
179
- cursor: pointer;
180
- }
181
-
182
- .be-callout-icon-input {
183
- outline: none;
184
- text-align: center;
185
- cursor: text;
186
- }
187
-
188
- .be-callout-content {
189
- flex: 1;
190
- min-width: 0;
191
- padding-right: 1.6em; /* keeps text from running under the color-swatch trigger */
192
- }
193
-
194
- /* First child reads as the card's title; every child after it is the
195
- description — see CalloutBlock.jsx's comment for why this is a CSS
196
- convention over the content, not a separate title/description field. */
197
- .be-callout-content > :first-child {
198
- font-weight: 600;
199
- }
200
-
201
- .be-callout-content > :not(:first-child) {
202
- color: var(--noteloom-text-muted);
203
- font-size: 0.92em;
204
- }
205
-
206
- .be-callout-color-wrap {
207
- position: absolute;
208
- top: 0.6em;
209
- right: 0.6em;
210
- }
211
-
212
- .be-callout-color-trigger {
213
- border: none;
214
- background: none;
215
- padding: 3px;
216
- border-radius: var(--noteloom-radius-sm);
217
- cursor: pointer;
218
- display: flex;
219
- }
220
-
221
- .be-callout-color-trigger:hover {
222
- background: rgba(15, 23, 42, 0.06);
223
- }
224
-
225
- .be-callout-color-dot {
226
- width: 12px;
227
- height: 12px;
228
- border-radius: 50%;
229
- border: 1px solid rgba(15, 23, 42, 0.12);
230
- }
231
-
232
- .be-callout-color-dot-gray { background: #94a3b8; }
233
- .be-callout-color-dot-blue { background: #6366f1; }
234
- .be-callout-color-dot-green { background: #22c55e; }
235
- .be-callout-color-dot-yellow { background: #eab308; }
236
- .be-callout-color-dot-orange { background: #f97316; }
237
- .be-callout-color-dot-red { background: #ef4444; }
238
- .be-callout-color-dot-purple { background: #a855f7; }
239
- .be-callout-color-dot-pink { background: #ec4899; }
240
-
241
- .be-callout-color-picker {
242
- position: absolute;
243
- top: 100%;
244
- right: 0;
245
- margin-top: 4px;
246
- z-index: 1000;
247
- display: grid;
248
- grid-template-columns: repeat(4, 1fr);
249
- gap: 4px;
250
- padding: 6px;
251
- background: var(--noteloom-bg);
252
- border: 1px solid var(--noteloom-border);
253
- border-radius: var(--noteloom-radius-md);
254
- box-shadow: var(--noteloom-shadow);
255
- }
256
-
257
- .be-callout-color-option {
258
- width: 22px;
259
- height: 22px;
260
- border-radius: 50%;
261
- border: 2px solid transparent;
262
- cursor: pointer;
263
- padding: 0;
264
- }
265
-
266
- .be-callout-color-option-gray { background: #94a3b8; }
267
- .be-callout-color-option-blue { background: #6366f1; }
268
- .be-callout-color-option-green { background: #22c55e; }
269
- .be-callout-color-option-yellow { background: #eab308; }
270
- .be-callout-color-option-orange { background: #f97316; }
271
- .be-callout-color-option-red { background: #ef4444; }
272
- .be-callout-color-option-purple { background: #a855f7; }
273
- .be-callout-color-option-pink { background: #ec4899; }
274
-
275
- .be-callout-color-option-active {
276
- border-color: var(--noteloom-text);
277
- }
278
-
279
- /* --- code block --- */
280
-
281
- .be-code-block {
282
- margin: 0.6em 0;
283
- border-radius: var(--noteloom-radius-lg);
284
- overflow: hidden;
285
- background: var(--noteloom-code-bg);
286
- color: var(--noteloom-code-text);
287
- }
288
-
289
- .be-code-block-header {
290
- display: flex;
291
- align-items: center;
292
- justify-content: flex-end;
293
- gap: 4px;
294
- padding: 6px 10px;
295
- background: rgba(255, 255, 255, 0.04);
296
- }
297
-
298
- .be-code-block-delete {
299
- appearance: none;
300
- -webkit-appearance: none;
301
- border: none;
302
- outline: none;
303
- background: transparent;
304
- box-shadow: none;
305
- color: var(--noteloom-text-faint);
306
- width: 24px;
307
- height: 24px;
308
- margin: 0;
309
- padding: 0;
310
- display: flex;
311
- align-items: center;
312
- justify-content: center;
313
- border-radius: var(--noteloom-radius-sm);
314
- cursor: pointer;
315
- }
316
-
317
- .be-code-block-delete:hover {
318
- background: rgba(255, 255, 255, 0.1);
319
- color: #fca5a5;
320
- }
321
-
322
- .be-code-block-language {
323
- background: transparent;
324
- color: var(--noteloom-text-faint);
325
- border: none;
326
- font-size: 0.8rem;
327
- cursor: pointer;
328
- }
329
-
330
- .be-code-block-pre {
331
- margin: 0;
332
- padding: 0.9em 1em;
333
- overflow-x: auto;
334
- font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
335
- font-size: 0.88rem;
336
- outline: none;
337
- }
338
-
339
- .be-code-block-pre code {
340
- position: relative;
341
- display: block;
342
- }
343
-
344
- /* --- list items (bulleted / numbered / to-do / toggle) --- */
345
-
346
- .be-list-item {
347
- margin: 0.1rem 0;
348
- }
349
-
350
- .be-list-item-row {
351
- display: flex;
352
- align-items: flex-start;
353
- gap: 0.4em;
354
- }
355
-
356
- .be-list-checkbox {
357
- margin-top: 0.3em;
358
- width: 16px;
359
- height: 16px;
360
- flex: none;
361
- accent-color: var(--noteloom-accent);
362
- cursor: pointer;
363
- }
364
-
365
- .be-list-toggle-marker {
366
- border: none;
367
- background: none;
368
- cursor: pointer;
369
- padding: 2px;
370
- margin-top: 0.1em;
371
- color: var(--noteloom-text-faint);
372
- display: flex;
373
- align-items: center;
374
- justify-content: center;
375
- height: 30px;
376
- width: 30px;
377
- border-radius: var(--noteloom-radius-sm);
378
- }
379
-
380
- .be-list-toggle-marker:hover {
381
- background: var(--noteloom-bg-hover);
382
- color: var(--noteloom-text-muted);
383
- }
384
-
385
- .be-list-marker {
386
- min-width: 1.2em;
387
- margin-top: 0.1em;
388
- text-align: center;
389
- color: var(--noteloom-text-faint);
390
- user-select: none;
391
- flex: none;
392
- }
393
-
394
- .be-list-item-title {
395
- position: relative;
396
- flex: 1;
397
- min-width: 0;
398
- outline: none;
399
- line-height: 1.6;
400
- }
401
-
402
- .be-list-item-children {
403
- margin-left: 2.1em;
404
- }
405
-
406
- /* --- toggle heading --- */
407
-
408
- .be-toggle-heading {
409
- margin: 1.25rem 0 0.25rem;
410
- }
411
-
412
- .be-toggle-heading-row {
413
- display: flex;
414
- align-items: center;
415
- gap: 0.15em;
416
- }
417
-
418
- .be-toggle-heading-marker {
419
- border: none;
420
- background: none;
421
- cursor: pointer;
422
- color: var(--noteloom-text-faint);
423
- display: flex;
424
- align-items: center;
425
- justify-content: center;
426
- width: 30px;
427
- height: 30px;
428
- border-radius: var(--noteloom-radius-sm);
429
- }
430
-
431
- .be-toggle-heading-marker:hover {
432
- background: var(--noteloom-bg-hover);
433
- color: var(--noteloom-text-muted);
434
- }
435
-
436
- .be-toggle-heading-title {
437
- flex: 1;
438
- min-width: 0;
439
- }
440
-
441
- .be-toggle-heading-children {
442
- margin-left: 2.1em;
443
- }
444
-
445
- /* --- layout (multi-column) --- */
446
-
447
- .be-layout {
448
- margin: 0.6em 0;
449
- }
450
-
451
- .be-layout-column {
452
- flex: 1;
453
- min-width: 0;
454
- }
455
-
456
- /* --- button block --- */
457
-
458
- .be-button-block {
459
- margin: 0.6em 0;
460
- }
461
-
462
- .be-button-block-pill {
463
- display: inline-flex;
464
- align-items: center;
465
- gap: 0.4em;
466
- border-radius: var(--noteloom-radius-md);
467
- padding: 0.5em 1em;
468
- color: var(--noteloom-accent-text);
469
- }
470
-
471
- .be-button-block-label {
472
- position: relative;
473
- outline: none;
474
- min-width: 2em;
475
- }
476
-
477
- /* --- generic empty-state placeholder for editable leaf content ---
478
- Note: this can't use :empty — an "empty" run still holds a zero-width
479
- space text node (see EMPTY_RUN_PLACEHOLDER) inside its host span, so the
480
- wrapper element is never actually childless. data-empty (kept in sync by
481
- EditableBlockContent's syncEmptyAttr against the *logical* run content,
482
- not the DOM) is the real signal. */
483
-
484
- [data-placeholder][data-empty]:focus-within::before {
485
- content: attr(data-placeholder);
486
- position: absolute;
487
- color: var(--noteloom-text-faint);
488
- font-weight: 400;
489
- font-style: normal;
490
- opacity: 0.85;
491
- pointer-events: none;
492
- }
493
-
494
- .be-button-block-open,
495
- .be-button-block-settings {
496
- flex: none;
497
- border: none;
498
- background: rgba(255, 255, 255, 0.16);
499
- color: inherit;
500
- border-radius: var(--noteloom-radius-sm);
501
- width: 24px;
502
- height: 24px;
503
- display: flex;
504
- align-items: center;
505
- justify-content: center;
506
- cursor: pointer;
507
- }
508
-
509
- .be-button-block-open:disabled {
510
- opacity: 0.5;
511
- cursor: not-allowed;
512
- }
513
-
514
- .be-button-block-open:hover:not(:disabled),
515
- .be-button-block-settings:hover {
516
- background: rgba(255, 255, 255, 0.28);
517
- }
518
-
519
- /* --- embed (image/video/audio/file) --- */
520
-
521
- .be-embed {
522
- margin: 0.6em 0;
523
- }
524
-
525
- .be-embed-preview {
526
- position: relative;
527
- display: flex;
528
- }
529
-
530
- .be-embed-align-left {
531
- justify-content: flex-start;
532
- }
533
-
534
- .be-embed-align-center {
535
- justify-content: center;
536
- }
537
-
538
- .be-embed-align-right {
539
- justify-content: flex-end;
540
- }
541
-
542
- .be-embed-frame {
543
- position: relative;
544
- max-width: 100%;
545
- overflow: visible;
546
- border-radius: var(--noteloom-radius-lg);
547
- }
548
-
549
- .be-embed-image,
550
- .be-embed-video {
551
- border: 1px solid var(--noteloom-border);
552
- }
553
-
554
- .be-embed-image,
555
- .be-embed-video {
556
- max-width: 100%;
557
- display: block;
558
- border-radius: var(--noteloom-radius-lg);
559
- }
560
-
561
- .be-embed-audio {
562
- width: 100%;
563
- }
564
-
565
- .be-embed-file-link {
566
- display: flex;
567
- align-items: center;
568
- gap: 0.5em;
569
- padding: 0.75em 1em;
570
- border: 1px solid var(--noteloom-border);
571
- border-radius: var(--noteloom-radius-xl);
572
- text-decoration: none;
573
- color: var(--noteloom-accent);
574
- font-weight: 500;
575
- font-size: 0.9rem;
576
- }
577
-
578
- .be-embed-file-link:hover {
579
- background: var(--noteloom-bg-subtle);
580
- }
581
-
582
- .be-embed-toolbar {
583
- position: absolute;
584
- top: 8px;
585
- right: 8px;
586
- z-index: 2;
587
- display: flex;
588
- align-items: center;
589
- gap: 2px;
590
- padding: 3px;
591
- background: rgba(15, 23, 42, 0.72);
592
- border-radius: var(--noteloom-radius-md);
593
- opacity: 0;
594
- transition: opacity 0.12s ease;
595
- }
596
-
597
- .be-embed-preview:hover .be-embed-toolbar,
598
- .be-embed-toolbar:focus-within {
599
- opacity: 1;
600
- }
601
-
602
- .be-embed-toolbar-btn {
603
- border: none;
604
- background: transparent;
605
- width: 24px;
606
- height: 24px;
607
- display: flex;
608
- align-items: center;
609
- justify-content: center;
610
- color: rgba(255, 255, 255, 0.8);
611
- border-radius: var(--noteloom-radius-sm);
612
- cursor: pointer;
613
- }
614
-
615
- .be-embed-toolbar-btn:hover {
616
- background: rgba(255, 255, 255, 0.16);
617
- color: #fff;
618
- }
619
-
620
- .be-embed-toolbar-btn-active {
621
- background: var(--noteloom-accent);
622
- color: #fff;
623
- }
624
-
625
- .be-embed-remove {
626
- border: none;
627
- background: transparent;
628
- border-radius: var(--noteloom-radius-sm);
629
- padding: 0 8px;
630
- height: 24px;
631
- color: rgba(255, 255, 255, 0.8);
632
- font-size: 0.75rem;
633
- cursor: pointer;
634
- }
635
-
636
- .be-embed-remove:hover {
637
- background: rgba(255, 255, 255, 0.16);
638
- color: #fff;
639
- }
640
-
641
- .be-embed-resize-handle {
642
- position: absolute;
643
- bottom: 4px;
644
- right: 4px;
645
- width: 12px;
646
- height: 12px;
647
- cursor: nwse-resize;
648
- border-radius: 2px;
649
- border: 1px solid #fff;
650
- background: var(--noteloom-accent);
651
- }
652
-
653
- .be-embed-dropzone {
654
- border: 1.5px dashed var(--noteloom-border);
655
- border-radius: var(--noteloom-radius-xl);
656
- padding: 2.2em;
657
- display: flex;
658
- flex-direction: column;
659
- align-items: center;
660
- gap: 0.6em;
661
- text-align: center;
662
- color: var(--noteloom-text-muted);
663
- }
664
-
665
- .be-embed-dropzone-active {
666
- border-color: var(--noteloom-accent);
667
- background: var(--noteloom-accent-soft);
668
- color: var(--noteloom-accent);
669
- }
670
-
671
- .be-embed-upload-btn {
672
- background: var(--noteloom-accent);
673
- color: var(--noteloom-accent-text);
674
- border-radius: var(--noteloom-radius-md);
675
- padding: 0.5em 1.1em;
676
- cursor: pointer;
677
- font-size: 0.85rem;
678
- font-weight: 500;
679
- }
680
-
681
- .be-embed-upload-btn input {
682
- display: none;
683
- }
684
-
685
- .be-embed-dropzone-hint {
686
- font-size: 0.8rem;
687
- color: var(--noteloom-text-faint);
688
- }
689
-
690
- .be-embed-url-row {
691
- display: flex;
692
- gap: 6px;
693
- width: 100%;
694
- max-width: 360px;
695
- }
696
-
697
- .be-embed-url-input {
698
- flex: 1;
699
- min-width: 0;
700
- border: 1px solid var(--noteloom-border);
701
- border-radius: var(--noteloom-radius-md);
702
- padding: 0.45em 0.7em;
703
- background: transparent;
704
- color: inherit;
705
- font: inherit;
706
- font-size: 0.85rem;
707
- outline: none;
708
- }
709
-
710
- .be-embed-url-input:focus {
711
- border-color: var(--noteloom-accent);
712
- }
713
-
714
- .be-embed-url-commit {
715
- border: none;
716
- background: var(--noteloom-accent);
717
- color: var(--noteloom-accent-text);
718
- border-radius: var(--noteloom-radius-md);
719
- padding: 0.45em 0.9em;
720
- cursor: pointer;
721
- font-size: 0.85rem;
722
- font-weight: 500;
723
- }
724
-
725
- /* --- table --- */
726
-
727
- .be-table-scroll {
728
- max-width: 100%;
729
- overflow-x: auto;
730
- }
731
-
732
- .be-table-wrapper {
733
- margin: 0.9em 0;
734
- overflow-x: auto;
735
- border: 1px solid var(--noteloom-border);
736
- border-radius: var(--noteloom-radius-lg);
737
- width: max-content;
738
- }
739
-
740
- .be-table {
741
- border-collapse: collapse;
742
- table-layout: fixed;
743
- /* Deliberately no width:100% — combined with table-layout:fixed and each
744
- column's own <col> width, that would make the browser redistribute
745
- leftover space proportionally across columns, fighting individual
746
- column resize (see be-table-col-resize-handle). */
747
- }
748
-
749
- .be-table-header-row {
750
- background: var(--noteloom-bg-subtle);
751
- }
752
-
753
- .be-table-header-cell {
754
- position: relative;
755
- border-bottom: 1px solid var(--noteloom-border);
756
- border-right: 1px solid var(--noteloom-border);
757
- padding: 6px 10px;
758
- }
759
-
760
- .be-table-header-label {
761
- display: block;
762
- width: 100%;
763
- border: none;
764
- background: none;
765
- font: inherit;
766
- font-weight: 600;
767
- font-size: 0.78rem;
768
- color: var(--noteloom-text-muted);
769
- outline: none;
770
- overflow: hidden;
771
- text-overflow: ellipsis;
772
- white-space: nowrap;
773
- padding: 2px 0;
774
- }
775
-
776
- .be-table-header-menu-trigger {
777
- position: absolute;
778
- right: 4px;
779
- top: 50%;
780
- transform: translateY(-50%);
781
- visibility: hidden;
782
- border: none;
783
- background: transparent;
784
- border-radius: var(--noteloom-radius-sm);
785
- padding: 2px;
786
- color: var(--noteloom-text-faint);
787
- cursor: pointer;
788
- }
789
-
790
- .be-table-header-cell:hover .be-table-header-menu-trigger {
791
- visibility: visible;
792
- }
793
-
794
- .be-table-header-menu-trigger:hover {
795
- background: var(--noteloom-bg-hover);
796
- }
797
-
798
- .be-table-col-resize-handle {
799
- position: absolute;
800
- top: 0;
801
- right: -3px;
802
- width: 6px;
803
- height: 100%;
804
- cursor: col-resize;
805
- z-index: 1;
806
- }
807
-
808
- .be-table-col-resize-handle:hover,
809
- .be-table-col-resize-handle:active {
810
- background: var(--noteloom-accent-soft-hover);
811
- }
812
-
813
- .be-table-header-spacer {
814
- border-bottom: 1px solid var(--noteloom-border);
815
- }
816
-
817
- .be-table-header-spacer-col {
818
- width: 32px;
819
- }
820
-
821
- .be-table-header-menu {
822
- z-index: 1000;
823
- width: 224px;
824
- border-radius: var(--noteloom-radius-lg);
825
- border: 1px solid var(--noteloom-border);
826
- background: var(--noteloom-bg);
827
- padding: 4px;
828
- font-size: 0.88rem;
829
- box-shadow: var(--noteloom-shadow);
830
- }
831
-
832
- .be-table-header-menu-options {
833
- z-index: 1000;
834
- padding: 4px;
835
- font-size: 0.88rem;
836
- border-bottom: 1px solid var(--noteloom-border);
837
- margin-bottom: 4px;
838
- }
839
-
840
- .be-table-header-menu-type {
841
- display: flex;
842
- flex-direction: row;
843
- justify-content: space-between;
844
- padding: 6px;
845
- border-bottom: 1px solid var(--noteloom-border);
846
- margin-bottom: 4px;
847
- }
848
-
849
- .be-table-header-type-select {
850
- width: 100%;
851
- border: 1px solid var(--noteloom-border);
852
- border-radius: var(--noteloom-radius-sm);
853
- padding: 6px 8px;
854
- background: transparent;
855
- color: inherit;
856
- font: inherit;
857
- font-size: 0.85rem;
858
- }
859
-
860
- .be-table-header-menu-item {
861
- display: flex;
862
- align-items: center;
863
- gap: 8px;
864
- width: 100%;
865
- text-align: left;
866
- border: none;
867
- border-radius: var(--noteloom-radius-sm);
868
- background: transparent;
869
- padding: 6px 10px;
870
- font: inherit;
871
- font-size: 0.88rem;
872
- color: var(--noteloom-text);
873
- cursor: pointer;
874
- }
875
-
876
- .be-table-header-menu-item:hover {
877
- background: var(--noteloom-bg-hover);
878
- }
879
-
880
- .be-table-header-menu-item-danger {
881
- color: var(--noteloom-danger);
882
- }
883
-
884
- .be-table-header-menu-item-danger:hover {
885
- background: var(--noteloom-danger-soft);
886
- }
887
-
888
- .be-table-header-menu-options-label {
889
- font-size: 0.68rem;
890
- text-transform: uppercase;
891
- letter-spacing: 0.04em;
892
- font-weight: 600;
893
- color: var(--noteloom-text-faint);
894
- padding: 6px 8px 2px;
895
- }
896
-
897
- .be-table-header-menu-option-row {
898
- display: flex;
899
- align-items: center;
900
- gap: 6px;
901
- padding: 2px 4px;
902
- }
903
-
904
- .be-table-header-menu-option-swatch {
905
- width: 14px;
906
- height: 14px;
907
- border-radius: 50%;
908
- flex: none;
909
- }
910
-
911
- .be-table-header-menu-option-input {
912
- flex: 1;
913
- min-width: 0;
914
- border: none;
915
- background: transparent;
916
- color: inherit;
917
- font: inherit;
918
- font-size: 0.85rem;
919
- padding: 4px 6px;
920
- border-radius: var(--noteloom-radius-sm);
921
- outline: none;
922
- }
923
-
924
- .be-table-header-menu-option-input:focus {
925
- background: var(--noteloom-bg-hover);
926
- }
927
-
928
- .be-table-header-menu-option-remove,
929
- .be-table-header-menu-option-add {
930
- flex: none;
931
- border: none;
932
- background: transparent;
933
- color: var(--noteloom-text-faint);
934
- cursor: pointer;
935
- padding: 3px;
936
- display: flex;
937
- align-items: center;
938
- justify-content: center;
939
- border-radius: var(--noteloom-radius-sm);
940
- }
941
-
942
- .be-table-header-menu-option-remove:hover {
943
- background: var(--noteloom-danger-soft);
944
- color: var(--noteloom-danger);
945
- }
946
-
947
- .be-table-header-menu-option-add {
948
- color: var(--noteloom-text-muted);
949
- }
950
-
951
- .be-table-header-menu-option-add:hover {
952
- background: var(--noteloom-bg-hover);
953
- }
954
-
955
- .be-table-row:hover {
956
- background: var(--noteloom-bg-subtle);
957
- }
958
-
959
- .be-table-cell {
960
- border-bottom: 1px solid var(--noteloom-border);
961
- border-right: 1px solid var(--noteloom-border);
962
- padding: 6px 10px;
963
- vertical-align: top;
964
- outline: none;
965
- font-size: 0.92rem;
966
- /* table-layout: fixed already keeps the COLUMN width from growing to fit
967
- content — this is what stops a long unbroken string (a URL, one giant
968
- word) from visually overflowing past that fixed width instead of
969
- wrapping onto a new line within the cell. */
970
- max-width: 0;
971
- overflow-wrap: anywhere;
972
- word-break: break-word;
973
- }
974
-
975
- .be-table-cell:focus-within {
976
- box-shadow: inset 0 0 0 2px var(--noteloom-accent);
977
- border-radius: 2px;
978
- }
979
-
980
- .be-table-row-actions {
981
- width: 32px;
982
- text-align: center;
983
- vertical-align: middle;
984
- border: none;
985
- background: transparent;
986
- padding: 0;
987
- }
988
-
989
- .be-table-delete-row {
990
- visibility: hidden;
991
- border: none;
992
- background: transparent;
993
- color: var(--noteloom-text-faint);
994
- cursor: pointer;
995
- width: 24px;
996
- height: 24px;
997
- display: inline-flex;
998
- align-items: center;
999
- justify-content: center;
1000
- border-radius: var(--noteloom-radius-sm);
1001
- }
1002
-
1003
- tr.be-table-row:hover .be-table-delete-row {
1004
- visibility: visible;
1005
- }
1006
-
1007
- .be-table-delete-row:hover {
1008
- background: var(--noteloom-danger-soft);
1009
- color: var(--noteloom-danger);
1010
- }
1011
-
1012
- .be-table-add-row {
1013
- display: block;
1014
- width: 100%;
1015
- border: none;
1016
- background: transparent;
1017
- text-align: left;
1018
- padding: 8px 12px;
1019
- color: var(--noteloom-text-faint);
1020
- cursor: pointer;
1021
- font: inherit;
1022
- font-size: 0.85rem;
1023
- font-weight: 500;
1024
- }
1025
-
1026
- .be-table-add-row:hover {
1027
- background: var(--noteloom-bg-subtle);
1028
- color: var(--noteloom-accent);
1029
- }
1030
-
1031
- .be-inline-table-select {
1032
- display: block;
1033
- }
1034
-
1035
- .be-inline-table-select .be-select {
1036
- width: 100%;
1037
- }
1038
-
1039
- .be-inline-table-select .be-select .be-select-tag {
1040
- width: -webkit-fill-available;
1041
- }
1042
-
1043
- .be-inline-table-select .be-select-trigger {
1044
- display: flex;
1045
- width: 100%;
1046
- min-width: 0;
1047
- min-height: 0;
1048
- border: none;
1049
- border-radius: var(--noteloom-radius-sm);
1050
- background: transparent;
1051
- padding: 0;
1052
- font: inherit;
1053
- font-size: 0.92rem;
1054
- }
1055
-
1056
- .be-inline-table-select .be-select-trigger:hover,
1057
- .be-inline-table-select .be-select-trigger[aria-expanded='true'] {
1058
- background: var(--noteloom-bg-hover);
1059
- box-shadow: none;
1060
- }
1061
-
1062
- /* --- per-block hover gutter (+ / drag-handle / menu) --- */
1063
-
1064
- .be-block-row {
1065
- position: relative;
1066
- }
1067
-
1068
- .be-block-row-hidden {
1069
- opacity: 0.4;
1070
- }
1071
-
1072
- .be-block-gutter {
1073
- position: absolute;
1074
- left: -56px;
1075
- top: 0.15em;
1076
- display: flex;
1077
- gap: 2px;
1078
- opacity: 0;
1079
- transition: opacity 0.1s ease;
1080
- user-select: none; /* it's a drag handle (see useBlockRangeDrag) never let its own space become selectable text */
1081
- }
1082
-
1083
- .be-block-row:hover .be-block-gutter,
1084
- .be-block-gutter-active {
1085
- opacity: 1;
1086
- }
1087
-
1088
- .be-block-gutter-btn {
1089
- display: flex;
1090
- align-items: center;
1091
- justify-content: center;
1092
- width: 24px;
1093
- height: 24px;
1094
- border: none;
1095
- border-radius: var(--noteloom-radius-sm);
1096
- background: transparent;
1097
- color: var(--noteloom-text-faint);
1098
- cursor: pointer;
1099
- transition: background-color 0.12s ease, color 0.12s ease;
1100
- }
1101
-
1102
- .be-block-gutter-btn:hover,
1103
- .be-block-gutter-btn[aria-expanded='true'] {
1104
- background: var(--noteloom-bg-hover);
1105
- color: var(--noteloom-text);
1106
- }
1107
-
1108
- .be-block-gutter-menu,
1109
- .be-block-range-menu {
1110
- z-index: 1000;
1111
- min-width: 200px;
1112
- background: var(--noteloom-bg);
1113
- border: 1px solid var(--noteloom-border);
1114
- border-radius: var(--noteloom-radius-lg);
1115
- box-shadow: var(--noteloom-shadow);
1116
- padding: 4px;
1117
- }
1118
-
1119
- .be-block-gutter-menu-item,
1120
- .be-block-range-menu-item {
1121
- display: flex;
1122
- align-items: center;
1123
- gap: 8px;
1124
- width: 100%;
1125
- text-align: left;
1126
- border: none;
1127
- border-radius: var(--noteloom-radius-sm);
1128
- background: transparent;
1129
- padding: 7px 10px;
1130
- font: inherit;
1131
- font-size: 0.88rem;
1132
- color: var(--noteloom-text);
1133
- cursor: pointer;
1134
- }
1135
-
1136
- .be-block-gutter-menu-item:hover,
1137
- .be-block-range-menu-item:hover {
1138
- background: var(--noteloom-bg-hover);
1139
- }
1140
-
1141
- .be-block-gutter-menu-item-danger,
1142
- .be-block-range-menu-item-danger {
1143
- color: var(--noteloom-danger);
1144
- }
1145
-
1146
- .be-block-gutter-menu-item-danger:hover,
1147
- .be-block-range-menu-item-danger:hover {
1148
- background: var(--noteloom-danger-soft);
1149
- }
1150
-
1151
- /* --- drag-in-the-margin block range selection --- */
1152
-
1153
- .be-block-row-range-selected {
1154
- background: var(--noteloom-accent-soft);
1155
- border-radius: var(--noteloom-radius-md);
1156
- margin: 0 -8px;
1157
- padding: 0 8px;
1158
- }
1159
-
1160
- .be-block-range-dragging,
1161
- .be-block-range-dragging * {
1162
- user-select: none !important;
1163
- }
1164
-
1165
- /* --- whole-document select-all / single non-editable block selected --- */
1166
-
1167
- .be-surface--all-selected .be-block-row-content > [data-block-id] {
1168
- background: var(--noteloom-accent-soft);
1169
- border-radius: var(--noteloom-radius-sm);
1170
- }
1171
-
1172
- .be-block-selected {
1173
- outline: 2px solid var(--noteloom-accent);
1174
- outline-offset: 2px;
1175
- border-radius: var(--noteloom-radius-sm);
1176
- }
1177
-
1178
- /* --- document export (view source) --- */
1179
-
1180
- .be-export-trigger {
1181
- display: inline-flex;
1182
- align-items: center;
1183
- gap: 6px;
1184
- border: 1px solid var(--noteloom-border);
1185
- background: var(--noteloom-bg);
1186
- color: var(--noteloom-text-muted);
1187
- border-radius: var(--noteloom-radius-sm);
1188
- padding: 5px 10px;
1189
- font-size: 0.85rem;
1190
- cursor: pointer;
1191
- }
1192
-
1193
- .be-export-trigger:hover {
1194
- background: var(--noteloom-bg-hover);
1195
- color: var(--noteloom-text);
1196
- }
1197
-
1198
- .be-export-tabs {
1199
- display: flex;
1200
- gap: 4px;
1201
- margin-bottom: 10px;
1202
- border-bottom: 1px solid var(--noteloom-border);
1203
- }
1204
-
1205
- .be-export-tab {
1206
- border: none;
1207
- background: transparent;
1208
- color: var(--noteloom-text-muted);
1209
- padding: 6px 10px;
1210
- margin-bottom: -1px;
1211
- border-bottom: 2px solid transparent;
1212
- font-size: 0.85rem;
1213
- font-weight: 500;
1214
- cursor: pointer;
1215
- }
1216
-
1217
- .be-export-tab:hover {
1218
- color: var(--noteloom-text);
1219
- }
1220
-
1221
- .be-export-tab-active {
1222
- color: var(--noteloom-accent);
1223
- border-bottom-color: var(--noteloom-accent);
1224
- }
1225
-
1226
- .be-export-pre {
1227
- max-height: 50vh;
1228
- overflow: auto;
1229
- margin: 0;
1230
- padding: 0.9em 1em;
1231
- border-radius: var(--noteloom-radius-md);
1232
- background: var(--noteloom-code-bg);
1233
- color: var(--noteloom-code-text);
1234
- font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
1235
- font-size: 0.8rem;
1236
- line-height: 1.5;
1237
- white-space: pre-wrap;
1238
- overflow-wrap: anywhere;
1239
- }
1240
-
1241
- /* --- trailing click-to-continue space --- */
1242
-
1243
- .be-trailing-space {
1244
- cursor: text;
1245
- width: 100%;
1246
- min-height: 180px;
1247
- }
1248
-
1249
- /* --- modal (button editor, field type editor) --- */
1250
-
1251
- .be-modal-overlay {
1252
- position: fixed;
1253
- inset: 0;
1254
- background: rgba(15, 23, 42, 0.45);
1255
- display: flex;
1256
- align-items: center;
1257
- justify-content: center;
1258
- z-index: 2000;
1259
- padding: 1em;
1260
- }
1261
-
1262
- .be-modal {
1263
- background: var(--noteloom-bg);
1264
- color: var(--noteloom-text);
1265
- border-radius: var(--noteloom-radius-xl);
1266
- border: 1px solid var(--noteloom-border);
1267
- padding: 1.4em;
1268
- width: 100%;
1269
- max-width: 380px;
1270
- max-height: 85vh;
1271
- overflow-y: auto;
1272
- box-shadow: var(--noteloom-shadow);
1273
- }
1274
-
1275
- .be-modal-large {
1276
- max-width: 640px;
1277
- }
1278
-
1279
- .be-modal-title {
1280
- font-weight: 600;
1281
- font-size: 1.05rem;
1282
- margin-bottom: 1em;
1283
- }
1284
-
1285
- .be-modal-field {
1286
- display: block;
1287
- margin-bottom: 1em;
1288
- }
1289
-
1290
- .be-modal-field > span {
1291
- display: block;
1292
- font-size: 0.8rem;
1293
- color: var(--noteloom-text-muted);
1294
- margin-bottom: 5px;
1295
- }
1296
-
1297
- .be-modal-field input[type='text'],
1298
- .be-modal-field input[type='url'] {
1299
- width: 100%;
1300
- box-sizing: border-box;
1301
- border: 1px solid var(--noteloom-border);
1302
- border-radius: var(--noteloom-radius-md);
1303
- padding: 0.55em 0.75em;
1304
- background: transparent;
1305
- color: inherit;
1306
- font: inherit;
1307
- outline: none;
1308
- }
1309
-
1310
- .be-modal-field input[type='text']:focus,
1311
- .be-modal-field input[type='url']:focus {
1312
- border-color: var(--noteloom-accent);
1313
- }
1314
-
1315
- .be-modal-field select {
1316
- width: 100%;
1317
- box-sizing: border-box;
1318
- border: 1px solid var(--noteloom-border);
1319
- border-radius: var(--noteloom-radius-md);
1320
- padding: 0.55em 0.75em;
1321
- background: transparent;
1322
- color: inherit;
1323
- font: inherit;
1324
- font-size: 0.9rem;
1325
- }
1326
-
1327
- .be-modal-field select:focus {
1328
- border-color: var(--noteloom-accent);
1329
- }
1330
-
1331
- .be-modal-color-row {
1332
- display: flex;
1333
- gap: 8px;
1334
- flex-wrap: wrap;
1335
- }
1336
-
1337
- .be-modal-color-swatch {
1338
- width: 26px;
1339
- height: 26px;
1340
- border-radius: 50%;
1341
- border: 2px solid transparent;
1342
- cursor: pointer;
1343
- }
1344
-
1345
- .be-modal-color-swatch-active {
1346
- border-color: var(--noteloom-accent);
1347
- box-shadow: 0 0 0 2px var(--noteloom-bg), 0 0 0 4px var(--noteloom-accent-soft);
1348
- }
1349
-
1350
- .be-modal-attr-row {
1351
- display: flex;
1352
- gap: 6px;
1353
- margin-bottom: 6px;
1354
- align-items: center;
1355
- }
1356
-
1357
- .be-modal-attr-row input {
1358
- flex: 1;
1359
- min-width: 0;
1360
- border: 1px solid var(--noteloom-border);
1361
- border-radius: var(--noteloom-radius-sm);
1362
- padding: 0.4em 0.6em;
1363
- background: transparent;
1364
- color: inherit;
1365
- font: inherit;
1366
- font-size: 0.85rem;
1367
- }
1368
-
1369
- .be-modal-attr-remove {
1370
- flex: none;
1371
- border: none;
1372
- background: none;
1373
- color: var(--noteloom-text-faint);
1374
- cursor: pointer;
1375
- padding: 2px;
1376
- border-radius: var(--noteloom-radius-sm);
1377
- }
1378
-
1379
- .be-modal-attr-remove:hover {
1380
- color: var(--noteloom-danger);
1381
- }
1382
-
1383
- .be-modal-actions {
1384
- display: flex;
1385
- justify-content: flex-end;
1386
- gap: 8px;
1387
- margin-top: 20px;
1388
- }
1389
-
1390
- .be-modal-delete {
1391
- margin-right: auto; /* pushes Cancel/Save to the right, Delete stays on its own at the left */
1392
- }
1393
-
1394
- .be-modal-cancel,
1395
- .be-modal-save,
1396
- .be-modal-delete {
1397
- border: none;
1398
- border-radius: var(--noteloom-radius-md);
1399
- padding: 7px 16px;
1400
- font-size: 0.85rem;
1401
- font-weight: 500;
1402
- cursor: pointer;
1403
- }
1404
-
1405
- .be-modal-delete {
1406
- background: var(--noteloom-danger-soft);
1407
- color: var(--noteloom-danger);
1408
- }
1409
-
1410
- .be-modal-cancel {
1411
- background: var(--noteloom-bg-subtle);
1412
- color: var(--noteloom-text);
1413
- }
1414
-
1415
- .be-modal-cancel:hover {
1416
- background: var(--noteloom-bg-hover);
1417
- }
1418
-
1419
- .be-modal-save {
1420
- background: var(--noteloom-accent);
1421
- color: var(--noteloom-accent-text);
1422
- }
1423
-
1424
- .be-modal-save:hover {
1425
- opacity: 0.9;
1426
- }
1427
-
1428
- .be-modal-save:disabled {
1429
- opacity: 0.5;
1430
- cursor: not-allowed;
1431
- }
1432
-
1433
- /* --- slash ("/") / emoji (":") / mention ("@") command menu --- */
1434
-
1435
- .be-slash-menu {
1436
- z-index: 1000;
1437
- width: 260px;
1438
- max-height: 320px;
1439
- overflow-y: auto;
1440
- background: var(--noteloom-bg);
1441
- border: 1px solid var(--noteloom-border);
1442
- border-radius: var(--noteloom-radius-lg);
1443
- box-shadow: var(--noteloom-shadow);
1444
- padding: 6px;
1445
- }
1446
-
1447
- .be-slash-menu-item {
1448
- display: flex;
1449
- align-items: center;
1450
- gap: 10px;
1451
- padding: 7px 8px;
1452
- border-radius: var(--noteloom-radius-md);
1453
- cursor: pointer;
1454
- font-size: 0.9rem;
1455
- color: var(--noteloom-text);
1456
- }
1457
-
1458
- .be-slash-menu-item-active,
1459
- .be-slash-menu-item:hover {
1460
- background: var(--noteloom-accent-soft);
1461
- }
1462
-
1463
- .be-slash-menu-item-icon {
1464
- flex: none;
1465
- display: flex;
1466
- align-items: center;
1467
- justify-content: center;
1468
- width: 28px;
1469
- height: 28px;
1470
- border-radius: var(--noteloom-radius-sm);
1471
- border: 1px solid var(--noteloom-border);
1472
- color: var(--noteloom-text-muted);
1473
- }
1474
-
1475
- .be-slash-menu-item-label {
1476
- flex: 1;
1477
- overflow: hidden;
1478
- text-overflow: ellipsis;
1479
- white-space: nowrap;
1480
- }
1481
-
1482
- /* --- searchable Select (inline select/date/checkbox widgets, custom field types, table column type) --- */
1483
-
1484
- .be-select {
1485
- display: inline-flex;
1486
- }
1487
-
1488
- .be-select-trigger {
1489
- display: inline-flex;
1490
- align-items: center;
1491
- gap: 6px;
1492
- min-height: 28px;
1493
- min-width: 6em;
1494
- border: 1px solid var(--noteloom-border);
1495
- border-radius: var(--noteloom-radius-md);
1496
- background: var(--noteloom-bg);
1497
- color: var(--noteloom-text);
1498
- font: inherit;
1499
- font-size: 0.88rem;
1500
- padding: 4px 8px;
1501
- cursor: pointer;
1502
- }
1503
-
1504
- .be-select-trigger:hover {
1505
- border-color: var(--noteloom-accent);
1506
- }
1507
-
1508
- .be-select-trigger[aria-expanded='true'] {
1509
- border-color: var(--noteloom-accent);
1510
- box-shadow: 0 0 0 2px var(--noteloom-accent-soft);
1511
- }
1512
-
1513
- .be-select-trigger-tag {
1514
- min-width: 0;
1515
- min-height: 0;
1516
- border: none;
1517
- background: transparent;
1518
- padding: 2px;
1519
- border-radius: var(--noteloom-radius-sm);
1520
- outline: none;
1521
- border: none;
1522
- }
1523
-
1524
- .be-select-trigger-tag:hover {
1525
- background: var(--noteloom-bg-hover);
1526
- }
1527
-
1528
- .be-select-trigger-tag[aria-expanded='true'] {
1529
- background: var(--noteloom-bg-hover);
1530
- box-shadow: none;
1531
- }
1532
-
1533
- .be-select-value-placeholder {
1534
- color: var(--noteloom-text-faint);
1535
- }
1536
-
1537
- .be-select-tag {
1538
- display: inline-flex;
1539
- flex: none;
1540
- max-width: 100%;
1541
- padding: 2px 9px;
1542
- border-radius: var(--noteloom-radius-sm);
1543
- font-size: 0.82em;
1544
- font-weight: 500;
1545
- line-height: 1.4;
1546
- /* Wraps rather than truncates — a fixed-width popover (see
1547
- .be-select-popover) or table cell (see .be-table-cell) combined with
1548
- nowrap+ellipsis let long option text silently overflow its box
1549
- instead of actually being clipped; wrapping sidesteps that entirely. */
1550
- white-space: normal;
1551
- overflow-wrap: anywhere;
1552
- word-break: break-word;
1553
- }
1554
-
1555
- .be-select-value {
1556
- flex: 1;
1557
- text-align: left;
1558
- overflow: hidden;
1559
- text-overflow: ellipsis;
1560
- white-space: nowrap;
1561
- }
1562
-
1563
- .be-select-chevron {
1564
- flex: none;
1565
- color: var(--noteloom-text-faint);
1566
- }
1567
-
1568
- .be-select-popover {
1569
- z-index: 1000;
1570
- width: 224px;
1571
- background: var(--noteloom-bg);
1572
- border: 1px solid var(--noteloom-border);
1573
- border-radius: var(--noteloom-radius-lg);
1574
- box-shadow: var(--noteloom-shadow);
1575
- overflow: hidden;
1576
- }
1577
-
1578
- .be-select-search {
1579
- display: block;
1580
- width: 100%;
1581
- box-sizing: border-box;
1582
- border: none;
1583
- border-bottom: 1px solid var(--noteloom-border);
1584
- background: transparent;
1585
- color: inherit;
1586
- padding: 10px 12px;
1587
- font: inherit;
1588
- font-size: 0.88rem;
1589
- outline: none;
1590
- }
1591
-
1592
- .be-select-options {
1593
- max-height: 220px;
1594
- overflow-y: auto;
1595
- overflow-x: hidden;
1596
- padding: 4px;
1597
- }
1598
-
1599
- .be-select-option {
1600
- display: flex;
1601
- align-items: center;
1602
- min-width: 0;
1603
- padding: 7px 8px;
1604
- border-radius: var(--noteloom-radius-sm);
1605
- cursor: pointer;
1606
- font-size: 0.88rem;
1607
- color: var(--noteloom-text);
1608
- }
1609
-
1610
- /* A tag-variant option list (colored pills — e.g. Priority/Assignee) must
1611
- read at the exact same size/weight as a plain default-variant list
1612
- (Diagnosis) — only the colored-chip background should differ between
1613
- them, not the typography. .be-select-tag's own font-size/weight (sized
1614
- down for when it's squeezed into a trigger button) would otherwise make
1615
- tag-variant options look smaller/bolder than plain ones for no reason. */
1616
- .be-select-option .be-select-tag {
1617
- font-size: inherit;
1618
- font-weight: inherit;
1619
- line-height: inherit;
1620
- width: -webkit-fill-available;
1621
- }
1622
-
1623
- .be-select-option-active {
1624
- background: var(--noteloom-accent-soft);
1625
- }
1626
-
1627
- .be-select-option-selected {
1628
- font-weight: 600;
1629
- }
1630
-
1631
- .be-select-option-selected:not(.be-select-option-active) {
1632
- background: var(--noteloom-bg-subtle);
1633
- }
1634
-
1635
- .be-select-option-selected .be-select-tag {
1636
- font-weight: 500;
1637
- box-shadow: inset 0 0 0 1.5px rgba(0, 0, 0, 0.2);
1638
- }
1639
-
1640
- .be-select-empty {
1641
- padding: 10px 12px;
1642
- color: var(--noteloom-text-faint);
1643
- font-size: 0.85rem;
1644
- text-align: center;
1645
- }
1646
-
1647
- .be-select-error {
1648
- color: var(--noteloom-danger);
1649
- }
1650
-
1651
- .be-select-manage-options {
1652
- display: block;
1653
- width: 100%;
1654
- box-sizing: border-box;
1655
- border: none;
1656
- border-top: 1px solid var(--noteloom-border);
1657
- background: transparent;
1658
- padding: 9px 12px;
1659
- font: inherit;
1660
- font-size: 0.82rem;
1661
- font-weight: 500;
1662
- color: var(--noteloom-accent);
1663
- text-align: left;
1664
- cursor: pointer;
1665
- }
1666
-
1667
- .be-select-manage-options:hover {
1668
- background: var(--noteloom-accent-soft);
1669
- }
1670
-
1671
- .be-inline-select,
1672
- .be-inline-date,
1673
- .be-inline-checkbox {
1674
- display: inline-flex;
1675
- align-items: center;
1676
- vertical-align: middle;
1677
- }
1678
-
1679
- /* Inline chips sit in running text — match the surrounding line's own font
1680
- size instead of the smaller size used for the Select component elsewhere
1681
- (menus, table column type dropdown), where a compact UI size is right. */
1682
- .be-inline-select .be-select-trigger {
1683
- min-height: 0;
1684
- font-size: 1em;
1685
- padding: 1px 8px;
1686
- }
1687
-
1688
- .be-inline-select .be-select-tag {
1689
- font-size: 0.92em;
1690
- }
1691
-
1692
- /* A mention reads as highlighted text sitting inline in the paragraph, not
1693
- a bulky standalone pill/button — minimal padding, small radius, no extra
1694
- chrome from the trigger button wrapping it. */
1695
- .be-inline-select .be-select-trigger-mention {
1696
- padding: 0 !important;
1697
- border-radius: 3px;
1698
- }
1699
-
1700
- /* A mention chip always uses this one fixed color, not each option's own
1701
- tag color — matches Notion/Slack/GitHub's "@mentions are one consistent
1702
- color" convention rather than a per-person palette. */
1703
- .be-select-tag-mention {
1704
- background: var(--noteloom-accent-soft);
1705
- color: var(--noteloom-accent);
1706
- font-weight: 500;
1707
- padding: 0 3px;
1708
- border-radius: 3px;
1709
- line-height: inherit;
1710
- }
1711
-
1712
- .be-inline-date input[type='date'] {
1713
- border: 1px solid var(--noteloom-border);
1714
- border-radius: var(--noteloom-radius-md);
1715
- background: var(--noteloom-bg);
1716
- color: inherit;
1717
- padding: 4px 8px;
1718
- font: inherit;
1719
- font-size: 0.88rem;
1720
- }
1721
-
1722
- .be-inline-checkbox {
1723
- gap: 6px;
1724
- }
1725
-
1726
- .be-inline-checkbox-input {
1727
- flex: none;
1728
- width: 16px;
1729
- height: 16px;
1730
- margin: 0;
1731
- accent-color: var(--noteloom-accent);
1732
- cursor: pointer;
1733
- }
1734
-
1735
- .be-inline-checkbox-label {
1736
- min-width: 0;
1737
- flex: 1;
1738
- border: 1px solid var(--noteloom-border);
1739
- border-radius: var(--noteloom-radius-sm);
1740
- background: transparent;
1741
- color: inherit;
1742
- font: inherit;
1743
- padding: 2px 8px;
1744
- outline: none;
1745
- }
1746
-
1747
- .be-inline-checkbox-label:focus {
1748
- border-color: var(--noteloom-accent);
1749
- }
1750
-
1751
- /* In a table cell (checkbox column), the browser's default text-input
1752
- width (~170px+) is wider than most columns, forcing the input — and with
1753
- it, the whole table — past the cell's own bounds. Constraining the
1754
- inline-flex row to the cell's actual width lets the label's flex:1 +
1755
- min-width:0 (above) do their job and shrink the input to fit instead. */
1756
- .be-table-cell .be-inline-checkbox {
1757
- display: flex;
1758
- width: 100%;
1759
- }
1760
-
1761
- .be-inline-checkbox-label::placeholder {
1762
- color: var(--noteloom-text-faint);
1763
- }
1764
-
1765
- /* --- floating (selection) format toolbar --- */
1766
-
1767
- .be-floating-toolbar {
1768
- display: flex;
1769
- align-items: center;
1770
- gap: 2px;
1771
- background: var(--noteloom-text);
1772
- border-radius: var(--noteloom-radius-md);
1773
- padding: 4px;
1774
- box-shadow: var(--noteloom-shadow);
1775
- z-index: 1000;
1776
- }
1777
-
1778
- .be-floating-toolbar-btn {
1779
- border: none;
1780
- background: transparent;
1781
- color: rgba(255, 255, 255, 0.85);
1782
- width: 30px;
1783
- height: 30px;
1784
- display: flex;
1785
- align-items: center;
1786
- justify-content: center;
1787
- border-radius: var(--noteloom-radius-sm);
1788
- cursor: pointer;
1789
- }
1790
-
1791
- .be-floating-toolbar-btn:hover {
1792
- background: rgba(255, 255, 255, 0.14);
1793
- }
1794
-
1795
- .be-floating-toolbar-btn-active {
1796
- background: var(--noteloom-accent);
1797
- color: #fff;
1798
- }
1799
-
1800
- .be-floating-toolbar-divider {
1801
- width: 1px;
1802
- height: 20px;
1803
- background: rgba(255, 255, 255, 0.2);
1804
- margin: 0 4px;
1805
- }
1806
-
1807
- .be-floating-toolbar-picker-wrap {
1808
- position: relative;
1809
- }
1810
-
1811
- .be-floating-toolbar-picker {
1812
- position: absolute;
1813
- top: 100%;
1814
- left: 0;
1815
- margin-top: 8px;
1816
- display: flex;
1817
- gap: 4px;
1818
- background: var(--noteloom-bg);
1819
- border-radius: var(--noteloom-radius-md);
1820
- padding: 6px;
1821
- box-shadow: var(--noteloom-shadow);
1822
- }
1823
-
1824
- .be-floating-toolbar-swatch {
1825
- width: 22px;
1826
- height: 22px;
1827
- border-radius: 50%;
1828
- border: 1px solid rgba(0, 0, 0, 0.1);
1829
- cursor: pointer;
1830
- }
1831
-
1832
- /* --- link hover card (edit/remove an existing link mark) --- */
1833
-
1834
- .be-link-hover-card {
1835
- z-index: 1000;
1836
- display: flex;
1837
- align-items: center;
1838
- gap: 2px;
1839
- max-width: 320px;
1840
- background: var(--noteloom-bg);
1841
- border: 1px solid var(--noteloom-border);
1842
- border-radius: var(--noteloom-radius-md);
1843
- padding: 5px 6px 5px 10px;
1844
- box-shadow: var(--noteloom-shadow);
1845
- font-size: 0.85rem;
1846
- }
1847
-
1848
- .be-link-hover-card-url {
1849
- flex: 1;
1850
- min-width: 0;
1851
- overflow: hidden;
1852
- text-overflow: ellipsis;
1853
- white-space: nowrap;
1854
- color: var(--noteloom-accent);
1855
- text-decoration: none;
1856
- }
1857
-
1858
- .be-link-hover-card-url:hover {
1859
- text-decoration: underline;
1860
- }
1861
-
1862
- .be-link-hover-card-btn {
1863
- flex: none;
1864
- width: 24px;
1865
- height: 24px;
1866
- border: none;
1867
- background: transparent;
1868
- color: var(--noteloom-text-muted);
1869
- display: flex;
1870
- align-items: center;
1871
- justify-content: center;
1872
- border-radius: var(--noteloom-radius-sm);
1873
- cursor: pointer;
1874
- }
1875
-
1876
- .be-link-hover-card-btn:hover {
1877
- background: var(--noteloom-bg-hover);
1878
- color: var(--noteloom-text);
1879
- }
1880
- `,ot="noteloom-default-styles";function It(){if(typeof document>"u"||document.getElementById(ot))return;const e=document.createElement("style");e.id=ot,e.textContent=kr,document.head.appendChild(e)}const wt=f.createContext(null);function yr({store:e,registry:n,inlineRegistry:t=null,history:o=null,className:r,style:l,theme:s="default",getBlockClassName:c,children:i}){f.useEffect(()=>{s!=="none"&&It()},[s]);const[u,p]=f.useState(!1),[d,b]=f.useState([]),[h,m]=f.useState(!1),[g,x]=f.useState(null),k=f.useCallback(()=>x("new"),[]),I=f.useCallback(v=>x(v),[]),y=f.useCallback(()=>x(null),[]),E=f.useRef(null),R=f.useCallback(()=>E.current,[]),S=f.useCallback(v=>{var B,O;const j=E.current;j!==v&&(j&&((B=document.querySelector(`[data-block-id="${j}"]`))==null||B.classList.remove("be-block-selected")),E.current=v,v&&((O=document.querySelector(`[data-block-id="${v}"]`))==null||O.classList.add("be-block-selected")))},[]),C=f.useMemo(()=>({store:e,registry:n,inlineRegistry:t,history:o,isWholeDocumentSelected:u,setIsWholeDocumentSelected:p,selectedBlockRange:d,setSelectedBlockRange:b,getSelectedBlockId:R,setSelectedBlockId:S,isPreviewMode:h,setIsPreviewMode:m,fieldTypeEditorTarget:g,openCreateFieldType:k,openEditFieldType:I,closeFieldTypeEditor:y,getBlockClassName:c}),[e,n,t,o,u,d,R,S,h,g,k,I,y,c]),w=r||l?a.jsx("div",{className:r?`be-root ${r}`:"be-root",style:l,children:i}):i;return a.jsx(wt.Provider,{value:C,children:w})}function pe(){const e=f.useContext(wt);if(!e)throw new Error("Editor hooks must be used within an <EditorProvider>");return e}function D(){return pe().store}function Ne(){return pe().registry}function he(){return pe().inlineRegistry}function Nn(){const{isWholeDocumentSelected:e,setIsWholeDocumentSelected:n}=pe();return[e,n]}function We(){const{selectedBlockRange:e,setSelectedBlockRange:n}=pe();return[e,n]}function ge(){const{getSelectedBlockId:e,setSelectedBlockId:n}=pe();return{getSelectedBlockId:e,setSelectedBlockId:n}}function Mn(){const{isPreviewMode:e,setIsPreviewMode:n}=pe();return[e,n]}function ee(e,n){const{getBlockClassName:t}=pe(),o=n&&t?t(n):void 0;return o?`${e} ${o}`:e}function An(){const{fieldTypeEditorTarget:e,openCreateFieldType:n,openEditFieldType:t,closeFieldTypeEditor:o}=pe();return{target:e,openCreate:n,openEdit:t,close:o}}function Q(e){const n=D(),t=f.useCallback(r=>n.subscribe(e,r),[n,e]),o=f.useCallback(()=>n.getBlock(e),[n,e]);return f.useSyncExternalStore(t,o)}function ye(e){const n=D(),t=f.useCallback(r=>n.subscribe(e,r),[n,e]),o=f.useCallback(()=>n.getRun(e),[n,e]);return f.useSyncExternalStore(t,o)}function T(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`id-${Date.now()}-${Math.random().toString(36).slice(2)}`}const Ct="​",vr=/​/g;function me(e){return(e??"").replace(vr,"")}function rt(e){return me(e.textContent)}function Ir(e,n){var c;const t=new Map(n.map(i=>[i.id,i])),o=new Set,r=[];let l=!0;for(const i of e.childNodes){const u=i.nodeType===1?(c=i.dataset)==null?void 0:c.runId:void 0;if(u&&t.has(u)){o.add(u);const d=t.get(u);if(d.type!=="text"){r.push(d);continue}const b=rt(i);r.push(b===d.value?d:{...d,value:b});continue}l=!1;const p=rt(i);p&&r.push({id:T(),type:"text",value:p,marks:{}})}if(n.some(i=>!o.has(i.id))&&(l=!1),r.length!==n.length&&(l=!1),l){for(let i=0;i<r.length;i+=1)if(r[i].id!==n[i].id){l=!1;break}}const s=!l||r.some((i,u)=>i!==n[u]);return{runs:r,changed:s,onlyValueChanges:l}}function Bt(e){return e?e.type!=="text"?!1:(e.value??"")==="":!0}function ae(e,n){return!n||n.length===0?!0:n.every(t=>Bt(e.getRun(t)))}function Ve(e,n){var r,l;if(!n)return!1;const t=n.contentIds.length>0,o=(((l=(r=n.props)==null?void 0:r.titleRunIds)==null?void 0:l.length)??0)>0;return!t&&!o}function Rt(e,n){requestAnimationFrame(()=>{const t=document.querySelector(`[data-run-id="${e}"]`);if(!t)return;t.focus();const o=document.createRange();o.selectNodeContents(t),o.collapse(n);const r=window.getSelection();r==null||r.removeAllRanges(),r==null||r.addRange(o)})}function X(e){Rt(e,!1)}function Dn(e){Rt(e,!0)}function be(e,n){requestAnimationFrame(()=>{const t=document.querySelector(`[data-run-id="${e}"]`);if(!t)return;t.focus();const o=t.firstChild,r=document.createRange();if(o&&o.nodeType===3){const s=Math.max(0,Math.min(n,o.length));r.setStart(o,s),r.setEnd(o,s)}else r.selectNodeContents(t),r.collapse(n<=0);const l=window.getSelection();l==null||l.removeAllRanges(),l==null||l.addRange(r)})}function Ye({isOpen:e,onClose:n,title:t,size:o="default",children:r}){return f.useEffect(()=>{if(!e)return;const l=s=>{s.key==="Escape"&&n()};return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[e,n]),e?a.jsx("div",{className:"be-modal-overlay",onMouseDown:l=>{l.target===l.currentTarget&&n()},children:a.jsxs("div",{className:`be-modal${o==="large"?" be-modal-large":""}`,role:"dialog","aria-modal":"true","aria-label":t,children:[t&&a.jsx("div",{className:"be-modal-title",children:t}),r]})}):null}function Tt({isOpen:e,initialHref:n,initialTarget:t,hasExistingLink:o,onSave:r,onRemove:l,onClose:s}){const[c,i]=f.useState(""),[u,p]=f.useState("_self");f.useEffect(()=>{e&&(i(n),p(t))},[e]);const d=c.trim(),b=f.useCallback(h=>{h.preventDefault(),d&&r(d,u)},[d,u,r]);return a.jsx(Ye,{isOpen:e,onClose:s,title:o?"Edit link":"Add link",children:a.jsxs("form",{onSubmit:b,children:[a.jsxs("label",{className:"be-modal-field",children:[a.jsx("span",{children:"URL"}),a.jsx("input",{type:"text",value:c,onChange:h=>i(h.target.value),placeholder:"https://example.com",autoFocus:!0})]}),a.jsxs("label",{className:"be-modal-field",children:[a.jsx("span",{children:"Open in"}),a.jsxs("select",{value:u,onChange:h=>p(h.target.value),children:[a.jsx("option",{value:"_self",children:"Same tab"}),a.jsx("option",{value:"_blank",children:"New tab"})]})]}),a.jsxs("div",{className:"be-modal-actions",children:[o&&a.jsx("button",{type:"button",className:"be-modal-delete",onClick:l,children:"Remove link"}),a.jsx("button",{type:"button",className:"be-modal-cancel",onClick:s,children:"Cancel"}),a.jsx("button",{type:"submit",className:"be-modal-save",disabled:!d,children:"Save"})]})]})})}function A({children:e,size:n=16,strokeWidth:t=2,...o}){return a.jsx("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:t,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",...o,children:e})}function pn(e){return a.jsx(A,{...e,children:a.jsx("polyline",{points:"9 18 15 12 9 6"})})}function _n(e){return a.jsx(A,{...e,children:a.jsx("polyline",{points:"6 9 12 15 18 9"})})}function Ge(e){return a.jsxs(A,{...e,children:[a.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}function jt(e){return a.jsx(A,{...e,children:a.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48"})})}function St(e){return a.jsxs(A,{...e,children:[a.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),a.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]})}function wr(e){return a.jsxs(A,{...e,children:[a.jsx("path",{d:"M6 4h8a4 4 0 0 1 4 4 4 4 0 0 1-4 4H6z"}),a.jsx("path",{d:"M6 12h9a4 4 0 0 1 4 4 4 4 0 0 1-4 4H6z"})]})}function Cr(e){return a.jsxs(A,{...e,children:[a.jsx("line",{x1:"19",y1:"4",x2:"10",y2:"4"}),a.jsx("line",{x1:"14",y1:"20",x2:"5",y2:"20"}),a.jsx("line",{x1:"15",y1:"4",x2:"9",y2:"20"})]})}function Br(e){return a.jsxs(A,{...e,children:[a.jsx("path",{d:"M6 3v7a6 6 0 0 0 12 0V3"}),a.jsx("line",{x1:"4",y1:"21",x2:"20",y2:"21"})]})}function Rr(e){return a.jsxs(A,{...e,children:[a.jsx("path",{d:"M12 20h9"}),a.jsx("path",{d:"M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z"})]})}function Tr(e){return a.jsxs(A,{...e,children:[a.jsx("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),a.jsx("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"})]})}function jr(e){return a.jsxs(A,{...e,children:[a.jsx("path",{d:"M16 4H9a3 3 0 0 0-2.83 4"}),a.jsx("path",{d:"M14 12a4 4 0 0 1 0 8H6"}),a.jsx("line",{x1:"4",y1:"12",x2:"20",y2:"12"})]})}function Sr(e){return a.jsxs(A,{...e,children:[a.jsx("line",{x1:"21",y1:"6",x2:"3",y2:"6"}),a.jsx("line",{x1:"17",y1:"10",x2:"3",y2:"10"}),a.jsx("line",{x1:"21",y1:"14",x2:"3",y2:"14"}),a.jsx("line",{x1:"17",y1:"18",x2:"3",y2:"18"})]})}function Er(e){return a.jsxs(A,{...e,children:[a.jsx("line",{x1:"21",y1:"6",x2:"3",y2:"6"}),a.jsx("line",{x1:"18",y1:"10",x2:"6",y2:"10"}),a.jsx("line",{x1:"21",y1:"14",x2:"3",y2:"14"}),a.jsx("line",{x1:"18",y1:"18",x2:"6",y2:"18"})]})}function Or(e){return a.jsxs(A,{...e,children:[a.jsx("line",{x1:"21",y1:"6",x2:"3",y2:"6"}),a.jsx("line",{x1:"21",y1:"10",x2:"7",y2:"10"}),a.jsx("line",{x1:"21",y1:"14",x2:"3",y2:"14"}),a.jsx("line",{x1:"21",y1:"18",x2:"7",y2:"18"})]})}function Lr(e){return a.jsx(A,{...e,children:[5,12,19].flatMap(n=>[9,15].map(t=>a.jsx("circle",{cx:t,cy:n,r:"1.3",fill:"currentColor",stroke:"none"},`${t}-${n}`)))})}function $n(e){return a.jsxs(A,{...e,children:[a.jsx("polyline",{points:"3 6 5 6 21 6"}),a.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"}),a.jsx("line",{x1:"10",y1:"11",x2:"10",y2:"17"}),a.jsx("line",{x1:"14",y1:"11",x2:"14",y2:"17"})]})}function Et(e){return a.jsxs(A,{...e,children:[a.jsx("rect",{x:"9",y:"9",width:"12",height:"12",rx:"2"}),a.jsx("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]})}function Ot(e){return a.jsxs(A,{...e,children:[a.jsx("line",{x1:"12",y1:"19",x2:"12",y2:"5"}),a.jsx("polyline",{points:"5 12 12 5 19 12"})]})}function Lt(e){return a.jsxs(A,{...e,children:[a.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),a.jsx("polyline",{points:"19 12 12 19 5 12"})]})}function Nr(e){return a.jsxs(A,{...e,children:[a.jsx("circle",{cx:"6",cy:"6",r:"3"}),a.jsx("circle",{cx:"6",cy:"18",r:"3"}),a.jsx("line",{x1:"20",y1:"4",x2:"8.12",y2:"15.88"}),a.jsx("line",{x1:"14.47",y1:"14.48",x2:"20",y2:"20"}),a.jsx("line",{x1:"8.12",y1:"8.12",x2:"12",y2:"12"})]})}function Mr(e){return a.jsxs(A,{...e,children:[a.jsx("line",{x1:"17",y1:"6",x2:"3",y2:"6"}),a.jsx("line",{x1:"21",y1:"12",x2:"3",y2:"12"}),a.jsx("line",{x1:"15",y1:"18",x2:"3",y2:"18"})]})}function Pn({level:e=1,size:n=16,...t}){return a.jsx("svg",{width:n,height:n,viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",...t,children:a.jsxs("text",{x:"2",y:"18",fontSize:"14",fontWeight:"700",fill:"currentColor",fontFamily:"inherit",children:["H",e]})})}function Ar(e){return a.jsx(Pn,{level:1,...e})}function Dr(e){return a.jsx(Pn,{level:2,...e})}function _r(e){return a.jsx(Pn,{level:3,...e})}function $r(e){return a.jsxs(A,{...e,children:[a.jsx("path",{d:"M7 7a3 3 0 0 0-3 3v3a2 2 0 0 0 2 2h2a1 1 0 0 0 1-1v-4a1 1 0 0 0-1-1H6a3 3 0 0 1 3-3z"}),a.jsx("path",{d:"M17 7a3 3 0 0 0-3 3v3a2 2 0 0 0 2 2h2a1 1 0 0 0 1-1v-4a1 1 0 0 0-1-1h-2a3 3 0 0 1 3-3z"})]})}function Nt(e){return a.jsxs(A,{...e,children:[a.jsx("polyline",{points:"9 8 4 12 9 16"}),a.jsx("polyline",{points:"15 8 20 12 15 16"})]})}function Pr(e){return a.jsx(A,{...e,children:a.jsx("line",{x1:"4",y1:"12",x2:"20",y2:"12"})})}function Hr(e){return a.jsxs(A,{...e,children:[a.jsx("path",{d:"M4 5h16a1 1 0 0 1 1 1v9a1 1 0 0 1-1 1H9l-4 4v-4H4a1 1 0 0 1-1-1V6a1 1 0 0 1 1-1z"}),a.jsx("line",{x1:"7",y1:"9",x2:"17",y2:"9"}),a.jsx("line",{x1:"7",y1:"12.5",x2:"13",y2:"12.5"})]})}function zr(e){return a.jsxs(A,{...e,children:[a.jsx("rect",{x:"3",y:"8",width:"18",height:"8",rx:"3"}),a.jsx("line",{x1:"8",y1:"12",x2:"16",y2:"12"})]})}function Fr(e){return a.jsxs(A,{...e,children:[a.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"1"}),a.jsx("line",{x1:"3",y1:"10",x2:"21",y2:"10"}),a.jsx("line",{x1:"3",y1:"16",x2:"21",y2:"16"}),a.jsx("line",{x1:"9",y1:"4",x2:"9",y2:"20"}),a.jsx("line",{x1:"15",y1:"4",x2:"15",y2:"20"})]})}function Ur(e){return a.jsxs(A,{...e,children:[a.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"1"}),a.jsx("line",{x1:"9",y1:"4",x2:"9",y2:"20"}),a.jsx("line",{x1:"15",y1:"4",x2:"15",y2:"20"})]})}function Kr(e){return a.jsxs(A,{...e,children:[a.jsx("circle",{cx:"4.5",cy:"6",r:"1.2",fill:"currentColor",stroke:"none"}),a.jsx("circle",{cx:"4.5",cy:"12",r:"1.2",fill:"currentColor",stroke:"none"}),a.jsx("circle",{cx:"4.5",cy:"18",r:"1.2",fill:"currentColor",stroke:"none"}),a.jsx("line",{x1:"9",y1:"6",x2:"21",y2:"6"}),a.jsx("line",{x1:"9",y1:"12",x2:"21",y2:"12"}),a.jsx("line",{x1:"9",y1:"18",x2:"21",y2:"18"})]})}function qr(e){return a.jsxs(A,{...e,children:[a.jsx("line",{x1:"10",y1:"6",x2:"21",y2:"6"}),a.jsx("line",{x1:"10",y1:"12",x2:"21",y2:"12"}),a.jsx("line",{x1:"10",y1:"18",x2:"21",y2:"18"}),a.jsx("text",{x:"2",y:"8.5",fontSize:"7",fontWeight:"700",fill:"currentColor",stroke:"none",children:"1"}),a.jsx("text",{x:"2",y:"14.5",fontSize:"7",fontWeight:"700",fill:"currentColor",stroke:"none",children:"2"}),a.jsx("text",{x:"2",y:"20.5",fontSize:"7",fontWeight:"700",fill:"currentColor",stroke:"none",children:"3"})]})}function Mt(e){return a.jsxs(A,{...e,children:[a.jsx("rect",{x:"4",y:"4",width:"16",height:"16",rx:"3"}),a.jsx("polyline",{points:"8 12 11 15 16 9"})]})}function Wr(e){return a.jsxs(A,{...e,children:[a.jsx("rect",{x:"3",y:"5",width:"18",height:"16",rx:"2"}),a.jsx("line",{x1:"3",y1:"10",x2:"21",y2:"10"}),a.jsx("line",{x1:"8",y1:"3",x2:"8",y2:"7"}),a.jsx("line",{x1:"16",y1:"3",x2:"16",y2:"7"})]})}function Vr(e){return a.jsxs(A,{...e,children:[a.jsx("path",{d:"M12 3h7a2 2 0 0 1 2 2v7a2 2 0 0 1-.59 1.41l-8 8a2 2 0 0 1-2.82 0l-7-7a2 2 0 0 1 0-2.82l8-8A2 2 0 0 1 12 3z"}),a.jsx("circle",{cx:"15.5",cy:"8.5",r:"1.2",fill:"currentColor",stroke:"none"})]})}function Yr(e){return a.jsxs(A,{...e,children:[a.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2"}),a.jsx("circle",{cx:"9",cy:"10",r:"1.5",fill:"currentColor",stroke:"none"}),a.jsx("path",{d:"M4 17l5-5 4 4 4-5 4 6"})]})}function Gr(e){return a.jsxs(A,{...e,children:[a.jsx("rect",{x:"3",y:"5",width:"14",height:"14",rx:"2"}),a.jsx("path",{d:"M17 10l4-2.5v9L17 14"})]})}function At(e){return a.jsxs(A,{...e,children:[a.jsx("path",{d:"M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7-10-7-10-7z"}),a.jsx("circle",{cx:"12",cy:"12",r:"3"})]})}function Dt(e){return a.jsxs(A,{...e,children:[a.jsx("path",{d:"M17.94 17.94A10.94 10.94 0 0 1 12 19c-6.5 0-10-7-10-7a18.5 18.5 0 0 1 5.06-5.94M9.9 4.24A10.94 10.94 0 0 1 12 4c6.5 0 10 7 10 7a18.5 18.5 0 0 1-2.16 3.19"}),a.jsx("path",{d:"M14.12 14.12a3 3 0 1 1-4.24-4.24"}),a.jsx("line",{x1:"1",y1:"1",x2:"23",y2:"23"})]})}function Xr(e){return a.jsxs(A,{...e,children:[a.jsx("line",{x1:"4",y1:"10",x2:"4",y2:"14"}),a.jsx("line",{x1:"8",y1:"7",x2:"8",y2:"17"}),a.jsx("line",{x1:"12",y1:"4",x2:"12",y2:"20"}),a.jsx("line",{x1:"16",y1:"7",x2:"16",y2:"17"}),a.jsx("line",{x1:"20",y1:"10",x2:"20",y2:"14"})]})}function Jr({containerRef:e,store:n}){var x;const[t,o]=f.useState(null),[r,l]=f.useState(!1),s=f.useRef(null),c=f.useRef(null),i=f.useCallback(()=>{s.current&&(clearTimeout(s.current),s.current=null)},[]),u=f.useCallback(()=>{i(),s.current=setTimeout(()=>{o(k=>r?k:null)},250)},[i,r]);f.useEffect(()=>{const k=e.current;if(!k)return;const I=E=>{var w,v,j;const R=(v=(w=E.target).closest)==null?void 0:v.call(w,"[data-run-id]");if(!R||!k.contains(R))return;const S=R.dataset.runId,C=n.getRun(S);(j=C==null?void 0:C.marks)!=null&&j.link&&(i(),o(B=>(B==null?void 0:B.runId)===S?B:{runId:S,rect:R.getBoundingClientRect()}))},y=()=>u();return k.addEventListener("mouseover",I),k.addEventListener("mouseout",y),()=>{k.removeEventListener("mouseover",I),k.removeEventListener("mouseout",y)}},[e,n,i,u]),f.useEffect(()=>()=>i(),[i]);const p=f.useCallback(()=>l(!0),[]),d=f.useCallback(()=>{l(!1),o(null)},[]),b=f.useCallback((k,I)=>{if(!t)return;const y=n.getRun(t.runId);y&&(n.applyOperation(J(t.runId,{marks:{...y.marks,link:{href:k,target:I}}})),d())},[t,n,d]),h=f.useCallback(()=>{if(!t)return;const k=n.getRun(t.runId);if(!k)return;const I={...k.marks};delete I.link,n.applyOperation(J(t.runId,{marks:I})),d()},[t,n,d]),m=t&&n.getRun(t.runId),g=(x=m==null?void 0:m.marks)==null?void 0:x.link;return a.jsxs(a.Fragment,{children:[t&&g&&!r?Le.createPortal(a.jsxs("div",{ref:c,className:"be-link-hover-card",contentEditable:!1,style:{position:"fixed",top:t.rect.bottom+6,left:t.rect.left},onMouseEnter:i,onMouseLeave:u,children:[a.jsx("a",{className:"be-link-hover-card-url",href:g.href,target:g.target==="_blank"?"_blank":"_self",rel:"noopener noreferrer",children:g.href}),a.jsx("button",{type:"button",className:"be-link-hover-card-btn",onClick:p,"aria-label":"Edit link",title:"Edit link",children:a.jsx(Rr,{size:13})}),a.jsx("button",{type:"button",className:"be-link-hover-card-btn",onClick:h,"aria-label":"Remove link",title:"Remove link",children:a.jsx(Ge,{size:13})})]}),document.body):null,a.jsx(Tt,{isOpen:r,initialHref:(g==null?void 0:g.href)??"",initialTarget:(g==null?void 0:g.target)??"_self",hasExistingLink:!!g,onSave:b,onRemove:h,onClose:d})]})}function lt(e,n){const t=e==null?void 0:e.parentElement;if(!t||!t.hasAttribute("data-placeholder"))return;n.length===0||n.every(Bt)?t.setAttribute("data-empty",""):t.removeAttribute("data-empty")}function Qr(e={}){return{fontWeight:e.bold?"bold":void 0,fontStyle:e.italic?"italic":void 0,textDecoration:[(e.underline||e.link)&&"underline",e.strike&&"line-through"].filter(Boolean).join(" ")||void 0,verticalAlign:e.subscript?"sub":e.superscript?"super":void 0,fontSize:e.subscript||e.superscript?"smaller":void 0,color:e.color||(e.link?"var(--noteloom-accent)":void 0),backgroundColor:e.highlight||void 0,cursor:e.link?"pointer":void 0}}function Zr({id:e,host:n,onValueSynced:t}){const o=ye(e);return f.useLayoutEffect(()=>{var u;if(!n||!o)return;const r=o.value??"";(me(n.textContent)!==r||r===""&&n.textContent==="")&&(n.textContent=r===""?Ct:r);const c=Qr(o.marks);n.style.fontWeight=c.fontWeight??"",n.style.fontStyle=c.fontStyle??"",n.style.textDecoration=c.textDecoration??"",n.style.verticalAlign=c.verticalAlign??"",n.style.fontSize=c.fontSize??"",n.style.color=c.color??"",n.style.backgroundColor=c.backgroundColor??"",n.style.cursor=c.cursor??"";const i=(u=o.marks)==null?void 0:u.link;n.title=i!=null&&i.href?`${i.href} — Ctrl+Click to open`:"",n.onclick=i!=null&&i.href?p=>{!p.ctrlKey&&!p.metaKey||(p.preventDefault(),window.open(i.href,i.target==="_blank"?"_blank":"_self","noopener,noreferrer"))}:null,t==null||t()},[n,o,t]),null}function st(e,n,t,o){var d,b,h;const r=(d=window.getSelection)==null?void 0:d.call(window);if(!r||!r.isCollapsed||r.rangeCount===0)return null;const{anchorNode:l,anchorOffset:s}=r;if(!l||!e.contains(l))return null;const c=m=>{const g=n.indexOf(m);if(g===-1)return null;const x=o?n[g-1]:n[g+1];if(!x)return null;const k=t(x);return k&&k.type!=="text"?x:null};if(l===e){const m=o?s-1:s,g=e.childNodes[m],x=(g==null?void 0:g.nodeType)===1?(b=g.dataset)==null?void 0:b.runId:void 0;if(!x||n.indexOf(x)===-1)return null;const k=t(x);return k&&k.type!=="text"?x:null}const i=l.nodeType===1?l:l.parentElement,u=(h=i==null?void 0:i.closest)==null?void 0:h.call(i,"[data-run-id]");return!u||!e.contains(u)||!(o?s===0:s===(l.textContent??"").length)?null:c(u.getAttribute("data-run-id"))}function at(e,n,t){var i,u;const o=(i=window.getSelection)==null?void 0:i.call(window);if(!o||o.isCollapsed||o.rangeCount===0)return null;const r=o.getRangeAt(0);if(r.startContainer!==r.endContainer||!e.contains(r.startContainer)||r.endOffset!==r.startOffset+1)return null;const l=r.startContainer.childNodes[r.startOffset],s=(l==null?void 0:l.nodeType)===1?(u=l.dataset)==null?void 0:u.runId:void 0;if(!s||n.indexOf(s)===-1)return null;const c=t(s);return c&&c.type!=="text"?s:null}function ct(e,n,t){var c;if(n===e)return{childIndex:t,charOffset:null};const o=n.nodeType===1?n:n.parentElement,r=(c=o==null?void 0:o.closest)==null?void 0:c.call(o,"[data-run-id]");if(!r||!e.contains(r))return null;const l=Array.prototype.indexOf.call(e.childNodes,r),s=n===r?t===0?0:(r.textContent??"").length:t;return{childIndex:l,charOffset:s}}function el(e,n,t,o){const r=ct(e,o.startContainer,o.startOffset),l=ct(e,o.endContainer,o.endOffset);if(!r||!l)return null;const s=Array.from(e.childNodes).filter(p=>{var d;return p.nodeType===1&&((d=p.dataset)==null?void 0:d.runId)&&n.indexOf(p.dataset.runId)!==-1});let c=!1;const i=[];let u=null;return s.forEach((p,d)=>{const b=p.dataset.runId,h=t(b);if(!h)return;const m=d<r.childIndex,g=l.charOffset===null?d>=l.childIndex:d>l.childIndex;if(m||g){i.push(h);return}const x=r.charOffset!==null&&d===r.childIndex,k=l.charOffset!==null&&d===l.childIndex;if(h.type!=="text"){c=!0,u===null&&(u=i.length);return}const I=h.value??"";if(x&&k){const y=I.slice(0,r.charOffset)+I.slice(l.charOffset);y&&i.push({...h,value:y}),u=i.length}else if(x){const y=I.slice(0,r.charOffset);y&&i.push({...h,value:y}),u===null&&(u=i.length)}else if(k){const y=I.slice(l.charOffset);y&&i.push({id:T(),type:"text",value:y,marks:h.marks})}}),c?{nextRuns:i,insertionIndex:u??i.length}:null}function nl(e){var l;const n=(l=window.getSelection)==null?void 0:l.call(window);if(!n||!n.isCollapsed)return!1;const t=e.firstChild;if(!t)return!0;if(n.anchorNode===e)return n.anchorOffset===0;let o=t;for(;o&&o.firstChild;)o=o.firstChild;if(n.anchorNode!==o&&n.anchorNode!==t)return!1;const r=o.nodeType===3&&o.textContent===Ct?1:0;return n.anchorOffset<=r}function tl(e){var l;const n=(l=window.getSelection)==null?void 0:l.call(window);if(!n||!n.isCollapsed)return!1;const t=e.lastChild;if(!t)return!0;if(n.anchorNode===e)return n.anchorOffset>=e.childNodes.length;let o=t;for(;o&&o.lastChild;)o=o.lastChild;if(n.anchorNode!==o&&n.anchorNode!==t)return!1;const r=o.nodeType===3?(o.textContent??"").length:0;return n.anchorOffset>=r}function it(e,n,t){const o=e.getBlock(n),r=e.getBlock(o==null?void 0:o.parentId);if(!r)return null;const l=r.contentIds.indexOf(n),s=t==="backward"?l-1:l+1;if(s<0||s>=r.contentIds.length)return null;const c=r.contentIds[s];return Ve(e,e.getBlock(c))?c:null}function ol({id:e,blockId:n,host:t,inlineRegistry:o,onValueSynced:r}){const l=ye(e);if(!l)return null;if(l.type==="text")return a.jsx(Zr,{id:e,host:t,onValueSynced:r});const s=o==null?void 0:o.get(l.type);if(!s)return process.env.NODE_ENV!=="production"&&console.warn(`[block-editor] No inline type registered for "${l.type}" (run: ${e})`),null;const c=s.component;return a.jsx(c,{id:e,blockId:n})}function rl(e,n,t){let o=e.get(t);if(!o){o=document.createElement("span"),o.dataset.runId=t;const r=n.getRun(t);r&&r.type!=="text"&&o.setAttribute("contenteditable","false"),e.set(t,o)}return o}function xe({blockId:e,runIds:n,onEnter:t,onBackspaceAtStart:o,onDeleteAtEnd:r,onArrowUp:l,onArrowDown:s,onTab:c,onShiftTab:i,onAutoformat:u}){const p=D(),d=he(),{getSelectedBlockId:b,setSelectedBlockId:h}=ge(),m=f.useRef(null),g=f.useRef(!1),x=f.useRef(new Map);f.useLayoutEffect(()=>{const v=m.current;if(!v)return;const j=new Set(n);for(const[O,N]of x.current)j.has(O)||(N.remove(),x.current.delete(O));let B=null;for(const O of n){const N=x.current.get(O);if(!N)continue;const M=B?B.nextSibling:v.firstChild;M!==N&&v.insertBefore(N,M),B=N}},[n]);const k=f.useCallback(()=>{if(g.current)return;const v=m.current;if(!v)return;const j=n.map(M=>p.getRun(M)).filter(Boolean),{runs:B,changed:O,onlyValueChanges:N}=Ir(v,j);if(O){if(N){if(B.forEach((M,q)=>{M!==j[q]&&p.applyOperation(J(M.id,{value:M.value}))}),u!=null&&u(B))return}else p.applyOperation(se(e,B.length?B:[{id:T(),type:"text",value:"",marks:{}}]));lt(v,B)}},[p,e,n,u]),I=f.useCallback(()=>{lt(m.current,n.map(v=>p.getRun(v)).filter(Boolean))},[p,n]),y=f.useCallback(()=>{g.current=!0},[]),E=f.useCallback(()=>{g.current=!1,k()},[k]),R=f.useCallback(v=>{const B=n.map(O=>p.getRun(O)).filter(Boolean).filter(O=>O.id!==v);p.applyOperation(se(e,B.length?B:[{id:T(),type:"text",value:"",marks:{}}]))},[p,e,n]),S=f.useCallback(v=>{b()===v?(p.applyOperation(_(v)),h(null)):h(v)},[p,b,h]),C=f.useCallback(v=>{var le,fe,Y;if(g.current)return;const j=v.inputType??"",B=j.startsWith("delete"),O=j==="insertText"||j==="insertReplacementText";if(!B&&!O)return;const N=m.current;if(!N)return;const M=(le=v.getTargetRanges)==null?void 0:le.call(v),q=(fe=window.getSelection)==null?void 0:fe.call(window),V=(M==null?void 0:M[0])??(q!=null&&q.rangeCount?q.getRangeAt(0):null);if(!V||!N.contains(V.startContainer)||!N.contains(V.endContainer))return;const H=el(N,n,L=>p.getRun(L),V);if(!H)return;v.preventDefault();let{nextRuns:P,insertionIndex:W}=H,K=null,re=!1;if(O&&v.data){const L={id:T(),type:"text",value:v.data,marks:{}};P=[...P.slice(0,W),L,...P.slice(W)],K=L.id,re=!1}else W>0?(K=(Y=P[W-1])==null?void 0:Y.id,re=!1):P.length>0&&(K=P[0].id,re=!0);const Re=P.length?P:[{id:T(),type:"text",value:"",marks:{}}];p.applyOperation(se(e,Re));const Z=K??Re[0].id;re?Dn(Z):X(Z)},[p,e,n]);f.useEffect(()=>{const v=m.current;if(v)return v.addEventListener("beforeinput",C),()=>v.removeEventListener("beforeinput",C)},[C]);const w=f.useCallback(v=>{if(!g.current){if(v.key==="Enter"&&t){v.preventDefault(),t(v);return}if(v.key==="Backspace"){const j=m.current,B=j&&at(j,n,p.getRun.bind(p));if(B){v.preventDefault(),R(B);return}const O=j&&st(j,n,p.getRun.bind(p),!0);if(O){v.preventDefault(),R(O);return}if(j&&nl(j)){if(!ae(p,n)){const M=it(p,e,"backward");if(M){v.preventDefault(),S(M);return}}v.preventDefault(),o&&o(v)}return}if(v.key==="Delete"){const j=m.current,B=j&&at(j,n,p.getRun.bind(p));if(B){v.preventDefault(),R(B);return}const O=j&&st(j,n,p.getRun.bind(p),!1);if(O){v.preventDefault(),R(O);return}if(j&&tl(j)){const N=it(p,e,"forward");if(N){v.preventDefault(),S(N);return}r&&r(v)}return}if(v.key==="ArrowUp"&&l){v.preventDefault(),l(v);return}if(v.key==="ArrowDown"&&s){v.preventDefault(),s(v);return}v.key==="Tab"&&(v.shiftKey&&i?(v.preventDefault(),i(v)):!v.shiftKey&&c&&(v.preventDefault(),c(v)))}},[t,o,r,l,s,c,i,R,S,n,e,p]);return a.jsxs(a.Fragment,{children:[a.jsx("span",{ref:m,className:"be-editable",contentEditable:!0,suppressContentEditableWarning:!0,onInput:k,onCompositionStart:y,onCompositionEnd:E,onKeyDown:w,children:n.map(v=>{const j=rl(x.current,p,v);return Le.createPortal(a.jsx(ol,{id:v,blockId:e,host:j,inlineRegistry:d,onValueSynced:I},v),j)})}),a.jsx(Jr,{containerRef:m,store:p})]})}function ll(e,n,t){const o=e.getBlock(n),r=o&&e.getBlock(o.parentId);if(!r)return null;const l=r.contentIds.indexOf(n),s=t==="up"?l-1:l+1;return s<0||s>=r.contentIds.length?null:r.contentIds[s]}function _t(e,n,t){let o=n;for(;;){const r=ll(e,o,t);if(!r)return null;const l=t==="up"?fn(e,r):Hn(e,r);if(l)return l;o=r}}function te(e,n,t){const o=_t(e,n,t);o&&X(o)}function Hn(e,n){var l;const t=e.getBlock(n);if(!t)return null;const o=((l=t.props)==null?void 0:l.titleRunIds)??t.contentIds;if(!o||o.length===0)return null;const r=o[0];return e.getRun(r)?r:Hn(e,r)}function oe(e,n){const t=Hn(e,n);t&&X(t)}function fn(e,n){var l;const t=e.getBlock(n);if(!t)return null;const o=((l=t.props)==null?void 0:l.titleRunIds)??t.contentIds;if(!o||o.length===0)return null;const r=o[o.length-1];return e.getRun(r)?r:fn(e,r)}function ut(e,n){const t=fn(e,n);t&&X(t)}function sl(){var c,i;const e=(c=window.getSelection)==null?void 0:c.call(window);if(!e||e.rangeCount===0)return null;const n=e.getRangeAt(0);if(n.collapsed||n.startContainer!==n.endContainer)return null;const t=n.startContainer,o=t.nodeType===1?t:t.parentElement,r=(i=o==null?void 0:o.closest)==null?void 0:i.call(o,"[data-run-id]");if(!r)return null;const l=r.closest("[data-block-id]");if(!l)return null;const s=t.textContent??"";return{runId:r.getAttribute("data-run-id"),blockId:l.getAttribute("data-block-id"),startOffset:me(s.slice(0,n.startOffset)).length,endOffset:me(s.slice(0,n.endOffset)).length}}function al(e,n){var c,i;if((e==null?void 0:e.nodeType)!==1||((c=e.getAttribute)==null?void 0:c.call(e,"contenteditable"))!=="true")return null;const t=e.childNodes;if(t.length===0)return null;const o=n>=t.length,r=t[o?t.length-1:Math.max(0,n)],l=(r==null?void 0:r.nodeType)===1?(i=r.dataset)==null?void 0:i.runId:void 0;if(!l)return null;const s=r.closest("[data-block-id]");return s?{runId:l,blockId:s.getAttribute("data-block-id"),offset:o?me(r.textContent??"").length:0}:null}function Fe(e,n){var c;const t=al(e,n);if(t)return t;let o=(e==null?void 0:e.nodeType)===1?e:e==null?void 0:e.parentElement;const r=(c=o==null?void 0:o.closest)==null?void 0:c.call(o,"[data-run-id]");if(!r)return null;const l=r.closest("[data-block-id]");if(!l)return null;let s=me((e.textContent??"").slice(0,n)).length;if(e===r){s=0;for(let i=0;i<n&&i<r.childNodes.length;i+=1)s+=me(r.childNodes[i].textContent??"").length}return{runId:r.getAttribute("data-run-id"),blockId:l.getAttribute("data-block-id"),offset:s}}function Xe(){var n;const e=(n=window.getSelection)==null?void 0:n.call(window);return!e||e.rangeCount===0||!e.isCollapsed?null:Fe(e.anchorNode,e.anchorOffset)}function Je(){var o;const e=(o=window.getSelection)==null?void 0:o.call(window);if(!e||e.rangeCount===0||e.isCollapsed)return null;const n=Fe(e.anchorNode,e.anchorOffset),t=Fe(e.focusNode,e.focusOffset);return!n||!t||n.blockId!==t.blockId?null:{blockId:n.blockId,startRunId:n.runId,startOffset:n.offset,endRunId:t.runId,endOffset:t.offset}}function Ue(e){var d;const n=(d=window.getSelection)==null?void 0:d.call(window);if(!n||n.rangeCount===0||n.isCollapsed)return null;const t=Fe(n.anchorNode,n.anchorOffset),o=Fe(n.focusNode,n.focusOffset);if(!t||!o||t.blockId===o.blockId)return null;const r=e.getBlock(t.blockId),l=r&&e.getBlock(r.parentId);if(!l)return null;const s=l.contentIds,c=s.indexOf(t.blockId),i=s.indexOf(o.blockId);if(c===-1||i===-1)return null;const[u,p]=c<=i?[c,i]:[i,c];return{blockIds:s.slice(u,p+1),startBlockId:t.blockId,startRunId:t.runId,startOffset:t.offset,endBlockId:o.blockId,endRunId:o.runId,endOffset:o.offset}}function zn(e,n,t){const r=e.getBlock(n).parentId,s=e.getBlock(r).contentIds.indexOf(n)+1,{block:c,runs:i=[],subtreeBlocks:u=[]}=t(r);return e.applyOperation(G(c,r,s,{blocks:[c,...u],runs:i})),c.id}function ve(e,n,t){const o=zn(e,n,t);return oe(e,o),o}function cl(e,n,t){const{block:o,runs:r=[],subtreeBlocks:l=[]}=t(n);return e.applyOperation(G(o,n,0,{blocks:[o,...l],runs:r})),oe(e,o.id),o.id}function $t(e,n){if(typeof e.performBatch=="function")e.performBatch(n);else for(const t of n)e.applyOperation(t)}function il(e,n,t){const o=e.findIndex(u=>u.id===n);if(o===-1)return null;const r=e[o],l=e.slice(0,o),s=e.slice(o+1);if(r.type==="text"){const u=r.value??"",p=u.slice(0,t),d=u.slice(t);p&&d?(l.push({...r,value:p}),s.unshift({...r,id:T(),value:d})):d?s.unshift(r):l.push(r)}else t>0?l.push(r):s.unshift(r);const c=l.length?l:[{id:T(),type:"text",value:"",marks:{}}],i=s.length?s:[{id:T(),type:"text",value:"",marks:{}}];return{leftRuns:c,rightRuns:i}}function Me(e,n,t,o){const r=e.getBlock(n),l=e.getBlock(r.parentId),s=l.contentIds.indexOf(n)+1;return Ht(e,n,t,o,{insertParentId:l.id,insertIndex:s,fallback:()=>ve(e,n,o)})}function Pt(e,n,t,o){return Ht(e,n,t,o,{insertParentId:n,insertIndex:0,fallback:()=>cl(e,n,o)})}function Ht(e,n,t,o,{insertParentId:r,insertIndex:l,fallback:s}){const c=Xe();if(!c||c.blockId!==n)return s();const i=t.map(x=>e.getRun(x)).filter(Boolean),u=il(i,c.runId,c.offset);if(!u)return s();const{leftRuns:p,rightRuns:d}=u,{block:b,runs:h=d,subtreeBlocks:m=[]}=o(r,d),g=p.length?p:[{id:T(),type:"text",value:"",marks:{}}];return $t(e,[se(n,g),G(b,r,l,{blocks:[b,...m],runs:h})]),oe(e,b.id),b.id}function ul(e){var n;return((n=e==null?void 0:e.props)==null?void 0:n.titleRunIds)??(e==null?void 0:e.contentIds)??[]}function dl(e){var n,t;return!!((n=e==null?void 0:e.props)!=null&&n.titleRunIds)&&(((t=e.contentIds)==null?void 0:t.length)??0)>0}function pl(e,n,t){const r=e.getBlock(n).parentId,s=e.getBlock(r).contentIds.indexOf(n),{block:c,runs:i=[],subtreeBlocks:u=[]}=t(r);return $t(e,[_(n),G(c,r,s,{blocks:[c,...u],runs:i})]),oe(e,c.id),c.id}function ne(e,{blockId:n,runId:t,sliceStart:o,sliceEnd:r},l){const s=e.getRun(t),c=(s==null?void 0:s.value)??"",i=c.slice(0,o)+c.slice(r),u=e.getBlock(n),p=ul(u);return p.length===1&&p[0]===t&&i===""&&!dl(u)?pl(e,n,l):(e.applyOperation(J(t,{value:i})),ve(e,n,l))}function $(e,n={}){return function(o,r){const l=T(),s=r!=null&&r.length?r:[{id:T(),type:"text",value:"",marks:{}}];return{block:{id:l,type:e,parentId:o,contentIds:s.map(c=>c.id),props:n},runs:s}}}function Ae(e){const n=e.getRootId(),t=e.getBlock(n);if(!t||t.contentIds.length>0)return null;const{block:o,runs:r}=$("paragraph")(n);return e.applyOperation(G(o,n,0,{blocks:[o],runs:r})),o.id}const fl=new Set(["callout"]),dt=new Set(["paragraph","heading","blockquote"]);function zt(e,n){return e===n||dt.has(e)&&dt.has(n)}function Qe(e,n){const t=e.getBlock(n);if(!t)return null;const o=e.getBlock(t.parentId),r=o.contentIds.indexOf(n),l=t.contentIds.length===0||t.contentIds.length===1&&bl(e,t.contentIds[0]);if(r<=0){if(!l)return null;if(o.contentIds.length>1)return Te(e,[_(n)]),e.getBlock(o.id).contentIds[0];if(fl.has(o.type))return ml(e,o);if(t.type==="paragraph")return null;const{block:u,runs:p}=$("paragraph")(o.id);return Te(e,[G(u,o.id,r,{blocks:[u],runs:p}),_(n)]),u.id}const s=o.contentIds[r-1],c=e.getBlock(s);if(l)return Te(e,[_(n)]),s;if(Ve(e,c))return Te(e,[_(s)]),n;if(!c||!zt(c.type,t.type))return null;const i=[...c.contentIds,...t.contentIds];return Te(e,[je(s,i),je(n,[]),_(n)]),s}function bl(e,n){const t=e.getRun(n);return!t||(t.value??"")===""}function ml(e,n){const t=e.getBlock(n.parentId);if(!t)return null;const o=t.contentIds.indexOf(n.id),r=o>0?t.contentIds[o-1]:null,l=o!==-1&&o<t.contentIds.length-1?t.contentIds[o+1]:null;Te(e,[_(n.id)]);const s=Ae(e);return r??l??s}function Te(e,n){if(typeof e.performBatch=="function")e.performBatch(n);else for(const t of n)e.applyOperation(t)}function De(e,n,t,o){if(!n||n===t)return;const r=fn(e,n);if(r){X(r);return}o(n),requestAnimationFrame(()=>{var l;(l=document.querySelector(`[data-block-id="${n}"]`))==null||l.focus()})}function hl(e,n,t,o,r){const l=e.getBlock(n),c=e.getBlock(l.parentId).contentIds.indexOf(n),i="titleRunIds"in o,u="titleRunIds"in(l.props??{}),p={id:T(),type:t,parentId:l.parentId,contentIds:[],props:o},d=i?z(p.id,{titleRunIds:r}):je(p.id,r),b=u?z(n,{titleRunIds:[]}):je(n,[]);return{newBlockId:p.id,ops:[G(p,l.parentId,c,{blocks:[p],runs:[]}),d,b,_(n)]}}function gl(e,n){if(typeof e.performBatch=="function")e.performBatch(n);else for(const t of n)e.applyOperation(t)}const xl=[{re:/^(#{1,3})[  ]$/,type:"heading",props:e=>({level:e[1].length})},{re:/^[-*][  ]$/,type:"listItem",props:()=>({ordered:!1,titleRunIds:[]})},{re:/^\d+\.[  ]$/,type:"listItem",props:()=>({ordered:!0,titleRunIds:[]})},{re:/^\[\][  ]$/,type:"listItem",props:()=>({ordered:!1,checked:!1,titleRunIds:[]})},{re:/^>[  ]$/,type:"blockquote",props:()=>({})},{re:/^```$/,type:"code",props:()=>({language:"plaintext"})}];function kl(e,n,t){if(t.length!==1||t[0].type!=="text")return!1;const o=t[0].value??"";for(const r of xl){const l=r.re.exec(o);if(!l)continue;const s=o.slice(l[0].length),{ops:c}=hl(e,n,r.type,r.props(l),[t[0].id]);return gl(e,[J(t[0].id,{value:s}),...c]),Dn(t[0].id),!0}return!1}const yl=new Set(["callout","toggleHeading"]);function vl({id:e}){const n=D(),t=Q(e),{setSelectedBlockId:o}=ge(),r=f.useCallback(()=>{const d=n.getBlock(t==null?void 0:t.parentId),b=ae(n,(t==null?void 0:t.contentIds)??[]),h=!!d&&d.contentIds[d.contentIds.length-1]===e;if(b&&h&&yl.has(d==null?void 0:d.type)){ve(n,d.id,$("paragraph"));return}Me(n,e,(t==null?void 0:t.contentIds)??[],$("paragraph"))},[n,e,t]),l=f.useCallback(()=>{var g,x;const d=n.getBlock(t==null?void 0:t.parentId),b=ae(n,(t==null?void 0:t.contentIds)??[]),h=((g=d==null?void 0:d.contentIds)==null?void 0:g.length)===1&&d.contentIds[0]===e;if(b&&h&&(d==null?void 0:d.type)==="toggleHeading"){const k=((x=d.props)==null?void 0:x.titleRunIds)??[],I=k[k.length-1];I&&X(I);return}const m=Qe(n,e);De(n,m,e,o)},[n,e,t,o]),s=f.useCallback(()=>te(n,e,"up"),[n,e]),c=f.useCallback(()=>te(n,e,"down"),[n,e]),i=f.useCallback(d=>kl(n,e,d),[n,e]),u=ee("be-paragraph",t);if(!t)return null;const p=ae(n,t.contentIds);return a.jsx("div",{className:u,"data-block-id":e,"data-empty":p?"":void 0,"data-placeholder":"Type '/' for commands",children:a.jsx(xe,{blockId:e,runIds:t.contentIds,onEnter:r,onBackspaceAtStart:l,onArrowUp:s,onArrowDown:c,onAutoformat:i})})}function Se(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function ce(e){return Se(e).replace(/"/g,"&quot;")}function Ie(e,n){var r,l;if(!e)return"";if(e.type!=="text"){const s=(r=n==null?void 0:n.inlineRegistry)==null?void 0:r.get(e.type);return s?s.toHTML(e,n):Se(e.value??"")}const t=e.marks??{};let o=Se(e.value??"");if(t.code&&(o=`<code>${o}</code>`),t.bold&&(o=`<strong>${o}</strong>`),t.italic&&(o=`<em>${o}</em>`),t.underline&&(o=`<u>${o}</u>`),t.strike&&(o=`<s>${o}</s>`),t.subscript&&(o=`<sub>${o}</sub>`),t.superscript&&(o=`<sup>${o}</sup>`),t.color&&(o=`<span style="color:${ce(t.color)}">${o}</span>`),t.highlight&&(o=`<span style="background-color:${ce(t.highlight)}">${o}</span>`),(l=t.link)!=null&&l.href){const s=t.link.target==="_blank"?' target="_blank" rel="noopener noreferrer"':"";o=`<a href="${ce(t.link.href)}"${s}>${o}</a>`}return o}function we(e,n){var t;if(!e)return"";if(e.type!=="text"){const o=(t=n==null?void 0:n.inlineRegistry)==null?void 0:t.get(e.type);return o?o.toPlainText(e,n):e.value??""}return e.value??""}const Il={STRONG:"bold",B:"bold",EM:"italic",I:"italic",U:"underline",S:"strike",STRIKE:"strike",DEL:"strike",CODE:"code",SUB:"subscript",SUP:"superscript"};function de(e,n,t={}){const o=[],r=(l,s)=>{var u,p;if(l.nodeType===3){const d=l.textContent;d&&o.push({id:T(),type:"text",value:d,marks:{...s}});return}if(l.nodeType!==1)return;if(n!=null&&n.inlineRegistry)for(const d of n.inlineRegistry.listHtmlMatchers()){const b=d.fromHTML(l,n);if(b){o.push(b);return}}let c=s;const i=Il[l.tagName];i&&(c={...c,[i]:!0}),l.tagName==="A"&&l.getAttribute("href")&&(c={...c,link:{href:l.getAttribute("href"),target:l.getAttribute("target")==="_blank"?"_blank":"_self"}}),(u=l.style)!=null&&u.color&&(c={...c,color:l.style.color}),(p=l.style)!=null&&p.backgroundColor&&(c={...c,highlight:l.style.backgroundColor});for(const d of l.childNodes)r(d,c)};return r(e,t),o.length?o:[{id:T(),type:"text",value:"",marks:{}}]}function wl(e,n){return`<p>${e.contentIds.map(o=>n.store.getRun(o)).map(o=>Ie(o,n)).join("")}</p>`}function Cl(e,n){return e.contentIds.map(t=>we(n.store.getRun(t),n)).join("")}function Bl(e,n){if(e.tagName!=="P")return null;const t=de(e,n);return{block:{id:T(),type:"paragraph",parentId:null,contentIds:t.map(r=>r.id),props:{}},runs:t}}const Ft={component:vl,isLeaf:!0,defaultProps:{},toHTML:wl,toPlainText:Cl,fromHTML:Bl,slashCommand:{label:"Text",icon:Mr,keywords:["paragraph","text","p"],run:(e,n)=>ne(e,n,$("paragraph"))}};function Rl({id:e}){var b;const n=D(),t=Q(e),{setSelectedBlockId:o}=ge(),r=f.useCallback(()=>{Me(n,e,(t==null?void 0:t.contentIds)??[],$("paragraph"))},[n,e,t]),l=f.useCallback(()=>{const h=Qe(n,e);De(n,h,e,o)},[n,e,o]),s=f.useCallback(()=>te(n,e,"up"),[n,e]),c=f.useCallback(()=>te(n,e,"down"),[n,e]),i=ee("be-heading",t);if(!t)return null;const u=((b=t.props)==null?void 0:b.level)??3,p=`h${u}`,d=ae(n,t.contentIds);return a.jsx(p,{className:i,"data-block-id":e,"data-empty":d?"":void 0,"data-placeholder":`Heading ${u}`,children:a.jsx(xe,{blockId:e,runIds:t.contentIds,onEnter:r,onBackspaceAtStart:l,onArrowUp:s,onArrowDown:c})})}const yn={1:Ar,2:Dr,3:_r},Tl={H1:1,H2:2,H3:3};function jl(e,n){var r;const t=((r=e.props)==null?void 0:r.level)??3,o=e.contentIds.map(l=>n.store.getRun(l));return`<h${t}>${o.map(l=>Ie(l,n)).join("")}</h${t}>`}function Sl(e,n){return e.contentIds.map(t=>we(n.store.getRun(t),n)).join("")}function El(e,n){const t=Tl[e.tagName];if(!t)return null;const o=de(e,n);return{block:{id:T(),type:"heading",parentId:null,contentIds:o.map(l=>l.id),props:{level:t}},runs:o}}const Ut={component:Rl,isLeaf:!0,defaultProps:{level:3},toHTML:jl,toPlainText:Sl,fromHTML:El,slashCommands:[{label:"Heading 1",icon:yn[1],keywords:["heading","h1","title"],run:(e,n)=>ne(e,n,$("heading",{level:1}))},{label:"Heading 2",icon:yn[2],keywords:["heading","h2","subtitle"],run:(e,n)=>ne(e,n,$("heading",{level:2}))},{label:"Heading 3",icon:yn[3],keywords:["heading","h3","title"],run:(e,n)=>ne(e,n,$("heading",{level:3}))}]},Ol=[];function Fn(e){const n=D(),t=f.useCallback(r=>n.subscribe(e,r),[n,e]),o=f.useCallback(()=>{const r=n.getBlock(e);return r?r.contentIds:Ol},[n,e]);return f.useSyncExternalStore(t,o)}class Kt extends f.Component{constructor(){super(...arguments);tt(this,"state",{hasError:!1,nonce:0})}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(t,o){var r,l;process.env.NODE_ENV!=="production"&&console.error("[block-editor] a block failed to render; recovering by remounting it:",t,o),(l=(r=this.props).onError)==null||l.call(r,t,o),queueMicrotask(()=>this.setState(s=>({hasError:!1,nonce:s.nonce+1})))}render(){return this.state.hasError?null:a.jsx(f.Fragment,{children:this.props.children},this.state.nonce)}}const Un=f.memo(function({id:n}){const t=Q(n),o=Ne();if(!t)return null;const r=o.get(t.type);if(!r)return process.env.NODE_ENV!=="production"&&console.warn(`[block-editor] No block type registered for "${t.type}" (id: ${n})`),null;const l=r.component;return a.jsx(Kt,{children:a.jsx(l,{id:n})})});function bn(e,n,t){f.useEffect(()=>{if(!n)return;const o=Array.isArray(e)?e:[e],r=s=>{o.some(i=>i.current&&i.current.contains(s.target))||t()},l=s=>{s.key==="Escape"&&t()};return document.addEventListener("mousedown",r),document.addEventListener("keydown",l),()=>{document.removeEventListener("mousedown",r),document.removeEventListener("keydown",l)}},[n,t,e])}function Ze(e,n,t,o){const r={store:e,registry:n,inlineRegistry:o};return{html:Ll(e,n,t,r),text:t.map(l=>{const s=e.getBlock(l);return n.get(s.type).toPlainText(s,r)}).join(`
1881
- `),json:JSON.stringify({version:1,blocks:t.map(l=>Kn(e,l))})}}function Ll(e,n,t,o){let r="",l=0;for(;l<t.length;){const s=e.getBlock(t[l]);if(s.type==="listItem"){const c=!!s.props.ordered;let i="",u=l;for(;u<t.length;){const d=e.getBlock(t[u]);if(d.type!=="listItem"||!!d.props.ordered!==c)break;i+=n.get("listItem").toHTML(d,o),u+=1}const p=c?"ol":"ul";r+=`<${p}>${i}</${p}>`,l=u}else if(s.type==="blockquote"){let c="",i=l;for(;i<t.length;){const u=e.getBlock(t[i]);if(u.type!=="blockquote")break;c+=n.get("blockquote").toHTML(u,o),i+=1}r+=`<blockquote>${c}</blockquote>`,l=i}else r+=n.get(s.type).toHTML(s,o),l+=1}return r}function Kn(e,n){const t=[],o=[],r=l=>{var i;const s=e.getRun(l);if(s){o.push(s);return}const c=e.getBlock(l);if(c){t.push(c);for(const u of c.contentIds)r(u);for(const u of((i=c.props)==null?void 0:i.titleRunIds)??[])r(u)}};return r(n),{rootId:n,blocks:t,runs:o}}function qn({rootId:e,blocks:n,runs:t}){const o=new Map;for(const i of n)o.set(i.id,T());for(const i of t)o.set(i.id,T());const r=i=>o.get(i)??i,l=n.map(i=>{var u;return{...i,id:r(i.id),parentId:i.parentId?r(i.parentId):i.parentId,contentIds:i.contentIds.map(r),props:{...i.props,...(u=i.props)!=null&&u.titleRunIds?{titleRunIds:i.props.titleRunIds.map(r)}:{}}}}),s=t.map(i=>({...i,id:r(i.id)})),c=r(e);return{block:l.find(i=>i.id===c),runs:s,subtreeBlocks:l.filter(i=>i.id!==c)}}function qt(e,n){const t=e.getBlock(n);if(!t)return null;const o=e.getBlock(t.parentId),r=o.contentIds.indexOf(n),l=Kn(e,n),{block:s,runs:c,subtreeBlocks:i}=qn(l);return e.applyOperation(G(s,o.id,r+1,{blocks:[s,...i],runs:c})),oe(e,s.id),s.id}function Wt(e,n){const t=e.getBlock(n),o=t&&e.getBlock(t.parentId);if(!o)return!1;const r=o.contentIds.indexOf(n);return r<=0?!1:(e.applyOperation(ke(n,o.id,r-1)),!0)}function Vt(e,n){const t=e.getBlock(n),o=t&&e.getBlock(t.parentId);if(!o)return!1;const r=o.contentIds.indexOf(n);return r===-1||r>=o.contentIds.length-1?!1:(e.applyOperation(ke(n,o.id,r+1)),!0)}function Wn(e,n){const t=e.getBlock(n);if(!t)return null;const o=e.getBlock(t.parentId),r=o.contentIds.indexOf(n),l=r>0?o.contentIds[r-1]:null,s=r!==-1&&r<o.contentIds.length-1?o.contentIds[r+1]:null;e.applyOperation(_(n));const c=Ae(e),i=l??s??c;return i&&oe(e,i),i??null}function Yt({id:e}){var R;const n=D(),t=Q(e),[o,r]=f.useState(!1),[l,s]=f.useState(null),c=f.useRef(null),i=f.useRef(null),u=f.useMemo(()=>[c,i],[]),[p]=We(),d=p.includes(e),b=f.useCallback(()=>r(!1),[]);bn(u,o,b);const h=f.useCallback(()=>{var S;s(((S=c.current)==null?void 0:S.getBoundingClientRect())??null),r(!0)},[]),m=f.useCallback(()=>{ve(n,e,$("paragraph"))},[n,e]),g=f.useCallback(()=>{qt(n,e),b()},[n,e,b]),x=f.useCallback(()=>{Wt(n,e),b()},[n,e,b]),k=f.useCallback(()=>{Vt(n,e),b()},[n,e,b]),I=f.useCallback(()=>{Wn(n,e),b()},[n,e,b]),y=!!((R=t==null?void 0:t.props)!=null&&R.hidden),E=f.useCallback(()=>{n.applyOperation(z(e,{hidden:!y})),b()},[n,e,y,b]);return t?a.jsxs("div",{className:`be-block-row${y?" be-block-row-hidden":""}${d?" be-block-row-range-selected":""}`,"data-block-row-id":e,children:[a.jsxs("div",{className:`be-block-gutter${o?" be-block-gutter-active":""}`,contentEditable:!1,children:[a.jsx("button",{type:"button",className:"be-block-gutter-btn",onClick:m,"aria-label":"Add block below",children:a.jsx(St,{size:16})}),a.jsx("button",{ref:c,type:"button",className:"be-block-gutter-btn","aria-label":"More options","aria-haspopup":"menu","aria-expanded":o,onClick:()=>o?b():h(),children:a.jsx(Lr,{size:16})})]}),a.jsx("div",{className:"be-block-row-content",children:a.jsx(Un,{id:e})}),o&&l&&Le.createPortal(a.jsxs("div",{ref:i,role:"menu","aria-label":"Block options",className:"be-block-gutter-menu",style:{position:"fixed",top:l.bottom+4,left:l.left},children:[a.jsxs("button",{type:"button",role:"menuitem",className:"be-block-gutter-menu-item",onClick:g,children:[a.jsx(Et,{size:15})," Duplicate"]}),a.jsxs("button",{type:"button",role:"menuitem",className:"be-block-gutter-menu-item",onClick:x,children:[a.jsx(Ot,{size:15})," Move up"]}),a.jsxs("button",{type:"button",role:"menuitem",className:"be-block-gutter-menu-item",onClick:k,children:[a.jsx(Lt,{size:15})," Move down"]}),a.jsxs("button",{type:"button",role:"menuitem",className:"be-block-gutter-menu-item",onClick:E,children:[y?a.jsx(At,{size:15}):a.jsx(Dt,{size:15}),y?"Show in preview":"Hide in preview"]}),a.jsxs("button",{type:"button",role:"menuitem",className:"be-block-gutter-menu-item be-block-gutter-menu-item-danger",onClick:I,children:[a.jsx($n,{size:15})," Delete"]})]}),document.body)]}):null}function Ce({parentId:e,isTopLevel:n=!1}){const t=Fn(e),o=D(),[r]=Mn(),l=r?t.filter(s=>{var c,i;return!((i=(c=o.getBlock(s))==null?void 0:c.props)!=null&&i.hidden)}):t;return n&&!r?l.map(s=>a.jsx(Yt,{id:s},s)):l.map(s=>a.jsx(Un,{id:s},s))}const Nl=97,Ml=[[1e3,"m"],[900,"cm"],[500,"d"],[400,"cd"],[100,"c"],[90,"xc"],[50,"l"],[40,"xl"],[10,"x"],[9,"ix"],[5,"v"],[4,"iv"],[1,"i"]];function Al(e){let n="";for(;e>0;)e-=1,n=String.fromCharCode(Nl+e%26)+n,e=Math.floor(e/26);return n}function Dl(e){let n="",t=e;for(const[o,r]of Ml)for(;t>=o;)n+=r,t-=o;return n}function _l(e){var n,t;return(e==null?void 0:e.type)==="listItem"&&((n=e.props)==null?void 0:n.checked)===void 0&&((t=e.props)==null?void 0:t.collapsed)===void 0}function pt(e,n){let t=0,o=n;for(;o;){const r=e.getBlock(o.parentId);if(!r||r.type!=="listItem")break;t+=1,o=r}return t}function $l(e,n,t){const o=t.indexOf(n.id);let r=1;for(let l=o-1;l>=0;l-=1){const s=e.getBlock(t[l]);if(!_l(s)||!s.props.ordered)break;r+=1}return r}function Pl(e,n){const t=(e%3+3)%3;return t===0?`${n}.`:t===1?`${Al(n)}.`:`${Dl(n)}.`}const Hl=["•","◦","▪"];function zl(e){const n=(e%3+3)%3;return Hl[n]}function He({ordered:e=!1,checked:n,collapsed:t}={}){return function(r,l){const s=T(),c=l!=null&&l.length?l:[{id:T(),type:"text",value:"",marks:{}}],i={ordered:e,titleRunIds:c.map(b=>b.id)};n!==void 0&&(i.checked=n);let u=[],p=[],d=c;if(t!==void 0){i.collapsed=t;const{block:b,runs:h}=$("paragraph")(s);u=[b.id],p=[b],d=[...c,...h]}return{block:{id:s,type:"listItem",parentId:r,contentIds:u,props:i},runs:d,subtreeBlocks:p}}}function Fl(e,n){const t=e.getBlock(n),o=e.getBlock(t.parentId),r=o.contentIds.indexOf(n),l=r>0?o.contentIds[r-1]:null,s=l?e.getBlock(l):null;if(!s||s.type!=="listItem"){te(e,n,"down");return}e.applyOperation(ke(n,l,s.contentIds.length)),oe(e,n)}function wn(e,n){const t=e.getBlock(n),o=e.getBlock(t.parentId);if(!o||o.type!=="listItem")return;const r=o.parentId,s=e.getBlock(r).contentIds.indexOf(o.id);e.applyOperation(ke(n,r,s+1)),oe(e,n)}function $e(e,n){if(typeof e.performBatch=="function")e.performBatch(n);else for(const t of n)e.applyOperation(t)}function Gt(e,n){var t;return n.length===0||n.length===1&&(((t=e.getRun(n[0]))==null?void 0:t.value)??"")===""}function Ul(e,n){const t=n.contentIds??[];if(t.length===0)return!0;if(t.length>1)return!1;const o=e.getBlock(t[0]);return!!o&&o.type==="paragraph"&&ae(e,o.contentIds)}function Kl(e,n){const t=e.getBlock(n);if(!t)return null;const o=e.getBlock(t.parentId),r=o.contentIds.indexOf(n),l=t.props.titleRunIds??[],c=Gt(e,l)&&Ul(e,t);if(r>0){const p=o.contentIds[r-1],d=e.getBlock(p);if(c)return $e(e,[_(n)]),{focusBlockId:p,needsRefocus:!0};if(Ve(e,d))return $e(e,[_(p)]),{focusBlockId:n,needsRefocus:!1};if((d==null?void 0:d.type)==="listItem"&&t.contentIds.length===0){const b=[...d.props.titleRunIds??[],...l];return $e(e,[z(p,{titleRunIds:b}),z(n,{titleRunIds:[]}),_(n)]),{focusBlockId:p,needsRefocus:!0}}return null}if(o.type==="listItem")return wn(e,n),{focusBlockId:n,needsRefocus:!0};if(!c)return null;if(o.contentIds.length>1)return $e(e,[_(n)]),{focusBlockId:e.getBlock(o.id).contentIds[0],needsRefocus:!0};const{block:i,runs:u}=$("paragraph")(o.id);return $e(e,[G(i,o.id,r,{blocks:[i],runs:u}),_(n)]),{focusBlockId:i.id,needsRefocus:!0}}function ql(e,n){if(typeof e.performBatch=="function")e.performBatch(n);else for(const t of n)e.applyOperation(t)}function Wl(e,n){const o=e.getBlock(n).parentId,l=e.getBlock(o).contentIds.indexOf(n),{block:s,runs:c}=$("paragraph")(o);return ql(e,[G(s,o,l,{blocks:[s],runs:c}),z(n,{titleRunIds:[]}),_(n)]),oe(e,s.id),s.id}function Vl(e,n){if(typeof e.performBatch=="function")e.performBatch(n);else for(const t of n)e.applyOperation(t)}function Yl({id:e}){var S,C;const n=D(),t=Q(e),{setSelectedBlockId:o}=ge(),r=Fn(t==null?void 0:t.parentId),l=f.useCallback(()=>{var q,V,H,P,W;const w=((q=t==null?void 0:t.props)==null?void 0:q.titleRunIds)??[],v=n.getBlock(t==null?void 0:t.parentId),j=Gt(n,w);if(j&&(v==null?void 0:v.type)==="listItem"){wn(n,e);return}const B=(((V=t==null?void 0:t.contentIds)==null?void 0:V.length)??0)>0;if(j&&(v==null?void 0:v.type)!=="listItem"&&!B){Wl(n,e);return}const O=((H=t==null?void 0:t.props)==null?void 0:H.checked)!==void 0,N=((P=t==null?void 0:t.props)==null?void 0:P.collapsed)!==void 0,M=He({ordered:(W=t==null?void 0:t.props)==null?void 0:W.ordered,checked:O?!1:void 0,collapsed:N?!1:void 0});B&&!N?Pt(n,e,w,M):Me(n,e,w,M)},[n,e,t]),s=f.useCallback(()=>Fl(n,e),[n,e]),c=f.useCallback(()=>wn(n,e),[n,e]),i=f.useCallback(()=>{const w=Kl(n,e);!w||!w.needsRefocus||De(n,w.focusBlockId,e,o)},[n,e,o]),u=f.useCallback(()=>te(n,e,"up"),[n,e]),p=f.useCallback(()=>te(n,e,"down"),[n,e]),d=f.useCallback(()=>{var w;n.applyOperation(z(e,{checked:!((w=t==null?void 0:t.props)!=null&&w.checked)}))},[n,e,(S=t==null?void 0:t.props)==null?void 0:S.checked]),b=f.useCallback(()=>{var v,j;if(!((((v=t==null?void 0:t.contentIds)==null?void 0:v.length)??0)>0)){const{block:B,runs:O}=$("paragraph")(e);Vl(n,[G(B,e,0,{blocks:[B],runs:O}),z(e,{collapsed:!1})]),X(B.contentIds[0]);return}n.applyOperation(z(e,{collapsed:!((j=t==null?void 0:t.props)!=null&&j.collapsed)}))},[n,e,t==null?void 0:t.contentIds,(C=t==null?void 0:t.props)==null?void 0:C.collapsed]),h=ee("be-list-item",t);if(!t)return null;const{ordered:m,checked:g,collapsed:x,titleRunIds:k=[]}=t.props,I=g!==void 0,y=!I&&x!==void 0,E=t.contentIds.length>0,R=k.map(w=>n.getRun(w)).filter(w=>(w==null?void 0:w.type)==="text").map(w=>w.value).join("").trim();return a.jsxs("div",{className:h,"data-block-id":e,children:[a.jsxs("div",{className:"be-list-item-row",children:[I?a.jsx("input",{type:"checkbox",className:"be-list-checkbox",checked:!!g,onChange:d,"aria-label":R||"To-do item"}):y?a.jsx("button",{type:"button",className:"be-list-toggle-marker",onClick:b,"aria-expanded":!x,"aria-label":E?x?"Expand toggle":"Collapse toggle":"Add content to toggle",children:x?a.jsx(pn,{}):a.jsx(_n,{})}):a.jsx("span",{className:"be-list-marker","aria-hidden":"true",children:m?Pl(pt(n,t),$l(n,t,r)):zl(pt(n,t))}),a.jsx("div",{className:"be-list-item-title","data-empty":ae(n,k)?"":void 0,"data-placeholder":I?"To-do":y?"Toggle":"List item",style:g?{textDecoration:"line-through",opacity:.6}:void 0,children:a.jsx(xe,{blockId:e,runIds:k,onEnter:l,onTab:s,onShiftTab:c,onBackspaceAtStart:i,onArrowUp:u,onArrowDown:p})})]}),(!y||!x)&&a.jsx("div",{className:"be-list-item-children",children:a.jsx(Ce,{parentId:e})})]})}function Gl(e,n){const{titleRunIds:t=[],ordered:o}=e.props,r=t.map(c=>Ie(n.store.getRun(c),n)).join(""),l=e.contentIds.map(c=>n.registry.get(n.store.getBlock(c).type).toHTML(n.store.getBlock(c),n)).join(""),s=l?`<${o?"ol":"ul"}>${l}</${o?"ol":"ul"}>`:"";return`<li>${r}${s}</li>`}function Xl(e,n){const{titleRunIds:t=[]}=e.props;return t.map(o=>we(n.store.getRun(o),n)).join("")}function Xt(e,n){const t=[],o=[];for(const d of e.childNodes)d.nodeType===1&&(d.tagName==="UL"||d.tagName==="OL")?o.push(d):t.push(d);const r=e.ownerDocument.createElement("span");for(const d of t)r.appendChild(d.cloneNode(!0));const l=de(r,n),s=T(),c=[...l],i=[],u=[];for(const d of o){const b=d.tagName==="OL";for(const h of d.children){if(h.tagName!=="LI")continue;const m=Xt(h,n);m.block.parentId=s,m.block.props.ordered=b,i.push(m.block,...m.childBlocks),c.push(...m.runs),u.push(m.block.id)}}return{block:{id:s,type:"listItem",parentId:null,contentIds:u,props:{ordered:!1,titleRunIds:l.map(d=>d.id)}},runs:c,childBlocks:i}}function Jl(e,n){if(e.tagName!=="LI")return null;const{block:t,runs:o,childBlocks:r}=Xt(e,n);return{block:t,runs:o,subtreeBlocks:r}}const Jt={component:Yl,isLeaf:!1,defaultProps:{ordered:!1,titleRunIds:[]},toHTML:Gl,toPlainText:Xl,fromHTML:Jl,slashCommands:[{label:"Bulleted list",icon:Kr,keywords:["list","bullet","ul"],run:(e,n)=>ne(e,n,He({ordered:!1}))},{label:"Numbered list",icon:qr,keywords:["list","number","ordered","ol"],run:(e,n)=>ne(e,n,He({ordered:!0}))},{label:"To-do list",icon:Mt,keywords:["todo","checkbox","task","checklist"],run:(e,n)=>ne(e,n,He({ordered:!1,checked:!1}))},{label:"Toggle list",icon:pn,keywords:["toggle","collapse","expand","dropdown","accordion"],run:(e,n)=>ne(e,n,He({ordered:!1,collapsed:!1}))}]},Qt=["text","date","checkbox","select"],mn="text",hn=160,an=80;function Ql(e){return`Column ${e+1}`}function Vn(e){return Array.from({length:e},(n,t)=>({id:T(),label:Ql(t),type:mn,width:hn}))}function ie(e,n){var o;const t=(o=e.props)==null?void 0:o.columns;return!Array.isArray(t)||t.length!==n?Vn(n):t.map(r=>{const l=r.type??mn,s=r.width??hn;return l===r.type&&s===r.width?r:{...r,type:l,width:s}})}function Zt(e){switch(e){case"date":return{id:T(),type:"date",value:"",marks:{},data:{isoDate:""}};case"checkbox":return{id:T(),type:"checkbox",value:"",marks:{},data:{checked:!1,label:""}};case"select":return{id:T(),type:"tableSelect",value:"",marks:{},data:{selectedValue:"",selectedLabel:""}};default:return{id:T(),type:"text",value:"",marks:{}}}}function gn(e,n){const t=Zt(n==null?void 0:n.type);return{block:{id:T(),type:"tableCell",parentId:e,contentIds:[t.id],props:{}},run:t}}function eo(e,n,t){if(e.type===n)return e;let o;if(e.type==="text")o=e.value??"";else{const r=t==null?void 0:t.get(e.type);o=r!=null&&r.toPlainText?r.toPlainText(e):""}if(n==="date"){const r=o?new Date(o):null,l=r&&!Number.isNaN(r.getTime())?r.toISOString().slice(0,10):"";return{id:T(),type:"date",value:"",marks:{},data:{isoDate:l}}}return n==="checkbox"?{id:T(),type:"checkbox",value:"",marks:{},data:{checked:!1,label:o}}:{id:T(),type:"text",value:o,marks:{}}}function Be(e,n){if(typeof e.performBatch=="function")e.performBatch(n);else for(const t of n)e.applyOperation(t)}function no(e,n){const o=e.getBlock(n.parentId).contentIds.indexOf(n.id);Be(e,[_(n.id)]);const r=Ae(e);if(r)return oe(e,r),null;const l=e.getBlock(n.parentId),s=l.contentIds[o]??l.contentIds[o-1];return s&&oe(e,s),null}function to(e,n){const t=e.getBlock(n),o=e.getBlock(t.parentId),r=o.contentIds.indexOf(n),l=ie(o,t.contentIds.length),s=T(),c=[],i=[],u=[];for(const d of l){const b=gn(s,d);c.push(b.block),i.push(b.run),u.push(b.block.id)}const p={id:s,type:"tableRow",parentId:o.id,contentIds:u,props:{}};return e.applyOperation(G(p,o.id,r+1,{blocks:[p,...c],runs:i})),oe(e,s),s}function oo(e,n){const t=e.getBlock(n),o=e.getBlock(t.parentId);if(o.contentIds.length<=1)return no(e,o);const r=o.contentIds.indexOf(n);Be(e,[_(n)]);const l=e.getBlock(o.id),s=Math.min(r,l.contentIds.length-1),c=l.contentIds[s];return c&&oe(e,c),c??null}function Cn(e,n,t){const o=e.getBlock(n),r=ie(o,o.contentIds[0]?e.getBlock(o.contentIds[0]).contentIds.length:0),l={id:T(),label:"New Column",type:mn,width:hn},s=[];let c=null;for(const u of o.contentIds){const p=gn(u,l);c===null&&(c=p.block.id),s.push(G(p.block,u,t+1,{blocks:[p.block],runs:[p.run]}))}const i=[...r];return i.splice(t+1,0,l),s.push(z(n,{columns:i})),Be(e,s),c&&oe(e,c),c}function ro(e,n,t){const o=e.getBlock(n),r=e.getBlock(o.contentIds[0]);if(!r||r.contentIds.length<=1)return no(e,o);const l=ie(o,r.contentIds.length),s=o.contentIds.map(d=>{const b=e.getBlock(d);return _(b.contentIds[t])}),c=l.filter((d,b)=>b!==t);s.push(z(n,{columns:c})),Be(e,s);const i=e.getBlock(o.contentIds[0]),u=Math.min(t,i.contentIds.length-1),p=i.contentIds[u];return p&&oe(e,p),p??null}function lo(e,n,t,o){const r=e.getBlock(n),l=e.getBlock(r.contentIds[0]),s=ie(r,l?l.contentIds.length:0);if(!s[t])return;const c=[...s];c[t]={...s[t],width:Math.max(an,Math.round(o))},e.applyOperation(z(n,{columns:c}))}function so(e,n,t,o){const r=e.getBlock(n),l=e.getBlock(r.contentIds[0]),c=[...ie(r,l?l.contentIds.length:0)];c[t]&&(c[t]={...c[t],label:o},e.applyOperation(z(n,{columns:c})))}function Yn(e,n,t){return n.contentIds.map(o=>{const l=e.getBlock(o).contentIds[t],s=e.getBlock(l);return{cellId:l,run:e.getRun(s.contentIds[0])}})}function ft(e,n){if(!e)return"";if(e.type==="text")return e.value??"";const t=n==null?void 0:n.get(e.type);return t!=null&&t.toPlainText?t.toPlainText(e):""}function Zl(e,n,t,o){const r=Yn(e,n,t),l=[],s=new Map;for(const{run:i}of r){const u=ft(i,o).trim();if(!u||s.has(u))continue;const p={value:T(),label:u};s.set(u,p),l.push(p)}const c=r.map(({cellId:i,run:u})=>{const p=ft(u,o).trim(),d=s.get(p);return{cellId:i,run:{id:T(),type:"tableSelect",value:"",marks:{},data:{selectedValue:(d==null?void 0:d.value)??"",selectedLabel:(d==null?void 0:d.label)??""}}}});return{options:l,newRuns:c}}function ao(e,n,t,o,r){const l=e.getBlock(n),s=e.getBlock(l.contentIds[0]),c=ie(l,s?s.contentIds.length:0),i=c[t];if(!i||i.type===o)return;const u=[...c];if(o==="select"){const{options:d,newRuns:b}=Zl(e,l,t,r);u[t]={...i,type:o,options:d};const h=[z(n,{columns:u})];for(const{cellId:m,run:g}of b)h.push(se(m,[g]));Be(e,h);return}u[t]={...i,type:o};const p=[z(n,{columns:u})];for(const{cellId:d,run:b}of Yn(e,l,t)){if(!b)continue;const h=eo(b,o,r);p.push(se(d,[h]))}Be(e,p)}function ln(e,n,t,o){var d,b;const r=e.getBlock(n),l=e.getBlock(r.contentIds[0]),s=ie(r,l?l.contentIds.length:0),c=s[t];if(!c)return;const i=[...s];i[t]={...c,options:o};const u=[z(n,{columns:i})],p=new Map(o.map(h=>[h.value,h]));for(const{run:h}of Yn(e,r,t)){if(!h||h.type!=="tableSelect")continue;const m=((d=h.data)==null?void 0:d.selectedValue)??"",g=p.get(m),x=g?m:"",k=g?g.label:"";(x!==m||k!==(((b=h.data)==null?void 0:b.selectedLabel)??""))&&u.push(J(h.id,{data:{selectedValue:x,selectedLabel:k}}))}Be(e,u)}function es(e,n){return n?e.label.toLowerCase().includes(n.toLowerCase()):!0}function _e({value:e,options:n,onChange:t,placeholder:o="Select…",ariaLabel:r,className:l="",variant:s="default",selectedLabel:c,selectedColor:i,onManageOptions:u,manageOptionsLabel:p="Manage options…",mention:d=!1}){var fe,Y;const[b,h]=f.useState(!1),[m,g]=f.useState(""),[x,k]=f.useState(0),[I,y]=f.useState(null),[E,R]=f.useState([]),[S,C]=f.useState(!1),[w,v]=f.useState(!1),j=f.useRef(null),B=f.useRef(null),O=f.useRef(null),N=f.useRef(null),M=f.useRef(null),q=f.useMemo(()=>[j,O],[]),V=s==="tag",H=typeof n=="function",P=H?void 0:n.find(L=>L.value===e),W=e?P??(c?{label:c,color:i}:void 0):void 0,K=f.useMemo(()=>H?E:n.filter(L=>es(L,m)),[H,E,n,m]);f.useEffect(()=>{if(!H||!b)return;let L=!1;C(!0),v(!1);const U=setTimeout(()=>{Promise.resolve(n(m)).then(ue=>{L||(R(ue??[]),C(!1))}).catch(()=>{L||(R([]),C(!1),v(!0))})},250);return()=>{L=!0,clearTimeout(U)}},[H,b,n,m]);const re=f.useCallback(()=>h(!1),[]);bn(q,b,re);const Re=f.useCallback(()=>{var L;y(((L=B.current)==null?void 0:L.getBoundingClientRect())??null),g(""),k(0),h(!0)},[]);f.useEffect(()=>{var L;b&&((L=N.current)==null||L.focus())},[b]),f.useEffect(()=>{var L,U;(U=(L=M.current)==null?void 0:L.scrollIntoView)==null||U.call(L,{block:"nearest"})},[x]);const Z=f.useCallback(L=>{var U;t(L.value,L),re(),(U=B.current)==null||U.focus()},[t,re]),le=f.useCallback(L=>{var U;L.key==="ArrowDown"?(L.preventDefault(),k(ue=>Math.min(ue+1,Math.max(K.length-1,0)))):L.key==="ArrowUp"?(L.preventDefault(),k(ue=>Math.max(ue-1,0))):L.key==="Enter"?(L.preventDefault(),K[x]&&Z(K[x])):L.key==="Escape"&&(L.preventDefault(),re(),(U=B.current)==null||U.focus())},[K,x,Z,re]);return a.jsxs("span",{className:`be-select ${l}`.trim(),ref:j,children:[a.jsx("button",{type:"button",ref:B,className:`be-select-trigger${V?" be-select-trigger-tag":""}${d?" be-select-trigger-mention":""}`,"aria-haspopup":"listbox","aria-expanded":b,"aria-label":r,onClick:()=>b?re():Re(),children:V?W?a.jsx("span",{className:`be-select-tag${d?" be-select-tag-mention":""}`,style:d?void 0:{background:(fe=W.color)==null?void 0:fe.bg,color:(Y=W.color)==null?void 0:Y.text},children:d?`@${W.label}`:W.label}):a.jsx("span",{className:"be-select-value be-select-value-placeholder",children:o}):a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"be-select-value",children:W?W.label:o}),a.jsx(_n,{size:14,className:"be-select-chevron"})]})}),b&&I&&Le.createPortal(a.jsxs("div",{ref:O,className:"be-select-popover",style:{position:"fixed",top:I.bottom+4,left:I.left,minWidth:I.width},children:[a.jsx("input",{ref:N,type:"text",className:"be-select-search",value:m,onChange:L=>{g(L.target.value),k(0)},onKeyDown:le,placeholder:"Search…","aria-label":r?`Search ${r}`:"Search options"}),a.jsxs("div",{className:"be-select-options",role:"listbox",children:[H&&S&&a.jsx("div",{className:"be-select-empty",children:"Loading…"}),H&&!S&&w&&a.jsx("div",{className:"be-select-empty be-select-error",children:"Couldn't load options"}),!S&&!w&&K.length===0&&a.jsx("div",{className:"be-select-empty",children:"No results"}),!S&&!w&&K.map((L,U)=>{var ue,nt;return a.jsx("div",{ref:U===x?M:void 0,role:"option","aria-selected":L.value===e,className:`be-select-option${U===x?" be-select-option-active":""}${L.value===e?" be-select-option-selected":""}`,onMouseDown:dr=>{dr.preventDefault(),Z(L)},onMouseEnter:()=>k(U),children:V?a.jsx("span",{className:"be-select-tag",style:{background:(ue=L.color)==null?void 0:ue.bg,color:(nt=L.color)==null?void 0:nt.text},children:L.label}):L.label},L.value)})]}),u&&a.jsx("button",{type:"button",className:"be-select-manage-options",onMouseDown:L=>{L.preventDefault(),re(),u()},children:p})]}),document.body)]})}const nn=[{bg:"#e9e9e7",text:"#32302c"},{bg:"#eee0da",text:"#64473a"},{bg:"#fadec9",text:"#8a4b23"},{bg:"#fdecc8",text:"#8a6116"},{bg:"#dbeddb",text:"#256029"},{bg:"#d3e5ef",text:"#1a5f8a"},{bg:"#e8deee",text:"#5b3a8a"},{bg:"#f5e0e9",text:"#8a3a5f"},{bg:"#ffe2dd",text:"#a13a2f"}];function Ke(e){return nn[(e%nn.length+nn.length)%nn.length]}const ns={text:"Text",date:"Date",checkbox:"Checkbox",select:"Select"},ts=Qt.map(e=>({value:e,label:ns[e]}));function os({tableId:e,colIndex:n,options:t}){const o=D(),[r,l]=f.useState(""),s=f.useCallback((u,p)=>{ln(o,e,n,t.map(d=>d.value===u?{...d,label:p}:d))},[o,e,n,t]),c=f.useCallback(u=>ln(o,e,n,t.filter(p=>p.value!==u)),[o,e,n,t]),i=f.useCallback(()=>{const u=r.trim();l(""),u&&ln(o,e,n,[...t,{value:T(),label:u,color:Ke(t.length)}])},[o,e,n,t,r]);return a.jsxs("div",{className:"be-table-header-menu-options",children:[a.jsx("div",{className:"be-table-header-menu-options-label",children:"Options"}),t.map((u,p)=>a.jsxs("div",{className:"be-table-header-menu-option-row",children:[a.jsx("span",{className:"be-table-header-menu-option-swatch",style:{background:(u.color??Ke(p)).bg},"aria-hidden":"true"}),a.jsx("input",{className:"be-table-header-menu-option-input",value:u.label,onChange:d=>s(u.value,d.target.value),"aria-label":`Rename option ${u.label}`}),a.jsx("button",{type:"button",className:"be-table-header-menu-option-remove",onClick:()=>c(u.value),"aria-label":`Remove option ${u.label}`,children:a.jsx(Ge,{size:14})})]},u.value)),a.jsxs("div",{className:"be-table-header-menu-option-row",children:[a.jsx("input",{className:"be-table-header-menu-option-input",value:r,onChange:u=>l(u.target.value),placeholder:"New option…",onKeyDown:u=>{u.key==="Enter"&&(u.preventDefault(),i())}}),a.jsx("button",{type:"button",className:"be-table-header-menu-option-add",onClick:i,"aria-label":"Add option",children:"+"})]})]})}function rs({tableId:e,column:n,colIndex:t,colCount:o}){const r=D(),l=he(),[s,c]=f.useState(!1),[i,u]=f.useState(null),[p,d]=f.useState(null),b=f.useRef(null),h=f.useRef(null),m=f.useRef(null),g=f.useMemo(()=>[b,h],[]),x=f.useCallback(()=>c(!1),[]);bn(g,s,x);const k=f.useCallback(()=>{var w;u(((w=m.current)==null?void 0:w.getBoundingClientRect())??null),c(!0)},[]),I=f.useCallback(w=>so(r,e,t,w.target.value),[r,e,t]),y=f.useCallback(()=>{Cn(r,e,t-1),x()},[r,e,t,x]),E=f.useCallback(()=>{Cn(r,e,t),x()},[r,e,t,x]),R=f.useCallback(()=>{ro(r,e,t),x()},[r,e,t,x]),S=f.useCallback(w=>ao(r,e,t,w,l),[r,e,t,l]),C=f.useCallback(w=>{var V;w.preventDefault();const v=(V=m.current)==null?void 0:V.closest("table"),j=v==null?void 0:v.querySelector(`col[data-col-index="${t}"]`);if(!j)return;const B=m.current.getBoundingClientRect().width,O=w.clientX,N=H=>Math.max(an,Math.round(B+(H.clientX-O))),M=H=>{const P=N(H);j.style.width=`${P}px`,d(P)},q=H=>{document.removeEventListener("mousemove",M),document.removeEventListener("mouseup",q),lo(r,e,t,N(H)),d(null)};document.addEventListener("mousemove",M),document.addEventListener("mouseup",q)},[r,e,t]);return a.jsxs("th",{ref:m,className:"be-table-header-cell",contentEditable:!1,children:[a.jsx("input",{className:"be-table-header-label",value:n.label,onChange:I,"aria-label":`Column ${t+1} name`}),a.jsx("button",{ref:b,type:"button",className:"be-table-header-menu-trigger","aria-label":`Column ${t+1} options`,"aria-haspopup":"menu","aria-expanded":s,onClick:()=>s?x():k(),children:"⋮"}),a.jsx("div",{className:"be-table-col-resize-handle",onMouseDown:C,role:"slider","aria-label":`Resize column ${t+1}`,"aria-valuemin":an,"aria-valuenow":p??n.width}),s&&i&&Le.createPortal(a.jsxs("div",{ref:h,role:"menu",className:"be-table-header-menu",style:{position:"fixed",top:i.bottom+4,left:i.right,transform:"translateX(-100%)"},children:[a.jsxs("div",{className:"be-table-header-menu-type",children:[a.jsx("span",{id:`be-table-col-type-${n.id}`,children:"Type"}),a.jsx(_e,{value:n.type,options:ts,onChange:S,ariaLabel:"Column type",className:""})]}),n.type==="select"&&a.jsx(os,{tableId:e,colIndex:t,options:n.options??[]}),a.jsx("button",{type:"button",role:"menuitem",className:"be-table-header-menu-item",onClick:y,children:"Insert column left"}),a.jsx("button",{type:"button",role:"menuitem",className:"be-table-header-menu-item",onClick:E,children:"Insert column right"}),a.jsx("button",{type:"button",role:"menuitem",className:"be-table-header-menu-item be-table-header-menu-item-danger",onClick:R,disabled:o<=1,children:"Delete column"})]}),document.body)]})}function co({tableId:e,columns:n}){return a.jsx("thead",{children:a.jsxs("tr",{className:"be-table-header-row",children:[n.map((t,o)=>a.jsx(rs,{tableId:e,column:t,colIndex:o,colCount:n.length},t.id)),a.jsx("th",{className:"be-table-header-spacer","aria-hidden":"true"})]})})}function ls({id:e}){var c;const n=D(),t=Q(e),o=f.useCallback(()=>{var u;const i=(u=t==null?void 0:t.contentIds)==null?void 0:u[t.contentIds.length-1];i&&to(n,i)},[n,t]),r=ee("be-table-wrapper",t);if(!t)return null;const l=n.getBlock(t.contentIds[0]),s=ie(t,((c=l==null?void 0:l.contentIds)==null?void 0:c.length)??0);return a.jsx("div",{className:"be-table-scroll",children:a.jsxs("div",{className:r,"data-block-id":e,children:[a.jsxs("table",{className:"be-table",children:[a.jsxs("colgroup",{children:[s.map((i,u)=>a.jsx("col",{"data-col-index":u,style:{width:i.width}},i.id)),a.jsx("col",{className:"be-table-header-spacer-col"})]}),a.jsx(co,{tableId:e,columns:s}),a.jsx("tbody",{children:a.jsx(Ce,{parentId:e})})]}),a.jsxs("button",{type:"button",className:"be-table-add-row",contentEditable:!1,onClick:o,children:[a.jsx(St,{size:14})," Add row"]})]})})}function ss({id:e}){const n=D(),t=Q(e),o=ee("be-table-row",t),r=f.useCallback(()=>oo(n,e),[n,e]);return a.jsxs("tr",{className:o,"data-block-id":e,children:[a.jsx(Ce,{parentId:e}),a.jsx("td",{className:"be-table-row-actions",contentEditable:!1,children:a.jsx("button",{type:"button",className:"be-table-delete-row",onClick:r,"aria-label":"Delete row",title:"Delete row",children:a.jsx(Ge,{size:14})})})]})}function io(e,n){const t=e.getBlock(n),o=e.getBlock(t.parentId),r=e.getBlock(o.parentId);return{table:r,row:o,rowIndex:r.contentIds.indexOf(o.id),colIndex:o.contentIds.indexOf(n)}}function as(e,n,t){const{table:o,row:r,rowIndex:l,colIndex:s}=io(e,n);if(t==="left"||t==="right"){const p=t==="right"?1:-1,d=s+p;if(d>=0&&d<r.contentIds.length)return r.contentIds[d];const b=l+p;if(b<0||b>=o.contentIds.length)return null;const h=e.getBlock(o.contentIds[b]),m=t==="right"?0:h.contentIds.length-1;return h.contentIds[m]}const i=l+(t==="down"?1:-1);if(i<0||i>=o.contentIds.length)return null;const u=e.getBlock(o.contentIds[i]);return u.contentIds[s]??u.contentIds[u.contentIds.length-1]??null}function cs(e,n){const t=_t(e,n,"down");if(t){X(t);return}ve(e,n,$("paragraph"))}function Pe(e,n,t){var r;const o=as(e,n,t);if(o){const l=e.getBlock(o),s=(r=l==null?void 0:l.contentIds)==null?void 0:r[0];s&&X(s);return}if(t==="right"){const{table:l}=io(e,n);cs(e,l.id)}}function is({id:e}){const n=D(),t=Q(e),o=f.useCallback(()=>Pe(n,e,"right"),[n,e]),r=f.useCallback(()=>Pe(n,e,"left"),[n,e]),l=f.useCallback(()=>Pe(n,e,"up"),[n,e]),s=f.useCallback(()=>Pe(n,e,"down"),[n,e]),c=f.useCallback(()=>Pe(n,e,"down"),[n,e]),i=ee("be-table-cell",t);return t?a.jsx("td",{className:i,"data-block-id":e,children:a.jsx(xe,{blockId:e,runIds:t.contentIds,onTab:o,onShiftTab:r,onArrowUp:l,onArrowDown:s,onEnter:c})}):null}function us(e,n){const t=T(),o=[],r=[],l=[];for(const s of n){const c=gn(t,s);o.push(c.block),r.push(c.run),l.push(c.block.id)}return{block:{id:t,type:"tableRow",parentId:e,contentIds:l,props:{}},blocks:o,runs:r}}function ds({rows:e=2,cols:n=2}={}){return function(o){const r=T(),l=Vn(n),s=[],c=[],i=[];for(let p=0;p<e;p+=1){const d=us(r,l);s.push(d.block,...d.blocks),c.push(...d.runs),i.push(d.block.id)}return{block:{id:r,type:"table",parentId:o,contentIds:i,props:{columns:l}},runs:c,subtreeBlocks:s}}}function ps(e,n){return`<td>${e.contentIds.map(o=>n.store.getRun(o)).map(o=>Ie(o,n)).join("")}</td>`}function fs(e,n){return e.contentIds.map(t=>we(n.store.getRun(t),n)).join("")}function bs(e,n){if(e.tagName!=="TD"&&e.tagName!=="TH")return null;const t=de(e,n);return{block:{id:T(),type:"tableCell",parentId:null,contentIds:t.map(r=>r.id),props:{}},runs:t}}function ms(e,n){return`<tr>${e.contentIds.map(o=>{const r=n.store.getBlock(o);return n.registry.get(r.type).toHTML(r,n)}).join("")}</tr>`}function hs(e,n){return e.contentIds.map(t=>{const o=n.store.getBlock(t);return n.registry.get(o.type).toPlainText(o,n)}).join(" ")}function gs(e,n){if(e.tagName!=="TR")return null;const t=[...e.children].filter(i=>i.tagName==="TD"||i.tagName==="TH"),o=T(),r=[],l=[],s=[];for(const i of t){const u=n.registry.get("tableCell").fromHTML(i,n);u&&(u.block.parentId=o,r.push(u.block),l.push(...u.runs),s.push(u.block.id))}return{block:{id:o,type:"tableRow",parentId:null,contentIds:s,props:{}},runs:l,subtreeBlocks:r}}function xs(e,n){var s;const t=e.contentIds[0]&&n.store.getBlock(e.contentIds[0]),o=ie(e,((s=t==null?void 0:t.contentIds)==null?void 0:s.length)??0),r=o.length?`<thead><tr>${o.map(c=>`<th>${Se(c.label??"")}</th>`).join("")}</tr></thead>`:"",l=e.contentIds.map(c=>{const i=n.store.getBlock(c);return n.registry.get(i.type).toHTML(i,n)}).join("");return`<table>${r}<tbody>${l}</tbody></table>`}function ks(e,n){return e.contentIds.map(t=>{const o=n.store.getBlock(t);return n.registry.get(o.type).toPlainText(o,n)}).join(`
1882
- `)}function ys(e,n){if(e.tagName!=="TABLE")return null;const t=e.querySelector("thead tr"),o=e.querySelector("tbody")?[...e.querySelectorAll("tbody tr")]:[...e.querySelectorAll("tr")].filter(p=>p!==t),r=T(),l=[],s=[],c=[];for(const p of o){const d=n.registry.get("tableRow").fromHTML(p,n);if(d){d.block.parentId=r;for(const b of d.subtreeBlocks)b.parentId=d.block.id;l.push(d.block,...d.subtreeBlocks),s.push(...d.runs),c.push(d.block.id)}}const i={};if(t){const p=[...t.children].filter(d=>d.tagName==="TH"||d.tagName==="TD");i.columns=p.map(d=>({id:T(),label:d.textContent??""}))}return{block:{id:r,type:"table",parentId:null,contentIds:c,props:i},runs:s,subtreeBlocks:l}}const uo={component:is,isLeaf:!0,defaultProps:{},toHTML:ps,toPlainText:fs,fromHTML:bs},po={component:ss,isLeaf:!1,defaultProps:{},toHTML:ms,toPlainText:hs,fromHTML:gs},fo={component:ls,isLeaf:!1,defaultProps:{},toHTML:xs,toPlainText:ks,fromHTML:ys,slashCommand:{label:"Table",icon:Fr,keywords:["table","grid"],run:(e,n)=>ne(e,n,ds({rows:2,cols:2}))}};function vs({id:e}){const n=Q(e),t=ee("be-layout",n);return a.jsx("div",{className:t,"data-block-id":e,style:{display:"flex",gap:"1em"},children:a.jsx(Ce,{parentId:e})})}function Is({id:e}){const n=Q(e),t=ee("be-layout-column",n);return a.jsx("div",{className:t,"data-block-id":e,children:a.jsx(Ce,{parentId:e})})}function ws({columns:e=2}={}){return function(t){const o=T(),r=[],l=[],s=[];for(let i=0;i<e;i+=1){const u=T(),{block:p,runs:d}=$("paragraph")(u),b={id:u,type:"layoutColumn",parentId:o,contentIds:[p.id],props:{}};r.push(b,p),l.push(...d),s.push(u)}return{block:{id:o,type:"layout",parentId:t,contentIds:s,props:{}},runs:l,subtreeBlocks:r}}}function bo(e,n){return(t,o)=>`${e}${t.contentIds.map(r=>{const l=o.store.getBlock(r);return o.registry.get(l.type).toHTML(l,o)}).join("")}${n}`}function mo(e,n){return e.contentIds.map(t=>{const o=n.store.getBlock(t);return n.registry.get(o.type).toPlainText(o,n)}).join(`
1883
- `)}const ho={component:Is,isLeaf:!1,defaultProps:{},toHTML:bo("<div>","</div>"),toPlainText:mo},go={component:vs,isLeaf:!1,defaultProps:{},toHTML:bo('<div style="display:flex;gap:1em">',"</div>"),toPlainText:mo,slashCommands:[2,3,4,5].map(e=>({label:`${e} columns`,icon:Ur,keywords:["layout","columns","column",String(e)],run:(n,t)=>ne(n,t,ws({columns:e}))}))};function Cs({id:e}){const n=Q(e),t=ee("be-divider",n);return a.jsx("hr",{className:t,"data-block-id":e,contentEditable:!1,tabIndex:-1})}function Bs(){return function(n){return{block:{id:T(),type:"divider",parentId:n,contentIds:[],props:{}},runs:[]}}}function Rs(){return"<hr />"}function Ts(){return"---"}function js(e){return e.tagName!=="HR"?null:{block:{id:T(),type:"divider",parentId:null,contentIds:[],props:{}},runs:[]}}const xo={component:Cs,isLeaf:!0,defaultProps:{},toHTML:Rs,toPlainText:Ts,fromHTML:js,slashCommand:{label:"Divider",icon:Pr,keywords:["divider","hr","separator","line"],run:(e,{blockId:n,runId:t,sliceStart:o,sliceEnd:r})=>{const l=e.getRun(t),s=(l==null?void 0:l.value)??"";e.applyOperation(J(t,{value:s.slice(0,o)+s.slice(r)}));const c=zn(e,n,Bs());return ve(e,c,$("paragraph")),c}}},en="💡",ko="gray";function Ss({icon:e=en,color:n=ko}={}){return function(o){const r=T(),{block:l,runs:s}=$("paragraph")(r);return{block:{id:r,type:"callout",parentId:o,contentIds:[l.id],props:{icon:e,color:n}},runs:s,subtreeBlocks:[l]}}}const Es=[{value:"gray",label:"Gray"},{value:"blue",label:"Blue"},{value:"green",label:"Green"},{value:"yellow",label:"Yellow"},{value:"orange",label:"Orange"},{value:"red",label:"Red"},{value:"purple",label:"Purple"},{value:"pink",label:"Pink"}];function Os({id:e}){var k,I;const n=D(),t=Q(e),[o,r]=f.useState(!1),[l,s]=f.useState(!1),c=f.useRef(null),i=f.useRef(null),u=f.useMemo(()=>[c,i],[]),p=f.useCallback(()=>s(!1),[]);bn(u,l,p);const d=((k=t==null?void 0:t.props)==null?void 0:k.icon)??en,b=((I=t==null?void 0:t.props)==null?void 0:I.color)??ko,h=f.useCallback(y=>{const E=y.target.value.trim();E&&n.applyOperation(z(e,{icon:E})),r(!1)},[n,e]),m=f.useCallback(y=>{y.key==="Enter"&&y.currentTarget.blur(),y.key==="Escape"&&r(!1)},[]),g=f.useCallback(y=>{n.applyOperation(z(e,{color:y})),s(!1)},[n,e]),x=ee("be-callout",t);return t?a.jsxs("div",{className:x,"data-block-id":e,"data-color":b,children:[a.jsx("div",{className:"be-callout-icon-wrap",children:o?a.jsx("input",{type:"text",className:"be-callout-icon-input",defaultValue:d,autoFocus:!0,onBlur:h,onKeyDown:m,"aria-label":"Callout icon (paste or type an emoji)"}):a.jsx("button",{type:"button",className:"be-callout-icon",onClick:()=>r(!0),"aria-label":"Change callout icon",title:"Change icon",children:d})}),a.jsx("div",{className:"be-callout-content",children:a.jsx(Ce,{parentId:e})}),a.jsxs("div",{className:"be-callout-color-wrap",contentEditable:!1,children:[a.jsx("button",{ref:c,type:"button",className:"be-callout-color-trigger","aria-label":"Callout color","aria-haspopup":"true","aria-expanded":l,title:"Callout color",onClick:()=>s(y=>!y),children:a.jsx("span",{className:`be-callout-color-dot be-callout-color-dot-${b}`})}),l&&a.jsx("div",{ref:i,className:"be-callout-color-picker",role:"menu","aria-label":"Callout color",children:Es.map(y=>a.jsx("button",{type:"button",role:"menuitem",className:`be-callout-color-option be-callout-color-option-${y.value}${y.value===b?" be-callout-color-option-active":""}`,title:y.label,"aria-label":y.label,onClick:()=>g(y.value)},y.value))})]})]}):null}function Ls(e,n){return e.contentIds.map(t=>{const o=n.store.getBlock(t);return n.registry.get(o.type).toHTML(o,n)}).join("")}function Ns(e,n){var o;const t=((o=e.props)==null?void 0:o.icon)??en;return`<div class="callout" data-icon="${t}"><div class="callout-icon">${t}</div><div class="callout-content">${Ls(e,n)}</div></div>`}function Ms(e,n){var r;const t=((r=e.props)==null?void 0:r.icon)??en,o=e.contentIds.map(l=>{const s=n.store.getBlock(l);return n.registry.get(s.type).toPlainText(s,n)}).join(`
1884
- `);return`${t} ${o}`}const yo={component:Os,isLeaf:!1,defaultProps:{icon:en},toHTML:Ns,toPlainText:Ms,slashCommand:{label:"Callout",icon:Hr,keywords:["callout","aside","note","info","tip","warning"],run:(e,n)=>ne(e,n,Ss())}};function As({id:e}){const n=D(),t=Q(e),{setSelectedBlockId:o}=ge(),r=f.useCallback(()=>{Me(n,e,(t==null?void 0:t.contentIds)??[],$("paragraph"))},[n,e,t]),l=f.useCallback(()=>{const p=Qe(n,e);De(n,p,e,o)},[n,e,o]),s=f.useCallback(()=>te(n,e,"up"),[n,e]),c=f.useCallback(()=>te(n,e,"down"),[n,e]),i=ee("be-blockquote",t);if(!t)return null;const u=ae(n,t.contentIds);return a.jsx("blockquote",{className:i,"data-block-id":e,"data-empty":u?"":void 0,"data-placeholder":"Empty quote",children:a.jsx(xe,{blockId:e,runIds:t.contentIds,onEnter:r,onBackspaceAtStart:l,onArrowUp:s,onArrowDown:c})})}function Ds(e,n){return`<p>${e.contentIds.map(o=>n.store.getRun(o)).map(o=>Ie(o,n)).join("")}</p>`}function _s(e,n){return e.contentIds.map(t=>we(n.store.getRun(t),n)).join("")}function $s(e,n){if(e.tagName!=="BLOCKQUOTE")return null;const t=de(e,n);return{block:{id:T(),type:"blockquote",parentId:null,contentIds:t.map(r=>r.id),props:{}},runs:t}}const vo={component:As,isLeaf:!0,defaultProps:{},toHTML:Ds,toPlainText:_s,fromHTML:$s,slashCommand:{label:"Quote",icon:$r,keywords:["quote","blockquote","citation"],run:(e,n)=>ne(e,n,$("blockquote"))}},Ps=["plaintext","javascript","python","html","css","json","bash","sql"],Hs=Ps.map(e=>({value:e,label:e}));function bt(e,n,t){const o=Xe();if(!o||o.blockId!==n)return;const r=e.getRun(o.runId);if(!r||r.type!=="text")return;const l=r.value??"",s=l.slice(0,o.offset)+t+l.slice(o.offset);e.applyOperation(J(r.id,{value:s})),be(r.id,o.offset+t.length)}function zs({id:e}){var h;const n=D(),t=Q(e),o=f.useCallback(()=>bt(n,e,`
1885
- `),[n,e]),r=f.useCallback(()=>bt(n,e," "),[n,e]),l=f.useCallback(()=>{var k;const m=Qe(n,e);if(!m||m===e)return;const g=n.getBlock(m),x=(k=g==null?void 0:g.contentIds)==null?void 0:k[g.contentIds.length-1];x&&X(x)},[n,e]),s=f.useCallback(()=>te(n,e,"up"),[n,e]),c=f.useCallback(()=>te(n,e,"down"),[n,e]),i=f.useCallback(m=>n.applyOperation(z(e,{language:m})),[n,e]),u=f.useCallback(()=>Wn(n,e),[n,e]),p=ee("be-code-block",t);if(!t)return null;const d=((h=t.props)==null?void 0:h.language)??"plaintext",b=ae(n,t.contentIds);return a.jsxs("div",{className:p,"data-block-id":e,children:[a.jsxs("div",{className:"be-code-block-header",contentEditable:!1,children:[a.jsx(_e,{className:"be-code-block-language",value:d,options:Hs,onChange:i,ariaLabel:"Code language"}),a.jsx("button",{type:"button",className:"be-code-block-delete",onClick:u,"aria-label":"Delete code block",title:"Delete code block",children:a.jsx($n,{size:14})})]}),a.jsx("pre",{className:"be-code-block-pre",children:a.jsx("code",{"data-empty":b?"":void 0,"data-placeholder":"Empty code block",children:a.jsx(xe,{blockId:e,runIds:t.contentIds,onEnter:o,onTab:r,onBackspaceAtStart:l,onArrowUp:s,onArrowDown:c})})})]})}function Fs(e,n){var l;const t=e.contentIds.map(s=>n.store.getRun(s)),o=(l=e.props)==null?void 0:l.language;return`<pre><code${o&&o!=="plaintext"?` data-language="${Se(o)}"`:""}>${t.map(s=>Ie(s,n)).join("")}</code></pre>`}function Us(e,n){return e.contentIds.map(t=>we(n.store.getRun(t),n)).join("")}function Ks(e,n){var s;if(e.tagName!=="PRE")return null;const t=e.querySelector("code")??e,o=(s=t.getAttribute)==null?void 0:s.call(t,"data-language"),r=T();return{block:{id:T(),type:"code",parentId:null,contentIds:[r],props:o?{language:o}:{}},runs:[{id:r,type:"text",value:t.textContent??"",marks:{}}]}}const Io={component:zs,isLeaf:!0,defaultProps:{language:"plaintext"},toHTML:Fs,toPlainText:Us,fromHTML:Ks,slashCommand:{label:"Code",icon:Nt,keywords:["code","codeblock","snippet","pre"],run:(e,n)=>ne(e,n,$("code"))}};function qs(e,n){var t;return n.length===0||n.length===1&&(((t=e.getRun(n[0]))==null?void 0:t.value)??"")===""}function Ws(e,n){const t=n.contentIds??[];if(t.length===0)return!0;if(t.length>1)return!1;const o=e.getBlock(t[0]);return!!o&&o.type==="paragraph"&&ae(e,o.contentIds)}function tn(e,n){if(typeof e.performBatch=="function")e.performBatch(n);else for(const t of n)e.applyOperation(t)}function Vs(e,n){const t=e.getBlock(n);if(!t)return null;const o=e.getBlock(t.parentId),r=o.contentIds.indexOf(n),l=t.props.titleRunIds??[],s=qs(e,l)&&Ws(e,t);if(r<=0){if(!s)return null;if(o.contentIds.length>1)return tn(e,[_(n)]),{focusBlockId:e.getBlock(o.id).contentIds[0],needsRefocus:!0};const{block:u,runs:p}=$("paragraph")(o.id);return tn(e,[G(u,o.id,r,{blocks:[u],runs:p}),_(n)]),{focusBlockId:u.id,needsRefocus:!0}}const c=o.contentIds[r-1],i=e.getBlock(c);return s?(tn(e,[_(n)]),{focusBlockId:c,needsRefocus:!0}):Ve(e,i)?(tn(e,[_(c)]),{focusBlockId:n,needsRefocus:!1}):null}function Ys(e,n){if(typeof e.performBatch=="function")e.performBatch(n);else for(const t of n)e.applyOperation(t)}function Gs({id:e}){var g;const n=D(),t=Q(e),{setSelectedBlockId:o}=ge(),r=f.useCallback(()=>{var y,E;const x=((y=t==null?void 0:t.props)==null?void 0:y.titleRunIds)??[],k=(((E=t==null?void 0:t.contentIds)==null?void 0:E.length)??0)>0,I=$("paragraph");k?Pt(n,e,x,I):Me(n,e,x,I)},[n,e,t]),l=f.useCallback(()=>{const x=Vs(n,e);!x||!x.needsRefocus||De(n,x.focusBlockId,e,o)},[n,e,o]),s=f.useCallback(()=>te(n,e,"up"),[n,e]),c=f.useCallback(()=>te(n,e,"down"),[n,e]),i=f.useCallback(()=>{var k,I;if(!((((k=t==null?void 0:t.contentIds)==null?void 0:k.length)??0)>0)){const{block:y,runs:E}=$("paragraph")(e);Ys(n,[G(y,e,0,{blocks:[y],runs:E}),z(e,{collapsed:!1})]),X(y.contentIds[0]);return}n.applyOperation(z(e,{collapsed:!((I=t==null?void 0:t.props)!=null&&I.collapsed)}))},[n,e,t==null?void 0:t.contentIds,(g=t==null?void 0:t.props)==null?void 0:g.collapsed]),u=ee("be-toggle-heading",t);if(!t)return null;const{level:p=2,collapsed:d,titleRunIds:b=[]}=t.props,h=t.contentIds.length>0,m=`h${p}`;return a.jsxs("div",{className:u,"data-block-id":e,children:[a.jsxs("div",{className:"be-toggle-heading-row",children:[a.jsx("button",{type:"button",className:"be-toggle-heading-marker",onClick:i,"aria-expanded":!d,"aria-label":h?d?"Expand section":"Collapse section":"Add content to section",children:d?a.jsx(pn,{}):a.jsx(_n,{})}),a.jsx(m,{className:"be-heading be-toggle-heading-title","data-empty":ae(n,b)?"":void 0,"data-placeholder":`Toggle heading ${p}`,children:a.jsx(xe,{blockId:e,runIds:b,onEnter:r,onBackspaceAtStart:l,onArrowUp:s,onArrowDown:c})})]}),!d&&a.jsx("div",{className:"be-toggle-heading-children",children:a.jsx(Ce,{parentId:e})})]})}function Xs({level:e=2,collapsed:n=!1}={}){return function(o,r){const l=T(),s=r!=null&&r.length?r:[{id:T(),type:"text",value:"",marks:{}}],{block:c,runs:i}=$("paragraph")(l);return{block:{id:l,type:"toggleHeading",parentId:o,contentIds:[c.id],props:{level:e,collapsed:n,titleRunIds:s.map(u=>u.id)}},runs:[...s,...i],subtreeBlocks:[c]}}}function Js(e,n){const{titleRunIds:t=[],level:o=2,collapsed:r}=e.props,l=t.map(c=>Ie(n.store.getRun(c),n)).join(""),s=e.contentIds.map(c=>{const i=n.store.getBlock(c);return n.registry.get(i.type).toHTML(i,n)}).join("");return`<details${r?"":" open"}><summary><h${o}>${l}</h${o}></summary>${s}</details>`}function Qs(e,n){const{titleRunIds:t=[]}=e.props,o=t.map(l=>we(n.store.getRun(l),n)).join(""),r=e.contentIds.map(l=>{const s=n.store.getBlock(l);return n.registry.get(s.type).toPlainText(s,n)}).join(`
1886
- `);return r?`${o}
1887
- ${r}`:o}function Zs(e,n){if(e.tagName!=="DETAILS")return null;const t=[...e.children].find(d=>d.tagName==="SUMMARY"),o=t==null?void 0:t.querySelector("h1,h2,h3,h4,h5,h6"),r=o?Math.min(6,Math.max(1,Number(o.tagName[1]))):2,l=o?de(o,n):[{id:T(),type:"text",value:"",marks:{}}],s=T(),c=[],i=[],u=[];for(const d of e.children){if(d===t||d.tagName!=="P")continue;const b=de(d,n),h={id:T(),type:"paragraph",parentId:s,contentIds:b.map(m=>m.id),props:{}};c.push(h),i.push(...b),u.push(h.id)}if(u.length===0){const{block:d,runs:b}=$("paragraph")(s);c.push(d),i.push(...b),u.push(d.id)}return{block:{id:s,type:"toggleHeading",parentId:null,contentIds:u,props:{level:r,collapsed:!e.hasAttribute("open"),titleRunIds:l.map(d=>d.id)}},runs:[...l,...i],subtreeBlocks:c}}const wo={component:Gs,isLeaf:!1,defaultProps:{level:2,collapsed:!1,titleRunIds:[]},toHTML:Js,toPlainText:Qs,fromHTML:Zs,slashCommands:[1,2,3].map(e=>({label:`Toggle heading ${e}`,icon:pn,keywords:["toggle","heading","collapse","section"],run:(n,t)=>ne(n,t,Xs({level:e}))}))},vn=[{label:"Blue",value:"#2b6fd6"},{label:"Green",value:"#2f9e44"},{label:"Red",value:"#e03131"},{label:"Purple",value:"#9c36b5"},{label:"Gray",value:"#495057"},{label:"Black",value:"#1a1a1a"}];function ea(e,n){if(typeof e.performBatch=="function")e.performBatch(n);else for(const t of n)e.applyOperation(t)}function na({isOpen:e,onClose:n,store:t,blockId:o}){const[r,l]=f.useState(""),[s,c]=f.useState(""),[i,u]=f.useState(vn[0].value),[p,d]=f.useState([{key:"",value:""}]);f.useEffect(()=>{var I,y,E;if(!e)return;const g=t.getBlock(o);if(!g)return;const x=g.contentIds.map(R=>{var S;return((S=t.getRun(R))==null?void 0:S.value)??""}).join(""),k=((I=g.props)==null?void 0:I.customAttrs)??[];l(x),c(((y=g.props)==null?void 0:y.href)??""),u(((E=g.props)==null?void 0:E.color)??vn[0].value),d([...k,{key:"",value:""}])},[e,o,t]);const b=f.useCallback((g,x)=>{d(k=>{const I=k.map((E,R)=>R===g?{...E,...x}:E),y=I[I.length-1];return(y.key.trim()||y.value.trim())&&I.push({key:"",value:""}),I})},[]),h=f.useCallback(g=>{d(x=>x.filter((k,I)=>I!==g))},[]),m=f.useCallback(()=>{const g={id:T(),type:"text",value:r,marks:{}},x=p.filter(k=>k.key.trim());ea(t,[se(o,[g]),z(o,{href:s.trim(),color:i,customAttrs:x})]),n()},[t,o,r,s,i,p,n]);return a.jsxs(Ye,{isOpen:e,onClose:n,title:"Edit button",children:[a.jsxs("label",{className:"be-modal-field",children:[a.jsx("span",{children:"Label"}),a.jsx("input",{type:"text",value:r,onChange:g=>l(g.target.value),placeholder:"Button"})]}),a.jsxs("label",{className:"be-modal-field",children:[a.jsx("span",{children:"Link URL"}),a.jsx("input",{type:"url",value:s,onChange:g=>c(g.target.value),placeholder:"https://example.com"})]}),a.jsxs("div",{className:"be-modal-field",children:[a.jsx("span",{children:"Color"}),a.jsx("div",{className:"be-modal-color-row",children:vn.map(g=>a.jsx("button",{type:"button",className:`be-modal-color-swatch${i===g.value?" be-modal-color-swatch-active":""}`,style:{backgroundColor:g.value},title:g.label,"aria-label":g.label,onClick:()=>u(g.value)},g.value))})]}),a.jsxs("div",{className:"be-modal-field",children:[a.jsx("span",{children:"Custom attributes"}),p.map((g,x)=>a.jsxs("div",{className:"be-modal-attr-row",children:[a.jsx("input",{type:"text",placeholder:"name",value:g.key,onChange:k=>b(x,{key:k.target.value})}),a.jsx("input",{type:"text",placeholder:"value",value:g.value,onChange:k=>b(x,{value:k.target.value})}),(g.key||g.value)&&a.jsx("button",{type:"button",className:"be-modal-attr-remove",onClick:()=>h(x),"aria-label":"Remove attribute",children:a.jsx(Ge,{size:14})})]},x))]}),a.jsxs("div",{className:"be-modal-actions",children:[a.jsx("button",{type:"button",className:"be-modal-cancel",onClick:n,children:"Cancel"}),a.jsx("button",{type:"button",className:"be-modal-save",onClick:m,children:"Save"})]})]})}const ta="#2b6fd6";function oa({id:e}){var k,I,y,E;const n=D(),t=Q(e),{setSelectedBlockId:o}=ge(),[r,l]=f.useState(!1),s=f.useCallback(()=>{Me(n,e,(t==null?void 0:t.contentIds)??[],$("paragraph"))},[n,e,t]),c=f.useCallback(()=>{const R=Qe(n,e);De(n,R,e,o)},[n,e,o]),i=f.useCallback(()=>te(n,e,"up"),[n,e]),u=f.useCallback(()=>te(n,e,"down"),[n,e]),p=f.useCallback(()=>{var S;const R=(S=t==null?void 0:t.props)==null?void 0:S.href;R&&window.open(R,"_blank","noopener,noreferrer")},[(k=t==null?void 0:t.props)==null?void 0:k.href]),d=ee("be-button-block",t);if(!t)return null;const b=((I=t.props)==null?void 0:I.href)??"",h=((y=t.props)==null?void 0:y.color)??ta,m=((E=t.props)==null?void 0:E.customAttrs)??[],g=ae(n,t.contentIds),x={};for(const{key:R,value:S}of m)R.trim()&&(x[`data-${R.trim()}`]=S);return a.jsxs("div",{className:d,"data-block-id":e,children:[a.jsxs("div",{className:"be-button-block-pill",style:{backgroundColor:h},...x,children:[a.jsx("span",{className:"be-button-block-label","data-empty":g?"":void 0,"data-placeholder":"Button",children:a.jsx(xe,{blockId:e,runIds:t.contentIds,onEnter:s,onBackspaceAtStart:c,onArrowUp:i,onArrowDown:u})}),a.jsx("button",{type:"button",className:"be-button-block-open",onClick:p,disabled:!b,title:b||"No link set","aria-label":"Open link",children:"↗"}),a.jsx("button",{type:"button",className:"be-button-block-settings",onClick:()=>l(!0),"aria-label":"Edit button",title:"Edit label, link, color…",children:"⚙"})]}),a.jsx(na,{isOpen:r,onClose:()=>l(!1),store:n,blockId:e})]})}function ra({href:e="",label:n="Button",color:t="",customAttrs:o=[]}={}){return function(l,s){const c=T(),i=s!=null&&s.length?s:[{id:T(),type:"text",value:n,marks:{}}];return{block:{id:c,type:"button",parentId:l,contentIds:i.map(u=>u.id),props:{href:e,color:t,customAttrs:o}},runs:i}}}const Co="be-button-block-link";function la(e,n){var i,u,p;const t=e.contentIds.map(d=>n.store.getRun(d)),o=((i=e.props)==null?void 0:i.href)??"",r=(u=e.props)==null?void 0:u.color,l=r?` style="background-color:${ce(r)}"`:"",c=(((p=e.props)==null?void 0:p.customAttrs)??[]).filter(d=>{var b;return(b=d.key)==null?void 0:b.trim()}).map(d=>` data-${ce(d.key.trim())}="${ce(d.value??"")}"`).join("");return`<a class="${Co}" href="${ce(o)}"${l}${c}>${t.map(d=>Ie(d,n)).join("")}</a>`}function sa(e,n){return e.contentIds.map(t=>we(n.store.getRun(t),n)).join("")}function aa(e,n){var l;if(e.tagName!=="A"||!e.classList.contains(Co))return null;const t=de(e,n),o=[];for(const s of e.attributes)s.name.startsWith("data-")&&o.push({key:s.name.slice(5),value:s.value});return{block:{id:T(),type:"button",parentId:null,contentIds:t.map(s=>s.id),props:{href:e.getAttribute("href")??"",color:((l=e.style)==null?void 0:l.backgroundColor)||void 0,customAttrs:o}},runs:t}}const Bo={component:oa,isLeaf:!0,defaultProps:{href:"",color:"",customAttrs:[]},toHTML:la,toPlainText:sa,fromHTML:aa,slashCommand:{label:"Button",icon:zr,keywords:["button","link","cta","action"],run:(e,n)=>ne(e,n,ra())}};function mt(e){return new Promise((n,t)=>{const o=new FileReader;o.onload=()=>n(o.result),o.onerror=()=>t(o.error),o.readAsDataURL(e)})}const on={image:"image",video:"video",audio:"audio",file:"file"},ca={image:"image/*",video:"video/*",audio:"audio/*",file:"*/*"},Ro=20,To=100,ia=[{value:"left",Icon:Sr,label:"Align left"},{value:"center",Icon:Er,label:"Align center"},{value:"right",Icon:Or,label:"Align right"}];function ua(e){return Math.min(To,Math.max(Ro,Math.round(e)))}function da({kind:e,src:n,name:t}){return e==="image"?a.jsx("img",{className:"be-embed-image",src:n,alt:t||""}):e==="video"?a.jsx("video",{className:"be-embed-video",src:n,controls:!0}):e==="audio"?a.jsx("audio",{className:"be-embed-audio",src:n,controls:!0}):a.jsxs("a",{className:"be-embed-file-link",href:n,download:t||void 0,target:"_blank",rel:"noopener noreferrer",children:[a.jsx(jt,{size:14})," ",t||n]})}function pa({id:e}){const n=D(),t=Q(e),[o,r]=f.useState(""),[l,s]=f.useState(!1),[c,i]=f.useState(null),u=f.useRef(null),p=f.useRef(null),d=f.useCallback(B=>n.applyOperation(z(e,B)),[n,e]),b=f.useCallback(async B=>{var M;const O=(M=B.target.files)==null?void 0:M[0];if(!O)return;const N=await mt(O);d({src:N,name:O.name,mimeType:O.type})},[d]),h=f.useCallback(async B=>{var M;B.preventDefault(),s(!1);const O=(M=B.dataTransfer.files)==null?void 0:M[0];if(!O)return;const N=await mt(O);d({src:N,name:O.name,mimeType:O.type})},[d]),m=f.useCallback(B=>{B.preventDefault(),s(!0)},[]),g=f.useCallback(()=>s(!1),[]),x=f.useCallback(()=>{const B=o.trim();B&&(d({src:B,name:B}),r(""))},[o,d]),k=f.useCallback(()=>d({src:"",name:"",mimeType:""}),[d]),I=f.useCallback(B=>{B.preventDefault();const O=u.current,N=p.current;if(!O||!N)return;const M=O.getBoundingClientRect().width,q=N.getBoundingClientRect().width,V=B.clientX,H=K=>ua((q+(K.clientX-V))/M*100),P=K=>i(H(K)),W=K=>{document.removeEventListener("mousemove",P),document.removeEventListener("mouseup",W),d({width:H(K)}),i(null)};document.addEventListener("mousemove",P),document.addEventListener("mouseup",W)},[d]),y=ee("be-embed",t);if(!t)return null;const{kind:E="file",src:R,name:S,align:C="left",width:w=100}=t.props,v=E==="image"||E==="video",j=c??w;return a.jsx("div",{className:y,"data-block-id":e,"data-kind":E,contentEditable:!1,tabIndex:-1,children:R?a.jsx("div",{ref:u,className:`be-embed-preview be-embed-align-${C}`,children:a.jsxs("div",{ref:p,className:"be-embed-frame",style:v?{width:`${j}%`}:void 0,children:[a.jsxs("div",{className:"be-embed-toolbar",contentEditable:!1,children:[ia.map(({value:B,Icon:O,label:N})=>a.jsx("button",{type:"button",className:`be-embed-toolbar-btn${C===B?" be-embed-toolbar-btn-active":""}`,title:N,"aria-label":N,"aria-pressed":C===B,onClick:()=>d({align:B}),children:a.jsx(O,{size:14})},B)),a.jsx("button",{type:"button",className:"be-embed-remove",onClick:k,"aria-label":`Remove ${on[E]}`,children:"Remove"})]}),a.jsx(da,{kind:E,src:R,name:S}),v&&a.jsx("div",{className:"be-embed-resize-handle",onMouseDown:I,role:"slider","aria-label":`Resize ${on[E]}`,"aria-valuemin":Ro,"aria-valuemax":To,"aria-valuenow":j})]})}):a.jsxs("div",{className:`be-embed-dropzone${l?" be-embed-dropzone-active":""}`,onDrop:h,onDragOver:m,onDragLeave:g,children:[a.jsxs("label",{className:"be-embed-upload-btn",children:["Upload ",on[E],a.jsx("input",{type:"file",accept:ca[E],onChange:b,hidden:!0})]}),a.jsx("span",{className:"be-embed-dropzone-hint",children:"or drop a file, or paste a URL below"}),a.jsxs("div",{className:"be-embed-url-row",children:[a.jsx("input",{type:"text",className:"be-embed-url-input",placeholder:`https://... ${on[E]} URL`,value:o,onChange:B=>r(B.target.value),onKeyDown:B=>B.key==="Enter"&&x()}),a.jsx("button",{type:"button",className:"be-embed-url-commit",onClick:x,children:"Embed"})]})]})})}function fa({kind:e="file",src:n="",name:t="",mimeType:o="",align:r="left",width:l=100}={}){return function(c){return{block:{id:T(),type:"embed",parentId:c,contentIds:[],props:{kind:e,src:n,name:t,mimeType:o,align:r,width:l}},runs:[]}}}const ba={image:Yr,video:Gr,audio:Xr,file:jt},jo="be-embed-file-link";function ma(e,n,t){if(e!=="image"&&e!=="video")return"";const o=[];return t!==100&&o.push(`width:${t}%`),n==="center"?o.push("display:block","margin-left:auto","margin-right:auto"):n==="right"&&o.push("display:block","margin-left:auto"),o.length?` style="${o.join(";")}"`:""}function ht(e){var r,l,s,c;const n=(r=e.style)==null?void 0:r.width,t=n&&n.endsWith("%")?parseInt(n,10):100;let o="left";return((l=e.style)==null?void 0:l.marginLeft)==="auto"&&((s=e.style)==null?void 0:s.marginRight)==="auto"?o="center":((c=e.style)==null?void 0:c.marginLeft)==="auto"&&(o="right"),{align:o,width:Number.isFinite(t)?t:100}}function ha(e){const{kind:n,src:t,name:o,align:r="left",width:l=100}=e.props;if(!t)return"<p></p>";const s=ma(n,r,l);return n==="image"?`<img src="${ce(t)}" alt="${ce(o||"")}"${s}>`:n==="video"?`<video src="${ce(t)}" controls${s}></video>`:n==="audio"?`<audio src="${ce(t)}" controls></audio>`:`<a class="${jo}" href="${ce(t)}">${Se(o||t)}</a>`}function ga(e){const{kind:n,src:t,name:o}=e.props;return t?`[${n}: ${o||t}]`:""}function xa(e){return e.tagName==="IMG"?rn("image",e.getAttribute("src")??"",e.getAttribute("alt")??"",ht(e)):e.tagName==="VIDEO"?rn("video",e.getAttribute("src")??"","",ht(e)):e.tagName==="AUDIO"?rn("audio",e.getAttribute("src")??"",""):e.tagName==="A"&&e.classList.contains(jo)?rn("file",e.getAttribute("href")??"",e.textContent??""):null}function rn(e,n,t,{align:o="left",width:r=100}={}){return{block:{id:T(),type:"embed",parentId:null,contentIds:[],props:{kind:e,src:n,name:t,align:o,width:r}},runs:[]}}function ka(e){return(n,{blockId:t,runId:o,sliceStart:r,sliceEnd:l})=>{const s=n.getRun(o),c=(s==null?void 0:s.value)??"";n.applyOperation(J(o,{value:c.slice(0,r)+c.slice(l)}));const i=zn(n,t,fa({kind:e}));return ve(n,i,$("paragraph")),i}}const So={component:pa,isLeaf:!0,defaultProps:{kind:"file",src:"",name:"",mimeType:"",align:"left",width:100},toHTML:ha,toPlainText:ga,fromHTML:xa,slashCommands:["image","video","audio","file"].map(e=>({label:e.charAt(0).toUpperCase()+e.slice(1),icon:ba[e],keywords:["embed","upload","insert",e],run:ka(e)}))};function ya(e){Eo(e,{paragraph:Ft,heading:Ut,listItem:Jt,...Oo,...Lo,divider:xo,callout:yo,blockquote:vo,code:Io,toggleHeading:wo,button:Bo,embed:So})}function Eo(e,n){for(const[t,o]of Object.entries(n))e.register(t,o)}const Oo={table:fo,tableRow:po,tableCell:uo},Lo={layout:go,layoutColumn:ho};function va({id:e}){const n=D(),t=ye(e),o=f.useCallback(c=>{n.applyOperation(J(e,{data:{...t==null?void 0:t.data,selectedValue:c}}))},[n,e,t==null?void 0:t.data]);if(!t)return null;const{options:r=[],selectedValue:l="",placeholder:s="Select…"}=t.data??{};return a.jsx("span",{className:"be-inline-select",onMouseDown:c=>{c.preventDefault(),c.stopPropagation()},onKeyDown:c=>c.stopPropagation(),children:a.jsx(_e,{value:l,options:r,onChange:o,placeholder:s,ariaLabel:"Select an option"})})}function xn(e,{blockId:n,runId:t,sliceStart:o,sliceEnd:r},l){const s=e.getRun(t),c=(s==null?void 0:s.value)??"",i=c.slice(0,o),u=c.slice(r),p=l(),d={...s,value:i},b={id:T(),type:"text",value:u,marks:{...s==null?void 0:s.marks}};e.applyOperation(qe(n,[t],[d,p,b])),X(b.id)}function Ia(e){return String(e).replace(/&/g,"&amp;").replace(/"/g,"&quot;")}function No(e){var o;const{options:n=[],selectedValue:t=""}=e.data??{};return((o=n.find(r=>r.value===t))==null?void 0:o.label)??""}function wa(e){var t,o;const n=No(e)||((t=e.data)==null?void 0:t.placeholder)||"";return`<span data-inline-type="select" data-selected-value="${Ia(((o=e.data)==null?void 0:o.selectedValue)??"")}">${n}</span>`}function Ca(e){return No(e)}function Ba(e){var n;return((n=e.getAttribute)==null?void 0:n.call(e,"data-inline-type"))!=="select"?null:{id:T(),type:"select",value:"",marks:{},data:{options:[],selectedValue:e.getAttribute("data-selected-value")??""}}}const Mo={component:va,isAtomic:!0,toHTML:wa,toPlainText:Ca,fromHTML:Ba,slashCommand:{label:"Select",icon:Vr,keywords:["select","dropdown","choice","picker"],run:(e,{blockId:n,runId:t,sliceStart:o,sliceEnd:r})=>xn(e,{blockId:n,runId:t,sliceStart:o,sliceEnd:r},()=>({id:T(),type:"select",value:"",marks:{},data:{options:[],selectedValue:"",placeholder:"Select…"}}))}};function Ra({id:e}){const n=D(),t=ye(e),o=f.useCallback(l=>{n.applyOperation(J(e,{data:{...t==null?void 0:t.data,isoDate:l.target.value}}))},[n,e,t==null?void 0:t.data]);if(!t)return null;const{isoDate:r=""}=t.data??{};return a.jsx("span",{className:"be-inline-date",onMouseDown:l=>l.stopPropagation(),onKeyDown:l=>l.stopPropagation(),children:a.jsx("input",{type:"date",value:r,onChange:o})})}function Ta(e){return String(e).replace(/&/g,"&amp;").replace(/"/g,"&quot;")}function Ao(e){if(!e)return"";const n=new Date(`${e}T00:00:00`);return Number.isNaN(n.getTime())?e:n.toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}function ja(e){var t;const n=((t=e.data)==null?void 0:t.isoDate)??"";return`<span data-inline-type="date" data-iso-date="${Ta(n)}">${Ao(n)}</span>`}function Sa(e){var n;return Ao(((n=e.data)==null?void 0:n.isoDate)??"")}function Ea(e){var n;return((n=e.getAttribute)==null?void 0:n.call(e,"data-inline-type"))!=="date"?null:{id:T(),type:"date",value:"",marks:{},data:{isoDate:e.getAttribute("data-iso-date")??""}}}function Oa(){return new Date().toISOString().slice(0,10)}const Do={component:Ra,isAtomic:!0,toHTML:ja,toPlainText:Sa,fromHTML:Ea,slashCommand:{label:"Date",icon:Wr,keywords:["date","when","schedule","calendar"],run:(e,{blockId:n,runId:t,sliceStart:o,sliceEnd:r})=>xn(e,{blockId:n,runId:t,sliceStart:o,sliceEnd:r},()=>({id:T(),type:"date",value:"",marks:{},data:{isoDate:Oa()}}))}};function La({id:e}){const n=D(),t=ye(e),o=f.useCallback(c=>{n.applyOperation(J(e,{data:{...t==null?void 0:t.data,checked:c.target.checked}}))},[n,e,t==null?void 0:t.data]),r=f.useCallback(c=>{n.applyOperation(J(e,{data:{...t==null?void 0:t.data,label:c.target.value}}))},[n,e,t==null?void 0:t.data]);if(!t)return null;const{checked:l=!1,label:s=""}=t.data??{};return a.jsxs("span",{className:"be-inline-checkbox",onMouseDown:c=>c.stopPropagation(),onKeyDown:c=>c.stopPropagation(),children:[a.jsx("input",{type:"checkbox",className:"be-inline-checkbox-input",checked:l,onChange:o}),a.jsx("input",{type:"text",className:"be-inline-checkbox-label",value:s,onChange:r,placeholder:"Label…"})]})}function Na(e){return String(e).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Ma(e){const{checked:n=!1,label:t=""}=e.data??{};return`<span data-inline-type="checkbox" data-checked="${n}">${n?"☑":"☐"} ${Na(t)}</span>`}function Aa(e){const{checked:n=!1,label:t=""}=e.data??{};return`${n?"[x]":"[ ]"} ${t}`.trim()}function Da(e){var n;return((n=e.getAttribute)==null?void 0:n.call(e,"data-inline-type"))!=="checkbox"?null:{id:T(),type:"checkbox",value:"",marks:{},data:{checked:e.getAttribute("data-checked")==="true",label:(e.textContent??"").replace(/^[☑☐]\s*/,"")}}}const _o={component:La,isAtomic:!0,toHTML:Ma,toPlainText:Aa,fromHTML:Da,slashCommand:{label:"Checkbox",icon:Mt,keywords:["checkbox","todo","check","toggle"],run:(e,{blockId:n,runId:t,sliceStart:o,sliceEnd:r})=>xn(e,{blockId:n,runId:t,sliceStart:o,sliceEnd:r},()=>({id:T(),type:"checkbox",value:"",marks:{},data:{checked:!1,label:""}}))}};function _a({id:e,blockId:n}){var h;const t=D(),o=ye(e),r=n?t.getBlock(n):null,l=r?t.getBlock(r.parentId):null,s=(l==null?void 0:l.parentId)??null,c=Q(s),i=l?l.contentIds.indexOf(n):-1,p=(((h=(c&&l?ie(c,l.contentIds.length):[])[i])==null?void 0:h.options)??[]).map((m,g)=>({...m,color:m.color??Ke(g)})),d=f.useCallback((m,g)=>{t.applyOperation(J(e,{data:{selectedValue:m,selectedLabel:(g==null?void 0:g.label)??""}}))},[t,e]);if(!o)return null;const{selectedValue:b=""}=o.data??{};return a.jsx("span",{className:"be-inline-table-select",onMouseDown:m=>{m.preventDefault(),m.stopPropagation()},onKeyDown:m=>m.stopPropagation(),children:a.jsx(_e,{value:b,options:p,onChange:d,placeholder:"Select…",ariaLabel:"Select an option",variant:"tag"})})}function $o(e){return String(e).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function $a(e){return $o(e).replace(/"/g,"&quot;")}function Pa(e){const{selectedValue:n="",selectedLabel:t=""}=e.data??{};return`<span data-inline-type="tableSelect" data-selected-value="${$a(n)}">${$o(t)}</span>`}function Ha(e){var n;return((n=e.data)==null?void 0:n.selectedLabel)??""}function za(e){var n;return((n=e.getAttribute)==null?void 0:n.call(e,"data-inline-type"))!=="tableSelect"?null:{id:T(),type:"tableSelect",value:"",marks:{},data:{selectedValue:e.getAttribute("data-selected-value")??"",selectedLabel:e.textContent??""}}}const Po={component:_a,isAtomic:!0,toHTML:Pa,toPlainText:Ha,fromHTML:za},Ho={};function Fa(e){zo(e,{select:Mo,date:Do,checkbox:_o,...Fo,emoji:Ho})}function zo(e,n){for(const[t,o]of Object.entries(n))e.register(t,o)}const Fo={tableSelect:Po},Ua="$fieldTypes";function Uo(){const e=D(),n=f.useCallback(o=>e.subscribe(Ua,o),[e]),t=f.useCallback(()=>e.getFieldTypes(),[e]);return f.useSyncExternalStore(n,t)}const Ka={canUndo:!1,canRedo:!1};function qa(){const{history:e}=pe(),n=f.useCallback(r=>e?e.subscribeToHistory(r):()=>{},[e]),t=f.useCallback(()=>e?e.getUndoRedoSnapshot():Ka,[e]),o=f.useSyncExternalStore(n,t);return e?{...o,undo:()=>e.undo(),redo:()=>e.redo(),getHistoryLog:()=>e.getHistoryLog()}:null}const cn="application/x-block-editor-blocks+json";function Gn(e){return e.split(/\r\n|\r|\n/).filter(n=>n.length>0).map(n=>{const t=T();return{block:{id:T(),type:"paragraph",parentId:null,contentIds:[t],props:{}},runs:[{id:t,type:"text",value:n,marks:{}}]}})}function Ko(e,n,t){const o=new DOMParser().parseFromString(e,"text/html"),r={registry:n,inlineRegistry:t},l=n.listHtmlMatchers(),s=[],c=u=>{var b;const p=u.tagName==="OL",d=[];for(const h of u.children){if(h.tagName!=="LI")continue;const m=(b=n.get("listItem"))==null?void 0:b.fromHTML(h,r);m&&(m.block.props.ordered=p,d.push(m))}return d},i=u=>{var d;const p=Array.from(u.children).filter(b=>b.tagName==="P");if(p.length===0){const b=(d=n.get("blockquote"))==null?void 0:d.fromHTML(u,r);return b?[b]:[]}return p.map(b=>{const h=de(b,r);return{block:{id:T(),type:"blockquote",parentId:null,contentIds:h.map(m=>m.id),props:{}},runs:h}})};for(const u of o.body.childNodes){if(u.nodeType===3){const d=u.textContent.trim();d&&s.push(...Gn(d));continue}if(u.nodeType!==1)continue;if(u.tagName==="UL"||u.tagName==="OL"){s.push(...c(u));continue}if(u.tagName==="BLOCKQUOTE"){s.push(...i(u));continue}let p=null;for(const d of l){const b=d.fromHTML(u,r);if(b){p=b;break}}if(p)s.push(p);else if(u.textContent.trim()){const d=de(u,r);s.push({block:{id:T(),type:"paragraph",parentId:null,contentIds:d.map(b=>b.id),props:{}},runs:d})}}return s}function qo(e,n,t){const o=e.types??[];if(o.includes(cn)){const l=e.getData(cn);if(l)return Wa(l)}if(o.includes("text/html")){const l=e.getData("text/html");if(l)return Ko(l,n,t)}const r=e.getData("text/plain")??"";return Gn(r)}function Wa(e){return JSON.parse(e).blocks.map(t=>qn(t))}function Bn(e,n){var o;const t=e.getBlock(n);return((o=t.props)==null?void 0:o.titleRunIds)??t.contentIds}function sn(){return{id:T(),type:"text",value:"",marks:{}}}function Rn(e,n){if(typeof e.performBatch=="function")e.performBatch(n);else for(const t of n)e.applyOperation(t)}function Xn(e,n,t){const{startRunId:o,startOffset:r,endRunId:l,endOffset:s}=t,c=Bn(e,n),i=c.indexOf(o),u=c.indexOf(l);if(i===-1||u===-1)return null;const[p,d]=i<=u?[i,u]:[u,i],b=i<=u?r:s,h=i<=u?s:r,m=c.slice(0,p).map(R=>e.getRun(R)),g=c.slice(d+1).map(R=>e.getRun(R)),x=c.slice(p,d+1).map(R=>e.getRun(R)),k=[];let I=null,y=0;if(p===d){const R=x[0];if(R.type==="text"){const S=Math.max(0,Math.min(b,h)),C=Math.min(R.value.length,Math.max(b,h)),w={...R,value:R.value.slice(0,S)+R.value.slice(C)};k.push(w),I=w.id,y=S}}else x.forEach((R,S)=>{if(R.type!=="text")return;const C=S===0,w=S===x.length-1,v=C?R.value.slice(0,b):"";if(C&&v){const j={...R,value:v};k.push(j),I=j.id,y=v.length}if(w&&!C){const j=R.value.slice(h);if(j){const B={id:T(),type:"text",value:j,marks:R.marks};k.push(B),I===null&&(I=B.id,y=0)}}});let E=[...m,...k,...g];if(E.length===0){const R=sn();E=[R],I=R.id,y=0}else if(I===null){const R=m[m.length-1];R?(I=R.id,y=R.type==="text"?R.value.length:0):g[0]&&(I=g[0].id,y=0)}return e.applyOperation(se(n,E)),{blockId:n,runId:I,offset:y}}function Jn(e,n){const{blockIds:t,startBlockId:o,startRunId:r,startOffset:l,endBlockId:s,endRunId:c,endOffset:i}=n;if(!t||t.length===0)return null;const u=t.indexOf(o),p=t.indexOf(s);if(u===-1||p===-1)return null;const[d,b]=u<=p?[u,p]:[p,u],h=u<=p,m=h?r:c,g=h?l:i,x=h?c:r,k=h?i:l;if(d===b)return Xn(e,t[d],{startRunId:m,startOffset:g,endRunId:x,endOffset:k});const I=t[d],y=t[b],E=e.getBlock(I),R=e.getBlock(y),S=Bn(e,I),C=S.indexOf(m),w=S.slice(0,C).map(Y=>e.getRun(Y)),v=e.getRun(m),j=v.type==="text"&&g>0?{...v,value:v.value.slice(0,g)}:null,B=Bn(e,y),O=B.indexOf(x),N=B.slice(O+1).map(Y=>e.getRun(Y)),M=e.getRun(x),q=M.type==="text"&&k<M.value.length?{id:T(),type:"text",value:M.value.slice(k),marks:M.marks}:null,V=[...w,...j?[j]:[]],H=[...q?[q]:[],...N],P=[];for(let Y=d+1;Y<b;Y+=1)P.push(_(t[Y]));const W=zt(E.type,R.type),K=e.getBlock(E.parentId),re=b-d-1+(W?1:0),Re=K&&K.contentIds.length-re===1;let Z,le,fe;if(W){const Y=[...V,...H];if(Y.length===0&&Re&&E.type!=="paragraph"){const{block:U,runs:ue}=$("paragraph")(K.id);return P.push({type:"insertBlock",block:U,parentId:K.id,index:0,subtree:{blocks:[U],runs:ue}}),P.push(_(I)),P.push(_(y)),Rn(e,P),{blockId:U.id,runId:U.contentIds[0],offset:0}}const L=Y.length?Y:[sn()];if(P.push(se(I,L)),P.push(_(y)),fe=I,j)Z=j.id,le=j.value.length;else if(w.length){const U=w[w.length-1];Z=U.id,le=U.type==="text"?U.value.length:0}else q?(Z=q.id,le=0):N.length?(Z=N[0].id,le=0):(Z=L[0].id,le=0)}else{const Y=V.length?V:[sn()];if(P.push(se(I,Y)),P.push(se(y,H.length?H:[sn()])),fe=I,j)Z=j.id,le=j.value.length;else if(w.length){const L=w[w.length-1];Z=L.id,le=L.type==="text"?L.value.length:0}else Z=Y[0].id,le=0}return Rn(e,P),{blockId:fe,runId:Z,offset:le}}function un(e,n=""){var c;const t=e.getRootId(),o=((c=e.getBlock(t))==null?void 0:c.contentIds)??[];if(o.length===0)return null;const r=o.map(i=>_(i)),{block:l,runs:s}=$("paragraph")(t);return n&&(s[0].value=n),r.push(G(l,t,0,{blocks:[l],runs:s})),Rn(e,r),{blockId:l.id,runId:l.contentIds[0],offset:n.length}}function Wo(e,n){if(typeof e.performBatch=="function")e.performBatch(n);else for(const t of n)e.applyOperation(t)}function ze(e,n){n.length!==0&&Wo(e,n.map(t=>_(t)))}function Vo(e,n){if(n.length===0)return!1;const t=e.getBlock(n[0]);if(!t)return!1;const o=e.getBlock(t.parentId);if(!o)return!1;const r=o.contentIds.indexOf(n[0]),l=o.contentIds.indexOf(n[n.length-1]);if(r<=0)return!1;const s=o.contentIds[r-1];return e.applyOperation(ke(s,t.parentId,l)),!0}function Yo(e,n){if(n.length===0)return!1;const t=e.getBlock(n[0]);if(!t)return!1;const o=e.getBlock(t.parentId);if(!o)return!1;const r=o.contentIds.indexOf(n[0]),l=o.contentIds.indexOf(n[n.length-1]);if(l===-1||l>=o.contentIds.length-1)return!1;const s=o.contentIds[l+1];return e.applyOperation(ke(s,t.parentId,r)),!0}function Go(e,n){return n.length>0&&n.every(t=>{var o,r;return!!((r=(o=e.getBlock(t))==null?void 0:o.props)!=null&&r.hidden)})}function Xo(e,n,t){n.length!==0&&Wo(e,n.map(o=>z(o,{hidden:t})))}function Va(e,n){if(n.length===0)return[];const t=e.getBlock(n[0]),o=t&&e.getBlock(t.parentId);if(!o)return n;const r=new Set(n);return o.contentIds.filter(l=>r.has(l))}function Tn(e){var t;let n=(e==null?void 0:e.nodeType)===1?e:e==null?void 0:e.parentElement;for(;n&&typeof n.hasAttribute=="function"&&!n.hasAttribute("data-block-id");)n=n.parentElement;return((t=n==null?void 0:n.getAttribute)==null?void 0:t.call(n,"data-block-id"))??null}function Ya(e){var d;const n=(d=window.getSelection)==null?void 0:d.call(window);if(!n||n.rangeCount===0)return[];const t=Tn(n.anchorNode),o=Tn(n.focusNode);if(!t)return[];if(!o||t===o)return[t];const r=e.getBlock(t),l=r&&e.getBlock(r.parentId);if(!l)return[t];const s=l.contentIds,c=s.indexOf(t),i=s.indexOf(o);if(c===-1||i===-1)return[t];const[u,p]=c<=i?[c,i]:[i,c];return s.slice(u,p+1)}function gt(e){const n=Je();if(n)return Xn(e,n.blockId,n);const t=Ue(e);return t?Jn(e,t):null}function Ga(e,n,t){const o=e.getRun(n.runId);if(!o||o.type!=="text")return null;const r=o.value??"",l=r.slice(0,n.offset)+t+r.slice(n.offset);return e.applyOperation(J(o.id,{value:l})),{blockId:n.blockId,runId:o.id,offset:n.offset+t.length}}function In(e,n){if(typeof e.performBatch=="function")e.performBatch(n);else for(const t of n)e.applyOperation(t)}function Xa(){const e=D(),n=Ne(),t=he(),[o,r]=Nn(),[l,s]=We(),c=f.useCallback(p=>{var g;const d=o?((g=e.getBlock(e.getRootId()))==null?void 0:g.contentIds)??[]:l.length>0?l:Ya(e);if(d.length===0)return;const{html:b,text:h,json:m}=Ze(e,n,d,t);p.clipboardData.setData("text/plain",h),p.clipboardData.setData("text/html",b),p.clipboardData.setData(cn,m),p.preventDefault()},[e,n,t,o,l]),i=f.useCallback(p=>{if(c(p),o){const b=un(e);r(!1),b!=null&&b.runId&&be(b.runId,b.offset);return}if(l.length>0){ze(e,l),s([]);return}const d=gt(e);d!=null&&d.runId&&be(d.runId,d.offset)},[c,e,o,r,l,s]),u=f.useCallback(p=>{var y,E,R;const d=qo(p.clipboardData,n,t);if(d.length===0)return;if(o){const S=e.getRootId(),w=(((y=e.getBlock(S))==null?void 0:y.contentIds)??[]).map(j=>_(j));let v=0;for(const{block:j,runs:B,subtreeBlocks:O=[]}of d)j.parentId=S,w.push(G(j,S,v,{blocks:[j,...O],runs:B})),v+=1;In(e,w),r(!1),p.preventDefault();return}if(l.length>0){const S=e.getBlock(l[0]),C=(S==null?void 0:S.parentId)??null,w=C&&e.getBlock(C);let v=w?w.contentIds.indexOf(l[0]):0;const j=l.map(B=>_(B));for(const{block:B,runs:O,subtreeBlocks:N=[]}of d)B.parentId=C,j.push(G(B,C,v,{blocks:[B,...N],runs:O})),v+=1;In(e,j),s([]),p.preventDefault();return}const b=gt(e);if(d.length===1&&d[0].runs.every(S=>S.type==="text")&&(d[0].subtreeBlocks??[]).length===0){const S=b?{blockId:b.blockId,runId:b.runId,offset:b.offset}:Xe();if(S){const C=d[0].runs.map(v=>v.value).join(""),w=Ga(e,S,C);if(w){be(w.runId,w.offset),p.preventDefault();return}}}const m=(b==null?void 0:b.blockId)??Tn((R=(E=window.getSelection)==null?void 0:E.call(window))==null?void 0:R.anchorNode);if(!m)return;const g=e.getBlock(m);if(!g)return;let k=e.getBlock(g.parentId).contentIds.indexOf(m)+1;const I=[];for(const{block:S,runs:C,subtreeBlocks:w=[]}of d)S.parentId=g.parentId,I.push(G(S,g.parentId,k,{blocks:[S,...w],runs:C})),k+=1;In(e,I),p.preventDefault()},[e,n,t,o,r,l,s]);return{onCopy:c,onCut:i,onPaste:u}}const Ja=["bold","italic","underline","strike","subscript","superscript","code"],Qa=["color","highlight","link"];function Ee(e,n){var o;const t=e.getBlock(n);return((o=t.props)==null?void 0:o.titleRunIds)??t.contentIds}function Za(e,n){return e===n?!0:e&&n&&typeof e=="object"?JSON.stringify(e)===JSON.stringify(n):!1}function Jo(e){var t;const n={};if(e.length===0)return n;for(const o of Ja)n[o]=e.every(r=>{var l;return(l=r.marks)==null?void 0:l[o]});for(const o of Qa){const r=((t=e[0].marks)==null?void 0:t[o])??null;n[o]=e.every(l=>{var s;return Za(((s=l.marks)==null?void 0:s[o])??null,r)})?r:null}return n}function Qo(e,n,t){const{startRunId:o,startOffset:r,endRunId:l,endOffset:s}=t,c=Ee(e,n),i=c.indexOf(o),u=c.indexOf(l);if(i===-1||u===-1)return{};const[p,d]=i<=u?[i,u]:[u,i],b=c.slice(p,d+1).map(h=>e.getRun(h)).filter(h=>h&&h.type==="text");return Jo(b)}function Zo(e,n){const{blockIds:t,startBlockId:o,endBlockId:r}=n,l=t.indexOf(o),s=t.indexOf(r);if(l===-1||s===-1)return{};const[c,i]=l<=s?[l,s]:[s,l],u=[];for(let p=c;p<=i;p+=1)for(const d of Ee(e,t[p])){const b=e.getRun(d);b&&b.type==="text"&&u.push(b)}return Jo(u)}function er(e,n){const t={...e};for(const[o,r]of Object.entries(n))r!=null?t[o]=r:delete t[o];return t}function nr(e,n,t,o,r,l){const s=er(t.marks,l);if(o===0&&r===t.value.length)return e.applyOperation({type:"updateRun",id:t.id,patch:{marks:s}}),t.id;const c=t.value.slice(0,o),i=t.value.slice(o,r),u=t.value.slice(r),p=[];c&&p.push({id:T(),type:"text",value:c,marks:{...t.marks}});const d={id:T(),type:"text",value:i,marks:s};return p.push(d),u&&p.push({id:T(),type:"text",value:u,marks:{...t.marks}}),e.applyOperation(qe(n,[t.id],p)),d.id}function ec(e,n,t,o){const{startRunId:r,startOffset:l,endRunId:s,endOffset:c}=t,i=Ee(e,n),u=i.indexOf(r),p=i.indexOf(s);if(u===-1||p===-1)return null;const[d,b]=u<=p?[u,p]:[p,u],h=u<=p?l:c,m=u<=p?c:l,g=i.slice(d,b+1),x=g.map(y=>e.getRun(y));if(d===b){const y=x[0];if(y.type!=="text")return y.id;const E=Math.max(0,Math.min(h,m)),R=Math.min(y.value.length,Math.max(h,m));return E===R?y.id:nr(e,n,y,E,R,o)}const k=[];let I=null;return x.forEach((y,E)=>{if(y.type!=="text"){k.push(y),I=y.id;return}const R=E===0,S=E===x.length-1,C=R?h:0,w=S?m:y.value.length,v=y.value.slice(0,C),j=y.value.slice(C,w),B=y.value.slice(w);v&&k.push({id:T(),type:"text",value:v,marks:{...y.marks}});const O={id:T(),type:"text",value:j,marks:er(y.marks,o)};k.push(O),I=O.id,B&&k.push({id:T(),type:"text",value:B,marks:{...y.marks}})}),e.applyOperation(qe(n,g,k)),I}function nc(e,n,t,o){var m;const{startRunId:r,startOffset:l,endRunId:s,endOffset:c}=t,i=Ee(e,n),u=i.indexOf(r),p=i.indexOf(s);if(u===-1||p===-1)return!0;const[d,b]=u<=p?[u,p]:[p,u],h=i.slice(d,b+1).map(g=>e.getRun(g)).filter(g=>g.type==="text");if(h.length===0)return!0;if(d===b){const g=Math.max(0,Math.min(l,c)),x=Math.min(h[0].value.length,Math.max(l,c));if(g===x)return!((m=h[0].marks)!=null&&m[o])}return!h.every(g=>{var x;return(x=g.marks)==null?void 0:x[o]})}function tc(e,n,t,o,r,l){var d;const s=e.getRun(t),c=s.value??"",i=Math.max(0,Math.min(o,r)),u=Math.min(c.length,Math.max(o,r));if(i===u)return t;const p=!((d=s.marks)!=null&&d[l]);return nr(e,n,s,i,u,{[l]:p?!0:null})}function Oe(e,n,t,o){return ec(e,n,t,o)}function Qn(e,n,t,o){const r=nc(e,n,t,o);return Oe(e,n,t,{[o]:r?!0:null})}function Zn(e,n,t){return dn(e,n,o=>({[t]:o?null:!0}),t)}function dn(e,n,t,o){var S;const{blockIds:r,startBlockId:l,startRunId:s,startOffset:c,endBlockId:i,endRunId:u,endOffset:p}=n;if(!r||r.length===0)return null;const d=r.indexOf(l),b=r.indexOf(i);if(d===-1||b===-1)return null;const[h,m]=d<=b?[d,b]:[b,d],g=d<=b,x=g?s:u,k=g?c:p,I=g?u:s,y=g?p:c;let E=t;if(typeof t=="function"){let C=!1,w=!0;for(let v=h;v<=m;v+=1){const j=Ee(e,r[v]).map(B=>e.getRun(B)).filter(B=>B.type==="text");j.length!==0&&(C=!0,j.every(B=>{var O;return(O=B.marks)==null?void 0:O[o]})||(w=!1))}E=t(C&&w)}if(h===m)return Oe(e,r[h],{startRunId:x,startOffset:k,endRunId:I,endOffset:y},E);let R=null;for(let C=h;C<=m;C+=1){const w=r[C],v=Ee(e,w),j=v[0],B=v[v.length-1],O=e.getRun(B),N=((S=O==null?void 0:O.value)==null?void 0:S.length)??0;let M;C===h&&C===m?M={startRunId:x,startOffset:k,endRunId:I,endOffset:y}:C===h?M={startRunId:x,startOffset:k,endRunId:B,endOffset:N}:C===m?M={startRunId:j,startOffset:0,endRunId:I,endOffset:y}:M={startRunId:j,startOffset:0,endRunId:B,endOffset:N},R=Oe(e,w,M,E)}return R}function tr(e,n){var o;const t=e.getBlock(n);return((o=t==null?void 0:t.props)==null?void 0:o.titleRunIds)??(t==null?void 0:t.contentIds)??[]}function or(e){const n=Je();if(!n)return!1;const{blockId:t,startRunId:o,startOffset:r,endRunId:l,endOffset:s}=n,c=tr(e,t);if(c.length===0)return!1;const i=c.indexOf(o),u=c.indexOf(l);if(i===-1||u===-1)return!1;const[p,d]=i<=u?[i,u]:[u,i],b=i<=u?r:s,h=i<=u?s:r;if(p!==0||d!==c.length-1||b!==0)return!1;const m=e.getRun(c[c.length-1]),g=(m==null?void 0:m.type)==="text"?(m.value??"").length:1;return h===g}function oc(e){const n=Xe();return n?ae(e,tr(e,n.blockId)):!1}function rc(e,n,t){var h,m;const o=e.getBlock(n);if(!o){t(null);return}const r=e.getBlock(o.parentId),l=r?r.contentIds.indexOf(n):-1,s=l>0?r.contentIds[l-1]:null,c=l!==-1&&l<r.contentIds.length-1?r.contentIds[l+1]:null;e.applyOperation(_(n)),t(null);const i=Ae(e),u=s??c??i;if(!u)return;const p=e.getBlock(u);if(Ve(e,p)){t(u),requestAnimationFrame(()=>{var g;return(g=document.querySelector(`[data-block-id="${u}"]`))==null?void 0:g.focus()});return}const d=(h=p==null?void 0:p.props)==null?void 0:h.titleRunIds,b=((m=p==null?void 0:p.contentIds)==null?void 0:m[p.contentIds.length-1])??(d==null?void 0:d[d.length-1]);b&&X(b)}const xt={b:"bold",i:"italic",u:"underline"};function lc(e){const n=D(),[t,o]=Nn(),{getSelectedBlockId:r,setSelectedBlockId:l}=ge();f.useEffect(()=>{const s=e.current;if(!s)return;const c=u=>{var d,b;if(r()&&(u.key==="Backspace"||u.key==="Delete")&&!u.defaultPrevented){u.preventDefault(),u.stopPropagation(),rc(n,r(),l);return}if(r()&&u.key!=="Backspace"&&u.key!=="Delete"&&l(null),u.metaKey||u.ctrlKey){const h=u.key.toLowerCase();if(h==="z"&&!u.shiftKey){u.preventDefault(),(d=n.undo)==null||d.call(n);return}if(h==="z"&&u.shiftKey||h==="y"){u.preventDefault(),(b=n.redo)==null||b.call(n);return}if(h==="a"){if(t)return;(or(n)||oc(n))&&(u.preventDefault(),o(!0));return}if(xt[h]){if(t)return;u.preventDefault();const m=xt[h],g=Je();if(g){const k=Qn(n,g.blockId,g,m);k&&X(k);return}const x=Ue(n);if(x){const k=Zn(n,x,m);k&&X(k)}}return}if(t){if(u.key==="Backspace"||u.key==="Delete"){u.preventDefault(),u.stopPropagation();const h=un(n);o(!1),h!=null&&h.runId&&be(h.runId,h.offset);return}if(u.key.length===1){u.preventDefault(),u.stopPropagation();const h=un(n,u.key);o(!1),h!=null&&h.runId&&be(h.runId,h.offset);return}if(o(!1),u.key==="Escape")return}if(u.key==="Backspace"||u.key==="Delete"){const h=Ue(n);if(!h)return;u.preventDefault(),u.stopPropagation();const m=Jn(n,h);m!=null&&m.runId&&be(m.runId,m.offset)}},i=()=>{t&&o(!1),r()&&l(null)};return s.addEventListener("keydown",c),s.addEventListener("mousedown",i),()=>{s.removeEventListener("keydown",c),s.removeEventListener("mousedown",i)}},[e,n,t,o,r,l])}async function jn(e,n,t,o){var s,c,i;const{html:r,text:l}=Ze(e,n,o,t);if(typeof ClipboardItem<"u"&&((s=navigator.clipboard)!=null&&s.write)){await navigator.clipboard.write([new ClipboardItem({"text/plain":new Blob([l],{type:"text/plain"}),"text/html":new Blob([r],{type:"text/html"})})]);return}await((i=(c=navigator.clipboard)==null?void 0:c.writeText)==null?void 0:i.call(c,l))}function sc(){const e=D(),n=Ne(),t=he(),[o,r]=We(),[l,s]=f.useState(null),c=f.useRef(null),i=o.length>0,u=f.useCallback(()=>r([]),[r]);f.useEffect(()=>{if(!i){s(null);return}const k=()=>{const I=o[o.length-1],y=document.querySelector(`[data-block-row-id="${I}"]`);s((y==null?void 0:y.getBoundingClientRect())??null)};return k(),window.addEventListener("scroll",k,!0),window.addEventListener("resize",k),()=>{window.removeEventListener("scroll",k,!0),window.removeEventListener("resize",k)}},[i,o]),f.useEffect(()=>{if(!i)return;const k=y=>{var E,R,S;(E=c.current)!=null&&E.contains(y.target)||(S=(R=y.target).closest)!=null&&S.call(R,".be-block-gutter")||u()},I=y=>{y.key==="Escape"?u():(y.key==="Delete"||y.key==="Backspace")&&(y.preventDefault(),ze(e,o),u())};return document.addEventListener("mousedown",k),document.addEventListener("keydown",I),()=>{document.removeEventListener("mousedown",k),document.removeEventListener("keydown",I)}},[i,e,o,u]);const p=f.useCallback(()=>{jn(e,n,t,o),u()},[e,n,t,o,u]),d=f.useCallback(async()=>{await jn(e,n,t,o),ze(e,o),u()},[e,n,t,o,u]),b=f.useCallback(()=>{ze(e,o),u()},[e,o,u]),h=f.useCallback(()=>{Vo(e,o),u()},[e,o,u]),m=f.useCallback(()=>{Yo(e,o),u()},[e,o,u]),g=Go(e,o),x=f.useCallback(()=>{Xo(e,o,!g),u()},[e,o,g,u]);return!i||!l?null:Le.createPortal(a.jsxs("div",{ref:c,role:"menu","aria-label":"Selected blocks options",className:"be-block-range-menu",style:{position:"fixed",top:l.bottom+4,left:l.left},children:[a.jsxs("button",{type:"button",role:"menuitem",className:"be-block-range-menu-item",onClick:p,children:[a.jsx(Et,{size:15})," Copy"]}),a.jsxs("button",{type:"button",role:"menuitem",className:"be-block-range-menu-item",onClick:d,children:[a.jsx(Nr,{size:15})," Cut"]}),a.jsxs("button",{type:"button",role:"menuitem",className:"be-block-range-menu-item",onClick:h,children:[a.jsx(Ot,{size:15})," Move up"]}),a.jsxs("button",{type:"button",role:"menuitem",className:"be-block-range-menu-item",onClick:m,children:[a.jsx(Lt,{size:15})," Move down"]}),a.jsxs("button",{type:"button",role:"menuitem",className:"be-block-range-menu-item",onClick:x,children:[g?a.jsx(At,{size:15}):a.jsx(Dt,{size:15}),g?"Show in preview":"Hide in preview"]}),a.jsxs("button",{type:"button",role:"menuitem",className:"be-block-range-menu-item be-block-range-menu-item-danger",onClick:b,children:[a.jsx($n,{size:15})," Delete"]})]}),document.body)}const ac=4;function cc(e,n,t){const o=e.getBlock(n);if(!o)return[];const r=e.getBlock(o.parentId);if(!r)return[n];const l=r.contentIds,s=l.indexOf(n),c=t?l.indexOf(t):s;if(s===-1)return[n];const[i,u]=c===-1?[s,s]:[Math.min(s,c),Math.max(s,c)];return l.slice(i,u+1)}function ic(){var e,n;return typeof window<"u"&&((n=(e=window.matchMedia)==null?void 0:e.call(window,"(pointer: coarse)"))==null?void 0:n.matches)===!0}function uc(e){const n=D(),[,t]=We(),o=f.useRef(null),r=f.useRef(!1),l=f.useRef(null),s=f.useCallback(p=>{var h,m,g,x,k;if(!o.current)return;if(!r.current){const{x:I,y}=l.current??{x:p.clientX,y:p.clientY};if(Math.hypot(p.clientX-I,p.clientY-y)<ac)return;r.current=!0,document.documentElement.classList.add("be-block-range-dragging"),(m=(h=window.getSelection)==null?void 0:h.call(window))==null||m.removeAllRanges()}(x=(g=window.getSelection)==null?void 0:g.call(window))==null||x.removeAllRanges(),p.preventDefault();const d=(k=document.elementFromPoint(p.clientX,p.clientY))==null?void 0:k.closest("[data-block-row-id]"),b=(d==null?void 0:d.getAttribute("data-block-row-id"))??null;t(cc(n,o.current,b))},[n,t]),c=f.useCallback(()=>{o.current=null,r.current=!1,l.current=null,document.documentElement.classList.remove("be-block-range-dragging")},[]),i=f.useCallback((p,d)=>{o.current=p,r.current=!1,l.current={x:d.clientX,y:d.clientY}},[]),u=f.useCallback(p=>{var g,x;if(p.button!==0||ic()||(x=(g=p.target).closest)!=null&&x.call(g,"button, input, textarea, select"))return;const d=p.target.closest("[data-block-row-id]");if(d){if(p.target.closest(".be-block-row-content"))return;i(d.getAttribute("data-block-row-id"),p);return}const b=e==null?void 0:e.current;if(!b)return;const m=[...b.querySelectorAll("[data-block-row-id]")].find(k=>{const I=k.getBoundingClientRect();return p.clientY>=I.top&&p.clientY<=I.bottom});m&&i(m.getAttribute("data-block-row-id"),p)},[e,i]);f.useEffect(()=>(document.addEventListener("mousedown",u),document.addEventListener("mousemove",s),document.addEventListener("mouseup",c),()=>{document.removeEventListener("mousedown",u),document.removeEventListener("mousemove",s),document.removeEventListener("mouseup",c),document.documentElement.classList.remove("be-block-range-dragging")}),[u,s,c])}function dc({minHeight:e=180,className:n="be-trailing-space"}){const t=D(),[o]=Mn(),r=f.useCallback(()=>{var u;if(o)return;const l=t.getRootId(),s=t.getBlock(l),c=(u=s==null?void 0:s.contentIds)==null?void 0:u[s.contentIds.length-1];if(!c){const p=Ae(t);p&&ut(t,p);return}const i=t.getBlock(c);(i==null?void 0:i.type)==="paragraph"?ut(t,c):ve(t,c,$("paragraph"))},[t,o]);return a.jsx("div",{className:n,style:{minHeight:e},onClick:r})}function rr(e,{pretty:n=!0}={}){const t=e.getRootId(),{blocks:o,runs:r}=Kn(e,t);return JSON.stringify({version:1,rootId:t,blocks:o,runs:r},null,n?2:0)}function lr(e,n,t){const o=e.getBlock(e.getRootId());return o?Ze(e,n,o.contentIds,t).html:""}function sr(e,n,t){const o=e.getBlock(e.getRootId());return o?Ze(e,n,o.contentIds,t).text:""}const pc=[{value:"json",label:"JSON"},{value:"html",label:"HTML"},{value:"text",label:"Text"}];function fc({label:e="View source",className:n=""}){const t=D(),o=Ne(),r=he(),[l,s]=f.useState(!1),[c,i]=f.useState("json"),[u,p]=f.useState(!1),d=f.useCallback(()=>{p(!1),s(!0)},[]),b=f.useCallback(()=>s(!1),[]),h=f.useMemo(()=>l?c==="json"?rr(t):c==="html"?lr(t,o,r):sr(t,o,r):"",[l,c,t,o,r]),m=f.useCallback(async()=>{try{await navigator.clipboard.writeText(h),p(!0),setTimeout(()=>p(!1),1500)}catch{}},[h]);return a.jsxs(a.Fragment,{children:[a.jsxs("button",{type:"button",className:`be-export-trigger ${n}`.trim(),onClick:d,children:[a.jsx(Nt,{size:14})," ",e]}),a.jsxs(Ye,{isOpen:l,onClose:b,title:"Document source",size:"large",children:[a.jsx("div",{className:"be-export-tabs",role:"tablist",children:pc.map(g=>a.jsx("button",{type:"button",role:"tab","aria-selected":c===g.value,className:`be-export-tab${c===g.value?" be-export-tab-active":""}`,onClick:()=>i(g.value),children:g.label},g.value))}),a.jsx("pre",{className:"be-export-pre",children:a.jsx("code",{children:h})}),a.jsxs("div",{className:"be-modal-actions",children:[a.jsx("button",{type:"button",className:"be-modal-cancel",onClick:b,children:"Close"}),a.jsx("button",{type:"button",className:"be-modal-save",onClick:m,children:u?"Copied!":"Copy"})]})]})]})}function bc(e,n,t,o){f.useEffect(()=>{if(!e||!n)return;const r=document.querySelector(`[data-run-id="${n}"]`);if(r)return r.setAttribute("aria-expanded","true"),r.setAttribute("aria-haspopup","listbox"),r.setAttribute("aria-controls",o),t&&r.setAttribute("aria-activedescendant",t),()=>{r.removeAttribute("aria-expanded"),r.removeAttribute("aria-haspopup"),r.removeAttribute("aria-controls"),r.removeAttribute("aria-activedescendant")}},[e,n,t,o])}function mc({isOpen:e,rect:n,commands:t,runId:o,onSelect:r,onClose:l,menuId:s="be-slash-menu",ariaLabel:c="Slash commands"}){const[i,u]=f.useState(0),p=f.useRef(null);f.useEffect(()=>{u(0)},[t.length]),f.useEffect(()=>{var h,m;(m=(h=p.current)==null?void 0:h.scrollIntoView)==null||m.call(h,{block:"nearest"})},[i]),f.useEffect(()=>{if(!e)return;const h=m=>{m.key==="ArrowDown"?(m.preventDefault(),m.stopPropagation(),u(g=>Math.min(g+1,Math.max(t.length-1,0)))):m.key==="ArrowUp"?(m.preventDefault(),m.stopPropagation(),u(g=>Math.max(g-1,0))):m.key==="Enter"?(m.preventDefault(),m.stopPropagation(),t[i]&&r(t[i])):m.key==="Escape"&&(m.preventDefault(),m.stopPropagation(),l())};return document.addEventListener("keydown",h,!0),()=>document.removeEventListener("keydown",h,!0)},[e,t,i,r,l]);const b=t[i]?`${s}-option-${i}`:null;return bc(e,o,b,s),!e||t.length===0||!n?null:a.jsx("div",{id:s,role:"listbox","aria-label":c,className:"be-slash-menu",style:{position:"fixed",top:n.bottom+4,left:n.left,zIndex:1e3},children:t.map((h,m)=>{const g=h.icon;return a.jsxs("div",{ref:m===i?p:void 0,id:`${s}-option-${m}`,role:"option","aria-selected":m===i,className:`be-slash-menu-item${m===i?" be-slash-menu-item-active":""}`,onMouseDown:x=>{x.preventDefault(),r(h)},onMouseEnter:()=>u(m),children:[g&&a.jsx("span",{className:"be-slash-menu-item-icon",children:a.jsx(g,{size:16})}),a.jsx("span",{className:"be-slash-menu-item-label",children:h.label})]},h.label)})})}function hc(e,n){var o;if(!n)return!0;const t=n.toLowerCase();return e.label.toLowerCase().includes(t)||((o=e.keywords)==null?void 0:o.some(r=>r.toLowerCase().includes(t)))}function gc(e,n){const t=n.anchorNode,o=n.anchorOffset;let r;if(t===e){r="";for(let l=0;l<o&&l<e.childNodes.length;l+=1)r+=e.childNodes[l].textContent??""}else t&&t.parentElement===e?r=(t.textContent??"").slice(0,o):r=e.textContent??"";return me(r).length}function et(e,n,t){const o=D(),[r,l]=f.useState(null);f.useEffect(()=>{const u=e.current;if(!u)return;const p=()=>{var R,S,C,w;const b=(R=window.getSelection)==null?void 0:R.call(window),h=b==null?void 0:b.anchorNode;let m=(h==null?void 0:h.nodeType)===1?h:h==null?void 0:h.parentElement;for(;m&&typeof m.hasAttribute=="function"&&!m.hasAttribute("data-run-id");)m=m.parentElement;const g=(S=m==null?void 0:m.getAttribute)==null?void 0:S.call(m,"data-run-id");if(!g||!b){l(null);return}const x=gc(m,b),k=me(m.textContent).slice(0,x),I=n.exec(k);if(!I){l(null);return}const y=(w=(C=m.closest)==null?void 0:C.call(m,"[data-block-id]"))==null?void 0:w.getAttribute("data-block-id");if(!y){l(null);return}const E=I.index+I[1].length;l({query:I[2],blockId:y,runId:g,sliceStart:E,sliceEnd:x,rect:m.getBoundingClientRect()})},d=b=>{b.key==="Escape"&&l(null)};return u.addEventListener("input",p),u.addEventListener("keydown",d),()=>{u.removeEventListener("input",p),u.removeEventListener("keydown",d)}},[e,n]);const s=r?t().filter(u=>hc(u,r.query)):[],c=f.useCallback(u=>{r&&(u.run(o,{blockId:r.blockId,runId:r.runId,sliceStart:r.sliceStart,sliceEnd:r.sliceEnd}),l(null))},[r,o]),i=f.useCallback(()=>l(null),[]);return{isOpen:!!r,query:(r==null?void 0:r.query)??"",rect:(r==null?void 0:r.rect)??null,runId:(r==null?void 0:r.runId)??null,commands:s,selectCommand:c,close:i}}const xc=/(^|\s)\/(\w*)$/;function kc(e){const n=Ne(),t=he(),o=f.useCallback(()=>[...n.listSlashCommands(),...(t==null?void 0:t.listSlashCommands())??[]],[n,t]);return et(e,xc,o)}const yc=[{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 vc(e,{runId:n,sliceStart:t,sliceEnd:o},r){const l=e.getRun(n),s=(l==null?void 0:l.value)??"",c=s.slice(0,t)+r+s.slice(o);e.applyOperation(J(n,{value:c})),be(n,t+r.length)}const Ic=yc.map(({char:e,name:n,keywords:t})=>({label:`${e} ${n}`,keywords:t,run:(o,r)=>vc(o,r,e)})),wc=/(^|\s):(\w*)$/,Cc=()=>Ic;function Bc(e){return et(e,wc,Cc)}const Rc=/(^|\s)@(\w*)$/;function Tc(e){const n=he(),t=f.useCallback(()=>(n==null?void 0:n.listAtCommands())??[],[n]);return et(e,Rc,t)}const jc=[{markName:"bold",Icon:wr,title:"Bold (Ctrl+B)"},{markName:"italic",Icon:Cr,title:"Italic (Ctrl+I)"},{markName:"underline",Icon:Br,title:"Underline (Ctrl+U)"},{markName:"strike",Icon:jr,title:"Strikethrough"}],Sc=[{label:"Default",value:null},{label:"Red",value:"#e03131"},{label:"Orange",value:"#e8590c"},{label:"Green",value:"#2f9e44"},{label:"Blue",value:"#1971c2"},{label:"Purple",value:"#9c36b5"}],Ec=[{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 Oc({isOpen:e,rect:n,kind:t,selection:o,crossSelection:r,marks:l,store:s}){var R,S;const[c,i]=f.useState(null),[u,p]=f.useState(!1),d=f.useRef(null);f.useEffect(()=>{if(!c)return;const C=v=>{d.current&&!d.current.contains(v.target)&&i(null)},w=v=>{v.key==="Escape"&&i(null)};return document.addEventListener("mousedown",C),document.addEventListener("keydown",w),()=>{document.removeEventListener("mousedown",C),document.removeEventListener("keydown",w)}},[c]),f.useEffect(()=>{i(null)},[n,t]);const b=f.useCallback(C=>{const w=t==="same-block"?Oe(s,o.blockId,o,C):dn(s,r,C);w&&X(w),i(null)},[s,t,o,r]),h=f.useCallback(C=>{const w=t==="same-block"?Qn(s,o.blockId,o,C):Zn(s,r,C);w&&X(w)},[s,t,o,r]),m=f.useCallback(C=>{const w=C==="subscript"?"superscript":"subscript",v=!l[C];b({[C]:v?!0:null,[w]:null})},[l,b]),g=f.useRef(null),x=f.useCallback(()=>{g.current={kind:t,selection:o,crossSelection:r},p(!0)},[t,o,r]),k=f.useCallback(()=>p(!1),[]),I=f.useCallback(C=>{const w=g.current;if(!w)return;const v=w.kind==="same-block"?Oe(s,w.selection.blockId,w.selection,C):dn(s,w.crossSelection,C);v&&X(v),p(!1)},[s]),y=f.useCallback((C,w)=>I({link:{href:C,target:w}}),[I]),E=f.useCallback(()=>I({link:null}),[I]);return(!e||!n)&&!u?null:a.jsxs(a.Fragment,{children:[e&&n&&a.jsxs("div",{ref:d,className:"be-floating-toolbar",role:"toolbar","aria-label":"Text formatting",style:{position:"fixed",top:n.top-44,left:n.left+n.width/2,transform:"translateX(-50%)"},onMouseDown:C=>C.preventDefault(),children:[jc.map(({markName:C,Icon:w,title:v})=>a.jsx("button",{type:"button",className:`be-floating-toolbar-btn${l[C]?" be-floating-toolbar-btn-active":""}`,title:v,"aria-label":v,"aria-pressed":!!l[C],onClick:()=>h(C),children:a.jsx(w,{})},C)),a.jsx("button",{type:"button",className:`be-floating-toolbar-btn${l.subscript?" be-floating-toolbar-btn-active":""}`,title:"Subscript","aria-pressed":!!l.subscript,onClick:()=>m("subscript"),children:"X₂"}),a.jsx("button",{type:"button",className:`be-floating-toolbar-btn${l.superscript?" be-floating-toolbar-btn-active":""}`,title:"Superscript","aria-pressed":!!l.superscript,onClick:()=>m("superscript"),children:"X²"}),a.jsx("span",{className:"be-floating-toolbar-divider"}),a.jsxs("div",{className:"be-floating-toolbar-picker-wrap",children:[a.jsx("button",{type:"button",className:"be-floating-toolbar-btn",title:"Text color","aria-haspopup":"true","aria-expanded":c==="color",onClick:()=>i(C=>C==="color"?null:"color"),children:a.jsx("span",{style:{color:l.color||"inherit",fontWeight:700},children:"A"})}),c==="color"&&a.jsx("div",{className:"be-floating-toolbar-picker",role:"menu","aria-label":"Text color",children:Sc.map(C=>a.jsx("button",{type:"button",role:"menuitem",className:"be-floating-toolbar-swatch",title:C.label,onClick:()=>b({color:C.value}),children:a.jsx("span",{style:{color:C.value||"#1a1a1a",fontWeight:700},children:"A"})},C.label))})]}),a.jsxs("div",{className:"be-floating-toolbar-picker-wrap",children:[a.jsx("button",{type:"button",className:"be-floating-toolbar-btn",title:"Highlight","aria-haspopup":"true","aria-expanded":c==="highlight",onClick:()=>i(C=>C==="highlight"?null:"highlight"),children:a.jsx("span",{style:{backgroundColor:l.highlight||"transparent",padding:"0 2px",borderRadius:2},children:"H"})}),c==="highlight"&&a.jsx("div",{className:"be-floating-toolbar-picker",role:"menu","aria-label":"Highlight color",children:Ec.map(C=>a.jsx("button",{type:"button",role:"menuitem",className:"be-floating-toolbar-swatch",style:{backgroundColor:C.value||"transparent"},title:C.label,onClick:()=>b({highlight:C.value})},C.label))})]}),a.jsx("span",{className:"be-floating-toolbar-divider"}),a.jsx("button",{type:"button",className:`be-floating-toolbar-btn${l.link?" be-floating-toolbar-btn-active":""}`,title:"Link","aria-label":"Link","aria-pressed":!!l.link,onClick:x,children:a.jsx(Tr,{})})]}),a.jsx(Tt,{isOpen:u,initialHref:((R=l.link)==null?void 0:R.href)??"",initialTarget:((S=l.link)==null?void 0:S.target)??"_self",hasExistingLink:!!l.link,onSave:y,onRemove:E,onClose:k})]})}function Lc(e){const n=D(),[t,o]=f.useState(null);return f.useEffect(()=>{const r=e.current;if(!r)return;const l=()=>{var p,d,b;const s=(p=window.getSelection)==null?void 0:p.call(window);if(!s||s.rangeCount===0||s.isCollapsed){o(null);return}if(!r.contains(s.anchorNode)||!r.contains(s.focusNode)){o(null);return}const c=((b=(d=s.getRangeAt(0)).getBoundingClientRect)==null?void 0:b.call(d))??{top:0,left:0,right:0,bottom:0,width:0,height:0},i=Je();if(i){o({kind:"same-block",rect:c,selection:i,marks:Qo(n,i.blockId,i)});return}const u=Ue(n);if(u){o({kind:"cross-block",rect:c,crossSelection:u,marks:Zo(n,u)});return}o(null)};return document.addEventListener("selectionchange",l),window.addEventListener("scroll",l,!0),window.addEventListener("resize",l),()=>{document.removeEventListener("selectionchange",l),window.removeEventListener("scroll",l,!0),window.removeEventListener("resize",l)}},[e,n]),{isOpen:!!t,rect:(t==null?void 0:t.rect)??null,kind:(t==null?void 0:t.kind)??null,selection:(t==null?void 0:t.selection)??null,crossSelection:(t==null?void 0:t.crossSelection)??null,marks:(t==null?void 0:t.marks)??{},close:()=>o(null)}}function Nc({id:e,label:n,placeholder:t,variant:o,options:r,onManage:l,mention:s=!1}){const c=D(),i=ye(e),u=f.useCallback((h,m)=>{c.applyOperation(J(e,{data:{selectedValue:h,selectedLabel:(m==null?void 0:m.label)??"",selectedColor:m==null?void 0:m.color}}))},[c,e]);if(!i)return null;const{selectedValue:p="",selectedLabel:d="",selectedColor:b}=i.data??{};return a.jsx("span",{className:"be-inline-select",onMouseDown:h=>{h.preventDefault(),h.stopPropagation()},onKeyDown:h=>h.stopPropagation(),children:a.jsx(_e,{value:p,selectedLabel:d,selectedColor:b,options:r,onChange:u,placeholder:t,variant:o,ariaLabel:n,onManageOptions:l,mention:s})})}function ar(e){return String(e).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function kt(e){return ar(e).replace(/"/g,"&quot;")}function cr({type:e,label:n,placeholder:t="Select…",variant:o="default",icon:r,options:l,onManage:s,triggers:c=["slash"],mention:i=c.includes("at")}){function u(m){var k,I;const g=((k=m.data)==null?void 0:k.selectedLabel)||"",x=i&&g?`@${g}`:g;return`<span data-inline-type="${kt(e)}" data-selected-value="${kt(((I=m.data)==null?void 0:I.selectedValue)??"")}">${ar(x)}</span>`}function p(m){var x;const g=((x=m.data)==null?void 0:x.selectedLabel)??"";return i&&g?`@${g}`:g}function d(m){var k;if(((k=m.getAttribute)==null?void 0:k.call(m,"data-inline-type"))!==e)return null;const g=m.textContent??"",x=i&&g.startsWith("@")?g.slice(1):g;return{id:T(),type:e,value:"",marks:{},data:{selectedValue:m.getAttribute("data-selected-value")??"",selectedLabel:x}}}function b({id:m}){return a.jsx(Nc,{id:m,label:n,placeholder:t,variant:o,options:l,onManage:s,mention:i})}const h={label:n,icon:r,keywords:[n.toLowerCase(),"select","field"],run:(m,{blockId:g,runId:x,sliceStart:k,sliceEnd:I})=>xn(m,{blockId:g,runId:x,sliceStart:k,sliceEnd:I},()=>({id:T(),type:e,value:"",marks:{},data:{selectedValue:"",selectedLabel:"",selectedColor:void 0}}))};return{component:b,isAtomic:!0,toHTML:u,toPlainText:p,fromHTML:d,slashCommand:c.includes("slash")?h:void 0,atCommand:c.includes("at")?h:void 0}}function ir(e,n,{onManage:t}={}){for(const o of e.getFieldTypes())n.register(o.id,cr({type:o.id,label:o.label,placeholder:o.placeholder,variant:o.variant,options:o.options??[],onManage:t?()=>t(o.id):void 0}))}function ur(){const e=D(),n=he(),t=Uo(),{openEdit:o}=An(),r=f.useRef([]);f.useEffect(()=>{if(!n)return;const l=new Set(t.map(s=>s.id));for(const s of r.current)l.has(s)||n.unregister(s);ir(e,n,{onManage:o}),r.current=[...l]},[e,n,t,o])}function Mc(){ur();const e=D(),{target:n,close:t}=An(),o=n!==null,r=o&&n!=="new",[l,s]=f.useState(""),[c,i]=f.useState([]),[u,p]=f.useState("");f.useEffect(()=>{if(o){if(r){const x=e.getFieldType(n);s((x==null?void 0:x.label)??""),i((x==null?void 0:x.options)??[])}else s(""),i([]);p("")}},[o,r,n,e]);const d=f.useCallback((x,k)=>{i(I=>I.map(y=>y.value===x?{...y,label:k}:y))},[]),b=f.useCallback(x=>{i(k=>k.filter(I=>I.value!==x))},[]),h=f.useCallback(()=>{const x=u.trim();p(""),x&&i(k=>[...k,{value:T(),label:x,color:Ke(k.length)}])},[u]),m=f.useCallback(()=>{const x=l.trim();x&&(r?e.applyOperation(En(n,{label:x,options:c})):e.applyOperation(Sn({id:T(),label:x,placeholder:"Select…",variant:"tag",options:c})),t())},[e,r,n,l,c,t]),g=f.useCallback(()=>{r&&e.applyOperation(On(n)),t()},[e,r,n,t]);return a.jsxs(Ye,{isOpen:o,onClose:t,title:r?"Edit field type":"New field type",children:[a.jsxs("label",{className:"be-modal-field",children:[a.jsx("span",{children:"Name"}),a.jsx("input",{type:"text",value:l,onChange:x=>s(x.target.value),placeholder:"e.g. Priority, Status…",autoFocus:!0})]}),a.jsxs("div",{className:"be-modal-field",children:[a.jsx("span",{children:"Options"}),c.map((x,k)=>a.jsxs("div",{className:"be-table-header-menu-option-row",children:[a.jsx("span",{className:"be-table-header-menu-option-swatch",style:{background:(x.color??Ke(k)).bg},"aria-hidden":"true"}),a.jsx("input",{className:"be-table-header-menu-option-input",value:x.label,onChange:I=>d(x.value,I.target.value),"aria-label":`Rename option ${x.label}`}),a.jsx("button",{type:"button",className:"be-table-header-menu-option-remove",onClick:()=>b(x.value),"aria-label":`Remove option ${x.label}`,children:a.jsx(Ge,{size:14})})]},x.value)),a.jsxs("div",{className:"be-table-header-menu-option-row",children:[a.jsx("input",{className:"be-table-header-menu-option-input",value:u,onChange:x=>p(x.target.value),placeholder:"New option…",onKeyDown:x=>{x.key==="Enter"&&(x.preventDefault(),h())}}),a.jsx("button",{type:"button",className:"be-table-header-menu-option-add",onClick:h,"aria-label":"Add option",children:"+"})]})]}),a.jsxs("div",{className:"be-modal-actions",children:[r&&a.jsx("button",{type:"button",className:"be-modal-delete",onClick:g,children:"Delete field type"}),a.jsx("button",{type:"button",className:"be-modal-cancel",onClick:t,children:"Cancel"}),a.jsx("button",{type:"button",className:"be-modal-save",onClick:m,children:"Save"})]})]})}exports.APP_MIME=cn;exports.BlockChildren=Ce;exports.BlockErrorBoundary=Kt;exports.BlockGutterRow=Yt;exports.BlockRangeActionMenu=sc;exports.BlockRegistry=yt;exports.BlockRenderer=Un;exports.COLUMN_TYPES=Qt;exports.DEFAULT_COLUMN_TYPE=mn;exports.DEFAULT_COLUMN_WIDTH=hn;exports.DocumentExportButton=fc;exports.EditableBlockContent=xe;exports.EditorProvider=yr;exports.EditorStore=Ln;exports.EditorTrailingSpace=dc;exports.FieldTypeEditorModal=Mc;exports.FloatingToolbar=Oc;exports.History=hr;exports.InlineRegistry=vt;exports.LAYOUT_BLOCKS=Lo;exports.MIN_COLUMN_WIDTH=an;exports.Modal=Ye;exports.Select=_e;exports.SlashMenu=mc;exports.TABLE_BLOCKS=Oo;exports.TABLE_SELECT_INLINE_TYPES=Fo;exports.TableHeaderRow=co;exports.blankRunForType=Zt;exports.blockquoteBlockType=vo;exports.buttonBlockType=Bo;exports.calloutBlockType=yo;exports.checkboxInlineType=_o;exports.codeBlockType=Io;exports.convertRunToType=eo;exports.copyBlockRangeToClipboard=jn;exports.createBlockRegistry=gr;exports.createCellForColumn=gn;exports.createDefaultColumns=Vn;exports.createInlineRegistry=xr;exports.createSelectFieldType=cr;exports.dateInlineType=Do;exports.deleteBlockAndFocusSibling=Wn;exports.deleteBlockRange=ze;exports.deleteColumn=ro;exports.deleteEntireDocument=un;exports.deleteOverBlockRange=Jn;exports.deleteRow=oo;exports.deleteRunRangeInBlock=Xn;exports.deserializeClipboard=qo;exports.dividerBlockType=xo;exports.duplicateBlock=qt;exports.embedBlockType=So;exports.emojiInlineType=Ho;exports.ensureRootNonEmpty=Ae;exports.exportDocumentHTML=lr;exports.exportDocumentJSON=rr;exports.exportDocumentText=sr;exports.focusRunAtOffset=be;exports.focusRunEnd=X;exports.focusRunStart=Dn;exports.getMarksSummaryOverBlockRange=Zo;exports.getMarksSummaryOverSelection=Qo;exports.headingBlockType=Ut;exports.injectDefaultStyles=It;exports.insertColumnAfter=Cn;exports.insertRowAfter=to;exports.isEntireBlockRangeHidden=Go;exports.isEntireBlockSelected=or;exports.layoutBlockType=go;exports.layoutColumnBlockType=ho;exports.listItemBlockType=Jt;exports.moveBlockDown=Vt;exports.moveBlockRangeDown=Yo;exports.moveBlockRangeUp=Vo;exports.moveBlockUp=Wt;exports.operations=br;exports.paragraphBlockType=Ft;exports.registerBlocks=Eo;exports.registerBuiltInBlocks=ya;exports.registerBuiltInInlineTypes=Fa;exports.registerInlineTypes=zo;exports.registerStoredFieldTypes=ir;exports.remapSubtreeIds=qn;exports.renameColumn=so;exports.reorderBlockRangeFromStore=Va;exports.resolveCollapsedCaret=Xe;exports.resolveColumns=ie;exports.resolveCrossBlockSelection=Ue;exports.resolveMultiRunSelection=Je;exports.resolveRunSelection=sl;exports.selectInlineType=Mo;exports.serializeBlockRange=Ze;exports.setBlockRangeHidden=Xo;exports.setColumnOptions=ln;exports.setColumnType=ao;exports.setColumnWidth=lo;exports.setMarksOverBlockRange=dn;exports.setMarksOverSelection=Oe;exports.tableBlockType=fo;exports.tableCellBlockType=uo;exports.tableRowBlockType=po;exports.tableSelectInlineType=Po;exports.textToParagraphs=Gn;exports.toggleHeadingBlockType=wo;exports.toggleMarkOnRunRange=tc;exports.toggleMarkOverBlockRange=Zn;exports.toggleMarkOverSelection=Qn;exports.useAtMenuTrigger=Tc;exports.useBlock=Q;exports.useBlockChildren=Fn;exports.useBlockClassName=ee;exports.useBlockRangeDrag=uc;exports.useBlockRangeSelection=We;exports.useBlockRegistry=Ne;exports.useClipboardHandlers=Xa;exports.useEditorKeyboardShortcuts=lc;exports.useEditorStore=D;exports.useEmojiMenuTrigger=Bc;exports.useFieldTypeEditor=An;exports.useFieldTypes=Uo;exports.useFloatingToolbarTrigger=Lc;exports.useHistory=qa;exports.useInlineRegistry=he;exports.usePreviewMode=Mn;exports.useRegisterFieldTypes=ur;exports.useRun=ye;exports.useSelectedBlock=ge;exports.useSlashMenuTrigger=kc;exports.useWholeDocumentSelection=Nn;exports.walkDomToBlocks=Ko;
1
+ "use strict";var To=Object.defineProperty;var So=(e,n,t)=>n in e?To(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t;var xt=(e,n,t)=>So(e,typeof n!="symbol"?n+"":n,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),f=require("react"),Pe=require("react-dom"),z={INSERT_BLOCK:"insertBlock",REMOVE_BLOCK:"removeBlock",MOVE_BLOCK:"moveBlock",UPDATE_BLOCK_PROPS:"updateBlockProps",UPDATE_RUN:"updateRun",SET_BLOCK_CONTENT_IDS:"setBlockContentIds",REPLACE_RUN_SPAN:"replaceRunSpan",SET_BLOCK_RUNS:"setBlockRuns",ADD_FIELD_TYPE:"addFieldType",UPDATE_FIELD_TYPE:"updateFieldType",REMOVE_FIELD_TYPE:"removeFieldType"};function q(e,n,t,r){return{type:z.INSERT_BLOCK,block:e,parentId:n,index:t,subtree:r}}function P(e){return{type:z.REMOVE_BLOCK,id:e}}function ve(e,n,t){return{type:z.MOVE_BLOCK,id:e,toParentId:n,toIndex:t}}function H(e,n){return{type:z.UPDATE_BLOCK_PROPS,id:e,patch:n}}function Y(e,n){return{type:z.UPDATE_RUN,id:e,patch:n}}function Ne(e,n){return{type:z.SET_BLOCK_CONTENT_IDS,blockId:e,contentIds:n}}function Ge(e,n,t){return{type:z.REPLACE_RUN_SPAN,blockId:e,oldRunIds:n,newRuns:t}}function ae(e,n){return{type:z.SET_BLOCK_RUNS,blockId:e,runs:n}}function Mn(e){return{type:z.ADD_FIELD_TYPE,fieldType:e}}function An(e,n){return{type:z.UPDATE_FIELD_TYPE,id:e,patch:n}}function Dn(e){return{type:z.REMOVE_FIELD_TYPE,id:e}}const Eo=Object.freeze(Object.defineProperty({__proto__:null,OP:z,addFieldType:Mn,insertBlock:q,moveBlock:ve,removeBlock:P,removeFieldType:Dn,replaceRunSpan:Ge,setBlockContentIds:Ne,setBlockRuns:ae,updateBlockProps:H,updateFieldType:An,updateRun:Y},Symbol.toStringTag,{value:"Module"})),Bn="$fieldTypes";class _n{constructor(n){this.blocks=new Map(((n==null?void 0:n.blocks)??[]).map(t=>[t.id,t])),this.runs=new Map(((n==null?void 0:n.runs)??[]).map(t=>[t.id,t])),this.rootId=(n==null?void 0:n.rootId)??null,this.fieldTypes=new Map(((n==null?void 0:n.fieldTypes)??[]).map(t=>[t.id,t])),this._fieldTypesSnapshot=null,this._listeners=new Map}getBlock(n){return this.blocks.get(n)}getRun(n){return this.runs.get(n)}getFieldTypes(){return this._fieldTypesSnapshot||(this._fieldTypesSnapshot=[...this.fieldTypes.values()]),this._fieldTypesSnapshot}getFieldType(n){return this.fieldTypes.get(n)}getRootId(){return this.rootId}subscribe(n,t){let r=this._listeners.get(n);return r||(r=new Set,this._listeners.set(n,r)),r.add(t),()=>{r.delete(t),r.size===0&&this._listeners.delete(n)}}_notify(n){for(const t of n){const r=this._listeners.get(t);if(r)for(const o of[...r])o()}}_captureSubtree(n){const t=[],r=[],o=l=>{var c;if(this.runs.has(l)){r.push(this.runs.get(l));return}const a=this.blocks.get(l);if(a){t.push(a);for(const i of a.contentIds)o(i);for(const i of((c=a.props)==null?void 0:c.titleRunIds)??[])o(i)}};return o(n),{blocks:t,runs:r}}_deleteSubtree(n){const t=r=>{var l;if(this.runs.has(r)){this.runs.delete(r);return}const o=this.blocks.get(r);if(o){for(const a of o.contentIds)t(a);for(const a of((l=o.props)==null?void 0:l.titleRunIds)??[])t(a);this.blocks.delete(r)}};t(n)}applyOperation(n){var t;switch(n.type){case z.UPDATE_RUN:{const r=this.runs.get(n.id),o={};for(const l of Object.keys(n.patch))o[l]=r[l];return this.runs.set(n.id,{...r,...n.patch}),this._notify([n.id]),Y(n.id,o)}case z.UPDATE_BLOCK_PROPS:{const r=this.blocks.get(n.id),o={};for(const l of Object.keys(n.patch))o[l]=r.props[l];return this.blocks.set(n.id,{...r,props:{...r.props,...n.patch}}),this._notify([n.id]),H(n.id,o)}case z.INSERT_BLOCK:{if(n.subtree){for(const a of n.subtree.blocks)this.blocks.set(a.id,a);for(const a of n.subtree.runs)this.runs.set(a.id,a)}else this.blocks.set(n.block.id,n.block);const r=this.blocks.get(n.parentId),o=[...r.contentIds],l=n.index??o.length;return o.splice(l,0,n.block.id),this.blocks.set(n.parentId,{...r,contentIds:o}),this._notify([n.block.id,n.parentId]),P(n.block.id)}case z.REMOVE_BLOCK:{const r=this.blocks.get(n.id),o=r.parentId,l=this.blocks.get(o),a=l.contentIds.indexOf(n.id),c=this._captureSubtree(n.id);this._deleteSubtree(n.id);const i=l.contentIds.filter(u=>u!==n.id);return this.blocks.set(o,{...l,contentIds:i}),this._notify([o]),{type:z.INSERT_BLOCK,block:r,parentId:o,index:a,subtree:c}}case z.MOVE_BLOCK:{const o=this.blocks.get(n.id).parentId,l=this.blocks.get(o),a=l.contentIds.indexOf(n.id),c=l.contentIds.filter(d=>d!==n.id);this.blocks.set(o,{...l,contentIds:c});const i=n.toParentId===o?this.blocks.get(o):this.blocks.get(n.toParentId),u=[...i.contentIds];u.splice(n.toIndex??u.length,0,n.id),this.blocks.set(n.toParentId,{...i,contentIds:u}),this.blocks.set(n.id,{...this.blocks.get(n.id),parentId:n.toParentId});const p=new Set([n.id,o,n.toParentId]);return this._notify(p),ve(n.id,o,a)}case z.SET_BLOCK_CONTENT_IDS:{const r=this.blocks.get(n.blockId),o=r.contentIds;return this.blocks.set(n.blockId,{...r,contentIds:n.contentIds}),this._notify([n.blockId]),Ne(n.blockId,o)}case z.REPLACE_RUN_SPAN:{const r=this.blocks.get(n.blockId),o=r.contentIds.indexOf(n.oldRunIds[0])!==-1,l=o?r.contentIds:((t=r.props)==null?void 0:t.titleRunIds)??[],a=l.indexOf(n.oldRunIds[0]),c=n.oldRunIds.map(u=>this.runs.get(u));for(const u of n.oldRunIds)this.runs.delete(u);for(const u of n.newRuns)this.runs.set(u.id,u);const i=[...l];return i.splice(a,n.oldRunIds.length,...n.newRuns.map(u=>u.id)),o?this.blocks.set(n.blockId,{...r,contentIds:i}):this.blocks.set(n.blockId,{...r,props:{...r.props,titleRunIds:i}}),this._notify([n.blockId,...n.oldRunIds,...n.newRuns.map(u=>u.id)]),Ge(n.blockId,n.newRuns.map(u=>u.id),c)}case z.SET_BLOCK_RUNS:{const r=this.blocks.get(n.blockId),o=r.props&&"titleRunIds"in r.props,l=o?r.props.titleRunIds:r.contentIds,a=l.map(i=>this.runs.get(i)).filter(Boolean);for(const i of l)this.runs.delete(i);for(const i of n.runs)this.runs.set(i.id,i);const c=n.runs.map(i=>i.id);return o?this.blocks.set(n.blockId,{...r,props:{...r.props,titleRunIds:c}}):this.blocks.set(n.blockId,{...r,contentIds:c}),this._notify([n.blockId,...l,...c]),ae(n.blockId,a)}case z.ADD_FIELD_TYPE:return this.fieldTypes.set(n.fieldType.id,n.fieldType),this._fieldTypesSnapshot=null,this._notify([Bn]),Dn(n.fieldType.id);case z.UPDATE_FIELD_TYPE:{const r=this.fieldTypes.get(n.id),o={};for(const l of Object.keys(n.patch))o[l]=r[l];return this.fieldTypes.set(n.id,{...r,...n.patch}),this._fieldTypesSnapshot=null,this._notify([Bn]),An(n.id,o)}case z.REMOVE_FIELD_TYPE:{const r=this.fieldTypes.get(n.id);return this.fieldTypes.delete(n.id),this._fieldTypesSnapshot=null,this._notify([Bn]),Mn(r)}default:throw new Error(`Unknown operation type: ${n.type}`)}}applyOperations(n){return n.map(t=>this.applyOperation(t))}toJSON(){return{blocks:[...this.blocks.values()],runs:[...this.runs.values()],rootId:this.rootId,fieldTypes:[...this.fieldTypes.values()]}}static fromJSON(n){return new _n(n)}}const Oo=500;class Lo{constructor(n,{idleMs:t=Oo}={}){this.store=n,this.idleMs=t,this.undoStack=[],this.redoStack=[],this.currentBatch=null,this.idleTimer=null,this.historyLog=[],this._listeners=new Set,this._undoRedoSnapshot={canUndo:!1,canRedo:!1}}getUndoRedoSnapshot(){const n=this.canUndo(),t=this.canRedo();return(this._undoRedoSnapshot.canUndo!==n||this._undoRedoSnapshot.canRedo!==t)&&(this._undoRedoSnapshot={canUndo:n,canRedo:t}),this._undoRedoSnapshot}getBlock(n){return this.store.getBlock(n)}getRun(n){return this.store.getRun(n)}getRootId(){return this.store.getRootId()}getFieldTypes(){return this.store.getFieldTypes()}getFieldType(n){return this.store.getFieldType(n)}subscribe(n,t){return this.store.subscribe(n,t)}toJSON(){return this.store.toJSON()}applyOperation(n,t={}){return this.perform(n,t)}applyOperations(n,t={}){return n.map(r=>this.perform(r,t))}performBatch(n,t={}){var a;const r=t.actorId??null,o=t.timestamp??Date.now();this._commitCurrentBatch();const l=[];for(const c of n)l.unshift(this.store.applyOperation(c)),this.historyLog.push({opType:c.type,id:c.id??c.blockId??((a=c.block)==null?void 0:a.id),actorId:r,timestamp:o});this.redoStack=[],this.undoStack.push({ops:[...n],inverses:l,batchKey:null,actorId:r,timestamp:o,lastTimestamp:o,boundaryHit:!0}),this._notify()}perform(n,t={}){const r=t.actorId??null,o=t.timestamp??Date.now(),l=this.store.applyOperation(n);return this._record(n,l,{actorId:r,timestamp:o}),l}_batchKeyFor(n){return n.type==="updateRun"?`run:${n.id}`:null}_isWordBoundary(n){var r;if(n.type!=="updateRun")return!1;const t=(r=n.patch)==null?void 0:r.value;return typeof t!="string"||t.length===0?!1:/\s/.test(t[t.length-1])}_record(n,t,r){var c;this.redoStack=[];const o=this._batchKeyFor(n),l=this.currentBatch&&r.timestamp-this.currentBatch.lastTimestamp<=this.idleMs;this.currentBatch&&o!==null&&this.currentBatch.batchKey===o&&l&&!this.currentBatch.boundaryHit?(this.currentBatch.ops.push(n),this.currentBatch.inverses.unshift(t),this.currentBatch.lastTimestamp=r.timestamp,this._isWordBoundary(n)&&(this.currentBatch.boundaryHit=!0)):(this._commitCurrentBatch(),this.currentBatch={ops:[n],inverses:[t],batchKey:o,actorId:r.actorId,timestamp:r.timestamp,lastTimestamp:r.timestamp,boundaryHit:this._isWordBoundary(n)}),this._resetIdleTimer(),this.historyLog.push({opType:n.type,id:n.id??((c=n.block)==null?void 0:c.id),actorId:r.actorId,timestamp:r.timestamp}),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 n=this.undoStack.pop();if(!n)return!1;for(const t of n.inverses)this.store.applyOperation(t);return this.redoStack.push(n),this._notify(),!0}redo(){const n=this.redoStack.pop();if(!n)return!1;for(const t of n.ops)this.store.applyOperation(t);return this.undoStack.push(n),this._notify(),!0}canUndo(){return this.undoStack.length>0||this.currentBatch!==null}canRedo(){return this.redoStack.length>0}getHistoryLog(){return[...this.historyLog]}subscribeToHistory(n){return this._listeners.add(n),()=>this._listeners.delete(n)}_notify(){for(const n of this._listeners)n()}}class _t{constructor(){this._types=new Map}register(n,t){this._types.set(n,t)}get(n){return this._types.get(n)}isLeaf(n){var t;return!!((t=this._types.get(n))!=null&&t.isLeaf)}listSlashCommands(){const n=[];for(const t of this._types.values())t.slashCommand&&n.push(t.slashCommand),t.slashCommands&&n.push(...t.slashCommands);return n}listHtmlMatchers(){return[...this._types.values()].filter(n=>n.fromHTML)}}function No(){return new _t}class Pt{constructor(){this._types=new Map}register(n,t){this._types.set(n,t)}unregister(n){this._types.delete(n)}get(n){return this._types.get(n)}listHtmlMatchers(){return[...this._types.values()].filter(n=>n.fromHTML)}listSlashCommands(){const n=[];for(const t of this._types.values())t.slashCommand&&n.push(t.slashCommand),t.slashCommands&&n.push(...t.slashCommands);return n}listAtCommands(){const n=[];for(const t of this._types.values())t.atCommand&&n.push(t.atCommand),t.atCommands&&n.push(...t.atCommands);return n}}function Mo(){return new Pt}const Ao=`/*\r
2
+ * noteloom's default theme — minimal, clean, Notion/Linear-adjacent.\r
3
+ *\r
4
+ * Ships as plain CSS custom properties on :root (not scoped to a wrapper\r
5
+ * element) deliberately: several of this package's own pieces — Select's\r
6
+ * popover, SlashMenu, FloatingToolbar, the table header menu, the block\r
7
+ * gutter/range menus, Modal — are portaled to document.body, so they are\r
8
+ * NOT DOM descendants of whatever element renders the editor itself.\r
9
+ * Scoping variables to a wrapper class would silently fail to reach any\r
10
+ * of those. \`--noteloom-*\` is a distinctive enough prefix that defining\r
11
+ * these on :root won't collide with a host app's own custom properties.\r
12
+ *\r
13
+ * This file is auto-injected at runtime by <EditorProvider> (see\r
14
+ * react/injectDefaultStyles.js) — you do NOT need to import this\r
15
+ * yourself. It's still published standalone at \`noteloom/style.css\` for:\r
16
+ * - passing \`theme="none"\` to <EditorProvider> and importing this\r
17
+ * explicitly instead (e.g. to control load order, or for SSR/CSP\r
18
+ * setups where runtime <style> injection isn't allowed)\r
19
+ * - copying as a starting point for your own from-scratch theme\r
20
+ *\r
21
+ * Retheme by overriding these variables in your own CSS (after the\r
22
+ * default theme loads) — every rule below reads from them, nothing is\r
23
+ * hardcoded. Override individual \`.be-*\` classes too, same as any other\r
24
+ * library's default styles.\r
25
+ */\r
26
+ \r
27
+ :root {\r
28
+ --noteloom-font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Inter, sans-serif;\r
29
+ --noteloom-text: #0f172a;\r
30
+ --noteloom-text-muted: #64748b;\r
31
+ --noteloom-text-faint: #94a3b8;\r
32
+ --noteloom-bg: #ffffff;\r
33
+ --noteloom-bg-subtle: #f8fafc;\r
34
+ --noteloom-bg-hover: #f1f5f9;\r
35
+ --noteloom-border: #e2e8f0;\r
36
+ --noteloom-accent: #6366f1;\r
37
+ --noteloom-accent-text: #ffffff;\r
38
+ --noteloom-accent-soft: rgba(99, 102, 241, 0.1);\r
39
+ --noteloom-accent-soft-hover: rgba(99, 102, 241, 0.16);\r
40
+ --noteloom-danger: #dc2626;\r
41
+ --noteloom-danger-soft: #fef2f2;\r
42
+ --noteloom-radius-sm: 6px;\r
43
+ --noteloom-radius-md: 8px;\r
44
+ --noteloom-radius-lg: 12px;\r
45
+ --noteloom-radius-xl: 16px;\r
46
+ --noteloom-shadow: 0 12px 24px -8px rgba(15, 23, 42, 0.12), 0 4px 8px -4px rgba(15, 23, 42, 0.06);\r
47
+ --noteloom-code-bg: #0f172a;\r
48
+ --noteloom-code-text: #e2e8f0;\r
49
+ }\r
50
+ \r
51
+ @media (prefers-color-scheme: dark) {\r
52
+ :root {\r
53
+ --noteloom-text: #f1f5f9;\r
54
+ --noteloom-text-muted: #94a3b8;\r
55
+ --noteloom-text-faint: #64748b;\r
56
+ --noteloom-bg: #1c1932;\r
57
+ --noteloom-bg-subtle: rgba(255, 255, 255, 0.03);\r
58
+ --noteloom-bg-hover: rgba(255, 255, 255, 0.06);\r
59
+ --noteloom-border: rgba(255, 255, 255, 0.1);\r
60
+ --noteloom-accent-soft: rgba(99, 102, 241, 0.18);\r
61
+ --noteloom-accent-soft-hover: rgba(99, 102, 241, 0.26);\r
62
+ --noteloom-danger-soft: rgba(220, 38, 38, 0.15);\r
63
+ --noteloom-code-bg: #13111f;\r
64
+ }\r
65
+ }\r
66
+ \r
67
+ /* Explicit overrides win either direction — a host toggling dark mode via\r
68
+ a class rather than the OS setting can set [data-theme="dark"/"light"]\r
69
+ on any ancestor (e.g. <html>), overriding the media query above. */\r
70
+ [data-theme='dark'] {\r
71
+ --noteloom-text: #f1f5f9;\r
72
+ --noteloom-text-muted: #94a3b8;\r
73
+ --noteloom-text-faint: #64748b;\r
74
+ --noteloom-bg: #1c1932;\r
75
+ --noteloom-bg-subtle: rgba(255, 255, 255, 0.03);\r
76
+ --noteloom-bg-hover: rgba(255, 255, 255, 0.06);\r
77
+ --noteloom-border: rgba(255, 255, 255, 0.1);\r
78
+ --noteloom-accent-soft: rgba(99, 102, 241, 0.18);\r
79
+ --noteloom-accent-soft-hover: rgba(99, 102, 241, 0.26);\r
80
+ --noteloom-danger-soft: rgba(220, 38, 38, 0.15);\r
81
+ --noteloom-code-bg: #13111f;\r
82
+ }\r
83
+ \r
84
+ [data-theme='light'] {\r
85
+ --noteloom-text: #0f172a;\r
86
+ --noteloom-text-muted: #64748b;\r
87
+ --noteloom-text-faint: #94a3b8;\r
88
+ --noteloom-bg: #ffffff;\r
89
+ --noteloom-bg-subtle: #f8fafc;\r
90
+ --noteloom-bg-hover: #f1f5f9;\r
91
+ --noteloom-border: #e2e8f0;\r
92
+ --noteloom-accent-soft: rgba(99, 102, 241, 0.1);\r
93
+ --noteloom-accent-soft-hover: rgba(99, 102, 241, 0.16);\r
94
+ --noteloom-danger-soft: #fef2f2;\r
95
+ --noteloom-code-bg: #0f172a;\r
96
+ }\r
97
+ \r
98
+ .be-root {\r
99
+ font-family: var(--noteloom-font);\r
100
+ color: var(--noteloom-text);\r
101
+ }\r
102
+ \r
103
+ .be-editable {\r
104
+ outline: none;\r
105
+ }\r
106
+ \r
107
+ /* --- basic leaf blocks --- */\r
108
+ \r
109
+ .be-paragraph {\r
110
+ position: relative;\r
111
+ margin: 0.25rem 0;\r
112
+ line-height: 1.6;\r
113
+ outline: none;\r
114
+ }\r
115
+ \r
116
+ .be-heading {\r
117
+ position: relative;\r
118
+ font-weight: 600;\r
119
+ margin: 1.25rem 0 0.25rem;\r
120
+ outline: none;\r
121
+ letter-spacing: -0.01em;\r
122
+ }\r
123
+ \r
124
+ /* Explicit per-level sizing, each in its own overridable class — without\r
125
+ this, h1/h2/h3 only differ via the browser's own UA-stylesheet defaults\r
126
+ (inconsistent across browsers, and not something a host can target\r
127
+ independently without fighting tag-selector specificity). Override just\r
128
+ one level with \`.be-heading-1 { font-size: ...; }\` in your own CSS, same\r
129
+ as any other .be-* class. */\r
130
+ .be-heading-1 {\r
131
+ font-size: 1.9em;\r
132
+ }\r
133
+ \r
134
+ .be-heading-2 {\r
135
+ font-size: 1.5em;\r
136
+ }\r
137
+ \r
138
+ .be-heading-3 {\r
139
+ font-size: 1.2em;\r
140
+ }\r
141
+ \r
142
+ .be-divider {\r
143
+ border: none;\r
144
+ border-top: 1px solid var(--noteloom-border);\r
145
+ margin: 1.5em 0;\r
146
+ cursor: default;\r
147
+ }\r
148
+ \r
149
+ .be-blockquote {\r
150
+ position: relative;\r
151
+ margin: 0.5em 0;\r
152
+ padding-left: 0.9em;\r
153
+ border-left: 3px solid var(--noteloom-border);\r
154
+ color: var(--noteloom-text-muted);\r
155
+ outline: none;\r
156
+ }\r
157
+ \r
158
+ /* --- callout --- */\r
159
+ \r
160
+ .be-callout {\r
161
+ position: relative;\r
162
+ display: flex;\r
163
+ gap: 0.7em;\r
164
+ align-items: flex-start;\r
165
+ background: var(--noteloom-bg-subtle);\r
166
+ border-radius: var(--noteloom-radius-lg);\r
167
+ padding: 0.9em 1em;\r
168
+ margin: 0.5em 0;\r
169
+ }\r
170
+ \r
171
+ .be-callout[data-color='gray'] { background: rgba(148, 163, 184, 0.16); }\r
172
+ .be-callout[data-color='blue'] { background: rgba(99, 102, 241, 0.12); }\r
173
+ .be-callout[data-color='green'] { background: rgba(34, 197, 94, 0.14); }\r
174
+ .be-callout[data-color='yellow'] { background: rgba(234, 179, 8, 0.16); }\r
175
+ .be-callout[data-color='orange'] { background: rgba(249, 115, 22, 0.14); }\r
176
+ .be-callout[data-color='red'] { background: rgba(239, 68, 68, 0.13); }\r
177
+ .be-callout[data-color='purple'] { background: rgba(168, 85, 247, 0.13); }\r
178
+ .be-callout[data-color='pink'] { background: rgba(236, 72, 153, 0.13); }\r
179
+ \r
180
+ .be-callout-icon-wrap {\r
181
+ flex: none;\r
182
+ }\r
183
+ \r
184
+ .be-callout-icon-input,\r
185
+ .be-callout-icon {\r
186
+ width: 2em;\r
187
+ height: 2em;\r
188
+ border: none;\r
189
+ background: var(--noteloom-bg);\r
190
+ border-radius: var(--noteloom-radius-md);\r
191
+ box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);\r
192
+ font-size: 1.15em;\r
193
+ display: flex;\r
194
+ align-items: center;\r
195
+ justify-content: center;\r
196
+ padding: 0;\r
197
+ cursor: pointer;\r
198
+ }\r
199
+ \r
200
+ .be-callout-icon-input {\r
201
+ outline: none;\r
202
+ text-align: center;\r
203
+ cursor: text;\r
204
+ }\r
205
+ \r
206
+ .be-callout-content {\r
207
+ flex: 1;\r
208
+ min-width: 0;\r
209
+ padding-right: 1.6em; /* keeps text from running under the color-swatch trigger */\r
210
+ }\r
211
+ \r
212
+ /* First child reads as the card's title; every child after it is the\r
213
+ description — see CalloutBlock.jsx's comment for why this is a CSS\r
214
+ convention over the content, not a separate title/description field. */\r
215
+ .be-callout-content > :first-child {\r
216
+ font-weight: 600;\r
217
+ }\r
218
+ \r
219
+ .be-callout-content > :not(:first-child) {\r
220
+ color: var(--noteloom-text-muted);\r
221
+ font-size: 0.92em;\r
222
+ }\r
223
+ \r
224
+ .be-callout-color-wrap {\r
225
+ position: absolute;\r
226
+ top: 0.6em;\r
227
+ right: 0.6em;\r
228
+ }\r
229
+ \r
230
+ .be-callout-color-trigger {\r
231
+ border: none;\r
232
+ background: none;\r
233
+ padding: 3px;\r
234
+ border-radius: var(--noteloom-radius-sm);\r
235
+ cursor: pointer;\r
236
+ display: flex;\r
237
+ }\r
238
+ \r
239
+ .be-callout-color-trigger:hover {\r
240
+ background: rgba(15, 23, 42, 0.06);\r
241
+ }\r
242
+ \r
243
+ .be-callout-color-dot {\r
244
+ width: 12px;\r
245
+ height: 12px;\r
246
+ border-radius: 50%;\r
247
+ border: 1px solid rgba(15, 23, 42, 0.12);\r
248
+ }\r
249
+ \r
250
+ .be-callout-color-dot-gray { background: #94a3b8; }\r
251
+ .be-callout-color-dot-blue { background: #6366f1; }\r
252
+ .be-callout-color-dot-green { background: #22c55e; }\r
253
+ .be-callout-color-dot-yellow { background: #eab308; }\r
254
+ .be-callout-color-dot-orange { background: #f97316; }\r
255
+ .be-callout-color-dot-red { background: #ef4444; }\r
256
+ .be-callout-color-dot-purple { background: #a855f7; }\r
257
+ .be-callout-color-dot-pink { background: #ec4899; }\r
258
+ \r
259
+ .be-callout-color-picker {\r
260
+ position: absolute;\r
261
+ top: 100%;\r
262
+ right: 0;\r
263
+ margin-top: 4px;\r
264
+ z-index: 1000;\r
265
+ display: grid;\r
266
+ grid-template-columns: repeat(4, 1fr);\r
267
+ gap: 4px;\r
268
+ padding: 6px;\r
269
+ background: var(--noteloom-bg);\r
270
+ border: 1px solid var(--noteloom-border);\r
271
+ border-radius: var(--noteloom-radius-md);\r
272
+ box-shadow: var(--noteloom-shadow);\r
273
+ }\r
274
+ \r
275
+ .be-callout-color-option {\r
276
+ width: 22px;\r
277
+ height: 22px;\r
278
+ border-radius: 50%;\r
279
+ border: 2px solid transparent;\r
280
+ cursor: pointer;\r
281
+ padding: 0;\r
282
+ }\r
283
+ \r
284
+ .be-callout-color-option-gray { background: #94a3b8; }\r
285
+ .be-callout-color-option-blue { background: #6366f1; }\r
286
+ .be-callout-color-option-green { background: #22c55e; }\r
287
+ .be-callout-color-option-yellow { background: #eab308; }\r
288
+ .be-callout-color-option-orange { background: #f97316; }\r
289
+ .be-callout-color-option-red { background: #ef4444; }\r
290
+ .be-callout-color-option-purple { background: #a855f7; }\r
291
+ .be-callout-color-option-pink { background: #ec4899; }\r
292
+ \r
293
+ .be-callout-color-option-active {\r
294
+ border-color: var(--noteloom-text);\r
295
+ }\r
296
+ \r
297
+ /* --- code block --- */\r
298
+ \r
299
+ .be-code-block {\r
300
+ margin: 0.6em 0;\r
301
+ border-radius: var(--noteloom-radius-lg);\r
302
+ overflow: hidden;\r
303
+ background: var(--noteloom-code-bg);\r
304
+ color: var(--noteloom-code-text);\r
305
+ }\r
306
+ \r
307
+ .be-code-block-header {\r
308
+ display: flex;\r
309
+ align-items: center;\r
310
+ justify-content: flex-end;\r
311
+ gap: 4px;\r
312
+ padding: 6px 10px;\r
313
+ background: rgba(255, 255, 255, 0.04);\r
314
+ }\r
315
+ \r
316
+ .be-code-block-delete {\r
317
+ appearance: none;\r
318
+ -webkit-appearance: none;\r
319
+ border: none;\r
320
+ outline: none;\r
321
+ background: transparent;\r
322
+ box-shadow: none;\r
323
+ color: var(--noteloom-text-faint);\r
324
+ width: 24px;\r
325
+ height: 24px;\r
326
+ margin: 0;\r
327
+ padding: 0;\r
328
+ display: flex;\r
329
+ align-items: center;\r
330
+ justify-content: center;\r
331
+ border-radius: var(--noteloom-radius-sm);\r
332
+ cursor: pointer;\r
333
+ }\r
334
+ \r
335
+ .be-code-block-delete:hover {\r
336
+ background: rgba(255, 255, 255, 0.1);\r
337
+ color: #fca5a5;\r
338
+ }\r
339
+ \r
340
+ .be-code-block-language {\r
341
+ background: transparent;\r
342
+ color: var(--noteloom-text-faint);\r
343
+ border: none;\r
344
+ font-size: 0.8rem;\r
345
+ cursor: pointer;\r
346
+ }\r
347
+ \r
348
+ .be-code-block-pre {\r
349
+ margin: 0;\r
350
+ padding: 0.9em 1em;\r
351
+ overflow-x: auto;\r
352
+ font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;\r
353
+ font-size: 0.88rem;\r
354
+ outline: none;\r
355
+ }\r
356
+ \r
357
+ .be-code-block-pre code {\r
358
+ position: relative;\r
359
+ display: block;\r
360
+ }\r
361
+ \r
362
+ /* --- list items (bulleted / numbered / to-do / toggle) --- */\r
363
+ \r
364
+ .be-list-item {\r
365
+ margin: 0.1rem 0;\r
366
+ }\r
367
+ \r
368
+ .be-list-item-row {\r
369
+ display: flex;\r
370
+ align-items: flex-start;\r
371
+ gap: 0.4em;\r
372
+ }\r
373
+ \r
374
+ .be-list-checkbox {\r
375
+ margin-top: 0.3em;\r
376
+ width: 16px;\r
377
+ height: 16px;\r
378
+ flex: none;\r
379
+ accent-color: var(--noteloom-accent);\r
380
+ cursor: pointer;\r
381
+ }\r
382
+ \r
383
+ .be-list-toggle-marker {\r
384
+ border: none;\r
385
+ background: none;\r
386
+ cursor: pointer;\r
387
+ padding: 2px;\r
388
+ margin-top: 0.1em;\r
389
+ color: var(--noteloom-text-faint);\r
390
+ display: flex;\r
391
+ align-items: center;\r
392
+ justify-content: center;\r
393
+ height: 30px;\r
394
+ width: 30px;\r
395
+ border-radius: var(--noteloom-radius-sm);\r
396
+ }\r
397
+ \r
398
+ .be-list-toggle-marker:hover {\r
399
+ background: var(--noteloom-bg-hover);\r
400
+ color: var(--noteloom-text-muted);\r
401
+ }\r
402
+ \r
403
+ .be-list-marker {\r
404
+ min-width: 1.2em;\r
405
+ margin-top: 0.1em;\r
406
+ text-align: center;\r
407
+ color: var(--noteloom-text-faint);\r
408
+ user-select: none;\r
409
+ flex: none;\r
410
+ }\r
411
+ \r
412
+ .be-list-item-title {\r
413
+ position: relative;\r
414
+ flex: 1;\r
415
+ min-width: 0;\r
416
+ outline: none;\r
417
+ line-height: 1.6;\r
418
+ }\r
419
+ \r
420
+ .be-list-item-children {\r
421
+ margin-left: 2.1em;\r
422
+ }\r
423
+ \r
424
+ /* --- toggle heading --- */\r
425
+ \r
426
+ .be-toggle-heading {\r
427
+ margin: 1.25rem 0 0.25rem;\r
428
+ }\r
429
+ \r
430
+ .be-toggle-heading-row {\r
431
+ display: flex;\r
432
+ align-items: center;\r
433
+ gap: 0.15em;\r
434
+ }\r
435
+ \r
436
+ .be-toggle-heading-marker {\r
437
+ border: none;\r
438
+ background: none;\r
439
+ cursor: pointer;\r
440
+ color: var(--noteloom-text-faint);\r
441
+ display: flex;\r
442
+ align-items: center;\r
443
+ justify-content: center;\r
444
+ width: 30px;\r
445
+ height: 30px;\r
446
+ border-radius: var(--noteloom-radius-sm);\r
447
+ }\r
448
+ \r
449
+ .be-toggle-heading-marker:hover {\r
450
+ background: var(--noteloom-bg-hover);\r
451
+ color: var(--noteloom-text-muted);\r
452
+ }\r
453
+ \r
454
+ .be-toggle-heading-title {\r
455
+ flex: 1;\r
456
+ min-width: 0;\r
457
+ }\r
458
+ \r
459
+ .be-toggle-heading-children {\r
460
+ margin-left: 2.1em;\r
461
+ }\r
462
+ \r
463
+ /* --- layout (multi-column) --- */\r
464
+ \r
465
+ .be-layout {\r
466
+ margin: 0.6em 0;\r
467
+ }\r
468
+ \r
469
+ .be-layout-column {\r
470
+ flex: 1;\r
471
+ min-width: 0;\r
472
+ }\r
473
+ \r
474
+ /* --- button block --- */\r
475
+ \r
476
+ .be-button-block {\r
477
+ margin: 0.6em 0;\r
478
+ }\r
479
+ \r
480
+ .be-button-block-pill {\r
481
+ display: inline-flex;\r
482
+ align-items: center;\r
483
+ gap: 0.4em;\r
484
+ border-radius: var(--noteloom-radius-md);\r
485
+ padding: 0.5em 1em;\r
486
+ color: var(--noteloom-accent-text);\r
487
+ }\r
488
+ \r
489
+ .be-button-block-label {\r
490
+ position: relative;\r
491
+ outline: none;\r
492
+ min-width: 2em;\r
493
+ }\r
494
+ \r
495
+ /* --- generic empty-state placeholder for editable leaf content ---\r
496
+ Note: this can't use :empty — an "empty" run still holds a zero-width\r
497
+ space text node (see EMPTY_RUN_PLACEHOLDER) inside its host span, so the\r
498
+ wrapper element is never actually childless. data-empty (kept in sync by\r
499
+ EditableBlockContent's syncEmptyAttr against the *logical* run content,\r
500
+ not the DOM) is the real signal. */\r
501
+ \r
502
+ [data-placeholder][data-empty]:focus-within::before {\r
503
+ content: attr(data-placeholder);\r
504
+ position: absolute;\r
505
+ color: var(--noteloom-text-faint);\r
506
+ font-weight: 400;\r
507
+ font-style: normal;\r
508
+ opacity: 0.85;\r
509
+ pointer-events: none;\r
510
+ }\r
511
+ \r
512
+ .be-button-block-open,\r
513
+ .be-button-block-settings {\r
514
+ flex: none;\r
515
+ border: none;\r
516
+ background: rgba(255, 255, 255, 0.16);\r
517
+ color: inherit;\r
518
+ border-radius: var(--noteloom-radius-sm);\r
519
+ width: 24px;\r
520
+ height: 24px;\r
521
+ display: flex;\r
522
+ align-items: center;\r
523
+ justify-content: center;\r
524
+ cursor: pointer;\r
525
+ }\r
526
+ \r
527
+ .be-button-block-open:disabled {\r
528
+ opacity: 0.5;\r
529
+ cursor: not-allowed;\r
530
+ }\r
531
+ \r
532
+ .be-button-block-open:hover:not(:disabled),\r
533
+ .be-button-block-settings:hover {\r
534
+ background: rgba(255, 255, 255, 0.28);\r
535
+ }\r
536
+ \r
537
+ /* --- embed (image/video/audio/file) --- */\r
538
+ \r
539
+ .be-embed {\r
540
+ margin: 0.6em 0;\r
541
+ }\r
542
+ \r
543
+ .be-embed-preview {\r
544
+ position: relative;\r
545
+ display: flex;\r
546
+ }\r
547
+ \r
548
+ .be-embed-align-left {\r
549
+ justify-content: flex-start;\r
550
+ }\r
551
+ \r
552
+ .be-embed-align-center {\r
553
+ justify-content: center;\r
554
+ }\r
555
+ \r
556
+ .be-embed-align-right {\r
557
+ justify-content: flex-end;\r
558
+ }\r
559
+ \r
560
+ .be-embed-frame {\r
561
+ position: relative;\r
562
+ max-width: 100%;\r
563
+ overflow: visible;\r
564
+ border-radius: var(--noteloom-radius-lg);\r
565
+ }\r
566
+ \r
567
+ .be-embed-image,\r
568
+ .be-embed-video {\r
569
+ border: 1px solid var(--noteloom-border);\r
570
+ }\r
571
+ \r
572
+ .be-embed-image,\r
573
+ .be-embed-video {\r
574
+ max-width: 100%;\r
575
+ display: block;\r
576
+ border-radius: var(--noteloom-radius-lg);\r
577
+ }\r
578
+ \r
579
+ .be-embed-audio {\r
580
+ width: 100%;\r
581
+ }\r
582
+ \r
583
+ .be-embed-file-link {\r
584
+ display: flex;\r
585
+ align-items: center;\r
586
+ gap: 0.5em;\r
587
+ padding: 0.75em 1em;\r
588
+ border: 1px solid var(--noteloom-border);\r
589
+ border-radius: var(--noteloom-radius-xl);\r
590
+ text-decoration: none;\r
591
+ color: var(--noteloom-accent);\r
592
+ font-weight: 500;\r
593
+ font-size: 0.9rem;\r
594
+ }\r
595
+ \r
596
+ .be-embed-file-link:hover {\r
597
+ background: var(--noteloom-bg-subtle);\r
598
+ }\r
599
+ \r
600
+ .be-embed-toolbar {\r
601
+ position: absolute;\r
602
+ top: 8px;\r
603
+ right: 8px;\r
604
+ z-index: 2;\r
605
+ display: flex;\r
606
+ align-items: center;\r
607
+ gap: 2px;\r
608
+ padding: 3px;\r
609
+ background: rgba(15, 23, 42, 0.72);\r
610
+ border-radius: var(--noteloom-radius-md);\r
611
+ opacity: 0;\r
612
+ transition: opacity 0.12s ease;\r
613
+ }\r
614
+ \r
615
+ .be-embed-preview:hover .be-embed-toolbar,\r
616
+ .be-embed-toolbar:focus-within {\r
617
+ opacity: 1;\r
618
+ }\r
619
+ \r
620
+ .be-embed-toolbar-btn {\r
621
+ border: none;\r
622
+ background: transparent;\r
623
+ width: 24px;\r
624
+ height: 24px;\r
625
+ display: flex;\r
626
+ align-items: center;\r
627
+ justify-content: center;\r
628
+ color: rgba(255, 255, 255, 0.8);\r
629
+ border-radius: var(--noteloom-radius-sm);\r
630
+ cursor: pointer;\r
631
+ }\r
632
+ \r
633
+ .be-embed-toolbar-btn:hover {\r
634
+ background: rgba(255, 255, 255, 0.16);\r
635
+ color: #fff;\r
636
+ }\r
637
+ \r
638
+ .be-embed-toolbar-btn-active {\r
639
+ background: var(--noteloom-accent);\r
640
+ color: #fff;\r
641
+ }\r
642
+ \r
643
+ .be-embed-remove {\r
644
+ border: none;\r
645
+ background: transparent;\r
646
+ border-radius: var(--noteloom-radius-sm);\r
647
+ padding: 0 8px;\r
648
+ height: 24px;\r
649
+ color: rgba(255, 255, 255, 0.8);\r
650
+ font-size: 0.75rem;\r
651
+ cursor: pointer;\r
652
+ }\r
653
+ \r
654
+ .be-embed-remove:hover {\r
655
+ background: rgba(255, 255, 255, 0.16);\r
656
+ color: #fff;\r
657
+ }\r
658
+ \r
659
+ .be-embed-resize-handle {\r
660
+ position: absolute;\r
661
+ bottom: 4px;\r
662
+ right: 4px;\r
663
+ width: 12px;\r
664
+ height: 12px;\r
665
+ cursor: nwse-resize;\r
666
+ border-radius: 2px;\r
667
+ border: 1px solid #fff;\r
668
+ background: var(--noteloom-accent);\r
669
+ }\r
670
+ \r
671
+ .be-embed-dropzone {\r
672
+ border: 1.5px dashed var(--noteloom-border);\r
673
+ border-radius: var(--noteloom-radius-xl);\r
674
+ padding: 2.2em;\r
675
+ display: flex;\r
676
+ flex-direction: column;\r
677
+ align-items: center;\r
678
+ gap: 0.6em;\r
679
+ text-align: center;\r
680
+ color: var(--noteloom-text-muted);\r
681
+ }\r
682
+ \r
683
+ .be-embed-dropzone-active {\r
684
+ border-color: var(--noteloom-accent);\r
685
+ background: var(--noteloom-accent-soft);\r
686
+ color: var(--noteloom-accent);\r
687
+ }\r
688
+ \r
689
+ .be-embed-upload-btn {\r
690
+ background: var(--noteloom-accent);\r
691
+ color: var(--noteloom-accent-text);\r
692
+ border-radius: var(--noteloom-radius-md);\r
693
+ padding: 0.5em 1.1em;\r
694
+ cursor: pointer;\r
695
+ font-size: 0.85rem;\r
696
+ font-weight: 500;\r
697
+ }\r
698
+ \r
699
+ .be-embed-upload-btn input {\r
700
+ display: none;\r
701
+ }\r
702
+ \r
703
+ .be-embed-dropzone-hint {\r
704
+ font-size: 0.8rem;\r
705
+ color: var(--noteloom-text-faint);\r
706
+ }\r
707
+ \r
708
+ .be-embed-url-row {\r
709
+ display: flex;\r
710
+ gap: 6px;\r
711
+ width: 100%;\r
712
+ max-width: 360px;\r
713
+ }\r
714
+ \r
715
+ .be-embed-url-input {\r
716
+ flex: 1;\r
717
+ min-width: 0;\r
718
+ border: 1px solid var(--noteloom-border);\r
719
+ border-radius: var(--noteloom-radius-md);\r
720
+ padding: 0.45em 0.7em;\r
721
+ background: transparent;\r
722
+ color: inherit;\r
723
+ font: inherit;\r
724
+ font-size: 0.85rem;\r
725
+ outline: none;\r
726
+ }\r
727
+ \r
728
+ .be-embed-url-input:focus {\r
729
+ border-color: var(--noteloom-accent);\r
730
+ }\r
731
+ \r
732
+ .be-embed-url-commit {\r
733
+ border: none;\r
734
+ background: var(--noteloom-accent);\r
735
+ color: var(--noteloom-accent-text);\r
736
+ border-radius: var(--noteloom-radius-md);\r
737
+ padding: 0.45em 0.9em;\r
738
+ cursor: pointer;\r
739
+ font-size: 0.85rem;\r
740
+ font-weight: 500;\r
741
+ }\r
742
+ \r
743
+ /* --- table --- */\r
744
+ \r
745
+ .be-table-scroll {\r
746
+ max-width: 100%;\r
747
+ overflow-x: auto;\r
748
+ }\r
749
+ \r
750
+ .be-table-wrapper {\r
751
+ margin: 0.9em 0;\r
752
+ overflow-x: auto;\r
753
+ border: 1px solid var(--noteloom-border);\r
754
+ border-radius: var(--noteloom-radius-lg);\r
755
+ width: max-content;\r
756
+ }\r
757
+ \r
758
+ .be-table {\r
759
+ border-collapse: collapse;\r
760
+ table-layout: fixed;\r
761
+ /* Deliberately no width:100% — combined with table-layout:fixed and each\r
762
+ column's own <col> width, that would make the browser redistribute\r
763
+ leftover space proportionally across columns, fighting individual\r
764
+ column resize (see be-table-col-resize-handle). */\r
765
+ }\r
766
+ \r
767
+ .be-table-header-row {\r
768
+ background: var(--noteloom-bg-subtle);\r
769
+ }\r
770
+ \r
771
+ .be-table-header-cell {\r
772
+ position: relative;\r
773
+ border-bottom: 1px solid var(--noteloom-border);\r
774
+ border-right: 1px solid var(--noteloom-border);\r
775
+ padding: 6px 10px;\r
776
+ }\r
777
+ \r
778
+ .be-table-header-label {\r
779
+ display: block;\r
780
+ width: 100%;\r
781
+ border: none;\r
782
+ background: none;\r
783
+ font: inherit;\r
784
+ font-weight: 600;\r
785
+ font-size: 0.78rem;\r
786
+ color: var(--noteloom-text-muted);\r
787
+ outline: none;\r
788
+ overflow: hidden;\r
789
+ text-overflow: ellipsis;\r
790
+ white-space: nowrap;\r
791
+ padding: 2px 0;\r
792
+ }\r
793
+ \r
794
+ .be-table-header-menu-trigger {\r
795
+ position: absolute;\r
796
+ right: 4px;\r
797
+ top: 50%;\r
798
+ transform: translateY(-50%);\r
799
+ visibility: hidden;\r
800
+ border: none;\r
801
+ background: transparent;\r
802
+ border-radius: var(--noteloom-radius-sm);\r
803
+ padding: 2px;\r
804
+ color: var(--noteloom-text-faint);\r
805
+ cursor: pointer;\r
806
+ }\r
807
+ \r
808
+ .be-table-header-cell:hover .be-table-header-menu-trigger {\r
809
+ visibility: visible;\r
810
+ }\r
811
+ \r
812
+ .be-table-header-menu-trigger:hover {\r
813
+ background: var(--noteloom-bg-hover);\r
814
+ }\r
815
+ \r
816
+ .be-table-col-resize-handle {\r
817
+ position: absolute;\r
818
+ top: 0;\r
819
+ right: -3px;\r
820
+ width: 6px;\r
821
+ height: 100%;\r
822
+ cursor: col-resize;\r
823
+ z-index: 1;\r
824
+ }\r
825
+ \r
826
+ .be-table-col-resize-handle:hover,\r
827
+ .be-table-col-resize-handle:active {\r
828
+ background: var(--noteloom-accent-soft-hover);\r
829
+ }\r
830
+ \r
831
+ .be-table-header-spacer {\r
832
+ border-bottom: 1px solid var(--noteloom-border);\r
833
+ }\r
834
+ \r
835
+ .be-table-header-spacer-col {\r
836
+ width: 32px;\r
837
+ }\r
838
+ \r
839
+ .be-table-header-menu {\r
840
+ z-index: 1000;\r
841
+ width: 224px;\r
842
+ border-radius: var(--noteloom-radius-lg);\r
843
+ border: 1px solid var(--noteloom-border);\r
844
+ background: var(--noteloom-bg);\r
845
+ padding: 4px;\r
846
+ font-size: 0.88rem;\r
847
+ box-shadow: var(--noteloom-shadow);\r
848
+ }\r
849
+ \r
850
+ .be-table-header-menu-options {\r
851
+ z-index: 1000;\r
852
+ padding: 4px;\r
853
+ font-size: 0.88rem;\r
854
+ border-bottom: 1px solid var(--noteloom-border);\r
855
+ margin-bottom: 4px;\r
856
+ }\r
857
+ \r
858
+ .be-table-header-menu-type {\r
859
+ display: flex;\r
860
+ flex-direction: row;\r
861
+ justify-content: space-between;\r
862
+ padding: 6px;\r
863
+ border-bottom: 1px solid var(--noteloom-border);\r
864
+ margin-bottom: 4px;\r
865
+ }\r
866
+ \r
867
+ .be-table-header-type-select {\r
868
+ width: 100%;\r
869
+ border: 1px solid var(--noteloom-border);\r
870
+ border-radius: var(--noteloom-radius-sm);\r
871
+ padding: 6px 8px;\r
872
+ background: transparent;\r
873
+ color: inherit;\r
874
+ font: inherit;\r
875
+ font-size: 0.85rem;\r
876
+ }\r
877
+ \r
878
+ .be-table-header-menu-item {\r
879
+ display: flex;\r
880
+ align-items: center;\r
881
+ gap: 8px;\r
882
+ width: 100%;\r
883
+ text-align: left;\r
884
+ border: none;\r
885
+ border-radius: var(--noteloom-radius-sm);\r
886
+ background: transparent;\r
887
+ padding: 6px 10px;\r
888
+ font: inherit;\r
889
+ font-size: 0.88rem;\r
890
+ color: var(--noteloom-text);\r
891
+ cursor: pointer;\r
892
+ }\r
893
+ \r
894
+ .be-table-header-menu-item:hover {\r
895
+ background: var(--noteloom-bg-hover);\r
896
+ }\r
897
+ \r
898
+ .be-table-header-menu-item-danger {\r
899
+ color: var(--noteloom-danger);\r
900
+ }\r
901
+ \r
902
+ .be-table-header-menu-item-danger:hover {\r
903
+ background: var(--noteloom-danger-soft);\r
904
+ }\r
905
+ \r
906
+ .be-table-header-menu-options-label {\r
907
+ font-size: 0.68rem;\r
908
+ text-transform: uppercase;\r
909
+ letter-spacing: 0.04em;\r
910
+ font-weight: 600;\r
911
+ color: var(--noteloom-text-faint);\r
912
+ padding: 6px 8px 2px;\r
913
+ }\r
914
+ \r
915
+ .be-table-header-menu-option-row {\r
916
+ display: flex;\r
917
+ align-items: center;\r
918
+ gap: 6px;\r
919
+ padding: 2px 4px;\r
920
+ }\r
921
+ \r
922
+ .be-table-header-menu-option-swatch {\r
923
+ width: 14px;\r
924
+ height: 14px;\r
925
+ border-radius: 50%;\r
926
+ flex: none;\r
927
+ }\r
928
+ \r
929
+ .be-table-header-menu-option-input {\r
930
+ flex: 1;\r
931
+ min-width: 0;\r
932
+ border: none;\r
933
+ background: transparent;\r
934
+ color: inherit;\r
935
+ font: inherit;\r
936
+ font-size: 0.85rem;\r
937
+ padding: 4px 6px;\r
938
+ border-radius: var(--noteloom-radius-sm);\r
939
+ outline: none;\r
940
+ }\r
941
+ \r
942
+ .be-table-header-menu-option-input:focus {\r
943
+ background: var(--noteloom-bg-hover);\r
944
+ }\r
945
+ \r
946
+ .be-table-header-menu-option-remove,\r
947
+ .be-table-header-menu-option-add {\r
948
+ flex: none;\r
949
+ border: none;\r
950
+ background: transparent;\r
951
+ color: var(--noteloom-text-faint);\r
952
+ cursor: pointer;\r
953
+ padding: 3px;\r
954
+ display: flex;\r
955
+ align-items: center;\r
956
+ justify-content: center;\r
957
+ border-radius: var(--noteloom-radius-sm);\r
958
+ }\r
959
+ \r
960
+ .be-table-header-menu-option-remove:hover {\r
961
+ background: var(--noteloom-danger-soft);\r
962
+ color: var(--noteloom-danger);\r
963
+ }\r
964
+ \r
965
+ .be-table-header-menu-option-add {\r
966
+ color: var(--noteloom-text-muted);\r
967
+ }\r
968
+ \r
969
+ .be-table-header-menu-option-add:hover {\r
970
+ background: var(--noteloom-bg-hover);\r
971
+ }\r
972
+ \r
973
+ .be-table-row:hover {\r
974
+ background: var(--noteloom-bg-subtle);\r
975
+ }\r
976
+ \r
977
+ .be-table-cell {\r
978
+ border-bottom: 1px solid var(--noteloom-border);\r
979
+ border-right: 1px solid var(--noteloom-border);\r
980
+ padding: 6px 10px;\r
981
+ vertical-align: top;\r
982
+ outline: none;\r
983
+ font-size: 0.92rem;\r
984
+ /* table-layout: fixed already keeps the COLUMN width from growing to fit\r
985
+ content — this is what stops a long unbroken string (a URL, one giant\r
986
+ word) from visually overflowing past that fixed width instead of\r
987
+ wrapping onto a new line within the cell. */\r
988
+ max-width: 0;\r
989
+ overflow-wrap: anywhere;\r
990
+ word-break: break-word;\r
991
+ }\r
992
+ \r
993
+ .be-table-cell:focus-within {\r
994
+ box-shadow: inset 0 0 0 2px var(--noteloom-accent);\r
995
+ border-radius: 2px;\r
996
+ }\r
997
+ \r
998
+ .be-table-row-actions {\r
999
+ width: 32px;\r
1000
+ text-align: center;\r
1001
+ vertical-align: middle;\r
1002
+ border: none;\r
1003
+ background: transparent;\r
1004
+ padding: 0;\r
1005
+ }\r
1006
+ \r
1007
+ .be-table-delete-row {\r
1008
+ visibility: hidden;\r
1009
+ border: none;\r
1010
+ background: transparent;\r
1011
+ color: var(--noteloom-text-faint);\r
1012
+ cursor: pointer;\r
1013
+ width: 24px;\r
1014
+ height: 24px;\r
1015
+ display: inline-flex;\r
1016
+ align-items: center;\r
1017
+ justify-content: center;\r
1018
+ border-radius: var(--noteloom-radius-sm);\r
1019
+ }\r
1020
+ \r
1021
+ tr.be-table-row:hover .be-table-delete-row {\r
1022
+ visibility: visible;\r
1023
+ }\r
1024
+ \r
1025
+ .be-table-delete-row:hover {\r
1026
+ background: var(--noteloom-danger-soft);\r
1027
+ color: var(--noteloom-danger);\r
1028
+ }\r
1029
+ \r
1030
+ .be-table-add-row {\r
1031
+ display: block;\r
1032
+ width: 100%;\r
1033
+ border: none;\r
1034
+ background: transparent;\r
1035
+ text-align: left;\r
1036
+ padding: 8px 12px;\r
1037
+ color: var(--noteloom-text-faint);\r
1038
+ cursor: pointer;\r
1039
+ font: inherit;\r
1040
+ font-size: 0.85rem;\r
1041
+ font-weight: 500;\r
1042
+ }\r
1043
+ \r
1044
+ .be-table-add-row:hover {\r
1045
+ background: var(--noteloom-bg-subtle);\r
1046
+ color: var(--noteloom-accent);\r
1047
+ }\r
1048
+ \r
1049
+ .be-inline-table-select {\r
1050
+ display: block;\r
1051
+ }\r
1052
+ \r
1053
+ .be-inline-table-select .be-select {\r
1054
+ width: 100%;\r
1055
+ }\r
1056
+ \r
1057
+ .be-inline-table-select .be-select .be-select-tag {\r
1058
+ width: -webkit-fill-available;\r
1059
+ }\r
1060
+ \r
1061
+ .be-inline-table-select .be-select-trigger {\r
1062
+ display: flex;\r
1063
+ width: 100%;\r
1064
+ min-width: 0;\r
1065
+ min-height: 0;\r
1066
+ border: none;\r
1067
+ border-radius: var(--noteloom-radius-sm);\r
1068
+ background: transparent;\r
1069
+ padding: 0;\r
1070
+ font: inherit;\r
1071
+ font-size: 0.92rem;\r
1072
+ }\r
1073
+ \r
1074
+ .be-inline-table-select .be-select-trigger:hover,\r
1075
+ .be-inline-table-select .be-select-trigger[aria-expanded='true'] {\r
1076
+ background: var(--noteloom-bg-hover);\r
1077
+ box-shadow: none;\r
1078
+ }\r
1079
+ \r
1080
+ /* --- per-block hover gutter (+ / drag-handle / menu) --- */\r
1081
+ \r
1082
+ .be-block-row {\r
1083
+ position: relative;\r
1084
+ }\r
1085
+ \r
1086
+ .be-block-row-hidden {\r
1087
+ opacity: 0.4;\r
1088
+ }\r
1089
+ \r
1090
+ .be-block-gutter {\r
1091
+ position: absolute;\r
1092
+ left: -56px;\r
1093
+ top: 0.15em;\r
1094
+ display: flex;\r
1095
+ gap: 2px;\r
1096
+ opacity: 0;\r
1097
+ transition: opacity 0.1s ease;\r
1098
+ user-select: none; /* it's a drag handle (see useBlockRangeDrag) — never let its own space become selectable text */\r
1099
+ }\r
1100
+ \r
1101
+ .be-block-row:hover .be-block-gutter,\r
1102
+ .be-block-gutter-active {\r
1103
+ opacity: 1;\r
1104
+ }\r
1105
+ \r
1106
+ .be-block-gutter-btn {\r
1107
+ display: flex;\r
1108
+ align-items: center;\r
1109
+ justify-content: center;\r
1110
+ width: 24px;\r
1111
+ height: 24px;\r
1112
+ border: none;\r
1113
+ border-radius: var(--noteloom-radius-sm);\r
1114
+ background: transparent;\r
1115
+ color: var(--noteloom-text-faint);\r
1116
+ cursor: pointer;\r
1117
+ transition: background-color 0.12s ease, color 0.12s ease;\r
1118
+ }\r
1119
+ \r
1120
+ /* Touch: no hover state exists to reveal the gutter at all, and its\r
1121
+ desktop position (left: -56px, sitting in the page's own side margin)\r
1122
+ would be off-screen on a narrow phone/tablet viewport regardless — so\r
1123
+ rather than force it into the row itself, its two actions (Add block,\r
1124
+ block options menu) live inside MobileActionBar instead (see\r
1125
+ MobileActionBar.jsx), pinned above the keyboard where they're always\r
1126
+ reachable. \`.be-touch-input\` is set by useCoarsePointer.js, based on\r
1127
+ real pointerdown activity, not just a static device-capability guess —\r
1128
+ see that file for why a plain \`pointer: coarse\` media query alone isn't\r
1129
+ enough (touchscreen laptops, etc.). */\r
1130
+ .be-touch-input .be-block-gutter {\r
1131
+ display: none;\r
1132
+ }\r
1133
+ \r
1134
+ .be-block-gutter-btn:hover,\r
1135
+ .be-block-gutter-btn[aria-expanded='true'] {\r
1136
+ background: var(--noteloom-bg-hover);\r
1137
+ color: var(--noteloom-text);\r
1138
+ }\r
1139
+ \r
1140
+ .be-block-gutter-menu,\r
1141
+ .be-block-range-menu {\r
1142
+ z-index: 1000;\r
1143
+ min-width: 200px;\r
1144
+ background: var(--noteloom-bg);\r
1145
+ border: 1px solid var(--noteloom-border);\r
1146
+ border-radius: var(--noteloom-radius-lg);\r
1147
+ box-shadow: var(--noteloom-shadow);\r
1148
+ padding: 4px;\r
1149
+ }\r
1150
+ \r
1151
+ .be-block-gutter-menu-item,\r
1152
+ .be-block-range-menu-item {\r
1153
+ display: flex;\r
1154
+ align-items: center;\r
1155
+ gap: 8px;\r
1156
+ width: 100%;\r
1157
+ text-align: left;\r
1158
+ border: none;\r
1159
+ border-radius: var(--noteloom-radius-sm);\r
1160
+ background: transparent;\r
1161
+ padding: 7px 10px;\r
1162
+ font: inherit;\r
1163
+ font-size: 0.88rem;\r
1164
+ color: var(--noteloom-text);\r
1165
+ cursor: pointer;\r
1166
+ }\r
1167
+ \r
1168
+ .be-block-gutter-menu-item:hover,\r
1169
+ .be-block-range-menu-item:hover {\r
1170
+ background: var(--noteloom-bg-hover);\r
1171
+ }\r
1172
+ \r
1173
+ .be-block-gutter-menu-item-danger,\r
1174
+ .be-block-range-menu-item-danger {\r
1175
+ color: var(--noteloom-danger);\r
1176
+ }\r
1177
+ \r
1178
+ .be-block-gutter-menu-item-danger:hover,\r
1179
+ .be-block-range-menu-item-danger:hover {\r
1180
+ background: var(--noteloom-danger-soft);\r
1181
+ }\r
1182
+ \r
1183
+ /* --- drag-in-the-margin block range selection --- */\r
1184
+ \r
1185
+ .be-block-row-range-selected {\r
1186
+ background: var(--noteloom-accent-soft);\r
1187
+ border-radius: var(--noteloom-radius-md);\r
1188
+ margin: 0 -8px;\r
1189
+ padding: 0 8px;\r
1190
+ }\r
1191
+ \r
1192
+ .be-block-range-dragging,\r
1193
+ .be-block-range-dragging * {\r
1194
+ user-select: none !important;\r
1195
+ }\r
1196
+ \r
1197
+ /* --- whole-document select-all / single non-editable block selected --- */\r
1198
+ \r
1199
+ .be-surface--all-selected .be-block-row-content > [data-block-id] {\r
1200
+ background: var(--noteloom-accent-soft);\r
1201
+ border-radius: var(--noteloom-radius-sm);\r
1202
+ }\r
1203
+ \r
1204
+ .be-block-selected {\r
1205
+ outline: 2px solid var(--noteloom-accent);\r
1206
+ outline-offset: 2px;\r
1207
+ border-radius: var(--noteloom-radius-sm);\r
1208
+ }\r
1209
+ \r
1210
+ /* --- document export (view source) --- */\r
1211
+ \r
1212
+ .be-export-trigger {\r
1213
+ display: inline-flex;\r
1214
+ align-items: center;\r
1215
+ gap: 6px;\r
1216
+ border: 1px solid var(--noteloom-border);\r
1217
+ background: var(--noteloom-bg);\r
1218
+ color: var(--noteloom-text-muted);\r
1219
+ border-radius: var(--noteloom-radius-sm);\r
1220
+ padding: 5px 10px;\r
1221
+ font-size: 0.85rem;\r
1222
+ cursor: pointer;\r
1223
+ }\r
1224
+ \r
1225
+ .be-export-trigger:hover {\r
1226
+ background: var(--noteloom-bg-hover);\r
1227
+ color: var(--noteloom-text);\r
1228
+ }\r
1229
+ \r
1230
+ .be-export-tabs {\r
1231
+ display: flex;\r
1232
+ gap: 4px;\r
1233
+ margin-bottom: 10px;\r
1234
+ border-bottom: 1px solid var(--noteloom-border);\r
1235
+ }\r
1236
+ \r
1237
+ .be-export-tab {\r
1238
+ border: none;\r
1239
+ background: transparent;\r
1240
+ color: var(--noteloom-text-muted);\r
1241
+ padding: 6px 10px;\r
1242
+ margin-bottom: -1px;\r
1243
+ border-bottom: 2px solid transparent;\r
1244
+ font-size: 0.85rem;\r
1245
+ font-weight: 500;\r
1246
+ cursor: pointer;\r
1247
+ }\r
1248
+ \r
1249
+ .be-export-tab:hover {\r
1250
+ color: var(--noteloom-text);\r
1251
+ }\r
1252
+ \r
1253
+ .be-export-tab-active {\r
1254
+ color: var(--noteloom-accent);\r
1255
+ border-bottom-color: var(--noteloom-accent);\r
1256
+ }\r
1257
+ \r
1258
+ .be-export-pre {\r
1259
+ max-height: 50vh;\r
1260
+ overflow: auto;\r
1261
+ margin: 0;\r
1262
+ padding: 0.9em 1em;\r
1263
+ border-radius: var(--noteloom-radius-md);\r
1264
+ background: var(--noteloom-code-bg);\r
1265
+ color: var(--noteloom-code-text);\r
1266
+ font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;\r
1267
+ font-size: 0.8rem;\r
1268
+ line-height: 1.5;\r
1269
+ white-space: pre-wrap;\r
1270
+ overflow-wrap: anywhere;\r
1271
+ }\r
1272
+ \r
1273
+ /* --- trailing click-to-continue space --- */\r
1274
+ \r
1275
+ .be-trailing-space {\r
1276
+ cursor: text;\r
1277
+ width: 100%;\r
1278
+ min-height: 180px;\r
1279
+ }\r
1280
+ \r
1281
+ /* --- modal (button editor, field type editor) --- */\r
1282
+ \r
1283
+ .be-modal-overlay {\r
1284
+ position: fixed;\r
1285
+ inset: 0;\r
1286
+ background: rgba(15, 23, 42, 0.45);\r
1287
+ display: flex;\r
1288
+ align-items: center;\r
1289
+ justify-content: center;\r
1290
+ z-index: 2000;\r
1291
+ padding: 1em;\r
1292
+ }\r
1293
+ \r
1294
+ .be-modal {\r
1295
+ background: var(--noteloom-bg);\r
1296
+ color: var(--noteloom-text);\r
1297
+ border-radius: var(--noteloom-radius-xl);\r
1298
+ border: 1px solid var(--noteloom-border);\r
1299
+ padding: 1.4em;\r
1300
+ width: 100%;\r
1301
+ max-width: 380px;\r
1302
+ max-height: 85vh;\r
1303
+ overflow-y: auto;\r
1304
+ box-shadow: var(--noteloom-shadow);\r
1305
+ }\r
1306
+ \r
1307
+ .be-modal-large {\r
1308
+ max-width: 640px;\r
1309
+ }\r
1310
+ \r
1311
+ /* Bottom sheet variant (mobile block picker) — anchored to the bottom edge\r
1312
+ instead of centered, rounded only on top, full page width. */\r
1313
+ .be-modal-overlay-sheet {\r
1314
+ align-items: flex-end;\r
1315
+ padding: 0;\r
1316
+ }\r
1317
+ \r
1318
+ .be-modal-sheet {\r
1319
+ max-width: 100%;\r
1320
+ width: 100%;\r
1321
+ max-height: 70vh;\r
1322
+ border-radius: var(--noteloom-radius-xl) var(--noteloom-radius-xl) 0 0;\r
1323
+ border-bottom: none;\r
1324
+ padding-bottom: max(1.4em, env(safe-area-inset-bottom));\r
1325
+ }\r
1326
+ \r
1327
+ .be-mobile-picker-list {\r
1328
+ display: flex;\r
1329
+ flex-direction: column;\r
1330
+ gap: 2px;\r
1331
+ }\r
1332
+ \r
1333
+ .be-mobile-picker-item {\r
1334
+ display: flex;\r
1335
+ align-items: center;\r
1336
+ gap: 10px;\r
1337
+ width: 100%;\r
1338
+ border: none;\r
1339
+ background: transparent;\r
1340
+ border-radius: var(--noteloom-radius-md);\r
1341
+ padding: 12px 10px;\r
1342
+ font: inherit;\r
1343
+ font-size: 0.95rem;\r
1344
+ color: var(--noteloom-text);\r
1345
+ text-align: left;\r
1346
+ cursor: pointer;\r
1347
+ }\r
1348
+ \r
1349
+ .be-mobile-picker-item:hover,\r
1350
+ .be-mobile-picker-item:active {\r
1351
+ background: var(--noteloom-bg-hover);\r
1352
+ }\r
1353
+ \r
1354
+ .be-mobile-picker-item-danger {\r
1355
+ color: var(--noteloom-danger);\r
1356
+ }\r
1357
+ \r
1358
+ .be-mobile-picker-item-danger:hover,\r
1359
+ .be-mobile-picker-item-danger:active {\r
1360
+ background: var(--noteloom-danger-soft);\r
1361
+ }\r
1362
+ \r
1363
+ .be-mobile-picker-item-danger .be-mobile-picker-item-icon {\r
1364
+ color: var(--noteloom-danger);\r
1365
+ }\r
1366
+ \r
1367
+ /* --- mobile action bar (pinned above the on-screen keyboard) --- */\r
1368
+ \r
1369
+ .be-mobile-action-bar {\r
1370
+ position: fixed;\r
1371
+ left: 0;\r
1372
+ right: 0;\r
1373
+ z-index: 1500;\r
1374
+ display: flex;\r
1375
+ align-items: center;\r
1376
+ gap: 2px;\r
1377
+ padding: 6px calc(6px + env(safe-area-inset-right)) 6px calc(6px + env(safe-area-inset-left));\r
1378
+ background: var(--noteloom-bg);\r
1379
+ border-top: 1px solid var(--noteloom-border);\r
1380
+ overflow-x: auto;\r
1381
+ }\r
1382
+ \r
1383
+ .be-mobile-bar-btn {\r
1384
+ flex: none;\r
1385
+ display: flex;\r
1386
+ align-items: center;\r
1387
+ justify-content: center;\r
1388
+ gap: 4px;\r
1389
+ min-width: 40px;\r
1390
+ height: 40px;\r
1391
+ padding: 0 10px;\r
1392
+ border: none;\r
1393
+ background: transparent;\r
1394
+ border-radius: var(--noteloom-radius-sm);\r
1395
+ color: var(--noteloom-text);\r
1396
+ font-size: 0.85rem;\r
1397
+ font-weight: 500;\r
1398
+ cursor: pointer;\r
1399
+ }\r
1400
+ \r
1401
+ .be-mobile-bar-btn:disabled {\r
1402
+ opacity: 0.4;\r
1403
+ }\r
1404
+ \r
1405
+ .be-mobile-bar-btn-active {\r
1406
+ background: var(--noteloom-accent-soft);\r
1407
+ color: var(--noteloom-accent);\r
1408
+ }\r
1409
+ \r
1410
+ .be-mobile-bar-spacer {\r
1411
+ flex: 1;\r
1412
+ }\r
1413
+ \r
1414
+ .be-mobile-bar-select {\r
1415
+ flex: none;\r
1416
+ }\r
1417
+ \r
1418
+ .be-mobile-bar-swatches {\r
1419
+ display: flex;\r
1420
+ align-items: center;\r
1421
+ gap: 6px;\r
1422
+ padding: 0 6px;\r
1423
+ }\r
1424
+ \r
1425
+ .be-mobile-picker-item-icon {\r
1426
+ flex: none;\r
1427
+ display: flex;\r
1428
+ align-items: center;\r
1429
+ justify-content: center;\r
1430
+ width: 32px;\r
1431
+ height: 32px;\r
1432
+ border-radius: var(--noteloom-radius-sm);\r
1433
+ background: var(--noteloom-bg-subtle);\r
1434
+ color: var(--noteloom-text-muted);\r
1435
+ }\r
1436
+ \r
1437
+ .be-modal-title {\r
1438
+ font-weight: 600;\r
1439
+ font-size: 1.05rem;\r
1440
+ margin-bottom: 1em;\r
1441
+ }\r
1442
+ \r
1443
+ .be-modal-field {\r
1444
+ display: block;\r
1445
+ margin-bottom: 1em;\r
1446
+ }\r
1447
+ \r
1448
+ .be-modal-field > span {\r
1449
+ display: block;\r
1450
+ font-size: 0.8rem;\r
1451
+ color: var(--noteloom-text-muted);\r
1452
+ margin-bottom: 5px;\r
1453
+ }\r
1454
+ \r
1455
+ .be-modal-field input[type='text'],\r
1456
+ .be-modal-field input[type='url'] {\r
1457
+ width: 100%;\r
1458
+ box-sizing: border-box;\r
1459
+ border: 1px solid var(--noteloom-border);\r
1460
+ border-radius: var(--noteloom-radius-md);\r
1461
+ padding: 0.55em 0.75em;\r
1462
+ background: transparent;\r
1463
+ color: inherit;\r
1464
+ font: inherit;\r
1465
+ outline: none;\r
1466
+ }\r
1467
+ \r
1468
+ .be-modal-field input[type='text']:focus,\r
1469
+ .be-modal-field input[type='url']:focus {\r
1470
+ border-color: var(--noteloom-accent);\r
1471
+ }\r
1472
+ \r
1473
+ .be-modal-field select {\r
1474
+ width: 100%;\r
1475
+ box-sizing: border-box;\r
1476
+ border: 1px solid var(--noteloom-border);\r
1477
+ border-radius: var(--noteloom-radius-md);\r
1478
+ padding: 0.55em 0.75em;\r
1479
+ background: transparent;\r
1480
+ color: inherit;\r
1481
+ font: inherit;\r
1482
+ font-size: 0.9rem;\r
1483
+ }\r
1484
+ \r
1485
+ .be-modal-field select:focus {\r
1486
+ border-color: var(--noteloom-accent);\r
1487
+ }\r
1488
+ \r
1489
+ .be-modal-color-row {\r
1490
+ display: flex;\r
1491
+ gap: 8px;\r
1492
+ flex-wrap: wrap;\r
1493
+ }\r
1494
+ \r
1495
+ .be-modal-color-swatch {\r
1496
+ width: 26px;\r
1497
+ height: 26px;\r
1498
+ border-radius: 50%;\r
1499
+ border: 2px solid transparent;\r
1500
+ cursor: pointer;\r
1501
+ }\r
1502
+ \r
1503
+ .be-modal-color-swatch-active {\r
1504
+ border-color: var(--noteloom-accent);\r
1505
+ box-shadow: 0 0 0 2px var(--noteloom-bg), 0 0 0 4px var(--noteloom-accent-soft);\r
1506
+ }\r
1507
+ \r
1508
+ .be-modal-attr-row {\r
1509
+ display: flex;\r
1510
+ gap: 6px;\r
1511
+ margin-bottom: 6px;\r
1512
+ align-items: center;\r
1513
+ }\r
1514
+ \r
1515
+ .be-modal-attr-row input {\r
1516
+ flex: 1;\r
1517
+ min-width: 0;\r
1518
+ border: 1px solid var(--noteloom-border);\r
1519
+ border-radius: var(--noteloom-radius-sm);\r
1520
+ padding: 0.4em 0.6em;\r
1521
+ background: transparent;\r
1522
+ color: inherit;\r
1523
+ font: inherit;\r
1524
+ font-size: 0.85rem;\r
1525
+ }\r
1526
+ \r
1527
+ .be-modal-attr-remove {\r
1528
+ flex: none;\r
1529
+ border: none;\r
1530
+ background: none;\r
1531
+ color: var(--noteloom-text-faint);\r
1532
+ cursor: pointer;\r
1533
+ padding: 2px;\r
1534
+ border-radius: var(--noteloom-radius-sm);\r
1535
+ }\r
1536
+ \r
1537
+ .be-modal-attr-remove:hover {\r
1538
+ color: var(--noteloom-danger);\r
1539
+ }\r
1540
+ \r
1541
+ .be-modal-actions {\r
1542
+ display: flex;\r
1543
+ justify-content: flex-end;\r
1544
+ gap: 8px;\r
1545
+ margin-top: 20px;\r
1546
+ }\r
1547
+ \r
1548
+ .be-modal-delete {\r
1549
+ margin-right: auto; /* pushes Cancel/Save to the right, Delete stays on its own at the left */\r
1550
+ }\r
1551
+ \r
1552
+ .be-modal-cancel,\r
1553
+ .be-modal-save,\r
1554
+ .be-modal-delete {\r
1555
+ border: none;\r
1556
+ border-radius: var(--noteloom-radius-md);\r
1557
+ padding: 7px 16px;\r
1558
+ font-size: 0.85rem;\r
1559
+ font-weight: 500;\r
1560
+ cursor: pointer;\r
1561
+ }\r
1562
+ \r
1563
+ .be-modal-delete {\r
1564
+ background: var(--noteloom-danger-soft);\r
1565
+ color: var(--noteloom-danger);\r
1566
+ }\r
1567
+ \r
1568
+ .be-modal-cancel {\r
1569
+ background: var(--noteloom-bg-subtle);\r
1570
+ color: var(--noteloom-text);\r
1571
+ }\r
1572
+ \r
1573
+ .be-modal-cancel:hover {\r
1574
+ background: var(--noteloom-bg-hover);\r
1575
+ }\r
1576
+ \r
1577
+ .be-modal-save {\r
1578
+ background: var(--noteloom-accent);\r
1579
+ color: var(--noteloom-accent-text);\r
1580
+ }\r
1581
+ \r
1582
+ .be-modal-save:hover {\r
1583
+ opacity: 0.9;\r
1584
+ }\r
1585
+ \r
1586
+ .be-modal-save:disabled {\r
1587
+ opacity: 0.5;\r
1588
+ cursor: not-allowed;\r
1589
+ }\r
1590
+ \r
1591
+ /* --- slash ("/") / emoji (":") / mention ("@") command menu --- */\r
1592
+ \r
1593
+ .be-slash-menu {\r
1594
+ z-index: 1000;\r
1595
+ width: 260px;\r
1596
+ max-height: 320px;\r
1597
+ overflow-y: auto;\r
1598
+ background: var(--noteloom-bg);\r
1599
+ border: 1px solid var(--noteloom-border);\r
1600
+ border-radius: var(--noteloom-radius-lg);\r
1601
+ box-shadow: var(--noteloom-shadow);\r
1602
+ padding: 6px;\r
1603
+ }\r
1604
+ \r
1605
+ .be-slash-menu-item {\r
1606
+ display: flex;\r
1607
+ align-items: center;\r
1608
+ gap: 10px;\r
1609
+ padding: 7px 8px;\r
1610
+ border-radius: var(--noteloom-radius-md);\r
1611
+ cursor: pointer;\r
1612
+ font-size: 0.9rem;\r
1613
+ color: var(--noteloom-text);\r
1614
+ }\r
1615
+ \r
1616
+ .be-slash-menu-item-active,\r
1617
+ .be-slash-menu-item:hover {\r
1618
+ background: var(--noteloom-accent-soft);\r
1619
+ }\r
1620
+ \r
1621
+ .be-slash-menu-item-icon {\r
1622
+ flex: none;\r
1623
+ display: flex;\r
1624
+ align-items: center;\r
1625
+ justify-content: center;\r
1626
+ width: 28px;\r
1627
+ height: 28px;\r
1628
+ border-radius: var(--noteloom-radius-sm);\r
1629
+ border: 1px solid var(--noteloom-border);\r
1630
+ color: var(--noteloom-text-muted);\r
1631
+ }\r
1632
+ \r
1633
+ .be-slash-menu-item-label {\r
1634
+ flex: 1;\r
1635
+ overflow: hidden;\r
1636
+ text-overflow: ellipsis;\r
1637
+ white-space: nowrap;\r
1638
+ }\r
1639
+ \r
1640
+ /* --- searchable Select (inline select/date/checkbox widgets, custom field types, table column type) --- */\r
1641
+ \r
1642
+ .be-select {\r
1643
+ display: inline-flex;\r
1644
+ }\r
1645
+ \r
1646
+ .be-select-trigger {\r
1647
+ display: inline-flex;\r
1648
+ align-items: center;\r
1649
+ gap: 6px;\r
1650
+ min-height: 28px;\r
1651
+ min-width: 6em;\r
1652
+ border: 1px solid var(--noteloom-border);\r
1653
+ border-radius: var(--noteloom-radius-md);\r
1654
+ background: var(--noteloom-bg);\r
1655
+ color: var(--noteloom-text);\r
1656
+ font: inherit;\r
1657
+ font-size: 0.88rem;\r
1658
+ padding: 4px 8px;\r
1659
+ cursor: pointer;\r
1660
+ }\r
1661
+ \r
1662
+ .be-select-trigger:hover {\r
1663
+ border-color: var(--noteloom-accent);\r
1664
+ }\r
1665
+ \r
1666
+ .be-select-trigger[aria-expanded='true'] {\r
1667
+ border-color: var(--noteloom-accent);\r
1668
+ box-shadow: 0 0 0 2px var(--noteloom-accent-soft);\r
1669
+ }\r
1670
+ \r
1671
+ .be-select-trigger-tag {\r
1672
+ min-width: 0;\r
1673
+ min-height: 0;\r
1674
+ border: none;\r
1675
+ background: transparent;\r
1676
+ padding: 2px;\r
1677
+ border-radius: var(--noteloom-radius-sm);\r
1678
+ outline: none;\r
1679
+ border: none;\r
1680
+ }\r
1681
+ \r
1682
+ .be-select-trigger-tag:hover {\r
1683
+ background: var(--noteloom-bg-hover);\r
1684
+ }\r
1685
+ \r
1686
+ .be-select-trigger-tag[aria-expanded='true'] {\r
1687
+ background: var(--noteloom-bg-hover);\r
1688
+ box-shadow: none;\r
1689
+ }\r
1690
+ \r
1691
+ .be-select-value-placeholder {\r
1692
+ color: var(--noteloom-text-faint);\r
1693
+ }\r
1694
+ \r
1695
+ .be-select-tag {\r
1696
+ display: inline-flex;\r
1697
+ flex: none;\r
1698
+ max-width: 100%;\r
1699
+ padding: 2px 9px;\r
1700
+ border-radius: var(--noteloom-radius-sm);\r
1701
+ font-size: 0.82em;\r
1702
+ font-weight: 500;\r
1703
+ line-height: 1.4;\r
1704
+ /* Wraps rather than truncates — a fixed-width popover (see\r
1705
+ .be-select-popover) or table cell (see .be-table-cell) combined with\r
1706
+ nowrap+ellipsis let long option text silently overflow its box\r
1707
+ instead of actually being clipped; wrapping sidesteps that entirely. */\r
1708
+ white-space: normal;\r
1709
+ overflow-wrap: anywhere;\r
1710
+ word-break: break-word;\r
1711
+ }\r
1712
+ \r
1713
+ .be-select-value {\r
1714
+ flex: 1;\r
1715
+ text-align: left;\r
1716
+ overflow: hidden;\r
1717
+ text-overflow: ellipsis;\r
1718
+ white-space: nowrap;\r
1719
+ }\r
1720
+ \r
1721
+ .be-select-chevron {\r
1722
+ flex: none;\r
1723
+ color: var(--noteloom-text-faint);\r
1724
+ }\r
1725
+ \r
1726
+ .be-select-popover {\r
1727
+ z-index: 1000;\r
1728
+ width: 224px;\r
1729
+ background: var(--noteloom-bg);\r
1730
+ border: 1px solid var(--noteloom-border);\r
1731
+ border-radius: var(--noteloom-radius-lg);\r
1732
+ box-shadow: var(--noteloom-shadow);\r
1733
+ overflow: hidden;\r
1734
+ }\r
1735
+ \r
1736
+ .be-select-search {\r
1737
+ display: block;\r
1738
+ width: 100%;\r
1739
+ box-sizing: border-box;\r
1740
+ border: none;\r
1741
+ border-bottom: 1px solid var(--noteloom-border);\r
1742
+ background: transparent;\r
1743
+ color: inherit;\r
1744
+ padding: 10px 12px;\r
1745
+ font: inherit;\r
1746
+ font-size: 0.88rem;\r
1747
+ outline: none;\r
1748
+ }\r
1749
+ \r
1750
+ .be-select-options {\r
1751
+ max-height: 220px;\r
1752
+ overflow-y: auto;\r
1753
+ overflow-x: hidden;\r
1754
+ padding: 4px;\r
1755
+ }\r
1756
+ \r
1757
+ .be-select-option {\r
1758
+ display: flex;\r
1759
+ align-items: center;\r
1760
+ min-width: 0;\r
1761
+ padding: 7px 8px;\r
1762
+ border-radius: var(--noteloom-radius-sm);\r
1763
+ cursor: pointer;\r
1764
+ font-size: 0.88rem;\r
1765
+ color: var(--noteloom-text);\r
1766
+ }\r
1767
+ \r
1768
+ /* A tag-variant option list (colored pills — e.g. Priority/Assignee) must\r
1769
+ read at the exact same size/weight as a plain default-variant list\r
1770
+ (Diagnosis) — only the colored-chip background should differ between\r
1771
+ them, not the typography. .be-select-tag's own font-size/weight (sized\r
1772
+ down for when it's squeezed into a trigger button) would otherwise make\r
1773
+ tag-variant options look smaller/bolder than plain ones for no reason. */\r
1774
+ .be-select-option .be-select-tag {\r
1775
+ font-size: inherit;\r
1776
+ font-weight: inherit;\r
1777
+ line-height: inherit;\r
1778
+ width: -webkit-fill-available;\r
1779
+ }\r
1780
+ \r
1781
+ .be-select-option-active {\r
1782
+ background: var(--noteloom-accent-soft);\r
1783
+ }\r
1784
+ \r
1785
+ .be-select-option-selected {\r
1786
+ font-weight: 600;\r
1787
+ }\r
1788
+ \r
1789
+ .be-select-option-selected:not(.be-select-option-active) {\r
1790
+ background: var(--noteloom-bg-subtle);\r
1791
+ }\r
1792
+ \r
1793
+ .be-select-option-selected .be-select-tag {\r
1794
+ font-weight: 500;\r
1795
+ box-shadow: inset 0 0 0 1.5px rgba(0, 0, 0, 0.2);\r
1796
+ }\r
1797
+ \r
1798
+ .be-select-empty {\r
1799
+ padding: 10px 12px;\r
1800
+ color: var(--noteloom-text-faint);\r
1801
+ font-size: 0.85rem;\r
1802
+ text-align: center;\r
1803
+ }\r
1804
+ \r
1805
+ .be-select-error {\r
1806
+ color: var(--noteloom-danger);\r
1807
+ }\r
1808
+ \r
1809
+ .be-select-manage-options {\r
1810
+ display: block;\r
1811
+ width: 100%;\r
1812
+ box-sizing: border-box;\r
1813
+ border: none;\r
1814
+ border-top: 1px solid var(--noteloom-border);\r
1815
+ background: transparent;\r
1816
+ padding: 9px 12px;\r
1817
+ font: inherit;\r
1818
+ font-size: 0.82rem;\r
1819
+ font-weight: 500;\r
1820
+ color: var(--noteloom-accent);\r
1821
+ text-align: left;\r
1822
+ cursor: pointer;\r
1823
+ }\r
1824
+ \r
1825
+ .be-select-manage-options:hover {\r
1826
+ background: var(--noteloom-accent-soft);\r
1827
+ }\r
1828
+ \r
1829
+ .be-inline-select,\r
1830
+ .be-inline-date,\r
1831
+ .be-inline-checkbox {\r
1832
+ display: inline-flex;\r
1833
+ align-items: center;\r
1834
+ vertical-align: middle;\r
1835
+ }\r
1836
+ \r
1837
+ /* Inline chips sit in running text — match the surrounding line's own font\r
1838
+ size instead of the smaller size used for the Select component elsewhere\r
1839
+ (menus, table column type dropdown), where a compact UI size is right. */\r
1840
+ .be-inline-select .be-select-trigger {\r
1841
+ min-height: 0;\r
1842
+ font-size: 1em;\r
1843
+ padding: 1px 8px;\r
1844
+ }\r
1845
+ \r
1846
+ .be-inline-select .be-select-tag {\r
1847
+ font-size: 0.92em;\r
1848
+ }\r
1849
+ \r
1850
+ /* A mention reads as highlighted text sitting inline in the paragraph, not\r
1851
+ a bulky standalone pill/button — minimal padding, small radius, no extra\r
1852
+ chrome from the trigger button wrapping it. */\r
1853
+ .be-inline-select .be-select-trigger-mention {\r
1854
+ padding: 0 !important;\r
1855
+ border-radius: 3px;\r
1856
+ }\r
1857
+ \r
1858
+ /* A mention chip always uses this one fixed color, not each option's own\r
1859
+ tag color — matches Notion/Slack/GitHub's "@mentions are one consistent\r
1860
+ color" convention rather than a per-person palette. */\r
1861
+ .be-select-tag-mention {\r
1862
+ background: var(--noteloom-accent-soft);\r
1863
+ color: var(--noteloom-accent);\r
1864
+ font-weight: 500;\r
1865
+ padding: 0 3px;\r
1866
+ border-radius: 3px;\r
1867
+ line-height: inherit;\r
1868
+ }\r
1869
+ \r
1870
+ .be-inline-date input[type='date'] {\r
1871
+ border: 1px solid var(--noteloom-border);\r
1872
+ border-radius: var(--noteloom-radius-md);\r
1873
+ background: var(--noteloom-bg);\r
1874
+ color: inherit;\r
1875
+ padding: 4px 8px;\r
1876
+ font: inherit;\r
1877
+ font-size: 0.88rem;\r
1878
+ }\r
1879
+ \r
1880
+ .be-inline-checkbox {\r
1881
+ gap: 6px;\r
1882
+ }\r
1883
+ \r
1884
+ .be-inline-checkbox-input {\r
1885
+ flex: none;\r
1886
+ width: 16px;\r
1887
+ height: 16px;\r
1888
+ margin: 0;\r
1889
+ accent-color: var(--noteloom-accent);\r
1890
+ cursor: pointer;\r
1891
+ }\r
1892
+ \r
1893
+ .be-inline-checkbox-label {\r
1894
+ min-width: 0;\r
1895
+ flex: 1;\r
1896
+ border: 1px solid var(--noteloom-border);\r
1897
+ border-radius: var(--noteloom-radius-sm);\r
1898
+ background: transparent;\r
1899
+ color: inherit;\r
1900
+ font: inherit;\r
1901
+ padding: 2px 8px;\r
1902
+ outline: none;\r
1903
+ }\r
1904
+ \r
1905
+ .be-inline-checkbox-label:focus {\r
1906
+ border-color: var(--noteloom-accent);\r
1907
+ }\r
1908
+ \r
1909
+ /* In a table cell (checkbox column), the browser's default text-input\r
1910
+ width (~170px+) is wider than most columns, forcing the input — and with\r
1911
+ it, the whole table — past the cell's own bounds. Constraining the\r
1912
+ inline-flex row to the cell's actual width lets the label's flex:1 +\r
1913
+ min-width:0 (above) do their job and shrink the input to fit instead. */\r
1914
+ .be-table-cell .be-inline-checkbox {\r
1915
+ display: flex;\r
1916
+ width: 100%;\r
1917
+ }\r
1918
+ \r
1919
+ .be-inline-checkbox-label::placeholder {\r
1920
+ color: var(--noteloom-text-faint);\r
1921
+ }\r
1922
+ \r
1923
+ /* --- floating (selection) format toolbar --- */\r
1924
+ \r
1925
+ .be-floating-toolbar {\r
1926
+ display: flex;\r
1927
+ align-items: center;\r
1928
+ gap: 2px;\r
1929
+ background: var(--noteloom-text);\r
1930
+ border-radius: var(--noteloom-radius-md);\r
1931
+ padding: 4px;\r
1932
+ box-shadow: var(--noteloom-shadow);\r
1933
+ z-index: 1000;\r
1934
+ }\r
1935
+ \r
1936
+ .be-floating-toolbar-btn {\r
1937
+ border: none;\r
1938
+ background: transparent;\r
1939
+ color: rgba(255, 255, 255, 0.85);\r
1940
+ width: 30px;\r
1941
+ height: 30px;\r
1942
+ display: flex;\r
1943
+ align-items: center;\r
1944
+ justify-content: center;\r
1945
+ border-radius: var(--noteloom-radius-sm);\r
1946
+ cursor: pointer;\r
1947
+ }\r
1948
+ \r
1949
+ .be-floating-toolbar-btn:hover {\r
1950
+ background: rgba(255, 255, 255, 0.14);\r
1951
+ }\r
1952
+ \r
1953
+ .be-floating-toolbar-btn-active {\r
1954
+ background: var(--noteloom-accent);\r
1955
+ color: #fff;\r
1956
+ }\r
1957
+ \r
1958
+ .be-floating-toolbar-divider {\r
1959
+ width: 1px;\r
1960
+ height: 20px;\r
1961
+ background: rgba(255, 255, 255, 0.2);\r
1962
+ margin: 0 4px;\r
1963
+ }\r
1964
+ \r
1965
+ .be-floating-toolbar-picker-wrap {\r
1966
+ position: relative;\r
1967
+ }\r
1968
+ \r
1969
+ .be-floating-toolbar-picker {\r
1970
+ position: absolute;\r
1971
+ top: 100%;\r
1972
+ left: 0;\r
1973
+ margin-top: 8px;\r
1974
+ display: flex;\r
1975
+ gap: 4px;\r
1976
+ background: var(--noteloom-bg);\r
1977
+ border-radius: var(--noteloom-radius-md);\r
1978
+ padding: 6px;\r
1979
+ box-shadow: var(--noteloom-shadow);\r
1980
+ }\r
1981
+ \r
1982
+ .be-floating-toolbar-swatch {\r
1983
+ width: 22px;\r
1984
+ height: 22px;\r
1985
+ border-radius: 50%;\r
1986
+ border: 1px solid rgba(0, 0, 0, 0.1);\r
1987
+ cursor: pointer;\r
1988
+ }\r
1989
+ \r
1990
+ /* --- link hover card (edit/remove an existing link mark) --- */\r
1991
+ \r
1992
+ .be-link-hover-card {\r
1993
+ z-index: 1000;\r
1994
+ display: flex;\r
1995
+ align-items: center;\r
1996
+ gap: 2px;\r
1997
+ max-width: 320px;\r
1998
+ background: var(--noteloom-bg);\r
1999
+ border: 1px solid var(--noteloom-border);\r
2000
+ border-radius: var(--noteloom-radius-md);\r
2001
+ padding: 5px 6px 5px 10px;\r
2002
+ box-shadow: var(--noteloom-shadow);\r
2003
+ font-size: 0.85rem;\r
2004
+ }\r
2005
+ \r
2006
+ .be-link-hover-card-url {\r
2007
+ flex: 1;\r
2008
+ min-width: 0;\r
2009
+ overflow: hidden;\r
2010
+ text-overflow: ellipsis;\r
2011
+ white-space: nowrap;\r
2012
+ color: var(--noteloom-accent);\r
2013
+ text-decoration: none;\r
2014
+ }\r
2015
+ \r
2016
+ .be-link-hover-card-url:hover {\r
2017
+ text-decoration: underline;\r
2018
+ }\r
2019
+ \r
2020
+ .be-link-hover-card-btn {\r
2021
+ flex: none;\r
2022
+ width: 24px;\r
2023
+ height: 24px;\r
2024
+ border: none;\r
2025
+ background: transparent;\r
2026
+ color: var(--noteloom-text-muted);\r
2027
+ display: flex;\r
2028
+ align-items: center;\r
2029
+ justify-content: center;\r
2030
+ border-radius: var(--noteloom-radius-sm);\r
2031
+ cursor: pointer;\r
2032
+ }\r
2033
+ \r
2034
+ .be-link-hover-card-btn:hover {\r
2035
+ background: var(--noteloom-bg-hover);\r
2036
+ color: var(--noteloom-text);\r
2037
+ }\r
2038
+ `,kt="noteloom-default-styles";function $t(){if(typeof document>"u"||document.getElementById(kt))return;const e=document.createElement("style");e.id=kt,e.textContent=Ao,document.head.appendChild(e)}const Ht=f.createContext(null);function Do({store:e,registry:n,inlineRegistry:t=null,history:r=null,className:o,style:l,theme:a="default",getBlockClassName:c,children:i}){f.useEffect(()=>{a!=="none"&&$t()},[a]);const[u,p]=f.useState(!1),[d,b]=f.useState([]),[m,h]=f.useState(!1),[g,x]=f.useState(null),k=f.useCallback(()=>x("new"),[]),y=f.useCallback(w=>x(w),[]),v=f.useCallback(()=>x(null),[]),S=f.useRef(null),I=f.useCallback(()=>S.current,[]),T=f.useCallback(w=>{var C,O;const B=S.current;B!==w&&(B&&((C=document.querySelector(`[data-block-id="${B}"]`))==null||C.classList.remove("be-block-selected")),S.current=w,w&&((O=document.querySelector(`[data-block-id="${w}"]`))==null||O.classList.add("be-block-selected")))},[]),E=f.useMemo(()=>({store:e,registry:n,inlineRegistry:t,history:r,isWholeDocumentSelected:u,setIsWholeDocumentSelected:p,selectedBlockRange:d,setSelectedBlockRange:b,getSelectedBlockId:I,setSelectedBlockId:T,isPreviewMode:m,setIsPreviewMode:h,fieldTypeEditorTarget:g,openCreateFieldType:k,openEditFieldType:y,closeFieldTypeEditor:v,getBlockClassName:c}),[e,n,t,r,u,d,I,T,m,g,k,y,v,c]),R=o||l?s.jsx("div",{className:o?`be-root ${o}`:"be-root",style:l,children:i}):i;return s.jsx(Ht.Provider,{value:E,children:R})}function fe(){const e=f.useContext(Ht);if(!e)throw new Error("Editor hooks must be used within an <EditorProvider>");return e}function D(){return fe().store}function Te(){return fe().registry}function be(){return fe().inlineRegistry}function Pn(){const{isWholeDocumentSelected:e,setIsWholeDocumentSelected:n}=fe();return[e,n]}function Xe(){const{selectedBlockRange:e,setSelectedBlockRange:n}=fe();return[e,n]}function ge(){const{getSelectedBlockId:e,setSelectedBlockId:n}=fe();return{getSelectedBlockId:e,setSelectedBlockId:n}}function $n(){const{isPreviewMode:e,setIsPreviewMode:n}=fe();return[e,n]}function Z(e,n){const{getBlockClassName:t}=fe(),r=n&&t?t(n):void 0;return r?`${e} ${r}`:e}function Hn(){const{fieldTypeEditorTarget:e,openCreateFieldType:n,openEditFieldType:t,closeFieldTypeEditor:r}=fe();return{target:e,openCreate:n,openEdit:t,close:r}}function G(e){const n=D(),t=f.useCallback(o=>n.subscribe(e,o),[n,e]),r=f.useCallback(()=>n.getBlock(e),[n,e]);return f.useSyncExternalStore(t,r)}function we(e){const n=D(),t=f.useCallback(o=>n.subscribe(e,o),[n,e]),r=f.useCallback(()=>n.getRun(e),[n,e]);return f.useSyncExternalStore(t,r)}function j(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`id-${Date.now()}-${Math.random().toString(36).slice(2)}`}const zt="​",_o=/​/g;function he(e){return(e??"").replace(_o,"")}function yt(e){return he(e.textContent)}function Po(e,n){var c;const t=new Map(n.map(i=>[i.id,i])),r=new Set,o=[];let l=!0;for(const i of e.childNodes){const u=i.nodeType===1?(c=i.dataset)==null?void 0:c.runId:void 0;if(u&&t.has(u)){r.add(u);const d=t.get(u);if(d.type!=="text"){o.push(d);continue}const b=yt(i);o.push(b===d.value?d:{...d,value:b});continue}l=!1;const p=yt(i);p&&o.push({id:j(),type:"text",value:p,marks:{}})}if(n.some(i=>!r.has(i.id))&&(l=!1),o.length!==n.length&&(l=!1),l){for(let i=0;i<o.length;i+=1)if(o[i].id!==n[i].id){l=!1;break}}const a=!l||o.some((i,u)=>i!==n[u]);return{runs:o,changed:a,onlyValueChanges:l}}function Ft(e){return e?e.type!=="text"?!1:(e.value??"")==="":!0}function ce(e,n){return!n||n.length===0?!0:n.every(t=>Ft(e.getRun(t)))}function Je(e,n){var o,l;if(!n)return!1;const t=n.contentIds.length>0,r=(((l=(o=n.props)==null?void 0:o.titleRunIds)==null?void 0:l.length)??0)>0;return!t&&!r}function Ut(e,n){requestAnimationFrame(()=>{const t=document.querySelector(`[data-run-id="${e}"]`);if(!t)return;t.focus();const r=document.createRange();r.selectNodeContents(t),r.collapse(n);const o=window.getSelection();o==null||o.removeAllRanges(),o==null||o.addRange(r)})}function W(e){Ut(e,!1)}function zn(e){Ut(e,!0)}function me(e,n){requestAnimationFrame(()=>{const t=document.querySelector(`[data-run-id="${e}"]`);if(!t)return;t.focus();const r=t.firstChild,o=document.createRange();if(r&&r.nodeType===3){const a=Math.max(0,Math.min(n,r.length));o.setStart(r,a),o.setEnd(r,a)}else o.selectNodeContents(t),o.collapse(n<=0);const l=window.getSelection();l==null||l.removeAllRanges(),l==null||l.addRange(o)})}function Se({isOpen:e,onClose:n,title:t,size:r="default",variant:o="dialog",children:l}){if(f.useEffect(()=>{if(!e)return;const c=i=>{i.key==="Escape"&&n()};return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[e,n]),!e)return null;const a=o==="sheet";return s.jsx("div",{className:`be-modal-overlay${a?" be-modal-overlay-sheet":""}`,onMouseDown:c=>{c.target===c.currentTarget&&n()},children:s.jsxs("div",{className:`be-modal${r==="large"?" be-modal-large":""}${a?" be-modal-sheet":""}`,role:"dialog","aria-modal":"true","aria-label":t,children:[t&&s.jsx("div",{className:"be-modal-title",children:t}),l]})})}function Kt({isOpen:e,initialHref:n,initialTarget:t,hasExistingLink:r,onSave:o,onRemove:l,onClose:a}){const[c,i]=f.useState(""),[u,p]=f.useState("_self");f.useEffect(()=>{e&&(i(n),p(t))},[e]);const d=c.trim(),b=f.useCallback(m=>{m.preventDefault(),d&&o(d,u)},[d,u,o]);return s.jsx(Se,{isOpen:e,onClose:a,title:r?"Edit link":"Add link",children:s.jsxs("form",{onSubmit:b,children:[s.jsxs("label",{className:"be-modal-field",children:[s.jsx("span",{children:"URL"}),s.jsx("input",{type:"text",value:c,onChange:m=>i(m.target.value),placeholder:"https://example.com",autoFocus:!0})]}),s.jsxs("label",{className:"be-modal-field",children:[s.jsx("span",{children:"Open in"}),s.jsxs("select",{value:u,onChange:m=>p(m.target.value),children:[s.jsx("option",{value:"_self",children:"Same tab"}),s.jsx("option",{value:"_blank",children:"New tab"})]})]}),s.jsxs("div",{className:"be-modal-actions",children:[r&&s.jsx("button",{type:"button",className:"be-modal-delete",onClick:l,children:"Remove link"}),s.jsx("button",{type:"button",className:"be-modal-cancel",onClick:a,children:"Cancel"}),s.jsx("button",{type:"submit",className:"be-modal-save",disabled:!d,children:"Save"})]})]})})}function A({children:e,size:n=16,strokeWidth:t=2,...r}){return s.jsx("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:t,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",...r,children:e})}function bn(e){return s.jsx(A,{...e,children:s.jsx("polyline",{points:"9 18 15 12 9 6"})})}function mn(e){return s.jsx(A,{...e,children:s.jsx("polyline",{points:"6 9 12 15 18 9"})})}function Qe(e){return s.jsxs(A,{...e,children:[s.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),s.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}function $o(e){return s.jsxs(A,{...e,fill:"currentColor",stroke:"none",children:[s.jsx("circle",{cx:"5",cy:"12",r:"1.6"}),s.jsx("circle",{cx:"12",cy:"12",r:"1.6"}),s.jsx("circle",{cx:"19",cy:"12",r:"1.6"})]})}function Vt(e){return s.jsx(A,{...e,children:s.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48"})})}function Fn(e){return s.jsxs(A,{...e,children:[s.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),s.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]})}function qt(e){return s.jsxs(A,{...e,children:[s.jsx("path",{d:"M6 4h8a4 4 0 0 1 4 4 4 4 0 0 1-4 4H6z"}),s.jsx("path",{d:"M6 12h9a4 4 0 0 1 4 4 4 4 0 0 1-4 4H6z"})]})}function Wt(e){return s.jsxs(A,{...e,children:[s.jsx("line",{x1:"19",y1:"4",x2:"10",y2:"4"}),s.jsx("line",{x1:"14",y1:"20",x2:"5",y2:"20"}),s.jsx("line",{x1:"15",y1:"4",x2:"9",y2:"20"})]})}function Yt(e){return s.jsxs(A,{...e,children:[s.jsx("path",{d:"M6 3v7a6 6 0 0 0 12 0V3"}),s.jsx("line",{x1:"4",y1:"21",x2:"20",y2:"21"})]})}function Ho(e){return s.jsxs(A,{...e,children:[s.jsx("path",{d:"M12 20h9"}),s.jsx("path",{d:"M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z"})]})}function Gt(e){return s.jsxs(A,{...e,children:[s.jsx("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),s.jsx("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"})]})}function zo(e){return s.jsxs(A,{...e,children:[s.jsx("path",{d:"M16 4H9a3 3 0 0 0-2.83 4"}),s.jsx("path",{d:"M14 12a4 4 0 0 1 0 8H6"}),s.jsx("line",{x1:"4",y1:"12",x2:"20",y2:"12"})]})}function Fo(e){return s.jsxs(A,{...e,children:[s.jsx("line",{x1:"21",y1:"6",x2:"3",y2:"6"}),s.jsx("line",{x1:"17",y1:"10",x2:"3",y2:"10"}),s.jsx("line",{x1:"21",y1:"14",x2:"3",y2:"14"}),s.jsx("line",{x1:"17",y1:"18",x2:"3",y2:"18"})]})}function Uo(e){return s.jsxs(A,{...e,children:[s.jsx("line",{x1:"21",y1:"6",x2:"3",y2:"6"}),s.jsx("line",{x1:"18",y1:"10",x2:"6",y2:"10"}),s.jsx("line",{x1:"21",y1:"14",x2:"3",y2:"14"}),s.jsx("line",{x1:"18",y1:"18",x2:"6",y2:"18"})]})}function Ko(e){return s.jsxs(A,{...e,children:[s.jsx("line",{x1:"21",y1:"6",x2:"3",y2:"6"}),s.jsx("line",{x1:"21",y1:"10",x2:"7",y2:"10"}),s.jsx("line",{x1:"21",y1:"14",x2:"3",y2:"14"}),s.jsx("line",{x1:"21",y1:"18",x2:"7",y2:"18"})]})}function Vo(e){return s.jsx(A,{...e,children:[5,12,19].flatMap(n=>[9,15].map(t=>s.jsx("circle",{cx:t,cy:n,r:"1.3",fill:"currentColor",stroke:"none"},`${t}-${n}`)))})}function hn(e){return s.jsxs(A,{...e,children:[s.jsx("polyline",{points:"3 6 5 6 21 6"}),s.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"}),s.jsx("line",{x1:"10",y1:"11",x2:"10",y2:"17"}),s.jsx("line",{x1:"14",y1:"11",x2:"14",y2:"17"})]})}function Un(e){return s.jsxs(A,{...e,children:[s.jsx("rect",{x:"9",y:"9",width:"12",height:"12",rx:"2"}),s.jsx("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]})}function Kn(e){return s.jsxs(A,{...e,children:[s.jsx("line",{x1:"12",y1:"19",x2:"12",y2:"5"}),s.jsx("polyline",{points:"5 12 12 5 19 12"})]})}function Vn(e){return s.jsxs(A,{...e,children:[s.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),s.jsx("polyline",{points:"19 12 12 19 5 12"})]})}function qo(e){return s.jsxs(A,{...e,children:[s.jsx("circle",{cx:"6",cy:"6",r:"3"}),s.jsx("circle",{cx:"6",cy:"18",r:"3"}),s.jsx("line",{x1:"20",y1:"4",x2:"8.12",y2:"15.88"}),s.jsx("line",{x1:"14.47",y1:"14.48",x2:"20",y2:"20"}),s.jsx("line",{x1:"8.12",y1:"8.12",x2:"12",y2:"12"})]})}function Wo(e){return s.jsxs(A,{...e,children:[s.jsx("line",{x1:"17",y1:"6",x2:"3",y2:"6"}),s.jsx("line",{x1:"21",y1:"12",x2:"3",y2:"12"}),s.jsx("line",{x1:"15",y1:"18",x2:"3",y2:"18"})]})}function qn({level:e=1,size:n=16,...t}){return s.jsx("svg",{width:n,height:n,viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",...t,children:s.jsxs("text",{x:"2",y:"18",fontSize:"14",fontWeight:"700",fill:"currentColor",fontFamily:"inherit",children:["H",e]})})}function Yo(e){return s.jsx(qn,{level:1,...e})}function Go(e){return s.jsx(qn,{level:2,...e})}function Xo(e){return s.jsx(qn,{level:3,...e})}function Jo(e){return s.jsxs(A,{...e,children:[s.jsx("path",{d:"M7 7a3 3 0 0 0-3 3v3a2 2 0 0 0 2 2h2a1 1 0 0 0 1-1v-4a1 1 0 0 0-1-1H6a3 3 0 0 1 3-3z"}),s.jsx("path",{d:"M17 7a3 3 0 0 0-3 3v3a2 2 0 0 0 2 2h2a1 1 0 0 0 1-1v-4a1 1 0 0 0-1-1h-2a3 3 0 0 1 3-3z"})]})}function Xt(e){return s.jsxs(A,{...e,children:[s.jsx("polyline",{points:"9 8 4 12 9 16"}),s.jsx("polyline",{points:"15 8 20 12 15 16"})]})}function Qo(e){return s.jsx(A,{...e,children:s.jsx("line",{x1:"4",y1:"12",x2:"20",y2:"12"})})}function Zo(e){return s.jsxs(A,{...e,children:[s.jsx("path",{d:"M4 5h16a1 1 0 0 1 1 1v9a1 1 0 0 1-1 1H9l-4 4v-4H4a1 1 0 0 1-1-1V6a1 1 0 0 1 1-1z"}),s.jsx("line",{x1:"7",y1:"9",x2:"17",y2:"9"}),s.jsx("line",{x1:"7",y1:"12.5",x2:"13",y2:"12.5"})]})}function el(e){return s.jsxs(A,{...e,children:[s.jsx("rect",{x:"3",y:"8",width:"18",height:"8",rx:"3"}),s.jsx("line",{x1:"8",y1:"12",x2:"16",y2:"12"})]})}function nl(e){return s.jsxs(A,{...e,children:[s.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"1"}),s.jsx("line",{x1:"3",y1:"10",x2:"21",y2:"10"}),s.jsx("line",{x1:"3",y1:"16",x2:"21",y2:"16"}),s.jsx("line",{x1:"9",y1:"4",x2:"9",y2:"20"}),s.jsx("line",{x1:"15",y1:"4",x2:"15",y2:"20"})]})}function tl(e){return s.jsxs(A,{...e,children:[s.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"1"}),s.jsx("line",{x1:"9",y1:"4",x2:"9",y2:"20"}),s.jsx("line",{x1:"15",y1:"4",x2:"15",y2:"20"})]})}function rl(e){return s.jsxs(A,{...e,children:[s.jsx("circle",{cx:"4.5",cy:"6",r:"1.2",fill:"currentColor",stroke:"none"}),s.jsx("circle",{cx:"4.5",cy:"12",r:"1.2",fill:"currentColor",stroke:"none"}),s.jsx("circle",{cx:"4.5",cy:"18",r:"1.2",fill:"currentColor",stroke:"none"}),s.jsx("line",{x1:"9",y1:"6",x2:"21",y2:"6"}),s.jsx("line",{x1:"9",y1:"12",x2:"21",y2:"12"}),s.jsx("line",{x1:"9",y1:"18",x2:"21",y2:"18"})]})}function ol(e){return s.jsxs(A,{...e,children:[s.jsx("line",{x1:"10",y1:"6",x2:"21",y2:"6"}),s.jsx("line",{x1:"10",y1:"12",x2:"21",y2:"12"}),s.jsx("line",{x1:"10",y1:"18",x2:"21",y2:"18"}),s.jsx("text",{x:"2",y:"8.5",fontSize:"7",fontWeight:"700",fill:"currentColor",stroke:"none",children:"1"}),s.jsx("text",{x:"2",y:"14.5",fontSize:"7",fontWeight:"700",fill:"currentColor",stroke:"none",children:"2"}),s.jsx("text",{x:"2",y:"20.5",fontSize:"7",fontWeight:"700",fill:"currentColor",stroke:"none",children:"3"})]})}function Jt(e){return s.jsxs(A,{...e,children:[s.jsx("rect",{x:"4",y:"4",width:"16",height:"16",rx:"3"}),s.jsx("polyline",{points:"8 12 11 15 16 9"})]})}function ll(e){return s.jsxs(A,{...e,children:[s.jsx("rect",{x:"3",y:"5",width:"18",height:"16",rx:"2"}),s.jsx("line",{x1:"3",y1:"10",x2:"21",y2:"10"}),s.jsx("line",{x1:"8",y1:"3",x2:"8",y2:"7"}),s.jsx("line",{x1:"16",y1:"3",x2:"16",y2:"7"})]})}function Qt(e){return s.jsxs(A,{...e,children:[s.jsx("path",{d:"M12 3h7a2 2 0 0 1 2 2v7a2 2 0 0 1-.59 1.41l-8 8a2 2 0 0 1-2.82 0l-7-7a2 2 0 0 1 0-2.82l8-8A2 2 0 0 1 12 3z"}),s.jsx("circle",{cx:"15.5",cy:"8.5",r:"1.2",fill:"currentColor",stroke:"none"})]})}function sl(e){return s.jsxs(A,{...e,children:[s.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2"}),s.jsx("circle",{cx:"9",cy:"10",r:"1.5",fill:"currentColor",stroke:"none"}),s.jsx("path",{d:"M4 17l5-5 4 4 4-5 4 6"})]})}function al(e){return s.jsxs(A,{...e,children:[s.jsx("rect",{x:"3",y:"5",width:"14",height:"14",rx:"2"}),s.jsx("path",{d:"M17 10l4-2.5v9L17 14"})]})}function Wn(e){return s.jsxs(A,{...e,children:[s.jsx("path",{d:"M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7-10-7-10-7z"}),s.jsx("circle",{cx:"12",cy:"12",r:"3"})]})}function Yn(e){return s.jsxs(A,{...e,children:[s.jsx("path",{d:"M17.94 17.94A10.94 10.94 0 0 1 12 19c-6.5 0-10-7-10-7a18.5 18.5 0 0 1 5.06-5.94M9.9 4.24A10.94 10.94 0 0 1 12 4c6.5 0 10 7 10 7a18.5 18.5 0 0 1-2.16 3.19"}),s.jsx("path",{d:"M14.12 14.12a3 3 0 1 1-4.24-4.24"}),s.jsx("line",{x1:"1",y1:"1",x2:"23",y2:"23"})]})}function cl(e){return s.jsxs(A,{...e,children:[s.jsx("line",{x1:"4",y1:"10",x2:"4",y2:"14"}),s.jsx("line",{x1:"8",y1:"7",x2:"8",y2:"17"}),s.jsx("line",{x1:"12",y1:"4",x2:"12",y2:"20"}),s.jsx("line",{x1:"16",y1:"7",x2:"16",y2:"17"}),s.jsx("line",{x1:"20",y1:"10",x2:"20",y2:"14"})]})}function il({containerRef:e,store:n}){var x;const[t,r]=f.useState(null),[o,l]=f.useState(!1),a=f.useRef(null),c=f.useRef(null),i=f.useCallback(()=>{a.current&&(clearTimeout(a.current),a.current=null)},[]),u=f.useCallback(()=>{i(),a.current=setTimeout(()=>{r(k=>o?k:null)},250)},[i,o]);f.useEffect(()=>{const k=e.current;if(!k)return;const y=S=>{var R,w,B;const I=(w=(R=S.target).closest)==null?void 0:w.call(R,"[data-run-id]");if(!I||!k.contains(I))return;const T=I.dataset.runId,E=n.getRun(T);(B=E==null?void 0:E.marks)!=null&&B.link&&(i(),r(C=>(C==null?void 0:C.runId)===T?C:{runId:T,rect:I.getBoundingClientRect()}))},v=()=>u();return k.addEventListener("mouseover",y),k.addEventListener("mouseout",v),()=>{k.removeEventListener("mouseover",y),k.removeEventListener("mouseout",v)}},[e,n,i,u]),f.useEffect(()=>()=>i(),[i]);const p=f.useCallback(()=>l(!0),[]),d=f.useCallback(()=>{l(!1),r(null)},[]),b=f.useCallback((k,y)=>{if(!t)return;const v=n.getRun(t.runId);v&&(n.applyOperation(Y(t.runId,{marks:{...v.marks,link:{href:k,target:y}}})),d())},[t,n,d]),m=f.useCallback(()=>{if(!t)return;const k=n.getRun(t.runId);if(!k)return;const y={...k.marks};delete y.link,n.applyOperation(Y(t.runId,{marks:y})),d()},[t,n,d]),h=t&&n.getRun(t.runId),g=(x=h==null?void 0:h.marks)==null?void 0:x.link;return s.jsxs(s.Fragment,{children:[t&&g&&!o?Pe.createPortal(s.jsxs("div",{ref:c,className:"be-link-hover-card",contentEditable:!1,style:{position:"fixed",top:t.rect.bottom+6,left:t.rect.left},onMouseEnter:i,onMouseLeave:u,children:[s.jsx("a",{className:"be-link-hover-card-url",href:g.href,target:g.target==="_blank"?"_blank":"_self",rel:"noopener noreferrer",children:g.href}),s.jsx("button",{type:"button",className:"be-link-hover-card-btn",onClick:p,"aria-label":"Edit link",title:"Edit link",children:s.jsx(Ho,{size:13})}),s.jsx("button",{type:"button",className:"be-link-hover-card-btn",onClick:m,"aria-label":"Remove link",title:"Remove link",children:s.jsx(Qe,{size:13})})]}),document.body):null,s.jsx(Kt,{isOpen:o,initialHref:(g==null?void 0:g.href)??"",initialTarget:(g==null?void 0:g.target)??"_self",hasExistingLink:!!g,onSave:b,onRemove:m,onClose:d})]})}function vt(e,n){const t=e==null?void 0:e.parentElement;if(!t||!t.hasAttribute("data-placeholder"))return;n.length===0||n.every(Ft)?t.setAttribute("data-empty",""):t.removeAttribute("data-empty")}function ul(e={}){return{fontWeight:e.bold?"bold":void 0,fontStyle:e.italic?"italic":void 0,textDecoration:[(e.underline||e.link)&&"underline",e.strike&&"line-through"].filter(Boolean).join(" ")||void 0,verticalAlign:e.subscript?"sub":e.superscript?"super":void 0,fontSize:e.subscript||e.superscript?"smaller":void 0,color:e.color||(e.link?"var(--noteloom-accent)":void 0),backgroundColor:e.highlight||void 0,cursor:e.link?"pointer":void 0}}function dl({id:e,host:n,onValueSynced:t}){const r=we(e);return f.useLayoutEffect(()=>{var u;if(!n||!r)return;const o=r.value??"";(he(n.textContent)!==o||o===""&&n.textContent==="")&&(n.textContent=o===""?zt:o);const c=ul(r.marks);n.style.fontWeight=c.fontWeight??"",n.style.fontStyle=c.fontStyle??"",n.style.textDecoration=c.textDecoration??"",n.style.verticalAlign=c.verticalAlign??"",n.style.fontSize=c.fontSize??"",n.style.color=c.color??"",n.style.backgroundColor=c.backgroundColor??"",n.style.cursor=c.cursor??"";const i=(u=r.marks)==null?void 0:u.link;n.title=i!=null&&i.href?`${i.href} — Ctrl+Click to open`:"",n.onclick=i!=null&&i.href?p=>{!p.ctrlKey&&!p.metaKey||(p.preventDefault(),window.open(i.href,i.target==="_blank"?"_blank":"_self","noopener,noreferrer"))}:null,t==null||t()},[n,r,t]),null}function wt(e,n,t,r){var d,b,m;const o=(d=window.getSelection)==null?void 0:d.call(window);if(!o||!o.isCollapsed||o.rangeCount===0)return null;const{anchorNode:l,anchorOffset:a}=o;if(!l||!e.contains(l))return null;const c=h=>{const g=n.indexOf(h);if(g===-1)return null;const x=r?n[g-1]:n[g+1];if(!x)return null;const k=t(x);return k&&k.type!=="text"?x:null};if(l===e){const h=r?a-1:a,g=e.childNodes[h],x=(g==null?void 0:g.nodeType)===1?(b=g.dataset)==null?void 0:b.runId:void 0;if(!x||n.indexOf(x)===-1)return null;const k=t(x);return k&&k.type!=="text"?x:null}const i=l.nodeType===1?l:l.parentElement,u=(m=i==null?void 0:i.closest)==null?void 0:m.call(i,"[data-run-id]");return!u||!e.contains(u)||!(r?a===0:a===(l.textContent??"").length)?null:c(u.getAttribute("data-run-id"))}function It(e,n,t){var i,u;const r=(i=window.getSelection)==null?void 0:i.call(window);if(!r||r.isCollapsed||r.rangeCount===0)return null;const o=r.getRangeAt(0);if(o.startContainer!==o.endContainer||!e.contains(o.startContainer)||o.endOffset!==o.startOffset+1)return null;const l=o.startContainer.childNodes[o.startOffset],a=(l==null?void 0:l.nodeType)===1?(u=l.dataset)==null?void 0:u.runId:void 0;if(!a||n.indexOf(a)===-1)return null;const c=t(a);return c&&c.type!=="text"?a:null}function Ct(e,n,t){var c;if(n===e)return{childIndex:t,charOffset:null};const r=n.nodeType===1?n:n.parentElement,o=(c=r==null?void 0:r.closest)==null?void 0:c.call(r,"[data-run-id]");if(!o||!e.contains(o))return null;const l=Array.prototype.indexOf.call(e.childNodes,o),a=n===o?t===0?0:(o.textContent??"").length:t;return{childIndex:l,charOffset:a}}function pl(e,n,t,r){const o=Ct(e,r.startContainer,r.startOffset),l=Ct(e,r.endContainer,r.endOffset);if(!o||!l)return null;const a=Array.from(e.childNodes).filter(p=>{var d;return p.nodeType===1&&((d=p.dataset)==null?void 0:d.runId)&&n.indexOf(p.dataset.runId)!==-1});let c=!1;const i=[];let u=null;return a.forEach((p,d)=>{const b=p.dataset.runId,m=t(b);if(!m)return;const h=d<o.childIndex,g=l.charOffset===null?d>=l.childIndex:d>l.childIndex;if(h||g){i.push(m);return}const x=o.charOffset!==null&&d===o.childIndex,k=l.charOffset!==null&&d===l.childIndex;if(m.type!=="text"){c=!0,u===null&&(u=i.length);return}const y=m.value??"";if(x&&k){const v=y.slice(0,o.charOffset)+y.slice(l.charOffset);v&&i.push({...m,value:v}),u=i.length}else if(x){const v=y.slice(0,o.charOffset);v&&i.push({...m,value:v}),u===null&&(u=i.length)}else if(k){const v=y.slice(l.charOffset);v&&i.push({id:j(),type:"text",value:v,marks:m.marks})}}),c?{nextRuns:i,insertionIndex:u??i.length}:null}function fl(e){var l;const n=(l=window.getSelection)==null?void 0:l.call(window);if(!n||!n.isCollapsed)return!1;const t=e.firstChild;if(!t)return!0;if(n.anchorNode===e)return n.anchorOffset===0;let r=t;for(;r&&r.firstChild;)r=r.firstChild;if(n.anchorNode!==r&&n.anchorNode!==t)return!1;const o=r.nodeType===3&&r.textContent===zt?1:0;return n.anchorOffset<=o}function bl(e){var l;const n=(l=window.getSelection)==null?void 0:l.call(window);if(!n||!n.isCollapsed)return!1;const t=e.lastChild;if(!t)return!0;if(n.anchorNode===e)return n.anchorOffset>=e.childNodes.length;let r=t;for(;r&&r.lastChild;)r=r.lastChild;if(n.anchorNode!==r&&n.anchorNode!==t)return!1;const o=r.nodeType===3?(r.textContent??"").length:0;return n.anchorOffset>=o}function Bt(e,n,t){const r=e.getBlock(n),o=e.getBlock(r==null?void 0:r.parentId);if(!o)return null;const l=o.contentIds.indexOf(n),a=t==="backward"?l-1:l+1;if(a<0||a>=o.contentIds.length)return null;const c=o.contentIds[a];return Je(e,e.getBlock(c))?c:null}function ml({id:e,blockId:n,host:t,inlineRegistry:r,onValueSynced:o}){const l=we(e);if(!l)return null;if(l.type==="text")return s.jsx(dl,{id:e,host:t,onValueSynced:o});const a=r==null?void 0:r.get(l.type);if(!a)return process.env.NODE_ENV!=="production"&&console.warn(`[block-editor] No inline type registered for "${l.type}" (run: ${e})`),null;const c=a.component;return s.jsx(c,{id:e,blockId:n})}function hl(e,n,t){let r=e.get(t);if(!r){r=document.createElement("span"),r.dataset.runId=t;const o=n.getRun(t);o&&o.type!=="text"&&r.setAttribute("contenteditable","false"),e.set(t,r)}return r}function xe({blockId:e,runIds:n,onEnter:t,onBackspaceAtStart:r,onDeleteAtEnd:o,onArrowUp:l,onArrowDown:a,onTab:c,onShiftTab:i,onAutoformat:u}){const p=D(),d=be(),{getSelectedBlockId:b,setSelectedBlockId:m}=ge(),h=f.useRef(null),g=f.useRef(!1),x=f.useRef(new Map);f.useLayoutEffect(()=>{const w=h.current;if(!w)return;const B=new Set(n);for(const[O,N]of x.current)B.has(O)||(N.remove(),x.current.delete(O));let C=null;for(const O of n){const N=x.current.get(O);if(!N)continue;const M=C?C.nextSibling:w.firstChild;M!==N&&w.insertBefore(N,M),C=N}},[n]);const k=f.useCallback(()=>{if(g.current)return;const w=h.current;if(!w)return;const B=n.map(M=>p.getRun(M)).filter(Boolean),{runs:C,changed:O,onlyValueChanges:N}=Po(w,B);if(O){if(N){if(C.forEach((M,U)=>{M!==B[U]&&p.applyOperation(Y(M.id,{value:M.value}))}),u!=null&&u(C))return}else p.applyOperation(ae(e,C.length?C:[{id:j(),type:"text",value:"",marks:{}}]));vt(w,C)}},[p,e,n,u]),y=f.useCallback(()=>{vt(h.current,n.map(w=>p.getRun(w)).filter(Boolean))},[p,n]),v=f.useCallback(()=>{g.current=!0},[]),S=f.useCallback(()=>{g.current=!1,k()},[k]),I=f.useCallback(w=>{const C=n.map(O=>p.getRun(O)).filter(Boolean).filter(O=>O.id!==w);p.applyOperation(ae(e,C.length?C:[{id:j(),type:"text",value:"",marks:{}}]))},[p,e,n]),T=f.useCallback(w=>{b()===w?(p.applyOperation(P(w)),m(null)):m(w)},[p,b,m]),E=f.useCallback(w=>{var J,ke,V;if(g.current)return;const B=w.inputType??"",C=B.startsWith("delete"),O=B==="insertText"||B==="insertReplacementText";if(!C&&!O)return;const N=h.current;if(!N)return;const M=(J=w.getTargetRanges)==null?void 0:J.call(w),U=(ke=window.getSelection)==null?void 0:ke.call(window),X=(M==null?void 0:M[0])??(U!=null&&U.rangeCount?U.getRangeAt(0):null);if(!X||!N.contains(X.startContainer)||!N.contains(X.endContainer))return;const K=pl(N,n,le=>p.getRun(le),X);if(!K)return;w.preventDefault();let{nextRuns:_,insertionIndex:ee}=K,F=null,se=!1;if(O&&w.data){const le={id:j(),type:"text",value:w.data,marks:{}};_=[..._.slice(0,ee),le,..._.slice(ee)],F=le.id,se=!1}else ee>0?(F=(V=_[ee-1])==null?void 0:V.id,se=!1):_.length>0&&(F=_[0].id,se=!0);const ie=_.length?_:[{id:j(),type:"text",value:"",marks:{}}];p.applyOperation(ae(e,ie));const oe=F??ie[0].id;se?zn(oe):W(oe)},[p,e,n]);f.useEffect(()=>{const w=h.current;if(w)return w.addEventListener("beforeinput",E),()=>w.removeEventListener("beforeinput",E)},[E]);const R=f.useCallback(w=>{if(!g.current){if(w.key==="Enter"&&t){w.preventDefault(),t(w);return}if(w.key==="Backspace"){const B=h.current,C=B&&It(B,n,p.getRun.bind(p));if(C){w.preventDefault(),I(C);return}const O=B&&wt(B,n,p.getRun.bind(p),!0);if(O){w.preventDefault(),I(O);return}if(B&&fl(B)){if(!ce(p,n)){const M=Bt(p,e,"backward");if(M){w.preventDefault(),T(M);return}}w.preventDefault(),r&&r(w)}return}if(w.key==="Delete"){const B=h.current,C=B&&It(B,n,p.getRun.bind(p));if(C){w.preventDefault(),I(C);return}const O=B&&wt(B,n,p.getRun.bind(p),!1);if(O){w.preventDefault(),I(O);return}if(B&&bl(B)){const N=Bt(p,e,"forward");if(N){w.preventDefault(),T(N);return}o&&o(w)}return}if(w.key==="ArrowUp"&&l){w.preventDefault(),l(w);return}if(w.key==="ArrowDown"&&a){w.preventDefault(),a(w);return}w.key==="Tab"&&(w.shiftKey&&i?(w.preventDefault(),i(w)):!w.shiftKey&&c&&(w.preventDefault(),c(w)))}},[t,r,o,l,a,c,i,I,T,n,e,p]);return s.jsxs(s.Fragment,{children:[s.jsx("span",{ref:h,className:"be-editable",contentEditable:!0,suppressContentEditableWarning:!0,onInput:k,onCompositionStart:v,onCompositionEnd:S,onKeyDown:R,children:n.map(w=>{const B=hl(x.current,p,w);return Pe.createPortal(s.jsx(ml,{id:w,blockId:e,host:B,inlineRegistry:d,onValueSynced:y},w),B)})}),s.jsx(il,{containerRef:h,store:p})]})}function gl(e,n,t){const r=e.getBlock(n),o=r&&e.getBlock(r.parentId);if(!o)return null;const l=o.contentIds.indexOf(n),a=t==="up"?l-1:l+1;return a<0||a>=o.contentIds.length?null:o.contentIds[a]}function Zt(e,n,t){let r=n;for(;;){const o=gl(e,r,t);if(!o)return null;const l=t==="up"?gn(e,o):Gn(e,o);if(l)return l;r=o}}function te(e,n,t){const r=Zt(e,n,t);r&&W(r)}function Gn(e,n){var l;const t=e.getBlock(n);if(!t)return null;const r=((l=t.props)==null?void 0:l.titleRunIds)??t.contentIds;if(!r||r.length===0)return null;const o=r[0];return e.getRun(o)?o:Gn(e,o)}function re(e,n){const t=Gn(e,n);t&&W(t)}function gn(e,n){var l;const t=e.getBlock(n);if(!t)return null;const r=((l=t.props)==null?void 0:l.titleRunIds)??t.contentIds;if(!r||r.length===0)return null;const o=r[r.length-1];return e.getRun(o)?o:gn(e,o)}function jt(e,n){const t=gn(e,n);t&&W(t)}function xl(){var c,i;const e=(c=window.getSelection)==null?void 0:c.call(window);if(!e||e.rangeCount===0)return null;const n=e.getRangeAt(0);if(n.collapsed||n.startContainer!==n.endContainer)return null;const t=n.startContainer,r=t.nodeType===1?t:t.parentElement,o=(i=r==null?void 0:r.closest)==null?void 0:i.call(r,"[data-run-id]");if(!o)return null;const l=o.closest("[data-block-id]");if(!l)return null;const a=t.textContent??"";return{runId:o.getAttribute("data-run-id"),blockId:l.getAttribute("data-block-id"),startOffset:he(a.slice(0,n.startOffset)).length,endOffset:he(a.slice(0,n.endOffset)).length}}function kl(e,n){var c,i;if((e==null?void 0:e.nodeType)!==1||((c=e.getAttribute)==null?void 0:c.call(e,"contenteditable"))!=="true")return null;const t=e.childNodes;if(t.length===0)return null;const r=n>=t.length,o=t[r?t.length-1:Math.max(0,n)],l=(o==null?void 0:o.nodeType)===1?(i=o.dataset)==null?void 0:i.runId:void 0;if(!l)return null;const a=o.closest("[data-block-id]");return a?{runId:l,blockId:a.getAttribute("data-block-id"),offset:r?he(o.textContent??"").length:0}:null}function We(e,n){var c;const t=kl(e,n);if(t)return t;let r=(e==null?void 0:e.nodeType)===1?e:e==null?void 0:e.parentElement;const o=(c=r==null?void 0:r.closest)==null?void 0:c.call(r,"[data-run-id]");if(!o)return null;const l=o.closest("[data-block-id]");if(!l)return null;let a=he((e.textContent??"").slice(0,n)).length;if(e===o){a=0;for(let i=0;i<n&&i<o.childNodes.length;i+=1)a+=he(o.childNodes[i].textContent??"").length}return{runId:o.getAttribute("data-run-id"),blockId:l.getAttribute("data-block-id"),offset:a}}function Ee(){var n;const e=(n=window.getSelection)==null?void 0:n.call(window);return!e||e.rangeCount===0||!e.isCollapsed?null:We(e.anchorNode,e.anchorOffset)}function $e(){var r;const e=(r=window.getSelection)==null?void 0:r.call(window);if(!e||e.rangeCount===0||e.isCollapsed)return null;const n=We(e.anchorNode,e.anchorOffset),t=We(e.focusNode,e.focusOffset);return!n||!t||n.blockId!==t.blockId?null:{blockId:n.blockId,startRunId:n.runId,startOffset:n.offset,endRunId:t.runId,endOffset:t.offset}}function Me(e){var d;const n=(d=window.getSelection)==null?void 0:d.call(window);if(!n||n.rangeCount===0||n.isCollapsed)return null;const t=We(n.anchorNode,n.anchorOffset),r=We(n.focusNode,n.focusOffset);if(!t||!r||t.blockId===r.blockId)return null;const o=e.getBlock(t.blockId),l=o&&e.getBlock(o.parentId);if(!l)return null;const a=l.contentIds,c=a.indexOf(t.blockId),i=a.indexOf(r.blockId);if(c===-1||i===-1)return null;const[u,p]=c<=i?[c,i]:[i,c];return{blockIds:a.slice(u,p+1),startBlockId:t.blockId,startRunId:t.runId,startOffset:t.offset,endBlockId:r.blockId,endRunId:r.runId,endOffset:r.offset}}function Xn(e,n,t){const o=e.getBlock(n).parentId,a=e.getBlock(o).contentIds.indexOf(n)+1,{block:c,runs:i=[],subtreeBlocks:u=[]}=t(o);return e.applyOperation(q(c,o,a,{blocks:[c,...u],runs:i})),c.id}function Ie(e,n,t){const r=Xn(e,n,t);return re(e,r),r}function yl(e,n,t){const{block:r,runs:o=[],subtreeBlocks:l=[]}=t(n);return e.applyOperation(q(r,n,0,{blocks:[r,...l],runs:o})),re(e,r.id),r.id}function er(e,n){if(typeof e.performBatch=="function")e.performBatch(n);else for(const t of n)e.applyOperation(t)}function vl(e,n,t){const r=e.findIndex(u=>u.id===n);if(r===-1)return null;const o=e[r],l=e.slice(0,r),a=e.slice(r+1);if(o.type==="text"){const u=o.value??"",p=u.slice(0,t),d=u.slice(t);p&&d?(l.push({...o,value:p}),a.unshift({...o,id:j(),value:d})):d?a.unshift(o):l.push(o)}else t>0?l.push(o):a.unshift(o);const c=l.length?l:[{id:j(),type:"text",value:"",marks:{}}],i=a.length?a:[{id:j(),type:"text",value:"",marks:{}}];return{leftRuns:c,rightRuns:i}}function He(e,n,t,r){const o=e.getBlock(n),l=e.getBlock(o.parentId),a=l.contentIds.indexOf(n)+1;return tr(e,n,t,r,{insertParentId:l.id,insertIndex:a,fallback:()=>Ie(e,n,r)})}function nr(e,n,t,r){return tr(e,n,t,r,{insertParentId:n,insertIndex:0,fallback:()=>yl(e,n,r)})}function tr(e,n,t,r,{insertParentId:o,insertIndex:l,fallback:a}){const c=Ee();if(!c||c.blockId!==n)return a();const i=t.map(x=>e.getRun(x)).filter(Boolean),u=vl(i,c.runId,c.offset);if(!u)return a();const{leftRuns:p,rightRuns:d}=u,{block:b,runs:m=d,subtreeBlocks:h=[]}=r(o,d),g=p.length?p:[{id:j(),type:"text",value:"",marks:{}}];return er(e,[ae(n,g),q(b,o,l,{blocks:[b,...h],runs:m})]),re(e,b.id),b.id}function wl(e){var n;return((n=e==null?void 0:e.props)==null?void 0:n.titleRunIds)??(e==null?void 0:e.contentIds)??[]}function Il(e){var n,t;return!!((n=e==null?void 0:e.props)!=null&&n.titleRunIds)&&(((t=e.contentIds)==null?void 0:t.length)??0)>0}function Cl(e,n,t){const o=e.getBlock(n).parentId,a=e.getBlock(o).contentIds.indexOf(n),{block:c,runs:i=[],subtreeBlocks:u=[]}=t(o);return er(e,[P(n),q(c,o,a,{blocks:[c,...u],runs:i})]),re(e,c.id),c.id}function ne(e,{blockId:n,runId:t,sliceStart:r,sliceEnd:o},l){const a=e.getRun(t),c=(a==null?void 0:a.value)??"",i=c.slice(0,r)+c.slice(o),u=e.getBlock(n),p=wl(u);return p.length===1&&p[0]===t&&i===""&&!Il(u)?Cl(e,n,l):(e.applyOperation(Y(t,{value:i})),Ie(e,n,l))}function $(e,n={}){return function(r,o){const l=j(),a=o!=null&&o.length?o:[{id:j(),type:"text",value:"",marks:{}}];return{block:{id:l,type:e,parentId:r,contentIds:a.map(c=>c.id),props:n},runs:a}}}function ze(e){const n=e.getRootId(),t=e.getBlock(n);if(!t||t.contentIds.length>0)return null;const{block:r,runs:o}=$("paragraph")(n);return e.applyOperation(q(r,n,0,{blocks:[r],runs:o})),r.id}const Bl=new Set(["callout"]),Rt=new Set(["paragraph","heading","blockquote"]);function rr(e,n){return e===n||Rt.has(e)&&Rt.has(n)}function Ze(e,n){const t=e.getBlock(n);if(!t)return null;const r=e.getBlock(t.parentId),o=r.contentIds.indexOf(n),l=t.contentIds.length===0||t.contentIds.length===1&&jl(e,t.contentIds[0]);if(o<=0){if(!l)return null;if(r.contentIds.length>1)return Le(e,[P(n)]),e.getBlock(r.id).contentIds[0];if(Bl.has(r.type))return Rl(e,r);if(t.type==="paragraph")return null;const{block:u,runs:p}=$("paragraph")(r.id);return Le(e,[q(u,r.id,o,{blocks:[u],runs:p}),P(n)]),u.id}const a=r.contentIds[o-1],c=e.getBlock(a);if(l)return Le(e,[P(n)]),a;if(Je(e,c))return Le(e,[P(a)]),n;if(!c||!rr(c.type,t.type))return null;const i=[...c.contentIds,...t.contentIds];return Le(e,[Ne(a,i),Ne(n,[]),P(n)]),a}function jl(e,n){const t=e.getRun(n);return!t||(t.value??"")===""}function Rl(e,n){const t=e.getBlock(n.parentId);if(!t)return null;const r=t.contentIds.indexOf(n.id),o=r>0?t.contentIds[r-1]:null,l=r!==-1&&r<t.contentIds.length-1?t.contentIds[r+1]:null;Le(e,[P(n.id)]);const a=ze(e);return o??l??a}function Le(e,n){if(typeof e.performBatch=="function")e.performBatch(n);else for(const t of n)e.applyOperation(t)}function Fe(e,n,t,r){if(!n||n===t)return;const o=gn(e,n);if(o){W(o);return}r(n),requestAnimationFrame(()=>{var l;(l=document.querySelector(`[data-block-id="${n}"]`))==null||l.focus()})}function Tl(e,n,t,r,o){const l=e.getBlock(n),c=e.getBlock(l.parentId).contentIds.indexOf(n),i="titleRunIds"in r,u="titleRunIds"in(l.props??{}),p={id:j(),type:t,parentId:l.parentId,contentIds:[],props:r},d=i?H(p.id,{titleRunIds:o}):Ne(p.id,o),b=u?H(n,{titleRunIds:[]}):Ne(n,[]);return{newBlockId:p.id,ops:[q(p,l.parentId,c,{blocks:[p],runs:[]}),d,b,P(n)]}}function Sl(e,n){if(typeof e.performBatch=="function")e.performBatch(n);else for(const t of n)e.applyOperation(t)}const El=[{re:/^(#{1,3})[  ]$/,type:"heading",props:e=>({level:e[1].length})},{re:/^[-*][  ]$/,type:"listItem",props:()=>({ordered:!1,titleRunIds:[]})},{re:/^\d+\.[  ]$/,type:"listItem",props:()=>({ordered:!0,titleRunIds:[]})},{re:/^\[\][  ]$/,type:"listItem",props:()=>({ordered:!1,checked:!1,titleRunIds:[]})},{re:/^>[  ]$/,type:"blockquote",props:()=>({})},{re:/^```$/,type:"code",props:()=>({language:"plaintext"})}];function Ol(e,n,t){if(t.length!==1||t[0].type!=="text")return!1;const r=t[0].value??"";for(const o of El){const l=o.re.exec(r);if(!l)continue;const a=r.slice(l[0].length),{ops:c}=Tl(e,n,o.type,o.props(l),[t[0].id]);return Sl(e,[Y(t[0].id,{value:a}),...c]),zn(t[0].id),!0}return!1}const Ll=new Set(["callout","toggleHeading"]);function Nl({id:e}){const n=D(),t=G(e),{setSelectedBlockId:r}=ge(),o=f.useCallback(()=>{const d=n.getBlock(t==null?void 0:t.parentId),b=ce(n,(t==null?void 0:t.contentIds)??[]),m=!!d&&d.contentIds[d.contentIds.length-1]===e;if(b&&m&&Ll.has(d==null?void 0:d.type)){Ie(n,d.id,$("paragraph"));return}He(n,e,(t==null?void 0:t.contentIds)??[],$("paragraph"))},[n,e,t]),l=f.useCallback(()=>{var g,x;const d=n.getBlock(t==null?void 0:t.parentId),b=ce(n,(t==null?void 0:t.contentIds)??[]),m=((g=d==null?void 0:d.contentIds)==null?void 0:g.length)===1&&d.contentIds[0]===e;if(b&&m&&(d==null?void 0:d.type)==="toggleHeading"){const k=((x=d.props)==null?void 0:x.titleRunIds)??[],y=k[k.length-1];y&&W(y);return}const h=Ze(n,e);Fe(n,h,e,r)},[n,e,t,r]),a=f.useCallback(()=>te(n,e,"up"),[n,e]),c=f.useCallback(()=>te(n,e,"down"),[n,e]),i=f.useCallback(d=>Ol(n,e,d),[n,e]),u=Z("be-paragraph",t);if(!t)return null;const p=ce(n,t.contentIds);return s.jsx("div",{className:u,"data-block-id":e,"data-empty":p?"":void 0,"data-placeholder":"Type '/' for commands",children:s.jsx(xe,{blockId:e,runIds:t.contentIds,onEnter:o,onBackspaceAtStart:l,onArrowUp:a,onArrowDown:c,onAutoformat:i})})}function Ae(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function ue(e){return Ae(e).replace(/"/g,"&quot;")}function Ce(e,n){var o,l;if(!e)return"";if(e.type!=="text"){const a=(o=n==null?void 0:n.inlineRegistry)==null?void 0:o.get(e.type);return a?a.toHTML(e,n):Ae(e.value??"")}const t=e.marks??{};let r=Ae(e.value??"");if(t.code&&(r=`<code>${r}</code>`),t.bold&&(r=`<strong>${r}</strong>`),t.italic&&(r=`<em>${r}</em>`),t.underline&&(r=`<u>${r}</u>`),t.strike&&(r=`<s>${r}</s>`),t.subscript&&(r=`<sub>${r}</sub>`),t.superscript&&(r=`<sup>${r}</sup>`),t.color&&(r=`<span style="color:${ue(t.color)}">${r}</span>`),t.highlight&&(r=`<span style="background-color:${ue(t.highlight)}">${r}</span>`),(l=t.link)!=null&&l.href){const a=t.link.target==="_blank"?' target="_blank" rel="noopener noreferrer"':"";r=`<a href="${ue(t.link.href)}"${a}>${r}</a>`}return r}function Be(e,n){var t;if(!e)return"";if(e.type!=="text"){const r=(t=n==null?void 0:n.inlineRegistry)==null?void 0:t.get(e.type);return r?r.toPlainText(e,n):e.value??""}return e.value??""}const Ml={STRONG:"bold",B:"bold",EM:"italic",I:"italic",U:"underline",S:"strike",STRIKE:"strike",DEL:"strike",CODE:"code",SUB:"subscript",SUP:"superscript"};function pe(e,n,t={}){const r=[],o=(l,a)=>{var u,p;if(l.nodeType===3){const d=l.textContent;d&&r.push({id:j(),type:"text",value:d,marks:{...a}});return}if(l.nodeType!==1)return;if(n!=null&&n.inlineRegistry)for(const d of n.inlineRegistry.listHtmlMatchers()){const b=d.fromHTML(l,n);if(b){r.push(b);return}}let c=a;const i=Ml[l.tagName];i&&(c={...c,[i]:!0}),l.tagName==="A"&&l.getAttribute("href")&&(c={...c,link:{href:l.getAttribute("href"),target:l.getAttribute("target")==="_blank"?"_blank":"_self"}}),(u=l.style)!=null&&u.color&&(c={...c,color:l.style.color}),(p=l.style)!=null&&p.backgroundColor&&(c={...c,highlight:l.style.backgroundColor});for(const d of l.childNodes)o(d,c)};return o(e,t),r.length?r:[{id:j(),type:"text",value:"",marks:{}}]}function Al(e,n){return`<p>${e.contentIds.map(r=>n.store.getRun(r)).map(r=>Ce(r,n)).join("")}</p>`}function Dl(e,n){return e.contentIds.map(t=>Be(n.store.getRun(t),n)).join("")}function _l(e,n){if(e.tagName!=="P")return null;const t=pe(e,n);return{block:{id:j(),type:"paragraph",parentId:null,contentIds:t.map(o=>o.id),props:{}},runs:t}}const or={component:Nl,isLeaf:!0,defaultProps:{},toHTML:Al,toPlainText:Dl,fromHTML:_l,slashCommand:{label:"Text",icon:Wo,keywords:["paragraph","text","p"],run:(e,n)=>ne(e,n,$("paragraph"))}};function Pl({id:e}){var b;const n=D(),t=G(e),{setSelectedBlockId:r}=ge(),o=f.useCallback(()=>{He(n,e,(t==null?void 0:t.contentIds)??[],$("paragraph"))},[n,e,t]),l=f.useCallback(()=>{const m=Ze(n,e);Fe(n,m,e,r)},[n,e,r]),a=f.useCallback(()=>te(n,e,"up"),[n,e]),c=f.useCallback(()=>te(n,e,"down"),[n,e]),i=((b=t==null?void 0:t.props)==null?void 0:b.level)??3,u=Z(`be-heading be-heading-${i}`,t);if(!t)return null;const p=`h${i}`,d=ce(n,t.contentIds);return s.jsx(p,{className:u,"data-block-id":e,"data-empty":d?"":void 0,"data-placeholder":`Heading ${i}`,children:s.jsx(xe,{blockId:e,runIds:t.contentIds,onEnter:o,onBackspaceAtStart:l,onArrowUp:a,onArrowDown:c})})}const jn={1:Yo,2:Go,3:Xo},$l={H1:1,H2:2,H3:3};function Hl(e,n){var o;const t=((o=e.props)==null?void 0:o.level)??3,r=e.contentIds.map(l=>n.store.getRun(l));return`<h${t}>${r.map(l=>Ce(l,n)).join("")}</h${t}>`}function zl(e,n){return e.contentIds.map(t=>Be(n.store.getRun(t),n)).join("")}function Fl(e,n){const t=$l[e.tagName];if(!t)return null;const r=pe(e,n);return{block:{id:j(),type:"heading",parentId:null,contentIds:r.map(l=>l.id),props:{level:t}},runs:r}}const lr={component:Pl,isLeaf:!0,defaultProps:{level:3},toHTML:Hl,toPlainText:zl,fromHTML:Fl,slashCommands:[{label:"Heading 1",icon:jn[1],keywords:["heading","h1","title"],run:(e,n)=>ne(e,n,$("heading",{level:1}))},{label:"Heading 2",icon:jn[2],keywords:["heading","h2","subtitle"],run:(e,n)=>ne(e,n,$("heading",{level:2}))},{label:"Heading 3",icon:jn[3],keywords:["heading","h3","title"],run:(e,n)=>ne(e,n,$("heading",{level:3}))}]},Ul=[];function Jn(e){const n=D(),t=f.useCallback(o=>n.subscribe(e,o),[n,e]),r=f.useCallback(()=>{const o=n.getBlock(e);return o?o.contentIds:Ul},[n,e]);return f.useSyncExternalStore(t,r)}class sr extends f.Component{constructor(){super(...arguments);xt(this,"state",{hasError:!1,nonce:0})}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(t,r){var o,l;process.env.NODE_ENV!=="production"&&console.error("[block-editor] a block failed to render; recovering by remounting it:",t,r),(l=(o=this.props).onError)==null||l.call(o,t,r),queueMicrotask(()=>this.setState(a=>({hasError:!1,nonce:a.nonce+1})))}render(){return this.state.hasError?null:s.jsx(f.Fragment,{children:this.props.children},this.state.nonce)}}const Qn=f.memo(function({id:n}){const t=G(n),r=Te();if(!t)return null;const o=r.get(t.type);if(!o)return process.env.NODE_ENV!=="production"&&console.warn(`[block-editor] No block type registered for "${t.type}" (id: ${n})`),null;const l=o.component;return s.jsx(sr,{children:s.jsx(l,{id:n})})});function xn(e,n,t){f.useEffect(()=>{if(!n)return;const r=Array.isArray(e)?e:[e],o=a=>{r.some(i=>i.current&&i.current.contains(a.target))||t()},l=a=>{a.key==="Escape"&&t()};return document.addEventListener("mousedown",o),document.addEventListener("keydown",l),()=>{document.removeEventListener("mousedown",o),document.removeEventListener("keydown",l)}},[n,t,e])}function en(e,n,t,r){const o={store:e,registry:n,inlineRegistry:r};return{html:Kl(e,n,t,o),text:t.map(l=>{const a=e.getBlock(l);return n.get(a.type).toPlainText(a,o)}).join(`
2039
+ `),json:JSON.stringify({version:1,blocks:t.map(l=>Zn(e,l))})}}function Kl(e,n,t,r){let o="",l=0;for(;l<t.length;){const a=e.getBlock(t[l]);if(a.type==="listItem"){const c=!!a.props.ordered;let i="",u=l;for(;u<t.length;){const d=e.getBlock(t[u]);if(d.type!=="listItem"||!!d.props.ordered!==c)break;i+=n.get("listItem").toHTML(d,r),u+=1}const p=c?"ol":"ul";o+=`<${p}>${i}</${p}>`,l=u}else if(a.type==="blockquote"){let c="",i=l;for(;i<t.length;){const u=e.getBlock(t[i]);if(u.type!=="blockquote")break;c+=n.get("blockquote").toHTML(u,r),i+=1}o+=`<blockquote>${c}</blockquote>`,l=i}else o+=n.get(a.type).toHTML(a,r),l+=1}return o}function Zn(e,n){const t=[],r=[],o=l=>{var i;const a=e.getRun(l);if(a){r.push(a);return}const c=e.getBlock(l);if(c){t.push(c);for(const u of c.contentIds)o(u);for(const u of((i=c.props)==null?void 0:i.titleRunIds)??[])o(u)}};return o(n),{rootId:n,blocks:t,runs:r}}function et({rootId:e,blocks:n,runs:t}){const r=new Map;for(const i of n)r.set(i.id,j());for(const i of t)r.set(i.id,j());const o=i=>r.get(i)??i,l=n.map(i=>{var u;return{...i,id:o(i.id),parentId:i.parentId?o(i.parentId):i.parentId,contentIds:i.contentIds.map(o),props:{...i.props,...(u=i.props)!=null&&u.titleRunIds?{titleRunIds:i.props.titleRunIds.map(o)}:{}}}}),a=t.map(i=>({...i,id:o(i.id)})),c=o(e);return{block:l.find(i=>i.id===c),runs:a,subtreeBlocks:l.filter(i=>i.id!==c)}}function nt(e,n){const t=e.getBlock(n);if(!t)return null;const r=e.getBlock(t.parentId),o=r.contentIds.indexOf(n),l=Zn(e,n),{block:a,runs:c,subtreeBlocks:i}=et(l);return e.applyOperation(q(a,r.id,o+1,{blocks:[a,...i],runs:c})),re(e,a.id),a.id}function tt(e,n){const t=e.getBlock(n),r=t&&e.getBlock(t.parentId);if(!r)return!1;const o=r.contentIds.indexOf(n);return o<=0?!1:(e.applyOperation(ve(n,r.id,o-1)),!0)}function rt(e,n){const t=e.getBlock(n),r=t&&e.getBlock(t.parentId);if(!r)return!1;const o=r.contentIds.indexOf(n);return o===-1||o>=r.contentIds.length-1?!1:(e.applyOperation(ve(n,r.id,o+1)),!0)}function kn(e,n){const t=e.getBlock(n);if(!t)return null;const r=e.getBlock(t.parentId),o=r.contentIds.indexOf(n),l=o>0?r.contentIds[o-1]:null,a=o!==-1&&o<r.contentIds.length-1?r.contentIds[o+1]:null;e.applyOperation(P(n));const c=ze(e),i=l??a??c;return i&&re(e,i),i??null}function ar({id:e}){var I;const n=D(),t=G(e),[r,o]=f.useState(!1),[l,a]=f.useState(null),c=f.useRef(null),i=f.useRef(null),u=f.useMemo(()=>[c,i],[]),[p]=Xe(),d=p.includes(e),b=f.useCallback(()=>o(!1),[]);xn(u,r,b);const m=f.useCallback(()=>{var T;a(((T=c.current)==null?void 0:T.getBoundingClientRect())??null),o(!0)},[]),h=f.useCallback(()=>{Ie(n,e,$("paragraph"))},[n,e]),g=f.useCallback(()=>{nt(n,e),b()},[n,e,b]),x=f.useCallback(()=>{tt(n,e),b()},[n,e,b]),k=f.useCallback(()=>{rt(n,e),b()},[n,e,b]),y=f.useCallback(()=>{kn(n,e),b()},[n,e,b]),v=!!((I=t==null?void 0:t.props)!=null&&I.hidden),S=f.useCallback(()=>{n.applyOperation(H(e,{hidden:!v})),b()},[n,e,v,b]);return t?s.jsxs("div",{className:`be-block-row${v?" be-block-row-hidden":""}${d?" be-block-row-range-selected":""}`,"data-block-row-id":e,children:[s.jsxs("div",{className:`be-block-gutter${r?" be-block-gutter-active":""}`,contentEditable:!1,children:[s.jsx("button",{type:"button",className:"be-block-gutter-btn",onClick:h,"aria-label":"Add block below",children:s.jsx(Fn,{size:16})}),s.jsx("button",{ref:c,type:"button",className:"be-block-gutter-btn","aria-label":"More options","aria-haspopup":"menu","aria-expanded":r,onClick:()=>r?b():m(),children:s.jsx(Vo,{size:16})})]}),s.jsx("div",{className:"be-block-row-content",children:s.jsx(Qn,{id:e})}),r&&l&&Pe.createPortal(s.jsxs("div",{ref:i,role:"menu","aria-label":"Block options",className:"be-block-gutter-menu",style:{position:"fixed",top:l.bottom+4,left:l.left},children:[s.jsxs("button",{type:"button",role:"menuitem",className:"be-block-gutter-menu-item",onClick:g,children:[s.jsx(Un,{size:15})," Duplicate"]}),s.jsxs("button",{type:"button",role:"menuitem",className:"be-block-gutter-menu-item",onClick:x,children:[s.jsx(Kn,{size:15})," Move up"]}),s.jsxs("button",{type:"button",role:"menuitem",className:"be-block-gutter-menu-item",onClick:k,children:[s.jsx(Vn,{size:15})," Move down"]}),s.jsxs("button",{type:"button",role:"menuitem",className:"be-block-gutter-menu-item",onClick:S,children:[v?s.jsx(Wn,{size:15}):s.jsx(Yn,{size:15}),v?"Show in preview":"Hide in preview"]}),s.jsxs("button",{type:"button",role:"menuitem",className:"be-block-gutter-menu-item be-block-gutter-menu-item-danger",onClick:y,children:[s.jsx(hn,{size:15})," Delete"]})]}),document.body)]}):null}function je({parentId:e,isTopLevel:n=!1}){const t=Jn(e),r=D(),[o]=$n(),l=o?t.filter(a=>{var c,i;return!((i=(c=r.getBlock(a))==null?void 0:c.props)!=null&&i.hidden)}):t;return n&&!o?l.map(a=>s.jsx(ar,{id:a},a)):l.map(a=>s.jsx(Qn,{id:a},a))}const Vl=97,ql=[[1e3,"m"],[900,"cm"],[500,"d"],[400,"cd"],[100,"c"],[90,"xc"],[50,"l"],[40,"xl"],[10,"x"],[9,"ix"],[5,"v"],[4,"iv"],[1,"i"]];function Wl(e){let n="";for(;e>0;)e-=1,n=String.fromCharCode(Vl+e%26)+n,e=Math.floor(e/26);return n}function Yl(e){let n="",t=e;for(const[r,o]of ql)for(;t>=r;)n+=o,t-=r;return n}function Gl(e){var n,t;return(e==null?void 0:e.type)==="listItem"&&((n=e.props)==null?void 0:n.checked)===void 0&&((t=e.props)==null?void 0:t.collapsed)===void 0}function Tt(e,n){let t=0,r=n;for(;r;){const o=e.getBlock(r.parentId);if(!o||o.type!=="listItem")break;t+=1,r=o}return t}function Xl(e,n,t){const r=t.indexOf(n.id);let o=1;for(let l=r-1;l>=0;l-=1){const a=e.getBlock(t[l]);if(!Gl(a)||!a.props.ordered)break;o+=1}return o}function Jl(e,n){const t=(e%3+3)%3;return t===0?`${n}.`:t===1?`${Wl(n)}.`:`${Yl(n)}.`}const Ql=["•","◦","▪"];function Zl(e){const n=(e%3+3)%3;return Ql[n]}function Ve({ordered:e=!1,checked:n,collapsed:t}={}){return function(o,l){const a=j(),c=l!=null&&l.length?l:[{id:j(),type:"text",value:"",marks:{}}],i={ordered:e,titleRunIds:c.map(b=>b.id)};n!==void 0&&(i.checked=n);let u=[],p=[],d=c;if(t!==void 0){i.collapsed=t;const{block:b,runs:m}=$("paragraph")(a);u=[b.id],p=[b],d=[...c,...m]}return{block:{id:a,type:"listItem",parentId:o,contentIds:u,props:i},runs:d,subtreeBlocks:p}}}function es(e,n){const t=e.getBlock(n),r=e.getBlock(t.parentId),o=r.contentIds.indexOf(n),l=o>0?r.contentIds[o-1]:null,a=l?e.getBlock(l):null;if(!a||a.type!=="listItem"){te(e,n,"down");return}e.applyOperation(ve(n,l,a.contentIds.length)),re(e,n)}function Sn(e,n){const t=e.getBlock(n),r=e.getBlock(t.parentId);if(!r||r.type!=="listItem")return;const o=r.parentId,a=e.getBlock(o).contentIds.indexOf(r.id);e.applyOperation(ve(n,o,a+1)),re(e,n)}function Ue(e,n){if(typeof e.performBatch=="function")e.performBatch(n);else for(const t of n)e.applyOperation(t)}function cr(e,n){var t;return n.length===0||n.length===1&&(((t=e.getRun(n[0]))==null?void 0:t.value)??"")===""}function ns(e,n){const t=n.contentIds??[];if(t.length===0)return!0;if(t.length>1)return!1;const r=e.getBlock(t[0]);return!!r&&r.type==="paragraph"&&ce(e,r.contentIds)}function ts(e,n){const t=e.getBlock(n);if(!t)return null;const r=e.getBlock(t.parentId),o=r.contentIds.indexOf(n),l=t.props.titleRunIds??[],c=cr(e,l)&&ns(e,t);if(o>0){const p=r.contentIds[o-1],d=e.getBlock(p);if(c)return Ue(e,[P(n)]),{focusBlockId:p,needsRefocus:!0};if(Je(e,d))return Ue(e,[P(p)]),{focusBlockId:n,needsRefocus:!1};if((d==null?void 0:d.type)==="listItem"&&t.contentIds.length===0){const b=[...d.props.titleRunIds??[],...l];return Ue(e,[H(p,{titleRunIds:b}),H(n,{titleRunIds:[]}),P(n)]),{focusBlockId:p,needsRefocus:!0}}return null}if(r.type==="listItem")return Sn(e,n),{focusBlockId:n,needsRefocus:!0};if(!c)return null;if(r.contentIds.length>1)return Ue(e,[P(n)]),{focusBlockId:e.getBlock(r.id).contentIds[0],needsRefocus:!0};const{block:i,runs:u}=$("paragraph")(r.id);return Ue(e,[q(i,r.id,o,{blocks:[i],runs:u}),P(n)]),{focusBlockId:i.id,needsRefocus:!0}}function rs(e,n){if(typeof e.performBatch=="function")e.performBatch(n);else for(const t of n)e.applyOperation(t)}function os(e,n){const r=e.getBlock(n).parentId,l=e.getBlock(r).contentIds.indexOf(n),{block:a,runs:c}=$("paragraph")(r);return rs(e,[q(a,r,l,{blocks:[a],runs:c}),H(n,{titleRunIds:[]}),P(n)]),re(e,a.id),a.id}function ls(e,n){if(typeof e.performBatch=="function")e.performBatch(n);else for(const t of n)e.applyOperation(t)}function ss({id:e}){var T,E;const n=D(),t=G(e),{setSelectedBlockId:r}=ge(),o=Jn(t==null?void 0:t.parentId),l=f.useCallback(()=>{var U,X,K,_,ee;const R=((U=t==null?void 0:t.props)==null?void 0:U.titleRunIds)??[],w=n.getBlock(t==null?void 0:t.parentId),B=cr(n,R);if(B&&(w==null?void 0:w.type)==="listItem"){Sn(n,e);return}const C=(((X=t==null?void 0:t.contentIds)==null?void 0:X.length)??0)>0;if(B&&(w==null?void 0:w.type)!=="listItem"&&!C){os(n,e);return}const O=((K=t==null?void 0:t.props)==null?void 0:K.checked)!==void 0,N=((_=t==null?void 0:t.props)==null?void 0:_.collapsed)!==void 0,M=Ve({ordered:(ee=t==null?void 0:t.props)==null?void 0:ee.ordered,checked:O?!1:void 0,collapsed:N?!1:void 0});C&&!N?nr(n,e,R,M):He(n,e,R,M)},[n,e,t]),a=f.useCallback(()=>es(n,e),[n,e]),c=f.useCallback(()=>Sn(n,e),[n,e]),i=f.useCallback(()=>{const R=ts(n,e);!R||!R.needsRefocus||Fe(n,R.focusBlockId,e,r)},[n,e,r]),u=f.useCallback(()=>te(n,e,"up"),[n,e]),p=f.useCallback(()=>te(n,e,"down"),[n,e]),d=f.useCallback(()=>{var R;n.applyOperation(H(e,{checked:!((R=t==null?void 0:t.props)!=null&&R.checked)}))},[n,e,(T=t==null?void 0:t.props)==null?void 0:T.checked]),b=f.useCallback(()=>{var w,B;if(!((((w=t==null?void 0:t.contentIds)==null?void 0:w.length)??0)>0)){const{block:C,runs:O}=$("paragraph")(e);ls(n,[q(C,e,0,{blocks:[C],runs:O}),H(e,{collapsed:!1})]),W(C.contentIds[0]);return}n.applyOperation(H(e,{collapsed:!((B=t==null?void 0:t.props)!=null&&B.collapsed)}))},[n,e,t==null?void 0:t.contentIds,(E=t==null?void 0:t.props)==null?void 0:E.collapsed]),m=Z("be-list-item",t);if(!t)return null;const{ordered:h,checked:g,collapsed:x,titleRunIds:k=[]}=t.props,y=g!==void 0,v=!y&&x!==void 0,S=t.contentIds.length>0,I=k.map(R=>n.getRun(R)).filter(R=>(R==null?void 0:R.type)==="text").map(R=>R.value).join("").trim();return s.jsxs("div",{className:m,"data-block-id":e,children:[s.jsxs("div",{className:"be-list-item-row",children:[y?s.jsx("input",{type:"checkbox",className:"be-list-checkbox",checked:!!g,onChange:d,"aria-label":I||"To-do item"}):v?s.jsx("button",{type:"button",className:"be-list-toggle-marker",onClick:b,"aria-expanded":!x,"aria-label":S?x?"Expand toggle":"Collapse toggle":"Add content to toggle",children:x?s.jsx(bn,{}):s.jsx(mn,{})}):s.jsx("span",{className:"be-list-marker","aria-hidden":"true",children:h?Jl(Tt(n,t),Xl(n,t,o)):Zl(Tt(n,t))}),s.jsx("div",{className:"be-list-item-title","data-empty":ce(n,k)?"":void 0,"data-placeholder":y?"To-do":v?"Toggle":"List item",style:g?{textDecoration:"line-through",opacity:.6}:void 0,children:s.jsx(xe,{blockId:e,runIds:k,onEnter:l,onTab:a,onShiftTab:c,onBackspaceAtStart:i,onArrowUp:u,onArrowDown:p})})]}),(!v||!x)&&s.jsx("div",{className:"be-list-item-children",children:s.jsx(je,{parentId:e})})]})}function as(e,n){const{titleRunIds:t=[],ordered:r}=e.props,o=t.map(c=>Ce(n.store.getRun(c),n)).join(""),l=e.contentIds.map(c=>n.registry.get(n.store.getBlock(c).type).toHTML(n.store.getBlock(c),n)).join(""),a=l?`<${r?"ol":"ul"}>${l}</${r?"ol":"ul"}>`:"";return`<li>${o}${a}</li>`}function cs(e,n){const{titleRunIds:t=[]}=e.props;return t.map(r=>Be(n.store.getRun(r),n)).join("")}function ir(e,n){const t=[],r=[];for(const d of e.childNodes)d.nodeType===1&&(d.tagName==="UL"||d.tagName==="OL")?r.push(d):t.push(d);const o=e.ownerDocument.createElement("span");for(const d of t)o.appendChild(d.cloneNode(!0));const l=pe(o,n),a=j(),c=[...l],i=[],u=[];for(const d of r){const b=d.tagName==="OL";for(const m of d.children){if(m.tagName!=="LI")continue;const h=ir(m,n);h.block.parentId=a,h.block.props.ordered=b,i.push(h.block,...h.childBlocks),c.push(...h.runs),u.push(h.block.id)}}return{block:{id:a,type:"listItem",parentId:null,contentIds:u,props:{ordered:!1,titleRunIds:l.map(d=>d.id)}},runs:c,childBlocks:i}}function is(e,n){if(e.tagName!=="LI")return null;const{block:t,runs:r,childBlocks:o}=ir(e,n);return{block:t,runs:r,subtreeBlocks:o}}const ur={component:ss,isLeaf:!1,defaultProps:{ordered:!1,titleRunIds:[]},toHTML:as,toPlainText:cs,fromHTML:is,slashCommands:[{label:"Bulleted list",icon:rl,keywords:["list","bullet","ul"],run:(e,n)=>ne(e,n,Ve({ordered:!1}))},{label:"Numbered list",icon:ol,keywords:["list","number","ordered","ol"],run:(e,n)=>ne(e,n,Ve({ordered:!0}))},{label:"To-do list",icon:Jt,keywords:["todo","checkbox","task","checklist"],run:(e,n)=>ne(e,n,Ve({ordered:!1,checked:!1}))},{label:"Toggle list",icon:bn,keywords:["toggle","collapse","expand","dropdown","accordion"],run:(e,n)=>ne(e,n,Ve({ordered:!1,collapsed:!1}))}]},dr=["text","date","checkbox","select"],yn="text",vn=160,cn=80;function us(e){return`Column ${e+1}`}function ot(e){return Array.from({length:e},(n,t)=>({id:j(),label:us(t),type:yn,width:vn}))}function de(e,n){var r;const t=(r=e.props)==null?void 0:r.columns;return!Array.isArray(t)||t.length!==n?ot(n):t.map(o=>{const l=o.type??yn,a=o.width??vn;return l===o.type&&a===o.width?o:{...o,type:l,width:a}})}function pr(e){switch(e){case"date":return{id:j(),type:"date",value:"",marks:{},data:{isoDate:""}};case"checkbox":return{id:j(),type:"checkbox",value:"",marks:{},data:{checked:!1,label:""}};case"select":return{id:j(),type:"tableSelect",value:"",marks:{},data:{selectedValue:"",selectedLabel:""}};default:return{id:j(),type:"text",value:"",marks:{}}}}function wn(e,n){const t=pr(n==null?void 0:n.type);return{block:{id:j(),type:"tableCell",parentId:e,contentIds:[t.id],props:{}},run:t}}function fr(e,n,t){if(e.type===n)return e;let r;if(e.type==="text")r=e.value??"";else{const o=t==null?void 0:t.get(e.type);r=o!=null&&o.toPlainText?o.toPlainText(e):""}if(n==="date"){const o=r?new Date(r):null,l=o&&!Number.isNaN(o.getTime())?o.toISOString().slice(0,10):"";return{id:j(),type:"date",value:"",marks:{},data:{isoDate:l}}}return n==="checkbox"?{id:j(),type:"checkbox",value:"",marks:{},data:{checked:!1,label:r}}:{id:j(),type:"text",value:r,marks:{}}}function Re(e,n){if(typeof e.performBatch=="function")e.performBatch(n);else for(const t of n)e.applyOperation(t)}function br(e,n){const r=e.getBlock(n.parentId).contentIds.indexOf(n.id);Re(e,[P(n.id)]);const o=ze(e);if(o)return re(e,o),null;const l=e.getBlock(n.parentId),a=l.contentIds[r]??l.contentIds[r-1];return a&&re(e,a),null}function lt(e,n){const t=e.getBlock(n),r=e.getBlock(t.parentId),o=r.contentIds.indexOf(n),l=de(r,t.contentIds.length),a=j(),c=[],i=[],u=[];for(const d of l){const b=wn(a,d);c.push(b.block),i.push(b.run),u.push(b.block.id)}const p={id:a,type:"tableRow",parentId:r.id,contentIds:u,props:{}};return e.applyOperation(q(p,r.id,o+1,{blocks:[p,...c],runs:i})),re(e,a),a}function mr(e,n){const t=e.getBlock(n),r=e.getBlock(t.parentId);if(r.contentIds.length<=1)return br(e,r);const o=r.contentIds.indexOf(n);Re(e,[P(n)]);const l=e.getBlock(r.id),a=Math.min(o,l.contentIds.length-1),c=l.contentIds[a];return c&&re(e,c),c??null}function un(e,n,t){const r=e.getBlock(n),o=de(r,r.contentIds[0]?e.getBlock(r.contentIds[0]).contentIds.length:0),l={id:j(),label:"New Column",type:yn,width:vn},a=[];let c=null;for(const u of r.contentIds){const p=wn(u,l);c===null&&(c=p.block.id),a.push(q(p.block,u,t+1,{blocks:[p.block],runs:[p.run]}))}const i=[...o];return i.splice(t+1,0,l),a.push(H(n,{columns:i})),Re(e,a),c&&re(e,c),c}function hr(e,n,t){const r=e.getBlock(n),o=e.getBlock(r.contentIds[0]);if(!o||o.contentIds.length<=1)return br(e,r);const l=de(r,o.contentIds.length),a=r.contentIds.map(d=>{const b=e.getBlock(d);return P(b.contentIds[t])}),c=l.filter((d,b)=>b!==t);a.push(H(n,{columns:c})),Re(e,a);const i=e.getBlock(r.contentIds[0]),u=Math.min(t,i.contentIds.length-1),p=i.contentIds[u];return p&&re(e,p),p??null}function gr(e,n,t,r){const o=e.getBlock(n),l=e.getBlock(o.contentIds[0]),a=de(o,l?l.contentIds.length:0);if(!a[t])return;const c=[...a];c[t]={...a[t],width:Math.max(cn,Math.round(r))},e.applyOperation(H(n,{columns:c}))}function xr(e,n,t,r){const o=e.getBlock(n),l=e.getBlock(o.contentIds[0]),c=[...de(o,l?l.contentIds.length:0)];c[t]&&(c[t]={...c[t],label:r},e.applyOperation(H(n,{columns:c})))}function st(e,n,t){return n.contentIds.map(r=>{const l=e.getBlock(r).contentIds[t],a=e.getBlock(l);return{cellId:l,run:e.getRun(a.contentIds[0])}})}function St(e,n){if(!e)return"";if(e.type==="text")return e.value??"";const t=n==null?void 0:n.get(e.type);return t!=null&&t.toPlainText?t.toPlainText(e):""}function ds(e,n,t,r){const o=st(e,n,t),l=[],a=new Map;for(const{run:i}of o){const u=St(i,r).trim();if(!u||a.has(u))continue;const p={value:j(),label:u};a.set(u,p),l.push(p)}const c=o.map(({cellId:i,run:u})=>{const p=St(u,r).trim(),d=a.get(p);return{cellId:i,run:{id:j(),type:"tableSelect",value:"",marks:{},data:{selectedValue:(d==null?void 0:d.value)??"",selectedLabel:(d==null?void 0:d.label)??""}}}});return{options:l,newRuns:c}}function kr(e,n,t,r,o){const l=e.getBlock(n),a=e.getBlock(l.contentIds[0]),c=de(l,a?a.contentIds.length:0),i=c[t];if(!i||i.type===r)return;const u=[...c];if(r==="select"){const{options:d,newRuns:b}=ds(e,l,t,o);u[t]={...i,type:r,options:d};const m=[H(n,{columns:u})];for(const{cellId:h,run:g}of b)m.push(ae(h,[g]));Re(e,m);return}u[t]={...i,type:r};const p=[H(n,{columns:u})];for(const{cellId:d,run:b}of st(e,l,t)){if(!b)continue;const m=fr(b,r,o);p.push(ae(d,[m]))}Re(e,p)}function sn(e,n,t,r){var d,b;const o=e.getBlock(n),l=e.getBlock(o.contentIds[0]),a=de(o,l?l.contentIds.length:0),c=a[t];if(!c)return;const i=[...a];i[t]={...c,options:r};const u=[H(n,{columns:i})],p=new Map(r.map(m=>[m.value,m]));for(const{run:m}of st(e,o,t)){if(!m||m.type!=="tableSelect")continue;const h=((d=m.data)==null?void 0:d.selectedValue)??"",g=p.get(h),x=g?h:"",k=g?g.label:"";(x!==h||k!==(((b=m.data)==null?void 0:b.selectedLabel)??""))&&u.push(Y(m.id,{data:{selectedValue:x,selectedLabel:k}}))}Re(e,u)}function Et(){if(typeof window>"u"||!window.visualViewport)return 0;const e=window.visualViewport,n=window.innerHeight-(e.height+e.offsetTop);return n>0?Math.round(n):0}function In(){const[e,n]=f.useState(Et);return f.useEffect(()=>{if(typeof window>"u"||!window.visualViewport)return;const t=window.visualViewport,r=()=>n(Et());return r(),t.addEventListener("resize",r),t.addEventListener("scroll",r),()=>{t.removeEventListener("resize",r),t.removeEventListener("scroll",r)}},[]),e}const ps=280;function fs(e,n){return n?e.label.toLowerCase().includes(n.toLowerCase()):!0}function Oe({value:e,options:n,onChange:t,placeholder:r="Select…",ariaLabel:o,className:l="",variant:a="default",selectedLabel:c,selectedColor:i,onManageOptions:u,manageOptionsLabel:p="Manage options…",mention:d=!1}){var V,le;const[b,m]=f.useState(!1),[h,g]=f.useState(""),[x,k]=f.useState(0),[y,v]=f.useState(null),S=In(),[I,T]=f.useState([]),[E,R]=f.useState(!1),[w,B]=f.useState(!1),C=f.useRef(null),O=f.useRef(null),N=f.useRef(null),M=f.useRef(null),U=f.useRef(null),X=f.useMemo(()=>[C,N],[]),K=a==="tag",_=typeof n=="function",ee=_?void 0:n.find(L=>L.value===e),F=e?ee??(c?{label:c,color:i}:void 0):void 0,se=f.useMemo(()=>_?I:n.filter(L=>fs(L,h)),[_,I,n,h]);f.useEffect(()=>{if(!_||!b)return;let L=!1;R(!0),B(!1);const Q=setTimeout(()=>{Promise.resolve(n(h)).then(ye=>{L||(T(ye??[]),R(!1))}).catch(()=>{L||(T([]),R(!1),B(!0))})},250);return()=>{L=!0,clearTimeout(Q)}},[_,b,n,h]);const ie=f.useCallback(()=>m(!1),[]);xn(X,b,ie);const oe=f.useCallback(()=>{var L;v(((L=O.current)==null?void 0:L.getBoundingClientRect())??null),g(""),k(0),m(!0)},[]);f.useEffect(()=>{var L;b&&((L=M.current)==null||L.focus())},[b]),f.useEffect(()=>{var L,Q;(Q=(L=U.current)==null?void 0:L.scrollIntoView)==null||Q.call(L,{block:"nearest"})},[x]);const J=f.useCallback(L=>{var Q;t(L.value,L),ie(),(Q=O.current)==null||Q.focus()},[t,ie]),ke=f.useCallback(L=>{var Q;L.key==="ArrowDown"?(L.preventDefault(),k(ye=>Math.min(ye+1,Math.max(se.length-1,0)))):L.key==="ArrowUp"?(L.preventDefault(),k(ye=>Math.max(ye-1,0))):L.key==="Enter"?(L.preventDefault(),se[x]&&J(se[x])):L.key==="Escape"&&(L.preventDefault(),ie(),(Q=O.current)==null||Q.focus())},[se,x,J,ie]);return s.jsxs("span",{className:`be-select ${l}`.trim(),ref:C,children:[s.jsx("button",{type:"button",ref:O,className:`be-select-trigger${K?" be-select-trigger-tag":""}${d?" be-select-trigger-mention":""}`,"aria-haspopup":"listbox","aria-expanded":b,"aria-label":o,onClick:()=>b?ie():oe(),children:K?F?s.jsx("span",{className:`be-select-tag${d?" be-select-tag-mention":""}`,style:d?void 0:{background:(V=F.color)==null?void 0:V.bg,color:(le=F.color)==null?void 0:le.text},children:d?`@${F.label}`:F.label}):s.jsx("span",{className:"be-select-value be-select-value-placeholder",children:r}):s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"be-select-value",children:F?F.label:r}),s.jsx(mn,{size:14,className:"be-select-chevron"})]})}),b&&y&&Pe.createPortal(s.jsxs("div",{ref:N,className:"be-select-popover",style:{position:"fixed",left:y.left,minWidth:y.width,...y.bottom+ps>window.innerHeight-S?{bottom:window.innerHeight-y.top+4}:{top:y.bottom+4}},children:[s.jsx("input",{ref:M,type:"text",className:"be-select-search",value:h,onChange:L=>{g(L.target.value),k(0)},onKeyDown:ke,placeholder:"Search…","aria-label":o?`Search ${o}`:"Search options"}),s.jsxs("div",{className:"be-select-options",role:"listbox",children:[_&&E&&s.jsx("div",{className:"be-select-empty",children:"Loading…"}),_&&!E&&w&&s.jsx("div",{className:"be-select-empty be-select-error",children:"Couldn't load options"}),!E&&!w&&se.length===0&&s.jsx("div",{className:"be-select-empty",children:"No results"}),!E&&!w&&se.map((L,Q)=>{var ye,gt;return s.jsx("div",{ref:Q===x?U:void 0,role:"option","aria-selected":L.value===e,className:`be-select-option${Q===x?" be-select-option-active":""}${L.value===e?" be-select-option-selected":""}`,onMouseDown:Ro=>{Ro.preventDefault(),J(L)},onMouseEnter:()=>k(Q),children:K?s.jsx("span",{className:"be-select-tag",style:{background:(ye=L.color)==null?void 0:ye.bg,color:(gt=L.color)==null?void 0:gt.text},children:L.label}):L.label},L.value)})]}),u&&s.jsx("button",{type:"button",className:"be-select-manage-options",onMouseDown:L=>{L.preventDefault(),ie(),u()},children:p})]}),document.body)]})}const tn=[{bg:"#e9e9e7",text:"#32302c"},{bg:"#eee0da",text:"#64473a"},{bg:"#fadec9",text:"#8a4b23"},{bg:"#fdecc8",text:"#8a6116"},{bg:"#dbeddb",text:"#256029"},{bg:"#d3e5ef",text:"#1a5f8a"},{bg:"#e8deee",text:"#5b3a8a"},{bg:"#f5e0e9",text:"#8a3a5f"},{bg:"#ffe2dd",text:"#a13a2f"}];function Ye(e){return tn[(e%tn.length+tn.length)%tn.length]}const bs={text:"Text",date:"Date",checkbox:"Checkbox",select:"Select"},ms=dr.map(e=>({value:e,label:bs[e]}));function hs({tableId:e,colIndex:n,options:t}){const r=D(),[o,l]=f.useState(""),a=f.useCallback((u,p)=>{sn(r,e,n,t.map(d=>d.value===u?{...d,label:p}:d))},[r,e,n,t]),c=f.useCallback(u=>sn(r,e,n,t.filter(p=>p.value!==u)),[r,e,n,t]),i=f.useCallback(()=>{const u=o.trim();l(""),u&&sn(r,e,n,[...t,{value:j(),label:u,color:Ye(t.length)}])},[r,e,n,t,o]);return s.jsxs("div",{className:"be-table-header-menu-options",children:[s.jsx("div",{className:"be-table-header-menu-options-label",children:"Options"}),t.map((u,p)=>s.jsxs("div",{className:"be-table-header-menu-option-row",children:[s.jsx("span",{className:"be-table-header-menu-option-swatch",style:{background:(u.color??Ye(p)).bg},"aria-hidden":"true"}),s.jsx("input",{className:"be-table-header-menu-option-input",value:u.label,onChange:d=>a(u.value,d.target.value),"aria-label":`Rename option ${u.label}`}),s.jsx("button",{type:"button",className:"be-table-header-menu-option-remove",onClick:()=>c(u.value),"aria-label":`Remove option ${u.label}`,children:s.jsx(Qe,{size:14})})]},u.value)),s.jsxs("div",{className:"be-table-header-menu-option-row",children:[s.jsx("input",{className:"be-table-header-menu-option-input",value:o,onChange:u=>l(u.target.value),placeholder:"New option…",onKeyDown:u=>{u.key==="Enter"&&(u.preventDefault(),i())}}),s.jsx("button",{type:"button",className:"be-table-header-menu-option-add",onClick:i,"aria-label":"Add option",children:"+"})]})]})}function gs({tableId:e,column:n,colIndex:t,colCount:r}){const o=D(),l=be(),[a,c]=f.useState(!1),[i,u]=f.useState(null),[p,d]=f.useState(null),b=f.useRef(null),m=f.useRef(null),h=f.useRef(null),g=f.useMemo(()=>[b,m],[]),x=f.useCallback(()=>c(!1),[]);xn(g,a,x);const k=f.useCallback(()=>{var R;u(((R=h.current)==null?void 0:R.getBoundingClientRect())??null),c(!0)},[]),y=f.useCallback(R=>xr(o,e,t,R.target.value),[o,e,t]),v=f.useCallback(()=>{un(o,e,t-1),x()},[o,e,t,x]),S=f.useCallback(()=>{un(o,e,t),x()},[o,e,t,x]),I=f.useCallback(()=>{hr(o,e,t),x()},[o,e,t,x]),T=f.useCallback(R=>kr(o,e,t,R,l),[o,e,t,l]),E=f.useCallback(R=>{var X;R.preventDefault();const w=(X=h.current)==null?void 0:X.closest("table"),B=w==null?void 0:w.querySelector(`col[data-col-index="${t}"]`);if(!B)return;const C=h.current.getBoundingClientRect().width,O=R.clientX,N=K=>Math.max(cn,Math.round(C+(K.clientX-O))),M=K=>{const _=N(K);B.style.width=`${_}px`,d(_)},U=K=>{document.removeEventListener("mousemove",M),document.removeEventListener("mouseup",U),gr(o,e,t,N(K)),d(null)};document.addEventListener("mousemove",M),document.addEventListener("mouseup",U)},[o,e,t]);return s.jsxs("th",{ref:h,className:"be-table-header-cell",contentEditable:!1,children:[s.jsx("input",{className:"be-table-header-label",value:n.label,onChange:y,"aria-label":`Column ${t+1} name`}),s.jsx("button",{ref:b,type:"button",className:"be-table-header-menu-trigger","aria-label":`Column ${t+1} options`,"aria-haspopup":"menu","aria-expanded":a,onClick:()=>a?x():k(),children:"⋮"}),s.jsx("div",{className:"be-table-col-resize-handle",onMouseDown:E,role:"slider","aria-label":`Resize column ${t+1}`,"aria-valuemin":cn,"aria-valuenow":p??n.width}),a&&i&&Pe.createPortal(s.jsxs("div",{ref:m,role:"menu",className:"be-table-header-menu",style:{position:"fixed",top:i.bottom+4,left:i.right,transform:"translateX(-100%)"},children:[s.jsxs("div",{className:"be-table-header-menu-type",children:[s.jsx("span",{id:`be-table-col-type-${n.id}`,children:"Type"}),s.jsx(Oe,{value:n.type,options:ms,onChange:T,ariaLabel:"Column type",className:""})]}),n.type==="select"&&s.jsx(hs,{tableId:e,colIndex:t,options:n.options??[]}),s.jsx("button",{type:"button",role:"menuitem",className:"be-table-header-menu-item",onClick:v,children:"Insert column left"}),s.jsx("button",{type:"button",role:"menuitem",className:"be-table-header-menu-item",onClick:S,children:"Insert column right"}),s.jsx("button",{type:"button",role:"menuitem",className:"be-table-header-menu-item be-table-header-menu-item-danger",onClick:I,disabled:r<=1,children:"Delete column"})]}),document.body)]})}function yr({tableId:e,columns:n}){return s.jsx("thead",{children:s.jsxs("tr",{className:"be-table-header-row",children:[n.map((t,r)=>s.jsx(gs,{tableId:e,column:t,colIndex:r,colCount:n.length},t.id)),s.jsx("th",{className:"be-table-header-spacer","aria-hidden":"true"})]})})}function xs({id:e}){var c;const n=D(),t=G(e),r=f.useCallback(()=>{var u;const i=(u=t==null?void 0:t.contentIds)==null?void 0:u[t.contentIds.length-1];i&&lt(n,i)},[n,t]),o=Z("be-table-wrapper",t);if(!t)return null;const l=n.getBlock(t.contentIds[0]),a=de(t,((c=l==null?void 0:l.contentIds)==null?void 0:c.length)??0);return s.jsx("div",{className:"be-table-scroll",children:s.jsxs("div",{className:o,"data-block-id":e,children:[s.jsxs("table",{className:"be-table",children:[s.jsxs("colgroup",{children:[a.map((i,u)=>s.jsx("col",{"data-col-index":u,style:{width:i.width}},i.id)),s.jsx("col",{className:"be-table-header-spacer-col"})]}),s.jsx(yr,{tableId:e,columns:a}),s.jsx("tbody",{children:s.jsx(je,{parentId:e})})]}),s.jsxs("button",{type:"button",className:"be-table-add-row",contentEditable:!1,onClick:r,children:[s.jsx(Fn,{size:14})," Add row"]})]})})}function ks({id:e}){const n=D(),t=G(e),r=Z("be-table-row",t),o=f.useCallback(()=>mr(n,e),[n,e]);return s.jsxs("tr",{className:r,"data-block-id":e,children:[s.jsx(je,{parentId:e}),s.jsx("td",{className:"be-table-row-actions",contentEditable:!1,children:s.jsx("button",{type:"button",className:"be-table-delete-row",onClick:o,"aria-label":"Delete row",title:"Delete row",children:s.jsx(Qe,{size:14})})})]})}function vr(e,n){const t=e.getBlock(n),r=e.getBlock(t.parentId),o=e.getBlock(r.parentId);return{table:o,row:r,rowIndex:o.contentIds.indexOf(r.id),colIndex:r.contentIds.indexOf(n)}}function ys(e,n,t){const{table:r,row:o,rowIndex:l,colIndex:a}=vr(e,n);if(t==="left"||t==="right"){const p=t==="right"?1:-1,d=a+p;if(d>=0&&d<o.contentIds.length)return o.contentIds[d];const b=l+p;if(b<0||b>=r.contentIds.length)return null;const m=e.getBlock(r.contentIds[b]),h=t==="right"?0:m.contentIds.length-1;return m.contentIds[h]}const i=l+(t==="down"?1:-1);if(i<0||i>=r.contentIds.length)return null;const u=e.getBlock(r.contentIds[i]);return u.contentIds[a]??u.contentIds[u.contentIds.length-1]??null}function vs(e,n){const t=Zt(e,n,"down");if(t){W(t);return}Ie(e,n,$("paragraph"))}function Ke(e,n,t){var o;const r=ys(e,n,t);if(r){const l=e.getBlock(r),a=(o=l==null?void 0:l.contentIds)==null?void 0:o[0];a&&W(a);return}if(t==="right"){const{table:l}=vr(e,n);vs(e,l.id)}}function ws({id:e}){const n=D(),t=G(e),r=f.useCallback(()=>Ke(n,e,"right"),[n,e]),o=f.useCallback(()=>Ke(n,e,"left"),[n,e]),l=f.useCallback(()=>Ke(n,e,"up"),[n,e]),a=f.useCallback(()=>Ke(n,e,"down"),[n,e]),c=f.useCallback(()=>Ke(n,e,"down"),[n,e]),i=Z("be-table-cell",t);return t?s.jsx("td",{className:i,"data-block-id":e,children:s.jsx(xe,{blockId:e,runIds:t.contentIds,onTab:r,onShiftTab:o,onArrowUp:l,onArrowDown:a,onEnter:c})}):null}function Is(e,n){const t=j(),r=[],o=[],l=[];for(const a of n){const c=wn(t,a);r.push(c.block),o.push(c.run),l.push(c.block.id)}return{block:{id:t,type:"tableRow",parentId:e,contentIds:l,props:{}},blocks:r,runs:o}}function Cs({rows:e=2,cols:n=2}={}){return function(r){const o=j(),l=ot(n),a=[],c=[],i=[];for(let p=0;p<e;p+=1){const d=Is(o,l);a.push(d.block,...d.blocks),c.push(...d.runs),i.push(d.block.id)}return{block:{id:o,type:"table",parentId:r,contentIds:i,props:{columns:l}},runs:c,subtreeBlocks:a}}}function Bs(e,n){return`<td>${e.contentIds.map(r=>n.store.getRun(r)).map(r=>Ce(r,n)).join("")}</td>`}function js(e,n){return e.contentIds.map(t=>Be(n.store.getRun(t),n)).join("")}function Rs(e,n){if(e.tagName!=="TD"&&e.tagName!=="TH")return null;const t=pe(e,n);return{block:{id:j(),type:"tableCell",parentId:null,contentIds:t.map(o=>o.id),props:{}},runs:t}}function Ts(e,n){return`<tr>${e.contentIds.map(r=>{const o=n.store.getBlock(r);return n.registry.get(o.type).toHTML(o,n)}).join("")}</tr>`}function Ss(e,n){return e.contentIds.map(t=>{const r=n.store.getBlock(t);return n.registry.get(r.type).toPlainText(r,n)}).join(" ")}function Es(e,n){if(e.tagName!=="TR")return null;const t=[...e.children].filter(i=>i.tagName==="TD"||i.tagName==="TH"),r=j(),o=[],l=[],a=[];for(const i of t){const u=n.registry.get("tableCell").fromHTML(i,n);u&&(u.block.parentId=r,o.push(u.block),l.push(...u.runs),a.push(u.block.id))}return{block:{id:r,type:"tableRow",parentId:null,contentIds:a,props:{}},runs:l,subtreeBlocks:o}}function Os(e,n){var a;const t=e.contentIds[0]&&n.store.getBlock(e.contentIds[0]),r=de(e,((a=t==null?void 0:t.contentIds)==null?void 0:a.length)??0),o=r.length?`<thead><tr>${r.map(c=>`<th>${Ae(c.label??"")}</th>`).join("")}</tr></thead>`:"",l=e.contentIds.map(c=>{const i=n.store.getBlock(c);return n.registry.get(i.type).toHTML(i,n)}).join("");return`<table>${o}<tbody>${l}</tbody></table>`}function Ls(e,n){return e.contentIds.map(t=>{const r=n.store.getBlock(t);return n.registry.get(r.type).toPlainText(r,n)}).join(`
2040
+ `)}function Ns(e,n){if(e.tagName!=="TABLE")return null;const t=e.querySelector("thead tr"),r=e.querySelector("tbody")?[...e.querySelectorAll("tbody tr")]:[...e.querySelectorAll("tr")].filter(p=>p!==t),o=j(),l=[],a=[],c=[];for(const p of r){const d=n.registry.get("tableRow").fromHTML(p,n);if(d){d.block.parentId=o;for(const b of d.subtreeBlocks)b.parentId=d.block.id;l.push(d.block,...d.subtreeBlocks),a.push(...d.runs),c.push(d.block.id)}}const i={};if(t){const p=[...t.children].filter(d=>d.tagName==="TH"||d.tagName==="TD");i.columns=p.map(d=>({id:j(),label:d.textContent??""}))}return{block:{id:o,type:"table",parentId:null,contentIds:c,props:i},runs:a,subtreeBlocks:l}}const wr={component:ws,isLeaf:!0,defaultProps:{},toHTML:Bs,toPlainText:js,fromHTML:Rs},Ir={component:ks,isLeaf:!1,defaultProps:{},toHTML:Ts,toPlainText:Ss,fromHTML:Es},Cr={component:xs,isLeaf:!1,defaultProps:{},toHTML:Os,toPlainText:Ls,fromHTML:Ns,slashCommand:{label:"Table",icon:nl,keywords:["table","grid"],run:(e,n)=>ne(e,n,Cs({rows:2,cols:2}))}};function Ms({id:e}){const n=G(e),t=Z("be-layout",n);return s.jsx("div",{className:t,"data-block-id":e,style:{display:"flex",gap:"1em"},children:s.jsx(je,{parentId:e})})}function As({id:e}){const n=G(e),t=Z("be-layout-column",n);return s.jsx("div",{className:t,"data-block-id":e,children:s.jsx(je,{parentId:e})})}function Ds({columns:e=2}={}){return function(t){const r=j(),o=[],l=[],a=[];for(let i=0;i<e;i+=1){const u=j(),{block:p,runs:d}=$("paragraph")(u),b={id:u,type:"layoutColumn",parentId:r,contentIds:[p.id],props:{}};o.push(b,p),l.push(...d),a.push(u)}return{block:{id:r,type:"layout",parentId:t,contentIds:a,props:{}},runs:l,subtreeBlocks:o}}}function Br(e,n){return(t,r)=>`${e}${t.contentIds.map(o=>{const l=r.store.getBlock(o);return r.registry.get(l.type).toHTML(l,r)}).join("")}${n}`}function jr(e,n){return e.contentIds.map(t=>{const r=n.store.getBlock(t);return n.registry.get(r.type).toPlainText(r,n)}).join(`
2041
+ `)}const Rr={component:As,isLeaf:!1,defaultProps:{},toHTML:Br("<div>","</div>"),toPlainText:jr},Tr={component:Ms,isLeaf:!1,defaultProps:{},toHTML:Br('<div style="display:flex;gap:1em">',"</div>"),toPlainText:jr,slashCommands:[2,3,4,5].map(e=>({label:`${e} columns`,icon:tl,keywords:["layout","columns","column",String(e)],run:(n,t)=>ne(n,t,Ds({columns:e}))}))};function _s({id:e}){const n=G(e),t=Z("be-divider",n);return s.jsx("hr",{className:t,"data-block-id":e,contentEditable:!1,tabIndex:-1})}function Ps(){return function(n){return{block:{id:j(),type:"divider",parentId:n,contentIds:[],props:{}},runs:[]}}}function $s(){return"<hr />"}function Hs(){return"---"}function zs(e){return e.tagName!=="HR"?null:{block:{id:j(),type:"divider",parentId:null,contentIds:[],props:{}},runs:[]}}const Sr={component:_s,isLeaf:!0,defaultProps:{},toHTML:$s,toPlainText:Hs,fromHTML:zs,slashCommand:{label:"Divider",icon:Qo,keywords:["divider","hr","separator","line"],run:(e,{blockId:n,runId:t,sliceStart:r,sliceEnd:o})=>{const l=e.getRun(t),a=(l==null?void 0:l.value)??"";e.applyOperation(Y(t,{value:a.slice(0,r)+a.slice(o)}));const c=Xn(e,n,Ps());return Ie(e,c,$("paragraph")),c}}},nn="💡",Er="gray";function Fs({icon:e=nn,color:n=Er}={}){return function(r){const o=j(),{block:l,runs:a}=$("paragraph")(o);return{block:{id:o,type:"callout",parentId:r,contentIds:[l.id],props:{icon:e,color:n}},runs:a,subtreeBlocks:[l]}}}const Or=[{value:"gray",label:"Gray"},{value:"blue",label:"Blue"},{value:"green",label:"Green"},{value:"yellow",label:"Yellow"},{value:"orange",label:"Orange"},{value:"red",label:"Red"},{value:"purple",label:"Purple"},{value:"pink",label:"Pink"}];function Us({id:e}){var k,y;const n=D(),t=G(e),[r,o]=f.useState(!1),[l,a]=f.useState(!1),c=f.useRef(null),i=f.useRef(null),u=f.useMemo(()=>[c,i],[]),p=f.useCallback(()=>a(!1),[]);xn(u,l,p);const d=((k=t==null?void 0:t.props)==null?void 0:k.icon)??nn,b=((y=t==null?void 0:t.props)==null?void 0:y.color)??Er,m=f.useCallback(v=>{const S=v.target.value.trim();S&&n.applyOperation(H(e,{icon:S})),o(!1)},[n,e]),h=f.useCallback(v=>{v.key==="Enter"&&v.currentTarget.blur(),v.key==="Escape"&&o(!1)},[]),g=f.useCallback(v=>{n.applyOperation(H(e,{color:v})),a(!1)},[n,e]),x=Z("be-callout",t);return t?s.jsxs("div",{className:x,"data-block-id":e,"data-color":b,children:[s.jsx("div",{className:"be-callout-icon-wrap",children:r?s.jsx("input",{type:"text",className:"be-callout-icon-input",defaultValue:d,autoFocus:!0,onBlur:m,onKeyDown:h,"aria-label":"Callout icon (paste or type an emoji)"}):s.jsx("button",{type:"button",className:"be-callout-icon",onClick:()=>o(!0),"aria-label":"Change callout icon",title:"Change icon",children:d})}),s.jsx("div",{className:"be-callout-content",children:s.jsx(je,{parentId:e})}),s.jsxs("div",{className:"be-callout-color-wrap",contentEditable:!1,children:[s.jsx("button",{ref:c,type:"button",className:"be-callout-color-trigger","aria-label":"Callout color","aria-haspopup":"true","aria-expanded":l,title:"Callout color",onClick:()=>a(v=>!v),children:s.jsx("span",{className:`be-callout-color-dot be-callout-color-dot-${b}`})}),l&&s.jsx("div",{ref:i,className:"be-callout-color-picker",role:"menu","aria-label":"Callout color",children:Or.map(v=>s.jsx("button",{type:"button",role:"menuitem",className:`be-callout-color-option be-callout-color-option-${v.value}${v.value===b?" be-callout-color-option-active":""}`,title:v.label,"aria-label":v.label,onClick:()=>g(v.value)},v.value))})]})]}):null}function Ks(e,n){return e.contentIds.map(t=>{const r=n.store.getBlock(t);return n.registry.get(r.type).toHTML(r,n)}).join("")}function Vs(e,n){var r;const t=((r=e.props)==null?void 0:r.icon)??nn;return`<div class="callout" data-icon="${t}"><div class="callout-icon">${t}</div><div class="callout-content">${Ks(e,n)}</div></div>`}function qs(e,n){var o;const t=((o=e.props)==null?void 0:o.icon)??nn,r=e.contentIds.map(l=>{const a=n.store.getBlock(l);return n.registry.get(a.type).toPlainText(a,n)}).join(`
2042
+ `);return`${t} ${r}`}const Lr={component:Us,isLeaf:!1,defaultProps:{icon:nn},toHTML:Vs,toPlainText:qs,slashCommand:{label:"Callout",icon:Zo,keywords:["callout","aside","note","info","tip","warning"],run:(e,n)=>ne(e,n,Fs())}};function Ws({id:e}){const n=D(),t=G(e),{setSelectedBlockId:r}=ge(),o=f.useCallback(()=>{He(n,e,(t==null?void 0:t.contentIds)??[],$("paragraph"))},[n,e,t]),l=f.useCallback(()=>{const p=Ze(n,e);Fe(n,p,e,r)},[n,e,r]),a=f.useCallback(()=>te(n,e,"up"),[n,e]),c=f.useCallback(()=>te(n,e,"down"),[n,e]),i=Z("be-blockquote",t);if(!t)return null;const u=ce(n,t.contentIds);return s.jsx("blockquote",{className:i,"data-block-id":e,"data-empty":u?"":void 0,"data-placeholder":"Empty quote",children:s.jsx(xe,{blockId:e,runIds:t.contentIds,onEnter:o,onBackspaceAtStart:l,onArrowUp:a,onArrowDown:c})})}function Ys(e,n){return`<p>${e.contentIds.map(r=>n.store.getRun(r)).map(r=>Ce(r,n)).join("")}</p>`}function Gs(e,n){return e.contentIds.map(t=>Be(n.store.getRun(t),n)).join("")}function Xs(e,n){if(e.tagName!=="BLOCKQUOTE")return null;const t=pe(e,n);return{block:{id:j(),type:"blockquote",parentId:null,contentIds:t.map(o=>o.id),props:{}},runs:t}}const Nr={component:Ws,isLeaf:!0,defaultProps:{},toHTML:Ys,toPlainText:Gs,fromHTML:Xs,slashCommand:{label:"Quote",icon:Jo,keywords:["quote","blockquote","citation"],run:(e,n)=>ne(e,n,$("blockquote"))}},Mr=["plaintext","javascript","python","html","css","json","bash","sql"],Js=Mr.map(e=>({value:e,label:e}));function Ot(e,n,t){const r=Ee();if(!r||r.blockId!==n)return;const o=e.getRun(r.runId);if(!o||o.type!=="text")return;const l=o.value??"",a=l.slice(0,r.offset)+t+l.slice(r.offset);e.applyOperation(Y(o.id,{value:a})),me(o.id,r.offset+t.length)}function Qs({id:e}){var m;const n=D(),t=G(e),r=f.useCallback(()=>Ot(n,e,`
2043
+ `),[n,e]),o=f.useCallback(()=>Ot(n,e," "),[n,e]),l=f.useCallback(()=>{var k;const h=Ze(n,e);if(!h||h===e)return;const g=n.getBlock(h),x=(k=g==null?void 0:g.contentIds)==null?void 0:k[g.contentIds.length-1];x&&W(x)},[n,e]),a=f.useCallback(()=>te(n,e,"up"),[n,e]),c=f.useCallback(()=>te(n,e,"down"),[n,e]),i=f.useCallback(h=>n.applyOperation(H(e,{language:h})),[n,e]),u=f.useCallback(()=>kn(n,e),[n,e]),p=Z("be-code-block",t);if(!t)return null;const d=((m=t.props)==null?void 0:m.language)??"plaintext",b=ce(n,t.contentIds);return s.jsxs("div",{className:p,"data-block-id":e,children:[s.jsxs("div",{className:"be-code-block-header",contentEditable:!1,children:[s.jsx(Oe,{className:"be-code-block-language",value:d,options:Js,onChange:i,ariaLabel:"Code language"}),s.jsx("button",{type:"button",className:"be-code-block-delete",onClick:u,"aria-label":"Delete code block",title:"Delete code block",children:s.jsx(hn,{size:14})})]}),s.jsx("pre",{className:"be-code-block-pre",children:s.jsx("code",{"data-empty":b?"":void 0,"data-placeholder":"Empty code block",children:s.jsx(xe,{blockId:e,runIds:t.contentIds,onEnter:r,onTab:o,onBackspaceAtStart:l,onArrowUp:a,onArrowDown:c})})})]})}function Zs(e,n){var l;const t=e.contentIds.map(a=>n.store.getRun(a)),r=(l=e.props)==null?void 0:l.language;return`<pre><code${r&&r!=="plaintext"?` data-language="${Ae(r)}"`:""}>${t.map(a=>Ce(a,n)).join("")}</code></pre>`}function ea(e,n){return e.contentIds.map(t=>Be(n.store.getRun(t),n)).join("")}function na(e,n){var a;if(e.tagName!=="PRE")return null;const t=e.querySelector("code")??e,r=(a=t.getAttribute)==null?void 0:a.call(t,"data-language"),o=j();return{block:{id:j(),type:"code",parentId:null,contentIds:[o],props:r?{language:r}:{}},runs:[{id:o,type:"text",value:t.textContent??"",marks:{}}]}}const Ar={component:Qs,isLeaf:!0,defaultProps:{language:"plaintext"},toHTML:Zs,toPlainText:ea,fromHTML:na,slashCommand:{label:"Code",icon:Xt,keywords:["code","codeblock","snippet","pre"],run:(e,n)=>ne(e,n,$("code"))}};function ta(e,n){var t;return n.length===0||n.length===1&&(((t=e.getRun(n[0]))==null?void 0:t.value)??"")===""}function ra(e,n){const t=n.contentIds??[];if(t.length===0)return!0;if(t.length>1)return!1;const r=e.getBlock(t[0]);return!!r&&r.type==="paragraph"&&ce(e,r.contentIds)}function rn(e,n){if(typeof e.performBatch=="function")e.performBatch(n);else for(const t of n)e.applyOperation(t)}function oa(e,n){const t=e.getBlock(n);if(!t)return null;const r=e.getBlock(t.parentId),o=r.contentIds.indexOf(n),l=t.props.titleRunIds??[],a=ta(e,l)&&ra(e,t);if(o<=0){if(!a)return null;if(r.contentIds.length>1)return rn(e,[P(n)]),{focusBlockId:e.getBlock(r.id).contentIds[0],needsRefocus:!0};const{block:u,runs:p}=$("paragraph")(r.id);return rn(e,[q(u,r.id,o,{blocks:[u],runs:p}),P(n)]),{focusBlockId:u.id,needsRefocus:!0}}const c=r.contentIds[o-1],i=e.getBlock(c);return a?(rn(e,[P(n)]),{focusBlockId:c,needsRefocus:!0}):Je(e,i)?(rn(e,[P(c)]),{focusBlockId:n,needsRefocus:!1}):null}function la(e,n){if(typeof e.performBatch=="function")e.performBatch(n);else for(const t of n)e.applyOperation(t)}function sa({id:e}){var g;const n=D(),t=G(e),{setSelectedBlockId:r}=ge(),o=f.useCallback(()=>{var v,S;const x=((v=t==null?void 0:t.props)==null?void 0:v.titleRunIds)??[],k=(((S=t==null?void 0:t.contentIds)==null?void 0:S.length)??0)>0,y=$("paragraph");k?nr(n,e,x,y):He(n,e,x,y)},[n,e,t]),l=f.useCallback(()=>{const x=oa(n,e);!x||!x.needsRefocus||Fe(n,x.focusBlockId,e,r)},[n,e,r]),a=f.useCallback(()=>te(n,e,"up"),[n,e]),c=f.useCallback(()=>te(n,e,"down"),[n,e]),i=f.useCallback(()=>{var k,y;if(!((((k=t==null?void 0:t.contentIds)==null?void 0:k.length)??0)>0)){const{block:v,runs:S}=$("paragraph")(e);la(n,[q(v,e,0,{blocks:[v],runs:S}),H(e,{collapsed:!1})]),W(v.contentIds[0]);return}n.applyOperation(H(e,{collapsed:!((y=t==null?void 0:t.props)!=null&&y.collapsed)}))},[n,e,t==null?void 0:t.contentIds,(g=t==null?void 0:t.props)==null?void 0:g.collapsed]),u=Z("be-toggle-heading",t);if(!t)return null;const{level:p=2,collapsed:d,titleRunIds:b=[]}=t.props,m=t.contentIds.length>0,h=`h${p}`;return s.jsxs("div",{className:u,"data-block-id":e,children:[s.jsxs("div",{className:"be-toggle-heading-row",children:[s.jsx("button",{type:"button",className:"be-toggle-heading-marker",onClick:i,"aria-expanded":!d,"aria-label":m?d?"Expand section":"Collapse section":"Add content to section",children:d?s.jsx(bn,{}):s.jsx(mn,{})}),s.jsx(h,{className:`be-heading be-heading-${p} be-toggle-heading-title`,"data-empty":ce(n,b)?"":void 0,"data-placeholder":`Toggle heading ${p}`,children:s.jsx(xe,{blockId:e,runIds:b,onEnter:o,onBackspaceAtStart:l,onArrowUp:a,onArrowDown:c})})]}),!d&&s.jsx("div",{className:"be-toggle-heading-children",children:s.jsx(je,{parentId:e})})]})}function aa({level:e=2,collapsed:n=!1}={}){return function(r,o){const l=j(),a=o!=null&&o.length?o:[{id:j(),type:"text",value:"",marks:{}}],{block:c,runs:i}=$("paragraph")(l);return{block:{id:l,type:"toggleHeading",parentId:r,contentIds:[c.id],props:{level:e,collapsed:n,titleRunIds:a.map(u=>u.id)}},runs:[...a,...i],subtreeBlocks:[c]}}}function ca(e,n){const{titleRunIds:t=[],level:r=2,collapsed:o}=e.props,l=t.map(c=>Ce(n.store.getRun(c),n)).join(""),a=e.contentIds.map(c=>{const i=n.store.getBlock(c);return n.registry.get(i.type).toHTML(i,n)}).join("");return`<details${o?"":" open"}><summary><h${r}>${l}</h${r}></summary>${a}</details>`}function ia(e,n){const{titleRunIds:t=[]}=e.props,r=t.map(l=>Be(n.store.getRun(l),n)).join(""),o=e.contentIds.map(l=>{const a=n.store.getBlock(l);return n.registry.get(a.type).toPlainText(a,n)}).join(`
2044
+ `);return o?`${r}
2045
+ ${o}`:r}function ua(e,n){if(e.tagName!=="DETAILS")return null;const t=[...e.children].find(d=>d.tagName==="SUMMARY"),r=t==null?void 0:t.querySelector("h1,h2,h3,h4,h5,h6"),o=r?Math.min(6,Math.max(1,Number(r.tagName[1]))):2,l=r?pe(r,n):[{id:j(),type:"text",value:"",marks:{}}],a=j(),c=[],i=[],u=[];for(const d of e.children){if(d===t||d.tagName!=="P")continue;const b=pe(d,n),m={id:j(),type:"paragraph",parentId:a,contentIds:b.map(h=>h.id),props:{}};c.push(m),i.push(...b),u.push(m.id)}if(u.length===0){const{block:d,runs:b}=$("paragraph")(a);c.push(d),i.push(...b),u.push(d.id)}return{block:{id:a,type:"toggleHeading",parentId:null,contentIds:u,props:{level:o,collapsed:!e.hasAttribute("open"),titleRunIds:l.map(d=>d.id)}},runs:[...l,...i],subtreeBlocks:c}}const Dr={component:sa,isLeaf:!1,defaultProps:{level:2,collapsed:!1,titleRunIds:[]},toHTML:ca,toPlainText:ia,fromHTML:ua,slashCommands:[1,2,3].map(e=>({label:`Toggle heading ${e}`,icon:bn,keywords:["toggle","heading","collapse","section"],run:(n,t)=>ne(n,t,aa({level:e}))}))},Rn=[{label:"Blue",value:"#2b6fd6"},{label:"Green",value:"#2f9e44"},{label:"Red",value:"#e03131"},{label:"Purple",value:"#9c36b5"},{label:"Gray",value:"#495057"},{label:"Black",value:"#1a1a1a"}];function da(e,n){if(typeof e.performBatch=="function")e.performBatch(n);else for(const t of n)e.applyOperation(t)}function pa({isOpen:e,onClose:n,store:t,blockId:r}){const[o,l]=f.useState(""),[a,c]=f.useState(""),[i,u]=f.useState(Rn[0].value),[p,d]=f.useState([{key:"",value:""}]);f.useEffect(()=>{var y,v,S;if(!e)return;const g=t.getBlock(r);if(!g)return;const x=g.contentIds.map(I=>{var T;return((T=t.getRun(I))==null?void 0:T.value)??""}).join(""),k=((y=g.props)==null?void 0:y.customAttrs)??[];l(x),c(((v=g.props)==null?void 0:v.href)??""),u(((S=g.props)==null?void 0:S.color)??Rn[0].value),d([...k,{key:"",value:""}])},[e,r,t]);const b=f.useCallback((g,x)=>{d(k=>{const y=k.map((S,I)=>I===g?{...S,...x}:S),v=y[y.length-1];return(v.key.trim()||v.value.trim())&&y.push({key:"",value:""}),y})},[]),m=f.useCallback(g=>{d(x=>x.filter((k,y)=>y!==g))},[]),h=f.useCallback(()=>{const g={id:j(),type:"text",value:o,marks:{}},x=p.filter(k=>k.key.trim());da(t,[ae(r,[g]),H(r,{href:a.trim(),color:i,customAttrs:x})]),n()},[t,r,o,a,i,p,n]);return s.jsxs(Se,{isOpen:e,onClose:n,title:"Edit button",children:[s.jsxs("label",{className:"be-modal-field",children:[s.jsx("span",{children:"Label"}),s.jsx("input",{type:"text",value:o,onChange:g=>l(g.target.value),placeholder:"Button"})]}),s.jsxs("label",{className:"be-modal-field",children:[s.jsx("span",{children:"Link URL"}),s.jsx("input",{type:"url",value:a,onChange:g=>c(g.target.value),placeholder:"https://example.com"})]}),s.jsxs("div",{className:"be-modal-field",children:[s.jsx("span",{children:"Color"}),s.jsx("div",{className:"be-modal-color-row",children:Rn.map(g=>s.jsx("button",{type:"button",className:`be-modal-color-swatch${i===g.value?" be-modal-color-swatch-active":""}`,style:{backgroundColor:g.value},title:g.label,"aria-label":g.label,onClick:()=>u(g.value)},g.value))})]}),s.jsxs("div",{className:"be-modal-field",children:[s.jsx("span",{children:"Custom attributes"}),p.map((g,x)=>s.jsxs("div",{className:"be-modal-attr-row",children:[s.jsx("input",{type:"text",placeholder:"name",value:g.key,onChange:k=>b(x,{key:k.target.value})}),s.jsx("input",{type:"text",placeholder:"value",value:g.value,onChange:k=>b(x,{value:k.target.value})}),(g.key||g.value)&&s.jsx("button",{type:"button",className:"be-modal-attr-remove",onClick:()=>m(x),"aria-label":"Remove attribute",children:s.jsx(Qe,{size:14})})]},x))]}),s.jsxs("div",{className:"be-modal-actions",children:[s.jsx("button",{type:"button",className:"be-modal-cancel",onClick:n,children:"Cancel"}),s.jsx("button",{type:"button",className:"be-modal-save",onClick:h,children:"Save"})]})]})}const fa="#2b6fd6";function ba({id:e}){var k,y,v,S;const n=D(),t=G(e),{setSelectedBlockId:r}=ge(),[o,l]=f.useState(!1),a=f.useCallback(()=>{He(n,e,(t==null?void 0:t.contentIds)??[],$("paragraph"))},[n,e,t]),c=f.useCallback(()=>{const I=Ze(n,e);Fe(n,I,e,r)},[n,e,r]),i=f.useCallback(()=>te(n,e,"up"),[n,e]),u=f.useCallback(()=>te(n,e,"down"),[n,e]),p=f.useCallback(()=>{var T;const I=(T=t==null?void 0:t.props)==null?void 0:T.href;I&&window.open(I,"_blank","noopener,noreferrer")},[(k=t==null?void 0:t.props)==null?void 0:k.href]),d=Z("be-button-block",t);if(!t)return null;const b=((y=t.props)==null?void 0:y.href)??"",m=((v=t.props)==null?void 0:v.color)??fa,h=((S=t.props)==null?void 0:S.customAttrs)??[],g=ce(n,t.contentIds),x={};for(const{key:I,value:T}of h)I.trim()&&(x[`data-${I.trim()}`]=T);return s.jsxs("div",{className:d,"data-block-id":e,children:[s.jsxs("div",{className:"be-button-block-pill",style:{backgroundColor:m},...x,children:[s.jsx("span",{className:"be-button-block-label","data-empty":g?"":void 0,"data-placeholder":"Button",children:s.jsx(xe,{blockId:e,runIds:t.contentIds,onEnter:a,onBackspaceAtStart:c,onArrowUp:i,onArrowDown:u})}),s.jsx("button",{type:"button",className:"be-button-block-open",onClick:p,disabled:!b,title:b||"No link set","aria-label":"Open link",children:"↗"}),s.jsx("button",{type:"button",className:"be-button-block-settings",onClick:()=>l(!0),"aria-label":"Edit button",title:"Edit label, link, color…",children:"⚙"})]}),s.jsx(pa,{isOpen:o,onClose:()=>l(!1),store:n,blockId:e})]})}function ma({href:e="",label:n="Button",color:t="",customAttrs:r=[]}={}){return function(l,a){const c=j(),i=a!=null&&a.length?a:[{id:j(),type:"text",value:n,marks:{}}];return{block:{id:c,type:"button",parentId:l,contentIds:i.map(u=>u.id),props:{href:e,color:t,customAttrs:r}},runs:i}}}const _r="be-button-block-link";function ha(e,n){var i,u,p;const t=e.contentIds.map(d=>n.store.getRun(d)),r=((i=e.props)==null?void 0:i.href)??"",o=(u=e.props)==null?void 0:u.color,l=o?` style="background-color:${ue(o)}"`:"",c=(((p=e.props)==null?void 0:p.customAttrs)??[]).filter(d=>{var b;return(b=d.key)==null?void 0:b.trim()}).map(d=>` data-${ue(d.key.trim())}="${ue(d.value??"")}"`).join("");return`<a class="${_r}" href="${ue(r)}"${l}${c}>${t.map(d=>Ce(d,n)).join("")}</a>`}function ga(e,n){return e.contentIds.map(t=>Be(n.store.getRun(t),n)).join("")}function xa(e,n){var l;if(e.tagName!=="A"||!e.classList.contains(_r))return null;const t=pe(e,n),r=[];for(const a of e.attributes)a.name.startsWith("data-")&&r.push({key:a.name.slice(5),value:a.value});return{block:{id:j(),type:"button",parentId:null,contentIds:t.map(a=>a.id),props:{href:e.getAttribute("href")??"",color:((l=e.style)==null?void 0:l.backgroundColor)||void 0,customAttrs:r}},runs:t}}const Pr={component:ba,isLeaf:!0,defaultProps:{href:"",color:"",customAttrs:[]},toHTML:ha,toPlainText:ga,fromHTML:xa,slashCommand:{label:"Button",icon:el,keywords:["button","link","cta","action"],run:(e,n)=>ne(e,n,ma())}};function Lt(e){return new Promise((n,t)=>{const r=new FileReader;r.onload=()=>n(r.result),r.onerror=()=>t(r.error),r.readAsDataURL(e)})}const on={image:"image",video:"video",audio:"audio",file:"file"},ka={image:"image/*",video:"video/*",audio:"audio/*",file:"*/*"},$r=20,Hr=100,ya=[{value:"left",Icon:Fo,label:"Align left"},{value:"center",Icon:Uo,label:"Align center"},{value:"right",Icon:Ko,label:"Align right"}];function va(e){return Math.min(Hr,Math.max($r,Math.round(e)))}function wa({kind:e,src:n,name:t}){return e==="image"?s.jsx("img",{className:"be-embed-image",src:n,alt:t||""}):e==="video"?s.jsx("video",{className:"be-embed-video",src:n,controls:!0}):e==="audio"?s.jsx("audio",{className:"be-embed-audio",src:n,controls:!0}):s.jsxs("a",{className:"be-embed-file-link",href:n,download:t||void 0,target:"_blank",rel:"noopener noreferrer",children:[s.jsx(Vt,{size:14})," ",t||n]})}function Ia({id:e}){const n=D(),t=G(e),[r,o]=f.useState(""),[l,a]=f.useState(!1),[c,i]=f.useState(null),u=f.useRef(null),p=f.useRef(null),d=f.useCallback(C=>n.applyOperation(H(e,C)),[n,e]),b=f.useCallback(async C=>{var M;const O=(M=C.target.files)==null?void 0:M[0];if(!O)return;const N=await Lt(O);d({src:N,name:O.name,mimeType:O.type})},[d]),m=f.useCallback(async C=>{var M;C.preventDefault(),a(!1);const O=(M=C.dataTransfer.files)==null?void 0:M[0];if(!O)return;const N=await Lt(O);d({src:N,name:O.name,mimeType:O.type})},[d]),h=f.useCallback(C=>{C.preventDefault(),a(!0)},[]),g=f.useCallback(()=>a(!1),[]),x=f.useCallback(()=>{const C=r.trim();C&&(d({src:C,name:C}),o(""))},[r,d]),k=f.useCallback(()=>d({src:"",name:"",mimeType:""}),[d]),y=f.useCallback(C=>{C.preventDefault();const O=u.current,N=p.current;if(!O||!N)return;const M=O.getBoundingClientRect().width,U=N.getBoundingClientRect().width,X=C.clientX,K=F=>va((U+(F.clientX-X))/M*100),_=F=>i(K(F)),ee=F=>{document.removeEventListener("mousemove",_),document.removeEventListener("mouseup",ee),d({width:K(F)}),i(null)};document.addEventListener("mousemove",_),document.addEventListener("mouseup",ee)},[d]),v=Z("be-embed",t);if(!t)return null;const{kind:S="file",src:I,name:T,align:E="left",width:R=100}=t.props,w=S==="image"||S==="video",B=c??R;return s.jsx("div",{className:v,"data-block-id":e,"data-kind":S,contentEditable:!1,tabIndex:-1,children:I?s.jsx("div",{ref:u,className:`be-embed-preview be-embed-align-${E}`,children:s.jsxs("div",{ref:p,className:"be-embed-frame",style:w?{width:`${B}%`}:void 0,children:[s.jsxs("div",{className:"be-embed-toolbar",contentEditable:!1,children:[ya.map(({value:C,Icon:O,label:N})=>s.jsx("button",{type:"button",className:`be-embed-toolbar-btn${E===C?" be-embed-toolbar-btn-active":""}`,title:N,"aria-label":N,"aria-pressed":E===C,onClick:()=>d({align:C}),children:s.jsx(O,{size:14})},C)),s.jsx("button",{type:"button",className:"be-embed-remove",onClick:k,"aria-label":`Remove ${on[S]}`,children:"Remove"})]}),s.jsx(wa,{kind:S,src:I,name:T}),w&&s.jsx("div",{className:"be-embed-resize-handle",onMouseDown:y,role:"slider","aria-label":`Resize ${on[S]}`,"aria-valuemin":$r,"aria-valuemax":Hr,"aria-valuenow":B})]})}):s.jsxs("div",{className:`be-embed-dropzone${l?" be-embed-dropzone-active":""}`,onDrop:m,onDragOver:h,onDragLeave:g,children:[s.jsxs("label",{className:"be-embed-upload-btn",children:["Upload ",on[S],s.jsx("input",{type:"file",accept:ka[S],onChange:b,hidden:!0})]}),s.jsx("span",{className:"be-embed-dropzone-hint",children:"or drop a file, or paste a URL below"}),s.jsxs("div",{className:"be-embed-url-row",children:[s.jsx("input",{type:"text",className:"be-embed-url-input",placeholder:`https://... ${on[S]} URL`,value:r,onChange:C=>o(C.target.value),onKeyDown:C=>C.key==="Enter"&&x()}),s.jsx("button",{type:"button",className:"be-embed-url-commit",onClick:x,children:"Embed"})]})]})})}function Ca({kind:e="file",src:n="",name:t="",mimeType:r="",align:o="left",width:l=100}={}){return function(c){return{block:{id:j(),type:"embed",parentId:c,contentIds:[],props:{kind:e,src:n,name:t,mimeType:r,align:o,width:l}},runs:[]}}}const Ba={image:sl,video:al,audio:cl,file:Vt},zr="be-embed-file-link";function ja(e,n,t){if(e!=="image"&&e!=="video")return"";const r=[];return t!==100&&r.push(`width:${t}%`),n==="center"?r.push("display:block","margin-left:auto","margin-right:auto"):n==="right"&&r.push("display:block","margin-left:auto"),r.length?` style="${r.join(";")}"`:""}function Nt(e){var o,l,a,c;const n=(o=e.style)==null?void 0:o.width,t=n&&n.endsWith("%")?parseInt(n,10):100;let r="left";return((l=e.style)==null?void 0:l.marginLeft)==="auto"&&((a=e.style)==null?void 0:a.marginRight)==="auto"?r="center":((c=e.style)==null?void 0:c.marginLeft)==="auto"&&(r="right"),{align:r,width:Number.isFinite(t)?t:100}}function Ra(e){const{kind:n,src:t,name:r,align:o="left",width:l=100}=e.props;if(!t)return"<p></p>";const a=ja(n,o,l);return n==="image"?`<img src="${ue(t)}" alt="${ue(r||"")}"${a}>`:n==="video"?`<video src="${ue(t)}" controls${a}></video>`:n==="audio"?`<audio src="${ue(t)}" controls></audio>`:`<a class="${zr}" href="${ue(t)}">${Ae(r||t)}</a>`}function Ta(e){const{kind:n,src:t,name:r}=e.props;return t?`[${n}: ${r||t}]`:""}function Sa(e){return e.tagName==="IMG"?ln("image",e.getAttribute("src")??"",e.getAttribute("alt")??"",Nt(e)):e.tagName==="VIDEO"?ln("video",e.getAttribute("src")??"","",Nt(e)):e.tagName==="AUDIO"?ln("audio",e.getAttribute("src")??"",""):e.tagName==="A"&&e.classList.contains(zr)?ln("file",e.getAttribute("href")??"",e.textContent??""):null}function ln(e,n,t,{align:r="left",width:o=100}={}){return{block:{id:j(),type:"embed",parentId:null,contentIds:[],props:{kind:e,src:n,name:t,align:r,width:o}},runs:[]}}function Ea(e){return(n,{blockId:t,runId:r,sliceStart:o,sliceEnd:l})=>{const a=n.getRun(r),c=(a==null?void 0:a.value)??"";n.applyOperation(Y(r,{value:c.slice(0,o)+c.slice(l)}));const i=Xn(n,t,Ca({kind:e}));return Ie(n,i,$("paragraph")),i}}const Fr={component:Ia,isLeaf:!0,defaultProps:{kind:"file",src:"",name:"",mimeType:"",align:"left",width:100},toHTML:Ra,toPlainText:Ta,fromHTML:Sa,slashCommands:["image","video","audio","file"].map(e=>({label:e.charAt(0).toUpperCase()+e.slice(1),icon:Ba[e],keywords:["embed","upload","insert",e],run:Ea(e)}))};function Oa(e){Ur(e,{paragraph:or,heading:lr,listItem:ur,...Kr,...Vr,divider:Sr,callout:Lr,blockquote:Nr,code:Ar,toggleHeading:Dr,button:Pr,embed:Fr})}function Ur(e,n){for(const[t,r]of Object.entries(n))e.register(t,r)}const Kr={table:Cr,tableRow:Ir,tableCell:wr},Vr={layout:Tr,layoutColumn:Rr};function La({id:e}){const n=D(),t=we(e),r=f.useCallback(c=>{n.applyOperation(Y(e,{data:{...t==null?void 0:t.data,selectedValue:c}}))},[n,e,t==null?void 0:t.data]);if(!t)return null;const{options:o=[],selectedValue:l="",placeholder:a="Select…"}=t.data??{};return s.jsx("span",{className:"be-inline-select",onMouseDown:c=>{c.preventDefault(),c.stopPropagation()},onKeyDown:c=>c.stopPropagation(),children:s.jsx(Oe,{value:l,options:o,onChange:r,placeholder:a,ariaLabel:"Select an option"})})}function Cn(e,{blockId:n,runId:t,sliceStart:r,sliceEnd:o},l){const a=e.getRun(t),c=(a==null?void 0:a.value)??"",i=c.slice(0,r),u=c.slice(o),p=l(),d={...a,value:i},b={id:j(),type:"text",value:u,marks:{...a==null?void 0:a.marks}};e.applyOperation(Ge(n,[t],[d,p,b])),W(b.id)}function Na(e){return String(e).replace(/&/g,"&amp;").replace(/"/g,"&quot;")}function qr(e){var r;const{options:n=[],selectedValue:t=""}=e.data??{};return((r=n.find(o=>o.value===t))==null?void 0:r.label)??""}function Ma(e){var t,r;const n=qr(e)||((t=e.data)==null?void 0:t.placeholder)||"";return`<span data-inline-type="select" data-selected-value="${Na(((r=e.data)==null?void 0:r.selectedValue)??"")}">${n}</span>`}function Aa(e){return qr(e)}function Da(e){var n;return((n=e.getAttribute)==null?void 0:n.call(e,"data-inline-type"))!=="select"?null:{id:j(),type:"select",value:"",marks:{},data:{options:[],selectedValue:e.getAttribute("data-selected-value")??""}}}const Wr={component:La,isAtomic:!0,toHTML:Ma,toPlainText:Aa,fromHTML:Da,slashCommand:{label:"Select",icon:Qt,keywords:["select","dropdown","choice","picker"],run:(e,{blockId:n,runId:t,sliceStart:r,sliceEnd:o})=>Cn(e,{blockId:n,runId:t,sliceStart:r,sliceEnd:o},()=>({id:j(),type:"select",value:"",marks:{},data:{options:[],selectedValue:"",placeholder:"Select…"}}))}};function _a({id:e}){const n=D(),t=we(e),r=f.useCallback(l=>{n.applyOperation(Y(e,{data:{...t==null?void 0:t.data,isoDate:l.target.value}}))},[n,e,t==null?void 0:t.data]);if(!t)return null;const{isoDate:o=""}=t.data??{};return s.jsx("span",{className:"be-inline-date",onMouseDown:l=>l.stopPropagation(),onKeyDown:l=>l.stopPropagation(),children:s.jsx("input",{type:"date",value:o,onChange:r})})}function Pa(e){return String(e).replace(/&/g,"&amp;").replace(/"/g,"&quot;")}function Yr(e){if(!e)return"";const n=new Date(`${e}T00:00:00`);return Number.isNaN(n.getTime())?e:n.toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}function $a(e){var t;const n=((t=e.data)==null?void 0:t.isoDate)??"";return`<span data-inline-type="date" data-iso-date="${Pa(n)}">${Yr(n)}</span>`}function Ha(e){var n;return Yr(((n=e.data)==null?void 0:n.isoDate)??"")}function za(e){var n;return((n=e.getAttribute)==null?void 0:n.call(e,"data-inline-type"))!=="date"?null:{id:j(),type:"date",value:"",marks:{},data:{isoDate:e.getAttribute("data-iso-date")??""}}}function Fa(){return new Date().toISOString().slice(0,10)}const Gr={component:_a,isAtomic:!0,toHTML:$a,toPlainText:Ha,fromHTML:za,slashCommand:{label:"Date",icon:ll,keywords:["date","when","schedule","calendar"],run:(e,{blockId:n,runId:t,sliceStart:r,sliceEnd:o})=>Cn(e,{blockId:n,runId:t,sliceStart:r,sliceEnd:o},()=>({id:j(),type:"date",value:"",marks:{},data:{isoDate:Fa()}}))}};function Ua({id:e}){const n=D(),t=we(e),r=f.useCallback(c=>{n.applyOperation(Y(e,{data:{...t==null?void 0:t.data,checked:c.target.checked}}))},[n,e,t==null?void 0:t.data]),o=f.useCallback(c=>{n.applyOperation(Y(e,{data:{...t==null?void 0:t.data,label:c.target.value}}))},[n,e,t==null?void 0:t.data]);if(!t)return null;const{checked:l=!1,label:a=""}=t.data??{};return s.jsxs("span",{className:"be-inline-checkbox",onMouseDown:c=>c.stopPropagation(),onKeyDown:c=>c.stopPropagation(),children:[s.jsx("input",{type:"checkbox",className:"be-inline-checkbox-input",checked:l,onChange:r}),s.jsx("input",{type:"text",className:"be-inline-checkbox-label",value:a,onChange:o,placeholder:"Label…"})]})}function Ka(e){return String(e).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Va(e){const{checked:n=!1,label:t=""}=e.data??{};return`<span data-inline-type="checkbox" data-checked="${n}">${n?"☑":"☐"} ${Ka(t)}</span>`}function qa(e){const{checked:n=!1,label:t=""}=e.data??{};return`${n?"[x]":"[ ]"} ${t}`.trim()}function Wa(e){var n;return((n=e.getAttribute)==null?void 0:n.call(e,"data-inline-type"))!=="checkbox"?null:{id:j(),type:"checkbox",value:"",marks:{},data:{checked:e.getAttribute("data-checked")==="true",label:(e.textContent??"").replace(/^[☑☐]\s*/,"")}}}const Xr={component:Ua,isAtomic:!0,toHTML:Va,toPlainText:qa,fromHTML:Wa,slashCommand:{label:"Checkbox",icon:Jt,keywords:["checkbox","todo","check","toggle"],run:(e,{blockId:n,runId:t,sliceStart:r,sliceEnd:o})=>Cn(e,{blockId:n,runId:t,sliceStart:r,sliceEnd:o},()=>({id:j(),type:"checkbox",value:"",marks:{},data:{checked:!1,label:""}}))}};function Ya({id:e,blockId:n}){var m;const t=D(),r=we(e),o=n?t.getBlock(n):null,l=o?t.getBlock(o.parentId):null,a=(l==null?void 0:l.parentId)??null,c=G(a),i=l?l.contentIds.indexOf(n):-1,p=(((m=(c&&l?de(c,l.contentIds.length):[])[i])==null?void 0:m.options)??[]).map((h,g)=>({...h,color:h.color??Ye(g)})),d=f.useCallback((h,g)=>{t.applyOperation(Y(e,{data:{selectedValue:h,selectedLabel:(g==null?void 0:g.label)??""}}))},[t,e]);if(!r)return null;const{selectedValue:b=""}=r.data??{};return s.jsx("span",{className:"be-inline-table-select",onMouseDown:h=>{h.preventDefault(),h.stopPropagation()},onKeyDown:h=>h.stopPropagation(),children:s.jsx(Oe,{value:b,options:p,onChange:d,placeholder:"Select…",ariaLabel:"Select an option",variant:"tag"})})}function Jr(e){return String(e).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Ga(e){return Jr(e).replace(/"/g,"&quot;")}function Xa(e){const{selectedValue:n="",selectedLabel:t=""}=e.data??{};return`<span data-inline-type="tableSelect" data-selected-value="${Ga(n)}">${Jr(t)}</span>`}function Ja(e){var n;return((n=e.data)==null?void 0:n.selectedLabel)??""}function Qa(e){var n;return((n=e.getAttribute)==null?void 0:n.call(e,"data-inline-type"))!=="tableSelect"?null:{id:j(),type:"tableSelect",value:"",marks:{},data:{selectedValue:e.getAttribute("data-selected-value")??"",selectedLabel:e.textContent??""}}}const Qr={component:Ya,isAtomic:!0,toHTML:Xa,toPlainText:Ja,fromHTML:Qa},Zr={};function Za(e){eo(e,{select:Wr,date:Gr,checkbox:Xr,...no,emoji:Zr})}function eo(e,n){for(const[t,r]of Object.entries(n))e.register(t,r)}const no={tableSelect:Qr},ec="$fieldTypes";function to(){const e=D(),n=f.useCallback(r=>e.subscribe(ec,r),[e]),t=f.useCallback(()=>e.getFieldTypes(),[e]);return f.useSyncExternalStore(n,t)}const nc={canUndo:!1,canRedo:!1};function ro(){const{history:e}=fe(),n=f.useCallback(o=>e?e.subscribeToHistory(o):()=>{},[e]),t=f.useCallback(()=>e?e.getUndoRedoSnapshot():nc,[e]),r=f.useSyncExternalStore(n,t);return e?{...r,undo:()=>e.undo(),redo:()=>e.redo(),getHistoryLog:()=>e.getHistoryLog()}:null}const dn="application/x-block-editor-blocks+json";function at(e){return e.split(/\r\n|\r|\n/).filter(n=>n.length>0).map(n=>{const t=j();return{block:{id:j(),type:"paragraph",parentId:null,contentIds:[t],props:{}},runs:[{id:t,type:"text",value:n,marks:{}}]}})}function oo(e,n,t){const r=new DOMParser().parseFromString(e,"text/html"),o={registry:n,inlineRegistry:t},l=n.listHtmlMatchers(),a=[],c=u=>{var b;const p=u.tagName==="OL",d=[];for(const m of u.children){if(m.tagName!=="LI")continue;const h=(b=n.get("listItem"))==null?void 0:b.fromHTML(m,o);h&&(h.block.props.ordered=p,d.push(h))}return d},i=u=>{var d;const p=Array.from(u.children).filter(b=>b.tagName==="P");if(p.length===0){const b=(d=n.get("blockquote"))==null?void 0:d.fromHTML(u,o);return b?[b]:[]}return p.map(b=>{const m=pe(b,o);return{block:{id:j(),type:"blockquote",parentId:null,contentIds:m.map(h=>h.id),props:{}},runs:m}})};for(const u of r.body.childNodes){if(u.nodeType===3){const d=u.textContent.trim();d&&a.push(...at(d));continue}if(u.nodeType!==1)continue;if(u.tagName==="UL"||u.tagName==="OL"){a.push(...c(u));continue}if(u.tagName==="BLOCKQUOTE"){a.push(...i(u));continue}let p=null;for(const d of l){const b=d.fromHTML(u,o);if(b){p=b;break}}if(p)a.push(p);else if(u.textContent.trim()){const d=pe(u,o);a.push({block:{id:j(),type:"paragraph",parentId:null,contentIds:d.map(b=>b.id),props:{}},runs:d})}}return a}function lo(e,n,t){const r=e.types??[];if(r.includes(dn)){const l=e.getData(dn);if(l)return tc(l)}if(r.includes("text/html")){const l=e.getData("text/html");if(l)return oo(l,n,t)}const o=e.getData("text/plain")??"";return at(o)}function tc(e){return JSON.parse(e).blocks.map(t=>et(t))}function En(e,n){var r;const t=e.getBlock(n);return((r=t.props)==null?void 0:r.titleRunIds)??t.contentIds}function an(){return{id:j(),type:"text",value:"",marks:{}}}function On(e,n){if(typeof e.performBatch=="function")e.performBatch(n);else for(const t of n)e.applyOperation(t)}function ct(e,n,t){const{startRunId:r,startOffset:o,endRunId:l,endOffset:a}=t,c=En(e,n),i=c.indexOf(r),u=c.indexOf(l);if(i===-1||u===-1)return null;const[p,d]=i<=u?[i,u]:[u,i],b=i<=u?o:a,m=i<=u?a:o,h=c.slice(0,p).map(I=>e.getRun(I)),g=c.slice(d+1).map(I=>e.getRun(I)),x=c.slice(p,d+1).map(I=>e.getRun(I)),k=[];let y=null,v=0;if(p===d){const I=x[0];if(I.type==="text"){const T=Math.max(0,Math.min(b,m)),E=Math.min(I.value.length,Math.max(b,m)),R={...I,value:I.value.slice(0,T)+I.value.slice(E)};k.push(R),y=R.id,v=T}}else x.forEach((I,T)=>{if(I.type!=="text")return;const E=T===0,R=T===x.length-1,w=E?I.value.slice(0,b):"";if(E&&w){const B={...I,value:w};k.push(B),y=B.id,v=w.length}if(R&&!E){const B=I.value.slice(m);if(B){const C={id:j(),type:"text",value:B,marks:I.marks};k.push(C),y===null&&(y=C.id,v=0)}}});let S=[...h,...k,...g];if(S.length===0){const I=an();S=[I],y=I.id,v=0}else if(y===null){const I=h[h.length-1];I?(y=I.id,v=I.type==="text"?I.value.length:0):g[0]&&(y=g[0].id,v=0)}return e.applyOperation(ae(n,S)),{blockId:n,runId:y,offset:v}}function it(e,n){const{blockIds:t,startBlockId:r,startRunId:o,startOffset:l,endBlockId:a,endRunId:c,endOffset:i}=n;if(!t||t.length===0)return null;const u=t.indexOf(r),p=t.indexOf(a);if(u===-1||p===-1)return null;const[d,b]=u<=p?[u,p]:[p,u],m=u<=p,h=m?o:c,g=m?l:i,x=m?c:o,k=m?i:l;if(d===b)return ct(e,t[d],{startRunId:h,startOffset:g,endRunId:x,endOffset:k});const y=t[d],v=t[b],S=e.getBlock(y),I=e.getBlock(v),T=En(e,y),E=T.indexOf(h),R=T.slice(0,E).map(V=>e.getRun(V)),w=e.getRun(h),B=w.type==="text"&&g>0?{...w,value:w.value.slice(0,g)}:null,C=En(e,v),O=C.indexOf(x),N=C.slice(O+1).map(V=>e.getRun(V)),M=e.getRun(x),U=M.type==="text"&&k<M.value.length?{id:j(),type:"text",value:M.value.slice(k),marks:M.marks}:null,X=[...R,...B?[B]:[]],K=[...U?[U]:[],...N],_=[];for(let V=d+1;V<b;V+=1)_.push(P(t[V]));const ee=rr(S.type,I.type),F=e.getBlock(S.parentId),se=b-d-1+(ee?1:0),ie=F&&F.contentIds.length-se===1;let oe,J,ke;if(ee){const V=[...X,...K];if(V.length===0&&ie&&S.type!=="paragraph"){const{block:L,runs:Q}=$("paragraph")(F.id);return _.push({type:"insertBlock",block:L,parentId:F.id,index:0,subtree:{blocks:[L],runs:Q}}),_.push(P(y)),_.push(P(v)),On(e,_),{blockId:L.id,runId:L.contentIds[0],offset:0}}const le=V.length?V:[an()];if(_.push(ae(y,le)),_.push(P(v)),ke=y,B)oe=B.id,J=B.value.length;else if(R.length){const L=R[R.length-1];oe=L.id,J=L.type==="text"?L.value.length:0}else U?(oe=U.id,J=0):N.length?(oe=N[0].id,J=0):(oe=le[0].id,J=0)}else{const V=X.length?X:[an()];if(_.push(ae(y,V)),_.push(ae(v,K.length?K:[an()])),ke=y,B)oe=B.id,J=B.value.length;else if(R.length){const le=R[R.length-1];oe=le.id,J=le.type==="text"?le.value.length:0}else oe=V[0].id,J=0}return On(e,_),{blockId:ke,runId:oe,offset:J}}function pn(e,n=""){var c;const t=e.getRootId(),r=((c=e.getBlock(t))==null?void 0:c.contentIds)??[];if(r.length===0)return null;const o=r.map(i=>P(i)),{block:l,runs:a}=$("paragraph")(t);return n&&(a[0].value=n),o.push(q(l,t,0,{blocks:[l],runs:a})),On(e,o),{blockId:l.id,runId:l.contentIds[0],offset:n.length}}function so(e,n){if(typeof e.performBatch=="function")e.performBatch(n);else for(const t of n)e.applyOperation(t)}function qe(e,n){n.length!==0&&so(e,n.map(t=>P(t)))}function ao(e,n){if(n.length===0)return!1;const t=e.getBlock(n[0]);if(!t)return!1;const r=e.getBlock(t.parentId);if(!r)return!1;const o=r.contentIds.indexOf(n[0]),l=r.contentIds.indexOf(n[n.length-1]);if(o<=0)return!1;const a=r.contentIds[o-1];return e.applyOperation(ve(a,t.parentId,l)),!0}function co(e,n){if(n.length===0)return!1;const t=e.getBlock(n[0]);if(!t)return!1;const r=e.getBlock(t.parentId);if(!r)return!1;const o=r.contentIds.indexOf(n[0]),l=r.contentIds.indexOf(n[n.length-1]);if(l===-1||l>=r.contentIds.length-1)return!1;const a=r.contentIds[l+1];return e.applyOperation(ve(a,t.parentId,o)),!0}function io(e,n){return n.length>0&&n.every(t=>{var r,o;return!!((o=(r=e.getBlock(t))==null?void 0:r.props)!=null&&o.hidden)})}function uo(e,n,t){n.length!==0&&so(e,n.map(r=>H(r,{hidden:t})))}function rc(e,n){if(n.length===0)return[];const t=e.getBlock(n[0]),r=t&&e.getBlock(t.parentId);if(!r)return n;const o=new Set(n);return r.contentIds.filter(l=>o.has(l))}function Ln(e){var t;let n=(e==null?void 0:e.nodeType)===1?e:e==null?void 0:e.parentElement;for(;n&&typeof n.hasAttribute=="function"&&!n.hasAttribute("data-block-id");)n=n.parentElement;return((t=n==null?void 0:n.getAttribute)==null?void 0:t.call(n,"data-block-id"))??null}function oc(e){var d;const n=(d=window.getSelection)==null?void 0:d.call(window);if(!n||n.rangeCount===0)return[];const t=Ln(n.anchorNode),r=Ln(n.focusNode);if(!t)return[];if(!r||t===r)return[t];const o=e.getBlock(t),l=o&&e.getBlock(o.parentId);if(!l)return[t];const a=l.contentIds,c=a.indexOf(t),i=a.indexOf(r);if(c===-1||i===-1)return[t];const[u,p]=c<=i?[c,i]:[i,c];return a.slice(u,p+1)}function Mt(e){const n=$e();if(n)return ct(e,n.blockId,n);const t=Me(e);return t?it(e,t):null}function lc(e,n,t){const r=e.getRun(n.runId);if(!r||r.type!=="text")return null;const o=r.value??"",l=o.slice(0,n.offset)+t+o.slice(n.offset);return e.applyOperation(Y(r.id,{value:l})),{blockId:n.blockId,runId:r.id,offset:n.offset+t.length}}function Tn(e,n){if(typeof e.performBatch=="function")e.performBatch(n);else for(const t of n)e.applyOperation(t)}function sc(){const e=D(),n=Te(),t=be(),[r,o]=Pn(),[l,a]=Xe(),c=f.useCallback(p=>{var g;const d=r?((g=e.getBlock(e.getRootId()))==null?void 0:g.contentIds)??[]:l.length>0?l:oc(e);if(d.length===0)return;const{html:b,text:m,json:h}=en(e,n,d,t);p.clipboardData.setData("text/plain",m),p.clipboardData.setData("text/html",b),p.clipboardData.setData(dn,h),p.preventDefault()},[e,n,t,r,l]),i=f.useCallback(p=>{if(c(p),r){const b=pn(e);o(!1),b!=null&&b.runId&&me(b.runId,b.offset);return}if(l.length>0){qe(e,l),a([]);return}const d=Mt(e);d!=null&&d.runId&&me(d.runId,d.offset)},[c,e,r,o,l,a]),u=f.useCallback(p=>{var v,S,I;const d=lo(p.clipboardData,n,t);if(d.length===0)return;if(r){const T=e.getRootId(),R=(((v=e.getBlock(T))==null?void 0:v.contentIds)??[]).map(B=>P(B));let w=0;for(const{block:B,runs:C,subtreeBlocks:O=[]}of d)B.parentId=T,R.push(q(B,T,w,{blocks:[B,...O],runs:C})),w+=1;Tn(e,R),o(!1),p.preventDefault();return}if(l.length>0){const T=e.getBlock(l[0]),E=(T==null?void 0:T.parentId)??null,R=E&&e.getBlock(E);let w=R?R.contentIds.indexOf(l[0]):0;const B=l.map(C=>P(C));for(const{block:C,runs:O,subtreeBlocks:N=[]}of d)C.parentId=E,B.push(q(C,E,w,{blocks:[C,...N],runs:O})),w+=1;Tn(e,B),a([]),p.preventDefault();return}const b=Mt(e);if(d.length===1&&d[0].runs.every(T=>T.type==="text")&&(d[0].subtreeBlocks??[]).length===0){const T=b?{blockId:b.blockId,runId:b.runId,offset:b.offset}:Ee();if(T){const E=d[0].runs.map(w=>w.value).join(""),R=lc(e,T,E);if(R){me(R.runId,R.offset),p.preventDefault();return}}}const h=(b==null?void 0:b.blockId)??Ln((I=(S=window.getSelection)==null?void 0:S.call(window))==null?void 0:I.anchorNode);if(!h)return;const g=e.getBlock(h);if(!g)return;let k=e.getBlock(g.parentId).contentIds.indexOf(h)+1;const y=[];for(const{block:T,runs:E,subtreeBlocks:R=[]}of d)T.parentId=g.parentId,y.push(q(T,g.parentId,k,{blocks:[T,...R],runs:E})),k+=1;Tn(e,y),p.preventDefault()},[e,n,t,r,o,l,a]);return{onCopy:c,onCut:i,onPaste:u}}const ac=["bold","italic","underline","strike","subscript","superscript","code"],cc=["color","highlight","link"];function De(e,n){var r;const t=e.getBlock(n);return((r=t.props)==null?void 0:r.titleRunIds)??t.contentIds}function ic(e,n){return e===n?!0:e&&n&&typeof e=="object"?JSON.stringify(e)===JSON.stringify(n):!1}function po(e){var t;const n={};if(e.length===0)return n;for(const r of ac)n[r]=e.every(o=>{var l;return(l=o.marks)==null?void 0:l[r]});for(const r of cc){const o=((t=e[0].marks)==null?void 0:t[r])??null;n[r]=e.every(l=>{var a;return ic(((a=l.marks)==null?void 0:a[r])??null,o)})?o:null}return n}function ut(e,n,t){const{startRunId:r,startOffset:o,endRunId:l,endOffset:a}=t,c=De(e,n),i=c.indexOf(r),u=c.indexOf(l);if(i===-1||u===-1)return{};const[p,d]=i<=u?[i,u]:[u,i],b=c.slice(p,d+1).map(m=>e.getRun(m)).filter(m=>m&&m.type==="text");return po(b)}function dt(e,n){const{blockIds:t,startBlockId:r,endBlockId:o}=n,l=t.indexOf(r),a=t.indexOf(o);if(l===-1||a===-1)return{};const[c,i]=l<=a?[l,a]:[a,l],u=[];for(let p=c;p<=i;p+=1)for(const d of De(e,t[p])){const b=e.getRun(d);b&&b.type==="text"&&u.push(b)}return po(u)}function fo(e,n){const t={...e};for(const[r,o]of Object.entries(n))o!=null?t[r]=o:delete t[r];return t}function bo(e,n,t,r,o,l){const a=fo(t.marks,l);if(r===0&&o===t.value.length)return e.applyOperation({type:"updateRun",id:t.id,patch:{marks:a}}),t.id;const c=t.value.slice(0,r),i=t.value.slice(r,o),u=t.value.slice(o),p=[];c&&p.push({id:j(),type:"text",value:c,marks:{...t.marks}});const d={id:j(),type:"text",value:i,marks:a};return p.push(d),u&&p.push({id:j(),type:"text",value:u,marks:{...t.marks}}),e.applyOperation(Ge(n,[t.id],p)),d.id}function uc(e,n,t,r){const{startRunId:o,startOffset:l,endRunId:a,endOffset:c}=t,i=De(e,n),u=i.indexOf(o),p=i.indexOf(a);if(u===-1||p===-1)return null;const[d,b]=u<=p?[u,p]:[p,u],m=u<=p?l:c,h=u<=p?c:l,g=i.slice(d,b+1),x=g.map(v=>e.getRun(v));if(d===b){const v=x[0];if(v.type!=="text")return v.id;const S=Math.max(0,Math.min(m,h)),I=Math.min(v.value.length,Math.max(m,h));return S===I?v.id:bo(e,n,v,S,I,r)}const k=[];let y=null;return x.forEach((v,S)=>{if(v.type!=="text"){k.push(v),y=v.id;return}const I=S===0,T=S===x.length-1,E=I?m:0,R=T?h:v.value.length,w=v.value.slice(0,E),B=v.value.slice(E,R),C=v.value.slice(R);w&&k.push({id:j(),type:"text",value:w,marks:{...v.marks}});const O={id:j(),type:"text",value:B,marks:fo(v.marks,r)};k.push(O),y=O.id,C&&k.push({id:j(),type:"text",value:C,marks:{...v.marks}})}),e.applyOperation(Ge(n,g,k)),y}function dc(e,n,t,r){var h;const{startRunId:o,startOffset:l,endRunId:a,endOffset:c}=t,i=De(e,n),u=i.indexOf(o),p=i.indexOf(a);if(u===-1||p===-1)return!0;const[d,b]=u<=p?[u,p]:[p,u],m=i.slice(d,b+1).map(g=>e.getRun(g)).filter(g=>g.type==="text");if(m.length===0)return!0;if(d===b){const g=Math.max(0,Math.min(l,c)),x=Math.min(m[0].value.length,Math.max(l,c));if(g===x)return!((h=m[0].marks)!=null&&h[r])}return!m.every(g=>{var x;return(x=g.marks)==null?void 0:x[r]})}function pc(e,n,t,r,o,l){var d;const a=e.getRun(t),c=a.value??"",i=Math.max(0,Math.min(r,o)),u=Math.min(c.length,Math.max(r,o));if(i===u)return t;const p=!((d=a.marks)!=null&&d[l]);return bo(e,n,a,i,u,{[l]:p?!0:null})}function _e(e,n,t,r){return uc(e,n,t,r)}function pt(e,n,t,r){const o=dc(e,n,t,r);return _e(e,n,t,{[r]:o?!0:null})}function ft(e,n,t){return fn(e,n,r=>({[t]:r?null:!0}),t)}function fn(e,n,t,r){var T;const{blockIds:o,startBlockId:l,startRunId:a,startOffset:c,endBlockId:i,endRunId:u,endOffset:p}=n;if(!o||o.length===0)return null;const d=o.indexOf(l),b=o.indexOf(i);if(d===-1||b===-1)return null;const[m,h]=d<=b?[d,b]:[b,d],g=d<=b,x=g?a:u,k=g?c:p,y=g?u:a,v=g?p:c;let S=t;if(typeof t=="function"){let E=!1,R=!0;for(let w=m;w<=h;w+=1){const B=De(e,o[w]).map(C=>e.getRun(C)).filter(C=>C.type==="text");B.length!==0&&(E=!0,B.every(C=>{var O;return(O=C.marks)==null?void 0:O[r]})||(R=!1))}S=t(E&&R)}if(m===h)return _e(e,o[m],{startRunId:x,startOffset:k,endRunId:y,endOffset:v},S);let I=null;for(let E=m;E<=h;E+=1){const R=o[E],w=De(e,R),B=w[0],C=w[w.length-1],O=e.getRun(C),N=((T=O==null?void 0:O.value)==null?void 0:T.length)??0;let M;E===m&&E===h?M={startRunId:x,startOffset:k,endRunId:y,endOffset:v}:E===m?M={startRunId:x,startOffset:k,endRunId:C,endOffset:N}:E===h?M={startRunId:B,startOffset:0,endRunId:y,endOffset:v}:M={startRunId:B,startOffset:0,endRunId:C,endOffset:N},I=_e(e,R,M,S)}return I}function mo(e,n){var r;const t=e.getBlock(n);return((r=t==null?void 0:t.props)==null?void 0:r.titleRunIds)??(t==null?void 0:t.contentIds)??[]}function ho(e){const n=$e();if(!n)return!1;const{blockId:t,startRunId:r,startOffset:o,endRunId:l,endOffset:a}=n,c=mo(e,t);if(c.length===0)return!1;const i=c.indexOf(r),u=c.indexOf(l);if(i===-1||u===-1)return!1;const[p,d]=i<=u?[i,u]:[u,i],b=i<=u?o:a,m=i<=u?a:o;if(p!==0||d!==c.length-1||b!==0)return!1;const h=e.getRun(c[c.length-1]),g=(h==null?void 0:h.type)==="text"?(h.value??"").length:1;return m===g}function fc(e){const n=Ee();return n?ce(e,mo(e,n.blockId)):!1}function bc(e,n,t){var m,h;const r=e.getBlock(n);if(!r){t(null);return}const o=e.getBlock(r.parentId),l=o?o.contentIds.indexOf(n):-1,a=l>0?o.contentIds[l-1]:null,c=l!==-1&&l<o.contentIds.length-1?o.contentIds[l+1]:null;e.applyOperation(P(n)),t(null);const i=ze(e),u=a??c??i;if(!u)return;const p=e.getBlock(u);if(Je(e,p)){t(u),requestAnimationFrame(()=>{var g;return(g=document.querySelector(`[data-block-id="${u}"]`))==null?void 0:g.focus()});return}const d=(m=p==null?void 0:p.props)==null?void 0:m.titleRunIds,b=((h=p==null?void 0:p.contentIds)==null?void 0:h[p.contentIds.length-1])??(d==null?void 0:d[d.length-1]);b&&W(b)}const At={b:"bold",i:"italic",u:"underline"};function mc(e){const n=D(),[t,r]=Pn(),{getSelectedBlockId:o,setSelectedBlockId:l}=ge();f.useEffect(()=>{const a=e.current;if(!a)return;const c=u=>{var d,b;if(o()&&(u.key==="Backspace"||u.key==="Delete")&&!u.defaultPrevented){u.preventDefault(),u.stopPropagation(),bc(n,o(),l);return}if(o()&&u.key!=="Backspace"&&u.key!=="Delete"&&l(null),u.metaKey||u.ctrlKey){const m=u.key.toLowerCase();if(m==="z"&&!u.shiftKey){u.preventDefault(),(d=n.undo)==null||d.call(n);return}if(m==="z"&&u.shiftKey||m==="y"){u.preventDefault(),(b=n.redo)==null||b.call(n);return}if(m==="a"){if(t)return;(ho(n)||fc(n))&&(u.preventDefault(),r(!0));return}if(At[m]){if(t)return;u.preventDefault();const h=At[m],g=$e();if(g){const k=pt(n,g.blockId,g,h);k&&W(k);return}const x=Me(n);if(x){const k=ft(n,x,h);k&&W(k)}}return}if(t){if(u.key==="Backspace"||u.key==="Delete"){u.preventDefault(),u.stopPropagation();const m=pn(n);r(!1),m!=null&&m.runId&&me(m.runId,m.offset);return}if(u.key.length===1){u.preventDefault(),u.stopPropagation();const m=pn(n,u.key);r(!1),m!=null&&m.runId&&me(m.runId,m.offset);return}if(r(!1),u.key==="Escape")return}if(u.key==="Backspace"||u.key==="Delete"){const m=Me(n);if(!m)return;u.preventDefault(),u.stopPropagation();const h=it(n,m);h!=null&&h.runId&&me(h.runId,h.offset)}},i=()=>{t&&r(!1),o()&&l(null)};return a.addEventListener("keydown",c),a.addEventListener("mousedown",i),()=>{a.removeEventListener("keydown",c),a.removeEventListener("mousedown",i)}},[e,n,t,r,o,l])}async function Nn(e,n,t,r){var a,c,i;const{html:o,text:l}=en(e,n,r,t);if(typeof ClipboardItem<"u"&&((a=navigator.clipboard)!=null&&a.write)){await navigator.clipboard.write([new ClipboardItem({"text/plain":new Blob([l],{type:"text/plain"}),"text/html":new Blob([o],{type:"text/html"})})]);return}await((i=(c=navigator.clipboard)==null?void 0:c.writeText)==null?void 0:i.call(c,l))}function hc(){const e=D(),n=Te(),t=be(),[r,o]=Xe(),[l,a]=f.useState(null),c=f.useRef(null),i=r.length>0,u=f.useCallback(()=>o([]),[o]);f.useEffect(()=>{if(!i){a(null);return}const k=()=>{const y=r[r.length-1],v=document.querySelector(`[data-block-row-id="${y}"]`);a((v==null?void 0:v.getBoundingClientRect())??null)};return k(),window.addEventListener("scroll",k,!0),window.addEventListener("resize",k),()=>{window.removeEventListener("scroll",k,!0),window.removeEventListener("resize",k)}},[i,r]),f.useEffect(()=>{if(!i)return;const k=v=>{var S,I,T;(S=c.current)!=null&&S.contains(v.target)||(T=(I=v.target).closest)!=null&&T.call(I,".be-block-gutter")||u()},y=v=>{v.key==="Escape"?u():(v.key==="Delete"||v.key==="Backspace")&&(v.preventDefault(),qe(e,r),u())};return document.addEventListener("mousedown",k),document.addEventListener("keydown",y),()=>{document.removeEventListener("mousedown",k),document.removeEventListener("keydown",y)}},[i,e,r,u]);const p=f.useCallback(()=>{Nn(e,n,t,r),u()},[e,n,t,r,u]),d=f.useCallback(async()=>{await Nn(e,n,t,r),qe(e,r),u()},[e,n,t,r,u]),b=f.useCallback(()=>{qe(e,r),u()},[e,r,u]),m=f.useCallback(()=>{ao(e,r),u()},[e,r,u]),h=f.useCallback(()=>{co(e,r),u()},[e,r,u]),g=io(e,r),x=f.useCallback(()=>{uo(e,r,!g),u()},[e,r,g,u]);return!i||!l?null:Pe.createPortal(s.jsxs("div",{ref:c,role:"menu","aria-label":"Selected blocks options",className:"be-block-range-menu",style:{position:"fixed",top:l.bottom+4,left:l.left},children:[s.jsxs("button",{type:"button",role:"menuitem",className:"be-block-range-menu-item",onClick:p,children:[s.jsx(Un,{size:15})," Copy"]}),s.jsxs("button",{type:"button",role:"menuitem",className:"be-block-range-menu-item",onClick:d,children:[s.jsx(qo,{size:15})," Cut"]}),s.jsxs("button",{type:"button",role:"menuitem",className:"be-block-range-menu-item",onClick:m,children:[s.jsx(Kn,{size:15})," Move up"]}),s.jsxs("button",{type:"button",role:"menuitem",className:"be-block-range-menu-item",onClick:h,children:[s.jsx(Vn,{size:15})," Move down"]}),s.jsxs("button",{type:"button",role:"menuitem",className:"be-block-range-menu-item",onClick:x,children:[g?s.jsx(Wn,{size:15}):s.jsx(Yn,{size:15}),g?"Show in preview":"Hide in preview"]}),s.jsxs("button",{type:"button",role:"menuitem",className:"be-block-range-menu-item be-block-range-menu-item-danger",onClick:b,children:[s.jsx(hn,{size:15})," Delete"]})]}),document.body)}const gc=4;function xc(e,n,t){const r=e.getBlock(n);if(!r)return[];const o=e.getBlock(r.parentId);if(!o)return[n];const l=o.contentIds,a=l.indexOf(n),c=t?l.indexOf(t):a;if(a===-1)return[n];const[i,u]=c===-1?[a,a]:[Math.min(a,c),Math.max(a,c)];return l.slice(i,u+1)}function kc(){var e,n;return typeof window<"u"&&((n=(e=window.matchMedia)==null?void 0:e.call(window,"(pointer: coarse)"))==null?void 0:n.matches)===!0}function yc(e){const n=D(),[,t]=Xe(),r=f.useRef(null),o=f.useRef(!1),l=f.useRef(null),a=f.useCallback(p=>{var m,h,g,x,k;if(!r.current)return;if(!o.current){const{x:y,y:v}=l.current??{x:p.clientX,y:p.clientY};if(Math.hypot(p.clientX-y,p.clientY-v)<gc)return;o.current=!0,document.documentElement.classList.add("be-block-range-dragging"),(h=(m=window.getSelection)==null?void 0:m.call(window))==null||h.removeAllRanges()}(x=(g=window.getSelection)==null?void 0:g.call(window))==null||x.removeAllRanges(),p.preventDefault();const d=(k=document.elementFromPoint(p.clientX,p.clientY))==null?void 0:k.closest("[data-block-row-id]"),b=(d==null?void 0:d.getAttribute("data-block-row-id"))??null;t(xc(n,r.current,b))},[n,t]),c=f.useCallback(()=>{r.current=null,o.current=!1,l.current=null,document.documentElement.classList.remove("be-block-range-dragging")},[]),i=f.useCallback((p,d)=>{r.current=p,o.current=!1,l.current={x:d.clientX,y:d.clientY}},[]),u=f.useCallback(p=>{var g,x;if(p.button!==0||kc()||(x=(g=p.target).closest)!=null&&x.call(g,"button, input, textarea, select"))return;const d=p.target.closest("[data-block-row-id]");if(d){if(p.target.closest(".be-block-row-content"))return;i(d.getAttribute("data-block-row-id"),p);return}const b=e==null?void 0:e.current;if(!b)return;const h=[...b.querySelectorAll("[data-block-row-id]")].find(k=>{const y=k.getBoundingClientRect();return p.clientY>=y.top&&p.clientY<=y.bottom});h&&i(h.getAttribute("data-block-row-id"),p)},[e,i]);f.useEffect(()=>(document.addEventListener("mousedown",u),document.addEventListener("mousemove",a),document.addEventListener("mouseup",c),()=>{document.removeEventListener("mousedown",u),document.removeEventListener("mousemove",a),document.removeEventListener("mouseup",c),document.documentElement.classList.remove("be-block-range-dragging")}),[u,a,c])}const vc="be-touch-input";function wc(){var e,n;return typeof window<"u"&&((n=(e=window.matchMedia)==null?void 0:e.call(window,"(pointer: coarse)"))==null?void 0:n.matches)===!0}function bt(){const[e,n]=f.useState(wc);return f.useEffect(()=>{if(typeof window>"u")return;const t=r=>{n(r.pointerType==="touch"||r.pointerType==="pen")};return window.addEventListener("pointerdown",t,{passive:!0}),()=>window.removeEventListener("pointerdown",t)},[]),f.useEffect(()=>{var t;(t=document.documentElement)==null||t.classList.toggle(vc,e)},[e]),e}function mt(e,n,t,r,o){const[l,a]=f.useState(!1),c=f.useCallback(x=>{const k=n==="same-block"?_e(e,t.blockId,t,x):fn(e,r,x);return k&&W(k),k},[e,n,t,r]),i=f.useCallback(x=>{const k=n==="same-block"?pt(e,t.blockId,t,x):ft(e,r,x);k&&W(k)},[e,n,t,r]),u=f.useCallback(x=>{const k=x==="subscript"?"superscript":"subscript",y=!o[x];c({[x]:y?!0:null,[k]:null})},[o,c]),p=f.useRef(null),d=f.useCallback(()=>{p.current={kind:n,selection:t,crossSelection:r},a(!0)},[n,t,r]),b=f.useCallback(()=>a(!1),[]),m=f.useCallback(x=>{const k=p.current;if(!k)return;const y=k.kind==="same-block"?_e(e,k.selection.blockId,k.selection,x):fn(e,k.crossSelection,x);y&&W(y),a(!1)},[e]),h=f.useCallback((x,k)=>m({link:{href:x,target:k}}),[m]),g=f.useCallback(()=>m({link:null}),[m]);return{applyPatch:c,toggleBoolean:i,setSubSuper:u,isLinkModalOpen:l,openLinkModal:d,closeLinkModal:b,handleSaveLink:h,handleRemoveLink:g}}function go({isOpen:e,onClose:n,onSelectCommand:t}){const r=Te(),o=be(),l=f.useMemo(()=>[...(r==null?void 0:r.listSlashCommands())??[],...(o==null?void 0:o.listSlashCommands())??[]],[r,o]);return s.jsx(Se,{isOpen:e,onClose:n,title:"Add a block",variant:"sheet",children:s.jsx("div",{className:"be-mobile-picker-list",role:"listbox","aria-label":"Insertable blocks",children:l.map(a=>{const c=a.icon;return s.jsxs("button",{type:"button",role:"option",className:"be-mobile-picker-item",onClick:()=>t(a),children:[c&&s.jsx("span",{className:"be-mobile-picker-item-icon",children:s.jsx(c,{size:18})}),s.jsx("span",{className:"be-mobile-picker-item-label",children:a.label})]},a.label)})})})}function xo({isOpen:e,onClose:n,store:t,blockId:r}){var c;const o=r?t.getBlock(r):null,l=!!((c=o==null?void 0:o.props)!=null&&c.hidden),a=f.useCallback(i=>{i(),n()},[n]);return s.jsx(Se,{isOpen:e,onClose:n,title:"Block options",variant:"sheet",children:s.jsxs("div",{className:"be-mobile-picker-list",role:"menu","aria-label":"Block options",children:[s.jsxs("button",{type:"button",role:"menuitem",className:"be-mobile-picker-item",onClick:()=>a(()=>nt(t,r)),children:[s.jsx("span",{className:"be-mobile-picker-item-icon",children:s.jsx(Un,{size:18})}),s.jsx("span",{className:"be-mobile-picker-item-label",children:"Duplicate"})]}),s.jsxs("button",{type:"button",role:"menuitem",className:"be-mobile-picker-item",onClick:()=>a(()=>tt(t,r)),children:[s.jsx("span",{className:"be-mobile-picker-item-icon",children:s.jsx(Kn,{size:18})}),s.jsx("span",{className:"be-mobile-picker-item-label",children:"Move up"})]}),s.jsxs("button",{type:"button",role:"menuitem",className:"be-mobile-picker-item",onClick:()=>a(()=>rt(t,r)),children:[s.jsx("span",{className:"be-mobile-picker-item-icon",children:s.jsx(Vn,{size:18})}),s.jsx("span",{className:"be-mobile-picker-item-label",children:"Move down"})]}),s.jsxs("button",{type:"button",role:"menuitem",className:"be-mobile-picker-item",onClick:()=>a(()=>t.applyOperation(H(r,{hidden:!l}))),children:[s.jsx("span",{className:"be-mobile-picker-item-icon",children:l?s.jsx(Wn,{size:18}):s.jsx(Yn,{size:18})}),s.jsx("span",{className:"be-mobile-picker-item-label",children:l?"Show in preview":"Hide in preview"})]}),s.jsxs("button",{type:"button",role:"menuitem",className:"be-mobile-picker-item be-mobile-picker-item-danger",onClick:()=>a(()=>kn(t,r)),children:[s.jsx("span",{className:"be-mobile-picker-item-icon",children:s.jsx(hn,{size:18})}),s.jsx("span",{className:"be-mobile-picker-item-label",children:"Delete"})]})]})})}const Ic=Mr.map(e=>({value:e,label:e}));function Cc(e,n){const[t,r]=f.useState(!1),[o,l]=f.useState(null),[a,c]=f.useState(null),[i,u]=f.useState(null);return f.useEffect(()=>{const p=e.current;if(!p)return;const d=()=>r(!0),b=m=>{p.contains(m.relatedTarget)||r(!1)};return p.addEventListener("focusin",d),p.addEventListener("focusout",b),()=>{p.removeEventListener("focusin",d),p.removeEventListener("focusout",b)}},[e]),f.useEffect(()=>{if(!t){l(null);return}const p=()=>{var h;const d=e.current,b=(h=window.getSelection)==null?void 0:h.call(window);if(!d||!b||b.rangeCount===0){l(null);return}if(!b.isCollapsed){if(!d.contains(b.anchorNode)||!d.contains(b.focusNode)){l(null);return}const g=$e();if(g){c({kind:"same-block",selection:g,crossSelection:null,marks:ut(n,g.blockId,g)}),l("selection");return}const x=Me(n);if(x){c({kind:"cross-block",selection:null,crossSelection:x,marks:dt(n,x)}),l("selection");return}l(null);return}const m=Ee();if(!m||!d.contains(b.anchorNode)){l(null);return}u(m),l("caret")};return p(),document.addEventListener("selectionchange",p),()=>document.removeEventListener("selectionchange",p)},[t,n,e]),{isFocused:t,mode:o,selectionState:a,caretState:i}}function Bc({store:e,selectionState:n}){const{kind:t,selection:r,crossSelection:o,marks:l}=n,{toggleBoolean:a,openLinkModal:c}=mt(e,t,r,o,l);return s.jsxs(s.Fragment,{children:[s.jsx("button",{type:"button",className:`be-mobile-bar-btn${l.bold?" be-mobile-bar-btn-active":""}`,"aria-label":"Bold",onClick:()=>a("bold"),children:s.jsx(qt,{size:18})}),s.jsx("button",{type:"button",className:`be-mobile-bar-btn${l.italic?" be-mobile-bar-btn-active":""}`,"aria-label":"Italic",onClick:()=>a("italic"),children:s.jsx(Wt,{size:18})}),s.jsx("button",{type:"button",className:`be-mobile-bar-btn${l.underline?" be-mobile-bar-btn-active":""}`,"aria-label":"Underline",onClick:()=>a("underline"),children:s.jsx(Yt,{size:18})}),s.jsx("button",{type:"button",className:`be-mobile-bar-btn${l.link?" be-mobile-bar-btn-active":""}`,"aria-label":"Link",onClick:c,children:s.jsx(Gt,{size:18})})]})}function jc({store:e,blockId:n}){const t=f.useCallback(()=>{const o=e.getBlock(n),l=o&&e.getBlock(o.parentId);l&&lt(e,l.id)},[e,n]),r=f.useCallback(()=>{const o=e.getBlock(n),l=o&&e.getBlock(o.parentId),a=l&&e.getBlock(l.parentId);if(!a||!l)return;const c=l.contentIds.indexOf(n);c!==-1&&un(e,a.id,c)},[e,n]);return s.jsxs(s.Fragment,{children:[s.jsx("button",{type:"button",className:"be-mobile-bar-btn","aria-label":"Insert row below",onClick:t,children:"+ Row"}),s.jsx("button",{type:"button",className:"be-mobile-bar-btn","aria-label":"Insert column right",onClick:r,children:"+ Column"})]})}function Rc({store:e,blockId:n}){var o;const t=e.getBlock(n),r=f.useCallback(l=>e.applyOperation(H(n,{language:l})),[e,n]);return s.jsx(Oe,{className:"be-mobile-bar-select",value:((o=t==null?void 0:t.props)==null?void 0:o.language)??"plaintext",options:Ic,onChange:r,ariaLabel:"Code language"})}function Tc({store:e,blockId:n}){var o;const t=e.getBlock(n),r=(o=t==null?void 0:t.props)==null?void 0:o.color;return s.jsx("div",{className:"be-mobile-bar-swatches",children:Or.map(l=>s.jsx("button",{type:"button",className:`be-callout-color-option be-callout-color-option-${l.value}${l.value===r?" be-callout-color-option-active":""}`,"aria-label":l.label,title:l.label,onClick:()=>e.applyOperation(H(n,{color:l.value}))},l.value))})}const ko={tableCell:jc,code:Rc,callout:Tc};function Sc(e,n){let t=e.getBlock(n);for(;t;){if(ko[t.type])return t;t=t.parentId?e.getBlock(t.parentId):null}return null}function Ec(e,n){const t=e.getRootId();let r=e.getBlock(n);for(;r&&r.parentId!==t;)r=e.getBlock(r.parentId);return r}function Oc({containerRef:e}){var E,R;const n=D(),t=ro(),r=bt(),o=In(),{isFocused:l,mode:a,selectionState:c,caretState:i}=Cc(e,n),[u,p]=f.useState(!1),[d,b]=f.useState(!1),m=f.useCallback(()=>p(!0),[]),h=f.useCallback(()=>p(!1),[]),g=f.useCallback(()=>b(!0),[]),x=f.useCallback(()=>b(!1),[]),k=f.useCallback(w=>{const B=Ee()??i;B&&(w.run(n,{blockId:B.blockId,runId:B.runId,sliceStart:B.offset,sliceEnd:B.offset}),h())},[n,i,h]),y=f.useCallback(()=>{var w,B;(B=(w=document.activeElement)==null?void 0:w.blur)==null||B.call(w)},[]);if(!r||!l)return null;const v=a==="caret"&&i?Sc(n,i.blockId):null,S=v?ko[v.type]:null,I=a==="caret"&&i?i.blockId:((E=c==null?void 0:c.selection)==null?void 0:E.blockId)??((R=c==null?void 0:c.crossSelection)==null?void 0:R.startBlockId)??null,T=I?Ec(n,I):null;return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"be-mobile-action-bar",role:"toolbar","aria-label":"Editor actions",style:{bottom:o},onMouseDown:w=>w.preventDefault(),children:[a==="selection"&&c&&s.jsx(Bc,{store:n,selectionState:c}),a!=="selection"&&s.jsxs(s.Fragment,{children:[s.jsx("button",{type:"button",className:"be-mobile-bar-btn","aria-label":"Add block",onClick:m,children:s.jsx(Fn,{size:18})}),S&&v&&s.jsx(S,{store:n,blockId:v.id}),t&&s.jsxs(s.Fragment,{children:[s.jsx("button",{type:"button",className:"be-mobile-bar-btn","aria-label":"Undo",disabled:!t.canUndo,onClick:t.undo,children:"↶"}),s.jsx("button",{type:"button",className:"be-mobile-bar-btn","aria-label":"Redo",disabled:!t.canRedo,onClick:t.redo,children:"↷"})]})]}),s.jsx("span",{className:"be-mobile-bar-spacer"}),T&&s.jsx("button",{type:"button",className:"be-mobile-bar-btn","aria-label":"Block options",onClick:g,children:s.jsx($o,{size:18})}),s.jsx("button",{type:"button",className:"be-mobile-bar-btn","aria-label":"Dismiss keyboard",onClick:y,children:s.jsx(mn,{size:18})})]}),s.jsx(go,{isOpen:u,onClose:h,onSelectCommand:k}),s.jsx(xo,{isOpen:d,onClose:x,store:n,blockId:T==null?void 0:T.id})]})}function Lc({minHeight:e=180,className:n="be-trailing-space"}){const t=D(),[r]=$n(),o=f.useCallback(()=>{var u;if(r)return;const l=t.getRootId(),a=t.getBlock(l),c=(u=a==null?void 0:a.contentIds)==null?void 0:u[a.contentIds.length-1];if(!c){const p=ze(t);p&&jt(t,p);return}const i=t.getBlock(c);(i==null?void 0:i.type)==="paragraph"?jt(t,c):Ie(t,c,$("paragraph"))},[t,r]);return s.jsx("div",{className:n,style:{minHeight:e},onClick:o})}function yo(e,{pretty:n=!0}={}){const t=e.getRootId(),{blocks:r,runs:o}=Zn(e,t);return JSON.stringify({version:1,rootId:t,blocks:r,runs:o},null,n?2:0)}function vo(e,n,t){const r=e.getBlock(e.getRootId());return r?en(e,n,r.contentIds,t).html:""}function wo(e,n,t){const r=e.getBlock(e.getRootId());return r?en(e,n,r.contentIds,t).text:""}const Nc=[{value:"json",label:"JSON"},{value:"html",label:"HTML"},{value:"text",label:"Text"}];function Mc({label:e="View source",className:n=""}){const t=D(),r=Te(),o=be(),[l,a]=f.useState(!1),[c,i]=f.useState("json"),[u,p]=f.useState(!1),d=f.useCallback(()=>{p(!1),a(!0)},[]),b=f.useCallback(()=>a(!1),[]),m=f.useMemo(()=>l?c==="json"?yo(t):c==="html"?vo(t,r,o):wo(t,r,o):"",[l,c,t,r,o]),h=f.useCallback(async()=>{try{await navigator.clipboard.writeText(m),p(!0),setTimeout(()=>p(!1),1500)}catch{}},[m]);return s.jsxs(s.Fragment,{children:[s.jsxs("button",{type:"button",className:`be-export-trigger ${n}`.trim(),onClick:d,children:[s.jsx(Xt,{size:14})," ",e]}),s.jsxs(Se,{isOpen:l,onClose:b,title:"Document source",size:"large",children:[s.jsx("div",{className:"be-export-tabs",role:"tablist",children:Nc.map(g=>s.jsx("button",{type:"button",role:"tab","aria-selected":c===g.value,className:`be-export-tab${c===g.value?" be-export-tab-active":""}`,onClick:()=>i(g.value),children:g.label},g.value))}),s.jsx("pre",{className:"be-export-pre",children:s.jsx("code",{children:m})}),s.jsxs("div",{className:"be-modal-actions",children:[s.jsx("button",{type:"button",className:"be-modal-cancel",onClick:b,children:"Close"}),s.jsx("button",{type:"button",className:"be-modal-save",onClick:h,children:u?"Copied!":"Copy"})]})]})]})}const Ac=340;function Dc(e,n,t,r){f.useEffect(()=>{if(!e||!n)return;const o=document.querySelector(`[data-run-id="${n}"]`);if(o)return o.setAttribute("aria-expanded","true"),o.setAttribute("aria-haspopup","listbox"),o.setAttribute("aria-controls",r),t&&o.setAttribute("aria-activedescendant",t),()=>{o.removeAttribute("aria-expanded"),o.removeAttribute("aria-haspopup"),o.removeAttribute("aria-controls"),o.removeAttribute("aria-activedescendant")}},[e,n,t,r])}function _c({isOpen:e,rect:n,commands:t,runId:r,onSelect:o,onClose:l,menuId:a="be-slash-menu",ariaLabel:c="Slash commands"}){const[i,u]=f.useState(0),p=f.useRef(null),d=In();f.useEffect(()=>{u(0)},[t.length]),f.useEffect(()=>{var k,y;(y=(k=p.current)==null?void 0:k.scrollIntoView)==null||y.call(k,{block:"nearest"})},[i]),f.useEffect(()=>{if(!e)return;const k=y=>{y.key==="ArrowDown"?(y.preventDefault(),y.stopPropagation(),u(v=>Math.min(v+1,Math.max(t.length-1,0)))):y.key==="ArrowUp"?(y.preventDefault(),y.stopPropagation(),u(v=>Math.max(v-1,0))):y.key==="Enter"?(y.preventDefault(),y.stopPropagation(),t[i]&&o(t[i])):y.key==="Escape"&&(y.preventDefault(),y.stopPropagation(),l())};return document.addEventListener("keydown",k,!0),()=>document.removeEventListener("keydown",k,!0)},[e,t,i,o,l]);const m=t[i]?`${a}-option-${i}`:null;if(Dc(e,r,m,a),!e||t.length===0||!n)return null;const h=window.innerHeight-d,x=n.bottom+Ac>h?{bottom:window.innerHeight-n.top+4}:{top:n.bottom+4};return s.jsx("div",{id:a,role:"listbox","aria-label":c,className:"be-slash-menu",style:{position:"fixed",left:n.left,zIndex:1e3,...x},children:t.map((k,y)=>{const v=k.icon;return s.jsxs("div",{ref:y===i?p:void 0,id:`${a}-option-${y}`,role:"option","aria-selected":y===i,className:`be-slash-menu-item${y===i?" be-slash-menu-item-active":""}`,onMouseDown:S=>{S.preventDefault(),o(k)},onMouseEnter:()=>u(y),children:[v&&s.jsx("span",{className:"be-slash-menu-item-icon",children:s.jsx(v,{size:16})}),s.jsx("span",{className:"be-slash-menu-item-label",children:k.label})]},k.label)})})}function Pc(e,n){var r;if(!n)return!0;const t=n.toLowerCase();return e.label.toLowerCase().includes(t)||((r=e.keywords)==null?void 0:r.some(o=>o.toLowerCase().includes(t)))}function $c(e,n){const t=n.anchorNode,r=n.anchorOffset;let o;if(t===e){o="";for(let l=0;l<r&&l<e.childNodes.length;l+=1)o+=e.childNodes[l].textContent??""}else t&&t.parentElement===e?o=(t.textContent??"").slice(0,r):o=e.textContent??"";return he(o).length}function ht(e,n,t){const r=D(),[o,l]=f.useState(null);f.useEffect(()=>{const u=e.current;if(!u)return;const p=()=>{var I,T,E,R;const b=(I=window.getSelection)==null?void 0:I.call(window),m=b==null?void 0:b.anchorNode;let h=(m==null?void 0:m.nodeType)===1?m:m==null?void 0:m.parentElement;for(;h&&typeof h.hasAttribute=="function"&&!h.hasAttribute("data-run-id");)h=h.parentElement;const g=(T=h==null?void 0:h.getAttribute)==null?void 0:T.call(h,"data-run-id");if(!g||!b){l(null);return}const x=$c(h,b),k=he(h.textContent).slice(0,x),y=n.exec(k);if(!y){l(null);return}const v=(R=(E=h.closest)==null?void 0:E.call(h,"[data-block-id]"))==null?void 0:R.getAttribute("data-block-id");if(!v){l(null);return}const S=y.index+y[1].length;l({query:y[2],blockId:v,runId:g,sliceStart:S,sliceEnd:x,rect:h.getBoundingClientRect()})},d=b=>{b.key==="Escape"&&l(null)};return u.addEventListener("input",p),u.addEventListener("keydown",d),()=>{u.removeEventListener("input",p),u.removeEventListener("keydown",d)}},[e,n]);const a=o?t().filter(u=>Pc(u,o.query)):[],c=f.useCallback(u=>{o&&(u.run(r,{blockId:o.blockId,runId:o.runId,sliceStart:o.sliceStart,sliceEnd:o.sliceEnd}),l(null))},[o,r]),i=f.useCallback(()=>l(null),[]);return{isOpen:!!o,query:(o==null?void 0:o.query)??"",rect:(o==null?void 0:o.rect)??null,runId:(o==null?void 0:o.runId)??null,commands:a,selectCommand:c,close:i}}const Hc=/(^|\s)\/(\w*)$/;function zc(e){const n=Te(),t=be(),r=f.useCallback(()=>[...n.listSlashCommands(),...(t==null?void 0:t.listSlashCommands())??[]],[n,t]);return ht(e,Hc,r)}const Fc=[{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 Uc(e,{runId:n,sliceStart:t,sliceEnd:r},o){const l=e.getRun(n),a=(l==null?void 0:l.value)??"",c=a.slice(0,t)+o+a.slice(r);e.applyOperation(Y(n,{value:c})),me(n,t+o.length)}const Kc=Fc.map(({char:e,name:n,keywords:t})=>({label:`${e} ${n}`,keywords:t,run:(r,o)=>Uc(r,o,e)})),Vc=/(^|\s):(\w*)$/,qc=()=>Kc;function Wc(e){return ht(e,Vc,qc)}const Yc=/(^|\s)@(\w*)$/;function Gc(e){const n=be(),t=f.useCallback(()=>(n==null?void 0:n.listAtCommands())??[],[n]);return ht(e,Yc,t)}const Xc=[{markName:"bold",Icon:qt,title:"Bold (Ctrl+B)"},{markName:"italic",Icon:Wt,title:"Italic (Ctrl+I)"},{markName:"underline",Icon:Yt,title:"Underline (Ctrl+U)"},{markName:"strike",Icon:zo,title:"Strikethrough"}],Jc=[{label:"Default",value:null},{label:"Red",value:"#e03131"},{label:"Orange",value:"#e8590c"},{label:"Green",value:"#2f9e44"},{label:"Blue",value:"#1971c2"},{label:"Purple",value:"#9c36b5"}],Qc=[{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 Zc({isOpen:e,rect:n,kind:t,selection:r,crossSelection:o,marks:l,store:a}){var v,S;const c=bt(),[i,u]=f.useState(null),p=f.useRef(null),{applyPatch:d,toggleBoolean:b,setSubSuper:m,isLinkModalOpen:h,openLinkModal:g,closeLinkModal:x,handleSaveLink:k,handleRemoveLink:y}=mt(a,t,r,o,l);return f.useEffect(()=>{if(!i)return;const I=E=>{p.current&&!p.current.contains(E.target)&&u(null)},T=E=>{E.key==="Escape"&&u(null)};return document.addEventListener("mousedown",I),document.addEventListener("keydown",T),()=>{document.removeEventListener("mousedown",I),document.removeEventListener("keydown",T)}},[i]),f.useEffect(()=>{u(null)},[n,t]),c||(!e||!n)&&!h?null:s.jsxs(s.Fragment,{children:[e&&n&&s.jsxs("div",{ref:p,className:"be-floating-toolbar",role:"toolbar","aria-label":"Text formatting",style:{position:"fixed",top:n.top-44,left:n.left+n.width/2,transform:"translateX(-50%)"},onMouseDown:I=>I.preventDefault(),children:[Xc.map(({markName:I,Icon:T,title:E})=>s.jsx("button",{type:"button",className:`be-floating-toolbar-btn${l[I]?" be-floating-toolbar-btn-active":""}`,title:E,"aria-label":E,"aria-pressed":!!l[I],onClick:()=>b(I),children:s.jsx(T,{})},I)),s.jsx("button",{type:"button",className:`be-floating-toolbar-btn${l.subscript?" be-floating-toolbar-btn-active":""}`,title:"Subscript","aria-pressed":!!l.subscript,onClick:()=>m("subscript"),children:"X₂"}),s.jsx("button",{type:"button",className:`be-floating-toolbar-btn${l.superscript?" be-floating-toolbar-btn-active":""}`,title:"Superscript","aria-pressed":!!l.superscript,onClick:()=>m("superscript"),children:"X²"}),s.jsx("span",{className:"be-floating-toolbar-divider"}),s.jsxs("div",{className:"be-floating-toolbar-picker-wrap",children:[s.jsx("button",{type:"button",className:"be-floating-toolbar-btn",title:"Text color","aria-haspopup":"true","aria-expanded":i==="color",onClick:()=>u(I=>I==="color"?null:"color"),children:s.jsx("span",{style:{color:l.color||"inherit",fontWeight:700},children:"A"})}),i==="color"&&s.jsx("div",{className:"be-floating-toolbar-picker",role:"menu","aria-label":"Text color",children:Jc.map(I=>s.jsx("button",{type:"button",role:"menuitem",className:"be-floating-toolbar-swatch",title:I.label,onClick:()=>{d({color:I.value}),u(null)},children:s.jsx("span",{style:{color:I.value||"#1a1a1a",fontWeight:700},children:"A"})},I.label))})]}),s.jsxs("div",{className:"be-floating-toolbar-picker-wrap",children:[s.jsx("button",{type:"button",className:"be-floating-toolbar-btn",title:"Highlight","aria-haspopup":"true","aria-expanded":i==="highlight",onClick:()=>u(I=>I==="highlight"?null:"highlight"),children:s.jsx("span",{style:{backgroundColor:l.highlight||"transparent",padding:"0 2px",borderRadius:2},children:"H"})}),i==="highlight"&&s.jsx("div",{className:"be-floating-toolbar-picker",role:"menu","aria-label":"Highlight color",children:Qc.map(I=>s.jsx("button",{type:"button",role:"menuitem",className:"be-floating-toolbar-swatch",style:{backgroundColor:I.value||"transparent"},title:I.label,onClick:()=>{d({highlight:I.value}),u(null)}},I.label))})]}),s.jsx("span",{className:"be-floating-toolbar-divider"}),s.jsx("button",{type:"button",className:`be-floating-toolbar-btn${l.link?" be-floating-toolbar-btn-active":""}`,title:"Link","aria-label":"Link","aria-pressed":!!l.link,onClick:g,children:s.jsx(Gt,{})})]}),s.jsx(Kt,{isOpen:h,initialHref:((v=l.link)==null?void 0:v.href)??"",initialTarget:((S=l.link)==null?void 0:S.target)??"_self",hasExistingLink:!!l.link,onSave:k,onRemove:y,onClose:x})]})}function ei(e){const n=D(),[t,r]=f.useState(null);return f.useEffect(()=>{const o=e.current;if(!o)return;const l=()=>{var p,d,b;const a=(p=window.getSelection)==null?void 0:p.call(window);if(!a||a.rangeCount===0||a.isCollapsed){r(null);return}if(!o.contains(a.anchorNode)||!o.contains(a.focusNode)){r(null);return}const c=((b=(d=a.getRangeAt(0)).getBoundingClientRect)==null?void 0:b.call(d))??{top:0,left:0,right:0,bottom:0,width:0,height:0},i=$e();if(i){r({kind:"same-block",rect:c,selection:i,marks:ut(n,i.blockId,i)});return}const u=Me(n);if(u){r({kind:"cross-block",rect:c,crossSelection:u,marks:dt(n,u)});return}r(null)};return document.addEventListener("selectionchange",l),window.addEventListener("scroll",l,!0),window.addEventListener("resize",l),()=>{document.removeEventListener("selectionchange",l),window.removeEventListener("scroll",l,!0),window.removeEventListener("resize",l)}},[e,n]),{isOpen:!!t,rect:(t==null?void 0:t.rect)??null,kind:(t==null?void 0:t.kind)??null,selection:(t==null?void 0:t.selection)??null,crossSelection:(t==null?void 0:t.crossSelection)??null,marks:(t==null?void 0:t.marks)??{},close:()=>r(null)}}function ni({id:e,label:n,placeholder:t,variant:r,options:o,onManage:l,mention:a=!1}){const c=D(),i=we(e),u=f.useCallback((m,h)=>{c.applyOperation(Y(e,{data:{selectedValue:m,selectedLabel:(h==null?void 0:h.label)??"",selectedColor:h==null?void 0:h.color}}))},[c,e]);if(!i)return null;const{selectedValue:p="",selectedLabel:d="",selectedColor:b}=i.data??{};return s.jsx("span",{className:"be-inline-select",onMouseDown:m=>{m.preventDefault(),m.stopPropagation()},onKeyDown:m=>m.stopPropagation(),children:s.jsx(Oe,{value:p,selectedLabel:d,selectedColor:b,options:o,onChange:u,placeholder:t,variant:r,ariaLabel:n,onManageOptions:l,mention:a})})}function Io(e){return String(e).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Dt(e){return Io(e).replace(/"/g,"&quot;")}function Co({type:e,label:n,placeholder:t="Select…",variant:r="default",icon:o,options:l,onManage:a,triggers:c=["slash"],mention:i=c.includes("at")}){function u(h){var k,y;const g=((k=h.data)==null?void 0:k.selectedLabel)||"",x=i&&g?`@${g}`:g;return`<span data-inline-type="${Dt(e)}" data-selected-value="${Dt(((y=h.data)==null?void 0:y.selectedValue)??"")}">${Io(x)}</span>`}function p(h){var x;const g=((x=h.data)==null?void 0:x.selectedLabel)??"";return i&&g?`@${g}`:g}function d(h){var k;if(((k=h.getAttribute)==null?void 0:k.call(h,"data-inline-type"))!==e)return null;const g=h.textContent??"",x=i&&g.startsWith("@")?g.slice(1):g;return{id:j(),type:e,value:"",marks:{},data:{selectedValue:h.getAttribute("data-selected-value")??"",selectedLabel:x}}}function b({id:h}){return s.jsx(ni,{id:h,label:n,placeholder:t,variant:r,options:l,onManage:a,mention:i})}const m={label:n,icon:o??Qt,keywords:[n.toLowerCase(),"select","field"],run:(h,{blockId:g,runId:x,sliceStart:k,sliceEnd:y})=>Cn(h,{blockId:g,runId:x,sliceStart:k,sliceEnd:y},()=>({id:j(),type:e,value:"",marks:{},data:{selectedValue:"",selectedLabel:"",selectedColor:void 0}}))};return{component:b,isAtomic:!0,toHTML:u,toPlainText:p,fromHTML:d,slashCommand:c.includes("slash")?m:void 0,atCommand:c.includes("at")?m:void 0}}function Bo(e,n,{onManage:t}={}){for(const r of e.getFieldTypes())n.register(r.id,Co({type:r.id,label:r.label,placeholder:r.placeholder,variant:r.variant,options:r.options??[],onManage:t?()=>t(r.id):void 0}))}function jo(){const e=D(),n=be(),t=to(),{openEdit:r}=Hn(),o=f.useRef([]);f.useEffect(()=>{if(!n)return;const l=new Set(t.map(a=>a.id));for(const a of o.current)l.has(a)||n.unregister(a);Bo(e,n,{onManage:r}),o.current=[...l]},[e,n,t,r])}function ti(){jo();const e=D(),{target:n,close:t}=Hn(),r=n!==null,o=r&&n!=="new",[l,a]=f.useState(""),[c,i]=f.useState([]),[u,p]=f.useState("");f.useEffect(()=>{if(r){if(o){const x=e.getFieldType(n);a((x==null?void 0:x.label)??""),i((x==null?void 0:x.options)??[])}else a(""),i([]);p("")}},[r,o,n,e]);const d=f.useCallback((x,k)=>{i(y=>y.map(v=>v.value===x?{...v,label:k}:v))},[]),b=f.useCallback(x=>{i(k=>k.filter(y=>y.value!==x))},[]),m=f.useCallback(()=>{const x=u.trim();p(""),x&&i(k=>[...k,{value:j(),label:x,color:Ye(k.length)}])},[u]),h=f.useCallback(()=>{const x=l.trim();x&&(o?e.applyOperation(An(n,{label:x,options:c})):e.applyOperation(Mn({id:j(),label:x,placeholder:"Select…",variant:"tag",options:c})),t())},[e,o,n,l,c,t]),g=f.useCallback(()=>{o&&e.applyOperation(Dn(n)),t()},[e,o,n,t]);return s.jsxs(Se,{isOpen:r,onClose:t,title:o?"Edit field type":"New field type",children:[s.jsxs("label",{className:"be-modal-field",children:[s.jsx("span",{children:"Name"}),s.jsx("input",{type:"text",value:l,onChange:x=>a(x.target.value),placeholder:"e.g. Priority, Status…",autoFocus:!0})]}),s.jsxs("div",{className:"be-modal-field",children:[s.jsx("span",{children:"Options"}),c.map((x,k)=>s.jsxs("div",{className:"be-table-header-menu-option-row",children:[s.jsx("span",{className:"be-table-header-menu-option-swatch",style:{background:(x.color??Ye(k)).bg},"aria-hidden":"true"}),s.jsx("input",{className:"be-table-header-menu-option-input",value:x.label,onChange:y=>d(x.value,y.target.value),"aria-label":`Rename option ${x.label}`}),s.jsx("button",{type:"button",className:"be-table-header-menu-option-remove",onClick:()=>b(x.value),"aria-label":`Remove option ${x.label}`,children:s.jsx(Qe,{size:14})})]},x.value)),s.jsxs("div",{className:"be-table-header-menu-option-row",children:[s.jsx("input",{className:"be-table-header-menu-option-input",value:u,onChange:x=>p(x.target.value),placeholder:"New option…",onKeyDown:x=>{x.key==="Enter"&&(x.preventDefault(),m())}}),s.jsx("button",{type:"button",className:"be-table-header-menu-option-add",onClick:m,"aria-label":"Add option",children:"+"})]})]}),s.jsxs("div",{className:"be-modal-actions",children:[o&&s.jsx("button",{type:"button",className:"be-modal-delete",onClick:g,children:"Delete field type"}),s.jsx("button",{type:"button",className:"be-modal-cancel",onClick:t,children:"Cancel"}),s.jsx("button",{type:"button",className:"be-modal-save",onClick:h,children:"Save"})]})]})}exports.APP_MIME=dn;exports.BlockChildren=je;exports.BlockErrorBoundary=sr;exports.BlockGutterRow=ar;exports.BlockRangeActionMenu=hc;exports.BlockRegistry=_t;exports.BlockRenderer=Qn;exports.COLUMN_TYPES=dr;exports.DEFAULT_COLUMN_TYPE=yn;exports.DEFAULT_COLUMN_WIDTH=vn;exports.DocumentExportButton=Mc;exports.EditableBlockContent=xe;exports.EditorProvider=Do;exports.EditorStore=_n;exports.EditorTrailingSpace=Lc;exports.FieldTypeEditorModal=ti;exports.FloatingToolbar=Zc;exports.History=Lo;exports.InlineRegistry=Pt;exports.LAYOUT_BLOCKS=Vr;exports.MIN_COLUMN_WIDTH=cn;exports.MobileActionBar=Oc;exports.MobileBlockOptionsSheet=xo;exports.MobileBlockPickerSheet=go;exports.Modal=Se;exports.Select=Oe;exports.SlashMenu=_c;exports.TABLE_BLOCKS=Kr;exports.TABLE_SELECT_INLINE_TYPES=no;exports.TableHeaderRow=yr;exports.blankRunForType=pr;exports.blockquoteBlockType=Nr;exports.buttonBlockType=Pr;exports.calloutBlockType=Lr;exports.checkboxInlineType=Xr;exports.codeBlockType=Ar;exports.convertRunToType=fr;exports.copyBlockRangeToClipboard=Nn;exports.createBlockRegistry=No;exports.createCellForColumn=wn;exports.createDefaultColumns=ot;exports.createInlineRegistry=Mo;exports.createSelectFieldType=Co;exports.dateInlineType=Gr;exports.deleteBlockAndFocusSibling=kn;exports.deleteBlockRange=qe;exports.deleteColumn=hr;exports.deleteEntireDocument=pn;exports.deleteOverBlockRange=it;exports.deleteRow=mr;exports.deleteRunRangeInBlock=ct;exports.deserializeClipboard=lo;exports.dividerBlockType=Sr;exports.duplicateBlock=nt;exports.embedBlockType=Fr;exports.emojiInlineType=Zr;exports.ensureRootNonEmpty=ze;exports.exportDocumentHTML=vo;exports.exportDocumentJSON=yo;exports.exportDocumentText=wo;exports.focusRunAtOffset=me;exports.focusRunEnd=W;exports.focusRunStart=zn;exports.getMarksSummaryOverBlockRange=dt;exports.getMarksSummaryOverSelection=ut;exports.headingBlockType=lr;exports.injectDefaultStyles=$t;exports.insertColumnAfter=un;exports.insertRowAfter=lt;exports.isEntireBlockRangeHidden=io;exports.isEntireBlockSelected=ho;exports.layoutBlockType=Tr;exports.layoutColumnBlockType=Rr;exports.listItemBlockType=ur;exports.moveBlockDown=rt;exports.moveBlockRangeDown=co;exports.moveBlockRangeUp=ao;exports.moveBlockUp=tt;exports.operations=Eo;exports.paragraphBlockType=or;exports.registerBlocks=Ur;exports.registerBuiltInBlocks=Oa;exports.registerBuiltInInlineTypes=Za;exports.registerInlineTypes=eo;exports.registerStoredFieldTypes=Bo;exports.remapSubtreeIds=et;exports.renameColumn=xr;exports.reorderBlockRangeFromStore=rc;exports.resolveCollapsedCaret=Ee;exports.resolveColumns=de;exports.resolveCrossBlockSelection=Me;exports.resolveMultiRunSelection=$e;exports.resolveRunSelection=xl;exports.selectInlineType=Wr;exports.serializeBlockRange=en;exports.setBlockRangeHidden=uo;exports.setColumnOptions=sn;exports.setColumnType=kr;exports.setColumnWidth=gr;exports.setMarksOverBlockRange=fn;exports.setMarksOverSelection=_e;exports.tableBlockType=Cr;exports.tableCellBlockType=wr;exports.tableRowBlockType=Ir;exports.tableSelectInlineType=Qr;exports.textToParagraphs=at;exports.toggleHeadingBlockType=Dr;exports.toggleMarkOnRunRange=pc;exports.toggleMarkOverBlockRange=ft;exports.toggleMarkOverSelection=pt;exports.useAtMenuTrigger=Gc;exports.useBlock=G;exports.useBlockChildren=Jn;exports.useBlockClassName=Z;exports.useBlockRangeDrag=yc;exports.useBlockRangeSelection=Xe;exports.useBlockRegistry=Te;exports.useClipboardHandlers=sc;exports.useCoarsePointer=bt;exports.useEditorKeyboardShortcuts=mc;exports.useEditorStore=D;exports.useEmojiMenuTrigger=Wc;exports.useFieldTypeEditor=Hn;exports.useFieldTypes=to;exports.useFloatingToolbarTrigger=ei;exports.useHistory=ro;exports.useInlineRegistry=be;exports.usePreviewMode=$n;exports.useRegisterFieldTypes=jo;exports.useRun=we;exports.useSelectedBlock=ge;exports.useSlashMenuTrigger=zc;exports.useTextFormattingActions=mt;exports.useVirtualKeyboardInset=In;exports.useWholeDocumentSelection=Pn;exports.walkDomToBlocks=oo;
1888
2046
  //# sourceMappingURL=noteloom.cjs.map