react-reason-editor 1.0.95 → 1.0.97

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. package/dist/{BubbleMenus-F5PFH6eV.cjs → BubbleMenus-3RiQc4lw.cjs} +1 -1
  2. package/dist/{BubbleMenus-eYDoohA4.js → BubbleMenus-CFzQBrVG.js} +1 -1
  3. package/dist/{ImportWord-cr386RpI.js → ImportWord-DtON-y5N.js} +1 -1
  4. package/dist/ImportWord.cjs +1 -1
  5. package/dist/ImportWord.js +1 -1
  6. package/dist/{Pagination-yjRu_qJK.cjs → Pagination-CGxVvD1Y.cjs} +1 -1
  7. package/dist/{Pagination-B8rfYYi_.js → Pagination-DYCCm6cp.js} +1 -1
  8. package/dist/Pagination.cjs +1 -1
  9. package/dist/Pagination.js +1 -1
  10. package/dist/{ReasonDocs-D_c14vkF.js → ReasonDocs-BXtUm4zk.js} +2 -2
  11. package/dist/{ReasonDocs-cELUZvnA.cjs → ReasonDocs-CsmZMk6W.cjs} +1 -1
  12. package/dist/{RichTextProvider-B5fdgtFs.js → RichTextProvider-BcsYTR6Z.js} +1 -1
  13. package/dist/{RichTextProvider-DJWvDmyS.cjs → RichTextProvider-KRSFedCE.cjs} +1 -1
  14. package/dist/docs-agent/plate/kits/markdown-kit.d.ts +8 -0
  15. package/dist/docs-agent/plate/plate-editor-config.d.ts +30 -0
  16. package/dist/docs-agent.cjs +1 -1
  17. package/dist/docs-agent.js +1 -1
  18. package/dist/editor-kit.cjs +1 -1
  19. package/dist/editor-kit.js +1 -1
  20. package/dist/{editorConfig-Duji4hwm.js → editorConfig-9-ZxkRbw.js} +1 -1
  21. package/dist/{editorConfig-2pHxtmeI.cjs → editorConfig-DF8EAH_P.cjs} +1 -1
  22. package/dist/extensions/Twitter/Twitter.d.ts +6 -1
  23. package/dist/{html-to-docx.esm-BLUcO7pp-DLRiI93_.cjs → html-to-docx.esm-BLUcO7pp-BKB2FJoB.cjs} +1 -1
  24. package/dist/index.cjs +1 -1
  25. package/dist/index.js +1 -1
  26. package/dist/reason-docs.cjs +1 -1
  27. package/dist/reason-docs.js +1 -1
  28. package/dist/reason-toolbar-skin-DY4w9SRA.cjs +1 -0
  29. package/dist/{reason-toolbar-skin-CQzJJqJy.js → reason-toolbar-skin-DarRq6V-.js} +4 -4
  30. package/package.json +3 -3
  31. package/dist/reason-toolbar-skin-SPGcsiuT.cjs +0 -1
