@yoopta/table 4.8.0 → 4.8.1

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 (2) hide show
  1. package/dist/index.js +6 -6
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -1,25 +1,25 @@
1
- import{generateId as e,Blocks as t,buildBlockData as n,Elements as r,UI as o,useYooptaEditor as i,useBlockData as a,deserializeTextNodes as s,serializeTextNodes as l,serializeTextNodesIntoMarkdown as c,YooptaPlugin as u}from"@yoopta/editor";import{jsxs as f,jsx as d,Fragment as p}from"react/jsx-runtime";import*as h from"react";import{forwardRef as m,createElement as y,useRef as g,useEffect as b,useLayoutEffect as v,useState as w,useMemo as x}from"react";import*as O from"react-dom";!function(e,t){void 0===t&&(t={});var n=t.insertAt;if(e&&"undefined"!=typeof document){var r=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===n&&r.firstChild?r.insertBefore(o,r.firstChild):r.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}(".mr-2{margin-right:.5rem}.block{display:block}.inline{display:inline}.flex{display:flex}.table{display:table}.table-row{display:table-row}.h-4{height:1rem}.h-\\[14px\\]{height:14px}.w-4{width:1rem}.w-\\[14px\\]{width:14px}.flex-shrink-0{flex-shrink:0}.rotate-180{--tw-rotate:180deg}.rotate-180,.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.justify-between{justify-content:space-between}.blur{--tw-blur:blur(8px)}.blur,.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.yoopta-table-block{overflow-x:auto;overflow-y:hidden;padding-bottom:.5rem;padding-top:.5rem;position:relative;width:100%}.yoopta-table-block .yoopta-table-options{opacity:0;top:12px;transition:opacity .15s ease-in-out}.yoopta-table-block:hover .yoopta-table-options{opacity:1}.yoopta-table{--tw-border-spacing-x:0px;--tw-border-spacing-y:0px;border-collapse:collapse;border-spacing:var(--tw-border-spacing-x) var(--tw-border-spacing-y);caption-side:bottom;font-size:.875rem;line-height:1.25rem;table-layout:fixed;-webkit-user-select:none;-moz-user-select:none;user-select:none;width:auto}.yoopta-table-selecting ::-moz-selection{background:none}.yoopta-table-selecting ::selection{background:none}.yoopta-table tbody{-webkit-user-select:none;-moz-user-select:none;user-select:none}.yoopta-table-row{position:relative;transition-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1)}.yoopta-table-row-selected{border-color:#73b6db;border-width:2px}.yoopta-table-data-cell{fill:currentColor;border-width:1px;border:1px solid #e9e9e7;color:inherit;min-height:32px;position:relative;transition-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);vertical-align:top}.yoopta-table-data-cell[data-cell-selected=true]{background-color:#37352f14}.yoopta-table-data-cell-head{background-color:#f7f6f3}.yoopta-table-data-cell:hover .yoopta-table-column-button,.yoopta-table-data-cell:hover .yoopta-table-row-button{opacity:1}.yoopta-table-data-cell-content{background-color:transparent;caret-color:#37352f;font-size:14px;line-height:20px;max-width:100%;overflow-wrap:break-word;padding:7px 9px;white-space:pre-wrap;width:100%}.yoopta-table-column-button{height:16px;left:calc(50% - 13px);padding:2px 4px;top:-8px;width:26px}.yoopta-table-column-button,.yoopta-table-row-button{--tw-bg-opacity:1;composes:yoopta-button;fill:rgba(55,53,47,.35);align-items:center;background-color:rgb(255 255 255/var(--tw-bg-opacity));border-radius:4px;box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),hsla(0,0%,6%,.1) 0 0 0 1px,hsla(0,0%,6%,.1) 0 2px 4px;cursor:pointer;display:flex;justify-content:center;opacity:0;position:absolute;transition-duration:.15s;transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);-webkit-user-select:none;-moz-user-select:none;user-select:none;z-index:4}.yoopta-table-row-button{height:26px;left:-8px;padding:4px 2px;top:calc(50% - 13px);width:16px}.yoopta-table-icons{height:1rem;margin-right:.5rem;width:1rem}.resize-handle{flex-grow:0;height:100%;right:0;top:0;width:0;z-index:1}.resize-handle,.resize-handle-inner{position:absolute;-webkit-user-select:none;-moz-user-select:none;user-select:none}.resize-handle-inner{background-color:#2383e200;cursor:col-resize;height:calc(100% + 2px);margin-left:-1px;margin-top:-1px;transition-delay:50ms;transition-duration:.15s;transition-property:background;transition-timing-function:cubic-bezier(.4,0,.2,1);width:3px}.resize-handle-inner:hover{background-color:#74b6db}");
1
+ import{generateId as e,Blocks as t,buildBlockData as n,Elements as r,UI as o,useYooptaEditor as i,useBlockData as a,deserializeTextNodes as s,serializeTextNodes as l,serializeTextNodesIntoMarkdown as c,YooptaPlugin as d}from"@yoopta/editor";import{jsxs as f,jsx as u,Fragment as p}from"react/jsx-runtime";import*as h from"react";import{forwardRef as m,createElement as y,useRef as g,useEffect as b,useLayoutEffect as v,useState as w,useMemo as x}from"react";import*as O from"react-dom";!function(e,t){void 0===t&&(t={});var n=t.insertAt;if(e&&"undefined"!=typeof document){var r=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===n&&r.firstChild?r.insertBefore(o,r.firstChild):r.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}(".mr-2{margin-right:.5rem}.block{display:block}.inline{display:inline}.flex{display:flex}.table{display:table}.table-row{display:table-row}.h-4{height:1rem}.h-\\[14px\\]{height:14px}.w-4{width:1rem}.w-\\[14px\\]{width:14px}.flex-shrink-0{flex-shrink:0}.rotate-180{--tw-rotate:180deg}.rotate-180,.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.justify-between{justify-content:space-between}.blur{--tw-blur:blur(8px)}.blur,.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.yoopta-table-block{overflow-x:auto;overflow-y:hidden;padding-bottom:.5rem;padding-top:.5rem;position:relative;width:100%}.yoopta-table-block .yoopta-table-options{opacity:0;top:12px;transition:opacity .15s ease-in-out}.yoopta-table-block:hover .yoopta-table-options{opacity:1}.yoopta-table{--tw-border-spacing-x:0px;--tw-border-spacing-y:0px;border-collapse:collapse;border-spacing:var(--tw-border-spacing-x) var(--tw-border-spacing-y);caption-side:bottom;font-size:.875rem;line-height:1.25rem;table-layout:fixed;-webkit-user-select:none;-moz-user-select:none;user-select:none;width:auto}.yoopta-table-selecting ::-moz-selection{background:none}.yoopta-table-selecting ::selection{background:none}.yoopta-table tbody{-webkit-user-select:none;-moz-user-select:none;user-select:none}.yoopta-table-row{position:relative;transition-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1)}.yoopta-table-row-selected{border-color:#73b6db;border-width:2px}.yoopta-table-data-cell{fill:currentColor;border-width:1px;border:1px solid #e9e9e7;color:inherit;min-height:32px;position:relative;transition-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);vertical-align:top}.yoopta-table-data-cell[data-cell-selected=true]{background-color:#37352f14}.yoopta-table-data-cell-head{background-color:#f7f6f3}.yoopta-table-data-cell:hover .yoopta-table-column-button,.yoopta-table-data-cell:hover .yoopta-table-row-button{opacity:1}.yoopta-table-data-cell-content{background-color:transparent;caret-color:#37352f;font-size:14px;line-height:20px;max-width:100%;overflow-wrap:break-word;padding:7px 9px;white-space:pre-wrap;width:100%}.yoopta-table-column-button{height:16px;left:calc(50% - 13px);padding:2px 4px;top:-8px;width:26px}.yoopta-table-column-button,.yoopta-table-row-button{--tw-bg-opacity:1;composes:yoopta-button;fill:rgba(55,53,47,.35);align-items:center;background-color:rgb(255 255 255/var(--tw-bg-opacity));border-radius:4px;box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),hsla(0,0%,6%,.1) 0 0 0 1px,hsla(0,0%,6%,.1) 0 2px 4px;cursor:pointer;display:flex;justify-content:center;opacity:0;position:absolute;transition-duration:.15s;transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);-webkit-user-select:none;-moz-user-select:none;user-select:none;z-index:4}.yoopta-table-row-button{height:26px;left:-8px;padding:4px 2px;top:calc(50% - 13px);width:16px}.yoopta-table-icons{height:1rem;margin-right:.5rem;width:1rem}.resize-handle{flex-grow:0;height:100%;right:0;top:0;width:0;z-index:1}.resize-handle,.resize-handle-inner{position:absolute;-webkit-user-select:none;-moz-user-select:none;user-select:none}.resize-handle-inner{background-color:#2383e200;cursor:col-resize;height:calc(100% + 2px);margin-left:-1px;margin-top:-1px;transition-delay:50ms;transition-duration:.15s;transition-property:background;transition-timing-function:cubic-bezier(.4,0,.2,1);width:3px}.resize-handle-inner:hover{background-color:#74b6db}");
2
2
  /**
3
- * @license lucide-react v0.436.0 - ISC
3
+ * @license lucide-react v0.378.0 - ISC
4
4
  *
5
5
  * This source code is licensed under the ISC license.
6
6
  * See the LICENSE file in the root directory of this source tree.
7
7
  */
8
8
  const k=(...e)=>e.filter(((e,t,n)=>Boolean(e)&&n.indexOf(e)===t)).join(" ")
9
9
  /**
10
- * @license lucide-react v0.436.0 - ISC
10
+ * @license lucide-react v0.378.0 - ISC
11
11
  *
12
12
  * This source code is licensed under the ISC license.
13
13
  * See the LICENSE file in the root directory of this source tree.
14
14
  */;var E={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};
15
15
  /**
16
- * @license lucide-react v0.436.0 - ISC
16
+ * @license lucide-react v0.378.0 - ISC
17
17
  *
18
18
  * This source code is licensed under the ISC license.
19
19
  * See the LICENSE file in the root directory of this source tree.
20
20
  */const _=m((({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:o="",children:i,iconNode:a,...s},l)=>y("svg",{ref:l,...E,width:t,height:t,stroke:e,strokeWidth:r?24*Number(n)/Number(t):n,className:k("lucide",o),...s},[...a.map((([e,t])=>y(e,t))),...Array.isArray(i)?i:[i]]))),P=(e,t)=>{const n=m((({className:n,...r},o)=>{return y(_,{ref:o,iconNode:t,className:k(`lucide-${i=e,i.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}`,n),...r});var i}));return n.displayName=`${e}`,n},j=P("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]),N=P("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]),S=P("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]),C=P("CornerDownRight",[["polyline",{points:"15 10 20 15 15 20",key:"1q7qjw"}],["path",{d:"M4 4v7a4 4 0 0 0 4 4h12",key:"z08zvw"}]]),R=P("CornerUpRight",[["polyline",{points:"15 14 20 9 15 4",key:"1tbx3s"}],["path",{d:"M4 20v-7a4 4 0 0 1 4-4h12",key:"1lu4f8"}]]),T=P("MoveDown",[["path",{d:"M8 18L12 22L16 18",key:"cskvfv"}],["path",{d:"M12 2V22",key:"r89rzk"}]]),A=P("MoveLeft",[["path",{d:"M6 8L2 12L6 16",key:"kyvwex"}],["path",{d:"M2 12H22",key:"1m8cig"}]]),M=P("MoveRight",[["path",{d:"M18 8L22 12L18 16",key:"1r0oui"}],["path",{d:"M2 12H22",key:"1m8cig"}]]),z=P("MoveUp",[["path",{d:"M8 6L12 2L16 6",key:"1yvkyx"}],["path",{d:"M12 2V22",key:"r89rzk"}]]),D=P("Sheet",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["line",{x1:"3",x2:"21",y1:"9",y2:"9",key:"1vqk6q"}],["line",{x1:"3",x2:"21",y1:"15",y2:"15",key:"o2sbyz"}],["line",{x1:"9",x2:"9",y1:"9",y2:"21",key:"1ib60c"}],["line",{x1:"15",x2:"15",y1:"9",y2:"21",key:"1n26ft"}]]),L=P("TableProperties",[["path",{d:"M15 3v18",key:"14nvp0"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M21 9H3",key:"1338ky"}],["path",{d:"M21 15H3",key:"9uk58r"}]]),B=P("Trash",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}]]);
21
21
  /**
22
- * @license lucide-react v0.436.0 - ISC
22
+ * @license lucide-react v0.378.0 - ISC
23
23
  *
24
24
  * This source code is licensed under the ISC license.
25
25
  * See the LICENSE file in the root directory of this source tree.
@@ -30,4 +30,4 @@ const k=(...e)=>e.filter(((e,t,n)=>Boolean(e)&&n.indexOf(e)===t)).join(" ")
30
30
  * Copyright (c) 2014-2017, Jon Schlinkert.
31
31
  * Released under the MIT License.
32
32
  */
