@yoopta/editor 4.9.6 → 4.9.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/editor/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/editor/index.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,SAAS,EAAsB,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/editor/index.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,SAAS,EAAsB,MAAM,SAAS,CAAC;AAuBxD,wBAAgB,kBAAkB,IAAI,SAAS,CA0E9C;AAED,eAAO,MAAM,mBAAmB,sBAAgB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import*as r from"react";import o,{createContext as i,useContext as l,useRef as a,useMemo as s,useLayoutEffect as c,useEffect as u,useCallback as d,useState as f,memo as p,useReducer as h,forwardRef as g,createElement as v}from"react";import{Editor as y,Element as m,Text as b,Transforms as w,Point as k,Path as x,Node as O,Range as E,createEditor as S,Operation as _}from"slate";import{ReactEditor as C,withReact as j,useSelected as D,Slate as A,Editable as P,DefaultElement as R}from"slate-react";import*as B from"react-dom";import{unstable_batchedUpdates as T,createPortal as M}from"react-dom";class N{constructor(e){this.plugin=e}get getPlugin(){return this.plugin}extend(e){const{renders:t,options:n,elementProps:r,events:o}=e,i=Object.assign(Object.assign({},this.plugin.options),n),l=Object.assign({},this.plugin.elements);return t&&Object.keys(t).forEach((e=>{const n=l[e];if(n&&n.render){const r=t[e];let o=n.render;n.render=e=>o(Object.assign(Object.assign({},e),{extendRender:r}))}})),r&&Object.keys(r).forEach((e=>{const t=l[e];if(t){const n=r[e],o=t.props;n&&o&&(t.props=n(o))}})),o&&Object.keys(o).forEach((e=>{const t=o[e];t&&(this.plugin.events||(this.plugin.events={}),this.plugin.events[e]=t)})),new N(Object.assign(Object.assign({},this.plugin),{elements:l,options:i}))}}function L(){let e=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};return e()+e()+"-"+e()+"-"+e()+"-"+e()+"-"+e()+e()+e()}const I=()=>{var e,t;return"undefined"==typeof window||"function"!=typeof(null===(e=window.crypto)||void 0===e?void 0:e.randomUUID)?L():null===(t=window.crypto)||void 0===t?void 0:t.randomUUID()},F=e=>({id:I(),type:(null==e?void 0:e.type)||"paragraph",children:(null==e?void 0:e.children)||[{text:""}],props:Object.assign({nodeType:"block"},null==e?void 0:e.props)}),z=e=>({id:(null==e?void 0:e.id)||I(),value:(null==e?void 0:e.value)||[F()],type:(null==e?void 0:e.type)||"Paragraph",meta:Object.assign({order:0,depth:0},null==e?void 0:e.meta)});function $(e){if(!e)return;const t=Object.keys(e);return 1===t.length?t[0]:t.find((t=>e[t].asRoot))}function H(e){if(!e)return;const t=$(e);return t?e[t]:void 0}function V(e,t={nodeType:"block"}){return{id:I(),type:e,children:[{text:""}],props:t}}function U(e,t,n){var r;return(null===(r=e.children)||void 0===r?void 0:r.map((e=>{const r=t[e];if(!r)throw new Error(`Element definition for ${e} not found`);return F({id:I(),type:e,props:r.props,children:r.children&&r.children.length>0?U(r,t,n):[{text:(null==n?void 0:n[e])||""}]})})))||[]}function K(e,t,n){const r=e.blocks[t].elements,o=$(r);if(!o)throw new Error(`Root element type not found for block type ${t}`);const i=r[o];return{id:I(),type:o,props:i.props,children:i.children&&i.children.length>0?U(i,r,n):[{text:""}]}}function W(e,t,n={}){var r,o;const{at:i=e.path.current,focus:l=!1,blockData:a}=n,s=e.plugins[t],{onBeforeCreate:c,onCreate:u}=s.events||{};let d;d=a&&Array.isArray(null==a?void 0:a.value)?a.value[0]:(null==c?void 0:c(e))||K(e,t);const f={id:(null==a?void 0:a.id)||I(),type:t,value:[d],meta:{align:(null===(r=null==a?void 0:a.meta)||void 0===r?void 0:r.align)||"left",depth:(null===(o=null==a?void 0:a.meta)||void 0===o?void 0:o.depth)||0,order:"number"==typeof i?i:Object.keys(e.children).length}},p=[];return p.push({type:"insert_block",path:{current:f.meta.order},block:f}),e.applyTransforms(p),null==u||u(e,f.id),l&&e.focusBlock(f.id),f.id}function q(e){const t=e.path.current;return"number"==typeof t&&0!==t?t-1:null}function Y(e,t){e.applyTransforms([{type:"set_block_path",path:t}],{validatePaths:!1})}function X(e){try{let t;const[n,r]=y.last(e,[]);if(m.isElement(n)&&!y.isEditor(n)){const[n,o]=y.last(e,r);b.isText(n)&&(t={path:o,offset:n.text.length})}else b.isText(n)&&(t={path:r,offset:n.text.length});return t}catch(e){return{path:[0,0],offset:0}}}const Z={getPath:function(e){return e.path.current},getNextPath:function(e){const t=e.path.current;return"number"==typeof t?t+1:null},getPreviousPath:q,isBlockSelected:function(e,t){const n=e.path.selected;return!!Array.isArray(n)&&n.includes(t.meta.order)},getSelectedPaths:function(e){return e.path.selected},isPathEmpty:function(e){return null===e.path.current},setPath:Y,getLastNodePoint:X};function J(e,t){if(!(null==t?void 0:t.id)&&"number"!=typeof(null==t?void 0:t.at))throw new Error("getBlockSlate requires either an id or at");const n=(null==t?void 0:t.id)||Object.keys(e.children).find((n=>e.children[n].meta.order===(null==t?void 0:t.at))),r=e.blockEditorsMap[n||""],o=e.children[n||""],i=e.blocks[(null==o?void 0:o.type)||""];if(!(null==i?void 0:i.hasCustomEditor)&&!r)throw new Error(`Slate not found with params: ${JSON.stringify(t)}`);return r}function G(e,t){const{focus:n,blockId:r,at:o}=t;if(!r&&"number"!=typeof o)throw new Error("blockId or path should be provided");const i=e.getBlock({id:r,at:o});if(!i)throw new Error("Block not found");const l=Z.getPreviousPath(e),a=null!==l?e.getBlock({at:l}):void 0,s=a?J(e,{id:null==a?void 0:a.id}):void 0,c=e.children[i.id],u=[],d=e.plugins[c.type],{onDestroy:f}=d.events||{};if(null==f||f(e,c.id),u.push({type:"delete_block",block:c,path:e.path}),e.applyTransforms(u,{validatePaths:!1}),n&&s&&a){const t=Z.getLastNodePoint(s);e.focusBlock(a.id,{focusAt:t})}}function Q(e,t,n){const r=n,o=e.children[t],i=Object.values(e.children).find((e=>e.meta.order===r));if(!o||!i)return void console.warn("Invalid block ids for move operation");const l=[],a={type:"move_block",prevProperties:{id:t,order:o.meta.order},properties:{id:t,order:r}};l.push(a),e.applyTransforms(l),e.setPath({current:r})}const ee=new WeakMap;function te(e,t,n={}){const{focusAt:r,waitExecution:o=!0,waitExecutionMs:i=0,shouldUpdateBlockPath:l=!0}=n,a=()=>{const o=n.slate||e.blockEditorsMap[t],i=e.children[t];if(!o||!i)return;if(!e.blocks[i.type].hasCustomEditor)try{const e=function(e,t){if(k.isPoint(t))return t;if(x.isPath(t))return{path:t,offset:0};const[,n]=y.first(e,[0]);return{path:n||[0,0],offset:0}}(o,r);w.select(o,e),C.focus(o)}catch(e){}l&&setTimeout((()=>{e.setPath({current:i.meta.order})}),0)};o?setTimeout((()=>a()),i):a(),ee.set(e,!0)}function ne(e,t){const n=Object.keys(e.children),{at:r=e.path.current}=t||{},o=n.find((t=>e.children[t].meta.order===r));return o?e.children[o]:null}function re(e,t){const n=Object.keys(e.children),{at:r=e.path.current}=t||{},o=n.find((t=>e.children[t].meta.order===r));if(o)return e.blockEditorsMap[o]}var oe="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function ie(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var le={};!function(e,t){var n="__lodash_hash_undefined__",r=9007199254740991,o="[object Arguments]",i="[object Boolean]",l="[object Date]",a="[object Function]",s="[object GeneratorFunction]",c="[object Map]",u="[object Number]",d="[object Object]",f="[object Promise]",p="[object RegExp]",h="[object Set]",g="[object String]",v="[object Symbol]",y="[object WeakMap]",m="[object ArrayBuffer]",b="[object DataView]",w="[object Float32Array]",k="[object Float64Array]",x="[object Int8Array]",O="[object Int16Array]",E="[object Int32Array]",S="[object Uint8Array]",_="[object Uint8ClampedArray]",C="[object Uint16Array]",j="[object Uint32Array]",D=/\w*$/,A=/^\[object .+?Constructor\]$/,P=/^(?:0|[1-9]\d*)$/,R={};R[o]=R["[object Array]"]=R[m]=R[b]=R[i]=R[l]=R[w]=R[k]=R[x]=R[O]=R[E]=R[c]=R[u]=R[d]=R[p]=R[h]=R[g]=R[v]=R[S]=R[_]=R[C]=R[j]=!0,R["[object Error]"]=R[a]=R[y]=!1;var B="object"==typeof oe&&oe&&oe.Object===Object&&oe,T="object"==typeof self&&self&&self.Object===Object&&self,M=B||T||Function("return this")(),N=t&&!t.nodeType&&t,L=N&&e&&!e.nodeType&&e,I=L&&L.exports===N;function F(e,t){return e.set(t[0],t[1]),e}function z(e,t){return e.add(t),e}function $(e,t,n,r){var o=-1,i=e?e.length:0;for(r&&i&&(n=e[++o]);++o<i;)n=t(n,e[o],o,e);return n}function H(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(e){}return t}function V(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function U(e,t){return function(n){return e(t(n))}}function K(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=e})),n}var W,q=Array.prototype,Y=Function.prototype,X=Object.prototype,Z=M["__core-js_shared__"],J=(W=/[^.]+$/.exec(Z&&Z.keys&&Z.keys.IE_PROTO||""))?"Symbol(src)_1."+W:"",G=Y.toString,Q=X.hasOwnProperty,ee=X.toString,te=RegExp("^"+G.call(Q).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ne=I?M.Buffer:void 0,re=M.Symbol,ie=M.Uint8Array,le=U(Object.getPrototypeOf,Object),ae=Object.create,se=X.propertyIsEnumerable,ce=q.splice,ue=Object.getOwnPropertySymbols,de=ne?ne.isBuffer:void 0,fe=U(Object.keys,Object),pe=Ie(M,"DataView"),he=Ie(M,"Map"),ge=Ie(M,"Promise"),ve=Ie(M,"Set"),ye=Ie(M,"WeakMap"),me=Ie(Object,"create"),be=Ve(pe),we=Ve(he),ke=Ve(ge),xe=Ve(ve),Oe=Ve(ye),Ee=re?re.prototype:void 0,Se=Ee?Ee.valueOf:void 0;function _e(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Ce(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function je(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function De(e){this.__data__=new Ce(e)}function Ae(e,t){var n=Ke(e)||function(e){return function(e){return function(e){return!!e&&"object"==typeof e}(e)&&We(e)}(e)&&Q.call(e,"callee")&&(!se.call(e,"callee")||ee.call(e)==o)}(e)?function(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}(e.length,String):[],r=n.length,i=!!r;for(var l in e)!t&&!Q.call(e,l)||i&&("length"==l||$e(l,r))||n.push(l);return n}function Pe(e,t,n){var r=e[t];Q.call(e,t)&&Ue(r,n)&&(void 0!==n||t in e)||(e[t]=n)}function Re(e,t){for(var n=e.length;n--;)if(Ue(e[n][0],t))return n;return-1}function Be(e,t,n,r,f,y,A){var P;if(r&&(P=y?r(e,f,y,A):r(e)),void 0!==P)return P;if(!Xe(e))return e;var B=Ke(e);if(B){if(P=function(e){var t=e.length,n=e.constructor(t);t&&"string"==typeof e[0]&&Q.call(e,"index")&&(n.index=e.index,n.input=e.input);return n}(e),!t)return function(e,t){var n=-1,r=e.length;t||(t=Array(r));for(;++n<r;)t[n]=e[n];return t}(e,P)}else{var T=ze(e),M=T==a||T==s;if(qe(e))return function(e,t){if(t)return e.slice();var n=new e.constructor(e.length);return e.copy(n),n}(e,t);if(T==d||T==o||M&&!y){if(H(e))return y?e:{};if(P=function(e){return"function"!=typeof e.constructor||He(e)?{}:(t=le(e),Xe(t)?ae(t):{});var t}(M?{}:e),!t)return function(e,t){return Ne(e,Fe(e),t)}(e,function(e,t){return e&&Ne(t,Ze(t),e)}(P,e))}else{if(!R[T])return y?e:{};P=function(e,t,n,r){var o=e.constructor;switch(t){case m:return Me(e);case i:case l:return new o(+e);case b:return function(e,t){var n=t?Me(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,r);case w:case k:case x:case O:case E:case S:case _:case C:case j:return function(e,t){var n=t?Me(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}(e,r);case c:return function(e,t,n){var r=t?n(V(e),!0):V(e);return $(r,F,new e.constructor)}(e,r,n);case u:case g:return new o(e);case p:return function(e){var t=new e.constructor(e.source,D.exec(e));return t.lastIndex=e.lastIndex,t}(e);case h:return function(e,t,n){var r=t?n(K(e),!0):K(e);return $(r,z,new e.constructor)}(e,r,n);case v:return a=e,Se?Object(Se.call(a)):{}}var a}(e,T,Be,t)}}A||(A=new De);var N=A.get(e);if(N)return N;if(A.set(e,P),!B)var L=n?function(e){return function(e,t,n){var r=t(e);return Ke(e)?r:function(e,t){for(var n=-1,r=t.length,o=e.length;++n<r;)e[o+n]=t[n];return e}(r,n(e))}(e,Ze,Fe)}(e):Ze(e);return function(e,t){for(var n=-1,r=e?e.length:0;++n<r&&!1!==t(e[n],n,e););}(L||e,(function(o,i){L&&(o=e[i=o]),Pe(P,i,Be(o,t,n,r,i,e,A))})),P}function Te(e){return!(!Xe(e)||(t=e,J&&J in t))&&(Ye(e)||H(e)?te:A).test(Ve(e));var t}function Me(e){var t=new e.constructor(e.byteLength);return new ie(t).set(new ie(e)),t}function Ne(e,t,n,r){n||(n={});for(var o=-1,i=t.length;++o<i;){var l=t[o],a=r?r(n[l],e[l],l,n,e):void 0;Pe(n,l,void 0===a?e[l]:a)}return n}function Le(e,t){var n,r,o=e.__data__;return("string"==(r=typeof(n=t))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?o["string"==typeof t?"string":"hash"]:o.map}function Ie(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return Te(n)?n:void 0}_e.prototype.clear=function(){this.__data__=me?me(null):{}},_e.prototype.delete=function(e){return this.has(e)&&delete this.__data__[e]},_e.prototype.get=function(e){var t=this.__data__;if(me){var r=t[e];return r===n?void 0:r}return Q.call(t,e)?t[e]:void 0},_e.prototype.has=function(e){var t=this.__data__;return me?void 0!==t[e]:Q.call(t,e)},_e.prototype.set=function(e,t){return this.__data__[e]=me&&void 0===t?n:t,this},Ce.prototype.clear=function(){this.__data__=[]},Ce.prototype.delete=function(e){var t=this.__data__,n=Re(t,e);return!(n<0)&&(n==t.length-1?t.pop():ce.call(t,n,1),!0)},Ce.prototype.get=function(e){var t=this.__data__,n=Re(t,e);return n<0?void 0:t[n][1]},Ce.prototype.has=function(e){return Re(this.__data__,e)>-1},Ce.prototype.set=function(e,t){var n=this.__data__,r=Re(n,e);return r<0?n.push([e,t]):n[r][1]=t,this},je.prototype.clear=function(){this.__data__={hash:new _e,map:new(he||Ce),string:new _e}},je.prototype.delete=function(e){return Le(this,e).delete(e)},je.prototype.get=function(e){return Le(this,e).get(e)},je.prototype.has=function(e){return Le(this,e).has(e)},je.prototype.set=function(e,t){return Le(this,e).set(e,t),this},De.prototype.clear=function(){this.__data__=new Ce},De.prototype.delete=function(e){return this.__data__.delete(e)},De.prototype.get=function(e){return this.__data__.get(e)},De.prototype.has=function(e){return this.__data__.has(e)},De.prototype.set=function(e,t){var n=this.__data__;if(n instanceof Ce){var r=n.__data__;if(!he||r.length<199)return r.push([e,t]),this;n=this.__data__=new je(r)}return n.set(e,t),this};var Fe=ue?U(ue,Object):function(){return[]},ze=function(e){return ee.call(e)};function $e(e,t){return!!(t=null==t?r:t)&&("number"==typeof e||P.test(e))&&e>-1&&e%1==0&&e<t}function He(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||X)}function Ve(e){if(null!=e){try{return G.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function Ue(e,t){return e===t||e!=e&&t!=t}(pe&&ze(new pe(new ArrayBuffer(1)))!=b||he&&ze(new he)!=c||ge&&ze(ge.resolve())!=f||ve&&ze(new ve)!=h||ye&&ze(new ye)!=y)&&(ze=function(e){var t=ee.call(e),n=t==d?e.constructor:void 0,r=n?Ve(n):void 0;if(r)switch(r){case be:return b;case we:return c;case ke:return f;case xe:return h;case Oe:return y}return t});var Ke=Array.isArray;function We(e){return null!=e&&function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=r}(e.length)&&!Ye(e)}var qe=de||function(){return!1};function Ye(e){var t=Xe(e)?ee.call(e):"";return t==a||t==s}function Xe(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function Ze(e){return We(e)?Ae(e):function(e){if(!He(e))return fe(e);var t=[];for(var n in Object(e))Q.call(e,n)&&"constructor"!=n&&t.push(n);return t}(e)}e.exports=function(e){return Be(e,!0,!0)}}({get exports(){return le},set exports(e){le=e}},le);var ae=le;function se(e){return ae(e)}function ce(e,t={}){const{focus:n=!0}=t,r=ne(e),o=t.slate||re(e);o&&r&&y.withoutNormalizing(o,(()=>{if(!o.selection)return;const t=se(o.children),i=[],[l,a]=function(e,t){const{path:n,offset:r}=t.focus,[,...o]=n,i=JSON.parse(JSON.stringify(e[0]));function l(e,t,n){if(0!==t.length){const[r,...o]=t,[i,a]=l(e.children[r],o,n),s=e.children.slice(0,r).concat(i?[i]:[]),c=(a?[a]:[]).concat(e.children.slice(r+1));return[Object.assign(Object.assign({},e),{children:s}),Object.assign(Object.assign({},e),{children:c})]}if(O.string(e).length<=n)return[e,null];if("text"in e)return[Object.assign(Object.assign({},e),{text:e.text.slice(0,n)}),Object.assign(Object.assign({},e),{text:e.text.slice(n)})];if("link"===e.type){const[t,r]=l(e.children[0],[],n);return[Object.assign(Object.assign({},e),{children:[t]}),Object.assign(Object.assign({},e),{children:[r]})]}}const[a,s]=l(i,o,r);function c(e){return"children"in e&&(e.children=e.children.filter((e=>""!==e.text&&void 0!==e.text||e.children&&e.children.length>0)),e.children.forEach(c)),e}return[c(a),c(s)].map((e=>[e])).filter((e=>e[0].children.length>0))}(o.children,o.selection),s={id:I(),type:r.type,meta:{order:r.meta.order+1,depth:r.meta.depth,align:r.meta.align},value:[]};i.push({type:"split_block",prevProperties:{originalBlock:r,originalValue:t},properties:{nextBlock:s,nextSlateValue:a||[V("paragraph")],splitSlateValue:l},path:e.path}),e.applyTransforms(i),n&&e.focusBlock(s.id)}))}function ue(e,t={}){const{at:n=e.path.current,blockId:r}=t,o=r?e.children[r]:ne(e,{at:n});if(!o)return;const i=o.meta.depth+1,l={type:"set_block_meta",id:o.id,properties:{depth:i},prevProperties:{depth:o.meta.depth}};e.applyTransforms([l])}function de(e,t={}){const{at:n=e.path.current,blockId:r}=t,o=r?e.children[r]:ne(e,{at:n});if(!o)return;const i=Math.max(0,o.meta.depth-1),l={type:"set_block_meta",id:o.id,properties:{depth:i},prevProperties:{depth:o.meta.depth}};e.applyTransforms([l])}function fe(e){return!!e&&("object"==typeof e&&!Array.isArray(e))}function pe(e,t){const{original:n,focus:r,at:o}=t;if(!n)throw new Error("`original` should be provided");if(!n.blockId&&"number"!=typeof n.path)throw new Error("blockId or path should be provided");const{blockId:i,path:l}=n;let a=i?e.children[i]:ne(e,{at:l});if(!a)throw new Error("Block not found");const s=[],c=se(a);return c.id=I(),c.meta.order=Array.isArray(o)&&"number"==typeof o?o:a.meta.order+1,s.push({type:"insert_block",path:{current:c.meta.order},block:c}),e.applyTransforms(s),r&&e.focusBlock(c.id,{waitExecution:!0}),c.id}function he(e,t,n){const r=e.children[t];if(!r)return void console.warn(`Block with id ${t} does not exist.`);const o={type:"set_block_meta",id:t,properties:{},prevProperties:{}},i={type:"set_block_value",id:t,value:[]};n.meta&&(o.prevProperties=r.meta,o.properties=Object.assign(Object.assign({},r.meta),n.meta)),n.value&&(i.value=n.value);const l=[];Object.keys(o.properties).length&&l.push(o),i.value.length&&l.push(i),l.length>0&&e.applyTransforms(l,{validatePaths:!1})}const ge="Paragraph";function ve(e,t,n,r){const o=r.plugins[n.type];return(null==o?void 0:o.customEditor)?n.value[0].children:y.isEditor(t)?t.children.flatMap((t=>ve(e,t,n,r))):m.isElement(t)?y.isInline(e,t)?[t]:t.children.flatMap((t=>ve(e,t,n,r))):[t]}function ye(e,t){return m.isElement(e)?0===e.children.length||b.isText(e.children[0])?t.deleteText?Object.assign(Object.assign({},e),{children:[{text:""}]}):e:ye(e.children[0],t):null}function me(e,t,n={}){const r=ne(e,{at:"number"==typeof n.at?n.at:e.path.current});if(!r)throw new Error("Block not found at current selection");let o=r.type===t?ge:t;const i=e.plugins[o],{onBeforeCreate:l}=i.events||{},a=re(e,{at:r.meta.order});if(!a)throw new Error(`Slate not found for block in position ${r.meta.order}`);const s=(null==l?void 0:l(e))||K(e,o),c=ve(a,a.children[0],r,e),u=ye(s,n);u&&(u.children=c);const d={id:I(),type:o,meta:Object.assign(Object.assign({},r.meta),{align:void 0}),value:[s]},f=[{type:"toggle_block",prevProperties:{sourceBlock:r,sourceSlateValue:a.children},properties:{toggledBlock:d,toggledSlateValue:d.value}}];return e.applyTransforms(f),n.focus&&e.focusBlock(d.id),d.id}function be(e,t){if(!(null==t?void 0:t.id)&&"number"!=typeof(null==t?void 0:t.at))throw new Error("getBlock requires either an id or at");if(null==t?void 0:t.id)return e.children[null==t?void 0:t.id];const n=Object.keys(e.children).find((n=>e.children[n].meta.order===(null==t?void 0:t.at)));return n?e.children[n]:null}function we(e,t,n){const r=e.children[t];if(!r)throw new Error(`Block with id ${t} not found`);const o=re(e,{at:r.meta.order});if(!o)return void console.warn("No slate found");let i=e=>m.isElement(e);(null==n?void 0:n.type)&&(i=e=>m.isElement(e)&&e.type===(null==n?void 0:n.type));try{const[e]=y.nodes(o,{at:(null==n?void 0:n.path)||o.selection||[0],match:i,mode:"lowest"});return e}catch(e){}}function ke(e,t,n){const r=we(e,t,n);if(r)return r[0]}const xe={createElement:function(e,t,n,r){const o=e.children[t];if(!o)throw new Error(`Block with id ${t} not found`);const i=re(e,{at:o.meta.order});i?y.withoutNormalizing(i,(()=>{const l=e.blocks[o.type],a=l.elements[n.type],s=F({type:n.type,props:Object.assign(Object.assign({},a.props),n.props)}),c=Object.keys(l.elements);let u=[];c.forEach((e=>{const t=l.elements[e];e===n.type&&Array.isArray(t.children)&&t.children.length>0&&t.children.forEach((e=>{const t=l.elements[e];u.push(F({type:e,props:t.props}))}))})),u.length>0&&(s.children=u);const{path:d,focus:f=!0}=r||{};let p;const h=we(e,t,{type:n.type});if(h){const[,e]=h;x.isPath(d)?p=d:"prev"===d?p=x.previous(e):"next"===d&&(p=x.next(e))}if(w.insertNodes(i,s,{at:p,select:f}),f&&u.length>0){const n=u[0],r=we(e,t,{path:p,type:n.type});if(r){const[,e]=r;w.select(i,e)}}})):console.warn("No slate found")},deleteElement:function(e,t,n){const r=e.children[t];if(!r)throw new Error(`Block with id ${t} not found`);const o=re(e,{at:r.meta.order});o?y.withoutNormalizing(o,(()=>{w.removeNodes(o,{at:n.path,match:e=>m.isElement(e)&&e.type===n.type})})):console.warn("No slate found")},updateElement:function(e,t,n,r){const o=e.children[t];if(!o)throw new Error(`Block with id ${t} not found`);const i=re(e,{at:o.meta.order});i?y.withoutNormalizing(i,(()=>{const[e]=y.nodes(i,{at:(null==r?void 0:r.path)||[0],match:e=>m.isElement(e)&&e.type===n.type}),t=null==e?void 0:e[0],o=null==e?void 0:e[1],l=(null==t?void 0:t.props)||{},a={props:Object.assign(Object.assign({},l),n.props)};w.setNodes(i,a,{at:(null==r?void 0:r.path)||o||[0],match:e=>m.isElement(e)&&e.type===n.type,mode:"lowest"})})):console.warn("No slate found")},insertElementText:function(e,t,n){const{blockId:r,focus:o}=n||{},i=r?e.children[r]:ne(e);if(!i)return void console.warn(`To set text programmatically, you must provide a valid blockId. Got: ${r}`);const l=re(e,{at:i.meta.order});if(!l)return void console.warn("No slate found");const a=e.blocks[i.type],s=Array.from({length:Object.keys(a.elements).length},(e=>0));let c=l.selection||s;c?y.withoutNormalizing(l,(()=>{E.isRange(c)&&!E.isCollapsed(c)&&w.collapse(l,{edge:"end"}),w.insertText(l,t,{at:c}),o&&e.focusBlock(i.id,{waitExecution:!0,shouldUpdateBlockPath:!0})})):console.warn("No valid path or selection found for text insertion")},getElement:ke,getElementChildren:function(e,t,n){const r=ke(e,t,n);if(r)return r.children},getElementEntry:we,isElementEmpty:function(e,t,n){const r=e.children[t];if(!r)throw new Error(`Block with id ${t} not found`);const o=re(e,{at:r.meta.order});if(!o)return void console.warn("No slate found");const[i]=y.nodes(o,{at:n.path||o.selection,match:e=>m.isElement(e)&&e.type===n.type});if(i){const[e,t]=i;return 0===y.string(o,t).trim().length}return!1},getElementPath:function(e,t,n){const r=e.children[t];if(!r)throw new Error(`Block with id ${t} not found`);const o=re(e,{at:r.meta.order});if(o)try{return C.findPath(o,n)}catch(e){}else console.warn("No slate found")},getParentElementPath:function(e,t,n){const r=e.children[t];if(!r)throw new Error(`Block with id ${t} not found`);const o=re(e,{at:r.meta.order});if(!o)return console.warn("No slate found"),[];try{const e=C.findPath(o,n);return x.parent(e)}catch(e){}}};function Oe(e){var t;const n=ne(e),r=re(e,{at:e.path.current}),o=Z.getPreviousPath(e),i=re(e,{at:o}),l=ne(e,{at:o}),a=e.blocks[(null==l?void 0:l.type)||""];if(!(r&&n&&i&&l))return;const s=xe.getElement(e,l.id);if(a&&!a.hasCustomEditor&&"void"!==(null===(t=null==s?void 0:s.props)||void 0===t?void 0:t.nodeType)){try{const e=X(i);w.select(i,e)}catch(e){w.select(i,y.start(i,[]))}y.withoutNormalizing(i,(()=>{const t=[],o=function(e,t){const n=JSON.parse(JSON.stringify(e.children)),r=JSON.parse(JSON.stringify(t.children)),o=n[n.length-1],i=r[0];return b.isText(o)&&b.isText(i)?(o.text+=i.text,[...n.slice(0,-1),o,...r.slice(1)]):[...n,...r]}(i.children[0],r.children[0]),a=[Object.assign(Object.assign({},i.children[0]),{children:o})],s=Object.assign(Object.assign({},l),{value:a});t.push({type:"merge_block",prevProperties:{sourceBlock:n,sourceSlateValue:r.children,targetBlock:l,targetSlateValue:i.children},properties:{mergedBlock:s,mergedSlateValue:a},path:e.path}),e.applyTransforms(t),e.setPath({current:l.meta.order});try{setTimeout((()=>{C.focus(i)}),0)}catch(e){console.error("Error setting focus:",e)}}))}}const Ee={insertBlock:W,deleteBlock:G,moveBlock:Q,focusBlock:te,splitBlock:ce,increaseBlockDepth:ue,decreaseBlockDepth:de,duplicateBlock:pe,updateBlock:he,toggleBlock:me,getBlock:be,getBlockSlate:J,buildBlockData:function(e){var t,n,r;return{id:(null==e?void 0:e.id)||I(),value:(null==e?void 0:e.value)||[{id:I(),type:(null==r?void 0:r.type)||"paragraph",children:(null==r?void 0:r.children)||[{text:""}],props:Object.assign({nodeType:"block"},null==r?void 0:r.props)}],type:(null==e?void 0:e.type)||"Paragraph",meta:Object.assign({order:(null===(t=null==e?void 0:e.meta)||void 0===t?void 0:t.order)||0,depth:(null===(n=null==e?void 0:e.meta)||void 0===n?void 0:n.depth)||0},null==e?void 0:e.meta)}},mergeBlock:Oe};function Se(e,t){try{C.blur(t),C.deselect(t),w.deselect(t)}catch(e){}e.setPath({current:null})}const _e={underline:{type:"underline",tag:"u"},strike:{type:"strike",tag:"s"},code:{type:"code",tag:"code"},italic:{type:"italic",tag:"i"},bold:{type:"bold",tag:"strong"},strong:{type:"bold",tag:"strong"}};function Ce(e,t,n){return e.map((e=>{var n,r;let o="";if(e.text)return o=Object.keys(_e).reduce(((t,n)=>e[n]?`<${_e[n].tag}>${t}</${_e[n].tag}>`:t),e.text),o;if(e.type){const i=function(e,t){return Object.values(e).find((e=>{var n,r;return e.type===(null===(r=null===(n=e.elements)||void 0===n?void 0:n[t])||void 0===r?void 0:r.rootPlugin)}))}(t,e.type);if(i&&(null===(r=null===(n=i.parsers)||void 0===n?void 0:n.html)||void 0===r?void 0:r.serialize))return o=i.parsers.html.serialize(e,Ce(e.children,t)),o}return o})).join("")}function je(e,t){const n=Object.values(t).filter((t=>{const n=Z.getSelectedPaths(e);return!(Array.isArray(n)&&n.length>0)||(null==n?void 0:n.includes(t.meta.order))})).sort(((e,t)=>e.meta.order-t.meta.order)).map((t=>{var n,r;const o=e.plugins[t.type];if(o&&(null===(r=null===(n=o.parsers)||void 0===n?void 0:n.html)||void 0===r?void 0:r.serialize)){const n=Ce(t.value[0].children,e.plugins);return o.parsers.html.serialize(t.value[0],n,t.meta)}return""}));return`<body id="yoopta-clipboard" data-editor-id="${e.id}">${n.join("")}</body>`}var De=Symbol.for("immer-nothing"),Ae=Symbol.for("immer-draftable"),Pe=Symbol.for("immer-state");function Re(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var Be=Object.getPrototypeOf;function Te(e){return!!e&&!!e[Pe]}function Me(e){return!!e&&(Le(e)||Array.isArray(e)||!!e[Ae]||!!e.constructor?.[Ae]||He(e)||Ve(e))}var Ne=Object.prototype.constructor.toString();function Le(e){if(!e||"object"!=typeof e)return!1;const t=Be(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)===Ne}function Ie(e,t){0===Fe(e)?Reflect.ownKeys(e).forEach((n=>{t(n,e[n],e)})):e.forEach(((n,r)=>t(r,n,e)))}function Fe(e){const t=e[Pe];return t?t.type_:Array.isArray(e)?1:He(e)?2:Ve(e)?3:0}function ze(e,t){return 2===Fe(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function $e(e,t,n){const r=Fe(e);2===r?e.set(t,n):3===r?e.add(n):e[t]=n}function He(e){return e instanceof Map}function Ve(e){return e instanceof Set}function Ue(e){return e.copy_||e.base_}function Ke(e,t){if(He(e))return new Map(e);if(Ve(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);if(!t&&Le(e)){if(!Be(e)){const t=Object.create(null);return Object.assign(t,e)}return{...e}}const n=Object.getOwnPropertyDescriptors(e);delete n[Pe];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(Be(e),n)}function We(e,t=!1){return Ye(e)||Te(e)||!Me(e)||(Fe(e)>1&&(e.set=e.add=e.clear=e.delete=qe),Object.freeze(e),t&&Object.entries(e).forEach((([e,t])=>We(t,!0)))),e}function qe(){Re(2)}function Ye(e){return Object.isFrozen(e)}var Xe,Ze={};function Je(e){const t=Ze[e];return t||Re(0),t}function Ge(){return Xe}function Qe(e,t){t&&(Je("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function et(e){tt(e),e.drafts_.forEach(rt),e.drafts_=null}function tt(e){e===Xe&&(Xe=e.parent_)}function nt(e){return Xe={drafts_:[],parent_:Xe,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function rt(e){const t=e[Pe];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function ot(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return void 0!==e&&e!==n?(n[Pe].modified_&&(et(t),Re(4)),Me(e)&&(e=it(t,e),t.parent_||at(t,e)),t.patches_&&Je("Patches").generateReplacementPatches_(n[Pe].base_,e,t.patches_,t.inversePatches_)):e=it(t,n,[]),et(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==De?e:void 0}function it(e,t,n){if(Ye(t))return t;const r=t[Pe];if(!r)return Ie(t,((o,i)=>lt(e,r,t,o,i,n))),t;if(r.scope_!==e)return t;if(!r.modified_)return at(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),Ie(o,((o,l)=>lt(e,r,t,o,l,n,i))),at(e,t,!1),n&&e.patches_&&Je("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function lt(e,t,n,r,o,i,l){if(Te(o)){const l=it(e,o,i&&t&&3!==t.type_&&!ze(t.assigned_,r)?i.concat(r):void 0);if($e(n,r,l),!Te(l))return;e.canAutoFreeze_=!1}else l&&n.add(o);if(Me(o)&&!Ye(o)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;it(e,o),t&&t.scope_.parent_||"symbol"==typeof r||!Object.prototype.propertyIsEnumerable.call(n,r)||at(e,o)}}function at(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&We(t,n)}var st={get(e,t){if(t===Pe)return e;const n=Ue(e);if(!ze(n,t))return function(e,t,n){const r=dt(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_||!Me(r)?r:r===ut(e.base_,t)?(pt(e),e.copy_[t]=ht(r,e)):r},has:(e,t)=>t in Ue(e),ownKeys:e=>Reflect.ownKeys(Ue(e)),set(e,t,n){const r=dt(Ue(e),t);if(r?.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const r=ut(Ue(e),t),l=r?.[Pe];if(l&&l.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||ze(e.base_,t)))return!0;pt(e),ft(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!==ut(e.base_,t)||t in e.base_?(e.assigned_[t]=!1,pt(e),ft(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0),getOwnPropertyDescriptor(e,t){const n=Ue(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r?{writable:!0,configurable:1!==e.type_||"length"!==t,enumerable:r.enumerable,value:n[t]}:r},defineProperty(){Re(11)},getPrototypeOf:e=>Be(e.base_),setPrototypeOf(){Re(12)}},ct={};function ut(e,t){const n=e[Pe];return(n?Ue(n):e)[t]}function dt(e,t){if(!(t in e))return;let n=Be(e);for(;n;){const e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=Be(n)}}function ft(e){e.modified_||(e.modified_=!0,e.parent_&&ft(e.parent_))}function pt(e){e.copy_||(e.copy_=Ke(e.base_,e.scope_.immer_.useStrictShallowCopy_))}Ie(st,((e,t)=>{ct[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),ct.deleteProperty=function(e,t){return ct.set.call(this,e,t,void 0)},ct.set=function(e,t,n){return st.set.call(this,e[0],t,n,e[0])};function ht(e,t){const n=He(e)?Je("MapSet").proxyMap_(e,t):Ve(e)?Je("MapSet").proxySet_(e,t):function(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:Ge(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let o=r,i=st;n&&(o=[r],i=ct);const{revoke:l,proxy:a}=Proxy.revocable(o,i);return r.draft_=a,r.revoke_=l,a}(e,t);return(t?t.scope_:Ge()).drafts_.push(n),n}function gt(e){if(!Me(e)||Ye(e))return e;const t=e[Pe];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=Ke(e,t.scope_.immer_.useStrictShallowCopy_)}else n=Ke(e,!0);return Ie(n,((e,t)=>{$e(n,e,gt(t))})),t&&(t.finalized_=!1),n}var vt=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&&Re(6),void 0!==n&&"function"!=typeof n&&Re(7),Me(e)){const o=nt(this),i=ht(e,void 0);let l=!0;try{r=t(i),l=!1}finally{l?et(o):tt(o)}return Qe(o,n),ot(r,o)}if(!e||"object"!=typeof e){if(r=t(e),void 0===r&&(r=e),r===De&&(r=void 0),this.autoFreeze_&&We(r,!0),n){const t=[],o=[];Je("Patches").generateReplacementPatches_(e,r,t,o),n(t,o)}return r}Re(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){Me(e)||Re(8),Te(e)&&(e=function(e){Te(e)||Re(10);return gt(e)}(e));const t=nt(this),n=ht(e,void 0);return n[Pe].isManual_=!0,tt(t),n}finishDraft(e,t){const n=e&&e[Pe];n&&n.isManual_||Re(9);const{scope_:r}=n;return Qe(r,t),ot(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=Je("Patches").applyPatches_;return Te(e)?r(e,t):this.produce(e,(e=>r(e,t)))}},yt=vt.produce;vt.produceWithPatches.bind(vt),vt.setAutoFreeze.bind(vt),vt.setUseStrictShallowCopy.bind(vt),vt.applyPatches.bind(vt);var mt=vt.createDraft.bind(vt),bt=vt.finishDraft.bind(vt);const wt=(e,t)=>{const{insertText:n}=t;return t.insertText=r=>{var o;const{selection:i}=t;if(" "===r&&i&&E.isCollapsed(i)){const{anchor:l}=i,a=y.above(t,{match:e=>m.isElement(e)&&y.isBlock(t,e),mode:"lowest"});if(!a)return;const[,s]=a,c=y.parent(t,s),[u]=c;if(m.isElement(u)&&!b.isText(u.children[0]))return n(r);const d=a?s:[],f={anchor:l,focus:y.start(t,d)},p=y.string(t,f),h=null===(o=e.shortcuts)||void 0===o?void 0:o[p];if(!!h&&!h.isActive())return w.select(t,f),w.delete(t),void e.toggleBlock(h.type,{deleteText:!0,focus:!0})}n(r)},t};function kt(e){return wt(e,j(S()))}function xt(e,t){switch(t.type){case"set_slate":{const{properties:n,blockId:r}=t,o=e.blockEditorsMap[r];if(o){const{slateOps:e,selectionBefore:t}=n;y.withoutNormalizing(o,(()=>{for(const t of e)o.apply(t);if(t)try{w.select(o,t),C.focus(o)}catch(e){}}))}break}case"insert_block":e.blockEditorsMap[t.block.id]=kt(e),e.children[t.block.id]=t.block,e.blockEditorsMap[t.block.id].children=t.block.value,Object.keys(e.children).forEach((n=>{const r=e.children[n];r.meta.order>=t.block.meta.order&&r.id!==t.block.id&&Te(e.children[r.id])&&(r.meta.order=r.meta.order+1)}));break;case"delete_block":{delete e.blockEditorsMap[t.block.id],delete e.children[t.block.id];const n=Object.values(e.children);n.forEach((e=>{e.meta.order>t.block.meta.order&&(Te(e)?e.meta.order--:yt(e,(e=>{e.meta.order--})))})),n.sort(((e,t)=>e.meta.order-t.meta.order)),n.forEach(((e,t)=>{Te(e.meta)?e.meta.order=t:yt(e,(e=>{e.meta=Object.assign(Object.assign({},e.meta),{order:t})}))}));break}case"set_block_value":{const{id:n,value:r,forceSlate:o}=t,i=e.blockEditorsMap[n];o&&i&&(i.children=r),Array.isArray(r)&&(Te(e.children[n])?e.children[n].value=r:yt(e.children[n],(e=>{e.value=r})));break}case"set_block_meta":{const{id:n,properties:r}=t,o=e.children[n];if(!o)break;Te(o)?Object.keys(r).forEach((e=>{o.meta[e]=r[e]})):yt(o,(e=>{e.meta=Object.assign(Object.assign({},e.meta),r)}));break}case"split_block":{const{properties:n}=t,r=kt(e);r.children=n.nextSlateValue,e.children[n.nextBlock.id]=Object.assign(Object.assign({},n.nextBlock),{value:r.children}),e.blockEditorsMap[n.nextBlock.id]=r;const o=e.blockEditorsMap[t.prevProperties.originalBlock.id];o.children=n.splitSlateValue,e.children[t.prevProperties.originalBlock.id].value=o.children,Object.values(e.children).forEach((e=>{e.meta.order>=n.nextBlock.meta.order&&e.id!==n.nextBlock.id&&(Te(e)?e.meta.order++:yt(e,(e=>{e.meta.order++})))}));break}case"merge_block":{const{prevProperties:n,properties:r}=t;delete e.blockEditorsMap[n.sourceBlock.id],delete e.children[n.sourceBlock.id],e.children[r.mergedBlock.id]=r.mergedBlock,e.blockEditorsMap[r.mergedBlock.id].children=r.mergedSlateValue,Object.values(e.children).forEach((e=>{e.meta.order>r.mergedBlock.meta.order&&(Te(e)?e.meta.order--:yt(e,(e=>{e.meta.order--})))}));break}case"toggle_block":{const{properties:n,prevProperties:r}=t;delete e.blockEditorsMap[r.sourceBlock.id],delete e.children[r.sourceBlock.id];const o=kt(e);o.children=n.toggledSlateValue,e.children[n.toggledBlock.id]=n.toggledBlock,e.blockEditorsMap[n.toggledBlock.id]=o;break}case"move_block":{const{prevProperties:n,properties:r}=t,o=e.children[n.id];o&&(o.meta.order=r.order,Object.values(e.children).forEach((e=>{e.id!==n.id&&(n.order<r.order?e.meta.order>n.order&&e.meta.order<=r.order&&e.meta.order--:e.meta.order<n.order&&e.meta.order>=r.order&&e.meta.order++)})));break}case"set_block_path":e.path=t.path;break;case"set_editor_value":{e.children=t.properties.value;const n={};Object.keys(e.children).forEach((t=>{const r=e.children[t],o=kt(e);o.children=r.value,n[t]=o})),e.blockEditorsMap=n;break}case"validate_block_paths":{const t=Object.values(e.children);t.sort(((e,t)=>e.meta.order-t.meta.order)),t.forEach(((e,t)=>{Te(e.meta)?e.meta.order=t:yt(e,(e=>{e.meta=Object.assign(Object.assign({},e.meta),{order:t})}))}));break}}}const Ot=100;const Et=new WeakMap,St=new WeakMap,_t={isMergingHistory:e=>St.get(e),isSavingHistory:e=>Et.get(e),withMergingHistory(e,t){const n=_t.isMergingHistory(e);St.set(e,!0),t(),St.set(e,n)},withSavingHistory(e,t){const n=_t.isSavingHistory(e);Et.set(e,!0),t(),Et.set(e,n)},withoutMergingHistory(e,t){const n=_t.isMergingHistory(e);St.set(e,!1),t(),St.set(e,n)},withoutSavingHistory(e,t){const n=_t.isSavingHistory(e);Et.set(e,!1),t(),Et.set(e,n)},redo:(e,t)=>{const{redos:n}=e.historyStack;if(n.length>0){const r=n[n.length-1];_t.withoutSavingHistory(e,(()=>{e.applyTransforms(r.operations,{source:"history"}),e.setPath(r.path);const{scroll:n=!0}=t||{};if(n&&"number"==typeof r.path.current){const t=Ee.getBlock(e,{at:r.path.current}),n=document.querySelector(`[data-yoopta-block-id="${null==t?void 0:t.id}"]`);n&&!Ct(n)&&n.scrollIntoView({block:"center",behavior:"auto"})}})),e.historyStack.redos.pop(),e.historyStack.undos.push(r)}},undo:(e,t)=>{const{undos:n}=e.historyStack;if(n.length>0){const n=e.historyStack.undos[e.historyStack.undos.length-1];_t.withoutSavingHistory(e,(()=>{const r=n.operations.flatMap((e=>function(e,t){switch(t.type){case"insert_block":return{type:"delete_block",path:t.path,block:t.block};case"delete_block":return{type:"insert_block",path:t.path,block:t.block};case"set_block_meta":return{type:"set_block_meta",id:t.id,properties:t.prevProperties,prevProperties:t.properties};case"split_block":return[{type:"delete_block",block:t.properties.nextBlock,path:t.path},{type:"set_block_value",id:t.prevProperties.originalBlock.id,value:t.prevProperties.originalValue,forceSlate:!0}];case"toggle_block":return{type:"toggle_block",properties:{toggledBlock:t.prevProperties.sourceBlock,toggledSlateValue:t.prevProperties.sourceSlateValue},prevProperties:{sourceBlock:t.properties.toggledBlock,sourceSlateValue:t.properties.toggledSlateValue}};case"merge_block":return[{type:"split_block",properties:{nextBlock:t.prevProperties.sourceBlock,nextSlateValue:t.prevProperties.sourceSlateValue,splitSlateValue:t.prevProperties.targetSlateValue},prevProperties:{originalBlock:t.properties.mergedBlock,originalValue:t.properties.mergedSlateValue},path:t.path}];case"move_block":return{type:"move_block",properties:t.prevProperties,prevProperties:t.properties};case"set_slate":return{type:"set_slate",properties:{slateOps:t.properties.slateOps.map(_.inverse).reverse(),selectionBefore:t.properties.selectionBefore},slate:t.slate,blockId:t.blockId};case"set_editor_value":return{type:"set_editor_value",properties:t.prevProperties,prevProperties:t.properties};default:return t}}(0,e))).reverse();e.applyTransforms(r,{source:"history"}),e.setPath(n.path);const{scroll:o=!0}=t||{};if(o&&"number"==typeof n.path.current){const t=Ee.getBlock(e,{at:n.path.current}),r=document.querySelector(`[data-yoopta-block-id="${null==t?void 0:t.id}"]`);r&&!Ct(r)&&r.scrollIntoView({block:"center",behavior:"auto"})}})),e.historyStack.redos.push(n),e.historyStack.undos.pop()}}};function Ct(e){var t=e.getBoundingClientRect(),n=document.documentElement;return t.top>=0&&t.left>=0&&t.bottom<=(window.innerHeight||n.clientHeight)&&t.right<=(window.innerWidth||n.clientWidth)}var jt={};function Dt(e){return e.map((e=>{var t,n;if("text"in e){let r=e.text;return e.bold&&(r=`<strong style="font-weight: bolder;">${r}</strong>`),e.italic&&(r=`<i>${r}</i>`),e.strike&&(r=`<s>${r}</s>`),e.underline&&(r=`<u>${r}</u>`),e.code&&(r=`<code style="background-color: rgb(242 242 242); border-radius: .25rem; font-size: 75%; padding: 3px 6px;">${r}</code>`),e.highlight&&(r=`<mark style="color: ${null===(t=e.highlight)||void 0===t?void 0:t.color}; background-color: ${(null===(n=e.highlight)||void 0===n?void 0:n.backgroundColor)||"transparent"};">${r}</mark>`),r}if("link"===e.type){const{url:t,target:n,rel:r}=e.props;return`<a href="${t}" target="${n}" rel="${r}" style="color: rgb(0 122 255);\n cursor: pointer;\n position: relative;\n text-decoration-line: underline;\n text-underline-offset: 4px;">${Dt(e.children)}</a>`}return""})).join("")}function At(e){return e.map((e=>{if("text"in e){let t=e.text;return e.bold&&(t=`**${t}**`),e.italic&&(t=`*${t}*`),e.strike&&(t=`~~${t}~~`),e.underline&&(t=`<u>${t}</u>`),e.code&&(t=`\`${t}\``),t}if("link"===e.type){const{url:t,target:n,rel:r}=e.props;return`[${At(e.children)}](${t})`}return""})).join("")}!function(e){var t=Object.prototype.hasOwnProperty,n="~";function r(){}function o(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function i(e,t,r,i,l){if("function"!=typeof r)throw new TypeError("The listener must be a function");var a=new o(r,i||e,l),s=n?n+t:t;return e._events[s]?e._events[s].fn?e._events[s]=[e._events[s],a]:e._events[s].push(a):(e._events[s]=a,e._eventsCount++),e}function l(e,t){0==--e._eventsCount?e._events=new r:delete e._events[t]}function a(){this._events=new r,this._eventsCount=0}Object.create&&(r.prototype=Object.create(null),(new r).__proto__||(n=!1)),a.prototype.eventNames=function(){var e,r,o=[];if(0===this._eventsCount)return o;for(r in e=this._events)t.call(e,r)&&o.push(n?r.slice(1):r);return Object.getOwnPropertySymbols?o.concat(Object.getOwnPropertySymbols(e)):o},a.prototype.listeners=function(e){var t=n?n+e:e,r=this._events[t];if(!r)return[];if(r.fn)return[r.fn];for(var o=0,i=r.length,l=new Array(i);o<i;o++)l[o]=r[o].fn;return l},a.prototype.listenerCount=function(e){var t=n?n+e:e,r=this._events[t];return r?r.fn?1:r.length:0},a.prototype.emit=function(e,t,r,o,i,l){var a=n?n+e:e;if(!this._events[a])return!1;var s,c,u=this._events[a],d=arguments.length;if(u.fn){switch(u.once&&this.removeListener(e,u.fn,void 0,!0),d){case 1:return u.fn.call(u.context),!0;case 2:return u.fn.call(u.context,t),!0;case 3:return u.fn.call(u.context,t,r),!0;case 4:return u.fn.call(u.context,t,r,o),!0;case 5:return u.fn.call(u.context,t,r,o,i),!0;case 6:return u.fn.call(u.context,t,r,o,i,l),!0}for(c=1,s=new Array(d-1);c<d;c++)s[c-1]=arguments[c];u.fn.apply(u.context,s)}else{var f,p=u.length;for(c=0;c<p;c++)switch(u[c].once&&this.removeListener(e,u[c].fn,void 0,!0),d){case 1:u[c].fn.call(u[c].context);break;case 2:u[c].fn.call(u[c].context,t);break;case 3:u[c].fn.call(u[c].context,t,r);break;case 4:u[c].fn.call(u[c].context,t,r,o);break;default:if(!s)for(f=1,s=new Array(d-1);f<d;f++)s[f-1]=arguments[f];u[c].fn.apply(u[c].context,s)}}return!0},a.prototype.on=function(e,t,n){return i(this,e,t,n,!1)},a.prototype.once=function(e,t,n){return i(this,e,t,n,!0)},a.prototype.removeListener=function(e,t,r,o){var i=n?n+e:e;if(!this._events[i])return this;if(!t)return l(this,i),this;var a=this._events[i];if(a.fn)a.fn!==t||o&&!a.once||r&&a.context!==r||l(this,i);else{for(var s=0,c=[],u=a.length;s<u;s++)(a[s].fn!==t||o&&!a[s].once||r&&a[s].context!==r)&&c.push(a[s]);c.length?this._events[i]=1===c.length?c[0]:c:l(this,i)}return this},a.prototype.removeAllListeners=function(e){var t;return e?(t=n?n+e:e,this._events[t]&&l(this,t)):(this._events=new r,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=n,a.EventEmitter=a,e.exports=a}({get exports(){return jt},set exports(e){jt=e}});const Pt={head:{meta:[{content:"width=device-width",name:"viewport"},{charset:"UTF-8"},{content:"IE=edge","http-equiv":"X-UA-Compatible"}]},body:{attrs:{style:{margin:"0 auto",padding:0,width:"900px"}}},container:{attrs:{style:{margin:"0 auto",width:"600px"}}}};function Rt(e,t,n){var r,o,i,l,a;const s=Tt(Pt,n||{}),c=Object.values(t).filter((t=>{const n=Z.getSelectedPaths(e);return!(Array.isArray(n)&&n.length>0)||(null==n?void 0:n.includes(t.meta.order))})).sort(((e,t)=>e.meta.order-t.meta.order)).map((t=>{var n,r;const o=e.plugins[t.type];if(o&&(null===(r=null===(n=o.parsers)||void 0===n?void 0:n.email)||void 0===r?void 0:r.serialize)){const e=Dt(t.value[0].children);return o.parsers.email.serialize(t.value[0],e,t.meta)}return""})),u=c.join("");if(s.customTemplate)return s.customTemplate(u);const d=Bt(null===(r=s.body)||void 0===r?void 0:r.attrs),f=Bt(null===(o=s.container)||void 0===o?void 0:o.attrs);return`\n <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\n <html lang="en">\n <head>\n <title>${(null===(i=null==s?void 0:s.head)||void 0===i?void 0:i.title)||"Email-Builder"}</title>\n <meta http-equiv="Content-Type" content="text/html charset=UTF-8" />\n ${function(e=[]){return e.map((e=>`<meta ${Object.entries(e).filter((([e,t])=>void 0!==t)).map((([e,t])=>""===t?e:`${e}="${t}"`)).join(" ")}>`)).join("\n")}(null===(l=s.head)||void 0===l?void 0:l.meta)}\n ${function(e=[]){return e.map((e=>`<style${e.id?` id="${e.id}"`:""}>${e.content}</style>`)).join("\n")}(null===(a=s.head)||void 0===a?void 0:a.styles)}\n </head>\n <body id="yoopta-email" ${d}>\n <table ${f}>\n <tbody>\n <tr>\n <td>\n ${u}\n </td>\n </tr>\n </tbody>\n </table>\n </body>\n </html>\n `}function Bt(e){return e?Object.entries(e).map((([e,t])=>{if("style"===e){const e=(n=t)?Object.entries(n).map((([e,t])=>`${e.replace(/[A-Z]/g,(e=>`-${e.toLowerCase()}`))}: ${t}${"number"==typeof t?"px":""};`)).join(" "):"";return`style="${e}"`}var n;return`${e}="${t}"`})).join(" "):""}function Tt(e,t){return Array.isArray(e)&&Array.isArray(t)?e.concat(t):"object"==typeof e&&"object"==typeof t?Object.keys(Object.assign(Object.assign({},e),t)).reduce(((n,r)=>(n[r]=Tt(e[r],t[r]),n)),{}):t}const Mt=new jt,Nt=(e,t)=>Mt.on(e,t),Lt=(e,t)=>Mt.once(e,t),It=(e,t)=>Mt.off(e,t),Ft=(e,t)=>Mt.emit(e,t);function zt(){const e={id:"",children:{},blockEditorsMap:{},path:{current:null},readOnly:!1,isEmpty:()=>function(e){const t=Object.values(e.children);if(t.length>1)return!1;const n=t[0];if(!n)return!0;if("Paragraph"!==n.type)return!1;const r=re(e,{at:n.meta.order});if(!r)return!0;try{return!(y.string(r,[0]).length>0)}catch(e){return!0}}(e),getEditorValue:()=>function(e){return e.children}(e),setEditorValue:(...t)=>function(e,t){let n;if(null!==t&&fe(t))n=t;else{const e=Ee.buildBlockData();n={[e.id]:e}}const r={type:"set_editor_value",properties:{value:n},prevProperties:{value:e.children}};e.applyTransforms([r],{validatePaths:!0})}(e,...t),insertBlock:(...t)=>W(e,...t),deleteBlock:(...t)=>G(e,...t),duplicateBlock:(...t)=>pe(e,...t),toggleBlock:(...t)=>me(e,...t),increaseBlockDepth:(...t)=>ue(e,...t),decreaseBlockDepth:(...t)=>de(e,...t),moveBlock:(...t)=>Q(e,...t),focusBlock:(...t)=>te(e,...t),getBlock:(...t)=>be(e,...t),updateBlock:(...t)=>he(e,...t),splitBlock:(...t)=>ce(e,...t),mergeBlock:(...t)=>Oe(e,...t),setPath:(...t)=>Y(e,...t),blocks:{},formats:{},shortcuts:{},plugins:{},commands:{},applyTransforms:(t,...n)=>function(e,t,n){e.children=mt(e.children),e.path=mt(e.path);const{validatePaths:r=!0,source:o}=n||{},i=[...t];r&&i.push({type:"validate_block_paths"}),i.length>1&&i.sort(((e,t)=>"insert_block"===e.type&&"insert_block"===t.type?e.block.meta.order-t.block.meta.order:0));for(const t of i)"set_slate"===t.type&&"api"===o||xt(e,t);if(Te(e.children)||(e.children=mt(e.children)),e.children=bt(e.children),Te(e.path)&&(e.path=bt(e.path)),!1!==e.isSavingHistory()){const t={operations:i.filter((e=>"set_block_path"!==e.type&&"set_block_value"!==e.type&&"validate_block_paths"!==e.type)),path:e.path};t.operations.length>0&&"history"!==o&&(e.historyStack.undos.push(t),e.historyStack.redos=[]),e.historyStack.undos.length>Ot&&e.historyStack.undos.shift()}const l={value:e.children,operations:i};e.emit("change",l),e.emit("path-change",e.path)}(e,t,...n),batchOperations:t=>function(e,t){const n=[];let r={};const o=e.applyTransforms;e.applyTransforms=(e,t)=>{t&&(r=t),n.push(...e)},t(),e.applyTransforms=o,n.length>0&&e.applyTransforms(n,r)}(e,t),on:(e,t)=>Nt(e,t),off:(e,t)=>It(e,t),emit:(e,...t)=>Ft(e,...t),once:(e,t)=>Lt(e,t),isFocused:()=>function(e){return!!ee.get(e)}(e),focus:()=>function(e){if(e.readOnly)return;const t=ne(e,{at:0});t&&(ee.set(e,!0),e.focusBlock(t.id,{waitExecution:!0}),e.emit("focus",!0))}(e),blur:(...t)=>function(e,t={}){var n;const r=null!==(n=t.slate)&&void 0!==n?n:re(e);if(!r)return;const{waitExecution:o,waitExecutionMs:i}=t;o?setTimeout((()=>Se(e,r)),i):(ee.set(e,!1),Se(e,r),e.emit("blur",!1))}(e,...t),getHTML:t=>je(e,t),getMarkdown:t=>function(e,t){return function(e,t){return t.sort(((e,t)=>e.meta.order>t.meta.order?1:-1)).map((t=>{var n,r;const o=e.plugins[t.type];if(o){const e=t.value[0];if(null===(r=null===(n=o.parsers)||void 0===n?void 0:n.markdown)||void 0===r?void 0:r.serialize){const n=o.parsers.markdown.serialize(e,e.children.map((e=>e.text)).join(""),t.meta);if(n)return n}}return""})).join("\n")}(e,Object.values(t))}(e,t),getPlainText:t=>function(e,t){const n=je(e,t),r=document.createElement("div");return r.innerHTML=n,r.innerText}(e,t),getEmail:(t,n)=>Rt(e,t,n),refElement:null,historyStack:{undos:[],redos:[]},redo:t=>_t.redo(e,t),undo:t=>_t.undo(e,t),isSavingHistory:()=>_t.isSavingHistory(e),isMergingHistory:()=>_t.isMergingHistory(e),withoutSavingHistory:t=>_t.withoutSavingHistory(e,t),withSavingHistory:t=>_t.withSavingHistory(e,t),withoutMergingHistory:t=>_t.withoutMergingHistory(e,t),withMergingHistory:t=>_t.withMergingHistory(e,t)};return e}const $t={editor:zt()},Ht=i($t),Vt=({children:t,editorState:n})=>{const r=a($t);return r.current={editor:n.editor},e(Ht.Provider,Object.assign({value:r.current},{children:t}))},Ut=()=>{const e=l(Ht);if(!e)throw new Error("useYooptaEditor must be used within a YooptaEditorContext");return e.editor},Kt=e=>Ut().children[e],Wt=()=>Ut().isFocused(),qt=()=>Ut().readOnly,Yt=e=>{var t;return null===(t=Ut().plugins[e])||void 0===t?void 0:t.options},Xt=({blockId:e,at:t})=>{const n=Ut();if(!e&&"number"!=typeof t)throw new Error("useBlockSelected must receive either blockId or at");let r;return e&&(r=n.children[e]),t&&(r=Ee.getBlock(n,{at:t})),n.path.current===(null==r?void 0:r.meta.order)};const Zt="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement;function Jt(e){const t=Object.prototype.toString.call(e);return"[object Window]"===t||"[object global]"===t}function Gt(e){return"nodeType"in e}function Qt(e){var t,n;return e?Jt(e)?e:Gt(e)&&null!=(t=null==(n=e.ownerDocument)?void 0:n.defaultView)?t:window:window}function en(e){const{Document:t}=Qt(e);return e instanceof t}function tn(e){return!Jt(e)&&e instanceof Qt(e).HTMLElement}function nn(e){return e instanceof Qt(e).SVGElement}function rn(e){return e?Jt(e)?e.document:Gt(e)?en(e)?e:tn(e)||nn(e)?e.ownerDocument:document:document:document}const on=Zt?c:u;function ln(e){const t=a(e);return on((()=>{t.current=e})),d((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)}),[])}function an(e,t){void 0===t&&(t=[e]);const n=a(e);return on((()=>{n.current!==e&&(n.current=e)}),t),n}function sn(e,t){const n=a();return s((()=>{const t=e(n.current);return n.current=t,t}),[...t])}function cn(e){const t=ln(e),n=a(null),r=d((e=>{e!==n.current&&(null==t||t(e,n.current)),n.current=e}),[]);return[n,r]}function un(e){const t=a();return u((()=>{t.current=e}),[e]),t.current}let dn={};function fn(e,t){return s((()=>{if(t)return t;const n=null==dn[e]?0:dn[e]+1;return dn[e]=n,e+"-"+n}),[e,t])}function pn(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return r.reduce(((t,n)=>{const r=Object.entries(n);for(const[n,o]of r){const r=t[n];null!=r&&(t[n]=r+e*o)}return t}),{...t})}}const hn=pn(1),gn=pn(-1);function vn(e){if(!e)return!1;const{KeyboardEvent:t}=Qt(e.target);return t&&e instanceof t}function yn(e){if(function(e){if(!e)return!1;const{TouchEvent:t}=Qt(e.target);return t&&e instanceof t}(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return function(e){return"clientX"in e&&"clientY"in e}(e)?{x:e.clientX,y:e.clientY}:null}const mn=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[mn.Translate.toString(e),mn.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),bn="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function wn(e){return e.matches(bn)?e:e.querySelector(bn)}const kn={display:"none"};function xn(e){let{id:t,value:n}=e;return o.createElement("div",{id:t,style:kn},n)}function On(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;return o.createElement("div",{id:t,style:{position:"fixed",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"},role:"status","aria-live":r,"aria-atomic":!0},n)}const En=i(null);const Sn={draggable:"\n To pick up a draggable item, press the space bar.\n While dragging, use the arrow keys to move the item.\n Press space again to drop the item in its new position, or press escape to cancel.\n "},_n={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function Cn(e){let{announcements:t=_n,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=Sn}=e;const{announce:a,announcement:c}=function(){const[e,t]=f("");return{announce:d((e=>{null!=e&&t(e)}),[]),announcement:e}}(),p=fn("DndLiveRegion"),[h,g]=f(!1);if(u((()=>{g(!0)}),[]),function(e){const t=l(En);u((()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)}),[e,t])}(s((()=>({onDragStart(e){let{active:n}=e;a(t.onDragStart({active:n}))},onDragMove(e){let{active:n,over:r}=e;t.onDragMove&&a(t.onDragMove({active:n,over:r}))},onDragOver(e){let{active:n,over:r}=e;a(t.onDragOver({active:n,over:r}))},onDragEnd(e){let{active:n,over:r}=e;a(t.onDragEnd({active:n,over:r}))},onDragCancel(e){let{active:n,over:r}=e;a(t.onDragCancel({active:n,over:r}))}})),[a,t])),!h)return null;const v=o.createElement(o.Fragment,null,o.createElement(xn,{id:r,value:i.draggable}),o.createElement(On,{id:p,announcement:c}));return n?M(v,n):v}var jn;function Dn(){}function An(e,t){return s((()=>({sensor:e,options:null!=t?t:{}})),[e,t])}!function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"}(jn||(jn={}));const Pn=Object.freeze({x:0,y:0});function Rn(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Bn(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function Tn(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function Mn(e){let{left:t,top:n,height:r,width:o}=e;return[{x:t,y:n},{x:t+o,y:n},{x:t,y:n+r},{x:t+o,y:n+r}]}function Nn(e,t){if(!e||0===e.length)return null;const[n]=e;return t?n[t]:n}function Ln(e,t,n){return void 0===t&&(t=e.left),void 0===n&&(n=e.top),{x:t+.5*e.width,y:n+.5*e.height}}const In=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=Ln(t,t.left,t.top),i=[];for(const e of r){const{id:t}=e,r=n.get(t);if(r){const n=Rn(Ln(r),o);i.push({id:t,data:{droppableContainer:e,value:n}})}}return i.sort(Bn)};function Fn(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),o=Math.min(t.left+t.width,e.left+e.width),i=Math.min(t.top+t.height,e.top+e.height),l=o-r,a=i-n;if(r<o&&n<i){const n=t.width*t.height,r=e.width*e.height,o=l*a;return Number((o/(n+r-o)).toFixed(4))}return 0}const zn=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=[];for(const e of r){const{id:r}=e,i=n.get(r);if(i){const n=Fn(i,t);n>0&&o.push({id:r,data:{droppableContainer:e,value:n}})}}return o.sort(Tn)};function $n(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:Pn}function Hn(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return r.reduce(((t,n)=>({...t,top:t.top+e*n.y,bottom:t.bottom+e*n.y,left:t.left+e*n.x,right:t.right+e*n.x})),{...t})}}const Vn=Hn(1);const Un={ignoreTransform:!1};function Kn(e,t){void 0===t&&(t=Un);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:t,transformOrigin:r}=Qt(e).getComputedStyle(e);t&&(n=function(e,t,n){const r=function(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}(t);if(!r)return e;const{scaleX:o,scaleY:i,x:l,y:a}=r,s=e.left-l-(1-o)*parseFloat(n),c=e.top-a-(1-i)*parseFloat(n.slice(n.indexOf(" ")+1)),u=o?e.width/o:e.width,d=i?e.height/i:e.height;return{width:u,height:d,top:c,right:s+u,bottom:c+d,left:s}}(n,t,r))}const{top:r,left:o,width:i,height:l,bottom:a,right:s}=n;return{top:r,left:o,width:i,height:l,bottom:a,right:s}}function Wn(e){return Kn(e,{ignoreTransform:!0})}function qn(e,t){const n=[];return e?function r(o){if(null!=t&&n.length>=t)return n;if(!o)return n;if(en(o)&&null!=o.scrollingElement&&!n.includes(o.scrollingElement))return n.push(o.scrollingElement),n;if(!tn(o)||nn(o))return n;if(n.includes(o))return n;const i=Qt(e).getComputedStyle(o);return o!==e&&function(e,t){void 0===t&&(t=Qt(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some((e=>{const r=t[e];return"string"==typeof r&&n.test(r)}))}(o,i)&&n.push(o),function(e,t){return void 0===t&&(t=Qt(e).getComputedStyle(e)),"fixed"===t.position}(o,i)?n:r(o.parentNode)}(e):n}function Yn(e){const[t]=qn(e,1);return null!=t?t:null}function Xn(e){return Zt&&e?Jt(e)?e:Gt(e)?en(e)||e===rn(e).scrollingElement?window:tn(e)?e:null:null:null}function Zn(e){return Jt(e)?e.scrollX:e.scrollLeft}function Jn(e){return Jt(e)?e.scrollY:e.scrollTop}function Gn(e){return{x:Zn(e),y:Jn(e)}}var Qn;function er(e){return!(!Zt||!e)&&e===document.scrollingElement}function tr(e){const t={x:0,y:0},n=er(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height};return{isTop:e.scrollTop<=t.y,isLeft:e.scrollLeft<=t.x,isBottom:e.scrollTop>=r.y,isRight:e.scrollLeft>=r.x,maxScroll:r,minScroll:t}}!function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"}(Qn||(Qn={}));const nr={x:.2,y:.2};function rr(e,t,n,r,o){let{top:i,left:l,right:a,bottom:s}=n;void 0===r&&(r=10),void 0===o&&(o=nr);const{isTop:c,isBottom:u,isLeft:d,isRight:f}=tr(e),p={x:0,y:0},h={x:0,y:0},g=t.height*o.y,v=t.width*o.x;return!c&&i<=t.top+g?(p.y=Qn.Backward,h.y=r*Math.abs((t.top+g-i)/g)):!u&&s>=t.bottom-g&&(p.y=Qn.Forward,h.y=r*Math.abs((t.bottom-g-s)/g)),!f&&a>=t.right-v?(p.x=Qn.Forward,h.x=r*Math.abs((t.right-v-a)/v)):!d&&l<=t.left+v&&(p.x=Qn.Backward,h.x=r*Math.abs((t.left+v-l)/v)),{direction:p,speed:h}}function or(e){if(e===document.scrollingElement){const{innerWidth:e,innerHeight:t}=window;return{top:0,left:0,right:e,bottom:t,width:e,height:t}}const{top:t,left:n,right:r,bottom:o}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:o,width:e.clientWidth,height:e.clientHeight}}function ir(e){return e.reduce(((e,t)=>hn(e,Gn(t))),Pn)}const lr=[["x",["left","right"],function(e){return e.reduce(((e,t)=>e+Zn(t)),0)}],["y",["top","bottom"],function(e){return e.reduce(((e,t)=>e+Jn(t)),0)}]];class ar{constructor(e,t){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const n=qn(t),r=ir(n);this.rect={...e},this.width=e.width,this.height=e.height;for(const[e,t,o]of lr)for(const i of t)Object.defineProperty(this,i,{get:()=>{const t=o(n),l=r[e]-t;return this.rect[i]+l},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class sr{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach((e=>{var t;return null==(t=this.target)?void 0:t.removeEventListener(...e)}))},this.target=e}add(e,t,n){var r;null==(r=this.target)||r.addEventListener(e,t,n),this.listeners.push([e,t,n])}}function cr(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return"number"==typeof t?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t&&r>t.y}var ur,dr;function fr(e){e.preventDefault()}function pr(e){e.stopPropagation()}!function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"}(ur||(ur={})),function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter"}(dr||(dr={}));const hr={start:[dr.Space,dr.Enter],cancel:[dr.Esc],end:[dr.Space,dr.Enter]},gr=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case dr.Right:return{...n,x:n.x+25};case dr.Left:return{...n,x:n.x-25};case dr.Down:return{...n,y:n.y+25};case dr.Up:return{...n,y:n.y-25}}};class vr{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;const{event:{target:t}}=e;this.props=e,this.listeners=new sr(rn(t)),this.windowListeners=new sr(Qt(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(ur.Resize,this.handleCancel),this.windowListeners.add(ur.VisibilityChange,this.handleCancel),setTimeout((()=>this.listeners.add(ur.Keydown,this.handleKeyDown)))}handleStart(){const{activeNode:e,onStart:t}=this.props,n=e.node.current;n&&function(e,t){if(void 0===t&&(t=Kn),!e)return;const{top:n,left:r,bottom:o,right:i}=t(e);Yn(e)&&(o<=0||i<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}(n),t(Pn)}handleKeyDown(e){if(vn(e)){const{active:t,context:n,options:r}=this.props,{keyboardCodes:o=hr,coordinateGetter:i=gr,scrollBehavior:l="smooth"}=r,{code:a}=e;if(o.end.includes(a))return void this.handleEnd(e);if(o.cancel.includes(a))return void this.handleCancel(e);const{collisionRect:s}=n.current,c=s?{x:s.left,y:s.top}:Pn;this.referenceCoordinates||(this.referenceCoordinates=c);const u=i(e,{active:t,context:n.current,currentCoordinates:c});if(u){const t=gn(u,c),r={x:0,y:0},{scrollableAncestors:o}=n.current;for(const n of o){const o=e.code,{isTop:i,isRight:a,isLeft:s,isBottom:c,maxScroll:d,minScroll:f}=tr(n),p=or(n),h={x:Math.min(o===dr.Right?p.right-p.width/2:p.right,Math.max(o===dr.Right?p.left:p.left+p.width/2,u.x)),y:Math.min(o===dr.Down?p.bottom-p.height/2:p.bottom,Math.max(o===dr.Down?p.top:p.top+p.height/2,u.y))},g=o===dr.Right&&!a||o===dr.Left&&!s,v=o===dr.Down&&!c||o===dr.Up&&!i;if(g&&h.x!==u.x){const e=n.scrollLeft+t.x,i=o===dr.Right&&e<=d.x||o===dr.Left&&e>=f.x;if(i&&!t.y)return void n.scrollTo({left:e,behavior:l});r.x=i?n.scrollLeft-e:o===dr.Right?n.scrollLeft-d.x:n.scrollLeft-f.x,r.x&&n.scrollBy({left:-r.x,behavior:l});break}if(v&&h.y!==u.y){const e=n.scrollTop+t.y,i=o===dr.Down&&e<=d.y||o===dr.Up&&e>=f.y;if(i&&!t.x)return void n.scrollTo({top:e,behavior:l});r.y=i?n.scrollTop-e:o===dr.Down?n.scrollTop-d.y:n.scrollTop-f.y,r.y&&n.scrollBy({top:-r.y,behavior:l});break}}this.handleMove(e,hn(gn(u,this.referenceCoordinates),r))}}}handleMove(e,t){const{onMove:n}=this.props;e.preventDefault(),n(t)}handleEnd(e){const{onEnd:t}=this.props;e.preventDefault(),this.detach(),t()}handleCancel(e){const{onCancel:t}=this.props;e.preventDefault(),this.detach(),t()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}function yr(e){return Boolean(e&&"distance"in e)}function mr(e){return Boolean(e&&"delay"in e)}vr.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=hr,onActivation:o}=t,{active:i}=n;const{code:l}=e.nativeEvent;if(r.start.includes(l)){const t=i.activatorNode.current;return(!t||e.target===t)&&(e.preventDefault(),null==o||o({event:e.nativeEvent}),!0)}return!1}}];class br{constructor(e,t,n){var r;void 0===n&&(n=function(e){const{EventTarget:t}=Qt(e);return e instanceof t?e:rn(e)}(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=t;const{event:o}=e,{target:i}=o;this.props=e,this.events=t,this.document=rn(i),this.documentListeners=new sr(this.document),this.listeners=new sr(n),this.windowListeners=new sr(Qt(i)),this.initialCoordinates=null!=(r=yn(o))?r:Pn,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:e,props:{options:{activationConstraint:t,bypassActivationConstraint:n}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),this.windowListeners.add(ur.Resize,this.handleCancel),this.windowListeners.add(ur.DragStart,fr),this.windowListeners.add(ur.VisibilityChange,this.handleCancel),this.windowListeners.add(ur.ContextMenu,fr),this.documentListeners.add(ur.Keydown,this.handleKeydown),t){if(null!=n&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(mr(t))return void(this.timeoutId=setTimeout(this.handleStart,t.delay));if(yr(t))return}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),null!==this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handleStart(){const{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,this.documentListeners.add(ur.Click,pr,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(ur.SelectionChange,this.removeTextSelection),t(e))}handleMove(e){var t;const{activated:n,initialCoordinates:r,props:o}=this,{onMove:i,options:{activationConstraint:l}}=o;if(!r)return;const a=null!=(t=yn(e))?t:Pn,s=gn(r,a);if(!n&&l){if(yr(l)){if(null!=l.tolerance&&cr(s,l.tolerance))return this.handleCancel();if(cr(s,l.distance))return this.handleStart()}return mr(l)&&cr(s,l.tolerance)?this.handleCancel():void 0}e.cancelable&&e.preventDefault(),i(a)}handleEnd(){const{onEnd:e}=this.props;this.detach(),e()}handleCancel(){const{onCancel:e}=this.props;this.detach(),e()}handleKeydown(e){e.code===dr.Esc&&this.handleCancel()}removeTextSelection(){var e;null==(e=this.document.getSelection())||e.removeAllRanges()}}const wr={move:{name:"pointermove"},end:{name:"pointerup"}};class kr extends br{constructor(e){const{event:t}=e,n=rn(t.target);super(e,wr,n)}}kr.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!(!n.isPrimary||0!==n.button)&&(null==r||r({event:n}),!0)}}];const xr={move:{name:"mousemove"},end:{name:"mouseup"}};var Or;!function(e){e[e.RightClick=2]="RightClick"}(Or||(Or={}));(class extends br{constructor(e){super(e,xr,rn(e.event.target))}}).activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button!==Or.RightClick&&(null==r||r({event:n}),!0)}}];const Er={move:{name:"touchmove"},end:{name:"touchend"}};var Sr,_r;function Cr(e){let{acceleration:t,activator:n=Sr.Pointer,canScroll:r,draggingRect:o,enabled:i,interval:l=5,order:c=_r.TreeOrder,pointerCoordinates:f,scrollableAncestors:p,scrollableAncestorRects:h,delta:g,threshold:v}=e;const y=function(e){let{delta:t,disabled:n}=e;const r=un(t);return sn((e=>{if(n||!r||!e)return jr;const o={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[Qn.Backward]:e.x[Qn.Backward]||-1===o.x,[Qn.Forward]:e.x[Qn.Forward]||1===o.x},y:{[Qn.Backward]:e.y[Qn.Backward]||-1===o.y,[Qn.Forward]:e.y[Qn.Forward]||1===o.y}}}),[n,t,r])}({delta:g,disabled:!i}),[m,b]=function(){const e=a(null);return[d(((t,n)=>{e.current=setInterval(t,n)}),[]),d((()=>{null!==e.current&&(clearInterval(e.current),e.current=null)}),[])]}(),w=a({x:0,y:0}),k=a({x:0,y:0}),x=s((()=>{switch(n){case Sr.Pointer:return f?{top:f.y,bottom:f.y,left:f.x,right:f.x}:null;case Sr.DraggableRect:return o}}),[n,o,f]),O=a(null),E=d((()=>{const e=O.current;if(!e)return;const t=w.current.x*k.current.x,n=w.current.y*k.current.y;e.scrollBy(t,n)}),[]),S=s((()=>c===_r.TreeOrder?[...p].reverse():p),[c,p]);u((()=>{if(i&&p.length&&x){for(const e of S){if(!1===(null==r?void 0:r(e)))continue;const n=p.indexOf(e),o=h[n];if(!o)continue;const{direction:i,speed:a}=rr(e,o,x,t,v);for(const e of["x","y"])y[e][i[e]]||(a[e]=0,i[e]=0);if(a.x>0||a.y>0)return b(),O.current=e,m(E,l),w.current=a,void(k.current=i)}w.current={x:0,y:0},k.current={x:0,y:0},b()}else b()}),[t,E,r,b,i,l,JSON.stringify(x),JSON.stringify(y),m,p,S,h,JSON.stringify(v)])}(class extends br{constructor(e){super(e,Er)}static setup(){return window.addEventListener(Er.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(Er.move.name,e)};function e(){}}}).activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:o}=n;return!(o.length>1)&&(null==r||r({event:n}),!0)}}],function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"}(Sr||(Sr={})),function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"}(_r||(_r={}));const jr={x:{[Qn.Backward]:!1,[Qn.Forward]:!1},y:{[Qn.Backward]:!1,[Qn.Forward]:!1}};var Dr,Ar;!function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"}(Dr||(Dr={})),function(e){e.Optimized="optimized"}(Ar||(Ar={}));const Pr=new Map;function Rr(e,t){return sn((n=>e?n||("function"==typeof t?t(e):e):null),[t,e])}function Br(e){let{callback:t,disabled:n}=e;const r=ln(t),o=s((()=>{if(n||"undefined"==typeof window||void 0===window.ResizeObserver)return;const{ResizeObserver:e}=window;return new e(r)}),[n]);return u((()=>()=>null==o?void 0:o.disconnect()),[o]),o}function Tr(e){return new ar(Kn(e),e)}function Mr(e,t,n){void 0===t&&(t=Tr);const[r,o]=h((function(r){if(!e)return null;var o;if(!1===e.isConnected)return null!=(o=null!=r?r:n)?o:null;const i=t(e);if(JSON.stringify(r)===JSON.stringify(i))return r;return i}),null),i=function(e){let{callback:t,disabled:n}=e;const r=ln(t),o=s((()=>{if(n||"undefined"==typeof window||void 0===window.MutationObserver)return;const{MutationObserver:e}=window;return new e(r)}),[r,n]);return u((()=>()=>null==o?void 0:o.disconnect()),[o]),o}({callback(t){if(e)for(const n of t){const{type:t,target:r}=n;if("childList"===t&&r instanceof HTMLElement&&r.contains(e)){o();break}}}}),l=Br({callback:o});return on((()=>{o(),e?(null==l||l.observe(e),null==i||i.observe(document.body,{childList:!0,subtree:!0})):(null==l||l.disconnect(),null==i||i.disconnect())}),[e]),r}const Nr=[];function Lr(e,t){void 0===t&&(t=[]);const n=a(null);return u((()=>{n.current=null}),t),u((()=>{const t=e!==Pn;t&&!n.current&&(n.current=e),!t&&n.current&&(n.current=null)}),[e]),n.current?gn(e,n.current):Pn}function Ir(e){return s((()=>e?function(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}(e):null),[e])}const Fr=[];function zr(e){let{measure:t}=e;const[n,r]=f(null),o=d((e=>{for(const{target:n}of e)if(tn(n)){r((e=>{const r=t(n);return e?{...e,width:r.width,height:r.height}:r}));break}}),[t]),i=Br({callback:o}),l=d((e=>{const n=function(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return tn(t)?t:e}(e);null==i||i.disconnect(),n&&(null==i||i.observe(n)),r(n?t(n):null)}),[t,i]),[a,c]=cn(l);return s((()=>({nodeRef:a,rect:n,setRef:c})),[n,a,c])}const $r=[{sensor:kr,options:{}},{sensor:vr,options:{}}],Hr={current:{}},Vr={draggable:{measure:Wn},droppable:{measure:Wn,strategy:Dr.WhileDragging,frequency:Ar.Optimized},dragOverlay:{measure:Kn}};class Ur extends Map{get(e){var t;return null!=e&&null!=(t=super.get(e))?t:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter((e=>{let{disabled:t}=e;return!t}))}getNodeFor(e){var t,n;return null!=(t=null==(n=this.get(e))?void 0:n.node.current)?t:void 0}}const Kr={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Ur,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Dn},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Vr,measureDroppableContainers:Dn,windowRect:null,measuringScheduled:!1},Wr=i({activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Dn,draggableNodes:new Map,over:null,measureDroppableContainers:Dn}),qr=i(Kr);function Yr(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Ur}}}function Xr(e,t){switch(t.type){case jn.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case jn.DragMove:return e.draggable.active?{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}}:e;case jn.DragEnd:case jn.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case jn.RegisterDroppable:{const{element:n}=t,{id:r}=n,o=new Ur(e.droppable.containers);return o.set(r,n),{...e,droppable:{...e.droppable,containers:o}}}case jn.SetDroppableDisabled:{const{id:n,key:r,disabled:o}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;const l=new Ur(e.droppable.containers);return l.set(n,{...i,disabled:o}),{...e,droppable:{...e.droppable,containers:l}}}case jn.UnregisterDroppable:{const{id:n,key:r}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const i=new Ur(e.droppable.containers);return i.delete(n),{...e,droppable:{...e.droppable,containers:i}}}default:return e}}function Zr(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:o}=l(Wr),i=un(r),a=un(null==n?void 0:n.id);return u((()=>{if(!t&&!r&&i&&null!=a){if(!vn(i))return;if(document.activeElement===i.target)return;const e=o.get(a);if(!e)return;const{activatorNode:t,node:n}=e;if(!t.current&&!n.current)return;requestAnimationFrame((()=>{for(const e of[t.current,n.current]){if(!e)continue;const t=wn(e);if(t){t.focus();break}}}))}}),[r,t,o,a,i]),null}const Jr=i({...Pn,scaleX:1,scaleY:1});var Gr;!function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"}(Gr||(Gr={}));const Qr=p((function(e){var t,n,r,i;let{id:l,accessibility:c,autoScroll:p=!0,children:g,sensors:v=$r,collisionDetection:y=zn,measuring:m,modifiers:b,...w}=e;const k=h(Xr,void 0,Yr),[x,O]=k,[E,S]=function(){const[e]=f((()=>new Set)),t=d((t=>(e.add(t),()=>e.delete(t))),[e]);return[d((t=>{let{type:n,event:r}=t;e.forEach((e=>{var t;return null==(t=e[n])?void 0:t.call(e,r)}))}),[e]),t]}(),[_,C]=f(Gr.Uninitialized),j=_===Gr.Initialized,{draggable:{active:D,nodes:A,translate:P},droppable:{containers:R}}=x,B=D?A.get(D):null,M=a({initial:null,translated:null}),N=s((()=>{var e;return null!=D?{id:D,data:null!=(e=null==B?void 0:B.data)?e:Hr,rect:M}:null}),[D,B]),L=a(null),[I,F]=f(null),[z,$]=f(null),H=an(w,Object.values(w)),V=fn("DndDescribedBy",l),U=s((()=>R.getEnabled()),[R]),K=s((()=>({draggable:{...Vr.draggable,...null==W?void 0:W.draggable},droppable:{...Vr.droppable,...null==W?void 0:W.droppable},dragOverlay:{...Vr.dragOverlay,...null==W?void 0:W.dragOverlay}})),[null==(W=m)?void 0:W.draggable,null==W?void 0:W.droppable,null==W?void 0:W.dragOverlay]);var W;const{droppableRects:q,measureDroppableContainers:Y,measuringScheduled:X}=function(e,t){let{dragging:n,dependencies:r,config:o}=t;const[i,l]=f(null),{frequency:s,measure:c,strategy:p}=o,h=a(e),g=function(){switch(p){case Dr.Always:return!1;case Dr.BeforeDragging:return n;default:return!n}}(),v=an(g),y=d((function(e){void 0===e&&(e=[]),v.current||l((t=>null===t?e:t.concat(e.filter((e=>!t.includes(e))))))}),[v]),m=a(null),b=sn((t=>{if(g&&!n)return Pr;if(!t||t===Pr||h.current!==e||null!=i){const t=new Map;for(let n of e){if(!n)continue;if(i&&i.length>0&&!i.includes(n.id)&&n.rect.current){t.set(n.id,n.rect.current);continue}const e=n.node.current,r=e?new ar(c(e),e):null;n.rect.current=r,r&&t.set(n.id,r)}return t}return t}),[e,i,n,g,c]);return u((()=>{h.current=e}),[e]),u((()=>{g||y()}),[n,g]),u((()=>{i&&i.length>0&&l(null)}),[JSON.stringify(i)]),u((()=>{g||"number"!=typeof s||null!==m.current||(m.current=setTimeout((()=>{y(),m.current=null}),s))}),[s,g,y,...r]),{droppableRects:b,measureDroppableContainers:y,measuringScheduled:null!=i}}(U,{dragging:j,dependencies:[P.x,P.y],config:K.droppable}),Z=function(e,t){const n=null!==t?e.get(t):void 0,r=n?n.node.current:null;return sn((e=>{var n;return null===t?null:null!=(n=null!=r?r:e)?n:null}),[r,t])}(A,D),J=s((()=>z?yn(z):null),[z]),G=function(){const e=!1===(null==I?void 0:I.autoScrollEnabled),t="object"==typeof p?!1===p.enabled:!1===p,n=j&&!e&&!t;if("object"==typeof p)return{...p,enabled:n};return{enabled:n}}(),Q=function(e,t){return Rr(e,t)}(Z,K.draggable.measure);!function(e){let{activeNode:t,measure:n,initialRect:r,config:o=!0}=e;const i=a(!1),{x:l,y:s}="boolean"==typeof o?{x:o,y:o}:o;on((()=>{if(!l&&!s||!t)return void(i.current=!1);if(i.current||!r)return;const e=null==t?void 0:t.node.current;if(!e||!1===e.isConnected)return;const o=$n(n(e),r);if(l||(o.x=0),s||(o.y=0),i.current=!0,Math.abs(o.x)>0||Math.abs(o.y)>0){const t=Yn(e);t&&t.scrollBy({top:o.y,left:o.x})}}),[t,l,s,r,n])}({activeNode:D?A.get(D):null,config:G.layoutShiftCompensation,initialRect:Q,measure:K.draggable.measure});const ee=Mr(Z,K.draggable.measure,Q),te=Mr(Z?Z.parentElement:null),ne=a({activatorEvent:null,active:null,activeNode:Z,collisionRect:null,collisions:null,droppableRects:q,draggableNodes:A,draggingNode:null,draggingNodeRect:null,droppableContainers:R,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),re=R.getNodeFor(null==(t=ne.current.over)?void 0:t.id),oe=zr({measure:K.dragOverlay.measure}),ie=null!=(n=oe.nodeRef.current)?n:Z,le=j?null!=(r=oe.rect)?r:ee:null,ae=Boolean(oe.nodeRef.current&&oe.rect),se=$n(ce=ae?null:ee,Rr(ce));var ce;const ue=Ir(ie?Qt(ie):null),de=function(e){const t=a(e),n=sn((n=>e?n&&n!==Nr&&e&&t.current&&e.parentNode===t.current.parentNode?n:qn(e):Nr),[e]);return u((()=>{t.current=e}),[e]),n}(j?null!=re?re:Z:null),fe=function(e,t){void 0===t&&(t=Kn);const[n]=e,r=Ir(n?Qt(n):null),[o,i]=h((function(){return e.length?e.map((e=>er(e)?r:new ar(t(e),e))):Fr}),Fr),l=Br({callback:i});return e.length>0&&o===Fr&&i(),on((()=>{e.length?e.forEach((e=>null==l?void 0:l.observe(e))):(null==l||l.disconnect(),i())}),[e]),o}(de),pe=function(e,t){let{transform:n,...r}=t;return null!=e&&e.length?e.reduce(((e,t)=>t({transform:e,...r})),n):n}(b,{transform:{x:P.x-se.x,y:P.y-se.y,scaleX:1,scaleY:1},activatorEvent:z,active:N,activeNodeRect:ee,containerNodeRect:te,draggingNodeRect:le,over:ne.current.over,overlayNodeRect:oe.rect,scrollableAncestors:de,scrollableAncestorRects:fe,windowRect:ue}),he=J?hn(J,P):null,ge=function(e){const[t,n]=f(null),r=a(e),o=d((e=>{const t=Xn(e.target);t&&n((e=>e?(e.set(t,Gn(t)),new Map(e)):null))}),[]);return u((()=>{const t=r.current;if(e!==t){i(t);const l=e.map((e=>{const t=Xn(e);return t?(t.addEventListener("scroll",o,{passive:!0}),[t,Gn(t)]):null})).filter((e=>null!=e));n(l.length?new Map(l):null),r.current=e}return()=>{i(e),i(t)};function i(e){e.forEach((e=>{const t=Xn(e);null==t||t.removeEventListener("scroll",o)}))}}),[o,e]),s((()=>e.length?t?Array.from(t.values()).reduce(((e,t)=>hn(e,t)),Pn):ir(e):Pn),[e,t])}(de),ve=Lr(ge),ye=Lr(ge,[ee]),me=hn(pe,ve),be=le?Vn(le,pe):null,we=N&&be?y({active:N,collisionRect:be,droppableRects:q,droppableContainers:U,pointerCoordinates:he}):null,ke=Nn(we,"id"),[xe,Oe]=f(null),Ee=function(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}(ae?pe:hn(pe,ye),null!=(i=null==xe?void 0:xe.rect)?i:null,ee),Se=d(((e,t)=>{let{sensor:n,options:r}=t;if(null==L.current)return;const o=A.get(L.current);if(!o)return;const i=e.nativeEvent,l=new n({active:L.current,activeNode:o,event:i,options:r,context:ne,onStart(e){const t=L.current;if(null==t)return;const n=A.get(t);if(!n)return;const{onDragStart:r}=H.current,o={active:{id:t,data:n.data,rect:M}};T((()=>{null==r||r(o),C(Gr.Initializing),O({type:jn.DragStart,initialCoordinates:e,active:t}),E({type:"onDragStart",event:o})}))},onMove(e){O({type:jn.DragMove,coordinates:e})},onEnd:a(jn.DragEnd),onCancel:a(jn.DragCancel)});function a(e){return async function(){const{active:t,collisions:n,over:r,scrollAdjustedTranslate:o}=ne.current;let l=null;if(t&&o){const{cancelDrop:a}=H.current;if(l={activatorEvent:i,active:t,collisions:n,delta:o,over:r},e===jn.DragEnd&&"function"==typeof a){await Promise.resolve(a(l))&&(e=jn.DragCancel)}}L.current=null,T((()=>{O({type:e}),C(Gr.Uninitialized),Oe(null),F(null),$(null);const t=e===jn.DragEnd?"onDragEnd":"onDragCancel";if(l){const e=H.current[t];null==e||e(l),E({type:t,event:l})}}))}}T((()=>{F(l),$(e.nativeEvent)}))}),[A]),_e=d(((e,t)=>(n,r)=>{const o=n.nativeEvent,i=A.get(r);if(null!==L.current||!i||o.dndKit||o.defaultPrevented)return;const l={active:i};!0===e(n,t.options,l)&&(o.dndKit={capturedBy:t.sensor},L.current=r,Se(n,t))}),[A,Se]),Ce=function(e,t){return s((()=>e.reduce(((e,n)=>{const{sensor:r}=n;return[...e,...r.activators.map((e=>({eventName:e.eventName,handler:t(e.handler,n)})))]}),[])),[e,t])}(v,_e);!function(e){u((()=>{if(!Zt)return;const t=e.map((e=>{let{sensor:t}=e;return null==t.setup?void 0:t.setup()}));return()=>{for(const e of t)null==e||e()}}),e.map((e=>{let{sensor:t}=e;return t})))}(v),on((()=>{ee&&_===Gr.Initializing&&C(Gr.Initialized)}),[ee,_]),u((()=>{const{onDragMove:e}=H.current,{active:t,activatorEvent:n,collisions:r,over:o}=ne.current;if(!t||!n)return;const i={active:t,activatorEvent:n,collisions:r,delta:{x:me.x,y:me.y},over:o};T((()=>{null==e||e(i),E({type:"onDragMove",event:i})}))}),[me.x,me.y]),u((()=>{const{active:e,activatorEvent:t,collisions:n,droppableContainers:r,scrollAdjustedTranslate:o}=ne.current;if(!e||null==L.current||!t||!o)return;const{onDragOver:i}=H.current,l=r.get(ke),a=l&&l.rect.current?{id:l.id,rect:l.rect.current,data:l.data,disabled:l.disabled}:null,s={active:e,activatorEvent:t,collisions:n,delta:{x:o.x,y:o.y},over:a};T((()=>{Oe(a),null==i||i(s),E({type:"onDragOver",event:s})}))}),[ke]),on((()=>{ne.current={activatorEvent:z,active:N,activeNode:Z,collisionRect:be,collisions:we,droppableRects:q,draggableNodes:A,draggingNode:ie,draggingNodeRect:le,droppableContainers:R,over:xe,scrollableAncestors:de,scrollAdjustedTranslate:me},M.current={initial:le,translated:be}}),[N,Z,we,be,A,ie,le,q,R,xe,de,me]),Cr({...G,delta:P,draggingRect:be,pointerCoordinates:he,scrollableAncestors:de,scrollableAncestorRects:fe});const je=s((()=>({active:N,activeNode:Z,activeNodeRect:ee,activatorEvent:z,collisions:we,containerNodeRect:te,dragOverlay:oe,draggableNodes:A,droppableContainers:R,droppableRects:q,over:xe,measureDroppableContainers:Y,scrollableAncestors:de,scrollableAncestorRects:fe,measuringConfiguration:K,measuringScheduled:X,windowRect:ue})),[N,Z,ee,z,we,te,oe,A,R,q,xe,Y,de,fe,K,X,ue]),De=s((()=>({activatorEvent:z,activators:Ce,active:N,activeNodeRect:ee,ariaDescribedById:{draggable:V},dispatch:O,draggableNodes:A,over:xe,measureDroppableContainers:Y})),[z,Ce,N,ee,O,V,A,xe,Y]);return o.createElement(En.Provider,{value:S},o.createElement(Wr.Provider,{value:De},o.createElement(qr.Provider,{value:je},o.createElement(Jr.Provider,{value:Ee},g)),o.createElement(Zr,{disabled:!1===(null==c?void 0:c.restoreFocus)})),o.createElement(Cn,{...c,hiddenTextDescribedById:V}))})),eo=i(null),to="button",no="Droppable";function ro(e){let{id:t,data:n,disabled:r=!1,attributes:o}=e;const i=fn(no),{activators:a,activatorEvent:c,active:u,activeNodeRect:d,ariaDescribedById:f,draggableNodes:p,over:h}=l(Wr),{role:g=to,roleDescription:v="draggable",tabIndex:y=0}=null!=o?o:{},m=(null==u?void 0:u.id)===t,b=l(m?Jr:eo),[w,k]=cn(),[x,O]=cn(),E=function(e,t){return s((()=>e.reduce(((e,n)=>{let{eventName:r,handler:o}=n;return e[r]=e=>{o(e,t)},e}),{})),[e,t])}(a,t),S=an(n);on((()=>(p.set(t,{id:t,key:i,node:w,activatorNode:x,data:S}),()=>{const e=p.get(t);e&&e.key===i&&p.delete(t)})),[p,t]);return{active:u,activatorEvent:c,activeNodeRect:d,attributes:s((()=>({role:g,tabIndex:y,"aria-disabled":r,"aria-pressed":!(!m||g!==to)||void 0,"aria-roledescription":v,"aria-describedby":f.draggable})),[r,g,y,m,v,f.draggable]),isDragging:m,listeners:r?void 0:E,node:w,over:h,setNodeRef:k,setActivatorNodeRef:O,transform:b}}const oo="Droppable",io={timeout:25};function lo(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function ao(e,t){return e.reduce(((e,n,r)=>{const o=t.get(n);return o&&(e[r]=o),e}),Array(e.length))}function so(e){return null!==e&&e>=0}const co=e=>{let{rects:t,activeIndex:n,overIndex:r,index:o}=e;const i=lo(t,r,n),l=t[o],a=i[o];return a&&l?{x:a.left-l.left,y:a.top-l.top,scaleX:a.width/l.width,scaleY:a.height/l.height}:null},uo={scaleX:1,scaleY:1},fo=e=>{var t;let{activeIndex:n,activeNodeRect:r,index:o,rects:i,overIndex:l}=e;const a=null!=(t=i[n])?t:r;if(!a)return null;if(o===n){const e=i[l];return e?{x:0,y:n<l?e.top+e.height-(a.top+a.height):e.top-a.top,...uo}:null}const s=function(e,t,n){const r=e[t],o=e[t-1],i=e[t+1];if(!r)return 0;if(n<t)return o?r.top-(o.top+o.height):i?i.top-(r.top+r.height):0;return i?i.top-(r.top+r.height):o?r.top-(o.top+o.height):0}(i,o,n);return o>n&&o<=l?{x:0,y:-a.height-s,...uo}:o<n&&o>=l?{x:0,y:a.height+s,...uo}:{x:0,y:0,...uo}};const po="Sortable",ho=o.createContext({activeIndex:-1,containerId:po,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:co,disabled:{draggable:!1,droppable:!1}});function go(e){let{children:t,id:n,items:r,strategy:i=co,disabled:c=!1}=e;const{active:d,dragOverlay:f,droppableRects:p,over:h,measureDroppableContainers:g}=l(qr),v=fn(po,n),y=Boolean(null!==f.rect),m=s((()=>r.map((e=>"object"==typeof e&&"id"in e?e.id:e))),[r]),b=null!=d,w=d?m.indexOf(d.id):-1,k=h?m.indexOf(h.id):-1,x=a(m),O=!function(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}(m,x.current),E=-1!==k&&-1===w||O,S=function(e){return"boolean"==typeof e?{draggable:e,droppable:e}:e}(c);on((()=>{O&&b&&g(m)}),[O,m,b,g]),u((()=>{x.current=m}),[m]);const _=s((()=>({activeIndex:w,containerId:v,disabled:S,disableTransforms:E,items:m,overIndex:k,useDragOverlay:y,sortedRects:ao(m,p),strategy:i})),[w,v,S.draggable,S.droppable,E,m,k,p,y,i]);return o.createElement(ho.Provider,{value:_},t)}const vo=e=>{let{id:t,items:n,activeIndex:r,overIndex:o}=e;return lo(n,r,o).indexOf(t)},yo=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:o,items:i,newIndex:l,previousItems:a,previousContainerId:s,transition:c}=e;return!(!c||!r)&&((a===i||o!==l)&&(!!n||l!==o&&t===s))},mo={duration:200,easing:"ease"},bo="transform",wo=mn.Transition.toString({property:bo,duration:0,easing:"linear"}),ko={roleDescription:"sortable"};function xo(e){let{animateLayoutChanges:t=yo,attributes:n,disabled:r,data:o,getNewIndex:i=vo,id:c,strategy:p,resizeObserverConfig:h,transition:g=mo}=e;const{items:v,containerId:y,activeIndex:m,disabled:b,disableTransforms:w,sortedRects:k,overIndex:x,useDragOverlay:O,strategy:E}=l(ho),S=function(e,t){var n,r;if("boolean"==typeof e)return{draggable:e,droppable:!1};return{draggable:null!=(n=null==e?void 0:e.draggable)?n:t.draggable,droppable:null!=(r=null==e?void 0:e.droppable)?r:t.droppable}}(r,b),_=v.indexOf(c),C=s((()=>({sortable:{containerId:y,index:_,items:v},...o})),[y,o,_,v]),j=s((()=>v.slice(v.indexOf(c))),[v,c]),{rect:D,node:A,isOver:P,setNodeRef:R}=function(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:o}=e;const i=fn(oo),{active:s,dispatch:c,over:f,measureDroppableContainers:p}=l(Wr),h=a({disabled:n}),g=a(!1),v=a(null),y=a(null),{disabled:m,updateMeasurementsFor:b,timeout:w}={...io,...o},k=an(null!=b?b:r),x=Br({callback:d((()=>{g.current?(null!=y.current&&clearTimeout(y.current),y.current=setTimeout((()=>{p(Array.isArray(k.current)?k.current:[k.current]),y.current=null}),w)):g.current=!0}),[w]),disabled:m||!s}),O=d(((e,t)=>{x&&(t&&(x.unobserve(t),g.current=!1),e&&x.observe(e))}),[x]),[E,S]=cn(O),_=an(t);return u((()=>{x&&E.current&&(x.disconnect(),g.current=!1,x.observe(E.current))}),[E,x]),on((()=>(c({type:jn.RegisterDroppable,element:{id:r,key:i,disabled:n,node:E,rect:v,data:_}}),()=>c({type:jn.UnregisterDroppable,key:i,id:r}))),[r]),u((()=>{n!==h.current.disabled&&(c({type:jn.SetDroppableDisabled,id:r,key:i,disabled:n}),h.current.disabled=n)}),[r,i,n,c]),{active:s,rect:v,isOver:(null==f?void 0:f.id)===r,node:E,over:f,setNodeRef:S}}({id:c,data:C,disabled:S.droppable,resizeObserverConfig:{updateMeasurementsFor:j,...h}}),{active:B,activatorEvent:T,activeNodeRect:M,attributes:N,setNodeRef:L,listeners:I,isDragging:F,over:z,setActivatorNodeRef:$,transform:H}=ro({id:c,data:C,attributes:{...ko,...n},disabled:S.draggable}),V=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return s((()=>e=>{t.forEach((t=>t(e)))}),t)}(R,L),U=Boolean(B),K=U&&!w&&so(m)&&so(x),W=!O&&F,q=W&&K?H:null,Y=K?null!=q?q:(null!=p?p:E)({rects:k,activeNodeRect:M,activeIndex:m,overIndex:x,index:_}):null,X=so(m)&&so(x)?i({id:c,items:v,activeIndex:m,overIndex:x}):_,Z=null==B?void 0:B.id,J=a({activeId:Z,items:v,newIndex:X,containerId:y}),G=v!==J.current.items,Q=t({active:B,containerId:y,isDragging:F,isSorting:U,id:c,index:_,items:v,newIndex:J.current.newIndex,previousItems:J.current.items,previousContainerId:J.current.containerId,transition:g,wasDragging:null!=J.current.activeId}),ee=function(e){let{disabled:t,index:n,node:r,rect:o}=e;const[i,l]=f(null),s=a(n);return on((()=>{if(!t&&n!==s.current&&r.current){const e=o.current;if(e){const t=Kn(r.current,{ignoreTransform:!0}),n={x:e.left-t.left,y:e.top-t.top,scaleX:e.width/t.width,scaleY:e.height/t.height};(n.x||n.y)&&l(n)}}n!==s.current&&(s.current=n)}),[t,n,r,o]),u((()=>{i&&l(null)}),[i]),i}({disabled:!Q,index:_,node:A,rect:D});return u((()=>{U&&J.current.newIndex!==X&&(J.current.newIndex=X),y!==J.current.containerId&&(J.current.containerId=y),v!==J.current.items&&(J.current.items=v)}),[U,X,y,v]),u((()=>{if(Z===J.current.activeId)return;if(Z&&!J.current.activeId)return void(J.current.activeId=Z);const e=setTimeout((()=>{J.current.activeId=Z}),50);return()=>clearTimeout(e)}),[Z]),{active:B,activeIndex:m,attributes:N,data:C,rect:D,index:_,newIndex:X,items:v,isOver:P,isSorting:U,isDragging:F,listeners:I,node:A,overIndex:x,over:z,setNodeRef:V,setActivatorNodeRef:$,setDroppableNodeRef:R,setDraggableNodeRef:L,transform:null!=ee?ee:Y,transition:function(){if(ee||G&&J.current.newIndex===_)return wo;if(W&&!vn(T)||!g)return;if(U||Q)return mn.Transition.toString({...g,property:bo});return}()}}function Oo(e){if(!e)return!1;const t=e.data.current;return!!(t&&"sortable"in t&&"object"==typeof t.sortable&&"containerId"in t.sortable&&"items"in t.sortable&&"index"in t.sortable)}const Eo=[dr.Down,dr.Right,dr.Up,dr.Left],So=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:o,droppableContainers:i,over:l,scrollableAncestors:a}}=t;if(Eo.includes(e.code)){if(e.preventDefault(),!n||!r)return;const t=[];i.getEnabled().forEach((n=>{if(!n||null!=n&&n.disabled)return;const i=o.get(n.id);if(i)switch(e.code){case dr.Down:r.top<i.top&&t.push(n);break;case dr.Up:r.top>i.top&&t.push(n);break;case dr.Left:r.left>i.left&&t.push(n);break;case dr.Right:r.left<i.left&&t.push(n)}}));const s=(e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=Mn(t),i=[];for(const e of r){const{id:t}=e,r=n.get(t);if(r){const n=Mn(r),l=o.reduce(((e,t,r)=>e+Rn(n[r],t)),0),a=Number((l/4).toFixed(4));i.push({id:t,data:{droppableContainer:e,value:a}})}}return i.sort(Bn)})({active:n,collisionRect:r,droppableRects:o,droppableContainers:t,pointerCoordinates:null});let c=Nn(s,"id");if(c===(null==l?void 0:l.id)&&s.length>1&&(c=s[1].id),null!=c){const e=i.get(n.id),t=i.get(c),l=t?o.get(t.id):null,s=null==t?void 0:t.node.current;if(s&&l&&e&&t){const n=qn(s).some(((e,t)=>a[t]!==e)),o=_o(e,t),i=function(e,t){if(!Oo(e)||!Oo(t))return!1;if(!_o(e,t))return!1;return e.data.current.sortable.index<t.data.current.sortable.index}(e,t),c=n||!o?{x:0,y:0}:{x:i?r.width-l.width:0,y:i?r.height-l.height:0},u={x:l.left,y:l.top};return c.x&&c.y?u:gn(u,c)}}}};function _o(e,t){return!(!Oo(e)||!Oo(t))&&e.data.current.sortable.containerId===t.data.current.sortable.containerId}const Co=i(void 0),jo=({children:r,tools:o})=>{const i=qt(),l=s((()=>o?Object.keys(o).reduce(((e,t)=>{var n;return Object.assign(Object.assign({},e),{[t]:null===(n=o[t])||void 0===n?void 0:n.render})}),{}):{}),[o]),a=s((()=>!o||i?null:Object.keys(o).map((t=>{var n,r,i;const l=null===(n=null==o?void 0:o[t])||void 0===n?void 0:n.tool,a=null===(r=null==o?void 0:o[t])||void 0===r?void 0:r.render,s=null===(i=null==o?void 0:o[t])||void 0===i?void 0:i.props;return l?e(l,Object.assign({render:a},s),t):null}))),[o]);return e(Co.Provider,Object.assign({value:l},{children:t(n,{children:[a,r]})}))},Do=()=>{const e=l(Co);if(void 0===e)throw new Error("useYooptaTools must be used within a ToolsProvider");return e};function Ao(e){return Bo(e)?(e.nodeName||"").toLowerCase():"#document"}function Po(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function Ro(e){var t;return null==(t=(Bo(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function Bo(e){return e instanceof Node||e instanceof Po(e).Node}function To(e){return e instanceof Element||e instanceof Po(e).Element}function Mo(e){return e instanceof HTMLElement||e instanceof Po(e).HTMLElement}function No(e){return"undefined"!=typeof ShadowRoot&&(e instanceof ShadowRoot||e instanceof Po(e).ShadowRoot)}function Lo(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=Ho(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function Io(e){return["table","td","th"].includes(Ao(e))}function Fo(e){const t=zo(),n=Ho(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 zo(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}function $o(e){return["html","body","#document"].includes(Ao(e))}function Ho(e){return Po(e).getComputedStyle(e)}function Vo(e){return To(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function Uo(e){if("html"===Ao(e))return e;const t=e.assignedSlot||e.parentNode||No(e)&&e.host||Ro(e);return No(t)?t.host:t}function Ko(e){const t=Uo(e);return $o(t)?e.ownerDocument?e.ownerDocument.body:e.body:Mo(t)&&Lo(t)?t:Ko(t)}function Wo(e,t,n){var r;void 0===t&&(t=[]),void 0===n&&(n=!0);const o=Ko(e),i=o===(null==(r=e.ownerDocument)?void 0:r.body),l=Po(o);return i?t.concat(l,l.visualViewport||[],Lo(o)?o:[],l.frameElement&&n?Wo(l.frameElement):[]):t.concat(o,Wo(o,[],n))}const qo=Math.min,Yo=Math.max,Xo=Math.round,Zo=Math.floor,Jo=e=>({x:e,y:e}),Go={left:"right",right:"left",bottom:"top",top:"bottom"},Qo={start:"end",end:"start"};function ei(e,t,n){return Yo(e,qo(t,n))}function ti(e,t){return"function"==typeof e?e(t):e}function ni(e){return e.split("-")[0]}function ri(e){return e.split("-")[1]}function oi(e){return"x"===e?"y":"x"}function ii(e){return"y"===e?"height":"width"}function li(e){return["top","bottom"].includes(ni(e))?"y":"x"}function ai(e){return oi(li(e))}function si(e){return e.replace(/start|end/g,(e=>Qo[e]))}function ci(e){return e.replace(/left|right|bottom|top/g,(e=>Go[e]))}function ui(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 di(e){return{...e,top:e.y,left:e.x,right:e.x+e.width,bottom:e.y+e.height}}function fi(e,t,n){let{reference:r,floating:o}=e;const i=li(t),l=ai(t),a=ii(l),s=ni(t),c="y"===i,u=r.x+r.width/2-o.width/2,d=r.y+r.height/2-o.height/2,f=r[a]/2-o[a]/2;let p;switch(s){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:d};break;case"left":p={x:r.x-o.width,y:d};break;default:p={x:r.x,y:r.y}}switch(ri(t)){case"start":p[l]-=f*(n&&c?-1:1);break;case"end":p[l]+=f*(n&&c?-1:1)}return p}async function pi(e,t){var n;void 0===t&&(t={});const{x:r,y:o,platform:i,rects:l,elements:a,strategy:s}=e,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:d="floating",altBoundary:f=!1,padding:p=0}=ti(t,e),h=ui(p),g=a[f?"floating"===d?"reference":"floating":d],v=di(await i.getClippingRect({element:null==(n=await(null==i.isElement?void 0:i.isElement(g)))||n?g:g.contextElement||await(null==i.getDocumentElement?void 0:i.getDocumentElement(a.floating)),boundary:c,rootBoundary:u,strategy:s})),y="floating"===d?{...l.floating,x:r,y:o}:l.reference,m=await(null==i.getOffsetParent?void 0:i.getOffsetParent(a.floating)),b=await(null==i.isElement?void 0:i.isElement(m))&&await(null==i.getScale?void 0:i.getScale(m))||{x:1,y:1},w=di(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:y,offsetParent:m,strategy:s}):y);return{top:(v.top-w.top+h.top)/b.y,bottom:(w.bottom-v.bottom+h.bottom)/b.y,left:(v.left-w.left+h.left)/b.x,right:(w.right-v.right+h.right)/b.x}}function hi(e){const t=qo(...e.map((e=>e.left))),n=qo(...e.map((e=>e.top)));return{x:t,y:n,width:Yo(...e.map((e=>e.right)))-t,height:Yo(...e.map((e=>e.bottom)))-n}}const gi=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:i,placement:l,middlewareData:a}=t,s=await async function(e,t){const{placement:n,platform:r,elements:o}=e,i=await(null==r.isRTL?void 0:r.isRTL(o.floating)),l=ni(n),a=ri(n),s="y"===li(n),c=["left","top"].includes(l)?-1:1,u=i&&s?-1:1,d=ti(t,e);let{mainAxis:f,crossAxis:p,alignmentAxis:h}="number"==typeof d?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...d};return a&&"number"==typeof h&&(p="end"===a?-1*h:h),s?{x:p*u,y:f*c}:{x:f*c,y:p*u}}(t,e);return l===(null==(n=a.offset)?void 0:n.placement)&&null!=(r=a.arrow)&&r.alignmentOffset?{}:{x:o+s.x,y:i+s.y,data:{...s,placement:l}}}}};function vi(e){const t=Ho(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=Mo(e),i=o?e.offsetWidth:n,l=o?e.offsetHeight:r,a=Xo(n)!==i||Xo(r)!==l;return a&&(n=i,r=l),{width:n,height:r,$:a}}function yi(e){return To(e)?e:e.contextElement}function mi(e){const t=yi(e);if(!Mo(t))return Jo(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=vi(t);let l=(i?Xo(n.width):n.width)/r,a=(i?Xo(n.height):n.height)/o;return l&&Number.isFinite(l)||(l=1),a&&Number.isFinite(a)||(a=1),{x:l,y:a}}const bi=Jo(0);function wi(e){const t=Po(e);return zo()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:bi}function ki(e,t,n,r){void 0===t&&(t=!1),void 0===n&&(n=!1);const o=e.getBoundingClientRect(),i=yi(e);let l=Jo(1);t&&(r?To(r)&&(l=mi(r)):l=mi(e));const a=function(e,t,n){return void 0===t&&(t=!1),!(!n||t&&n!==Po(e))&&t}(i,n,r)?wi(i):Jo(0);let s=(o.left+a.x)/l.x,c=(o.top+a.y)/l.y,u=o.width/l.x,d=o.height/l.y;if(i){const e=Po(i),t=r&&To(r)?Po(r):r;let n=e,o=n.frameElement;for(;o&&r&&t!==n;){const e=mi(o),t=o.getBoundingClientRect(),r=Ho(o),i=t.left+(o.clientLeft+parseFloat(r.paddingLeft))*e.x,l=t.top+(o.clientTop+parseFloat(r.paddingTop))*e.y;s*=e.x,c*=e.y,u*=e.x,d*=e.y,s+=i,c+=l,n=Po(o),o=n.frameElement}}return di({width:u,height:d,x:s,y:c})}const xi=[":popover-open",":modal"];function Oi(e){return xi.some((t=>{try{return e.matches(t)}catch(e){return!1}}))}function Ei(e){return ki(Ro(e)).left+Vo(e).scrollLeft}function Si(e,t,n){let r;if("viewport"===t)r=function(e,t){const n=Po(e),r=Ro(e),o=n.visualViewport;let i=r.clientWidth,l=r.clientHeight,a=0,s=0;if(o){i=o.width,l=o.height;const e=zo();(!e||e&&"fixed"===t)&&(a=o.offsetLeft,s=o.offsetTop)}return{width:i,height:l,x:a,y:s}}(e,n);else if("document"===t)r=function(e){const t=Ro(e),n=Vo(e),r=e.ownerDocument.body,o=Yo(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=Yo(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let l=-n.scrollLeft+Ei(e);const a=-n.scrollTop;return"rtl"===Ho(r).direction&&(l+=Yo(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:l,y:a}}(Ro(e));else if(To(t))r=function(e,t){const n=ki(e,!0,"fixed"===t),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=Mo(e)?mi(e):Jo(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=wi(e);r={...t,x:t.x-n.x,y:t.y-n.y}}return di(r)}function _i(e,t){const n=Uo(e);return!(n===t||!To(n)||$o(n))&&("fixed"===Ho(n).position||_i(n,t))}function Ci(e,t,n){const r=Mo(t),o=Ro(t),i="fixed"===n,l=ki(e,!0,i,t);let a={scrollLeft:0,scrollTop:0};const s=Jo(0);if(r||!r&&!i)if(("body"!==Ao(t)||Lo(o))&&(a=Vo(t)),r){const e=ki(t,!0,i,t);s.x=e.x+t.clientLeft,s.y=e.y+t.clientTop}else o&&(s.x=Ei(o));return{x:l.left+a.scrollLeft-s.x,y:l.top+a.scrollTop-s.y,width:l.width,height:l.height}}function ji(e,t){return Mo(e)&&"fixed"!==Ho(e).position?t?t(e):e.offsetParent:null}function Di(e,t){const n=Po(e);if(!Mo(e)||Oi(e))return n;let r=ji(e,t);for(;r&&Io(r)&&"static"===Ho(r).position;)r=ji(r,t);return r&&("html"===Ao(r)||"body"===Ao(r)&&"static"===Ho(r).position&&!Fo(r))?n:r||function(e){let t=Uo(e);for(;Mo(t)&&!$o(t);){if(Fo(t))return t;t=Uo(t)}return null}(e)||n}const Ai={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i="fixed"===o,l=Ro(r),a=!!t&&Oi(t.floating);if(r===l||a&&i)return n;let s={scrollLeft:0,scrollTop:0},c=Jo(1);const u=Jo(0),d=Mo(r);if((d||!d&&!i)&&(("body"!==Ao(r)||Lo(l))&&(s=Vo(r)),Mo(r))){const e=ki(r);c=mi(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-s.scrollLeft*c.x+u.x,y:n.y*c.y-s.scrollTop*c.y+u.y}},getDocumentElement:Ro,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=Wo(e,[],!1).filter((e=>To(e)&&"body"!==Ao(e))),o=null;const i="fixed"===Ho(e).position;let l=i?Uo(e):e;for(;To(l)&&!$o(l);){const t=Ho(l),n=Fo(l);n||"fixed"!==t.position||(o=null),(i?!n&&!o:!n&&"static"===t.position&&o&&["absolute","fixed"].includes(o.position)||Lo(l)&&!n&&_i(e,l))?r=r.filter((e=>e!==l)):o=t,l=Uo(l)}return t.set(e,r),r}(t,this._c):[].concat(n),r],l=i[0],a=i.reduce(((e,n)=>{const r=Si(t,n,o);return e.top=Yo(r.top,e.top),e.right=qo(r.right,e.right),e.bottom=qo(r.bottom,e.bottom),e.left=Yo(r.left,e.left),e}),Si(t,l,o));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}},getOffsetParent:Di,getElementRects:async function(e){const t=this.getOffsetParent||Di,n=this.getDimensions;return{reference:Ci(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}=vi(e);return{width:t,height:n}},getScale:mi,isElement:To,isRTL:function(e){return"rtl"===Ho(e).direction}};function Pi(e,t,n,r){void 0===r&&(r={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:l="function"==typeof ResizeObserver,layoutShift:a="function"==typeof IntersectionObserver,animationFrame:s=!1}=r,c=yi(e),u=o||i?[...c?Wo(c):[],...Wo(t)]:[];u.forEach((e=>{o&&e.addEventListener("scroll",n,{passive:!0}),i&&e.addEventListener("resize",n)}));const d=c&&a?function(e,t){let n,r=null;const o=Ro(e);function i(){var e;clearTimeout(n),null==(e=r)||e.disconnect(),r=null}return function l(a,s){void 0===a&&(a=!1),void 0===s&&(s=1),i();const{left:c,top:u,width:d,height:f}=e.getBoundingClientRect();if(a||t(),!d||!f)return;const p={rootMargin:-Zo(u)+"px "+-Zo(o.clientWidth-(c+d))+"px "+-Zo(o.clientHeight-(u+f))+"px "+-Zo(c)+"px",threshold:Yo(0,qo(1,s))||1};let h=!0;function g(e){const t=e[0].intersectionRatio;if(t!==s){if(!h)return l();t?l(!1,t):n=setTimeout((()=>{l(!1,1e-7)}),100)}h=!1}try{r=new IntersectionObserver(g,{...p,root:o.ownerDocument})}catch(e){r=new IntersectionObserver(g,p)}r.observe(e)}(!0),i}(c,n):null;let f,p=-1,h=null;l&&(h=new ResizeObserver((e=>{let[r]=e;r&&r.target===c&&h&&(h.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame((()=>{var e;null==(e=h)||e.observe(t)}))),n()})),c&&!s&&h.observe(c),h.observe(t));let g=s?ki(e):null;return s&&function t(){const r=ki(e);!g||r.x===g.x&&r.y===g.y&&r.width===g.width&&r.height===g.height||n();g=r,f=requestAnimationFrame(t)}(),n(),()=>{var e;u.forEach((e=>{o&&e.removeEventListener("scroll",n),i&&e.removeEventListener("resize",n)})),null==d||d(),null==(e=h)||e.disconnect(),h=null,s&&cancelAnimationFrame(f)}}const Ri=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:l=!1,limiter:a={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...s}=ti(e,t),c={x:n,y:r},u=await pi(t,s),d=li(ni(o)),f=oi(d);let p=c[f],h=c[d];if(i){const e="y"===f?"bottom":"right";p=ei(p+u["y"===f?"top":"left"],p,p-u[e])}if(l){const e="y"===d?"bottom":"right";h=ei(h+u["y"===d?"top":"left"],h,h-u[e])}const g=a.fn({...t,[f]:p,[d]:h});return{...g,data:{x:g.x-n,y:g.y-r}}}}},Bi=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:i,rects:l,initialPlacement:a,platform:s,elements:c}=t,{mainAxis:u=!0,crossAxis:d=!0,fallbackPlacements:f,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:h="none",flipAlignment:g=!0,...v}=ti(e,t);if(null!=(n=i.arrow)&&n.alignmentOffset)return{};const y=ni(o),m=ni(a)===a,b=await(null==s.isRTL?void 0:s.isRTL(c.floating)),w=f||(m||!g?[ci(a)]:function(e){const t=ci(e);return[si(e),t,si(t)]}(a));f||"none"===h||w.push(...function(e,t,n,r){const o=ri(e);let i=function(e,t,n){const r=["left","right"],o=["right","left"],i=["top","bottom"],l=["bottom","top"];switch(e){case"top":case"bottom":return n?t?o:r:t?r:o;case"left":case"right":return t?i:l;default:return[]}}(ni(e),"start"===n,r);return o&&(i=i.map((e=>e+"-"+o)),t&&(i=i.concat(i.map(si)))),i}(a,g,h,b));const k=[a,...w],x=await pi(t,v),O=[];let E=(null==(r=i.flip)?void 0:r.overflows)||[];if(u&&O.push(x[y]),d){const e=function(e,t,n){void 0===n&&(n=!1);const r=ri(e),o=ai(e),i=ii(o);let l="x"===o?r===(n?"end":"start")?"right":"left":"start"===r?"bottom":"top";return t.reference[i]>t.floating[i]&&(l=ci(l)),[l,ci(l)]}(o,l,b);O.push(x[e[0]],x[e[1]])}if(E=[...E,{placement:o,overflows:O}],!O.every((e=>e<=0))){var S,_;const e=((null==(S=i.flip)?void 0:S.index)||0)+1,t=k[e];if(t)return{data:{index:e,overflows:E},reset:{placement:t}};let n=null==(_=E.filter((e=>e.overflows[0]<=0)).sort(((e,t)=>e.overflows[1]-t.overflows[1]))[0])?void 0:_.placement;if(!n)switch(p){case"bestFit":{var C;const e=null==(C=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:C[0];e&&(n=e);break}case"initialPlacement":n=a}if(o!==n)return{reset:{placement:n}}}return{}}}},Ti=function(e){return void 0===e&&(e={}),{name:"inline",options:e,async fn(t){const{placement:n,elements:r,rects:o,platform:i,strategy:l}=t,{padding:a=2,x:s,y:c}=ti(e,t),u=Array.from(await(null==i.getClientRects?void 0:i.getClientRects(r.reference))||[]),d=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=>di(hi(e))))}(u),f=di(hi(u)),p=ui(a);const h=await i.getElementRects({reference:{getBoundingClientRect:function(){if(2===d.length&&d[0].left>d[1].right&&null!=s&&null!=c)return d.find((e=>s>e.left-p.left&&s<e.right+p.right&&c>e.top-p.top&&c<e.bottom+p.bottom))||f;if(d.length>=2){if("y"===li(n)){const e=d[0],t=d[d.length-1],r="top"===ni(n),o=e.top,i=t.bottom,l=r?e.left:t.left,a=r?e.right:t.right;return{top:o,bottom:i,left:l,right:a,width:a-l,height:i-o,x:l,y:o}}const e="left"===ni(n),t=Yo(...d.map((e=>e.right))),r=qo(...d.map((e=>e.left))),o=d.filter((n=>e?n.left===r:n.right===t)),i=o[0].top,l=o[o.length-1].bottom;return{top:i,bottom:l,left:r,right:t,width:t-r,height:l-i,x:r,y:i}}return f}},floating:r.floating,strategy:l});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}}:{}}}},Mi=(e,t,n)=>{const r=new Map,o={platform:Ai,...n},i={...o.platform,_c:r};return(async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:l}=n,a=i.filter(Boolean),s=await(null==l.isRTL?void 0:l.isRTL(t));let c=await l.getElementRects({reference:e,floating:t,strategy:o}),{x:u,y:d}=fi(c,r,s),f=r,p={},h=0;for(let n=0;n<a.length;n++){const{name:i,fn:g}=a[n],{x:v,y:y,data:m,reset:b}=await g({x:u,y:d,initialPlacement:r,placement:f,strategy:o,middlewareData:p,rects:c,platform:l,elements:{reference:e,floating:t}});u=null!=v?v:u,d=null!=y?y:d,p={...p,[i]:{...p[i],...m}},b&&h<=50&&(h++,"object"==typeof b&&(b.placement&&(f=b.placement),b.rects&&(c=!0===b.rects?await l.getElementRects({reference:e,floating:t,strategy:o}):b.rects),({x:u,y:d}=fi(c,f,s))),n=-1)}return{x:u,y:d,placement:f,strategy:o,middlewareData:p}})(e,t,{...o,platform:i})};var Ni="undefined"!=typeof document?c:u;function Li(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(!Li(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)&&!Li(e[n],t[n]))return!1}return!0}return e!=e&&t!=t}function Ii(e){if("undefined"==typeof window)return 1;return(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Fi(e,t){const n=Ii(e);return Math.round(t*n)/n}function zi(e){const t=r.useRef(e);return Ni((()=>{t.current=e})),t}
|
|
1
|
+
import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import*as r from"react";import o,{createContext as i,useContext as l,useRef as a,useMemo as s,useLayoutEffect as c,useEffect as u,useCallback as d,useState as f,memo as p,useReducer as h,forwardRef as g,createElement as v}from"react";import{Editor as y,Element as m,Text as b,Transforms as w,Point as k,Path as x,Node as O,Range as E,createEditor as S,Operation as _}from"slate";import{ReactEditor as C,withReact as j,useSelected as D,Slate as A,Editable as P,DefaultElement as R}from"slate-react";import*as B from"react-dom";import{unstable_batchedUpdates as T,createPortal as M}from"react-dom";class N{constructor(e){this.plugin=e}get getPlugin(){return this.plugin}extend(e){const{renders:t,options:n,elementProps:r,events:o}=e,i=Object.assign(Object.assign({},this.plugin.options),n),l=Object.assign({},this.plugin.elements);return t&&Object.keys(t).forEach((e=>{const n=l[e];if(n&&n.render){const r=t[e];let o=n.render;n.render=e=>o(Object.assign(Object.assign({},e),{extendRender:r}))}})),r&&Object.keys(r).forEach((e=>{const t=l[e];if(t){const n=r[e],o=t.props;n&&o&&(t.props=n(o))}})),o&&Object.keys(o).forEach((e=>{const t=o[e];t&&(this.plugin.events||(this.plugin.events={}),this.plugin.events[e]=t)})),new N(Object.assign(Object.assign({},this.plugin),{elements:l,options:i}))}}function L(){let e=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};return e()+e()+"-"+e()+"-"+e()+"-"+e()+"-"+e()+e()+e()}const I=()=>{var e,t;return"undefined"==typeof window||"function"!=typeof(null===(e=window.crypto)||void 0===e?void 0:e.randomUUID)?L():null===(t=window.crypto)||void 0===t?void 0:t.randomUUID()},F=e=>({id:I(),type:(null==e?void 0:e.type)||"paragraph",children:(null==e?void 0:e.children)||[{text:""}],props:Object.assign({nodeType:"block"},null==e?void 0:e.props)}),z=e=>({id:(null==e?void 0:e.id)||I(),value:(null==e?void 0:e.value)||[F()],type:(null==e?void 0:e.type)||"Paragraph",meta:Object.assign({order:0,depth:0},null==e?void 0:e.meta)});function $(e){if(!e)return;const t=Object.keys(e);return 1===t.length?t[0]:t.find((t=>e[t].asRoot))}function H(e){if(!e)return;const t=$(e);return t?e[t]:void 0}function V(e,t={nodeType:"block"}){return{id:I(),type:e,children:[{text:""}],props:t}}function U(e,t,n){var r;return(null===(r=e.children)||void 0===r?void 0:r.map((e=>{const r=t[e];if(!r)throw new Error(`Element definition for ${e} not found`);return F({id:I(),type:e,props:r.props,children:r.children&&r.children.length>0?U(r,t,n):[{text:(null==n?void 0:n[e])||""}]})})))||[]}function K(e,t,n){const r=e.blocks[t].elements,o=$(r);if(!o)throw new Error(`Root element type not found for block type ${t}`);const i=r[o];return{id:I(),type:o,props:i.props,children:i.children&&i.children.length>0?U(i,r,n):[{text:""}]}}function W(e,t,n={}){var r,o;const{at:i=e.path.current,focus:l=!1,blockData:a}=n,s=e.plugins[t],{onBeforeCreate:c,onCreate:u}=s.events||{};let d;d=a&&Array.isArray(null==a?void 0:a.value)?a.value[0]:(null==c?void 0:c(e))||K(e,t);const f={id:(null==a?void 0:a.id)||I(),type:t,value:[d],meta:{align:(null===(r=null==a?void 0:a.meta)||void 0===r?void 0:r.align)||"left",depth:(null===(o=null==a?void 0:a.meta)||void 0===o?void 0:o.depth)||0,order:"number"==typeof i?i:Object.keys(e.children).length}},p=[];return p.push({type:"insert_block",path:{current:f.meta.order},block:f}),e.applyTransforms(p),null==u||u(e,f.id),l&&e.focusBlock(f.id),f.id}function q(e){const t=e.path.current;return"number"==typeof t&&0!==t?t-1:null}function Y(e,t){e.applyTransforms([{type:"set_block_path",path:t}],{validatePaths:!1})}function X(e){try{let t;const[n,r]=y.last(e,[]);if(m.isElement(n)&&!y.isEditor(n)){const[n,o]=y.last(e,r);b.isText(n)&&(t={path:o,offset:n.text.length})}else b.isText(n)&&(t={path:r,offset:n.text.length});return t}catch(e){return{path:[0,0],offset:0}}}const Z={getPath:function(e){return e.path.current},getNextPath:function(e){const t=e.path.current;return"number"==typeof t?t+1:null},getPreviousPath:q,isBlockSelected:function(e,t){const n=e.path.selected;return!!Array.isArray(n)&&n.includes(t.meta.order)},getSelectedPaths:function(e){return e.path.selected},isPathEmpty:function(e){return null===e.path.current},setPath:Y,getLastNodePoint:X};function J(e,t){if(!(null==t?void 0:t.id)&&"number"!=typeof(null==t?void 0:t.at))throw new Error("getBlockSlate requires either an id or at");const n=(null==t?void 0:t.id)||Object.keys(e.children).find((n=>e.children[n].meta.order===(null==t?void 0:t.at))),r=e.blockEditorsMap[n||""],o=e.children[n||""],i=e.blocks[(null==o?void 0:o.type)||""];if(!(null==i?void 0:i.hasCustomEditor)&&!r)throw new Error(`Slate not found with params: ${JSON.stringify(t)}`);return r}function G(e,t){const{focus:n,blockId:r,at:o}=t;if(!r&&"number"!=typeof o)throw new Error("blockId or path should be provided");const i=e.getBlock({id:r,at:o});if(!i)throw new Error("Block not found");const l=Z.getPreviousPath(e),a=null!==l?e.getBlock({at:l}):void 0,s=a?J(e,{id:null==a?void 0:a.id}):void 0,c=e.children[i.id],u=[],d=e.plugins[c.type],{onDestroy:f}=d.events||{};if(null==f||f(e,c.id),u.push({type:"delete_block",block:c,path:e.path}),e.applyTransforms(u,{validatePaths:!1}),n&&s&&a){const t=Z.getLastNodePoint(s);e.focusBlock(a.id,{focusAt:t})}}function Q(e,t,n){const r=n,o=e.children[t],i=Object.values(e.children).find((e=>e.meta.order===r));if(!o||!i)return void console.warn("Invalid block ids for move operation");const l=[],a={type:"move_block",prevProperties:{id:t,order:o.meta.order},properties:{id:t,order:r}};l.push(a),e.applyTransforms(l),e.setPath({current:r})}const ee=new WeakMap;function te(e,t,n={}){const{focusAt:r,waitExecution:o=!0,waitExecutionMs:i=0,shouldUpdateBlockPath:l=!0}=n,a=()=>{const o=n.slate||e.blockEditorsMap[t],i=e.children[t];if(!o||!i)return;if(!e.blocks[i.type].hasCustomEditor)try{const e=function(e,t){if(k.isPoint(t))return t;if(x.isPath(t))return{path:t,offset:0};const[,n]=y.first(e,[0]);return{path:n||[0,0],offset:0}}(o,r);w.select(o,e),C.focus(o)}catch(e){}l&&setTimeout((()=>{e.setPath({current:i.meta.order})}),0)};o?setTimeout((()=>a()),i):a(),ee.set(e,!0)}function ne(e,t){const n=Object.keys(e.children),{at:r=e.path.current}=t||{},o=n.find((t=>e.children[t].meta.order===r));return o?e.children[o]:null}function re(e,t){const n=Object.keys(e.children),{at:r=e.path.current}=t||{},o=n.find((t=>e.children[t].meta.order===r));if(o)return e.blockEditorsMap[o]}var oe="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function ie(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var le={};!function(e,t){var n="__lodash_hash_undefined__",r=9007199254740991,o="[object Arguments]",i="[object Boolean]",l="[object Date]",a="[object Function]",s="[object GeneratorFunction]",c="[object Map]",u="[object Number]",d="[object Object]",f="[object Promise]",p="[object RegExp]",h="[object Set]",g="[object String]",v="[object Symbol]",y="[object WeakMap]",m="[object ArrayBuffer]",b="[object DataView]",w="[object Float32Array]",k="[object Float64Array]",x="[object Int8Array]",O="[object Int16Array]",E="[object Int32Array]",S="[object Uint8Array]",_="[object Uint8ClampedArray]",C="[object Uint16Array]",j="[object Uint32Array]",D=/\w*$/,A=/^\[object .+?Constructor\]$/,P=/^(?:0|[1-9]\d*)$/,R={};R[o]=R["[object Array]"]=R[m]=R[b]=R[i]=R[l]=R[w]=R[k]=R[x]=R[O]=R[E]=R[c]=R[u]=R[d]=R[p]=R[h]=R[g]=R[v]=R[S]=R[_]=R[C]=R[j]=!0,R["[object Error]"]=R[a]=R[y]=!1;var B="object"==typeof oe&&oe&&oe.Object===Object&&oe,T="object"==typeof self&&self&&self.Object===Object&&self,M=B||T||Function("return this")(),N=t&&!t.nodeType&&t,L=N&&e&&!e.nodeType&&e,I=L&&L.exports===N;function F(e,t){return e.set(t[0],t[1]),e}function z(e,t){return e.add(t),e}function $(e,t,n,r){var o=-1,i=e?e.length:0;for(r&&i&&(n=e[++o]);++o<i;)n=t(n,e[o],o,e);return n}function H(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(e){}return t}function V(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function U(e,t){return function(n){return e(t(n))}}function K(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=e})),n}var W,q=Array.prototype,Y=Function.prototype,X=Object.prototype,Z=M["__core-js_shared__"],J=(W=/[^.]+$/.exec(Z&&Z.keys&&Z.keys.IE_PROTO||""))?"Symbol(src)_1."+W:"",G=Y.toString,Q=X.hasOwnProperty,ee=X.toString,te=RegExp("^"+G.call(Q).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ne=I?M.Buffer:void 0,re=M.Symbol,ie=M.Uint8Array,le=U(Object.getPrototypeOf,Object),ae=Object.create,se=X.propertyIsEnumerable,ce=q.splice,ue=Object.getOwnPropertySymbols,de=ne?ne.isBuffer:void 0,fe=U(Object.keys,Object),pe=Ie(M,"DataView"),he=Ie(M,"Map"),ge=Ie(M,"Promise"),ve=Ie(M,"Set"),ye=Ie(M,"WeakMap"),me=Ie(Object,"create"),be=Ve(pe),we=Ve(he),ke=Ve(ge),xe=Ve(ve),Oe=Ve(ye),Ee=re?re.prototype:void 0,Se=Ee?Ee.valueOf:void 0;function _e(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Ce(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function je(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function De(e){this.__data__=new Ce(e)}function Ae(e,t){var n=Ke(e)||function(e){return function(e){return function(e){return!!e&&"object"==typeof e}(e)&&We(e)}(e)&&Q.call(e,"callee")&&(!se.call(e,"callee")||ee.call(e)==o)}(e)?function(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}(e.length,String):[],r=n.length,i=!!r;for(var l in e)!t&&!Q.call(e,l)||i&&("length"==l||$e(l,r))||n.push(l);return n}function Pe(e,t,n){var r=e[t];Q.call(e,t)&&Ue(r,n)&&(void 0!==n||t in e)||(e[t]=n)}function Re(e,t){for(var n=e.length;n--;)if(Ue(e[n][0],t))return n;return-1}function Be(e,t,n,r,f,y,A){var P;if(r&&(P=y?r(e,f,y,A):r(e)),void 0!==P)return P;if(!Xe(e))return e;var B=Ke(e);if(B){if(P=function(e){var t=e.length,n=e.constructor(t);t&&"string"==typeof e[0]&&Q.call(e,"index")&&(n.index=e.index,n.input=e.input);return n}(e),!t)return function(e,t){var n=-1,r=e.length;t||(t=Array(r));for(;++n<r;)t[n]=e[n];return t}(e,P)}else{var T=ze(e),M=T==a||T==s;if(qe(e))return function(e,t){if(t)return e.slice();var n=new e.constructor(e.length);return e.copy(n),n}(e,t);if(T==d||T==o||M&&!y){if(H(e))return y?e:{};if(P=function(e){return"function"!=typeof e.constructor||He(e)?{}:(t=le(e),Xe(t)?ae(t):{});var t}(M?{}:e),!t)return function(e,t){return Ne(e,Fe(e),t)}(e,function(e,t){return e&&Ne(t,Ze(t),e)}(P,e))}else{if(!R[T])return y?e:{};P=function(e,t,n,r){var o=e.constructor;switch(t){case m:return Me(e);case i:case l:return new o(+e);case b:return function(e,t){var n=t?Me(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,r);case w:case k:case x:case O:case E:case S:case _:case C:case j:return function(e,t){var n=t?Me(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}(e,r);case c:return function(e,t,n){var r=t?n(V(e),!0):V(e);return $(r,F,new e.constructor)}(e,r,n);case u:case g:return new o(e);case p:return function(e){var t=new e.constructor(e.source,D.exec(e));return t.lastIndex=e.lastIndex,t}(e);case h:return function(e,t,n){var r=t?n(K(e),!0):K(e);return $(r,z,new e.constructor)}(e,r,n);case v:return a=e,Se?Object(Se.call(a)):{}}var a}(e,T,Be,t)}}A||(A=new De);var N=A.get(e);if(N)return N;if(A.set(e,P),!B)var L=n?function(e){return function(e,t,n){var r=t(e);return Ke(e)?r:function(e,t){for(var n=-1,r=t.length,o=e.length;++n<r;)e[o+n]=t[n];return e}(r,n(e))}(e,Ze,Fe)}(e):Ze(e);return function(e,t){for(var n=-1,r=e?e.length:0;++n<r&&!1!==t(e[n],n,e););}(L||e,(function(o,i){L&&(o=e[i=o]),Pe(P,i,Be(o,t,n,r,i,e,A))})),P}function Te(e){return!(!Xe(e)||(t=e,J&&J in t))&&(Ye(e)||H(e)?te:A).test(Ve(e));var t}function Me(e){var t=new e.constructor(e.byteLength);return new ie(t).set(new ie(e)),t}function Ne(e,t,n,r){n||(n={});for(var o=-1,i=t.length;++o<i;){var l=t[o],a=r?r(n[l],e[l],l,n,e):void 0;Pe(n,l,void 0===a?e[l]:a)}return n}function Le(e,t){var n,r,o=e.__data__;return("string"==(r=typeof(n=t))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?o["string"==typeof t?"string":"hash"]:o.map}function Ie(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return Te(n)?n:void 0}_e.prototype.clear=function(){this.__data__=me?me(null):{}},_e.prototype.delete=function(e){return this.has(e)&&delete this.__data__[e]},_e.prototype.get=function(e){var t=this.__data__;if(me){var r=t[e];return r===n?void 0:r}return Q.call(t,e)?t[e]:void 0},_e.prototype.has=function(e){var t=this.__data__;return me?void 0!==t[e]:Q.call(t,e)},_e.prototype.set=function(e,t){return this.__data__[e]=me&&void 0===t?n:t,this},Ce.prototype.clear=function(){this.__data__=[]},Ce.prototype.delete=function(e){var t=this.__data__,n=Re(t,e);return!(n<0)&&(n==t.length-1?t.pop():ce.call(t,n,1),!0)},Ce.prototype.get=function(e){var t=this.__data__,n=Re(t,e);return n<0?void 0:t[n][1]},Ce.prototype.has=function(e){return Re(this.__data__,e)>-1},Ce.prototype.set=function(e,t){var n=this.__data__,r=Re(n,e);return r<0?n.push([e,t]):n[r][1]=t,this},je.prototype.clear=function(){this.__data__={hash:new _e,map:new(he||Ce),string:new _e}},je.prototype.delete=function(e){return Le(this,e).delete(e)},je.prototype.get=function(e){return Le(this,e).get(e)},je.prototype.has=function(e){return Le(this,e).has(e)},je.prototype.set=function(e,t){return Le(this,e).set(e,t),this},De.prototype.clear=function(){this.__data__=new Ce},De.prototype.delete=function(e){return this.__data__.delete(e)},De.prototype.get=function(e){return this.__data__.get(e)},De.prototype.has=function(e){return this.__data__.has(e)},De.prototype.set=function(e,t){var n=this.__data__;if(n instanceof Ce){var r=n.__data__;if(!he||r.length<199)return r.push([e,t]),this;n=this.__data__=new je(r)}return n.set(e,t),this};var Fe=ue?U(ue,Object):function(){return[]},ze=function(e){return ee.call(e)};function $e(e,t){return!!(t=null==t?r:t)&&("number"==typeof e||P.test(e))&&e>-1&&e%1==0&&e<t}function He(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||X)}function Ve(e){if(null!=e){try{return G.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function Ue(e,t){return e===t||e!=e&&t!=t}(pe&&ze(new pe(new ArrayBuffer(1)))!=b||he&&ze(new he)!=c||ge&&ze(ge.resolve())!=f||ve&&ze(new ve)!=h||ye&&ze(new ye)!=y)&&(ze=function(e){var t=ee.call(e),n=t==d?e.constructor:void 0,r=n?Ve(n):void 0;if(r)switch(r){case be:return b;case we:return c;case ke:return f;case xe:return h;case Oe:return y}return t});var Ke=Array.isArray;function We(e){return null!=e&&function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=r}(e.length)&&!Ye(e)}var qe=de||function(){return!1};function Ye(e){var t=Xe(e)?ee.call(e):"";return t==a||t==s}function Xe(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function Ze(e){return We(e)?Ae(e):function(e){if(!He(e))return fe(e);var t=[];for(var n in Object(e))Q.call(e,n)&&"constructor"!=n&&t.push(n);return t}(e)}e.exports=function(e){return Be(e,!0,!0)}}({get exports(){return le},set exports(e){le=e}},le);var ae=le;function se(e){return ae(e)}function ce(e,t={}){const{focus:n=!0}=t,r=ne(e),o=t.slate||re(e);o&&r&&y.withoutNormalizing(o,(()=>{if(!o.selection)return;const t=se(o.children),i=[],[l,a]=function(e,t){const{path:n,offset:r}=t.focus,[,...o]=n,i=JSON.parse(JSON.stringify(e[0]));function l(e,t,n){if(0!==t.length){const[r,...o]=t,[i,a]=l(e.children[r],o,n),s=e.children.slice(0,r).concat(i?[i]:[]),c=(a?[a]:[]).concat(e.children.slice(r+1));return[Object.assign(Object.assign({},e),{children:s}),Object.assign(Object.assign({},e),{children:c})]}if(O.string(e).length<=n)return[e,null];if("text"in e)return[Object.assign(Object.assign({},e),{text:e.text.slice(0,n)}),Object.assign(Object.assign({},e),{text:e.text.slice(n)})];if("link"===e.type){const[t,r]=l(e.children[0],[],n);return[Object.assign(Object.assign({},e),{children:[t]}),Object.assign(Object.assign({},e),{children:[r]})]}}const[a,s]=l(i,o,r);function c(e){return"children"in e&&(e.children=e.children.filter((e=>""!==e.text&&void 0!==e.text||e.children&&e.children.length>0)),e.children.forEach(c)),e}return[c(a),c(s)].map((e=>[e])).filter((e=>e[0].children.length>0))}(o.children,o.selection),s={id:I(),type:r.type,meta:{order:r.meta.order+1,depth:r.meta.depth,align:r.meta.align},value:[]};i.push({type:"split_block",prevProperties:{originalBlock:r,originalValue:t},properties:{nextBlock:s,nextSlateValue:a||[V("paragraph")],splitSlateValue:l},path:e.path}),e.applyTransforms(i),n&&e.focusBlock(s.id)}))}function ue(e,t={}){const{at:n=e.path.current,blockId:r}=t,o=r?e.children[r]:ne(e,{at:n});if(!o)return;const i=o.meta.depth+1,l={type:"set_block_meta",id:o.id,properties:{depth:i},prevProperties:{depth:o.meta.depth}};e.applyTransforms([l])}function de(e,t={}){const{at:n=e.path.current,blockId:r}=t,o=r?e.children[r]:ne(e,{at:n});if(!o)return;const i=Math.max(0,o.meta.depth-1),l={type:"set_block_meta",id:o.id,properties:{depth:i},prevProperties:{depth:o.meta.depth}};e.applyTransforms([l])}function fe(e){return!!e&&("object"==typeof e&&!Array.isArray(e))}function pe(e,t){const{original:n,focus:r,at:o}=t;if(!n)throw new Error("`original` should be provided");if(!n.blockId&&"number"!=typeof n.path)throw new Error("blockId or path should be provided");const{blockId:i,path:l}=n;let a=i?e.children[i]:ne(e,{at:l});if(!a)throw new Error("Block not found");const s=[],c=se(a);return c.id=I(),c.meta.order=Array.isArray(o)&&"number"==typeof o?o:a.meta.order+1,s.push({type:"insert_block",path:{current:c.meta.order},block:c}),e.applyTransforms(s),r&&e.focusBlock(c.id,{waitExecution:!0}),c.id}function he(e,t,n){const r=e.children[t];if(!r)return void console.warn(`Block with id ${t} does not exist.`);const o={type:"set_block_meta",id:t,properties:{},prevProperties:{}},i={type:"set_block_value",id:t,value:[]};n.meta&&(o.prevProperties=r.meta,o.properties=Object.assign(Object.assign({},r.meta),n.meta)),n.value&&(i.value=n.value);const l=[];Object.keys(o.properties).length&&l.push(o),i.value.length&&l.push(i),l.length>0&&e.applyTransforms(l,{validatePaths:!1})}const ge="Paragraph";function ve(e,t,n,r){const o=r.plugins[n.type];return(null==o?void 0:o.customEditor)?n.value[0].children:y.isEditor(t)?t.children.flatMap((t=>ve(e,t,n,r))):m.isElement(t)?y.isInline(e,t)?[t]:t.children.flatMap((t=>ve(e,t,n,r))):[t]}function ye(e,t){return m.isElement(e)?0===e.children.length||b.isText(e.children[0])?t.deleteText?Object.assign(Object.assign({},e),{children:[{text:""}]}):e:ye(e.children[0],t):null}function me(e,t,n={}){const r=ne(e,{at:"number"==typeof n.at?n.at:e.path.current});if(!r)throw new Error("Block not found at current selection");let o=r.type===t?ge:t;const i=e.plugins[o],{onBeforeCreate:l}=i.events||{},a=re(e,{at:r.meta.order});if(!a)throw new Error(`Slate not found for block in position ${r.meta.order}`);const s=(null==l?void 0:l(e))||K(e,o),c=ve(a,a.children[0],r,e),u=ye(s,n);u&&(u.children=c);const d={id:I(),type:o,meta:Object.assign(Object.assign({},r.meta),{align:void 0}),value:[s]},f=[{type:"toggle_block",prevProperties:{sourceBlock:r,sourceSlateValue:a.children},properties:{toggledBlock:d,toggledSlateValue:d.value}}];return e.applyTransforms(f),n.focus&&e.focusBlock(d.id),d.id}function be(e,t){if(!(null==t?void 0:t.id)&&"number"!=typeof(null==t?void 0:t.at))throw new Error("getBlock requires either an id or at");if(null==t?void 0:t.id)return e.children[null==t?void 0:t.id];const n=Object.keys(e.children).find((n=>e.children[n].meta.order===(null==t?void 0:t.at)));return n?e.children[n]:null}function we(e,t,n){const r=e.children[t];if(!r)throw new Error(`Block with id ${t} not found`);const o=re(e,{at:r.meta.order});if(!o)return void console.warn("No slate found");let i=e=>m.isElement(e);(null==n?void 0:n.type)&&(i=e=>m.isElement(e)&&e.type===(null==n?void 0:n.type));try{const[e]=y.nodes(o,{at:(null==n?void 0:n.path)||o.selection||[0],match:i,mode:"lowest"});return e}catch(e){}}function ke(e,t,n){const r=we(e,t,n);if(r)return r[0]}const xe={createElement:function(e,t,n,r){const o=e.children[t];if(!o)throw new Error(`Block with id ${t} not found`);const i=re(e,{at:o.meta.order});i?y.withoutNormalizing(i,(()=>{const l=e.blocks[o.type],a=l.elements[n.type],s=F({type:n.type,props:Object.assign(Object.assign({},a.props),n.props)}),c=Object.keys(l.elements);let u=[];c.forEach((e=>{const t=l.elements[e];e===n.type&&Array.isArray(t.children)&&t.children.length>0&&t.children.forEach((e=>{const t=l.elements[e];u.push(F({type:e,props:t.props}))}))})),u.length>0&&(s.children=u);const{path:d,focus:f=!0}=r||{};let p;const h=we(e,t,{type:n.type});if(h){const[,e]=h;x.isPath(d)?p=d:"prev"===d?p=x.previous(e):"next"===d&&(p=x.next(e))}if(w.insertNodes(i,s,{at:p,select:f}),f&&u.length>0){const n=u[0],r=we(e,t,{path:p,type:n.type});if(r){const[,e]=r;w.select(i,e)}}})):console.warn("No slate found")},deleteElement:function(e,t,n){const r=e.children[t];if(!r)throw new Error(`Block with id ${t} not found`);const o=re(e,{at:r.meta.order});o?y.withoutNormalizing(o,(()=>{w.removeNodes(o,{at:n.path,match:e=>m.isElement(e)&&e.type===n.type})})):console.warn("No slate found")},updateElement:function(e,t,n,r){const o=e.children[t];if(!o)throw new Error(`Block with id ${t} not found`);const i=re(e,{at:o.meta.order});i?y.withoutNormalizing(i,(()=>{const[e]=y.nodes(i,{at:(null==r?void 0:r.path)||[0],match:e=>m.isElement(e)&&e.type===n.type}),t=null==e?void 0:e[0],o=null==e?void 0:e[1],l=(null==t?void 0:t.props)||{},a={props:Object.assign(Object.assign({},l),n.props)};w.setNodes(i,a,{at:(null==r?void 0:r.path)||o||[0],match:e=>m.isElement(e)&&e.type===n.type,mode:"lowest"})})):console.warn("No slate found")},insertElementText:function(e,t,n){const{blockId:r,focus:o}=n||{},i=r?e.children[r]:ne(e);if(!i)return void console.warn(`To set text programmatically, you must provide a valid blockId. Got: ${r}`);const l=re(e,{at:i.meta.order});if(!l)return void console.warn("No slate found");const a=e.blocks[i.type],s=Array.from({length:Object.keys(a.elements).length},(e=>0));let c=l.selection||s;c?y.withoutNormalizing(l,(()=>{E.isRange(c)&&!E.isCollapsed(c)&&w.collapse(l,{edge:"end"}),w.insertText(l,t,{at:c}),o&&e.focusBlock(i.id,{waitExecution:!0,shouldUpdateBlockPath:!0})})):console.warn("No valid path or selection found for text insertion")},getElement:ke,getElementChildren:function(e,t,n){const r=ke(e,t,n);if(r)return r.children},getElementEntry:we,isElementEmpty:function(e,t,n){const r=e.children[t];if(!r)throw new Error(`Block with id ${t} not found`);const o=re(e,{at:r.meta.order});if(!o)return void console.warn("No slate found");const[i]=y.nodes(o,{at:n.path||o.selection,match:e=>m.isElement(e)&&e.type===n.type});if(i){const[e,t]=i;return 0===y.string(o,t).trim().length}return!1},getElementPath:function(e,t,n){const r=e.children[t];if(!r)throw new Error(`Block with id ${t} not found`);const o=re(e,{at:r.meta.order});if(o)try{return C.findPath(o,n)}catch(e){}else console.warn("No slate found")},getParentElementPath:function(e,t,n){const r=e.children[t];if(!r)throw new Error(`Block with id ${t} not found`);const o=re(e,{at:r.meta.order});if(!o)return console.warn("No slate found"),[];try{const e=C.findPath(o,n);return x.parent(e)}catch(e){}}};function Oe(e){var t;const n=ne(e),r=re(e,{at:e.path.current}),o=Z.getPreviousPath(e),i=re(e,{at:o}),l=ne(e,{at:o}),a=e.blocks[(null==l?void 0:l.type)||""];if(!(r&&n&&i&&l))return;const s=xe.getElement(e,l.id);if(a&&!a.hasCustomEditor&&"void"!==(null===(t=null==s?void 0:s.props)||void 0===t?void 0:t.nodeType)){try{const e=X(i);w.select(i,e)}catch(e){w.select(i,y.start(i,[]))}y.withoutNormalizing(i,(()=>{const t=[],o=function(e,t){const n=JSON.parse(JSON.stringify(e.children)),r=JSON.parse(JSON.stringify(t.children)),o=n[n.length-1],i=r[0];return b.isText(o)&&b.isText(i)?(o.text+=i.text,[...n.slice(0,-1),o,...r.slice(1)]):[...n,...r]}(i.children[0],r.children[0]),a=[Object.assign(Object.assign({},i.children[0]),{children:o})],s=Object.assign(Object.assign({},l),{value:a});t.push({type:"merge_block",prevProperties:{sourceBlock:n,sourceSlateValue:r.children,targetBlock:l,targetSlateValue:i.children},properties:{mergedBlock:s,mergedSlateValue:a},path:e.path}),e.applyTransforms(t),e.setPath({current:l.meta.order});try{setTimeout((()=>{C.focus(i)}),0)}catch(e){console.error("Error setting focus:",e)}}))}}const Ee={insertBlock:W,deleteBlock:G,moveBlock:Q,focusBlock:te,splitBlock:ce,increaseBlockDepth:ue,decreaseBlockDepth:de,duplicateBlock:pe,updateBlock:he,toggleBlock:me,getBlock:be,getBlockSlate:J,buildBlockData:function(e){var t,n,r;return{id:(null==e?void 0:e.id)||I(),value:(null==e?void 0:e.value)||[{id:I(),type:(null==r?void 0:r.type)||"paragraph",children:(null==r?void 0:r.children)||[{text:""}],props:Object.assign({nodeType:"block"},null==r?void 0:r.props)}],type:(null==e?void 0:e.type)||"Paragraph",meta:Object.assign({order:(null===(t=null==e?void 0:e.meta)||void 0===t?void 0:t.order)||0,depth:(null===(n=null==e?void 0:e.meta)||void 0===n?void 0:n.depth)||0},null==e?void 0:e.meta)}},mergeBlock:Oe};function Se(e,t){try{C.blur(t),C.deselect(t),w.deselect(t)}catch(e){}e.setPath({current:null})}const _e={underline:{type:"underline",tag:"u"},strike:{type:"strike",tag:"s"},code:{type:"code",tag:"code"},italic:{type:"italic",tag:"i"},bold:{type:"bold",tag:"strong"},strong:{type:"bold",tag:"strong"}};function Ce(e,t,n){return e.map((e=>{var n,r;let o="";if(e.text)return o=Object.keys(_e).reduce(((t,n)=>e[n]?`<${_e[n].tag}>${t}</${_e[n].tag}>`:t),e.text),o;if(e.type){const i=function(e,t){return Object.values(e).find((e=>{var n,r;return e.type===(null===(r=null===(n=e.elements)||void 0===n?void 0:n[t])||void 0===r?void 0:r.rootPlugin)}))}(t,e.type);if(i&&(null===(r=null===(n=i.parsers)||void 0===n?void 0:n.html)||void 0===r?void 0:r.serialize))return o=i.parsers.html.serialize(e,Ce(e.children,t)),o}return o})).join("")}function je(e,t){const n=Object.values(t).filter((t=>{const n=Z.getSelectedPaths(e);return!(Array.isArray(n)&&n.length>0)||(null==n?void 0:n.includes(t.meta.order))})).sort(((e,t)=>e.meta.order-t.meta.order)).map((t=>{var n,r;const o=e.plugins[t.type];if(o&&(null===(r=null===(n=o.parsers)||void 0===n?void 0:n.html)||void 0===r?void 0:r.serialize)){const n=Ce(t.value[0].children,e.plugins);return o.parsers.html.serialize(t.value[0],n,t.meta)}return""}));return`<body id="yoopta-clipboard" data-editor-id="${e.id}">${n.join("")}</body>`}var De=Symbol.for("immer-nothing"),Ae=Symbol.for("immer-draftable"),Pe=Symbol.for("immer-state");function Re(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var Be=Object.getPrototypeOf;function Te(e){return!!e&&!!e[Pe]}function Me(e){return!!e&&(Le(e)||Array.isArray(e)||!!e[Ae]||!!e.constructor?.[Ae]||He(e)||Ve(e))}var Ne=Object.prototype.constructor.toString();function Le(e){if(!e||"object"!=typeof e)return!1;const t=Be(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)===Ne}function Ie(e,t){0===Fe(e)?Reflect.ownKeys(e).forEach((n=>{t(n,e[n],e)})):e.forEach(((n,r)=>t(r,n,e)))}function Fe(e){const t=e[Pe];return t?t.type_:Array.isArray(e)?1:He(e)?2:Ve(e)?3:0}function ze(e,t){return 2===Fe(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function $e(e,t,n){const r=Fe(e);2===r?e.set(t,n):3===r?e.add(n):e[t]=n}function He(e){return e instanceof Map}function Ve(e){return e instanceof Set}function Ue(e){return e.copy_||e.base_}function Ke(e,t){if(He(e))return new Map(e);if(Ve(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);if(!t&&Le(e)){if(!Be(e)){const t=Object.create(null);return Object.assign(t,e)}return{...e}}const n=Object.getOwnPropertyDescriptors(e);delete n[Pe];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(Be(e),n)}function We(e,t=!1){return Ye(e)||Te(e)||!Me(e)||(Fe(e)>1&&(e.set=e.add=e.clear=e.delete=qe),Object.freeze(e),t&&Object.entries(e).forEach((([e,t])=>We(t,!0)))),e}function qe(){Re(2)}function Ye(e){return Object.isFrozen(e)}var Xe,Ze={};function Je(e){const t=Ze[e];return t||Re(0),t}function Ge(){return Xe}function Qe(e,t){t&&(Je("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function et(e){tt(e),e.drafts_.forEach(rt),e.drafts_=null}function tt(e){e===Xe&&(Xe=e.parent_)}function nt(e){return Xe={drafts_:[],parent_:Xe,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function rt(e){const t=e[Pe];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function ot(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return void 0!==e&&e!==n?(n[Pe].modified_&&(et(t),Re(4)),Me(e)&&(e=it(t,e),t.parent_||at(t,e)),t.patches_&&Je("Patches").generateReplacementPatches_(n[Pe].base_,e,t.patches_,t.inversePatches_)):e=it(t,n,[]),et(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==De?e:void 0}function it(e,t,n){if(Ye(t))return t;const r=t[Pe];if(!r)return Ie(t,((o,i)=>lt(e,r,t,o,i,n))),t;if(r.scope_!==e)return t;if(!r.modified_)return at(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),Ie(o,((o,l)=>lt(e,r,t,o,l,n,i))),at(e,t,!1),n&&e.patches_&&Je("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function lt(e,t,n,r,o,i,l){if(Te(o)){const l=it(e,o,i&&t&&3!==t.type_&&!ze(t.assigned_,r)?i.concat(r):void 0);if($e(n,r,l),!Te(l))return;e.canAutoFreeze_=!1}else l&&n.add(o);if(Me(o)&&!Ye(o)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;it(e,o),t&&t.scope_.parent_||"symbol"==typeof r||!Object.prototype.propertyIsEnumerable.call(n,r)||at(e,o)}}function at(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&We(t,n)}var st={get(e,t){if(t===Pe)return e;const n=Ue(e);if(!ze(n,t))return function(e,t,n){const r=dt(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_||!Me(r)?r:r===ut(e.base_,t)?(pt(e),e.copy_[t]=ht(r,e)):r},has:(e,t)=>t in Ue(e),ownKeys:e=>Reflect.ownKeys(Ue(e)),set(e,t,n){const r=dt(Ue(e),t);if(r?.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const r=ut(Ue(e),t),l=r?.[Pe];if(l&&l.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||ze(e.base_,t)))return!0;pt(e),ft(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!==ut(e.base_,t)||t in e.base_?(e.assigned_[t]=!1,pt(e),ft(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0),getOwnPropertyDescriptor(e,t){const n=Ue(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r?{writable:!0,configurable:1!==e.type_||"length"!==t,enumerable:r.enumerable,value:n[t]}:r},defineProperty(){Re(11)},getPrototypeOf:e=>Be(e.base_),setPrototypeOf(){Re(12)}},ct={};function ut(e,t){const n=e[Pe];return(n?Ue(n):e)[t]}function dt(e,t){if(!(t in e))return;let n=Be(e);for(;n;){const e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=Be(n)}}function ft(e){e.modified_||(e.modified_=!0,e.parent_&&ft(e.parent_))}function pt(e){e.copy_||(e.copy_=Ke(e.base_,e.scope_.immer_.useStrictShallowCopy_))}Ie(st,((e,t)=>{ct[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),ct.deleteProperty=function(e,t){return ct.set.call(this,e,t,void 0)},ct.set=function(e,t,n){return st.set.call(this,e[0],t,n,e[0])};function ht(e,t){const n=He(e)?Je("MapSet").proxyMap_(e,t):Ve(e)?Je("MapSet").proxySet_(e,t):function(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:Ge(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let o=r,i=st;n&&(o=[r],i=ct);const{revoke:l,proxy:a}=Proxy.revocable(o,i);return r.draft_=a,r.revoke_=l,a}(e,t);return(t?t.scope_:Ge()).drafts_.push(n),n}function gt(e){if(!Me(e)||Ye(e))return e;const t=e[Pe];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=Ke(e,t.scope_.immer_.useStrictShallowCopy_)}else n=Ke(e,!0);return Ie(n,((e,t)=>{$e(n,e,gt(t))})),t&&(t.finalized_=!1),n}var vt=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&&Re(6),void 0!==n&&"function"!=typeof n&&Re(7),Me(e)){const o=nt(this),i=ht(e,void 0);let l=!0;try{r=t(i),l=!1}finally{l?et(o):tt(o)}return Qe(o,n),ot(r,o)}if(!e||"object"!=typeof e){if(r=t(e),void 0===r&&(r=e),r===De&&(r=void 0),this.autoFreeze_&&We(r,!0),n){const t=[],o=[];Je("Patches").generateReplacementPatches_(e,r,t,o),n(t,o)}return r}Re(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){Me(e)||Re(8),Te(e)&&(e=function(e){Te(e)||Re(10);return gt(e)}(e));const t=nt(this),n=ht(e,void 0);return n[Pe].isManual_=!0,tt(t),n}finishDraft(e,t){const n=e&&e[Pe];n&&n.isManual_||Re(9);const{scope_:r}=n;return Qe(r,t),ot(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=Je("Patches").applyPatches_;return Te(e)?r(e,t):this.produce(e,(e=>r(e,t)))}},yt=vt.produce;vt.produceWithPatches.bind(vt),vt.setAutoFreeze.bind(vt),vt.setUseStrictShallowCopy.bind(vt),vt.applyPatches.bind(vt);var mt=vt.createDraft.bind(vt),bt=vt.finishDraft.bind(vt);const wt=(e,t)=>{const{insertText:n}=t;return t.insertText=r=>{var o;const{selection:i}=t;if(" "===r&&i&&E.isCollapsed(i)){const{anchor:l}=i,a=y.above(t,{match:e=>m.isElement(e)&&y.isBlock(t,e),mode:"lowest"});if(!a)return;const[,s]=a,c=y.parent(t,s),[u]=c;if(m.isElement(u)&&!b.isText(u.children[0]))return n(r);const d=a?s:[],f={anchor:l,focus:y.start(t,d)},p=y.string(t,f),h=null===(o=e.shortcuts)||void 0===o?void 0:o[p];if(!!h&&!h.isActive())return w.select(t,f),w.delete(t),void e.toggleBlock(h.type,{deleteText:!0,focus:!0})}n(r)},t};function kt(e){return wt(e,j(S()))}function xt(e,t){switch(t.type){case"set_slate":{const{properties:n,blockId:r}=t,o=e.blockEditorsMap[r];if(o){const{slateOps:e,selectionBefore:t}=n;y.withoutNormalizing(o,(()=>{for(const t of e)o.apply(t);if(t)try{w.select(o,t),C.focus(o)}catch(e){}}))}break}case"insert_block":e.blockEditorsMap[t.block.id]=kt(e),e.children[t.block.id]=t.block,e.blockEditorsMap[t.block.id].children=t.block.value,Object.keys(e.children).forEach((n=>{const r=e.children[n];r.meta.order>=t.block.meta.order&&r.id!==t.block.id&&Te(e.children[r.id])&&(r.meta.order=r.meta.order+1)}));break;case"delete_block":{delete e.blockEditorsMap[t.block.id],delete e.children[t.block.id];const n=Object.values(e.children);n.forEach((e=>{e.meta.order>t.block.meta.order&&(Te(e)?e.meta.order--:yt(e,(e=>{e.meta.order--})))})),n.sort(((e,t)=>e.meta.order-t.meta.order)),n.forEach(((e,t)=>{Te(e.meta)?e.meta.order=t:yt(e,(e=>{e.meta=Object.assign(Object.assign({},e.meta),{order:t})}))}));break}case"set_block_value":{const{id:n,value:r,forceSlate:o}=t,i=e.blockEditorsMap[n];o&&i&&(i.children=r),Array.isArray(r)&&(Te(e.children[n])?e.children[n].value=r:yt(e.children[n],(e=>{e.value=r})));break}case"set_block_meta":{const{id:n,properties:r}=t,o=e.children[n];if(!o)break;Te(o)?Object.keys(r).forEach((e=>{o.meta[e]=r[e]})):yt(o,(e=>{e.meta=Object.assign(Object.assign({},e.meta),r)}));break}case"split_block":{const{properties:n}=t,r=kt(e);r.children=n.nextSlateValue,e.children[n.nextBlock.id]=Object.assign(Object.assign({},n.nextBlock),{value:r.children}),e.blockEditorsMap[n.nextBlock.id]=r;const o=e.blockEditorsMap[t.prevProperties.originalBlock.id];o.children=n.splitSlateValue,e.children[t.prevProperties.originalBlock.id].value=o.children,Object.values(e.children).forEach((e=>{e.meta.order>=n.nextBlock.meta.order&&e.id!==n.nextBlock.id&&(Te(e)?e.meta.order++:yt(e,(e=>{e.meta.order++})))}));break}case"merge_block":{const{prevProperties:n,properties:r}=t;delete e.blockEditorsMap[n.sourceBlock.id],delete e.children[n.sourceBlock.id],e.children[r.mergedBlock.id]=r.mergedBlock,e.blockEditorsMap[r.mergedBlock.id].children=r.mergedSlateValue,Object.values(e.children).forEach((e=>{e.meta.order>r.mergedBlock.meta.order&&(Te(e)?e.meta.order--:yt(e,(e=>{e.meta.order--})))}));break}case"toggle_block":{const{properties:n,prevProperties:r}=t;delete e.blockEditorsMap[r.sourceBlock.id],delete e.children[r.sourceBlock.id];const o=kt(e);o.children=n.toggledSlateValue,e.children[n.toggledBlock.id]=n.toggledBlock,e.blockEditorsMap[n.toggledBlock.id]=o;break}case"move_block":{const{prevProperties:n,properties:r}=t,o=e.children[n.id];o&&(o.meta.order=r.order,Object.values(e.children).forEach((e=>{e.id!==n.id&&(n.order<r.order?e.meta.order>n.order&&e.meta.order<=r.order&&e.meta.order--:e.meta.order<n.order&&e.meta.order>=r.order&&e.meta.order++)})));break}case"set_block_path":e.path=t.path;break;case"set_editor_value":{e.children=t.properties.value;const n={};Object.keys(e.children).forEach((t=>{const r=e.children[t],o=kt(e);o.children=r.value,n[t]=o})),e.blockEditorsMap=n;break}case"validate_block_paths":{const t=Object.values(e.children);t.sort(((e,t)=>e.meta.order-t.meta.order)),t.forEach(((e,t)=>{Te(e.meta)?e.meta.order=t:yt(e,(e=>{e.meta=Object.assign(Object.assign({},e.meta),{order:t})}))}));break}}}const Ot=100;const Et=new WeakMap,St=new WeakMap,_t={isMergingHistory:e=>St.get(e),isSavingHistory:e=>Et.get(e),withMergingHistory(e,t){const n=_t.isMergingHistory(e);St.set(e,!0),t(),St.set(e,n)},withSavingHistory(e,t){const n=_t.isSavingHistory(e);Et.set(e,!0),t(),Et.set(e,n)},withoutMergingHistory(e,t){const n=_t.isMergingHistory(e);St.set(e,!1),t(),St.set(e,n)},withoutSavingHistory(e,t){const n=_t.isSavingHistory(e);Et.set(e,!1),t(),Et.set(e,n)},redo:(e,t)=>{const{redos:n}=e.historyStack;if(n.length>0){const r=n[n.length-1];_t.withoutSavingHistory(e,(()=>{e.applyTransforms(r.operations,{source:"history"}),e.setPath(r.path);const{scroll:n=!0}=t||{};if(n&&"number"==typeof r.path.current){const t=Ee.getBlock(e,{at:r.path.current}),n=document.querySelector(`[data-yoopta-block-id="${null==t?void 0:t.id}"]`);n&&!Ct(n)&&n.scrollIntoView({block:"center",behavior:"auto"})}})),e.historyStack.redos.pop(),e.historyStack.undos.push(r)}},undo:(e,t)=>{const{undos:n}=e.historyStack;if(n.length>0){const n=e.historyStack.undos[e.historyStack.undos.length-1];_t.withoutSavingHistory(e,(()=>{const r=n.operations.flatMap((e=>function(e,t){switch(t.type){case"insert_block":return{type:"delete_block",path:t.path,block:t.block};case"delete_block":return{type:"insert_block",path:t.path,block:t.block};case"set_block_meta":return{type:"set_block_meta",id:t.id,properties:t.prevProperties,prevProperties:t.properties};case"split_block":return[{type:"delete_block",block:t.properties.nextBlock,path:t.path},{type:"set_block_value",id:t.prevProperties.originalBlock.id,value:t.prevProperties.originalValue,forceSlate:!0}];case"toggle_block":return{type:"toggle_block",properties:{toggledBlock:t.prevProperties.sourceBlock,toggledSlateValue:t.prevProperties.sourceSlateValue},prevProperties:{sourceBlock:t.properties.toggledBlock,sourceSlateValue:t.properties.toggledSlateValue}};case"merge_block":return[{type:"split_block",properties:{nextBlock:t.prevProperties.sourceBlock,nextSlateValue:t.prevProperties.sourceSlateValue,splitSlateValue:t.prevProperties.targetSlateValue},prevProperties:{originalBlock:t.properties.mergedBlock,originalValue:t.properties.mergedSlateValue},path:t.path}];case"move_block":return{type:"move_block",properties:t.prevProperties,prevProperties:t.properties};case"set_slate":return{type:"set_slate",properties:{slateOps:t.properties.slateOps.map(_.inverse).reverse(),selectionBefore:t.properties.selectionBefore},slate:t.slate,blockId:t.blockId};case"set_editor_value":return{type:"set_editor_value",properties:t.prevProperties,prevProperties:t.properties};default:return t}}(0,e))).reverse();e.applyTransforms(r,{source:"history"}),e.setPath(n.path);const{scroll:o=!0}=t||{};if(o&&"number"==typeof n.path.current){const t=Ee.getBlock(e,{at:n.path.current}),r=document.querySelector(`[data-yoopta-block-id="${null==t?void 0:t.id}"]`);r&&!Ct(r)&&r.scrollIntoView({block:"center",behavior:"auto"})}})),e.historyStack.redos.push(n),e.historyStack.undos.pop()}}};function Ct(e){var t=e.getBoundingClientRect(),n=document.documentElement;return t.top>=0&&t.left>=0&&t.bottom<=(window.innerHeight||n.clientHeight)&&t.right<=(window.innerWidth||n.clientWidth)}var jt={};!function(e){var t=Object.prototype.hasOwnProperty,n="~";function r(){}function o(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function i(e,t,r,i,l){if("function"!=typeof r)throw new TypeError("The listener must be a function");var a=new o(r,i||e,l),s=n?n+t:t;return e._events[s]?e._events[s].fn?e._events[s]=[e._events[s],a]:e._events[s].push(a):(e._events[s]=a,e._eventsCount++),e}function l(e,t){0==--e._eventsCount?e._events=new r:delete e._events[t]}function a(){this._events=new r,this._eventsCount=0}Object.create&&(r.prototype=Object.create(null),(new r).__proto__||(n=!1)),a.prototype.eventNames=function(){var e,r,o=[];if(0===this._eventsCount)return o;for(r in e=this._events)t.call(e,r)&&o.push(n?r.slice(1):r);return Object.getOwnPropertySymbols?o.concat(Object.getOwnPropertySymbols(e)):o},a.prototype.listeners=function(e){var t=n?n+e:e,r=this._events[t];if(!r)return[];if(r.fn)return[r.fn];for(var o=0,i=r.length,l=new Array(i);o<i;o++)l[o]=r[o].fn;return l},a.prototype.listenerCount=function(e){var t=n?n+e:e,r=this._events[t];return r?r.fn?1:r.length:0},a.prototype.emit=function(e,t,r,o,i,l){var a=n?n+e:e;if(!this._events[a])return!1;var s,c,u=this._events[a],d=arguments.length;if(u.fn){switch(u.once&&this.removeListener(e,u.fn,void 0,!0),d){case 1:return u.fn.call(u.context),!0;case 2:return u.fn.call(u.context,t),!0;case 3:return u.fn.call(u.context,t,r),!0;case 4:return u.fn.call(u.context,t,r,o),!0;case 5:return u.fn.call(u.context,t,r,o,i),!0;case 6:return u.fn.call(u.context,t,r,o,i,l),!0}for(c=1,s=new Array(d-1);c<d;c++)s[c-1]=arguments[c];u.fn.apply(u.context,s)}else{var f,p=u.length;for(c=0;c<p;c++)switch(u[c].once&&this.removeListener(e,u[c].fn,void 0,!0),d){case 1:u[c].fn.call(u[c].context);break;case 2:u[c].fn.call(u[c].context,t);break;case 3:u[c].fn.call(u[c].context,t,r);break;case 4:u[c].fn.call(u[c].context,t,r,o);break;default:if(!s)for(f=1,s=new Array(d-1);f<d;f++)s[f-1]=arguments[f];u[c].fn.apply(u[c].context,s)}}return!0},a.prototype.on=function(e,t,n){return i(this,e,t,n,!1)},a.prototype.once=function(e,t,n){return i(this,e,t,n,!0)},a.prototype.removeListener=function(e,t,r,o){var i=n?n+e:e;if(!this._events[i])return this;if(!t)return l(this,i),this;var a=this._events[i];if(a.fn)a.fn!==t||o&&!a.once||r&&a.context!==r||l(this,i);else{for(var s=0,c=[],u=a.length;s<u;s++)(a[s].fn!==t||o&&!a[s].once||r&&a[s].context!==r)&&c.push(a[s]);c.length?this._events[i]=1===c.length?c[0]:c:l(this,i)}return this},a.prototype.removeAllListeners=function(e){var t;return e?(t=n?n+e:e,this._events[t]&&l(this,t)):(this._events=new r,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=n,a.EventEmitter=a,e.exports=a}({get exports(){return jt},set exports(e){jt=e}});var Dt=jt;function At(e){return e.map((e=>{var t,n;if("text"in e){let r=e.text;return e.bold&&(r=`<strong style="font-weight: bolder;">${r}</strong>`),e.italic&&(r=`<i>${r}</i>`),e.strike&&(r=`<s>${r}</s>`),e.underline&&(r=`<u>${r}</u>`),e.code&&(r=`<code style="background-color: rgb(242 242 242); border-radius: .25rem; font-size: 75%; padding: 3px 6px;">${r}</code>`),e.highlight&&(r=`<mark style="color: ${null===(t=e.highlight)||void 0===t?void 0:t.color}; background-color: ${(null===(n=e.highlight)||void 0===n?void 0:n.backgroundColor)||"transparent"};">${r}</mark>`),r}if("link"===e.type){const{url:t,target:n,rel:r}=e.props;return`<a href="${t}" target="${n}" rel="${r}" style="color: rgb(0 122 255);\n cursor: pointer;\n position: relative;\n text-decoration-line: underline;\n text-underline-offset: 4px;">${At(e.children)}</a>`}return""})).join("")}function Pt(e){return e.map((e=>{if("text"in e){let t=e.text;return e.bold&&(t=`**${t}**`),e.italic&&(t=`*${t}*`),e.strike&&(t=`~~${t}~~`),e.underline&&(t=`<u>${t}</u>`),e.code&&(t=`\`${t}\``),t}if("link"===e.type){const{url:t,target:n,rel:r}=e.props;return`[${Pt(e.children)}](${t})`}return""})).join("")}const Rt={head:{meta:[{content:"width=device-width",name:"viewport"},{charset:"UTF-8"},{content:"IE=edge","http-equiv":"X-UA-Compatible"}]},body:{attrs:{style:{margin:"0 auto",padding:0,width:"900px"}}},container:{attrs:{style:{margin:"0 auto",width:"600px"}}}};function Bt(e,t,n){var r,o,i,l,a;const s=Mt(Rt,n||{}),c=Object.values(t).filter((t=>{const n=Z.getSelectedPaths(e);return!(Array.isArray(n)&&n.length>0)||(null==n?void 0:n.includes(t.meta.order))})).sort(((e,t)=>e.meta.order-t.meta.order)).map((t=>{var n,r;const o=e.plugins[t.type];if(o&&(null===(r=null===(n=o.parsers)||void 0===n?void 0:n.email)||void 0===r?void 0:r.serialize)){const e=At(t.value[0].children);return o.parsers.email.serialize(t.value[0],e,t.meta)}return""})),u=c.join("");if(s.customTemplate)return s.customTemplate(u);const d=Tt(null===(r=s.body)||void 0===r?void 0:r.attrs),f=Tt(null===(o=s.container)||void 0===o?void 0:o.attrs);return`\n <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\n <html lang="en">\n <head>\n <title>${(null===(i=null==s?void 0:s.head)||void 0===i?void 0:i.title)||"Email-Builder"}</title>\n <meta http-equiv="Content-Type" content="text/html charset=UTF-8" />\n ${function(e=[]){return e.map((e=>`<meta ${Object.entries(e).filter((([e,t])=>void 0!==t)).map((([e,t])=>""===t?e:`${e}="${t}"`)).join(" ")}>`)).join("\n")}(null===(l=s.head)||void 0===l?void 0:l.meta)}\n ${function(e=[]){return e.map((e=>`<style${e.id?` id="${e.id}"`:""}>${e.content}</style>`)).join("\n")}(null===(a=s.head)||void 0===a?void 0:a.styles)}\n </head>\n <body id="yoopta-email" ${d}>\n <table ${f}>\n <tbody>\n <tr>\n <td>\n ${u}\n </td>\n </tr>\n </tbody>\n </table>\n </body>\n </html>\n `}function Tt(e){return e?Object.entries(e).map((([e,t])=>{if("style"===e){const e=(n=t)?Object.entries(n).map((([e,t])=>`${e.replace(/[A-Z]/g,(e=>`-${e.toLowerCase()}`))}: ${t}${"number"==typeof t?"px":""};`)).join(" "):"";return`style="${e}"`}var n;return`${e}="${t}"`})).join(" "):""}function Mt(e,t){return Array.isArray(e)&&Array.isArray(t)?e.concat(t):"object"==typeof e&&"object"==typeof t?Object.keys(Object.assign(Object.assign({},e),t)).reduce(((n,r)=>(n[r]=Mt(e[r],t[r]),n)),{}):t}function Nt(){const e=new Dt,t=(t,n)=>e.on(t,n),n=(t,n)=>e.once(t,n),r=(t,n)=>e.off(t,n),o=(t,n)=>e.emit(t,n),i={id:"",children:{},blockEditorsMap:{},path:{current:null},readOnly:!1,isEmpty:()=>function(e){const t=Object.values(e.children);if(t.length>1)return!1;const n=t[0];if(!n)return!0;if("Paragraph"!==n.type)return!1;const r=re(e,{at:n.meta.order});if(!r)return!0;try{return!(y.string(r,[0]).length>0)}catch(e){return!0}}(i),getEditorValue:()=>function(e){return e.children}(i),setEditorValue:(...e)=>function(e,t){let n;if(null!==t&&fe(t))n=t;else{const e=Ee.buildBlockData();n={[e.id]:e}}const r={type:"set_editor_value",properties:{value:n},prevProperties:{value:e.children}};e.applyTransforms([r],{validatePaths:!0})}(i,...e),insertBlock:(...e)=>W(i,...e),deleteBlock:(...e)=>G(i,...e),duplicateBlock:(...e)=>pe(i,...e),toggleBlock:(...e)=>me(i,...e),increaseBlockDepth:(...e)=>ue(i,...e),decreaseBlockDepth:(...e)=>de(i,...e),moveBlock:(...e)=>Q(i,...e),focusBlock:(...e)=>te(i,...e),getBlock:(...e)=>be(i,...e),updateBlock:(...e)=>he(i,...e),splitBlock:(...e)=>ce(i,...e),mergeBlock:(...e)=>Oe(i,...e),setPath:(...e)=>Y(i,...e),blocks:{},formats:{},shortcuts:{},plugins:{},commands:{},applyTransforms:(e,...t)=>function(e,t,n){e.children=mt(e.children),e.path=mt(e.path);const{validatePaths:r=!0,source:o}=n||{},i=[...t];r&&i.push({type:"validate_block_paths"}),i.length>1&&i.sort(((e,t)=>"insert_block"===e.type&&"insert_block"===t.type?e.block.meta.order-t.block.meta.order:0));for(const t of i)"set_slate"===t.type&&"api"===o||xt(e,t);if(Te(e.children)||(e.children=mt(e.children)),e.children=bt(e.children),Te(e.path)&&(e.path=bt(e.path)),!1!==e.isSavingHistory()){const t={operations:i.filter((e=>"set_block_path"!==e.type&&"set_block_value"!==e.type&&"validate_block_paths"!==e.type)),path:e.path};t.operations.length>0&&"history"!==o&&(e.historyStack.undos.push(t),e.historyStack.redos=[]),e.historyStack.undos.length>Ot&&e.historyStack.undos.shift()}const l={value:e.children,operations:i};e.emit("change",l),e.emit("path-change",e.path)}(i,e,...t),batchOperations:e=>function(e,t){const n=[];let r={};const o=e.applyTransforms;e.applyTransforms=(e,t)=>{t&&(r=t),n.push(...e)},t(),e.applyTransforms=o,n.length>0&&e.applyTransforms(n,r)}(i,e),on:(e,n)=>t(e,n),off:(e,t)=>r(e,t),emit:(e,...t)=>o(e,...t),once:(e,t)=>n(e,t),isFocused:()=>function(e){return!!ee.get(e)}(i),focus:()=>function(e){if(e.readOnly)return;const t=ne(e,{at:0});t&&(ee.set(e,!0),e.focusBlock(t.id,{waitExecution:!0}),e.emit("focus",!0))}(i),blur:(...e)=>function(e,t={}){var n;const r=null!==(n=t.slate)&&void 0!==n?n:re(e);if(!r)return;const{waitExecution:o,waitExecutionMs:i}=t;o?setTimeout((()=>Se(e,r)),i):(ee.set(e,!1),Se(e,r),e.emit("blur",!1))}(i,...e),getHTML:e=>je(i,e),getMarkdown:e=>function(e,t){return function(e,t){return t.sort(((e,t)=>e.meta.order>t.meta.order?1:-1)).map((t=>{var n,r;const o=e.plugins[t.type];if(o){const e=t.value[0];if(null===(r=null===(n=o.parsers)||void 0===n?void 0:n.markdown)||void 0===r?void 0:r.serialize){const n=o.parsers.markdown.serialize(e,e.children.map((e=>e.text)).join(""),t.meta);if(n)return n}}return""})).join("\n")}(e,Object.values(t))}(i,e),getPlainText:e=>function(e,t){const n=je(e,t),r=document.createElement("div");return r.innerHTML=n,r.innerText}(i,e),getEmail:(e,t)=>Bt(i,e,t),refElement:null,historyStack:{undos:[],redos:[]},redo:e=>_t.redo(i,e),undo:e=>_t.undo(i,e),isSavingHistory:()=>_t.isSavingHistory(i),isMergingHistory:()=>_t.isMergingHistory(i),withoutSavingHistory:e=>_t.withoutSavingHistory(i,e),withSavingHistory:e=>_t.withSavingHistory(i,e),withoutMergingHistory:e=>_t.withoutMergingHistory(i,e),withMergingHistory:e=>_t.withMergingHistory(i,e)};return i}const Lt={editor:Nt()},It=i(Lt),Ft=({children:t,editorState:n})=>{const r=a(Lt);return r.current={editor:n.editor},e(It.Provider,Object.assign({value:r.current},{children:t}))},zt=()=>{const e=l(It);if(!e)throw new Error("useYooptaEditor must be used within a YooptaEditorContext");return e.editor},$t=e=>zt().children[e],Ht=()=>zt().isFocused(),Vt=()=>zt().readOnly,Ut=e=>{var t;return null===(t=zt().plugins[e])||void 0===t?void 0:t.options},Kt=({blockId:e,at:t})=>{const n=zt();if(!e&&"number"!=typeof t)throw new Error("useBlockSelected must receive either blockId or at");let r;return e&&(r=n.children[e]),t&&(r=Ee.getBlock(n,{at:t})),n.path.current===(null==r?void 0:r.meta.order)};const Wt="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement;function qt(e){const t=Object.prototype.toString.call(e);return"[object Window]"===t||"[object global]"===t}function Yt(e){return"nodeType"in e}function Xt(e){var t,n;return e?qt(e)?e:Yt(e)&&null!=(t=null==(n=e.ownerDocument)?void 0:n.defaultView)?t:window:window}function Zt(e){const{Document:t}=Xt(e);return e instanceof t}function Jt(e){return!qt(e)&&e instanceof Xt(e).HTMLElement}function Gt(e){return e instanceof Xt(e).SVGElement}function Qt(e){return e?qt(e)?e.document:Yt(e)?Zt(e)?e:Jt(e)||Gt(e)?e.ownerDocument:document:document:document}const en=Wt?c:u;function tn(e){const t=a(e);return en((()=>{t.current=e})),d((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)}),[])}function nn(e,t){void 0===t&&(t=[e]);const n=a(e);return en((()=>{n.current!==e&&(n.current=e)}),t),n}function rn(e,t){const n=a();return s((()=>{const t=e(n.current);return n.current=t,t}),[...t])}function on(e){const t=tn(e),n=a(null),r=d((e=>{e!==n.current&&(null==t||t(e,n.current)),n.current=e}),[]);return[n,r]}function ln(e){const t=a();return u((()=>{t.current=e}),[e]),t.current}let an={};function sn(e,t){return s((()=>{if(t)return t;const n=null==an[e]?0:an[e]+1;return an[e]=n,e+"-"+n}),[e,t])}function cn(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return r.reduce(((t,n)=>{const r=Object.entries(n);for(const[n,o]of r){const r=t[n];null!=r&&(t[n]=r+e*o)}return t}),{...t})}}const un=cn(1),dn=cn(-1);function fn(e){if(!e)return!1;const{KeyboardEvent:t}=Xt(e.target);return t&&e instanceof t}function pn(e){if(function(e){if(!e)return!1;const{TouchEvent:t}=Xt(e.target);return t&&e instanceof t}(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return function(e){return"clientX"in e&&"clientY"in e}(e)?{x:e.clientX,y:e.clientY}:null}const hn=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[hn.Translate.toString(e),hn.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),gn="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function vn(e){return e.matches(gn)?e:e.querySelector(gn)}const yn={display:"none"};function mn(e){let{id:t,value:n}=e;return o.createElement("div",{id:t,style:yn},n)}function bn(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;return o.createElement("div",{id:t,style:{position:"fixed",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"},role:"status","aria-live":r,"aria-atomic":!0},n)}const wn=i(null);const kn={draggable:"\n To pick up a draggable item, press the space bar.\n While dragging, use the arrow keys to move the item.\n Press space again to drop the item in its new position, or press escape to cancel.\n "},xn={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function On(e){let{announcements:t=xn,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=kn}=e;const{announce:a,announcement:c}=function(){const[e,t]=f("");return{announce:d((e=>{null!=e&&t(e)}),[]),announcement:e}}(),p=sn("DndLiveRegion"),[h,g]=f(!1);if(u((()=>{g(!0)}),[]),function(e){const t=l(wn);u((()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)}),[e,t])}(s((()=>({onDragStart(e){let{active:n}=e;a(t.onDragStart({active:n}))},onDragMove(e){let{active:n,over:r}=e;t.onDragMove&&a(t.onDragMove({active:n,over:r}))},onDragOver(e){let{active:n,over:r}=e;a(t.onDragOver({active:n,over:r}))},onDragEnd(e){let{active:n,over:r}=e;a(t.onDragEnd({active:n,over:r}))},onDragCancel(e){let{active:n,over:r}=e;a(t.onDragCancel({active:n,over:r}))}})),[a,t])),!h)return null;const v=o.createElement(o.Fragment,null,o.createElement(mn,{id:r,value:i.draggable}),o.createElement(bn,{id:p,announcement:c}));return n?M(v,n):v}var En;function Sn(){}function _n(e,t){return s((()=>({sensor:e,options:null!=t?t:{}})),[e,t])}!function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"}(En||(En={}));const Cn=Object.freeze({x:0,y:0});function jn(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Dn(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function An(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function Pn(e){let{left:t,top:n,height:r,width:o}=e;return[{x:t,y:n},{x:t+o,y:n},{x:t,y:n+r},{x:t+o,y:n+r}]}function Rn(e,t){if(!e||0===e.length)return null;const[n]=e;return t?n[t]:n}function Bn(e,t,n){return void 0===t&&(t=e.left),void 0===n&&(n=e.top),{x:t+.5*e.width,y:n+.5*e.height}}const Tn=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=Bn(t,t.left,t.top),i=[];for(const e of r){const{id:t}=e,r=n.get(t);if(r){const n=jn(Bn(r),o);i.push({id:t,data:{droppableContainer:e,value:n}})}}return i.sort(Dn)};function Mn(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),o=Math.min(t.left+t.width,e.left+e.width),i=Math.min(t.top+t.height,e.top+e.height),l=o-r,a=i-n;if(r<o&&n<i){const n=t.width*t.height,r=e.width*e.height,o=l*a;return Number((o/(n+r-o)).toFixed(4))}return 0}const Nn=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=[];for(const e of r){const{id:r}=e,i=n.get(r);if(i){const n=Mn(i,t);n>0&&o.push({id:r,data:{droppableContainer:e,value:n}})}}return o.sort(An)};function Ln(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:Cn}function In(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return r.reduce(((t,n)=>({...t,top:t.top+e*n.y,bottom:t.bottom+e*n.y,left:t.left+e*n.x,right:t.right+e*n.x})),{...t})}}const Fn=In(1);const zn={ignoreTransform:!1};function $n(e,t){void 0===t&&(t=zn);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:t,transformOrigin:r}=Xt(e).getComputedStyle(e);t&&(n=function(e,t,n){const r=function(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}(t);if(!r)return e;const{scaleX:o,scaleY:i,x:l,y:a}=r,s=e.left-l-(1-o)*parseFloat(n),c=e.top-a-(1-i)*parseFloat(n.slice(n.indexOf(" ")+1)),u=o?e.width/o:e.width,d=i?e.height/i:e.height;return{width:u,height:d,top:c,right:s+u,bottom:c+d,left:s}}(n,t,r))}const{top:r,left:o,width:i,height:l,bottom:a,right:s}=n;return{top:r,left:o,width:i,height:l,bottom:a,right:s}}function Hn(e){return $n(e,{ignoreTransform:!0})}function Vn(e,t){const n=[];return e?function r(o){if(null!=t&&n.length>=t)return n;if(!o)return n;if(Zt(o)&&null!=o.scrollingElement&&!n.includes(o.scrollingElement))return n.push(o.scrollingElement),n;if(!Jt(o)||Gt(o))return n;if(n.includes(o))return n;const i=Xt(e).getComputedStyle(o);return o!==e&&function(e,t){void 0===t&&(t=Xt(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some((e=>{const r=t[e];return"string"==typeof r&&n.test(r)}))}(o,i)&&n.push(o),function(e,t){return void 0===t&&(t=Xt(e).getComputedStyle(e)),"fixed"===t.position}(o,i)?n:r(o.parentNode)}(e):n}function Un(e){const[t]=Vn(e,1);return null!=t?t:null}function Kn(e){return Wt&&e?qt(e)?e:Yt(e)?Zt(e)||e===Qt(e).scrollingElement?window:Jt(e)?e:null:null:null}function Wn(e){return qt(e)?e.scrollX:e.scrollLeft}function qn(e){return qt(e)?e.scrollY:e.scrollTop}function Yn(e){return{x:Wn(e),y:qn(e)}}var Xn;function Zn(e){return!(!Wt||!e)&&e===document.scrollingElement}function Jn(e){const t={x:0,y:0},n=Zn(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height};return{isTop:e.scrollTop<=t.y,isLeft:e.scrollLeft<=t.x,isBottom:e.scrollTop>=r.y,isRight:e.scrollLeft>=r.x,maxScroll:r,minScroll:t}}!function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"}(Xn||(Xn={}));const Gn={x:.2,y:.2};function Qn(e,t,n,r,o){let{top:i,left:l,right:a,bottom:s}=n;void 0===r&&(r=10),void 0===o&&(o=Gn);const{isTop:c,isBottom:u,isLeft:d,isRight:f}=Jn(e),p={x:0,y:0},h={x:0,y:0},g=t.height*o.y,v=t.width*o.x;return!c&&i<=t.top+g?(p.y=Xn.Backward,h.y=r*Math.abs((t.top+g-i)/g)):!u&&s>=t.bottom-g&&(p.y=Xn.Forward,h.y=r*Math.abs((t.bottom-g-s)/g)),!f&&a>=t.right-v?(p.x=Xn.Forward,h.x=r*Math.abs((t.right-v-a)/v)):!d&&l<=t.left+v&&(p.x=Xn.Backward,h.x=r*Math.abs((t.left+v-l)/v)),{direction:p,speed:h}}function er(e){if(e===document.scrollingElement){const{innerWidth:e,innerHeight:t}=window;return{top:0,left:0,right:e,bottom:t,width:e,height:t}}const{top:t,left:n,right:r,bottom:o}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:o,width:e.clientWidth,height:e.clientHeight}}function tr(e){return e.reduce(((e,t)=>un(e,Yn(t))),Cn)}const nr=[["x",["left","right"],function(e){return e.reduce(((e,t)=>e+Wn(t)),0)}],["y",["top","bottom"],function(e){return e.reduce(((e,t)=>e+qn(t)),0)}]];class rr{constructor(e,t){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const n=Vn(t),r=tr(n);this.rect={...e},this.width=e.width,this.height=e.height;for(const[e,t,o]of nr)for(const i of t)Object.defineProperty(this,i,{get:()=>{const t=o(n),l=r[e]-t;return this.rect[i]+l},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class or{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach((e=>{var t;return null==(t=this.target)?void 0:t.removeEventListener(...e)}))},this.target=e}add(e,t,n){var r;null==(r=this.target)||r.addEventListener(e,t,n),this.listeners.push([e,t,n])}}function ir(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return"number"==typeof t?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t&&r>t.y}var lr,ar;function sr(e){e.preventDefault()}function cr(e){e.stopPropagation()}!function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"}(lr||(lr={})),function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter"}(ar||(ar={}));const ur={start:[ar.Space,ar.Enter],cancel:[ar.Esc],end:[ar.Space,ar.Enter]},dr=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case ar.Right:return{...n,x:n.x+25};case ar.Left:return{...n,x:n.x-25};case ar.Down:return{...n,y:n.y+25};case ar.Up:return{...n,y:n.y-25}}};class fr{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;const{event:{target:t}}=e;this.props=e,this.listeners=new or(Qt(t)),this.windowListeners=new or(Xt(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(lr.Resize,this.handleCancel),this.windowListeners.add(lr.VisibilityChange,this.handleCancel),setTimeout((()=>this.listeners.add(lr.Keydown,this.handleKeyDown)))}handleStart(){const{activeNode:e,onStart:t}=this.props,n=e.node.current;n&&function(e,t){if(void 0===t&&(t=$n),!e)return;const{top:n,left:r,bottom:o,right:i}=t(e);Un(e)&&(o<=0||i<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}(n),t(Cn)}handleKeyDown(e){if(fn(e)){const{active:t,context:n,options:r}=this.props,{keyboardCodes:o=ur,coordinateGetter:i=dr,scrollBehavior:l="smooth"}=r,{code:a}=e;if(o.end.includes(a))return void this.handleEnd(e);if(o.cancel.includes(a))return void this.handleCancel(e);const{collisionRect:s}=n.current,c=s?{x:s.left,y:s.top}:Cn;this.referenceCoordinates||(this.referenceCoordinates=c);const u=i(e,{active:t,context:n.current,currentCoordinates:c});if(u){const t=dn(u,c),r={x:0,y:0},{scrollableAncestors:o}=n.current;for(const n of o){const o=e.code,{isTop:i,isRight:a,isLeft:s,isBottom:c,maxScroll:d,minScroll:f}=Jn(n),p=er(n),h={x:Math.min(o===ar.Right?p.right-p.width/2:p.right,Math.max(o===ar.Right?p.left:p.left+p.width/2,u.x)),y:Math.min(o===ar.Down?p.bottom-p.height/2:p.bottom,Math.max(o===ar.Down?p.top:p.top+p.height/2,u.y))},g=o===ar.Right&&!a||o===ar.Left&&!s,v=o===ar.Down&&!c||o===ar.Up&&!i;if(g&&h.x!==u.x){const e=n.scrollLeft+t.x,i=o===ar.Right&&e<=d.x||o===ar.Left&&e>=f.x;if(i&&!t.y)return void n.scrollTo({left:e,behavior:l});r.x=i?n.scrollLeft-e:o===ar.Right?n.scrollLeft-d.x:n.scrollLeft-f.x,r.x&&n.scrollBy({left:-r.x,behavior:l});break}if(v&&h.y!==u.y){const e=n.scrollTop+t.y,i=o===ar.Down&&e<=d.y||o===ar.Up&&e>=f.y;if(i&&!t.x)return void n.scrollTo({top:e,behavior:l});r.y=i?n.scrollTop-e:o===ar.Down?n.scrollTop-d.y:n.scrollTop-f.y,r.y&&n.scrollBy({top:-r.y,behavior:l});break}}this.handleMove(e,un(dn(u,this.referenceCoordinates),r))}}}handleMove(e,t){const{onMove:n}=this.props;e.preventDefault(),n(t)}handleEnd(e){const{onEnd:t}=this.props;e.preventDefault(),this.detach(),t()}handleCancel(e){const{onCancel:t}=this.props;e.preventDefault(),this.detach(),t()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}function pr(e){return Boolean(e&&"distance"in e)}function hr(e){return Boolean(e&&"delay"in e)}fr.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=ur,onActivation:o}=t,{active:i}=n;const{code:l}=e.nativeEvent;if(r.start.includes(l)){const t=i.activatorNode.current;return(!t||e.target===t)&&(e.preventDefault(),null==o||o({event:e.nativeEvent}),!0)}return!1}}];class gr{constructor(e,t,n){var r;void 0===n&&(n=function(e){const{EventTarget:t}=Xt(e);return e instanceof t?e:Qt(e)}(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=t;const{event:o}=e,{target:i}=o;this.props=e,this.events=t,this.document=Qt(i),this.documentListeners=new or(this.document),this.listeners=new or(n),this.windowListeners=new or(Xt(i)),this.initialCoordinates=null!=(r=pn(o))?r:Cn,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:e,props:{options:{activationConstraint:t,bypassActivationConstraint:n}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),this.windowListeners.add(lr.Resize,this.handleCancel),this.windowListeners.add(lr.DragStart,sr),this.windowListeners.add(lr.VisibilityChange,this.handleCancel),this.windowListeners.add(lr.ContextMenu,sr),this.documentListeners.add(lr.Keydown,this.handleKeydown),t){if(null!=n&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(hr(t))return void(this.timeoutId=setTimeout(this.handleStart,t.delay));if(pr(t))return}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),null!==this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handleStart(){const{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,this.documentListeners.add(lr.Click,cr,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(lr.SelectionChange,this.removeTextSelection),t(e))}handleMove(e){var t;const{activated:n,initialCoordinates:r,props:o}=this,{onMove:i,options:{activationConstraint:l}}=o;if(!r)return;const a=null!=(t=pn(e))?t:Cn,s=dn(r,a);if(!n&&l){if(pr(l)){if(null!=l.tolerance&&ir(s,l.tolerance))return this.handleCancel();if(ir(s,l.distance))return this.handleStart()}return hr(l)&&ir(s,l.tolerance)?this.handleCancel():void 0}e.cancelable&&e.preventDefault(),i(a)}handleEnd(){const{onEnd:e}=this.props;this.detach(),e()}handleCancel(){const{onCancel:e}=this.props;this.detach(),e()}handleKeydown(e){e.code===ar.Esc&&this.handleCancel()}removeTextSelection(){var e;null==(e=this.document.getSelection())||e.removeAllRanges()}}const vr={move:{name:"pointermove"},end:{name:"pointerup"}};class yr extends gr{constructor(e){const{event:t}=e,n=Qt(t.target);super(e,vr,n)}}yr.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!(!n.isPrimary||0!==n.button)&&(null==r||r({event:n}),!0)}}];const mr={move:{name:"mousemove"},end:{name:"mouseup"}};var br;!function(e){e[e.RightClick=2]="RightClick"}(br||(br={}));(class extends gr{constructor(e){super(e,mr,Qt(e.event.target))}}).activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button!==br.RightClick&&(null==r||r({event:n}),!0)}}];const wr={move:{name:"touchmove"},end:{name:"touchend"}};var kr,xr;function Or(e){let{acceleration:t,activator:n=kr.Pointer,canScroll:r,draggingRect:o,enabled:i,interval:l=5,order:c=xr.TreeOrder,pointerCoordinates:f,scrollableAncestors:p,scrollableAncestorRects:h,delta:g,threshold:v}=e;const y=function(e){let{delta:t,disabled:n}=e;const r=ln(t);return rn((e=>{if(n||!r||!e)return Er;const o={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[Xn.Backward]:e.x[Xn.Backward]||-1===o.x,[Xn.Forward]:e.x[Xn.Forward]||1===o.x},y:{[Xn.Backward]:e.y[Xn.Backward]||-1===o.y,[Xn.Forward]:e.y[Xn.Forward]||1===o.y}}}),[n,t,r])}({delta:g,disabled:!i}),[m,b]=function(){const e=a(null);return[d(((t,n)=>{e.current=setInterval(t,n)}),[]),d((()=>{null!==e.current&&(clearInterval(e.current),e.current=null)}),[])]}(),w=a({x:0,y:0}),k=a({x:0,y:0}),x=s((()=>{switch(n){case kr.Pointer:return f?{top:f.y,bottom:f.y,left:f.x,right:f.x}:null;case kr.DraggableRect:return o}}),[n,o,f]),O=a(null),E=d((()=>{const e=O.current;if(!e)return;const t=w.current.x*k.current.x,n=w.current.y*k.current.y;e.scrollBy(t,n)}),[]),S=s((()=>c===xr.TreeOrder?[...p].reverse():p),[c,p]);u((()=>{if(i&&p.length&&x){for(const e of S){if(!1===(null==r?void 0:r(e)))continue;const n=p.indexOf(e),o=h[n];if(!o)continue;const{direction:i,speed:a}=Qn(e,o,x,t,v);for(const e of["x","y"])y[e][i[e]]||(a[e]=0,i[e]=0);if(a.x>0||a.y>0)return b(),O.current=e,m(E,l),w.current=a,void(k.current=i)}w.current={x:0,y:0},k.current={x:0,y:0},b()}else b()}),[t,E,r,b,i,l,JSON.stringify(x),JSON.stringify(y),m,p,S,h,JSON.stringify(v)])}(class extends gr{constructor(e){super(e,wr)}static setup(){return window.addEventListener(wr.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(wr.move.name,e)};function e(){}}}).activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:o}=n;return!(o.length>1)&&(null==r||r({event:n}),!0)}}],function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"}(kr||(kr={})),function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"}(xr||(xr={}));const Er={x:{[Xn.Backward]:!1,[Xn.Forward]:!1},y:{[Xn.Backward]:!1,[Xn.Forward]:!1}};var Sr,_r;!function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"}(Sr||(Sr={})),function(e){e.Optimized="optimized"}(_r||(_r={}));const Cr=new Map;function jr(e,t){return rn((n=>e?n||("function"==typeof t?t(e):e):null),[t,e])}function Dr(e){let{callback:t,disabled:n}=e;const r=tn(t),o=s((()=>{if(n||"undefined"==typeof window||void 0===window.ResizeObserver)return;const{ResizeObserver:e}=window;return new e(r)}),[n]);return u((()=>()=>null==o?void 0:o.disconnect()),[o]),o}function Ar(e){return new rr($n(e),e)}function Pr(e,t,n){void 0===t&&(t=Ar);const[r,o]=h((function(r){if(!e)return null;var o;if(!1===e.isConnected)return null!=(o=null!=r?r:n)?o:null;const i=t(e);if(JSON.stringify(r)===JSON.stringify(i))return r;return i}),null),i=function(e){let{callback:t,disabled:n}=e;const r=tn(t),o=s((()=>{if(n||"undefined"==typeof window||void 0===window.MutationObserver)return;const{MutationObserver:e}=window;return new e(r)}),[r,n]);return u((()=>()=>null==o?void 0:o.disconnect()),[o]),o}({callback(t){if(e)for(const n of t){const{type:t,target:r}=n;if("childList"===t&&r instanceof HTMLElement&&r.contains(e)){o();break}}}}),l=Dr({callback:o});return en((()=>{o(),e?(null==l||l.observe(e),null==i||i.observe(document.body,{childList:!0,subtree:!0})):(null==l||l.disconnect(),null==i||i.disconnect())}),[e]),r}const Rr=[];function Br(e,t){void 0===t&&(t=[]);const n=a(null);return u((()=>{n.current=null}),t),u((()=>{const t=e!==Cn;t&&!n.current&&(n.current=e),!t&&n.current&&(n.current=null)}),[e]),n.current?dn(e,n.current):Cn}function Tr(e){return s((()=>e?function(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}(e):null),[e])}const Mr=[];function Nr(e){let{measure:t}=e;const[n,r]=f(null),o=d((e=>{for(const{target:n}of e)if(Jt(n)){r((e=>{const r=t(n);return e?{...e,width:r.width,height:r.height}:r}));break}}),[t]),i=Dr({callback:o}),l=d((e=>{const n=function(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Jt(t)?t:e}(e);null==i||i.disconnect(),n&&(null==i||i.observe(n)),r(n?t(n):null)}),[t,i]),[a,c]=on(l);return s((()=>({nodeRef:a,rect:n,setRef:c})),[n,a,c])}const Lr=[{sensor:yr,options:{}},{sensor:fr,options:{}}],Ir={current:{}},Fr={draggable:{measure:Hn},droppable:{measure:Hn,strategy:Sr.WhileDragging,frequency:_r.Optimized},dragOverlay:{measure:$n}};class zr extends Map{get(e){var t;return null!=e&&null!=(t=super.get(e))?t:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter((e=>{let{disabled:t}=e;return!t}))}getNodeFor(e){var t,n;return null!=(t=null==(n=this.get(e))?void 0:n.node.current)?t:void 0}}const $r={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new zr,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Sn},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Fr,measureDroppableContainers:Sn,windowRect:null,measuringScheduled:!1},Hr=i({activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Sn,draggableNodes:new Map,over:null,measureDroppableContainers:Sn}),Vr=i($r);function Ur(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new zr}}}function Kr(e,t){switch(t.type){case En.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case En.DragMove:return e.draggable.active?{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}}:e;case En.DragEnd:case En.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case En.RegisterDroppable:{const{element:n}=t,{id:r}=n,o=new zr(e.droppable.containers);return o.set(r,n),{...e,droppable:{...e.droppable,containers:o}}}case En.SetDroppableDisabled:{const{id:n,key:r,disabled:o}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;const l=new zr(e.droppable.containers);return l.set(n,{...i,disabled:o}),{...e,droppable:{...e.droppable,containers:l}}}case En.UnregisterDroppable:{const{id:n,key:r}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const i=new zr(e.droppable.containers);return i.delete(n),{...e,droppable:{...e.droppable,containers:i}}}default:return e}}function Wr(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:o}=l(Hr),i=ln(r),a=ln(null==n?void 0:n.id);return u((()=>{if(!t&&!r&&i&&null!=a){if(!fn(i))return;if(document.activeElement===i.target)return;const e=o.get(a);if(!e)return;const{activatorNode:t,node:n}=e;if(!t.current&&!n.current)return;requestAnimationFrame((()=>{for(const e of[t.current,n.current]){if(!e)continue;const t=vn(e);if(t){t.focus();break}}}))}}),[r,t,o,a,i]),null}const qr=i({...Cn,scaleX:1,scaleY:1});var Yr;!function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"}(Yr||(Yr={}));const Xr=p((function(e){var t,n,r,i;let{id:l,accessibility:c,autoScroll:p=!0,children:g,sensors:v=Lr,collisionDetection:y=Nn,measuring:m,modifiers:b,...w}=e;const k=h(Kr,void 0,Ur),[x,O]=k,[E,S]=function(){const[e]=f((()=>new Set)),t=d((t=>(e.add(t),()=>e.delete(t))),[e]);return[d((t=>{let{type:n,event:r}=t;e.forEach((e=>{var t;return null==(t=e[n])?void 0:t.call(e,r)}))}),[e]),t]}(),[_,C]=f(Yr.Uninitialized),j=_===Yr.Initialized,{draggable:{active:D,nodes:A,translate:P},droppable:{containers:R}}=x,B=D?A.get(D):null,M=a({initial:null,translated:null}),N=s((()=>{var e;return null!=D?{id:D,data:null!=(e=null==B?void 0:B.data)?e:Ir,rect:M}:null}),[D,B]),L=a(null),[I,F]=f(null),[z,$]=f(null),H=nn(w,Object.values(w)),V=sn("DndDescribedBy",l),U=s((()=>R.getEnabled()),[R]),K=s((()=>({draggable:{...Fr.draggable,...null==W?void 0:W.draggable},droppable:{...Fr.droppable,...null==W?void 0:W.droppable},dragOverlay:{...Fr.dragOverlay,...null==W?void 0:W.dragOverlay}})),[null==(W=m)?void 0:W.draggable,null==W?void 0:W.droppable,null==W?void 0:W.dragOverlay]);var W;const{droppableRects:q,measureDroppableContainers:Y,measuringScheduled:X}=function(e,t){let{dragging:n,dependencies:r,config:o}=t;const[i,l]=f(null),{frequency:s,measure:c,strategy:p}=o,h=a(e),g=function(){switch(p){case Sr.Always:return!1;case Sr.BeforeDragging:return n;default:return!n}}(),v=nn(g),y=d((function(e){void 0===e&&(e=[]),v.current||l((t=>null===t?e:t.concat(e.filter((e=>!t.includes(e))))))}),[v]),m=a(null),b=rn((t=>{if(g&&!n)return Cr;if(!t||t===Cr||h.current!==e||null!=i){const t=new Map;for(let n of e){if(!n)continue;if(i&&i.length>0&&!i.includes(n.id)&&n.rect.current){t.set(n.id,n.rect.current);continue}const e=n.node.current,r=e?new rr(c(e),e):null;n.rect.current=r,r&&t.set(n.id,r)}return t}return t}),[e,i,n,g,c]);return u((()=>{h.current=e}),[e]),u((()=>{g||y()}),[n,g]),u((()=>{i&&i.length>0&&l(null)}),[JSON.stringify(i)]),u((()=>{g||"number"!=typeof s||null!==m.current||(m.current=setTimeout((()=>{y(),m.current=null}),s))}),[s,g,y,...r]),{droppableRects:b,measureDroppableContainers:y,measuringScheduled:null!=i}}(U,{dragging:j,dependencies:[P.x,P.y],config:K.droppable}),Z=function(e,t){const n=null!==t?e.get(t):void 0,r=n?n.node.current:null;return rn((e=>{var n;return null===t?null:null!=(n=null!=r?r:e)?n:null}),[r,t])}(A,D),J=s((()=>z?pn(z):null),[z]),G=function(){const e=!1===(null==I?void 0:I.autoScrollEnabled),t="object"==typeof p?!1===p.enabled:!1===p,n=j&&!e&&!t;if("object"==typeof p)return{...p,enabled:n};return{enabled:n}}(),Q=function(e,t){return jr(e,t)}(Z,K.draggable.measure);!function(e){let{activeNode:t,measure:n,initialRect:r,config:o=!0}=e;const i=a(!1),{x:l,y:s}="boolean"==typeof o?{x:o,y:o}:o;en((()=>{if(!l&&!s||!t)return void(i.current=!1);if(i.current||!r)return;const e=null==t?void 0:t.node.current;if(!e||!1===e.isConnected)return;const o=Ln(n(e),r);if(l||(o.x=0),s||(o.y=0),i.current=!0,Math.abs(o.x)>0||Math.abs(o.y)>0){const t=Un(e);t&&t.scrollBy({top:o.y,left:o.x})}}),[t,l,s,r,n])}({activeNode:D?A.get(D):null,config:G.layoutShiftCompensation,initialRect:Q,measure:K.draggable.measure});const ee=Pr(Z,K.draggable.measure,Q),te=Pr(Z?Z.parentElement:null),ne=a({activatorEvent:null,active:null,activeNode:Z,collisionRect:null,collisions:null,droppableRects:q,draggableNodes:A,draggingNode:null,draggingNodeRect:null,droppableContainers:R,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),re=R.getNodeFor(null==(t=ne.current.over)?void 0:t.id),oe=Nr({measure:K.dragOverlay.measure}),ie=null!=(n=oe.nodeRef.current)?n:Z,le=j?null!=(r=oe.rect)?r:ee:null,ae=Boolean(oe.nodeRef.current&&oe.rect),se=Ln(ce=ae?null:ee,jr(ce));var ce;const ue=Tr(ie?Xt(ie):null),de=function(e){const t=a(e),n=rn((n=>e?n&&n!==Rr&&e&&t.current&&e.parentNode===t.current.parentNode?n:Vn(e):Rr),[e]);return u((()=>{t.current=e}),[e]),n}(j?null!=re?re:Z:null),fe=function(e,t){void 0===t&&(t=$n);const[n]=e,r=Tr(n?Xt(n):null),[o,i]=h((function(){return e.length?e.map((e=>Zn(e)?r:new rr(t(e),e))):Mr}),Mr),l=Dr({callback:i});return e.length>0&&o===Mr&&i(),en((()=>{e.length?e.forEach((e=>null==l?void 0:l.observe(e))):(null==l||l.disconnect(),i())}),[e]),o}(de),pe=function(e,t){let{transform:n,...r}=t;return null!=e&&e.length?e.reduce(((e,t)=>t({transform:e,...r})),n):n}(b,{transform:{x:P.x-se.x,y:P.y-se.y,scaleX:1,scaleY:1},activatorEvent:z,active:N,activeNodeRect:ee,containerNodeRect:te,draggingNodeRect:le,over:ne.current.over,overlayNodeRect:oe.rect,scrollableAncestors:de,scrollableAncestorRects:fe,windowRect:ue}),he=J?un(J,P):null,ge=function(e){const[t,n]=f(null),r=a(e),o=d((e=>{const t=Kn(e.target);t&&n((e=>e?(e.set(t,Yn(t)),new Map(e)):null))}),[]);return u((()=>{const t=r.current;if(e!==t){i(t);const l=e.map((e=>{const t=Kn(e);return t?(t.addEventListener("scroll",o,{passive:!0}),[t,Yn(t)]):null})).filter((e=>null!=e));n(l.length?new Map(l):null),r.current=e}return()=>{i(e),i(t)};function i(e){e.forEach((e=>{const t=Kn(e);null==t||t.removeEventListener("scroll",o)}))}}),[o,e]),s((()=>e.length?t?Array.from(t.values()).reduce(((e,t)=>un(e,t)),Cn):tr(e):Cn),[e,t])}(de),ve=Br(ge),ye=Br(ge,[ee]),me=un(pe,ve),be=le?Fn(le,pe):null,we=N&&be?y({active:N,collisionRect:be,droppableRects:q,droppableContainers:U,pointerCoordinates:he}):null,ke=Rn(we,"id"),[xe,Oe]=f(null),Ee=function(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}(ae?pe:un(pe,ye),null!=(i=null==xe?void 0:xe.rect)?i:null,ee),Se=d(((e,t)=>{let{sensor:n,options:r}=t;if(null==L.current)return;const o=A.get(L.current);if(!o)return;const i=e.nativeEvent,l=new n({active:L.current,activeNode:o,event:i,options:r,context:ne,onStart(e){const t=L.current;if(null==t)return;const n=A.get(t);if(!n)return;const{onDragStart:r}=H.current,o={active:{id:t,data:n.data,rect:M}};T((()=>{null==r||r(o),C(Yr.Initializing),O({type:En.DragStart,initialCoordinates:e,active:t}),E({type:"onDragStart",event:o})}))},onMove(e){O({type:En.DragMove,coordinates:e})},onEnd:a(En.DragEnd),onCancel:a(En.DragCancel)});function a(e){return async function(){const{active:t,collisions:n,over:r,scrollAdjustedTranslate:o}=ne.current;let l=null;if(t&&o){const{cancelDrop:a}=H.current;if(l={activatorEvent:i,active:t,collisions:n,delta:o,over:r},e===En.DragEnd&&"function"==typeof a){await Promise.resolve(a(l))&&(e=En.DragCancel)}}L.current=null,T((()=>{O({type:e}),C(Yr.Uninitialized),Oe(null),F(null),$(null);const t=e===En.DragEnd?"onDragEnd":"onDragCancel";if(l){const e=H.current[t];null==e||e(l),E({type:t,event:l})}}))}}T((()=>{F(l),$(e.nativeEvent)}))}),[A]),_e=d(((e,t)=>(n,r)=>{const o=n.nativeEvent,i=A.get(r);if(null!==L.current||!i||o.dndKit||o.defaultPrevented)return;const l={active:i};!0===e(n,t.options,l)&&(o.dndKit={capturedBy:t.sensor},L.current=r,Se(n,t))}),[A,Se]),Ce=function(e,t){return s((()=>e.reduce(((e,n)=>{const{sensor:r}=n;return[...e,...r.activators.map((e=>({eventName:e.eventName,handler:t(e.handler,n)})))]}),[])),[e,t])}(v,_e);!function(e){u((()=>{if(!Wt)return;const t=e.map((e=>{let{sensor:t}=e;return null==t.setup?void 0:t.setup()}));return()=>{for(const e of t)null==e||e()}}),e.map((e=>{let{sensor:t}=e;return t})))}(v),en((()=>{ee&&_===Yr.Initializing&&C(Yr.Initialized)}),[ee,_]),u((()=>{const{onDragMove:e}=H.current,{active:t,activatorEvent:n,collisions:r,over:o}=ne.current;if(!t||!n)return;const i={active:t,activatorEvent:n,collisions:r,delta:{x:me.x,y:me.y},over:o};T((()=>{null==e||e(i),E({type:"onDragMove",event:i})}))}),[me.x,me.y]),u((()=>{const{active:e,activatorEvent:t,collisions:n,droppableContainers:r,scrollAdjustedTranslate:o}=ne.current;if(!e||null==L.current||!t||!o)return;const{onDragOver:i}=H.current,l=r.get(ke),a=l&&l.rect.current?{id:l.id,rect:l.rect.current,data:l.data,disabled:l.disabled}:null,s={active:e,activatorEvent:t,collisions:n,delta:{x:o.x,y:o.y},over:a};T((()=>{Oe(a),null==i||i(s),E({type:"onDragOver",event:s})}))}),[ke]),en((()=>{ne.current={activatorEvent:z,active:N,activeNode:Z,collisionRect:be,collisions:we,droppableRects:q,draggableNodes:A,draggingNode:ie,draggingNodeRect:le,droppableContainers:R,over:xe,scrollableAncestors:de,scrollAdjustedTranslate:me},M.current={initial:le,translated:be}}),[N,Z,we,be,A,ie,le,q,R,xe,de,me]),Or({...G,delta:P,draggingRect:be,pointerCoordinates:he,scrollableAncestors:de,scrollableAncestorRects:fe});const je=s((()=>({active:N,activeNode:Z,activeNodeRect:ee,activatorEvent:z,collisions:we,containerNodeRect:te,dragOverlay:oe,draggableNodes:A,droppableContainers:R,droppableRects:q,over:xe,measureDroppableContainers:Y,scrollableAncestors:de,scrollableAncestorRects:fe,measuringConfiguration:K,measuringScheduled:X,windowRect:ue})),[N,Z,ee,z,we,te,oe,A,R,q,xe,Y,de,fe,K,X,ue]),De=s((()=>({activatorEvent:z,activators:Ce,active:N,activeNodeRect:ee,ariaDescribedById:{draggable:V},dispatch:O,draggableNodes:A,over:xe,measureDroppableContainers:Y})),[z,Ce,N,ee,O,V,A,xe,Y]);return o.createElement(wn.Provider,{value:S},o.createElement(Hr.Provider,{value:De},o.createElement(Vr.Provider,{value:je},o.createElement(qr.Provider,{value:Ee},g)),o.createElement(Wr,{disabled:!1===(null==c?void 0:c.restoreFocus)})),o.createElement(On,{...c,hiddenTextDescribedById:V}))})),Zr=i(null),Jr="button",Gr="Droppable";function Qr(e){let{id:t,data:n,disabled:r=!1,attributes:o}=e;const i=sn(Gr),{activators:a,activatorEvent:c,active:u,activeNodeRect:d,ariaDescribedById:f,draggableNodes:p,over:h}=l(Hr),{role:g=Jr,roleDescription:v="draggable",tabIndex:y=0}=null!=o?o:{},m=(null==u?void 0:u.id)===t,b=l(m?qr:Zr),[w,k]=on(),[x,O]=on(),E=function(e,t){return s((()=>e.reduce(((e,n)=>{let{eventName:r,handler:o}=n;return e[r]=e=>{o(e,t)},e}),{})),[e,t])}(a,t),S=nn(n);en((()=>(p.set(t,{id:t,key:i,node:w,activatorNode:x,data:S}),()=>{const e=p.get(t);e&&e.key===i&&p.delete(t)})),[p,t]);return{active:u,activatorEvent:c,activeNodeRect:d,attributes:s((()=>({role:g,tabIndex:y,"aria-disabled":r,"aria-pressed":!(!m||g!==Jr)||void 0,"aria-roledescription":v,"aria-describedby":f.draggable})),[r,g,y,m,v,f.draggable]),isDragging:m,listeners:r?void 0:E,node:w,over:h,setNodeRef:k,setActivatorNodeRef:O,transform:b}}const eo="Droppable",to={timeout:25};function no(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function ro(e,t){return e.reduce(((e,n,r)=>{const o=t.get(n);return o&&(e[r]=o),e}),Array(e.length))}function oo(e){return null!==e&&e>=0}const io=e=>{let{rects:t,activeIndex:n,overIndex:r,index:o}=e;const i=no(t,r,n),l=t[o],a=i[o];return a&&l?{x:a.left-l.left,y:a.top-l.top,scaleX:a.width/l.width,scaleY:a.height/l.height}:null},lo={scaleX:1,scaleY:1},ao=e=>{var t;let{activeIndex:n,activeNodeRect:r,index:o,rects:i,overIndex:l}=e;const a=null!=(t=i[n])?t:r;if(!a)return null;if(o===n){const e=i[l];return e?{x:0,y:n<l?e.top+e.height-(a.top+a.height):e.top-a.top,...lo}:null}const s=function(e,t,n){const r=e[t],o=e[t-1],i=e[t+1];if(!r)return 0;if(n<t)return o?r.top-(o.top+o.height):i?i.top-(r.top+r.height):0;return i?i.top-(r.top+r.height):o?r.top-(o.top+o.height):0}(i,o,n);return o>n&&o<=l?{x:0,y:-a.height-s,...lo}:o<n&&o>=l?{x:0,y:a.height+s,...lo}:{x:0,y:0,...lo}};const so="Sortable",co=o.createContext({activeIndex:-1,containerId:so,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:io,disabled:{draggable:!1,droppable:!1}});function uo(e){let{children:t,id:n,items:r,strategy:i=io,disabled:c=!1}=e;const{active:d,dragOverlay:f,droppableRects:p,over:h,measureDroppableContainers:g}=l(Vr),v=sn(so,n),y=Boolean(null!==f.rect),m=s((()=>r.map((e=>"object"==typeof e&&"id"in e?e.id:e))),[r]),b=null!=d,w=d?m.indexOf(d.id):-1,k=h?m.indexOf(h.id):-1,x=a(m),O=!function(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}(m,x.current),E=-1!==k&&-1===w||O,S=function(e){return"boolean"==typeof e?{draggable:e,droppable:e}:e}(c);en((()=>{O&&b&&g(m)}),[O,m,b,g]),u((()=>{x.current=m}),[m]);const _=s((()=>({activeIndex:w,containerId:v,disabled:S,disableTransforms:E,items:m,overIndex:k,useDragOverlay:y,sortedRects:ro(m,p),strategy:i})),[w,v,S.draggable,S.droppable,E,m,k,p,y,i]);return o.createElement(co.Provider,{value:_},t)}const fo=e=>{let{id:t,items:n,activeIndex:r,overIndex:o}=e;return no(n,r,o).indexOf(t)},po=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:o,items:i,newIndex:l,previousItems:a,previousContainerId:s,transition:c}=e;return!(!c||!r)&&((a===i||o!==l)&&(!!n||l!==o&&t===s))},ho={duration:200,easing:"ease"},go="transform",vo=hn.Transition.toString({property:go,duration:0,easing:"linear"}),yo={roleDescription:"sortable"};function mo(e){let{animateLayoutChanges:t=po,attributes:n,disabled:r,data:o,getNewIndex:i=fo,id:c,strategy:p,resizeObserverConfig:h,transition:g=ho}=e;const{items:v,containerId:y,activeIndex:m,disabled:b,disableTransforms:w,sortedRects:k,overIndex:x,useDragOverlay:O,strategy:E}=l(co),S=function(e,t){var n,r;if("boolean"==typeof e)return{draggable:e,droppable:!1};return{draggable:null!=(n=null==e?void 0:e.draggable)?n:t.draggable,droppable:null!=(r=null==e?void 0:e.droppable)?r:t.droppable}}(r,b),_=v.indexOf(c),C=s((()=>({sortable:{containerId:y,index:_,items:v},...o})),[y,o,_,v]),j=s((()=>v.slice(v.indexOf(c))),[v,c]),{rect:D,node:A,isOver:P,setNodeRef:R}=function(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:o}=e;const i=sn(eo),{active:s,dispatch:c,over:f,measureDroppableContainers:p}=l(Hr),h=a({disabled:n}),g=a(!1),v=a(null),y=a(null),{disabled:m,updateMeasurementsFor:b,timeout:w}={...to,...o},k=nn(null!=b?b:r),x=Dr({callback:d((()=>{g.current?(null!=y.current&&clearTimeout(y.current),y.current=setTimeout((()=>{p(Array.isArray(k.current)?k.current:[k.current]),y.current=null}),w)):g.current=!0}),[w]),disabled:m||!s}),O=d(((e,t)=>{x&&(t&&(x.unobserve(t),g.current=!1),e&&x.observe(e))}),[x]),[E,S]=on(O),_=nn(t);return u((()=>{x&&E.current&&(x.disconnect(),g.current=!1,x.observe(E.current))}),[E,x]),en((()=>(c({type:En.RegisterDroppable,element:{id:r,key:i,disabled:n,node:E,rect:v,data:_}}),()=>c({type:En.UnregisterDroppable,key:i,id:r}))),[r]),u((()=>{n!==h.current.disabled&&(c({type:En.SetDroppableDisabled,id:r,key:i,disabled:n}),h.current.disabled=n)}),[r,i,n,c]),{active:s,rect:v,isOver:(null==f?void 0:f.id)===r,node:E,over:f,setNodeRef:S}}({id:c,data:C,disabled:S.droppable,resizeObserverConfig:{updateMeasurementsFor:j,...h}}),{active:B,activatorEvent:T,activeNodeRect:M,attributes:N,setNodeRef:L,listeners:I,isDragging:F,over:z,setActivatorNodeRef:$,transform:H}=Qr({id:c,data:C,attributes:{...yo,...n},disabled:S.draggable}),V=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return s((()=>e=>{t.forEach((t=>t(e)))}),t)}(R,L),U=Boolean(B),K=U&&!w&&oo(m)&&oo(x),W=!O&&F,q=W&&K?H:null,Y=K?null!=q?q:(null!=p?p:E)({rects:k,activeNodeRect:M,activeIndex:m,overIndex:x,index:_}):null,X=oo(m)&&oo(x)?i({id:c,items:v,activeIndex:m,overIndex:x}):_,Z=null==B?void 0:B.id,J=a({activeId:Z,items:v,newIndex:X,containerId:y}),G=v!==J.current.items,Q=t({active:B,containerId:y,isDragging:F,isSorting:U,id:c,index:_,items:v,newIndex:J.current.newIndex,previousItems:J.current.items,previousContainerId:J.current.containerId,transition:g,wasDragging:null!=J.current.activeId}),ee=function(e){let{disabled:t,index:n,node:r,rect:o}=e;const[i,l]=f(null),s=a(n);return en((()=>{if(!t&&n!==s.current&&r.current){const e=o.current;if(e){const t=$n(r.current,{ignoreTransform:!0}),n={x:e.left-t.left,y:e.top-t.top,scaleX:e.width/t.width,scaleY:e.height/t.height};(n.x||n.y)&&l(n)}}n!==s.current&&(s.current=n)}),[t,n,r,o]),u((()=>{i&&l(null)}),[i]),i}({disabled:!Q,index:_,node:A,rect:D});return u((()=>{U&&J.current.newIndex!==X&&(J.current.newIndex=X),y!==J.current.containerId&&(J.current.containerId=y),v!==J.current.items&&(J.current.items=v)}),[U,X,y,v]),u((()=>{if(Z===J.current.activeId)return;if(Z&&!J.current.activeId)return void(J.current.activeId=Z);const e=setTimeout((()=>{J.current.activeId=Z}),50);return()=>clearTimeout(e)}),[Z]),{active:B,activeIndex:m,attributes:N,data:C,rect:D,index:_,newIndex:X,items:v,isOver:P,isSorting:U,isDragging:F,listeners:I,node:A,overIndex:x,over:z,setNodeRef:V,setActivatorNodeRef:$,setDroppableNodeRef:R,setDraggableNodeRef:L,transform:null!=ee?ee:Y,transition:function(){if(ee||G&&J.current.newIndex===_)return vo;if(W&&!fn(T)||!g)return;if(U||Q)return hn.Transition.toString({...g,property:go});return}()}}function bo(e){if(!e)return!1;const t=e.data.current;return!!(t&&"sortable"in t&&"object"==typeof t.sortable&&"containerId"in t.sortable&&"items"in t.sortable&&"index"in t.sortable)}const wo=[ar.Down,ar.Right,ar.Up,ar.Left],ko=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:o,droppableContainers:i,over:l,scrollableAncestors:a}}=t;if(wo.includes(e.code)){if(e.preventDefault(),!n||!r)return;const t=[];i.getEnabled().forEach((n=>{if(!n||null!=n&&n.disabled)return;const i=o.get(n.id);if(i)switch(e.code){case ar.Down:r.top<i.top&&t.push(n);break;case ar.Up:r.top>i.top&&t.push(n);break;case ar.Left:r.left>i.left&&t.push(n);break;case ar.Right:r.left<i.left&&t.push(n)}}));const s=(e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=Pn(t),i=[];for(const e of r){const{id:t}=e,r=n.get(t);if(r){const n=Pn(r),l=o.reduce(((e,t,r)=>e+jn(n[r],t)),0),a=Number((l/4).toFixed(4));i.push({id:t,data:{droppableContainer:e,value:a}})}}return i.sort(Dn)})({active:n,collisionRect:r,droppableRects:o,droppableContainers:t,pointerCoordinates:null});let c=Rn(s,"id");if(c===(null==l?void 0:l.id)&&s.length>1&&(c=s[1].id),null!=c){const e=i.get(n.id),t=i.get(c),l=t?o.get(t.id):null,s=null==t?void 0:t.node.current;if(s&&l&&e&&t){const n=Vn(s).some(((e,t)=>a[t]!==e)),o=xo(e,t),i=function(e,t){if(!bo(e)||!bo(t))return!1;if(!xo(e,t))return!1;return e.data.current.sortable.index<t.data.current.sortable.index}(e,t),c=n||!o?{x:0,y:0}:{x:i?r.width-l.width:0,y:i?r.height-l.height:0},u={x:l.left,y:l.top};return c.x&&c.y?u:dn(u,c)}}}};function xo(e,t){return!(!bo(e)||!bo(t))&&e.data.current.sortable.containerId===t.data.current.sortable.containerId}const Oo=i(void 0),Eo=({children:r,tools:o})=>{const i=Vt(),l=s((()=>o?Object.keys(o).reduce(((e,t)=>{var n;return Object.assign(Object.assign({},e),{[t]:null===(n=o[t])||void 0===n?void 0:n.render})}),{}):{}),[o]),a=s((()=>!o||i?null:Object.keys(o).map((t=>{var n,r,i;const l=null===(n=null==o?void 0:o[t])||void 0===n?void 0:n.tool,a=null===(r=null==o?void 0:o[t])||void 0===r?void 0:r.render,s=null===(i=null==o?void 0:o[t])||void 0===i?void 0:i.props;return l?e(l,Object.assign({render:a},s),t):null}))),[o]);return e(Oo.Provider,Object.assign({value:l},{children:t(n,{children:[a,r]})}))},So=()=>{const e=l(Oo);if(void 0===e)throw new Error("useYooptaTools must be used within a ToolsProvider");return e};function _o(e){return Do(e)?(e.nodeName||"").toLowerCase():"#document"}function Co(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function jo(e){var t;return null==(t=(Do(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function Do(e){return e instanceof Node||e instanceof Co(e).Node}function Ao(e){return e instanceof Element||e instanceof Co(e).Element}function Po(e){return e instanceof HTMLElement||e instanceof Co(e).HTMLElement}function Ro(e){return"undefined"!=typeof ShadowRoot&&(e instanceof ShadowRoot||e instanceof Co(e).ShadowRoot)}function Bo(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=Io(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function To(e){return["table","td","th"].includes(_o(e))}function Mo(e){const t=No(),n=Io(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 No(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}function Lo(e){return["html","body","#document"].includes(_o(e))}function Io(e){return Co(e).getComputedStyle(e)}function Fo(e){return Ao(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function zo(e){if("html"===_o(e))return e;const t=e.assignedSlot||e.parentNode||Ro(e)&&e.host||jo(e);return Ro(t)?t.host:t}function $o(e){const t=zo(e);return Lo(t)?e.ownerDocument?e.ownerDocument.body:e.body:Po(t)&&Bo(t)?t:$o(t)}function Ho(e,t,n){var r;void 0===t&&(t=[]),void 0===n&&(n=!0);const o=$o(e),i=o===(null==(r=e.ownerDocument)?void 0:r.body),l=Co(o);return i?t.concat(l,l.visualViewport||[],Bo(o)?o:[],l.frameElement&&n?Ho(l.frameElement):[]):t.concat(o,Ho(o,[],n))}const Vo=Math.min,Uo=Math.max,Ko=Math.round,Wo=Math.floor,qo=e=>({x:e,y:e}),Yo={left:"right",right:"left",bottom:"top",top:"bottom"},Xo={start:"end",end:"start"};function Zo(e,t,n){return Uo(e,Vo(t,n))}function Jo(e,t){return"function"==typeof e?e(t):e}function Go(e){return e.split("-")[0]}function Qo(e){return e.split("-")[1]}function ei(e){return"x"===e?"y":"x"}function ti(e){return"y"===e?"height":"width"}function ni(e){return["top","bottom"].includes(Go(e))?"y":"x"}function ri(e){return ei(ni(e))}function oi(e){return e.replace(/start|end/g,(e=>Xo[e]))}function ii(e){return e.replace(/left|right|bottom|top/g,(e=>Yo[e]))}function li(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 ai(e){return{...e,top:e.y,left:e.x,right:e.x+e.width,bottom:e.y+e.height}}function si(e,t,n){let{reference:r,floating:o}=e;const i=ni(t),l=ri(t),a=ti(l),s=Go(t),c="y"===i,u=r.x+r.width/2-o.width/2,d=r.y+r.height/2-o.height/2,f=r[a]/2-o[a]/2;let p;switch(s){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:d};break;case"left":p={x:r.x-o.width,y:d};break;default:p={x:r.x,y:r.y}}switch(Qo(t)){case"start":p[l]-=f*(n&&c?-1:1);break;case"end":p[l]+=f*(n&&c?-1:1)}return p}async function ci(e,t){var n;void 0===t&&(t={});const{x:r,y:o,platform:i,rects:l,elements:a,strategy:s}=e,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:d="floating",altBoundary:f=!1,padding:p=0}=Jo(t,e),h=li(p),g=a[f?"floating"===d?"reference":"floating":d],v=ai(await i.getClippingRect({element:null==(n=await(null==i.isElement?void 0:i.isElement(g)))||n?g:g.contextElement||await(null==i.getDocumentElement?void 0:i.getDocumentElement(a.floating)),boundary:c,rootBoundary:u,strategy:s})),y="floating"===d?{...l.floating,x:r,y:o}:l.reference,m=await(null==i.getOffsetParent?void 0:i.getOffsetParent(a.floating)),b=await(null==i.isElement?void 0:i.isElement(m))&&await(null==i.getScale?void 0:i.getScale(m))||{x:1,y:1},w=ai(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:y,offsetParent:m,strategy:s}):y);return{top:(v.top-w.top+h.top)/b.y,bottom:(w.bottom-v.bottom+h.bottom)/b.y,left:(v.left-w.left+h.left)/b.x,right:(w.right-v.right+h.right)/b.x}}function ui(e){const t=Vo(...e.map((e=>e.left))),n=Vo(...e.map((e=>e.top)));return{x:t,y:n,width:Uo(...e.map((e=>e.right)))-t,height:Uo(...e.map((e=>e.bottom)))-n}}const di=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:i,placement:l,middlewareData:a}=t,s=await async function(e,t){const{placement:n,platform:r,elements:o}=e,i=await(null==r.isRTL?void 0:r.isRTL(o.floating)),l=Go(n),a=Qo(n),s="y"===ni(n),c=["left","top"].includes(l)?-1:1,u=i&&s?-1:1,d=Jo(t,e);let{mainAxis:f,crossAxis:p,alignmentAxis:h}="number"==typeof d?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...d};return a&&"number"==typeof h&&(p="end"===a?-1*h:h),s?{x:p*u,y:f*c}:{x:f*c,y:p*u}}(t,e);return l===(null==(n=a.offset)?void 0:n.placement)&&null!=(r=a.arrow)&&r.alignmentOffset?{}:{x:o+s.x,y:i+s.y,data:{...s,placement:l}}}}};function fi(e){const t=Io(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=Po(e),i=o?e.offsetWidth:n,l=o?e.offsetHeight:r,a=Ko(n)!==i||Ko(r)!==l;return a&&(n=i,r=l),{width:n,height:r,$:a}}function pi(e){return Ao(e)?e:e.contextElement}function hi(e){const t=pi(e);if(!Po(t))return qo(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=fi(t);let l=(i?Ko(n.width):n.width)/r,a=(i?Ko(n.height):n.height)/o;return l&&Number.isFinite(l)||(l=1),a&&Number.isFinite(a)||(a=1),{x:l,y:a}}const gi=qo(0);function vi(e){const t=Co(e);return No()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:gi}function yi(e,t,n,r){void 0===t&&(t=!1),void 0===n&&(n=!1);const o=e.getBoundingClientRect(),i=pi(e);let l=qo(1);t&&(r?Ao(r)&&(l=hi(r)):l=hi(e));const a=function(e,t,n){return void 0===t&&(t=!1),!(!n||t&&n!==Co(e))&&t}(i,n,r)?vi(i):qo(0);let s=(o.left+a.x)/l.x,c=(o.top+a.y)/l.y,u=o.width/l.x,d=o.height/l.y;if(i){const e=Co(i),t=r&&Ao(r)?Co(r):r;let n=e,o=n.frameElement;for(;o&&r&&t!==n;){const e=hi(o),t=o.getBoundingClientRect(),r=Io(o),i=t.left+(o.clientLeft+parseFloat(r.paddingLeft))*e.x,l=t.top+(o.clientTop+parseFloat(r.paddingTop))*e.y;s*=e.x,c*=e.y,u*=e.x,d*=e.y,s+=i,c+=l,n=Co(o),o=n.frameElement}}return ai({width:u,height:d,x:s,y:c})}const mi=[":popover-open",":modal"];function bi(e){return mi.some((t=>{try{return e.matches(t)}catch(e){return!1}}))}function wi(e){return yi(jo(e)).left+Fo(e).scrollLeft}function ki(e,t,n){let r;if("viewport"===t)r=function(e,t){const n=Co(e),r=jo(e),o=n.visualViewport;let i=r.clientWidth,l=r.clientHeight,a=0,s=0;if(o){i=o.width,l=o.height;const e=No();(!e||e&&"fixed"===t)&&(a=o.offsetLeft,s=o.offsetTop)}return{width:i,height:l,x:a,y:s}}(e,n);else if("document"===t)r=function(e){const t=jo(e),n=Fo(e),r=e.ownerDocument.body,o=Uo(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=Uo(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let l=-n.scrollLeft+wi(e);const a=-n.scrollTop;return"rtl"===Io(r).direction&&(l+=Uo(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:l,y:a}}(jo(e));else if(Ao(t))r=function(e,t){const n=yi(e,!0,"fixed"===t),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=Po(e)?hi(e):qo(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=vi(e);r={...t,x:t.x-n.x,y:t.y-n.y}}return ai(r)}function xi(e,t){const n=zo(e);return!(n===t||!Ao(n)||Lo(n))&&("fixed"===Io(n).position||xi(n,t))}function Oi(e,t,n){const r=Po(t),o=jo(t),i="fixed"===n,l=yi(e,!0,i,t);let a={scrollLeft:0,scrollTop:0};const s=qo(0);if(r||!r&&!i)if(("body"!==_o(t)||Bo(o))&&(a=Fo(t)),r){const e=yi(t,!0,i,t);s.x=e.x+t.clientLeft,s.y=e.y+t.clientTop}else o&&(s.x=wi(o));return{x:l.left+a.scrollLeft-s.x,y:l.top+a.scrollTop-s.y,width:l.width,height:l.height}}function Ei(e,t){return Po(e)&&"fixed"!==Io(e).position?t?t(e):e.offsetParent:null}function Si(e,t){const n=Co(e);if(!Po(e)||bi(e))return n;let r=Ei(e,t);for(;r&&To(r)&&"static"===Io(r).position;)r=Ei(r,t);return r&&("html"===_o(r)||"body"===_o(r)&&"static"===Io(r).position&&!Mo(r))?n:r||function(e){let t=zo(e);for(;Po(t)&&!Lo(t);){if(Mo(t))return t;t=zo(t)}return null}(e)||n}const _i={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i="fixed"===o,l=jo(r),a=!!t&&bi(t.floating);if(r===l||a&&i)return n;let s={scrollLeft:0,scrollTop:0},c=qo(1);const u=qo(0),d=Po(r);if((d||!d&&!i)&&(("body"!==_o(r)||Bo(l))&&(s=Fo(r)),Po(r))){const e=yi(r);c=hi(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-s.scrollLeft*c.x+u.x,y:n.y*c.y-s.scrollTop*c.y+u.y}},getDocumentElement:jo,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=Ho(e,[],!1).filter((e=>Ao(e)&&"body"!==_o(e))),o=null;const i="fixed"===Io(e).position;let l=i?zo(e):e;for(;Ao(l)&&!Lo(l);){const t=Io(l),n=Mo(l);n||"fixed"!==t.position||(o=null),(i?!n&&!o:!n&&"static"===t.position&&o&&["absolute","fixed"].includes(o.position)||Bo(l)&&!n&&xi(e,l))?r=r.filter((e=>e!==l)):o=t,l=zo(l)}return t.set(e,r),r}(t,this._c):[].concat(n),r],l=i[0],a=i.reduce(((e,n)=>{const r=ki(t,n,o);return e.top=Uo(r.top,e.top),e.right=Vo(r.right,e.right),e.bottom=Vo(r.bottom,e.bottom),e.left=Uo(r.left,e.left),e}),ki(t,l,o));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}},getOffsetParent:Si,getElementRects:async function(e){const t=this.getOffsetParent||Si,n=this.getDimensions;return{reference:Oi(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}=fi(e);return{width:t,height:n}},getScale:hi,isElement:Ao,isRTL:function(e){return"rtl"===Io(e).direction}};function Ci(e,t,n,r){void 0===r&&(r={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:l="function"==typeof ResizeObserver,layoutShift:a="function"==typeof IntersectionObserver,animationFrame:s=!1}=r,c=pi(e),u=o||i?[...c?Ho(c):[],...Ho(t)]:[];u.forEach((e=>{o&&e.addEventListener("scroll",n,{passive:!0}),i&&e.addEventListener("resize",n)}));const d=c&&a?function(e,t){let n,r=null;const o=jo(e);function i(){var e;clearTimeout(n),null==(e=r)||e.disconnect(),r=null}return function l(a,s){void 0===a&&(a=!1),void 0===s&&(s=1),i();const{left:c,top:u,width:d,height:f}=e.getBoundingClientRect();if(a||t(),!d||!f)return;const p={rootMargin:-Wo(u)+"px "+-Wo(o.clientWidth-(c+d))+"px "+-Wo(o.clientHeight-(u+f))+"px "+-Wo(c)+"px",threshold:Uo(0,Vo(1,s))||1};let h=!0;function g(e){const t=e[0].intersectionRatio;if(t!==s){if(!h)return l();t?l(!1,t):n=setTimeout((()=>{l(!1,1e-7)}),100)}h=!1}try{r=new IntersectionObserver(g,{...p,root:o.ownerDocument})}catch(e){r=new IntersectionObserver(g,p)}r.observe(e)}(!0),i}(c,n):null;let f,p=-1,h=null;l&&(h=new ResizeObserver((e=>{let[r]=e;r&&r.target===c&&h&&(h.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame((()=>{var e;null==(e=h)||e.observe(t)}))),n()})),c&&!s&&h.observe(c),h.observe(t));let g=s?yi(e):null;return s&&function t(){const r=yi(e);!g||r.x===g.x&&r.y===g.y&&r.width===g.width&&r.height===g.height||n();g=r,f=requestAnimationFrame(t)}(),n(),()=>{var e;u.forEach((e=>{o&&e.removeEventListener("scroll",n),i&&e.removeEventListener("resize",n)})),null==d||d(),null==(e=h)||e.disconnect(),h=null,s&&cancelAnimationFrame(f)}}const ji=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:l=!1,limiter:a={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...s}=Jo(e,t),c={x:n,y:r},u=await ci(t,s),d=ni(Go(o)),f=ei(d);let p=c[f],h=c[d];if(i){const e="y"===f?"bottom":"right";p=Zo(p+u["y"===f?"top":"left"],p,p-u[e])}if(l){const e="y"===d?"bottom":"right";h=Zo(h+u["y"===d?"top":"left"],h,h-u[e])}const g=a.fn({...t,[f]:p,[d]:h});return{...g,data:{x:g.x-n,y:g.y-r}}}}},Di=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:i,rects:l,initialPlacement:a,platform:s,elements:c}=t,{mainAxis:u=!0,crossAxis:d=!0,fallbackPlacements:f,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:h="none",flipAlignment:g=!0,...v}=Jo(e,t);if(null!=(n=i.arrow)&&n.alignmentOffset)return{};const y=Go(o),m=Go(a)===a,b=await(null==s.isRTL?void 0:s.isRTL(c.floating)),w=f||(m||!g?[ii(a)]:function(e){const t=ii(e);return[oi(e),t,oi(t)]}(a));f||"none"===h||w.push(...function(e,t,n,r){const o=Qo(e);let i=function(e,t,n){const r=["left","right"],o=["right","left"],i=["top","bottom"],l=["bottom","top"];switch(e){case"top":case"bottom":return n?t?o:r:t?r:o;case"left":case"right":return t?i:l;default:return[]}}(Go(e),"start"===n,r);return o&&(i=i.map((e=>e+"-"+o)),t&&(i=i.concat(i.map(oi)))),i}(a,g,h,b));const k=[a,...w],x=await ci(t,v),O=[];let E=(null==(r=i.flip)?void 0:r.overflows)||[];if(u&&O.push(x[y]),d){const e=function(e,t,n){void 0===n&&(n=!1);const r=Qo(e),o=ri(e),i=ti(o);let l="x"===o?r===(n?"end":"start")?"right":"left":"start"===r?"bottom":"top";return t.reference[i]>t.floating[i]&&(l=ii(l)),[l,ii(l)]}(o,l,b);O.push(x[e[0]],x[e[1]])}if(E=[...E,{placement:o,overflows:O}],!O.every((e=>e<=0))){var S,_;const e=((null==(S=i.flip)?void 0:S.index)||0)+1,t=k[e];if(t)return{data:{index:e,overflows:E},reset:{placement:t}};let n=null==(_=E.filter((e=>e.overflows[0]<=0)).sort(((e,t)=>e.overflows[1]-t.overflows[1]))[0])?void 0:_.placement;if(!n)switch(p){case"bestFit":{var C;const e=null==(C=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:C[0];e&&(n=e);break}case"initialPlacement":n=a}if(o!==n)return{reset:{placement:n}}}return{}}}},Ai=function(e){return void 0===e&&(e={}),{name:"inline",options:e,async fn(t){const{placement:n,elements:r,rects:o,platform:i,strategy:l}=t,{padding:a=2,x:s,y:c}=Jo(e,t),u=Array.from(await(null==i.getClientRects?void 0:i.getClientRects(r.reference))||[]),d=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=>ai(ui(e))))}(u),f=ai(ui(u)),p=li(a);const h=await i.getElementRects({reference:{getBoundingClientRect:function(){if(2===d.length&&d[0].left>d[1].right&&null!=s&&null!=c)return d.find((e=>s>e.left-p.left&&s<e.right+p.right&&c>e.top-p.top&&c<e.bottom+p.bottom))||f;if(d.length>=2){if("y"===ni(n)){const e=d[0],t=d[d.length-1],r="top"===Go(n),o=e.top,i=t.bottom,l=r?e.left:t.left,a=r?e.right:t.right;return{top:o,bottom:i,left:l,right:a,width:a-l,height:i-o,x:l,y:o}}const e="left"===Go(n),t=Uo(...d.map((e=>e.right))),r=Vo(...d.map((e=>e.left))),o=d.filter((n=>e?n.left===r:n.right===t)),i=o[0].top,l=o[o.length-1].bottom;return{top:i,bottom:l,left:r,right:t,width:t-r,height:l-i,x:r,y:i}}return f}},floating:r.floating,strategy:l});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}}:{}}}},Pi=(e,t,n)=>{const r=new Map,o={platform:_i,...n},i={...o.platform,_c:r};return(async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:l}=n,a=i.filter(Boolean),s=await(null==l.isRTL?void 0:l.isRTL(t));let c=await l.getElementRects({reference:e,floating:t,strategy:o}),{x:u,y:d}=si(c,r,s),f=r,p={},h=0;for(let n=0;n<a.length;n++){const{name:i,fn:g}=a[n],{x:v,y:y,data:m,reset:b}=await g({x:u,y:d,initialPlacement:r,placement:f,strategy:o,middlewareData:p,rects:c,platform:l,elements:{reference:e,floating:t}});u=null!=v?v:u,d=null!=y?y:d,p={...p,[i]:{...p[i],...m}},b&&h<=50&&(h++,"object"==typeof b&&(b.placement&&(f=b.placement),b.rects&&(c=!0===b.rects?await l.getElementRects({reference:e,floating:t,strategy:o}):b.rects),({x:u,y:d}=si(c,f,s))),n=-1)}return{x:u,y:d,placement:f,strategy:o,middlewareData:p}})(e,t,{...o,platform:i})};var Ri="undefined"!=typeof document?c:u;function Bi(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(!Bi(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)&&!Bi(e[n],t[n]))return!1}return!0}return e!=e&&t!=t}function Ti(e){if("undefined"==typeof window)return 1;return(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Mi(e,t){const n=Ti(e);return Math.round(t*n)/n}function Ni(e){const t=r.useRef(e);return Ri((()=>{t.current=e})),t}
|
|
2
2
|
/*!
|
|
3
3
|
* tabbable 6.2.0
|
|
4
4
|
* @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
|
|
5
5
|
*/
|
|
6
|
-
var $i=["input:not([inert])","select:not([inert])","textarea:not([inert])","a[href]:not([inert])","button:not([inert])","[tabindex]:not(slot):not([inert])","audio[controls]:not([inert])","video[controls]:not([inert])",'[contenteditable]:not([contenteditable="false"]):not([inert])',"details>summary:first-of-type:not([inert])","details:not([inert])"].join(","),Hi="undefined"==typeof Element,Vi=Hi?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Ui=!Hi&&Element.prototype.getRootNode?function(e){var t;return null==e||null===(t=e.getRootNode)||void 0===t?void 0:t.call(e)}:function(e){return null==e?void 0:e.ownerDocument},Ki=function e(t,n){var r;void 0===n&&(n=!0);var o=null==t||null===(r=t.getAttribute)||void 0===r?void 0:r.call(t,"inert");return""===o||"true"===o||n&&t&&e(t.parentNode)},Wi=function e(t,n,r){for(var o=[],i=Array.from(t);i.length;){var l=i.shift();if(!Ki(l,!1))if("SLOT"===l.tagName){var a=l.assignedElements(),s=e(a.length?a:l.children,!0,r);r.flatten?o.push.apply(o,s):o.push({scopeParent:l,candidates:s})}else{Vi.call(l,$i)&&r.filter(l)&&(n||!t.includes(l))&&o.push(l);var c=l.shadowRoot||"function"==typeof r.getShadowRoot&&r.getShadowRoot(l),u=!Ki(c,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(l));if(c&&u){var d=e(!0===c?l.children:c.children,!0,r);r.flatten?o.push.apply(o,d):o.push({scopeParent:l,candidates:d})}else i.unshift.apply(i,l.children)}}return o},qi=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},Yi=function(e){if(!e)throw new Error("No node provided");return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||function(e){var t,n=null==e||null===(t=e.getAttribute)||void 0===t?void 0:t.call(e,"contenteditable");return""===n||"true"===n}(e))&&!qi(e)?0:e.tabIndex},Xi=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},Zi=function(e){return"INPUT"===e.tagName},Ji=function(e){return function(e){return Zi(e)&&"radio"===e.type}(e)&&!function(e){if(!e.name)return!0;var t,n=e.form||Ui(e),r=function(e){return n.querySelectorAll('input[type="radio"][name="'+e+'"]')};if("undefined"!=typeof window&&void 0!==window.CSS&&"function"==typeof window.CSS.escape)t=r(window.CSS.escape(e.name));else try{t=r(e.name)}catch(e){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",e.message),!1}var o=function(e,t){for(var n=0;n<e.length;n++)if(e[n].checked&&e[n].form===t)return e[n]}(t,e.form);return!o||o===e}(e)},Gi=function(e){var t=e.getBoundingClientRect(),n=t.width,r=t.height;return 0===n&&0===r},Qi=function(e,t){var n=t.displayCheck,r=t.getShadowRoot;if("hidden"===getComputedStyle(e).visibility)return!0;var o=Vi.call(e,"details>summary:first-of-type")?e.parentElement:e;if(Vi.call(o,"details:not([open]) *"))return!0;if(n&&"full"!==n&&"legacy-full"!==n){if("non-zero-area"===n)return Gi(e)}else{if("function"==typeof r){for(var i=e;e;){var l=e.parentElement,a=Ui(e);if(l&&!l.shadowRoot&&!0===r(l))return Gi(e);e=e.assignedSlot?e.assignedSlot:l||a===e.ownerDocument?l:a.host}e=i}if(function(e){var t,n,r,o,i=e&&Ui(e),l=null===(t=i)||void 0===t?void 0:t.host,a=!1;if(i&&i!==e)for(a=!!(null!==(n=l)&&void 0!==n&&null!==(r=n.ownerDocument)&&void 0!==r&&r.contains(l)||null!=e&&null!==(o=e.ownerDocument)&&void 0!==o&&o.contains(e));!a&&l;){var s,c,u;a=!(null===(c=l=null===(s=i=Ui(l))||void 0===s?void 0:s.host)||void 0===c||null===(u=c.ownerDocument)||void 0===u||!u.contains(l))}return a}(e))return!e.getClientRects().length;if("legacy-full"!==n)return!0}return!1},el=function(e,t){return!(t.disabled||Ki(t)||function(e){return Zi(e)&&"hidden"===e.type}(t)||Qi(t,e)||function(e){return"DETAILS"===e.tagName&&Array.prototype.slice.apply(e.children).some((function(e){return"SUMMARY"===e.tagName}))}(t)||function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var t=e.parentElement;t;){if("FIELDSET"===t.tagName&&t.disabled){for(var n=0;n<t.children.length;n++){var r=t.children.item(n);if("LEGEND"===r.tagName)return!!Vi.call(t,"fieldset[disabled] *")||!r.contains(e)}return!0}t=t.parentElement}return!1}(t))},tl=function(e,t){return!(Ji(t)||Yi(t)<0||!el(e,t))},nl=function(e){var t=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(t)||t>=0)},rl=function e(t){var n=[],r=[];return t.forEach((function(t,o){var i=!!t.scopeParent,l=i?t.scopeParent:t,a=function(e,t){var n=Yi(e);return n<0&&t&&!qi(e)?0:n}(l,i),s=i?e(t.candidates):l;0===a?i?n.push.apply(n,s):n.push(l):r.push({documentOrder:o,tabIndex:a,item:t,isScope:i,content:s})})),r.sort(Xi).reduce((function(e,t){return t.isScope?e.push.apply(e,t.content):e.push(t.content),e}),[]).concat(n)},ol=function(e,t){var n;return n=(t=t||{}).getShadowRoot?Wi([e],t.includeContainer,{filter:tl.bind(null,t),flatten:!1,getShadowRoot:t.getShadowRoot,shadowRootFilter:nl}):function(e,t,n){if(Ki(e))return[];var r=Array.prototype.slice.apply(e.querySelectorAll($i));return t&&Vi.call(e,$i)&&r.unshift(e),r.filter(n)}(e,t.includeContainer,tl.bind(null,t)),rl(n)};const il=r["useInsertionEffect".toString()]||(e=>e());var ll="undefined"!=typeof document?c:u;function al(){return al=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},al.apply(this,arguments)}let sl=!1,cl=0;const ul=()=>"floating-ui-"+cl++;const dl=r["useId".toString()]||function(){const[e,t]=r.useState((()=>sl?ul():void 0));return ll((()=>{null==e&&t(ul())}),[]),r.useEffect((()=>{sl||(sl=!0)}),[]),e};const fl=r.createContext(null),pl=r.createContext(null);function hl(e){return"data-floating-ui-"+e}function gl(e){const t=a(e);return ll((()=>{t.current=e})),t}const vl=()=>({getShadowRoot:!0,displayCheck:"function"==typeof ResizeObserver&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function yl(e,t){const n=ol(e,vl());"prev"===t&&n.reverse();const r=n.indexOf(function(e){let t=e.activeElement;for(;null!=(null==(n=t)||null==(n=n.shadowRoot)?void 0:n.activeElement);){var n;t=t.shadowRoot.activeElement}return t}((null==(o=e)?void 0:o.ownerDocument)||document));var o;return n.slice(r+1)[0]}function ml(e,t){const n=t||e.currentTarget,r=e.relatedTarget;return!r||!function(e,t){if(!e||!t)return!1;const n=null==t.getRootNode?void 0:t.getRootNode();if(e.contains(t))return!0;if(n&&No(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}(n,r)}function bl(e){ol(e,vl()).forEach((e=>{e.dataset.tabindex=e.getAttribute("tabindex")||"",e.setAttribute("tabindex","-1")}))}function wl(e){e.querySelectorAll("[data-tabindex]").forEach((e=>{const t=e.dataset.tabindex;delete e.dataset.tabindex,t?e.setAttribute("tabindex",t):e.removeAttribute("tabindex")}))}const kl={border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"fixed",whiteSpace:"nowrap",width:"1px",top:0,left:0};function xl(e){"Tab"===e.key&&(e.target,clearTimeout(undefined))}const Ol=r.forwardRef((function(e,t){const[n,o]=r.useState();ll((()=>(/apple/i.test(navigator.vendor)&&o("button"),document.addEventListener("keydown",xl),()=>{document.removeEventListener("keydown",xl)})),[]);const i={ref:t,tabIndex:0,role:n,"aria-hidden":!n||void 0,[hl("focus-guard")]:"",style:kl};return r.createElement("span",al({},e,i))})),El=r.createContext(null),Sl=hl("portal");function _l(e){let{children:t,id:n,root:o=null,preserveTabOrder:i=!0}=e;const l=function(e){let{id:t,root:n}=void 0===e?{}:e;const[o,i]=r.useState(null),l=dl(),a=Cl(),s=r.useRef(null);return ll((()=>()=>{null==o||o.remove(),queueMicrotask((()=>{s.current=null}))}),[o]),ll((()=>{if(s.current)return;const e=t?document.getElementById(t):null;if(!e)return;const n=document.createElement("div");n.id=l,n.setAttribute(Sl,""),e.appendChild(n),s.current=n,i(n)}),[t,l]),ll((()=>{if(s.current)return;let e=n||(null==a?void 0:a.portalNode);e&&!To(e)&&(e=e.current),e=e||document.body;let r=null;t&&(r=document.createElement("div"),r.id=t,e.appendChild(r));const o=document.createElement("div");o.id=l,o.setAttribute(Sl,""),e=r||e,e.appendChild(o),s.current=o,i(o)}),[t,n,l,a]),o}({id:n,root:o}),[a,s]=r.useState(null),c=r.useRef(null),u=r.useRef(null),d=r.useRef(null),f=r.useRef(null),p=!!a&&!a.modal&&a.open&&i&&!(!o&&!l);return r.useEffect((()=>{if(l&&i&&(null==a||!a.modal))return l.addEventListener("focusin",e,!0),l.addEventListener("focusout",e,!0),()=>{l.removeEventListener("focusin",e,!0),l.removeEventListener("focusout",e,!0)};function e(e){if(l&&ml(e)){("focusin"===e.type?wl:bl)(l)}}}),[l,i,null==a?void 0:a.modal]),r.createElement(El.Provider,{value:r.useMemo((()=>({preserveTabOrder:i,beforeOutsideRef:c,afterOutsideRef:u,beforeInsideRef:d,afterInsideRef:f,portalNode:l,setFocusManagerState:s})),[i,l])},p&&l&&r.createElement(Ol,{"data-type":"outside",ref:c,onFocus:e=>{if(ml(e,l)){var t;null==(t=d.current)||t.focus()}else{const e=yl(document.body,"prev")||(null==a?void 0:a.refs.domReference.current);null==e||e.focus()}}}),p&&l&&r.createElement("span",{"aria-owns":l.id,style:kl}),l&&M(t,l),p&&l&&r.createElement(Ol,{"data-type":"outside",ref:u,onFocus:e=>{if(ml(e,l)){var t;null==(t=f.current)||t.focus()}else{const t=yl(document.body,"next")||(null==a?void 0:a.refs.domReference.current);null==t||t.focus(),(null==a?void 0:a.closeOnFocusOut)&&(null==a||a.onOpenChange(!1,e.nativeEvent))}}}))}const Cl=()=>r.useContext(El),jl=new Set,Dl=r.forwardRef((function(e,t){let{lockScroll:n=!1,...o}=e;const i=dl();return ll((()=>{if(!n)return;jl.add(i);const e=/iP(hone|ad|od)|iOS/.test(function(){const e=navigator.userAgentData;return null!=e&&e.platform?e.platform:navigator.platform}()),t=document.body.style,r=Math.round(document.documentElement.getBoundingClientRect().left)+document.documentElement.scrollLeft?"paddingLeft":"paddingRight",o=window.innerWidth-document.documentElement.clientWidth,l=t.left?parseFloat(t.left):window.pageXOffset,a=t.top?parseFloat(t.top):window.pageYOffset;if(t.overflow="hidden",o&&(t[r]=o+"px"),e){var s,c;const e=(null==(s=window.visualViewport)?void 0:s.offsetLeft)||0,n=(null==(c=window.visualViewport)?void 0:c.offsetTop)||0;Object.assign(t,{position:"fixed",top:-(a-Math.floor(n))+"px",left:-(l-Math.floor(e))+"px",right:"0"})}return()=>{jl.delete(i),0===jl.size&&(Object.assign(t,{overflow:"",[r]:""}),e&&(Object.assign(t,{position:"",top:"",left:"",right:""}),window.scrollTo(l,a)))}}),[i,n]),r.createElement("div",al({ref:t},o,{style:{position:"fixed",overflow:"auto",top:0,right:0,bottom:0,left:0,...o.style}}))}));function Al(e){var t;void 0===e&&(e={});const{open:n=!1,onOpenChange:o,nodeId:i}=e,[l,a]=r.useState(null),s=(null==(t=e.elements)?void 0:t.reference)||l,c=function(e){void 0===e&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:o=[],platform:i,elements:{reference:l,floating:a}={},transform:s=!0,whileElementsMounted:c,open:u}=e,[d,f]=r.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,h]=r.useState(o);Li(p,o)||h(o);const[g,v]=r.useState(null),[y,m]=r.useState(null),b=r.useCallback((e=>{e!==O.current&&(O.current=e,v(e))}),[]),w=r.useCallback((e=>{e!==E.current&&(E.current=e,m(e))}),[]),k=l||g,x=a||y,O=r.useRef(null),E=r.useRef(null),S=r.useRef(d),_=null!=c,C=zi(c),j=zi(i),D=r.useCallback((()=>{if(!O.current||!E.current)return;const e={placement:t,strategy:n,middleware:p};j.current&&(e.platform=j.current),Mi(O.current,E.current,e).then((e=>{const t={...e,isPositioned:!0};A.current&&!Li(S.current,t)&&(S.current=t,B.flushSync((()=>{f(t)})))}))}),[p,t,n,j]);Ni((()=>{!1===u&&S.current.isPositioned&&(S.current.isPositioned=!1,f((e=>({...e,isPositioned:!1}))))}),[u]);const A=r.useRef(!1);Ni((()=>(A.current=!0,()=>{A.current=!1})),[]),Ni((()=>{if(k&&(O.current=k),x&&(E.current=x),k&&x){if(C.current)return C.current(k,x,D);D()}}),[k,x,D,C,_]);const P=r.useMemo((()=>({reference:O,floating:E,setReference:b,setFloating:w})),[b,w]),R=r.useMemo((()=>({reference:k,floating:x})),[k,x]),T=r.useMemo((()=>{const e={position:n,left:0,top:0};if(!R.floating)return e;const t=Fi(R.floating,d.x),r=Fi(R.floating,d.y);return s?{...e,transform:"translate("+t+"px, "+r+"px)",...Ii(R.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:t,top:r}}),[n,s,R.floating,d.x,d.y]);return r.useMemo((()=>({...d,update:D,refs:P,elements:R,floatingStyles:T})),[d,D,P,R,T])}(e),u=r.useContext(pl),d=null!=((null==(f=r.useContext(fl))?void 0:f.id)||null);var f;const p=function(e){const t=r.useRef((()=>{}));return il((()=>{t.current=e})),r.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&&(g.current.openEvent=t),v.emit("openchange",{open:e,event:t,reason:n,nested:d}),null==o||o(e,t,n)})),h=r.useRef(null),g=r.useRef({}),v=r.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],y=dl(),m=r.useCallback((e=>{const t=To(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),contextElement:e}:e;c.refs.setReference(t)}),[c.refs]),b=r.useCallback((e=>{(To(e)||null===e)&&(h.current=e,a(e)),(To(c.refs.reference.current)||null===c.refs.reference.current||null!==e&&!To(e))&&c.refs.setReference(e)}),[c.refs]),w=r.useMemo((()=>({...c.refs,setReference:b,setPositionReference:m,domReference:h})),[c.refs,b,m]),k=r.useMemo((()=>({...c.elements,domReference:s})),[c.elements,s]),x=r.useMemo((()=>({...c,refs:w,elements:k,dataRef:g,nodeId:i,floatingId:y,events:v,open:n,onOpenChange:p})),[c,i,y,v,n,p,w,k]);return ll((()=>{const e=null==u?void 0:u.nodesRef.current.find((e=>e.id===i));e&&(e.context=x)})),r.useMemo((()=>({...c,context:x,refs:w,elements:k})),[c,w,k,x])}const Pl=e=>e.replace(/[A-Z]+(?![a-z])|[A-Z]/g,((e,t)=>(t?"-":"")+e.toLowerCase()));function Rl(e,t){return"function"==typeof e?e(t):e}function Bl(e,t){void 0===t&&(t={});const{open:n,elements:{floating:o}}=e,{duration:i=250}=t,l=("number"==typeof i?i:i.close)||0,[a,s]=r.useState(!1),[c,u]=r.useState("unmounted"),d=function(e,t){const[n,o]=r.useState(e);return e&&!n&&o(!0),r.useEffect((()=>{if(!e){const e=setTimeout((()=>o(!1)),t);return()=>clearTimeout(e)}}),[e,t]),n}(n,l);return ll((()=>{a&&!d&&u("unmounted")}),[a,d]),ll((()=>{if(o){if(n){u("initial");const e=requestAnimationFrame((()=>{u("open")}));return()=>{cancelAnimationFrame(e)}}s(!0),u("close")}}),[n,o]),{isMounted:d,status:c}}function Tl(e,t){void 0===t&&(t={});const{initial:n={opacity:0},open:o,close:i,common:l,duration:a=250}=t,s=e.placement,c=s.split("-")[0],u=r.useMemo((()=>({side:c,placement:s})),[c,s]),d="number"==typeof a,f=(d?a:a.open)||0,p=(d?a:a.close)||0,[h,g]=r.useState((()=>({...Rl(l,u),...Rl(n,u)}))),{isMounted:v,status:y}=Bl(e,{duration:a}),m=gl(n),b=gl(o),w=gl(i),k=gl(l);return ll((()=>{const e=Rl(m.current,u),t=Rl(w.current,u),n=Rl(k.current,u),r=Rl(b.current,u)||Object.keys(e).reduce(((e,t)=>(e[t]="",e)),{});if("initial"===y&&g((t=>({transitionProperty:t.transitionProperty,...n,...e}))),"open"===y&&g({transitionProperty:Object.keys(r).map(Pl).join(","),transitionDuration:f+"ms",...n,...r}),"close"===y){const r=t||e;g({transitionProperty:Object.keys(r).map(Pl).join(","),transitionDuration:p+"ms",...n,...r})}}),[p,w,m,b,k,f,y,u]),{isMounted:v,styles:h}}function Ml({editor:e,view:t,onClose:n,mode:r="toggle"}){return{actions:(()=>{let t=Object.keys(e.blocks);return"toggle"===r&&(t=t.filter((t=>function(e,t){var n;const r=e.blocks[t];if(!r)return!1;const o=H(r.elements);return"void"!==(null===(n=null==o?void 0:o.props)||void 0===n?void 0:n.nodeType)}(e,t)))),t.map((t=>{var n,r,o,i,l,a;return{type:t,title:(null===(r=null===(n=e.blocks[t].options)||void 0===n?void 0:n.display)||void 0===r?void 0:r.title)||t,description:null===(i=null===(o=e.blocks[t].options)||void 0===o?void 0:o.display)||void 0===i?void 0:i.description,icon:null===(a=null===(l=e.blocks[t].options)||void 0===l?void 0:l.display)||void 0===a?void 0:a.icon}}))})(),onClose:n,empty:!1,getItemProps:t=>({onMouseEnter:()=>{},"data-action-menu-item":!0,"data-action-menu-item-type":t,"aria-selected":!1,onClick:()=>{e.toggleBlock(t,{deleteText:"toggle"===r,focus:!0}),n()}}),getRootProps:()=>({"data-action-menu-list":!0}),editor:e,view:t}}const Nl=p((({children:n,block:r,blockId:o,onActiveDragHandleChange:i})=>{const l=Ut(),{attributes:a,listeners:c,setNodeRef:u,setActivatorNodeRef:d,transform:f,transition:p,isOver:h,isDragging:g}=xo({id:o,disabled:l.readOnly}),v=((e,t,n,r,o)=>s((()=>({container:{marginLeft:20*e.meta.depth+"px",transform:t?`translate3d(${t.x}px, ${t.y}px, 0)`:"none",transition:n,opacity:r?.7:1},content:o&&!r?{borderBottom:"2px solid #007aff"}:void 0})),[e.meta.depth,t,n,r,o]))(r,f,p,g,h),y=`yoopta-block yoopta-align-${r.meta.align||"left"}`,m=Z.isBlockSelected(l,r);return t("div",Object.assign({ref:u,className:y,style:v.container,"data-yoopta-block":!0,"data-yoopta-block-id":o,onMouseEnter:()=>{!l.readOnly&&i&&i({attributes:a,listeners:c,setActivatorNodeRef:d})}},{children:[e("div",Object.assign({style:v.content},{children:n})),!l.readOnly&&e("div",{"data-block-selected":m,className:"yoopta-selection-block"})]}))}));function Ll(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}Nl.displayName="Block","function"==typeof SuppressedError&&SuppressedError;var Il={};Object.defineProperty(Il,"__esModule",{value:!0});for(var Fl="undefined"!=typeof window&&/Mac|iPod|iPhone|iPad/.test(window.navigator.platform),zl={alt:"altKey",control:"ctrlKey",meta:"metaKey",shift:"shiftKey"},$l={add:"+",break:"pause",cmd:"meta",command:"meta",ctl:"control",ctrl:"control",del:"delete",down:"arrowdown",esc:"escape",ins:"insert",left:"arrowleft",mod:Fl?"meta":"control",opt:"alt",option:"alt",return:"enter",right:"arrowright",space:" ",spacebar:" ",up:"arrowup",win:"meta",windows:"meta"},Hl={backspace:8,tab:9,enter:13,shift:16,control:17,alt:18,pause:19,capslock:20,escape:27," ":32,pageup:33,pagedown:34,end:35,home:36,arrowleft:37,arrowup:38,arrowright:39,arrowdown:40,insert:45,delete:46,meta:91,numlock:144,scrolllock:145,";":186,"=":187,",":188,"-":189,".":190,"/":191,"`":192,"[":219,"\\":220,"]":221,"'":222},Vl=1;Vl<20;Vl++)Hl["f"+Vl]=111+Vl;function Ul(e,t,n){t&&!("byKey"in t)&&(n=t,t=null),Array.isArray(e)||(e=[e]);var r=e.map((function(e){return Kl(e,t)})),o=function(e){return r.some((function(t){return Wl(t,e)}))};return null==n?o:o(n)}function Kl(e,t){var n=t&&t.byKey,r={},o=(e=e.replace("++","+add")).split("+"),i=o.length;for(var l in zl)r[zl[l]]=!1;var a=!0,s=!1,c=void 0;try{for(var u,d=o[Symbol.iterator]();!(a=(u=d.next()).done);a=!0){var f=u.value,p=f.endsWith("?")&&f.length>1;p&&(f=f.slice(0,-1));var h=Yl(f),g=zl[h];if(f.length>1&&!g&&!$l[f]&&!Hl[h])throw new TypeError('Unknown modifier: "'+f+'"');1!==i&&g||(n?r.key=h:r.which=ql(f)),g&&(r[g]=!p||null)}}catch(e){s=!0,c=e}finally{try{!a&&d.return&&d.return()}finally{if(s)throw c}}return r}function Wl(e,t){for(var n in e){var r=e[n],o=void 0;if(null!=r&&((null!=(o="key"===n&&null!=t.key?t.key.toLowerCase():"which"===n?91===r&&93===t.which?91:t.which:t[n])||!1!==r)&&o!==r))return!1}return!0}function ql(e){return e=Yl(e),Hl[e]||e.toUpperCase().charCodeAt(0)}function Yl(e){return e=e.toLowerCase(),e=$l[e]||e}Il.default=Ul,Il.isHotkey=Ul,Il.isCodeHotkey=function(e,t){return Ul(e,t)};var Xl=Il.isKeyHotkey=function(e,t){return Ul(e,{byKey:!0},t)};Il.parseHotkey=Kl,Il.compareHotkey=Wl,Il.toKeyCode=ql,Il.toKeyName=Yl;const Zl={bold:"mod+b",italic:"mod+i",compose:["down","left","right","up","backspace","enter"],arrowLeft:"left",arrowUp:"up",arrowDown:"down",arrowRight:"right",ctrlLeft:"ctrl+left",escape:"esc",ctrlRight:"ctrl+right",deleteBackward:"shift?+backspace",backspace:"backspace",deleteForward:"shift?+delete",extendBackward:"shift+left",shiftDelete:"shift+delete",extendForward:"shift+right",shiftEnter:"shift+enter",enter:"enter",space:"space",undo:"mod+z",select:"mod+a",shiftTab:"shift+tab",shiftArrowUp:"shift+up",shiftArrowDown:"shift+down",tab:"tab",cmd:"mod",cmdEnter:"mod+enter",cmdShiftEnter:"mod+shift+enter",slashCommand:"/",copy:"mod+c",cut:"mod+x",cmdShiftRight:"mod+shift+right",cmdShiftLeft:"mod+shift+left",cmdShiftDelete:"mod+shift+backspace",cmdShiftD:"mod+shift+d",cmdAltDelete:"mod+alt+backspace"},Jl={moveLineBackward:"opt+up",moveLineForward:"opt+down",ctrlLeft:"opt+left",ctrlRight:"opt+right",deleteBackward:["ctrl+backspace","ctrl+h"],deleteForward:["ctrl+delete","ctrl+d"],deleteLineBackward:"cmd+shift?+backspace",deleteLineForward:["cmd+shift?+delete","ctrl+k"],deleteWordBackward:"opt+shift?+backspace",deleteWordForward:"opt+shift?+delete",extendLineBackward:"opt+shift+up",extendLineForward:"opt+shift+down",redo:"cmd+shift+z",transposeCharacter:"ctrl+t"},Gl={deleteWordBackward:"ctrl+shift?+backspace",deleteWordForward:"ctrl+shift?+delete",redo:["ctrl+y","ctrl+shift+z"]},Ql=e=>{const t=Zl[e],n=Jl[e],r=Gl[e],o=t&&Xl(t),i=n&&Xl(n),l=r&&Xl(r);return e=>!(!o||!o(e))||(!(!i||!i(e))||!(!l||!l(e)))},ea={isBold:Ql("bold"),isCompose:Ql("compose"),isArrowLeft:Ql("arrowLeft"),isArrowRight:Ql("arrowRight"),isArrowUp:Ql("arrowUp"),isArrowDown:Ql("arrowDown"),isDeleteBackward:Ql("deleteBackward"),isDeleteForward:Ql("deleteForward"),isDeleteLineBackward:Ql("deleteLineBackward"),isDeleteLineForward:Ql("deleteLineForward"),isDeleteWordBackward:Ql("deleteWordBackward"),isDeleteWordForward:Ql("deleteWordForward"),isExtendBackward:Ql("extendBackward"),isExtendForward:Ql("extendForward"),isExtendLineBackward:Ql("extendLineBackward"),isExtendLineForward:Ql("extendLineForward"),isItalic:Ql("italic"),isMoveLineBackward:Ql("moveLineBackward"),isMoveLineForward:Ql("moveLineForward"),isCtrlLeft:Ql("ctrlLeft"),isCtrlRight:Ql("ctrlRight"),isRedo:Ql("redo"),isShiftEnter:Ql("shiftEnter"),isEnter:Ql("enter"),isTransposeCharacter:Ql("transposeCharacter"),isUndo:Ql("undo"),isSpace:Ql("space"),isSelect:Ql("select"),isTab:Ql("tab"),isShiftTab:Ql("shiftTab"),isBackspace:Ql("backspace"),isCmdEnter:Ql("cmdEnter"),isCmd:Ql("cmd"),isEscape:Ql("escape"),isSlashCommand:Ql("slashCommand"),isShiftArrowUp:Ql("shiftArrowUp"),isShiftArrowDown:Ql("shiftArrowDown"),isCopy:Ql("copy"),isCut:Ql("cut"),isShiftDelete:Ql("shiftDelete"),isCmdShiftEnter:Ql("cmdShiftEnter"),isCmdShiftRight:Ql("cmdShiftRight"),isCmdShiftLeft:Ql("cmdShiftLeft"),isCmdShiftDelete:Ql("cmdShiftDelete"),isCmdAltDelete:Ql("cmdAltDelete"),isCmdShiftD:Ql("cmdShiftD")};const ta={onKeyDown:function(e){return t=>{const n=re(e,{at:e.path.current});if(ea.isShiftEnter(t)){if(t.isDefaultPrevented())return;if(!n||!n.selection)return;return t.preventDefault(),void n.insertText("\n")}if(ea.isUndo(t))t.preventDefault();else if(ea.isRedo(t))t.preventDefault();else if(ea.isEnter(t)){if(t.isDefaultPrevented())return;if(!n||!n.selection)return;t.preventDefault();const r=y.first(n,[]),o=y.last(n,[]),i=y.isStart(n,n.selection.anchor,r[1]),l=y.isEnd(n,n.selection.anchor,o[1]);if(E.isExpanded(n.selection)&&w.delete(n,{at:n.selection}),!i&&!l)return void e.splitBlock({slate:n,focus:!0});const a=Ee.getBlock(e,{at:e.path.current}),s=Ee.buildBlockData({id:I()}),c=y.string(n,[]),u=i&&c.length>0,d=Z.getNextPath(e);e.batchOperations((()=>{e.insertBlock(s.type,{at:u?e.path.current:d,focus:!u}),u&&a&&e.focusBlock(a.id)}))}else if(ea.isBackspace(t)){if(t.isDefaultPrevented())return;if(!n||!n.selection)return;const r=x.parent(n.selection.anchor.path);if(y.isStart(n,n.selection.anchor,r)){t.preventDefault();if(0===y.string(n,r).trim().length)return void e.deleteBlock({at:e.path.current,focus:!0});{if(E.isExpanded(n.selection))return w.delete(n,{at:n.selection});const t=Ee.getBlock(e,{at:Z.getPreviousPath(e)}),r=Ee.getBlockSlate(e,{id:null==t?void 0:t.id});if(t&&r){const{node:n}=function(e){const t=y.last(e,[]);return{node:t[0],path:t[1]}}(r);if(0===O.string(n).trim().length)return e.deleteBlock({blockId:t.id,focus:!1}),void e.setPath({current:t.meta.order})}e.mergeBlock()}}}else{if(ea.isSelect(t)){if(t.isDefaultPrevented())return;if(!n||!n.selection)return;const[,r]=y.first(n,[0]),[,o]=y.last(n,[n.children.length-1]),i=y.range(n,r,o),l=E.equals(n.selection,i),a=0===y.string(n,i).trim().length;if(E.isExpanded(n.selection)&&l||a){t.preventDefault(),C.blur(n),C.deselect(n),w.deselect(n);const r=Array.from({length:Object.keys(e.children).length},((e,t)=>t));return void e.setPath({current:null,selected:r,source:"keyboard"})}}if(ea.isShiftTab(t)){if(t.isDefaultPrevented())return;t.preventDefault();const n=e.path.selected;return Array.isArray(n)&&n.length>0?void e.batchOperations((()=>{n.forEach((t=>{const n=Ee.getBlock(e,{at:t});n&&n.meta.depth>0&&e.decreaseBlockDepth({at:t})}))})):void e.decreaseBlockDepth()}if(ea.isTab(t)){if(t.isDefaultPrevented())return;t.preventDefault();const n=e.path.selected;return Array.isArray(n)&&n.length>0?void e.batchOperations((()=>{n.forEach((t=>{e.increaseBlockDepth({at:t})}))})):void e.increaseBlockDepth()}if(ea.isArrowUp(t)){if(t.isDefaultPrevented())return;if(!n||!n.selection)return;if(1===new Set(n.selection.anchor.path).size){const n=Z.getPreviousPath(e),r=re(e,{at:n}),o=ne(e,{at:n}),i=e.blocks[(null==o?void 0:o.type)||""];if(r&&o&&!(null==i?void 0:i.hasCustomEditor)){const[,n]=y.last(r,[0]),i={path:n,offset:y.string(r,n).length};return t.preventDefault(),void e.focusBlock(o.id,{focusAt:i,waitExecution:!1,shouldUpdateBlockPath:!0})}}}if(ea.isArrowDown(t)){if(t.isDefaultPrevented())return;if(!n||!n.selection)return;const r=x.parent(n.selection.anchor.path);if(y.isEnd(n,n.selection.anchor,r)){const n=Z.getNextPath(e),o=re(e,{at:n}),i=ne(e,{at:n}),l=e.blocks[(null==i?void 0:i.type)||""];if(o&&i&&!(null==l?void 0:l.hasCustomEditor)){const n=function(e,t){try{const[,n]=y.first(e,t);return{path:n,offset:0}}catch(e){return{path:[0,0],offset:0}}}(o,r);return t.preventDefault(),void e.focusBlock(i.id,{focusAt:n,waitExecution:!1})}}}if(n&&n.selection&&E.isExpanded(n.selection)){if(Object.values(e.formats).length>0)for(const n of Object.values(e.formats))if(n.hotkey&&Xl(n.hotkey)(t)){t.preventDefault(),e.formats[n.type].toggle();break}}}}}},na=({children:t,attributes:n,placeholder:r})=>{const o=D(),i=Object.assign({},n);return o&&r&&(i["data-placeholder"]=r,i.className="yoopta-placeholder"),e("span",Object.assign({},i,{children:t}))};function ra(e){return!!(e&&e.id&&e.type&&e.value&&e.meta)}const oa={B:{type:"bold"},STRONG:{type:"bold"},I:{type:"italic"},U:{type:"underline"},S:{type:"strike"},CODE:{type:"code"},EM:{type:"italic"},MARK:{type:"highlight",parse:e=>({color:e.style.color})}},ia=["left","center","right",void 0];function la(e,t,n,r){var o,i;let l;if(t.parse){l=t.parse(n,e);if(m.isElement(l)&&"inline"===(null===(o=l.props)||void 0===o?void 0:o.nodeType))return l}const a=e.blocks[t.type],s=$(a.elements)||"",c=a.elements[s],u="void"===(null===(i=c.props)||void 0===i?void 0:i.nodeType);let d={id:I(),type:s,children:u&&!a.hasCustomEditor?[{text:""}]:r.map(sa).flat(),props:Object.assign({nodeType:"block"},c.props)};if(l)if(m.isElement(l))d=l;else if(Array.isArray(l)){return l}if(0===d.children.length&&(d.children=[{text:""}]),!l&&t.parse)return;const f=n.getAttribute("data-meta-align"),p=parseInt(n.getAttribute("data-meta-depth")||"0",10);return Ee.buildBlockData({id:I(),type:t.type,value:[d],meta:{order:0,depth:p,align:ia.includes(f)?f:void 0}})}function aa(e,t,n){var r;if(3===n.nodeType){return{text:null===(r=n.textContent)||void 0===r?void 0:r.replace(/[\t\n\r\f\v]+/g," ")}}if(1!==n.nodeType)return null;if("BR"===n.nodeName)return{text:"\n"};const o=n;let i=Array.from(o.childNodes).map((n=>aa(e,t,n))).flat().filter(Boolean);if(oa[o.nodeName]){const e=oa[o.nodeName],t=e.type;return i.map((n=>"string"==typeof n?{[t]:!e.parse||e.parse(o),text:n}:n.text?Object.assign(Object.assign({},n),{[t]:!e.parse||e.parse(o)}):n))}const l=t[o.nodeName];if(l){if(Array.isArray(l)){return l.map((t=>la(e,t,o,i))).filter(Boolean)}return la(e,l,o,i)}return i}function sa(e){if("string"==typeof e)return{text:e};if(m.isElement(e))return e;if(Array.isArray(e))return e.map(sa).flat();if(null==e?void 0:e.text)return e;if(ra(e)){return e.value[0].children.map(sa).flat()}return{text:""}}function ca(e,t){console.log("pasted html",t);const n=function(e){const t={};return Object.keys(e.plugins).forEach((n=>{const r=e.plugins[n],{parsers:o}=r;if(o){const{html:e}=o;if(e){const{deserialize:r}=e;if(r){const{nodeNames:e}=r;e&&e.forEach((e=>{const o=t[e];if(o){const i=Array.isArray(o)?o:[o];t[e]=[...i,{type:n,parse:r.parse}]}else t[e]={type:n,parse:r.parse}}))}}}})),t}(e);return aa(e,n,t).flat().filter(ra)}var ua={},da={get exports(){return ua},set exports(e){ua=e}},fa={};!function(e,t){function n(e){return n="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},n(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){if(!("string"==typeof e||e instanceof String)){var t=n(e);throw null===e?t="null":"object"===t&&(t=e.constructor.name),new TypeError("Expected a string but received a ".concat(t))}},e.exports=t.default,e.exports.default=t.default}({get exports(){return fa},set exports(e){fa=e}},fa);var pa,ha,ga={},va={get exports(){return ga},set exports(e){ga=e}},ya={};pa={get exports(){return ya},set exports(e){ya=e}},ha=ya,Object.defineProperty(ha,"__esModule",{value:!0}),ha.default=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;for(var n in t)void 0===e[n]&&(e[n]=t[n]);return e},pa.exports=ha.default,pa.exports.default=ha.default,function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){(0,n.default)(e),(t=(0,r.default)(t,i)).allow_trailing_dot&&"."===e[e.length-1]&&(e=e.substring(0,e.length-1));!0===t.allow_wildcard&&0===e.indexOf("*.")&&(e=e.substring(2));var o=e.split("."),l=o[o.length-1];if(t.require_tld){if(o.length<2)return!1;if(!t.allow_numeric_tld&&!/^([a-z\u00A1-\u00A8\u00AA-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]{2,}|xn[a-z0-9-]{2,})$/i.test(l))return!1;if(/\s/.test(l))return!1}if(!t.allow_numeric_tld&&/^\d+$/.test(l))return!1;return o.every((function(e){return!(e.length>63&&!t.ignore_max_length)&&(!!/^[a-z_\u00a1-\uffff0-9-]+$/i.test(e)&&(!/[\uff01-\uff5e]/.test(e)&&(!/^-|-$/.test(e)&&!(!t.allow_underscores&&/_/.test(e)))))}))};var n=o(fa),r=o(ya);function o(e){return e&&e.__esModule?e:{default:e}}var i={require_tld:!0,allow_underscores:!1,allow_trailing_dot:!1,allow_numeric_tld:!1,allow_wildcard:!1,ignore_max_length:!1};e.exports=t.default,e.exports.default=t.default}(va,ga);var ma={};!function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if((0,r.default)(t),!(n=String(n)))return e(t,4)||e(t,6);if("4"===n)return l.test(t);if("6"===n)return s.test(t);return!1};var n,r=(n=fa)&&n.__esModule?n:{default:n};var o="(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])",i="(".concat(o,"[.]){3}").concat(o),l=new RegExp("^".concat(i,"$")),a="(?:[0-9a-fA-F]{1,4})",s=new RegExp("^("+"(?:".concat(a,":){7}(?:").concat(a,"|:)|")+"(?:".concat(a,":){6}(?:").concat(i,"|:").concat(a,"|:)|")+"(?:".concat(a,":){5}(?::").concat(i,"|(:").concat(a,"){1,2}|:)|")+"(?:".concat(a,":){4}(?:(:").concat(a,"){0,1}:").concat(i,"|(:").concat(a,"){1,3}|:)|")+"(?:".concat(a,":){3}(?:(:").concat(a,"){0,2}:").concat(i,"|(:").concat(a,"){1,4}|:)|")+"(?:".concat(a,":){2}(?:(:").concat(a,"){0,3}:").concat(i,"|(:").concat(a,"){1,5}|:)|")+"(?:".concat(a,":){1}(?:(:").concat(a,"){0,4}:").concat(i,"|(:").concat(a,"){1,6}|:)|")+"(?::((?::".concat(a,"){0,5}:").concat(i,"|(?::").concat(a,"){1,7}|:))")+")(%[0-9a-zA-Z-.:]{1,})?$");e.exports=t.default,e.exports.default=t.default}({get exports(){return ma},set exports(e){ma=e}},ma),function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){if((0,n.default)(e),!e||/[\s<>]/.test(e))return!1;if(0===e.indexOf("mailto:"))return!1;if((t=(0,i.default)(t,s)).validate_length&&e.length>=2083)return!1;if(!t.allow_fragments&&e.includes("#"))return!1;if(!t.allow_query_components&&(e.includes("?")||e.includes("&")))return!1;var l,d,f,p,h,g,v,y;if(v=e.split("#"),e=v.shift(),v=e.split("?"),e=v.shift(),(v=e.split("://")).length>1){if(l=v.shift().toLowerCase(),t.require_valid_protocol&&-1===t.protocols.indexOf(l))return!1}else{if(t.require_protocol)return!1;if("//"===e.slice(0,2)){if(!t.allow_protocol_relative_urls)return!1;v[0]=e.slice(2)}}if(""===(e=v.join("://")))return!1;if(v=e.split("/"),""===(e=v.shift())&&!t.require_host)return!0;if((v=e.split("@")).length>1){if(t.disallow_auth)return!1;if(""===v[0])return!1;if((d=v.shift()).indexOf(":")>=0&&d.split(":").length>2)return!1;var m=d.split(":"),b=(O=2,function(e){if(Array.isArray(e))return e}(x=m)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,l,a=[],s=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=i.call(n)).done)&&(a.push(r.value),a.length!==t);s=!0);}catch(e){c=!0,o=e}finally{try{if(!s&&null!=n.return&&(l=n.return(),Object(l)!==l))return}finally{if(c)throw o}}return a}}(x,O)||function(e,t){if(e){if("string"==typeof e)return a(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?a(e,t):void 0}}(x,O)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),w=b[0],k=b[1];if(""===w&&""===k)return!1}var x,O;p=v.join("@"),g=null,y=null;var E=p.match(c);E?(f="",y=E[1],g=E[2]||null):(f=(v=p.split(":")).shift(),v.length&&(g=v.join(":")));if(null!==g&&g.length>0){if(h=parseInt(g,10),!/^[0-9]+$/.test(g)||h<=0||h>65535)return!1}else if(t.require_port)return!1;if(t.host_whitelist)return u(f,t.host_whitelist);if(""===f&&!t.require_host)return!0;if(!((0,o.default)(f)||(0,r.default)(f,t)||y&&(0,o.default)(y,6)))return!1;if(f=f||y,t.host_blacklist&&u(f,t.host_blacklist))return!1;return!0};var n=l(fa),r=l(ga),o=l(ma),i=l(ya);function l(e){return e&&e.__esModule?e:{default:e}}function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var s={protocols:["http","https","ftp"],require_tld:!0,require_protocol:!1,require_host:!0,require_port:!1,require_valid_protocol:!0,allow_underscores:!1,allow_trailing_dot:!1,allow_protocol_relative_urls:!1,allow_fragments:!0,allow_query_components:!0,validate_length:!0},c=/^\[([^\]]+)\](?::([0-9]+))?$/;function u(e,t){for(var n=0;n<t.length;n++){var r=t[n];if(e===r||(o=r,"[object RegExp]"===Object.prototype.toString.call(o)&&r.test(e)))return!0}var o;return!1}e.exports=t.default,e.exports.default=t.default}(da,ua);var ba=ie(ua);function wa(e){return!(!e||e.length>2048)&&ba(e,{protocols:["http","https"],require_protocol:!0,require_valid_protocol:!0,require_host:!0,require_port:!1,allow_protocol_relative_urls:!1,allow_fragments:!0,allow_query_components:!0,allow_underscores:!0,disallow_auth:!1})}const ka=(e,t,n)=>{var r,o,i,l;(e=>{const[t]=y.nodes(e,{match:e=>!y.isEditor(e)&&m.isElement(e)&&"link"===e.type});return!!t})(t)&&(e=>{w.unwrapNodes(e,{match:e=>!y.isEditor(e)&&m.isElement(e)&&"link"===e.type})})(t);const{selection:a}=t,s=a&&E.isCollapsed(a),c=null===(l=null===(i=null===(o=null===(r=e.plugins)||void 0===r?void 0:r.LinkPlugin)||void 0===o?void 0:o.elements)||void 0===i?void 0:i.link)||void 0===l?void 0:l.props,u={type:"link",children:s?[{text:n}]:[],props:{url:n,target:(null==c?void 0:c.target)||"_self",rel:(null==c?void 0:c.rel)||"noopener noreferrer"}};s?w.insertNodes(t,u):(w.wrapNodes(t,u,{split:!0}),w.collapse(t,{edge:"end"}))},xa=(e,t,n,r,o)=>s((()=>{let i=t.blockEditorsMap[e];const{normalizeNode:l,insertText:a,apply:s}=i,c=Object.keys(r);return c.forEach((e=>{var n;const o=null===(n=r[e].props)||void 0===n?void 0:n.nodeType,l="inline"===o,a="void"===o,s="inlineVoid"===o,{markableVoid:c,isVoid:u,isInline:d}=i;s&&(i.markableVoid=t=>c(t)||t.type===e),(a||s)&&(i.isVoid=t=>u(t)||t.type===e),(l||s)&&(i.isInline=t=>d(t)||t.type===e,i=((e,t)=>{const{insertData:n,insertText:r}=t;return t.insertText=n=>{n&&wa(n)?ka(e,t,n):r(n)},t.insertData=r=>{const o=r.getData("text/plain");o&&wa(o)?ka(e,t,o):n(r)},t})(t,i))})),i.insertText=e=>{const n=Z.getSelectedPaths(t),r=Z.getPath(t);Array.isArray(n)&&n.length>0&&t.setPath({current:r}),a(e)},i.normalizeNode=e=>{const[r,o]=e,a=t.blocks[n.type].elements;if(Object.keys(a).length>1)return l(e);if(m.isElement(r)){const{type:e}=r,t=$(a);if(!c.includes(e))return void w.setNodes(i,{type:t,props:Object.assign({},r.props)},{at:o});if(r.type===t)for(const[e,t]of O.children(i,o))if(m.isElement(e)&&!i.isInline(e))return void w.unwrapNodes(i,{at:t})}l(e)},i.apply=n=>{var r,o,l;if(_.isSelectionOperation(n)){const e=Z.getSelectedPaths(t),n=Z.getPath(t);Array.isArray(e)&&i.selection&&E.isExpanded(i.selection)&&t.setPath({current:n})}let a=t.isSavingHistory();if(void 0===a&&(a=Oa(n)),a){const a=t.historyStack.undos[t.historyStack.undos.length-1];if(!a||"set_slate"!==(null===(r=null==a?void 0:a.operations[0])||void 0===r?void 0:r.type)){const r={type:"set_slate",properties:{slateOps:[n],selectionBefore:i.selection},blockId:e,slate:i};return t.applyTransforms([r],{source:"api",validatePaths:!1}),void s(n)}const c=null===(l=null===(o=null==a?void 0:a.operations[0])||void 0===o?void 0:o.properties)||void 0===l?void 0:l.slateOps,u=c&&c[c.length-1];let d=Ea(n,u);if(0!==i.operations.length&&(d=!0),d)u!==n&&c.push(n);else{const r={operations:[n],selectionBefore:i.selection},o={type:"set_slate",properties:{slateOps:r.operations,selectionBefore:r.selectionBefore},blockId:e,slate:i};t.applyTransforms([o],{source:"api",validatePaths:!1})}}s(n)},o&&(i=o(i,t,e)),i}),[]),Oa=e=>"set_selection"!==e.type,Ea=(e,t)=>t===e||(!(!t||"insert_text"!==e.type||"insert_text"!==t.type||e.offset!==t.offset+t.text.length||!x.equals(e.path,t.path))||!(!t||"remove_text"!==e.type||"remove_text"!==t.type||e.offset+e.text.length!==t.offset||!x.equals(e.path,t.path))),Sa=({id:t,customEditor:n,elements:r,marks:o,events:i,options:l,extensions:c,placeholder:u="Type '/' for commands"})=>{const f=Ut(),p=Kt(t);let h=a(p.value).current;const g=s((()=>(e=>{const t={};return Object.keys(e).forEach((n=>t[n]=e[n].render)),t})(r)),[r]),v=s((()=>(e=>{const t={};return e?(e.forEach((e=>t[e.type]=e)),t):t})(o)),[o]),m=xa(t,f,p,r,c),b=((e,t,n,r)=>s((()=>{if(!e||t.readOnly)return{};const o=Ll(e||{},["onBeforeCreate","onDestroy","onCreate"]),i={hotkeys:ea,currentBlock:n,defaultBlock:Ee.buildBlockData({id:I()})},l={};return Object.keys(o).forEach((e=>{l[e]=function(n){o[e]&&o[e](t,r,i)(n)}})),l}),[e,t,n]))(i,f,p,m),w=d((e=>{f.readOnly||(window.scheduler?window.scheduler.postTask((()=>f.updateBlock(t,{value:e})),{priority:"background"}):f.updateBlock(t,{value:e}))}),[t]),k=d((e=>{f.readOnly||"mousemove"!==f.path.source&&"keyboard"!==f.path.source&&f.setPath({current:f.path.current,selected:f.path.selected,selection:e,source:"native-selection"})}),[f.readOnly]),O=d((n=>{const r=g[n.element.type],{attributes:o}=n,i=Ll(n,["attributes"]);return o["data-element-type"]=i.element.type,r?e(r,Object.assign({},i,{attributes:o,blockId:t,HTMLAttributes:null==l?void 0:l.HTMLAttributes})):e(R,Object.assign({},i,{attributes:o}))}),[r]),S=d((t=>{var n,r,o,i;let{children:l,leaf:a,attributes:s}=t;const c=Ll(a,["text"]),d=f.path.current===p.meta.order;c&&Object.keys(c).forEach((e=>{const t=v[e];t&&(l=t.render({children:l,leaf:a}))}));const h=!("void"===(null===(i=null===(o=null===(r=null===(n=t.children)||void 0===n?void 0:n.props)||void 0===r?void 0:r.parent)||void 0===o?void 0:o.props)||void 0===i?void 0:i.nodeType))&&d&&a.withPlaceholder;return e(na,Object.assign({attributes:s,placeholder:h?u:void 0},{children:l}))}),[o]),_=d((e=>{var t;f.readOnly||(null===(t=b.onKeyDown)||void 0===t||t.call(b,e),ta.onKeyDown(f)(e))}),[b.onKeyDown,f.readOnly,f.path.current,p.meta.order]),j=d((e=>{var t;f.readOnly||null===(t=null==b?void 0:b.onKeyUp)||void 0===t||t.call(b,e)}),[b.onKeyUp,f.readOnly]),D=d((e=>{var t;f.readOnly||(e.preventDefault(),null===(t=null==b?void 0:b.onBlur)||void 0===t||t.call(b,e))}),[b.onBlur,f.readOnly]),A=d((e=>{var t;f.readOnly||(f.isFocused()||(ee.set(f,!0),f.emit("focus",!0)),null===(t=null==b?void 0:b.onFocus)||void 0===t||t.call(b,e))}),[b.onFocus,f.readOnly]),P=d((e=>{var t;if(f.readOnly)return;null===(t=null==b?void 0:b.onPaste)||void 0===t||t.call(b,e);const n=e.clipboardData.getData("text/html"),r=(new DOMParser).parseFromString(n,"text/html");if(r.body.childNodes.length>0){const t=ca(f,r.body);if(t.length>0&&null!==f.path.current){e.preventDefault();let n=!1,r=!1;if(m&&m.selection){const e=x.parent(m.selection.anchor.path),t=y.string(m,e).trim(),o=y.isStart(m,m.selection.anchor,e);r=""===t&&o,n=!o||t.length>0,C.blur(m)}const o=f.path.current;if(null===o)return;return void f.batchOperations((()=>{const e=[];r&&f.deleteBlock({at:o}),t.forEach(((t,r)=>{let i=n?o+r+1:o+r;e.push(i);const l=Ll(t,["type"]);f.insertBlock(t.type,{at:i,focus:!1,blockData:l})})),f.setPath({current:null,selected:e,source:"copy-paste"})}))}}}),[b.onPaste,f.readOnly]),B=d((e=>{const t=[];if(f.readOnly)return t;const[n,r]=e,o=f.path.current===p.meta.order;return m.selection&&o&&!y.isEditor(n)&&""===y.string(m,[r[0]])&&E.includes(m.selection,r)&&E.isCollapsed(m.selection)&&t.push(Object.assign(Object.assign({},m.selection),{withPlaceholder:!0})),t}),[f.readOnly,f.path.current,p.meta.order]);return e(_a,{id:t,slate:m,initialValue:h,onChange:w,onSelectionChange:k,decorate:B,renderLeaf:S,renderElement:O,eventHandlers:b,onKeyDown:_,onKeyUp:j,onFocus:A,onBlur:D,customEditor:n,readOnly:f.readOnly,onPaste:P})},_a=p((({id:t,slate:n,initialValue:r,onChange:o,renderLeaf:i,renderElement:l,eventHandlers:a,onKeyDown:s,onKeyUp:c,onFocus:u,onSelectionChange:d,onPaste:f,customEditor:p,decorate:h,readOnly:g})=>"function"==typeof p?p({blockId:t}):e(A,Object.assign({editor:n,initialValue:r,onValueChange:o,onSelectionChange:d},{children:e(P,Object.assign({renderElement:l,renderLeaf:i,className:"yoopta-slate",spellCheck:!0},a,{onKeyDown:s,onKeyUp:c,onFocus:u,decorate:h,readOnly:g,onPaste:f}),`editable-${t}`)}),`slate-${t}`)));_a.displayName="SlateEditorInstance";const Ca=({editor:e})=>({sensors:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return s((()=>[...t].filter((e=>null!=e))),[...t])}(An(kr,{activationConstraint:{distance:20}}),An(vr,{coordinateGetter:So})),handleDragEnd:d((t=>{const{active:n,over:r}=t;if(n&&r&&n.id!==r.id){const t=e.children[r.id].meta.order;e.moveBlock(n.id,t)}}),[]),handleDragStart:d((t=>{e.setPath({current:null})}),[])});var ja;function Da(){return Da=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},Da.apply(this,arguments)}var Aa,Pa=function(e){return r.createElement("svg",Da({viewBox:"0 0 10 10",fill:"currentColor",style:{width:14,height:14,display:"block",flexShrink:0,backfaceVisibility:"hidden"}},e),ja||(ja=r.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 Ra(){return Ra=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},Ra.apply(this,arguments)}var Ba,Ta=function(e){return r.createElement("svg",Ra({viewBox:"0 0 16 16",fill:"currentColor",style:{width:16,height:16,display:"block",flexShrink:0,backfaceVisibility:"hidden"}},e),Aa||(Aa=r.createElement("path",{d:"M7.977 14.963c.407 0 .747-.324.747-.723V8.72h5.362c.399 0 .74-.34.74-.747a.746.746 0 0 0-.74-.738H8.724V1.706c0-.398-.34-.722-.747-.722a.732.732 0 0 0-.739.722v5.529h-5.37a.746.746 0 0 0-.74.738c0 .407.341.747.74.747h5.37v5.52c0 .399.332.723.739.723z"})))};function Ma(){return Ma=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},Ma.apply(this,arguments)}var Na=function(e){return r.createElement("svg",Ma({viewBox:"0 0 16 16",className:"turn_svg__loop",style:{width:16,height:16,display:"block",fill:"currentcolor",flexShrink:0,backfaceVisibility:"hidden"}},e),Ba||(Ba=r.createElement("path",{d:"M5.804 3.123c.006.38.254.622.673.622h4.887c.59 0 .914.305.914.92v6.628l-.901-.978-.514-.514c-.267-.254-.629-.273-.895-.013-.254.26-.248.635.012.895l2.165 2.158c.476.47 1.022.47 1.498 0l2.165-2.158c.26-.26.266-.635.012-.895-.266-.26-.628-.241-.895.013l-.514.514-.895.971V4.564c0-1.358-.71-2.063-2.082-2.063H6.477c-.42 0-.68.241-.673.622ZM.186 7.06c.26.266.622.247.889-.013l.52-.508.889-.971v6.722c0 1.359.71 2.063 2.082 2.063h4.957c.42 0 .68-.241.673-.622-.006-.387-.254-.622-.673-.622h-4.88c-.591 0-.915-.311-.915-.927V5.554l.895.984.52.508c.26.26.629.28.89.013.26-.26.253-.629-.013-.89L3.855 4.013c-.476-.476-1.016-.476-1.492 0L.2 6.17c-.267.26-.273.628-.013.889Z"})))};function La(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}var Ia=["color"],Fa=g((function(e,t){var n=e.color,r=void 0===n?"currentColor":n,o=La(e,Ia);return v("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o,{ref:t}),v("path",{d:"M1 9.50006C1 10.3285 1.67157 11.0001 2.5 11.0001H4L4 10.0001H2.5C2.22386 10.0001 2 9.7762 2 9.50006L2 2.50006C2 2.22392 2.22386 2.00006 2.5 2.00006L9.5 2.00006C9.77614 2.00006 10 2.22392 10 2.50006V4.00002H5.5C4.67158 4.00002 4 4.67159 4 5.50002V12.5C4 13.3284 4.67158 14 5.5 14H12.5C13.3284 14 14 13.3284 14 12.5V5.50002C14 4.67159 13.3284 4.00002 12.5 4.00002H11V2.50006C11 1.67163 10.3284 1.00006 9.5 1.00006H2.5C1.67157 1.00006 1 1.67163 1 2.50006V9.50006ZM5 5.50002C5 5.22388 5.22386 5.00002 5.5 5.00002H12.5C12.7761 5.00002 13 5.22388 13 5.50002V12.5C13 12.7762 12.7761 13 12.5 13H5.5C5.22386 13 5 12.7762 5 12.5V5.50002Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))})),za=["color"],$a=g((function(e,t){var n=e.color,r=void 0===n?"currentColor":n,o=La(e,za);return v("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o,{ref:t}),v("path",{d:"M3.625 7.5C3.625 8.12132 3.12132 8.625 2.5 8.625C1.87868 8.625 1.375 8.12132 1.375 7.5C1.375 6.87868 1.87868 6.375 2.5 6.375C3.12132 6.375 3.625 6.87868 3.625 7.5ZM8.625 7.5C8.625 8.12132 8.12132 8.625 7.5 8.625C6.87868 8.625 6.375 8.12132 6.375 7.5C6.375 6.87868 6.87868 6.375 7.5 6.375C8.12132 6.375 8.625 6.87868 8.625 7.5ZM12.5 8.625C13.1213 8.625 13.625 8.12132 13.625 7.5C13.625 6.87868 13.1213 6.375 12.5 6.375C11.8787 6.375 11.375 6.87868 11.375 7.5C11.375 8.12132 11.8787 8.625 12.5 8.625Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))})),Ha=["color"],Va=g((function(e,t){var n=e.color,r=void 0===n?"currentColor":n,o=La(e,Ha);return v("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o,{ref:t}),v("path",{d:"M8.51194 3.00541C9.18829 2.54594 10.0435 2.53694 10.6788 2.95419C10.8231 3.04893 10.9771 3.1993 11.389 3.61119C11.8009 4.02307 11.9513 4.17714 12.046 4.32141C12.4633 4.95675 12.4543 5.81192 11.9948 6.48827C11.8899 6.64264 11.7276 6.80811 11.3006 7.23511L10.6819 7.85383C10.4867 8.04909 10.4867 8.36567 10.6819 8.56093C10.8772 8.7562 11.1938 8.7562 11.389 8.56093L12.0077 7.94221L12.0507 7.89929C12.4203 7.52976 12.6568 7.2933 12.822 7.0502C13.4972 6.05623 13.5321 4.76252 12.8819 3.77248C12.7233 3.53102 12.4922 3.30001 12.1408 2.94871L12.0961 2.90408L12.0515 2.85942C11.7002 2.508 11.4692 2.27689 11.2277 2.11832C10.2377 1.46813 8.94398 1.50299 7.95001 2.17822C7.70691 2.34336 7.47044 2.57991 7.1009 2.94955L7.058 2.99247L6.43928 3.61119C6.24401 3.80645 6.24401 4.12303 6.43928 4.31829C6.63454 4.51355 6.95112 4.51355 7.14638 4.31829L7.7651 3.69957C8.1921 3.27257 8.35757 3.11027 8.51194 3.00541ZM4.31796 7.14672C4.51322 6.95146 4.51322 6.63487 4.31796 6.43961C4.12269 6.24435 3.80611 6.24435 3.61085 6.43961L2.99213 7.05833L2.94922 7.10124C2.57957 7.47077 2.34303 7.70724 2.17788 7.95035C1.50265 8.94432 1.4678 10.238 2.11799 11.2281C2.27656 11.4695 2.50766 11.7005 2.8591 12.0518L2.90374 12.0965L2.94837 12.1411C3.29967 12.4925 3.53068 12.7237 3.77214 12.8822C4.76219 13.5324 6.05589 13.4976 7.04986 12.8223C7.29296 12.6572 7.52943 12.4206 7.89896 12.051L7.89897 12.051L7.94188 12.0081L8.5606 11.3894C8.75586 11.1941 8.75586 10.8775 8.5606 10.6823C8.36533 10.487 8.04875 10.487 7.85349 10.6823L7.23477 11.301C6.80777 11.728 6.6423 11.8903 6.48794 11.9951C5.81158 12.4546 4.95642 12.4636 4.32107 12.0464C4.17681 11.9516 4.02274 11.8012 3.61085 11.3894C3.19896 10.9775 3.0486 10.8234 2.95385 10.6791C2.53661 10.0438 2.54561 9.18863 3.00507 8.51227C3.10993 8.35791 3.27224 8.19244 3.69924 7.76544L4.31796 7.14672ZM9.62172 6.08558C9.81698 5.89032 9.81698 5.57373 9.62172 5.37847C9.42646 5.18321 9.10988 5.18321 8.91461 5.37847L5.37908 8.91401C5.18382 9.10927 5.18382 9.42585 5.37908 9.62111C5.57434 9.81637 5.89092 9.81637 6.08619 9.62111L9.62172 6.08558Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))})),Ua=["color"],Ka=g((function(e,t){var n=e.color,r=void 0===n?"currentColor":n,o=La(e,Ua);return v("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o,{ref:t}),v("path",{d:"M5.5 1C5.22386 1 5 1.22386 5 1.5C5 1.77614 5.22386 2 5.5 2H9.5C9.77614 2 10 1.77614 10 1.5C10 1.22386 9.77614 1 9.5 1H5.5ZM3 3.5C3 3.22386 3.22386 3 3.5 3H5H10H11.5C11.7761 3 12 3.22386 12 3.5C12 3.77614 11.7761 4 11.5 4H11V12C11 12.5523 10.5523 13 10 13H5C4.44772 13 4 12.5523 4 12V4L3.5 4C3.22386 4 3 3.77614 3 3.5ZM5 4H10V12H5V4Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))})),Wa=function(){var e=document.getSelection();if(!e.rangeCount)return function(){};for(var t=document.activeElement,n=[],r=0;r<e.rangeCount;r++)n.push(e.getRangeAt(r));switch(t.tagName.toUpperCase()){case"INPUT":case"TEXTAREA":t.blur();break;default:t=null}return e.removeAllRanges(),function(){"Caret"===e.type&&e.removeAllRanges(),e.rangeCount||n.forEach((function(t){e.addRange(t)})),t&&t.focus()}},qa={"text/plain":"Text","text/html":"Url",default:"Text"};var Ya=function(e,t){var n,r,o,i,l,a,s=!1;t||(t={}),n=t.debug||!1;try{if(o=Wa(),i=document.createRange(),l=document.getSelection(),(a=document.createElement("span")).textContent=e,a.ariaHidden="true",a.style.all="unset",a.style.position="fixed",a.style.top=0,a.style.clip="rect(0, 0, 0, 0)",a.style.whiteSpace="pre",a.style.webkitUserSelect="text",a.style.MozUserSelect="text",a.style.msUserSelect="text",a.style.userSelect="text",a.addEventListener("copy",(function(r){if(r.stopPropagation(),t.format)if(r.preventDefault(),void 0===r.clipboardData){n&&console.warn("unable to use e.clipboardData"),n&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var o=qa[t.format]||qa.default;window.clipboardData.setData(o,e)}else r.clipboardData.clearData(),r.clipboardData.setData(t.format,e);t.onCopy&&(r.preventDefault(),t.onCopy(r.clipboardData))})),document.body.appendChild(a),i.selectNodeContents(a),l.addRange(i),!document.execCommand("copy"))throw new Error("copy command was unsuccessful");s=!0}catch(o){n&&console.error("unable to copy using execCommand: ",o),n&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(t.format||"text",e),t.onCopy&&t.onCopy(window.clipboardData),s=!0}catch(o){n&&console.error("unable to copy using clipboardData: ",o),n&&console.error("falling back to prompt"),r=function(e){var t=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return e.replace(/#{\s*key\s*}/g,t)}("message"in t?t.message:"Copy to clipboard: #{key}, Enter"),window.prompt(r,e)}}finally{l&&("function"==typeof l.removeRange?l.removeRange(i):l.removeAllRanges()),a&&document.body.removeChild(a),o()}return s};const Xa=t=>{var{className:n,children:r,lockScroll:o=!0}=t,i=Ll(t,["className","children","lockScroll"]);return e(Dl,Object.assign({lockScroll:o,className:n},i,{onClick:e=>{var t;e.stopPropagation(),null===(t=i.onClick)||void 0===t||t.call(i,e)},onMouseDown:e=>{var t;e.stopPropagation(),null===(t=i.onMouseDown)||void 0===t||t.call(i,e)}},{children:r}))},Za=t=>{const[n,r]=f(!1),o=a(null),i=Ut();return u((()=>{r(!0);const e=i.refElement;if(!e)return;return e.querySelector(".yoopta-overlays")||(o.current=document.createElement("div"),o.current.className="yoopta-overlays",e.appendChild(o.current)),()=>{o.current&&o.current.remove()}}),[]),n?e(_l,Object.assign({id:`${t.id}-${i.id}`,root:o.current||i.refElement},{children:t.children})):null},Ja=({children:t})=>e("div",Object.assign({className:"yoopta-block-options-group"},{children:t})),Ga=({children:t})=>e("div",Object.assign({onClick:e=>e.stopPropagation(),className:"yoopta-block-options-menu-content data-[state=open]:yoo-editor-animate-in data-[state=closed]:yoo-editor-animate-out data-[state=closed]:yoo-editor-fade-out-0 data-[state=open]:yoo-editor-fade-in-0 data-[state=closed]:yoo-editor-zoom-out-95 data-[state=open]:yoo-editor-zoom-in-95 data-[side=bottom]:yoo-editor-slide-in-from-top-2 data-[side=left]:yoo-editor-slide-in-from-right-2 data-[side=right]:yoo-editor-slide-in-from-left-2 data-[side=top]:yoo-editor-slide-in-from-bottom-2"},{children:t})),Qa=({children:t})=>e("div",Object.assign({className:"yoopta-block-options-item"},{children:t})),es=["delete","duplicate","turnInto","copy"],ts=({isOpen:n,onClose:r,refs:o,style:i,actions:l=es,children:a})=>{var s,c,u;const d=Ut(),p=Do(),[h,g]=f(!1),{refs:v,floatingStyles:y,context:m}=Al({placement:"right",open:h,onOpenChange:g,middleware:[Ti(),Bi(),Ri(),gi(10)],whileElementsMounted:Pi}),{isMounted:b,styles:w}=Tl(m,{duration:100});if(!n)return null;const k=ne(d,{at:d.path.current}),x=H(null===(s=d.blocks[(null==k?void 0:k.type)||""])||void 0===s?void 0:s.elements),O="void"===(null===(c=null==x?void 0:x.props)||void 0===c?void 0:c.nodeType),E=p.ActionMenu,S=Object.assign(Object.assign({},y),w),_=Ml({editor:d,view:"small",onClose:()=>{g(!1),r()}});return e(Za,Object.assign({id:"yoo-block-options-portal"},{children:e(Xa,Object.assign({lockScroll:!0,className:"yoo-editor-z-[100]",onClick:r},{children:e("div",Object.assign({style:i,ref:o.setFloating,contentEditable:!1},{children:t(Ga,{children:[null!==l&&t(Ja,{children:[e(Qa,{children:t("button",Object.assign({type:"button",className:"yoopta-block-options-button",onClick:()=>{d.deleteBlock({at:d.path.current}),d.setPath({current:null}),r()}},{children:[e(Ka,{className:"yoo-editor-w-4 yoo-editor-h-4 yoo-editor-mr-2"}),"Delete"]}))}),e(Qa,{children:t("button",Object.assign({type:"button",className:"yoopta-block-options-button",onClick:()=>{"number"==typeof d.path.current&&(d.duplicateBlock({original:{path:d.path.current},focus:!0}),r())}},{children:[e(Fa,{className:"yoo-editor-w-4 yoo-editor-h-4 yoo-editor-mr-2"}),"Duplicate"]}))}),!!E&&!O&&!(null===(u=d.blocks[(null==k?void 0:k.type)||""])||void 0===u?void 0:u.hasCustomEditor)&&t(Qa,{children:[b&&e(Za,Object.assign({id:"yoo-block-options-portal"},{children:e(Xa,Object.assign({lockScroll:!0,className:"yoo-editor-z-[100]",onClick:()=>g(!1)},{children:e("div",Object.assign({style:S,ref:v.setFloating},{children:e(E,Object.assign({},_))}))}))})),t("button",Object.assign({type:"button",className:"yoopta-block-options-button",ref:v.setReference,onClick:()=>g((e=>!e))},{children:[e(Na,{className:"yoo-editor-w-4 yoo-editor-h-4 yoo-editor-mr-2"}),"Turn into"]}))]}),e(Qa,{children:t("button",Object.assign({type:"button",className:"yoopta-block-options-button",onClick:()=>{const e=ne(d);e&&(Ya(`${window.location.origin}${window.location.pathname}#${e.id}`),d.emit("block:copy",e)),r()}},{children:[e(Va,{className:"yoo-editor-w-4 yoo-editor-h-4 yoo-editor-mr-2"}),"Copy link to block"]}))})]}),a]})}))}))}))};var ns=Object.freeze({__proto__:null,BlockOptions:ts,BlockOptionsMenuContent:Ga,BlockOptionsMenuGroup:Ja,BlockOptionsMenuItem:Qa,BlockOptionsSeparator:({className:t=""})=>e("div",{className:`yoopta-block-options-separator ${t}`})});const rs={position:"fixed",top:0,left:0,opacity:0,transform:"scale(0.95) translateX(-46px)",transition:"opacity 150ms ease-out"},os=p((({editor:n,dragHandleProps:r})=>{const[o,i]=f(null),l=a(null),[s,c]=f(rs),{attributes:d,listeners:p,setActivatorNodeRef:h}=r||{},{isBlockOptionsMounted:g,setIsBlockOptionsOpen:v,blockOptionsFloatingStyle:m,blockOptionsRefs:b}=(()=>{const[e,t]=f(!1),{refs:n,floatingStyles:r,context:o}=Al({placement:"right-start",open:e,onOpenChange:t,middleware:[Ti(),Bi(),Ri(),gi()]}),{isMounted:i,styles:l}=Tl(o,{duration:100});return{blockOptionsRefs:n,blockOptionsFloatingStyle:Object.assign(Object.assign({},r),l),isBlockOptionsOpen:e,setIsBlockOptionsOpen:t,isBlockOptionsMounted:i}})(),{isActionMenuOpen:k,actionMenuRefs:x,hasActionMenu:O,actionMenuStyles:E,onChangeActionMenuOpen:S,onCloseActionMenu:_,actionMenuRenderProps:j,ActionMenu:D}=(({editor:e})=>{const t=Do().ActionMenu,[n,r]=f(!1),{refs:o,floatingStyles:i,context:l}=Al({placement:"bottom-start",open:n,onOpenChange:r,middleware:[Ti(),Bi(),Ri(),gi(10)],whileElementsMounted:Pi}),{isMounted:a,styles:s}=Tl(l,{duration:100}),c=Object.assign(Object.assign({},i),s),u=e=>r(e),d=()=>u(!1),p=Ml({editor:e,view:"default",mode:"create",onClose:d});return{isActionMenuOpen:a,actionMenuStyles:c,actionMenuRefs:o,hasActionMenu:!!t,onChangeActionMenuOpen:u,actionMenuRenderProps:p,onCloseActionMenu:d,ActionMenu:t}})({editor:n}),A=()=>{c((e=>Object.assign(Object.assign({},e),{opacity:0,transform:rs.transform}))),setTimeout((()=>{i(null)}),150)},P=function(e,t,{leading:n=!0,trailing:r=!0}={}){let o=0,i=null,l=null;const a=t=>{e(...l),o=t,l=null},s=(...e)=>{const s=Date.now();o||n||(o=s);const c=t-(s-o);l=e,c<=0||c>t?(i&&(clearTimeout(i),i=null),a(s)):!i&&r&&(i=setTimeout((()=>{i=null,r&&l&&a(Date.now())}),c))};return s.cancel=()=>{i&&(clearTimeout(i),i=null),l=null,o=0},s}((e=>{var t;if(!(null===(t=n.refElement)||void 0===t?void 0:t.contains(e.target)))return A();if(n.readOnly)return;const r=e.target.closest("[data-yoopta-block]");if(r){const e=r.getAttribute("data-yoopta-block-id");if(e===(null==o?void 0:o.id))return;const t=n.children[e||""];t&&((e,t)=>{var n;i(t);const r=e.getBoundingClientRect(),o=(null===(n=l.current)||void 0===n?void 0:n.offsetWidth)||46;c((e=>Object.assign(Object.assign({},e),{top:r.top+2,left:r.left,opacity:1,transform:`scale(1) translateX(-${o}px)`})))})(r,t)}}),100,{leading:!0,trailing:!0});u((()=>(document.addEventListener("scroll",A),document.addEventListener("mousemove",P),()=>{document.removeEventListener("scroll",A),document.removeEventListener("mousemove",P),P.cancel()})),[]);return e(Za,Object.assign({id:"block-actions"},{children:e("div",Object.assign({contentEditable:!1,style:s,className:"yoopta-block-actions",ref:l},{children:t("div",Object.assign({className:"yoopta-block-action-buttons"},{children:[k&&O&&e(Za,Object.assign({id:"yoo-block-options-portal"},{children:e(Xa,Object.assign({lockScroll:!0,className:"yoo-editor-z-[100]",onClick:_},{children:e("div",Object.assign({style:E,ref:x.setFloating},{children:e(D,Object.assign({},j))}))}))})),e("button",Object.assign({type:"button",onClick:()=>{var e;const t=o;if(!t)return;const r=Ee.getBlockSlate(n,{id:t.id}),i=n.blocks[t.type];if(!r)return;const l=document.querySelector(`[data-yoopta-block-id="${t.id}"]`),a=H(i.elements);let s;i.hasCustomEditor||(s=y.string(r,[0]));const c="string"==typeof s&&0===s.trim().length;if(O&&c&&"void"!==(null===(e=null==a?void 0:a.props)||void 0===e?void 0:e.nodeType))n.setPath({current:t.meta.order}),n.focusBlock(t.id),x.setReference(l),S(!0);else{const e=Ee.buildBlockData({id:I()}),r=t.meta.order+1;n.setPath({current:t.meta.order}),n.insertBlock(e.type,{at:r,focus:!0}),O&&setTimeout((()=>{l&&x.setReference(l.nextSibling),S(!0)}),0)}},className:"yoopta-block-actions-plus"},{children:e(Ta,{})})),e("button",Object.assign({ref:e=>{null==h||h(e),b.setReference(e)},type:"button",className:"yoopta-block-actions-drag",onClick:e=>{e.stopPropagation();const t=o;if(!t)return;const r=re(n,{at:t.meta.order});n.focusBlock(t.id),r&&setTimeout((()=>{n.blocks[t.type].hasCustomEditor||(C.blur(r),C.deselect(r),w.deselect(r)),n.setPath({current:t.meta.order,selected:[t.meta.order]}),v(!0)}),10)}},d,p,{children:e(Pa,{})})),e(ts,{isOpen:g,refs:b,style:m,onClose:()=>v(!1)})]}))}))}))}));os.displayName="FloatingBlockActions";const is=[],ls=({editor:r,marks:o,placeholder:i})=>{const l=qt(),{sensors:a,handleDragEnd:c,handleDragStart:u}=Ca({editor:r}),[d,p]=f(null),h=Object.keys(r.children),g=s((()=>0===h.length?is:h.sort(((e,t)=>r.children[e].meta.order-r.children[t].meta.order))),[h]),v=[];for(let t=0;t<g.length;t++){const n=g[t],l=r.children[n],a=r.plugins[l.type];l&&a?v.push(e(Nl,Object.assign({block:l,blockId:n,onActiveDragHandleChange:p},{children:e(Sa,{type:l.type,id:n,marks:o,customEditor:a.customEditor,events:a.events,elements:a.elements,options:a.options,extensions:a.extensions,placeholder:i},n)}),n)):console.error(`Plugin ${l.type} not found`)}return l?e(n,{children:v}):e(Qr,Object.assign({id:"yoopta-dnd-context",sensors:a,collisionDetection:In,onDragStart:u,onDragEnd:c},{children:t(go,Object.assign({disabled:l,items:g,strategy:fo},{children:[v,e(os,{editor:r,dragHandleProps:d})]}))}))},as=({editor:e,root:t})=>{const[n,r]=f({origin:[0,0],coords:[0,0],selection:!1}),o=o=>{var i;if(e.readOnly||!1===t)return;const l=null===(i=e.refElement)||void 0===i?void 0:i.contains(o.target),s=Z.getSelectedPaths(e);if(!l&&!n.selection&&Array.isArray(s)&&s.length>0)return e.setPath({current:null}),a();l||r({origin:[o.pageX,o.pageY-window.pageYOffset],coords:[o.pageX,o.pageY-window.pageYOffset],selection:!0})},i=o=>{if(!n.selection||e.readOnly||!1===t)return;r((e=>Object.assign(Object.assign({},e),{coords:[o.pageX,o.pageY-window.pageYOffset]})));const i=((e,t,n)=>{var r;const o=[],i=null===(r=e.refElement)||void 0===r?void 0:r.querySelectorAll("[data-yoopta-block]");return i?(i.forEach(((e,r)=>{if(!e)return;const i=e.getBoundingClientRect(),l=Math.min(t[1],n[1]),a=Math.min(t[0],n[0]),s=Math.max(t[1],n[1]),c=Math.max(t[0],n[0]);l<i.bottom&&s>i.top&&a<i.right&&c>i.left&&o.push(r)})),o):o})(e,n.origin,[o.pageX,o.pageY-window.pageYOffset]);e.setPath({current:null,selected:i,source:"selection-box"})},l=()=>{e.readOnly||a()};u((()=>{var n;if(e.readOnly||!1===t)return;const r=t&&"current"in t?t.current:t||document;if(!r)throw new Error("Root element not found. Please check the `selectionBoxRoot` prop");if(!("nodeType"in r))throw new Error("Root element should be a DOM element or a ref object. Please check the `selectionBoxRoot` prop");if(null===(n=e.refElement)||void 0===n?void 0:n.contains(r))throw new Error("Root element should not be a child of the editor. Please check the `selectionBoxRoot` prop");return r.addEventListener("mousedown",o),r.addEventListener("mousemove",i),r.addEventListener("mouseup",l),()=>{r.removeEventListener("mousedown",o),r.removeEventListener("mousemove",i),r.removeEventListener("mouseup",l)}}),[e.path,n,t,e.readOnly]);const a=()=>{r({origin:[0,0],coords:[0,0],selection:!1})};return Object.assign(Object.assign({},n),{onClose:a})},ss=({origin:t,coords:n,isOpen:r})=>{if(!r)return null;const o={zIndex:10,left:t[0],top:t[1],height:Math.abs(n[1]-t[1]-1),width:Math.abs(n[0]-t[0]-1),userSelect:"none",transformOrigin:"top left",transform:t[1]>n[1]&&t[0]>n[0]?"scaleY(-1) scaleX(-1)":t[1]>n[1]?"scaleY(-1)":t[0]>n[0]?"scaleX(-1)":void 0,position:"fixed",backgroundColor:"rgba(35, 131, 226, 0.14)"};return e("div",{style:o})},cs={selectionStarted:!1,indexToSelect:null,startedIndexToSelect:null};function us({editor:e}){const t=a(!1),n=a(!1),r=a(null),o=a(null);let i=a(cs).current;const l=()=>{const t=e.path.current;if("number"==typeof t){const n=Ee.getBlockSlate(e,{at:t}),r=Ee.getBlock(e,{at:t}),o=e.blocks[(null==r?void 0:r.type)||""];if(!n||(null==o?void 0:o.hasCustomEditor))return;try{y.withoutNormalizing(n,(()=>{w.select(n,[0]),n.selection&&E.isExpanded(n.selection)&&(C.blur(n),C.deselect(n))}))}catch(e){}}},s=i=>{if(!t.current||e.readOnly)return;const a=document.elementFromPoint(i.clientX,i.clientY),s=null==a?void 0:a.closest("[data-yoopta-block]");s&&e.batchOperations((()=>{var t;const i=s.getAttribute("data-yoopta-block-id")||"",a=null===(t=e.children[i])||void 0===t?void 0:t.meta.order;if(n.current&&"number"==typeof a&&a===r.current)return o.current=a,void e.setPath({current:a,selected:[a],source:"mousemove"});if("number"==typeof a&&a!==o.current){o.current=a,n.current=!0;const t=Math.min(r.current,a),i=Math.max(r.current,a);l();const s=Array.from({length:i-t+1},((e,n)=>t+n));e.setPath({current:a,selected:s,source:"mousemove"})}}))},c=()=>{var i,l;t.current=!1,n.current=!1,r.current=null,o.current=null,null===(i=e.refElement)||void 0===i||i.removeEventListener("mousemove",s),null===(l=e.refElement)||void 0===l||l.removeEventListener("mouseup",c),null===document||void 0===document||document.removeEventListener("mouseup",c)};return{onMouseDown:n=>{e.readOnly||(e.isFocused()||e.focus(),e.batchOperations((()=>{var i,a,u;const d=Z.getSelectedPaths(e);Array.isArray(d)&&d.length>0&&!n.shiftKey&&!n.altKey&&e.setPath({current:null});const f=n.target.closest("[data-yoopta-block]");if(f&&0===n.button){const d=f.getAttribute("data-yoopta-block-id")||"",p=null===(i=e.children[d])||void 0===i?void 0:i.meta.order;if("number"==typeof p){if(t.current=!0,r.current=p,o.current=p,n.shiftKey&&!Z.isPathEmpty(e)&&p!==e.path.current)return void(t=>{l();const n=Z.getPath(e);if("number"!=typeof n)return;const r=Array.from({length:Math.abs(t-n)}).map(((e,r)=>t>n?n+r+1:n-r-1));e.setPath({current:t,selected:[...r,n],source:"keyboard"})})(p);p!==e.path.current&&e.setPath({current:p}),null===(a=e.refElement)||void 0===a||a.addEventListener("mousemove",s),null===(u=e.refElement)||void 0===u||u.addEventListener("mouseup",c),null===document||void 0===document||document.addEventListener("mouseup",c)}}})))},onShiftArrowUp:t=>{if("function"==typeof t.isDefaultPrevented&&t.isDefaultPrevented())return;if(i.selectionStarted&&null!==i.startedIndexToSelect&&null!==i.indexToSelect){const t=i.indexToSelect,n=t-1;if(0===t)return;if(t===i.startedIndexToSelect){const t=e.path.selected?[...e.path.selected,n]:[n];return e.setPath({current:n,selected:t,source:"keyboard"}),void(i.indexToSelect=n)}if(n<i.startedIndexToSelect){const t=e.path.selected?[...e.path.selected,n]:[n];return e.setPath({current:n,selected:t,source:"keyboard"}),void(i.indexToSelect=n)}const r=Z.getSelectedPaths(e);if((null==r?void 0:r.includes(t))&&t!==i.startedIndexToSelect){const o=r.filter((e=>e!==t));return e.setPath({current:n,selected:o,source:"keyboard"}),void(i.indexToSelect=n)}return}const n=ne(e),r=re(e);if(!r||!r.selection||!n)return;const o=x.parent(r.selection.anchor.path),l=y.isStart(r,r.selection.focus,o);if(E.isExpanded(r.selection)&&l){const o=q(e);if("number"!=typeof o)return;const l=ne(e,{at:o});if(n&&l){t.preventDefault(),C.blur(r),C.deselect(r),w.deselect(r);const o=e.path.selected?[...e.path.selected,null==n?void 0:n.meta.order,n.meta.order-1]:[null==n?void 0:n.meta.order,n.meta.order-1];e.setPath({current:null,selected:o,source:"keyboard"}),i.startedIndexToSelect=n.meta.order,i.indexToSelect=n.meta.order-1,i.selectionStarted=!0}}},onShiftArrowDown:t=>{if(i.selectionStarted&&null!==i.indexToSelect&&null!==i.startedIndexToSelect){const t=i.indexToSelect,n=t+1;if(n===Object.keys(e.children).length)return;if(t===i.startedIndexToSelect){const t=e.path.selected?[...e.path.selected,n]:[n];return e.setPath({current:n,selected:t,source:"keyboard"}),void(i.indexToSelect=n)}if(n>i.startedIndexToSelect){const t=e.path.selected?[...e.path.selected,n]:[n];return e.setPath({current:n,selected:t,source:"keyboard"}),void(i.indexToSelect=n)}const r=Z.getSelectedPaths(e);if((null==r?void 0:r.includes(t))&&t!==i.startedIndexToSelect){const o=r.filter((e=>e!==t));return e.setPath({current:n,selected:o,source:"keyboard"}),void(i.indexToSelect=n)}return}const n=ne(e),r=re(e);if(!r||!r.selection||!n)return;const o=x.parent(r.selection.anchor.path),l=y.isEnd(r,r.selection.focus,o);if(E.isExpanded(r.selection)&&l){const o=Z.getNextPath(e),l=ne(e,{at:o});if(n&&l){t.preventDefault(),C.blur(r),C.deselect(r),w.deselect(r);const o=e.path.selected?[...e.path.selected,null==n?void 0:n.meta.order,(null==n?void 0:n.meta.order)+1]:[null==n?void 0:n.meta.order,n.meta.order+1];e.setPath({current:null,selected:o,source:"keyboard"}),i.startedIndexToSelect=n.meta.order,i.indexToSelect=n.meta.order+1,i.selectionStarted=!0}}},selectionState:i}}const ds=({placeholder:n,marks:r,className:o,selectionBoxRoot:i,width:l,style:a,children:s,autoFocus:c=!0})=>{const d=Ut(),f=qt(),p=as({editor:d,root:i}),h=us({editor:d});u((()=>{c&&!f&&d.focus()}),[c,f]),u((()=>{if(!f)return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)}),[d.path,f]);const g=()=>{h.selectionState.indexToSelect=null,h.selectionState.startedIndexToSelect=null,h.selectionState.selectionStarted=!1},v=e=>{if(!f){if(ea.isRedo(e))return e.preventDefault(),void d.redo();if(ea.isUndo(e))return e.preventDefault(),void d.undo();if(ea.isSelect(e)){const t=Z.getSelectedPaths(d);if((null==t?void 0:t.length)===Object.keys(d.children).length)return void e.preventDefault();if(Array.isArray(t)&&t.length>0){e.preventDefault();const t=Object.keys(d.children).map(((e,t)=>t));return void d.setPath({current:null,selected:t,source:"keyboard"})}}if(ea.isCopy(e)||ea.isCut(e)){const t=Z.getSelectedPaths(d);if(Array.isArray(t)&&t.length>0){e.preventDefault();const t=d.getHTML(d.getEditorValue()),n=d.getPlainText(d.getEditorValue()),r=new Blob([t],{type:"text/html"}),o=new Blob([n],{type:"text/plain"}),i=new ClipboardItem({"text/html":r,"text/plain":o});return navigator.clipboard.write([i]).then((()=>{const e=(new DOMParser).parseFromString(t,"text/html");console.log("HTML copied\n",e.body)})),void(ea.isCut(e)&&(d.batchOperations((()=>{const e=Z.getSelectedPaths(d);if(Array.isArray(e)&&e.length>0){const t=e.length===Object.keys(d.children).length;if(e.forEach((e=>{var t;const n=null===(t=Ee.getBlock(d,{at:e}))||void 0===t?void 0:t.id;n&&d.deleteBlock({blockId:n})})),t){const e=z({id:I()});d.insertBlock(e.type,{at:0,focus:!0})}}})),d.setPath({current:null,selected:null,source:"copy-paste"}),g()))}}if(ea.isBackspace(e)){e.stopPropagation();const t=Z.getSelectedPaths(d);return(null==t?void 0:t.length)===Object.keys(d.children).length?(e.preventDefault(),void d.batchOperations((()=>{Object.keys(d.children).forEach((e=>d.deleteBlock({blockId:e}))),d.setPath({current:null,selected:null}),g()}))):void d.batchOperations((()=>{const t=Z.getSelectedPaths(d);Array.isArray(t)&&(null==t?void 0:t.length)>0&&(e.preventDefault(),t.forEach((e=>d.deleteBlock({at:e}))),d.setPath({current:null,selected:null}),g())}))}if(ea.isShiftArrowUp(e)&&h.onShiftArrowUp(e),ea.isShiftArrowDown(e)&&h.onShiftArrowDown(e),ea.isTab(e)){const t=Z.getSelectedPaths(d);Array.isArray(t)&&t.length>0&&(e.preventDefault(),d.batchOperations((()=>{t.forEach((e=>{const t=Ee.getBlock(d,{at:e});d.increaseBlockDepth({blockId:null==t?void 0:t.id})}))})))}else if(ea.isShiftTab(e)){const t=Z.getSelectedPaths(d);Array.isArray(t)&&t.length>0&&(e.preventDefault(),d.batchOperations((()=>{t.forEach((e=>{const t=Ee.getBlock(d,{at:e});d.decreaseBlockDepth({blockId:null==t?void 0:t.id})}))})))}else;}},b=e=>{if(!f)return;const t=e.clipboardData,n=window.getSelection();if(n&&n.rangeCount>0){const e=n.getRangeAt(0);if(e.collapsed)return;const r=e.cloneContents().querySelectorAll("[data-yoopta-block-id]");if(!r.length)return;const o=Array.from(r).reduce(((e,t)=>{const n=t.getAttribute("data-yoopta-block-id")||"",r=d.children[n];return r&&(e[n]=r),e}),{}),i=d.getHTML(o),l=d.getPlainText(o);return t.setData("text/html",i),void t.setData("text/plain",l)}},w=(k=Object.assign(Object.assign({},a),{userSelect:p.selection?"none":"auto",pointerEvents:p.selection?"none":"auto",width:l||(null==a?void 0:a.width),paddingBottom:null==a?void 0:a.paddingBottom}),Object.assign(Object.assign({},k),{width:k.width||400,paddingBottom:"number"==typeof k.paddingBottom?k.paddingBottom:100}));var k;return t("div",Object.assign({ref:e=>d.refElement=e,className:o?`yoopta-editor ${o}`:"yoopta-editor",style:w,onMouseDown:e=>{f||(h.onMouseDown(e),g(),(e=>{var t;const n=d.refElement;if(!n)return;const{bottom:r}=n.getBoundingClientRect(),o=r-parseInt(getComputedStyle(n).paddingBottom,10),i=z({id:I()});if(e.clientY>=o){const e=Object.keys(d.children).length-1,n=ne(d,{at:e}),r=re(d,{at:e});if(n&&r&&r.selection){const e=y.string(r,r.selection.anchor.path),o=x.parent(r.selection.anchor.path),[l]=y.node(r,o);if(n.type===i.type&&m.isElement(l)&&"void"!==(null===(t=l.props)||void 0===t?void 0:t.nodeType)&&0===e.trim().length)return void d.focusBlock(n.id,{slate:r})}const o=e+1;d.insertBlock(i.type,{at:o,focus:!0})}})(e))},onBlur:e=>{var t,n;if((null===(t=d.refElement)||void 0===t?void 0:t.contains(e.relatedTarget))||(null===(n=d.refElement)||void 0===n?void 0:n.contains(e.target))||f)return;g();const r=Z.getSelectedPaths(d);Array.isArray(r)&&r.length>0&&d.setPath({current:null,selected:null})},onCopy:b,onCut:b},{children:[e(ls,{editor:d,marks:r,placeholder:n}),!1!==i&&e(ss,{origin:p.origin,coords:p.coords,isOpen:p.selection&&!f}),s]}))};function fs(e,t){const n=re(e);if(!n)return!1;const r=y.marks(n);return!!(null==r?void 0:r[t])}function ps(e,t){const n={};return t.forEach((t=>{const r=t.type;n[r]={hotkey:t.hotkey,type:r,getValue:()=>function(e,t){const n=re(e);if(!n)return null;const r=y.marks(n);return null==r?void 0:r[t]}(e,r),isActive:()=>fs(e,r),toggle:()=>function(e,t){if(Array.isArray(e.path.selected)&&e.path.selected.length>0){const n=e.path.selected.map((n=>{const r=Ee.getBlockSlate(e,{at:n});if(!r)return{isActiveMark:!1,slate:r};const[o]=y.node(r,[]);if(!o)return{isActiveMark:!1,slate:r};const i=y.end(r,[]),l=y.start(r,[]);w.select(r,{anchor:l,focus:i});const a=y.marks(r);return{slate:r,isActiveMark:!!(null==a?void 0:a[t])}})),r=n.every((e=>e.isActiveMark));for(const e of n)e.isActiveMark?r&&y.removeMark(e.slate,t):y.addMark(e.slate,t,!0);return}const n=re(e),r=fs(e,t);n&&n.selection&&(r?y.removeMark(n,t):y.addMark(n,t,!0))}(e,r),update:t=>function(e,t,n){if(Array.isArray(e.path.selected)&&e.path.selected.length>0){for(const r of e.path.selected){const o=Ee.getBlockSlate(e,{at:r});if(!o)continue;const[i]=y.node(o,[]);if(!i)continue;const l=y.end(o,[]),a=y.start(o,[]);w.select(o,{anchor:a,focus:l});const s=y.marks(o);(null==s?void 0:s[t])?y.removeMark(o,t):y.addMark(o,t,n)}return}const r=re(e);r&&r.selection&&E.isExpanded(r.selection)&&y.addMark(r,t,n)}(e,r,t)}})),n}function hs({type:e,hotkey:t,render:n}){return{type:e,hotkey:t,render:n}}const gs=hs({type:"fakeSelection",render:t=>e("span",Object.assign({style:{backgroundColor:"#d7e6fa"}},{children:t.children}))}),vs=({id:t,editor:n,value:r,marks:o,plugins:i,autoFocus:l,className:a,tools:c,selectionBoxRoot:p,children:h,placeholder:g,readOnly:v,width:y,style:m,onChange:b,onPathChange:w})=>{const k=s((()=>o?[gs,...o]:[gs]),[o]),x=s((()=>i.map((e=>e.getPlugin))),[i]),[O,E]=f((()=>{n.id||(n.id=t||I()),n.readOnly=v||!1,k&&(n.formats=ps(n,k)),n.blocks=function(e,t){const n={};return t.forEach((t=>{var r;const o=H(t.elements),i=null===(r=null==o?void 0:o.props)||void 0===r?void 0:r.nodeType;if("inline"!==i&&"inlineVoid"!==i){const r={};Object.keys(t.elements).forEach((e=>{const n=Ll(t.elements[e],["render"]);r[e]=n}));const{display:o,placeholder:i,shortcuts:l}=t.options||{};n[t.type]={type:t.type,elements:r,hasCustomEditor:!!t.customEditor,options:{display:o,placeholder:i,shortcuts:l},isActive:()=>{const n=ne(e,{at:e.path.current});return(null==n?void 0:n.type)===t.type}}}})),n}(n,x);const e=fe(r);return e||void 0===r||console.error(`Initial value is not valid. Should be an object with blocks. You passed: ${JSON.stringify(r)}`),n.children=e?r:{},n.blockEditorsMap=function(e){const t={};return Object.keys(e.children).forEach((n=>{const r=kt(e);if(0===r.children.length){const t=e.children[n];if(t){const n=K(e,t.type);r.children=[n]}}t[n]=r})),t}(n),n.shortcuts=function(e){const t={};return Object.values(e.blocks).forEach((e=>{var n,r,o,i;e.options&&Array.isArray(null===(n=e.options)||void 0===n?void 0:n.shortcuts)&&(null===(r=e.options)||void 0===r?void 0:r.shortcuts.length)>0&&(null===(i=null===(o=e.options)||void 0===o?void 0:o.shortcuts)||void 0===i||i.forEach((n=>{t[n]=e})))})),t}(n),n.plugins=function(e){const t={},n={};return e.forEach((e=>{e.elements&&Object.keys(e.elements).forEach((t=>{var r;const o=e.elements[t],i=null===(r=o.props)||void 0===r?void 0:r.nodeType;"inline"!==i&&"inlineVoid"!==i||(n[t]=Object.assign(Object.assign({},o),{rootPlugin:e.type}))})),t[e.type]=e})),e.forEach((e=>{if(e.elements){const r=Object.assign(Object.assign({},e.elements),n);t[e.type]=Object.assign(Object.assign({},e),{elements:r})}})),t}(x),n.commands=function(e,t){const n={};return t.forEach((t=>{t.commands&&Object.keys(t.commands).forEach((r=>{var o;(null===(o=t.commands)||void 0===o?void 0:o[r])&&(n[r]=(...n)=>{var o;return null===(o=t.commands)||void 0===o?void 0:o[r](e,...n)})}))})),n}(n,x),{editor:n,version:0}})),[S,_]=f(null),C=d((e=>{_(e),null==w||w(e)}),[]),j=d(((e,t)=>{if(E((e=>({editor:e.editor,version:e.version+1}))),"function"==typeof b&&Array.isArray(t.operations)){const n=t.operations.filter((e=>"validate_block_paths"!==e.type&&"set_block_path"!==e.type&&"set_slate"!==e.type));n.length>0&&b(e,{operations:n})}}),[]);return u((()=>{const e=e=>{j(e.value,{operations:e.operations})};return n.on("change",e),n.on("path-change",C),()=>{n.off("change",e),n.off("path-change",C)}}),[n,j]),e(Vt,Object.assign({editorState:O},{children:e(jo,Object.assign({tools:c},{children:e(ds,Object.assign({placeholder:g,marks:k,autoFocus:l,className:a,selectionBoxRoot:p,width:y,style:m},{children:h}))}))}))},ys=Object.assign(Object.assign({},ns),{ExtendedBlockActions:({id:r,className:o,style:i,onClick:l,children:a})=>{const s=qt(),[c,u]=f(!1),{refs:d,floatingStyles:p,context:h}=Al({placement:"bottom-start",open:c,onOpenChange:u,middleware:[Ti(),Bi(),Ri(),gi(10)],whileElementsMounted:Pi}),{isMounted:g,styles:v}=Tl(h,{duration:100}),y=Object.assign(Object.assign({},v),p);return s?null:t(n,{children:[g&&e(ts,Object.assign({isOpen:!0,onClose:()=>u(!1),refs:d,style:y},{children:a})),e("button",Object.assign({type:"button",contentEditable:!1,ref:d.setReference,id:r,className:`yoopta-button yoopta-extended-block-actions ${o||""}`,onClick:()=>{null==l||l(),u(!0)},style:c?Object.assign(Object.assign({},i),{opacity:1}):i},{children:e($a,{})}))]})},Portal:Za,Overlay:Xa});function ms(e,t){var n;const r=[];return t.forEach((t=>{if(t.nodeType===Node.TEXT_NODE&&r.push({text:t.textContent||""}),t.nodeType===Node.ELEMENT_NODE){const n=t;if("P"!==n.nodeName&&"SPAN"!==n.nodeName&&"DIV"!==n.nodeName||r.push(Object.assign({},ms(e,n.childNodes)[0])),"B"!==n.nodeName&&"STRONG"!==n.nodeName||r.push(Object.assign({bold:!0},ms(e,n.childNodes)[0])),"I"!==n.nodeName&&"EM"!==n.nodeName||r.push(Object.assign({italic:!0},ms(e,n.childNodes)[0])),"S"!==n.nodeName&&"STRIKE"!==n.nodeName||r.push(Object.assign({strike:!0},ms(e,n.childNodes)[0])),"U"!==n.nodeName&&"INS"!==n.nodeName||r.push(Object.assign({underline:!0},ms(e,n.childNodes)[0])),"CODE"===n.nodeName&&r.push(Object.assign({code:!0},ms(e,n.childNodes)[0])),"MARK"===n.nodeName){const t=n.style.color,o=n.style.backgroundColor||"transparent";r.push(Object.assign({highlight:{color:t,backgroundColor:o}},ms(e,n.childNodes)[0]))}"A"===n.nodeName&&r.push({id:I(),type:"link",props:{url:n.getAttribute("href")||"",target:n.getAttribute("target")||"",rel:n.getAttribute("rel")||""},children:ms(e,n.childNodes)})}})),0!==r.length||(null===(n=r[0])||void 0===n?void 0:n.text)||r.push({text:""}),r}!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))}}('.yoo-editor-z-\\[100\\]{z-index:100}.yoo-editor-mr-2{margin-right:.5rem}.yoo-editor-h-4{height:1rem}.yoo-editor-w-4{width:1rem}.yoopta-editor *{border:0 solid #e5e7eb;box-sizing:border-box;scrollbar-color:#d3d1cb transparent}::-moz-selection{background:#c6ddf8}::selection{background:#c6ddf8}.yoopta-placeholder{display:contents;position:relative}.yoopta-placeholder:after{color:inherit;content:attr(data-placeholder);cursor:text;font-size:75%;font-style:inherit;font-weight:inherit;opacity:.5;padding-left:5px;pointer-events:none;position:absolute;text-indent:2px;top:50%;transform:translateY(-50%);-webkit-user-select:none;-moz-user-select:none;user-select:none}.yoopta-button{background-color:transparent;border-style:none;cursor:pointer}.yoopta-block{border-radius:.25rem;margin-bottom:1px;margin-top:2px;padding:0 2px;position:relative}.yoopta-selection-block:before{background-color:#2383e224;border-radius:4px;content:"";content:var(--tw-content);height:100%;inset:0;opacity:0;pointer-events:none;position:absolute;transition-duration:.2s;transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);width:100%;z-index:0}.yoopta-selection-block[data-block-selected=true]:before{background-color:#2383e224;opacity:1}.yoopta-block-actions{pointer-events:none}.yoopta-block-action-buttons{display:flex;pointer-events:auto}.yoopta-block-actions-plus{align-items:center;background-color:inherit;background-color:transparent;border-radius:6px;border-style:none;color:#37352f59;cursor:pointer;display:flex;height:24px;justify-content:center;margin:0 1px;padding:0;position:relative;transition-duration:.18s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);width:24px}.yoopta-block-actions-plus:active,.yoopta-block-actions-plus:focus,.yoopta-block-actions-plus:hover{background-color:#37362f14}.yoopta-block-actions-drag{align-items:center;background-color:inherit;background-color:transparent;border-radius:6px;border-style:none;color:#37352f59;cursor:pointer;display:flex;height:24px;justify-content:center;margin:0 1px;padding:0;position:relative;transition-duration:.18s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);width:18px}.yoopta-block-actions-drag:active,.yoopta-block-actions-drag:focus,.yoopta-block-actions-drag:hover{background-color:#37362f14}.yoopta-slate:focus{outline:2px solid transparent;outline-offset:2px}.yoopta-slate:focus-visible{outline:2px solid transparent;outline-offset:2px}.yoopta-block-options-button{background-color:transparent;border-radius:.125rem;border-style:none;cursor:pointer;display:flex;justify-content:flex-start;line-height:120%;margin-left:4px;margin-right:4px;padding:.375rem .5rem;width:100%}.yoopta-block-options-button:hover{background-color:#37352f14}.yoopta-block-options-item{align-items:center;cursor:default;display:flex;font-size:.875rem;line-height:1.25rem;outline:2px solid transparent;outline-offset:2px;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);-webkit-user-select:none;-moz-user-select:none;user-select:none}.yoopta-block-options-item[data-disabled]{opacity:.5;pointer-events:none}.yoopta-extended-block-actions{--tw-bg-opacity:1;align-items:center;background-color:rgb(238 238 238/var(--tw-bg-opacity));border-radius:2px;border-style:none;cursor:pointer;display:flex;height:22px;justify-content:space-between;opacity:1;padding:0 4px;position:absolute;right:8px;top:8px;transition-duration:.15s;transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-timing-function:cubic-bezier(.4,0,1,1);width:22px;z-index:10}.yoopta-block-options-separator{background-color:#37352f14;height:1px;margin-bottom:4px;margin-top:4px;width:100%}.yoopta-block-options-menu-content{--tw-border-opacity:1;--tw-bg-opacity:1;--tw-shadow:0 4px 6px -1px rgba(0,0,0,.1),0 2px 4px -2px rgba(0,0,0,.1);--tw-shadow-colored:0 4px 6px -1px var(--tw-shadow-color),0 2px 4px -2px var(--tw-shadow-color);background-color:rgb(255 255 255/var(--tw-bg-opacity));border-color:rgb(229 231 235/var(--tw-border-opacity));border-radius:.375rem;border-style:solid;border-width:1px;box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow);min-width:200px;overflow:hidden;padding:6px 0;position:relative;width:auto}.yoopta-block-options-group{display:flex;flex-direction:column}.yoopta-align-left{justify-content:flex-start;text-align:left}.yoopta-align-center{justify-content:center;text-align:center}.yoopta-align-right{justify-content:flex-end;text-align:right}');export{Ee as Blocks,xe as Elements,ea as HOTKEYS,Z as Paths,ys as UI,N as YooptaPlugin,z as buildBlockData,F as buildBlockElement,K as buildBlockElementsStructure,kt as buildSlateEditor,zt as createYooptaEditor,hs as createYooptaMark,vs as default,ca as deserializeHTML,ms as deserializeTextNodes,ne as findPluginBlockByPath,re as findSlateBySelectionPath,I as generateId,H as getRootBlockElement,$ as getRootBlockElementType,Dt as serializeTextNodes,At as serializeTextNodesIntoMarkdown,Kt as useBlockData,Xt as useBlockSelected,Ut as useYooptaEditor,Wt as useYooptaFocused,Yt as useYooptaPluginOptions,qt as useYooptaReadOnly,Do as useYooptaTools};
|
|
6
|
+
var Li=["input:not([inert])","select:not([inert])","textarea:not([inert])","a[href]:not([inert])","button:not([inert])","[tabindex]:not(slot):not([inert])","audio[controls]:not([inert])","video[controls]:not([inert])",'[contenteditable]:not([contenteditable="false"]):not([inert])',"details>summary:first-of-type:not([inert])","details:not([inert])"].join(","),Ii="undefined"==typeof Element,Fi=Ii?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,zi=!Ii&&Element.prototype.getRootNode?function(e){var t;return null==e||null===(t=e.getRootNode)||void 0===t?void 0:t.call(e)}:function(e){return null==e?void 0:e.ownerDocument},$i=function e(t,n){var r;void 0===n&&(n=!0);var o=null==t||null===(r=t.getAttribute)||void 0===r?void 0:r.call(t,"inert");return""===o||"true"===o||n&&t&&e(t.parentNode)},Hi=function e(t,n,r){for(var o=[],i=Array.from(t);i.length;){var l=i.shift();if(!$i(l,!1))if("SLOT"===l.tagName){var a=l.assignedElements(),s=e(a.length?a:l.children,!0,r);r.flatten?o.push.apply(o,s):o.push({scopeParent:l,candidates:s})}else{Fi.call(l,Li)&&r.filter(l)&&(n||!t.includes(l))&&o.push(l);var c=l.shadowRoot||"function"==typeof r.getShadowRoot&&r.getShadowRoot(l),u=!$i(c,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(l));if(c&&u){var d=e(!0===c?l.children:c.children,!0,r);r.flatten?o.push.apply(o,d):o.push({scopeParent:l,candidates:d})}else i.unshift.apply(i,l.children)}}return o},Vi=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},Ui=function(e){if(!e)throw new Error("No node provided");return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||function(e){var t,n=null==e||null===(t=e.getAttribute)||void 0===t?void 0:t.call(e,"contenteditable");return""===n||"true"===n}(e))&&!Vi(e)?0:e.tabIndex},Ki=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},Wi=function(e){return"INPUT"===e.tagName},qi=function(e){return function(e){return Wi(e)&&"radio"===e.type}(e)&&!function(e){if(!e.name)return!0;var t,n=e.form||zi(e),r=function(e){return n.querySelectorAll('input[type="radio"][name="'+e+'"]')};if("undefined"!=typeof window&&void 0!==window.CSS&&"function"==typeof window.CSS.escape)t=r(window.CSS.escape(e.name));else try{t=r(e.name)}catch(e){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",e.message),!1}var o=function(e,t){for(var n=0;n<e.length;n++)if(e[n].checked&&e[n].form===t)return e[n]}(t,e.form);return!o||o===e}(e)},Yi=function(e){var t=e.getBoundingClientRect(),n=t.width,r=t.height;return 0===n&&0===r},Xi=function(e,t){var n=t.displayCheck,r=t.getShadowRoot;if("hidden"===getComputedStyle(e).visibility)return!0;var o=Fi.call(e,"details>summary:first-of-type")?e.parentElement:e;if(Fi.call(o,"details:not([open]) *"))return!0;if(n&&"full"!==n&&"legacy-full"!==n){if("non-zero-area"===n)return Yi(e)}else{if("function"==typeof r){for(var i=e;e;){var l=e.parentElement,a=zi(e);if(l&&!l.shadowRoot&&!0===r(l))return Yi(e);e=e.assignedSlot?e.assignedSlot:l||a===e.ownerDocument?l:a.host}e=i}if(function(e){var t,n,r,o,i=e&&zi(e),l=null===(t=i)||void 0===t?void 0:t.host,a=!1;if(i&&i!==e)for(a=!!(null!==(n=l)&&void 0!==n&&null!==(r=n.ownerDocument)&&void 0!==r&&r.contains(l)||null!=e&&null!==(o=e.ownerDocument)&&void 0!==o&&o.contains(e));!a&&l;){var s,c,u;a=!(null===(c=l=null===(s=i=zi(l))||void 0===s?void 0:s.host)||void 0===c||null===(u=c.ownerDocument)||void 0===u||!u.contains(l))}return a}(e))return!e.getClientRects().length;if("legacy-full"!==n)return!0}return!1},Zi=function(e,t){return!(t.disabled||$i(t)||function(e){return Wi(e)&&"hidden"===e.type}(t)||Xi(t,e)||function(e){return"DETAILS"===e.tagName&&Array.prototype.slice.apply(e.children).some((function(e){return"SUMMARY"===e.tagName}))}(t)||function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var t=e.parentElement;t;){if("FIELDSET"===t.tagName&&t.disabled){for(var n=0;n<t.children.length;n++){var r=t.children.item(n);if("LEGEND"===r.tagName)return!!Fi.call(t,"fieldset[disabled] *")||!r.contains(e)}return!0}t=t.parentElement}return!1}(t))},Ji=function(e,t){return!(qi(t)||Ui(t)<0||!Zi(e,t))},Gi=function(e){var t=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(t)||t>=0)},Qi=function e(t){var n=[],r=[];return t.forEach((function(t,o){var i=!!t.scopeParent,l=i?t.scopeParent:t,a=function(e,t){var n=Ui(e);return n<0&&t&&!Vi(e)?0:n}(l,i),s=i?e(t.candidates):l;0===a?i?n.push.apply(n,s):n.push(l):r.push({documentOrder:o,tabIndex:a,item:t,isScope:i,content:s})})),r.sort(Ki).reduce((function(e,t){return t.isScope?e.push.apply(e,t.content):e.push(t.content),e}),[]).concat(n)},el=function(e,t){var n;return n=(t=t||{}).getShadowRoot?Hi([e],t.includeContainer,{filter:Ji.bind(null,t),flatten:!1,getShadowRoot:t.getShadowRoot,shadowRootFilter:Gi}):function(e,t,n){if($i(e))return[];var r=Array.prototype.slice.apply(e.querySelectorAll(Li));return t&&Fi.call(e,Li)&&r.unshift(e),r.filter(n)}(e,t.includeContainer,Ji.bind(null,t)),Qi(n)};const tl=r["useInsertionEffect".toString()]||(e=>e());var nl="undefined"!=typeof document?c:u;function rl(){return rl=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},rl.apply(this,arguments)}let ol=!1,il=0;const ll=()=>"floating-ui-"+il++;const al=r["useId".toString()]||function(){const[e,t]=r.useState((()=>ol?ll():void 0));return nl((()=>{null==e&&t(ll())}),[]),r.useEffect((()=>{ol||(ol=!0)}),[]),e};const sl=r.createContext(null),cl=r.createContext(null);function ul(e){return"data-floating-ui-"+e}function dl(e){const t=a(e);return nl((()=>{t.current=e})),t}const fl=()=>({getShadowRoot:!0,displayCheck:"function"==typeof ResizeObserver&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function pl(e,t){const n=el(e,fl());"prev"===t&&n.reverse();const r=n.indexOf(function(e){let t=e.activeElement;for(;null!=(null==(n=t)||null==(n=n.shadowRoot)?void 0:n.activeElement);){var n;t=t.shadowRoot.activeElement}return t}((null==(o=e)?void 0:o.ownerDocument)||document));var o;return n.slice(r+1)[0]}function hl(e,t){const n=t||e.currentTarget,r=e.relatedTarget;return!r||!function(e,t){if(!e||!t)return!1;const n=null==t.getRootNode?void 0:t.getRootNode();if(e.contains(t))return!0;if(n&&Ro(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}(n,r)}function gl(e){el(e,fl()).forEach((e=>{e.dataset.tabindex=e.getAttribute("tabindex")||"",e.setAttribute("tabindex","-1")}))}function vl(e){e.querySelectorAll("[data-tabindex]").forEach((e=>{const t=e.dataset.tabindex;delete e.dataset.tabindex,t?e.setAttribute("tabindex",t):e.removeAttribute("tabindex")}))}const yl={border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"fixed",whiteSpace:"nowrap",width:"1px",top:0,left:0};function ml(e){"Tab"===e.key&&(e.target,clearTimeout(undefined))}const bl=r.forwardRef((function(e,t){const[n,o]=r.useState();nl((()=>(/apple/i.test(navigator.vendor)&&o("button"),document.addEventListener("keydown",ml),()=>{document.removeEventListener("keydown",ml)})),[]);const i={ref:t,tabIndex:0,role:n,"aria-hidden":!n||void 0,[ul("focus-guard")]:"",style:yl};return r.createElement("span",rl({},e,i))})),wl=r.createContext(null),kl=ul("portal");function xl(e){let{children:t,id:n,root:o=null,preserveTabOrder:i=!0}=e;const l=function(e){let{id:t,root:n}=void 0===e?{}:e;const[o,i]=r.useState(null),l=al(),a=Ol(),s=r.useRef(null);return nl((()=>()=>{null==o||o.remove(),queueMicrotask((()=>{s.current=null}))}),[o]),nl((()=>{if(s.current)return;const e=t?document.getElementById(t):null;if(!e)return;const n=document.createElement("div");n.id=l,n.setAttribute(kl,""),e.appendChild(n),s.current=n,i(n)}),[t,l]),nl((()=>{if(s.current)return;let e=n||(null==a?void 0:a.portalNode);e&&!Ao(e)&&(e=e.current),e=e||document.body;let r=null;t&&(r=document.createElement("div"),r.id=t,e.appendChild(r));const o=document.createElement("div");o.id=l,o.setAttribute(kl,""),e=r||e,e.appendChild(o),s.current=o,i(o)}),[t,n,l,a]),o}({id:n,root:o}),[a,s]=r.useState(null),c=r.useRef(null),u=r.useRef(null),d=r.useRef(null),f=r.useRef(null),p=!!a&&!a.modal&&a.open&&i&&!(!o&&!l);return r.useEffect((()=>{if(l&&i&&(null==a||!a.modal))return l.addEventListener("focusin",e,!0),l.addEventListener("focusout",e,!0),()=>{l.removeEventListener("focusin",e,!0),l.removeEventListener("focusout",e,!0)};function e(e){if(l&&hl(e)){("focusin"===e.type?vl:gl)(l)}}}),[l,i,null==a?void 0:a.modal]),r.createElement(wl.Provider,{value:r.useMemo((()=>({preserveTabOrder:i,beforeOutsideRef:c,afterOutsideRef:u,beforeInsideRef:d,afterInsideRef:f,portalNode:l,setFocusManagerState:s})),[i,l])},p&&l&&r.createElement(bl,{"data-type":"outside",ref:c,onFocus:e=>{if(hl(e,l)){var t;null==(t=d.current)||t.focus()}else{const e=pl(document.body,"prev")||(null==a?void 0:a.refs.domReference.current);null==e||e.focus()}}}),p&&l&&r.createElement("span",{"aria-owns":l.id,style:yl}),l&&M(t,l),p&&l&&r.createElement(bl,{"data-type":"outside",ref:u,onFocus:e=>{if(hl(e,l)){var t;null==(t=f.current)||t.focus()}else{const t=pl(document.body,"next")||(null==a?void 0:a.refs.domReference.current);null==t||t.focus(),(null==a?void 0:a.closeOnFocusOut)&&(null==a||a.onOpenChange(!1,e.nativeEvent))}}}))}const Ol=()=>r.useContext(wl),El=new Set,Sl=r.forwardRef((function(e,t){let{lockScroll:n=!1,...o}=e;const i=al();return nl((()=>{if(!n)return;El.add(i);const e=/iP(hone|ad|od)|iOS/.test(function(){const e=navigator.userAgentData;return null!=e&&e.platform?e.platform:navigator.platform}()),t=document.body.style,r=Math.round(document.documentElement.getBoundingClientRect().left)+document.documentElement.scrollLeft?"paddingLeft":"paddingRight",o=window.innerWidth-document.documentElement.clientWidth,l=t.left?parseFloat(t.left):window.pageXOffset,a=t.top?parseFloat(t.top):window.pageYOffset;if(t.overflow="hidden",o&&(t[r]=o+"px"),e){var s,c;const e=(null==(s=window.visualViewport)?void 0:s.offsetLeft)||0,n=(null==(c=window.visualViewport)?void 0:c.offsetTop)||0;Object.assign(t,{position:"fixed",top:-(a-Math.floor(n))+"px",left:-(l-Math.floor(e))+"px",right:"0"})}return()=>{El.delete(i),0===El.size&&(Object.assign(t,{overflow:"",[r]:""}),e&&(Object.assign(t,{position:"",top:"",left:"",right:""}),window.scrollTo(l,a)))}}),[i,n]),r.createElement("div",rl({ref:t},o,{style:{position:"fixed",overflow:"auto",top:0,right:0,bottom:0,left:0,...o.style}}))}));function _l(e){var t;void 0===e&&(e={});const{open:n=!1,onOpenChange:o,nodeId:i}=e,[l,a]=r.useState(null),s=(null==(t=e.elements)?void 0:t.reference)||l,c=function(e){void 0===e&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:o=[],platform:i,elements:{reference:l,floating:a}={},transform:s=!0,whileElementsMounted:c,open:u}=e,[d,f]=r.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,h]=r.useState(o);Bi(p,o)||h(o);const[g,v]=r.useState(null),[y,m]=r.useState(null),b=r.useCallback((e=>{e!==O.current&&(O.current=e,v(e))}),[]),w=r.useCallback((e=>{e!==E.current&&(E.current=e,m(e))}),[]),k=l||g,x=a||y,O=r.useRef(null),E=r.useRef(null),S=r.useRef(d),_=null!=c,C=Ni(c),j=Ni(i),D=r.useCallback((()=>{if(!O.current||!E.current)return;const e={placement:t,strategy:n,middleware:p};j.current&&(e.platform=j.current),Pi(O.current,E.current,e).then((e=>{const t={...e,isPositioned:!0};A.current&&!Bi(S.current,t)&&(S.current=t,B.flushSync((()=>{f(t)})))}))}),[p,t,n,j]);Ri((()=>{!1===u&&S.current.isPositioned&&(S.current.isPositioned=!1,f((e=>({...e,isPositioned:!1}))))}),[u]);const A=r.useRef(!1);Ri((()=>(A.current=!0,()=>{A.current=!1})),[]),Ri((()=>{if(k&&(O.current=k),x&&(E.current=x),k&&x){if(C.current)return C.current(k,x,D);D()}}),[k,x,D,C,_]);const P=r.useMemo((()=>({reference:O,floating:E,setReference:b,setFloating:w})),[b,w]),R=r.useMemo((()=>({reference:k,floating:x})),[k,x]),T=r.useMemo((()=>{const e={position:n,left:0,top:0};if(!R.floating)return e;const t=Mi(R.floating,d.x),r=Mi(R.floating,d.y);return s?{...e,transform:"translate("+t+"px, "+r+"px)",...Ti(R.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:t,top:r}}),[n,s,R.floating,d.x,d.y]);return r.useMemo((()=>({...d,update:D,refs:P,elements:R,floatingStyles:T})),[d,D,P,R,T])}(e),u=r.useContext(cl),d=null!=((null==(f=r.useContext(sl))?void 0:f.id)||null);var f;const p=function(e){const t=r.useRef((()=>{}));return tl((()=>{t.current=e})),r.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&&(g.current.openEvent=t),v.emit("openchange",{open:e,event:t,reason:n,nested:d}),null==o||o(e,t,n)})),h=r.useRef(null),g=r.useRef({}),v=r.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],y=al(),m=r.useCallback((e=>{const t=Ao(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),contextElement:e}:e;c.refs.setReference(t)}),[c.refs]),b=r.useCallback((e=>{(Ao(e)||null===e)&&(h.current=e,a(e)),(Ao(c.refs.reference.current)||null===c.refs.reference.current||null!==e&&!Ao(e))&&c.refs.setReference(e)}),[c.refs]),w=r.useMemo((()=>({...c.refs,setReference:b,setPositionReference:m,domReference:h})),[c.refs,b,m]),k=r.useMemo((()=>({...c.elements,domReference:s})),[c.elements,s]),x=r.useMemo((()=>({...c,refs:w,elements:k,dataRef:g,nodeId:i,floatingId:y,events:v,open:n,onOpenChange:p})),[c,i,y,v,n,p,w,k]);return nl((()=>{const e=null==u?void 0:u.nodesRef.current.find((e=>e.id===i));e&&(e.context=x)})),r.useMemo((()=>({...c,context:x,refs:w,elements:k})),[c,w,k,x])}const Cl=e=>e.replace(/[A-Z]+(?![a-z])|[A-Z]/g,((e,t)=>(t?"-":"")+e.toLowerCase()));function jl(e,t){return"function"==typeof e?e(t):e}function Dl(e,t){void 0===t&&(t={});const{open:n,elements:{floating:o}}=e,{duration:i=250}=t,l=("number"==typeof i?i:i.close)||0,[a,s]=r.useState(!1),[c,u]=r.useState("unmounted"),d=function(e,t){const[n,o]=r.useState(e);return e&&!n&&o(!0),r.useEffect((()=>{if(!e){const e=setTimeout((()=>o(!1)),t);return()=>clearTimeout(e)}}),[e,t]),n}(n,l);return nl((()=>{a&&!d&&u("unmounted")}),[a,d]),nl((()=>{if(o){if(n){u("initial");const e=requestAnimationFrame((()=>{u("open")}));return()=>{cancelAnimationFrame(e)}}s(!0),u("close")}}),[n,o]),{isMounted:d,status:c}}function Al(e,t){void 0===t&&(t={});const{initial:n={opacity:0},open:o,close:i,common:l,duration:a=250}=t,s=e.placement,c=s.split("-")[0],u=r.useMemo((()=>({side:c,placement:s})),[c,s]),d="number"==typeof a,f=(d?a:a.open)||0,p=(d?a:a.close)||0,[h,g]=r.useState((()=>({...jl(l,u),...jl(n,u)}))),{isMounted:v,status:y}=Dl(e,{duration:a}),m=dl(n),b=dl(o),w=dl(i),k=dl(l);return nl((()=>{const e=jl(m.current,u),t=jl(w.current,u),n=jl(k.current,u),r=jl(b.current,u)||Object.keys(e).reduce(((e,t)=>(e[t]="",e)),{});if("initial"===y&&g((t=>({transitionProperty:t.transitionProperty,...n,...e}))),"open"===y&&g({transitionProperty:Object.keys(r).map(Cl).join(","),transitionDuration:f+"ms",...n,...r}),"close"===y){const r=t||e;g({transitionProperty:Object.keys(r).map(Cl).join(","),transitionDuration:p+"ms",...n,...r})}}),[p,w,m,b,k,f,y,u]),{isMounted:v,styles:h}}function Pl({editor:e,view:t,onClose:n,mode:r="toggle"}){return{actions:(()=>{let t=Object.keys(e.blocks);return"toggle"===r&&(t=t.filter((t=>function(e,t){var n;const r=e.blocks[t];if(!r)return!1;const o=H(r.elements);return"void"!==(null===(n=null==o?void 0:o.props)||void 0===n?void 0:n.nodeType)}(e,t)))),t.map((t=>{var n,r,o,i,l,a;return{type:t,title:(null===(r=null===(n=e.blocks[t].options)||void 0===n?void 0:n.display)||void 0===r?void 0:r.title)||t,description:null===(i=null===(o=e.blocks[t].options)||void 0===o?void 0:o.display)||void 0===i?void 0:i.description,icon:null===(a=null===(l=e.blocks[t].options)||void 0===l?void 0:l.display)||void 0===a?void 0:a.icon}}))})(),onClose:n,empty:!1,getItemProps:t=>({onMouseEnter:()=>{},"data-action-menu-item":!0,"data-action-menu-item-type":t,"aria-selected":!1,onClick:()=>{e.toggleBlock(t,{deleteText:"create"===r,focus:!0}),n()}}),getRootProps:()=>({"data-action-menu-list":!0}),editor:e,view:t}}const Rl=p((({children:n,block:r,blockId:o,onActiveDragHandleChange:i})=>{const l=zt(),{attributes:a,listeners:c,setNodeRef:u,setActivatorNodeRef:d,transform:f,transition:p,isOver:h,isDragging:g}=mo({id:o,disabled:l.readOnly}),v=((e,t,n,r,o)=>s((()=>({container:{marginLeft:20*e.meta.depth+"px",transform:t?`translate3d(${t.x}px, ${t.y}px, 0)`:"none",transition:n,opacity:r?.7:1},content:o&&!r?{borderBottom:"2px solid #007aff"}:void 0})),[e.meta.depth,t,n,r,o]))(r,f,p,g,h),y=`yoopta-block yoopta-align-${r.meta.align||"left"}`,m=Z.isBlockSelected(l,r);return t("div",Object.assign({ref:u,className:y,style:v.container,"data-yoopta-block":!0,"data-yoopta-block-id":o,onMouseEnter:()=>{!l.readOnly&&i&&i({attributes:a,listeners:c,setActivatorNodeRef:d})}},{children:[e("div",Object.assign({style:v.content},{children:n})),!l.readOnly&&e("div",{"data-block-selected":m,className:"yoopta-selection-block"})]}))}));function Bl(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}Rl.displayName="Block","function"==typeof SuppressedError&&SuppressedError;var Tl={};Object.defineProperty(Tl,"__esModule",{value:!0});for(var Ml="undefined"!=typeof window&&/Mac|iPod|iPhone|iPad/.test(window.navigator.platform),Nl={alt:"altKey",control:"ctrlKey",meta:"metaKey",shift:"shiftKey"},Ll={add:"+",break:"pause",cmd:"meta",command:"meta",ctl:"control",ctrl:"control",del:"delete",down:"arrowdown",esc:"escape",ins:"insert",left:"arrowleft",mod:Ml?"meta":"control",opt:"alt",option:"alt",return:"enter",right:"arrowright",space:" ",spacebar:" ",up:"arrowup",win:"meta",windows:"meta"},Il={backspace:8,tab:9,enter:13,shift:16,control:17,alt:18,pause:19,capslock:20,escape:27," ":32,pageup:33,pagedown:34,end:35,home:36,arrowleft:37,arrowup:38,arrowright:39,arrowdown:40,insert:45,delete:46,meta:91,numlock:144,scrolllock:145,";":186,"=":187,",":188,"-":189,".":190,"/":191,"`":192,"[":219,"\\":220,"]":221,"'":222},Fl=1;Fl<20;Fl++)Il["f"+Fl]=111+Fl;function zl(e,t,n){t&&!("byKey"in t)&&(n=t,t=null),Array.isArray(e)||(e=[e]);var r=e.map((function(e){return $l(e,t)})),o=function(e){return r.some((function(t){return Hl(t,e)}))};return null==n?o:o(n)}function $l(e,t){var n=t&&t.byKey,r={},o=(e=e.replace("++","+add")).split("+"),i=o.length;for(var l in Nl)r[Nl[l]]=!1;var a=!0,s=!1,c=void 0;try{for(var u,d=o[Symbol.iterator]();!(a=(u=d.next()).done);a=!0){var f=u.value,p=f.endsWith("?")&&f.length>1;p&&(f=f.slice(0,-1));var h=Ul(f),g=Nl[h];if(f.length>1&&!g&&!Ll[f]&&!Il[h])throw new TypeError('Unknown modifier: "'+f+'"');1!==i&&g||(n?r.key=h:r.which=Vl(f)),g&&(r[g]=!p||null)}}catch(e){s=!0,c=e}finally{try{!a&&d.return&&d.return()}finally{if(s)throw c}}return r}function Hl(e,t){for(var n in e){var r=e[n],o=void 0;if(null!=r&&((null!=(o="key"===n&&null!=t.key?t.key.toLowerCase():"which"===n?91===r&&93===t.which?91:t.which:t[n])||!1!==r)&&o!==r))return!1}return!0}function Vl(e){return e=Ul(e),Il[e]||e.toUpperCase().charCodeAt(0)}function Ul(e){return e=e.toLowerCase(),e=Ll[e]||e}Tl.default=zl,Tl.isHotkey=zl,Tl.isCodeHotkey=function(e,t){return zl(e,t)};var Kl=Tl.isKeyHotkey=function(e,t){return zl(e,{byKey:!0},t)};Tl.parseHotkey=$l,Tl.compareHotkey=Hl,Tl.toKeyCode=Vl,Tl.toKeyName=Ul;const Wl={bold:"mod+b",italic:"mod+i",compose:["down","left","right","up","backspace","enter"],arrowLeft:"left",arrowUp:"up",arrowDown:"down",arrowRight:"right",ctrlLeft:"ctrl+left",escape:"esc",ctrlRight:"ctrl+right",deleteBackward:"shift?+backspace",backspace:"backspace",deleteForward:"shift?+delete",extendBackward:"shift+left",shiftDelete:"shift+delete",extendForward:"shift+right",shiftEnter:"shift+enter",enter:"enter",space:"space",undo:"mod+z",select:"mod+a",shiftTab:"shift+tab",shiftArrowUp:"shift+up",shiftArrowDown:"shift+down",tab:"tab",cmd:"mod",cmdEnter:"mod+enter",cmdShiftEnter:"mod+shift+enter",slashCommand:"/",copy:"mod+c",cut:"mod+x",cmdShiftRight:"mod+shift+right",cmdShiftLeft:"mod+shift+left",cmdShiftDelete:"mod+shift+backspace",cmdShiftD:"mod+shift+d",cmdAltDelete:"mod+alt+backspace"},ql={moveLineBackward:"opt+up",moveLineForward:"opt+down",ctrlLeft:"opt+left",ctrlRight:"opt+right",deleteBackward:["ctrl+backspace","ctrl+h"],deleteForward:["ctrl+delete","ctrl+d"],deleteLineBackward:"cmd+shift?+backspace",deleteLineForward:["cmd+shift?+delete","ctrl+k"],deleteWordBackward:"opt+shift?+backspace",deleteWordForward:"opt+shift?+delete",extendLineBackward:"opt+shift+up",extendLineForward:"opt+shift+down",redo:"cmd+shift+z",transposeCharacter:"ctrl+t"},Yl={deleteWordBackward:"ctrl+shift?+backspace",deleteWordForward:"ctrl+shift?+delete",redo:["ctrl+y","ctrl+shift+z"]},Xl=e=>{const t=Wl[e],n=ql[e],r=Yl[e],o=t&&Kl(t),i=n&&Kl(n),l=r&&Kl(r);return e=>!(!o||!o(e))||(!(!i||!i(e))||!(!l||!l(e)))},Zl={isBold:Xl("bold"),isCompose:Xl("compose"),isArrowLeft:Xl("arrowLeft"),isArrowRight:Xl("arrowRight"),isArrowUp:Xl("arrowUp"),isArrowDown:Xl("arrowDown"),isDeleteBackward:Xl("deleteBackward"),isDeleteForward:Xl("deleteForward"),isDeleteLineBackward:Xl("deleteLineBackward"),isDeleteLineForward:Xl("deleteLineForward"),isDeleteWordBackward:Xl("deleteWordBackward"),isDeleteWordForward:Xl("deleteWordForward"),isExtendBackward:Xl("extendBackward"),isExtendForward:Xl("extendForward"),isExtendLineBackward:Xl("extendLineBackward"),isExtendLineForward:Xl("extendLineForward"),isItalic:Xl("italic"),isMoveLineBackward:Xl("moveLineBackward"),isMoveLineForward:Xl("moveLineForward"),isCtrlLeft:Xl("ctrlLeft"),isCtrlRight:Xl("ctrlRight"),isRedo:Xl("redo"),isShiftEnter:Xl("shiftEnter"),isEnter:Xl("enter"),isTransposeCharacter:Xl("transposeCharacter"),isUndo:Xl("undo"),isSpace:Xl("space"),isSelect:Xl("select"),isTab:Xl("tab"),isShiftTab:Xl("shiftTab"),isBackspace:Xl("backspace"),isCmdEnter:Xl("cmdEnter"),isCmd:Xl("cmd"),isEscape:Xl("escape"),isSlashCommand:Xl("slashCommand"),isShiftArrowUp:Xl("shiftArrowUp"),isShiftArrowDown:Xl("shiftArrowDown"),isCopy:Xl("copy"),isCut:Xl("cut"),isShiftDelete:Xl("shiftDelete"),isCmdShiftEnter:Xl("cmdShiftEnter"),isCmdShiftRight:Xl("cmdShiftRight"),isCmdShiftLeft:Xl("cmdShiftLeft"),isCmdShiftDelete:Xl("cmdShiftDelete"),isCmdAltDelete:Xl("cmdAltDelete"),isCmdShiftD:Xl("cmdShiftD")};const Jl={onKeyDown:function(e){return t=>{const n=re(e,{at:e.path.current});if(Zl.isShiftEnter(t)){if(t.isDefaultPrevented())return;if(!n||!n.selection)return;return t.preventDefault(),void n.insertText("\n")}if(Zl.isUndo(t))t.preventDefault();else if(Zl.isRedo(t))t.preventDefault();else if(Zl.isEnter(t)){if(t.isDefaultPrevented())return;if(!n||!n.selection)return;t.preventDefault();const r=y.first(n,[]),o=y.last(n,[]),i=y.isStart(n,n.selection.anchor,r[1]),l=y.isEnd(n,n.selection.anchor,o[1]);if(E.isExpanded(n.selection)&&w.delete(n,{at:n.selection}),!i&&!l)return void e.splitBlock({slate:n,focus:!0});const a=Ee.getBlock(e,{at:e.path.current}),s=Ee.buildBlockData({id:I()}),c=y.string(n,[]),u=i&&c.length>0,d=Z.getNextPath(e);e.batchOperations((()=>{e.insertBlock(s.type,{at:u?e.path.current:d,focus:!u}),u&&a&&e.focusBlock(a.id)}))}else if(Zl.isBackspace(t)){if(t.isDefaultPrevented())return;if(!n||!n.selection)return;const r=x.parent(n.selection.anchor.path);if(y.isStart(n,n.selection.anchor,r)){t.preventDefault();if(0===y.string(n,r).trim().length)return void e.deleteBlock({at:e.path.current,focus:!0});{if(E.isExpanded(n.selection))return w.delete(n,{at:n.selection});const t=Ee.getBlock(e,{at:Z.getPreviousPath(e)}),r=Ee.getBlockSlate(e,{id:null==t?void 0:t.id});if(t&&r){const{node:n}=function(e){const t=y.last(e,[]);return{node:t[0],path:t[1]}}(r);if(0===O.string(n).trim().length)return e.deleteBlock({blockId:t.id,focus:!1}),void e.setPath({current:t.meta.order})}e.mergeBlock()}}}else{if(Zl.isSelect(t)){if(t.isDefaultPrevented())return;if(!n||!n.selection)return;const[,r]=y.first(n,[0]),[,o]=y.last(n,[n.children.length-1]),i=y.range(n,r,o),l=E.equals(n.selection,i),a=0===y.string(n,i).trim().length;if(E.isExpanded(n.selection)&&l||a){t.preventDefault(),C.blur(n),C.deselect(n),w.deselect(n);const r=Array.from({length:Object.keys(e.children).length},((e,t)=>t));return void e.setPath({current:null,selected:r,source:"keyboard"})}}if(Zl.isShiftTab(t)){if(t.isDefaultPrevented())return;t.preventDefault();const n=e.path.selected;return Array.isArray(n)&&n.length>0?void e.batchOperations((()=>{n.forEach((t=>{const n=Ee.getBlock(e,{at:t});n&&n.meta.depth>0&&e.decreaseBlockDepth({at:t})}))})):void e.decreaseBlockDepth()}if(Zl.isTab(t)){if(t.isDefaultPrevented())return;t.preventDefault();const n=e.path.selected;return Array.isArray(n)&&n.length>0?void e.batchOperations((()=>{n.forEach((t=>{e.increaseBlockDepth({at:t})}))})):void e.increaseBlockDepth()}if(Zl.isArrowUp(t)){if(t.isDefaultPrevented())return;if(!n||!n.selection)return;if(1===new Set(n.selection.anchor.path).size){const n=Z.getPreviousPath(e),r=re(e,{at:n}),o=ne(e,{at:n}),i=e.blocks[(null==o?void 0:o.type)||""];if(r&&o&&!(null==i?void 0:i.hasCustomEditor)){const[,n]=y.last(r,[0]),i={path:n,offset:y.string(r,n).length};return t.preventDefault(),void e.focusBlock(o.id,{focusAt:i,waitExecution:!1,shouldUpdateBlockPath:!0})}}}if(Zl.isArrowDown(t)){if(t.isDefaultPrevented())return;if(!n||!n.selection)return;const r=x.parent(n.selection.anchor.path);if(y.isEnd(n,n.selection.anchor,r)){const n=Z.getNextPath(e),o=re(e,{at:n}),i=ne(e,{at:n}),l=e.blocks[(null==i?void 0:i.type)||""];if(o&&i&&!(null==l?void 0:l.hasCustomEditor)){const n=function(e,t){try{const[,n]=y.first(e,t);return{path:n,offset:0}}catch(e){return{path:[0,0],offset:0}}}(o,r);return t.preventDefault(),void e.focusBlock(i.id,{focusAt:n,waitExecution:!1})}}}if(n&&n.selection&&E.isExpanded(n.selection)){if(Object.values(e.formats).length>0)for(const n of Object.values(e.formats))if(n.hotkey&&Kl(n.hotkey)(t)){t.preventDefault(),e.formats[n.type].toggle();break}}}}}},Gl=({children:t,attributes:n,placeholder:r})=>{const o=D(),i=Object.assign({},n);return o&&r&&(i["data-placeholder"]=r,i.className="yoopta-placeholder"),e("span",Object.assign({},i,{children:t}))};function Ql(e){return!!(e&&e.id&&e.type&&e.value&&e.meta)}const ea={B:{type:"bold"},STRONG:{type:"bold"},I:{type:"italic"},U:{type:"underline"},S:{type:"strike"},CODE:{type:"code"},EM:{type:"italic"},MARK:{type:"highlight",parse:e=>({color:e.style.color})}},ta=["left","center","right",void 0];function na(e,t,n,r){var o,i;let l;if(t.parse){l=t.parse(n,e);if(m.isElement(l)&&"inline"===(null===(o=l.props)||void 0===o?void 0:o.nodeType))return l}const a=e.blocks[t.type],s=$(a.elements)||"",c=a.elements[s],u="void"===(null===(i=c.props)||void 0===i?void 0:i.nodeType);let d={id:I(),type:s,children:u&&!a.hasCustomEditor?[{text:""}]:r.map(oa).flat(),props:Object.assign({nodeType:"block"},c.props)};if(l)if(m.isElement(l))d=l;else if(Array.isArray(l)){return l}if(0===d.children.length&&(d.children=[{text:""}]),!l&&t.parse)return;const f=n.getAttribute("data-meta-align"),p=parseInt(n.getAttribute("data-meta-depth")||"0",10);return Ee.buildBlockData({id:I(),type:t.type,value:[d],meta:{order:0,depth:p,align:ta.includes(f)?f:void 0}})}function ra(e,t,n){var r;if(3===n.nodeType){return{text:null===(r=n.textContent)||void 0===r?void 0:r.replace(/[\t\n\r\f\v]+/g," ")}}if(1!==n.nodeType)return null;if("BR"===n.nodeName)return{text:"\n"};const o=n;let i=Array.from(o.childNodes).map((n=>ra(e,t,n))).flat().filter(Boolean);if(ea[o.nodeName]){const e=ea[o.nodeName],t=e.type;return i.map((n=>"string"==typeof n?{[t]:!e.parse||e.parse(o),text:n}:n.text?Object.assign(Object.assign({},n),{[t]:!e.parse||e.parse(o)}):n))}const l=t[o.nodeName];if(l){if(Array.isArray(l)){return l.map((t=>na(e,t,o,i))).filter(Boolean)}return na(e,l,o,i)}return i}function oa(e){if("string"==typeof e)return{text:e};if(m.isElement(e))return e;if(Array.isArray(e))return e.map(oa).flat();if(null==e?void 0:e.text)return e;if(Ql(e)){return e.value[0].children.map(oa).flat()}return{text:""}}function ia(e,t){console.log("pasted html",t);const n=function(e){const t={};return Object.keys(e.plugins).forEach((n=>{const r=e.plugins[n],{parsers:o}=r;if(o){const{html:e}=o;if(e){const{deserialize:r}=e;if(r){const{nodeNames:e}=r;e&&e.forEach((e=>{const o=t[e];if(o){const i=Array.isArray(o)?o:[o];t[e]=[...i,{type:n,parse:r.parse}]}else t[e]={type:n,parse:r.parse}}))}}}})),t}(e);return ra(e,n,t).flat().filter(Ql)}var la={},aa={get exports(){return la},set exports(e){la=e}},sa={};!function(e,t){function n(e){return n="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},n(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){if(!("string"==typeof e||e instanceof String)){var t=n(e);throw null===e?t="null":"object"===t&&(t=e.constructor.name),new TypeError("Expected a string but received a ".concat(t))}},e.exports=t.default,e.exports.default=t.default}({get exports(){return sa},set exports(e){sa=e}},sa);var ca,ua,da={},fa={get exports(){return da},set exports(e){da=e}},pa={};ca={get exports(){return pa},set exports(e){pa=e}},ua=pa,Object.defineProperty(ua,"__esModule",{value:!0}),ua.default=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;for(var n in t)void 0===e[n]&&(e[n]=t[n]);return e},ca.exports=ua.default,ca.exports.default=ua.default,function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){(0,n.default)(e),(t=(0,r.default)(t,i)).allow_trailing_dot&&"."===e[e.length-1]&&(e=e.substring(0,e.length-1));!0===t.allow_wildcard&&0===e.indexOf("*.")&&(e=e.substring(2));var o=e.split("."),l=o[o.length-1];if(t.require_tld){if(o.length<2)return!1;if(!t.allow_numeric_tld&&!/^([a-z\u00A1-\u00A8\u00AA-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]{2,}|xn[a-z0-9-]{2,})$/i.test(l))return!1;if(/\s/.test(l))return!1}if(!t.allow_numeric_tld&&/^\d+$/.test(l))return!1;return o.every((function(e){return!(e.length>63&&!t.ignore_max_length)&&(!!/^[a-z_\u00a1-\uffff0-9-]+$/i.test(e)&&(!/[\uff01-\uff5e]/.test(e)&&(!/^-|-$/.test(e)&&!(!t.allow_underscores&&/_/.test(e)))))}))};var n=o(sa),r=o(pa);function o(e){return e&&e.__esModule?e:{default:e}}var i={require_tld:!0,allow_underscores:!1,allow_trailing_dot:!1,allow_numeric_tld:!1,allow_wildcard:!1,ignore_max_length:!1};e.exports=t.default,e.exports.default=t.default}(fa,da);var ha={};!function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if((0,r.default)(t),!(n=String(n)))return e(t,4)||e(t,6);if("4"===n)return l.test(t);if("6"===n)return s.test(t);return!1};var n,r=(n=sa)&&n.__esModule?n:{default:n};var o="(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])",i="(".concat(o,"[.]){3}").concat(o),l=new RegExp("^".concat(i,"$")),a="(?:[0-9a-fA-F]{1,4})",s=new RegExp("^("+"(?:".concat(a,":){7}(?:").concat(a,"|:)|")+"(?:".concat(a,":){6}(?:").concat(i,"|:").concat(a,"|:)|")+"(?:".concat(a,":){5}(?::").concat(i,"|(:").concat(a,"){1,2}|:)|")+"(?:".concat(a,":){4}(?:(:").concat(a,"){0,1}:").concat(i,"|(:").concat(a,"){1,3}|:)|")+"(?:".concat(a,":){3}(?:(:").concat(a,"){0,2}:").concat(i,"|(:").concat(a,"){1,4}|:)|")+"(?:".concat(a,":){2}(?:(:").concat(a,"){0,3}:").concat(i,"|(:").concat(a,"){1,5}|:)|")+"(?:".concat(a,":){1}(?:(:").concat(a,"){0,4}:").concat(i,"|(:").concat(a,"){1,6}|:)|")+"(?::((?::".concat(a,"){0,5}:").concat(i,"|(?::").concat(a,"){1,7}|:))")+")(%[0-9a-zA-Z-.:]{1,})?$");e.exports=t.default,e.exports.default=t.default}({get exports(){return ha},set exports(e){ha=e}},ha),function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){if((0,n.default)(e),!e||/[\s<>]/.test(e))return!1;if(0===e.indexOf("mailto:"))return!1;if((t=(0,i.default)(t,s)).validate_length&&e.length>=2083)return!1;if(!t.allow_fragments&&e.includes("#"))return!1;if(!t.allow_query_components&&(e.includes("?")||e.includes("&")))return!1;var l,d,f,p,h,g,v,y;if(v=e.split("#"),e=v.shift(),v=e.split("?"),e=v.shift(),(v=e.split("://")).length>1){if(l=v.shift().toLowerCase(),t.require_valid_protocol&&-1===t.protocols.indexOf(l))return!1}else{if(t.require_protocol)return!1;if("//"===e.slice(0,2)){if(!t.allow_protocol_relative_urls)return!1;v[0]=e.slice(2)}}if(""===(e=v.join("://")))return!1;if(v=e.split("/"),""===(e=v.shift())&&!t.require_host)return!0;if((v=e.split("@")).length>1){if(t.disallow_auth)return!1;if(""===v[0])return!1;if((d=v.shift()).indexOf(":")>=0&&d.split(":").length>2)return!1;var m=d.split(":"),b=(O=2,function(e){if(Array.isArray(e))return e}(x=m)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,l,a=[],s=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=i.call(n)).done)&&(a.push(r.value),a.length!==t);s=!0);}catch(e){c=!0,o=e}finally{try{if(!s&&null!=n.return&&(l=n.return(),Object(l)!==l))return}finally{if(c)throw o}}return a}}(x,O)||function(e,t){if(e){if("string"==typeof e)return a(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?a(e,t):void 0}}(x,O)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),w=b[0],k=b[1];if(""===w&&""===k)return!1}var x,O;p=v.join("@"),g=null,y=null;var E=p.match(c);E?(f="",y=E[1],g=E[2]||null):(f=(v=p.split(":")).shift(),v.length&&(g=v.join(":")));if(null!==g&&g.length>0){if(h=parseInt(g,10),!/^[0-9]+$/.test(g)||h<=0||h>65535)return!1}else if(t.require_port)return!1;if(t.host_whitelist)return u(f,t.host_whitelist);if(""===f&&!t.require_host)return!0;if(!((0,o.default)(f)||(0,r.default)(f,t)||y&&(0,o.default)(y,6)))return!1;if(f=f||y,t.host_blacklist&&u(f,t.host_blacklist))return!1;return!0};var n=l(sa),r=l(da),o=l(ha),i=l(pa);function l(e){return e&&e.__esModule?e:{default:e}}function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var s={protocols:["http","https","ftp"],require_tld:!0,require_protocol:!1,require_host:!0,require_port:!1,require_valid_protocol:!0,allow_underscores:!1,allow_trailing_dot:!1,allow_protocol_relative_urls:!1,allow_fragments:!0,allow_query_components:!0,validate_length:!0},c=/^\[([^\]]+)\](?::([0-9]+))?$/;function u(e,t){for(var n=0;n<t.length;n++){var r=t[n];if(e===r||(o=r,"[object RegExp]"===Object.prototype.toString.call(o)&&r.test(e)))return!0}var o;return!1}e.exports=t.default,e.exports.default=t.default}(aa,la);var ga=ie(la);function va(e){return!(!e||e.length>2048)&&ga(e,{protocols:["http","https"],require_protocol:!0,require_valid_protocol:!0,require_host:!0,require_port:!1,allow_protocol_relative_urls:!1,allow_fragments:!0,allow_query_components:!0,allow_underscores:!0,disallow_auth:!1})}const ya=(e,t,n)=>{var r,o,i,l;(e=>{const[t]=y.nodes(e,{match:e=>!y.isEditor(e)&&m.isElement(e)&&"link"===e.type});return!!t})(t)&&(e=>{w.unwrapNodes(e,{match:e=>!y.isEditor(e)&&m.isElement(e)&&"link"===e.type})})(t);const{selection:a}=t,s=a&&E.isCollapsed(a),c=null===(l=null===(i=null===(o=null===(r=e.plugins)||void 0===r?void 0:r.LinkPlugin)||void 0===o?void 0:o.elements)||void 0===i?void 0:i.link)||void 0===l?void 0:l.props,u={type:"link",children:s?[{text:n}]:[],props:{url:n,target:(null==c?void 0:c.target)||"_self",rel:(null==c?void 0:c.rel)||"noopener noreferrer"}};s?w.insertNodes(t,u):(w.wrapNodes(t,u,{split:!0}),w.collapse(t,{edge:"end"}))},ma=(e,t,n,r,o)=>s((()=>{let i=t.blockEditorsMap[e];const{normalizeNode:l,insertText:a,apply:s}=i,c=Object.keys(r);return c.forEach((e=>{var n;const o=null===(n=r[e].props)||void 0===n?void 0:n.nodeType,l="inline"===o,a="void"===o,s="inlineVoid"===o,{markableVoid:c,isVoid:u,isInline:d}=i;s&&(i.markableVoid=t=>c(t)||t.type===e),(a||s)&&(i.isVoid=t=>u(t)||t.type===e),(l||s)&&(i.isInline=t=>d(t)||t.type===e,i=((e,t)=>{const{insertData:n,insertText:r}=t;return t.insertText=n=>{n&&va(n)?ya(e,t,n):r(n)},t.insertData=r=>{const o=r.getData("text/plain");o&&va(o)?ya(e,t,o):n(r)},t})(t,i))})),i.insertText=e=>{const n=Z.getSelectedPaths(t),r=Z.getPath(t);Array.isArray(n)&&n.length>0&&t.setPath({current:r}),a(e)},i.normalizeNode=e=>{const[r,o]=e,a=t.blocks[n.type].elements;if(Object.keys(a).length>1)return l(e);if(m.isElement(r)){const{type:e}=r,t=$(a);if(!c.includes(e))return void w.setNodes(i,{type:t,props:Object.assign({},r.props)},{at:o});if(r.type===t)for(const[e,t]of O.children(i,o))if(m.isElement(e)&&!i.isInline(e))return void w.unwrapNodes(i,{at:t})}l(e)},i.apply=n=>{var r,o,l;if(_.isSelectionOperation(n)){const e=Z.getSelectedPaths(t),n=Z.getPath(t);Array.isArray(e)&&i.selection&&E.isExpanded(i.selection)&&t.setPath({current:n})}let a=t.isSavingHistory();if(void 0===a&&(a=ba(n)),a){const a=t.historyStack.undos[t.historyStack.undos.length-1];if(!a||"set_slate"!==(null===(r=null==a?void 0:a.operations[0])||void 0===r?void 0:r.type)){const r={type:"set_slate",properties:{slateOps:[n],selectionBefore:i.selection},blockId:e,slate:i};return t.applyTransforms([r],{source:"api",validatePaths:!1}),void s(n)}const c=null===(l=null===(o=null==a?void 0:a.operations[0])||void 0===o?void 0:o.properties)||void 0===l?void 0:l.slateOps,u=c&&c[c.length-1];let d=wa(n,u);if(0!==i.operations.length&&(d=!0),d)u!==n&&c.push(n);else{const r={operations:[n],selectionBefore:i.selection},o={type:"set_slate",properties:{slateOps:r.operations,selectionBefore:r.selectionBefore},blockId:e,slate:i};t.applyTransforms([o],{source:"api",validatePaths:!1})}}s(n)},o&&(i=o(i,t,e)),i}),[]),ba=e=>"set_selection"!==e.type,wa=(e,t)=>t===e||(!(!t||"insert_text"!==e.type||"insert_text"!==t.type||e.offset!==t.offset+t.text.length||!x.equals(e.path,t.path))||!(!t||"remove_text"!==e.type||"remove_text"!==t.type||e.offset+e.text.length!==t.offset||!x.equals(e.path,t.path))),ka=({id:t,customEditor:n,elements:r,marks:o,events:i,options:l,extensions:c,placeholder:u="Type '/' for commands"})=>{const f=zt(),p=$t(t);let h=a(p.value).current;const g=s((()=>(e=>{const t={};return Object.keys(e).forEach((n=>t[n]=e[n].render)),t})(r)),[r]),v=s((()=>(e=>{const t={};return e?(e.forEach((e=>t[e.type]=e)),t):t})(o)),[o]),m=ma(t,f,p,r,c),b=((e,t,n,r)=>s((()=>{if(!e||t.readOnly)return{};const o=Bl(e||{},["onBeforeCreate","onDestroy","onCreate"]),i={hotkeys:Zl,currentBlock:n,defaultBlock:Ee.buildBlockData({id:I()})},l={};return Object.keys(o).forEach((e=>{l[e]=function(n){o[e]&&o[e](t,r,i)(n)}})),l}),[e,t,n]))(i,f,p,m),w=d((e=>{f.readOnly||(window.scheduler?window.scheduler.postTask((()=>f.updateBlock(t,{value:e})),{priority:"background"}):f.updateBlock(t,{value:e}))}),[t]),k=d((e=>{f.readOnly||"mousemove"!==f.path.source&&"keyboard"!==f.path.source&&f.setPath({current:f.path.current,selected:f.path.selected,selection:e,source:"native-selection"})}),[f.readOnly]),O=d((n=>{const r=g[n.element.type],{attributes:o}=n,i=Bl(n,["attributes"]);return o["data-element-type"]=i.element.type,r?e(r,Object.assign({},i,{attributes:o,blockId:t,HTMLAttributes:null==l?void 0:l.HTMLAttributes})):e(R,Object.assign({},i,{attributes:o}))}),[r]),S=d((t=>{var n,r,o,i;let{children:l,leaf:a,attributes:s}=t;const c=Bl(a,["text"]),d=f.path.current===p.meta.order;c&&Object.keys(c).forEach((e=>{const t=v[e];t&&(l=t.render({children:l,leaf:a}))}));const h=!("void"===(null===(i=null===(o=null===(r=null===(n=t.children)||void 0===n?void 0:n.props)||void 0===r?void 0:r.parent)||void 0===o?void 0:o.props)||void 0===i?void 0:i.nodeType))&&d&&a.withPlaceholder;return e(Gl,Object.assign({attributes:s,placeholder:h?u:void 0},{children:l}))}),[o]),_=d((e=>{var t;f.readOnly||(null===(t=b.onKeyDown)||void 0===t||t.call(b,e),Jl.onKeyDown(f)(e))}),[b.onKeyDown,f.readOnly,f.path.current,p.meta.order]),j=d((e=>{var t;f.readOnly||null===(t=null==b?void 0:b.onKeyUp)||void 0===t||t.call(b,e)}),[b.onKeyUp,f.readOnly]),D=d((e=>{var t;f.readOnly||(e.preventDefault(),null===(t=null==b?void 0:b.onBlur)||void 0===t||t.call(b,e))}),[b.onBlur,f.readOnly]),A=d((e=>{var t;f.readOnly||(f.isFocused()||(ee.set(f,!0),f.emit("focus",!0)),null===(t=null==b?void 0:b.onFocus)||void 0===t||t.call(b,e))}),[b.onFocus,f.readOnly]),P=d((e=>{var t;if(f.readOnly)return;null===(t=null==b?void 0:b.onPaste)||void 0===t||t.call(b,e);const n=e.clipboardData.getData("text/html"),r=(new DOMParser).parseFromString(n,"text/html");if(r.body.childNodes.length>0){const t=ia(f,r.body);if(t.length>0&&null!==f.path.current){e.preventDefault();let n=!1,r=!1;if(m&&m.selection){const e=x.parent(m.selection.anchor.path),t=y.string(m,e).trim(),o=y.isStart(m,m.selection.anchor,e);r=""===t&&o,n=!o||t.length>0,C.blur(m)}const o=f.path.current;if(null===o)return;return void f.batchOperations((()=>{const e=[];r&&f.deleteBlock({at:o}),t.forEach(((t,r)=>{let i=n?o+r+1:o+r;e.push(i);const l=Bl(t,["type"]);f.insertBlock(t.type,{at:i,focus:!1,blockData:l})})),f.setPath({current:null,selected:e,source:"copy-paste"})}))}}}),[b.onPaste,f.readOnly]),B=d((e=>{const t=[];if(f.readOnly)return t;const[n,r]=e,o=f.path.current===p.meta.order;return m.selection&&o&&!y.isEditor(n)&&""===y.string(m,[r[0]])&&E.includes(m.selection,r)&&E.isCollapsed(m.selection)&&t.push(Object.assign(Object.assign({},m.selection),{withPlaceholder:!0})),t}),[f.readOnly,f.path.current,p.meta.order]);return e(xa,{id:t,slate:m,initialValue:h,onChange:w,onSelectionChange:k,decorate:B,renderLeaf:S,renderElement:O,eventHandlers:b,onKeyDown:_,onKeyUp:j,onFocus:A,onBlur:D,customEditor:n,readOnly:f.readOnly,onPaste:P})},xa=p((({id:t,slate:n,initialValue:r,onChange:o,renderLeaf:i,renderElement:l,eventHandlers:a,onKeyDown:s,onKeyUp:c,onFocus:u,onSelectionChange:d,onPaste:f,customEditor:p,decorate:h,readOnly:g})=>"function"==typeof p?p({blockId:t}):e(A,Object.assign({editor:n,initialValue:r,onValueChange:o,onSelectionChange:d},{children:e(P,Object.assign({renderElement:l,renderLeaf:i,className:"yoopta-slate",spellCheck:!0},a,{onKeyDown:s,onKeyUp:c,onFocus:u,decorate:h,readOnly:g,onPaste:f}),`editable-${t}`)}),`slate-${t}`)));xa.displayName="SlateEditorInstance";const Oa=({editor:e})=>({sensors:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return s((()=>[...t].filter((e=>null!=e))),[...t])}(_n(yr,{activationConstraint:{distance:20}}),_n(fr,{coordinateGetter:ko})),handleDragEnd:d((t=>{const{active:n,over:r}=t;if(n&&r&&n.id!==r.id){const t=e.children[r.id].meta.order;e.moveBlock(n.id,t)}}),[]),handleDragStart:d((t=>{e.setPath({current:null})}),[])});var Ea;function Sa(){return Sa=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},Sa.apply(this,arguments)}var _a,Ca=function(e){return r.createElement("svg",Sa({viewBox:"0 0 10 10",fill:"currentColor",style:{width:14,height:14,display:"block",flexShrink:0,backfaceVisibility:"hidden"}},e),Ea||(Ea=r.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 ja(){return ja=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},ja.apply(this,arguments)}var Da,Aa=function(e){return r.createElement("svg",ja({viewBox:"0 0 16 16",fill:"currentColor",style:{width:16,height:16,display:"block",flexShrink:0,backfaceVisibility:"hidden"}},e),_a||(_a=r.createElement("path",{d:"M7.977 14.963c.407 0 .747-.324.747-.723V8.72h5.362c.399 0 .74-.34.74-.747a.746.746 0 0 0-.74-.738H8.724V1.706c0-.398-.34-.722-.747-.722a.732.732 0 0 0-.739.722v5.529h-5.37a.746.746 0 0 0-.74.738c0 .407.341.747.74.747h5.37v5.52c0 .399.332.723.739.723z"})))};function Pa(){return Pa=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},Pa.apply(this,arguments)}var Ra=function(e){return r.createElement("svg",Pa({viewBox:"0 0 16 16",className:"turn_svg__loop",style:{width:16,height:16,display:"block",fill:"currentcolor",flexShrink:0,backfaceVisibility:"hidden"}},e),Da||(Da=r.createElement("path",{d:"M5.804 3.123c.006.38.254.622.673.622h4.887c.59 0 .914.305.914.92v6.628l-.901-.978-.514-.514c-.267-.254-.629-.273-.895-.013-.254.26-.248.635.012.895l2.165 2.158c.476.47 1.022.47 1.498 0l2.165-2.158c.26-.26.266-.635.012-.895-.266-.26-.628-.241-.895.013l-.514.514-.895.971V4.564c0-1.358-.71-2.063-2.082-2.063H6.477c-.42 0-.68.241-.673.622ZM.186 7.06c.26.266.622.247.889-.013l.52-.508.889-.971v6.722c0 1.359.71 2.063 2.082 2.063h4.957c.42 0 .68-.241.673-.622-.006-.387-.254-.622-.673-.622h-4.88c-.591 0-.915-.311-.915-.927V5.554l.895.984.52.508c.26.26.629.28.89.013.26-.26.253-.629-.013-.89L3.855 4.013c-.476-.476-1.016-.476-1.492 0L.2 6.17c-.267.26-.273.628-.013.889Z"})))};function Ba(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}var Ta=["color"],Ma=g((function(e,t){var n=e.color,r=void 0===n?"currentColor":n,o=Ba(e,Ta);return v("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o,{ref:t}),v("path",{d:"M1 9.50006C1 10.3285 1.67157 11.0001 2.5 11.0001H4L4 10.0001H2.5C2.22386 10.0001 2 9.7762 2 9.50006L2 2.50006C2 2.22392 2.22386 2.00006 2.5 2.00006L9.5 2.00006C9.77614 2.00006 10 2.22392 10 2.50006V4.00002H5.5C4.67158 4.00002 4 4.67159 4 5.50002V12.5C4 13.3284 4.67158 14 5.5 14H12.5C13.3284 14 14 13.3284 14 12.5V5.50002C14 4.67159 13.3284 4.00002 12.5 4.00002H11V2.50006C11 1.67163 10.3284 1.00006 9.5 1.00006H2.5C1.67157 1.00006 1 1.67163 1 2.50006V9.50006ZM5 5.50002C5 5.22388 5.22386 5.00002 5.5 5.00002H12.5C12.7761 5.00002 13 5.22388 13 5.50002V12.5C13 12.7762 12.7761 13 12.5 13H5.5C5.22386 13 5 12.7762 5 12.5V5.50002Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))})),Na=["color"],La=g((function(e,t){var n=e.color,r=void 0===n?"currentColor":n,o=Ba(e,Na);return v("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o,{ref:t}),v("path",{d:"M3.625 7.5C3.625 8.12132 3.12132 8.625 2.5 8.625C1.87868 8.625 1.375 8.12132 1.375 7.5C1.375 6.87868 1.87868 6.375 2.5 6.375C3.12132 6.375 3.625 6.87868 3.625 7.5ZM8.625 7.5C8.625 8.12132 8.12132 8.625 7.5 8.625C6.87868 8.625 6.375 8.12132 6.375 7.5C6.375 6.87868 6.87868 6.375 7.5 6.375C8.12132 6.375 8.625 6.87868 8.625 7.5ZM12.5 8.625C13.1213 8.625 13.625 8.12132 13.625 7.5C13.625 6.87868 13.1213 6.375 12.5 6.375C11.8787 6.375 11.375 6.87868 11.375 7.5C11.375 8.12132 11.8787 8.625 12.5 8.625Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))})),Ia=["color"],Fa=g((function(e,t){var n=e.color,r=void 0===n?"currentColor":n,o=Ba(e,Ia);return v("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o,{ref:t}),v("path",{d:"M8.51194 3.00541C9.18829 2.54594 10.0435 2.53694 10.6788 2.95419C10.8231 3.04893 10.9771 3.1993 11.389 3.61119C11.8009 4.02307 11.9513 4.17714 12.046 4.32141C12.4633 4.95675 12.4543 5.81192 11.9948 6.48827C11.8899 6.64264 11.7276 6.80811 11.3006 7.23511L10.6819 7.85383C10.4867 8.04909 10.4867 8.36567 10.6819 8.56093C10.8772 8.7562 11.1938 8.7562 11.389 8.56093L12.0077 7.94221L12.0507 7.89929C12.4203 7.52976 12.6568 7.2933 12.822 7.0502C13.4972 6.05623 13.5321 4.76252 12.8819 3.77248C12.7233 3.53102 12.4922 3.30001 12.1408 2.94871L12.0961 2.90408L12.0515 2.85942C11.7002 2.508 11.4692 2.27689 11.2277 2.11832C10.2377 1.46813 8.94398 1.50299 7.95001 2.17822C7.70691 2.34336 7.47044 2.57991 7.1009 2.94955L7.058 2.99247L6.43928 3.61119C6.24401 3.80645 6.24401 4.12303 6.43928 4.31829C6.63454 4.51355 6.95112 4.51355 7.14638 4.31829L7.7651 3.69957C8.1921 3.27257 8.35757 3.11027 8.51194 3.00541ZM4.31796 7.14672C4.51322 6.95146 4.51322 6.63487 4.31796 6.43961C4.12269 6.24435 3.80611 6.24435 3.61085 6.43961L2.99213 7.05833L2.94922 7.10124C2.57957 7.47077 2.34303 7.70724 2.17788 7.95035C1.50265 8.94432 1.4678 10.238 2.11799 11.2281C2.27656 11.4695 2.50766 11.7005 2.8591 12.0518L2.90374 12.0965L2.94837 12.1411C3.29967 12.4925 3.53068 12.7237 3.77214 12.8822C4.76219 13.5324 6.05589 13.4976 7.04986 12.8223C7.29296 12.6572 7.52943 12.4206 7.89896 12.051L7.89897 12.051L7.94188 12.0081L8.5606 11.3894C8.75586 11.1941 8.75586 10.8775 8.5606 10.6823C8.36533 10.487 8.04875 10.487 7.85349 10.6823L7.23477 11.301C6.80777 11.728 6.6423 11.8903 6.48794 11.9951C5.81158 12.4546 4.95642 12.4636 4.32107 12.0464C4.17681 11.9516 4.02274 11.8012 3.61085 11.3894C3.19896 10.9775 3.0486 10.8234 2.95385 10.6791C2.53661 10.0438 2.54561 9.18863 3.00507 8.51227C3.10993 8.35791 3.27224 8.19244 3.69924 7.76544L4.31796 7.14672ZM9.62172 6.08558C9.81698 5.89032 9.81698 5.57373 9.62172 5.37847C9.42646 5.18321 9.10988 5.18321 8.91461 5.37847L5.37908 8.91401C5.18382 9.10927 5.18382 9.42585 5.37908 9.62111C5.57434 9.81637 5.89092 9.81637 6.08619 9.62111L9.62172 6.08558Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))})),za=["color"],$a=g((function(e,t){var n=e.color,r=void 0===n?"currentColor":n,o=Ba(e,za);return v("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o,{ref:t}),v("path",{d:"M5.5 1C5.22386 1 5 1.22386 5 1.5C5 1.77614 5.22386 2 5.5 2H9.5C9.77614 2 10 1.77614 10 1.5C10 1.22386 9.77614 1 9.5 1H5.5ZM3 3.5C3 3.22386 3.22386 3 3.5 3H5H10H11.5C11.7761 3 12 3.22386 12 3.5C12 3.77614 11.7761 4 11.5 4H11V12C11 12.5523 10.5523 13 10 13H5C4.44772 13 4 12.5523 4 12V4L3.5 4C3.22386 4 3 3.77614 3 3.5ZM5 4H10V12H5V4Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))})),Ha=function(){var e=document.getSelection();if(!e.rangeCount)return function(){};for(var t=document.activeElement,n=[],r=0;r<e.rangeCount;r++)n.push(e.getRangeAt(r));switch(t.tagName.toUpperCase()){case"INPUT":case"TEXTAREA":t.blur();break;default:t=null}return e.removeAllRanges(),function(){"Caret"===e.type&&e.removeAllRanges(),e.rangeCount||n.forEach((function(t){e.addRange(t)})),t&&t.focus()}},Va={"text/plain":"Text","text/html":"Url",default:"Text"};var Ua=function(e,t){var n,r,o,i,l,a,s=!1;t||(t={}),n=t.debug||!1;try{if(o=Ha(),i=document.createRange(),l=document.getSelection(),(a=document.createElement("span")).textContent=e,a.ariaHidden="true",a.style.all="unset",a.style.position="fixed",a.style.top=0,a.style.clip="rect(0, 0, 0, 0)",a.style.whiteSpace="pre",a.style.webkitUserSelect="text",a.style.MozUserSelect="text",a.style.msUserSelect="text",a.style.userSelect="text",a.addEventListener("copy",(function(r){if(r.stopPropagation(),t.format)if(r.preventDefault(),void 0===r.clipboardData){n&&console.warn("unable to use e.clipboardData"),n&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var o=Va[t.format]||Va.default;window.clipboardData.setData(o,e)}else r.clipboardData.clearData(),r.clipboardData.setData(t.format,e);t.onCopy&&(r.preventDefault(),t.onCopy(r.clipboardData))})),document.body.appendChild(a),i.selectNodeContents(a),l.addRange(i),!document.execCommand("copy"))throw new Error("copy command was unsuccessful");s=!0}catch(o){n&&console.error("unable to copy using execCommand: ",o),n&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(t.format||"text",e),t.onCopy&&t.onCopy(window.clipboardData),s=!0}catch(o){n&&console.error("unable to copy using clipboardData: ",o),n&&console.error("falling back to prompt"),r=function(e){var t=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return e.replace(/#{\s*key\s*}/g,t)}("message"in t?t.message:"Copy to clipboard: #{key}, Enter"),window.prompt(r,e)}}finally{l&&("function"==typeof l.removeRange?l.removeRange(i):l.removeAllRanges()),a&&document.body.removeChild(a),o()}return s};const Ka=t=>{var{className:n,children:r,lockScroll:o=!0}=t,i=Bl(t,["className","children","lockScroll"]);return e(Sl,Object.assign({lockScroll:o,className:n},i,{onClick:e=>{var t;e.stopPropagation(),null===(t=i.onClick)||void 0===t||t.call(i,e)},onMouseDown:e=>{var t;e.stopPropagation(),null===(t=i.onMouseDown)||void 0===t||t.call(i,e)}},{children:r}))},Wa=t=>{const[n,r]=f(!1),o=a(null),i=zt();return u((()=>{r(!0);const e=i.refElement;if(!e)return;return e.querySelector(".yoopta-overlays")||(o.current=document.createElement("div"),o.current.className="yoopta-overlays",e.appendChild(o.current)),()=>{o.current&&o.current.remove()}}),[]),n?e(xl,Object.assign({id:`${t.id}-${i.id}`,root:o.current||i.refElement},{children:t.children})):null},qa=({children:t})=>e("div",Object.assign({className:"yoopta-block-options-group"},{children:t})),Ya=({children:t})=>e("div",Object.assign({onClick:e=>e.stopPropagation(),className:"yoopta-block-options-menu-content data-[state=open]:yoo-editor-animate-in data-[state=closed]:yoo-editor-animate-out data-[state=closed]:yoo-editor-fade-out-0 data-[state=open]:yoo-editor-fade-in-0 data-[state=closed]:yoo-editor-zoom-out-95 data-[state=open]:yoo-editor-zoom-in-95 data-[side=bottom]:yoo-editor-slide-in-from-top-2 data-[side=left]:yoo-editor-slide-in-from-right-2 data-[side=right]:yoo-editor-slide-in-from-left-2 data-[side=top]:yoo-editor-slide-in-from-bottom-2"},{children:t})),Xa=({children:t})=>e("div",Object.assign({className:"yoopta-block-options-item"},{children:t})),Za=["delete","duplicate","turnInto","copy"],Ja=({isOpen:n,onClose:r,refs:o,style:i,actions:l=Za,children:a})=>{var s,c,u;const d=zt(),p=So(),[h,g]=f(!1),{refs:v,floatingStyles:y,context:m}=_l({placement:"right",open:h,onOpenChange:g,middleware:[Ai(),Di(),ji(),di(10)],whileElementsMounted:Ci}),{isMounted:b,styles:w}=Al(m,{duration:100});if(!n)return null;const k=ne(d,{at:d.path.current}),x=H(null===(s=d.blocks[(null==k?void 0:k.type)||""])||void 0===s?void 0:s.elements),O="void"===(null===(c=null==x?void 0:x.props)||void 0===c?void 0:c.nodeType),E=p.ActionMenu,S=Object.assign(Object.assign({},y),w),_=Pl({editor:d,view:"small",onClose:()=>{g(!1),r()}});return e(Wa,Object.assign({id:"yoo-block-options-portal"},{children:e(Ka,Object.assign({lockScroll:!0,className:"yoo-editor-z-[100]",onClick:r},{children:e("div",Object.assign({style:i,ref:o.setFloating,contentEditable:!1},{children:t(Ya,{children:[null!==l&&t(qa,{children:[e(Xa,{children:t("button",Object.assign({type:"button",className:"yoopta-block-options-button",onClick:()=>{d.deleteBlock({at:d.path.current}),d.setPath({current:null}),r()}},{children:[e($a,{className:"yoo-editor-w-4 yoo-editor-h-4 yoo-editor-mr-2"}),"Delete"]}))}),e(Xa,{children:t("button",Object.assign({type:"button",className:"yoopta-block-options-button",onClick:()=>{"number"==typeof d.path.current&&(d.duplicateBlock({original:{path:d.path.current},focus:!0}),r())}},{children:[e(Ma,{className:"yoo-editor-w-4 yoo-editor-h-4 yoo-editor-mr-2"}),"Duplicate"]}))}),!!E&&!O&&!(null===(u=d.blocks[(null==k?void 0:k.type)||""])||void 0===u?void 0:u.hasCustomEditor)&&t(Xa,{children:[b&&e(Wa,Object.assign({id:"yoo-block-options-portal"},{children:e(Ka,Object.assign({lockScroll:!0,className:"yoo-editor-z-[100]",onClick:()=>g(!1)},{children:e("div",Object.assign({style:S,ref:v.setFloating},{children:e(E,Object.assign({},_))}))}))})),t("button",Object.assign({type:"button",className:"yoopta-block-options-button",ref:v.setReference,onClick:()=>g((e=>!e))},{children:[e(Ra,{className:"yoo-editor-w-4 yoo-editor-h-4 yoo-editor-mr-2"}),"Turn into"]}))]}),e(Xa,{children:t("button",Object.assign({type:"button",className:"yoopta-block-options-button",onClick:()=>{const e=ne(d);e&&(Ua(`${window.location.origin}${window.location.pathname}#${e.id}`),d.emit("block:copy",e)),r()}},{children:[e(Fa,{className:"yoo-editor-w-4 yoo-editor-h-4 yoo-editor-mr-2"}),"Copy link to block"]}))})]}),a]})}))}))}))};var Ga=Object.freeze({__proto__:null,BlockOptions:Ja,BlockOptionsMenuContent:Ya,BlockOptionsMenuGroup:qa,BlockOptionsMenuItem:Xa,BlockOptionsSeparator:({className:t=""})=>e("div",{className:`yoopta-block-options-separator ${t}`})});const Qa={position:"fixed",top:0,left:0,opacity:0,transform:"scale(0.95) translateX(-46px)",transition:"opacity 150ms ease-out"},es=p((({editor:n,dragHandleProps:r})=>{const[o,i]=f(null),l=a(null),[s,c]=f(Qa),{attributes:d,listeners:p,setActivatorNodeRef:h}=r||{},{isBlockOptionsMounted:g,setIsBlockOptionsOpen:v,blockOptionsFloatingStyle:m,blockOptionsRefs:b}=(()=>{const[e,t]=f(!1),{refs:n,floatingStyles:r,context:o}=_l({placement:"right-start",open:e,onOpenChange:t,middleware:[Ai(),Di(),ji(),di()]}),{isMounted:i,styles:l}=Al(o,{duration:100});return{blockOptionsRefs:n,blockOptionsFloatingStyle:Object.assign(Object.assign({},r),l),isBlockOptionsOpen:e,setIsBlockOptionsOpen:t,isBlockOptionsMounted:i}})(),{isActionMenuOpen:k,actionMenuRefs:x,hasActionMenu:O,actionMenuStyles:E,onChangeActionMenuOpen:S,onCloseActionMenu:_,actionMenuRenderProps:j,ActionMenu:D}=(({editor:e})=>{const t=So().ActionMenu,[n,r]=f(!1),{refs:o,floatingStyles:i,context:l}=_l({placement:"bottom-start",open:n,onOpenChange:r,middleware:[Ai(),Di(),ji(),di(10)],whileElementsMounted:Ci}),{isMounted:a,styles:s}=Al(l,{duration:100}),c=Object.assign(Object.assign({},i),s),u=e=>r(e),d=()=>u(!1),p=Pl({editor:e,view:"default",mode:"create",onClose:d});return{isActionMenuOpen:a,actionMenuStyles:c,actionMenuRefs:o,hasActionMenu:!!t,onChangeActionMenuOpen:u,actionMenuRenderProps:p,onCloseActionMenu:d,ActionMenu:t}})({editor:n}),A=()=>{c((e=>Object.assign(Object.assign({},e),{opacity:0,transform:Qa.transform}))),setTimeout((()=>{i(null)}),150)},P=function(e,t,{leading:n=!0,trailing:r=!0}={}){let o=0,i=null,l=null;const a=t=>{e(...l),o=t,l=null},s=(...e)=>{const s=Date.now();o||n||(o=s);const c=t-(s-o);l=e,c<=0||c>t?(i&&(clearTimeout(i),i=null),a(s)):!i&&r&&(i=setTimeout((()=>{i=null,r&&l&&a(Date.now())}),c))};return s.cancel=()=>{i&&(clearTimeout(i),i=null),l=null,o=0},s}((e=>{var t;if(!(null===(t=n.refElement)||void 0===t?void 0:t.contains(e.target)))return A();if(n.readOnly)return;const r=e.target.closest("[data-yoopta-block]");if(r){const e=r.getAttribute("data-yoopta-block-id");if(e===(null==o?void 0:o.id))return;const t=n.children[e||""];t&&((e,t)=>{var n;i(t);const r=e.getBoundingClientRect(),o=(null===(n=l.current)||void 0===n?void 0:n.offsetWidth)||46;c((e=>Object.assign(Object.assign({},e),{top:r.top+2,left:r.left,opacity:1,transform:`scale(1) translateX(-${o}px)`})))})(r,t)}}),100,{leading:!0,trailing:!0});u((()=>(document.addEventListener("scroll",A),document.addEventListener("mousemove",P),()=>{document.removeEventListener("scroll",A),document.removeEventListener("mousemove",P),P.cancel()})),[]);return e(Wa,Object.assign({id:"block-actions"},{children:e("div",Object.assign({contentEditable:!1,style:s,className:"yoopta-block-actions",ref:l},{children:t("div",Object.assign({className:"yoopta-block-action-buttons"},{children:[k&&O&&e(Wa,Object.assign({id:"yoo-block-options-portal"},{children:e(Ka,Object.assign({lockScroll:!0,className:"yoo-editor-z-[100]",onClick:_},{children:e("div",Object.assign({style:E,ref:x.setFloating},{children:e(D,Object.assign({},j))}))}))})),e("button",Object.assign({type:"button",onClick:()=>{var e;const t=o;if(!t)return;const r=Ee.getBlockSlate(n,{id:t.id}),i=n.blocks[t.type];if(!r)return;const l=document.querySelector(`[data-yoopta-block-id="${t.id}"]`),a=H(i.elements);let s;i.hasCustomEditor||(s=y.string(r,[0]));const c="string"==typeof s&&0===s.trim().length;if(O&&c&&"void"!==(null===(e=null==a?void 0:a.props)||void 0===e?void 0:e.nodeType))n.setPath({current:t.meta.order}),n.focusBlock(t.id),x.setReference(l),S(!0);else{const e=Ee.buildBlockData({id:I()}),r=t.meta.order+1;n.setPath({current:t.meta.order}),n.insertBlock(e.type,{at:r,focus:!0}),O&&setTimeout((()=>{l&&x.setReference(l.nextSibling),S(!0)}),0)}},className:"yoopta-block-actions-plus"},{children:e(Aa,{})})),e("button",Object.assign({ref:e=>{null==h||h(e),b.setReference(e)},type:"button",className:"yoopta-block-actions-drag",onClick:e=>{e.stopPropagation();const t=o;if(!t)return;const r=re(n,{at:t.meta.order});n.focusBlock(t.id),r&&setTimeout((()=>{n.blocks[t.type].hasCustomEditor||(C.blur(r),C.deselect(r),w.deselect(r)),n.setPath({current:t.meta.order,selected:[t.meta.order]}),v(!0)}),10)}},d,p,{children:e(Ca,{})})),e(Ja,{isOpen:g,refs:b,style:m,onClose:()=>v(!1)})]}))}))}))}));es.displayName="FloatingBlockActions";const ts=[],ns=({editor:r,marks:o,placeholder:i})=>{const l=Vt(),{sensors:a,handleDragEnd:c,handleDragStart:u}=Oa({editor:r}),[d,p]=f(null),h=Object.keys(r.children),g=s((()=>0===h.length?ts:h.sort(((e,t)=>r.children[e].meta.order-r.children[t].meta.order))),[h]),v=[];for(let t=0;t<g.length;t++){const n=g[t],l=r.children[n],a=r.plugins[l.type];l&&a?v.push(e(Rl,Object.assign({block:l,blockId:n,onActiveDragHandleChange:p},{children:e(ka,{type:l.type,id:n,marks:o,customEditor:a.customEditor,events:a.events,elements:a.elements,options:a.options,extensions:a.extensions,placeholder:i},n)}),n)):console.error(`Plugin ${l.type} not found`)}return l?e(n,{children:v}):e(Xr,Object.assign({id:"yoopta-dnd-context",sensors:a,collisionDetection:Tn,onDragStart:u,onDragEnd:c},{children:t(uo,Object.assign({disabled:l,items:g,strategy:ao},{children:[v,e(es,{editor:r,dragHandleProps:d})]}))}))},rs=({editor:e,root:t})=>{const[n,r]=f({origin:[0,0],coords:[0,0],selection:!1}),o=o=>{var i;if(e.readOnly||!1===t)return;const l=null===(i=e.refElement)||void 0===i?void 0:i.contains(o.target),s=Z.getSelectedPaths(e);if(!l&&!n.selection&&Array.isArray(s)&&s.length>0)return e.setPath({current:null}),a();l||r({origin:[o.pageX,o.pageY-window.pageYOffset],coords:[o.pageX,o.pageY-window.pageYOffset],selection:!0})},i=o=>{if(!n.selection||e.readOnly||!1===t)return;r((e=>Object.assign(Object.assign({},e),{coords:[o.pageX,o.pageY-window.pageYOffset]})));const i=((e,t,n)=>{var r;const o=[],i=null===(r=e.refElement)||void 0===r?void 0:r.querySelectorAll("[data-yoopta-block]");return i?(i.forEach(((e,r)=>{if(!e)return;const i=e.getBoundingClientRect(),l=Math.min(t[1],n[1]),a=Math.min(t[0],n[0]),s=Math.max(t[1],n[1]),c=Math.max(t[0],n[0]);l<i.bottom&&s>i.top&&a<i.right&&c>i.left&&o.push(r)})),o):o})(e,n.origin,[o.pageX,o.pageY-window.pageYOffset]);e.setPath({current:null,selected:i,source:"selection-box"})},l=()=>{e.readOnly||a()};u((()=>{var n;if(e.readOnly||!1===t)return;const r=t&&"current"in t?t.current:t||document;if(!r)throw new Error("Root element not found. Please check the `selectionBoxRoot` prop");if(!("nodeType"in r))throw new Error("Root element should be a DOM element or a ref object. Please check the `selectionBoxRoot` prop");if(null===(n=e.refElement)||void 0===n?void 0:n.contains(r))throw new Error("Root element should not be a child of the editor. Please check the `selectionBoxRoot` prop");return r.addEventListener("mousedown",o),r.addEventListener("mousemove",i),r.addEventListener("mouseup",l),()=>{r.removeEventListener("mousedown",o),r.removeEventListener("mousemove",i),r.removeEventListener("mouseup",l)}}),[e.path,n,t,e.readOnly]);const a=()=>{r({origin:[0,0],coords:[0,0],selection:!1})};return Object.assign(Object.assign({},n),{onClose:a})},os=({origin:t,coords:n,isOpen:r})=>{if(!r)return null;const o={zIndex:10,left:t[0],top:t[1],height:Math.abs(n[1]-t[1]-1),width:Math.abs(n[0]-t[0]-1),userSelect:"none",transformOrigin:"top left",transform:t[1]>n[1]&&t[0]>n[0]?"scaleY(-1) scaleX(-1)":t[1]>n[1]?"scaleY(-1)":t[0]>n[0]?"scaleX(-1)":void 0,position:"fixed",backgroundColor:"rgba(35, 131, 226, 0.14)"};return e("div",{style:o})},is={selectionStarted:!1,indexToSelect:null,startedIndexToSelect:null};function ls({editor:e}){const t=a(!1),n=a(!1),r=a(null),o=a(null);let i=a(is).current;const l=()=>{const t=e.path.current;if("number"==typeof t){const n=Ee.getBlockSlate(e,{at:t}),r=Ee.getBlock(e,{at:t}),o=e.blocks[(null==r?void 0:r.type)||""];if(!n||(null==o?void 0:o.hasCustomEditor))return;try{y.withoutNormalizing(n,(()=>{w.select(n,[0]),n.selection&&E.isExpanded(n.selection)&&(C.blur(n),C.deselect(n))}))}catch(e){}}},s=i=>{if(!t.current||e.readOnly)return;const a=document.elementFromPoint(i.clientX,i.clientY),s=null==a?void 0:a.closest("[data-yoopta-block]");s&&e.batchOperations((()=>{var t;const i=s.getAttribute("data-yoopta-block-id")||"",a=null===(t=e.children[i])||void 0===t?void 0:t.meta.order;if(n.current&&"number"==typeof a&&a===r.current)return o.current=a,void e.setPath({current:a,selected:[a],source:"mousemove"});if("number"==typeof a&&a!==o.current){o.current=a,n.current=!0;const t=Math.min(r.current,a),i=Math.max(r.current,a);l();const s=Array.from({length:i-t+1},((e,n)=>t+n));e.setPath({current:a,selected:s,source:"mousemove"})}}))},c=()=>{var i,l;t.current=!1,n.current=!1,r.current=null,o.current=null,null===(i=e.refElement)||void 0===i||i.removeEventListener("mousemove",s),null===(l=e.refElement)||void 0===l||l.removeEventListener("mouseup",c),null===document||void 0===document||document.removeEventListener("mouseup",c)};return{onMouseDown:n=>{e.readOnly||(e.isFocused()||e.focus(),e.batchOperations((()=>{var i,a,u;const d=Z.getSelectedPaths(e);Array.isArray(d)&&d.length>0&&!n.shiftKey&&!n.altKey&&e.setPath({current:null});const f=n.target.closest("[data-yoopta-block]");if(f&&0===n.button){const d=f.getAttribute("data-yoopta-block-id")||"",p=null===(i=e.children[d])||void 0===i?void 0:i.meta.order;if("number"==typeof p){if(t.current=!0,r.current=p,o.current=p,n.shiftKey&&!Z.isPathEmpty(e)&&p!==e.path.current)return void(t=>{l();const n=Z.getPath(e);if("number"!=typeof n)return;const r=Array.from({length:Math.abs(t-n)}).map(((e,r)=>t>n?n+r+1:n-r-1));e.setPath({current:t,selected:[...r,n],source:"keyboard"})})(p);p!==e.path.current&&e.setPath({current:p}),null===(a=e.refElement)||void 0===a||a.addEventListener("mousemove",s),null===(u=e.refElement)||void 0===u||u.addEventListener("mouseup",c),null===document||void 0===document||document.addEventListener("mouseup",c)}}})))},onShiftArrowUp:t=>{if("function"==typeof t.isDefaultPrevented&&t.isDefaultPrevented())return;if(i.selectionStarted&&null!==i.startedIndexToSelect&&null!==i.indexToSelect){const t=i.indexToSelect,n=t-1;if(0===t)return;if(t===i.startedIndexToSelect){const t=e.path.selected?[...e.path.selected,n]:[n];return e.setPath({current:n,selected:t,source:"keyboard"}),void(i.indexToSelect=n)}if(n<i.startedIndexToSelect){const t=e.path.selected?[...e.path.selected,n]:[n];return e.setPath({current:n,selected:t,source:"keyboard"}),void(i.indexToSelect=n)}const r=Z.getSelectedPaths(e);if((null==r?void 0:r.includes(t))&&t!==i.startedIndexToSelect){const o=r.filter((e=>e!==t));return e.setPath({current:n,selected:o,source:"keyboard"}),void(i.indexToSelect=n)}return}const n=ne(e),r=re(e);if(!r||!r.selection||!n)return;const o=x.parent(r.selection.anchor.path),l=y.isStart(r,r.selection.focus,o);if(E.isExpanded(r.selection)&&l){const o=q(e);if("number"!=typeof o)return;const l=ne(e,{at:o});if(n&&l){t.preventDefault(),C.blur(r),C.deselect(r),w.deselect(r);const o=e.path.selected?[...e.path.selected,null==n?void 0:n.meta.order,n.meta.order-1]:[null==n?void 0:n.meta.order,n.meta.order-1];e.setPath({current:null,selected:o,source:"keyboard"}),i.startedIndexToSelect=n.meta.order,i.indexToSelect=n.meta.order-1,i.selectionStarted=!0}}},onShiftArrowDown:t=>{if(i.selectionStarted&&null!==i.indexToSelect&&null!==i.startedIndexToSelect){const t=i.indexToSelect,n=t+1;if(n===Object.keys(e.children).length)return;if(t===i.startedIndexToSelect){const t=e.path.selected?[...e.path.selected,n]:[n];return e.setPath({current:n,selected:t,source:"keyboard"}),void(i.indexToSelect=n)}if(n>i.startedIndexToSelect){const t=e.path.selected?[...e.path.selected,n]:[n];return e.setPath({current:n,selected:t,source:"keyboard"}),void(i.indexToSelect=n)}const r=Z.getSelectedPaths(e);if((null==r?void 0:r.includes(t))&&t!==i.startedIndexToSelect){const o=r.filter((e=>e!==t));return e.setPath({current:n,selected:o,source:"keyboard"}),void(i.indexToSelect=n)}return}const n=ne(e),r=re(e);if(!r||!r.selection||!n)return;const o=x.parent(r.selection.anchor.path),l=y.isEnd(r,r.selection.focus,o);if(E.isExpanded(r.selection)&&l){const o=Z.getNextPath(e),l=ne(e,{at:o});if(n&&l){t.preventDefault(),C.blur(r),C.deselect(r),w.deselect(r);const o=e.path.selected?[...e.path.selected,null==n?void 0:n.meta.order,(null==n?void 0:n.meta.order)+1]:[null==n?void 0:n.meta.order,n.meta.order+1];e.setPath({current:null,selected:o,source:"keyboard"}),i.startedIndexToSelect=n.meta.order,i.indexToSelect=n.meta.order+1,i.selectionStarted=!0}}},selectionState:i}}const as=({placeholder:n,marks:r,className:o,selectionBoxRoot:i,width:l,style:a,children:s,autoFocus:c=!0})=>{const d=zt(),f=Vt(),p=rs({editor:d,root:i}),h=ls({editor:d});u((()=>{c&&!f&&d.focus()}),[c,f]),u((()=>{if(!f)return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)}),[d.path,f]);const g=()=>{h.selectionState.indexToSelect=null,h.selectionState.startedIndexToSelect=null,h.selectionState.selectionStarted=!1},v=e=>{if(!f){if(Zl.isRedo(e))return e.preventDefault(),void d.redo();if(Zl.isUndo(e))return e.preventDefault(),void d.undo();if(Zl.isSelect(e)){const t=Z.getSelectedPaths(d);if((null==t?void 0:t.length)===Object.keys(d.children).length)return void e.preventDefault();if(Array.isArray(t)&&t.length>0){e.preventDefault();const t=Object.keys(d.children).map(((e,t)=>t));return void d.setPath({current:null,selected:t,source:"keyboard"})}}if(Zl.isCopy(e)||Zl.isCut(e)){const t=Z.getSelectedPaths(d);if(Array.isArray(t)&&t.length>0){e.preventDefault();const t=d.getHTML(d.getEditorValue()),n=d.getPlainText(d.getEditorValue()),r=new Blob([t],{type:"text/html"}),o=new Blob([n],{type:"text/plain"}),i=new ClipboardItem({"text/html":r,"text/plain":o});return navigator.clipboard.write([i]).then((()=>{const e=(new DOMParser).parseFromString(t,"text/html");console.log("HTML copied\n",e.body)})),void(Zl.isCut(e)&&(d.batchOperations((()=>{const e=Z.getSelectedPaths(d);if(Array.isArray(e)&&e.length>0){const t=e.length===Object.keys(d.children).length;if(e.forEach((e=>{var t;const n=null===(t=Ee.getBlock(d,{at:e}))||void 0===t?void 0:t.id;n&&d.deleteBlock({blockId:n})})),t){const e=z({id:I()});d.insertBlock(e.type,{at:0,focus:!0})}}})),d.setPath({current:null,selected:null,source:"copy-paste"}),g()))}}if(Zl.isBackspace(e)){e.stopPropagation();const t=Z.getSelectedPaths(d);return(null==t?void 0:t.length)===Object.keys(d.children).length?(e.preventDefault(),void d.batchOperations((()=>{Object.keys(d.children).forEach((e=>d.deleteBlock({blockId:e}))),d.setPath({current:null,selected:null}),g()}))):void d.batchOperations((()=>{const t=Z.getSelectedPaths(d);Array.isArray(t)&&(null==t?void 0:t.length)>0&&(e.preventDefault(),t.forEach((e=>d.deleteBlock({at:e}))),d.setPath({current:null,selected:null}),g())}))}if(Zl.isShiftArrowUp(e)&&h.onShiftArrowUp(e),Zl.isShiftArrowDown(e)&&h.onShiftArrowDown(e),Zl.isTab(e)){const t=Z.getSelectedPaths(d);Array.isArray(t)&&t.length>0&&(e.preventDefault(),d.batchOperations((()=>{t.forEach((e=>{const t=Ee.getBlock(d,{at:e});d.increaseBlockDepth({blockId:null==t?void 0:t.id})}))})))}else if(Zl.isShiftTab(e)){const t=Z.getSelectedPaths(d);Array.isArray(t)&&t.length>0&&(e.preventDefault(),d.batchOperations((()=>{t.forEach((e=>{const t=Ee.getBlock(d,{at:e});d.decreaseBlockDepth({blockId:null==t?void 0:t.id})}))})))}else;}},b=e=>{if(!f)return;const t=e.clipboardData,n=window.getSelection();if(n&&n.rangeCount>0){const e=n.getRangeAt(0);if(e.collapsed)return;const r=e.cloneContents().querySelectorAll("[data-yoopta-block-id]");if(!r.length)return;const o=Array.from(r).reduce(((e,t)=>{const n=t.getAttribute("data-yoopta-block-id")||"",r=d.children[n];return r&&(e[n]=r),e}),{}),i=d.getHTML(o),l=d.getPlainText(o);return t.setData("text/html",i),void t.setData("text/plain",l)}},w=(k=Object.assign(Object.assign({},a),{userSelect:p.selection?"none":"auto",pointerEvents:p.selection?"none":"auto",width:l||(null==a?void 0:a.width),paddingBottom:null==a?void 0:a.paddingBottom}),Object.assign(Object.assign({},k),{width:k.width||400,paddingBottom:"number"==typeof k.paddingBottom?k.paddingBottom:100}));var k;return t("div",Object.assign({ref:e=>d.refElement=e,className:o?`yoopta-editor ${o}`:"yoopta-editor",style:w,onMouseDown:e=>{f||(h.onMouseDown(e),g(),(e=>{var t;const n=d.refElement;if(!n)return;const{bottom:r}=n.getBoundingClientRect(),o=r-parseInt(getComputedStyle(n).paddingBottom,10),i=z({id:I()});if(e.clientY>=o){const e=Object.keys(d.children).length-1,n=ne(d,{at:e}),r=re(d,{at:e});if(n&&r&&r.selection){const e=y.string(r,r.selection.anchor.path),o=x.parent(r.selection.anchor.path),[l]=y.node(r,o);if(n.type===i.type&&m.isElement(l)&&"void"!==(null===(t=l.props)||void 0===t?void 0:t.nodeType)&&0===e.trim().length)return void d.focusBlock(n.id,{slate:r})}const o=e+1;d.insertBlock(i.type,{at:o,focus:!0})}})(e))},onBlur:e=>{var t,n;if((null===(t=d.refElement)||void 0===t?void 0:t.contains(e.relatedTarget))||(null===(n=d.refElement)||void 0===n?void 0:n.contains(e.target))||f)return;g();const r=Z.getSelectedPaths(d);Array.isArray(r)&&r.length>0&&d.setPath({current:null,selected:null})},onCopy:b,onCut:b},{children:[e(ns,{editor:d,marks:r,placeholder:n}),!1!==i&&e(os,{origin:p.origin,coords:p.coords,isOpen:p.selection&&!f}),s]}))};function ss(e,t){const n=re(e);if(!n)return!1;const r=y.marks(n);return!!(null==r?void 0:r[t])}function cs(e,t){const n={};return t.forEach((t=>{const r=t.type;n[r]={hotkey:t.hotkey,type:r,getValue:()=>function(e,t){const n=re(e);if(!n)return null;const r=y.marks(n);return null==r?void 0:r[t]}(e,r),isActive:()=>ss(e,r),toggle:()=>function(e,t){if(Array.isArray(e.path.selected)&&e.path.selected.length>0){const n=e.path.selected.map((n=>{const r=Ee.getBlockSlate(e,{at:n});if(!r)return{isActiveMark:!1,slate:r};const[o]=y.node(r,[]);if(!o)return{isActiveMark:!1,slate:r};const i=y.end(r,[]),l=y.start(r,[]);w.select(r,{anchor:l,focus:i});const a=y.marks(r);return{slate:r,isActiveMark:!!(null==a?void 0:a[t])}})),r=n.every((e=>e.isActiveMark));for(const e of n)e.isActiveMark?r&&y.removeMark(e.slate,t):y.addMark(e.slate,t,!0);return}const n=re(e),r=ss(e,t);n&&n.selection&&(r?y.removeMark(n,t):y.addMark(n,t,!0))}(e,r),update:t=>function(e,t,n){if(Array.isArray(e.path.selected)&&e.path.selected.length>0){for(const r of e.path.selected){const o=Ee.getBlockSlate(e,{at:r});if(!o)continue;const[i]=y.node(o,[]);if(!i)continue;const l=y.end(o,[]),a=y.start(o,[]);w.select(o,{anchor:a,focus:l});const s=y.marks(o);(null==s?void 0:s[t])?y.removeMark(o,t):y.addMark(o,t,n)}return}const r=re(e);r&&r.selection&&E.isExpanded(r.selection)&&y.addMark(r,t,n)}(e,r,t)}})),n}function us({type:e,hotkey:t,render:n}){return{type:e,hotkey:t,render:n}}const ds=us({type:"fakeSelection",render:t=>e("span",Object.assign({style:{backgroundColor:"#d7e6fa"}},{children:t.children}))}),fs=({id:t,editor:n,value:r,marks:o,plugins:i,autoFocus:l,className:a,tools:c,selectionBoxRoot:p,children:h,placeholder:g,readOnly:v,width:y,style:m,onChange:b,onPathChange:w})=>{const k=s((()=>o?[ds,...o]:[ds]),[o]),x=s((()=>i.map((e=>e.getPlugin))),[i]),[O,E]=f((()=>{n.id||(n.id=t||I()),n.readOnly=v||!1,k&&(n.formats=cs(n,k)),n.blocks=function(e,t){const n={};return t.forEach((t=>{var r;const o=H(t.elements),i=null===(r=null==o?void 0:o.props)||void 0===r?void 0:r.nodeType;if("inline"!==i&&"inlineVoid"!==i){const r={};Object.keys(t.elements).forEach((e=>{const n=Bl(t.elements[e],["render"]);r[e]=n}));const{display:o,placeholder:i,shortcuts:l}=t.options||{};n[t.type]={type:t.type,elements:r,hasCustomEditor:!!t.customEditor,options:{display:o,placeholder:i,shortcuts:l},isActive:()=>{const n=ne(e,{at:e.path.current});return(null==n?void 0:n.type)===t.type}}}})),n}(n,x);const e=fe(r);return e||void 0===r||console.error(`Initial value is not valid. Should be an object with blocks. You passed: ${JSON.stringify(r)}`),n.children=e?r:{},n.blockEditorsMap=function(e){const t={};return Object.keys(e.children).forEach((n=>{const r=kt(e);if(0===r.children.length){const t=e.children[n];if(t){const n=K(e,t.type);r.children=[n]}}t[n]=r})),t}(n),n.shortcuts=function(e){const t={};return Object.values(e.blocks).forEach((e=>{var n,r,o,i;e.options&&Array.isArray(null===(n=e.options)||void 0===n?void 0:n.shortcuts)&&(null===(r=e.options)||void 0===r?void 0:r.shortcuts.length)>0&&(null===(i=null===(o=e.options)||void 0===o?void 0:o.shortcuts)||void 0===i||i.forEach((n=>{t[n]=e})))})),t}(n),n.plugins=function(e){const t={},n={};return e.forEach((e=>{e.elements&&Object.keys(e.elements).forEach((t=>{var r;const o=e.elements[t],i=null===(r=o.props)||void 0===r?void 0:r.nodeType;"inline"!==i&&"inlineVoid"!==i||(n[t]=Object.assign(Object.assign({},o),{rootPlugin:e.type}))})),t[e.type]=e})),e.forEach((e=>{if(e.elements){const r=Object.assign(Object.assign({},e.elements),n);t[e.type]=Object.assign(Object.assign({},e),{elements:r})}})),t}(x),n.commands=function(e,t){const n={};return t.forEach((t=>{t.commands&&Object.keys(t.commands).forEach((r=>{var o;(null===(o=t.commands)||void 0===o?void 0:o[r])&&(n[r]=(...n)=>{var o;return null===(o=t.commands)||void 0===o?void 0:o[r](e,...n)})}))})),n}(n,x),{editor:n,version:0}})),[S,_]=f(null),C=d((e=>{_(e),null==w||w(e)}),[]),j=d(((e,t)=>{if(E((e=>({editor:e.editor,version:e.version+1}))),"function"==typeof b&&Array.isArray(t.operations)){const n=t.operations.filter((e=>"validate_block_paths"!==e.type&&"set_block_path"!==e.type&&"set_slate"!==e.type));n.length>0&&b(e,{operations:n})}}),[]);return u((()=>{const e=e=>{j(e.value,{operations:e.operations})};return n.on("change",e),n.on("path-change",C),()=>{n.off("change",e),n.off("path-change",C)}}),[n,j]),e(Ft,Object.assign({editorState:O},{children:e(Eo,Object.assign({tools:c},{children:e(as,Object.assign({placeholder:g,marks:k,autoFocus:l,className:a,selectionBoxRoot:p,width:y,style:m},{children:h}))}))}))},ps=Object.assign(Object.assign({},Ga),{ExtendedBlockActions:({id:r,className:o,style:i,onClick:l,children:a})=>{const s=Vt(),[c,u]=f(!1),{refs:d,floatingStyles:p,context:h}=_l({placement:"bottom-start",open:c,onOpenChange:u,middleware:[Ai(),Di(),ji(),di(10)],whileElementsMounted:Ci}),{isMounted:g,styles:v}=Al(h,{duration:100}),y=Object.assign(Object.assign({},v),p);return s?null:t(n,{children:[g&&e(Ja,Object.assign({isOpen:!0,onClose:()=>u(!1),refs:d,style:y},{children:a})),e("button",Object.assign({type:"button",contentEditable:!1,ref:d.setReference,id:r,className:`yoopta-button yoopta-extended-block-actions ${o||""}`,onClick:()=>{null==l||l(),u(!0)},style:c?Object.assign(Object.assign({},i),{opacity:1}):i},{children:e(La,{})}))]})},Portal:Wa,Overlay:Ka});function hs(e,t){var n;const r=[];return t.forEach((t=>{if(t.nodeType===Node.TEXT_NODE&&r.push({text:t.textContent||""}),t.nodeType===Node.ELEMENT_NODE){const n=t;if("P"!==n.nodeName&&"SPAN"!==n.nodeName&&"DIV"!==n.nodeName||r.push(Object.assign({},hs(e,n.childNodes)[0])),"B"!==n.nodeName&&"STRONG"!==n.nodeName||r.push(Object.assign({bold:!0},hs(e,n.childNodes)[0])),"I"!==n.nodeName&&"EM"!==n.nodeName||r.push(Object.assign({italic:!0},hs(e,n.childNodes)[0])),"S"!==n.nodeName&&"STRIKE"!==n.nodeName||r.push(Object.assign({strike:!0},hs(e,n.childNodes)[0])),"U"!==n.nodeName&&"INS"!==n.nodeName||r.push(Object.assign({underline:!0},hs(e,n.childNodes)[0])),"CODE"===n.nodeName&&r.push(Object.assign({code:!0},hs(e,n.childNodes)[0])),"MARK"===n.nodeName){const t=n.style.color,o=n.style.backgroundColor||"transparent";r.push(Object.assign({highlight:{color:t,backgroundColor:o}},hs(e,n.childNodes)[0]))}"A"===n.nodeName&&r.push({id:I(),type:"link",props:{url:n.getAttribute("href")||"",target:n.getAttribute("target")||"",rel:n.getAttribute("rel")||""},children:hs(e,n.childNodes)})}})),0!==r.length||(null===(n=r[0])||void 0===n?void 0:n.text)||r.push({text:""}),r}!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))}}('.yoo-editor-z-\\[100\\]{z-index:100}.yoo-editor-mr-2{margin-right:.5rem}.yoo-editor-h-4{height:1rem}.yoo-editor-w-4{width:1rem}.yoopta-editor *{border:0 solid #e5e7eb;box-sizing:border-box;scrollbar-color:#d3d1cb transparent}::-moz-selection{background:#c6ddf8}::selection{background:#c6ddf8}.yoopta-placeholder{display:contents;position:relative}.yoopta-placeholder:after{color:inherit;content:attr(data-placeholder);cursor:text;font-size:75%;font-style:inherit;font-weight:inherit;opacity:.5;padding-left:5px;pointer-events:none;position:absolute;text-indent:2px;top:50%;transform:translateY(-50%);-webkit-user-select:none;-moz-user-select:none;user-select:none}.yoopta-button{background-color:transparent;border-style:none;cursor:pointer}.yoopta-block{border-radius:.25rem;margin-bottom:1px;margin-top:2px;padding:0 2px;position:relative}.yoopta-selection-block:before{background-color:#2383e224;border-radius:4px;content:"";content:var(--tw-content);height:100%;inset:0;opacity:0;pointer-events:none;position:absolute;transition-duration:.2s;transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);width:100%;z-index:0}.yoopta-selection-block[data-block-selected=true]:before{background-color:#2383e224;opacity:1}.yoopta-block-actions{pointer-events:none}.yoopta-block-action-buttons{display:flex;pointer-events:auto}.yoopta-block-actions-plus{align-items:center;background-color:inherit;background-color:transparent;border-radius:6px;border-style:none;color:#37352f59;cursor:pointer;display:flex;height:24px;justify-content:center;margin:0 1px;padding:0;position:relative;transition-duration:.18s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);width:24px}.yoopta-block-actions-plus:active,.yoopta-block-actions-plus:focus,.yoopta-block-actions-plus:hover{background-color:#37362f14}.yoopta-block-actions-drag{align-items:center;background-color:inherit;background-color:transparent;border-radius:6px;border-style:none;color:#37352f59;cursor:pointer;display:flex;height:24px;justify-content:center;margin:0 1px;padding:0;position:relative;transition-duration:.18s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);width:18px}.yoopta-block-actions-drag:active,.yoopta-block-actions-drag:focus,.yoopta-block-actions-drag:hover{background-color:#37362f14}.yoopta-slate:focus{outline:2px solid transparent;outline-offset:2px}.yoopta-slate:focus-visible{outline:2px solid transparent;outline-offset:2px}.yoopta-block-options-button{background-color:transparent;border-radius:.125rem;border-style:none;cursor:pointer;display:flex;justify-content:flex-start;line-height:120%;margin-left:4px;margin-right:4px;padding:.375rem .5rem;width:100%}.yoopta-block-options-button:hover{background-color:#37352f14}.yoopta-block-options-item{align-items:center;cursor:default;display:flex;font-size:.875rem;line-height:1.25rem;outline:2px solid transparent;outline-offset:2px;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);-webkit-user-select:none;-moz-user-select:none;user-select:none}.yoopta-block-options-item[data-disabled]{opacity:.5;pointer-events:none}.yoopta-extended-block-actions{--tw-bg-opacity:1;align-items:center;background-color:rgb(238 238 238/var(--tw-bg-opacity));border-radius:2px;border-style:none;cursor:pointer;display:flex;height:22px;justify-content:space-between;opacity:1;padding:0 4px;position:absolute;right:8px;top:8px;transition-duration:.15s;transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-timing-function:cubic-bezier(.4,0,1,1);width:22px;z-index:10}.yoopta-block-options-separator{background-color:#37352f14;height:1px;margin-bottom:4px;margin-top:4px;width:100%}.yoopta-block-options-menu-content{--tw-border-opacity:1;--tw-bg-opacity:1;--tw-shadow:0 4px 6px -1px rgba(0,0,0,.1),0 2px 4px -2px rgba(0,0,0,.1);--tw-shadow-colored:0 4px 6px -1px var(--tw-shadow-color),0 2px 4px -2px var(--tw-shadow-color);background-color:rgb(255 255 255/var(--tw-bg-opacity));border-color:rgb(229 231 235/var(--tw-border-opacity));border-radius:.375rem;border-style:solid;border-width:1px;box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow);min-width:200px;overflow:hidden;padding:6px 0;position:relative;width:auto}.yoopta-block-options-group{display:flex;flex-direction:column}.yoopta-align-left{justify-content:flex-start;text-align:left}.yoopta-align-center{justify-content:center;text-align:center}.yoopta-align-right{justify-content:flex-end;text-align:right}');export{Ee as Blocks,xe as Elements,Zl as HOTKEYS,Z as Paths,ps as UI,N as YooptaPlugin,z as buildBlockData,F as buildBlockElement,K as buildBlockElementsStructure,kt as buildSlateEditor,Nt as createYooptaEditor,us as createYooptaMark,fs as default,ia as deserializeHTML,hs as deserializeTextNodes,ne as findPluginBlockByPath,re as findSlateBySelectionPath,I as generateId,H as getRootBlockElement,$ as getRootBlockElementType,At as serializeTextNodes,Pt as serializeTextNodesIntoMarkdown,$t as useBlockData,Kt as useBlockSelected,zt as useYooptaEditor,Ht as useYooptaFocused,Ut as useYooptaPluginOptions,Vt as useYooptaReadOnly,So as useYooptaTools};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yoopta/editor",
|
|
3
|
-
"version": "4.9.
|
|
3
|
+
"version": "4.9.8",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"private": false,
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -68,5 +68,5 @@
|
|
|
68
68
|
"url": "https://github.com/Darginec05/Yoopta-Editor/issues"
|
|
69
69
|
},
|
|
70
70
|
"homepage": "https://github.com/Darginec05/Yoopta-Editor#readme",
|
|
71
|
-
"gitHead": "
|
|
71
|
+
"gitHead": "1f76dd78df66443a2f176994faab20db5a5be576"
|
|
72
72
|
}
|