@yoopta/editor 4.9.4-rc.0 → 4.9.4-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
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 m,Element as y,Text as b,Transforms as w,Point as x,Path as k,Node as O,Range as E,createEditor as _,Operation as S}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]=m.last(e,[]);if(y.isElement(n)&&!m.isEditor(n)){const[n,o]=m.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(x.isPoint(t))return t;if(k.isPath(t))return{path:t,offset:0};const[,n]=m.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]",m="[object WeakMap]",y="[object ArrayBuffer]",b="[object DataView]",w="[object Float32Array]",x="[object Float64Array]",k="[object Int8Array]",O="[object Int16Array]",E="[object Int32Array]",_="[object Uint8Array]",S="[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[y]=R[b]=R[i]=R[l]=R[w]=R[x]=R[k]=R[O]=R[E]=R[c]=R[u]=R[d]=R[p]=R[h]=R[g]=R[v]=R[_]=R[S]=R[C]=R[j]=!0,R["[object Error]"]=R[a]=R[m]=!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"),me=Ie(M,"WeakMap"),ye=Ie(Object,"create"),be=Ve(pe),we=Ve(he),xe=Ve(ge),ke=Ve(ve),Oe=Ve(me),Ee=re?re.prototype:void 0,_e=Ee?Ee.valueOf:void 0;function Se(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,m,A){var P;if(r&&(P=m?r(e,f,m,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&&!m){if(H(e))return m?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 m?e:{};P=function(e,t,n,r){var o=e.constructor;switch(t){case y: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 x:case k:case O:case E:case _:case S: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,_e?Object(_e.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}Se.prototype.clear=function(){this.__data__=ye?ye(null):{}},Se.prototype.delete=function(e){return this.has(e)&&delete this.__data__[e]},Se.prototype.get=function(e){var t=this.__data__;if(ye){var r=t[e];return r===n?void 0:r}return Q.call(t,e)?t[e]:void 0},Se.prototype.has=function(e){var t=this.__data__;return ye?void 0!==t[e]:Q.call(t,e)},Se.prototype.set=function(e,t){return this.__data__[e]=ye&&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 Se,map:new(he||Ce),string:new Se}},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||me&&ze(new me)!=m)&&(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 xe:return f;case ke:return h;case Oe:return m}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&&m.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=(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=m.above(t,{match:e=>y.isElement(e)&&m.isBlock(t,e),mode:"lowest"});if(!a)return;const[,s]=a,c=m.parent(t,s),[u]=c;if(y.isElement(u)&&!b.isText(u.children[0]))return n(r);const d=a?s:[],f={anchor:l,focus:m.start(t,d)},p=m.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 ve(e){return ge(e,j(_()))}const me="Paragraph";function ye(e,t,n,r){const o=r.plugins[n.type];return(null==o?void 0:o.customEditor)?n.value[0].children:m.isEditor(t)?t.children.flatMap((t=>ye(e,t,n,r))):y.isElement(t)?m.isInline(e,t)?[t]:t.children.flatMap((t=>ye(e,t,n,r))):[t]}function be(e){return y.isElement(e)?0===e.children.length||b.isText(e.children[0])?e:be(e.children[0]):null}function we(e,t,n={}){const r=ne(e,{at:n.at||e.path.current});if(!r)throw new Error("Block not found at current selection");let o=r.type===t?me: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=ye(a,a.children[0],r,e),u=be(s);u&&(u.children=c);const d={id:I(),type:o,meta:Object.assign(Object.assign({},r.meta),{align:void 0}),value:[s]},f=ve(e);f.children=[s];const p=[{type:"delete_block",block:r,path:{current:r.meta.order}},{type:"insert_block",path:{current:r.meta.order},block:d}];return e.applyTransforms(p),n.deleteText&&w.delete(f,{at:[0,0]}),n.focus&&e.focusBlock(d.id),d.id}function xe(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 ke(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=>y.isElement(e);(null==n?void 0:n.type)&&(i=e=>y.isElement(e)&&e.type===(null==n?void 0:n.type));try{const[e]=m.nodes(o,{at:(null==n?void 0:n.path)||o.selection||[0],match:i,mode:"lowest"});return e}catch(e){}}function Oe(e,t,n){const r=ke(e,t,n);if(r)return r[0]}const Ee={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?m.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=ke(e,t,{type:n.type});if(h){const[,e]=h;k.isPath(d)?p=d:"prev"===d?p=k.previous(e):"next"===d&&(p=k.next(e))}if(w.insertNodes(i,s,{at:p,select:f}),f&&u.length>0){const n=u[0],r=ke(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?m.withoutNormalizing(o,(()=>{w.removeNodes(o,{at:n.path,match:e=>y.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?m.withoutNormalizing(i,(()=>{const[e]=m.nodes(i,{at:(null==r?void 0:r.path)||[0],match:e=>y.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=>y.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?m.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:Oe,getElementChildren:function(e,t,n){const r=Oe(e,t,n);if(r)return r.children},getElementEntry:ke,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]=m.nodes(o,{at:n.path||o.selection,match:e=>y.isElement(e)&&e.type===n.type});if(i){const[e,t]=i;return 0===m.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 k.parent(e)}catch(e){}}};function _e(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=Ee.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,m.start(i,[]))}m.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 Se={insertBlock:W,deleteBlock:G,moveBlock:Q,focusBlock:te,splitBlock:ce,increaseBlockDepth:ue,decreaseBlockDepth:de,duplicateBlock:pe,updateBlock:he,toggleBlock:we,getBlock:xe,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:_e};function Ce(e,t){try{C.blur(t),C.deselect(t),w.deselect(t)}catch(e){}e.setPath({current:null})}const je={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 De(e,t,n){return e.map((e=>{var n,r;let o="";if(e.text)return o=Object.keys(je).reduce(((t,n)=>e[n]?`<${je[n].tag}>${t}</${je[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,De(e.children,t)),o}return o})).join("")}function Ae(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=De(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 Pe=Symbol.for("immer-nothing"),Re=Symbol.for("immer-draftable"),Be=Symbol.for("immer-state");function Te(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var Me=Object.getPrototypeOf;function Ne(e){return!!e&&!!e[Be]}function Le(e){return!!e&&(Fe(e)||Array.isArray(e)||!!e[Re]||!!e.constructor?.[Re]||Ue(e)||Ke(e))}var Ie=Object.prototype.constructor.toString();function Fe(e){if(!e||"object"!=typeof e)return!1;const t=Me(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)===Ie}function ze(e,t){0===$e(e)?Reflect.ownKeys(e).forEach((n=>{t(n,e[n],e)})):e.forEach(((n,r)=>t(r,n,e)))}function $e(e){const t=e[Be];return t?t.type_:Array.isArray(e)?1:Ue(e)?2:Ke(e)?3:0}function He(e,t){return 2===$e(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function Ve(e,t,n){const r=$e(e);2===r?e.set(t,n):3===r?e.add(n):e[t]=n}function Ue(e){return e instanceof Map}function Ke(e){return e instanceof Set}function We(e){return e.copy_||e.base_}function qe(e,t){if(Ue(e))return new Map(e);if(Ke(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);if(!t&&Fe(e)){if(!Me(e)){const t=Object.create(null);return Object.assign(t,e)}return{...e}}const n=Object.getOwnPropertyDescriptors(e);delete n[Be];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(Me(e),n)}function Ye(e,t=!1){return Ze(e)||Ne(e)||!Le(e)||($e(e)>1&&(e.set=e.add=e.clear=e.delete=Xe),Object.freeze(e),t&&Object.entries(e).forEach((([e,t])=>Ye(t,!0)))),e}function Xe(){Te(2)}function Ze(e){return Object.isFrozen(e)}var Je,Ge={};function Qe(e){const t=Ge[e];return t||Te(0),t}function et(){return Je}function tt(e,t){t&&(Qe("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function nt(e){rt(e),e.drafts_.forEach(it),e.drafts_=null}function rt(e){e===Je&&(Je=e.parent_)}function ot(e){return Je={drafts_:[],parent_:Je,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function it(e){const t=e[Be];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function lt(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return void 0!==e&&e!==n?(n[Be].modified_&&(nt(t),Te(4)),Le(e)&&(e=at(t,e),t.parent_||ct(t,e)),t.patches_&&Qe("Patches").generateReplacementPatches_(n[Be].base_,e,t.patches_,t.inversePatches_)):e=at(t,n,[]),nt(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==Pe?e:void 0}function at(e,t,n){if(Ze(t))return t;const r=t[Be];if(!r)return ze(t,((o,i)=>st(e,r,t,o,i,n))),t;if(r.scope_!==e)return t;if(!r.modified_)return ct(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),ze(o,((o,l)=>st(e,r,t,o,l,n,i))),ct(e,t,!1),n&&e.patches_&&Qe("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function st(e,t,n,r,o,i,l){if(Ne(o)){const l=at(e,o,i&&t&&3!==t.type_&&!He(t.assigned_,r)?i.concat(r):void 0);if(Ve(n,r,l),!Ne(l))return;e.canAutoFreeze_=!1}else l&&n.add(o);if(Le(o)&&!Ze(o)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;at(e,o),t&&t.scope_.parent_||"symbol"==typeof r||!Object.prototype.propertyIsEnumerable.call(n,r)||ct(e,o)}}function ct(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Ye(t,n)}var ut={get(e,t){if(t===Be)return e;const n=We(e);if(!He(n,t))return function(e,t,n){const r=pt(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_||!Le(r)?r:r===ft(e.base_,t)?(gt(e),e.copy_[t]=vt(r,e)):r},has:(e,t)=>t in We(e),ownKeys:e=>Reflect.ownKeys(We(e)),set(e,t,n){const r=pt(We(e),t);if(r?.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const r=ft(We(e),t),l=r?.[Be];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||He(e.base_,t)))return!0;gt(e),ht(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!==ft(e.base_,t)||t in e.base_?(e.assigned_[t]=!1,gt(e),ht(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0),getOwnPropertyDescriptor(e,t){const n=We(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r?{writable:!0,configurable:1!==e.type_||"length"!==t,enumerable:r.enumerable,value:n[t]}:r},defineProperty(){Te(11)},getPrototypeOf:e=>Me(e.base_),setPrototypeOf(){Te(12)}},dt={};function ft(e,t){const n=e[Be];return(n?We(n):e)[t]}function pt(e,t){if(!(t in e))return;let n=Me(e);for(;n;){const e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=Me(n)}}function ht(e){e.modified_||(e.modified_=!0,e.parent_&&ht(e.parent_))}function gt(e){e.copy_||(e.copy_=qe(e.base_,e.scope_.immer_.useStrictShallowCopy_))}ze(ut,((e,t)=>{dt[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),dt.deleteProperty=function(e,t){return dt.set.call(this,e,t,void 0)},dt.set=function(e,t,n){return ut.set.call(this,e[0],t,n,e[0])};function vt(e,t){const n=Ue(e)?Qe("MapSet").proxyMap_(e,t):Ke(e)?Qe("MapSet").proxySet_(e,t):function(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:et(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let o=r,i=ut;n&&(o=[r],i=dt);const{revoke:l,proxy:a}=Proxy.revocable(o,i);return r.draft_=a,r.revoke_=l,a}(e,t);return(t?t.scope_:et()).drafts_.push(n),n}function mt(e){if(!Le(e)||Ze(e))return e;const t=e[Be];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=qe(e,t.scope_.immer_.useStrictShallowCopy_)}else n=qe(e,!0);return ze(n,((e,t)=>{Ve(n,e,mt(t))})),t&&(t.finalized_=!1),n}var yt=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&&Te(6),void 0!==n&&"function"!=typeof n&&Te(7),Le(e)){const o=ot(this),i=vt(e,void 0);let l=!0;try{r=t(i),l=!1}finally{l?nt(o):rt(o)}return tt(o,n),lt(r,o)}if(!e||"object"!=typeof e){if(r=t(e),void 0===r&&(r=e),r===Pe&&(r=void 0),this.autoFreeze_&&Ye(r,!0),n){const t=[],o=[];Qe("Patches").generateReplacementPatches_(e,r,t,o),n(t,o)}return r}Te(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){Le(e)||Te(8),Ne(e)&&(e=function(e){Ne(e)||Te(10);return mt(e)}(e));const t=ot(this),n=vt(e,void 0);return n[Be].isManual_=!0,rt(t),n}finishDraft(e,t){const n=e&&e[Be];n&&n.isManual_||Te(9);const{scope_:r}=n;return tt(r,t),lt(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=Qe("Patches").applyPatches_;return Ne(e)?r(e,t):this.produce(e,(e=>r(e,t)))}},bt=yt.produce;yt.produceWithPatches.bind(yt),yt.setAutoFreeze.bind(yt),yt.setUseStrictShallowCopy.bind(yt),yt.applyPatches.bind(yt);var wt=yt.createDraft.bind(yt),xt=yt.finishDraft.bind(yt);function kt(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;m.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]=ve(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&&Ne(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&&(Ne(e)?e.meta.order--:bt(e,(e=>{e.meta.order--})))})),n.sort(((e,t)=>e.meta.order-t.meta.order)),n.forEach(((e,t)=>{Ne(e.meta)?e.meta.order=t:bt(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)&&(Ne(e.children[n])?e.children[n].value=r:bt(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;Ne(o)?Object.keys(r).forEach((e=>{o.meta[e]=r[e]})):bt(o,(e=>{e.meta=Object.assign(Object.assign({},e.meta),r)}));break}case"split_block":{const{properties:n}=t,r=ve(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&&(Ne(e)?e.meta.order++:bt(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&&(Ne(e)?e.meta.order--:bt(e,(e=>{e.meta.order--})))}));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=ve(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)=>{Ne(e.meta)?e.meta.order=t:bt(e,(e=>{e.meta=Object.assign(Object.assign({},e.meta),{order:t})}))}));break}}}const Ot=100;const Et=new WeakMap,_t=new WeakMap,St={isMergingHistory:e=>_t.get(e),isSavingHistory:e=>Et.get(e),withMergingHistory(e,t){const n=St.isMergingHistory(e);_t.set(e,!0),t(),_t.set(e,n)},withSavingHistory(e,t){const n=St.isSavingHistory(e);Et.set(e,!0),t(),Et.set(e,n)},withoutMergingHistory(e,t){const n=St.isMergingHistory(e);_t.set(e,!1),t(),_t.set(e,n)},withoutSavingHistory(e,t){const n=St.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];St.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=Se.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];St.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"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(S.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=Se.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!(m.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=Se.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)=>we(e,...t),increaseBlockDepth:(...t)=>ue(e,...t),decreaseBlockDepth:(...t)=>de(e,...t),moveBlock:(...t)=>Q(e,...t),focusBlock:(...t)=>te(e,...t),getBlock:(...t)=>xe(e,...t),updateBlock:(...t)=>he(e,...t),splitBlock:(...t)=>ce(e,...t),mergeBlock:(...t)=>_e(e,...t),setPath:(...t)=>Y(e,...t),blocks:{},formats:{},shortcuts:{},plugins:{},commands:{},applyTransforms:(t,...n)=>function(e,t,n){e.children=wt(e.children),e.path=wt(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||kt(e,t);if(Ne(e.children)||(e.children=wt(e.children)),e.children=xt(e.children),Ne(e.path)&&(e.path=xt(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((()=>Ce(e,r)),i):(ee.set(e,!1),Ce(e,r),e.emit("blur",!1))}(e,...t),getHTML:t=>Ae(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 t=o.parsers.markdown.serialize(e,e.children.map((e=>e.text)).join(""));if(t)return t}}return""})).join("\n")}(e,Object.values(t))}(e,t),getPlainText:t=>function(e,t){const n=Ae(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=>St.redo(e,t),undo:t=>St.undo(e,t),isSavingHistory:()=>St.isSavingHistory(e),isMergingHistory:()=>St.isMergingHistory(e),withoutSavingHistory:t=>St.withoutSavingHistory(e,t),withSavingHistory:t=>St.withSavingHistory(e,t),withoutMergingHistory:t=>St.withoutMergingHistory(e,t),withMergingHistory:t=>St.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=Se.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 mn(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 yn=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[yn.Translate.toString(e),yn.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 xn={display:"none"};function kn(e){let{id:t,value:n}=e;return o.createElement("div",{id:t,style:xn},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 _n={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 "},Sn={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=Sn,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=_n}=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(kn,{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 mr(e){return Boolean(e&&"distance"in e)}function yr(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=mn(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(yr(t))return void(this.timeoutId=setTimeout(this.handleStart,t.delay));if(mr(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=mn(e))?t:Pn,s=gn(r,a);if(!n&&l){if(mr(l)){if(null!=l.tolerance&&cr(s,l.tolerance))return this.handleCancel();if(cr(s,l.distance))return this.handleStart()}return yr(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 xr extends br{constructor(e){const{event:t}=e,n=rn(t.target);super(e,wr,n)}}xr.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 kr={move:{name:"mousemove"},end:{name:"mouseup"}};var Or;!function(e){e[e.RightClick=2]="RightClick"}(Or||(Or={}));(class extends br{constructor(e){super(e,kr,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 _r,Sr;function Cr(e){let{acceleration:t,activator:n=_r.Pointer,canScroll:r,draggingRect:o,enabled:i,interval:l=5,order:c=Sr.TreeOrder,pointerCoordinates:f,scrollableAncestors:p,scrollableAncestorRects:h,delta:g,threshold:v}=e;const m=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}),[y,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}),x=a({x:0,y:0}),k=s((()=>{switch(n){case _r.Pointer:return f?{top:f.y,bottom:f.y,left:f.x,right:f.x}:null;case _r.DraggableRect:return o}}),[n,o,f]),O=a(null),E=d((()=>{const e=O.current;if(!e)return;const t=w.current.x*x.current.x,n=w.current.y*x.current.y;e.scrollBy(t,n)}),[]),_=s((()=>c===Sr.TreeOrder?[...p].reverse():p),[c,p]);u((()=>{if(i&&p.length&&k){for(const e of _){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,k,t,v);for(const e of["x","y"])m[e][i[e]]||(a[e]=0,i[e]=0);if(a.x>0||a.y>0)return b(),O.current=e,y(E,l),w.current=a,void(x.current=i)}w.current={x:0,y:0},x.current={x:0,y:0},b()}else b()}),[t,E,r,b,i,l,JSON.stringify(k),JSON.stringify(m),y,p,_,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"}(_r||(_r={})),function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"}(Sr||(Sr={}));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:xr,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:m=zn,measuring:y,modifiers:b,...w}=e;const x=h(Xr,void 0,Yr),[k,O]=x,[E,_]=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]}(),[S,C]=f(Gr.Uninitialized),j=S===Gr.Initialized,{draggable:{active:D,nodes:A,translate:P},droppable:{containers:R}}=k,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=y)?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),m=d((function(e){void 0===e&&(e=[]),v.current||l((t=>null===t?e:t.concat(e.filter((e=>!t.includes(e))))))}),[v]),y=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||m()}),[n,g]),u((()=>{i&&i.length>0&&l(null)}),[JSON.stringify(i)]),u((()=>{g||"number"!=typeof s||null!==y.current||(y.current=setTimeout((()=>{m(),y.current=null}),s))}),[s,g,m,...r]),{droppableRects:b,measureDroppableContainers:m,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?mn(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),me=Lr(ge,[ee]),ye=hn(pe,ve),be=le?Vn(le,pe):null,we=N&&be?m({active:N,collisionRect:be,droppableRects:q,droppableContainers:U,pointerCoordinates:he}):null,xe=Nn(we,"id"),[ke,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,me),null!=(i=null==ke?void 0:ke.rect)?i:null,ee),_e=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]),Se=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,_e(n,t))}),[A,_e]),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,Se);!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&&S===Gr.Initializing&&C(Gr.Initialized)}),[ee,S]),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:ye.x,y:ye.y},over:o};T((()=>{null==e||e(i),E({type:"onDragMove",event:i})}))}),[ye.x,ye.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(xe),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})}))}),[xe]),on((()=>{ne.current={activatorEvent:z,active:N,activeNode:Z,collisionRect:be,collisions:we,droppableRects:q,draggableNodes:A,draggingNode:ie,draggingNodeRect:le,droppableContainers:R,over:ke,scrollableAncestors:de,scrollAdjustedTranslate:ye},M.current={initial:le,translated:be}}),[N,Z,we,be,A,ie,le,q,R,ke,de,ye]),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:ke,measureDroppableContainers:Y,scrollableAncestors:de,scrollableAncestorRects:fe,measuringConfiguration:K,measuringScheduled:X,windowRect:ue})),[N,Z,ee,z,we,te,oe,A,R,q,ke,Y,de,fe,K,X,ue]),De=s((()=>({activatorEvent:z,activators:Ce,active:N,activeNodeRect:ee,ariaDescribedById:{draggable:V},dispatch:O,draggableNodes:A,over:ke,measureDroppableContainers:Y})),[z,Ce,N,ee,O,V,A,ke,Y]);return o.createElement(En.Provider,{value:_},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:m=0}=null!=o?o:{},y=(null==u?void 0:u.id)===t,b=l(y?Jr:eo),[w,x]=cn(),[k,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),_=an(n);on((()=>(p.set(t,{id:t,key:i,node:w,activatorNode:k,data:_}),()=>{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:m,"aria-disabled":r,"aria-pressed":!(!y||g!==to)||void 0,"aria-roledescription":v,"aria-describedby":f.draggable})),[r,g,m,y,v,f.draggable]),isDragging:y,listeners:r?void 0:E,node:w,over:h,setNodeRef:x,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),m=Boolean(null!==f.rect),y=s((()=>r.map((e=>"object"==typeof e&&"id"in e?e.id:e))),[r]),b=null!=d,w=d?y.indexOf(d.id):-1,x=h?y.indexOf(h.id):-1,k=a(y),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}(y,k.current),E=-1!==x&&-1===w||O,_=function(e){return"boolean"==typeof e?{draggable:e,droppable:e}:e}(c);on((()=>{O&&b&&g(y)}),[O,y,b,g]),u((()=>{k.current=y}),[y]);const S=s((()=>({activeIndex:w,containerId:v,disabled:_,disableTransforms:E,items:y,overIndex:x,useDragOverlay:m,sortedRects:ao(y,p),strategy:i})),[w,v,_.draggable,_.droppable,E,y,x,p,m,i]);return o.createElement(ho.Provider,{value:S},t)}const vo=e=>{let{id:t,items:n,activeIndex:r,overIndex:o}=e;return lo(n,r,o).indexOf(t)},mo=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))},yo={duration:200,easing:"ease"},bo="transform",wo=yn.Transition.toString({property:bo,duration:0,easing:"linear"}),xo={roleDescription:"sortable"};function ko(e){let{animateLayoutChanges:t=mo,attributes:n,disabled:r,data:o,getNewIndex:i=vo,id:c,strategy:p,resizeObserverConfig:h,transition:g=yo}=e;const{items:v,containerId:m,activeIndex:y,disabled:b,disableTransforms:w,sortedRects:x,overIndex:k,useDragOverlay:O,strategy:E}=l(ho),_=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),S=v.indexOf(c),C=s((()=>({sortable:{containerId:m,index:S,items:v},...o})),[m,o,S,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),m=a(null),{disabled:y,updateMeasurementsFor:b,timeout:w}={...io,...o},x=an(null!=b?b:r),k=Br({callback:d((()=>{g.current?(null!=m.current&&clearTimeout(m.current),m.current=setTimeout((()=>{p(Array.isArray(x.current)?x.current:[x.current]),m.current=null}),w)):g.current=!0}),[w]),disabled:y||!s}),O=d(((e,t)=>{k&&(t&&(k.unobserve(t),g.current=!1),e&&k.observe(e))}),[k]),[E,_]=cn(O),S=an(t);return u((()=>{k&&E.current&&(k.disconnect(),g.current=!1,k.observe(E.current))}),[E,k]),on((()=>(c({type:jn.RegisterDroppable,element:{id:r,key:i,disabled:n,node:E,rect:v,data:S}}),()=>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:_}}({id:c,data:C,disabled:_.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:{...xo,...n},disabled:_.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(y)&&so(k),W=!O&&F,q=W&&K?H:null,Y=K?null!=q?q:(null!=p?p:E)({rects:x,activeNodeRect:M,activeIndex:y,overIndex:k,index:S}):null,X=so(y)&&so(k)?i({id:c,items:v,activeIndex:y,overIndex:k}):S,Z=null==B?void 0:B.id,J=a({activeId:Z,items:v,newIndex:X,containerId:m}),G=v!==J.current.items,Q=t({active:B,containerId:m,isDragging:F,isSorting:U,id:c,index:S,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:S,node:A,rect:D});return u((()=>{U&&J.current.newIndex!==X&&(J.current.newIndex=X),m!==J.current.containerId&&(J.current.containerId=m),v!==J.current.items&&(J.current.items=v)}),[U,X,m,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:y,attributes:N,data:C,rect:D,index:S,newIndex:X,items:v,isOver:P,isSorting:U,isDragging:F,listeners:I,node:A,overIndex:k,over:z,setNodeRef:V,setActivatorNodeRef:$,setDroppableNodeRef:R,setDraggableNodeRef:L,transform:null!=ee?ee:Y,transition:function(){if(ee||G&&J.current.newIndex===S)return wo;if(W&&!vn(T)||!g)return;if(U||Q)return yn.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],_o=(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=So(e,t),i=function(e,t){if(!Oo(e)||!Oo(t))return!1;if(!So(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 So(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})),m="floating"===d?{...l.floating,x:r,y:o}:l.reference,y=await(null==i.getOffsetParent?void 0:i.getOffsetParent(a.floating)),b=await(null==i.isElement?void 0:i.isElement(y))&&await(null==i.getScale?void 0:i.getScale(y))||{x:1,y:1},w=di(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:m,offsetParent:y,strategy:s}):m);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 mi(e){return To(e)?e:e.contextElement}function yi(e){const t=mi(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 xi(e,t,n,r){void 0===t&&(t=!1),void 0===n&&(n=!1);const o=e.getBoundingClientRect(),i=mi(e);let l=Jo(1);t&&(r?To(r)&&(l=yi(r)):l=yi(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=yi(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 ki=[":popover-open",":modal"];function Oi(e){return ki.some((t=>{try{return e.matches(t)}catch(e){return!1}}))}function Ei(e){return xi(Ro(e)).left+Vo(e).scrollLeft}function _i(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=xi(e,!0,"fixed"===t),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=Mo(e)?yi(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 Si(e,t){const n=Uo(e);return!(n===t||!To(n)||$o(n))&&("fixed"===Ho(n).position||Si(n,t))}function Ci(e,t,n){const r=Mo(t),o=Ro(t),i="fixed"===n,l=xi(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=xi(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=xi(r);c=yi(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&&Si(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=_i(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}),_i(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:yi,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=mi(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?xi(e):null;return s&&function t(){const r=xi(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 m=ni(o),y=ni(a)===a,b=await(null==s.isRTL?void 0:s.isRTL(c.floating)),w=f||(y||!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 x=[a,...w],k=await pi(t,v),O=[];let E=(null==(r=i.flip)?void 0:r.overflows)||[];if(u&&O.push(k[m]),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(k[e[0]],k[e[1]])}if(E=[...E,{placement:o,overflows:O}],!O.every((e=>e<=0))){var _,S;const e=((null==(_=i.flip)?void 0:_.index)||0)+1,t=x[e];if(t)return{data:{index:e,overflows:E},reset:{placement:t}};let n=null==(S=E.filter((e=>e.overflows[0]<=0)).sort(((e,t)=>e.overflows[1]-t.overflows[1]))[0])?void 0:S.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:m,data:y,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!=m?m:d,p={...p,[i]:{...p[i],...y}},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 m,Element as y,Text as b,Transforms as w,Point as x,Path as k,Node as O,Range as E,createEditor as _,Operation as S}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]=m.last(e,[]);if(y.isElement(n)&&!m.isEditor(n)){const[n,o]=m.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(x.isPoint(t))return t;if(k.isPath(t))return{path:t,offset:0};const[,n]=m.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]",m="[object WeakMap]",y="[object ArrayBuffer]",b="[object DataView]",w="[object Float32Array]",x="[object Float64Array]",k="[object Int8Array]",O="[object Int16Array]",E="[object Int32Array]",_="[object Uint8Array]",S="[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[y]=R[b]=R[i]=R[l]=R[w]=R[x]=R[k]=R[O]=R[E]=R[c]=R[u]=R[d]=R[p]=R[h]=R[g]=R[v]=R[_]=R[S]=R[C]=R[j]=!0,R["[object Error]"]=R[a]=R[m]=!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"),me=Ie(M,"WeakMap"),ye=Ie(Object,"create"),be=Ve(pe),we=Ve(he),xe=Ve(ge),ke=Ve(ve),Oe=Ve(me),Ee=re?re.prototype:void 0,_e=Ee?Ee.valueOf:void 0;function Se(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,m,A){var P;if(r&&(P=m?r(e,f,m,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&&!m){if(H(e))return m?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 m?e:{};P=function(e,t,n,r){var o=e.constructor;switch(t){case y: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 x:case k:case O:case E:case _:case S: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,_e?Object(_e.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}Se.prototype.clear=function(){this.__data__=ye?ye(null):{}},Se.prototype.delete=function(e){return this.has(e)&&delete this.__data__[e]},Se.prototype.get=function(e){var t=this.__data__;if(ye){var r=t[e];return r===n?void 0:r}return Q.call(t,e)?t[e]:void 0},Se.prototype.has=function(e){var t=this.__data__;return ye?void 0!==t[e]:Q.call(t,e)},Se.prototype.set=function(e,t){return this.__data__[e]=ye&&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 Se,map:new(he||Ce),string:new Se}},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||me&&ze(new me)!=m)&&(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 xe:return f;case ke:return h;case Oe:return m}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&&m.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=(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=m.above(t,{match:e=>y.isElement(e)&&m.isBlock(t,e),mode:"lowest"});if(!a)return;const[,s]=a,c=m.parent(t,s),[u]=c;if(y.isElement(u)&&!b.isText(u.children[0]))return n(r);const d=a?s:[],f={anchor:l,focus:m.start(t,d)},p=m.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 ve(e){return ge(e,j(_()))}const me="Paragraph";function ye(e,t,n,r){const o=r.plugins[n.type];return(null==o?void 0:o.customEditor)?n.value[0].children:m.isEditor(t)?t.children.flatMap((t=>ye(e,t,n,r))):y.isElement(t)?m.isInline(e,t)?[t]:t.children.flatMap((t=>ye(e,t,n,r))):[t]}function be(e){return y.isElement(e)?0===e.children.length||b.isText(e.children[0])?e:be(e.children[0]):null}function we(e,t,n={}){const r=ne(e,{at:n.at||e.path.current});if(!r)throw new Error("Block not found at current selection");let o=r.type===t?me: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=ye(a,a.children[0],r,e),u=be(s);u&&(u.children=c);const d={id:I(),type:o,meta:Object.assign(Object.assign({},r.meta),{align:void 0}),value:[s]},f=ve(e);f.children=[s];const p=[{type:"delete_block",block:r,path:{current:r.meta.order}},{type:"insert_block",path:{current:r.meta.order},block:d}];return e.applyTransforms(p),n.deleteText&&w.delete(f,{at:[0,0]}),n.focus&&e.focusBlock(d.id),d.id}function xe(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 ke(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=>y.isElement(e);(null==n?void 0:n.type)&&(i=e=>y.isElement(e)&&e.type===(null==n?void 0:n.type));try{const[e]=m.nodes(o,{at:(null==n?void 0:n.path)||o.selection||[0],match:i,mode:"lowest"});return e}catch(e){}}function Oe(e,t,n){const r=ke(e,t,n);if(r)return r[0]}const Ee={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?m.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=ke(e,t,{type:n.type});if(h){const[,e]=h;k.isPath(d)?p=d:"prev"===d?p=k.previous(e):"next"===d&&(p=k.next(e))}if(w.insertNodes(i,s,{at:p,select:f}),f&&u.length>0){const n=u[0],r=ke(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?m.withoutNormalizing(o,(()=>{w.removeNodes(o,{at:n.path,match:e=>y.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?m.withoutNormalizing(i,(()=>{const[e]=m.nodes(i,{at:(null==r?void 0:r.path)||[0],match:e=>y.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=>y.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?m.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:Oe,getElementChildren:function(e,t,n){const r=Oe(e,t,n);if(r)return r.children},getElementEntry:ke,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]=m.nodes(o,{at:n.path||o.selection,match:e=>y.isElement(e)&&e.type===n.type});if(i){const[e,t]=i;return 0===m.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 k.parent(e)}catch(e){}}};function _e(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=Ee.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,m.start(i,[]))}m.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 Se={insertBlock:W,deleteBlock:G,moveBlock:Q,focusBlock:te,splitBlock:ce,increaseBlockDepth:ue,decreaseBlockDepth:de,duplicateBlock:pe,updateBlock:he,toggleBlock:we,getBlock:xe,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:_e};function Ce(e,t){try{C.blur(t),C.deselect(t),w.deselect(t)}catch(e){}e.setPath({current:null})}const je={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 De(e,t,n){return e.map((e=>{var n,r;let o="";if(e.text)return o=Object.keys(je).reduce(((t,n)=>e[n]?`<${je[n].tag}>${t}</${je[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,De(e.children,t)),o}return o})).join("")}function Ae(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=De(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 Pe=Symbol.for("immer-nothing"),Re=Symbol.for("immer-draftable"),Be=Symbol.for("immer-state");function Te(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var Me=Object.getPrototypeOf;function Ne(e){return!!e&&!!e[Be]}function Le(e){return!!e&&(Fe(e)||Array.isArray(e)||!!e[Re]||!!e.constructor?.[Re]||Ue(e)||Ke(e))}var Ie=Object.prototype.constructor.toString();function Fe(e){if(!e||"object"!=typeof e)return!1;const t=Me(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)===Ie}function ze(e,t){0===$e(e)?Reflect.ownKeys(e).forEach((n=>{t(n,e[n],e)})):e.forEach(((n,r)=>t(r,n,e)))}function $e(e){const t=e[Be];return t?t.type_:Array.isArray(e)?1:Ue(e)?2:Ke(e)?3:0}function He(e,t){return 2===$e(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function Ve(e,t,n){const r=$e(e);2===r?e.set(t,n):3===r?e.add(n):e[t]=n}function Ue(e){return e instanceof Map}function Ke(e){return e instanceof Set}function We(e){return e.copy_||e.base_}function qe(e,t){if(Ue(e))return new Map(e);if(Ke(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);if(!t&&Fe(e)){if(!Me(e)){const t=Object.create(null);return Object.assign(t,e)}return{...e}}const n=Object.getOwnPropertyDescriptors(e);delete n[Be];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(Me(e),n)}function Ye(e,t=!1){return Ze(e)||Ne(e)||!Le(e)||($e(e)>1&&(e.set=e.add=e.clear=e.delete=Xe),Object.freeze(e),t&&Object.entries(e).forEach((([e,t])=>Ye(t,!0)))),e}function Xe(){Te(2)}function Ze(e){return Object.isFrozen(e)}var Je,Ge={};function Qe(e){const t=Ge[e];return t||Te(0),t}function et(){return Je}function tt(e,t){t&&(Qe("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function nt(e){rt(e),e.drafts_.forEach(it),e.drafts_=null}function rt(e){e===Je&&(Je=e.parent_)}function ot(e){return Je={drafts_:[],parent_:Je,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function it(e){const t=e[Be];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function lt(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return void 0!==e&&e!==n?(n[Be].modified_&&(nt(t),Te(4)),Le(e)&&(e=at(t,e),t.parent_||ct(t,e)),t.patches_&&Qe("Patches").generateReplacementPatches_(n[Be].base_,e,t.patches_,t.inversePatches_)):e=at(t,n,[]),nt(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==Pe?e:void 0}function at(e,t,n){if(Ze(t))return t;const r=t[Be];if(!r)return ze(t,((o,i)=>st(e,r,t,o,i,n))),t;if(r.scope_!==e)return t;if(!r.modified_)return ct(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),ze(o,((o,l)=>st(e,r,t,o,l,n,i))),ct(e,t,!1),n&&e.patches_&&Qe("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function st(e,t,n,r,o,i,l){if(Ne(o)){const l=at(e,o,i&&t&&3!==t.type_&&!He(t.assigned_,r)?i.concat(r):void 0);if(Ve(n,r,l),!Ne(l))return;e.canAutoFreeze_=!1}else l&&n.add(o);if(Le(o)&&!Ze(o)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;at(e,o),t&&t.scope_.parent_||"symbol"==typeof r||!Object.prototype.propertyIsEnumerable.call(n,r)||ct(e,o)}}function ct(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Ye(t,n)}var ut={get(e,t){if(t===Be)return e;const n=We(e);if(!He(n,t))return function(e,t,n){const r=pt(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_||!Le(r)?r:r===ft(e.base_,t)?(gt(e),e.copy_[t]=vt(r,e)):r},has:(e,t)=>t in We(e),ownKeys:e=>Reflect.ownKeys(We(e)),set(e,t,n){const r=pt(We(e),t);if(r?.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const r=ft(We(e),t),l=r?.[Be];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||He(e.base_,t)))return!0;gt(e),ht(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!==ft(e.base_,t)||t in e.base_?(e.assigned_[t]=!1,gt(e),ht(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0),getOwnPropertyDescriptor(e,t){const n=We(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r?{writable:!0,configurable:1!==e.type_||"length"!==t,enumerable:r.enumerable,value:n[t]}:r},defineProperty(){Te(11)},getPrototypeOf:e=>Me(e.base_),setPrototypeOf(){Te(12)}},dt={};function ft(e,t){const n=e[Be];return(n?We(n):e)[t]}function pt(e,t){if(!(t in e))return;let n=Me(e);for(;n;){const e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=Me(n)}}function ht(e){e.modified_||(e.modified_=!0,e.parent_&&ht(e.parent_))}function gt(e){e.copy_||(e.copy_=qe(e.base_,e.scope_.immer_.useStrictShallowCopy_))}ze(ut,((e,t)=>{dt[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),dt.deleteProperty=function(e,t){return dt.set.call(this,e,t,void 0)},dt.set=function(e,t,n){return ut.set.call(this,e[0],t,n,e[0])};function vt(e,t){const n=Ue(e)?Qe("MapSet").proxyMap_(e,t):Ke(e)?Qe("MapSet").proxySet_(e,t):function(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:et(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let o=r,i=ut;n&&(o=[r],i=dt);const{revoke:l,proxy:a}=Proxy.revocable(o,i);return r.draft_=a,r.revoke_=l,a}(e,t);return(t?t.scope_:et()).drafts_.push(n),n}function mt(e){if(!Le(e)||Ze(e))return e;const t=e[Be];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=qe(e,t.scope_.immer_.useStrictShallowCopy_)}else n=qe(e,!0);return ze(n,((e,t)=>{Ve(n,e,mt(t))})),t&&(t.finalized_=!1),n}var yt=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&&Te(6),void 0!==n&&"function"!=typeof n&&Te(7),Le(e)){const o=ot(this),i=vt(e,void 0);let l=!0;try{r=t(i),l=!1}finally{l?nt(o):rt(o)}return tt(o,n),lt(r,o)}if(!e||"object"!=typeof e){if(r=t(e),void 0===r&&(r=e),r===Pe&&(r=void 0),this.autoFreeze_&&Ye(r,!0),n){const t=[],o=[];Qe("Patches").generateReplacementPatches_(e,r,t,o),n(t,o)}return r}Te(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){Le(e)||Te(8),Ne(e)&&(e=function(e){Ne(e)||Te(10);return mt(e)}(e));const t=ot(this),n=vt(e,void 0);return n[Be].isManual_=!0,rt(t),n}finishDraft(e,t){const n=e&&e[Be];n&&n.isManual_||Te(9);const{scope_:r}=n;return tt(r,t),lt(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=Qe("Patches").applyPatches_;return Ne(e)?r(e,t):this.produce(e,(e=>r(e,t)))}},bt=yt.produce;yt.produceWithPatches.bind(yt),yt.setAutoFreeze.bind(yt),yt.setUseStrictShallowCopy.bind(yt),yt.applyPatches.bind(yt);var wt=yt.createDraft.bind(yt),xt=yt.finishDraft.bind(yt);function kt(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;m.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]=ve(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&&Ne(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&&(Ne(e)?e.meta.order--:bt(e,(e=>{e.meta.order--})))})),n.sort(((e,t)=>e.meta.order-t.meta.order)),n.forEach(((e,t)=>{Ne(e.meta)?e.meta.order=t:bt(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)&&(Ne(e.children[n])?e.children[n].value=r:bt(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;Ne(o)?Object.keys(r).forEach((e=>{o.meta[e]=r[e]})):bt(o,(e=>{e.meta=Object.assign(Object.assign({},e.meta),r)}));break}case"split_block":{const{properties:n}=t,r=ve(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&&(Ne(e)?e.meta.order++:bt(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&&(Ne(e)?e.meta.order--:bt(e,(e=>{e.meta.order--})))}));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=ve(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)=>{Ne(e.meta)?e.meta.order=t:bt(e,(e=>{e.meta=Object.assign(Object.assign({},e.meta),{order:t})}))}));break}}}const Ot=100;const Et=new WeakMap,_t=new WeakMap,St={isMergingHistory:e=>_t.get(e),isSavingHistory:e=>Et.get(e),withMergingHistory(e,t){const n=St.isMergingHistory(e);_t.set(e,!0),t(),_t.set(e,n)},withSavingHistory(e,t){const n=St.isSavingHistory(e);Et.set(e,!0),t(),Et.set(e,n)},withoutMergingHistory(e,t){const n=St.isMergingHistory(e);_t.set(e,!1),t(),_t.set(e,n)},withoutSavingHistory(e,t){const n=St.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];St.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=Se.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];St.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"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(S.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=Se.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!(m.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=Se.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)=>we(e,...t),increaseBlockDepth:(...t)=>ue(e,...t),decreaseBlockDepth:(...t)=>de(e,...t),moveBlock:(...t)=>Q(e,...t),focusBlock:(...t)=>te(e,...t),getBlock:(...t)=>xe(e,...t),updateBlock:(...t)=>he(e,...t),splitBlock:(...t)=>ce(e,...t),mergeBlock:(...t)=>_e(e,...t),setPath:(...t)=>Y(e,...t),blocks:{},formats:{},shortcuts:{},plugins:{},commands:{},applyTransforms:(t,...n)=>function(e,t,n){e.children=wt(e.children),e.path=wt(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||kt(e,t);if(Ne(e.children)||(e.children=wt(e.children)),e.children=xt(e.children),Ne(e.path)&&(e.path=xt(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((()=>Ce(e,r)),i):(ee.set(e,!1),Ce(e,r),e.emit("blur",!1))}(e,...t),getHTML:t=>Ae(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=Ae(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=>St.redo(e,t),undo:t=>St.undo(e,t),isSavingHistory:()=>St.isSavingHistory(e),isMergingHistory:()=>St.isMergingHistory(e),withoutSavingHistory:t=>St.withoutSavingHistory(e,t),withSavingHistory:t=>St.withSavingHistory(e,t),withoutMergingHistory:t=>St.withoutMergingHistory(e,t),withMergingHistory:t=>St.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=Se.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 mn(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 yn=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[yn.Translate.toString(e),yn.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 xn={display:"none"};function kn(e){let{id:t,value:n}=e;return o.createElement("div",{id:t,style:xn},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 _n={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 "},Sn={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=Sn,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=_n}=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(kn,{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 mr(e){return Boolean(e&&"distance"in e)}function yr(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=mn(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(yr(t))return void(this.timeoutId=setTimeout(this.handleStart,t.delay));if(mr(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=mn(e))?t:Pn,s=gn(r,a);if(!n&&l){if(mr(l)){if(null!=l.tolerance&&cr(s,l.tolerance))return this.handleCancel();if(cr(s,l.distance))return this.handleStart()}return yr(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 xr extends br{constructor(e){const{event:t}=e,n=rn(t.target);super(e,wr,n)}}xr.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 kr={move:{name:"mousemove"},end:{name:"mouseup"}};var Or;!function(e){e[e.RightClick=2]="RightClick"}(Or||(Or={}));(class extends br{constructor(e){super(e,kr,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 _r,Sr;function Cr(e){let{acceleration:t,activator:n=_r.Pointer,canScroll:r,draggingRect:o,enabled:i,interval:l=5,order:c=Sr.TreeOrder,pointerCoordinates:f,scrollableAncestors:p,scrollableAncestorRects:h,delta:g,threshold:v}=e;const m=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}),[y,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}),x=a({x:0,y:0}),k=s((()=>{switch(n){case _r.Pointer:return f?{top:f.y,bottom:f.y,left:f.x,right:f.x}:null;case _r.DraggableRect:return o}}),[n,o,f]),O=a(null),E=d((()=>{const e=O.current;if(!e)return;const t=w.current.x*x.current.x,n=w.current.y*x.current.y;e.scrollBy(t,n)}),[]),_=s((()=>c===Sr.TreeOrder?[...p].reverse():p),[c,p]);u((()=>{if(i&&p.length&&k){for(const e of _){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,k,t,v);for(const e of["x","y"])m[e][i[e]]||(a[e]=0,i[e]=0);if(a.x>0||a.y>0)return b(),O.current=e,y(E,l),w.current=a,void(x.current=i)}w.current={x:0,y:0},x.current={x:0,y:0},b()}else b()}),[t,E,r,b,i,l,JSON.stringify(k),JSON.stringify(m),y,p,_,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"}(_r||(_r={})),function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"}(Sr||(Sr={}));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:xr,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:m=zn,measuring:y,modifiers:b,...w}=e;const x=h(Xr,void 0,Yr),[k,O]=x,[E,_]=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]}(),[S,C]=f(Gr.Uninitialized),j=S===Gr.Initialized,{draggable:{active:D,nodes:A,translate:P},droppable:{containers:R}}=k,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=y)?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),m=d((function(e){void 0===e&&(e=[]),v.current||l((t=>null===t?e:t.concat(e.filter((e=>!t.includes(e))))))}),[v]),y=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||m()}),[n,g]),u((()=>{i&&i.length>0&&l(null)}),[JSON.stringify(i)]),u((()=>{g||"number"!=typeof s||null!==y.current||(y.current=setTimeout((()=>{m(),y.current=null}),s))}),[s,g,m,...r]),{droppableRects:b,measureDroppableContainers:m,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?mn(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),me=Lr(ge,[ee]),ye=hn(pe,ve),be=le?Vn(le,pe):null,we=N&&be?m({active:N,collisionRect:be,droppableRects:q,droppableContainers:U,pointerCoordinates:he}):null,xe=Nn(we,"id"),[ke,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,me),null!=(i=null==ke?void 0:ke.rect)?i:null,ee),_e=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]),Se=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,_e(n,t))}),[A,_e]),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,Se);!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&&S===Gr.Initializing&&C(Gr.Initialized)}),[ee,S]),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:ye.x,y:ye.y},over:o};T((()=>{null==e||e(i),E({type:"onDragMove",event:i})}))}),[ye.x,ye.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(xe),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})}))}),[xe]),on((()=>{ne.current={activatorEvent:z,active:N,activeNode:Z,collisionRect:be,collisions:we,droppableRects:q,draggableNodes:A,draggingNode:ie,draggingNodeRect:le,droppableContainers:R,over:ke,scrollableAncestors:de,scrollAdjustedTranslate:ye},M.current={initial:le,translated:be}}),[N,Z,we,be,A,ie,le,q,R,ke,de,ye]),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:ke,measureDroppableContainers:Y,scrollableAncestors:de,scrollableAncestorRects:fe,measuringConfiguration:K,measuringScheduled:X,windowRect:ue})),[N,Z,ee,z,we,te,oe,A,R,q,ke,Y,de,fe,K,X,ue]),De=s((()=>({activatorEvent:z,activators:Ce,active:N,activeNodeRect:ee,ariaDescribedById:{draggable:V},dispatch:O,draggableNodes:A,over:ke,measureDroppableContainers:Y})),[z,Ce,N,ee,O,V,A,ke,Y]);return o.createElement(En.Provider,{value:_},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:m=0}=null!=o?o:{},y=(null==u?void 0:u.id)===t,b=l(y?Jr:eo),[w,x]=cn(),[k,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),_=an(n);on((()=>(p.set(t,{id:t,key:i,node:w,activatorNode:k,data:_}),()=>{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:m,"aria-disabled":r,"aria-pressed":!(!y||g!==to)||void 0,"aria-roledescription":v,"aria-describedby":f.draggable})),[r,g,m,y,v,f.draggable]),isDragging:y,listeners:r?void 0:E,node:w,over:h,setNodeRef:x,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),m=Boolean(null!==f.rect),y=s((()=>r.map((e=>"object"==typeof e&&"id"in e?e.id:e))),[r]),b=null!=d,w=d?y.indexOf(d.id):-1,x=h?y.indexOf(h.id):-1,k=a(y),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}(y,k.current),E=-1!==x&&-1===w||O,_=function(e){return"boolean"==typeof e?{draggable:e,droppable:e}:e}(c);on((()=>{O&&b&&g(y)}),[O,y,b,g]),u((()=>{k.current=y}),[y]);const S=s((()=>({activeIndex:w,containerId:v,disabled:_,disableTransforms:E,items:y,overIndex:x,useDragOverlay:m,sortedRects:ao(y,p),strategy:i})),[w,v,_.draggable,_.droppable,E,y,x,p,m,i]);return o.createElement(ho.Provider,{value:S},t)}const vo=e=>{let{id:t,items:n,activeIndex:r,overIndex:o}=e;return lo(n,r,o).indexOf(t)},mo=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))},yo={duration:200,easing:"ease"},bo="transform",wo=yn.Transition.toString({property:bo,duration:0,easing:"linear"}),xo={roleDescription:"sortable"};function ko(e){let{animateLayoutChanges:t=mo,attributes:n,disabled:r,data:o,getNewIndex:i=vo,id:c,strategy:p,resizeObserverConfig:h,transition:g=yo}=e;const{items:v,containerId:m,activeIndex:y,disabled:b,disableTransforms:w,sortedRects:x,overIndex:k,useDragOverlay:O,strategy:E}=l(ho),_=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),S=v.indexOf(c),C=s((()=>({sortable:{containerId:m,index:S,items:v},...o})),[m,o,S,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),m=a(null),{disabled:y,updateMeasurementsFor:b,timeout:w}={...io,...o},x=an(null!=b?b:r),k=Br({callback:d((()=>{g.current?(null!=m.current&&clearTimeout(m.current),m.current=setTimeout((()=>{p(Array.isArray(x.current)?x.current:[x.current]),m.current=null}),w)):g.current=!0}),[w]),disabled:y||!s}),O=d(((e,t)=>{k&&(t&&(k.unobserve(t),g.current=!1),e&&k.observe(e))}),[k]),[E,_]=cn(O),S=an(t);return u((()=>{k&&E.current&&(k.disconnect(),g.current=!1,k.observe(E.current))}),[E,k]),on((()=>(c({type:jn.RegisterDroppable,element:{id:r,key:i,disabled:n,node:E,rect:v,data:S}}),()=>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:_}}({id:c,data:C,disabled:_.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:{...xo,...n},disabled:_.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(y)&&so(k),W=!O&&F,q=W&&K?H:null,Y=K?null!=q?q:(null!=p?p:E)({rects:x,activeNodeRect:M,activeIndex:y,overIndex:k,index:S}):null,X=so(y)&&so(k)?i({id:c,items:v,activeIndex:y,overIndex:k}):S,Z=null==B?void 0:B.id,J=a({activeId:Z,items:v,newIndex:X,containerId:m}),G=v!==J.current.items,Q=t({active:B,containerId:m,isDragging:F,isSorting:U,id:c,index:S,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:S,node:A,rect:D});return u((()=>{U&&J.current.newIndex!==X&&(J.current.newIndex=X),m!==J.current.containerId&&(J.current.containerId=m),v!==J.current.items&&(J.current.items=v)}),[U,X,m,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:y,attributes:N,data:C,rect:D,index:S,newIndex:X,items:v,isOver:P,isSorting:U,isDragging:F,listeners:I,node:A,overIndex:k,over:z,setNodeRef:V,setActivatorNodeRef:$,setDroppableNodeRef:R,setDraggableNodeRef:L,transform:null!=ee?ee:Y,transition:function(){if(ee||G&&J.current.newIndex===S)return wo;if(W&&!vn(T)||!g)return;if(U||Q)return yn.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],_o=(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=So(e,t),i=function(e,t){if(!Oo(e)||!Oo(t))return!1;if(!So(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 So(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})),m="floating"===d?{...l.floating,x:r,y:o}:l.reference,y=await(null==i.getOffsetParent?void 0:i.getOffsetParent(a.floating)),b=await(null==i.isElement?void 0:i.isElement(y))&&await(null==i.getScale?void 0:i.getScale(y))||{x:1,y:1},w=di(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:m,offsetParent:y,strategy:s}):m);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 mi(e){return To(e)?e:e.contextElement}function yi(e){const t=mi(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 xi(e,t,n,r){void 0===t&&(t=!1),void 0===n&&(n=!1);const o=e.getBoundingClientRect(),i=mi(e);let l=Jo(1);t&&(r?To(r)&&(l=yi(r)):l=yi(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=yi(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 ki=[":popover-open",":modal"];function Oi(e){return ki.some((t=>{try{return e.matches(t)}catch(e){return!1}}))}function Ei(e){return xi(Ro(e)).left+Vo(e).scrollLeft}function _i(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=xi(e,!0,"fixed"===t),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=Mo(e)?yi(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 Si(e,t){const n=Uo(e);return!(n===t||!To(n)||$o(n))&&("fixed"===Ho(n).position||Si(n,t))}function Ci(e,t,n){const r=Mo(t),o=Ro(t),i="fixed"===n,l=xi(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=xi(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=xi(r);c=yi(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&&Si(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=_i(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}),_i(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:yi,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=mi(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?xi(e):null;return s&&function t(){const r=xi(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 m=ni(o),y=ni(a)===a,b=await(null==s.isRTL?void 0:s.isRTL(c.floating)),w=f||(y||!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 x=[a,...w],k=await pi(t,v),O=[];let E=(null==(r=i.flip)?void 0:r.overflows)||[];if(u&&O.push(k[m]),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(k[e[0]],k[e[1]])}if(E=[...E,{placement:o,overflows:O}],!O.every((e=>e<=0))){var _,S;const e=((null==(_=i.flip)?void 0:_.index)||0)+1,t=x[e];if(t)return{data:{index:e,overflows:E},reset:{placement:t}};let n=null==(S=E.filter((e=>e.overflows[0]<=0)).sort(((e,t)=>e.overflows[1]-t.overflows[1]))[0])?void 0:S.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:m,data:y,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!=m?m:d,p={...p,[i]:{...p[i],...y}},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}
|
|
2
2
|
/*!
|
|
3
3
|
* tabbable 6.2.0
|
|
4
4
|
* @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getMarkdown.d.ts","sourceRoot":"","sources":["../../src/parsers/getMarkdown.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,SAAS,EAAuB,eAAe,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAEpH,wBAAgB,SAAS,CAAC,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,eAAe,EAAE,
|
|
1
|
+
{"version":3,"file":"getMarkdown.d.ts","sourceRoot":"","sources":["../../src/parsers/getMarkdown.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,SAAS,EAAuB,eAAe,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAEpH,wBAAgB,SAAS,CAAC,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,eAAe,EAAE,UAwBzE;AAED,wBAAgB,WAAW,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,kBAAkB,UAGzE"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yoopta/editor",
|
|
3
|
-
"version": "4.9.4-rc.
|
|
3
|
+
"version": "4.9.4-rc.1",
|
|
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": "75d62f7855d90fcf1d51caa29104d73a3409cd01"
|
|
72
72
|
}
|