33
- function q(e){return"[object Object]"===Object.prototype.toString.call(e)}function H(e){var t,n;return!1!==q(e)&&(void 0===(t=e.constructor)||!1!==q(n=t.prototype)&&!1!==n.hasOwnProperty("isPrototypeOf"))}var I=Symbol.for("immer-nothing"),F=Symbol.for("immer-draftable"),W=Symbol.for("immer-state");function V(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var $=Object.getPrototypeOf;function K(e){return!!e&&!!e[W]}function Z(e){return!!e&&(U(e)||Array.isArray(e)||!!e[F]||!!e.constructor?.[F]||ee(e)||te(e))}var X=Object.prototype.constructor.toString();function U(e){if(!e||"object"!=typeof e)return!1;const t=$(e);if(null===t)return!0;const n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return n===Object||"function"==typeof n&&Function.toString.call(n)===X}function J(e,t){0===Y(e)?Reflect.ownKeys(e).forEach((n=>{t(n,e[n],e)})):e.forEach(((n,r)=>t(r,n,e)))}function Y(e){const t=e[W];return t?t.type_:Array.isArray(e)?1:ee(e)?2:te(e)?3:0}function G(e,t){return 2===Y(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function Q(e,t,n){const r=Y(e);2===r?e.set(t,n):3===r?e.add(n):e[t]=n}function ee(e){return e instanceof Map}function te(e){return e instanceof Set}function ne(e){return e.copy_||e.base_}function re(e,t){if(ee(e))return new Map(e);if(te(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);if(!t&&U(e)){if(!$(e)){const t=Object.create(null);return Object.assign(t,e)}return{...e}}const n=Object.getOwnPropertyDescriptors(e);delete n[W];let r=Reflect.ownKeys(n);for(let t=0;t<r.length;t++){const o=r[t],i=n[o];!1===i.writable&&(i.writable=!0,i.configurable=!0),(i.get||i.set)&&(n[o]={configurable:!0,writable:!0,enumerable:i.enumerable,value:e[o]})}return Object.create($(e),n)}function oe(e,t=!1){return ae(e)||K(e)||!Z(e)||(Y(e)>1&&(e.set=e.add=e.clear=e.delete=ie),Object.freeze(e),t&&Object.entries(e).forEach((([e,t])=>oe(t,!0)))),e}function ie(){V(2)}function ae(e){return Object.isFrozen(e)}var se,le={};function ce(e){const t=le[e];return t||V(0),t}function ue(){return se}function fe(e,t){t&&(ce("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function de(e){pe(e),e.drafts_.forEach(me),e.drafts_=null}function pe(e){e===se&&(se=e.parent_)}function he(e){return se={drafts_:[],parent_:se,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function me(e){const t=e[W];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function ye(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return void 0!==e&&e!==n?(n[W].modified_&&(de(t),V(4)),Z(e)&&(e=ge(t,e),t.parent_||ve(t,e)),t.patches_&&ce("Patches").generateReplacementPatches_(n[W].base_,e,t.patches_,t.inversePatches_)):e=ge(t,n,[]),de(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==I?e:void 0}function ge(e,t,n){if(ae(t))return t;const r=t[W];if(!r)return J(t,((o,i)=>be(e,r,t,o,i,n))),t;if(r.scope_!==e)return t;if(!r.modified_)return ve(e,r.base_,!0),r.base_;if(!r.finalized_){r.finalized_=!0,r.scope_.unfinalizedDrafts_--;const t=r.copy_;let o=t,i=!1;3===r.type_&&(o=new Set(t),t.clear(),i=!0),J(o,((o,a)=>be(e,r,t,o,a,n,i))),ve(e,t,!1),n&&e.patches_&&ce("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function be(e,t,n,r,o,i,a){if(K(o)){const a=ge(e,o,i&&t&&3!==t.type_&&!G(t.assigned_,r)?i.concat(r):void 0);if(Q(n,r,a),!K(a))return;e.canAutoFreeze_=!1}else a&&n.add(o);if(Z(o)&&!ae(o)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;ge(e,o),t&&t.scope_.parent_||"symbol"==typeof r||!Object.prototype.propertyIsEnumerable.call(n,r)||ve(e,o)}}function ve(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&oe(t,n)}var we={get(e,t){if(t===W)return e;const n=ne(e);if(!G(n,t))return function(e,t,n){const r=ke(t,n);return r?"value"in r?r.value:r.get?.call(e.draft_):void 0}(e,n,t);const r=n[t];return e.finalized_||!Z(r)?r:r===Oe(e.base_,t)?(_e(e),e.copy_[t]=Pe(r,e)):r},has:(e,t)=>t in ne(e),ownKeys:e=>Reflect.ownKeys(ne(e)),set(e,t,n){const r=ke(ne(e),t);if(r?.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const r=Oe(ne(e),t),a=r?.[W];if(a&&a.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(((o=n)===(i=r)?0!==o||1/o==1/i:o!=o&&i!=i)&&(void 0!==n||G(e.base_,t)))return!0;_e(e),Ee(e)}var o,i;return e.copy_[t]===n&&(void 0!==n||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_[t]=!0),!0},deleteProperty:(e,t)=>(void 0!==Oe(e.base_,t)||t in e.base_?(e.assigned_[t]=!1,_e(e),Ee(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0),getOwnPropertyDescriptor(e,t){const n=ne(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r?{writable:!0,configurable:1!==e.type_||"length"!==t,enumerable:r.enumerable,value:n[t]}:r},defineProperty(){V(11)},getPrototypeOf:e=>$(e.base_),setPrototypeOf(){V(12)}},xe={};function Oe(e,t){const n=e[W];return(n?ne(n):e)[t]}function ke(e,t){if(!(t in e))return;let n=$(e);for(;n;){const e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=$(n)}}function Ee(e){e.modified_||(e.modified_=!0,e.parent_&&Ee(e.parent_))}function _e(e){e.copy_||(e.copy_=re(e.base_,e.scope_.immer_.useStrictShallowCopy_))}J(we,((e,t)=>{xe[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),xe.deleteProperty=function(e,t){return xe.set.call(this,e,t,void 0)},xe.set=function(e,t,n){return we.set.call(this,e[0],t,n,e[0])};function Pe(e,t){const n=ee(e)?ce("MapSet").proxyMap_(e,t):te(e)?ce("MapSet").proxySet_(e,t):function(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:ue(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let o=r,i=we;n&&(o=[r],i=xe);const{revoke:a,proxy:s}=Proxy.revocable(o,i);return r.draft_=s,r.revoke_=a,s}(e,t);return(t?t.scope_:ue()).drafts_.push(n),n}function je(e){if(!Z(e)||ae(e))return e;const t=e[W];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=re(e,t.scope_.immer_.useStrictShallowCopy_)}else n=re(e,!0);return J(n,((e,t)=>{Q(n,e,je(t))})),t&&(t.finalized_=!1),n}var Ne=new class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(e,t,n)=>{if("function"==typeof e&&"function"!=typeof t){const n=t;t=e;const r=this;return function(e=n,...o){return r.produce(e,(e=>t.call(this,e,...o)))}}let r;if("function"!=typeof t&&V(6),void 0!==n&&"function"!=typeof n&&V(7),Z(e)){const o=he(this),i=Pe(e,void 0);let a=!0;try{r=t(i),a=!1}finally{a?de(o):pe(o)}return fe(o,n),ye(r,o)}if(!e||"object"!=typeof e){if(r=t(e),void 0===r&&(r=e),r===I&&(r=void 0),this.autoFreeze_&&oe(r,!0),n){const t=[],o=[];ce("Patches").generateReplacementPatches_(e,r,t,o),n(t,o)}return r}V(1)},this.produceWithPatches=(e,t)=>{if("function"==typeof e)return(t,...n)=>this.produceWithPatches(t,(t=>e(t,...n)));let n,r;return[this.produce(e,t,((e,t)=>{n=e,r=t})),n,r]},"boolean"==typeof e?.autoFreeze&&this.setAutoFreeze(e.autoFreeze),"boolean"==typeof e?.useStrictShallowCopy&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){Z(e)||V(8),K(e)&&(e=function(e){K(e)||V(10);return je(e)}(e));const t=he(this),n=Pe(e,void 0);return n[W].isManual_=!0,pe(t),n}finishDraft(e,t){const n=e&&e[W];n&&n.isManual_||V(9);const{scope_:r}=n;return fe(r,t),ye(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const r=t[n];if(0===r.path.length&&"replace"===r.op){e=r.value;break}}n>-1&&(t=t.slice(n+1));const r=ce("Patches").applyPatches_;return K(e)?r(e,t):this.produce(e,(e=>r(e,t)))}},Se=Ne.produce;Ne.produceWithPatches.bind(Ne),Ne.setAutoFreeze.bind(Ne),Ne.setUseStrictShallowCopy.bind(Ne),Ne.applyPatches.bind(Ne);var Ce=Ne.createDraft.bind(Ne),Re=Ne.finishDraft.bind(Ne),Te={ancestors(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{reverse:n=!1}=t,r=Te.levels(e,t);return r=n?r.slice(1):r.slice(0,-1)},common(e,t){for(var n=[],r=0;r<e.length&&r<t.length;r++){var o=e[r];if(o!==t[r])break;n.push(o)}return n},compare(e,t){for(var n=Math.min(e.length,t.length),r=0;r<n;r++){if(e[r]<t[r])return-1;if(e[r]>t[r])return 1}return 0},endsAfter(e,t){var n=e.length-1,r=e.slice(0,n),o=t.slice(0,n),i=e[n],a=t[n];return Te.equals(r,o)&&i>a},endsAt(e,t){var n=e.length,r=e.slice(0,n),o=t.slice(0,n);return Te.equals(r,o)},endsBefore(e,t){var n=e.length-1,r=e.slice(0,n),o=t.slice(0,n),i=e[n],a=t[n];return Te.equals(r,o)&&i<a},equals:(e,t)=>e.length===t.length&&e.every(((e,n)=>e===t[n])),hasPrevious:e=>e[e.length-1]>0,isAfter:(e,t)=>1===Te.compare(e,t),isAncestor:(e,t)=>e.length<t.length&&0===Te.compare(e,t),isBefore:(e,t)=>-1===Te.compare(e,t),isChild:(e,t)=>e.length===t.length+1&&0===Te.compare(e,t),isCommon:(e,t)=>e.length<=t.length&&0===Te.compare(e,t),isDescendant:(e,t)=>e.length>t.length&&0===Te.compare(e,t),isParent:(e,t)=>e.length+1===t.length&&0===Te.compare(e,t),isPath:e=>Array.isArray(e)&&(0===e.length||"number"==typeof e[0]),isSibling(e,t){if(e.length!==t.length)return!1;var n=e.slice(0,-1),r=t.slice(0,-1);return e[e.length-1]!==t[t.length-1]&&Te.equals(n,r)},levels(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{reverse:n=!1}=t,r=[],o=0;o<=e.length;o++)r.push(e.slice(0,o));return n&&r.reverse(),r},next(e){if(0===e.length)throw new Error("Cannot get the next path of a root path [".concat(e,"], because it has no next index."));var t=e[e.length-1];return e.slice(0,-1).concat(t+1)},operationCanTransformPath(e){switch(e.type){case"insert_node":case"remove_node":case"merge_node":case"split_node":case"move_node":return!0;default:return!1}},parent(e){if(0===e.length)throw new Error("Cannot get the parent path of the root path [".concat(e,"]."));return e.slice(0,-1)},previous(e){if(0===e.length)throw new Error("Cannot get the previous path of a root path [".concat(e,"], because it has no previous index."));var t=e[e.length-1];if(t<=0)throw new Error("Cannot get the previous path of a first child path [".concat(e,"] because it would result in a negative index."));return e.slice(0,-1).concat(t-1)},relative(e,t){if(!Te.isAncestor(t,e)&&!Te.equals(e,t))throw new Error("Cannot get the relative path of [".concat(e,"] inside ancestor [").concat(t,"], because it is not above or equal to the path."));return e.slice(t.length)},transform(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!e)return null;var r=[...e],{affinity:o="forward"}=n;if(0===e.length)return r;switch(t.type){case"insert_node":var{path:i}=t;(Te.equals(i,r)||Te.endsBefore(i,r)||Te.isAncestor(i,r))&&(r[i.length-1]+=1);break;case"remove_node":var{path:a}=t;if(Te.equals(a,r)||Te.isAncestor(a,r))return null;Te.endsBefore(a,r)&&(r[a.length-1]-=1);break;case"merge_node":var{path:s,position:l}=t;Te.equals(s,r)||Te.endsBefore(s,r)?r[s.length-1]-=1:Te.isAncestor(s,r)&&(r[s.length-1]-=1,r[s.length]+=l);break;case"split_node":var{path:c,position:u}=t;if(Te.equals(c,r)){if("forward"===o)r[r.length-1]+=1;else if("backward"!==o)return null}else Te.endsBefore(c,r)?r[c.length-1]+=1:Te.isAncestor(c,r)&&e[c.length]>=u&&(r[c.length-1]+=1,r[c.length]-=u);break;case"move_node":var{path:f,newPath:d}=t;if(Te.equals(f,d))return r;if(Te.isAncestor(f,r)||Te.equals(f,r)){var p=d.slice();return Te.endsBefore(f,d)&&f.length<d.length&&(p[f.length-1]-=1),p.concat(r.slice(f.length))}Te.isSibling(f,d)&&(Te.isAncestor(d,r)||Te.equals(d,r))?Te.endsBefore(f,r)?r[f.length-1]-=1:r[f.length-1]+=1:Te.endsBefore(d,r)||Te.equals(d,r)||Te.isAncestor(d,r)?(Te.endsBefore(f,r)&&(r[f.length-1]-=1),r[d.length-1]+=1):Te.endsBefore(f,r)&&(Te.equals(d,r)&&(r[d.length-1]+=1),r[f.length-1]-=1)}return r}};function Ae(e){return Ae="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ae(e)}function Me(e){var t=function(e,t){if("object"!==Ae(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==Ae(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===Ae(t)?t:String(t)}function ze(e,t,n){return(t=Me(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function De(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Le(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?De(Object(n),!0).forEach((function(t){ze(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):De(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var Be={transform(e,t){e.children=Ce(e.children);var n=e.selection&&Ce(e.selection);try{n=((e,t,n)=>{switch(n.type){case"insert_node":var{path:r,node:o}=n,i=Ye.parent(e,r),a=r[r.length-1];if(a>i.children.length)throw new Error('Cannot apply an "insert_node" operation at path ['.concat(r,"] because the destination is past the end of the node."));if(i.children.splice(a,0,o),t)for(var[s,l]of $e.points(t))t[l]=it.transform(s,n);break;case"insert_text":var{path:c,offset:u,text:f}=n;if(0===f.length)break;var d=Ye.leaf(e,c),p=d.text.slice(0,u),h=d.text.slice(u);if(d.text=p+f+h,t)for(var[m,y]of $e.points(t))t[y]=it.transform(m,n);break;case"merge_node":var{path:g}=n,b=Ye.get(e,g),v=Te.previous(g),w=Ye.get(e,v),x=Ye.parent(e,g),O=g[g.length-1];if(pt.isText(b)&&pt.isText(w))w.text+=b.text;else{if(pt.isText(b)||pt.isText(w))throw new Error('Cannot apply a "merge_node" operation at path ['.concat(g,"] to nodes of different interfaces: ").concat(st.stringify(b)," ").concat(st.stringify(w)));w.children.push(...b.children)}if(x.children.splice(O,1),t)for(var[k,E]of $e.points(t))t[E]=it.transform(k,n);break;case"move_node":var{path:_,newPath:P}=n;if(Te.isAncestor(_,P))throw new Error("Cannot move a path [".concat(_,"] to new path [").concat(P,"] because the destination is inside itself."));var j=Ye.get(e,_),N=Ye.parent(e,_),S=_[_.length-1];N.children.splice(S,1);var C=Te.transform(_,n),R=Ye.get(e,Te.parent(C)),T=C[C.length-1];if(R.children.splice(T,0,j),t)for(var[A,M]of $e.points(t))t[M]=it.transform(A,n);break;case"remove_node":var{path:z}=n,D=z[z.length-1];if(Ye.parent(e,z).children.splice(D,1),t)for(var[L,B]of $e.points(t)){var q=it.transform(L,n);if(null!=t&&null!=q)t[B]=q;else{var H=void 0,I=void 0;for(var[F,W]of Ye.texts(e)){if(-1!==Te.compare(W,z)){I=[F,W];break}H=[F,W]}var V=!1;H&&I&&(V=Te.equals(I[1],z)?!Te.hasPrevious(I[1]):Te.common(H[1],z).length<Te.common(I[1],z).length),H&&!V?(L.path=H[1],L.offset=H[0].text.length):I?(L.path=I[1],L.offset=0):t=null}}break;case"remove_text":var{path:$,offset:K,text:Z}=n;if(0===Z.length)break;var X=Ye.leaf(e,$),U=X.text.slice(0,K),J=X.text.slice(K+Z.length);if(X.text=U+J,t)for(var[Y,G]of $e.points(t))t[G]=it.transform(Y,n);break;case"set_node":var{path:Q,properties:ee,newProperties:te}=n;if(0===Q.length)throw new Error("Cannot set properties on the root node!");var ne=Ye.get(e,Q);for(var re in te){if("children"===re||"text"===re)throw new Error('Cannot set the "'.concat(re,'" property of nodes!'));var oe=te[re];null==oe?delete ne[re]:ne[re]=oe}for(var ie in ee)te.hasOwnProperty(ie)||delete ne[ie];break;case"set_selection":var{newProperties:ae}=n;if(null==ae)t=ae;else{if(null==t){if(!$e.isRange(ae))throw new Error('Cannot apply an incomplete "set_selection" operation properties '.concat(st.stringify(ae)," when there is no current selection."));t=Le({},ae)}for(var se in ae){var le=ae[se];if(null==le){if("anchor"===se||"focus"===se)throw new Error('Cannot remove the "'.concat(se,'" selection property'));delete t[se]}else t[se]=le}}break;case"split_node":var{path:ce,position:ue,properties:fe}=n;if(0===ce.length)throw new Error('Cannot apply a "split_node" operation at path ['.concat(ce,"] because the root node cannot be split."));var de,pe=Ye.get(e,ce),he=Ye.parent(e,ce),me=ce[ce.length-1];if(pt.isText(pe)){var ye=pe.text.slice(0,ue),ge=pe.text.slice(ue);pe.text=ye,de=Le(Le({},fe),{},{text:ge})}else{var be=pe.children.slice(0,ue),ve=pe.children.slice(ue);pe.children=be,de=Le(Le({},fe),{},{children:ve})}if(he.children.splice(me+1,0,de),t)for(var[we,xe]of $e.points(t))t[xe]=it.transform(we,n)}return t})(e,n,t)}finally{e.children=Re(e.children),e.selection=n?K(n)?Re(n):n:null}}},qe={insertNodes(e,t,n){e.insertNodes(t,n)},liftNodes(e,t){e.liftNodes(t)},mergeNodes(e,t){e.mergeNodes(t)},moveNodes(e,t){e.moveNodes(t)},removeNodes(e,t){e.removeNodes(t)},setNodes(e,t,n){e.setNodes(t,n)},splitNodes(e,t){e.splitNodes(t)},unsetNodes(e,t,n){e.unsetNodes(t,n)},unwrapNodes(e,t){e.unwrapNodes(t)},wrapNodes(e,t,n){e.wrapNodes(t,n)}},He={collapse(e,t){e.collapse(t)},deselect(e){e.deselect()},move(e,t){e.move(t)},select(e,t){e.select(t)},setPoint(e,t,n){e.setPoint(t,n)},setSelection(e,t){e.setSelection(t)}},Ie=(e,t)=>{for(var n in e){var r=e[n],o=t[n];if(H(r)&&H(o)){if(!Ie(r,o))return!1}else if(Array.isArray(r)&&Array.isArray(o)){if(r.length!==o.length)return!1;for(var i=0;i<r.length;i++)if(r[i]!==o[i])return!1}else if(r!==o)return!1}for(var a in t)if(void 0===e[a]&&void 0!==t[a])return!1;return!0};function Fe(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var We=["anchor","focus"];function Ve(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}var $e={edges(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{reverse:n=!1}=t,{anchor:r,focus:o}=e;return $e.isBackward(e)===n?[r,o]:[o,r]},end(e){var[,t]=$e.edges(e);return t},equals:(e,t)=>it.equals(e.anchor,t.anchor)&&it.equals(e.focus,t.focus),includes(e,t){if($e.isRange(t)){if($e.includes(e,t.anchor)||$e.includes(e,t.focus))return!0;var[n,r]=$e.edges(e),[o,i]=$e.edges(t);return it.isBefore(n,o)&&it.isAfter(r,i)}var[a,s]=$e.edges(e),l=!1,c=!1;return it.isPoint(t)?(l=it.compare(t,a)>=0,c=it.compare(t,s)<=0):(l=Te.compare(t,a.path)>=0,c=Te.compare(t,s.path)<=0),l&&c},intersection(e,t){var n=Fe(e,We),[r,o]=$e.edges(e),[i,a]=$e.edges(t),s=it.isBefore(r,i)?i:r,l=it.isBefore(o,a)?o:a;return it.isBefore(l,s)?null:function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ve(Object(n),!0).forEach((function(t){ze(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ve(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({anchor:s,focus:l},n)},isBackward(e){var{anchor:t,focus:n}=e;return it.isAfter(t,n)},isCollapsed(e){var{anchor:t,focus:n}=e;return it.equals(t,n)},isExpanded:e=>!$e.isCollapsed(e),isForward:e=>!$e.isBackward(e),isRange:e=>H(e)&&it.isPoint(e.anchor)&&it.isPoint(e.focus),*points(e){yield[e.anchor,"anchor"],yield[e.focus,"focus"]},start(e){var[t]=$e.edges(e);return t},transform(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return Se(e,(e=>{if(null===e)return null;var r,o,{affinity:i="inward"}=n;if("inward"===i){var a=$e.isCollapsed(e);$e.isForward(e)?(r="forward",o=a?r:"backward"):(r="backward",o=a?r:"forward")}else"outward"===i?$e.isForward(e)?(r="backward",o="forward"):(r="forward",o="backward"):(r=i,o=i);var s=it.transform(e.anchor,t,{affinity:r}),l=it.transform(e.focus,t,{affinity:o});if(!s||!l)return null;e.anchor=s,e.focus=l}))}},Ke=e=>H(e)&&Ye.isNodeList(e.children)&&!nt.isEditor(e),Ze={isAncestor:e=>H(e)&&Ye.isNodeList(e.children),isElement:Ke,isElementList:e=>Array.isArray(e)&&e.every((e=>Ze.isElement(e))),isElementProps:e=>void 0!==e.children,isElementType:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"type";return Ke(e)&&e[n]===t},matches(e,t){for(var n in t)if("children"!==n&&e[n]!==t[n])return!1;return!0}},Xe=["children"],Ue=["text"],Je=new WeakMap,Ye={ancestor(e,t){var n=Ye.get(e,t);if(pt.isText(n))throw new Error("Cannot get the ancestor node at path [".concat(t,"] because it refers to a text node instead: ").concat(st.stringify(n)));return n},ancestors(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return function*(){for(var r of Te.ancestors(t,n)){var o=[Ye.ancestor(e,r),r];yield o}}()},child(e,t){if(pt.isText(e))throw new Error("Cannot get the child of a text node: ".concat(st.stringify(e)));var n=e.children[t];if(null==n)throw new Error("Cannot get child at index `".concat(t,"` in node: ").concat(st.stringify(e)));return n},children(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return function*(){for(var{reverse:r=!1}=n,o=Ye.ancestor(e,t),{children:i}=o,a=r?i.length-1:0;r?a>=0:a<i.length;){var s=Ye.child(o,a),l=t.concat(a);yield[s,l],a=r?a-1:a+1}}()},common(e,t,n){var r=Te.common(t,n);return[Ye.get(e,r),r]},descendant(e,t){var n=Ye.get(e,t);if(nt.isEditor(n))throw new Error("Cannot get the descendant node at path [".concat(t,"] because it refers to the root editor node instead: ").concat(st.stringify(n)));return n},descendants(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function*(){for(var[n,r]of Ye.nodes(e,t))0!==r.length&&(yield[n,r])}()},elements(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function*(){for(var[n,r]of Ye.nodes(e,t))Ze.isElement(n)&&(yield[n,r])}()},extractProps:e=>Ze.isAncestor(e)?Fe(e,Xe):Fe(e,Ue),first(e,t){for(var n=t.slice(),r=Ye.get(e,n);r&&!pt.isText(r)&&0!==r.children.length;)r=r.children[0],n.push(0);return[r,n]},fragment(e,t){if(pt.isText(e))throw new Error("Cannot get a fragment starting from a root text node: ".concat(st.stringify(e)));var n=Se({children:e.children},(e=>{var[n,r]=$e.edges(t),o=Ye.nodes(e,{reverse:!0,pass:e=>{var[,n]=e;return!$e.includes(t,n)}});for(var[,i]of o){if(!$e.includes(t,i)){var a=Ye.parent(e,i),s=i[i.length-1];a.children.splice(s,1)}if(Te.equals(i,r.path)){var l=Ye.leaf(e,i);l.text=l.text.slice(0,r.offset)}if(Te.equals(i,n.path)){var c=Ye.leaf(e,i);c.text=c.text.slice(n.offset)}}nt.isEditor(e)&&(e.selection=null)}));return n.children},get(e,t){for(var n=e,r=0;r<t.length;r++){var o=t[r];if(pt.isText(n)||!n.children[o])throw new Error("Cannot find a descendant at path [".concat(t,"] in node: ").concat(st.stringify(e)));n=n.children[o]}return n},has(e,t){for(var n=e,r=0;r<t.length;r++){var o=t[r];if(pt.isText(n)||!n.children[o])return!1;n=n.children[o]}return!0},isNode:e=>pt.isText(e)||Ze.isElement(e)||nt.isEditor(e),isNodeList(e){if(!Array.isArray(e))return!1;var t=Je.get(e);if(void 0!==t)return t;var n=e.every((e=>Ye.isNode(e)));return Je.set(e,n),n},last(e,t){for(var n=t.slice(),r=Ye.get(e,n);r&&!pt.isText(r)&&0!==r.children.length;){var o=r.children.length-1;r=r.children[o],n.push(o)}return[r,n]},leaf(e,t){var n=Ye.get(e,t);if(!pt.isText(n))throw new Error("Cannot get the leaf node at path [".concat(t,"] because it refers to a non-leaf node: ").concat(st.stringify(n)));return n},levels(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return function*(){for(var r of Te.levels(t,n)){var o=Ye.get(e,r);yield[o,r]}}()},matches:(e,t)=>Ze.isElement(e)&&Ze.isElementProps(t)&&Ze.matches(e,t)||pt.isText(e)&&pt.isTextProps(t)&&pt.matches(e,t),nodes(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function*(){for(var{pass:n,reverse:r=!1}=t,{from:o=[],to:i}=t,a=new Set,s=[],l=e;!i||!(r?Te.isBefore(s,i):Te.isAfter(s,i));)if(a.has(l)||(yield[l,s]),a.has(l)||pt.isText(l)||0===l.children.length||null!=n&&!1!==n([l,s])){if(0===s.length)break;if(!r){var c=Te.next(s);if(Ye.has(e,c)){s=c,l=Ye.get(e,s);continue}}if(r&&0!==s[s.length-1])s=Te.previous(s),l=Ye.get(e,s);else s=Te.parent(s),l=Ye.get(e,s),a.add(l)}else{a.add(l);var u=r?l.children.length-1:0;Te.isAncestor(s,o)&&(u=o[s.length]),s=s.concat(u),l=Ye.get(e,s)}}()},parent(e,t){var n=Te.parent(t),r=Ye.get(e,n);if(pt.isText(r))throw new Error("Cannot get the parent of path [".concat(t,"] because it does not exist in the root."));return r},string:e=>pt.isText(e)?e.text:e.children.map(Ye.string).join(""),texts(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function*(){for(var[n,r]of Ye.nodes(e,t))pt.isText(n)&&(yield[n,r])}()}};function Ge(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Qe(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ge(Object(n),!0).forEach((function(t){ze(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ge(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var et={isNodeOperation:e=>et.isOperation(e)&&e.type.endsWith("_node"),isOperation(e){if(!H(e))return!1;switch(e.type){case"insert_node":case"remove_node":return Te.isPath(e.path)&&Ye.isNode(e.node);case"insert_text":case"remove_text":return"number"==typeof e.offset&&"string"==typeof e.text&&Te.isPath(e.path);case"merge_node":return"number"==typeof e.position&&Te.isPath(e.path)&&H(e.properties);case"move_node":return Te.isPath(e.path)&&Te.isPath(e.newPath);case"set_node":return Te.isPath(e.path)&&H(e.properties)&&H(e.newProperties);case"set_selection":return null===e.properties&&$e.isRange(e.newProperties)||null===e.newProperties&&$e.isRange(e.properties)||H(e.properties)&&H(e.newProperties);case"split_node":return Te.isPath(e.path)&&"number"==typeof e.position&&H(e.properties);default:return!1}},isOperationList:e=>Array.isArray(e)&&e.every((e=>et.isOperation(e))),isSelectionOperation:e=>et.isOperation(e)&&e.type.endsWith("_selection"),isTextOperation:e=>et.isOperation(e)&&e.type.endsWith("_text"),inverse(e){switch(e.type){case"insert_node":return Qe(Qe({},e),{},{type:"remove_node"});case"insert_text":return Qe(Qe({},e),{},{type:"remove_text"});case"merge_node":return Qe(Qe({},e),{},{type:"split_node",path:Te.previous(e.path)});case"move_node":var{newPath:t,path:n}=e;if(Te.equals(t,n))return e;if(Te.isSibling(n,t))return Qe(Qe({},e),{},{path:t,newPath:n});var r=Te.transform(n,e),o=Te.transform(Te.next(n),e);return Qe(Qe({},e),{},{path:r,newPath:o});case"remove_node":return Qe(Qe({},e),{},{type:"insert_node"});case"remove_text":return Qe(Qe({},e),{},{type:"insert_text"});case"set_node":var{properties:i,newProperties:a}=e;return Qe(Qe({},e),{},{properties:a,newProperties:i});case"set_selection":var{properties:s,newProperties:l}=e;return Qe(Qe({},e),{},null==s?{properties:l,newProperties:null}:null==l?{properties:null,newProperties:s}:{properties:l,newProperties:s});case"split_node":return Qe(Qe({},e),{},{type:"merge_node",path:Te.next(e.path)})}}},tt=new WeakMap,nt={above:(e,t)=>e.above(t),addMark(e,t,n){e.addMark(t,n)},after:(e,t,n)=>e.after(t,n),before:(e,t,n)=>e.before(t,n),deleteBackward(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{unit:n="character"}=t;e.deleteBackward(n)},deleteForward(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{unit:n="character"}=t;e.deleteForward(n)},deleteFragment(e,t){e.deleteFragment(t)},edges:(e,t)=>e.edges(t),elementReadOnly(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e.elementReadOnly(t)},end:(e,t)=>e.end(t),first:(e,t)=>e.first(t),fragment:(e,t)=>e.fragment(t),hasBlocks:(e,t)=>e.hasBlocks(t),hasInlines:(e,t)=>e.hasInlines(t),hasPath:(e,t)=>e.hasPath(t),hasTexts:(e,t)=>e.hasTexts(t),insertBreak(e){e.insertBreak()},insertFragment(e,t,n){e.insertFragment(t,n)},insertNode(e,t){e.insertNode(t)},insertSoftBreak(e){e.insertSoftBreak()},insertText(e,t){e.insertText(t)},isBlock:(e,t)=>e.isBlock(t),isEdge:(e,t,n)=>e.isEdge(t,n),isEditor:e=>(e=>{var t=tt.get(e);if(void 0!==t)return t;if(!H(e))return!1;var n="function"==typeof e.addMark&&"function"==typeof e.apply&&"function"==typeof e.deleteFragment&&"function"==typeof e.insertBreak&&"function"==typeof e.insertSoftBreak&&"function"==typeof e.insertFragment&&"function"==typeof e.insertNode&&"function"==typeof e.insertText&&"function"==typeof e.isElementReadOnly&&"function"==typeof e.isInline&&"function"==typeof e.isSelectable&&"function"==typeof e.isVoid&&"function"==typeof e.normalizeNode&&"function"==typeof e.onChange&&"function"==typeof e.removeMark&&"function"==typeof e.getDirtyPaths&&(null===e.marks||H(e.marks))&&(null===e.selection||$e.isRange(e.selection))&&Ye.isNodeList(e.children)&&et.isOperationList(e.operations);return tt.set(e,n),n})(e),isElementReadOnly:(e,t)=>e.isElementReadOnly(t),isEmpty:(e,t)=>e.isEmpty(t),isEnd:(e,t,n)=>e.isEnd(t,n),isInline:(e,t)=>e.isInline(t),isNormalizing:e=>e.isNormalizing(),isSelectable:(e,t)=>e.isSelectable(t),isStart:(e,t,n)=>e.isStart(t,n),isVoid:(e,t)=>e.isVoid(t),last:(e,t)=>e.last(t),leaf:(e,t,n)=>e.leaf(t,n),levels:(e,t)=>e.levels(t),marks:e=>e.getMarks(),next:(e,t)=>e.next(t),node:(e,t,n)=>e.node(t,n),nodes:(e,t)=>e.nodes(t),normalize(e,t){e.normalize(t)},parent:(e,t,n)=>e.parent(t,n),path:(e,t,n)=>e.path(t,n),pathRef:(e,t,n)=>e.pathRef(t,n),pathRefs:e=>e.pathRefs(),point:(e,t,n)=>e.point(t,n),pointRef:(e,t,n)=>e.pointRef(t,n),pointRefs:e=>e.pointRefs(),positions:(e,t)=>e.positions(t),previous:(e,t)=>e.previous(t),range:(e,t,n)=>e.range(t,n),rangeRef:(e,t,n)=>e.rangeRef(t,n),rangeRefs:e=>e.rangeRefs(),removeMark(e,t){e.removeMark(t)},setNormalizing(e,t){e.setNormalizing(t)},start:(e,t)=>e.start(t),string:(e,t,n)=>e.string(t,n),unhangRange:(e,t,n)=>e.unhangRange(t,n),void:(e,t)=>e.void(t),withoutNormalizing(e,t){e.withoutNormalizing(t)}};function rt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function ot(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?rt(Object(n),!0).forEach((function(t){ze(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):rt(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var it={compare(e,t){var n=Te.compare(e.path,t.path);return 0===n?e.offset<t.offset?-1:e.offset>t.offset?1:0:n},isAfter:(e,t)=>1===it.compare(e,t),isBefore:(e,t)=>-1===it.compare(e,t),equals:(e,t)=>e.offset===t.offset&&Te.equals(e.path,t.path),isPoint:e=>H(e)&&"number"==typeof e.offset&&Te.isPath(e.path),transform(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return Se(e,(e=>{if(null===e)return null;var{affinity:r="forward"}=n,{path:o,offset:i}=e;switch(t.type){case"insert_node":case"move_node":e.path=Te.transform(o,t,n);break;case"insert_text":Te.equals(t.path,o)&&(t.offset<i||t.offset===i&&"forward"===r)&&(e.offset+=t.text.length);break;case"merge_node":Te.equals(t.path,o)&&(e.offset+=t.position),e.path=Te.transform(o,t,n);break;case"remove_text":Te.equals(t.path,o)&&t.offset<=i&&(e.offset-=Math.min(i-t.offset,t.text.length));break;case"remove_node":if(Te.equals(t.path,o)||Te.isAncestor(t.path,o))return null;e.path=Te.transform(o,t,n);break;case"split_node":if(Te.equals(t.path,o)){if(t.position===i&&null==r)return null;(t.position<i||t.position===i&&"forward"===r)&&(e.offset-=t.position,e.path=Te.transform(o,t,ot(ot({},n),{},{affinity:"forward"})))}else e.path=Te.transform(o,t,n)}}))}},at=void 0,st={setScrubber(e){at=e},stringify:e=>JSON.stringify(e,at)},lt=["text"],ct=["anchor","focus"];function ut(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function ft(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ut(Object(n),!0).forEach((function(t){ze(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ut(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var dt,pt={equals(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},{loose:r=!1}=n;function o(e){return Fe(e,lt)}return Ie(r?o(e):e,r?o(t):t)},isText:e=>H(e)&&"string"==typeof e.text,isTextList:e=>Array.isArray(e)&&e.every((e=>pt.isText(e))),isTextProps:e=>void 0!==e.text,matches(e,t){for(var n in t)if("text"!==n&&(!e.hasOwnProperty(n)||e[n]!==t[n]))return!1;return!0},decorations(e,t){var n=[ft({},e)];for(var r of t){var o=Fe(r,ct),[i,a]=$e.edges(r),s=[],l=0,c=i.offset,u=a.offset;for(var f of n){var{length:d}=f.text,p=l;if(l+=d,c<=p&&l<=u)Object.assign(f,o),s.push(f);else if(c!==u&&(c===l||u===p)||c>l||u<p||u===p&&0!==p)s.push(f);else{var h=f,m=void 0,y=void 0;if(u<l){var g=u-p;y=ft(ft({},h),{},{text:h.text.slice(g)}),h=ft(ft({},h),{},{text:h.text.slice(0,g)})}if(c>p){var b=c-p;m=ft(ft({},h),{},{text:h.text.slice(0,b)}),h=ft(ft({},h),{},{text:h.text.slice(b)})}Object.assign(h,o),m&&s.push(m),s.push(h),y&&s.push(y)}}n=s}return n}},ht=e=>e.selection?e.selection:e.children.length>0?nt.end(e,[]):[0];!function(e){e[e.None=0]="None",e[e.Extend=1]="Extend",e[e.ZWJ=2]="ZWJ",e[e.RI=4]="RI",e[e.Prepend=8]="Prepend",e[e.SpacingMark=16]="SpacingMark",e[e.L=32]="L",e[e.V=64]="V",e[e.T=128]="T",e[e.LV=256]="LV",e[e.LVT=512]="LVT",e[e.ExtPict=1024]="ExtPict",e[e.Any=2048]="Any"}(dt||(dt={})),dt.L,dt.L,dt.V,dt.LV,dt.LVT,dt.LV,dt.V,dt.V,dt.T,dt.LVT,dt.T,dt.T,dt.Any,dt.Extend,dt.ZWJ,dt.Any,dt.SpacingMark,dt.Prepend,dt.Any,dt.ZWJ,dt.ExtPict,dt.RI,dt.RI;var mt={delete(e,t){e.delete(t)},insertFragment(e,t,n){e.insertFragment(t,n)},insertText(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};nt.withoutNormalizing(e,(()=>{var{voids:r=!1}=n,{at:o=ht(e)}=n;if(Te.isPath(o)&&(o=nt.range(e,o)),$e.isRange(o))if($e.isCollapsed(o))o=o.anchor;else{var i=$e.end(o);if(!r&&nt.void(e,{at:i}))return;var a=$e.start(o),s=nt.pointRef(e,a),l=nt.pointRef(e,i);bt.delete(e,{at:o,voids:r});var c=s.unref(),u=l.unref();o=c||u,bt.setSelection(e,{anchor:o,focus:o})}if(!(!r&&nt.void(e,{at:o})||nt.elementReadOnly(e,{at:o}))){var{path:f,offset:d}=o;t.length>0&&e.apply({type:"insert_text",path:f,offset:d,text:t})}}))}};function yt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function gt(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?yt(Object(n),!0).forEach((function(t){ze(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):yt(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var bt=gt(gt(gt(gt({},Be),qe),He),mt);const vt={buildTableElements:(t,n)=>{const{rows:r=3,columns:o=3,columnWidth:i=200,headerColumn:a=!1,headerRow:s=!1}=n||{},l={id:e(),type:"table",children:[],props:{headerColumn:a,headerRow:s}};for(let t=0;t<r;t++){const n={id:e(),type:"table-row",children:[]};for(let r=0;r<o;r++){const r={id:e(),type:"table-data-cell",children:[{text:""}],props:{width:i||200,asHeader:0===t&&!!s}};n.children.push(r)}l.children.push(n)}return l},insertTable:(e,r)=>{const o=vt.buildTableElements(e,r);t.insertBlock(e,n({value:[o],type:"Table"}),r)},deleteTable:(e,t)=>{e.deleteBlock({blockId:t})},insertTableRow:(n,o,i)=>{const a=t.getSlate(n,{id:o});a&&nt.withoutNormalizing(a,(()=>{const{insertMode:t="after",path:s=a.selection,select:l=!0}=i||{},c=r.getElementEntry(n,o,{path:s,type:"table-row"});if(!c)return;const[u,f]=c,d="before"===t?f:Te.next(f),p={id:e(),type:"table-row",children:u.children.map((t=>({id:e(),type:"table-data-cell",children:[{text:""}]}))),props:{nodeType:"block"}};bt.insertNodes(a,p,{at:d}),l&&bt.select(a,[...d,0])}))},deleteTableRow:(e,n,o)=>{const i=t.getSlate(e,{id:n});i&&nt.withoutNormalizing(i,(()=>{const{path:t=i.selection}=o||{},a=r.getElementEntry(e,n,{path:t,type:"table-row"});if(!a)return;const[s,l]=a,c=nt.nodes(i,{at:[0],match:e=>Ze.isElement(e)&&"table-row"===e.type,mode:"highest"});1!==Array.from(c).length&&bt.removeNodes(i,{at:l,match:e=>Ze.isElement(e)&&"table-row"===e.type})}))},moveTableRow:(e,n,{from:r,to:o})=>{const i=t.getSlate(e,{id:n});i&&nt.withoutNormalizing(i,(()=>{bt.moveNodes(i,{at:r,to:o,match:e=>Ze.isElement(e)&&"table-row"===e.type})}))},moveTableColumn:(e,n,{from:r,to:o})=>{const i=t.getSlate(e,{id:n});i&&nt.withoutNormalizing(i,(()=>{const e=nt.nodes(i,{at:[0],match:e=>Ze.isElement(e)&&"table-row"===e.type,mode:"all"});Array.from(e).forEach((([e,t])=>{bt.moveNodes(i,{at:t.concat(r[r.length-1]),to:[...t,o[o.length-1]],match:e=>Ze.isElement(e)})}))}))},insertTableColumn:(n,o,i)=>{const a=t.getSlate(n,{id:o});a&&nt.withoutNormalizing(a,(()=>{const{insertMode:t="after",path:s=a.selection,select:l=!0}=i||{},c=r.getElementEntry(n,o,{path:s,type:"table-data-cell"});if(!c)return;const[u,f]=c,d=f[f.length-1],p="before"===t?d:Te.next(f)[f.length-1],h=nt.nodes(a,{at:[0],match:e=>Ze.isElement(e)&&"table-row"===e.type,mode:"lowest"});for(const[,t]of h){const n={id:e(),type:"table-data-cell",children:[{text:""}]};bt.insertNodes(a,n,{at:[...t,p]})}l&&bt.select(a,[0,0,p,0])}))},deleteTableColumn:(e,n,o)=>{const i=t.getSlate(e,{id:n});i&&nt.withoutNormalizing(i,(()=>{const{path:t=i.selection}=o||{},a=nt.nodes(i,{at:[0],match:e=>Ze.isElement(e)&&"table-row"===e.type,mode:"all"}),s=Array.from(a);if(s[0][0].children.length<=1)return;const l=r.getElementEntry(e,n,{path:t,type:"table-data-cell"});if(!l)return;const[c,u]=l,f=u[u.length-1],d=s.map((([e,t])=>e.children[f]?[...t,f]:null));d.forEach((e=>{e&&bt.removeNodes(i,{at:e})}))}))},updateColumnWidth:(e,n,r,o)=>{const i=t.getSlate(e,{id:n});i&&nt.withoutNormalizing(i,(()=>{const e=nt.nodes(i,{at:[0],match:e=>Ze.isElement(e)&&"table-data-cell"===e.type,mode:"all"});Array.from(e).forEach((([e,t])=>{t[t.length-1]===r&&bt.setNodes(i,{props:Object.assign(Object.assign({},e.props),{width:o})},{at:t,match:e=>Ze.isElement(e)&&"table-data-cell"===e.type})}))}))},toggleHeaderRow:(e,n)=>{const o=t.getSlate(e,{id:n});o&&nt.withoutNormalizing(o,(()=>{var t;const i=r.getElement(e,n,{type:"table",path:[0]}),a=(null===(t=null==i?void 0:i.props)||void 0===t?void 0:t.headerRow)||!1,s=nt.nodes(o,{at:[0,0],match:e=>Ze.isElement(e)&&"table-data-cell"===e.type,mode:"all"});Array.from(s).forEach((([e,t])=>{var n;bt.setNodes(o,{props:Object.assign(Object.assign({},e.props),{asHeader:!(null===(n=e.props)||void 0===n?void 0:n.asHeader)})},{at:t,match:e=>Ze.isElement(e)&&"table-data-cell"===e.type})})),bt.setNodes(o,{props:Object.assign(Object.assign({},null==i?void 0:i.props),{headerRow:!a})},{at:[0],match:e=>Ze.isElement(e)&&"table"===e.type})}))},toggleHeaderColumn:(e,n)=>{const o=t.getSlate(e,{id:n});o&&nt.withoutNormalizing(o,(()=>{var t;const i=r.getElement(e,n,{type:"table",path:[0]}),a=(null===(t=null==i?void 0:i.props)||void 0===t?void 0:t.headerColumn)||!1,s=nt.nodes(o,{at:[0],match:e=>Ze.isElement(e)&&"table-row"===e.type,mode:"all"});Array.from(s).forEach((([e,t])=>{var n;const r=e.children[0];bt.setNodes(o,{props:Object.assign(Object.assign({},r.props),{asHeader:!(null===(n=r.props)||void 0===n?void 0:n.asHeader)})},{at:t.concat(0),match:e=>Ze.isElement(e)&&"table-data-cell"===e.type})})),bt.setNodes(o,{props:Object.assign(Object.assign({},null==i?void 0:i.props),{headerColumn:!a})},{at:[0],match:e=>Ze.isElement(e)&&"table"===e.type})}))}},{ExtendedBlockActions:wt,BlockOptionsMenuGroup:xt,BlockOptionsMenuItem:Ot,BlockOptionsSeparator:kt}=o,Et=({editor:e,block:t,table:n})=>{const r=n.props,o=null==r?void 0:r.headerRow,i=null==r?void 0:r.headerColumn;return f(wt,Object.assign({onClick:()=>e.setSelection([t.meta.order]),className:"yoopta-table-options"},{children:[d(kt,{}),f(xt,{children:[d(Ot,{children:f("button",Object.assign({type:"button",className:"yoopta-block-options-button justify-between",onClick:()=>{vt.toggleHeaderRow(e,t.id)}},{children:[f("span",Object.assign({className:"flex"},{children:[d(D,{width:16,height:16,className:"w-4 h-4 mr-2"}),"Header row"]})),o&&d(S,{width:16,height:16,className:"w-4 h-4"})]}))}),d(Ot,{children:f("button",Object.assign({type:"button",className:"yoopta-block-options-button justify-between",onClick:()=>{vt.toggleHeaderColumn(e,t.id)}},{children:[f("span",Object.assign({className:"flex"},{children:[d(L,{width:16,height:16,className:"w-4 h-4 mr-2 rotate-180"}),"Header column"]})),i&&d(S,{width:16,height:16,className:"w-4 h-4"})]}))})]})]}))},_t=new WeakMap,Pt=new WeakMap,jt=({onResize:e,tdWidth:t,columnIndex:n})=>{const r=g(null),o=g(0),i=g(0);return b((()=>{const e=document.querySelector(".yoopta-table");if(!e)return;const t=null==e?void 0:e.offsetHeight;r.current&&(r.current.style.height=`${t}px`)}),[]),b((()=>{var n;const a=document.querySelector(".yoopta-table");if(!a)return;const s=n=>{const s=null==a?void 0:a.offsetHeight;if(!r.current)return;r.current.style.height=`${s}px`,i.current=n.clientX,o.current=t;const l=t=>{const n=t.clientX,r=o.current+(n-i.current);e(r)},c=()=>{document.removeEventListener("mousemove",l),document.removeEventListener("mouseup",c)};document.addEventListener("mousemove",l),document.addEventListener("mouseup",c)};return null===(n=r.current)||void 0===n||n.addEventListener("mousedown",s),()=>{var e;null===(e=r.current)||void 0===e||e.removeEventListener("mousedown",s)}}),[n,t]),d("div",Object.assign({ref:r,className:"resize-handle",contentEditable:!1},{children:d("div",{className:"resize-handle-inner",contentEditable:!1})}))};function Nt(e){return Rt(e)?(e.nodeName||"").toLowerCase():"#document"}function St(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function Ct(e){var t;return null==(t=(Rt(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function Rt(e){return e instanceof Node||e instanceof St(e).Node}function Tt(e){return e instanceof Element||e instanceof St(e).Element}function At(e){return e instanceof HTMLElement||e instanceof St(e).HTMLElement}function Mt(e){return"undefined"!=typeof ShadowRoot&&(e instanceof ShadowRoot||e instanceof St(e).ShadowRoot)}function zt(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=It(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function Dt(e){return["table","td","th"].includes(Nt(e))}function Lt(e){return[":popover-open",":modal"].some((t=>{try{return e.matches(t)}catch(e){return!1}}))}function Bt(e){const t=qt(),n=Tt(e)?It(e):e;return"none"!==n.transform||"none"!==n.perspective||!!n.containerType&&"normal"!==n.containerType||!t&&!!n.backdropFilter&&"none"!==n.backdropFilter||!t&&!!n.filter&&"none"!==n.filter||["transform","perspective","filter"].some((e=>(n.willChange||"").includes(e)))||["paint","layout","strict","content"].some((e=>(n.contain||"").includes(e)))}function qt(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}function Ht(e){return["html","body","#document"].includes(Nt(e))}function It(e){return St(e).getComputedStyle(e)}function Ft(e){return Tt(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Wt(e){if("html"===Nt(e))return e;const t=e.assignedSlot||e.parentNode||Mt(e)&&e.host||Ct(e);return Mt(t)?t.host:t}function Vt(e){const t=Wt(e);return Ht(t)?e.ownerDocument?e.ownerDocument.body:e.body:At(t)&&zt(t)?t:Vt(t)}function $t(e,t,n){var r;void 0===t&&(t=[]),void 0===n&&(n=!0);const o=Vt(e),i=o===(null==(r=e.ownerDocument)?void 0:r.body),a=St(o);if(i){const e=Kt(a);return t.concat(a,a.visualViewport||[],zt(o)?o:[],e&&n?$t(e):[])}return t.concat(o,$t(o,[],n))}function Kt(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}const Zt=Math.min,Xt=Math.max,Ut=Math.round,Jt=e=>({x:e,y:e}),Yt={left:"right",right:"left",bottom:"top",top:"bottom"},Gt={start:"end",end:"start"};function Qt(e,t,n){return Xt(e,Zt(t,n))}function en(e,t){return"function"==typeof e?e(t):e}function tn(e){return e.split("-")[0]}function nn(e){return e.split("-")[1]}function rn(e){return"x"===e?"y":"x"}function on(e){return"y"===e?"height":"width"}function an(e){return["top","bottom"].includes(tn(e))?"y":"x"}function sn(e){return rn(an(e))}function ln(e){return e.replace(/start|end/g,(e=>Gt[e]))}function cn(e){return e.replace(/left|right|bottom|top/g,(e=>Yt[e]))}function un(e){return"number"!=typeof e?function(e){return{top:0,right:0,bottom:0,left:0,...e}}(e):{top:e,right:e,bottom:e,left:e}}function fn(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}function dn(e,t,n){let{reference:r,floating:o}=e;const i=an(t),a=sn(t),s=on(a),l=tn(t),c="y"===i,u=r.x+r.width/2-o.width/2,f=r.y+r.height/2-o.height/2,d=r[s]/2-o[s]/2;let p;switch(l){case"top":p={x:u,y:r.y-o.height};break;case"bottom":p={x:u,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:f};break;case"left":p={x:r.x-o.width,y:f};break;default:p={x:r.x,y:r.y}}switch(nn(t)){case"start":p[a]-=d*(n&&c?-1:1);break;case"end":p[a]+=d*(n&&c?-1:1)}return p}async function pn(e,t){var n;void 0===t&&(t={});const{x:r,y:o,platform:i,rects:a,elements:s,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:f="floating",altBoundary:d=!1,padding:p=0}=en(t,e),h=un(p),m=s[d?"floating"===f?"reference":"floating":f],y=fn(await i.getClippingRect({element:null==(n=await(null==i.isElement?void 0:i.isElement(m)))||n?m:m.contextElement||await(null==i.getDocumentElement?void 0:i.getDocumentElement(s.floating)),boundary:c,rootBoundary:u,strategy:l})),g="floating"===f?{x:r,y:o,width:a.floating.width,height:a.floating.height}:a.reference,b=await(null==i.getOffsetParent?void 0:i.getOffsetParent(s.floating)),v=await(null==i.isElement?void 0:i.isElement(b))&&await(null==i.getScale?void 0:i.getScale(b))||{x:1,y:1},w=fn(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:g,offsetParent:b,strategy:l}):g);return{top:(y.top-w.top+h.top)/v.y,bottom:(w.bottom-y.bottom+h.bottom)/v.y,left:(y.left-w.left+h.left)/v.x,right:(w.right-y.right+h.right)/v.x}}function hn(e){const t=Zt(...e.map((e=>e.left))),n=Zt(...e.map((e=>e.top)));return{x:t,y:n,width:Xt(...e.map((e=>e.right)))-t,height:Xt(...e.map((e=>e.bottom)))-n}}function mn(e){const t=It(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=At(e),i=o?e.offsetWidth:n,a=o?e.offsetHeight:r,s=Ut(n)!==i||Ut(r)!==a;return s&&(n=i,r=a),{width:n,height:r,$:s}}function yn(e){return Tt(e)?e:e.contextElement}function gn(e){const t=yn(e);if(!At(t))return Jt(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=mn(t);let a=(i?Ut(n.width):n.width)/r,s=(i?Ut(n.height):n.height)/o;return a&&Number.isFinite(a)||(a=1),s&&Number.isFinite(s)||(s=1),{x:a,y:s}}const bn=Jt(0);function vn(e){const t=St(e);return qt()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:bn}function wn(e,t,n,r){void 0===t&&(t=!1),void 0===n&&(n=!1);const o=e.getBoundingClientRect(),i=yn(e);let a=Jt(1);t&&(r?Tt(r)&&(a=gn(r)):a=gn(e));const s=function(e,t,n){return void 0===t&&(t=!1),!(!n||t&&n!==St(e))&&t}(i,n,r)?vn(i):Jt(0);let l=(o.left+s.x)/a.x,c=(o.top+s.y)/a.y,u=o.width/a.x,f=o.height/a.y;if(i){const e=St(i),t=r&&Tt(r)?St(r):r;let n=e,o=Kt(n);for(;o&&r&&t!==n;){const e=gn(o),t=o.getBoundingClientRect(),r=It(o),i=t.left+(o.clientLeft+parseFloat(r.paddingLeft))*e.x,a=t.top+(o.clientTop+parseFloat(r.paddingTop))*e.y;l*=e.x,c*=e.y,u*=e.x,f*=e.y,l+=i,c+=a,n=St(o),o=Kt(n)}}return fn({width:u,height:f,x:l,y:c})}function xn(e){return wn(Ct(e)).left+Ft(e).scrollLeft}function On(e,t,n){let r;if("viewport"===t)r=function(e,t){const n=St(e),r=Ct(e),o=n.visualViewport;let i=r.clientWidth,a=r.clientHeight,s=0,l=0;if(o){i=o.width,a=o.height;const e=qt();(!e||e&&"fixed"===t)&&(s=o.offsetLeft,l=o.offsetTop)}return{width:i,height:a,x:s,y:l}}(e,n);else if("document"===t)r=function(e){const t=Ct(e),n=Ft(e),r=e.ownerDocument.body,o=Xt(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=Xt(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let a=-n.scrollLeft+xn(e);const s=-n.scrollTop;return"rtl"===It(r).direction&&(a+=Xt(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:a,y:s}}(Ct(e));else if(Tt(t))r=function(e,t){const n=wn(e,!0,"fixed"===t),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=At(e)?gn(e):Jt(1);return{width:e.clientWidth*i.x,height:e.clientHeight*i.y,x:o*i.x,y:r*i.y}}(t,n);else{const n=vn(e);r={...t,x:t.x-n.x,y:t.y-n.y}}return fn(r)}function kn(e,t){const n=Wt(e);return!(n===t||!Tt(n)||Ht(n))&&("fixed"===It(n).position||kn(n,t))}function En(e,t,n){const r=At(t),o=Ct(t),i="fixed"===n,a=wn(e,!0,i,t);let s={scrollLeft:0,scrollTop:0};const l=Jt(0);if(r||!r&&!i)if(("body"!==Nt(t)||zt(o))&&(s=Ft(t)),r){const e=wn(t,!0,i,t);l.x=e.x+t.clientLeft,l.y=e.y+t.clientTop}else o&&(l.x=xn(o));return{x:a.left+s.scrollLeft-l.x,y:a.top+s.scrollTop-l.y,width:a.width,height:a.height}}function _n(e){return"static"===It(e).position}function Pn(e,t){return At(e)&&"fixed"!==It(e).position?t?t(e):e.offsetParent:null}function jn(e,t){const n=St(e);if(Lt(e))return n;if(!At(e)){let t=Wt(e);for(;t&&!Ht(t);){if(Tt(t)&&!_n(t))return t;t=Wt(t)}return n}let r=Pn(e,t);for(;r&&Dt(r)&&_n(r);)r=Pn(r,t);return r&&Ht(r)&&_n(r)&&!Bt(r)?n:r||function(e){let t=Wt(e);for(;At(t)&&!Ht(t);){if(Bt(t))return t;if(Lt(t))return null;t=Wt(t)}return null}(e)||n}const Nn={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i="fixed"===o,a=Ct(r),s=!!t&&Lt(t.floating);if(r===a||s&&i)return n;let l={scrollLeft:0,scrollTop:0},c=Jt(1);const u=Jt(0),f=At(r);if((f||!f&&!i)&&(("body"!==Nt(r)||zt(a))&&(l=Ft(r)),At(r))){const e=wn(r);c=gn(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+u.x,y:n.y*c.y-l.scrollTop*c.y+u.y}},getDocumentElement:Ct,getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[..."clippingAncestors"===n?Lt(t)?[]:function(e,t){const n=t.get(e);if(n)return n;let r=$t(e,[],!1).filter((e=>Tt(e)&&"body"!==Nt(e))),o=null;const i="fixed"===It(e).position;let a=i?Wt(e):e;for(;Tt(a)&&!Ht(a);){const t=It(a),n=Bt(a);n||"fixed"!==t.position||(o=null),(i?!n&&!o:!n&&"static"===t.position&&o&&["absolute","fixed"].includes(o.position)||zt(a)&&!n&&kn(e,a))?r=r.filter((e=>e!==a)):o=t,a=Wt(a)}return t.set(e,r),r}(t,this._c):[].concat(n),r],a=i[0],s=i.reduce(((e,n)=>{const r=On(t,n,o);return e.top=Xt(r.top,e.top),e.right=Zt(r.right,e.right),e.bottom=Zt(r.bottom,e.bottom),e.left=Xt(r.left,e.left),e}),On(t,a,o));return{width:s.right-s.left,height:s.bottom-s.top,x:s.left,y:s.top}},getOffsetParent:jn,getElementRects:async function(e){const t=this.getOffsetParent||jn,n=this.getDimensions,r=await n(e.floating);return{reference:En(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}},getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){const{width:t,height:n}=mn(e);return{width:t,height:n}},getScale:gn,isElement:Tt,isRTL:function(e){return"rtl"===It(e).direction}},Sn=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:i,placement:a,middlewareData:s}=t,l=await async function(e,t){const{placement:n,platform:r,elements:o}=e,i=await(null==r.isRTL?void 0:r.isRTL(o.floating)),a=tn(n),s=nn(n),l="y"===an(n),c=["left","top"].includes(a)?-1:1,u=i&&l?-1:1,f=en(t,e);let{mainAxis:d,crossAxis:p,alignmentAxis:h}="number"==typeof f?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...f};return s&&"number"==typeof h&&(p="end"===s?-1*h:h),l?{x:p*u,y:d*c}:{x:d*c,y:p*u}}(t,e);return a===(null==(n=s.offset)?void 0:n.placement)&&null!=(r=s.arrow)&&r.alignmentOffset?{}:{x:o+l.x,y:i+l.y,data:{...l,placement:a}}}}},Cn=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:i=!0,crossAxis:a=!1,limiter:s={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=en(e,t),c={x:n,y:r},u=await pn(t,l),f=an(tn(o)),d=rn(f);let p=c[d],h=c[f];if(i){const e="y"===d?"bottom":"right";p=Qt(p+u["y"===d?"top":"left"],p,p-u[e])}if(a){const e="y"===f?"bottom":"right";h=Qt(h+u["y"===f?"top":"left"],h,h-u[e])}const m=s.fn({...t,[d]:p,[f]:h});return{...m,data:{x:m.x-n,y:m.y-r}}}}},Rn=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:i,rects:a,initialPlacement:s,platform:l,elements:c}=t,{mainAxis:u=!0,crossAxis:f=!0,fallbackPlacements:d,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:h="none",flipAlignment:m=!0,...y}=en(e,t);if(null!=(n=i.arrow)&&n.alignmentOffset)return{};const g=tn(o),b=an(s),v=tn(s)===s,w=await(null==l.isRTL?void 0:l.isRTL(c.floating)),x=d||(v||!m?[cn(s)]:function(e){const t=cn(e);return[ln(e),t,ln(t)]}(s)),O="none"!==h;!d&&O&&x.push(...function(e,t,n,r){const o=nn(e);let i=function(e,t,n){const r=["left","right"],o=["right","left"],i=["top","bottom"],a=["bottom","top"];switch(e){case"top":case"bottom":return n?t?o:r:t?r:o;case"left":case"right":return t?i:a;default:return[]}}(tn(e),"start"===n,r);return o&&(i=i.map((e=>e+"-"+o)),t&&(i=i.concat(i.map(ln)))),i}(s,m,h,w));const k=[s,...x],E=await pn(t,y),_=[];let P=(null==(r=i.flip)?void 0:r.overflows)||[];if(u&&_.push(E[g]),f){const e=function(e,t,n){void 0===n&&(n=!1);const r=nn(e),o=sn(e),i=on(o);let a="x"===o?r===(n?"end":"start")?"right":"left":"start"===r?"bottom":"top";return t.reference[i]>t.floating[i]&&(a=cn(a)),[a,cn(a)]}(o,a,w);_.push(E[e[0]],E[e[1]])}if(P=[...P,{placement:o,overflows:_}],!_.every((e=>e<=0))){var j,N;const e=((null==(j=i.flip)?void 0:j.index)||0)+1,t=k[e];if(t)return{data:{index:e,overflows:P},reset:{placement:t}};let n=null==(N=P.filter((e=>e.overflows[0]<=0)).sort(((e,t)=>e.overflows[1]-t.overflows[1]))[0])?void 0:N.placement;if(!n)switch(p){case"bestFit":{var S;const e=null==(S=P.filter((e=>{if(O){const t=an(e.placement);return t===b||"y"===t}return!0})).map((e=>[e.placement,e.overflows.filter((e=>e>0)).reduce(((e,t)=>e+t),0)])).sort(((e,t)=>e[1]-t[1]))[0])?void 0:S[0];e&&(n=e);break}case"initialPlacement":n=s}if(o!==n)return{reset:{placement:n}}}return{}}}},Tn=function(e){return void 0===e&&(e={}),{name:"inline",options:e,async fn(t){const{placement:n,elements:r,rects:o,platform:i,strategy:a}=t,{padding:s=2,x:l,y:c}=en(e,t),u=Array.from(await(null==i.getClientRects?void 0:i.getClientRects(r.reference))||[]),f=function(e){const t=e.slice().sort(((e,t)=>e.y-t.y)),n=[];let r=null;for(let e=0;e<t.length;e++){const o=t[e];!r||o.y-r.y>r.height/2?n.push([o]):n[n.length-1].push(o),r=o}return n.map((e=>fn(hn(e))))}(u),d=fn(hn(u)),p=un(s);const h=await i.getElementRects({reference:{getBoundingClientRect:function(){if(2===f.length&&f[0].left>f[1].right&&null!=l&&null!=c)return f.find((e=>l>e.left-p.left&&l<e.right+p.right&&c>e.top-p.top&&c<e.bottom+p.bottom))||d;if(f.length>=2){if("y"===an(n)){const e=f[0],t=f[f.length-1],r="top"===tn(n),o=e.top,i=t.bottom,a=r?e.left:t.left,s=r?e.right:t.right;return{top:o,bottom:i,left:a,right:s,width:s-a,height:i-o,x:a,y:o}}const e="left"===tn(n),t=Xt(...f.map((e=>e.right))),r=Zt(...f.map((e=>e.left))),o=f.filter((n=>e?n.left===r:n.right===t)),i=o[0].top,a=o[o.length-1].bottom;return{top:i,bottom:a,left:r,right:t,width:t-r,height:a-i,x:r,y:i}}return d}},floating:r.floating,strategy:a});return o.reference.x!==h.reference.x||o.reference.y!==h.reference.y||o.reference.width!==h.reference.width||o.reference.height!==h.reference.height?{reset:{rects:h}}:{}}}},An=(e,t,n)=>{const r=new Map,o={platform:Nn,...n},i={...o.platform,_c:r};return(async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:a}=n,s=i.filter(Boolean),l=await(null==a.isRTL?void 0:a.isRTL(t));let c=await a.getElementRects({reference:e,floating:t,strategy:o}),{x:u,y:f}=dn(c,r,l),d=r,p={},h=0;for(let n=0;n<s.length;n++){const{name:i,fn:m}=s[n],{x:y,y:g,data:b,reset:v}=await m({x:u,y:f,initialPlacement:r,placement:d,strategy:o,middlewareData:p,rects:c,platform:a,elements:{reference:e,floating:t}});u=null!=y?y:u,f=null!=g?g:f,p={...p,[i]:{...p[i],...b}},v&&h<=50&&(h++,"object"==typeof v&&(v.placement&&(d=v.placement),v.rects&&(c=!0===v.rects?await a.getElementRects({reference:e,floating:t,strategy:o}):v.rects),({x:u,y:f}=dn(c,d,l))),n=-1)}return{x:u,y:f,placement:d,strategy:o,middlewareData:p}})(e,t,{...o,platform:i})};var Mn="undefined"!=typeof document?v:b;function zn(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if("function"==typeof e&&e.toString()===t.toString())return!0;let n,r,o;if(e&&t&&"object"==typeof e){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;0!=r--;)if(!zn(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;0!=r--;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;0!=r--;){const n=o[r];if(("_owner"!==n||!e.$$typeof)&&!zn(e[n],t[n]))return!1}return!0}return e!=e&&t!=t}function Dn(e){if("undefined"==typeof window)return 1;return(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Ln(e,t){const n=Dn(e);return Math.round(t*n)/n}function Bn(e){const t=h.useRef(e);return Mn((()=>{t.current=e})),t}const qn=(e,t)=>({...Sn(e),options:[e,t]}),Hn=(e,t)=>({...Cn(e),options:[e,t]}),In=(e,t)=>({...Rn(e),options:[e,t]}),Fn=(e,t)=>({...Tn(e),options:[e,t]}),Wn={...h},Vn=Wn.useInsertionEffect||(e=>e());var $n="undefined"!=typeof document?v:b;let Kn=!1,Zn=0;const Xn=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+Zn++;const Un=Wn.useId||function(){const[e,t]=h.useState((()=>Kn?Xn():void 0));return $n((()=>{null==e&&t(Xn())}),[]),h.useEffect((()=>{Kn=!0}),[]),e};const Jn=h.createContext(null),Yn=h.createContext(null),Gn=()=>{var e;return(null==(e=h.useContext(Jn))?void 0:e.id)||null};function Qn(e){const{open:t=!1,onOpenChange:n,elements:r}=e,o=Un(),i=h.useRef({}),[a]=h.useState((()=>function(){const e=new Map;return{emit(t,n){var r;null==(r=e.get(t))||r.forEach((e=>e(n)))},on(t,n){e.set(t,[...e.get(t)||[],n])},off(t,n){var r;e.set(t,(null==(r=e.get(t))?void 0:r.filter((e=>e!==n)))||[])}}}())),s=null!=Gn();const[l,c]=h.useState(r.reference),u=function(e){const t=h.useRef((()=>{}));return Vn((()=>{t.current=e})),h.useCallback((function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return null==t.current?void 0:t.current(...n)}),[])}(((e,t,r)=>{i.current.openEvent=e?t:void 0,a.emit("openchange",{open:e,event:t,reason:r,nested:s}),null==n||n(e,t,r)})),f=h.useMemo((()=>({setPositionReference:c})),[]),d=h.useMemo((()=>({reference:l||r.reference||null,floating:r.floating||null,domReference:r.reference})),[l,r.reference,r.floating]);return h.useMemo((()=>({dataRef:i,open:t,onOpenChange:u,elements:d,events:a,floatingId:o,refs:f})),[t,u,d,a,o,f])}function er(e){void 0===e&&(e={});const{nodeId:t}=e,n=Qn({...e,elements:{reference:null,floating:null,...e.elements}}),r=e.rootContext||n,o=r.elements,[i,a]=h.useState(null),[s,l]=h.useState(null),c=(null==o?void 0:o.reference)||i,u=h.useRef(null),f=h.useContext(Yn);$n((()=>{c&&(u.current=c)}),[c]);const d=function(e){void 0===e&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:i,floating:a}={},transform:s=!0,whileElementsMounted:l,open:c}=e,[u,f]=h.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[d,p]=h.useState(r);zn(d,r)||p(r);const[m,y]=h.useState(null),[g,b]=h.useState(null),v=h.useCallback((e=>{e!==E.current&&(E.current=e,y(e))}),[]),w=h.useCallback((e=>{e!==_.current&&(_.current=e,b(e))}),[]),x=i||m,k=a||g,E=h.useRef(null),_=h.useRef(null),P=h.useRef(u),j=null!=l,N=Bn(l),S=Bn(o),C=h.useCallback((()=>{if(!E.current||!_.current)return;const e={placement:t,strategy:n,middleware:d};S.current&&(e.platform=S.current),An(E.current,_.current,e).then((e=>{const t={...e,isPositioned:!0};R.current&&!zn(P.current,t)&&(P.current=t,O.flushSync((()=>{f(t)})))}))}),[d,t,n,S]);Mn((()=>{!1===c&&P.current.isPositioned&&(P.current.isPositioned=!1,f((e=>({...e,isPositioned:!1}))))}),[c]);const R=h.useRef(!1);Mn((()=>(R.current=!0,()=>{R.current=!1})),[]),Mn((()=>{if(x&&(E.current=x),k&&(_.current=k),x&&k){if(N.current)return N.current(x,k,C);C()}}),[x,k,C,N,j]);const T=h.useMemo((()=>({reference:E,floating:_,setReference:v,setFloating:w})),[v,w]),A=h.useMemo((()=>({reference:x,floating:k})),[x,k]),M=h.useMemo((()=>{const e={position:n,left:0,top:0};if(!A.floating)return e;const t=Ln(A.floating,u.x),r=Ln(A.floating,u.y);return s?{...e,transform:"translate("+t+"px, "+r+"px)",...Dn(A.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:t,top:r}}),[n,s,A.floating,u.x,u.y]);return h.useMemo((()=>({...u,update:C,refs:T,elements:A,floatingStyles:M})),[u,C,T,A,M])}({...e,elements:{...o,...s&&{reference:s}}}),p=h.useCallback((e=>{const t=Tt(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),contextElement:e}:e;l(t),d.refs.setReference(t)}),[d.refs]),m=h.useCallback((e=>{(Tt(e)||null===e)&&(u.current=e,a(e)),(Tt(d.refs.reference.current)||null===d.refs.reference.current||null!==e&&!Tt(e))&&d.refs.setReference(e)}),[d.refs]),y=h.useMemo((()=>({...d.refs,setReference:m,setPositionReference:p,domReference:u})),[d.refs,m,p]),g=h.useMemo((()=>({...d.elements,domReference:c})),[d.elements,c]),b=h.useMemo((()=>({...d,...r,refs:y,elements:g,nodeId:t})),[d,y,g,t,r]);return $n((()=>{r.dataRef.current.floatingContext=b;const e=null==f?void 0:f.nodesRef.current.find((e=>e.id===t));e&&(e.context=b)})),h.useMemo((()=>({...d,context:b,refs:y,elements:g})),[d,y,g,b])}var tr;function nr(){return nr=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},nr.apply(this,arguments)}var rr=function(e){return h.createElement("svg",nr({viewBox:"0 0 10 10",style:{width:14,height:14,display:"block",flexShrink:0,transform:"rotate(90deg)"}},e),tr||(tr=h.createElement("path",{d:"M3 2a1 1 0 1 1 0-2 1 1 0 0 1 0 2Zm0 4a1 1 0 1 1 0-2 1 1 0 0 1 0 2Zm0 4a1 1 0 1 1 0-2 1 1 0 0 1 0 2Zm4-8a1 1 0 1 1 0-2 1 1 0 0 1 0 2Zm0 4a1 1 0 1 1 0-2 1 1 0 0 1 0 2Zm0 4a1 1 0 1 1 0-2 1 1 0 0 1 0 2Z"})))};function or(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}"function"==typeof SuppressedError&&SuppressedError;const{BlockOptionsMenuGroup:ir,BlockOptionsMenuItem:ar,BlockOptions:sr,BlockOptionsSeparator:lr}=o,cr=e=>{var{editor:t,blockId:n,element:o,onClose:i}=e,a=or(e,["editor","blockId","element","onClose"]);return d(sr,Object.assign({},a,{onClose:i,actions:null},{children:f(ir,{children:[d(ar,{children:f("button",Object.assign({type:"button",className:"yoopta-block-options-button",onClick:()=>{vt.insertTableColumn(t,n,{insertMode:"before"}),i()}},{children:[d(j,{className:"yoopta-table-icons"}),"Insert left"]}))}),d(ar,{children:f("button",Object.assign({type:"button",className:"yoopta-block-options-button",onClick:()=>{vt.insertTableColumn(t,n,{insertMode:"after"}),i()}},{children:[d(N,{className:"yoopta-table-icons"}),"Insert right"]}))}),d(lr,{}),d(ar,{children:f("button",Object.assign({type:"button",className:"yoopta-block-options-button",onClick:()=>{const e=t.blockEditorsMap[n],o=r.getElementEntry(t,n,{type:"table-data-cell",path:e.selection});if(o){const[,r]=o,i=nt.next(e,{at:r,match:e=>Ze.isElement(e)&&"table-data-cell"===e.type});if(!i)return;const[,a]=i;vt.moveTableColumn(t,n,{from:r,to:a})}}},{children:[d(M,{className:"yoopta-table-icons"}),"Move right"]}))}),d(ar,{children:f("button",Object.assign({type:"button",className:"yoopta-block-options-button",onClick:()=>{const e=t.blockEditorsMap[n],o=r.getElementEntry(t,n,{type:"table-data-cell",path:e.selection});if(o){const[,r]=o,i=nt.previous(e,{at:r,match:e=>Ze.isElement(e)&&"table-data-cell"===e.type});if(!i)return;const[,a]=i;vt.moveTableColumn(t,n,{from:r,to:a})}}},{children:[d(A,{className:"yoopta-table-icons"}),"Move left"]}))}),d(lr,{}),d(ar,{children:f("button",Object.assign({type:"button",className:"yoopta-block-options-button",onClick:()=>{let e=r.getElementPath(t,n,o);e&&(vt.deleteTableColumn(t,n,{path:e}),i())}},{children:[d(B,{className:"yoopta-table-icons"}),"Delete"]}))})]})}))},ur=({editor:e,blockId:t,tdElement:n})=>{const[o,i]=w(!1),{refs:a,floatingStyles:s}=er({placement:"bottom-start",open:o,onOpenChange:i,middleware:[Fn(),In(),Hn(),qn(10)]});return f(p,{children:[d(cr,{refs:a,isOpen:o,onClose:()=>{i(!1)},style:s,editor:e,blockId:t,element:n}),d("button",Object.assign({type:"button",ref:a.setReference,onClick:()=>{if(e.readOnly)return;const o=e.blockEditorsMap[t],a=r.getElementPath(e,t,n);a&&(bt.select(o,{path:a.concat([0]),offset:0}),i(!0))},contentEditable:!1,style:o?{opacity:1}:void 0,className:"yoopta-table-column-button"},{children:d(rr,{})}))]})},{BlockOptionsMenuGroup:fr,BlockOptionsMenuItem:dr,BlockOptions:pr,BlockOptionsSeparator:hr}=o,mr=e=>{var{editor:t,blockId:n,onClose:o,tdElement:i}=e,a=or(e,["editor","blockId","onClose","tdElement"]);return d(pr,Object.assign({},a,{onClose:o,actions:null},{children:f(fr,{children:[d(dr,{children:f("button",Object.assign({type:"button",className:"yoopta-block-options-button",onClick:()=>{vt.insertTableRow(t,n,{insertMode:"before",select:!0}),o()}},{children:[d(R,{className:"yoopta-table-icons"}),"Insert above"]}))}),d(dr,{children:f("button",Object.assign({type:"button",className:"yoopta-block-options-button",onClick:()=>{vt.insertTableRow(t,n,{insertMode:"after",select:!0}),o()}},{children:[d(C,{className:"yoopta-table-icons"}),"Insert below"]}))}),d(hr,{}),d(dr,{children:f("button",Object.assign({type:"button",className:"yoopta-block-options-button",onClick:()=>{const e=r.getElementPath(t,n,i),a=r.getElement(t,n,{type:"table-row",path:e});if(!a)return;let s=r.getElementPath(t,n,a);const l=t.blockEditorsMap[n],c=nt.previous(l,{at:s,match:e=>Ze.isElement(e)&&"table-row"===e.type});if(!c)return o();vt.moveTableRow(t,n,{from:s,to:c[1]})}},{children:[d(z,{className:"yoopta-table-icons"}),"Move up"]}))}),d(dr,{children:f("button",Object.assign({type:"button",className:"yoopta-block-options-button",onClick:()=>{const e=r.getElementPath(t,n,i),a=r.getElement(t,n,{type:"table-row",path:e});if(!a)return;let s=r.getElementPath(t,n,a);const l=t.blockEditorsMap[n],c=nt.next(l,{at:s,match:e=>Ze.isElement(e)&&"table-row"===e.type});if(!c)return o();vt.moveTableRow(t,n,{from:s,to:c[1]})}},{children:[d(T,{className:"yoopta-table-icons"}),"Move down"]}))}),d(hr,{}),d(dr,{children:f("button",Object.assign({type:"button",className:"yoopta-block-options-button",onClick:()=>{const e=r.getElementPath(t,n,i),a=r.getElement(t,n,{type:"table-row",path:e});if(!a)return;let s=r.getElementPath(t,n,a);vt.deleteTableRow(t,n,{path:s}),o()}},{children:[d(B,{className:"yoopta-table-icons"}),"Delete row"]}))})]})}))},yr=({editor:e,blockId:t,tdElement:n})=>{const[o,i]=w(!1),{refs:a,floatingStyles:s}=er({placement:"right-start",open:o,onOpenChange:i,middleware:[Fn(),In(),Hn(),qn(10)]});return f(p,{children:[d(mr,{refs:a,isOpen:o,onClose:()=>{i(!1)},style:s,editor:e,blockId:t,tdElement:n}),d("button",Object.assign({ref:a.setReference,type:"button",onClick:()=>{if(e.readOnly)return;const o=e.blockEditorsMap[t],a=r.getElementPath(e,t,n);a&&(bt.select(o,{path:a.concat([0]),offset:0}),i(!0))},contentEditable:!1,className:"yoopta-table-row-button",style:o?{opacity:1}:void 0},{children:d(rr,{className:"w-[14px] h-[14px] block flex-shrink-0",style:{transform:"rotate(0deg)"}})}))]})};const gr=new u({type:"Table",elements:{table:{render:({attributes:e,children:t,blockId:n,element:r,HTMLAttributes:o})=>{const s=i(),l=s.blockEditorsMap[n],c=a(n),u=s.readOnly,p=Pt.get(l);return f("div",Object.assign({className:"yoopta-table-block"},{children:[d("table",Object.assign({},o,{className:"yoopta-table "+(p?"yoopta-table-selecting":"")},{children:d("tbody",Object.assign({},e,{children:t}))})),!u&&d(Et,{block:c,editor:s,table:r})]}))},asRoot:!0,children:["table-row"],props:{headerRow:!1,headerColumn:!1}},"table-row":{render:({attributes:e,children:t,element:n})=>d("tr",Object.assign({className:"yoopta-table-row","data-element-id":n.id},e,{children:t})),children:["table-data-cell"]},"table-data-cell":{render:({attributes:e,children:t,element:n,blockId:o})=>{var a,s,l;const c=i(),u=c.blockEditorsMap[o],p=r.getElementPath(c,o,n),h=null===(a=Pt.get(u))||void 0===a?void 0:a.has(n),m=(null===(s=null==n?void 0:n.props)||void 0===s?void 0:s.asHeader)||!1,y=x((()=>{var e,t;const n=nt.above(u,{at:p,match:e=>Ze.isElement(e)&&"table"===e.type});if(!n)return null;const[r]=n,o=(null===(e=null==r?void 0:r.props)||void 0===e?void 0:e.headerRow)||!1;return{headerColumn:(null===(t=null==r?void 0:r.props)||void 0===t?void 0:t.headerColumn)||!1,headerRow:o}}),[m]),{headerRow:g,headerColumn:b}=y||{},v=(null==p?void 0:p[p.length-1])||0,w=(null===(l=null==n?void 0:n.props)||void 0===l?void 0:l.width)||200,O=0===(null==p?void 0:p[p.length-1]),k=0===(null==p?void 0:p[p.length-2]);let E=!1;k&&g&&(E=!0),O&&b&&(E=!0);const _={maxWidth:w,minWidth:w},P=E?"yoopta-table-data-cell yoopta-table-data-cell-head":"yoopta-table-data-cell";return f(E?"th":"td",Object.assign({scope:E?"col":void 0,"data-cell-selected":h,style:_,colSpan:1,rowSpan:1,className:P},{children:[d("div",Object.assign({className:"yoopta-table-data-cell-content"},e,{children:t})),!c.readOnly&&k&&d(jt,{onResize:e=>{vt.updateColumnWidth(c,o,v,e)},tdWidth:w,columnIndex:v}),!c.readOnly&&k&&d(ur,{editor:c,blockId:o,tdElement:n}),!c.readOnly&&O&&d(yr,{editor:c,blockId:o,tdElement:n})]}))},props:{asHeader:!1,width:200}}},events:{onKeyDown:function(e,t,{hotkeys:n,currentBlock:r}){return o=>{if(t.selection){if(n.isBackspace(o)){const e=Te.parent(t.selection.anchor.path),n=nt.isStart(t,t.selection.anchor,e),r=_t.get(t);if(r)return o.preventDefault(),void nt.withoutNormalizing(t,(()=>{for(const[,e]of r)for(const[n,r]of Ye.children(t,e))if(pt.isText(n)){const e=Ye.string(n).length;e>0&&bt.delete(t,{at:{anchor:{path:r,offset:0},focus:{path:r,offset:e}}})}bt.select(t,{path:r[0][1].concat(0),offset:0})}));if(n&&$e.isCollapsed(t.selection))return void o.preventDefault()}if(n.isCmdShiftEnter(o))return o.preventDefault(),void vt.insertTableRow(e,r.id,{select:!0,insertMode:"before"});if(n.isShiftEnter(o))return o.preventDefault(),void vt.insertTableRow(e,r.id,{select:!0,insertMode:"after"});if(n.isCmdShiftRight(o))return o.preventDefault(),void vt.insertTableColumn(e,r.id,{select:!0,insertMode:"after"});if(n.isCmdShiftLeft(o))return o.preventDefault(),void vt.insertTableColumn(e,r.id,{select:!0,insertMode:"before"});if(n.isCmdShiftDelete(o))return o.preventDefault(),void vt.deleteTableRow(e,r.id);if(n.isCmdAltDelete(o))return o.preventDefault(),void vt.deleteTableColumn(e,r.id);if(n.isArrowUp(o)){o.preventDefault();const e=nt.above(t,{at:t.selection.anchor,match:e=>Ze.isElement(e)&&"table-data-cell"===e.type});if(!e)return;const[n,r]=e;try{const e=r[r.length-1],n=Te.previous(r.slice(0,-1)).concat(e);nt.node(t,n),bt.select(t,n)}catch(e){}}else if(n.isArrowDown(o)){o.preventDefault();const e=nt.above(t,{at:t.selection.anchor,match:e=>Ze.isElement(e)&&"table-data-cell"===e.type});if(!e)return;const[n,r]=e;try{const e=r[r.length-1],n=Te.next(r.slice(0,-1)).concat(e);nt.node(t,n),bt.select(t,n)}catch(e){}}else{if(n.isEnter(o)&&(o.preventDefault(),bt.insertText(t,"\n")),n.isSelect(o)){const n=nt.above(t,{match:e=>Ze.isElement(e)&&"table-data-cell"===e.type});if(n){o.preventDefault();const[i,a]=n,s=nt.string(t,a);if($e.isExpanded(t.selection)||0===s.length)return e.blur(),void e.setBlockSelected([r.meta.order]);bt.select(t,a)}}(o.metaKey||o.ctrlKey)&&o.shiftKey&&"h"===o.key&&(o.preventDefault(),vt.toggleHeaderRow(e,r.id)),(o.metaKey||o.ctrlKey)&&o.shiftKey&&"v"===o.key&&(o.preventDefault(),vt.toggleHeaderColumn(e,r.id))}}}},onBlur:(e,t)=>()=>{Pt.delete(t)},onBeforeCreate:(e,t)=>vt.buildTableElements(e,{rows:3,columns:3})},parsers:{html:{deserialize:{nodeNames:["TABLE"],parse:function(t,n){const r=t.querySelector("tbody"),o=t.querySelector("thead"),i={id:e(),type:"table",children:[],props:{headerRow:"true"===t.getAttribute("data-header-row"),headerColumn:"true"===t.getAttribute("data-header-column")}};if(!r&&!o)return;const a=null==o?void 0:o.querySelector("tr");if(a&&(i.props.headerRow=!0),a){const t={id:e(),type:"table-row",children:[]};Array.from(a.childNodes).forEach((r=>{if("TH"===r.nodeName){const o={id:e(),type:"table-data-cell",children:[{text:""}],props:{asHeader:!0,width:200}};r instanceof HTMLElement&&(null==r?void 0:r.hasAttribute("data-width"))&&(o.props.width=parseInt(r.getAttribute("data-width")||"200",10));let i=s(n,r.childNodes);o.children=i,t.children.push(o)}})),i.children.push(t)}return null==r||r.childNodes.forEach((t=>{const r=Array.from(t.childNodes).filter((e=>"TD"===e.nodeName||"TH"===e.nodeName));if(r.length>0){const t={id:e(),type:"table-row",children:[]};r.forEach((r=>{const o={id:e(),type:"table-data-cell",children:[{text:""}],props:{asHeader:!1,width:200}};if("TH"===r.nodeName&&(o.props.asHeader=!0),"TD"===r.nodeName&&(o.props.asHeader=!1),"TD"===r.nodeName||"TH"===r.nodeName){r instanceof HTMLElement&&(null==r?void 0:r.hasAttribute("data-width"))&&(o.props.width=parseInt(r.getAttribute("data-width")||"200",10));let e=s(n,r.childNodes);o.children=e,t.children.push(o)}})),i.children.push(t)}})),i}},serialize:function(e,t,n){var r,o;const i=e.children[0].children,{align:a="left",depth:s=0}=n||{};return`<table style="margin-left: ${s}px; text-align: ${a}" data-meta-align="${a}" data-meta-depth="${s}" data-header-row="${null===(r=e.props)||void 0===r?void 0:r.headerRow}" data-header-column="${null===(o=e.props)||void 0===o?void 0:o.headerColumn}">\n <colgroup>\n ${i.map((e=>{var t,n;return`<col style="width: ${(null===(t=e.props)||void 0===t?void 0:t.width)?`${null===(n=e.props)||void 0===n?void 0:n.width}px`:"auto"}" />`})).join("")}\n </colgroup>\n <tbody>${e.children.map((e=>`<tr>${e.children.map((e=>{var t,n,r;const o=l(e.children);return(null===(t=e.props)||void 0===t?void 0:t.asHeader)?`<th data-width="${(null===(n=e.props)||void 0===n?void 0:n.width)||200}" rowspan="1" colspan="1">${o}</th>`:`<td data-width="${(null===(r=e.props)||void 0===r?void 0:r.width)||200}" rowspan="1" colspan="1">${o}</td>`})).join("")}</tr>`)).join("")}</tbody></table>`}},markdown:{serialize:function(e,t){let n="";return e.children.forEach(((e,t)=>{const r=e.children.map((e=>` ${c(e.children)} `)).join("|");if(n+=`|${r}|\n`,0===t){const t=e.children.map((()=>" --- ")).join("|");n+=`|${t}|\n`}})),n}}},extensions:function(t,n){return t=function(e){const{deleteBackward:t}=e;return e.deleteBackward=n=>{const{selection:r}=e;if(!r||$e.isExpanded(r))return t(n);const[o]=nt.nodes(e,{match:e=>Ze.isElement(e)&&"table-data-cell"===e.type,at:r}),i=nt.before(e,r,{unit:n}),[a]=i?nt.nodes(e,{match:e=>Ze.isElement(e)&&"table-data-cell"===e.type,at:i}):[void 0];if(!o&&!a)return t(n);if(!o&&a&&i)return bt.select(e,i);const[,s]=o,l=nt.start(e,s);it.equals(r.anchor,l)||t(n)},e}(t=function(t,n){const{normalizeNode:r}=t;return t.normalizeNode=(n,o)=>{const[i,a]=n;if(Ze.isElement(i)&&"table-data-cell"===i.type)for(const[e,n]of Ye.children(t,a)){if(Ze.isElement(e)&&"table"===e.type)return void bt.unwrapNodes(t,{at:n});if(Ze.isElement(e)&&"table-row"===e.type)return void bt.unwrapNodes(t,{at:n});if(Ze.isElement(e)&&"table-data-cell"===e.type)return void bt.unwrapNodes(t,{at:n})}if(Ze.isElement(i)&&"table-row"===i.type)for(const[n,r]of Ye.children(t,a))if(!Ze.isElement(n)||"table-data-cell"!==n.type)return bt.wrapNodes(t,{id:e(),type:"table-data-cell",children:[n]},{at:r});r(n,o)},t}(t=function(e){const{apply:t}=e;return e.apply=n=>{if(!et.isSelectionOperation(n)||!n.newProperties)return Pt.delete(e),_t.delete(e),t(n);const r=Object.assign(Object.assign({},e.selection),n.newProperties);if(!$e.isRange(r))return Pt.delete(e),_t.delete(e),t(n);const[o]=nt.nodes(e,{match:e=>Ze.isElement(e)&&"table-data-cell"===e.type,at:$e.start(r)}),[i]=nt.nodes(e,{match:e=>Ze.isElement(e)&&"table-data-cell"===e.type,at:$e.end(r)});if(!o||!i)return Pt.delete(e),_t.delete(e),t(n);const[,a]=o,[,s]=i;if(Te.equals(a,s))return Pt.delete(e),_t.delete(e),t(n);const l=new WeakSet,c=nt.range(e,a,s),u=Array.from(nt.nodes(e,{at:c,match:e=>Ze.isElement(e)&&"table-data-cell"===e.type})),f=[];for(const[e,t]of u)Ze.isElement(e)&&"table-data-cell"===e.type&&(l.add(e),f.push([e,t]));_t.set(e,f),Pt.set(e,l),t(n)},e}(t)))},options:{display:{title:"Table",description:"Add simple table"},shortcuts:["table","||","3x3"]},commands:vt});export{vt as TableCommands,gr as default};
33
+ function q(e){return"[object Object]"===Object.prototype.toString.call(e)}function H(e){var t,n;return!1!==q(e)&&(void 0===(t=e.constructor)||!1!==q(n=t.prototype)&&!1!==n.hasOwnProperty("isPrototypeOf"))}var I=Symbol.for("immer-nothing"),F=Symbol.for("immer-draftable"),W=Symbol.for("immer-state");function V(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var $=Object.getPrototypeOf;function K(e){return!!e&&!!e[W]}function Z(e){return!!e&&(U(e)||Array.isArray(e)||!!e[F]||!!e.constructor?.[F]||ee(e)||te(e))}var X=Object.prototype.constructor.toString();function U(e){if(!e||"object"!=typeof e)return!1;const t=$(e);if(null===t)return!0;const n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return n===Object||"function"==typeof n&&Function.toString.call(n)===X}function J(e,t){0===Y(e)?Reflect.ownKeys(e).forEach((n=>{t(n,e[n],e)})):e.forEach(((n,r)=>t(r,n,e)))}function Y(e){const t=e[W];return t?t.type_:Array.isArray(e)?1:ee(e)?2:te(e)?3:0}function G(e,t){return 2===Y(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function Q(e,t,n){const r=Y(e);2===r?e.set(t,n):3===r?e.add(n):e[t]=n}function ee(e){return e instanceof Map}function te(e){return e instanceof Set}function ne(e){return e.copy_||e.base_}function re(e,t){if(ee(e))return new Map(e);if(te(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);if(!t&&U(e)){if(!$(e)){const t=Object.create(null);return Object.assign(t,e)}return{...e}}const n=Object.getOwnPropertyDescriptors(e);delete n[W];let r=Reflect.ownKeys(n);for(let t=0;t<r.length;t++){const o=r[t],i=n[o];!1===i.writable&&(i.writable=!0,i.configurable=!0),(i.get||i.set)&&(n[o]={configurable:!0,writable:!0,enumerable:i.enumerable,value:e[o]})}return Object.create($(e),n)}function oe(e,t=!1){return ae(e)||K(e)||!Z(e)||(Y(e)>1&&(e.set=e.add=e.clear=e.delete=ie),Object.freeze(e),t&&Object.entries(e).forEach((([e,t])=>oe(t,!0)))),e}function ie(){V(2)}function ae(e){return Object.isFrozen(e)}var se,le={};function ce(e){const t=le[e];return t||V(0),t}function de(){return se}function fe(e,t){t&&(ce("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function ue(e){pe(e),e.drafts_.forEach(me),e.drafts_=null}function pe(e){e===se&&(se=e.parent_)}function he(e){return se={drafts_:[],parent_:se,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function me(e){const t=e[W];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function ye(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return void 0!==e&&e!==n?(n[W].modified_&&(ue(t),V(4)),Z(e)&&(e=ge(t,e),t.parent_||ve(t,e)),t.patches_&&ce("Patches").generateReplacementPatches_(n[W].base_,e,t.patches_,t.inversePatches_)):e=ge(t,n,[]),ue(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==I?e:void 0}function ge(e,t,n){if(ae(t))return t;const r=t[W];if(!r)return J(t,((o,i)=>be(e,r,t,o,i,n))),t;if(r.scope_!==e)return t;if(!r.modified_)return ve(e,r.base_,!0),r.base_;if(!r.finalized_){r.finalized_=!0,r.scope_.unfinalizedDrafts_--;const t=r.copy_;let o=t,i=!1;3===r.type_&&(o=new Set(t),t.clear(),i=!0),J(o,((o,a)=>be(e,r,t,o,a,n,i))),ve(e,t,!1),n&&e.patches_&&ce("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function be(e,t,n,r,o,i,a){if(K(o)){const a=ge(e,o,i&&t&&3!==t.type_&&!G(t.assigned_,r)?i.concat(r):void 0);if(Q(n,r,a),!K(a))return;e.canAutoFreeze_=!1}else a&&n.add(o);if(Z(o)&&!ae(o)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;ge(e,o),t&&t.scope_.parent_||"symbol"==typeof r||!Object.prototype.propertyIsEnumerable.call(n,r)||ve(e,o)}}function ve(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&oe(t,n)}var we={get(e,t){if(t===W)return e;const n=ne(e);if(!G(n,t))return function(e,t,n){const r=ke(t,n);return r?"value"in r?r.value:r.get?.call(e.draft_):void 0}(e,n,t);const r=n[t];return e.finalized_||!Z(r)?r:r===Oe(e.base_,t)?(_e(e),e.copy_[t]=Pe(r,e)):r},has:(e,t)=>t in ne(e),ownKeys:e=>Reflect.ownKeys(ne(e)),set(e,t,n){const r=ke(ne(e),t);if(r?.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const r=Oe(ne(e),t),a=r?.[W];if(a&&a.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(((o=n)===(i=r)?0!==o||1/o==1/i:o!=o&&i!=i)&&(void 0!==n||G(e.base_,t)))return!0;_e(e),Ee(e)}var o,i;return e.copy_[t]===n&&(void 0!==n||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_[t]=!0),!0},deleteProperty:(e,t)=>(void 0!==Oe(e.base_,t)||t in e.base_?(e.assigned_[t]=!1,_e(e),Ee(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0),getOwnPropertyDescriptor(e,t){const n=ne(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r?{writable:!0,configurable:1!==e.type_||"length"!==t,enumerable:r.enumerable,value:n[t]}:r},defineProperty(){V(11)},getPrototypeOf:e=>$(e.base_),setPrototypeOf(){V(12)}},xe={};function Oe(e,t){const n=e[W];return(n?ne(n):e)[t]}function ke(e,t){if(!(t in e))return;let n=$(e);for(;n;){const e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=$(n)}}function Ee(e){e.modified_||(e.modified_=!0,e.parent_&&Ee(e.parent_))}function _e(e){e.copy_||(e.copy_=re(e.base_,e.scope_.immer_.useStrictShallowCopy_))}J(we,((e,t)=>{xe[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),xe.deleteProperty=function(e,t){return xe.set.call(this,e,t,void 0)},xe.set=function(e,t,n){return we.set.call(this,e[0],t,n,e[0])};function Pe(e,t){const n=ee(e)?ce("MapSet").proxyMap_(e,t):te(e)?ce("MapSet").proxySet_(e,t):function(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:de(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let o=r,i=we;n&&(o=[r],i=xe);const{revoke:a,proxy:s}=Proxy.revocable(o,i);return r.draft_=s,r.revoke_=a,s}(e,t);return(t?t.scope_:de()).drafts_.push(n),n}function je(e){if(!Z(e)||ae(e))return e;const t=e[W];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=re(e,t.scope_.immer_.useStrictShallowCopy_)}else n=re(e,!0);return J(n,((e,t)=>{Q(n,e,je(t))})),t&&(t.finalized_=!1),n}var Ne=new class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(e,t,n)=>{if("function"==typeof e&&"function"!=typeof t){const n=t;t=e;const r=this;return function(e=n,...o){return r.produce(e,(e=>t.call(this,e,...o)))}}let r;if("function"!=typeof t&&V(6),void 0!==n&&"function"!=typeof n&&V(7),Z(e)){const o=he(this),i=Pe(e,void 0);let a=!0;try{r=t(i),a=!1}finally{a?ue(o):pe(o)}return fe(o,n),ye(r,o)}if(!e||"object"!=typeof e){if(r=t(e),void 0===r&&(r=e),r===I&&(r=void 0),this.autoFreeze_&&oe(r,!0),n){const t=[],o=[];ce("Patches").generateReplacementPatches_(e,r,t,o),n(t,o)}return r}V(1)},this.produceWithPatches=(e,t)=>{if("function"==typeof e)return(t,...n)=>this.produceWithPatches(t,(t=>e(t,...n)));let n,r;return[this.produce(e,t,((e,t)=>{n=e,r=t})),n,r]},"boolean"==typeof e?.autoFreeze&&this.setAutoFreeze(e.autoFreeze),"boolean"==typeof e?.useStrictShallowCopy&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){Z(e)||V(8),K(e)&&(e=function(e){K(e)||V(10);return je(e)}(e));const t=he(this),n=Pe(e,void 0);return n[W].isManual_=!0,pe(t),n}finishDraft(e,t){const n=e&&e[W];n&&n.isManual_||V(9);const{scope_:r}=n;return fe(r,t),ye(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const r=t[n];if(0===r.path.length&&"replace"===r.op){e=r.value;break}}n>-1&&(t=t.slice(n+1));const r=ce("Patches").applyPatches_;return K(e)?r(e,t):this.produce(e,(e=>r(e,t)))}},Se=Ne.produce;Ne.produceWithPatches.bind(Ne),Ne.setAutoFreeze.bind(Ne),Ne.setUseStrictShallowCopy.bind(Ne),Ne.applyPatches.bind(Ne);var Ce=Ne.createDraft.bind(Ne),Re=Ne.finishDraft.bind(Ne),Te={ancestors(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{reverse:n=!1}=t,r=Te.levels(e,t);return r=n?r.slice(1):r.slice(0,-1)},common(e,t){for(var n=[],r=0;r<e.length&&r<t.length;r++){var o=e[r];if(o!==t[r])break;n.push(o)}return n},compare(e,t){for(var n=Math.min(e.length,t.length),r=0;r<n;r++){if(e[r]<t[r])return-1;if(e[r]>t[r])return 1}return 0},endsAfter(e,t){var n=e.length-1,r=e.slice(0,n),o=t.slice(0,n),i=e[n],a=t[n];return Te.equals(r,o)&&i>a},endsAt(e,t){var n=e.length,r=e.slice(0,n),o=t.slice(0,n);return Te.equals(r,o)},endsBefore(e,t){var n=e.length-1,r=e.slice(0,n),o=t.slice(0,n),i=e[n],a=t[n];return Te.equals(r,o)&&i<a},equals:(e,t)=>e.length===t.length&&e.every(((e,n)=>e===t[n])),hasPrevious:e=>e[e.length-1]>0,isAfter:(e,t)=>1===Te.compare(e,t),isAncestor:(e,t)=>e.length<t.length&&0===Te.compare(e,t),isBefore:(e,t)=>-1===Te.compare(e,t),isChild:(e,t)=>e.length===t.length+1&&0===Te.compare(e,t),isCommon:(e,t)=>e.length<=t.length&&0===Te.compare(e,t),isDescendant:(e,t)=>e.length>t.length&&0===Te.compare(e,t),isParent:(e,t)=>e.length+1===t.length&&0===Te.compare(e,t),isPath:e=>Array.isArray(e)&&(0===e.length||"number"==typeof e[0]),isSibling(e,t){if(e.length!==t.length)return!1;var n=e.slice(0,-1),r=t.slice(0,-1);return e[e.length-1]!==t[t.length-1]&&Te.equals(n,r)},levels(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{reverse:n=!1}=t,r=[],o=0;o<=e.length;o++)r.push(e.slice(0,o));return n&&r.reverse(),r},next(e){if(0===e.length)throw new Error("Cannot get the next path of a root path [".concat(e,"], because it has no next index."));var t=e[e.length-1];return e.slice(0,-1).concat(t+1)},operationCanTransformPath(e){switch(e.type){case"insert_node":case"remove_node":case"merge_node":case"split_node":case"move_node":return!0;default:return!1}},parent(e){if(0===e.length)throw new Error("Cannot get the parent path of the root path [".concat(e,"]."));return e.slice(0,-1)},previous(e){if(0===e.length)throw new Error("Cannot get the previous path of a root path [".concat(e,"], because it has no previous index."));var t=e[e.length-1];if(t<=0)throw new Error("Cannot get the previous path of a first child path [".concat(e,"] because it would result in a negative index."));return e.slice(0,-1).concat(t-1)},relative(e,t){if(!Te.isAncestor(t,e)&&!Te.equals(e,t))throw new Error("Cannot get the relative path of [".concat(e,"] inside ancestor [").concat(t,"], because it is not above or equal to the path."));return e.slice(t.length)},transform(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!e)return null;var r=[...e],{affinity:o="forward"}=n;if(0===e.length)return r;switch(t.type){case"insert_node":var{path:i}=t;(Te.equals(i,r)||Te.endsBefore(i,r)||Te.isAncestor(i,r))&&(r[i.length-1]+=1);break;case"remove_node":var{path:a}=t;if(Te.equals(a,r)||Te.isAncestor(a,r))return null;Te.endsBefore(a,r)&&(r[a.length-1]-=1);break;case"merge_node":var{path:s,position:l}=t;Te.equals(s,r)||Te.endsBefore(s,r)?r[s.length-1]-=1:Te.isAncestor(s,r)&&(r[s.length-1]-=1,r[s.length]+=l);break;case"split_node":var{path:c,position:d}=t;if(Te.equals(c,r)){if("forward"===o)r[r.length-1]+=1;else if("backward"!==o)return null}else Te.endsBefore(c,r)?r[c.length-1]+=1:Te.isAncestor(c,r)&&e[c.length]>=d&&(r[c.length-1]+=1,r[c.length]-=d);break;case"move_node":var{path:f,newPath:u}=t;if(Te.equals(f,u))return r;if(Te.isAncestor(f,r)||Te.equals(f,r)){var p=u.slice();return Te.endsBefore(f,u)&&f.length<u.length&&(p[f.length-1]-=1),p.concat(r.slice(f.length))}Te.isSibling(f,u)&&(Te.isAncestor(u,r)||Te.equals(u,r))?Te.endsBefore(f,r)?r[f.length-1]-=1:r[f.length-1]+=1:Te.endsBefore(u,r)||Te.equals(u,r)||Te.isAncestor(u,r)?(Te.endsBefore(f,r)&&(r[f.length-1]-=1),r[u.length-1]+=1):Te.endsBefore(f,r)&&(Te.equals(u,r)&&(r[u.length-1]+=1),r[f.length-1]-=1)}return r}};function Ae(e){return Ae="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ae(e)}function Me(e){var t=function(e,t){if("object"!==Ae(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==Ae(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===Ae(t)?t:String(t)}function ze(e,t,n){return(t=Me(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function De(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Le(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?De(Object(n),!0).forEach((function(t){ze(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):De(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var Be={transform(e,t){e.children=Ce(e.children);var n=e.selection&&Ce(e.selection);try{n=((e,t,n)=>{switch(n.type){case"insert_node":var{path:r,node:o}=n,i=Ye.parent(e,r),a=r[r.length-1];if(a>i.children.length)throw new Error('Cannot apply an "insert_node" operation at path ['.concat(r,"] because the destination is past the end of the node."));if(i.children.splice(a,0,o),t)for(var[s,l]of $e.points(t))t[l]=it.transform(s,n);break;case"insert_text":var{path:c,offset:d,text:f}=n;if(0===f.length)break;var u=Ye.leaf(e,c),p=u.text.slice(0,d),h=u.text.slice(d);if(u.text=p+f+h,t)for(var[m,y]of $e.points(t))t[y]=it.transform(m,n);break;case"merge_node":var{path:g}=n,b=Ye.get(e,g),v=Te.previous(g),w=Ye.get(e,v),x=Ye.parent(e,g),O=g[g.length-1];if(pt.isText(b)&&pt.isText(w))w.text+=b.text;else{if(pt.isText(b)||pt.isText(w))throw new Error('Cannot apply a "merge_node" operation at path ['.concat(g,"] to nodes of different interfaces: ").concat(st.stringify(b)," ").concat(st.stringify(w)));w.children.push(...b.children)}if(x.children.splice(O,1),t)for(var[k,E]of $e.points(t))t[E]=it.transform(k,n);break;case"move_node":var{path:_,newPath:P}=n;if(Te.isAncestor(_,P))throw new Error("Cannot move a path [".concat(_,"] to new path [").concat(P,"] because the destination is inside itself."));var j=Ye.get(e,_),N=Ye.parent(e,_),S=_[_.length-1];N.children.splice(S,1);var C=Te.transform(_,n),R=Ye.get(e,Te.parent(C)),T=C[C.length-1];if(R.children.splice(T,0,j),t)for(var[A,M]of $e.points(t))t[M]=it.transform(A,n);break;case"remove_node":var{path:z}=n,D=z[z.length-1];if(Ye.parent(e,z).children.splice(D,1),t)for(var[L,B]of $e.points(t)){var q=it.transform(L,n);if(null!=t&&null!=q)t[B]=q;else{var H=void 0,I=void 0;for(var[F,W]of Ye.texts(e)){if(-1!==Te.compare(W,z)){I=[F,W];break}H=[F,W]}var V=!1;H&&I&&(V=Te.equals(I[1],z)?!Te.hasPrevious(I[1]):Te.common(H[1],z).length<Te.common(I[1],z).length),H&&!V?(L.path=H[1],L.offset=H[0].text.length):I?(L.path=I[1],L.offset=0):t=null}}break;case"remove_text":var{path:$,offset:K,text:Z}=n;if(0===Z.length)break;var X=Ye.leaf(e,$),U=X.text.slice(0,K),J=X.text.slice(K+Z.length);if(X.text=U+J,t)for(var[Y,G]of $e.points(t))t[G]=it.transform(Y,n);break;case"set_node":var{path:Q,properties:ee,newProperties:te}=n;if(0===Q.length)throw new Error("Cannot set properties on the root node!");var ne=Ye.get(e,Q);for(var re in te){if("children"===re||"text"===re)throw new Error('Cannot set the "'.concat(re,'" property of nodes!'));var oe=te[re];null==oe?delete ne[re]:ne[re]=oe}for(var ie in ee)te.hasOwnProperty(ie)||delete ne[ie];break;case"set_selection":var{newProperties:ae}=n;if(null==ae)t=ae;else{if(null==t){if(!$e.isRange(ae))throw new Error('Cannot apply an incomplete "set_selection" operation properties '.concat(st.stringify(ae)," when there is no current selection."));t=Le({},ae)}for(var se in ae){var le=ae[se];if(null==le){if("anchor"===se||"focus"===se)throw new Error('Cannot remove the "'.concat(se,'" selection property'));delete t[se]}else t[se]=le}}break;case"split_node":var{path:ce,position:de,properties:fe}=n;if(0===ce.length)throw new Error('Cannot apply a "split_node" operation at path ['.concat(ce,"] because the root node cannot be split."));var ue,pe=Ye.get(e,ce),he=Ye.parent(e,ce),me=ce[ce.length-1];if(pt.isText(pe)){var ye=pe.text.slice(0,de),ge=pe.text.slice(de);pe.text=ye,ue=Le(Le({},fe),{},{text:ge})}else{var be=pe.children.slice(0,de),ve=pe.children.slice(de);pe.children=be,ue=Le(Le({},fe),{},{children:ve})}if(he.children.splice(me+1,0,ue),t)for(var[we,xe]of $e.points(t))t[xe]=it.transform(we,n)}return t})(e,n,t)}finally{e.children=Re(e.children),e.selection=n?K(n)?Re(n):n:null}}},qe={insertNodes(e,t,n){e.insertNodes(t,n)},liftNodes(e,t){e.liftNodes(t)},mergeNodes(e,t){e.mergeNodes(t)},moveNodes(e,t){e.moveNodes(t)},removeNodes(e,t){e.removeNodes(t)},setNodes(e,t,n){e.setNodes(t,n)},splitNodes(e,t){e.splitNodes(t)},unsetNodes(e,t,n){e.unsetNodes(t,n)},unwrapNodes(e,t){e.unwrapNodes(t)},wrapNodes(e,t,n){e.wrapNodes(t,n)}},He={collapse(e,t){e.collapse(t)},deselect(e){e.deselect()},move(e,t){e.move(t)},select(e,t){e.select(t)},setPoint(e,t,n){e.setPoint(t,n)},setSelection(e,t){e.setSelection(t)}},Ie=(e,t)=>{for(var n in e){var r=e[n],o=t[n];if(H(r)&&H(o)){if(!Ie(r,o))return!1}else if(Array.isArray(r)&&Array.isArray(o)){if(r.length!==o.length)return!1;for(var i=0;i<r.length;i++)if(r[i]!==o[i])return!1}else if(r!==o)return!1}for(var a in t)if(void 0===e[a]&&void 0!==t[a])return!1;return!0};function Fe(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var We=["anchor","focus"];function Ve(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}var $e={edges(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{reverse:n=!1}=t,{anchor:r,focus:o}=e;return $e.isBackward(e)===n?[r,o]:[o,r]},end(e){var[,t]=$e.edges(e);return t},equals:(e,t)=>it.equals(e.anchor,t.anchor)&&it.equals(e.focus,t.focus),includes(e,t){if($e.isRange(t)){if($e.includes(e,t.anchor)||$e.includes(e,t.focus))return!0;var[n,r]=$e.edges(e),[o,i]=$e.edges(t);return it.isBefore(n,o)&&it.isAfter(r,i)}var[a,s]=$e.edges(e),l=!1,c=!1;return it.isPoint(t)?(l=it.compare(t,a)>=0,c=it.compare(t,s)<=0):(l=Te.compare(t,a.path)>=0,c=Te.compare(t,s.path)<=0),l&&c},intersection(e,t){var n=Fe(e,We),[r,o]=$e.edges(e),[i,a]=$e.edges(t),s=it.isBefore(r,i)?i:r,l=it.isBefore(o,a)?o:a;return it.isBefore(l,s)?null:function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ve(Object(n),!0).forEach((function(t){ze(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ve(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({anchor:s,focus:l},n)},isBackward(e){var{anchor:t,focus:n}=e;return it.isAfter(t,n)},isCollapsed(e){var{anchor:t,focus:n}=e;return it.equals(t,n)},isExpanded:e=>!$e.isCollapsed(e),isForward:e=>!$e.isBackward(e),isRange:e=>H(e)&&it.isPoint(e.anchor)&&it.isPoint(e.focus),*points(e){yield[e.anchor,"anchor"],yield[e.focus,"focus"]},start(e){var[t]=$e.edges(e);return t},transform(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return Se(e,(e=>{if(null===e)return null;var r,o,{affinity:i="inward"}=n;if("inward"===i){var a=$e.isCollapsed(e);$e.isForward(e)?(r="forward",o=a?r:"backward"):(r="backward",o=a?r:"forward")}else"outward"===i?$e.isForward(e)?(r="backward",o="forward"):(r="forward",o="backward"):(r=i,o=i);var s=it.transform(e.anchor,t,{affinity:r}),l=it.transform(e.focus,t,{affinity:o});if(!s||!l)return null;e.anchor=s,e.focus=l}))}},Ke=e=>H(e)&&Ye.isNodeList(e.children)&&!nt.isEditor(e),Ze={isAncestor:e=>H(e)&&Ye.isNodeList(e.children),isElement:Ke,isElementList:e=>Array.isArray(e)&&e.every((e=>Ze.isElement(e))),isElementProps:e=>void 0!==e.children,isElementType:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"type";return Ke(e)&&e[n]===t},matches(e,t){for(var n in t)if("children"!==n&&e[n]!==t[n])return!1;return!0}},Xe=["children"],Ue=["text"],Je=new WeakMap,Ye={ancestor(e,t){var n=Ye.get(e,t);if(pt.isText(n))throw new Error("Cannot get the ancestor node at path [".concat(t,"] because it refers to a text node instead: ").concat(st.stringify(n)));return n},ancestors(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return function*(){for(var r of Te.ancestors(t,n)){var o=[Ye.ancestor(e,r),r];yield o}}()},child(e,t){if(pt.isText(e))throw new Error("Cannot get the child of a text node: ".concat(st.stringify(e)));var n=e.children[t];if(null==n)throw new Error("Cannot get child at index `".concat(t,"` in node: ").concat(st.stringify(e)));return n},children(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return function*(){for(var{reverse:r=!1}=n,o=Ye.ancestor(e,t),{children:i}=o,a=r?i.length-1:0;r?a>=0:a<i.length;){var s=Ye.child(o,a),l=t.concat(a);yield[s,l],a=r?a-1:a+1}}()},common(e,t,n){var r=Te.common(t,n);return[Ye.get(e,r),r]},descendant(e,t){var n=Ye.get(e,t);if(nt.isEditor(n))throw new Error("Cannot get the descendant node at path [".concat(t,"] because it refers to the root editor node instead: ").concat(st.stringify(n)));return n},descendants(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function*(){for(var[n,r]of Ye.nodes(e,t))0!==r.length&&(yield[n,r])}()},elements(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function*(){for(var[n,r]of Ye.nodes(e,t))Ze.isElement(n)&&(yield[n,r])}()},extractProps:e=>Ze.isAncestor(e)?Fe(e,Xe):Fe(e,Ue),first(e,t){for(var n=t.slice(),r=Ye.get(e,n);r&&!pt.isText(r)&&0!==r.children.length;)r=r.children[0],n.push(0);return[r,n]},fragment(e,t){if(pt.isText(e))throw new Error("Cannot get a fragment starting from a root text node: ".concat(st.stringify(e)));var n=Se({children:e.children},(e=>{var[n,r]=$e.edges(t),o=Ye.nodes(e,{reverse:!0,pass:e=>{var[,n]=e;return!$e.includes(t,n)}});for(var[,i]of o){if(!$e.includes(t,i)){var a=Ye.parent(e,i),s=i[i.length-1];a.children.splice(s,1)}if(Te.equals(i,r.path)){var l=Ye.leaf(e,i);l.text=l.text.slice(0,r.offset)}if(Te.equals(i,n.path)){var c=Ye.leaf(e,i);c.text=c.text.slice(n.offset)}}nt.isEditor(e)&&(e.selection=null)}));return n.children},get(e,t){for(var n=e,r=0;r<t.length;r++){var o=t[r];if(pt.isText(n)||!n.children[o])throw new Error("Cannot find a descendant at path [".concat(t,"] in node: ").concat(st.stringify(e)));n=n.children[o]}return n},has(e,t){for(var n=e,r=0;r<t.length;r++){var o=t[r];if(pt.isText(n)||!n.children[o])return!1;n=n.children[o]}return!0},isNode:e=>pt.isText(e)||Ze.isElement(e)||nt.isEditor(e),isNodeList(e){if(!Array.isArray(e))return!1;var t=Je.get(e);if(void 0!==t)return t;var n=e.every((e=>Ye.isNode(e)));return Je.set(e,n),n},last(e,t){for(var n=t.slice(),r=Ye.get(e,n);r&&!pt.isText(r)&&0!==r.children.length;){var o=r.children.length-1;r=r.children[o],n.push(o)}return[r,n]},leaf(e,t){var n=Ye.get(e,t);if(!pt.isText(n))throw new Error("Cannot get the leaf node at path [".concat(t,"] because it refers to a non-leaf node: ").concat(st.stringify(n)));return n},levels(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return function*(){for(var r of Te.levels(t,n)){var o=Ye.get(e,r);yield[o,r]}}()},matches:(e,t)=>Ze.isElement(e)&&Ze.isElementProps(t)&&Ze.matches(e,t)||pt.isText(e)&&pt.isTextProps(t)&&pt.matches(e,t),nodes(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function*(){for(var{pass:n,reverse:r=!1}=t,{from:o=[],to:i}=t,a=new Set,s=[],l=e;!i||!(r?Te.isBefore(s,i):Te.isAfter(s,i));)if(a.has(l)||(yield[l,s]),a.has(l)||pt.isText(l)||0===l.children.length||null!=n&&!1!==n([l,s])){if(0===s.length)break;if(!r){var c=Te.next(s);if(Ye.has(e,c)){s=c,l=Ye.get(e,s);continue}}if(r&&0!==s[s.length-1])s=Te.previous(s),l=Ye.get(e,s);else s=Te.parent(s),l=Ye.get(e,s),a.add(l)}else{a.add(l);var d=r?l.children.length-1:0;Te.isAncestor(s,o)&&(d=o[s.length]),s=s.concat(d),l=Ye.get(e,s)}}()},parent(e,t){var n=Te.parent(t),r=Ye.get(e,n);if(pt.isText(r))throw new Error("Cannot get the parent of path [".concat(t,"] because it does not exist in the root."));return r},string:e=>pt.isText(e)?e.text:e.children.map(Ye.string).join(""),texts(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function*(){for(var[n,r]of Ye.nodes(e,t))pt.isText(n)&&(yield[n,r])}()}};function Ge(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Qe(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ge(Object(n),!0).forEach((function(t){ze(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ge(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var et={isNodeOperation:e=>et.isOperation(e)&&e.type.endsWith("_node"),isOperation(e){if(!H(e))return!1;switch(e.type){case"insert_node":case"remove_node":return Te.isPath(e.path)&&Ye.isNode(e.node);case"insert_text":case"remove_text":return"number"==typeof e.offset&&"string"==typeof e.text&&Te.isPath(e.path);case"merge_node":return"number"==typeof e.position&&Te.isPath(e.path)&&H(e.properties);case"move_node":return Te.isPath(e.path)&&Te.isPath(e.newPath);case"set_node":return Te.isPath(e.path)&&H(e.properties)&&H(e.newProperties);case"set_selection":return null===e.properties&&$e.isRange(e.newProperties)||null===e.newProperties&&$e.isRange(e.properties)||H(e.properties)&&H(e.newProperties);case"split_node":return Te.isPath(e.path)&&"number"==typeof e.position&&H(e.properties);default:return!1}},isOperationList:e=>Array.isArray(e)&&e.every((e=>et.isOperation(e))),isSelectionOperation:e=>et.isOperation(e)&&e.type.endsWith("_selection"),isTextOperation:e=>et.isOperation(e)&&e.type.endsWith("_text"),inverse(e){switch(e.type){case"insert_node":return Qe(Qe({},e),{},{type:"remove_node"});case"insert_text":return Qe(Qe({},e),{},{type:"remove_text"});case"merge_node":return Qe(Qe({},e),{},{type:"split_node",path:Te.previous(e.path)});case"move_node":var{newPath:t,path:n}=e;if(Te.equals(t,n))return e;if(Te.isSibling(n,t))return Qe(Qe({},e),{},{path:t,newPath:n});var r=Te.transform(n,e),o=Te.transform(Te.next(n),e);return Qe(Qe({},e),{},{path:r,newPath:o});case"remove_node":return Qe(Qe({},e),{},{type:"insert_node"});case"remove_text":return Qe(Qe({},e),{},{type:"insert_text"});case"set_node":var{properties:i,newProperties:a}=e;return Qe(Qe({},e),{},{properties:a,newProperties:i});case"set_selection":var{properties:s,newProperties:l}=e;return Qe(Qe({},e),{},null==s?{properties:l,newProperties:null}:null==l?{properties:null,newProperties:s}:{properties:l,newProperties:s});case"split_node":return Qe(Qe({},e),{},{type:"merge_node",path:Te.next(e.path)})}}},tt=new WeakMap,nt={above:(e,t)=>e.above(t),addMark(e,t,n){e.addMark(t,n)},after:(e,t,n)=>e.after(t,n),before:(e,t,n)=>e.before(t,n),deleteBackward(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{unit:n="character"}=t;e.deleteBackward(n)},deleteForward(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{unit:n="character"}=t;e.deleteForward(n)},deleteFragment(e,t){e.deleteFragment(t)},edges:(e,t)=>e.edges(t),elementReadOnly(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e.elementReadOnly(t)},end:(e,t)=>e.end(t),first:(e,t)=>e.first(t),fragment:(e,t)=>e.fragment(t),hasBlocks:(e,t)=>e.hasBlocks(t),hasInlines:(e,t)=>e.hasInlines(t),hasPath:(e,t)=>e.hasPath(t),hasTexts:(e,t)=>e.hasTexts(t),insertBreak(e){e.insertBreak()},insertFragment(e,t,n){e.insertFragment(t,n)},insertNode(e,t){e.insertNode(t)},insertSoftBreak(e){e.insertSoftBreak()},insertText(e,t){e.insertText(t)},isBlock:(e,t)=>e.isBlock(t),isEdge:(e,t,n)=>e.isEdge(t,n),isEditor:e=>(e=>{var t=tt.get(e);if(void 0!==t)return t;if(!H(e))return!1;var n="function"==typeof e.addMark&&"function"==typeof e.apply&&"function"==typeof e.deleteFragment&&"function"==typeof e.insertBreak&&"function"==typeof e.insertSoftBreak&&"function"==typeof e.insertFragment&&"function"==typeof e.insertNode&&"function"==typeof e.insertText&&"function"==typeof e.isElementReadOnly&&"function"==typeof e.isInline&&"function"==typeof e.isSelectable&&"function"==typeof e.isVoid&&"function"==typeof e.normalizeNode&&"function"==typeof e.onChange&&"function"==typeof e.removeMark&&"function"==typeof e.getDirtyPaths&&(null===e.marks||H(e.marks))&&(null===e.selection||$e.isRange(e.selection))&&Ye.isNodeList(e.children)&&et.isOperationList(e.operations);return tt.set(e,n),n})(e),isElementReadOnly:(e,t)=>e.isElementReadOnly(t),isEmpty:(e,t)=>e.isEmpty(t),isEnd:(e,t,n)=>e.isEnd(t,n),isInline:(e,t)=>e.isInline(t),isNormalizing:e=>e.isNormalizing(),isSelectable:(e,t)=>e.isSelectable(t),isStart:(e,t,n)=>e.isStart(t,n),isVoid:(e,t)=>e.isVoid(t),last:(e,t)=>e.last(t),leaf:(e,t,n)=>e.leaf(t,n),levels:(e,t)=>e.levels(t),marks:e=>e.getMarks(),next:(e,t)=>e.next(t),node:(e,t,n)=>e.node(t,n),nodes:(e,t)=>e.nodes(t),normalize(e,t){e.normalize(t)},parent:(e,t,n)=>e.parent(t,n),path:(e,t,n)=>e.path(t,n),pathRef:(e,t,n)=>e.pathRef(t,n),pathRefs:e=>e.pathRefs(),point:(e,t,n)=>e.point(t,n),pointRef:(e,t,n)=>e.pointRef(t,n),pointRefs:e=>e.pointRefs(),positions:(e,t)=>e.positions(t),previous:(e,t)=>e.previous(t),range:(e,t,n)=>e.range(t,n),rangeRef:(e,t,n)=>e.rangeRef(t,n),rangeRefs:e=>e.rangeRefs(),removeMark(e,t){e.removeMark(t)},setNormalizing(e,t){e.setNormalizing(t)},start:(e,t)=>e.start(t),string:(e,t,n)=>e.string(t,n),unhangRange:(e,t,n)=>e.unhangRange(t,n),void:(e,t)=>e.void(t),withoutNormalizing(e,t){e.withoutNormalizing(t)}};function rt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function ot(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?rt(Object(n),!0).forEach((function(t){ze(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):rt(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var it={compare(e,t){var n=Te.compare(e.path,t.path);return 0===n?e.offset<t.offset?-1:e.offset>t.offset?1:0:n},isAfter:(e,t)=>1===it.compare(e,t),isBefore:(e,t)=>-1===it.compare(e,t),equals:(e,t)=>e.offset===t.offset&&Te.equals(e.path,t.path),isPoint:e=>H(e)&&"number"==typeof e.offset&&Te.isPath(e.path),transform(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return Se(e,(e=>{if(null===e)return null;var{affinity:r="forward"}=n,{path:o,offset:i}=e;switch(t.type){case"insert_node":case"move_node":e.path=Te.transform(o,t,n);break;case"insert_text":Te.equals(t.path,o)&&(t.offset<i||t.offset===i&&"forward"===r)&&(e.offset+=t.text.length);break;case"merge_node":Te.equals(t.path,o)&&(e.offset+=t.position),e.path=Te.transform(o,t,n);break;case"remove_text":Te.equals(t.path,o)&&t.offset<=i&&(e.offset-=Math.min(i-t.offset,t.text.length));break;case"remove_node":if(Te.equals(t.path,o)||Te.isAncestor(t.path,o))return null;e.path=Te.transform(o,t,n);break;case"split_node":if(Te.equals(t.path,o)){if(t.position===i&&null==r)return null;(t.position<i||t.position===i&&"forward"===r)&&(e.offset-=t.position,e.path=Te.transform(o,t,ot(ot({},n),{},{affinity:"forward"})))}else e.path=Te.transform(o,t,n)}}))}},at=void 0,st={setScrubber(e){at=e},stringify:e=>JSON.stringify(e,at)},lt=["text"],ct=["anchor","focus"];function dt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function ft(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?dt(Object(n),!0).forEach((function(t){ze(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):dt(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var ut,pt={equals(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},{loose:r=!1}=n;function o(e){return Fe(e,lt)}return Ie(r?o(e):e,r?o(t):t)},isText:e=>H(e)&&"string"==typeof e.text,isTextList:e=>Array.isArray(e)&&e.every((e=>pt.isText(e))),isTextProps:e=>void 0!==e.text,matches(e,t){for(var n in t)if("text"!==n&&(!e.hasOwnProperty(n)||e[n]!==t[n]))return!1;return!0},decorations(e,t){var n=[ft({},e)];for(var r of t){var o=Fe(r,ct),[i,a]=$e.edges(r),s=[],l=0,c=i.offset,d=a.offset;for(var f of n){var{length:u}=f.text,p=l;if(l+=u,c<=p&&l<=d)Object.assign(f,o),s.push(f);else if(c!==d&&(c===l||d===p)||c>l||d<p||d===p&&0!==p)s.push(f);else{var h=f,m=void 0,y=void 0;if(d<l){var g=d-p;y=ft(ft({},h),{},{text:h.text.slice(g)}),h=ft(ft({},h),{},{text:h.text.slice(0,g)})}if(c>p){var b=c-p;m=ft(ft({},h),{},{text:h.text.slice(0,b)}),h=ft(ft({},h),{},{text:h.text.slice(b)})}Object.assign(h,o),m&&s.push(m),s.push(h),y&&s.push(y)}}n=s}return n}},ht=e=>e.selection?e.selection:e.children.length>0?nt.end(e,[]):[0];!function(e){e[e.None=0]="None",e[e.Extend=1]="Extend",e[e.ZWJ=2]="ZWJ",e[e.RI=4]="RI",e[e.Prepend=8]="Prepend",e[e.SpacingMark=16]="SpacingMark",e[e.L=32]="L",e[e.V=64]="V",e[e.T=128]="T",e[e.LV=256]="LV",e[e.LVT=512]="LVT",e[e.ExtPict=1024]="ExtPict",e[e.Any=2048]="Any"}(ut||(ut={})),ut.L,ut.L,ut.V,ut.LV,ut.LVT,ut.LV,ut.V,ut.V,ut.T,ut.LVT,ut.T,ut.T,ut.Any,ut.Extend,ut.ZWJ,ut.Any,ut.SpacingMark,ut.Prepend,ut.Any,ut.ZWJ,ut.ExtPict,ut.RI,ut.RI;var mt={delete(e,t){e.delete(t)},insertFragment(e,t,n){e.insertFragment(t,n)},insertText(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};nt.withoutNormalizing(e,(()=>{var{voids:r=!1}=n,{at:o=ht(e)}=n;if(Te.isPath(o)&&(o=nt.range(e,o)),$e.isRange(o))if($e.isCollapsed(o))o=o.anchor;else{var i=$e.end(o);if(!r&&nt.void(e,{at:i}))return;var a=$e.start(o),s=nt.pointRef(e,a),l=nt.pointRef(e,i);bt.delete(e,{at:o,voids:r});var c=s.unref(),d=l.unref();o=c||d,bt.setSelection(e,{anchor:o,focus:o})}if(!(!r&&nt.void(e,{at:o})||nt.elementReadOnly(e,{at:o}))){var{path:f,offset:u}=o;t.length>0&&e.apply({type:"insert_text",path:f,offset:u,text:t})}}))}};function yt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function gt(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?yt(Object(n),!0).forEach((function(t){ze(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):yt(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var bt=gt(gt(gt(gt({},Be),qe),He),mt);const vt={buildTableElements:(t,n)=>{const{rows:r=3,columns:o=3,columnWidth:i=200,headerColumn:a=!1,headerRow:s=!1}=n||{},l={id:e(),type:"table",children:[],props:{headerColumn:a,headerRow:s}};for(let t=0;t<r;t++){const n={id:e(),type:"table-row",children:[]};for(let r=0;r<o;r++){const r={id:e(),type:"table-data-cell",children:[{text:""}],props:{width:i||200,asHeader:0===t&&!!s}};n.children.push(r)}l.children.push(n)}return l},insertTable:(e,r)=>{const o=vt.buildTableElements(e,r);t.insertBlock(e,n({value:[o],type:"Table"}),r)},deleteTable:(e,t)=>{e.deleteBlock({blockId:t})},insertTableRow:(n,o,i)=>{const a=t.getSlate(n,{id:o});a&&nt.withoutNormalizing(a,(()=>{const{insertMode:t="after",path:s=a.selection,select:l=!0}=i||{},c=r.getElementEntry(n,o,{path:s,type:"table-row"});if(!c)return;const[d,f]=c,u="before"===t?f:Te.next(f),p={id:e(),type:"table-row",children:d.children.map((t=>({id:e(),type:"table-data-cell",children:[{text:""}]}))),props:{nodeType:"block"}};bt.insertNodes(a,p,{at:u}),l&&bt.select(a,[...u,0])}))},deleteTableRow:(e,n,o)=>{const i=t.getSlate(e,{id:n});i&&nt.withoutNormalizing(i,(()=>{const{path:t=i.selection}=o||{},a=r.getElementEntry(e,n,{path:t,type:"table-row"});if(!a)return;const[s,l]=a,c=nt.nodes(i,{at:[0],match:e=>Ze.isElement(e)&&"table-row"===e.type,mode:"highest"});1!==Array.from(c).length&&bt.removeNodes(i,{at:l,match:e=>Ze.isElement(e)&&"table-row"===e.type})}))},moveTableRow:(e,n,{from:r,to:o})=>{const i=t.getSlate(e,{id:n});i&&nt.withoutNormalizing(i,(()=>{bt.moveNodes(i,{at:r,to:o,match:e=>Ze.isElement(e)&&"table-row"===e.type})}))},moveTableColumn:(e,n,{from:r,to:o})=>{const i=t.getSlate(e,{id:n});i&&nt.withoutNormalizing(i,(()=>{const e=nt.nodes(i,{at:[0],match:e=>Ze.isElement(e)&&"table-row"===e.type,mode:"all"});Array.from(e).forEach((([e,t])=>{bt.moveNodes(i,{at:t.concat(r[r.length-1]),to:[...t,o[o.length-1]],match:e=>Ze.isElement(e)})}))}))},insertTableColumn:(n,o,i)=>{const a=t.getSlate(n,{id:o});a&&nt.withoutNormalizing(a,(()=>{const{insertMode:t="after",path:s=a.selection,select:l=!0}=i||{},c=r.getElementEntry(n,o,{path:s,type:"table-data-cell"});if(!c)return;const[d,f]=c,u=f[f.length-1],p="before"===t?u:Te.next(f)[f.length-1],h=nt.nodes(a,{at:[0],match:e=>Ze.isElement(e)&&"table-row"===e.type,mode:"lowest"});for(const[,t]of h){const n={id:e(),type:"table-data-cell",children:[{text:""}]};bt.insertNodes(a,n,{at:[...t,p]})}l&&bt.select(a,[0,0,p,0])}))},deleteTableColumn:(e,n,o)=>{const i=t.getSlate(e,{id:n});i&&nt.withoutNormalizing(i,(()=>{const{path:t=i.selection}=o||{},a=nt.nodes(i,{at:[0],match:e=>Ze.isElement(e)&&"table-row"===e.type,mode:"all"}),s=Array.from(a);if(s[0][0].children.length<=1)return;const l=r.getElementEntry(e,n,{path:t,type:"table-data-cell"});if(!l)return;const[c,d]=l,f=d[d.length-1],u=s.map((([e,t])=>e.children[f]?[...t,f]:null));u.forEach((e=>{e&&bt.removeNodes(i,{at:e})}))}))},updateColumnWidth:(e,n,r,o)=>{const i=t.getSlate(e,{id:n});i&&nt.withoutNormalizing(i,(()=>{const e=nt.nodes(i,{at:[0],match:e=>Ze.isElement(e)&&"table-data-cell"===e.type,mode:"all"});Array.from(e).forEach((([e,t])=>{t[t.length-1]===r&&bt.setNodes(i,{props:Object.assign(Object.assign({},e.props),{width:o})},{at:t,match:e=>Ze.isElement(e)&&"table-data-cell"===e.type})}))}))},toggleHeaderRow:(e,n)=>{const o=t.getSlate(e,{id:n});o&&nt.withoutNormalizing(o,(()=>{var t;const i=r.getElement(e,n,{type:"table",path:[0]}),a=(null===(t=null==i?void 0:i.props)||void 0===t?void 0:t.headerRow)||!1,s=nt.nodes(o,{at:[0,0],match:e=>Ze.isElement(e)&&"table-data-cell"===e.type,mode:"all"});Array.from(s).forEach((([e,t])=>{var n;bt.setNodes(o,{props:Object.assign(Object.assign({},e.props),{asHeader:!(null===(n=e.props)||void 0===n?void 0:n.asHeader)})},{at:t,match:e=>Ze.isElement(e)&&"table-data-cell"===e.type})})),bt.setNodes(o,{props:Object.assign(Object.assign({},null==i?void 0:i.props),{headerRow:!a})},{at:[0],match:e=>Ze.isElement(e)&&"table"===e.type})}))},toggleHeaderColumn:(e,n)=>{const o=t.getSlate(e,{id:n});o&&nt.withoutNormalizing(o,(()=>{var t;const i=r.getElement(e,n,{type:"table",path:[0]}),a=(null===(t=null==i?void 0:i.props)||void 0===t?void 0:t.headerColumn)||!1,s=nt.nodes(o,{at:[0],match:e=>Ze.isElement(e)&&"table-row"===e.type,mode:"all"});Array.from(s).forEach((([e,t])=>{var n;const r=e.children[0];bt.setNodes(o,{props:Object.assign(Object.assign({},r.props),{asHeader:!(null===(n=r.props)||void 0===n?void 0:n.asHeader)})},{at:t.concat(0),match:e=>Ze.isElement(e)&&"table-data-cell"===e.type})})),bt.setNodes(o,{props:Object.assign(Object.assign({},null==i?void 0:i.props),{headerColumn:!a})},{at:[0],match:e=>Ze.isElement(e)&&"table"===e.type})}))}},{ExtendedBlockActions:wt,BlockOptionsMenuGroup:xt,BlockOptionsMenuItem:Ot,BlockOptionsSeparator:kt}=o,Et=({editor:e,block:t,table:n})=>{const r=n.props,o=null==r?void 0:r.headerRow,i=null==r?void 0:r.headerColumn;return f(wt,Object.assign({onClick:()=>e.setSelection([t.meta.order]),className:"yoopta-table-options"},{children:[u(kt,{}),f(xt,{children:[u(Ot,{children:f("button",Object.assign({type:"button",className:"yoopta-block-options-button justify-between",onClick:()=>{vt.toggleHeaderRow(e,t.id)}},{children:[f("span",Object.assign({className:"flex"},{children:[u(D,{width:16,height:16,className:"w-4 h-4 mr-2"}),"Header row"]})),o&&u(S,{width:16,height:16,className:"w-4 h-4"})]}))}),u(Ot,{children:f("button",Object.assign({type:"button",className:"yoopta-block-options-button justify-between",onClick:()=>{vt.toggleHeaderColumn(e,t.id)}},{children:[f("span",Object.assign({className:"flex"},{children:[u(L,{width:16,height:16,className:"w-4 h-4 mr-2 rotate-180"}),"Header column"]})),i&&u(S,{width:16,height:16,className:"w-4 h-4"})]}))})]})]}))},_t=new WeakMap,Pt=new WeakMap,jt=({onResize:e,tdWidth:t,columnIndex:n})=>{const r=g(null),o=g(0),i=g(0);return b((()=>{const e=document.querySelector(".yoopta-table");if(!e)return;const t=null==e?void 0:e.offsetHeight;r.current&&(r.current.style.height=`${t}px`)}),[]),b((()=>{var n;const a=document.querySelector(".yoopta-table");if(!a)return;const s=n=>{const s=null==a?void 0:a.offsetHeight;if(!r.current)return;r.current.style.height=`${s}px`,i.current=n.clientX,o.current=t;const l=t=>{const n=t.clientX,r=o.current+(n-i.current);e(r)},c=()=>{document.removeEventListener("mousemove",l),document.removeEventListener("mouseup",c)};document.addEventListener("mousemove",l),document.addEventListener("mouseup",c)};return null===(n=r.current)||void 0===n||n.addEventListener("mousedown",s),()=>{var e;null===(e=r.current)||void 0===e||e.removeEventListener("mousedown",s)}}),[n,t]),u("div",Object.assign({ref:r,className:"resize-handle",contentEditable:!1},{children:u("div",{className:"resize-handle-inner",contentEditable:!1})}))};function Nt(e){return Rt(e)?(e.nodeName||"").toLowerCase():"#document"}function St(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function Ct(e){var t;return null==(t=(Rt(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function Rt(e){return e instanceof Node||e instanceof St(e).Node}function Tt(e){return e instanceof Element||e instanceof St(e).Element}function At(e){return e instanceof HTMLElement||e instanceof St(e).HTMLElement}function Mt(e){return"undefined"!=typeof ShadowRoot&&(e instanceof ShadowRoot||e instanceof St(e).ShadowRoot)}function zt(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=Ht(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function Dt(e){return["table","td","th"].includes(Nt(e))}function Lt(e){const t=Bt(),n=Ht(e);return"none"!==n.transform||"none"!==n.perspective||!!n.containerType&&"normal"!==n.containerType||!t&&!!n.backdropFilter&&"none"!==n.backdropFilter||!t&&!!n.filter&&"none"!==n.filter||["transform","perspective","filter"].some((e=>(n.willChange||"").includes(e)))||["paint","layout","strict","content"].some((e=>(n.contain||"").includes(e)))}function Bt(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}function qt(e){return["html","body","#document"].includes(Nt(e))}function Ht(e){return St(e).getComputedStyle(e)}function It(e){return Tt(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function Ft(e){if("html"===Nt(e))return e;const t=e.assignedSlot||e.parentNode||Mt(e)&&e.host||Ct(e);return Mt(t)?t.host:t}function Wt(e){const t=Ft(e);return qt(t)?e.ownerDocument?e.ownerDocument.body:e.body:At(t)&&zt(t)?t:Wt(t)}function Vt(e,t,n){var r;void 0===t&&(t=[]),void 0===n&&(n=!0);const o=Wt(e),i=o===(null==(r=e.ownerDocument)?void 0:r.body),a=St(o);return i?t.concat(a,a.visualViewport||[],zt(o)?o:[],a.frameElement&&n?Vt(a.frameElement):[]):t.concat(o,Vt(o,[],n))}const $t=Math.min,Kt=Math.max,Zt=Math.round,Xt=e=>({x:e,y:e}),Ut={left:"right",right:"left",bottom:"top",top:"bottom"},Jt={start:"end",end:"start"};function Yt(e,t,n){return Kt(e,$t(t,n))}function Gt(e,t){return"function"==typeof e?e(t):e}function Qt(e){return e.split("-")[0]}function en(e){return e.split("-")[1]}function tn(e){return"x"===e?"y":"x"}function nn(e){return"y"===e?"height":"width"}function rn(e){return["top","bottom"].includes(Qt(e))?"y":"x"}function on(e){return tn(rn(e))}function an(e){return e.replace(/start|end/g,(e=>Jt[e]))}function sn(e){return e.replace(/left|right|bottom|top/g,(e=>Ut[e]))}function ln(e){return"number"!=typeof e?function(e){return{top:0,right:0,bottom:0,left:0,...e}}(e):{top:e,right:e,bottom:e,left:e}}function cn(e){return{...e,top:e.y,left:e.x,right:e.x+e.width,bottom:e.y+e.height}}function dn(e,t,n){let{reference:r,floating:o}=e;const i=rn(t),a=on(t),s=nn(a),l=Qt(t),c="y"===i,d=r.x+r.width/2-o.width/2,f=r.y+r.height/2-o.height/2,u=r[s]/2-o[s]/2;let p;switch(l){case"top":p={x:d,y:r.y-o.height};break;case"bottom":p={x:d,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:f};break;case"left":p={x:r.x-o.width,y:f};break;default:p={x:r.x,y:r.y}}switch(en(t)){case"start":p[a]-=u*(n&&c?-1:1);break;case"end":p[a]+=u*(n&&c?-1:1)}return p}async function fn(e,t){var n;void 0===t&&(t={});const{x:r,y:o,platform:i,rects:a,elements:s,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:d="viewport",elementContext:f="floating",altBoundary:u=!1,padding:p=0}=Gt(t,e),h=ln(p),m=s[u?"floating"===f?"reference":"floating":f],y=cn(await i.getClippingRect({element:null==(n=await(null==i.isElement?void 0:i.isElement(m)))||n?m:m.contextElement||await(null==i.getDocumentElement?void 0:i.getDocumentElement(s.floating)),boundary:c,rootBoundary:d,strategy:l})),g="floating"===f?{...a.floating,x:r,y:o}:a.reference,b=await(null==i.getOffsetParent?void 0:i.getOffsetParent(s.floating)),v=await(null==i.isElement?void 0:i.isElement(b))&&await(null==i.getScale?void 0:i.getScale(b))||{x:1,y:1},w=cn(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:g,offsetParent:b,strategy:l}):g);return{top:(y.top-w.top+h.top)/v.y,bottom:(w.bottom-y.bottom+h.bottom)/v.y,left:(y.left-w.left+h.left)/v.x,right:(w.right-y.right+h.right)/v.x}}function un(e){const t=$t(...e.map((e=>e.left))),n=$t(...e.map((e=>e.top)));return{x:t,y:n,width:Kt(...e.map((e=>e.right)))-t,height:Kt(...e.map((e=>e.bottom)))-n}}const pn=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:i,placement:a,middlewareData:s}=t,l=await async function(e,t){const{placement:n,platform:r,elements:o}=e,i=await(null==r.isRTL?void 0:r.isRTL(o.floating)),a=Qt(n),s=en(n),l="y"===rn(n),c=["left","top"].includes(a)?-1:1,d=i&&l?-1:1,f=Gt(t,e);let{mainAxis:u,crossAxis:p,alignmentAxis:h}="number"==typeof f?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...f};return s&&"number"==typeof h&&(p="end"===s?-1*h:h),l?{x:p*d,y:u*c}:{x:u*c,y:p*d}}(t,e);return a===(null==(n=s.offset)?void 0:n.placement)&&null!=(r=s.arrow)&&r.alignmentOffset?{}:{x:o+l.x,y:i+l.y,data:{...l,placement:a}}}}};function hn(e){const t=Ht(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=At(e),i=o?e.offsetWidth:n,a=o?e.offsetHeight:r,s=Zt(n)!==i||Zt(r)!==a;return s&&(n=i,r=a),{width:n,height:r,$:s}}function mn(e){return Tt(e)?e:e.contextElement}function yn(e){const t=mn(e);if(!At(t))return Xt(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=hn(t);let a=(i?Zt(n.width):n.width)/r,s=(i?Zt(n.height):n.height)/o;return a&&Number.isFinite(a)||(a=1),s&&Number.isFinite(s)||(s=1),{x:a,y:s}}const gn=Xt(0);function bn(e){const t=St(e);return Bt()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:gn}function vn(e,t,n,r){void 0===t&&(t=!1),void 0===n&&(n=!1);const o=e.getBoundingClientRect(),i=mn(e);let a=Xt(1);t&&(r?Tt(r)&&(a=yn(r)):a=yn(e));const s=function(e,t,n){return void 0===t&&(t=!1),!(!n||t&&n!==St(e))&&t}(i,n,r)?bn(i):Xt(0);let l=(o.left+s.x)/a.x,c=(o.top+s.y)/a.y,d=o.width/a.x,f=o.height/a.y;if(i){const e=St(i),t=r&&Tt(r)?St(r):r;let n=e,o=n.frameElement;for(;o&&r&&t!==n;){const e=yn(o),t=o.getBoundingClientRect(),r=Ht(o),i=t.left+(o.clientLeft+parseFloat(r.paddingLeft))*e.x,a=t.top+(o.clientTop+parseFloat(r.paddingTop))*e.y;l*=e.x,c*=e.y,d*=e.x,f*=e.y,l+=i,c+=a,n=St(o),o=n.frameElement}}return cn({width:d,height:f,x:l,y:c})}const wn=[":popover-open",":modal"];function xn(e){return wn.some((t=>{try{return e.matches(t)}catch(e){return!1}}))}function On(e){return vn(Ct(e)).left+It(e).scrollLeft}function kn(e,t,n){let r;if("viewport"===t)r=function(e,t){const n=St(e),r=Ct(e),o=n.visualViewport;let i=r.clientWidth,a=r.clientHeight,s=0,l=0;if(o){i=o.width,a=o.height;const e=Bt();(!e||e&&"fixed"===t)&&(s=o.offsetLeft,l=o.offsetTop)}return{width:i,height:a,x:s,y:l}}(e,n);else if("document"===t)r=function(e){const t=Ct(e),n=It(e),r=e.ownerDocument.body,o=Kt(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=Kt(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let a=-n.scrollLeft+On(e);const s=-n.scrollTop;return"rtl"===Ht(r).direction&&(a+=Kt(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:a,y:s}}(Ct(e));else if(Tt(t))r=function(e,t){const n=vn(e,!0,"fixed"===t),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=At(e)?yn(e):Xt(1);return{width:e.clientWidth*i.x,height:e.clientHeight*i.y,x:o*i.x,y:r*i.y}}(t,n);else{const n=bn(e);r={...t,x:t.x-n.x,y:t.y-n.y}}return cn(r)}function En(e,t){const n=Ft(e);return!(n===t||!Tt(n)||qt(n))&&("fixed"===Ht(n).position||En(n,t))}function _n(e,t,n){const r=At(t),o=Ct(t),i="fixed"===n,a=vn(e,!0,i,t);let s={scrollLeft:0,scrollTop:0};const l=Xt(0);if(r||!r&&!i)if(("body"!==Nt(t)||zt(o))&&(s=It(t)),r){const e=vn(t,!0,i,t);l.x=e.x+t.clientLeft,l.y=e.y+t.clientTop}else o&&(l.x=On(o));return{x:a.left+s.scrollLeft-l.x,y:a.top+s.scrollTop-l.y,width:a.width,height:a.height}}function Pn(e,t){return At(e)&&"fixed"!==Ht(e).position?t?t(e):e.offsetParent:null}function jn(e,t){const n=St(e);if(!At(e)||xn(e))return n;let r=Pn(e,t);for(;r&&Dt(r)&&"static"===Ht(r).position;)r=Pn(r,t);return r&&("html"===Nt(r)||"body"===Nt(r)&&"static"===Ht(r).position&&!Lt(r))?n:r||function(e){let t=Ft(e);for(;At(t)&&!qt(t);){if(Lt(t))return t;t=Ft(t)}return null}(e)||n}const Nn={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i="fixed"===o,a=Ct(r),s=!!t&&xn(t.floating);if(r===a||s&&i)return n;let l={scrollLeft:0,scrollTop:0},c=Xt(1);const d=Xt(0),f=At(r);if((f||!f&&!i)&&(("body"!==Nt(r)||zt(a))&&(l=It(r)),At(r))){const e=vn(r);c=yn(r),d.x=e.x+r.clientLeft,d.y=e.y+r.clientTop}return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+d.x,y:n.y*c.y-l.scrollTop*c.y+d.y}},getDocumentElement:Ct,getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[..."clippingAncestors"===n?function(e,t){const n=t.get(e);if(n)return n;let r=Vt(e,[],!1).filter((e=>Tt(e)&&"body"!==Nt(e))),o=null;const i="fixed"===Ht(e).position;let a=i?Ft(e):e;for(;Tt(a)&&!qt(a);){const t=Ht(a),n=Lt(a);n||"fixed"!==t.position||(o=null),(i?!n&&!o:!n&&"static"===t.position&&o&&["absolute","fixed"].includes(o.position)||zt(a)&&!n&&En(e,a))?r=r.filter((e=>e!==a)):o=t,a=Ft(a)}return t.set(e,r),r}(t,this._c):[].concat(n),r],a=i[0],s=i.reduce(((e,n)=>{const r=kn(t,n,o);return e.top=Kt(r.top,e.top),e.right=$t(r.right,e.right),e.bottom=$t(r.bottom,e.bottom),e.left=Kt(r.left,e.left),e}),kn(t,a,o));return{width:s.right-s.left,height:s.bottom-s.top,x:s.left,y:s.top}},getOffsetParent:jn,getElementRects:async function(e){const t=this.getOffsetParent||jn,n=this.getDimensions;return{reference:_n(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,...await n(e.floating)}}},getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){const{width:t,height:n}=hn(e);return{width:t,height:n}},getScale:yn,isElement:Tt,isRTL:function(e){return"rtl"===Ht(e).direction}},Sn=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:i=!0,crossAxis:a=!1,limiter:s={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=Gt(e,t),c={x:n,y:r},d=await fn(t,l),f=rn(Qt(o)),u=tn(f);let p=c[u],h=c[f];if(i){const e="y"===u?"bottom":"right";p=Yt(p+d["y"===u?"top":"left"],p,p-d[e])}if(a){const e="y"===f?"bottom":"right";h=Yt(h+d["y"===f?"top":"left"],h,h-d[e])}const m=s.fn({...t,[u]:p,[f]:h});return{...m,data:{x:m.x-n,y:m.y-r}}}}},Cn=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:i,rects:a,initialPlacement:s,platform:l,elements:c}=t,{mainAxis:d=!0,crossAxis:f=!0,fallbackPlacements:u,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:h="none",flipAlignment:m=!0,...y}=Gt(e,t);if(null!=(n=i.arrow)&&n.alignmentOffset)return{};const g=Qt(o),b=Qt(s)===s,v=await(null==l.isRTL?void 0:l.isRTL(c.floating)),w=u||(b||!m?[sn(s)]:function(e){const t=sn(e);return[an(e),t,an(t)]}(s));u||"none"===h||w.push(...function(e,t,n,r){const o=en(e);let i=function(e,t,n){const r=["left","right"],o=["right","left"],i=["top","bottom"],a=["bottom","top"];switch(e){case"top":case"bottom":return n?t?o:r:t?r:o;case"left":case"right":return t?i:a;default:return[]}}(Qt(e),"start"===n,r);return o&&(i=i.map((e=>e+"-"+o)),t&&(i=i.concat(i.map(an)))),i}(s,m,h,v));const x=[s,...w],O=await fn(t,y),k=[];let E=(null==(r=i.flip)?void 0:r.overflows)||[];if(d&&k.push(O[g]),f){const e=function(e,t,n){void 0===n&&(n=!1);const r=en(e),o=on(e),i=nn(o);let a="x"===o?r===(n?"end":"start")?"right":"left":"start"===r?"bottom":"top";return t.reference[i]>t.floating[i]&&(a=sn(a)),[a,sn(a)]}(o,a,v);k.push(O[e[0]],O[e[1]])}if(E=[...E,{placement:o,overflows:k}],!k.every((e=>e<=0))){var _,P;const e=((null==(_=i.flip)?void 0:_.index)||0)+1,t=x[e];if(t)return{data:{index:e,overflows:E},reset:{placement:t}};let n=null==(P=E.filter((e=>e.overflows[0]<=0)).sort(((e,t)=>e.overflows[1]-t.overflows[1]))[0])?void 0:P.placement;if(!n)switch(p){case"bestFit":{var j;const e=null==(j=E.map((e=>[e.placement,e.overflows.filter((e=>e>0)).reduce(((e,t)=>e+t),0)])).sort(((e,t)=>e[1]-t[1]))[0])?void 0:j[0];e&&(n=e);break}case"initialPlacement":n=s}if(o!==n)return{reset:{placement:n}}}return{}}}},Rn=function(e){return void 0===e&&(e={}),{name:"inline",options:e,async fn(t){const{placement:n,elements:r,rects:o,platform:i,strategy:a}=t,{padding:s=2,x:l,y:c}=Gt(e,t),d=Array.from(await(null==i.getClientRects?void 0:i.getClientRects(r.reference))||[]),f=function(e){const t=e.slice().sort(((e,t)=>e.y-t.y)),n=[];let r=null;for(let e=0;e<t.length;e++){const o=t[e];!r||o.y-r.y>r.height/2?n.push([o]):n[n.length-1].push(o),r=o}return n.map((e=>cn(un(e))))}(d),u=cn(un(d)),p=ln(s);const h=await i.getElementRects({reference:{getBoundingClientRect:function(){if(2===f.length&&f[0].left>f[1].right&&null!=l&&null!=c)return f.find((e=>l>e.left-p.left&&l<e.right+p.right&&c>e.top-p.top&&c<e.bottom+p.bottom))||u;if(f.length>=2){if("y"===rn(n)){const e=f[0],t=f[f.length-1],r="top"===Qt(n),o=e.top,i=t.bottom,a=r?e.left:t.left,s=r?e.right:t.right;return{top:o,bottom:i,left:a,right:s,width:s-a,height:i-o,x:a,y:o}}const e="left"===Qt(n),t=Kt(...f.map((e=>e.right))),r=$t(...f.map((e=>e.left))),o=f.filter((n=>e?n.left===r:n.right===t)),i=o[0].top,a=o[o.length-1].bottom;return{top:i,bottom:a,left:r,right:t,width:t-r,height:a-i,x:r,y:i}}return u}},floating:r.floating,strategy:a});return o.reference.x!==h.reference.x||o.reference.y!==h.reference.y||o.reference.width!==h.reference.width||o.reference.height!==h.reference.height?{reset:{rects:h}}:{}}}},Tn=(e,t,n)=>{const r=new Map,o={platform:Nn,...n},i={...o.platform,_c:r};return(async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:a}=n,s=i.filter(Boolean),l=await(null==a.isRTL?void 0:a.isRTL(t));let c=await a.getElementRects({reference:e,floating:t,strategy:o}),{x:d,y:f}=dn(c,r,l),u=r,p={},h=0;for(let n=0;n<s.length;n++){const{name:i,fn:m}=s[n],{x:y,y:g,data:b,reset:v}=await m({x:d,y:f,initialPlacement:r,placement:u,strategy:o,middlewareData:p,rects:c,platform:a,elements:{reference:e,floating:t}});d=null!=y?y:d,f=null!=g?g:f,p={...p,[i]:{...p[i],...b}},v&&h<=50&&(h++,"object"==typeof v&&(v.placement&&(u=v.placement),v.rects&&(c=!0===v.rects?await a.getElementRects({reference:e,floating:t,strategy:o}):v.rects),({x:d,y:f}=dn(c,u,l))),n=-1)}return{x:d,y:f,placement:u,strategy:o,middlewareData:p}})(e,t,{...o,platform:i})};var An="undefined"!=typeof document?v:b;function Mn(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if("function"==typeof e&&e.toString()===t.toString())return!0;let n,r,o;if(e&&t&&"object"==typeof e){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;0!=r--;)if(!Mn(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;0!=r--;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;0!=r--;){const n=o[r];if(("_owner"!==n||!e.$$typeof)&&!Mn(e[n],t[n]))return!1}return!0}return e!=e&&t!=t}function zn(e){if("undefined"==typeof window)return 1;return(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Dn(e,t){const n=zn(e);return Math.round(t*n)/n}function Ln(e){const t=h.useRef(e);return An((()=>{t.current=e})),t}const Bn=h["useInsertionEffect".toString()]||(e=>e());var qn="undefined"!=typeof document?v:b;let Hn=!1,In=0;const Fn=()=>"floating-ui-"+In++;const Wn=h["useId".toString()]||function(){const[e,t]=h.useState((()=>Hn?Fn():void 0));return qn((()=>{null==e&&t(Fn())}),[]),h.useEffect((()=>{Hn||(Hn=!0)}),[]),e};const Vn=h.createContext(null),$n=h.createContext(null);function Kn(e){var t;void 0===e&&(e={});const{open:n=!1,onOpenChange:r,nodeId:o}=e,[i,a]=h.useState(null),s=(null==(t=e.elements)?void 0:t.reference)||i,l=function(e){void 0===e&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:i,floating:a}={},transform:s=!0,whileElementsMounted:l,open:c}=e,[d,f]=h.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[u,p]=h.useState(r);Mn(u,r)||p(r);const[m,y]=h.useState(null),[g,b]=h.useState(null),v=h.useCallback((e=>{e!==E.current&&(E.current=e,y(e))}),[]),w=h.useCallback((e=>{e!==_.current&&(_.current=e,b(e))}),[]),x=i||m,k=a||g,E=h.useRef(null),_=h.useRef(null),P=h.useRef(d),j=null!=l,N=Ln(l),S=Ln(o),C=h.useCallback((()=>{if(!E.current||!_.current)return;const e={placement:t,strategy:n,middleware:u};S.current&&(e.platform=S.current),Tn(E.current,_.current,e).then((e=>{const t={...e,isPositioned:!0};R.current&&!Mn(P.current,t)&&(P.current=t,O.flushSync((()=>{f(t)})))}))}),[u,t,n,S]);An((()=>{!1===c&&P.current.isPositioned&&(P.current.isPositioned=!1,f((e=>({...e,isPositioned:!1}))))}),[c]);const R=h.useRef(!1);An((()=>(R.current=!0,()=>{R.current=!1})),[]),An((()=>{if(x&&(E.current=x),k&&(_.current=k),x&&k){if(N.current)return N.current(x,k,C);C()}}),[x,k,C,N,j]);const T=h.useMemo((()=>({reference:E,floating:_,setReference:v,setFloating:w})),[v,w]),A=h.useMemo((()=>({reference:x,floating:k})),[x,k]),M=h.useMemo((()=>{const e={position:n,left:0,top:0};if(!A.floating)return e;const t=Dn(A.floating,d.x),r=Dn(A.floating,d.y);return s?{...e,transform:"translate("+t+"px, "+r+"px)",...zn(A.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:t,top:r}}),[n,s,A.floating,d.x,d.y]);return h.useMemo((()=>({...d,update:C,refs:T,elements:A,floatingStyles:M})),[d,C,T,A,M])}(e),c=h.useContext($n),d=null!=((null==(f=h.useContext(Vn))?void 0:f.id)||null);var f;const u=function(e){const t=h.useRef((()=>{}));return Bn((()=>{t.current=e})),h.useCallback((function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return null==t.current?void 0:t.current(...n)}),[])}(((e,t,n)=>{e&&(m.current.openEvent=t),y.emit("openchange",{open:e,event:t,reason:n,nested:d}),null==r||r(e,t,n)})),p=h.useRef(null),m=h.useRef({}),y=h.useState((()=>function(){const e=new Map;return{emit(t,n){var r;null==(r=e.get(t))||r.forEach((e=>e(n)))},on(t,n){e.set(t,[...e.get(t)||[],n])},off(t,n){var r;e.set(t,(null==(r=e.get(t))?void 0:r.filter((e=>e!==n)))||[])}}}()))[0],g=Wn(),b=h.useCallback((e=>{const t=Tt(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),contextElement:e}:e;l.refs.setReference(t)}),[l.refs]),v=h.useCallback((e=>{(Tt(e)||null===e)&&(p.current=e,a(e)),(Tt(l.refs.reference.current)||null===l.refs.reference.current||null!==e&&!Tt(e))&&l.refs.setReference(e)}),[l.refs]),w=h.useMemo((()=>({...l.refs,setReference:v,setPositionReference:b,domReference:p})),[l.refs,v,b]),x=h.useMemo((()=>({...l.elements,domReference:s})),[l.elements,s]),k=h.useMemo((()=>({...l,refs:w,elements:x,dataRef:m,nodeId:o,floatingId:g,events:y,open:n,onOpenChange:u})),[l,o,g,y,n,u,w,x]);return qn((()=>{const e=null==c?void 0:c.nodesRef.current.find((e=>e.id===o));e&&(e.context=k)})),h.useMemo((()=>({...l,context:k,refs:w,elements:x})),[l,w,x,k])}var Zn;function Xn(){return Xn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Xn.apply(this,arguments)}var Un=function(e){return h.createElement("svg",Xn({viewBox:"0 0 10 10",style:{width:14,height:14,display:"block",flexShrink:0,transform:"rotate(90deg)"}},e),Zn||(Zn=h.createElement("path",{d:"M3 2a1 1 0 1 1 0-2 1 1 0 0 1 0 2Zm0 4a1 1 0 1 1 0-2 1 1 0 0 1 0 2Zm0 4a1 1 0 1 1 0-2 1 1 0 0 1 0 2Zm4-8a1 1 0 1 1 0-2 1 1 0 0 1 0 2Zm0 4a1 1 0 1 1 0-2 1 1 0 0 1 0 2Zm0 4a1 1 0 1 1 0-2 1 1 0 0 1 0 2Z"})))};function Jn(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}"function"==typeof SuppressedError&&SuppressedError;const{BlockOptionsMenuGroup:Yn,BlockOptionsMenuItem:Gn,BlockOptions:Qn,BlockOptionsSeparator:er}=o,tr=e=>{var{editor:t,blockId:n,element:o,onClose:i}=e,a=Jn(e,["editor","blockId","element","onClose"]);return u(Qn,Object.assign({},a,{onClose:i,actions:null},{children:f(Yn,{children:[u(Gn,{children:f("button",Object.assign({type:"button",className:"yoopta-block-options-button",onClick:()=>{vt.insertTableColumn(t,n,{insertMode:"before"}),i()}},{children:[u(j,{className:"yoopta-table-icons"}),"Insert left"]}))}),u(Gn,{children:f("button",Object.assign({type:"button",className:"yoopta-block-options-button",onClick:()=>{vt.insertTableColumn(t,n,{insertMode:"after"}),i()}},{children:[u(N,{className:"yoopta-table-icons"}),"Insert right"]}))}),u(er,{}),u(Gn,{children:f("button",Object.assign({type:"button",className:"yoopta-block-options-button",onClick:()=>{const e=t.blockEditorsMap[n],o=r.getElementEntry(t,n,{type:"table-data-cell",path:e.selection});if(o){const[,r]=o,i=nt.next(e,{at:r,match:e=>Ze.isElement(e)&&"table-data-cell"===e.type});if(!i)return;const[,a]=i;vt.moveTableColumn(t,n,{from:r,to:a})}}},{children:[u(M,{className:"yoopta-table-icons"}),"Move right"]}))}),u(Gn,{children:f("button",Object.assign({type:"button",className:"yoopta-block-options-button",onClick:()=>{const e=t.blockEditorsMap[n],o=r.getElementEntry(t,n,{type:"table-data-cell",path:e.selection});if(o){const[,r]=o,i=nt.previous(e,{at:r,match:e=>Ze.isElement(e)&&"table-data-cell"===e.type});if(!i)return;const[,a]=i;vt.moveTableColumn(t,n,{from:r,to:a})}}},{children:[u(A,{className:"yoopta-table-icons"}),"Move left"]}))}),u(er,{}),u(Gn,{children:f("button",Object.assign({type:"button",className:"yoopta-block-options-button",onClick:()=>{let e=r.getElementPath(t,n,o);e&&(vt.deleteTableColumn(t,n,{path:e}),i())}},{children:[u(B,{className:"yoopta-table-icons"}),"Delete"]}))})]})}))},nr=({editor:e,blockId:t,tdElement:n})=>{const[o,i]=w(!1),{refs:a,floatingStyles:s}=Kn({placement:"bottom-start",open:o,onOpenChange:i,middleware:[Rn(),Cn(),Sn(),pn(10)]});return f(p,{children:[u(tr,{refs:a,isOpen:o,onClose:()=>{i(!1)},style:s,editor:e,blockId:t,element:n}),u("button",Object.assign({type:"button",ref:a.setReference,onClick:()=>{if(e.readOnly)return;const o=e.blockEditorsMap[t],a=r.getElementPath(e,t,n);a&&(bt.select(o,{path:a.concat([0]),offset:0}),i(!0))},contentEditable:!1,style:o?{opacity:1}:void 0,className:"yoopta-table-column-button"},{children:u(Un,{})}))]})},{BlockOptionsMenuGroup:rr,BlockOptionsMenuItem:or,BlockOptions:ir,BlockOptionsSeparator:ar}=o,sr=e=>{var{editor:t,blockId:n,onClose:o,tdElement:i}=e,a=Jn(e,["editor","blockId","onClose","tdElement"]);return u(ir,Object.assign({},a,{onClose:o,actions:null},{children:f(rr,{children:[u(or,{children:f("button",Object.assign({type:"button",className:"yoopta-block-options-button",onClick:()=>{vt.insertTableRow(t,n,{insertMode:"before",select:!0}),o()}},{children:[u(R,{className:"yoopta-table-icons"}),"Insert above"]}))}),u(or,{children:f("button",Object.assign({type:"button",className:"yoopta-block-options-button",onClick:()=>{vt.insertTableRow(t,n,{insertMode:"after",select:!0}),o()}},{children:[u(C,{className:"yoopta-table-icons"}),"Insert below"]}))}),u(ar,{}),u(or,{children:f("button",Object.assign({type:"button",className:"yoopta-block-options-button",onClick:()=>{const e=r.getElementPath(t,n,i),a=r.getElement(t,n,{type:"table-row",path:e});if(!a)return;let s=r.getElementPath(t,n,a);const l=t.blockEditorsMap[n],c=nt.previous(l,{at:s,match:e=>Ze.isElement(e)&&"table-row"===e.type});if(!c)return o();vt.moveTableRow(t,n,{from:s,to:c[1]})}},{children:[u(z,{className:"yoopta-table-icons"}),"Move up"]}))}),u(or,{children:f("button",Object.assign({type:"button",className:"yoopta-block-options-button",onClick:()=>{const e=r.getElementPath(t,n,i),a=r.getElement(t,n,{type:"table-row",path:e});if(!a)return;let s=r.getElementPath(t,n,a);const l=t.blockEditorsMap[n],c=nt.next(l,{at:s,match:e=>Ze.isElement(e)&&"table-row"===e.type});if(!c)return o();vt.moveTableRow(t,n,{from:s,to:c[1]})}},{children:[u(T,{className:"yoopta-table-icons"}),"Move down"]}))}),u(ar,{}),u(or,{children:f("button",Object.assign({type:"button",className:"yoopta-block-options-button",onClick:()=>{const e=r.getElementPath(t,n,i),a=r.getElement(t,n,{type:"table-row",path:e});if(!a)return;let s=r.getElementPath(t,n,a);vt.deleteTableRow(t,n,{path:s}),o()}},{children:[u(B,{className:"yoopta-table-icons"}),"Delete row"]}))})]})}))},lr=({editor:e,blockId:t,tdElement:n})=>{const[o,i]=w(!1),{refs:a,floatingStyles:s}=Kn({placement:"right-start",open:o,onOpenChange:i,middleware:[Rn(),Cn(),Sn(),pn(10)]});return f(p,{children:[u(sr,{refs:a,isOpen:o,onClose:()=>{i(!1)},style:s,editor:e,blockId:t,tdElement:n}),u("button",Object.assign({ref:a.setReference,type:"button",onClick:()=>{if(e.readOnly)return;const o=e.blockEditorsMap[t],a=r.getElementPath(e,t,n);a&&(bt.select(o,{path:a.concat([0]),offset:0}),i(!0))},contentEditable:!1,className:"yoopta-table-row-button",style:o?{opacity:1}:void 0},{children:u(Un,{className:"w-[14px] h-[14px] block flex-shrink-0",style:{transform:"rotate(0deg)"}})}))]})};const cr=new d({type:"Table",elements:{table:{render:({attributes:e,children:t,blockId:n,element:r,HTMLAttributes:o})=>{const s=i(),l=s.blockEditorsMap[n],c=a(n),d=s.readOnly,p=Pt.get(l);return f("div",Object.assign({className:"yoopta-table-block"},{children:[u("table",Object.assign({},o,{className:"yoopta-table "+(p?"yoopta-table-selecting":"")},{children:u("tbody",Object.assign({},e,{children:t}))})),!d&&u(Et,{block:c,editor:s,table:r})]}))},asRoot:!0,children:["table-row"],props:{headerRow:!1,headerColumn:!1}},"table-row":{render:({attributes:e,children:t,element:n})=>u("tr",Object.assign({className:"yoopta-table-row","data-element-id":n.id},e,{children:t})),children:["table-data-cell"]},"table-data-cell":{render:({attributes:e,children:t,element:n,blockId:o})=>{var a,s,l;const c=i(),d=c.blockEditorsMap[o],p=r.getElementPath(c,o,n),h=null===(a=Pt.get(d))||void 0===a?void 0:a.has(n),m=(null===(s=null==n?void 0:n.props)||void 0===s?void 0:s.asHeader)||!1,y=x((()=>{var e,t;const n=nt.above(d,{at:p,match:e=>Ze.isElement(e)&&"table"===e.type});if(!n)return null;const[r]=n,o=(null===(e=null==r?void 0:r.props)||void 0===e?void 0:e.headerRow)||!1;return{headerColumn:(null===(t=null==r?void 0:r.props)||void 0===t?void 0:t.headerColumn)||!1,headerRow:o}}),[m]),{headerRow:g,headerColumn:b}=y||{},v=(null==p?void 0:p[p.length-1])||0,w=(null===(l=null==n?void 0:n.props)||void 0===l?void 0:l.width)||200,O=0===(null==p?void 0:p[p.length-1]),k=0===(null==p?void 0:p[p.length-2]);let E=!1;k&&g&&(E=!0),O&&b&&(E=!0);const _={maxWidth:w,minWidth:w},P=E?"yoopta-table-data-cell yoopta-table-data-cell-head":"yoopta-table-data-cell";return f(E?"th":"td",Object.assign({scope:E?"col":void 0,"data-cell-selected":h,style:_,colSpan:1,rowSpan:1,className:P},{children:[u("div",Object.assign({className:"yoopta-table-data-cell-content"},e,{children:t})),!c.readOnly&&k&&u(jt,{onResize:e=>{vt.updateColumnWidth(c,o,v,e)},tdWidth:w,columnIndex:v}),!c.readOnly&&k&&u(nr,{editor:c,blockId:o,tdElement:n}),!c.readOnly&&O&&u(lr,{editor:c,blockId:o,tdElement:n})]}))},props:{asHeader:!1,width:200}}},events:{onKeyDown:function(e,t,{hotkeys:n,currentBlock:r}){return o=>{if(t.selection){if(n.isBackspace(o)){const e=Te.parent(t.selection.anchor.path),n=nt.isStart(t,t.selection.anchor,e),r=_t.get(t);if(r)return o.preventDefault(),void nt.withoutNormalizing(t,(()=>{for(const[,e]of r)for(const[n,r]of Ye.children(t,e))if(pt.isText(n)){const e=Ye.string(n).length;e>0&&bt.delete(t,{at:{anchor:{path:r,offset:0},focus:{path:r,offset:e}}})}bt.select(t,{path:r[0][1].concat(0),offset:0})}));if(n&&$e.isCollapsed(t.selection))return void o.preventDefault()}if(n.isCmdShiftEnter(o))return o.preventDefault(),void vt.insertTableRow(e,r.id,{select:!0,insertMode:"before"});if(n.isShiftEnter(o))return o.preventDefault(),void vt.insertTableRow(e,r.id,{select:!0,insertMode:"after"});if(n.isCmdShiftRight(o))return o.preventDefault(),void vt.insertTableColumn(e,r.id,{select:!0,insertMode:"after"});if(n.isCmdShiftLeft(o))return o.preventDefault(),void vt.insertTableColumn(e,r.id,{select:!0,insertMode:"before"});if(n.isCmdShiftDelete(o))return o.preventDefault(),void vt.deleteTableRow(e,r.id);if(n.isCmdAltDelete(o))return o.preventDefault(),void vt.deleteTableColumn(e,r.id);if(n.isArrowUp(o)){o.preventDefault();const e=nt.above(t,{at:t.selection.anchor,match:e=>Ze.isElement(e)&&"table-data-cell"===e.type});if(!e)return;const[n,r]=e;try{const e=r[r.length-1],n=Te.previous(r.slice(0,-1)).concat(e);nt.node(t,n),bt.select(t,n)}catch(e){}}else if(n.isArrowDown(o)){o.preventDefault();const e=nt.above(t,{at:t.selection.anchor,match:e=>Ze.isElement(e)&&"table-data-cell"===e.type});if(!e)return;const[n,r]=e;try{const e=r[r.length-1],n=Te.next(r.slice(0,-1)).concat(e);nt.node(t,n),bt.select(t,n)}catch(e){}}else{if(n.isEnter(o)&&(o.preventDefault(),bt.insertText(t,"\n")),n.isSelect(o)){const n=nt.above(t,{match:e=>Ze.isElement(e)&&"table-data-cell"===e.type});if(n){o.preventDefault();const[i,a]=n,s=nt.string(t,a);if($e.isExpanded(t.selection)||0===s.length)return e.blur(),void e.setBlockSelected([r.meta.order]);bt.select(t,a)}}(o.metaKey||o.ctrlKey)&&o.shiftKey&&"h"===o.key&&(o.preventDefault(),vt.toggleHeaderRow(e,r.id)),(o.metaKey||o.ctrlKey)&&o.shiftKey&&"v"===o.key&&(o.preventDefault(),vt.toggleHeaderColumn(e,r.id))}}}},onBlur:(e,t)=>()=>{Pt.delete(t)},onBeforeCreate:(e,t)=>vt.buildTableElements(e,{rows:3,columns:3})},parsers:{html:{deserialize:{nodeNames:["TABLE"],parse:function(t,n){const r=t.querySelector("tbody"),o=t.querySelector("thead"),i={id:e(),type:"table",children:[],props:{headerRow:"true"===t.getAttribute("data-header-row"),headerColumn:"true"===t.getAttribute("data-header-column")}};if(!r&&!o)return;const a=null==o?void 0:o.querySelector("tr");if(a&&(i.props.headerRow=!0),a){const t={id:e(),type:"table-row",children:[]};Array.from(a.childNodes).forEach((r=>{if("TH"===r.nodeName){const o={id:e(),type:"table-data-cell",children:[{text:""}],props:{asHeader:!0,width:200}};r instanceof HTMLElement&&(null==r?void 0:r.hasAttribute("data-width"))&&(o.props.width=parseInt(r.getAttribute("data-width")||"200",10));let i=s(n,r.childNodes);o.children=i,t.children.push(o)}})),i.children.push(t)}return null==r||r.childNodes.forEach((t=>{const r=Array.from(t.childNodes).filter((e=>"TD"===e.nodeName||"TH"===e.nodeName));if(r.length>0){const t={id:e(),type:"table-row",children:[]};r.forEach((r=>{const o={id:e(),type:"table-data-cell",children:[{text:""}],props:{asHeader:!1,width:200}};if("TH"===r.nodeName&&(o.props.asHeader=!0),"TD"===r.nodeName&&(o.props.asHeader=!1),"TD"===r.nodeName||"TH"===r.nodeName){r instanceof HTMLElement&&(null==r?void 0:r.hasAttribute("data-width"))&&(o.props.width=parseInt(r.getAttribute("data-width")||"200",10));let e=s(n,r.childNodes);o.children=e,t.children.push(o)}})),i.children.push(t)}})),i}},serialize:function(e,t,n){var r,o;const i=e.children[0].children,{align:a="left",depth:s=0}=n||{};return`<table style="margin-left: ${s}px; text-align: ${a}" data-meta-align="${a}" data-meta-depth="${s}" data-header-row="${null===(r=e.props)||void 0===r?void 0:r.headerRow}" data-header-column="${null===(o=e.props)||void 0===o?void 0:o.headerColumn}">\n <colgroup>\n ${i.map((e=>{var t,n;return`<col style="width: ${(null===(t=e.props)||void 0===t?void 0:t.width)?`${null===(n=e.props)||void 0===n?void 0:n.width}px`:"auto"}" />`})).join("")}\n </colgroup>\n <tbody>${e.children.map((e=>`<tr>${e.children.map((e=>{var t,n,r;const o=l(e.children);return(null===(t=e.props)||void 0===t?void 0:t.asHeader)?`<th data-width="${(null===(n=e.props)||void 0===n?void 0:n.width)||200}" rowspan="1" colspan="1">${o}</th>`:`<td data-width="${(null===(r=e.props)||void 0===r?void 0:r.width)||200}" rowspan="1" colspan="1">${o}</td>`})).join("")}</tr>`)).join("")}</tbody></table>`}},markdown:{serialize:function(e,t){let n="";return e.children.forEach(((e,t)=>{const r=e.children.map((e=>` ${c(e.children)} `)).join("|");if(n+=`|${r}|\n`,0===t){const t=e.children.map((()=>" --- ")).join("|");n+=`|${t}|\n`}})),n}}},extensions:function(t,n){return t=function(e){const{deleteBackward:t}=e;return e.deleteBackward=n=>{const{selection:r}=e;if(!r||$e.isExpanded(r))return t(n);const[o]=nt.nodes(e,{match:e=>Ze.isElement(e)&&"table-data-cell"===e.type,at:r}),i=nt.before(e,r,{unit:n}),[a]=i?nt.nodes(e,{match:e=>Ze.isElement(e)&&"table-data-cell"===e.type,at:i}):[void 0];if(!o&&!a)return t(n);if(!o&&a&&i)return bt.select(e,i);const[,s]=o,l=nt.start(e,s);it.equals(r.anchor,l)||t(n)},e}(t=function(t,n){const{normalizeNode:r}=t;return t.normalizeNode=(n,o)=>{const[i,a]=n;if(Ze.isElement(i)&&"table-data-cell"===i.type)for(const[e,n]of Ye.children(t,a)){if(Ze.isElement(e)&&"table"===e.type)return void bt.unwrapNodes(t,{at:n});if(Ze.isElement(e)&&"table-row"===e.type)return void bt.unwrapNodes(t,{at:n});if(Ze.isElement(e)&&"table-data-cell"===e.type)return void bt.unwrapNodes(t,{at:n})}if(Ze.isElement(i)&&"table-row"===i.type)for(const[n,r]of Ye.children(t,a))if(!Ze.isElement(n)||"table-data-cell"!==n.type)return bt.wrapNodes(t,{id:e(),type:"table-data-cell",children:[n]},{at:r});r(n,o)},t}(t=function(e){const{apply:t}=e;return e.apply=n=>{if(!et.isSelectionOperation(n)||!n.newProperties)return Pt.delete(e),_t.delete(e),t(n);const r=Object.assign(Object.assign({},e.selection),n.newProperties);if(!$e.isRange(r))return Pt.delete(e),_t.delete(e),t(n);const[o]=nt.nodes(e,{match:e=>Ze.isElement(e)&&"table-data-cell"===e.type,at:$e.start(r)}),[i]=nt.nodes(e,{match:e=>Ze.isElement(e)&&"table-data-cell"===e.type,at:$e.end(r)});if(!o||!i)return Pt.delete(e),_t.delete(e),t(n);const[,a]=o,[,s]=i;if(Te.equals(a,s))return Pt.delete(e),_t.delete(e),t(n);const l=new WeakSet,c=nt.range(e,a,s),d=Array.from(nt.nodes(e,{at:c,match:e=>Ze.isElement(e)&&"table-data-cell"===e.type})),f=[];for(const[e,t]of d)Ze.isElement(e)&&"table-data-cell"===e.type&&(l.add(e),f.push([e,t]));_t.set(e,f),Pt.set(e,l),t(n)},e}(t)))},options:{display:{title:"Table",description:"Add simple table"},shortcuts:["table","||","3x3"]},commands:vt});export{vt as TableCommands,cr as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yoopta/table",
3
- "version": "4.8.0",
3
+ "version": "4.8.1",
4
4
  "description": "Table plugin for Yoopta Editor [IN PROGRESS]",
5
5
  "author": "Darginec05 <devopsbanda@gmail.com>",
6
6
  "homepage": "https://github.com/Darginec05/Editor-Yoopta#readme",
@@ -38,5 +38,5 @@
38
38
  "@floating-ui/react": "^0.26.22",
39
39
  "lucide-react": "^0.436.0"
40
40
  },
41
- "gitHead": "6ab0f98876ff4cec80a89a983e70e7c8e3a3f35f"
41
+ "gitHead": "e8a4a716f7cc83157c87b8e26e316ac27d0b49b8"
42
42
  }