@@ -1,4 +1,4 @@
1
- import{a as e,n as t,o as n,r as i,t as r}from"./rolldown-runtime-Drgf5FY8.js";import{o as a,t as o}from"./dist-DmY5xFkC.js";import{i as s,n as l,r as c,t as u}from"./tooltip-G11f5UOp.js";import{m as d,o as f,p}from"./editorConfig-Duji4hwm.js";import{t as h}from"./separator-CVKC9LXg.js";import{c as m,l as g,s as y,u as v}from"./Comment-DcnVhRwn.js";import{n as k,t as b}from"./button-D_m2J53A.js";import{t as w}from"./checkbox-3vQdQTmi.js";import{a as _,c as x,i as C,l as E,n as D,o as S,r as A,s as F,t as z}from"./floating-ui.dom-CdG_EzIc.js";import{a as B,c as T,f as O,h as P,i as N,l as I,m as j,n as R,o as M,p as L,r as V,s as q,t as W,u as H}from"./dropdown-menu-tmQwCqOR.js";import{i as U,n as $,r as K,t as G}from"./popover-Bgd9XvwH.js";import{r as J}from"./ExportWord--CMls-Qy.js";import*as Q from"react";import X,{Component as Y,Fragment as Z,Suspense as ee,cloneElement as te,createContext as ne,createElement as ie,forwardRef as re,isValidElement as ae,lazy as oe,memo as se,useCallback as le,useContext as ce,useDebugValue as ue,useEffect as de,useId as fe,useLayoutEffect as pe,useMemo as he,useReducer as me,useRef as ge,useState as ye}from"react";import{Slot as ve,createSlot as ke}from"@radix-ui/react-slot";import be,{clsx as we}from"clsx";import{Fragment as _e,jsx as xe,jsxs as Ce}from"react/jsx-runtime";import{AlignCenterIcon as Ee,AlignJustifyIcon as De,AlignLeftIcon as Se,AlignRightIcon as Ae,AppleIcon as Fe,ArrowDown as ze,ArrowDownToLineIcon as Be,ArrowLeft as Te,ArrowRight as Oe,ArrowUp as Pe,ArrowUpToLineIcon as Ne,AudioLinesIcon as Ie,BaselineIcon as je,BoldIcon as Re,BracesIcon as Me,CalendarIcon as Le,Check as Ve,CheckIcon as qe,ChevronDown as We,ChevronRight as He,ChevronRightIcon as Ue,ClockIcon as $e,Code2 as Ke,Code2Icon as Ge,Columns3Icon as Je,Combine as Qe,CombineIcon as Xe,CompassIcon as Ye,CopyIcon as Ze,CornerDownLeftIcon as et,EraserIcon as tt,ExternalLink as nt,FileUp as it,FileUpIcon as rt,FilmIcon as at,FlagIcon as ot,Grid2X2Icon as st,Grid3x3Icon as lt,GripHorizontal as ct,GripVertical as ut,Heading1Icon as dt,Heading2Icon as ft,Heading3Icon as pt,Heading4Icon as ht,Heading5Icon as mt,Heading6Icon as gt,HighlighterIcon as yt,ImageIcon as vt,IndentIcon as kt,ItalicIcon as bt,KeyboardIcon as wt,LeafIcon as _t,LightbulbIcon as xt,Link as Ct,Link2Icon as Et,List as Dt,ListCollapseIcon as St,ListIcon as At,ListOrdered as Ft,ListTodoIcon as zt,MicIcon as Bt,Minus as Tt,MinusIcon as Ot,MoreHorizontalIcon as Pt,MusicIcon as Nt,OutdentIcon as It,PaintBucketIcon as jt,PenToolIcon as Rt,PilcrowIcon as Mt,Plus as Lt,PlusIcon as Vt,Quote as qt,RadicalIcon as Wt,Redo2Icon as Ht,Search as Ut,SearchIcon as $t,SmileIcon as Kt,SparklesIcon as Gt,Square as Jt,SquareIcon as Qt,SquareSplitHorizontalIcon as Xt,StarIcon as Yt,StrikethroughIcon as Zt,SubscriptIcon as en,SuperscriptIcon as tn,Table as nn,TableOfContentsIcon as rn,Text as an,Trash2Icon as on,UnderlineIcon as sn,Undo2Icon as ln,Ungroup as cn,Unlink as un,WrapText as dn,XIcon as fn}from"lucide-react";import*as pn from"react-dom";import hn,{createPortal as mn,flushSync as gn}from"react-dom";import{DropdownMenuItemIndicator as yn}from"@radix-ui/react-dropdown-menu";import*as vn from"@radix-ui/react-popover";import"@radix-ui/react-separator";import*as kn from"@radix-ui/react-tooltip";import{Toggle as bn}from"@radix-ui/react-toggle";import wn from"use-sync-external-store/shim/with-selector.js";import _n from"katex";import{Tweet as xn}from"react-tweet";import Cn from"scroll-into-view-if-needed";import{c as En}from"react-compiler-runtime";import{all as Dn,createLowlight as Sn}from"lowlight";import{useSyncExternalStore as An}from"use-sync-external-store/shim";import{LiveTranscriber as Fn,isTranscriptionSupported as zn}from"use-voice-control/client";var Bn=Object.defineProperty,Tn=(e,t)=>Bn(e,"name",{value:t,configurable:!0}),On=!("undefined"==typeof window||!window.document||!window.document.createElement);function Pn(e,t,{checkForDefaultPrevented:n=!0}={}){/* @__PURE__ */
1
+ import{a as e,n as t,o as n,r as i,t as r}from"./rolldown-runtime-Drgf5FY8.js";import{o as a,t as o}from"./dist-DmY5xFkC.js";import{i as s,n as l,r as c,t as u}from"./tooltip-G11f5UOp.js";import{m as d,o as f,p}from"./editorConfig-9-ZxkRbw.js";import{t as h}from"./separator-CVKC9LXg.js";import{c as m,l as g,s as y,u as v}from"./Comment-DcnVhRwn.js";import{n as k,t as b}from"./button-D_m2J53A.js";import{t as w}from"./checkbox-3vQdQTmi.js";import{a as _,c as x,i as C,l as E,n as D,o as S,r as A,s as F,t as z}from"./floating-ui.dom-CdG_EzIc.js";import{a as B,c as T,f as O,h as P,i as N,l as I,m as j,n as R,o as M,p as L,r as V,s as q,t as W,u as H}from"./dropdown-menu-tmQwCqOR.js";import{i as U,n as $,r as K,t as G}from"./popover-Bgd9XvwH.js";import{r as J}from"./ExportWord--CMls-Qy.js";import*as Q from"react";import X,{Component as Y,Fragment as Z,Suspense as ee,cloneElement as te,createContext as ne,createElement as ie,forwardRef as re,isValidElement as ae,lazy as oe,memo as se,useCallback as le,useContext as ce,useDebugValue as ue,useEffect as de,useId as fe,useLayoutEffect as pe,useMemo as he,useReducer as me,useRef as ge,useState as ye}from"react";import{Slot as ve,createSlot as ke}from"@radix-ui/react-slot";import be,{clsx as we}from"clsx";import{Fragment as _e,jsx as xe,jsxs as Ce}from"react/jsx-runtime";import{AlignCenterIcon as Ee,AlignJustifyIcon as De,AlignLeftIcon as Se,AlignRightIcon as Ae,AppleIcon as Fe,ArrowDown as ze,ArrowDownToLineIcon as Be,ArrowLeft as Te,ArrowRight as Oe,ArrowUp as Pe,ArrowUpToLineIcon as Ne,AudioLinesIcon as Ie,BaselineIcon as je,BoldIcon as Re,BracesIcon as Me,CalendarIcon as Le,Check as Ve,CheckIcon as qe,ChevronDown as We,ChevronRight as He,ChevronRightIcon as Ue,ClockIcon as $e,Code2 as Ke,Code2Icon as Ge,Columns3Icon as Je,Combine as Qe,CombineIcon as Xe,CompassIcon as Ye,CopyIcon as Ze,CornerDownLeftIcon as et,EraserIcon as tt,ExternalLink as nt,FileUp as it,FileUpIcon as rt,FilmIcon as at,FlagIcon as ot,Grid2X2Icon as st,Grid3x3Icon as lt,GripHorizontal as ct,GripVertical as ut,Heading1Icon as dt,Heading2Icon as ft,Heading3Icon as pt,Heading4Icon as ht,Heading5Icon as mt,Heading6Icon as gt,HighlighterIcon as yt,ImageIcon as vt,IndentIcon as kt,ItalicIcon as bt,KeyboardIcon as wt,LeafIcon as _t,LightbulbIcon as xt,Link as Ct,Link2Icon as Et,List as Dt,ListCollapseIcon as St,ListIcon as At,ListOrdered as Ft,ListTodoIcon as zt,MicIcon as Bt,Minus as Tt,MinusIcon as Ot,MoreHorizontalIcon as Pt,MusicIcon as Nt,OutdentIcon as It,PaintBucketIcon as jt,PenToolIcon as Rt,PilcrowIcon as Mt,Plus as Lt,PlusIcon as Vt,Quote as qt,RadicalIcon as Wt,Redo2Icon as Ht,Search as Ut,SearchIcon as $t,SmileIcon as Kt,SparklesIcon as Gt,Square as Jt,SquareIcon as Qt,SquareSplitHorizontalIcon as Xt,StarIcon as Yt,StrikethroughIcon as Zt,SubscriptIcon as en,SuperscriptIcon as tn,Table as nn,TableOfContentsIcon as rn,Text as an,Trash2Icon as on,UnderlineIcon as sn,Undo2Icon as ln,Ungroup as cn,Unlink as un,WrapText as dn,XIcon as fn}from"lucide-react";import*as pn from"react-dom";import hn,{createPortal as mn,flushSync as gn}from"react-dom";import{DropdownMenuItemIndicator as yn}from"@radix-ui/react-dropdown-menu";import*as vn from"@radix-ui/react-popover";import"@radix-ui/react-separator";import*as kn from"@radix-ui/react-tooltip";import{Toggle as bn}from"@radix-ui/react-toggle";import wn from"use-sync-external-store/shim/with-selector.js";import _n from"katex";import{Tweet as xn}from"react-tweet";import Cn from"scroll-into-view-if-needed";import{c as En}from"react-compiler-runtime";import{all as Dn,createLowlight as Sn}from"lowlight";import{useSyncExternalStore as An}from"use-sync-external-store/shim";import{LiveTranscriber as Fn,isTranscriptionSupported as zn}from"use-voice-control/client";var Bn=Object.defineProperty,Tn=(e,t)=>Bn(e,"name",{value:t,configurable:!0}),On=!("undefined"==typeof window||!window.document||!window.document.createElement);function Pn(e,t,{checkForDefaultPrevented:n=!0}={}){/* @__PURE__ */
2
2
  return Tn(function(i){if(e?.(i),!1===n||!i||!i.defaultPrevented)return t?.(i)},"handleEvent")}function Nn(e){if(!On)throw new Error("Cannot access document outside of the DOM");return e?.ownerDocument??document}function In(e){return"IFRAME"===e.tagName}Tn(Pn,"composeEventHandlers"),Tn(function(e){if(!On)throw new Error("Cannot access window outside of the DOM");return e?.ownerDocument?.defaultView??window},"getOwnerWindow"),Tn(Nn,"getOwnerDocument"),Tn(function e(t,n=!1){const{activeElement:i}=Nn(t);if(!i?.nodeName)return null;if(In(i)&&i.contentDocument)return e(i.contentDocument.body,n);if(n){const e=i.getAttribute("aria-activedescendant");if(e){const t=Nn(i).getElementById(e);if(t)return t}}return i},"getActiveElement"),Tn(In,"isFrame");var jn=Object.defineProperty,Rn=(e,t)=>jn(e,"name",{value:t,configurable:!0});function Mn(e){const t=e+"CollectionProvider",[n,i]=v(t),[r,a]=n(t,{collectionRef:{current:null},itemMap:/* @__PURE__ */new Map}),o=/* @__PURE__ */Rn(e=>{const{scope:t,children:n}=e,i=Q.useRef(null),a=Q.useRef(/* @__PURE__ */new Map).current;/* @__PURE__ */
3
3
  return xe(r,{scope:t,itemMap:a,collectionRef:i,children:n})},"CollectionProvider");o.displayName=t;const s=e+"CollectionSlot",l=ke(s),c=Q.forwardRef((e,t)=>{const{scope:n,children:i}=e,r=a(s,n),o=d(t,r.collectionRef);/* @__PURE__ */
4
4
  return xe(l,{ref:o,children:i})});c.displayName=s;const u=e+"CollectionItemSlot",f="data-radix-collection-item",p=ke(u),h=Q.forwardRef((e,t)=>{const{scope:n,children:i,...r}=e,o=Q.useRef(null),s=d(t,o),l=a(u,n);return Q.useEffect(()=>(l.itemMap.set(o,{ref:o,...r}),()=>{l.itemMap.delete(o)})),/* @__PURE__ */xe(p,{[f]:"",ref:s,children:i})});function m(t){const n=a(e+"CollectionConsumer",t);return Q.useCallback(()=>{const e=n.collectionRef.current;if(!e)return[];const t=Array.from(e.querySelectorAll(`[${f}]`));return Array.from(n.itemMap.values()).sort((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current))},[n.collectionRef,n.itemMap])}return h.displayName=u,Rn(m,"useCollection"),[{Provider:o,Slot:c,ItemSlot:h},m,i]}Rn(Mn,"createCollection");var Ln=/* @__PURE__ */new WeakMap,Vn=class e extends Map{static{Rn(this,"OrderedDict")}#e;constructor(e){super(e),this.#e=[...super.keys()],Ln.set(this,!0)}set(e,t){return Ln.get(this)&&(this.has(e)?this.#e[this.#e.indexOf(e)]=e:this.#e.push(e)),super.set(e,t),this}insert(e,t,n){const i=this.has(t),r=this.#e.length,a=Hn(e);let o=a>=0?a:r+a;const s=o<0||o>=r?-1:o;if(s===this.size||i&&s===this.size-1||-1===s)return this.set(t,n),this;const l=this.size+(i?0:1);a<0&&o++;const c=[...this.#e];let u,d=!1;for(let f=o;f<l;f++)if(o===f){let e=c[f];c[f]===t&&(e=c[f+1]),i&&this.delete(t),u=this.get(e),this.set(t,n)}else{d||c[f-1]!==t||(d=!0);const e=c[d?f:f-1],n=u;u=this.get(e),this.delete(e),this.set(e,n)}return this}with(t,n,i){const r=new e(this);return r.insert(t,n,i),r}before(e){const t=this.#e.indexOf(e)-1;if(!(t<0))return this.entryAt(t)}setBefore(e,t,n){const i=this.#e.indexOf(e);return-1===i?this:this.insert(i,t,n)}after(e){let t=this.#e.indexOf(e);if(t=-1===t||t===this.size-1?-1:t+1,-1!==t)return this.entryAt(t)}setAfter(e,t,n){const i=this.#e.indexOf(e);return-1===i?this:this.insert(i+1,t,n)}first(){return this.entryAt(0)}last(){return this.entryAt(-1)}clear(){return this.#e=[],super.clear()}delete(e){const t=super.delete(e);return t&&this.#e.splice(this.#e.indexOf(e),1),t}deleteAt(e){const t=this.keyAt(e);return void 0!==t&&this.delete(t)}at(e){const t=qn(this.#e,e);if(void 0!==t)return this.get(t)}entryAt(e){const t=qn(this.#e,e);if(void 0!==t)return[t,this.get(t)]}indexOf(e){return this.#e.indexOf(e)}keyAt(e){return qn(this.#e,e)}from(e,t){const n=this.indexOf(e);if(-1===n)return;let i=n+t;return i<0&&(i=0),i>=this.size&&(i=this.size-1),this.at(i)}keyFrom(e,t){const n=this.indexOf(e);if(-1===n)return;let i=n+t;return i<0&&(i=0),i>=this.size&&(i=this.size-1),this.keyAt(i)}find(e,t){let n=0;for(const i of this){if(Reflect.apply(e,t,[i,n,this]))return i;n++}}findIndex(e,t){let n=0;for(const i of this){if(Reflect.apply(e,t,[i,n,this]))return n;n++}return-1}filter(t,n){const i=[];let r=0;for(const e of this)Reflect.apply(t,n,[e,r,this])&&i.push(e),r++;return new e(i)}map(t,n){const i=[];let r=0;for(const e of this)i.push([e[0],Reflect.apply(t,n,[e,r,this])]),r++;return new e(i)}reduce(...e){const[t,n]=e;let i=0,r=n??this.at(0);for(const a of this)r=0===i&&1===e.length?a:Reflect.apply(t,this,[r,a,i,this]),i++;return r}reduceRight(...e){const[t,n]=e;let i=n??this.at(-1);for(let r=this.size-1;r>=0;r--){const n=this.at(r);i=r===this.size-1&&1===e.length?n:Reflect.apply(t,this,[i,n,r,this])}return i}toSorted(t){const n=[...this.entries()].sort(t);return new e(n)}toReversed(){const t=new e;for(let e=this.size-1;e>=0;e--){const n=this.keyAt(e),i=this.get(n);t.set(n,i)}return t}toSpliced(...t){const n=[...this.entries()];return n.splice(...t),new e(n)}slice(t,n){const i=new e;let r=this.size-1;if(void 0===t)return i;t<0&&(t+=this.size),void 0!==n&&n>0&&(r=n-1);for(let e=t;e<=r;e++){const t=this.keyAt(e),n=this.get(t);i.set(t,n)}return i}every(e,t){let n=0;for(const i of this){if(!Reflect.apply(e,t,[i,n,this]))return!1;n++}return!0}some(e,t){let n=0;for(const i of this){if(Reflect.apply(e,t,[i,n,this]))return!0;n++}return!1}};function qn(e,t){if("at"in Array.prototype)return Array.prototype.at.call(e,t);const n=Wn(e,t);return-1===n?void 0:e[n]}function Wn(e,t){const n=e.length,i=Hn(t),r=i>=0?i:n+i;return r<0||r>=n?-1:r}function Hn(e){return e!=e||0===e?0:Math.trunc(e)}function Un(e,t){if(e===t)return!0;if("object"!=typeof e||"object"!=typeof t)return!1;if(null==e||null==t)return!1;const n=Object.keys(e),i=Object.keys(t);if(n.length!==i.length)return!1;for(const r of n){if(!Object.prototype.hasOwnProperty.call(t,r))return!1;if(e[r]!==t[r])return!1}return!0}function $n(e,t){return!!(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)}function Kn(e,t){return e[1].element&&t[1].element?$n(e[1].element,t[1].element)?-1:1:0}function Gn(e){return new MutationObserver(t=>{for(const n of t)if("childList"===n.type)return void e()})}Rn(qn,"at"),Rn(Wn,"toSafeIndex"),Rn(Hn,"toSafeInteger"),Rn(function(e){const t=e+"CollectionProvider",[n,i]=v(t),[r,a]=n(t,{collectionElement:null,collectionRef:{current:null},collectionRefObject:{current:null},itemMap:new Vn,setItemMap:/* @__PURE__ */Rn(()=>{},"setItemMap")}),o=/* @__PURE__ */Rn(({state:e,...t})=>e?/* @__PURE__ */xe(l,{...t,state:e}):/* @__PURE__ */xe(s,{...t}),"CollectionProvider");o.displayName=t;const s=/* @__PURE__ */Rn(e=>{const t=y();/* @__PURE__ */
@@ -108,7 +108,7 @@ return xe(OS,{className:"py-1 **:[.hljs-addition]:bg-[#f0fff4] **:[.hljs-additio
108
108
  /* @__PURE__ */xe(aN,{size:"icon",variant:"ghost",className:"size-6 gap-1 text-muted-foreground text-xs",value:()=>Ld.string(i)})]})]})})}},options:{lowlight:sN},shortcuts:{toggle:{keys:"mod+alt+8"}}}),KP.withComponent(function(e){/* @__PURE__ */
109
109
  return xe(OS,{...e})}),$P.withComponent(function(e){const t=e.leaf.className;/* @__PURE__ */
110
110
  return xe(jS,{className:t,...e})})],cN=Uv({key:kw.column,node:{isContainer:!0,isElement:!0,isStrictSiblings:!0}}).overrideEditor(({editor:e,tf:{normalizeNode:t,selectAll:n},type:i})=>({transforms:{normalizeNode([n,r]){if(Id.isElement(n)&&n.type===e.getType(kw.columnGroup)){const t=n,a=t.children[0];if(1===t.children.length&&a.type===e.getType(kw.p))return void e.tf.unwrapNodes({at:r});if(!t.children.some(e=>Id.isElement(e)&&e.type===i))return void e.tf.unwrapNodes({at:r});if(t.children.length<2)return void e.tf.withoutNormalizing(()=>{e.tf.unwrapNodes({at:r}),e.tf.unwrapNodes({at:r})});e.tf.withoutNormalizing(()=>{const n=t.children.length;let i=t.children.map(e=>{const t=Number.parseFloat(e.width);return Number.isNaN(t)?0:t});const a=i.reduce((e,t)=>e+t,0);if(100!==a){const t=(100-a)/n;i=i.map(e=>e+t),i.forEach((t,n)=>{const i=r.concat([n]);e.tf.setNodes({width:`${t}%`},{at:i})})}})}if(!Id.isElement(n)||n.type!==i||0!==n.children.length)return t([n,r]);e.tf.removeNodes({at:r})},selectAll:()=>!!(()=>{const t=e.selection;if(!t)return;const n=e.api.above({match:{type:i}});if(!n)return;let r=n[1];return e.api.isStart(e.api.start(t),r)&&e.api.isEnd(e.api.end(t),r)&&(r=jd.parent(r)),0!==r.length?(e.tf.select(r),!0):void 0})()||n()}})),uN=Uv({key:kw.columnGroup,node:{isContainer:!0,isElement:!0},plugins:[cN]}),dN=uS(cN),fN=uS(uN,{plugins:[dN]}),pN=/* @__PURE__ */r((e,t)=>{(function(){var e,n,i,r,a,o;"undefined"!=typeof performance&&null!==performance&&performance.now?t.exports=function(){return performance.now()}:"undefined"!=typeof process&&null!==process&&process.hrtime?(t.exports=function(){return(e()-a)/1e6},n=process.hrtime,e=function(){var e=n();return 1e9*e[0]+e[1]},r=e(),o=1e9*process.uptime(),a=r-o):Date.now?(t.exports=function(){return Date.now()-i},i=Date.now()):(t.exports=function(){/* @__PURE__ */
111
- return(new Date).getTime()-i},i=/* @__PURE__ */(new Date).getTime())}).call(e)}),hN=/* @__PURE__ */r((e,t)=>{for(var n=pN(),i="undefined"==typeof window?global:window,r=["moz","webkit"],a="AnimationFrame",o=i["request"+a],s=i["cancel"+a]||i["cancelRequest"+a],l=0;!o&&l<r.length;l++)o=i[r[l]+"Request"+a],s=i[r[l]+"Cancel"+a]||i[r[l]+"CancelRequest"+a];if(!o||!s){var c=0,u=0,d=[],f=1e3/60;o=function(e){if(0===d.length){var t=n(),i=Math.max(0,f-(t-c));c=i+t,setTimeout(function(){var e=d.slice(0);d.length=0;for(var t=0;t<e.length;t++)if(!e[t].cancelled)try{e[t].callback(c)}catch(jE){setTimeout(function(){throw jE},0)}},Math.round(i))}return d.push({handle:++u,callback:e,cancelled:!1}),u},s=function(e){for(var t=0;t<d.length;t++)d[t].handle===e&&(d[t].cancelled=!0)}}t.exports=function(e){return o.call(i,e)},t.exports.cancel=function(){s.apply(i,arguments)},t.exports.polyfill=function(e){e||(e=i),e.requestAnimationFrame=o,e.cancelAnimationFrame=s}});var mN=ne({dragDropManager:void 0});function gN(e,t,...n){if("undefined"!=typeof process&&"production"===process.env.NODE_ENV&&void 0===t)throw new Error("invariant requires an error message argument");if(!e){let e;if(void 0===t)e=/* @__PURE__ */new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{let i=0;e=new Error(t.replace(/%s/g,function(){return n[i++]})),e.name="Invariant Violation"}throw e.framesToPop=1,e}}var yN=/* @__PURE__ */r((e,t)=>{t.exports=function e(t,n){if(t===n)return!0;if(t&&n&&"object"==typeof t&&"object"==typeof n){if(t.constructor!==n.constructor)return!1;var i,r,a;if(Array.isArray(t)){if((i=t.length)!=n.length)return!1;for(r=i;0!==r--;)if(!e(t[r],n[r]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if((i=(a=Object.keys(t)).length)!==Object.keys(n).length)return!1;for(r=i;0!==r--;)if(!Object.prototype.hasOwnProperty.call(n,a[r]))return!1;for(r=i;0!==r--;){var o=a[r];if(!e(t[o],n[o]))return!1}return!0}return t!=t&&n!=n}}),vN=/* @__PURE__ */n(yN(),1),kN="undefined"!=typeof window?pe:de;function bN(e,t,n){const[i,r]=function(e,t,n){const[i,r]=ye(()=>t(e)),a=le(()=>{const a=t(e);(0,vN.default)(i,a)||(r(a),n&&n())},[i,e,n]);return kN(a),[i,a]}(e,t,n);return kN(function(){const t=e.getHandlerId();if(null!=t)return e.subscribeToStateChange(r,{handlerIds:[t]})},[e,r]),i}function wN(e,t,n){return bN(t,e||(()=>({})),()=>n.reconnect())}function _N(e,t){const n=[...t||[]];return null==t&&"function"!=typeof e&&n.push(e),he(()=>"function"==typeof e?e():e,n)}function xN(e){return he(()=>e.hooks.dragSource(),[e])}function CN(e){return he(()=>e.hooks.dragPreview(),[e])}var EN=!1,DN=!1,SN=class{receiveHandlerId(e){this.sourceId=e}getHandlerId(){return this.sourceId}canDrag(){gN(!EN,"You may not call monitor.canDrag() inside your canDrag() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor");try{return EN=!0,this.internalMonitor.canDragSource(this.sourceId)}finally{EN=!1}}isDragging(){if(!this.sourceId)return!1;gN(!DN,"You may not call monitor.isDragging() inside your isDragging() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor");try{return DN=!0,this.internalMonitor.isDraggingSource(this.sourceId)}finally{DN=!1}}subscribeToStateChange(e,t){return this.internalMonitor.subscribeToStateChange(e,t)}isDraggingSource(e){return this.internalMonitor.isDraggingSource(e)}isOverTarget(e,t){return this.internalMonitor.isOverTarget(e,t)}getTargetIds(){return this.internalMonitor.getTargetIds()}isSourcePublic(){return this.internalMonitor.isSourcePublic()}getSourceId(){return this.internalMonitor.getSourceId()}subscribeToOffsetChange(e){return this.internalMonitor.subscribeToOffsetChange(e)}canDragSource(e){return this.internalMonitor.canDragSource(e)}canDropOnTarget(e){return this.internalMonitor.canDropOnTarget(e)}getItemType(){return this.internalMonitor.getItemType()}getItem(){return this.internalMonitor.getItem()}getDropResult(){return this.internalMonitor.getDropResult()}didDrop(){return this.internalMonitor.didDrop()}getInitialClientOffset(){return this.internalMonitor.getInitialClientOffset()}getInitialSourceClientOffset(){return this.internalMonitor.getInitialSourceClientOffset()}getSourceClientOffset(){return this.internalMonitor.getSourceClientOffset()}getClientOffset(){return this.internalMonitor.getClientOffset()}getDifferenceFromInitialOffset(){return this.internalMonitor.getDifferenceFromInitialOffset()}constructor(e){this.sourceId=null,this.internalMonitor=e.getMonitor()}},AN=!1,FN=class{receiveHandlerId(e){this.targetId=e}getHandlerId(){return this.targetId}subscribeToStateChange(e,t){return this.internalMonitor.subscribeToStateChange(e,t)}canDrop(){if(!this.targetId)return!1;gN(!AN,"You may not call monitor.canDrop() inside your canDrop() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target-monitor");try{return AN=!0,this.internalMonitor.canDropOnTarget(this.targetId)}finally{AN=!1}}isOver(e){return!!this.targetId&&this.internalMonitor.isOverTarget(this.targetId,e)}getItemType(){return this.internalMonitor.getItemType()}getItem(){return this.internalMonitor.getItem()}getDropResult(){return this.internalMonitor.getDropResult()}didDrop(){return this.internalMonitor.didDrop()}getInitialClientOffset(){return this.internalMonitor.getInitialClientOffset()}getInitialSourceClientOffset(){return this.internalMonitor.getInitialSourceClientOffset()}getSourceClientOffset(){return this.internalMonitor.getSourceClientOffset()}getClientOffset(){return this.internalMonitor.getClientOffset()}getDifferenceFromInitialOffset(){return this.internalMonitor.getDifferenceFromInitialOffset()}constructor(e){this.targetId=null,this.internalMonitor=e.getMonitor()}};function zN(e,t,n,i){let r=n?n.call(i,e,t):void 0;if(void 0!==r)return!!r;if(e===t)return!0;if("object"!=typeof e||!e||"object"!=typeof t||!t)return!1;const a=Object.keys(e),o=Object.keys(t);if(a.length!==o.length)return!1;const s=Object.prototype.hasOwnProperty.bind(t);for(let l=0;l<a.length;l++){const o=a[l];if(!s(o))return!1;const c=e[o],u=t[o];if(r=n?n.call(i,c,u,o):void 0,!1===r||void 0===r&&c!==u)return!1}return!0}function BN(e){return null!==e&&"object"==typeof e&&Object.prototype.hasOwnProperty.call(e,"current")}function TN(e){return(t=null,n=null)=>{if(!ae(t)){const i=t;return e(i,n),i}const i=t;return function(e){if("string"==typeof e.type)return;const t=e.type.displayName||e.type.name||"the component";throw new Error(`Only native element nodes can now be passed to React DnD connectors.You can either wrap ${t} into a <div>, or turn it into a drag source or a drop target itself.`)}(i),function(e,t){const n=e.ref;return gN("string"!=typeof n,"Cannot connect React DnD to an element with an existing string ref. Please convert it to use a callback ref instead, or wrap it into a <span> or <div>. Read more: https://reactjs.org/docs/refs-and-the-dom.html#callback-refs"),te(e,n?{ref:e=>{PN(n,e),PN(t,e)}}:{ref:t})}(i,n?t=>e(t,n):e)}}function ON(e){const t={};return Object.keys(e).forEach(n=>{const i=e[n];if(n.endsWith("Ref"))t[n]=e[n];else{const e=TN(i);t[n]=()=>e}}),t}function PN(e,t){"function"==typeof e?e(t):e.current=t}var NN=class{receiveHandlerId(e){this.handlerId!==e&&(this.handlerId=e,this.reconnect())}get connectTarget(){return this.dragSource}get dragSourceOptions(){return this.dragSourceOptionsInternal}set dragSourceOptions(e){this.dragSourceOptionsInternal=e}get dragPreviewOptions(){return this.dragPreviewOptionsInternal}set dragPreviewOptions(e){this.dragPreviewOptionsInternal=e}reconnect(){const e=this.reconnectDragSource();this.reconnectDragPreview(e)}reconnectDragSource(){const e=this.dragSource,t=this.didHandlerIdChange()||this.didConnectedDragSourceChange()||this.didDragSourceOptionsChange();return t&&this.disconnectDragSource(),this.handlerId?e?(t&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDragSource=e,this.lastConnectedDragSourceOptions=this.dragSourceOptions,this.dragSourceUnsubscribe=this.backend.connectDragSource(this.handlerId,e,this.dragSourceOptions)),t):(this.lastConnectedDragSource=e,t):t}reconnectDragPreview(e=!1){const t=this.dragPreview,n=e||this.didHandlerIdChange()||this.didConnectedDragPreviewChange()||this.didDragPreviewOptionsChange();n&&this.disconnectDragPreview(),this.handlerId&&(t?n&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDragPreview=t,this.lastConnectedDragPreviewOptions=this.dragPreviewOptions,this.dragPreviewUnsubscribe=this.backend.connectDragPreview(this.handlerId,t,this.dragPreviewOptions)):this.lastConnectedDragPreview=t)}didHandlerIdChange(){return this.lastConnectedHandlerId!==this.handlerId}didConnectedDragSourceChange(){return this.lastConnectedDragSource!==this.dragSource}didConnectedDragPreviewChange(){return this.lastConnectedDragPreview!==this.dragPreview}didDragSourceOptionsChange(){return!zN(this.lastConnectedDragSourceOptions,this.dragSourceOptions)}didDragPreviewOptionsChange(){return!zN(this.lastConnectedDragPreviewOptions,this.dragPreviewOptions)}disconnectDragSource(){this.dragSourceUnsubscribe&&(this.dragSourceUnsubscribe(),this.dragSourceUnsubscribe=void 0)}disconnectDragPreview(){this.dragPreviewUnsubscribe&&(this.dragPreviewUnsubscribe(),this.dragPreviewUnsubscribe=void 0,this.dragPreviewNode=null,this.dragPreviewRef=null)}get dragSource(){return this.dragSourceNode||this.dragSourceRef&&this.dragSourceRef.current}get dragPreview(){return this.dragPreviewNode||this.dragPreviewRef&&this.dragPreviewRef.current}clearDragSource(){this.dragSourceNode=null,this.dragSourceRef=null}clearDragPreview(){this.dragPreviewNode=null,this.dragPreviewRef=null}constructor(e){this.hooks=ON({dragSource:(e,t)=>{this.clearDragSource(),this.dragSourceOptions=t||null,BN(e)?this.dragSourceRef=e:this.dragSourceNode=e,this.reconnectDragSource()},dragPreview:(e,t)=>{this.clearDragPreview(),this.dragPreviewOptions=t||null,BN(e)?this.dragPreviewRef=e:this.dragPreviewNode=e,this.reconnectDragPreview()}}),this.handlerId=null,this.dragSourceRef=null,this.dragSourceOptionsInternal=null,this.dragPreviewRef=null,this.dragPreviewOptionsInternal=null,this.lastConnectedHandlerId=null,this.lastConnectedDragSource=null,this.lastConnectedDragSourceOptions=null,this.lastConnectedDragPreview=null,this.lastConnectedDragPreviewOptions=null,this.backend=e}},IN=class{get connectTarget(){return this.dropTarget}reconnect(){const e=this.didHandlerIdChange()||this.didDropTargetChange()||this.didOptionsChange();e&&this.disconnectDropTarget();const t=this.dropTarget;this.handlerId&&(t?e&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDropTarget=t,this.lastConnectedDropTargetOptions=this.dropTargetOptions,this.unsubscribeDropTarget=this.backend.connectDropTarget(this.handlerId,t,this.dropTargetOptions)):this.lastConnectedDropTarget=t)}receiveHandlerId(e){e!==this.handlerId&&(this.handlerId=e,this.reconnect())}get dropTargetOptions(){return this.dropTargetOptionsInternal}set dropTargetOptions(e){this.dropTargetOptionsInternal=e}didHandlerIdChange(){return this.lastConnectedHandlerId!==this.handlerId}didDropTargetChange(){return this.lastConnectedDropTarget!==this.dropTarget}didOptionsChange(){return!zN(this.lastConnectedDropTargetOptions,this.dropTargetOptions)}disconnectDropTarget(){this.unsubscribeDropTarget&&(this.unsubscribeDropTarget(),this.unsubscribeDropTarget=void 0)}get dropTarget(){return this.dropTargetNode||this.dropTargetRef&&this.dropTargetRef.current}clearDropTarget(){this.dropTargetRef=null,this.dropTargetNode=null}constructor(e){this.hooks=ON({dropTarget:(e,t)=>{this.clearDropTarget(),this.dropTargetOptions=t,BN(e)?this.dropTargetRef=e:this.dropTargetNode=e,this.reconnect()}}),this.handlerId=null,this.dropTargetRef=null,this.dropTargetOptionsInternal=null,this.lastConnectedHandlerId=null,this.lastConnectedDropTarget=null,this.lastConnectedDropTargetOptions=null,this.backend=e}};function jN(){const{dragDropManager:e}=ce(mN);return gN(null!=e,"Expected drag drop context"),e}var RN=class{beginDrag(){const e=this.spec,t=this.monitor;let n=null;return n="object"==typeof e.item?e.item:"function"==typeof e.item?e.item(t):{},null!=n?n:null}canDrag(){const e=this.spec,t=this.monitor;return"boolean"==typeof e.canDrag?e.canDrag:"function"!=typeof e.canDrag||e.canDrag(t)}isDragging(e,t){const n=this.spec,i=this.monitor,{isDragging:r}=n;return r?r(i):t===e.getSourceId()}endDrag(){const e=this.spec,t=this.monitor,n=this.connector,{end:i}=e;i&&i(t.getItem(),t),n.reconnect()}constructor(e,t,n){this.spec=e,this.monitor=t,this.connector=n}};function MN(e,t,n){const i=jN(),r=function(e,t,n){const i=he(()=>new RN(e,t,n),[t,n]);return de(()=>{i.spec=e},[e]),i}(e,t,n),a=function(e){return he(()=>{const t=e.type;return gN(null!=t,"spec.type must be defined"),t},[e])}(e);kN(function(){if(null!=a){const[e,o]=function(e,t,n){const i=n.getRegistry(),r=i.addSource(e,t);return[r,()=>i.removeSource(r)]}(a,r,i);return t.receiveHandlerId(e),n.receiveHandlerId(e),o}},[i,t,n,r,a])}function LN(e,t){const n=_N(e,t);gN(!n.begin,"useDrag::spec.begin was deprecated in v14. Replace spec.begin() with spec.item(). (see more here - https://react-dnd.github.io/react-dnd/docs/api/use-drag)");const i=function(){const e=jN();return he(()=>new SN(e),[e])}(),r=function(e,t){const n=jN(),i=he(()=>new NN(n.getBackend()),[n]);return kN(()=>(i.dragSourceOptions=e||null,i.reconnect(),()=>i.disconnectDragSource()),[i,e]),kN(()=>(i.dragPreviewOptions=t||null,i.reconnect(),()=>i.disconnectDragPreview()),[i,t]),i}(n.options,n.previewOptions);return MN(n,i,r),[wN(n.collect,i,r),xN(r),CN(r)]}function VN(e){return he(()=>e.hooks.dropTarget(),[e])}var qN=class{canDrop(){const e=this.spec,t=this.monitor;return!e.canDrop||e.canDrop(t.getItem(),t)}hover(){const e=this.spec,t=this.monitor;e.hover&&e.hover(t.getItem(),t)}drop(){const e=this.spec,t=this.monitor;if(e.drop)return e.drop(t.getItem(),t)}constructor(e,t){this.spec=e,this.monitor=t}};function WN(e,t,n){const i=jN(),r=function(e,t){const n=he(()=>new qN(e,t),[t]);return de(()=>{n.spec=e},[e]),n}(e,t),a=function(e){const{accept:t}=e;return he(()=>(gN(null!=e.accept,"accept must be defined"),Array.isArray(t)?t:[t]),[t])}(e);kN(function(){const[e,o]=function(e,t,n){const i=n.getRegistry(),r=i.addTarget(e,t);return[r,()=>i.removeTarget(r)]}(a,r,i);return t.receiveHandlerId(e),n.receiveHandlerId(e),o},[i,t,r,n,a.map(e=>e.toString()).join("|")])}function HN(e,t){const n=_N(e,t),i=function(){const e=jN();return he(()=>new FN(e),[e])}(),r=function(e){const t=jN(),n=he(()=>new IN(t.getBackend()),[t]);return kN(()=>(n.dropTargetOptions=e||null,n.reconnect(),()=>n.disconnectDropTarget()),[e]),n}(n.options);return WN(n,i,r),[wN(n.collect,i,r),VN(r)]}var UN=/* @__PURE__ */n(hN(),1);function $N(e){const t=En(22),{containerRef:n,enabled:i,height:r,minStrength:a,placement:o,scrollAreaProps:s,strengthMultiplier:l,zIndex:c}=e,u=void 0===i||i,d=void 0===r?100:r,f=void 0===a?.15:a,p=void 0===l?25:l,h=void 0===c?1e4:c,m=X.useRef(void 0),g=X.useRef(0),y=X.useRef(null),v="top"===o?-1:1,k=s?.style;let b,w;t[0]!==d||t[1]!==o||t[2]!==k||t[3]!==h?(b={height:d,opacity:0,position:"fixed",width:"100%",zIndex:h,...k},"top"===o?b.top=0:"bottom"===o&&(b.bottom=0),t[0]=d,t[1]=o,t[2]=k,t[3]=h,t[4]=b):b=t[4],t[5]===Symbol.for("react.memo_cache_sentinel")?(w=()=>{g.current=0,y.current&&(UN.default.cancel(y.current),y.current=null)},t[5]=w):w=t[5];const _=w;let x;t[6]!==n||t[7]!==v||t[8]!==p?(x=()=>{const e=()=>{const t=g.current;0!==p&&0!==t?((n?.current??window).scrollBy(0,t*p*v),y.current=(0,UN.default)(e)):_()};e()},t[6]=n,t[7]=v,t[8]=p,t[9]=x):x=t[9];const C=x,E=X.useRef(void 0);let D,S,A;t[10]!==v||t[11]!==f||t[12]!==C?(S=()=>{E.current=(0,t_.default)(e=>{const t=m.current;if(!t)return;const{height:n,top:i}=t.getBoundingClientRect(),r=(e=>"touchmove"===e.type?{x:e.changedTouches[0].clientX,y:e.changedTouches[0].clientY}:{x:e.clientX,y:e.clientY})(e),a=Math.max(Math.max(r.y-i,0)/n,f);g.current=-1===v?1-a:a,!y.current&&g.current&&C()},100,{trailing:!1})},D=[v,f,C],t[10]=v,t[11]=f,t[12]=C,t[13]=D,t[14]=S):(D=t[13],S=t[14]),X.useEffect(S,D),t[15]===Symbol.for("react.memo_cache_sentinel")?(A=e=>{E.current?.(e)},t[15]=A):A=t[15];const F=A;let z,B,T;return t[16]!==u?(z=()=>{u||_()},B=[u],t[16]=u,t[17]=z,t[18]=B):(z=t[17],B=t[18]),X.useEffect(z,B),u?(t[19]!==s||t[20]!==b?(T=/* @__PURE__ */X.createElement("div",{ref:m,style:b,onDragEnd:_,onDragLeave:_,onDragOver:F,onTouchMove:F,...s}),t[19]=s,t[20]=b,t[21]=T):T=t[21],T):null}function KN(e){const t=En(2);let n;return t[0]!==e?(n=/* @__PURE__ */X.createElement(X.Fragment,null,/* @__PURE__ */X.createElement($N,{placement:"top",...e}),/* @__PURE__ */X.createElement($N,{placement:"bottom",...e})),t[0]=e,t[1]=n):n=t[1],n}function GN(e){const t=En(8),n=MA(QN,"isDragging"),[i,r]=X.useState(!1);let a,o;t[0]!==n?(a=()=>{if(n){const e=setTimeout(()=>{r(!0)},100);return()=>clearTimeout(e)}r(!1)},t[0]=n,t[1]=a):a=t[1],t[2]!==n||t[3]!==i?(o=[n,i],t[2]=n,t[3]=i,t[4]=o):o=t[4],X.useEffect(a,o);const s=n&&i;let l;return t[5]!==e||t[6]!==s?(l=/* @__PURE__ */X.createElement(KN,{enabled:s,...e}),t[5]=e,t[6]=s,t[7]=l):l=t[7],l}var JN="block",QN=pS({key:kw.dnd,editOnly:!0,handlers:{onDragEnd:({editor:e,plugin:t})=>{e.setOption(t,"isDragging",!1),e.setOption(t,"dropTarget",{id:null,line:""})},onDragEnter:({editor:e,plugin:t})=>{e.setOption(t,"_isOver",!0)},onDragStart:({editor:e,event:t,plugin:n})=>{const i=t.target,r=t.dataTransfer;r.effectAllowed="move",r.dropEffect="move";const a=i.dataset.blockId;a&&(e.setOption(n,"draggingId",a),e.setOption(n,"isDragging",!0),e.setOption(n,"_isOver",!0))},onDrop:({getOptions:e})=>e().isDragging,onFocus:({editor:e,plugin:t})=>{e.setOption(t,"isDragging",!1),e.setOption(t,"dropTarget",{id:null,line:""}),e.setOption(t,"_isOver",!1),e.getOption(t,"multiplePreviewRef")?.current?.replaceChildren()}},options:{_isOver:!1,draggingId:null,dropTarget:{id:null,line:""},isDragging:!1,multiplePreviewRef:null},useHooks:({editor:e,setOption:t})=>{const n=le(n=>{if(n.target instanceof Node){const i=e.api.toDOMNode(e);if(!i)return;const r=n.target instanceof HTMLElement?n.target:n.target.parentElement,a=n.relatedTarget,o=a instanceof HTMLElement?a:a instanceof Node?a.parentElement:null,s=r?.closest("[data-block-id]"),l=o?.closest("[data-block-id]"),c=!(n.target===i||i.contains(n.target)),u=!!s&&!l&&(!a||a instanceof Node&&i.contains(a));(c||u)&&t("dropTarget",void 0)}},[e,t]),i=le(()=>{t("_isOver",!1),t("dropTarget",void 0)},[t]);de(()=>(document.addEventListener("dragleave",n,!0),document.addEventListener("drop",i,!0),()=>{document.removeEventListener("dragleave",n,!0),document.removeEventListener("drop",i,!0)}),[n,i])}}).extend(({getOptions:e})=>({render:{afterEditable:e().enableScroller?()=>/* @__PURE__ */X.createElement(GN,e()?.scrollerProps):void 0}})),XN=e=>{const{orientation:t="vertical",type:n=JN,onDropHandler:i}=e,r=PA(),a=X.useRef(null),o=X.useRef(null);if(!r.plugins.dnd)return{};const{dragRef:s,isAboutToDrag:l,isDragging:c}=iI({multiplePreviewRef:o,nodeRef:a,orientation:t,type:n,onDropHandler:i,...e});return{isAboutToDrag:l,isDragging:c,nodeRef:a,previewRef:o,handleRef:s}},YN=e=>{const t=En(5);let n;t[0]!==e?(n=void 0===e?{}:e,t[0]=e,t[1]=n):n=t[1];const{id:i,orientation:r}=n,a=void 0===r?"vertical":r,o=VA(),s=i||o.id,l=LA(QN,e=>{const{dropTarget:t}=e;return t?t.id!==s?null:t.line:null})??"";if(a&&("vertical"===a&&("left"===l||"right"===l)||"horizontal"===a&&("top"===l||"bottom"===l))){let e;return t[2]===Symbol.for("react.memo_cache_sentinel")?(e={dropLine:""},t[2]=e):e=t[2],e}let c;return t[3]!==l?(c={dropLine:l},t[3]=l,t[4]=c):c=t[4],c},ZN=()=>"undefined"!=typeof document&&"undefined"!=typeof window,eI=e=>e,tI=(e,{canDropNode:t,dragItem:n,element:i,monitor:r,nodeRef:a,orientation:o="vertical"})=>{const s=(({dragItem:e,element:t,monitor:n,nodeRef:i,orientation:r="vertical"})=>{if(!i.current)return;if(t===e.element)return;const a=e;if((Array.isArray(a.id)?a.id:[a.id]).includes(t.id))return;const o=i.current?.getBoundingClientRect();if(!o)return;const s=n.getClientOffset();if(s){if("vertical"!==r){const e=(o.right-o.left)/2;return s.x-o.left<e?"left":"right"}{const e=(o.bottom-o.top)/2,t=s.y-o.top;if(t<e)return"top";if(t>=e)return"bottom"}}})({dragItem:n,element:i,monitor:r,nodeRef:a,orientation:o});if(!s)return;let l,c,u;if("element"in n){let t;if(n.editorId===e.id&&(t=e.api.findPath(n.element),!t))return;const r=e.api.findPath(i);if(!r)return;l=t&&[n.element,t],c=[i,r]}else c=e.api.node({id:i.id,at:[]});if(!c)return;if(t&&!t({dragEntry:l,dragItem:n,dropEntry:c,editor:e})||!r.canDrop())return;const d=l?.[1],f=c[1];if(("bottom"===s||"right"===s)&&(u=f,d&&jd.equals(d,jd.next(u))))return;if(("top"===s||"left"===s)&&(u=[...f.slice(0,-1),f.at(-1)-1],d&&jd.equals(d,u)))return;const p=u;return{direction:s,dragPath:d,to:d&&jd.isBefore(d,p)&&jd.isSibling(d,p)?p:jd.next(p)}},nI=(e,{canDropNode:t,element:n,nodeRef:i,orientation:r,onDropHandler:a,...o})=>{const s=n.id;return ZN()?HN({collect:e=>({isOver:e.isOver({shallow:!0})}),drop:(o,l)=>{if(!o.id){const a=tI(e,{canDropNode:t,dragItem:o,element:n,monitor:l,nodeRef:i,orientation:r}),c=e.getOptions(QN).onDropFiles;if(!a||!c)return;return c({id:s,dragItem:o,editor:e,monitor:l,nodeRef:i,target:a.to})}a&&a(e,{id:s,dragItem:o,monitor:l,nodeRef:i})||((e,{canDropNode:t,dragItem:n,element:i,monitor:r,nodeRef:a,orientation:o="vertical"})=>{const s=tI(e,{canDropNode:t,dragItem:n,element:i,monitor:r,nodeRef:a,orientation:o});if(!s)return;const{dragPath:l,to:c}=s;if(n.editorId===e.id){const t=Array.isArray(n.id)?n.id:[n.id];if(t.length>1){const n=[];t.forEach(t=>{const i=e.api.node({id:t,at:[]});i&&n.push(i[0])}),e.tf.moveNodes({at:[],to:c,match:e=>n.some(t=>t.id===e.id)})}else e.tf.moveNodes({at:l,to:c})}else{const t=n.editor;if(t){const i=(Array.isArray(n.id)?n.id:n.id?[n.id]:[]).map(e=>t.api.node({id:e,at:[]})).filter(e=>!!e),r=i.map(([e])=>e);e.tf.insertNodes(r,{at:c}),i.map(([,e])=>e).sort((e,t)=>jd.compare(t,e)).forEach(e=>{t.tf.removeNodes({at:e})})}else e.tf.insertNodes([n.element],{at:c})}})(e,{canDropNode:t,dragItem:o,element:n,monitor:l,nodeRef:i,orientation:r})},hover(a,o){((e,{canDropNode:t,dragItem:n,element:i,monitor:r,nodeRef:a,orientation:o="vertical"})=>{const{_isOver:s,dropTarget:l}=e.getOptions(QN),c=l?.id??null,u=l?.line??"",d=tI(e,{canDropNode:t,dragItem:n,element:i,monitor:r,nodeRef:a,orientation:o});if(!d)return void((c||u)&&e.setOption(QN,"dropTarget",{id:null,line:""}));const{direction:f}=d,p={id:i.id,line:f};if(p.id!==c||p.line!==u){if(!s)return;if("top"===p.line){const t=jd.previous(e.api.findPath(i));if(!t)return e.setOption(QN,"dropTarget",p);const n=Ld.get(e,t);return void e.setOption(QN,"dropTarget",{id:n?.id,line:"bottom"})}e.setOption(QN,"dropTarget",p)}f&&e.api.isExpanded()&&(e.tf.focus(),e.tf.collapse())})(e,{canDropNode:t,dragItem:a,element:n,monitor:o,nodeRef:i,orientation:r})},...o}):[{isOver:!1},eI]},iI=({canDropNode:e,drag:t,drop:n,element:i,multiplePreviewRef:r,nodeRef:a,orientation:o="vertical",preview:s={},type:l=JN,onDropHandler:c})=>{const u=PA();if(!ZN())return{dragRef:eI,isAboutToDrag:!1,isDragging:!1,isOver:!1};const[{isAboutToDrag:d,isDragging:f},p,h]=((e,{element:t,item:n,...i})=>{const r=t.id,[a,o]=X.useState(!1);if(!ZN())return[{isAboutToDrag:!1,isDragging:!1},eI,eI];const[s,l,c]=LN(()=>({canDrag:()=>(o(!0),!0),collect:e=>({isDragging:e.isDragging()}),end:()=>{e.setOption(QN,"isDragging",!1),document.body.classList.remove("dragging"),o(!1)},item(t){e.setOption(QN,"isDragging",!0),e.setOption(QN,"_isOver",!0),document.body.classList.add("dragging");const i="function"==typeof n?n(t):n,[a]=e.api.node({id:r,at:[]}),o=e.getOption(QN,"draggingId");let s;return Array.isArray(o)&&o.length>1&&o.includes(r)?s=Array.from(o):(s=r,e.setOption(QN,"draggingId",r)),{id:s,editor:e,editorId:e.id,element:a,...i}},...i}),[e,r]);return X.useEffect(()=>{!s.isDragging&&a&&o(!1)},[s.isDragging,a]),[{...s,isAboutToDrag:a},l,c]})(u,{element:i,type:l,...t}),[{isOver:m},g]=nI(u,{accept:[l,"__NATIVE_FILE__"],canDropNode:e,element:i,multiplePreviewRef:r,nodeRef:a,orientation:o,onDropHandler:c,...n});return g(a),s.disable?h((oN||((oN=new Image).src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="),oN),{captureDraggingState:!0}):s.ref?h(s.ref):h(r),{dragRef:p,isAboutToDrag:d,isDragging:f,isOver:m}},rI=(e,{columns:t=2,select:n,...i}={})=>{const r=100/t;e.tf.withoutNormalizing(()=>{if(e.tf.insertNodes({children:new Array(t).fill(null).map(()=>({children:[e.api.create.block()],type:e.getType(kw.column),width:`${r}%`})),type:e.getType(kw.columnGroup)},i),n){const t=e.api.node({at:i.at,match:{type:e.getType(kw.column)}});if(!t)return;e.tf.select(t[1].concat([0]))}})},aI=({columns:e=2}={})=>new Array(e).fill(null).map(()=>100/e+"%"),oI=(e,{at:t,columns:n,widths:i})=>{e.tf.withoutNormalizing(()=>{if(!t)return;if(0===(i=i??aI({columns:n})).length)return;const r=e.api.node(t);if(!r)return;const[{children:a},o]=r,s=a.length,l=i.length;if(s!==l){if(l>s){const t=l-s,n=o.concat([s]),r=new Array(t).fill(null).map((t,n)=>({children:[e.api.create.block()],type:e.getType(kw.column),width:i[s+n]||100/l+"%"}));return e.tf.insertNodes(r,{at:n}),void i.forEach((t,n)=>{e.tf.setNodes({width:t},{at:o.concat([n])})})}if(l<s){const t=l-1,n=o.concat([t]),r=Ld.get(e,n);if(!r)return;const a=n.concat([r.children.length]);for(let i=s-1;i>t;i--){const t=o.concat([i]),n=e.api.node(t);n&&e.tf.moveNodes({at:n[1],children:!0,to:a})}for(let i=s-1;i>t;i--)e.tf.removeNodes({at:o.concat([i])});i.forEach((t,n)=>{e.tf.setNodes({width:t},{at:o.concat([n])})})}}else i.forEach((t,n)=>{e.tf.setNodes({width:t},{at:o.concat([n])})})})},sI=(e,t)=>"string"==typeof e?t*Number.parseFloat(e)/100:e,lI=(e,{max:t,min:n})=>{let i=e;return void 0!==n&&(i=Math.max(i,n)),void 0!==t&&(i=Math.min(i,t)),i},{ResizeHandleProvider:cI,useResizeHandleSet:uI,useResizeHandleStore:dI,useResizeHandleValue:fI}=OE({onResize:null},{name:"resizeHandle",suppressWarnings:!0}),pI=e=>{const t=En(21),{direction:n,initialSize:i,onHover:r,onHoverEnd:a,onMouseDown:o,onResize:s,onTouchStart:l}=e,c=void 0===n?"left":n,u=Ux(),d=fI("onResize"),f=s??d,[p,h]=X.useState(!1),[m,g]=X.useState(0),[y,v]=X.useState(0),k=i??y,b="left"===c||"right"===c;let w,_,x;return t[0]!==c||t[1]!==m||t[2]!==k||t[3]!==b||t[4]!==p||t[5]!==a||t[6]!==f?(w=()=>{if(!p)return;const e=(e,t)=>{const{clientX:n,clientY:i}=(e=>"touches"in e)(e)?e.touches[0]||e.changedTouches[0]:e;f({delta:(b?n:i)-m,direction:c,finished:t,initialSize:k})},t=t=>e(t,!1),n=t=>{h(!1),a?.(),e(t,!0)};return window.addEventListener("mousemove",t),window.addEventListener("mouseup",n),window.addEventListener("touchmove",t),window.addEventListener("touchend",n),()=>{window.removeEventListener("mousemove",t),window.removeEventListener("mouseup",n),window.removeEventListener("touchmove",t),window.removeEventListener("touchend",n)}},_=[p,m,k,f,b,a,c],t[0]=c,t[1]=m,t[2]=k,t[3]=b,t[4]=p,t[5]=a,t[6]=f,t[7]=w,t[8]=_):(w=t[7],_=t[8]),X.useEffect(w,_),t[9]!==c||t[10]!==m||t[11]!==k||t[12]!==b||t[13]!==p||t[14]!==r||t[15]!==a||t[16]!==o||t[17]!==f||t[18]!==l||t[19]!==u?(x={direction:c,initialPosition:m,initialSize:k,isHorizontal:b,isResizing:p,readOnly:u,setInitialPosition:g,setInitialSize:v,setIsResizing:h,onHover:r,onHoverEnd:a,onMouseDown:o,onResize:f,onTouchStart:l},t[9]=c,t[10]=m,t[11]=k,t[12]=b,t[13]=p,t[14]=r,t[15]=a,t[16]=o,t[17]=f,t[18]=l,t[19]=u,t[20]=x):x=t[20],x},hI=({isHorizontal:e,isResizing:t,readOnly:n,setInitialPosition:i,setInitialSize:r,setIsResizing:a,onHover:o,onHoverEnd:s,onMouseDown:l,onTouchStart:c})=>{const u=()=>{o?.()},d=()=>{t||s?.()};return{hidden:n,props:{onMouseDown:t=>{const{clientX:n,clientY:o}=t;i(e?n:o);const s=t.target.parentElement;r(e?s.offsetWidth:s.offsetHeight),a(!0),l?.(t)},onMouseOut:d,onMouseOver:u,onTouchEnd:d,onTouchMove:u,onTouchStart:t=>{const{touches:n}=t,{clientX:o,clientY:s}=n[0];i(e?o:s);const l=t.target.parentElement;r(e?l.offsetWidth:l.offsetHeight),a(!0),c?.(t)}}}},{ResizableProvider:mI,resizableStore:gI,useResizableSet:yI,useResizableStore:vI,useResizableValue:kI}=(hD("div")({propsHook:hI,stateHook:pI}),OE({width:0},{name:"resizable"})),bI=e=>{const t=En(19),{align:n,maxWidth:i,minWidth:r,setNodeWidth:a,setWidth:o,width:s}=e,l=X.useRef(null);let c;t[0]!==n||t[1]!==i||t[2]!==r||t[3]!==a||t[4]!==o?(c=e=>{const{delta:t,direction:s,finished:c,initialSize:u}=e,d=l.current.offsetWidth,f=((e,t,{max:n,min:i})=>{const r=lI(sI(e,t),{max:void 0===n?void 0:sI(n,t),min:void 0===i?void 0:sI(i,t)});switch(typeof e){case"number":return r;case"string":return((e,t)=>"number"==typeof e?e/t*100+"%":e)(r,t);default:throw new Error("Invalid length type")}})(u+t*(("center"===n?2:1)*("left"===s?-1:1)),d,{max:i,min:r});c?a(f):o(f)},t[0]=n,t[1]=i,t[2]=r,t[3]=a,t[4]=o,t[5]=c):c=t[5];const u=c;let d,f;t[6]!==u?(d={onResize:u},t[6]=u,t[7]=d):d=t[7],t[8]!==i||t[9]!==r||t[10]!==s?(f={maxWidth:i,minWidth:r,position:"relative",width:s},t[8]=i,t[9]=r,t[10]=s,t[11]=f):f=t[11];const p=f;let h,m,g,y;return t[12]!==p?(h={style:p},t[12]=p,t[13]=h):h=t[13],t[14]===Symbol.for("react.memo_cache_sentinel")?(m={position:"relative"},t[14]=m):m=t[14],t[15]===Symbol.for("react.memo_cache_sentinel")?(g={style:m},t[15]=g):g=t[15],t[16]!==d||t[17]!==h?(y={context:d,props:h,wrapperProps:g,wrapperRef:l},t[16]=d,t[17]=h,t[18]=y):y=t[18],y},wI=X.forwardRef((e,t)=>{const n=En(16);let i,r,a;n[0]!==e?(({children:i,options:r,...a}=e),n[0]=e,n[1]=i,n[2]=r,n[3]=a):(i=n[1],r=n[2],a=n[3]);const{context:o,props:s,wrapperProps:l,wrapperRef:c}=bI((e=>{const t=En(17);let n;t[0]!==e?(n=void 0===e?{}:e,t[0]=e,t[1]=n):n=t[1];const{align:i,maxWidth:r,minWidth:a}=n,o=void 0===i?"center":i,s=void 0===r?"100%":r,l=void 0===a?92:a,c=PA(),u=VA(),d=WA(),f=u?.width??"100%",p=kI("width"),h=yI("width");let m;t[2]!==c||t[3]!==f||t[4]!==d?(m=e=>{e===f?c.tf.select(d):c.tf.setNodes({width:e},{at:d})},t[2]=c,t[3]=f,t[4]=d,t[5]=m):m=t[5];const g=m;let y,v,k;return t[6]!==f||t[7]!==h?(y=()=>{h(f)},v=[f,h],t[6]=f,t[7]=h,t[8]=y,t[9]=v):(y=t[8],v=t[9]),X.useEffect(y,v),t[10]!==o||t[11]!==s||t[12]!==l||t[13]!==g||t[14]!==h||t[15]!==p?(k={align:o,maxWidth:s,minWidth:l,setNodeWidth:g,setWidth:h,width:p},t[10]=o,t[11]=s,t[12]=l,t[13]=g,t[14]=h,t[15]=p,t[16]=k):k=t[16],k})(r));let u,d,f;return n[4]!==i||n[5]!==o.onResize?(u=/* @__PURE__ */X.createElement(cI,{onResize:o.onResize},i),n[4]=i,n[5]=o.onResize,n[6]=u):u=n[6],n[7]!==s||n[8]!==t||n[9]!==a||n[10]!==u?(d=/* @__PURE__ */X.createElement("div",{ref:t,...s,...a},u),n[7]=s,n[8]=t,n[9]=a,n[10]=u,n[11]=d):d=n[11],n[12]!==d||n[13]!==l||n[14]!==c?(f=/* @__PURE__ */X.createElement("div",{ref:c,...l},d),n[12]=d,n[13]=l,n[14]=c,n[15]=f):f=n[15],f});wI.displayName="Resizable";var _I=e=>e.map(e=>e.dataset.blockId).filter(Boolean),xI=e=>{const t=e.getOption({key:kw.blockSelection},"isSelectingSome");return e.api.isExpanded()||t},CI=/* @__PURE__ */r((e,t)=>{t.exports=function(){var e=document.getSelection();if(!e.rangeCount)return function(){};for(var t=document.activeElement,n=[],i=0;i<e.rangeCount;i++)n.push(e.getRangeAt(i));switch(t.tagName.toUpperCase()){case"INPUT":case"TEXTAREA":t.blur();break;default:t=null}return e.removeAllRanges(),function(){"Caret"===e.type&&e.removeAllRanges(),e.rangeCount||n.forEach(function(t){e.addRange(t)}),t&&t.focus()}}}),EI=/* @__PURE__ */r((e,t)=>{var n=CI(),i={"text/plain":"Text","text/html":"Url",default:"Text"};t.exports=function(e,t){var r,a,o,s,l,c=!1;t||(t={}),t.debug;try{if(a=n(),o=document.createRange(),s=document.getSelection(),(l=document.createElement("span")).textContent=e,l.ariaHidden="true",l.style.all="unset",l.style.position="fixed",l.style.top=0,l.style.clip="rect(0, 0, 0, 0)",l.style.whiteSpace="pre",l.style.webkitUserSelect="text",l.style.MozUserSelect="text",l.style.msUserSelect="text",l.style.userSelect="text",l.addEventListener("copy",function(n){if(n.stopPropagation(),t.format)if(n.preventDefault(),void 0===n.clipboardData){window.clipboardData.clearData();var r=i[t.format]||i.default;window.clipboardData.setData(r,e)}else n.clipboardData.clearData(),n.clipboardData.setData(t.format,e);t.onCopy&&(n.preventDefault(),t.onCopy(n.clipboardData))}),document.body.appendChild(l),o.selectNodeContents(l),s.addRange(o),!document.execCommand("copy"))throw new Error("copy command was unsuccessful");c=!0}catch(u){try{window.clipboardData.setData(t.format||"text",e),t.onCopy&&t.onCopy(window.clipboardData),c=!0}catch(u){r=function(e){var t=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return e.replace(/#{\s*key\s*}/g,t)}("message"in t?t.message:"Copy to clipboard: #{key}, Enter"),window.prompt(r,e)}}finally{s&&("function"==typeof s.removeRange?s.removeRange(o):s.removeAllRanges()),l&&document.body.removeChild(l),a()}return c}}),DI=/* @__PURE__ */n(EI(),1),SI=pS({key:kw.blockMenu,editOnly:!0,options:{openId:null,position:{x:-1e4,y:-1e4}}}).extendApi(({setOption:e,setOptions:t})=>({hide:()=>{t({openId:null,position:{x:-1e4,y:-1e4}})},show:(n,i)=>{i?t({openId:n,position:i}):e("openId",n)}})).extendApi(({api:e,editor:t})=>({showContextMenu:(n,i)=>{t.getApi({key:kw.blockSelection}).blockSelection?.set(n),e.blockMenu.show("context",i)}})).extend(({api:e})=>({handlers:{onMouseDown:({event:t,getOptions:n})=>{0===t.button&&n().openId&&(t.preventDefault(),e.blockMenu.hide()),2===t.button&&t.preventDefault()}}})),AI=(e,t)=>{const n=e.getApi(sj).blockSelection.getNodes(),i=e.api.node(t);if(!i)return;const[r,a]=i,o=(n.length>0?n:e.api.blocks({mode:"lowest",match:(e,t)=>t.length===a.length})).map(e=>e[0].id);e.getApi(sj).blockSelection.set(o.includes(r.id)?o:[r.id])},FI=(e,{disabledWhenFocused:t=!0,element:n,event:i})=>{const{enableContextMenu:r,selectedIds:a}=e.getOptions(sj);if(!r)return;if(e.selection?.focus&&t){const t=e.api.above(),r=e.api.findPath(n);if(t&&r&&jd.isCommon(r,t[1])){const n=t[0].id,r=e.getOption(sj,"isSelected",n),a="true"===i.target.dataset?.plateOpenContextMenu;if(!r&&!e.api.isVoid(t[0])&&!a)return i.stopPropagation()}}const o=n.id;o&&(i?.shiftKey?e.getApi(sj).blockSelection.add(o):a?.has(o)||e.setOption(sj,"selectedIds",/* @__PURE__ */new Set([o])))},zI=e=>{const{id:t}=VA();return MA(sj,"isSelected",e??t)},BI=e=>({api:t})=>{t.cursorOverlay.removeCursor(e)},TI=(pS({key:kw.cursorOverlay,editOnly:{render:!1},options:{cursors:{}}}).extendApi(({editor:e,plugin:t})=>({addCursor:(n,i)=>{const r={...e.getOptions(t).cursors};r[n]={id:n,...i},e.setOption(t,"cursors",r)},removeCursor:n=>{const i={...e.getOptions(t).cursors};i[n]&&(delete i[n],e.setOption(t,"cursors",i))}})).overrideEditor(({api:e,editor:t,getOptions:n,tf:{setSelection:i}})=>({transforms:{setSelection(r){n().cursors?.selection&&setTimeout(()=>{e.cursorOverlay.addCursor("selection",{selection:t.selection})},0),i(r)}}})).extend(()=>({handlers:{onBlur:({api:e,editor:t,event:n})=>{t.selection&&"true"===n.relatedTarget?.dataset?.plateFocus&&e.cursorOverlay.addCursor("selection",{selection:t.selection})},onDragEnd:BI("drag"),onDragLeave:BI("drag"),onDragOver:({api:e,editor:t,event:n})=>{if(!t.plugins.dnd||t.getOptions({key:kw.dnd}).isDragging)return;if((n.dataTransfer?.types||[]).some(e=>e.startsWith("Files")))return;const i=t.api.findEventRange(n);i&&e.cursorOverlay.addCursor("drag",{selection:i})},onDrop:BI("drag"),onFocus:BI("selection")},useHooks:({api:e,setOption:t})=>{const n=MA(sj,"isSelecting");de(()=>{n&&setTimeout(()=>{e.cursorOverlay.removeCursor("selection")},0)},[n,t,e.cursorOverlay])}})),Object.freeze([]),class{_listeners=/* @__PURE__ */new Map;emit=this.dispatchEvent;off=this.removeEventListener;on=this.addEventListener;addEventListener(e,t){const n=this._listeners.get(e)??/* @__PURE__ */new Set;return this._listeners.set(e,n),n.add(t),this}dispatchEvent(e,...t){let n=!0;for(const i of this._listeners.get(e)??[])n=!1!==i(...t)&&n;return n}removeEventListener(e,t){return this._listeners.get(e)?.delete(t),this}unbindAllListeners(){this._listeners.clear()}}),OI=(e,t="px")=>"number"==typeof e?e+t:e;function PI({style:e},t,n){if("object"==typeof t)for(const[i,r]of Object.entries(t))void 0!==r&&(e[i]=OI(r));else void 0!==n&&(e[t]=OI(n))}var NI=e=>(t,n,i,r={})=>{let a,o;a=t instanceof HTMLCollection||t instanceof NodeList?Array.from(t):Array.isArray(t)?t:[t],o=Array.isArray(n)?n:[n];for(const s of a)if(s)for(const t of o)s[e](t,i,{capture:!1,...r});return[a,o,i,r]},II=NI("addEventListener"),jI=NI("removeEventListener"),RI=e=>{const{clientX:t,clientY:n,target:i}=e.touches?.[0]??e;return{target:i,x:t,y:n}};function MI(e,t,n,i){const r=i.getBoundingClientRect(),a=i.scrollLeft,o=i.scrollTop;return e.right>=t.left-r.left&&e.left+r.left<=t.right+a&&e.bottom-o>=t.top-r.top&&e.top<=t.bottom-r.top+o}function LI(e,t=document){const n=Array.isArray(e)?e:[e];let i=[];for(let r=0,a=n.length;r<a;r++){const e=n[r];"string"==typeof e?i=i.concat(Array.from(t.querySelectorAll(e))):e instanceof Element&&i.push(e)}return i}var{abs:VI,ceil:qI,max:WI,min:HI}=Math,UI=class extends TI{_area;_areaClientLocation={x1:0,x2:0,y1:0,y2:0};_areaLocation={x1:0,x2:0,y1:0,y2:0};_areaRect=new DOMRect;_container;_containerRect;_frame;_initScrollDelta={x:0,y:0};_latestElement;_options;_scrollAvailable=!0;_scrollDelta={x:0,y:0};_scrollingActive=!1;_scrollSpeed={x:0,y:0};_selectables=[];_selection={changed:{added:[],removed:[]},selected:[],stored:[],touched:[]};_singleClick=!0;wheelTimer=null;disable=this._bindStartEvents.bind(this,!1);enable=this._bindStartEvents;constructor(e){super(),this._options={boundaries:["html"],container:"body",document:window.document,selectables:[],selectionAreaClass:"selection-area",startAreas:["html"],...e,behaviour:{intersect:"touch",overlap:"invert",triggers:[0],...e.behaviour,scrolling:{manualSpeed:750,speedDivider:.7,...e.behaviour?.scrolling,startScrollMargins:{x:20,y:40,...e.behaviour?.scrolling?.startScrollMargins}},startThreshold:e.behaviour?.startThreshold?"number"==typeof e.behaviour.startThreshold?e.behaviour.startThreshold:{x:4,y:4,...e.behaviour.startThreshold}:{x:4,y:4}},features:{range:!0,touch:!0,...e.features,singleTap:{allow:!0,intersect:"native",...e.features?.singleTap}}};for(const i of Object.getOwnPropertyNames(Object.getPrototypeOf(this)))"function"==typeof this[i]&&(this[i]=this[i].bind(this));const{document:t,selectionAreaClass:n}=this._options;this._area=t.createElement("div"),this._area.classList.add(n),PI(this._area,{left:0,position:"absolute",top:0,willChange:"top, left, bottom, right, width, height"}),this._frame=(e=>{let t,n=-1,i=!1;return{cancel(){cancelAnimationFrame(n),i=!1},next(...r){t=r,i||(i=!0,n=requestAnimationFrame(()=>{e(...t),i=!1}))}}})(e=>{this._recalculateSelectionAreaRect(),this._updateElementSelection(),this._emitEvent("move",e),this._redrawSelectionArea()}),this.enable()}_bindStartEvents(e=!0){const{document:t,features:n}=this._options,i=e?II:jI;i(t,"mousedown",this._onTapStart),n.touch&&i(t,"touchstart",this._onTapStart,{passive:!1})}_delayedTapMove(e){const{behaviour:{startThreshold:t},document:n}=this._options,{x1:i,y1:r}=this._areaLocation,{x1:a,y1:o}=this._areaClientLocation,{x:s,y:l}=RI(e);if("number"==typeof t&&VI(s+l-(a+o))>=t||"object"==typeof t&&VI(s-i)>=t.x||VI(l-r)>=t.y){if(jI(n,["mousemove","touchmove"],this._delayedTapMove,{passive:!1}),!1===this._emitEvent("beforedrag",e))return void jI(n,["mouseup","touchcancel","touchend"],this._onTapStop);II(n,["mousemove","touchmove"],this._onTapMove,{passive:!1}),PI(this._area,"display","block"),this._container.append(this._area),this.resolveSelectables(),this._singleClick=!1,II(this._container,"wheel",this._manualScroll,{passive:!0}),this._setupSelectionArea(),this._emitEvent("start",e),this._onTapMove(e)}this._handleMoveEvent(e)}_emitEvent(e,t){return this.emit(e,{event:t,selection:this,store:this._selection})}_handleMoveEvent(e){const{features:t}=this._options;(t.touch&&matchMedia("(hover: none), (pointer: coarse)").matches||this._scrollAvailable&&"safari"in window)&&e.preventDefault()}_keepSelection(){const{_options:e,_selection:t}=this,{changed:n,selected:i,stored:r,touched:a}=t,o=i.filter(e=>!r.includes(e));switch(e.behaviour.overlap){case"drop":t.stored=[...o,...r.filter(e=>!a.includes(e))];break;case"invert":t.stored=[...o,...r.filter(e=>!n.removed.includes(e))];break;case"keep":t.stored=[...r,...i.filter(e=>!r.includes(e))]}}_manualScroll(e){this.wheelTimer&&clearTimeout(this.wheelTimer);const{x:t,y:n}=RI(e);this.wheelTimer=setTimeout(()=>{this._areaClientLocation.x2=t,this._areaClientLocation.y2=n;const e=n-this._containerRect.top,i=t-this._containerRect.left;this._areaLocation.x2=i+this._container.scrollLeft,this._areaLocation.y2=e+this._container.scrollTop,this._frame.next(null)},100)}_onScroll(e){const{document:t}=this._options;this.wheelTimer&&clearTimeout(this.wheelTimer);const{x:n,y:i}=RI(e);this.wheelTimer=setTimeout(()=>{this._areaClientLocation.x2=n,this._areaClientLocation.y2=i;const e=i-this._containerRect.top+this._container.scrollTop+t.scrollingElement.scrollTop-this._initScrollDelta.y,r=n-this._containerRect.left+this._container.scrollLeft+t.scrollingElement.scrollLeft;this._scrollDelta.y=t.scrollingElement.scrollTop-this._initScrollDelta.y,this._scrollDelta.x=t.scrollingElement.scrollLeft-this._initScrollDelta.x,this._areaLocation.y2=e,this._areaLocation.x2=r,this._frame.next(null)},100)}_onSingleTap(e){const{range:t,singleTap:{intersect:n}}=this._options.features,i=RI(e);let r;if("native"===n)r=i.target;else if("touch"===n){this.resolveSelectables();const{x:e,y:t}=i;r=this._selectables.find(n=>{const{bottom:i,left:r,right:a,top:o}=n.getBoundingClientRect();return e<a&&e>r&&t<i&&t>o})}if(!r)return;for(this.resolveSelectables();!this._selectables.includes(r);){if(!r.parentElement)return;r=r.parentElement}const{stored:a}=this._selection;if(this._emitEvent("start",e),e.shiftKey&&t&&this._latestElement){const e=this._latestElement,[t,n]=4&e.compareDocumentPosition(r)?[r,e]:[e,r],i=[...this._selectables.filter(e=>4&e.compareDocumentPosition(t)&&2&e.compareDocumentPosition(n)),t,n];this.select(i),this._latestElement=e}else a.includes(r)&&(1===a.length||e.ctrlKey||a.every(e=>this._selection.stored.includes(e)))?this.deselect(r):(this.select(r),this._latestElement=r)}_onTapMove(e){const{x:t,y:n}=RI(e),{_areaClientLocation:i,_areaLocation:r,_frame:a,_options:o,_scrollSpeed:s}=this,{speedDivider:l}=o.behaviour.scrolling,c=n-this._containerRect.top,u=t-this._containerRect.left;if(this._scrollAvailable&&!this._scrollingActive&&(s.y||s.x)){this._scrollingActive=!0;const t=()=>{s.x||s.y?(s.y&&(this._container.scrollTop+=qI(s.y/l),r.y2=c),s.x&&(this._container.scrollLeft+=qI(s.x/l),r.x2=u),a.next(e),requestAnimationFrame(t)):this._scrollingActive=!1};requestAnimationFrame(t)}else r.x2=u+this._container.scrollLeft+this._scrollDelta.x,r.y2=c+this._container.scrollTop+this._scrollDelta.y,i.x2=t,i.y2=n,a.next(e);this._handleMoveEvent(e)}_onTapStart(e,t=!1){const{container:n,document:i}=this._options,{target:r,x:a,y:o}=RI(e);if(this._container=LI(n,i)[0],!this._container)return;if(this._container.contains(r)&&"true"!==r.dataset.slateEditor&&"true"!==r.dataset.plateSelectable)return;this._containerRect=this._container.getBoundingClientRect();const s=a-this._containerRect.left+this._container.scrollLeft,l=o-this._containerRect.top+this._container.scrollTop,{_options:c}=this;if(e instanceof MouseEvent&&!function(e,t){for(const n of t)if("number"!=typeof n){if("object"==typeof n){const t=n.button===e.button,i=n.modifiers.every(t=>{switch(t){case"alt":return e.altKey;case"ctrl":return e.ctrlKey||e.metaKey;case"shift":return e.shiftKey;default:return!1}});if(t&&i)return!0}}else if(e.button===n)return!0;return!1}(e,c.behaviour.triggers))return;const u=LI(c.startAreas,c.document),d=LI(c.boundaries,c.document),f=e.composedPath();if(!this._container||!u.find(e=>f.includes(e))||!d.find(e=>f.includes(e)))return;if(!t&&!1===this._emitEvent("beforestart",e))return;this._areaLocation={x1:s,x2:0,y1:l,y2:0},this._areaClientLocation={x1:a,x2:0,y1:o,y2:0};const p=i.scrollingElement??i.body;this._initScrollDelta={x:p.scrollLeft,y:p.scrollTop},this._singleClick=!0,this.clearSelection(!1,!0),II(i,["touchmove","mousemove"],this._delayedTapMove,{passive:!1}),II(i,["mouseup","touchcancel","touchend"],this._onTapStop),II(i,"wheel",this._onScroll,{passive:!1})}_onTapStop(e,t){const{document:n,features:i}=this._options,{_singleClick:r}=this;jI(n,["mousemove","touchmove"],this._delayedTapMove),jI(n,["touchmove","mousemove"],this._onTapMove),jI(n,["mouseup","touchcancel","touchend"],this._onTapStop),jI(n,"wheel",this._onScroll),this._keepSelection(),e&&r&&i.singleTap.allow?this._onSingleTap(e):r||t||(this._updateElementSelection(),this._emitEvent("stop",e)),this._scrollSpeed.x=0,this._scrollSpeed.y=0,this._scrollDelta.x=0,this._scrollDelta.y=0,jI(this._container,"wheel",this._manualScroll,{passive:!0}),this._area.remove(),this._frame?.cancel(),PI(this._area,"display","none")}_recalculateSelectionAreaRect(){const{_areaClientLocation:e,_areaLocation:t,_areaRect:n,_container:i,_containerRect:r,_scrollSpeed:a}=this,{clientHeight:o,clientWidth:s,scrollHeight:l,scrollLeft:c,scrollTop:u,scrollWidth:d}=i,{x1:f,y1:p}=t;let{x2:h,y2:m}=t;const{behaviour:{scrolling:{startScrollMargins:g}}}=this._options;e.x2+this._scrollDelta.x<r.left+g.x?(a.x=c?-VI(r.left-e.x2-this._scrollDelta.x):0,h=WI(h,this._container.scrollLeft)):e.x2+this._scrollDelta.x>r.right-g.x?(a.x=d-c-s?VI(r.left+this._container.clientWidth-e.x2-this._scrollDelta.x):0,h=s+c):a.x=0,e.y2+this._scrollDelta.y<r.top+g.y?(a.y=u?-VI(r.top-e.y2-this._scrollDelta.y+g.y):0,m=WI(m,this._container.scrollTop)):e.y2+this._scrollDelta.y>r.bottom-g.y?(a.y=l-u-o?VI(e.y2+this._scrollDelta.y-(r.top+this._container.clientHeight-g.y)):0,m=o+u):a.y=0;const y=HI(f,h),v=HI(p,m),k=WI(f,h),b=WI(p,m);n.x=y,n.y=v,n.width=k-y,n.height=b-v}_redrawSelectionArea(){const{height:e,width:t,x:n,y:i}=this._areaRect,{style:r}=this._area;r.left=`${n}px`,r.top=`${i}px`,r.width=`${t}px`,r.height=`${e}px`}_setupSelectionArea(){}_updateElementSelection(){const{_areaRect:e,_options:t,_selectables:n,_selection:i}=this,{selected:r,stored:a,touched:o}=i,{intersect:s,overlap:l}=t.behaviour,c="invert"===l,u=[],d=[],f=[];for(let h=0;h<n.length;h++){const t=n[h];if(MI(e,t.getBoundingClientRect(),0,this._container)){if(r.includes(t))a.includes(t)&&!o.includes(t)&&o.push(t);else{if(c&&a.includes(t)){f.push(t);continue}d.push(t)}u.push(t)}}c&&d.push(...a.filter(e=>!r.includes(e)));const p="keep"===l;for(let h=0;h<r.length;h++){const e=r[h];u.includes(e)||p&&a.includes(e)||f.push(e)}i.selected=u,i.changed={added:d,removed:f},this._latestElement=void 0}cancel(e=!1){this._onTapStop(null,!e)}clearSelection(e=!0,t=!1){const{changed:n,selected:i,stored:r}=this._selection;n.added=[],n.removed.push(...i,...e?r:[]),t||(this._emitEvent("move",null),this._emitEvent("stop",null)),this._selection={changed:{added:[],removed:[]},selected:[],stored:e?[]:r,touched:[]}}deselect(e,t=!1){const{changed:n,selected:i,stored:r}=this._selection,a=LI(e,this._options.document).filter(e=>i.includes(e)||r.includes(e));0!==a.length&&(this._selection.stored=r.filter(e=>!a.includes(e)),this._selection.selected=i.filter(e=>!a.includes(e)),this._selection.changed.added=[],this._selection.changed.removed.push(...a.filter(e=>!n.removed.includes(e))),this._latestElement=void 0,t||(this._emitEvent("move",null),this._emitEvent("stop",null)))}destroy(){this.cancel(),this.disable(),super.unbindAllListeners()}getSelection(){return this._selection.stored}getSelectionArea(){return this._area}resolveSelectables(){this._selectables=LI(this._options.selectables,this._options.document)}select(e,t=!1){const{changed:n,selected:i,stored:r}=this._selection,a=LI(e,this._options.document).filter(e=>!i.includes(e)&&!r.includes(e));return r.push(...a),i.push(...a),n.added.push(...a),n.removed=[],this._latestElement=void 0,t||(this._emitEvent("move",null),this._emitEvent("stop",null)),a}trigger(e,t=!0){this._onTapStart(e,t)}},$I=()=>{const{api:e,editor:t,getOption:n,getOptions:i,setOption:r}=jA(sj),{areaOptions:a}=i(),o=X.useRef({ids:/* @__PURE__ */new Set}),s=X.useRef({ids:/* @__PURE__ */new Set}),l=()=>{t.api.isFocused()&&t.tf.blur(),t.selection&&t.tf.deselect(),r("isSelectionAreaVisible",!0)};X.useEffect(()=>{const c=new UI({boundaries:`#${t.meta.uid}`,container:`#${t.meta.uid}`,document:window.document,selectables:`#${t.meta.uid} .slate-selectable`,selectionAreaClass:"slate-selection-area",...a}).on("beforestart",()=>{r("isSelecting",!1)}).on("start",({event:t})=>{l(),t?.shiftKey||(c.clearSelection(),e.blockSelection.clear())}).on("move",({store:{changed:e}})=>{i().isSelectionAreaVisible||l();(()=>{if(0===e.added.length&&0===e.removed.length)return;const n=new Set(i().selectedIds);_I(e.removed).forEach(e=>{n.delete(e),o.current.ids.delete(e)}),new Set(_I(e.added)).forEach(e=>{const i=t.api.block({at:[],match:t=>!!t.id&&t.id===e});if(i&&i[0].type!==kw.table)return 1===i[1].length?(n.add(e),void o.current.ids.add(e)):void(t.api.block({above:!0,at:i[1],match:e=>!!e.id&&o.current.ids.has(e.id)})||(n.add(e),o.current.ids.add(e)))}),r("selectedIds",n)})(),(()=>{const e=new Set(n("selectedIds")),i=Array.from(e),a=e=>t.api.block({at:[],match:t=>!!t.id&&t.id===e});i.every(e=>{const t=a(e);return!!t&&(t[1].length>=3||(e=>e.type===kw.table||e.type===kw.tr||e.type===kw.th)(t[0]))})?i.some(t=>{const n=a(t);return!(!n||n[0].type!==kw.table)&&(e.delete(t),s.current.ids.forEach(t=>{e.add(t)}),s.current.ids.clear(),!0)}):i.some(n=>{const i=a(n);if(!i||!(e=>e.type===kw.tr||e.type===kw.th)(i[0]))return!1;const r=t.api.block({above:!0,at:i[1]});if(!r)return!1;const o=r[0].children.map(e=>e.id);return e.add(r[0].id),o.forEach(t=>{e.has(t)&&(s.current.ids.add(t),e.delete(t))}),!0}),r("selectedIds",e)})()}).on("stop",()=>{o.current={ids:/* @__PURE__ */new Set},s.current={ids:/* @__PURE__ */new Set},r("isSelectionAreaVisible",!1)});return()=>c.destroy()},[])},KI=(e,t)=>{if(!t)return!1;const{selectedIds:n}=e.getOptions(sj),i=e.getApi(sj).blockSelection.getNodes({collapseTableRows:!0}),r=i.map(([e])=>e);if(0===i.length)return!1;let a="";const o=document.createElement("div");e.tf.withoutNormalizing(()=>{i.forEach(([,n])=>{e.tf.select({anchor:e.api.start(n),focus:e.api.end(n)});const i=e.api.isEmpty(n);if(i){const t=e.api.after(e.selection);e.tf.select({anchor:e.api.start(n),focus:t})}i||e.tf.setFragmentData(t),a+=i?"\n":`${t.getData("text/plain")}\n`;const r=document.createElement("div");r.innerHTML=i?"<p></p>":t.getData("text/html"),o.append(r)}),e.tf.deselect(),e.setOption(sj,"selectedIds",n)}),t.setData("text/plain",a),t.setData("text/html",o.innerHTML);const s=JSON.stringify(r),l=window.btoa(encodeURIComponent(s));return t.setData("application/x-slate-fragment",l),!0},GI=(e,t)=>{if(t)return KI(e,t);let n=!1;return(0,DI.default)(" ",{onCopy:t=>{n=KI(e,t)}})&&n},JI=e=>{const{setOption:t}=Kv(e,sj),n=/* @__PURE__ */new Set;e.operations.forEach(t=>{"insert_node"===t.type&&t.node.id&&e.api.isBlock(t.node)&&n.add(t.node.id)}),t("selectedIds",n)},QI=(e,t)=>{const{api:n,setOption:i}=hS(e,sj),r=n.blockSelection.getNodes();if(0!==r.length)if("up"===t){const[,t]=r[0],a=e.api.previous({at:t,from:"parent",match:n.blockSelection.isSelectable});if(a){const[e]=a;i("anchorId",e.id),n.blockSelection.set(e.id)}else n.blockSelection.set(r[0][0].id)}else{const[,t]=r.at(-1),a=e.api.next({at:t,from:"child",match:n.blockSelection.isSelectable});if(a){const[e]=a;i("anchorId",e.id),n.blockSelection.set(e.id)}else n.blockSelection.set(r.at(-1)[0].id)}},XI=(e,{added:t,ids:n,removed:i})=>{const{getOptions:r,setOption:a}=Kv(e,{key:kw.blockSelection});if(n&&a("selectedIds",new Set(n)),t||i){const{selectedIds:e}=r(),n=new Set(e);if(t)for(const i of _I(t))i&&n.add(i);if(i)for(const t of _I(i))t&&n.delete(t);a("selectedIds",n)}a("isSelecting",!0)},YI=(e,t,n={})=>{const{api:i,getOptions:r,setOption:a}=Kv(e,{key:kw.blockSelection}),{clear:o=!0,delay:s}=n,l=(e=>document.querySelector(`.slate-selectable[data-block-id="${e}"]`))(t);l&&(!r().selectedIds.has(t)&&o&&a("selectedIds",/* @__PURE__ */new Set),i.blockSelection.setSelectedIds({added:[l],removed:[]}),s&&setTimeout(()=>{i.blockSelection.setSelectedIds({added:[],removed:[l]})},s))},ZI=(e,t)=>{const{api:n,getOption:i,getOptions:r,setOption:a}=hS(e,sj),o=n.blockSelection.getNodes();if(0===o.length)return;const[s,l]=o[0],[c,u]=o.at(-1);let d=r().anchorId;d||(d="up"===t?c.id:s.id,a("anchorId",d));const f=o.findIndex(([e])=>e.id===d);if(-1===f)return void a("anchorId",c.id);const p=0===f,h=f===o.length-1,m=new Set(i("selectedIds"));if("down"===t)if(p){const t=e.api.next({at:u,mode:"highest",match:(e,t)=>n.blockSelection.isSelectable(e,t)&&!jd.isAncestor(t,u)});if(!t)return;const[i]=t;m.add(i.id)}else s.id&&s.id!==d&&m.delete(s.id);else if(h){const t=e.api.previous({at:l,from:"parent",match:n.blockSelection.isSelectable});if(!t)return;const[i,r]=t;jd.isAncestor(r,l)&&m.forEach(t=>{const n=e.api.node({id:t,at:r});n&&jd.isDescendant(n[1],r)&&(m.delete(t),t===d&&(d=i.id,a("anchorId",d)))}),m.add(i.id)}else c.id&&c.id!==d&&m.delete(c.id);m.add(d),a("selectedIds",m)},ej=e=>{const t=e.getApi(sj).blockSelection.getNodes(),n=t.at(-1);if(!n)return;e.tf.duplicateNodes({nodes:t});const i=jd.next(n[1]),r=t.map((t,n)=>{const r=[i[0]+n];return e.api.node(r)?.[0].id}).filter(Boolean);setTimeout(()=>{e.setOption(sj,"selectedIds",new Set(r))},0)},tj=(e,t,{at:n,insertedCallback:i})=>{e.tf.insertNodes(t,{at:n}),i?.();const r=[Ld.get(e,n)];let a=1;for(;a<t.length;){n=jd.next(n);const t=Ld.get(e,n);r.push(t),a++}setTimeout(()=>{e.setOption(sj,"selectedIds",new Set(r.map(e=>e.id)))},0)},nj=e=>{const t=e.getOption(sj,"selectedIds");t&&e.tf.removeNodes({at:[],block:!0,match:e=>!!e.id&&t.has(e.id)})},ij=e=>{e.tf.select(e.api.nodesRange(e.getApi(sj).blockSelection.getNodes())),e.getApi(sj).blockSelection.clear()},rj=(e,t,n)=>{e.tf.withoutNormalizing(()=>{e.getApi(sj).blockSelection.getNodes().forEach(([,i])=>{e.tf.setNodes(t,{...n,at:i})})})},aj=(e,t,n)=>{const i=e.getApi(sj);e.tf.withoutNormalizing(()=>{i.blockSelection.getNodes().forEach(([i,r])=>{const a=(i.indent??0)+t;e.tf.setNodes({indent:Math.max(a,0)},{...n,at:r})})})},oj=(e,t,n)=>{rj(e,t,{mode:"lowest",...n})},sj=pS({key:kw.blockSelection,editOnly:!0,handlers:{onMouseDown:({api:e,editor:t,event:n,getOptions:i})=>{const r=n.target;r.dataset.platePreventUnselect||r.dataset.platePreventDeselect||0===n.button&&i().selectedIds.size>0&&!t.getOption(SI,"openId")&&e.blockSelection.deselect()}},inject:{isBlock:!0,nodeProps:{transformProps:()=>(()=>{const e=En(6),t=VA(),n=WA();let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i={key:kw.blockSelection},e[0]=i):i=e[0];const{api:r,editor:a}=jA(i);let o;return e[1]!==r.blockSelection||e[2]!==a||e[3]!==t||e[4]!==n?(o={props:r.blockSelection?.isSelectable(t,n)?{className:"slate-selectable",onContextMenu:e=>FI(a,{element:t,event:e})}:{}},e[1]=r.blockSelection,e[2]=a,e[3]=t,e[4]=n,e[5]=o):o=e[5],o})().props}},options:{anchorId:null,areaOptions:{features:{singleTap:{allow:!1}}},enableContextMenu:!1,disableSelectAll:!1,isSelecting:!1,isSelectionAreaVisible:!1,selectedIds:/* @__PURE__ */new Set,shadowInputRef:{current:null},isSelectable:()=>!0},plugins:[SI],render:{afterEditable:()=>{const e=PA(),{api:t,getOption:n,getOptions:i,setOption:r}=jA({key:kw.blockSelection}),a=MA(sj,"isSelectingSome"),o=MA(sj,"selectedIds"),s=X.useCallback((n={})=>{const i=[...e.api.nodes({at:[],match:e=>!!e.id&&o?.has(e.id)})];if(0===i.length)return null;const a=i[0][1];return e.tf.withoutNormalizing(()=>{for(const[n,r]of[...i].reverse())e.tf.removeNodes({at:r}),t.blockSelection.delete(n.id);if(0===e.children.length)e.meta._forceFocus=!0,e.tf.focus(),e.meta._forceFocus=!1;else if(n.selectPrevious){const t=jd.previous(a);if(t){const n=e.api.block({at:t});n&&r("selectedIds",/* @__PURE__ */new Set([n[0].id]))}}}),a},[e,t.blockSelection,o,r]);$I();const l=X.useRef(null),[c,u]=X.useState(!1);X.useEffect(()=>(u(!0),r("shadowInputRef",l),()=>{u(!1)}),[r]),X.useEffect(()=>{a||r("anchorId",null)},[a,r]),X.useEffect(()=>{a&&l.current?l.current.focus({preventScroll:!0}):l.current&&l.current.blur()},[a]);const d=X.useCallback(r=>{const a=e.api.isReadOnly();if(i().onKeyDownSelecting?.(e,r.nativeEvent),n("isSelectingSome")){if((0,Ns.isHotkey)("shift+up")(r))return r.preventDefault(),r.stopPropagation(),void t.blockSelection.shiftSelection("up");if((0,Ns.isHotkey)("shift+down")(r))return r.preventDefault(),r.stopPropagation(),void t.blockSelection.shiftSelection("down");if((0,Ns.isHotkey)("escape")(r))t.blockSelection.deselect();else{if((0,Ns.isHotkey)("mod+z")(r))return e.undo(),void JI(e);if((0,Ns.isHotkey)("mod+a")(r))t.blockSelection.selectAll();else{if((0,Ns.isHotkey)("mod+shift+z")(r))return e.redo(),void JI(e);if((0,Ns.isHotkey)("mod+d")(r))return r.preventDefault(),void e.getTransforms(sj).blockSelection.duplicate();if(n("isSelectingSome")){if((0,Ns.isHotkey)("enter")(r)){const t=e.api.node({at:[],block:!0,match:e=>!!e.id&&o?.has(e.id)});if(t){const[,n]=t;e.meta._forceFocus=!0,e.tf.focus({at:n,edge:"end"}),e.meta._forceFocus=void 0,r.preventDefault()}return}if((0,Ns.isHotkey)(["backspace","delete"])(r)&&!a)return r.preventDefault(),void s({selectPrevious:(0,Ns.isHotkey)("backspace")(r)});if((0,Ns.isHotkey)("up")(r))return r.preventDefault(),r.stopPropagation(),void t.blockSelection.moveSelection("up");if((0,Ns.isHotkey)("down")(r))return r.preventDefault(),r.stopPropagation(),void t.blockSelection.moveSelection("down");if(!(a||1!==r.key.length||r.ctrlKey||r.metaKey||r.altKey)){r.preventDefault();const t=s();return void(t&&(e.meta._forceFocus=!0,e.tf.insertNodes(e.api.create.block({children:[{text:r.key}]}),{at:t}),e.tf.select(t,{edge:"end"}),e.meta._forceFocus=!1,e.tf.focus()))}}}}}},[e,i,n,t.blockSelection,s,o]),f=X.useCallback(t=>{n("isSelectingSome")&&GI(e,t.clipboardData)&&t.preventDefault()},[e,n]),p=X.useCallback(t=>{if(n("isSelectingSome")){const n=GI(e,t.clipboardData);n&&t.preventDefault(),n&&!e.api.isReadOnly()&&s()}},[e,n,s]),h=X.useCallback(t=>{t.preventDefault(),e.api.isReadOnly()||((e,t)=>{const{api:n}=Kv(e,sj),i=n.blockSelection.getNodes();if(i.length>0){const[n,r]=i.at(-1);if(!e.api.isEmpty(n)){const t=jd.next(r);e.tf.insertNodes(e.api.create.block({},t),{at:t,select:!0})}e.tf.insertData(t.clipboardData),JI(e)}})(e,t.nativeEvent)},[e]);return c&&"undefined"!=typeof window?hn.createPortal(/* @__PURE__ */X.createElement("input",{ref:l,className:"slate-shadow-input",style:{left:"-300px",opacity:0,position:"fixed",top:"-300px",zIndex:999},onCopy:f,onCut:p,onKeyDown:d,onPaste:h}),document.body):null}}}).extendSelectors(({getOptions:e})=>({isSelected:t=>!!t&&e().selectedIds.has(t),isSelectingSome:()=>e().selectedIds.size>0})).extendApi(({editor:e,getOption:t,getOptions:n,setOption:i})=>({addOnContextMenu:tr(FI,e),moveSelection:tr(QI,e),setSelectedIds:tr(XI,e),shiftSelection:tr(ZI,e),add:e=>{const t=new Set(n().selectedIds);if(Array.isArray(e))for(const n of e)t.add(n);else t.add(e);i("selectedIds",t)},clear:()=>{i("selectedIds",/* @__PURE__ */new Set)},delete:e=>{const t=new Set(n().selectedIds);if(Array.isArray(e))for(const n of e)t.delete(n);else t.delete(e);i("selectedIds",t)},deselect:()=>{i("selectedIds",/* @__PURE__ */new Set),i("isSelecting",!1)},first:()=>{const n=t("selectedIds");return n&&0!==n.size?e.api.node({at:[],match:e=>n.has(e.id)}):null},focus:()=>{const e=t("shadowInputRef");e?.current&&e.current.focus({preventScroll:!0})},getNodes:n=>{const i=t("selectedIds"),r=e.api.blocks({at:[],match:e=>!!e.id&&i?.has(e.id)});if(n?.sort&&r.sort(([,e],[,t])=>jd.compare(e,t)),n?.collapseTableRows){const t=[];return r.forEach(([n,i])=>{if(n.type===kw.tr){const r=jd.parent(i),a=e.api.node(r),o=t.findIndex(([e])=>e.type===a[0].type&&e.id===a[0].id);if(-1===o){const e={...a[0],children:[n]};t.push([e,a[1]])}else t[o][0].children.push(n);return}t.push([n,i])}),t}return 0===r.length&&n?.selectionFallback?e.api.blocks({mode:"highest"}):r},has:e=>Array.isArray(e)?e.every(e=>n().selectedIds.has(e)):n().selectedIds.has(e),isSelectable:(t,i)=>!!t.id&&e.api.isBlock(t)&&n().isSelectable(t,i),resetSelectedIds:()=>{i("selectedIds",/* @__PURE__ */new Set)},set:e=>{i("selectedIds",new Set(Array.isArray(e)?e:[e]))},unselect:()=>{i("selectedIds",/* @__PURE__ */new Set),i("isSelecting",!1)}})).extendApi(({api:e,editor:t,setOption:n})=>({addSelectedRow:tr(YI,t),selectAll:()=>{const t=e.blocks({at:[],mode:"highest",match:(t,n)=>!!t.id&&e.blockSelection.isSelectable(t,n)}).map(e=>e[0].id);n("selectedIds",new Set(t)),e.blockSelection.focus()}})).extendTransforms(({editor:e})=>({duplicate:tr(ej,e),insertBlocksAndSelect:tr(tj,e),removeNodes:tr(nj,e),select:tr(ij,e),selectBlocks:tr(AI,e),setIndent:tr(aj,e),setNodes:tr(rj,e),setTexts:tr(oj,e)})).overrideEditor(e=>{const{api:t,api:{nodes:n},editor:i,getOption:r,getOptions:a,tf:{addMark:o,escape:s,focus:l,selectAll:c,setNodes:u,setSelection:d,toggleMark:f}}=e;return{api:{nodes:e=>!e?.at&&r("isSelectingSome")?t.blockSelection.getNodes():n(e)},transforms:{addMark(t,n){lj(e,()=>{o(t,n)})},escape:()=>!!(()=>{const e=i.api.block({highest:!0});if(!e)return;const n=e[0].id;return n?(t.blockSelection.set(n),!0):void 0})()||s(),focus(){!i.meta._forceFocus&&r("isSelectingSome")||l()},selectAll:()=>{if(a().disableSelectAll)return c();return!!(()=>{const e=i.api.block({highest:!0});if(!e)return;const[,n]=e;return i.api.isAt({block:!0,end:!0,start:!0})?(t.blockSelection.selectAll(),!0):i.api.isAt({block:!0})?(i.tf.select(n),!0):(t.blockSelection.selectAll(),!0)})()||c()},setNodes(t,n){lj(e,()=>{u(t,n)})},setSelection(e){a().selectedIds.size>0&&!i.getOption(SI,"openId")&&t.blockSelection.deselect(),d(e)},toggleMark(t,n){lj(e,()=>{f(t,n)})}}}}),lj=({api:e,editor:t,getOption:n},i)=>{n("isSelectingSome")?t.tf.withoutNormalizing(()=>{const n=t.getApi(sj).blockSelection.getNodes();t.tf.select(t.api.nodesRange(n)),i(),e.blockSelection.set(n.map(([e])=>e.id))}):i()},cj=aF(mI,function(e){const{width:t}=e.element,n=Ux(),i=MA(sj,"isSelectionAreaVisible"),{isDragging:r,nodeRef:o,previewRef:s,handleRef:l}=XN({element:e.element,orientation:"horizontal",type:"column",canDropNode:({dragEntry:e,dropEntry:t})=>jd.equals(jd.parent(e[1]),jd.parent(t[1]))});/* @__PURE__ */
111
+ return(new Date).getTime()-i},i=/* @__PURE__ */(new Date).getTime())}).call(e)}),hN=/* @__PURE__ */r((e,t)=>{for(var n=pN(),i="undefined"==typeof window?global:window,r=["moz","webkit"],a="AnimationFrame",o=i["request"+a],s=i["cancel"+a]||i["cancelRequest"+a],l=0;!o&&l<r.length;l++)o=i[r[l]+"Request"+a],s=i[r[l]+"Cancel"+a]||i[r[l]+"CancelRequest"+a];if(!o||!s){var c=0,u=0,d=[],f=1e3/60;o=function(e){if(0===d.length){var t=n(),i=Math.max(0,f-(t-c));c=i+t,setTimeout(function(){var e=d.slice(0);d.length=0;for(var t=0;t<e.length;t++)if(!e[t].cancelled)try{e[t].callback(c)}catch(jE){setTimeout(function(){throw jE},0)}},Math.round(i))}return d.push({handle:++u,callback:e,cancelled:!1}),u},s=function(e){for(var t=0;t<d.length;t++)d[t].handle===e&&(d[t].cancelled=!0)}}t.exports=function(e){return o.call(i,e)},t.exports.cancel=function(){s.apply(i,arguments)},t.exports.polyfill=function(e){e||(e=i),e.requestAnimationFrame=o,e.cancelAnimationFrame=s}});var mN=ne({dragDropManager:void 0});function gN(e,t,...n){if("undefined"!=typeof process&&"production"===process.env.NODE_ENV&&void 0===t)throw new Error("invariant requires an error message argument");if(!e){let e;if(void 0===t)e=/* @__PURE__ */new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{let i=0;e=new Error(t.replace(/%s/g,function(){return n[i++]})),e.name="Invariant Violation"}throw e.framesToPop=1,e}}var yN=/* @__PURE__ */r((e,t)=>{t.exports=function e(t,n){if(t===n)return!0;if(t&&n&&"object"==typeof t&&"object"==typeof n){if(t.constructor!==n.constructor)return!1;var i,r,a;if(Array.isArray(t)){if((i=t.length)!=n.length)return!1;for(r=i;0!==r--;)if(!e(t[r],n[r]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if((i=(a=Object.keys(t)).length)!==Object.keys(n).length)return!1;for(r=i;0!==r--;)if(!Object.prototype.hasOwnProperty.call(n,a[r]))return!1;for(r=i;0!==r--;){var o=a[r];if(!e(t[o],n[o]))return!1}return!0}return t!=t&&n!=n}}),vN=/* @__PURE__ */n(yN(),1),kN="undefined"!=typeof window?pe:de;function bN(e,t,n){const[i,r]=function(e,t,n){const[i,r]=ye(()=>t(e)),a=le(()=>{const a=t(e);(0,vN.default)(i,a)||(r(a),n&&n())},[i,e,n]);return kN(a),[i,a]}(e,t,n);return kN(function(){const t=e.getHandlerId();if(null!=t)return e.subscribeToStateChange(r,{handlerIds:[t]})},[e,r]),i}function wN(e,t,n){return bN(t,e||(()=>({})),()=>n.reconnect())}function _N(e,t){const n=[...t||[]];return null==t&&"function"!=typeof e&&n.push(e),he(()=>"function"==typeof e?e():e,n)}function xN(e){return he(()=>e.hooks.dragSource(),[e])}function CN(e){return he(()=>e.hooks.dragPreview(),[e])}var EN=!1,DN=!1,SN=class{receiveHandlerId(e){this.sourceId=e}getHandlerId(){return this.sourceId}canDrag(){gN(!EN,"You may not call monitor.canDrag() inside your canDrag() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor");try{return EN=!0,this.internalMonitor.canDragSource(this.sourceId)}finally{EN=!1}}isDragging(){if(!this.sourceId)return!1;gN(!DN,"You may not call monitor.isDragging() inside your isDragging() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor");try{return DN=!0,this.internalMonitor.isDraggingSource(this.sourceId)}finally{DN=!1}}subscribeToStateChange(e,t){return this.internalMonitor.subscribeToStateChange(e,t)}isDraggingSource(e){return this.internalMonitor.isDraggingSource(e)}isOverTarget(e,t){return this.internalMonitor.isOverTarget(e,t)}getTargetIds(){return this.internalMonitor.getTargetIds()}isSourcePublic(){return this.internalMonitor.isSourcePublic()}getSourceId(){return this.internalMonitor.getSourceId()}subscribeToOffsetChange(e){return this.internalMonitor.subscribeToOffsetChange(e)}canDragSource(e){return this.internalMonitor.canDragSource(e)}canDropOnTarget(e){return this.internalMonitor.canDropOnTarget(e)}getItemType(){return this.internalMonitor.getItemType()}getItem(){return this.internalMonitor.getItem()}getDropResult(){return this.internalMonitor.getDropResult()}didDrop(){return this.internalMonitor.didDrop()}getInitialClientOffset(){return this.internalMonitor.getInitialClientOffset()}getInitialSourceClientOffset(){return this.internalMonitor.getInitialSourceClientOffset()}getSourceClientOffset(){return this.internalMonitor.getSourceClientOffset()}getClientOffset(){return this.internalMonitor.getClientOffset()}getDifferenceFromInitialOffset(){return this.internalMonitor.getDifferenceFromInitialOffset()}constructor(e){this.sourceId=null,this.internalMonitor=e.getMonitor()}},AN=!1,FN=class{receiveHandlerId(e){this.targetId=e}getHandlerId(){return this.targetId}subscribeToStateChange(e,t){return this.internalMonitor.subscribeToStateChange(e,t)}canDrop(){if(!this.targetId)return!1;gN(!AN,"You may not call monitor.canDrop() inside your canDrop() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target-monitor");try{return AN=!0,this.internalMonitor.canDropOnTarget(this.targetId)}finally{AN=!1}}isOver(e){return!!this.targetId&&this.internalMonitor.isOverTarget(this.targetId,e)}getItemType(){return this.internalMonitor.getItemType()}getItem(){return this.internalMonitor.getItem()}getDropResult(){return this.internalMonitor.getDropResult()}didDrop(){return this.internalMonitor.didDrop()}getInitialClientOffset(){return this.internalMonitor.getInitialClientOffset()}getInitialSourceClientOffset(){return this.internalMonitor.getInitialSourceClientOffset()}getSourceClientOffset(){return this.internalMonitor.getSourceClientOffset()}getClientOffset(){return this.internalMonitor.getClientOffset()}getDifferenceFromInitialOffset(){return this.internalMonitor.getDifferenceFromInitialOffset()}constructor(e){this.targetId=null,this.internalMonitor=e.getMonitor()}};function zN(e,t,n,i){let r=n?n.call(i,e,t):void 0;if(void 0!==r)return!!r;if(e===t)return!0;if("object"!=typeof e||!e||"object"!=typeof t||!t)return!1;const a=Object.keys(e),o=Object.keys(t);if(a.length!==o.length)return!1;const s=Object.prototype.hasOwnProperty.bind(t);for(let l=0;l<a.length;l++){const o=a[l];if(!s(o))return!1;const c=e[o],u=t[o];if(r=n?n.call(i,c,u,o):void 0,!1===r||void 0===r&&c!==u)return!1}return!0}function BN(e){return null!==e&&"object"==typeof e&&Object.prototype.hasOwnProperty.call(e,"current")}function TN(e){return(t=null,n=null)=>{if(!ae(t)){const i=t;return e(i,n),i}const i=t;return function(e){if("string"==typeof e.type)return;const t=e.type.displayName||e.type.name||"the component";throw new Error(`Only native element nodes can now be passed to React DnD connectors.You can either wrap ${t} into a <div>, or turn it into a drag source or a drop target itself.`)}(i),function(e,t){const n=e.ref;return gN("string"!=typeof n,"Cannot connect React DnD to an element with an existing string ref. Please convert it to use a callback ref instead, or wrap it into a <span> or <div>. Read more: https://reactjs.org/docs/refs-and-the-dom.html#callback-refs"),te(e,n?{ref:e=>{PN(n,e),PN(t,e)}}:{ref:t})}(i,n?t=>e(t,n):e)}}function ON(e){const t={};return Object.keys(e).forEach(n=>{const i=e[n];if(n.endsWith("Ref"))t[n]=e[n];else{const e=TN(i);t[n]=()=>e}}),t}function PN(e,t){"function"==typeof e?e(t):e.current=t}var NN=class{receiveHandlerId(e){this.handlerId!==e&&(this.handlerId=e,this.reconnect())}get connectTarget(){return this.dragSource}get dragSourceOptions(){return this.dragSourceOptionsInternal}set dragSourceOptions(e){this.dragSourceOptionsInternal=e}get dragPreviewOptions(){return this.dragPreviewOptionsInternal}set dragPreviewOptions(e){this.dragPreviewOptionsInternal=e}reconnect(){const e=this.reconnectDragSource();this.reconnectDragPreview(e)}reconnectDragSource(){const e=this.dragSource,t=this.didHandlerIdChange()||this.didConnectedDragSourceChange()||this.didDragSourceOptionsChange();return t&&this.disconnectDragSource(),this.handlerId?e?(t&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDragSource=e,this.lastConnectedDragSourceOptions=this.dragSourceOptions,this.dragSourceUnsubscribe=this.backend.connectDragSource(this.handlerId,e,this.dragSourceOptions)),t):(this.lastConnectedDragSource=e,t):t}reconnectDragPreview(e=!1){const t=this.dragPreview,n=e||this.didHandlerIdChange()||this.didConnectedDragPreviewChange()||this.didDragPreviewOptionsChange();n&&this.disconnectDragPreview(),this.handlerId&&(t?n&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDragPreview=t,this.lastConnectedDragPreviewOptions=this.dragPreviewOptions,this.dragPreviewUnsubscribe=this.backend.connectDragPreview(this.handlerId,t,this.dragPreviewOptions)):this.lastConnectedDragPreview=t)}didHandlerIdChange(){return this.lastConnectedHandlerId!==this.handlerId}didConnectedDragSourceChange(){return this.lastConnectedDragSource!==this.dragSource}didConnectedDragPreviewChange(){return this.lastConnectedDragPreview!==this.dragPreview}didDragSourceOptionsChange(){return!zN(this.lastConnectedDragSourceOptions,this.dragSourceOptions)}didDragPreviewOptionsChange(){return!zN(this.lastConnectedDragPreviewOptions,this.dragPreviewOptions)}disconnectDragSource(){this.dragSourceUnsubscribe&&(this.dragSourceUnsubscribe(),this.dragSourceUnsubscribe=void 0)}disconnectDragPreview(){this.dragPreviewUnsubscribe&&(this.dragPreviewUnsubscribe(),this.dragPreviewUnsubscribe=void 0,this.dragPreviewNode=null,this.dragPreviewRef=null)}get dragSource(){return this.dragSourceNode||this.dragSourceRef&&this.dragSourceRef.current}get dragPreview(){return this.dragPreviewNode||this.dragPreviewRef&&this.dragPreviewRef.current}clearDragSource(){this.dragSourceNode=null,this.dragSourceRef=null}clearDragPreview(){this.dragPreviewNode=null,this.dragPreviewRef=null}constructor(e){this.hooks=ON({dragSource:(e,t)=>{this.clearDragSource(),this.dragSourceOptions=t||null,BN(e)?this.dragSourceRef=e:this.dragSourceNode=e,this.reconnectDragSource()},dragPreview:(e,t)=>{this.clearDragPreview(),this.dragPreviewOptions=t||null,BN(e)?this.dragPreviewRef=e:this.dragPreviewNode=e,this.reconnectDragPreview()}}),this.handlerId=null,this.dragSourceRef=null,this.dragSourceOptionsInternal=null,this.dragPreviewRef=null,this.dragPreviewOptionsInternal=null,this.lastConnectedHandlerId=null,this.lastConnectedDragSource=null,this.lastConnectedDragSourceOptions=null,this.lastConnectedDragPreview=null,this.lastConnectedDragPreviewOptions=null,this.backend=e}},IN=class{get connectTarget(){return this.dropTarget}reconnect(){const e=this.didHandlerIdChange()||this.didDropTargetChange()||this.didOptionsChange();e&&this.disconnectDropTarget();const t=this.dropTarget;this.handlerId&&(t?e&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDropTarget=t,this.lastConnectedDropTargetOptions=this.dropTargetOptions,this.unsubscribeDropTarget=this.backend.connectDropTarget(this.handlerId,t,this.dropTargetOptions)):this.lastConnectedDropTarget=t)}receiveHandlerId(e){e!==this.handlerId&&(this.handlerId=e,this.reconnect())}get dropTargetOptions(){return this.dropTargetOptionsInternal}set dropTargetOptions(e){this.dropTargetOptionsInternal=e}didHandlerIdChange(){return this.lastConnectedHandlerId!==this.handlerId}didDropTargetChange(){return this.lastConnectedDropTarget!==this.dropTarget}didOptionsChange(){return!zN(this.lastConnectedDropTargetOptions,this.dropTargetOptions)}disconnectDropTarget(){this.unsubscribeDropTarget&&(this.unsubscribeDropTarget(),this.unsubscribeDropTarget=void 0)}get dropTarget(){return this.dropTargetNode||this.dropTargetRef&&this.dropTargetRef.current}clearDropTarget(){this.dropTargetRef=null,this.dropTargetNode=null}constructor(e){this.hooks=ON({dropTarget:(e,t)=>{this.clearDropTarget(),this.dropTargetOptions=t,BN(e)?this.dropTargetRef=e:this.dropTargetNode=e,this.reconnect()}}),this.handlerId=null,this.dropTargetRef=null,this.dropTargetOptionsInternal=null,this.lastConnectedHandlerId=null,this.lastConnectedDropTarget=null,this.lastConnectedDropTargetOptions=null,this.backend=e}};function jN(){const{dragDropManager:e}=ce(mN);return gN(null!=e,"Expected drag drop context"),e}var RN=class{beginDrag(){const e=this.spec,t=this.monitor;let n=null;return n="object"==typeof e.item?e.item:"function"==typeof e.item?e.item(t):{},null!=n?n:null}canDrag(){const e=this.spec,t=this.monitor;return"boolean"==typeof e.canDrag?e.canDrag:"function"!=typeof e.canDrag||e.canDrag(t)}isDragging(e,t){const n=this.spec,i=this.monitor,{isDragging:r}=n;return r?r(i):t===e.getSourceId()}endDrag(){const e=this.spec,t=this.monitor,n=this.connector,{end:i}=e;i&&i(t.getItem(),t),n.reconnect()}constructor(e,t,n){this.spec=e,this.monitor=t,this.connector=n}};function MN(e,t,n){const i=jN(),r=function(e,t,n){const i=he(()=>new RN(e,t,n),[t,n]);return de(()=>{i.spec=e},[e]),i}(e,t,n),a=function(e){return he(()=>{const t=e.type;return gN(null!=t,"spec.type must be defined"),t},[e])}(e);kN(function(){if(null!=a){const[e,o]=function(e,t,n){const i=n.getRegistry(),r=i.addSource(e,t);return[r,()=>i.removeSource(r)]}(a,r,i);return t.receiveHandlerId(e),n.receiveHandlerId(e),o}},[i,t,n,r,a])}function LN(e,t){const n=_N(e,t);gN(!n.begin,"useDrag::spec.begin was deprecated in v14. Replace spec.begin() with spec.item(). (see more here - https://react-dnd.github.io/react-dnd/docs/api/use-drag)");const i=function(){const e=jN();return he(()=>new SN(e),[e])}(),r=function(e,t){const n=jN(),i=he(()=>new NN(n.getBackend()),[n]);return kN(()=>(i.dragSourceOptions=e||null,i.reconnect(),()=>i.disconnectDragSource()),[i,e]),kN(()=>(i.dragPreviewOptions=t||null,i.reconnect(),()=>i.disconnectDragPreview()),[i,t]),i}(n.options,n.previewOptions);return MN(n,i,r),[wN(n.collect,i,r),xN(r),CN(r)]}function VN(e){return he(()=>e.hooks.dropTarget(),[e])}var qN=class{canDrop(){const e=this.spec,t=this.monitor;return!e.canDrop||e.canDrop(t.getItem(),t)}hover(){const e=this.spec,t=this.monitor;e.hover&&e.hover(t.getItem(),t)}drop(){const e=this.spec,t=this.monitor;if(e.drop)return e.drop(t.getItem(),t)}constructor(e,t){this.spec=e,this.monitor=t}};function WN(e,t,n){const i=jN(),r=function(e,t){const n=he(()=>new qN(e,t),[t]);return de(()=>{n.spec=e},[e]),n}(e,t),a=function(e){const{accept:t}=e;return he(()=>(gN(null!=e.accept,"accept must be defined"),Array.isArray(t)?t:[t]),[t])}(e);kN(function(){const[e,o]=function(e,t,n){const i=n.getRegistry(),r=i.addTarget(e,t);return[r,()=>i.removeTarget(r)]}(a,r,i);return t.receiveHandlerId(e),n.receiveHandlerId(e),o},[i,t,r,n,a.map(e=>e.toString()).join("|")])}function HN(e,t){const n=_N(e,t),i=function(){const e=jN();return he(()=>new FN(e),[e])}(),r=function(e){const t=jN(),n=he(()=>new IN(t.getBackend()),[t]);return kN(()=>(n.dropTargetOptions=e||null,n.reconnect(),()=>n.disconnectDropTarget()),[e]),n}(n.options);return WN(n,i,r),[wN(n.collect,i,r),VN(r)]}var UN=/* @__PURE__ */n(hN(),1);function $N(e){const t=En(22),{containerRef:n,enabled:i,height:r,minStrength:a,placement:o,scrollAreaProps:s,strengthMultiplier:l,zIndex:c}=e,u=void 0===i||i,d=void 0===r?100:r,f=void 0===a?.15:a,p=void 0===l?25:l,h=void 0===c?1e4:c,m=X.useRef(void 0),g=X.useRef(0),y=X.useRef(null),v="top"===o?-1:1,k=s?.style;let b,w;t[0]!==d||t[1]!==o||t[2]!==k||t[3]!==h?(b={height:d,opacity:0,position:"fixed",width:"100%",zIndex:h,...k},"top"===o?b.top=0:"bottom"===o&&(b.bottom=0),t[0]=d,t[1]=o,t[2]=k,t[3]=h,t[4]=b):b=t[4],t[5]===Symbol.for("react.memo_cache_sentinel")?(w=()=>{g.current=0,y.current&&(UN.default.cancel(y.current),y.current=null)},t[5]=w):w=t[5];const _=w;let x;t[6]!==n||t[7]!==v||t[8]!==p?(x=()=>{const e=()=>{const t=g.current;0!==p&&0!==t?((n?.current??window).scrollBy(0,t*p*v),y.current=(0,UN.default)(e)):_()};e()},t[6]=n,t[7]=v,t[8]=p,t[9]=x):x=t[9];const C=x,E=X.useRef(void 0);let D,S,A;t[10]!==v||t[11]!==f||t[12]!==C?(S=()=>{E.current=(0,t_.default)(e=>{const t=m.current;if(!t)return;const{height:n,top:i}=t.getBoundingClientRect(),r=(e=>"touchmove"===e.type?{x:e.changedTouches[0].clientX,y:e.changedTouches[0].clientY}:{x:e.clientX,y:e.clientY})(e),a=Math.max(Math.max(r.y-i,0)/n,f);g.current=-1===v?1-a:a,!y.current&&g.current&&C()},100,{trailing:!1})},D=[v,f,C],t[10]=v,t[11]=f,t[12]=C,t[13]=D,t[14]=S):(D=t[13],S=t[14]),X.useEffect(S,D),t[15]===Symbol.for("react.memo_cache_sentinel")?(A=e=>{E.current?.(e)},t[15]=A):A=t[15];const F=A;let z,B,T;return t[16]!==u?(z=()=>{u||_()},B=[u],t[16]=u,t[17]=z,t[18]=B):(z=t[17],B=t[18]),X.useEffect(z,B),u?(t[19]!==s||t[20]!==b?(T=/* @__PURE__ */X.createElement("div",{ref:m,style:b,onDragEnd:_,onDragLeave:_,onDragOver:F,onTouchMove:F,...s}),t[19]=s,t[20]=b,t[21]=T):T=t[21],T):null}function KN(e){const t=En(2);let n;return t[0]!==e?(n=/* @__PURE__ */X.createElement(X.Fragment,null,/* @__PURE__ */X.createElement($N,{placement:"top",...e}),/* @__PURE__ */X.createElement($N,{placement:"bottom",...e})),t[0]=e,t[1]=n):n=t[1],n}function GN(e){const t=En(8),n=MA(QN,"isDragging"),[i,r]=X.useState(!1);let a,o;t[0]!==n?(a=()=>{if(n){const e=setTimeout(()=>{r(!0)},100);return()=>clearTimeout(e)}r(!1)},t[0]=n,t[1]=a):a=t[1],t[2]!==n||t[3]!==i?(o=[n,i],t[2]=n,t[3]=i,t[4]=o):o=t[4],X.useEffect(a,o);const s=n&&i;let l;return t[5]!==e||t[6]!==s?(l=/* @__PURE__ */X.createElement(KN,{enabled:s,...e}),t[5]=e,t[6]=s,t[7]=l):l=t[7],l}var JN="block",QN=pS({key:kw.dnd,editOnly:!0,handlers:{onDragEnd:({editor:e,plugin:t})=>{e.setOption(t,"isDragging",!1),e.setOption(t,"dropTarget",{id:null,line:""})},onDragEnter:({editor:e,plugin:t})=>{e.setOption(t,"_isOver",!0)},onDragStart:({editor:e,event:t,plugin:n})=>{const i=t.target,r=t.dataTransfer;r.effectAllowed="move",r.dropEffect="move";const a=i.dataset.blockId;a&&(e.setOption(n,"draggingId",a),e.setOption(n,"isDragging",!0),e.setOption(n,"_isOver",!0))},onDrop:({getOptions:e})=>e().isDragging,onFocus:({editor:e,plugin:t})=>{e.setOption(t,"isDragging",!1),e.setOption(t,"dropTarget",{id:null,line:""}),e.setOption(t,"_isOver",!1),e.getOption(t,"multiplePreviewRef")?.current?.replaceChildren()}},options:{_isOver:!1,draggingId:null,dropTarget:{id:null,line:""},isDragging:!1,multiplePreviewRef:null},useHooks:({editor:e,setOption:t})=>{const n=le(n=>{if(n.target instanceof Node){const i=e.api.toDOMNode(e);if(!i)return;const r=n.target instanceof HTMLElement?n.target:n.target.parentElement,a=n.relatedTarget,o=a instanceof HTMLElement?a:a instanceof Node?a.parentElement:null,s=r?.closest("[data-block-id]"),l=o?.closest("[data-block-id]"),c=!(n.target===i||i.contains(n.target)),u=!!s&&!l&&(!a||a instanceof Node&&i.contains(a));(c||u)&&t("dropTarget",void 0)}},[e,t]),i=le(()=>{t("_isOver",!1),t("dropTarget",void 0)},[t]);de(()=>(document.addEventListener("dragleave",n,!0),document.addEventListener("drop",i,!0),()=>{document.removeEventListener("dragleave",n,!0),document.removeEventListener("drop",i,!0)}),[n,i])}}).extend(({getOptions:e})=>({render:{afterEditable:e().enableScroller?()=>/* @__PURE__ */X.createElement(GN,e()?.scrollerProps):void 0}})),XN=e=>{const{orientation:t="vertical",type:n=JN,onDropHandler:i}=e,r=PA(),a=X.useRef(null),o=X.useRef(null);if(!r.plugins.dnd)return{};const{dragRef:s,isAboutToDrag:l,isDragging:c}=iI({multiplePreviewRef:o,nodeRef:a,orientation:t,type:n,onDropHandler:i,...e});return{isAboutToDrag:l,isDragging:c,nodeRef:a,previewRef:o,handleRef:s}},YN=e=>{const t=En(5);let n;t[0]!==e?(n=void 0===e?{}:e,t[0]=e,t[1]=n):n=t[1];const{id:i,orientation:r}=n,a=void 0===r?"vertical":r,o=VA(),s=i||o.id,l=LA(QN,e=>{const{dropTarget:t}=e;return t?t.id!==s?null:t.line:null})??"";if(a&&("vertical"===a&&("left"===l||"right"===l)||"horizontal"===a&&("top"===l||"bottom"===l))){let e;return t[2]===Symbol.for("react.memo_cache_sentinel")?(e={dropLine:""},t[2]=e):e=t[2],e}let c;return t[3]!==l?(c={dropLine:l},t[3]=l,t[4]=c):c=t[4],c},ZN=()=>"undefined"!=typeof document&&"undefined"!=typeof window,eI=e=>e,tI=(e,{canDropNode:t,dragItem:n,element:i,monitor:r,nodeRef:a,orientation:o="vertical"})=>{const s=(({dragItem:e,element:t,monitor:n,nodeRef:i,orientation:r="vertical"})=>{if(!i.current)return;if(t===e.element)return;const a=e;if((Array.isArray(a.id)?a.id:[a.id]).includes(t.id))return;const o=i.current?.getBoundingClientRect();if(!o)return;const s=n.getClientOffset();if(s){if("vertical"!==r){const e=(o.right-o.left)/2;return s.x-o.left<e?"left":"right"}{const e=(o.bottom-o.top)/2,t=s.y-o.top;if(t<e)return"top";if(t>=e)return"bottom"}}})({dragItem:n,element:i,monitor:r,nodeRef:a,orientation:o});if(!s)return;let l,c,u;if("element"in n){let t;if(n.editorId===e.id&&(t=e.api.findPath(n.element),!t))return;const r=e.api.findPath(i);if(!r)return;l=t&&[n.element,t],c=[i,r]}else c=e.api.node({id:i.id,at:[]});if(!c)return;if(t&&!t({dragEntry:l,dragItem:n,dropEntry:c,editor:e})||!r.canDrop())return;const d=l?.[1],f=c[1];if(("bottom"===s||"right"===s)&&(u=f,d&&jd.equals(d,jd.next(u))))return;if(("top"===s||"left"===s)&&(u=[...f.slice(0,-1),f.at(-1)-1],d&&jd.equals(d,u)))return;const p=u;return{direction:s,dragPath:d,to:d&&jd.isBefore(d,p)&&jd.isSibling(d,p)?p:jd.next(p)}},nI=(e,{canDropNode:t,element:n,nodeRef:i,orientation:r,onDropHandler:a,...o})=>{const s=n.id;return ZN()?HN({collect:e=>({isOver:e.isOver({shallow:!0})}),drop:(o,l)=>{if(!o.id){const a=tI(e,{canDropNode:t,dragItem:o,element:n,monitor:l,nodeRef:i,orientation:r}),c=e.getOptions(QN).onDropFiles;if(!a||!c)return;return c({id:s,dragItem:o,editor:e,monitor:l,nodeRef:i,target:a.to})}a&&a(e,{id:s,dragItem:o,monitor:l,nodeRef:i})||((e,{canDropNode:t,dragItem:n,element:i,monitor:r,nodeRef:a,orientation:o="vertical"})=>{const s=tI(e,{canDropNode:t,dragItem:n,element:i,monitor:r,nodeRef:a,orientation:o});if(!s)return;const{dragPath:l,to:c}=s;if(n.editorId===e.id){const t=Array.isArray(n.id)?n.id:[n.id];if(t.length>1){const n=[];t.forEach(t=>{const i=e.api.node({id:t,at:[]});i&&n.push(i[0])}),e.tf.moveNodes({at:[],to:c,match:e=>n.some(t=>t.id===e.id)})}else e.tf.moveNodes({at:l,to:c})}else{const t=n.editor;if(t){const i=(Array.isArray(n.id)?n.id:n.id?[n.id]:[]).map(e=>t.api.node({id:e,at:[]})).filter(e=>!!e),r=i.map(([e])=>e);e.tf.insertNodes(r,{at:c}),i.map(([,e])=>e).sort((e,t)=>jd.compare(t,e)).forEach(e=>{t.tf.removeNodes({at:e})})}else e.tf.insertNodes([n.element],{at:c})}})(e,{canDropNode:t,dragItem:o,element:n,monitor:l,nodeRef:i,orientation:r})},hover(a,o){((e,{canDropNode:t,dragItem:n,element:i,monitor:r,nodeRef:a,orientation:o="vertical"})=>{const{_isOver:s,dropTarget:l}=e.getOptions(QN),c=l?.id??null,u=l?.line??"",d=tI(e,{canDropNode:t,dragItem:n,element:i,monitor:r,nodeRef:a,orientation:o});if(!d)return void((c||u)&&e.setOption(QN,"dropTarget",{id:null,line:""}));const{direction:f}=d,p={id:i.id,line:f};if(p.id!==c||p.line!==u){if(!s)return;if("top"===p.line){const t=jd.previous(e.api.findPath(i));if(!t)return e.setOption(QN,"dropTarget",p);const n=Ld.get(e,t);return void e.setOption(QN,"dropTarget",{id:n?.id,line:"bottom"})}e.setOption(QN,"dropTarget",p)}f&&e.api.isExpanded()&&(e.tf.focus(),e.tf.collapse())})(e,{canDropNode:t,dragItem:a,element:n,monitor:o,nodeRef:i,orientation:r})},...o}):[{isOver:!1},eI]},iI=({canDropNode:e,drag:t,drop:n,element:i,multiplePreviewRef:r,nodeRef:a,orientation:o="vertical",preview:s={},type:l=JN,onDropHandler:c})=>{const u=PA();if(!ZN())return{dragRef:eI,isAboutToDrag:!1,isDragging:!1,isOver:!1};const[{isAboutToDrag:d,isDragging:f},p,h]=((e,{element:t,item:n,...i})=>{const r=t.id,[a,o]=X.useState(!1);if(!ZN())return[{isAboutToDrag:!1,isDragging:!1},eI,eI];const[s,l,c]=LN(()=>({canDrag:()=>(o(!0),!0),collect:e=>({isDragging:e.isDragging()}),end:()=>{e.setOption(QN,"isDragging",!1),document.body.classList.remove("dragging"),o(!1)},item(t){e.setOption(QN,"isDragging",!0),e.setOption(QN,"_isOver",!0),document.body.classList.add("dragging");const i="function"==typeof n?n(t):n,[a]=e.api.node({id:r,at:[]}),o=e.getOption(QN,"draggingId");let s;return Array.isArray(o)&&o.length>1&&o.includes(r)?s=Array.from(o):(s=r,e.setOption(QN,"draggingId",r)),{id:s,editor:e,editorId:e.id,element:a,...i}},...i}),[e,r]);return X.useEffect(()=>{!s.isDragging&&a&&o(!1)},[s.isDragging,a]),[{...s,isAboutToDrag:a},l,c]})(u,{element:i,type:l,...t}),[{isOver:m},g]=nI(u,{accept:[l,"__NATIVE_FILE__"],canDropNode:e,element:i,multiplePreviewRef:r,nodeRef:a,orientation:o,onDropHandler:c,...n});return g(a),s.disable?h((oN||((oN=new Image).src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="),oN),{captureDraggingState:!0}):s.ref?h(s.ref):h(r),{dragRef:p,isAboutToDrag:d,isDragging:f,isOver:m}},rI=(e,{columns:t=2,select:n,...i}={})=>{const r=100/t;e.tf.withoutNormalizing(()=>{if(e.tf.insertNodes({children:new Array(t).fill(null).map(()=>({children:[e.api.create.block()],type:e.getType(kw.column),width:`${r}%`})),type:e.getType(kw.columnGroup)},i),n){const t=e.api.node({at:i.at,match:{type:e.getType(kw.column)}});if(!t)return;e.tf.select(t[1].concat([0]))}})},aI=({columns:e=2}={})=>new Array(e).fill(null).map(()=>100/e+"%"),oI=(e,{at:t,columns:n,widths:i})=>{e.tf.withoutNormalizing(()=>{if(!t)return;if(0===(i=i??aI({columns:n})).length)return;const r=e.api.node(t);if(!r)return;const[{children:a},o]=r,s=a.length,l=i.length;if(s!==l){if(l>s){const t=l-s,n=o.concat([s]),r=new Array(t).fill(null).map((t,n)=>({children:[e.api.create.block()],type:e.getType(kw.column),width:i[s+n]||100/l+"%"}));return e.tf.insertNodes(r,{at:n}),void i.forEach((t,n)=>{e.tf.setNodes({width:t},{at:o.concat([n])})})}if(l<s){const t=l-1,n=o.concat([t]),r=Ld.get(e,n);if(!r)return;const a=n.concat([r.children.length]);for(let i=s-1;i>t;i--){const t=o.concat([i]),n=e.api.node(t);n&&e.tf.moveNodes({at:n[1],children:!0,to:a})}for(let i=s-1;i>t;i--)e.tf.removeNodes({at:o.concat([i])});i.forEach((t,n)=>{e.tf.setNodes({width:t},{at:o.concat([n])})})}}else i.forEach((t,n)=>{e.tf.setNodes({width:t},{at:o.concat([n])})})})},sI=(e,t)=>"string"==typeof e?t*Number.parseFloat(e)/100:e,lI=(e,{max:t,min:n})=>{let i=e;return void 0!==n&&(i=Math.max(i,n)),void 0!==t&&(i=Math.min(i,t)),i},{ResizeHandleProvider:cI,useResizeHandleSet:uI,useResizeHandleStore:dI,useResizeHandleValue:fI}=OE({onResize:null},{name:"resizeHandle",suppressWarnings:!0}),pI=e=>{const t=En(21),{direction:n,initialSize:i,onHover:r,onHoverEnd:a,onMouseDown:o,onResize:s,onTouchStart:l}=e,c=void 0===n?"left":n,u=Ux(),d=fI("onResize"),f=s??d,[p,h]=X.useState(!1),[m,g]=X.useState(0),[y,v]=X.useState(0),k=i??y,b="left"===c||"right"===c;let w,_,x;return t[0]!==c||t[1]!==m||t[2]!==k||t[3]!==b||t[4]!==p||t[5]!==a||t[6]!==f?(w=()=>{if(!p)return;const e=(e,t)=>{const{clientX:n,clientY:i}=(e=>"touches"in e)(e)?e.touches[0]||e.changedTouches[0]:e;f({delta:(b?n:i)-m,direction:c,finished:t,initialSize:k})},t=t=>e(t,!1),n=t=>{h(!1),a?.(),e(t,!0)};return window.addEventListener("mousemove",t),window.addEventListener("mouseup",n),window.addEventListener("touchmove",t),window.addEventListener("touchend",n),()=>{window.removeEventListener("mousemove",t),window.removeEventListener("mouseup",n),window.removeEventListener("touchmove",t),window.removeEventListener("touchend",n)}},_=[p,m,k,f,b,a,c],t[0]=c,t[1]=m,t[2]=k,t[3]=b,t[4]=p,t[5]=a,t[6]=f,t[7]=w,t[8]=_):(w=t[7],_=t[8]),X.useEffect(w,_),t[9]!==c||t[10]!==m||t[11]!==k||t[12]!==b||t[13]!==p||t[14]!==r||t[15]!==a||t[16]!==o||t[17]!==f||t[18]!==l||t[19]!==u?(x={direction:c,initialPosition:m,initialSize:k,isHorizontal:b,isResizing:p,readOnly:u,setInitialPosition:g,setInitialSize:v,setIsResizing:h,onHover:r,onHoverEnd:a,onMouseDown:o,onResize:f,onTouchStart:l},t[9]=c,t[10]=m,t[11]=k,t[12]=b,t[13]=p,t[14]=r,t[15]=a,t[16]=o,t[17]=f,t[18]=l,t[19]=u,t[20]=x):x=t[20],x},hI=({isHorizontal:e,isResizing:t,readOnly:n,setInitialPosition:i,setInitialSize:r,setIsResizing:a,onHover:o,onHoverEnd:s,onMouseDown:l,onTouchStart:c})=>{const u=()=>{o?.()},d=()=>{t||s?.()};return{hidden:n,props:{onMouseDown:t=>{const{clientX:n,clientY:o}=t;i(e?n:o);const s=t.target.parentElement;r(e?s.offsetWidth:s.offsetHeight),a(!0),l?.(t)},onMouseOut:d,onMouseOver:u,onTouchEnd:d,onTouchMove:u,onTouchStart:t=>{const{touches:n}=t,{clientX:o,clientY:s}=n[0];i(e?o:s);const l=t.target.parentElement;r(e?l.offsetWidth:l.offsetHeight),a(!0),c?.(t)}}}},{ResizableProvider:mI,resizableStore:gI,useResizableSet:yI,useResizableStore:vI,useResizableValue:kI}=(hD("div")({propsHook:hI,stateHook:pI}),OE({width:0},{name:"resizable"})),bI=e=>{const t=En(19),{align:n,maxWidth:i,minWidth:r,setNodeWidth:a,setWidth:o,width:s}=e,l=X.useRef(null);let c;t[0]!==n||t[1]!==i||t[2]!==r||t[3]!==a||t[4]!==o?(c=e=>{const{delta:t,direction:s,finished:c,initialSize:u}=e,d=l.current.offsetWidth,f=((e,t,{max:n,min:i})=>{const r=lI(sI(e,t),{max:void 0===n?void 0:sI(n,t),min:void 0===i?void 0:sI(i,t)});switch(typeof e){case"number":return r;case"string":return((e,t)=>"number"==typeof e?e/t*100+"%":e)(r,t);default:throw new Error("Invalid length type")}})(u+t*(("center"===n?2:1)*("left"===s?-1:1)),d,{max:i,min:r});c?a(f):o(f)},t[0]=n,t[1]=i,t[2]=r,t[3]=a,t[4]=o,t[5]=c):c=t[5];const u=c;let d,f;t[6]!==u?(d={onResize:u},t[6]=u,t[7]=d):d=t[7],t[8]!==i||t[9]!==r||t[10]!==s?(f={maxWidth:i,minWidth:r,position:"relative",width:s},t[8]=i,t[9]=r,t[10]=s,t[11]=f):f=t[11];const p=f;let h,m,g,y;return t[12]!==p?(h={style:p},t[12]=p,t[13]=h):h=t[13],t[14]===Symbol.for("react.memo_cache_sentinel")?(m={position:"relative"},t[14]=m):m=t[14],t[15]===Symbol.for("react.memo_cache_sentinel")?(g={style:m},t[15]=g):g=t[15],t[16]!==d||t[17]!==h?(y={context:d,props:h,wrapperProps:g,wrapperRef:l},t[16]=d,t[17]=h,t[18]=y):y=t[18],y},wI=X.forwardRef((e,t)=>{const n=En(16);let i,r,a;n[0]!==e?(({children:i,options:r,...a}=e),n[0]=e,n[1]=i,n[2]=r,n[3]=a):(i=n[1],r=n[2],a=n[3]);const{context:o,props:s,wrapperProps:l,wrapperRef:c}=bI((e=>{const t=En(17);let n;t[0]!==e?(n=void 0===e?{}:e,t[0]=e,t[1]=n):n=t[1];const{align:i,maxWidth:r,minWidth:a}=n,o=void 0===i?"center":i,s=void 0===r?"100%":r,l=void 0===a?92:a,c=PA(),u=VA(),d=WA(),f=u?.width??"100%",p=kI("width"),h=yI("width");let m;t[2]!==c||t[3]!==f||t[4]!==d?(m=e=>{e===f?c.tf.select(d):c.tf.setNodes({width:e},{at:d})},t[2]=c,t[3]=f,t[4]=d,t[5]=m):m=t[5];const g=m;let y,v,k;return t[6]!==f||t[7]!==h?(y=()=>{h(f)},v=[f,h],t[6]=f,t[7]=h,t[8]=y,t[9]=v):(y=t[8],v=t[9]),X.useEffect(y,v),t[10]!==o||t[11]!==s||t[12]!==l||t[13]!==g||t[14]!==h||t[15]!==p?(k={align:o,maxWidth:s,minWidth:l,setNodeWidth:g,setWidth:h,width:p},t[10]=o,t[11]=s,t[12]=l,t[13]=g,t[14]=h,t[15]=p,t[16]=k):k=t[16],k})(r));let u,d,f;return n[4]!==i||n[5]!==o.onResize?(u=/* @__PURE__ */X.createElement(cI,{onResize:o.onResize},i),n[4]=i,n[5]=o.onResize,n[6]=u):u=n[6],n[7]!==s||n[8]!==t||n[9]!==a||n[10]!==u?(d=/* @__PURE__ */X.createElement("div",{ref:t,...s,...a},u),n[7]=s,n[8]=t,n[9]=a,n[10]=u,n[11]=d):d=n[11],n[12]!==d||n[13]!==l||n[14]!==c?(f=/* @__PURE__ */X.createElement("div",{ref:c,...l},d),n[12]=d,n[13]=l,n[14]=c,n[15]=f):f=n[15],f});wI.displayName="Resizable";var _I=e=>e.map(e=>e.dataset.blockId).filter(Boolean),xI=e=>{const t=e.getOption({key:kw.blockSelection},"isSelectingSome");return e.api.isExpanded()||t},CI=/* @__PURE__ */r((e,t)=>{t.exports=function(){var e=document.getSelection();if(!e.rangeCount)return function(){};for(var t=document.activeElement,n=[],i=0;i<e.rangeCount;i++)n.push(e.getRangeAt(i));switch(t.tagName.toUpperCase()){case"INPUT":case"TEXTAREA":t.blur();break;default:t=null}return e.removeAllRanges(),function(){"Caret"===e.type&&e.removeAllRanges(),e.rangeCount||n.forEach(function(t){e.addRange(t)}),t&&t.focus()}}}),EI=/* @__PURE__ */r((e,t)=>{var n=CI(),i={"text/plain":"Text","text/html":"Url",default:"Text"};t.exports=function(e,t){var r,a,o,s,l,c=!1;t||(t={}),t.debug;try{if(a=n(),o=document.createRange(),s=document.getSelection(),(l=document.createElement("span")).textContent=e,l.ariaHidden="true",l.style.all="unset",l.style.position="fixed",l.style.top=0,l.style.clip="rect(0, 0, 0, 0)",l.style.whiteSpace="pre",l.style.webkitUserSelect="text",l.style.MozUserSelect="text",l.style.msUserSelect="text",l.style.userSelect="text",l.addEventListener("copy",function(n){if(n.stopPropagation(),t.format)if(n.preventDefault(),void 0===n.clipboardData){window.clipboardData.clearData();var r=i[t.format]||i.default;window.clipboardData.setData(r,e)}else n.clipboardData.clearData(),n.clipboardData.setData(t.format,e);t.onCopy&&(n.preventDefault(),t.onCopy(n.clipboardData))}),document.body.appendChild(l),o.selectNodeContents(l),s.addRange(o),!document.execCommand("copy"))throw new Error("copy command was unsuccessful");c=!0}catch(u){try{window.clipboardData.setData(t.format||"text",e),t.onCopy&&t.onCopy(window.clipboardData),c=!0}catch(u){r=function(e){var t=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return e.replace(/#{\s*key\s*}/g,t)}("message"in t?t.message:"Copy to clipboard: #{key}, Enter"),window.prompt(r,e)}}finally{s&&("function"==typeof s.removeRange?s.removeRange(o):s.removeAllRanges()),l&&document.body.removeChild(l),a()}return c}}),DI=/* @__PURE__ */n(EI(),1),SI=pS({key:kw.blockMenu,editOnly:!0,options:{openId:null,position:{x:-1e4,y:-1e4}}}).extendApi(({setOption:e,setOptions:t})=>({hide:()=>{t({openId:null,position:{x:-1e4,y:-1e4}})},show:(n,i)=>{i?t({openId:n,position:i}):e("openId",n)}})).extendApi(({api:e,editor:t})=>({showContextMenu:(n,i)=>{t.getApi({key:kw.blockSelection}).blockSelection?.set(n),e.blockMenu.show("context",i)}})).extend(({api:e})=>({handlers:{onMouseDown:({event:t,getOptions:n})=>{0===t.button&&n().openId&&(t.preventDefault(),e.blockMenu.hide()),2===t.button&&t.preventDefault()}}})),AI=(e,t)=>{const n=e.getApi(sj).blockSelection.getNodes(),i=e.api.node(t);if(!i)return;const[r,a]=i,o=(n.length>0?n:e.api.blocks({mode:"lowest",match:(e,t)=>t.length===a.length})).map(e=>e[0].id);e.getApi(sj).blockSelection.set(o.includes(r.id)?o:[r.id])},FI=(e,{disabledWhenFocused:t=!0,element:n,event:i})=>{const{enableContextMenu:r,selectedIds:a}=e.getOptions(sj);if(!r)return;if(e.selection?.focus&&t){const t=e.api.above(),r=e.api.findPath(n);if(t&&r&&jd.isCommon(r,t[1])){const n=t[0].id,r=e.getOption(sj,"isSelected",n),a="true"===i.target.dataset?.plateOpenContextMenu;if(!r&&!e.api.isVoid(t[0])&&!a)return i.stopPropagation()}}const o=n.id;o&&(i?.shiftKey?e.getApi(sj).blockSelection.add(o):a?.has(o)||e.setOption(sj,"selectedIds",/* @__PURE__ */new Set([o])))},zI=e=>{const{id:t}=VA();return MA(sj,"isSelected",e??t)},BI=e=>({api:t})=>{t.cursorOverlay.removeCursor(e)},TI=(pS({key:kw.cursorOverlay,editOnly:{render:!1},options:{cursors:{}}}).extendApi(({editor:e,plugin:t})=>({addCursor:(n,i)=>{const r={...e.getOptions(t).cursors};r[n]={id:n,...i},e.setOption(t,"cursors",r)},removeCursor:n=>{const i={...e.getOptions(t).cursors};i[n]&&(delete i[n],e.setOption(t,"cursors",i))}})).overrideEditor(({api:e,editor:t,getOptions:n,tf:{setSelection:i}})=>({transforms:{setSelection(r){n().cursors?.selection&&setTimeout(()=>{e.cursorOverlay.addCursor("selection",{selection:t.selection})},0),i(r)}}})).extend(()=>({handlers:{onBlur:({api:e,editor:t,event:n})=>{t.selection&&"true"===n.relatedTarget?.dataset?.plateFocus&&e.cursorOverlay.addCursor("selection",{selection:t.selection})},onDragEnd:BI("drag"),onDragLeave:BI("drag"),onDragOver:({api:e,editor:t,event:n})=>{if(!t.plugins.dnd||t.getOptions({key:kw.dnd}).isDragging)return;if((n.dataTransfer?.types||[]).some(e=>e.startsWith("Files")))return;const i=t.api.findEventRange(n);i&&e.cursorOverlay.addCursor("drag",{selection:i})},onDrop:BI("drag"),onFocus:BI("selection")},useHooks:({api:e,setOption:t})=>{const n=MA(sj,"isSelecting");de(()=>{n&&setTimeout(()=>{e.cursorOverlay.removeCursor("selection")},0)},[n,t,e.cursorOverlay])}})),Object.freeze([]),class{_listeners=/* @__PURE__ */new Map;emit=this.dispatchEvent;off=this.removeEventListener;on=this.addEventListener;addEventListener(e,t){const n=this._listeners.get(e)??/* @__PURE__ */new Set;return this._listeners.set(e,n),n.add(t),this}dispatchEvent(e,...t){let n=!0;for(const i of this._listeners.get(e)??[])n=!1!==i(...t)&&n;return n}removeEventListener(e,t){return this._listeners.get(e)?.delete(t),this}unbindAllListeners(){this._listeners.clear()}}),OI=(e,t="px")=>"number"==typeof e?e+t:e;function PI({style:e},t,n){if("object"==typeof t)for(const[i,r]of Object.entries(t))void 0!==r&&(e[i]=OI(r));else void 0!==n&&(e[t]=OI(n))}var NI=e=>(t,n,i,r={})=>{let a,o;a=t instanceof HTMLCollection||t instanceof NodeList?Array.from(t):Array.isArray(t)?t:[t],o=Array.isArray(n)?n:[n];for(const s of a)if(s)for(const t of o)s[e](t,i,{capture:!1,...r});return[a,o,i,r]},II=NI("addEventListener"),jI=NI("removeEventListener"),RI=e=>{const{clientX:t,clientY:n,target:i}=e.touches?.[0]??e;return{target:i,x:t,y:n}};function MI(e,t,n,i){const r=i.getBoundingClientRect(),a=i.scrollLeft,o=i.scrollTop;return e.right>=t.left-r.left&&e.left+r.left<=t.right+a&&e.bottom-o>=t.top-r.top&&e.top<=t.bottom-r.top+o}function LI(e,t=document){const n=Array.isArray(e)?e:[e];let i=[];for(let r=0,a=n.length;r<a;r++){const e=n[r];"string"==typeof e?i=i.concat(Array.from(t.querySelectorAll(e))):e instanceof Element&&i.push(e)}return i}var{abs:VI,ceil:qI,max:WI,min:HI}=Math,UI=class extends TI{_area;_areaClientLocation={x1:0,x2:0,y1:0,y2:0};_areaLocation={x1:0,x2:0,y1:0,y2:0};_areaRect=new DOMRect;_container;_containerRect;_frame;_initScrollDelta={x:0,y:0};_latestElement;_options;_scrollAvailable=!0;_scrollDelta={x:0,y:0};_scrollingActive=!1;_scrollSpeed={x:0,y:0};_selectables=[];_selection={changed:{added:[],removed:[]},selected:[],stored:[],touched:[]};_singleClick=!0;wheelTimer=null;disable=this._bindStartEvents.bind(this,!1);enable=this._bindStartEvents;constructor(e){super(),this._options={boundaries:["html"],container:"body",document:window.document,selectables:[],selectionAreaClass:"selection-area",startAreas:["html"],...e,behaviour:{intersect:"touch",overlap:"invert",triggers:[0],...e.behaviour,scrolling:{manualSpeed:750,speedDivider:.7,...e.behaviour?.scrolling,startScrollMargins:{x:20,y:40,...e.behaviour?.scrolling?.startScrollMargins}},startThreshold:e.behaviour?.startThreshold?"number"==typeof e.behaviour.startThreshold?e.behaviour.startThreshold:{x:4,y:4,...e.behaviour.startThreshold}:{x:4,y:4}},features:{range:!0,touch:!0,...e.features,singleTap:{allow:!0,intersect:"native",...e.features?.singleTap}}};for(const i of Object.getOwnPropertyNames(Object.getPrototypeOf(this)))"function"==typeof this[i]&&(this[i]=this[i].bind(this));const{document:t,selectionAreaClass:n}=this._options;this._area=t.createElement("div"),this._area.classList.add(n),PI(this._area,{left:0,position:"absolute",top:0,willChange:"top, left, bottom, right, width, height"}),this._frame=(e=>{let t,n=-1,i=!1;return{cancel(){cancelAnimationFrame(n),i=!1},next(...r){t=r,i||(i=!0,n=requestAnimationFrame(()=>{e(...t),i=!1}))}}})(e=>{this._recalculateSelectionAreaRect(),this._updateElementSelection(),this._emitEvent("move",e),this._redrawSelectionArea()}),this.enable()}_bindStartEvents(e=!0){const{document:t,features:n}=this._options,i=e?II:jI;i(t,"mousedown",this._onTapStart),n.touch&&i(t,"touchstart",this._onTapStart,{passive:!1})}_delayedTapMove(e){const{behaviour:{startThreshold:t},document:n}=this._options,{x1:i,y1:r}=this._areaLocation,{x1:a,y1:o}=this._areaClientLocation,{x:s,y:l}=RI(e);if("number"==typeof t&&VI(s+l-(a+o))>=t||"object"==typeof t&&VI(s-i)>=t.x||VI(l-r)>=t.y){if(jI(n,["mousemove","touchmove"],this._delayedTapMove,{passive:!1}),!1===this._emitEvent("beforedrag",e))return void jI(n,["mouseup","touchcancel","touchend"],this._onTapStop);II(n,["mousemove","touchmove"],this._onTapMove,{passive:!1}),PI(this._area,"display","block"),this._container.append(this._area),this.resolveSelectables(),this._singleClick=!1,II(this._container,"wheel",this._manualScroll,{passive:!0}),this._setupSelectionArea(),this._emitEvent("start",e),this._onTapMove(e)}this._handleMoveEvent(e)}_emitEvent(e,t){return this.emit(e,{event:t,selection:this,store:this._selection})}_handleMoveEvent(e){const{features:t}=this._options;(t.touch&&matchMedia("(hover: none), (pointer: coarse)").matches||this._scrollAvailable&&"safari"in window)&&e.preventDefault()}_keepSelection(){const{_options:e,_selection:t}=this,{changed:n,selected:i,stored:r,touched:a}=t,o=i.filter(e=>!r.includes(e));switch(e.behaviour.overlap){case"drop":t.stored=[...o,...r.filter(e=>!a.includes(e))];break;case"invert":t.stored=[...o,...r.filter(e=>!n.removed.includes(e))];break;case"keep":t.stored=[...r,...i.filter(e=>!r.includes(e))]}}_manualScroll(e){this.wheelTimer&&clearTimeout(this.wheelTimer);const{x:t,y:n}=RI(e);this.wheelTimer=setTimeout(()=>{this._areaClientLocation.x2=t,this._areaClientLocation.y2=n;const e=n-this._containerRect.top,i=t-this._containerRect.left;this._areaLocation.x2=i+this._container.scrollLeft,this._areaLocation.y2=e+this._container.scrollTop,this._frame.next(null)},100)}_onScroll(e){const{document:t}=this._options;this.wheelTimer&&clearTimeout(this.wheelTimer);const{x:n,y:i}=RI(e);this.wheelTimer=setTimeout(()=>{this._areaClientLocation.x2=n,this._areaClientLocation.y2=i;const e=i-this._containerRect.top+this._container.scrollTop+t.scrollingElement.scrollTop-this._initScrollDelta.y,r=n-this._containerRect.left+this._container.scrollLeft+t.scrollingElement.scrollLeft;this._scrollDelta.y=t.scrollingElement.scrollTop-this._initScrollDelta.y,this._scrollDelta.x=t.scrollingElement.scrollLeft-this._initScrollDelta.x,this._areaLocation.y2=e,this._areaLocation.x2=r,this._frame.next(null)},100)}_onSingleTap(e){const{range:t,singleTap:{intersect:n}}=this._options.features,i=RI(e);let r;if("native"===n)r=i.target;else if("touch"===n){this.resolveSelectables();const{x:e,y:t}=i;r=this._selectables.find(n=>{const{bottom:i,left:r,right:a,top:o}=n.getBoundingClientRect();return e<a&&e>r&&t<i&&t>o})}if(!r)return;for(this.resolveSelectables();!this._selectables.includes(r);){if(!r.parentElement)return;r=r.parentElement}const{stored:a}=this._selection;if(this._emitEvent("start",e),e.shiftKey&&t&&this._latestElement){const e=this._latestElement,[t,n]=4&e.compareDocumentPosition(r)?[r,e]:[e,r],i=[...this._selectables.filter(e=>4&e.compareDocumentPosition(t)&&2&e.compareDocumentPosition(n)),t,n];this.select(i),this._latestElement=e}else a.includes(r)&&(1===a.length||e.ctrlKey||a.every(e=>this._selection.stored.includes(e)))?this.deselect(r):(this.select(r),this._latestElement=r)}_onTapMove(e){const{x:t,y:n}=RI(e),{_areaClientLocation:i,_areaLocation:r,_frame:a,_options:o,_scrollSpeed:s}=this,{speedDivider:l}=o.behaviour.scrolling,c=n-this._containerRect.top,u=t-this._containerRect.left;if(this._scrollAvailable&&!this._scrollingActive&&(s.y||s.x)){this._scrollingActive=!0;const t=()=>{s.x||s.y?(s.y&&(this._container.scrollTop+=qI(s.y/l),r.y2=c),s.x&&(this._container.scrollLeft+=qI(s.x/l),r.x2=u),a.next(e),requestAnimationFrame(t)):this._scrollingActive=!1};requestAnimationFrame(t)}else r.x2=u+this._container.scrollLeft+this._scrollDelta.x,r.y2=c+this._container.scrollTop+this._scrollDelta.y,i.x2=t,i.y2=n,a.next(e);this._handleMoveEvent(e)}_onTapStart(e,t=!1){const{container:n,document:i}=this._options,{target:r,x:a,y:o}=RI(e);if(this._container=LI(n,i)[0],!this._container)return;if(this._container.contains(r)&&"true"!==r.dataset.slateEditor&&"true"!==r.dataset.plateSelectable)return;this._containerRect=this._container.getBoundingClientRect();const s=a-this._containerRect.left+this._container.scrollLeft,l=o-this._containerRect.top+this._container.scrollTop,{_options:c}=this;if(e instanceof MouseEvent&&!function(e,t){for(const n of t)if("number"!=typeof n){if("object"==typeof n){const t=n.button===e.button,i=n.modifiers.every(t=>{switch(t){case"alt":return e.altKey;case"ctrl":return e.ctrlKey||e.metaKey;case"shift":return e.shiftKey;default:return!1}});if(t&&i)return!0}}else if(e.button===n)return!0;return!1}(e,c.behaviour.triggers))return;const u=LI(c.startAreas,c.document),d=LI(c.boundaries,c.document),f=e.composedPath();if(!this._container||!u.find(e=>f.includes(e))||!d.find(e=>f.includes(e)))return;if(!t&&!1===this._emitEvent("beforestart",e))return;this._areaLocation={x1:s,x2:0,y1:l,y2:0},this._areaClientLocation={x1:a,x2:0,y1:o,y2:0};const p=i.scrollingElement??i.body;this._initScrollDelta={x:p.scrollLeft,y:p.scrollTop},this._singleClick=!0,this.clearSelection(!1,!0),II(i,["touchmove","mousemove"],this._delayedTapMove,{passive:!1}),II(i,["mouseup","touchcancel","touchend"],this._onTapStop),II(i,"wheel",this._onScroll,{passive:!1})}_onTapStop(e,t){const{document:n,features:i}=this._options,{_singleClick:r}=this;jI(n,["mousemove","touchmove"],this._delayedTapMove),jI(n,["touchmove","mousemove"],this._onTapMove),jI(n,["mouseup","touchcancel","touchend"],this._onTapStop),jI(n,"wheel",this._onScroll),this._keepSelection(),e&&r&&i.singleTap.allow?this._onSingleTap(e):r||t||(this._updateElementSelection(),this._emitEvent("stop",e)),this._scrollSpeed.x=0,this._scrollSpeed.y=0,this._scrollDelta.x=0,this._scrollDelta.y=0,jI(this._container,"wheel",this._manualScroll,{passive:!0}),this._area.remove(),this._frame?.cancel(),PI(this._area,"display","none")}_recalculateSelectionAreaRect(){const{_areaClientLocation:e,_areaLocation:t,_areaRect:n,_container:i,_containerRect:r,_scrollSpeed:a}=this,{clientHeight:o,clientWidth:s,scrollHeight:l,scrollLeft:c,scrollTop:u,scrollWidth:d}=i,{x1:f,y1:p}=t;let{x2:h,y2:m}=t;const{behaviour:{scrolling:{startScrollMargins:g}}}=this._options;e.x2+this._scrollDelta.x<r.left+g.x?(a.x=c?-VI(r.left-e.x2-this._scrollDelta.x):0,h=WI(h,this._container.scrollLeft)):e.x2+this._scrollDelta.x>r.right-g.x?(a.x=d-c-s?VI(r.left+this._container.clientWidth-e.x2-this._scrollDelta.x):0,h=s+c):a.x=0,e.y2+this._scrollDelta.y<r.top+g.y?(a.y=u?-VI(r.top-e.y2-this._scrollDelta.y+g.y):0,m=WI(m,this._container.scrollTop)):e.y2+this._scrollDelta.y>r.bottom-g.y?(a.y=l-u-o?VI(e.y2+this._scrollDelta.y-(r.top+this._container.clientHeight-g.y)):0,m=o+u):a.y=0;const y=HI(f,h),v=HI(p,m),k=WI(f,h),b=WI(p,m);n.x=y,n.y=v,n.width=k-y,n.height=b-v}_redrawSelectionArea(){const{height:e,width:t,x:n,y:i}=this._areaRect,{style:r}=this._area;r.left=`${n}px`,r.top=`${i}px`,r.width=`${t}px`,r.height=`${e}px`}_setupSelectionArea(){}_updateElementSelection(){const{_areaRect:e,_options:t,_selectables:n,_selection:i}=this,{selected:r,stored:a,touched:o}=i,{intersect:s,overlap:l}=t.behaviour,c="invert"===l,u=[],d=[],f=[];for(let h=0;h<n.length;h++){const t=n[h];if(MI(e,t.getBoundingClientRect(),0,this._container)){if(r.includes(t))a.includes(t)&&!o.includes(t)&&o.push(t);else{if(c&&a.includes(t)){f.push(t);continue}d.push(t)}u.push(t)}}c&&d.push(...a.filter(e=>!r.includes(e)));const p="keep"===l;for(let h=0;h<r.length;h++){const e=r[h];u.includes(e)||p&&a.includes(e)||f.push(e)}i.selected=u,i.changed={added:d,removed:f},this._latestElement=void 0}cancel(e=!1){this._onTapStop(null,!e)}clearSelection(e=!0,t=!1){const{changed:n,selected:i,stored:r}=this._selection;n.added=[],n.removed.push(...i,...e?r:[]),t||(this._emitEvent("move",null),this._emitEvent("stop",null)),this._selection={changed:{added:[],removed:[]},selected:[],stored:e?[]:r,touched:[]}}deselect(e,t=!1){const{changed:n,selected:i,stored:r}=this._selection,a=LI(e,this._options.document).filter(e=>i.includes(e)||r.includes(e));0!==a.length&&(this._selection.stored=r.filter(e=>!a.includes(e)),this._selection.selected=i.filter(e=>!a.includes(e)),this._selection.changed.added=[],this._selection.changed.removed.push(...a.filter(e=>!n.removed.includes(e))),this._latestElement=void 0,t||(this._emitEvent("move",null),this._emitEvent("stop",null)))}destroy(){this.cancel(),this.disable(),super.unbindAllListeners()}getSelection(){return this._selection.stored}getSelectionArea(){return this._area}resolveSelectables(){this._selectables=LI(this._options.selectables,this._options.document)}select(e,t=!1){const{changed:n,selected:i,stored:r}=this._selection,a=LI(e,this._options.document).filter(e=>!i.includes(e)&&!r.includes(e));return r.push(...a),i.push(...a),n.added.push(...a),n.removed=[],this._latestElement=void 0,t||(this._emitEvent("move",null),this._emitEvent("stop",null)),a}trigger(e,t=!0){this._onTapStart(e,t)}},$I=()=>{const{api:e,editor:t,getOption:n,getOptions:i,setOption:r}=jA(sj),{areaOptions:a}=i(),o=X.useRef({ids:/* @__PURE__ */new Set}),s=X.useRef({ids:/* @__PURE__ */new Set}),l=()=>{t.api.isFocused()&&t.tf.blur(),t.selection&&t.tf.deselect(),r("isSelectionAreaVisible",!0)};X.useEffect(()=>{const c=new UI({boundaries:`#${t.meta.uid}`,container:`#${t.meta.uid}`,document:window.document,selectables:`#${t.meta.uid} .slate-selectable`,selectionAreaClass:"slate-selection-area",...a}).on("beforestart",()=>{r("isSelecting",!1)}).on("start",({event:t})=>{l(),t?.shiftKey||(c.clearSelection(),e.blockSelection.clear())}).on("move",({store:{changed:e}})=>{i().isSelectionAreaVisible||l();(()=>{if(0===e.added.length&&0===e.removed.length)return;const n=new Set(i().selectedIds);_I(e.removed).forEach(e=>{n.delete(e),o.current.ids.delete(e)}),new Set(_I(e.added)).forEach(e=>{const i=t.api.block({at:[],match:t=>!!t.id&&t.id===e});if(i&&i[0].type!==kw.table)return 1===i[1].length?(n.add(e),void o.current.ids.add(e)):void(t.api.block({above:!0,at:i[1],match:e=>!!e.id&&o.current.ids.has(e.id)})||(n.add(e),o.current.ids.add(e)))}),r("selectedIds",n)})(),(()=>{const e=new Set(n("selectedIds")),i=Array.from(e),a=e=>t.api.block({at:[],match:t=>!!t.id&&t.id===e});i.every(e=>{const t=a(e);return!!t&&(t[1].length>=3||(e=>e.type===kw.table||e.type===kw.tr||e.type===kw.th)(t[0]))})?i.some(t=>{const n=a(t);return!(!n||n[0].type!==kw.table)&&(e.delete(t),s.current.ids.forEach(t=>{e.add(t)}),s.current.ids.clear(),!0)}):i.some(n=>{const i=a(n);if(!i||!(e=>e.type===kw.tr||e.type===kw.th)(i[0]))return!1;const r=t.api.block({above:!0,at:i[1]});if(!r)return!1;const o=r[0].children.map(e=>e.id);return e.add(r[0].id),o.forEach(t=>{e.has(t)&&(s.current.ids.add(t),e.delete(t))}),!0}),r("selectedIds",e)})()}).on("stop",()=>{o.current={ids:/* @__PURE__ */new Set},s.current={ids:/* @__PURE__ */new Set},r("isSelectionAreaVisible",!1)});return()=>c.destroy()},[])},KI=(e,t)=>{if(!t)return!1;const{selectedIds:n}=e.getOptions(sj),i=e.getApi(sj).blockSelection.getNodes({collapseTableRows:!0}),r=i.map(([e])=>e);if(0===i.length)return!1;let a="";const o=document.createElement("div");e.tf.withoutNormalizing(()=>{i.forEach(([,n])=>{e.tf.select({anchor:e.api.start(n),focus:e.api.end(n)});const i=e.api.isEmpty(n);if(i){const t=e.api.after(e.selection);e.tf.select({anchor:e.api.start(n),focus:t})}i||e.tf.setFragmentData(t),a+=i?"\n":`${t.getData("text/plain")}\n`;const r=document.createElement("div");r.innerHTML=i?"<p></p>":t.getData("text/html"),o.append(r)}),e.tf.deselect(),e.setOption(sj,"selectedIds",n)}),t.setData("text/plain",a),t.setData("text/html",o.innerHTML);const s=JSON.stringify(r),l=window.btoa(encodeURIComponent(s));return t.setData("application/x-slate-fragment",l),!0},GI=(e,t)=>{if(t)return KI(e,t);let n=!1;return(0,DI.default)(" ",{onCopy:t=>{n=KI(e,t)}})&&n},JI=e=>{const{setOption:t}=Kv(e,sj),n=/* @__PURE__ */new Set;e.operations.forEach(t=>{"insert_node"===t.type&&t.node.id&&e.api.isBlock(t.node)&&n.add(t.node.id)}),t("selectedIds",n)},QI=(e,t)=>{const{api:n,setOption:i}=hS(e,sj),r=n.blockSelection.getNodes();if(0!==r.length)if("up"===t){const[,t]=r[0],a=e.api.previous({at:t,from:"parent",match:n.blockSelection.isSelectable});if(a){const[e]=a;i("anchorId",e.id),n.blockSelection.set(e.id)}else n.blockSelection.set(r[0][0].id)}else{const[,t]=r.at(-1),a=e.api.next({at:t,from:"child",match:n.blockSelection.isSelectable});if(a){const[e]=a;i("anchorId",e.id),n.blockSelection.set(e.id)}else n.blockSelection.set(r.at(-1)[0].id)}},XI=(e,{added:t,ids:n,removed:i})=>{const{getOptions:r,setOption:a}=Kv(e,{key:kw.blockSelection});if(n&&a("selectedIds",new Set(n)),t||i){const{selectedIds:e}=r(),n=new Set(e);if(t)for(const i of _I(t))i&&n.add(i);if(i)for(const t of _I(i))t&&n.delete(t);a("selectedIds",n)}a("isSelecting",!0)},YI=(e,t,n={})=>{const{api:i,getOptions:r,setOption:a}=Kv(e,{key:kw.blockSelection}),{clear:o=!0,delay:s}=n,l=(e=>document.querySelector(`.slate-selectable[data-block-id="${e}"]`))(t);l&&(!r().selectedIds.has(t)&&o&&a("selectedIds",/* @__PURE__ */new Set),i.blockSelection.setSelectedIds({added:[l],removed:[]}),s&&setTimeout(()=>{i.blockSelection.setSelectedIds({added:[],removed:[l]})},s))},ZI=(e,t)=>{const{api:n,getOption:i,getOptions:r,setOption:a}=hS(e,sj),o=n.blockSelection.getNodes();if(0===o.length)return;const[s,l]=o[0],[c,u]=o.at(-1);let d=r().anchorId;d||(d="up"===t?c.id:s.id,a("anchorId",d));const f=o.findIndex(([e])=>e.id===d);if(-1===f)return void a("anchorId",c.id);const p=0===f,h=f===o.length-1,m=new Set(i("selectedIds"));if("down"===t)if(p){const t=e.api.next({at:u,mode:"highest",match:(e,t)=>n.blockSelection.isSelectable(e,t)&&!jd.isAncestor(t,u)});if(!t)return;const[i]=t;m.add(i.id)}else s.id&&s.id!==d&&m.delete(s.id);else if(h){const t=e.api.previous({at:l,from:"parent",match:n.blockSelection.isSelectable});if(!t)return;const[i,r]=t;jd.isAncestor(r,l)&&m.forEach(t=>{const n=e.api.node({id:t,at:r});n&&jd.isDescendant(n[1],r)&&(m.delete(t),t===d&&(d=i.id,a("anchorId",d)))}),m.add(i.id)}else c.id&&c.id!==d&&m.delete(c.id);m.add(d),a("selectedIds",m)},ej=e=>{const t=e.getApi(sj).blockSelection.getNodes(),n=t.at(-1);if(!n)return;e.tf.duplicateNodes({nodes:t});const i=jd.next(n[1]),r=t.map((t,n)=>{const r=[i[0]+n];return e.api.node(r)?.[0].id}).filter(Boolean);setTimeout(()=>{e.setOption(sj,"selectedIds",new Set(r))},0)},tj=(e,t,{at:n,insertedCallback:i})=>{e.tf.insertNodes(t,{at:n}),i?.();const r=[Ld.get(e,n)];let a=1;for(;a<t.length;){n=jd.next(n);const t=Ld.get(e,n);r.push(t),a++}setTimeout(()=>{e.setOption(sj,"selectedIds",new Set(r.map(e=>e.id)))},0)},nj=e=>{const t=e.getOption(sj,"selectedIds");t&&e.tf.removeNodes({at:[],block:!0,match:e=>!!e.id&&t.has(e.id)})},ij=e=>{e.tf.select(e.api.nodesRange(e.getApi(sj).blockSelection.getNodes())),e.getApi(sj).blockSelection.clear()},rj=(e,t,n)=>{e.tf.withoutNormalizing(()=>{e.getApi(sj).blockSelection.getNodes().forEach(([,i])=>{e.tf.setNodes(t,{...n,at:i})})})},aj=(e,t,n)=>{const i=e.getApi(sj);e.tf.withoutNormalizing(()=>{i.blockSelection.getNodes().forEach(([i,r])=>{const a=(i.indent??0)+t;e.tf.setNodes({indent:Math.max(a,0)},{...n,at:r})})})},oj=(e,t,n)=>{rj(e,t,{mode:"lowest",...n})},sj=pS({key:kw.blockSelection,editOnly:!0,handlers:{onMouseDown:({api:e,editor:t,event:n,getOptions:i})=>{const r=n.target;r.dataset.platePreventUnselect||r.dataset.platePreventDeselect||0===n.button&&i().selectedIds.size>0&&!t.getOption(SI,"openId")&&e.blockSelection.deselect()}},inject:{isBlock:!0,nodeProps:{transformProps:()=>(()=>{const e=En(6),t=VA(),n=WA();let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i={key:kw.blockSelection},e[0]=i):i=e[0];const{api:r,editor:a}=jA(i);let o;return e[1]!==r.blockSelection||e[2]!==a||e[3]!==t||e[4]!==n?(o={props:r.blockSelection?.isSelectable(t,n)?{className:"slate-selectable",onContextMenu:e=>FI(a,{element:t,event:e})}:{}},e[1]=r.blockSelection,e[2]=a,e[3]=t,e[4]=n,e[5]=o):o=e[5],o})().props}},options:{anchorId:null,areaOptions:{features:{singleTap:{allow:!1}}},enableContextMenu:!1,disableSelectAll:!1,isSelecting:!1,isSelectionAreaVisible:!1,selectedIds:/* @__PURE__ */new Set,shadowInputRef:{current:null},isSelectable:()=>!0},plugins:[SI],render:{afterEditable:()=>{const e=PA(),{api:t,getOption:n,getOptions:i,setOption:r}=jA({key:kw.blockSelection}),a=MA(sj,"isSelectingSome"),o=MA(sj,"selectedIds"),s=X.useCallback((n={})=>{const i=[...e.api.nodes({at:[],match:e=>!!e.id&&o?.has(e.id)})];if(0===i.length)return null;const a=i[0][1];return e.tf.withoutNormalizing(()=>{for(const[n,r]of[...i].reverse())e.tf.removeNodes({at:r}),t.blockSelection.delete(n.id);if(0===e.children.length)e.meta._forceFocus=!0,e.tf.focus(),e.meta._forceFocus=!1;else if(n.selectPrevious){const t=jd.previous(a);if(t){const n=e.api.block({at:t});n&&r("selectedIds",/* @__PURE__ */new Set([n[0].id]))}}}),a},[e,t.blockSelection,o,r]);$I();const l=X.useRef(null),[c,u]=X.useState(!1);X.useEffect(()=>(u(!0),r("shadowInputRef",l),()=>{u(!1)}),[r]),X.useEffect(()=>{a||r("anchorId",null)},[a,r]),X.useEffect(()=>{a&&l.current?l.current.focus({preventScroll:!0}):l.current&&l.current.blur()},[a]);const d=X.useCallback(r=>{const a=e.api.isReadOnly();if(i().onKeyDownSelecting?.(e,r.nativeEvent),n("isSelectingSome")){if((0,Ns.isHotkey)("shift+up")(r))return r.preventDefault(),r.stopPropagation(),void t.blockSelection.shiftSelection("up");if((0,Ns.isHotkey)("shift+down")(r))return r.preventDefault(),r.stopPropagation(),void t.blockSelection.shiftSelection("down");if((0,Ns.isHotkey)("escape")(r))t.blockSelection.deselect();else{if((0,Ns.isHotkey)("mod+z")(r))return e.undo(),void JI(e);if((0,Ns.isHotkey)("mod+a")(r))t.blockSelection.selectAll();else{if((0,Ns.isHotkey)("mod+shift+z")(r))return e.redo(),void JI(e);if((0,Ns.isHotkey)("mod+d")(r))return r.preventDefault(),void e.getTransforms(sj).blockSelection.duplicate();if(n("isSelectingSome")){if((0,Ns.isHotkey)("enter")(r)){const t=e.api.node({at:[],block:!0,match:e=>!!e.id&&o?.has(e.id)});if(t){const[,n]=t;e.meta._forceFocus=!0,e.tf.focus({at:n,edge:"end"}),e.meta._forceFocus=void 0,r.preventDefault()}return}if((0,Ns.isHotkey)(["backspace","delete"])(r)&&!a)return r.preventDefault(),void s({selectPrevious:(0,Ns.isHotkey)("backspace")(r)});if((0,Ns.isHotkey)("up")(r))return r.preventDefault(),r.stopPropagation(),void t.blockSelection.moveSelection("up");if((0,Ns.isHotkey)("down")(r))return r.preventDefault(),r.stopPropagation(),void t.blockSelection.moveSelection("down");if(!(a||1!==r.key.length||r.ctrlKey||r.metaKey||r.altKey)){r.preventDefault();const t=s();return void(t&&(e.meta._forceFocus=!0,e.tf.insertNodes(e.api.create.block({children:[{text:r.key}]}),{at:t}),e.tf.select(t,{edge:"end"}),e.meta._forceFocus=!1,e.tf.focus()))}}}}}},[e,i,n,t.blockSelection,s,o]),f=X.useCallback(t=>{n("isSelectingSome")&&GI(e,t.clipboardData)&&t.preventDefault()},[e,n]),p=X.useCallback(t=>{if(n("isSelectingSome")){const n=GI(e,t.clipboardData);n&&t.preventDefault(),n&&!e.api.isReadOnly()&&s()}},[e,n,s]),h=X.useCallback(t=>{t.preventDefault(),e.api.isReadOnly()||((e,t)=>{const{api:n}=Kv(e,sj),i=n.blockSelection.getNodes();if(i.length>0){const[n,r]=i.at(-1);if(!e.api.isEmpty(n)){const t=jd.next(r);e.tf.insertNodes(e.api.create.block({},t),{at:t,select:!0})}e.tf.insertData(t.clipboardData),JI(e)}})(e,t.nativeEvent)},[e]);return c&&"undefined"!=typeof window?hn.createPortal(/* @__PURE__ */X.createElement("input",{ref:l,className:"slate-shadow-input",style:{left:"-300px",opacity:0,position:"fixed",top:"-300px",zIndex:999},onCopy:f,onCut:p,onKeyDown:d,onPaste:h}),document.body):null}}}).extendSelectors(({getOptions:e})=>({isSelected:t=>!!t&&e().selectedIds.has(t),isSelectingSome:()=>e().selectedIds.size>0})).extendApi(({editor:e,getOption:t,getOptions:n,setOption:i})=>({addOnContextMenu:tr(FI,e),moveSelection:tr(QI,e),setSelectedIds:tr(XI,e),shiftSelection:tr(ZI,e),add:e=>{const t=new Set(n().selectedIds);if(Array.isArray(e))for(const n of e)t.add(n);else t.add(e);i("selectedIds",t)},clear:()=>{i("selectedIds",/* @__PURE__ */new Set)},delete:e=>{const t=new Set(n().selectedIds);if(Array.isArray(e))for(const n of e)t.delete(n);else t.delete(e);i("selectedIds",t)},deselect:()=>{i("selectedIds",/* @__PURE__ */new Set),i("isSelecting",!1)},first:()=>{const n=t("selectedIds");return n&&0!==n.size?e.api.node({at:[],match:e=>n.has(e.id)}):null},focus:()=>{const e=t("shadowInputRef");e?.current&&e.current.focus({preventScroll:!0})},getNodes:n=>{const i=t("selectedIds"),r=e.api.blocks({at:[],match:e=>!!e.id&&i?.has(e.id)});if(n?.sort&&r.sort(([,e],[,t])=>jd.compare(e,t)),n?.collapseTableRows){const t=[];return r.forEach(([n,i])=>{if(n.type===kw.tr){const r=jd.parent(i),a=e.api.node(r),o=t.findIndex(([e])=>e.type===a[0].type&&e.id===a[0].id);if(-1===o){const e={...a[0],children:[n]};t.push([e,a[1]])}else t[o][0].children.push(n);return}t.push([n,i])}),t}return 0===r.length&&n?.selectionFallback?e.api.blocks({mode:"highest"}):r},has:e=>Array.isArray(e)?e.every(e=>n().selectedIds.has(e)):n().selectedIds.has(e),isSelectable:(t,i)=>!!t.id&&e.api.isBlock(t)&&n().isSelectable(t,i),resetSelectedIds:()=>{i("selectedIds",/* @__PURE__ */new Set)},set:e=>{i("selectedIds",new Set(Array.isArray(e)?e:[e]))},unselect:()=>{i("selectedIds",/* @__PURE__ */new Set),i("isSelecting",!1)}})).extendApi(({api:e,editor:t,setOption:n})=>({addSelectedRow:tr(YI,t),selectAll:()=>{const t=e.blocks({at:[],mode:"highest",match:(t,n)=>!!t.id&&e.blockSelection.isSelectable(t,n)}).map(e=>e[0].id);n("selectedIds",new Set(t)),e.blockSelection.focus()}})).extendTransforms(({editor:e})=>({duplicate:tr(ej,e),insertBlocksAndSelect:tr(tj,e),removeNodes:tr(nj,e),select:tr(ij,e),selectBlocks:tr(AI,e),setIndent:tr(aj,e),setNodes:tr(rj,e),setTexts:tr(oj,e)})).overrideEditor(e=>{const{api:t,api:{nodes:n},editor:i,getOption:r,getOptions:a,tf:{addMark:o,escape:s,focus:l,selectAll:c,setNodes:u,setSelection:d,toggleMark:f}}=e;return{api:{nodes:e=>!e?.at&&r("isSelectingSome")?t.blockSelection.getNodes():n(e)},transforms:{addMark(t,n){lj(e,()=>{o(t,n)})},escape:()=>!!(()=>{const e=i.api.block({highest:!0});if(!e)return;const n=e[0].id;return n?(t.blockSelection.set(n),!0):void 0})()||s(),focus(){!i.meta._forceFocus&&r("isSelectingSome")||l()},selectAll:()=>{if(a().disableSelectAll)return c();return!!(()=>{const e=i.api.block({highest:!0});if(!e)return;const[,n]=e;return i.api.isAt({block:!0,end:!0,start:!0})?(t.blockSelection.selectAll(),!0):i.api.isAt({block:!0})?(i.tf.select(n),!0):(t.blockSelection.selectAll(),!0)})()||c()},setNodes(t,n){lj(e,()=>{u(t,n)})},setSelection(e){a().selectedIds.size>0&&!i.getOption(SI,"openId")&&t.blockSelection.deselect(),d(e)},toggleMark(t,n){lj(e,()=>{f(t,n)})}}}}),lj=({api:e,editor:t,getOption:n},i)=>{n("isSelectingSome")?t.tf.withoutNormalizing(()=>{const n=t.getApi(sj).blockSelection.getNodes();t.tf.select(t.api.nodesRange(n)),i(),e.blockSelection.set(n.map(([e])=>e.id))}):i()},cj=aF(mI,function(e){const{width:t}=e.element,n=Ux(),i=MA(sj,"isSelectionAreaVisible"),{isDragging:r,nodeRef:o,previewRef:s,handleRef:l}=XN({element:e.element,orientation:"horizontal",type:"column",canDropNode:({dragEntry:e,dropEntry:t})=>!!e&&jd.equals(jd.parent(e[1]),jd.parent(t[1]))});/* @__PURE__ */
112
112
  return Ce("div",{className:"group/column relative",style:{width:t??"100%"},children:[!n&&!i&&/* @__PURE__ */xe("div",{ref:l,className:a("-translate-x-1/2 -translate-y-1/2 absolute top-2 left-1/2 z-50","pointer-events-auto flex items-center","opacity-0 transition-opacity group-hover/column:opacity-100"),children:/* @__PURE__ */xe(uj,{})}),/* @__PURE__ */xe(OS,{...e,ref:pD(e.ref,s,o),className:"h-full px-2 pt-2 group-first/column:pl-0 group-last/column:pr-0",children:/* @__PURE__ */Ce("div",{className:a("relative h-full border border-transparent p-1.5",!n&&"rounded-lg border-border border-dashed",r&&"opacity-50"),children:[e.children,!n&&!i&&/* @__PURE__ */xe(dj,{})]})})]})}),uj=Q.memo(function(){/* @__PURE__ */
113
113
  return xe(c,{children:/* @__PURE__ */Ce(u,{children:[/* @__PURE__ */xe(s,{asChild:!0,children:/* @__PURE__ */xe(b,{variant:"ghost",className:"!px-1 h-5",children:/* @__PURE__ */xe(ct,{className:"text-muted-foreground",onClick:e=>{e.stopPropagation(),e.preventDefault()}})})}),/* @__PURE__ */xe(l,{children:"Drag to move column"})]})})});function dj(){const{dropLine:e}=YN({orientation:"horizontal"});return e?/* @__PURE__ */xe("div",{className:a("slate-dropLine","absolute bg-brand/50","left"===e&&"group-first/column:-left-1 inset-y-0 left-[-10.5px] w-1","right"===e&&"group-last/column:-right-1 inset-y-0 right-[-11px] w-1")}):null}function fj({children:e}){const t=PA(),n=Ux(),i=VA(),{props:r}=sF({element:i}),a=gC(),o=RA(e=>e.api.isCollapsed(),[]),s=bS()&&!n&&a&&o,l=e=>{oI(t,{at:i,widths:e})};/* @__PURE__ */
114
114
  return Ce(G,{open:s,modal:!1,children:[/* @__PURE__ */xe($,{children:e}),/* @__PURE__ */xe(K,{className:"w-auto p-1",onOpenAutoFocus:e=>e.preventDefault(),align:"center",side:"top",sideOffset:10,children:/* @__PURE__ */Ce("div",{className:"box-content flex h-8 items-center",children:[
@@ -366,7 +366,7 @@ return Ce(OS,{...t,as:e?"th":"td",className:a("relative h-full overflow-visible
366
366
  /* @__PURE__ */xe("div",{className:"relative z-20 box-border h-full px-3 py-2",style:1===h?{minHeight:"var(--tableRowMinHeight, 0px)"}:void 0,children:t.children}),!n&&!c&&/* @__PURE__ */xe(sDe,{colIndex:d,rowIndex:p}),l&&/* @__PURE__ */xe("div",{className:AEe(),contentEditable:!1})]})}var sDe=Q.memo(function({colIndex:e,rowIndex:t}){const{clearResizePreview:n,disableMarginLeft:i,setResizePreview:r,startResize:a}=function(){const e=Q.useContext(GEe);if(!e)throw new Error("TableResizeContext is missing");return e}(),o=`right:${t}:${e}`,s=`bottom:${t}:${e}`,l=`left:${t}:${e}`;/* @__PURE__ */
367
367
  return Ce("div",{className:"group/resize pointer-events-none absolute inset-0 z-30 select-none",contentEditable:!1,suppressContentEditableWarning:!0,children:[
368
368
  /* @__PURE__ */xe("div",{className:"-top-2 -right-1 pointer-events-auto absolute z-40 h-[calc(100%_+_8px)] w-2 cursor-col-resize touch-none",onPointerEnter:n=>{r(n,{colIndex:e,direction:"right",handleKey:o,rowIndex:t})},onPointerLeave:()=>{n(o)},onPointerDown:n=>{a(n,{colIndex:e,direction:"right",handleKey:o,rowIndex:t})}}),
369
- /* @__PURE__ */xe("div",{className:"-bottom-1 pointer-events-auto absolute left-0 z-40 h-2 w-full cursor-row-resize touch-none",onPointerEnter:n=>{r(n,{colIndex:e,direction:"bottom",handleKey:s,rowIndex:t})},onPointerLeave:()=>{n(s)},onPointerDown:n=>{a(n,{colIndex:e,direction:"bottom",handleKey:s,rowIndex:t})}}),0===e&&!i&&/* @__PURE__ */xe("div",{className:"-left-1 pointer-events-auto absolute top-0 z-40 h-full w-2 cursor-col-resize touch-none",onPointerEnter:n=>{r(n,{colIndex:e,direction:"left",handleKey:l,rowIndex:t})},onPointerLeave:()=>{n(l)},onPointerDown:n=>{a(n,{colIndex:e,direction:"left",handleKey:l,rowIndex:t})}})]})});sDe.displayName="TableCellResizeControls";var lDe=[WCe.withComponent(QEe),LCe.withComponent(function({children:e,...t}){const{element:n}=t,i=Ux(),r=PA(),o=qA(([,e])=>e.at(-1),[],{key:kw.tr}),s=qA(([e])=>e.size,[],{key:kw.tr}),l=tEe("rowSizeOverrides").get?.(o)??s,c=MA(sj,"isSelectionAreaVisible"),u=!i&&!c,{isDragging:d,nodeRef:f,previewRef:p,handleRef:h}=XN({element:n,type:n.type,canDropNode:({dragEntry:e,dropEntry:t})=>jd.equals(jd.parent(e[1]),jd.parent(t[1])),onDropHandler:(e,{dragItem:t})=>{const n=t.element;n&&r.tf.select(n)}});/* @__PURE__ */
369
+ /* @__PURE__ */xe("div",{className:"-bottom-1 pointer-events-auto absolute left-0 z-40 h-2 w-full cursor-row-resize touch-none",onPointerEnter:n=>{r(n,{colIndex:e,direction:"bottom",handleKey:s,rowIndex:t})},onPointerLeave:()=>{n(s)},onPointerDown:n=>{a(n,{colIndex:e,direction:"bottom",handleKey:s,rowIndex:t})}}),0===e&&!i&&/* @__PURE__ */xe("div",{className:"-left-1 pointer-events-auto absolute top-0 z-40 h-full w-2 cursor-col-resize touch-none",onPointerEnter:n=>{r(n,{colIndex:e,direction:"left",handleKey:l,rowIndex:t})},onPointerLeave:()=>{n(l)},onPointerDown:n=>{a(n,{colIndex:e,direction:"left",handleKey:l,rowIndex:t})}})]})});sDe.displayName="TableCellResizeControls";var lDe=[WCe.withComponent(QEe),LCe.withComponent(function({children:e,...t}){const{element:n}=t,i=Ux(),r=PA(),o=qA(([,e])=>e.at(-1),[],{key:kw.tr}),s=qA(([e])=>e.size,[],{key:kw.tr}),l=tEe("rowSizeOverrides").get?.(o)??s,c=MA(sj,"isSelectionAreaVisible"),u=!i&&!c,{isDragging:d,nodeRef:f,previewRef:p,handleRef:h}=XN({element:n,type:n.type,canDropNode:({dragEntry:e,dropEntry:t})=>!!e&&jd.equals(jd.parent(e[1]),jd.parent(t[1])),onDropHandler:(e,{dragItem:t})=>{const n=t.element;n&&r.tf.select(n)}});/* @__PURE__ */
370
370
  return Ce(OS,{...t,ref:pD(t.ref,p,f),as:"tr",className:a("group/row",d&&"opacity-50"),style:{...t.style,"--tableRowMinHeight":l?`${l}px`:void 0},children:[u&&/* @__PURE__ */Ce("td",{className:"w-2 min-w-2 max-w-2 select-none p-0",contentEditable:!1,children:[/* @__PURE__ */xe(rDe,{dragRef:h}),/* @__PURE__ */xe(aDe,{})]}),e]})}),VCe.withComponent(oDe),qCe.withComponent(function(e){/* @__PURE__ */
371
371
  return xe(oDe,{...e,isHeader:!0})})],cDe=uS(pEe),uDe=(e,t)=>{const n=t?t.current:document.body;if(!n||!e)return 0;const i=n.getBoundingClientRect(),r=e.getBoundingClientRect(),a=n.scrollTop;return r.top+a-i.top},dDe={h1:1,h2:2,h3:3,h4:4,h5:5,h6:6},fDe=e=>{const t=e.getOptions(pEe);if(t.queryHeading)return t.queryHeading(e);const n=[],i=e.api.nodes({at:[],match:e=>hEe(e)});if(!i)return[];for(const[r,a]of i){const{type:e}=r,t=Ld.string(r),i=dDe[e],o=r.id;t&&n.push({id:o,depth:i,path:a,title:t,type:e})}return n};function pDe(e,t){return e[t.target.id]=t,e}var hDe=({containerRef:e,isObserve:t,rootMargin:n,topOffset:i})=>{const r=PA(),[a,o]=X.useState(e),s=X.useRef(!1),l=(a.current?.scrollHeight||0)>(a.current?.clientHeight||0);s.current=l;const c=X.useMemo(()=>{if("object"==typeof window)return l?a.current:window},[l]),[u,d]=X.useState(0),{activeId:f}=(e=>{const t=En(19),{editorContentRef:n,isObserve:i,isScroll:r,rootMargin:a,status:o}=e;let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s={},t[0]=s):s=t[0];const l=X.useRef(s),c=PA();let u;t[1]===Symbol.for("react.memo_cache_sentinel")?(u=[],t[1]=u):u=t[1];const d=RA(fDe,u),[f,p]=X.useState("");let h,m,g;return t[2]!==c||t[3]!==n||t[4]!==d||t[5]!==i||t[6]!==r||t[7]!==a?(h=()=>{const e=r?n.current:void 0,t=new IntersectionObserver(e=>{if(!i)return;l.current=e.reduce(pDe,l.current);const t=[];Object.keys(l.current).forEach(e=>{l.current[e].isIntersecting&&t.push(e)});const n=Object.keys(l.current).pop();t.length>0&&p(t[0]||n),l.current={}},{root:e,rootMargin:a});return d.forEach(e=>{const{path:n}=e,i=Ld.get(c,n);if(!i)return;const r=c.api.toDOMNode(i);r&&t.observe(r)}),()=>{t.disconnect()}},t[2]=c,t[3]=n,t[4]=d,t[5]=i,t[6]=r,t[7]=a,t[8]=h):h=t[8],t[9]!==c||t[10]!==n||t[11]!==d||t[12]!==i||t[13]!==r||t[14]!==a||t[15]!==o?(m=[d,i,c,n,r,a,o],t[9]=c,t[10]=n,t[11]=d,t[12]=i,t[13]=r,t[14]=a,t[15]=o,t[16]=m):m=t[16],X.useEffect(h,m),t[17]!==f?(g={activeId:f},t[17]=f,t[18]=g):g=t[18],g})({editorContentRef:a,isObserve:t,isScroll:l,rootMargin:n,status:u}),[p,h]=X.useState(f);return X.useEffect(()=>{o(e)},[e]),X.useEffect(()=>{h(f)},[f]),X.useEffect(()=>{if(!c)return;const e=()=>{t&&d(Date.now())};return c.addEventListener("scroll",e),()=>{c.removeEventListener("scroll",e)}},[t,c]),{activeContentId:p,onContentScroll:({behavior:e="instant",el:t,id:n,path:o})=>{if(h(n),s.current)a.current?.scrollTo({behavior:e,top:uDe(t,a)-i});else{const n=uDe(t)-i;window.scrollTo({behavior:e,top:n})}o&&r.tf.navigation.flashTarget({target:{path:o,type:"node"}})}}},mDe=o("block h-auto w-full cursor-pointer truncate rounded-none px-0.5 py-1.5 text-left font-medium underline decoration-[0.5px] underline-offset-4",{variants:{active:{false:"text-muted-foreground hover:bg-accent hover:text-foreground",true:"bg-accent text-foreground decoration-foreground"},depth:{1:"pl-0.5",2:"pl-[26px]",3:"pl-[50px]"}}});var gDe=[cDe.configure({options:{topOffset:80}}).withComponent(function(e){const t=(()=>{const e=En(13),{editor:t,getOptions:n}=jA(cDe);let i;e[0]!==n?(i=n(),e[0]=n,e[1]=i):i=e[1];const{topOffset:r}=i;let a;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=[],e[2]=a):a=e[2];const o=RA(fDe,a),s=TA();let l;e[3]!==s||e[4]!==r?(l={containerRef:s,isObserve:!0,rootMargin:"0px 0px 0px 0px",topOffset:r},e[3]=s,e[4]=r,e[5]=l):l=e[5];const{activeContentId:c,onContentScroll:u}=hDe(l);let d;e[6]!==u?(d=(e,t,n,i)=>{u({behavior:void 0===n?"instant":n,el:e,id:t,path:i})},e[6]=u,e[7]=d):d=e[7];const f=d;let p;return e[8]!==c||e[9]!==t||e[10]!==o||e[11]!==f?(p={activeContentId:c,editor:t,headingList:o,onContentScroll:f},e[8]=c,e[9]=t,e[10]=o,e[11]=f,e[12]=p):p=e[12],p})(),{props:n}=(({editor:e,onContentScroll:t})=>({props:{onClick:(n,i,r)=>{n.preventDefault();const{id:a,path:o}=i,s=Ld.get(e,o);if(!s)return;const l=e.api.toDOMNode(s);l&&t(l,a,r,o)}}}))(t),{activeContentId:i,headingList:r}=t;/* @__PURE__ */
372
372
  return Ce(OS,{...e,className:"mb-1 p-0",children:[/* @__PURE__ */xe("div",{contentEditable:!1,children:r.length>0?r.map(e=>/* @__PURE__ */xe(b,{variant:"ghost",className:mDe({active:e.id===i,depth:e.depth}),onClick:t=>n.onClick(t,e,"smooth"),"aria-current":e.id===i?"location":void 0,children:e.title},e.id)):/* @__PURE__ */xe("div",{className:"text-gray-500 text-sm",children:"Create a heading to display the table of contents."})}),e.children]})})],yDe=$v({key:kw.toggle,node:{isElement:!0},options:{openIds:/* @__PURE__ */new Set}}).extendSelectors(({getOptions:e})=>({isOpen:t=>e().openIds.has(t),someClosed:t=>{const{openIds:n}=e();return t.some(e=>!n.has(e))}})).extendApi(({setOptions:e})=>({toggleIds:(t,n=null)=>{e(e=>{t.forEach(t=>{const i=e.openIds.has(t);(null===n?!i:n)?e.openIds.add(t):e.openIds.delete(t)})})}})),vDe=/* @__PURE__ */n(tD(),1),kDe=e=>{const t=/* @__PURE__ */new Map;let n=[];return e.forEach(e=>{const i=e[kw.indent]||0,r=e.listStyleType&&e[kw.indent]?i-1:i,a=n.filter(([e,t])=>t<r);n=a,t.set(e.id,a.map(([e])=>e)),e.type===kw.toggle&&n.push([e.id,i])}),t},bDe=xA.atom.trackedEditor,wDe=VC(e=>kDe(e(bDe).editor.children)),_De=e=>{const t=En(2),{children:n,element:i}=e;if((e=>{const t=En(3),n=MA(SDe,"openIds");let i;t[0]!==e||t[1]!==n?(i=VC(t=>(t(wDe).get(e)||[]).every(e=>n.has(e))),t[0]=e,t[1]=n,t[2]=i):i=t[2];const r=i;return IE(FA(),r)})(i.id))return n;let r;return t[0]!==n?(r=/* @__PURE__ */X.createElement("div",{style:xDe},n),t[0]=n,t[1]=r):r=t[1],r},xDe={height:0,margin:0,overflow:"hidden",visibility:"hidden"};var CDe=(e,t)=>{const n=function(e,t){return e.getOptions(SDe).toggleIndex?.get(t)||[]}(e,t);return Kv(e,SDe).getOption("someClosed",n)},EDe=e=>{const{selection:t}=e;if(!t)return;const n=e.api.block();if(!n)return;if(!e.api.isAt({start:!0}))return;const i=e.api.before(t);if(!i)return;const r=e.api.block({at:i});if(!r)return;if(!CDe(e,r[0].id))return;const a=e.api.previous({match:t=>(e=>!!e&&"object"==typeof e&&!Array.isArray(e))(t)&&!CDe(e,t.id)});if(!a)return!1;const o=[a[1][0]+1];e.tf.moveNodes({at:n[1],to:o})},DDe=e=>{const{selection:t}=e;if(!t)return;const n=e.api.block();if(!n)return;if(!e.api.isAt({end:!0}))return;const i=e.api.after(t);if(!i)return;const r=e.api.block({at:i});if(!r)return;if(!CDe(e,r[0].id))return;const a=e.api.next({match:t=>(e=>!!e&&"object"==typeof e&&!Array.isArray(e))(t)&&!CDe(e,t.id)});if(!a)return!1;const o=[n[1][0]+1];e.tf.moveNodes({at:a[1],to:o})},SDe=dS(yDe,{options:{toggleIndex:/* @__PURE__ */new Map},render:{aboveNodes:()=>_De},useHooks:e=>{const t=En(7),{editor:n,setOption:i}=e,r=IE(FA(),wDe);let a,o;t[0]!==i||t[1]!==r?(a=()=>{i("toggleIndex",r)},t[0]=i,t[1]=r,t[2]=a):a=t[2],t[3]!==n||t[4]!==i||t[5]!==r?(o=[n,i,r],t[3]=n,t[4]=i,t[5]=r,t[6]=o):o=t[6],de(a,o)}}).overrideEditor(({api:{isSelectable:e},editor:t,getOption:n,tf:{deleteBackward:i,deleteForward:r,insertBreak:a}})=>({api:{isSelectable:n=>(!(e=>null!=e)(n)||!CDe(t,n.id))&&e(n)},transforms:{deleteBackward(e){!1!==EDe(t)&&i(e)},deleteForward(e){!1!==DDe(t)&&r(e)},insertBreak(){const e=t.api.block();if(!e||e[0].type!==kw.toggle)return a();const i=e[0].id,r=n("isOpen",i);t.tf.withoutNormalizing(()=>{if(r)a(),t.tf.toggleBlock(kw.toggle),VW(t);else{const n=((e,t)=>{const n=kDe(e.children);return(0,vDe.default)(e.children.map((e,t)=>[e,[t]]).filter(([e])=>(n.get(e.id)||[]).includes(t)))})(t,i);if(a(),n){const i=[e[1][0]+1],r=[n[1][0]+1];t.tf.moveNodes({at:i,to:r})}}})}}}));function ADe(e){e.preventDefault()}var FDe=e=>{const t=En(5),{pressed:n}=e,i=PA();let r,a;return t[0]!==i?(r=()=>{(e=>{const t=Array.from(e.api.nodes({block:!0,mode:"lowest"}));e.getApi(SDe).toggle.toggleIds(t.map(([e])=>e.id),!0)})(i),i.tf.toggleBlock(kw.toggle),i.tf.collapse(),i.tf.focus()},t[0]=i,t[1]=r):r=t[1],t[2]!==n||t[3]!==r?(a={props:{pressed:n,onClick:r,onMouseDown:BDe}},t[2]=n,t[3]=r,t[4]=a):a=t[4],a};function zDe(e){return(e=>!!e.selection&&e.api.some({match:e=>e.type===kw.toggle}))(e)}function BDe(e){e.preventDefault()}var TDe=[...KW,SDe.withComponent(function(e){const t=(e=>{const t=En(6),n=MA(yDe,"openIds");let i,r;return t[0]!==n||t[1]!==e?(i=n.has(e),t[0]=n,t[1]=e,t[2]=i):i=t[2],t[3]!==i||t[4]!==e?(r={open:i,toggleId:e},t[3]=i,t[4]=e,t[5]=r):r=t[5],r})(e.element.id),{buttonProps:n,open:i}=(e=>{const t=En(6),{api:n}=jA(yDe);let i,r;return t[0]!==n||t[1]!==e?(i={onClick:t=>{t.preventDefault(),n.toggle.toggleIds([e.toggleId])},onMouseDown:ADe},t[0]=n,t[1]=e,t[2]=i):i=t[2],t[3]!==e||t[4]!==i?(r={...e,buttonProps:i},t[3]=e,t[4]=i,t[5]=r):r=t[5],r})(t);/* @__PURE__ */
@@ -485,7 +485,7 @@ return Ce(W,{open:r,onOpenChange:a,modal:!1,...e,children:[/* @__PURE__ */xe(P,{
485
485
  /* @__PURE__ */Ce(B,{className:"min-w-[180px]",disabled:!t,onSelect:()=>{i.remove.tableColumn(),n.tf.focus()},children:[/* @__PURE__ */xe(fn,{}),"Delete column"]})]})]}),
486
486
  /* @__PURE__ */Ce(B,{className:"min-w-[180px]",disabled:!t,onSelect:()=>{i.remove.table(),n.tf.focus()},children:[/* @__PURE__ */xe(on,{}),"Delete table"]})]})})]})}function jAe(){const{editor:e,tf:t}=jA(WCe),[n,i]=Q.useState({grid:Array.from({length:8},()=>Array.from({length:8}).fill(0)),size:{colCount:0,rowCount:0}});/* @__PURE__ */
487
487
  return Ce("div",{className:"flex! m-0 flex-col p-0",onClick:()=>{t.insert.table(n.size,{select:!0}),e.tf.focus()},role:"button",children:[/* @__PURE__ */xe("div",{className:"grid size-[130px] grid-cols-8 gap-0.5 p-1",children:n.grid.map((e,t)=>e.map((e,r)=>/* @__PURE__ */xe("div",{className:a("col-span-1 size-3 border border-solid bg-secondary",!!e&&"border-current"),onMouseMove:()=>{((e,t)=>{const r=[...n.grid];for(let n=0;n<r.length;n++)for(let i=0;i<r[n].length;i++)r[n][i]=n>=0&&n<=e&&i>=0&&i<=t?1:0;i({grid:r,size:{colCount:t+1,rowCount:e+1}})})(t,r)}},`(${t},${r})`)))}),/* @__PURE__ */Ce("div",{className:"text-center text-current text-xs",children:[n.size.rowCount," x ",n.size.colCount]})]})}function RAe(e){const t=(()=>{const e=En(3);let t;e[0]===Symbol.for("react.memo_cache_sentinel")?(t=[],e[0]=t):t=e[0];const n=RA(zDe,t);let i;return e[1]!==n?(i={pressed:n},e[1]=n,e[2]=i):i=e[2],i})(),{props:n}=FDe(t);/* @__PURE__ */
488
- return xe(UO,{...e,...n,tooltip:"Toggle",children:/* @__PURE__ */xe(St,{})})}var MAe=/* @__PURE__ */new WeakMap;function LAe(e,t){const n=e.api.before(t,{unit:"character"});if(!n)return!1;const i=e.api.string({anchor:n,focus:t});return i.length>0&&!/\s/.test(i)}function VAe(e){return e.selection?kr.end(e.selection):e.api.end([])}function qAe(e,t){const n={listening:!1,partial:"",lastPhrase:"",phraseId:0,error:null},i=/* @__PURE__ */new Set,r=()=>i.forEach(e=>e());let a=null,o=null;function s(){return o||(o=new Fn({engine:t.engine??"auto",language:t.language??"en-US",model:t.model??"model/small",onStateChange:e=>{n.listening=e,r()},onPartial:t=>{n.partial=t,t&&(n.lastPhrase=t,n.phraseId+=1),function(t){e.tf.withoutSaving(()=>{const n=a?a.anchor:VAe(e),i=a?a.prefix:LAe(e,n)?" ":"";a&&(e.tf.select({anchor:a.anchor,focus:a.focus}),e.tf.delete()),t?(e.tf.select(n),e.tf.insertText(`${i}${t}`),a={anchor:n,focus:e.selection?kr.end(e.selection):n,prefix:i}):a=null})}(t),r()},onCommit:t=>{n.partial="",n.lastPhrase=t,n.phraseId+=1,function(t){const n=a;a=null;const i=n?n.anchor:VAe(e),r=n?n.prefix:LAe(e,i)?" ":"";n&&e.tf.withoutSaving(()=>{e.tf.select({anchor:n.anchor,focus:n.focus}),e.tf.delete()}),e.tf.select(i),e.tf.insertText(`${r}${t} `)}(t),r()},onError:e=>{n.error=e,r()}}),o)}function l(){const t=s();t.isListening()||(n.error=null,e.selection||e.tf.focus(),t.start())}function c(){o&&(o.stop(),function(){if(!a)return;const t={anchor:a.anchor,focus:a.focus};a=null,e.tf.withoutSaving(()=>{e.tf.select(t),e.tf.delete()})}(),n.partial="",r())}return{start:l,stop:c,toggle:function(){o?.isListening()?c():l()},getState:()=>n,subscribe:e=>(i.add(e),()=>i.delete(e))}}function WAe(e,t={}){let n=MAe.get(e);return n||(n=qAe(e,t),MAe.set(e,n)),n}function HAe(e){const t=PA(),n=Q.useMemo(()=>WAe(t),[t]),i=Q.useSyncExternalStore(n.subscribe,()=>n.getState().listening,()=>!1),r=zn();/* @__PURE__ */
488
+ return xe(UO,{...e,...n,tooltip:"Toggle",children:/* @__PURE__ */xe(St,{})})}var MAe=/* @__PURE__ */new WeakMap;function LAe(e,t){const n=e.api.before(t,{unit:"character"});if(!n)return!1;const i=e.api.string({anchor:n,focus:t});return i.length>0&&!/\s/.test(i)}function VAe(e){return e.selection?kr.end(e.selection):e.api.end([])}function qAe(e,t){const n={listening:!1,partial:"",lastPhrase:"",phraseId:0,error:null},i=/* @__PURE__ */new Set,r=()=>i.forEach(e=>e());let a=null,o=null;function s(){return o||(o=new Fn({engine:t.engine??"auto",language:t.language??"en-US",model:t.model??"model/small",onStateChange:e=>{n.listening=e,r()},onPartial:t=>{n.partial=t,t&&(n.lastPhrase=t,n.phraseId+=1),function(t){e.tf.withoutSaving(()=>{const n=a?a.anchor:VAe(e);if(!n)return void(a=null);const i=a?a.prefix:LAe(e,n)?" ":"";a&&(e.tf.select({anchor:a.anchor,focus:a.focus}),e.tf.delete()),t?(e.tf.select(n),e.tf.insertText(`${i}${t}`),a={anchor:n,focus:e.selection?kr.end(e.selection):n,prefix:i}):a=null})}(t),r()},onCommit:t=>{n.partial="",n.lastPhrase=t,n.phraseId+=1,function(t){const n=a;a=null;const i=n?n.anchor:VAe(e);if(!i)return;const r=n?n.prefix:LAe(e,i)?" ":"";n&&e.tf.withoutSaving(()=>{e.tf.select({anchor:n.anchor,focus:n.focus}),e.tf.delete()}),e.tf.select(i),e.tf.insertText(`${r}${t} `)}(t),r()},onError:e=>{n.error=e,r()}}),o)}function l(){const t=s();t.isListening()||(n.error=null,e.selection||e.tf.focus(),t.start())}function c(){o&&(o.stop(),function(){if(!a)return;const t={anchor:a.anchor,focus:a.focus};a=null,e.tf.withoutSaving(()=>{e.tf.select(t),e.tf.delete()})}(),n.partial="",r())}return{start:l,stop:c,toggle:function(){o?.isListening()?c():l()},getState:()=>n,subscribe:e=>(i.add(e),()=>i.delete(e))}}function WAe(e,t={}){let n=MAe.get(e);return n||(n=qAe(e,t),MAe.set(e,n)),n}function HAe(e){const t=PA(),n=Q.useMemo(()=>WAe(t),[t]),i=Q.useSyncExternalStore(n.subscribe,()=>n.getState().listening,()=>!1),r=zn();/* @__PURE__ */
489
489
  return xe(UO,{...e,disabled:!r,onClick:()=>n.toggle(),pressed:i,tooltip:r?"Dictate (Ctrl+Shift+D)":"Dictation is unavailable",children:/* @__PURE__ */xe(Bt,{})})}var UAe=[{icon:/* @__PURE__ */xe(Mt,{}),keywords:["paragraph"],label:"Text",value:kw.p},{icon:/* @__PURE__ */xe(dt,{}),keywords:["title","h1"],label:"Heading 1",value:kw.h1},{icon:/* @__PURE__ */xe(ft,{}),keywords:["subtitle","h2"],label:"Heading 2",value:kw.h2},{icon:/* @__PURE__ */xe(pt,{}),keywords:["subtitle","h3"],label:"Heading 3",value:kw.h3},{icon:/* @__PURE__ */xe(ht,{}),keywords:["h4"],label:"Heading 4",value:kw.h4},{icon:/* @__PURE__ */xe(mt,{}),keywords:["h5"],label:"Heading 5",value:kw.h5},{icon:/* @__PURE__ */xe(gt,{}),keywords:["h6"],label:"Heading 6",value:kw.h6},{icon:/* @__PURE__ */xe(At,{}),keywords:["unordered","ul","-"],label:"Bulleted list",value:kw.ul},{icon:/* @__PURE__ */xe(Ft,{}),keywords:["ordered","ol","1"],label:"Numbered list",value:kw.ol},{icon:/* @__PURE__ */xe(Qt,{}),keywords:["checklist","task","checkbox","[]"],label:"To-do list",value:kw.listTodo},{icon:/* @__PURE__ */xe(Ue,{}),keywords:["collapsible","expandable"],label:"Toggle list",value:kw.toggle},{icon:/* @__PURE__ */xe(Ke,{}),keywords:["```"],label:"Code",value:kw.codeBlock},{icon:/* @__PURE__ */xe(qt,{}),keywords:["citation","blockquote",">"],label:"Quote",value:kw.blockquote}];function $Ae(e){const t=PA(),[n,i]=Q.useState(!1),r=cF({defaultValue:kw.p,getProp:e=>CEe(e)}),a=Q.useMemo(()=>UAe.find(e=>e.value===(r??kw.p))??UAe[0],[r]);/* @__PURE__ */
490
490
  return Ce(W,{open:n,onOpenChange:i,modal:!1,...e,children:[/* @__PURE__ */xe(P,{asChild:!0,children:/* @__PURE__ */xe(UO,{className:"min-w-[110px] justify-start",isDropdown:!0,pressed:n,tooltip:"Turn into",children:a.label})}),/* @__PURE__ */xe(V,{align:"start",className:"ignore-click-outside/toolbar min-w-0",onCloseAutoFocus:e=>{e.preventDefault(),t.tf.focus()},children:/* @__PURE__ */xe(YO,{label:"Turn into",onValueChange:e=>((e,t,{at:n}={})=>{e.tf.withoutNormalizing(()=>{if(t===kw.blockquote){const i=n??e.selection;if(!i||e.api.some({at:i,match:{type:t}}))return;return void e.tf.toggleBlock(t,{...n?{at:n}:{},wrap:!0})}const i=n=>{const[i,r]=n;if(i[kw.listType]&&e.tf.unsetNodes([kw.listType,"indent"],{at:r}),t in xEe)return xEe[t](e,t,n);i.type!==t&&e.tf.setNodes({type:t},{at:r})};if(n){const t=e.api.node(n);if(t)return void i(t)}e.api.blocks({mode:"lowest"}).forEach(e=>{i(e)})})})(t,e),value:r,children:UAe.map(({icon:e,label:t,value:n})=>/* @__PURE__ */Ce(I,{className:"min-w-[180px] pl-2 *:first:[span]:hidden",value:n,children:[e,t]},n))})})]})}function KAe(){return OA()?null:/* @__PURE__ */Ce(_e,{children:[
491
491
  /* @__PURE__ */Ce(QO,{children:[/* @__PURE__ */xe(bAe,{}),/* @__PURE__ */xe(kAe,{})]}),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-reason-editor",
3
- "version": "1.0.95",
3
+ "version": "1.0.97",
4
4
  "description": "A modern WYSIWYG rich text editor based on tiptap and shadcn ui for React",
5
5
  "repository": {
6
6
  "type": "git",
@@ -919,7 +919,7 @@
919
919
  "react-image-crop": "^11.1.2",
920
920
  "react-lite-youtube-embed": "^3.7.0",
921
921
  "react-player": "3.4.0",
922
- "react-reason-editor-sidebar": "^0.1.12",
922
+ "react-reason-editor-sidebar": "^0.1.14",
923
923
  "react-split-pane": "^3.2.0",
924
924
  "react-textarea-autosize": "^8.5.9",
925
925
  "react-tweet": "^3.3.1",
@@ -993,7 +993,7 @@
993
993
  "pnpm": {
994
994
  "overrides": {
995
995
  "esbuild": "0.25.12",
996
- "prosemirror-view": "1.41.1"
996
+ "prosemirror-view": "1.42.3"
997
997
  }
998
998
  }
999
999
  }