@yoopta/editor 4.0.0-rc.20 → 4.0.0-rc.22
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/components/Editor/Editor.d.ts.map +1 -1
- package/dist/index.es.js +6 -0
- package/dist/index.js +2 -2
- package/dist/plugins/SlateEditorComponent.d.ts.map +1 -1
- package/dist/plugins/createYooptaPlugin.d.ts +3 -3
- package/dist/plugins/createYooptaPlugin.d.ts.map +1 -1
- package/dist/plugins/types.d.ts +3 -1
- package/dist/plugins/types.d.ts.map +1 -1
- package/package.json +3 -4
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import*as r from"react";import o,{createContext as i,useContext as a,useRef as l,useLayoutEffect as c,useEffect as s,useMemo as d,useCallback as u,useState as f,memo as p,useReducer as h,forwardRef as g,createElement as v}from"react";import{randomFillSync as m}from"crypto";import*as b from"react-dom";import{unstable_batchedUpdates as y,createPortal as w}from"react-dom";import{ReactEditor as x,useSelected as k,Slate as E,Editable as C,withReact as O}from"slate-react";import{Path as S,Editor as D,Element as _,Transforms as R,Range as j,Text as B,createEditor as A,Point as T}from"slate";class L{constructor(e){this.plugin=e}get getPlugin(){return this.plugin}extend(e){const{renders:t,options:n}=e,r=Object.assign(Object.assign({},this.plugin.options),n),o=Object.assign({},this.plugin.elements);return t&&Object.keys(t).forEach((e=>{const n=o[e];n&&n.render&&(o[e].render=n=>t[e](n))})),new L({type:this.plugin.type,elements:o,events:this.plugin.events,parsers:this.plugin.parsers,options:r})}}function N(e,t={}){const n=Object.keys(e.children),{at:r=e.selection}=t,o=n.find((t=>e.children[t].meta.order===(null==r?void 0:r[0])));return o?e.children[o]:null}const M={editor:{getBlock:()=>{},insertBlock:()=>{},insertBlocks:()=>{},updateBlock:()=>{},moveBlock:()=>{},splitBlock:()=>{},deleteBlock:()=>{},toggleBlock:()=>{},focusBlock:()=>{},setSelection:()=>{},applyChanges:()=>{},decreaseBlockDepth:()=>{},increaseBlockDepth:()=>{},setBlockSelected:()=>{},selectedBlocks:[],duplicateBlock:()=>{},getEditorValue:()=>{},blur:()=>{},blocks:{},shortcuts:{},plugins:{},formats:{},selection:null,readOnly:!1,blockEditorsMap:{},children:{},emit:()=>{},on:()=>{},off:()=>{},once:()=>{}}},I=i(M),P=({children:t,editorState:n})=>{const r=l(M);return r.current={editor:n.editor},e(I.Provider,Object.assign({value:r.current},{children:t}))},z=()=>{const e=a(I);if(!e)throw new Error("useYooptaEditor must be used within a YooptaEditorContext");return e.editor},F=e=>z().children[e],U=e=>z().blocks[e],V=e=>z().plugins[e],H=()=>z().readOnly,W=e=>{var t;return null===(t=V(e))||void 0===t?void 0:t.options},K=({blockId:e,path:t})=>{var n;const r=z();if(!e&&!t)throw new Error("useBlockSelected must receive either blockId or path");let o;return e&&(o=r.children[e]),t&&(o=N(r,{at:t})),(null===(n=r.selection)||void 0===n?void 0:n[0])===(null==o?void 0:o.meta.order)};var Y="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},X={};!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,a){if("function"!=typeof r)throw new TypeError("The listener must be a function");var l=new o(r,i||e,a),c=n?n+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],l]:e._events[c].push(l):(e._events[c]=l,e._eventsCount++),e}function a(e,t){0==--e._eventsCount?e._events=new r:delete e._events[t]}function l(){this._events=new r,this._eventsCount=0}Object.create&&(r.prototype=Object.create(null),(new r).__proto__||(n=!1)),l.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},l.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,a=new Array(i);o<i;o++)a[o]=r[o].fn;return a},l.prototype.listenerCount=function(e){var t=n?n+e:e,r=this._events[t];return r?r.fn?1:r.length:0},l.prototype.emit=function(e,t,r,o,i,a){var l=n?n+e:e;if(!this._events[l])return!1;var c,s,d=this._events[l],u=arguments.length;if(d.fn){switch(d.once&&this.removeListener(e,d.fn,void 0,!0),u){case 1:return d.fn.call(d.context),!0;case 2:return d.fn.call(d.context,t),!0;case 3:return d.fn.call(d.context,t,r),!0;case 4:return d.fn.call(d.context,t,r,o),!0;case 5:return d.fn.call(d.context,t,r,o,i),!0;case 6:return d.fn.call(d.context,t,r,o,i,a),!0}for(s=1,c=new Array(u-1);s<u;s++)c[s-1]=arguments[s];d.fn.apply(d.context,c)}else{var f,p=d.length;for(s=0;s<p;s++)switch(d[s].once&&this.removeListener(e,d[s].fn,void 0,!0),u){case 1:d[s].fn.call(d[s].context);break;case 2:d[s].fn.call(d[s].context,t);break;case 3:d[s].fn.call(d[s].context,t,r);break;case 4:d[s].fn.call(d[s].context,t,r,o);break;default:if(!c)for(f=1,c=new Array(u-1);f<u;f++)c[f-1]=arguments[f];d[s].fn.apply(d[s].context,c)}}return!0},l.prototype.on=function(e,t,n){return i(this,e,t,n,!1)},l.prototype.once=function(e,t,n){return i(this,e,t,n,!0)},l.prototype.removeListener=function(e,t,r,o){var i=n?n+e:e;if(!this._events[i])return this;if(!t)return a(this,i),this;var l=this._events[i];if(l.fn)l.fn!==t||o&&!l.once||r&&l.context!==r||a(this,i);else{for(var c=0,s=[],d=l.length;c<d;c++)(l[c].fn!==t||o&&!l[c].once||r&&l[c].context!==r)&&s.push(l[c]);s.length?this._events[i]=1===s.length?s[0]:s:a(this,i)}return this},l.prototype.removeAllListeners=function(e){var t;return e?(t=n?n+e:e,this._events[t]&&a(this,t)):(this._events=new r,this._eventsCount=0),this},l.prototype.off=l.prototype.removeListener,l.prototype.addListener=l.prototype.on,l.prefixed=n,l.EventEmitter=l,e.exports=l}({get exports(){return X},set exports(e){X=e}});var $=X;let Z,q,G=(e=21)=>{var t;t=e-=0,!Z||Z.length<t?(Z=Buffer.allocUnsafe(128*t),m(Z),q=0):q+t>Z.length&&(m(Z),q=0),q+=t;let n="";for(let t=q-e;t<q;t++)n+="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"[63&Z[t]];return n};const J=()=>{var e;return"undefined"==typeof window?G():"function"!=typeof(null===(e=window.crypto)||void 0===e?void 0:e.randomUUID)?function(){let e=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};return e()+e()+"-"+e()+"-"+e()+"-"+e()+"-"+e()+e()+e()}():G()},Q=e=>({id:J(),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)}),ee=e=>({id:(null==e?void 0:e.id)||J(),value:(null==e?void 0:e.value)||[Q()],type:(null==e?void 0:e.type)||"Paragraph",meta:Object.assign({order:0,depth:0},null==e?void 0:e.meta)});const te="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement;function ne(e){const t=Object.prototype.toString.call(e);return"[object Window]"===t||"[object global]"===t}function re(e){return"nodeType"in e}function oe(e){var t,n;return e?ne(e)?e:re(e)&&null!=(t=null==(n=e.ownerDocument)?void 0:n.defaultView)?t:window:window}function ie(e){const{Document:t}=oe(e);return e instanceof t}function ae(e){return!ne(e)&&e instanceof oe(e).HTMLElement}function le(e){return e instanceof oe(e).SVGElement}function ce(e){return e?ne(e)?e.document:re(e)?ie(e)?e:ae(e)||le(e)?e.ownerDocument:document:document:document}const se=te?c:s;function de(e){const t=l(e);return se((()=>{t.current=e})),u((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 ue(e,t){void 0===t&&(t=[e]);const n=l(e);return se((()=>{n.current!==e&&(n.current=e)}),t),n}function fe(e,t){const n=l();return d((()=>{const t=e(n.current);return n.current=t,t}),[...t])}function pe(e){const t=de(e),n=l(null),r=u((e=>{e!==n.current&&(null==t||t(e,n.current)),n.current=e}),[]);return[n,r]}function he(e){const t=l();return s((()=>{t.current=e}),[e]),t.current}let ge={};function ve(e,t){return d((()=>{if(t)return t;const n=null==ge[e]?0:ge[e]+1;return ge[e]=n,e+"-"+n}),[e,t])}function me(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 be=me(1),ye=me(-1);function we(e){if(!e)return!1;const{KeyboardEvent:t}=oe(e.target);return t&&e instanceof t}function xe(e){if(function(e){if(!e)return!1;const{TouchEvent:t}=oe(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 ke=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[ke.Translate.toString(e),ke.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),Ee="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Ce(e){return e.matches(Ee)?e:e.querySelector(Ee)}const Oe={display:"none"};function Se(e){let{id:t,value:n}=e;return o.createElement("div",{id:t,style:Oe},n)}function De(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 _e=i(null);const Re={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 "},je={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 Be(e){let{announcements:t=je,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=Re}=e;const{announce:l,announcement:c}=function(){const[e,t]=f("");return{announce:u((e=>{null!=e&&t(e)}),[]),announcement:e}}(),p=ve("DndLiveRegion"),[h,g]=f(!1);if(s((()=>{g(!0)}),[]),function(e){const t=a(_e);s((()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)}),[e,t])}(d((()=>({onDragStart(e){let{active:n}=e;l(t.onDragStart({active:n}))},onDragMove(e){let{active:n,over:r}=e;t.onDragMove&&l(t.onDragMove({active:n,over:r}))},onDragOver(e){let{active:n,over:r}=e;l(t.onDragOver({active:n,over:r}))},onDragEnd(e){let{active:n,over:r}=e;l(t.onDragEnd({active:n,over:r}))},onDragCancel(e){let{active:n,over:r}=e;l(t.onDragCancel({active:n,over:r}))}})),[l,t])),!h)return null;const v=o.createElement(o.Fragment,null,o.createElement(Se,{id:r,value:i.draggable}),o.createElement(De,{id:p,announcement:c}));return n?w(v,n):v}var Ae;function Te(){}function Le(e,t){return d((()=>({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"}(Ae||(Ae={}));const Ne=Object.freeze({x:0,y:0});function Me(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Ie(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function Pe(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function ze(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 Fe(e,t){if(!e||0===e.length)return null;const[n]=e;return t?n[t]:n}function Ue(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 Ve=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=Ue(t,t.left,t.top),i=[];for(const e of r){const{id:t}=e,r=n.get(t);if(r){const n=Me(Ue(r),o);i.push({id:t,data:{droppableContainer:e,value:n}})}}return i.sort(Ie)};function He(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),a=o-r,l=i-n;if(r<o&&n<i){const n=t.width*t.height,r=e.width*e.height,o=a*l;return Number((o/(n+r-o)).toFixed(4))}return 0}const We=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=He(i,t);n>0&&o.push({id:r,data:{droppableContainer:e,value:n}})}}return o.sort(Pe)};function Ke(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:Ne}function Ye(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 Xe=Ye(1);const $e={ignoreTransform:!1};function Ze(e,t){void 0===t&&(t=$e);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:t,transformOrigin:r}=oe(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:a,y:l}=r,c=e.left-a-(1-o)*parseFloat(n),s=e.top-l-(1-i)*parseFloat(n.slice(n.indexOf(" ")+1)),d=o?e.width/o:e.width,u=i?e.height/i:e.height;return{width:d,height:u,top:s,right:c+d,bottom:s+u,left:c}}(n,t,r))}const{top:r,left:o,width:i,height:a,bottom:l,right:c}=n;return{top:r,left:o,width:i,height:a,bottom:l,right:c}}function qe(e){return Ze(e,{ignoreTransform:!0})}function Ge(e,t){const n=[];return e?function r(o){if(null!=t&&n.length>=t)return n;if(!o)return n;if(ie(o)&&null!=o.scrollingElement&&!n.includes(o.scrollingElement))return n.push(o.scrollingElement),n;if(!ae(o)||le(o))return n;if(n.includes(o))return n;const i=oe(e).getComputedStyle(o);return o!==e&&function(e,t){void 0===t&&(t=oe(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=oe(e).getComputedStyle(e)),"fixed"===t.position}(o,i)?n:r(o.parentNode)}(e):n}function Je(e){const[t]=Ge(e,1);return null!=t?t:null}function Qe(e){return te&&e?ne(e)?e:re(e)?ie(e)||e===ce(e).scrollingElement?window:ae(e)?e:null:null:null}function et(e){return ne(e)?e.scrollX:e.scrollLeft}function tt(e){return ne(e)?e.scrollY:e.scrollTop}function nt(e){return{x:et(e),y:tt(e)}}var rt;function ot(e){return!(!te||!e)&&e===document.scrollingElement}function it(e){const t={x:0,y:0},n=ot(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"}(rt||(rt={}));const at={x:.2,y:.2};function lt(e,t,n,r,o){let{top:i,left:a,right:l,bottom:c}=n;void 0===r&&(r=10),void 0===o&&(o=at);const{isTop:s,isBottom:d,isLeft:u,isRight:f}=it(e),p={x:0,y:0},h={x:0,y:0},g=t.height*o.y,v=t.width*o.x;return!s&&i<=t.top+g?(p.y=rt.Backward,h.y=r*Math.abs((t.top+g-i)/g)):!d&&c>=t.bottom-g&&(p.y=rt.Forward,h.y=r*Math.abs((t.bottom-g-c)/g)),!f&&l>=t.right-v?(p.x=rt.Forward,h.x=r*Math.abs((t.right-v-l)/v)):!u&&a<=t.left+v&&(p.x=rt.Backward,h.x=r*Math.abs((t.left+v-a)/v)),{direction:p,speed:h}}function ct(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 st(e){return e.reduce(((e,t)=>be(e,nt(t))),Ne)}const dt=[["x",["left","right"],function(e){return e.reduce(((e,t)=>e+et(t)),0)}],["y",["top","bottom"],function(e){return e.reduce(((e,t)=>e+tt(t)),0)}]];class ut{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=Ge(t),r=st(n);this.rect={...e},this.width=e.width,this.height=e.height;for(const[e,t,o]of dt)for(const i of t)Object.defineProperty(this,i,{get:()=>{const t=o(n),a=r[e]-t;return this.rect[i]+a},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class ft{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 pt(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 ht,gt;function vt(e){e.preventDefault()}function mt(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"}(ht||(ht={})),function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter"}(gt||(gt={}));const bt={start:[gt.Space,gt.Enter],cancel:[gt.Esc],end:[gt.Space,gt.Enter]},yt=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case gt.Right:return{...n,x:n.x+25};case gt.Left:return{...n,x:n.x-25};case gt.Down:return{...n,y:n.y+25};case gt.Up:return{...n,y:n.y-25}}};class wt{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 ft(ce(t)),this.windowListeners=new ft(oe(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(ht.Resize,this.handleCancel),this.windowListeners.add(ht.VisibilityChange,this.handleCancel),setTimeout((()=>this.listeners.add(ht.Keydown,this.handleKeyDown)))}handleStart(){const{activeNode:e,onStart:t}=this.props,n=e.node.current;n&&function(e,t){if(void 0===t&&(t=Ze),!e)return;const{top:n,left:r,bottom:o,right:i}=t(e);Je(e)&&(o<=0||i<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}(n),t(Ne)}handleKeyDown(e){if(we(e)){const{active:t,context:n,options:r}=this.props,{keyboardCodes:o=bt,coordinateGetter:i=yt,scrollBehavior:a="smooth"}=r,{code:l}=e;if(o.end.includes(l))return void this.handleEnd(e);if(o.cancel.includes(l))return void this.handleCancel(e);const{collisionRect:c}=n.current,s=c?{x:c.left,y:c.top}:Ne;this.referenceCoordinates||(this.referenceCoordinates=s);const d=i(e,{active:t,context:n.current,currentCoordinates:s});if(d){const t=ye(d,s),r={x:0,y:0},{scrollableAncestors:o}=n.current;for(const n of o){const o=e.code,{isTop:i,isRight:l,isLeft:c,isBottom:s,maxScroll:u,minScroll:f}=it(n),p=ct(n),h={x:Math.min(o===gt.Right?p.right-p.width/2:p.right,Math.max(o===gt.Right?p.left:p.left+p.width/2,d.x)),y:Math.min(o===gt.Down?p.bottom-p.height/2:p.bottom,Math.max(o===gt.Down?p.top:p.top+p.height/2,d.y))},g=o===gt.Right&&!l||o===gt.Left&&!c,v=o===gt.Down&&!s||o===gt.Up&&!i;if(g&&h.x!==d.x){const e=n.scrollLeft+t.x,i=o===gt.Right&&e<=u.x||o===gt.Left&&e>=f.x;if(i&&!t.y)return void n.scrollTo({left:e,behavior:a});r.x=i?n.scrollLeft-e:o===gt.Right?n.scrollLeft-u.x:n.scrollLeft-f.x,r.x&&n.scrollBy({left:-r.x,behavior:a});break}if(v&&h.y!==d.y){const e=n.scrollTop+t.y,i=o===gt.Down&&e<=u.y||o===gt.Up&&e>=f.y;if(i&&!t.x)return void n.scrollTo({top:e,behavior:a});r.y=i?n.scrollTop-e:o===gt.Down?n.scrollTop-u.y:n.scrollTop-f.y,r.y&&n.scrollBy({top:-r.y,behavior:a});break}}this.handleMove(e,be(ye(d,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 xt(e){return Boolean(e&&"distance"in e)}function kt(e){return Boolean(e&&"delay"in e)}wt.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=bt,onActivation:o}=t,{active:i}=n;const{code:a}=e.nativeEvent;if(r.start.includes(a)){const t=i.activatorNode.current;return(!t||e.target===t)&&(e.preventDefault(),null==o||o({event:e.nativeEvent}),!0)}return!1}}];class Et{constructor(e,t,n){var r;void 0===n&&(n=function(e){const{EventTarget:t}=oe(e);return e instanceof t?e:ce(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=ce(i),this.documentListeners=new ft(this.document),this.listeners=new ft(n),this.windowListeners=new ft(oe(i)),this.initialCoordinates=null!=(r=xe(o))?r:Ne,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(ht.Resize,this.handleCancel),this.windowListeners.add(ht.DragStart,vt),this.windowListeners.add(ht.VisibilityChange,this.handleCancel),this.windowListeners.add(ht.ContextMenu,vt),this.documentListeners.add(ht.Keydown,this.handleKeydown),t){if(null!=n&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(kt(t))return void(this.timeoutId=setTimeout(this.handleStart,t.delay));if(xt(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(ht.Click,mt,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(ht.SelectionChange,this.removeTextSelection),t(e))}handleMove(e){var t;const{activated:n,initialCoordinates:r,props:o}=this,{onMove:i,options:{activationConstraint:a}}=o;if(!r)return;const l=null!=(t=xe(e))?t:Ne,c=ye(r,l);if(!n&&a){if(xt(a)){if(null!=a.tolerance&&pt(c,a.tolerance))return this.handleCancel();if(pt(c,a.distance))return this.handleStart()}return kt(a)&&pt(c,a.tolerance)?this.handleCancel():void 0}e.cancelable&&e.preventDefault(),i(l)}handleEnd(){const{onEnd:e}=this.props;this.detach(),e()}handleCancel(){const{onCancel:e}=this.props;this.detach(),e()}handleKeydown(e){e.code===gt.Esc&&this.handleCancel()}removeTextSelection(){var e;null==(e=this.document.getSelection())||e.removeAllRanges()}}const Ct={move:{name:"pointermove"},end:{name:"pointerup"}};class Ot extends Et{constructor(e){const{event:t}=e,n=ce(t.target);super(e,Ct,n)}}Ot.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 St={move:{name:"mousemove"},end:{name:"mouseup"}};var Dt;!function(e){e[e.RightClick=2]="RightClick"}(Dt||(Dt={}));(class extends Et{constructor(e){super(e,St,ce(e.event.target))}}).activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button!==Dt.RightClick&&(null==r||r({event:n}),!0)}}];const _t={move:{name:"touchmove"},end:{name:"touchend"}};var Rt,jt;function Bt(e){let{acceleration:t,activator:n=Rt.Pointer,canScroll:r,draggingRect:o,enabled:i,interval:a=5,order:c=jt.TreeOrder,pointerCoordinates:f,scrollableAncestors:p,scrollableAncestorRects:h,delta:g,threshold:v}=e;const m=function(e){let{delta:t,disabled:n}=e;const r=he(t);return fe((e=>{if(n||!r||!e)return At;const o={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[rt.Backward]:e.x[rt.Backward]||-1===o.x,[rt.Forward]:e.x[rt.Forward]||1===o.x},y:{[rt.Backward]:e.y[rt.Backward]||-1===o.y,[rt.Forward]:e.y[rt.Forward]||1===o.y}}}),[n,t,r])}({delta:g,disabled:!i}),[b,y]=function(){const e=l(null);return[u(((t,n)=>{e.current=setInterval(t,n)}),[]),u((()=>{null!==e.current&&(clearInterval(e.current),e.current=null)}),[])]}(),w=l({x:0,y:0}),x=l({x:0,y:0}),k=d((()=>{switch(n){case Rt.Pointer:return f?{top:f.y,bottom:f.y,left:f.x,right:f.x}:null;case Rt.DraggableRect:return o}}),[n,o,f]),E=l(null),C=u((()=>{const e=E.current;if(!e)return;const t=w.current.x*x.current.x,n=w.current.y*x.current.y;e.scrollBy(t,n)}),[]),O=d((()=>c===jt.TreeOrder?[...p].reverse():p),[c,p]);s((()=>{if(i&&p.length&&k){for(const e of O){if(!1===(null==r?void 0:r(e)))continue;const n=p.indexOf(e),o=h[n];if(!o)continue;const{direction:i,speed:l}=lt(e,o,k,t,v);for(const e of["x","y"])m[e][i[e]]||(l[e]=0,i[e]=0);if(l.x>0||l.y>0)return y(),E.current=e,b(C,a),w.current=l,void(x.current=i)}w.current={x:0,y:0},x.current={x:0,y:0},y()}else y()}),[t,C,r,y,i,a,JSON.stringify(k),JSON.stringify(m),b,p,O,h,JSON.stringify(v)])}(class extends Et{constructor(e){super(e,_t)}static setup(){return window.addEventListener(_t.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(_t.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"}(Rt||(Rt={})),function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"}(jt||(jt={}));const At={x:{[rt.Backward]:!1,[rt.Forward]:!1},y:{[rt.Backward]:!1,[rt.Forward]:!1}};var Tt,Lt;!function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"}(Tt||(Tt={})),function(e){e.Optimized="optimized"}(Lt||(Lt={}));const Nt=new Map;function Mt(e,t){return fe((n=>e?n||("function"==typeof t?t(e):e):null),[t,e])}function It(e){let{callback:t,disabled:n}=e;const r=de(t),o=d((()=>{if(n||"undefined"==typeof window||void 0===window.ResizeObserver)return;const{ResizeObserver:e}=window;return new e(r)}),[n]);return s((()=>()=>null==o?void 0:o.disconnect()),[o]),o}function Pt(e){return new ut(Ze(e),e)}function zt(e,t,n){void 0===t&&(t=Pt);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=de(t),o=d((()=>{if(n||"undefined"==typeof window||void 0===window.MutationObserver)return;const{MutationObserver:e}=window;return new e(r)}),[r,n]);return s((()=>()=>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}}}}),a=It({callback:o});return se((()=>{o(),e?(null==a||a.observe(e),null==i||i.observe(document.body,{childList:!0,subtree:!0})):(null==a||a.disconnect(),null==i||i.disconnect())}),[e]),r}const Ft=[];function Ut(e,t){void 0===t&&(t=[]);const n=l(null);return s((()=>{n.current=null}),t),s((()=>{const t=e!==Ne;t&&!n.current&&(n.current=e),!t&&n.current&&(n.current=null)}),[e]),n.current?ye(e,n.current):Ne}function Vt(e){return d((()=>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 Ht=[];function Wt(e){let{measure:t}=e;const[n,r]=f(null),o=u((e=>{for(const{target:n}of e)if(ae(n)){r((e=>{const r=t(n);return e?{...e,width:r.width,height:r.height}:r}));break}}),[t]),i=It({callback:o}),a=u((e=>{const n=function(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return ae(t)?t:e}(e);null==i||i.disconnect(),n&&(null==i||i.observe(n)),r(n?t(n):null)}),[t,i]),[l,c]=pe(a);return d((()=>({nodeRef:l,rect:n,setRef:c})),[n,l,c])}const Kt=[{sensor:Ot,options:{}},{sensor:wt,options:{}}],Yt={current:{}},Xt={draggable:{measure:qe},droppable:{measure:qe,strategy:Tt.WhileDragging,frequency:Lt.Optimized},dragOverlay:{measure:Ze}};class $t 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 Zt={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new $t,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Te},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Xt,measureDroppableContainers:Te,windowRect:null,measuringScheduled:!1},qt=i({activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Te,draggableNodes:new Map,over:null,measureDroppableContainers:Te}),Gt=i(Zt);function Jt(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new $t}}}function Qt(e,t){switch(t.type){case Ae.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case Ae.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 Ae.DragEnd:case Ae.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Ae.RegisterDroppable:{const{element:n}=t,{id:r}=n,o=new $t(e.droppable.containers);return o.set(r,n),{...e,droppable:{...e.droppable,containers:o}}}case Ae.SetDroppableDisabled:{const{id:n,key:r,disabled:o}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;const a=new $t(e.droppable.containers);return a.set(n,{...i,disabled:o}),{...e,droppable:{...e.droppable,containers:a}}}case Ae.UnregisterDroppable:{const{id:n,key:r}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const i=new $t(e.droppable.containers);return i.delete(n),{...e,droppable:{...e.droppable,containers:i}}}default:return e}}function en(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:o}=a(qt),i=he(r),l=he(null==n?void 0:n.id);return s((()=>{if(!t&&!r&&i&&null!=l){if(!we(i))return;if(document.activeElement===i.target)return;const e=o.get(l);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=Ce(e);if(t){t.focus();break}}}))}}),[r,t,o,l,i]),null}const tn=i({...Ne,scaleX:1,scaleY:1});var nn;!function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"}(nn||(nn={}));const rn=p((function(e){var t,n,r,i;let{id:a,accessibility:c,autoScroll:p=!0,children:g,sensors:v=Kt,collisionDetection:m=We,measuring:b,modifiers:w,...x}=e;const k=h(Qt,void 0,Jt),[E,C]=k,[O,S]=function(){const[e]=f((()=>new Set)),t=u((t=>(e.add(t),()=>e.delete(t))),[e]);return[u((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]}(),[D,_]=f(nn.Uninitialized),R=D===nn.Initialized,{draggable:{active:j,nodes:B,translate:A},droppable:{containers:T}}=E,L=j?B.get(j):null,N=l({initial:null,translated:null}),M=d((()=>{var e;return null!=j?{id:j,data:null!=(e=null==L?void 0:L.data)?e:Yt,rect:N}:null}),[j,L]),I=l(null),[P,z]=f(null),[F,U]=f(null),V=ue(x,Object.values(x)),H=ve("DndDescribedBy",a),W=d((()=>T.getEnabled()),[T]),K=d((()=>({draggable:{...Xt.draggable,...null==Y?void 0:Y.draggable},droppable:{...Xt.droppable,...null==Y?void 0:Y.droppable},dragOverlay:{...Xt.dragOverlay,...null==Y?void 0:Y.dragOverlay}})),[null==(Y=b)?void 0:Y.draggable,null==Y?void 0:Y.droppable,null==Y?void 0:Y.dragOverlay]);var Y;const{droppableRects:X,measureDroppableContainers:$,measuringScheduled:Z}=function(e,t){let{dragging:n,dependencies:r,config:o}=t;const[i,a]=f(null),{frequency:c,measure:d,strategy:p}=o,h=l(e),g=function(){switch(p){case Tt.Always:return!1;case Tt.BeforeDragging:return n;default:return!n}}(),v=ue(g),m=u((function(e){void 0===e&&(e=[]),v.current||a((t=>null===t?e:t.concat(e.filter((e=>!t.includes(e))))))}),[v]),b=l(null),y=fe((t=>{if(g&&!n)return Nt;if(!t||t===Nt||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 ut(d(e),e):null;n.rect.current=r,r&&t.set(n.id,r)}return t}return t}),[e,i,n,g,d]);return s((()=>{h.current=e}),[e]),s((()=>{g||m()}),[n,g]),s((()=>{i&&i.length>0&&a(null)}),[JSON.stringify(i)]),s((()=>{g||"number"!=typeof c||null!==b.current||(b.current=setTimeout((()=>{m(),b.current=null}),c))}),[c,g,m,...r]),{droppableRects:y,measureDroppableContainers:m,measuringScheduled:null!=i}}(W,{dragging:R,dependencies:[A.x,A.y],config:K.droppable}),q=function(e,t){const n=null!==t?e.get(t):void 0,r=n?n.node.current:null;return fe((e=>{var n;return null===t?null:null!=(n=null!=r?r:e)?n:null}),[r,t])}(B,j),G=d((()=>F?xe(F):null),[F]),J=function(){const e=!1===(null==P?void 0:P.autoScrollEnabled),t="object"==typeof p?!1===p.enabled:!1===p,n=R&&!e&&!t;if("object"==typeof p)return{...p,enabled:n};return{enabled:n}}(),Q=function(e,t){return Mt(e,t)}(q,K.draggable.measure);!function(e){let{activeNode:t,measure:n,initialRect:r,config:o=!0}=e;const i=l(!1),{x:a,y:c}="boolean"==typeof o?{x:o,y:o}:o;se((()=>{if(!a&&!c||!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=Ke(n(e),r);if(a||(o.x=0),c||(o.y=0),i.current=!0,Math.abs(o.x)>0||Math.abs(o.y)>0){const t=Je(e);t&&t.scrollBy({top:o.y,left:o.x})}}),[t,a,c,r,n])}({activeNode:j?B.get(j):null,config:J.layoutShiftCompensation,initialRect:Q,measure:K.draggable.measure});const ee=zt(q,K.draggable.measure,Q),ne=zt(q?q.parentElement:null),re=l({activatorEvent:null,active:null,activeNode:q,collisionRect:null,collisions:null,droppableRects:X,draggableNodes:B,draggingNode:null,draggingNodeRect:null,droppableContainers:T,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),ie=T.getNodeFor(null==(t=re.current.over)?void 0:t.id),ae=Wt({measure:K.dragOverlay.measure}),le=null!=(n=ae.nodeRef.current)?n:q,ce=R?null!=(r=ae.rect)?r:ee:null,de=Boolean(ae.nodeRef.current&&ae.rect),pe=Ke(he=de?null:ee,Mt(he));var he;const ge=Vt(le?oe(le):null),me=function(e){const t=l(e),n=fe((n=>e?n&&n!==Ft&&e&&t.current&&e.parentNode===t.current.parentNode?n:Ge(e):Ft),[e]);return s((()=>{t.current=e}),[e]),n}(R?null!=ie?ie:q:null),ye=function(e,t){void 0===t&&(t=Ze);const[n]=e,r=Vt(n?oe(n):null),[o,i]=h((function(){return e.length?e.map((e=>ot(e)?r:new ut(t(e),e))):Ht}),Ht),a=It({callback:i});return e.length>0&&o===Ht&&i(),se((()=>{e.length?e.forEach((e=>null==a?void 0:a.observe(e))):(null==a||a.disconnect(),i())}),[e]),o}(me),we=function(e,t){let{transform:n,...r}=t;return null!=e&&e.length?e.reduce(((e,t)=>t({transform:e,...r})),n):n}(w,{transform:{x:A.x-pe.x,y:A.y-pe.y,scaleX:1,scaleY:1},activatorEvent:F,active:M,activeNodeRect:ee,containerNodeRect:ne,draggingNodeRect:ce,over:re.current.over,overlayNodeRect:ae.rect,scrollableAncestors:me,scrollableAncestorRects:ye,windowRect:ge}),ke=G?be(G,A):null,Ee=function(e){const[t,n]=f(null),r=l(e),o=u((e=>{const t=Qe(e.target);t&&n((e=>e?(e.set(t,nt(t)),new Map(e)):null))}),[]);return s((()=>{const t=r.current;if(e!==t){i(t);const a=e.map((e=>{const t=Qe(e);return t?(t.addEventListener("scroll",o,{passive:!0}),[t,nt(t)]):null})).filter((e=>null!=e));n(a.length?new Map(a):null),r.current=e}return()=>{i(e),i(t)};function i(e){e.forEach((e=>{const t=Qe(e);null==t||t.removeEventListener("scroll",o)}))}}),[o,e]),d((()=>e.length?t?Array.from(t.values()).reduce(((e,t)=>be(e,t)),Ne):st(e):Ne),[e,t])}(me),Ce=Ut(Ee),Oe=Ut(Ee,[ee]),Se=be(we,Ce),De=ce?Xe(ce,we):null,Re=M&&De?m({active:M,collisionRect:De,droppableRects:X,droppableContainers:W,pointerCoordinates:ke}):null,je=Fe(Re,"id"),[Te,Le]=f(null),Me=function(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}(de?we:be(we,Oe),null!=(i=null==Te?void 0:Te.rect)?i:null,ee),Ie=u(((e,t)=>{let{sensor:n,options:r}=t;if(null==I.current)return;const o=B.get(I.current);if(!o)return;const i=e.nativeEvent,a=new n({active:I.current,activeNode:o,event:i,options:r,context:re,onStart(e){const t=I.current;if(null==t)return;const n=B.get(t);if(!n)return;const{onDragStart:r}=V.current,o={active:{id:t,data:n.data,rect:N}};y((()=>{null==r||r(o),_(nn.Initializing),C({type:Ae.DragStart,initialCoordinates:e,active:t}),O({type:"onDragStart",event:o})}))},onMove(e){C({type:Ae.DragMove,coordinates:e})},onEnd:l(Ae.DragEnd),onCancel:l(Ae.DragCancel)});function l(e){return async function(){const{active:t,collisions:n,over:r,scrollAdjustedTranslate:o}=re.current;let a=null;if(t&&o){const{cancelDrop:l}=V.current;if(a={activatorEvent:i,active:t,collisions:n,delta:o,over:r},e===Ae.DragEnd&&"function"==typeof l){await Promise.resolve(l(a))&&(e=Ae.DragCancel)}}I.current=null,y((()=>{C({type:e}),_(nn.Uninitialized),Le(null),z(null),U(null);const t=e===Ae.DragEnd?"onDragEnd":"onDragCancel";if(a){const e=V.current[t];null==e||e(a),O({type:t,event:a})}}))}}y((()=>{z(a),U(e.nativeEvent)}))}),[B]),Pe=u(((e,t)=>(n,r)=>{const o=n.nativeEvent,i=B.get(r);if(null!==I.current||!i||o.dndKit||o.defaultPrevented)return;const a={active:i};!0===e(n,t.options,a)&&(o.dndKit={capturedBy:t.sensor},I.current=r,Ie(n,t))}),[B,Ie]),ze=function(e,t){return d((()=>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,Pe);!function(e){s((()=>{if(!te)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),se((()=>{ee&&D===nn.Initializing&&_(nn.Initialized)}),[ee,D]),s((()=>{const{onDragMove:e}=V.current,{active:t,activatorEvent:n,collisions:r,over:o}=re.current;if(!t||!n)return;const i={active:t,activatorEvent:n,collisions:r,delta:{x:Se.x,y:Se.y},over:o};y((()=>{null==e||e(i),O({type:"onDragMove",event:i})}))}),[Se.x,Se.y]),s((()=>{const{active:e,activatorEvent:t,collisions:n,droppableContainers:r,scrollAdjustedTranslate:o}=re.current;if(!e||null==I.current||!t||!o)return;const{onDragOver:i}=V.current,a=r.get(je),l=a&&a.rect.current?{id:a.id,rect:a.rect.current,data:a.data,disabled:a.disabled}:null,c={active:e,activatorEvent:t,collisions:n,delta:{x:o.x,y:o.y},over:l};y((()=>{Le(l),null==i||i(c),O({type:"onDragOver",event:c})}))}),[je]),se((()=>{re.current={activatorEvent:F,active:M,activeNode:q,collisionRect:De,collisions:Re,droppableRects:X,draggableNodes:B,draggingNode:le,draggingNodeRect:ce,droppableContainers:T,over:Te,scrollableAncestors:me,scrollAdjustedTranslate:Se},N.current={initial:ce,translated:De}}),[M,q,Re,De,B,le,ce,X,T,Te,me,Se]),Bt({...J,delta:A,draggingRect:De,pointerCoordinates:ke,scrollableAncestors:me,scrollableAncestorRects:ye});const Ue=d((()=>({active:M,activeNode:q,activeNodeRect:ee,activatorEvent:F,collisions:Re,containerNodeRect:ne,dragOverlay:ae,draggableNodes:B,droppableContainers:T,droppableRects:X,over:Te,measureDroppableContainers:$,scrollableAncestors:me,scrollableAncestorRects:ye,measuringConfiguration:K,measuringScheduled:Z,windowRect:ge})),[M,q,ee,F,Re,ne,ae,B,T,X,Te,$,me,ye,K,Z,ge]),Ve=d((()=>({activatorEvent:F,activators:ze,active:M,activeNodeRect:ee,ariaDescribedById:{draggable:H},dispatch:C,draggableNodes:B,over:Te,measureDroppableContainers:$})),[F,ze,M,ee,C,H,B,Te,$]);return o.createElement(_e.Provider,{value:S},o.createElement(qt.Provider,{value:Ve},o.createElement(Gt.Provider,{value:Ue},o.createElement(tn.Provider,{value:Me},g)),o.createElement(en,{disabled:!1===(null==c?void 0:c.restoreFocus)})),o.createElement(Be,{...c,hiddenTextDescribedById:H}))})),on=i(null),an="button",ln="Droppable";function cn(e){let{id:t,data:n,disabled:r=!1,attributes:o}=e;const i=ve(ln),{activators:l,activatorEvent:c,active:s,activeNodeRect:u,ariaDescribedById:f,draggableNodes:p,over:h}=a(qt),{role:g=an,roleDescription:v="draggable",tabIndex:m=0}=null!=o?o:{},b=(null==s?void 0:s.id)===t,y=a(b?tn:on),[w,x]=pe(),[k,E]=pe(),C=function(e,t){return d((()=>e.reduce(((e,n)=>{let{eventName:r,handler:o}=n;return e[r]=e=>{o(e,t)},e}),{})),[e,t])}(l,t),O=ue(n);se((()=>(p.set(t,{id:t,key:i,node:w,activatorNode:k,data:O}),()=>{const e=p.get(t);e&&e.key===i&&p.delete(t)})),[p,t]);return{active:s,activatorEvent:c,activeNodeRect:u,attributes:d((()=>({role:g,tabIndex:m,"aria-disabled":r,"aria-pressed":!(!b||g!==an)||void 0,"aria-roledescription":v,"aria-describedby":f.draggable})),[r,g,m,b,v,f.draggable]),isDragging:b,listeners:r?void 0:C,node:w,over:h,setNodeRef:x,setActivatorNodeRef:E,transform:y}}const sn="Droppable",dn={timeout:25};function un(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function fn(e,t){return e.reduce(((e,n,r)=>{const o=t.get(n);return o&&(e[r]=o),e}),Array(e.length))}function pn(e){return null!==e&&e>=0}const hn=e=>{let{rects:t,activeIndex:n,overIndex:r,index:o}=e;const i=un(t,r,n),a=t[o],l=i[o];return l&&a?{x:l.left-a.left,y:l.top-a.top,scaleX:l.width/a.width,scaleY:l.height/a.height}:null},gn={scaleX:1,scaleY:1},vn=e=>{var t;let{activeIndex:n,activeNodeRect:r,index:o,rects:i,overIndex:a}=e;const l=null!=(t=i[n])?t:r;if(!l)return null;if(o===n){const e=i[a];return e?{x:0,y:n<a?e.top+e.height-(l.top+l.height):e.top-l.top,...gn}:null}const c=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<=a?{x:0,y:-l.height-c,...gn}:o<n&&o>=a?{x:0,y:l.height+c,...gn}:{x:0,y:0,...gn}};const mn="Sortable",bn=o.createContext({activeIndex:-1,containerId:mn,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:hn,disabled:{draggable:!1,droppable:!1}});function yn(e){let{children:t,id:n,items:r,strategy:i=hn,disabled:c=!1}=e;const{active:u,dragOverlay:f,droppableRects:p,over:h,measureDroppableContainers:g}=a(Gt),v=ve(mn,n),m=Boolean(null!==f.rect),b=d((()=>r.map((e=>"object"==typeof e&&"id"in e?e.id:e))),[r]),y=null!=u,w=u?b.indexOf(u.id):-1,x=h?b.indexOf(h.id):-1,k=l(b),E=!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}(b,k.current),C=-1!==x&&-1===w||E,O=function(e){return"boolean"==typeof e?{draggable:e,droppable:e}:e}(c);se((()=>{E&&y&&g(b)}),[E,b,y,g]),s((()=>{k.current=b}),[b]);const S=d((()=>({activeIndex:w,containerId:v,disabled:O,disableTransforms:C,items:b,overIndex:x,useDragOverlay:m,sortedRects:fn(b,p),strategy:i})),[w,v,O.draggable,O.droppable,C,b,x,p,m,i]);return o.createElement(bn.Provider,{value:S},t)}const wn=e=>{let{id:t,items:n,activeIndex:r,overIndex:o}=e;return un(n,r,o).indexOf(t)},xn=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:o,items:i,newIndex:a,previousItems:l,previousContainerId:c,transition:s}=e;return!(!s||!r)&&((l===i||o!==a)&&(!!n||a!==o&&t===c))},kn={duration:200,easing:"ease"},En="transform",Cn=ke.Transition.toString({property:En,duration:0,easing:"linear"}),On={roleDescription:"sortable"};function Sn(e){let{animateLayoutChanges:t=xn,attributes:n,disabled:r,data:o,getNewIndex:i=wn,id:c,strategy:p,resizeObserverConfig:h,transition:g=kn}=e;const{items:v,containerId:m,activeIndex:b,disabled:y,disableTransforms:w,sortedRects:x,overIndex:k,useDragOverlay:E,strategy:C}=a(bn),O=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,y),S=v.indexOf(c),D=d((()=>({sortable:{containerId:m,index:S,items:v},...o})),[m,o,S,v]),_=d((()=>v.slice(v.indexOf(c))),[v,c]),{rect:R,node:j,isOver:B,setNodeRef:A}=function(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:o}=e;const i=ve(sn),{active:c,dispatch:d,over:f,measureDroppableContainers:p}=a(qt),h=l({disabled:n}),g=l(!1),v=l(null),m=l(null),{disabled:b,updateMeasurementsFor:y,timeout:w}={...dn,...o},x=ue(null!=y?y:r),k=It({callback:u((()=>{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:b||!c}),E=u(((e,t)=>{k&&(t&&(k.unobserve(t),g.current=!1),e&&k.observe(e))}),[k]),[C,O]=pe(E),S=ue(t);return s((()=>{k&&C.current&&(k.disconnect(),g.current=!1,k.observe(C.current))}),[C,k]),se((()=>(d({type:Ae.RegisterDroppable,element:{id:r,key:i,disabled:n,node:C,rect:v,data:S}}),()=>d({type:Ae.UnregisterDroppable,key:i,id:r}))),[r]),s((()=>{n!==h.current.disabled&&(d({type:Ae.SetDroppableDisabled,id:r,key:i,disabled:n}),h.current.disabled=n)}),[r,i,n,d]),{active:c,rect:v,isOver:(null==f?void 0:f.id)===r,node:C,over:f,setNodeRef:O}}({id:c,data:D,disabled:O.droppable,resizeObserverConfig:{updateMeasurementsFor:_,...h}}),{active:T,activatorEvent:L,activeNodeRect:N,attributes:M,setNodeRef:I,listeners:P,isDragging:z,over:F,setActivatorNodeRef:U,transform:V}=cn({id:c,data:D,attributes:{...On,...n},disabled:O.draggable}),H=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return d((()=>e=>{t.forEach((t=>t(e)))}),t)}(A,I),W=Boolean(T),K=W&&!w&&pn(b)&&pn(k),Y=!E&&z,X=Y&&K?V:null,$=K?null!=X?X:(null!=p?p:C)({rects:x,activeNodeRect:N,activeIndex:b,overIndex:k,index:S}):null,Z=pn(b)&&pn(k)?i({id:c,items:v,activeIndex:b,overIndex:k}):S,q=null==T?void 0:T.id,G=l({activeId:q,items:v,newIndex:Z,containerId:m}),J=v!==G.current.items,Q=t({active:T,containerId:m,isDragging:z,isSorting:W,id:c,index:S,items:v,newIndex:G.current.newIndex,previousItems:G.current.items,previousContainerId:G.current.containerId,transition:g,wasDragging:null!=G.current.activeId}),ee=function(e){let{disabled:t,index:n,node:r,rect:o}=e;const[i,a]=f(null),c=l(n);return se((()=>{if(!t&&n!==c.current&&r.current){const e=o.current;if(e){const t=Ze(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)&&a(n)}}n!==c.current&&(c.current=n)}),[t,n,r,o]),s((()=>{i&&a(null)}),[i]),i}({disabled:!Q,index:S,node:j,rect:R});return s((()=>{W&&G.current.newIndex!==Z&&(G.current.newIndex=Z),m!==G.current.containerId&&(G.current.containerId=m),v!==G.current.items&&(G.current.items=v)}),[W,Z,m,v]),s((()=>{if(q===G.current.activeId)return;if(q&&!G.current.activeId)return void(G.current.activeId=q);const e=setTimeout((()=>{G.current.activeId=q}),50);return()=>clearTimeout(e)}),[q]),{active:T,activeIndex:b,attributes:M,data:D,rect:R,index:S,newIndex:Z,items:v,isOver:B,isSorting:W,isDragging:z,listeners:P,node:j,overIndex:k,over:F,setNodeRef:H,setActivatorNodeRef:U,setDroppableNodeRef:A,setDraggableNodeRef:I,transform:null!=ee?ee:$,transition:function(){if(ee||J&&G.current.newIndex===S)return Cn;if(Y&&!we(L)||!g)return;if(W||Q)return ke.Transition.toString({...g,property:En});return}()}}function Dn(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 _n=[gt.Down,gt.Right,gt.Up,gt.Left],Rn=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:o,droppableContainers:i,over:a,scrollableAncestors:l}}=t;if(_n.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 gt.Down:r.top<i.top&&t.push(n);break;case gt.Up:r.top>i.top&&t.push(n);break;case gt.Left:r.left>i.left&&t.push(n);break;case gt.Right:r.left<i.left&&t.push(n)}}));const c=(e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=ze(t),i=[];for(const e of r){const{id:t}=e,r=n.get(t);if(r){const n=ze(r),a=o.reduce(((e,t,r)=>e+Me(n[r],t)),0),l=Number((a/4).toFixed(4));i.push({id:t,data:{droppableContainer:e,value:l}})}}return i.sort(Ie)})({active:n,collisionRect:r,droppableRects:o,droppableContainers:t,pointerCoordinates:null});let s=Fe(c,"id");if(s===(null==a?void 0:a.id)&&c.length>1&&(s=c[1].id),null!=s){const e=i.get(n.id),t=i.get(s),a=t?o.get(t.id):null,c=null==t?void 0:t.node.current;if(c&&a&&e&&t){const n=Ge(c).some(((e,t)=>l[t]!==e)),o=jn(e,t),i=function(e,t){if(!Dn(e)||!Dn(t))return!1;if(!jn(e,t))return!1;return e.data.current.sortable.index<t.data.current.sortable.index}(e,t),s=n||!o?{x:0,y:0}:{x:i?r.width-a.width:0,y:i?r.height-a.height:0},d={x:a.left,y:a.top};return s.x&&s.y?d:ye(d,s)}}}};function jn(e,t){return!(!Dn(e)||!Dn(t))&&e.data.current.sortable.containerId===t.data.current.sortable.containerId}var Bn;function An(){return An=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},An.apply(this,arguments)}var Tn,Ln=function(e){return r.createElement("svg",An({viewBox:"0 0 10 10",fill:"currentColor",style:{width:14,height:14,display:"block",flexShrink:0,backfaceVisibility:"hidden"}},e),Bn||(Bn=r.createElement("path",{d:"M3 2a1 1 0 1 1 0-2 1 1 0 0 1 0 2Zm0 4a1 1 0 1 1 0-2 1 1 0 0 1 0 2Zm0 4a1 1 0 1 1 0-2 1 1 0 0 1 0 2Zm4-8a1 1 0 1 1 0-2 1 1 0 0 1 0 2Zm0 4a1 1 0 1 1 0-2 1 1 0 0 1 0 2Zm0 4a1 1 0 1 1 0-2 1 1 0 0 1 0 2Z"})))};function Nn(){return Nn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Nn.apply(this,arguments)}var Mn=function(e){return r.createElement("svg",Nn({viewBox:"0 0 16 16",fill:"currentColor",style:{width:16,height:16,display:"block",flexShrink:0,backfaceVisibility:"hidden"}},e),Tn||(Tn=r.createElement("path",{d:"M7.977 14.963c.407 0 .747-.324.747-.723V8.72h5.362c.399 0 .74-.34.74-.747a.746.746 0 0 0-.74-.738H8.724V1.706c0-.398-.34-.722-.747-.722a.732.732 0 0 0-.739.722v5.529h-5.37a.746.746 0 0 0-.74.738c0 .407.341.747.74.747h5.37v5.52c0 .399.332.723.739.723z"})))};function In(e,t={}){const n=Object.keys(e.children),{at:r=e.selection}=t,o=n.find((t=>e.children[t].meta.order===(null==r?void 0:r[0])));if(o)return e.blockEditorsMap[o]}function Pn(e){return Un(e)?(e.nodeName||"").toLowerCase():"#document"}function zn(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function Fn(e){var t;return null==(t=(Un(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function Un(e){return e instanceof Node||e instanceof zn(e).Node}function Vn(e){return e instanceof Element||e instanceof zn(e).Element}function Hn(e){return e instanceof HTMLElement||e instanceof zn(e).HTMLElement}function Wn(e){return"undefined"!=typeof ShadowRoot&&(e instanceof ShadowRoot||e instanceof zn(e).ShadowRoot)}function Kn(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=qn(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function Yn(e){return["table","td","th"].includes(Pn(e))}function Xn(e){const t=$n(),n=qn(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 $n(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}function Zn(e){return["html","body","#document"].includes(Pn(e))}function qn(e){return zn(e).getComputedStyle(e)}function Gn(e){return Vn(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function Jn(e){if("html"===Pn(e))return e;const t=e.assignedSlot||e.parentNode||Wn(e)&&e.host||Fn(e);return Wn(t)?t.host:t}function Qn(e){const t=Jn(e);return Zn(t)?e.ownerDocument?e.ownerDocument.body:e.body:Hn(t)&&Kn(t)?t:Qn(t)}function er(e,t,n){var r;void 0===t&&(t=[]),void 0===n&&(n=!0);const o=Qn(e),i=o===(null==(r=e.ownerDocument)?void 0:r.body),a=zn(o);return i?t.concat(a,a.visualViewport||[],Kn(o)?o:[],a.frameElement&&n?er(a.frameElement):[]):t.concat(o,er(o,[],n))}const tr=Math.min,nr=Math.max,rr=Math.round,or=Math.floor,ir=e=>({x:e,y:e}),ar={left:"right",right:"left",bottom:"top",top:"bottom"},lr={start:"end",end:"start"};function cr(e,t,n){return nr(e,tr(t,n))}function sr(e,t){return"function"==typeof e?e(t):e}function dr(e){return e.split("-")[0]}function ur(e){return e.split("-")[1]}function fr(e){return"x"===e?"y":"x"}function pr(e){return"y"===e?"height":"width"}function hr(e){return["top","bottom"].includes(dr(e))?"y":"x"}function gr(e){return fr(hr(e))}function vr(e){return e.replace(/start|end/g,(e=>lr[e]))}function mr(e){return e.replace(/left|right|bottom|top/g,(e=>ar[e]))}function br(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 yr(e){return{...e,top:e.y,left:e.x,right:e.x+e.width,bottom:e.y+e.height}}function wr(e,t,n){let{reference:r,floating:o}=e;const i=hr(t),a=gr(t),l=pr(a),c=dr(t),s="y"===i,d=r.x+r.width/2-o.width/2,u=r.y+r.height/2-o.height/2,f=r[l]/2-o[l]/2;let p;switch(c){case"top":p={x:d,y:r.y-o.height};break;case"bottom":p={x:d,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:u};break;case"left":p={x:r.x-o.width,y:u};break;default:p={x:r.x,y:r.y}}switch(ur(t)){case"start":p[a]-=f*(n&&s?-1:1);break;case"end":p[a]+=f*(n&&s?-1:1)}return p}async function xr(e,t){var n;void 0===t&&(t={});const{x:r,y:o,platform:i,rects:a,elements:l,strategy:c}=e,{boundary:s="clippingAncestors",rootBoundary:d="viewport",elementContext:u="floating",altBoundary:f=!1,padding:p=0}=sr(t,e),h=br(p),g=l[f?"floating"===u?"reference":"floating":u],v=yr(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(l.floating)),boundary:s,rootBoundary:d,strategy:c})),m="floating"===u?{...a.floating,x:r,y:o}:a.reference,b=await(null==i.getOffsetParent?void 0:i.getOffsetParent(l.floating)),y=await(null==i.isElement?void 0:i.isElement(b))&&await(null==i.getScale?void 0:i.getScale(b))||{x:1,y:1},w=yr(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:m,offsetParent:b,strategy:c}):m);return{top:(v.top-w.top+h.top)/y.y,bottom:(w.bottom-v.bottom+h.bottom)/y.y,left:(v.left-w.left+h.left)/y.x,right:(w.right-v.right+h.right)/y.x}}function kr(e){const t=tr(...e.map((e=>e.left))),n=tr(...e.map((e=>e.top)));return{x:t,y:n,width:nr(...e.map((e=>e.right)))-t,height:nr(...e.map((e=>e.bottom)))-n}}const Er=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:i,placement:a,middlewareData:l}=t,c=await async function(e,t){const{placement:n,platform:r,elements:o}=e,i=await(null==r.isRTL?void 0:r.isRTL(o.floating)),a=dr(n),l=ur(n),c="y"===hr(n),s=["left","top"].includes(a)?-1:1,d=i&&c?-1:1,u=sr(t,e);let{mainAxis:f,crossAxis:p,alignmentAxis:h}="number"==typeof u?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...u};return l&&"number"==typeof h&&(p="end"===l?-1*h:h),c?{x:p*d,y:f*s}:{x:f*s,y:p*d}}(t,e);return a===(null==(n=l.offset)?void 0:n.placement)&&null!=(r=l.arrow)&&r.alignmentOffset?{}:{x:o+c.x,y:i+c.y,data:{...c,placement:a}}}}};function Cr(e){const t=qn(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=Hn(e),i=o?e.offsetWidth:n,a=o?e.offsetHeight:r,l=rr(n)!==i||rr(r)!==a;return l&&(n=i,r=a),{width:n,height:r,$:l}}function Or(e){return Vn(e)?e:e.contextElement}function Sr(e){const t=Or(e);if(!Hn(t))return ir(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=Cr(t);let a=(i?rr(n.width):n.width)/r,l=(i?rr(n.height):n.height)/o;return a&&Number.isFinite(a)||(a=1),l&&Number.isFinite(l)||(l=1),{x:a,y:l}}const Dr=ir(0);function _r(e){const t=zn(e);return $n()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:Dr}function Rr(e,t,n,r){void 0===t&&(t=!1),void 0===n&&(n=!1);const o=e.getBoundingClientRect(),i=Or(e);let a=ir(1);t&&(r?Vn(r)&&(a=Sr(r)):a=Sr(e));const l=function(e,t,n){return void 0===t&&(t=!1),!(!n||t&&n!==zn(e))&&t}(i,n,r)?_r(i):ir(0);let c=(o.left+l.x)/a.x,s=(o.top+l.y)/a.y,d=o.width/a.x,u=o.height/a.y;if(i){const e=zn(i),t=r&&Vn(r)?zn(r):r;let n=e,o=n.frameElement;for(;o&&r&&t!==n;){const e=Sr(o),t=o.getBoundingClientRect(),r=qn(o),i=t.left+(o.clientLeft+parseFloat(r.paddingLeft))*e.x,a=t.top+(o.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,s*=e.y,d*=e.x,u*=e.y,c+=i,s+=a,n=zn(o),o=n.frameElement}}return yr({width:d,height:u,x:c,y:s})}const jr=[":popover-open",":modal"];function Br(e){return jr.some((t=>{try{return e.matches(t)}catch(e){return!1}}))}function Ar(e){return Rr(Fn(e)).left+Gn(e).scrollLeft}function Tr(e,t,n){let r;if("viewport"===t)r=function(e,t){const n=zn(e),r=Fn(e),o=n.visualViewport;let i=r.clientWidth,a=r.clientHeight,l=0,c=0;if(o){i=o.width,a=o.height;const e=$n();(!e||e&&"fixed"===t)&&(l=o.offsetLeft,c=o.offsetTop)}return{width:i,height:a,x:l,y:c}}(e,n);else if("document"===t)r=function(e){const t=Fn(e),n=Gn(e),r=e.ownerDocument.body,o=nr(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=nr(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let a=-n.scrollLeft+Ar(e);const l=-n.scrollTop;return"rtl"===qn(r).direction&&(a+=nr(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:a,y:l}}(Fn(e));else if(Vn(t))r=function(e,t){const n=Rr(e,!0,"fixed"===t),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=Hn(e)?Sr(e):ir(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=_r(e);r={...t,x:t.x-n.x,y:t.y-n.y}}return yr(r)}function Lr(e,t){const n=Jn(e);return!(n===t||!Vn(n)||Zn(n))&&("fixed"===qn(n).position||Lr(n,t))}function Nr(e,t,n){const r=Hn(t),o=Fn(t),i="fixed"===n,a=Rr(e,!0,i,t);let l={scrollLeft:0,scrollTop:0};const c=ir(0);if(r||!r&&!i)if(("body"!==Pn(t)||Kn(o))&&(l=Gn(t)),r){const e=Rr(t,!0,i,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}else o&&(c.x=Ar(o));return{x:a.left+l.scrollLeft-c.x,y:a.top+l.scrollTop-c.y,width:a.width,height:a.height}}function Mr(e,t){return Hn(e)&&"fixed"!==qn(e).position?t?t(e):e.offsetParent:null}function Ir(e,t){const n=zn(e);if(!Hn(e)||Br(e))return n;let r=Mr(e,t);for(;r&&Yn(r)&&"static"===qn(r).position;)r=Mr(r,t);return r&&("html"===Pn(r)||"body"===Pn(r)&&"static"===qn(r).position&&!Xn(r))?n:r||function(e){let t=Jn(e);for(;Hn(t)&&!Zn(t);){if(Xn(t))return t;t=Jn(t)}return null}(e)||n}const Pr={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i="fixed"===o,a=Fn(r),l=!!t&&Br(t.floating);if(r===a||l&&i)return n;let c={scrollLeft:0,scrollTop:0},s=ir(1);const d=ir(0),u=Hn(r);if((u||!u&&!i)&&(("body"!==Pn(r)||Kn(a))&&(c=Gn(r)),Hn(r))){const e=Rr(r);s=Sr(r),d.x=e.x+r.clientLeft,d.y=e.y+r.clientTop}return{width:n.width*s.x,height:n.height*s.y,x:n.x*s.x-c.scrollLeft*s.x+d.x,y:n.y*s.y-c.scrollTop*s.y+d.y}},getDocumentElement:Fn,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=er(e,[],!1).filter((e=>Vn(e)&&"body"!==Pn(e))),o=null;const i="fixed"===qn(e).position;let a=i?Jn(e):e;for(;Vn(a)&&!Zn(a);){const t=qn(a),n=Xn(a);n||"fixed"!==t.position||(o=null),(i?!n&&!o:!n&&"static"===t.position&&o&&["absolute","fixed"].includes(o.position)||Kn(a)&&!n&&Lr(e,a))?r=r.filter((e=>e!==a)):o=t,a=Jn(a)}return t.set(e,r),r}(t,this._c):[].concat(n),r],a=i[0],l=i.reduce(((e,n)=>{const r=Tr(t,n,o);return e.top=nr(r.top,e.top),e.right=tr(r.right,e.right),e.bottom=tr(r.bottom,e.bottom),e.left=nr(r.left,e.left),e}),Tr(t,a,o));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}},getOffsetParent:Ir,getElementRects:async function(e){const t=this.getOffsetParent||Ir,n=this.getDimensions;return{reference:Nr(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}=Cr(e);return{width:t,height:n}},getScale:Sr,isElement:Vn,isRTL:function(e){return"rtl"===qn(e).direction}};function zr(e,t,n,r){void 0===r&&(r={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:a="function"==typeof ResizeObserver,layoutShift:l="function"==typeof IntersectionObserver,animationFrame:c=!1}=r,s=Or(e),d=o||i?[...s?er(s):[],...er(t)]:[];d.forEach((e=>{o&&e.addEventListener("scroll",n,{passive:!0}),i&&e.addEventListener("resize",n)}));const u=s&&l?function(e,t){let n,r=null;const o=Fn(e);function i(){var e;clearTimeout(n),null==(e=r)||e.disconnect(),r=null}return function a(l,c){void 0===l&&(l=!1),void 0===c&&(c=1),i();const{left:s,top:d,width:u,height:f}=e.getBoundingClientRect();if(l||t(),!u||!f)return;const p={rootMargin:-or(d)+"px "+-or(o.clientWidth-(s+u))+"px "+-or(o.clientHeight-(d+f))+"px "+-or(s)+"px",threshold:nr(0,tr(1,c))||1};let h=!0;function g(e){const t=e[0].intersectionRatio;if(t!==c){if(!h)return a();t?a(!1,t):n=setTimeout((()=>{a(!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}(s,n):null;let f,p=-1,h=null;a&&(h=new ResizeObserver((e=>{let[r]=e;r&&r.target===s&&h&&(h.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame((()=>{var e;null==(e=h)||e.observe(t)}))),n()})),s&&!c&&h.observe(s),h.observe(t));let g=c?Rr(e):null;return c&&function t(){const r=Rr(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;d.forEach((e=>{o&&e.removeEventListener("scroll",n),i&&e.removeEventListener("resize",n)})),null==u||u(),null==(e=h)||e.disconnect(),h=null,c&&cancelAnimationFrame(f)}}const Fr=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:i=!0,crossAxis:a=!1,limiter:l={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...c}=sr(e,t),s={x:n,y:r},d=await xr(t,c),u=hr(dr(o)),f=fr(u);let p=s[f],h=s[u];if(i){const e="y"===f?"bottom":"right";p=cr(p+d["y"===f?"top":"left"],p,p-d[e])}if(a){const e="y"===u?"bottom":"right";h=cr(h+d["y"===u?"top":"left"],h,h-d[e])}const g=l.fn({...t,[f]:p,[u]:h});return{...g,data:{x:g.x-n,y:g.y-r}}}}},Ur=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:i,rects:a,initialPlacement:l,platform:c,elements:s}=t,{mainAxis:d=!0,crossAxis:u=!0,fallbackPlacements:f,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:h="none",flipAlignment:g=!0,...v}=sr(e,t);if(null!=(n=i.arrow)&&n.alignmentOffset)return{};const m=dr(o),b=dr(l)===l,y=await(null==c.isRTL?void 0:c.isRTL(s.floating)),w=f||(b||!g?[mr(l)]:function(e){const t=mr(e);return[vr(e),t,vr(t)]}(l));f||"none"===h||w.push(...function(e,t,n,r){const o=ur(e);let i=function(e,t,n){const r=["left","right"],o=["right","left"],i=["top","bottom"],a=["bottom","top"];switch(e){case"top":case"bottom":return n?t?o:r:t?r:o;case"left":case"right":return t?i:a;default:return[]}}(dr(e),"start"===n,r);return o&&(i=i.map((e=>e+"-"+o)),t&&(i=i.concat(i.map(vr)))),i}(l,g,h,y));const x=[l,...w],k=await xr(t,v),E=[];let C=(null==(r=i.flip)?void 0:r.overflows)||[];if(d&&E.push(k[m]),u){const e=function(e,t,n){void 0===n&&(n=!1);const r=ur(e),o=gr(e),i=pr(o);let a="x"===o?r===(n?"end":"start")?"right":"left":"start"===r?"bottom":"top";return t.reference[i]>t.floating[i]&&(a=mr(a)),[a,mr(a)]}(o,a,y);E.push(k[e[0]],k[e[1]])}if(C=[...C,{placement:o,overflows:E}],!E.every((e=>e<=0))){var O,S;const e=((null==(O=i.flip)?void 0:O.index)||0)+1,t=x[e];if(t)return{data:{index:e,overflows:C},reset:{placement:t}};let n=null==(S=C.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 D;const e=null==(D=C.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:D[0];e&&(n=e);break}case"initialPlacement":n=l}if(o!==n)return{reset:{placement:n}}}return{}}}},Vr=function(e){return void 0===e&&(e={}),{name:"inline",options:e,async fn(t){const{placement:n,elements:r,rects:o,platform:i,strategy:a}=t,{padding:l=2,x:c,y:s}=sr(e,t),d=Array.from(await(null==i.getClientRects?void 0:i.getClientRects(r.reference))||[]),u=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=>yr(kr(e))))}(d),f=yr(kr(d)),p=br(l);const h=await i.getElementRects({reference:{getBoundingClientRect:function(){if(2===u.length&&u[0].left>u[1].right&&null!=c&&null!=s)return u.find((e=>c>e.left-p.left&&c<e.right+p.right&&s>e.top-p.top&&s<e.bottom+p.bottom))||f;if(u.length>=2){if("y"===hr(n)){const e=u[0],t=u[u.length-1],r="top"===dr(n),o=e.top,i=t.bottom,a=r?e.left:t.left,l=r?e.right:t.right;return{top:o,bottom:i,left:a,right:l,width:l-a,height:i-o,x:a,y:o}}const e="left"===dr(n),t=nr(...u.map((e=>e.right))),r=tr(...u.map((e=>e.left))),o=u.filter((n=>e?n.left===r:n.right===t)),i=o[0].top,a=o[o.length-1].bottom;return{top:i,bottom:a,left:r,right:t,width:t-r,height:a-i,x:r,y:i}}return f}},floating:r.floating,strategy:a});return o.reference.x!==h.reference.x||o.reference.y!==h.reference.y||o.reference.width!==h.reference.width||o.reference.height!==h.reference.height?{reset:{rects:h}}:{}}}},Hr=(e,t,n)=>{const r=new Map,o={platform:Pr,...n},i={...o.platform,_c:r};return(async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:a}=n,l=i.filter(Boolean),c=await(null==a.isRTL?void 0:a.isRTL(t));let s=await a.getElementRects({reference:e,floating:t,strategy:o}),{x:d,y:u}=wr(s,r,c),f=r,p={},h=0;for(let n=0;n<l.length;n++){const{name:i,fn:g}=l[n],{x:v,y:m,data:b,reset:y}=await g({x:d,y:u,initialPlacement:r,placement:f,strategy:o,middlewareData:p,rects:s,platform:a,elements:{reference:e,floating:t}});d=null!=v?v:d,u=null!=m?m:u,p={...p,[i]:{...p[i],...b}},y&&h<=50&&(h++,"object"==typeof y&&(y.placement&&(f=y.placement),y.rects&&(s=!0===y.rects?await a.getElementRects({reference:e,floating:t,strategy:o}):y.rects),({x:d,y:u}=wr(s,f,c))),n=-1)}return{x:d,y:u,placement:f,strategy:o,middlewareData:p}})(e,t,{...o,platform:i})};var Wr="undefined"!=typeof document?c:s;function Kr(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(!Kr(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)&&!Kr(e[n],t[n]))return!1}return!0}return e!=e&&t!=t}function Yr(e){if("undefined"==typeof window)return 1;return(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Xr(e,t){const n=Yr(e);return Math.round(t*n)/n}function $r(e){const t=r.useRef(e);return Wr((()=>{t.current=e})),t}
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),n=require("crypto"),r=require("react-dom"),o=require("slate-react"),i=require("slate");function a(e){var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var l=a(t),s=a(r);class c{constructor(e){this.plugin=e}get getPlugin(){return this.plugin}extend(e){const{renders:t,options:n}=e,r=Object.assign(Object.assign({},this.plugin.options),n),o=Object.assign({},this.plugin.elements);return t&&Object.keys(t).forEach((e=>{const n=o[e];n&&n.render&&(o[e].render=n=>t[e](n))})),new c({type:this.plugin.type,elements:o,events:this.plugin.events,parsers:this.plugin.parsers,options:r})}}function d(e,t={}){const n=Object.keys(e.children),{at:r=e.selection}=t,o=n.find((t=>e.children[t].meta.order===(null==r?void 0:r[0])));return o?e.children[o]:null}const u={editor:{getBlock:()=>{},insertBlock:()=>{},insertBlocks:()=>{},updateBlock:()=>{},moveBlock:()=>{},splitBlock:()=>{},deleteBlock:()=>{},toggleBlock:()=>{},focusBlock:()=>{},setSelection:()=>{},applyChanges:()=>{},decreaseBlockDepth:()=>{},increaseBlockDepth:()=>{},setBlockSelected:()=>{},selectedBlocks:[],duplicateBlock:()=>{},getEditorValue:()=>{},blur:()=>{},blocks:{},shortcuts:{},plugins:{},formats:{},selection:null,readOnly:!1,blockEditorsMap:{},children:{},emit:()=>{},on:()=>{},off:()=>{},once:()=>{}}},f=t.createContext(u),p=({children:n,editorState:r})=>{const o=t.useRef(u);return o.current={editor:r.editor},e.jsx(f.Provider,Object.assign({value:o.current},{children:n}))},h=()=>{const e=t.useContext(f);if(!e)throw new Error("useYooptaEditor must be used within a YooptaEditorContext");return e.editor},g=e=>h().children[e],v=e=>h().plugins[e],m=()=>h().readOnly;var b="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},y={};!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,a){if("function"!=typeof r)throw new TypeError("The listener must be a function");var l=new o(r,i||e,a),s=n?n+t:t;return e._events[s]?e._events[s].fn?e._events[s]=[e._events[s],l]:e._events[s].push(l):(e._events[s]=l,e._eventsCount++),e}function a(e,t){0==--e._eventsCount?e._events=new r:delete e._events[t]}function l(){this._events=new r,this._eventsCount=0}Object.create&&(r.prototype=Object.create(null),(new r).__proto__||(n=!1)),l.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},l.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,a=new Array(i);o<i;o++)a[o]=r[o].fn;return a},l.prototype.listenerCount=function(e){var t=n?n+e:e,r=this._events[t];return r?r.fn?1:r.length:0},l.prototype.emit=function(e,t,r,o,i,a){var l=n?n+e:e;if(!this._events[l])return!1;var s,c,d=this._events[l],u=arguments.length;if(d.fn){switch(d.once&&this.removeListener(e,d.fn,void 0,!0),u){case 1:return d.fn.call(d.context),!0;case 2:return d.fn.call(d.context,t),!0;case 3:return d.fn.call(d.context,t,r),!0;case 4:return d.fn.call(d.context,t,r,o),!0;case 5:return d.fn.call(d.context,t,r,o,i),!0;case 6:return d.fn.call(d.context,t,r,o,i,a),!0}for(c=1,s=new Array(u-1);c<u;c++)s[c-1]=arguments[c];d.fn.apply(d.context,s)}else{var f,p=d.length;for(c=0;c<p;c++)switch(d[c].once&&this.removeListener(e,d[c].fn,void 0,!0),u){case 1:d[c].fn.call(d[c].context);break;case 2:d[c].fn.call(d[c].context,t);break;case 3:d[c].fn.call(d[c].context,t,r);break;case 4:d[c].fn.call(d[c].context,t,r,o);break;default:if(!s)for(f=1,s=new Array(u-1);f<u;f++)s[f-1]=arguments[f];d[c].fn.apply(d[c].context,s)}}return!0},l.prototype.on=function(e,t,n){return i(this,e,t,n,!1)},l.prototype.once=function(e,t,n){return i(this,e,t,n,!0)},l.prototype.removeListener=function(e,t,r,o){var i=n?n+e:e;if(!this._events[i])return this;if(!t)return a(this,i),this;var l=this._events[i];if(l.fn)l.fn!==t||o&&!l.once||r&&l.context!==r||a(this,i);else{for(var s=0,c=[],d=l.length;s<d;s++)(l[s].fn!==t||o&&!l[s].once||r&&l[s].context!==r)&&c.push(l[s]);c.length?this._events[i]=1===c.length?c[0]:c:a(this,i)}return this},l.prototype.removeAllListeners=function(e){var t;return e?(t=n?n+e:e,this._events[t]&&a(this,t)):(this._events=new r,this._eventsCount=0),this},l.prototype.off=l.prototype.removeListener,l.prototype.addListener=l.prototype.on,l.prefixed=n,l.EventEmitter=l,e.exports=l}({get exports(){return y},set exports(e){y=e}});var w=y;let x,k,E=(e=21)=>{var t;t=e-=0,!x||x.length<t?(x=Buffer.allocUnsafe(128*t),n.randomFillSync(x),k=0):k+t>x.length&&(n.randomFillSync(x),k=0),k+=t;let r="";for(let t=k-e;t<k;t++)r+="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"[63&x[t]];return r};const C=()=>{var e;return"undefined"==typeof window?E():"function"!=typeof(null===(e=window.crypto)||void 0===e?void 0:e.randomUUID)?function(){let e=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};return e()+e()+"-"+e()+"-"+e()+"-"+e()+"-"+e()+e()+e()}():E()},O=e=>({id:C(),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)}),S=e=>({id:(null==e?void 0:e.id)||C(),value:(null==e?void 0:e.value)||[O()],type:(null==e?void 0:e.type)||"Paragraph",meta:Object.assign({order:0,depth:0},null==e?void 0:e.meta)});const j="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement;function R(e){const t=Object.prototype.toString.call(e);return"[object Window]"===t||"[object global]"===t}function _(e){return"nodeType"in e}function D(e){var t,n;return e?R(e)?e:_(e)&&null!=(t=null==(n=e.ownerDocument)?void 0:n.defaultView)?t:window:window}function B(e){const{Document:t}=D(e);return e instanceof t}function T(e){return!R(e)&&e instanceof D(e).HTMLElement}function A(e){return e instanceof D(e).SVGElement}function M(e){return e?R(e)?e.document:_(e)?B(e)?e:T(e)||A(e)?e.ownerDocument:document:document:document}const L=j?t.useLayoutEffect:t.useEffect;function N(e){const n=t.useRef(e);return L((()=>{n.current=e})),t.useCallback((function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return null==n.current?void 0:n.current(...t)}),[])}function P(e,n){void 0===n&&(n=[e]);const r=t.useRef(e);return L((()=>{r.current!==e&&(r.current=e)}),n),r}function I(e,n){const r=t.useRef();return t.useMemo((()=>{const t=e(r.current);return r.current=t,t}),[...n])}function z(e){const n=N(e),r=t.useRef(null),o=t.useCallback((e=>{e!==r.current&&(null==n||n(e,r.current)),r.current=e}),[]);return[r,o]}function F(e){const n=t.useRef();return t.useEffect((()=>{n.current=e}),[e]),n.current}let U={};function H(e,n){return t.useMemo((()=>{if(n)return n;const t=null==U[e]?0:U[e]+1;return U[e]=t,e+"-"+t}),[e,n])}function V(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 Y=V(1),W=V(-1);function K(e){if(!e)return!1;const{KeyboardEvent:t}=D(e.target);return t&&e instanceof t}function X(e){if(function(e){if(!e)return!1;const{TouchEvent:t}=D(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 $=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[$.Translate.toString(e),$.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),q="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Z(e){return e.matches(q)?e:e.querySelector(q)}const G={display:"none"};function J(e){let{id:n,value:r}=e;return t.createElement("div",{id:n,style:G},r)}function Q(e){let{id:n,announcement:r,ariaLiveType:o="assertive"}=e;return t.createElement("div",{id:n,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":o,"aria-atomic":!0},r)}const ee=t.createContext(null);const te={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 "},ne={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 re(e){let{announcements:n=ne,container:o,hiddenTextDescribedById:i,screenReaderInstructions:a=te}=e;const{announce:l,announcement:s}=function(){const[e,n]=t.useState("");return{announce:t.useCallback((e=>{null!=e&&n(e)}),[]),announcement:e}}(),c=H("DndLiveRegion"),[d,u]=t.useState(!1);if(t.useEffect((()=>{u(!0)}),[]),function(e){const n=t.useContext(ee);t.useEffect((()=>{if(!n)throw new Error("useDndMonitor must be used within a children of <DndContext>");return n(e)}),[e,n])}(t.useMemo((()=>({onDragStart(e){let{active:t}=e;l(n.onDragStart({active:t}))},onDragMove(e){let{active:t,over:r}=e;n.onDragMove&&l(n.onDragMove({active:t,over:r}))},onDragOver(e){let{active:t,over:r}=e;l(n.onDragOver({active:t,over:r}))},onDragEnd(e){let{active:t,over:r}=e;l(n.onDragEnd({active:t,over:r}))},onDragCancel(e){let{active:t,over:r}=e;l(n.onDragCancel({active:t,over:r}))}})),[l,n])),!d)return null;const f=t.createElement(t.Fragment,null,t.createElement(J,{id:i,value:a.draggable}),t.createElement(Q,{id:c,announcement:s}));return o?r.createPortal(f,o):f}var oe;function ie(){}function ae(e,n){return t.useMemo((()=>({sensor:e,options:null!=n?n:{}})),[e,n])}!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"}(oe||(oe={}));const le=Object.freeze({x:0,y:0});function se(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function ce(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function de(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function ue(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 fe(e,t){if(!e||0===e.length)return null;const[n]=e;return t?n[t]:n}function pe(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 he=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=pe(t,t.left,t.top),i=[];for(const e of r){const{id:t}=e,r=n.get(t);if(r){const n=se(pe(r),o);i.push({id:t,data:{droppableContainer:e,value:n}})}}return i.sort(ce)};function ge(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),a=o-r,l=i-n;if(r<o&&n<i){const n=t.width*t.height,r=e.width*e.height,o=a*l;return Number((o/(n+r-o)).toFixed(4))}return 0}const ve=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=ge(i,t);n>0&&o.push({id:r,data:{droppableContainer:e,value:n}})}}return o.sort(de)};function me(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:le}function be(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 ye=be(1);const we={ignoreTransform:!1};function xe(e,t){void 0===t&&(t=we);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:t,transformOrigin:r}=D(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:a,y:l}=r,s=e.left-a-(1-o)*parseFloat(n),c=e.top-l-(1-i)*parseFloat(n.slice(n.indexOf(" ")+1)),d=o?e.width/o:e.width,u=i?e.height/i:e.height;return{width:d,height:u,top:c,right:s+d,bottom:c+u,left:s}}(n,t,r))}const{top:r,left:o,width:i,height:a,bottom:l,right:s}=n;return{top:r,left:o,width:i,height:a,bottom:l,right:s}}function ke(e){return xe(e,{ignoreTransform:!0})}function Ee(e,t){const n=[];return e?function r(o){if(null!=t&&n.length>=t)return n;if(!o)return n;if(B(o)&&null!=o.scrollingElement&&!n.includes(o.scrollingElement))return n.push(o.scrollingElement),n;if(!T(o)||A(o))return n;if(n.includes(o))return n;const i=D(e).getComputedStyle(o);return o!==e&&function(e,t){void 0===t&&(t=D(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=D(e).getComputedStyle(e)),"fixed"===t.position}(o,i)?n:r(o.parentNode)}(e):n}function Ce(e){const[t]=Ee(e,1);return null!=t?t:null}function Oe(e){return j&&e?R(e)?e:_(e)?B(e)||e===M(e).scrollingElement?window:T(e)?e:null:null:null}function Se(e){return R(e)?e.scrollX:e.scrollLeft}function je(e){return R(e)?e.scrollY:e.scrollTop}function Re(e){return{x:Se(e),y:je(e)}}var _e;function De(e){return!(!j||!e)&&e===document.scrollingElement}function Be(e){const t={x:0,y:0},n=De(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"}(_e||(_e={}));const Te={x:.2,y:.2};function Ae(e,t,n,r,o){let{top:i,left:a,right:l,bottom:s}=n;void 0===r&&(r=10),void 0===o&&(o=Te);const{isTop:c,isBottom:d,isLeft:u,isRight:f}=Be(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=_e.Backward,h.y=r*Math.abs((t.top+g-i)/g)):!d&&s>=t.bottom-g&&(p.y=_e.Forward,h.y=r*Math.abs((t.bottom-g-s)/g)),!f&&l>=t.right-v?(p.x=_e.Forward,h.x=r*Math.abs((t.right-v-l)/v)):!u&&a<=t.left+v&&(p.x=_e.Backward,h.x=r*Math.abs((t.left+v-a)/v)),{direction:p,speed:h}}function Me(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 Le(e){return e.reduce(((e,t)=>Y(e,Re(t))),le)}const Ne=[["x",["left","right"],function(e){return e.reduce(((e,t)=>e+Se(t)),0)}],["y",["top","bottom"],function(e){return e.reduce(((e,t)=>e+je(t)),0)}]];class Pe{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=Ee(t),r=Le(n);this.rect={...e},this.width=e.width,this.height=e.height;for(const[e,t,o]of Ne)for(const i of t)Object.defineProperty(this,i,{get:()=>{const t=o(n),a=r[e]-t;return this.rect[i]+a},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Ie{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 ze(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 Fe,Ue;function He(e){e.preventDefault()}function Ve(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"}(Fe||(Fe={})),function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter"}(Ue||(Ue={}));const Ye={start:[Ue.Space,Ue.Enter],cancel:[Ue.Esc],end:[Ue.Space,Ue.Enter]},We=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case Ue.Right:return{...n,x:n.x+25};case Ue.Left:return{...n,x:n.x-25};case Ue.Down:return{...n,y:n.y+25};case Ue.Up:return{...n,y:n.y-25}}};class Ke{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 Ie(M(t)),this.windowListeners=new Ie(D(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Fe.Resize,this.handleCancel),this.windowListeners.add(Fe.VisibilityChange,this.handleCancel),setTimeout((()=>this.listeners.add(Fe.Keydown,this.handleKeyDown)))}handleStart(){const{activeNode:e,onStart:t}=this.props,n=e.node.current;n&&function(e,t){if(void 0===t&&(t=xe),!e)return;const{top:n,left:r,bottom:o,right:i}=t(e);Ce(e)&&(o<=0||i<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}(n),t(le)}handleKeyDown(e){if(K(e)){const{active:t,context:n,options:r}=this.props,{keyboardCodes:o=Ye,coordinateGetter:i=We,scrollBehavior:a="smooth"}=r,{code:l}=e;if(o.end.includes(l))return void this.handleEnd(e);if(o.cancel.includes(l))return void this.handleCancel(e);const{collisionRect:s}=n.current,c=s?{x:s.left,y:s.top}:le;this.referenceCoordinates||(this.referenceCoordinates=c);const d=i(e,{active:t,context:n.current,currentCoordinates:c});if(d){const t=W(d,c),r={x:0,y:0},{scrollableAncestors:o}=n.current;for(const n of o){const o=e.code,{isTop:i,isRight:l,isLeft:s,isBottom:c,maxScroll:u,minScroll:f}=Be(n),p=Me(n),h={x:Math.min(o===Ue.Right?p.right-p.width/2:p.right,Math.max(o===Ue.Right?p.left:p.left+p.width/2,d.x)),y:Math.min(o===Ue.Down?p.bottom-p.height/2:p.bottom,Math.max(o===Ue.Down?p.top:p.top+p.height/2,d.y))},g=o===Ue.Right&&!l||o===Ue.Left&&!s,v=o===Ue.Down&&!c||o===Ue.Up&&!i;if(g&&h.x!==d.x){const e=n.scrollLeft+t.x,i=o===Ue.Right&&e<=u.x||o===Ue.Left&&e>=f.x;if(i&&!t.y)return void n.scrollTo({left:e,behavior:a});r.x=i?n.scrollLeft-e:o===Ue.Right?n.scrollLeft-u.x:n.scrollLeft-f.x,r.x&&n.scrollBy({left:-r.x,behavior:a});break}if(v&&h.y!==d.y){const e=n.scrollTop+t.y,i=o===Ue.Down&&e<=u.y||o===Ue.Up&&e>=f.y;if(i&&!t.x)return void n.scrollTo({top:e,behavior:a});r.y=i?n.scrollTop-e:o===Ue.Down?n.scrollTop-u.y:n.scrollTop-f.y,r.y&&n.scrollBy({top:-r.y,behavior:a});break}}this.handleMove(e,Y(W(d,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 Xe(e){return Boolean(e&&"distance"in e)}function $e(e){return Boolean(e&&"delay"in e)}Ke.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=Ye,onActivation:o}=t,{active:i}=n;const{code:a}=e.nativeEvent;if(r.start.includes(a)){const t=i.activatorNode.current;return(!t||e.target===t)&&(e.preventDefault(),null==o||o({event:e.nativeEvent}),!0)}return!1}}];class qe{constructor(e,t,n){var r;void 0===n&&(n=function(e){const{EventTarget:t}=D(e);return e instanceof t?e:M(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=M(i),this.documentListeners=new Ie(this.document),this.listeners=new Ie(n),this.windowListeners=new Ie(D(i)),this.initialCoordinates=null!=(r=X(o))?r:le,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(Fe.Resize,this.handleCancel),this.windowListeners.add(Fe.DragStart,He),this.windowListeners.add(Fe.VisibilityChange,this.handleCancel),this.windowListeners.add(Fe.ContextMenu,He),this.documentListeners.add(Fe.Keydown,this.handleKeydown),t){if(null!=n&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if($e(t))return void(this.timeoutId=setTimeout(this.handleStart,t.delay));if(Xe(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(Fe.Click,Ve,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Fe.SelectionChange,this.removeTextSelection),t(e))}handleMove(e){var t;const{activated:n,initialCoordinates:r,props:o}=this,{onMove:i,options:{activationConstraint:a}}=o;if(!r)return;const l=null!=(t=X(e))?t:le,s=W(r,l);if(!n&&a){if(Xe(a)){if(null!=a.tolerance&&ze(s,a.tolerance))return this.handleCancel();if(ze(s,a.distance))return this.handleStart()}return $e(a)&&ze(s,a.tolerance)?this.handleCancel():void 0}e.cancelable&&e.preventDefault(),i(l)}handleEnd(){const{onEnd:e}=this.props;this.detach(),e()}handleCancel(){const{onCancel:e}=this.props;this.detach(),e()}handleKeydown(e){e.code===Ue.Esc&&this.handleCancel()}removeTextSelection(){var e;null==(e=this.document.getSelection())||e.removeAllRanges()}}const Ze={move:{name:"pointermove"},end:{name:"pointerup"}};class Ge extends qe{constructor(e){const{event:t}=e,n=M(t.target);super(e,Ze,n)}}Ge.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 Je={move:{name:"mousemove"},end:{name:"mouseup"}};var Qe;!function(e){e[e.RightClick=2]="RightClick"}(Qe||(Qe={}));(class extends qe{constructor(e){super(e,Je,M(e.event.target))}}).activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button!==Qe.RightClick&&(null==r||r({event:n}),!0)}}];const et={move:{name:"touchmove"},end:{name:"touchend"}};var tt,nt;function rt(e){let{acceleration:n,activator:r=tt.Pointer,canScroll:o,draggingRect:i,enabled:a,interval:l=5,order:s=nt.TreeOrder,pointerCoordinates:c,scrollableAncestors:d,scrollableAncestorRects:u,delta:f,threshold:p}=e;const h=function(e){let{delta:t,disabled:n}=e;const r=F(t);return I((e=>{if(n||!r||!e)return ot;const o={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[_e.Backward]:e.x[_e.Backward]||-1===o.x,[_e.Forward]:e.x[_e.Forward]||1===o.x},y:{[_e.Backward]:e.y[_e.Backward]||-1===o.y,[_e.Forward]:e.y[_e.Forward]||1===o.y}}}),[n,t,r])}({delta:f,disabled:!a}),[g,v]=function(){const e=t.useRef(null);return[t.useCallback(((t,n)=>{e.current=setInterval(t,n)}),[]),t.useCallback((()=>{null!==e.current&&(clearInterval(e.current),e.current=null)}),[])]}(),m=t.useRef({x:0,y:0}),b=t.useRef({x:0,y:0}),y=t.useMemo((()=>{switch(r){case tt.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case tt.DraggableRect:return i}}),[r,i,c]),w=t.useRef(null),x=t.useCallback((()=>{const e=w.current;if(!e)return;const t=m.current.x*b.current.x,n=m.current.y*b.current.y;e.scrollBy(t,n)}),[]),k=t.useMemo((()=>s===nt.TreeOrder?[...d].reverse():d),[s,d]);t.useEffect((()=>{if(a&&d.length&&y){for(const e of k){if(!1===(null==o?void 0:o(e)))continue;const t=d.indexOf(e),r=u[t];if(!r)continue;const{direction:i,speed:a}=Ae(e,r,y,n,p);for(const e of["x","y"])h[e][i[e]]||(a[e]=0,i[e]=0);if(a.x>0||a.y>0)return v(),w.current=e,g(x,l),m.current=a,void(b.current=i)}m.current={x:0,y:0},b.current={x:0,y:0},v()}else v()}),[n,x,o,v,a,l,JSON.stringify(y),JSON.stringify(h),g,d,k,u,JSON.stringify(p)])}(class extends qe{constructor(e){super(e,et)}static setup(){return window.addEventListener(et.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(et.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"}(tt||(tt={})),function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"}(nt||(nt={}));const ot={x:{[_e.Backward]:!1,[_e.Forward]:!1},y:{[_e.Backward]:!1,[_e.Forward]:!1}};var it,at;!function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"}(it||(it={})),function(e){e.Optimized="optimized"}(at||(at={}));const lt=new Map;function st(e,t){return I((n=>e?n||("function"==typeof t?t(e):e):null),[t,e])}function ct(e){let{callback:n,disabled:r}=e;const o=N(n),i=t.useMemo((()=>{if(r||"undefined"==typeof window||void 0===window.ResizeObserver)return;const{ResizeObserver:e}=window;return new e(o)}),[r]);return t.useEffect((()=>()=>null==i?void 0:i.disconnect()),[i]),i}function dt(e){return new Pe(xe(e),e)}function ut(e,n,r){void 0===n&&(n=dt);const[o,i]=t.useReducer((function(t){if(!e)return null;var o;if(!1===e.isConnected)return null!=(o=null!=t?t:r)?o:null;const i=n(e);if(JSON.stringify(t)===JSON.stringify(i))return t;return i}),null),a=function(e){let{callback:n,disabled:r}=e;const o=N(n),i=t.useMemo((()=>{if(r||"undefined"==typeof window||void 0===window.MutationObserver)return;const{MutationObserver:e}=window;return new e(o)}),[o,r]);return t.useEffect((()=>()=>null==i?void 0:i.disconnect()),[i]),i}({callback(t){if(e)for(const n of t){const{type:t,target:r}=n;if("childList"===t&&r instanceof HTMLElement&&r.contains(e)){i();break}}}}),l=ct({callback:i});return L((()=>{i(),e?(null==l||l.observe(e),null==a||a.observe(document.body,{childList:!0,subtree:!0})):(null==l||l.disconnect(),null==a||a.disconnect())}),[e]),o}const ft=[];function pt(e,n){void 0===n&&(n=[]);const r=t.useRef(null);return t.useEffect((()=>{r.current=null}),n),t.useEffect((()=>{const t=e!==le;t&&!r.current&&(r.current=e),!t&&r.current&&(r.current=null)}),[e]),r.current?W(e,r.current):le}function ht(e){return t.useMemo((()=>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 gt=[];function vt(e){let{measure:n}=e;const[r,o]=t.useState(null),i=t.useCallback((e=>{for(const{target:t}of e)if(T(t)){o((e=>{const r=n(t);return e?{...e,width:r.width,height:r.height}:r}));break}}),[n]),a=ct({callback:i}),l=t.useCallback((e=>{const t=function(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return T(t)?t:e}(e);null==a||a.disconnect(),t&&(null==a||a.observe(t)),o(t?n(t):null)}),[n,a]),[s,c]=z(l);return t.useMemo((()=>({nodeRef:s,rect:r,setRef:c})),[r,s,c])}const mt=[{sensor:Ge,options:{}},{sensor:Ke,options:{}}],bt={current:{}},yt={draggable:{measure:ke},droppable:{measure:ke,strategy:it.WhileDragging,frequency:at.Optimized},dragOverlay:{measure:xe}};class wt 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 xt={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new wt,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:ie},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:yt,measureDroppableContainers:ie,windowRect:null,measuringScheduled:!1},kt={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:ie,draggableNodes:new Map,over:null,measureDroppableContainers:ie},Et=t.createContext(kt),Ct=t.createContext(xt);function Ot(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new wt}}}function St(e,t){switch(t.type){case oe.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case oe.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 oe.DragEnd:case oe.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case oe.RegisterDroppable:{const{element:n}=t,{id:r}=n,o=new wt(e.droppable.containers);return o.set(r,n),{...e,droppable:{...e.droppable,containers:o}}}case oe.SetDroppableDisabled:{const{id:n,key:r,disabled:o}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;const a=new wt(e.droppable.containers);return a.set(n,{...i,disabled:o}),{...e,droppable:{...e.droppable,containers:a}}}case oe.UnregisterDroppable:{const{id:n,key:r}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const i=new wt(e.droppable.containers);return i.delete(n),{...e,droppable:{...e.droppable,containers:i}}}default:return e}}function jt(e){let{disabled:n}=e;const{active:r,activatorEvent:o,draggableNodes:i}=t.useContext(Et),a=F(o),l=F(null==r?void 0:r.id);return t.useEffect((()=>{if(!n&&!o&&a&&null!=l){if(!K(a))return;if(document.activeElement===a.target)return;const e=i.get(l);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=Z(e);if(t){t.focus();break}}}))}}),[o,n,i,l,a]),null}const Rt=t.createContext({...le,scaleX:1,scaleY:1});var _t;!function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"}(_t||(_t={}));const Dt=t.memo((function(e){var n,o,i,a;let{id:l,accessibility:s,autoScroll:c=!0,children:d,sensors:u=mt,collisionDetection:f=ve,measuring:p,modifiers:h,...g}=e;const v=t.useReducer(St,void 0,Ot),[m,b]=v,[y,w]=function(){const[e]=t.useState((()=>new Set)),n=t.useCallback((t=>(e.add(t),()=>e.delete(t))),[e]);return[t.useCallback((t=>{let{type:n,event:r}=t;e.forEach((e=>{var t;return null==(t=e[n])?void 0:t.call(e,r)}))}),[e]),n]}(),[x,k]=t.useState(_t.Uninitialized),E=x===_t.Initialized,{draggable:{active:C,nodes:O,translate:S},droppable:{containers:R}}=m,_=C?O.get(C):null,B=t.useRef({initial:null,translated:null}),T=t.useMemo((()=>{var e;return null!=C?{id:C,data:null!=(e=null==_?void 0:_.data)?e:bt,rect:B}:null}),[C,_]),A=t.useRef(null),[M,N]=t.useState(null),[z,F]=t.useState(null),U=P(g,Object.values(g)),V=H("DndDescribedBy",l),W=t.useMemo((()=>R.getEnabled()),[R]),K=($=p,t.useMemo((()=>({draggable:{...yt.draggable,...null==$?void 0:$.draggable},droppable:{...yt.droppable,...null==$?void 0:$.droppable},dragOverlay:{...yt.dragOverlay,...null==$?void 0:$.dragOverlay}})),[null==$?void 0:$.draggable,null==$?void 0:$.droppable,null==$?void 0:$.dragOverlay]));var $;const{droppableRects:q,measureDroppableContainers:Z,measuringScheduled:G}=function(e,n){let{dragging:r,dependencies:o,config:i}=n;const[a,l]=t.useState(null),{frequency:s,measure:c,strategy:d}=i,u=t.useRef(e),f=function(){switch(d){case it.Always:return!1;case it.BeforeDragging:return r;default:return!r}}(),p=P(f),h=t.useCallback((function(e){void 0===e&&(e=[]),p.current||l((t=>null===t?e:t.concat(e.filter((e=>!t.includes(e))))))}),[p]),g=t.useRef(null),v=I((t=>{if(f&&!r)return lt;if(!t||t===lt||u.current!==e||null!=a){const t=new Map;for(let n of e){if(!n)continue;if(a&&a.length>0&&!a.includes(n.id)&&n.rect.current){t.set(n.id,n.rect.current);continue}const e=n.node.current,r=e?new Pe(c(e),e):null;n.rect.current=r,r&&t.set(n.id,r)}return t}return t}),[e,a,r,f,c]);return t.useEffect((()=>{u.current=e}),[e]),t.useEffect((()=>{f||h()}),[r,f]),t.useEffect((()=>{a&&a.length>0&&l(null)}),[JSON.stringify(a)]),t.useEffect((()=>{f||"number"!=typeof s||null!==g.current||(g.current=setTimeout((()=>{h(),g.current=null}),s))}),[s,f,h,...o]),{droppableRects:v,measureDroppableContainers:h,measuringScheduled:null!=a}}(W,{dragging:E,dependencies:[S.x,S.y],config:K.droppable}),J=function(e,t){const n=null!==t?e.get(t):void 0,r=n?n.node.current:null;return I((e=>{var n;return null===t?null:null!=(n=null!=r?r:e)?n:null}),[r,t])}(O,C),Q=t.useMemo((()=>z?X(z):null),[z]),te=function(){const e=!1===(null==M?void 0:M.autoScrollEnabled),t="object"==typeof c?!1===c.enabled:!1===c,n=E&&!e&&!t;if("object"==typeof c)return{...c,enabled:n};return{enabled:n}}(),ne=function(e,t){return st(e,t)}(J,K.draggable.measure);!function(e){let{activeNode:n,measure:r,initialRect:o,config:i=!0}=e;const a=t.useRef(!1),{x:l,y:s}="boolean"==typeof i?{x:i,y:i}:i;L((()=>{if(!l&&!s||!n)return void(a.current=!1);if(a.current||!o)return;const e=null==n?void 0:n.node.current;if(!e||!1===e.isConnected)return;const t=me(r(e),o);if(l||(t.x=0),s||(t.y=0),a.current=!0,Math.abs(t.x)>0||Math.abs(t.y)>0){const n=Ce(e);n&&n.scrollBy({top:t.y,left:t.x})}}),[n,l,s,o,r])}({activeNode:C?O.get(C):null,config:te.layoutShiftCompensation,initialRect:ne,measure:K.draggable.measure});const ie=ut(J,K.draggable.measure,ne),ae=ut(J?J.parentElement:null),se=t.useRef({activatorEvent:null,active:null,activeNode:J,collisionRect:null,collisions:null,droppableRects:q,draggableNodes:O,draggingNode:null,draggingNodeRect:null,droppableContainers:R,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),ce=R.getNodeFor(null==(n=se.current.over)?void 0:n.id),de=vt({measure:K.dragOverlay.measure}),ue=null!=(o=de.nodeRef.current)?o:J,pe=E?null!=(i=de.rect)?i:ie:null,he=Boolean(de.nodeRef.current&&de.rect),ge=me(be=he?null:ie,st(be));var be;const we=ht(ue?D(ue):null),ke=function(e){const n=t.useRef(e),r=I((t=>e?t&&t!==ft&&e&&n.current&&e.parentNode===n.current.parentNode?t:Ee(e):ft),[e]);return t.useEffect((()=>{n.current=e}),[e]),r}(E?null!=ce?ce:J:null),Se=function(e,n){void 0===n&&(n=xe);const[r]=e,o=ht(r?D(r):null),[i,a]=t.useReducer((function(){return e.length?e.map((e=>De(e)?o:new Pe(n(e),e))):gt}),gt),l=ct({callback:a});return e.length>0&&i===gt&&a(),L((()=>{e.length?e.forEach((e=>null==l?void 0:l.observe(e))):(null==l||l.disconnect(),a())}),[e]),i}(ke),je=function(e,t){let{transform:n,...r}=t;return null!=e&&e.length?e.reduce(((e,t)=>t({transform:e,...r})),n):n}(h,{transform:{x:S.x-ge.x,y:S.y-ge.y,scaleX:1,scaleY:1},activatorEvent:z,active:T,activeNodeRect:ie,containerNodeRect:ae,draggingNodeRect:pe,over:se.current.over,overlayNodeRect:de.rect,scrollableAncestors:ke,scrollableAncestorRects:Se,windowRect:we}),_e=Q?Y(Q,S):null,Be=function(e){const[n,r]=t.useState(null),o=t.useRef(e),i=t.useCallback((e=>{const t=Oe(e.target);t&&r((e=>e?(e.set(t,Re(t)),new Map(e)):null))}),[]);return t.useEffect((()=>{const t=o.current;if(e!==t){n(t);const a=e.map((e=>{const t=Oe(e);return t?(t.addEventListener("scroll",i,{passive:!0}),[t,Re(t)]):null})).filter((e=>null!=e));r(a.length?new Map(a):null),o.current=e}return()=>{n(e),n(t)};function n(e){e.forEach((e=>{const t=Oe(e);null==t||t.removeEventListener("scroll",i)}))}}),[i,e]),t.useMemo((()=>e.length?n?Array.from(n.values()).reduce(((e,t)=>Y(e,t)),le):Le(e):le),[e,n])}(ke),Te=pt(Be),Ae=pt(Be,[ie]),Me=Y(je,Te),Ne=pe?ye(pe,je):null,Ie=T&&Ne?f({active:T,collisionRect:Ne,droppableRects:q,droppableContainers:W,pointerCoordinates:_e}):null,ze=fe(Ie,"id"),[Fe,Ue]=t.useState(null),He=function(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}(he?je:Y(je,Ae),null!=(a=null==Fe?void 0:Fe.rect)?a:null,ie),Ve=t.useCallback(((e,t)=>{let{sensor:n,options:o}=t;if(null==A.current)return;const i=O.get(A.current);if(!i)return;const a=e.nativeEvent,l=new n({active:A.current,activeNode:i,event:a,options:o,context:se,onStart(e){const t=A.current;if(null==t)return;const n=O.get(t);if(!n)return;const{onDragStart:o}=U.current,i={active:{id:t,data:n.data,rect:B}};r.unstable_batchedUpdates((()=>{null==o||o(i),k(_t.Initializing),b({type:oe.DragStart,initialCoordinates:e,active:t}),y({type:"onDragStart",event:i})}))},onMove(e){b({type:oe.DragMove,coordinates:e})},onEnd:s(oe.DragEnd),onCancel:s(oe.DragCancel)});function s(e){return async function(){const{active:t,collisions:n,over:o,scrollAdjustedTranslate:i}=se.current;let l=null;if(t&&i){const{cancelDrop:r}=U.current;if(l={activatorEvent:a,active:t,collisions:n,delta:i,over:o},e===oe.DragEnd&&"function"==typeof r){await Promise.resolve(r(l))&&(e=oe.DragCancel)}}A.current=null,r.unstable_batchedUpdates((()=>{b({type:e}),k(_t.Uninitialized),Ue(null),N(null),F(null);const t=e===oe.DragEnd?"onDragEnd":"onDragCancel";if(l){const e=U.current[t];null==e||e(l),y({type:t,event:l})}}))}}r.unstable_batchedUpdates((()=>{N(l),F(e.nativeEvent)}))}),[O]),Ye=t.useCallback(((e,t)=>(n,r)=>{const o=n.nativeEvent,i=O.get(r);if(null!==A.current||!i||o.dndKit||o.defaultPrevented)return;const a={active:i};!0===e(n,t.options,a)&&(o.dndKit={capturedBy:t.sensor},A.current=r,Ve(n,t))}),[O,Ve]),We=function(e,n){return t.useMemo((()=>e.reduce(((e,t)=>{const{sensor:r}=t;return[...e,...r.activators.map((e=>({eventName:e.eventName,handler:n(e.handler,t)})))]}),[])),[e,n])}(u,Ye);!function(e){t.useEffect((()=>{if(!j)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})))}(u),L((()=>{ie&&x===_t.Initializing&&k(_t.Initialized)}),[ie,x]),t.useEffect((()=>{const{onDragMove:e}=U.current,{active:t,activatorEvent:n,collisions:o,over:i}=se.current;if(!t||!n)return;const a={active:t,activatorEvent:n,collisions:o,delta:{x:Me.x,y:Me.y},over:i};r.unstable_batchedUpdates((()=>{null==e||e(a),y({type:"onDragMove",event:a})}))}),[Me.x,Me.y]),t.useEffect((()=>{const{active:e,activatorEvent:t,collisions:n,droppableContainers:o,scrollAdjustedTranslate:i}=se.current;if(!e||null==A.current||!t||!i)return;const{onDragOver:a}=U.current,l=o.get(ze),s=l&&l.rect.current?{id:l.id,rect:l.rect.current,data:l.data,disabled:l.disabled}:null,c={active:e,activatorEvent:t,collisions:n,delta:{x:i.x,y:i.y},over:s};r.unstable_batchedUpdates((()=>{Ue(s),null==a||a(c),y({type:"onDragOver",event:c})}))}),[ze]),L((()=>{se.current={activatorEvent:z,active:T,activeNode:J,collisionRect:Ne,collisions:Ie,droppableRects:q,draggableNodes:O,draggingNode:ue,draggingNodeRect:pe,droppableContainers:R,over:Fe,scrollableAncestors:ke,scrollAdjustedTranslate:Me},B.current={initial:pe,translated:Ne}}),[T,J,Ie,Ne,O,ue,pe,q,R,Fe,ke,Me]),rt({...te,delta:S,draggingRect:Ne,pointerCoordinates:_e,scrollableAncestors:ke,scrollableAncestorRects:Se});const Ke=t.useMemo((()=>({active:T,activeNode:J,activeNodeRect:ie,activatorEvent:z,collisions:Ie,containerNodeRect:ae,dragOverlay:de,draggableNodes:O,droppableContainers:R,droppableRects:q,over:Fe,measureDroppableContainers:Z,scrollableAncestors:ke,scrollableAncestorRects:Se,measuringConfiguration:K,measuringScheduled:G,windowRect:we})),[T,J,ie,z,Ie,ae,de,O,R,q,Fe,Z,ke,Se,K,G,we]),Xe=t.useMemo((()=>({activatorEvent:z,activators:We,active:T,activeNodeRect:ie,ariaDescribedById:{draggable:V},dispatch:b,draggableNodes:O,over:Fe,measureDroppableContainers:Z})),[z,We,T,ie,b,V,O,Fe,Z]);return t.createElement(ee.Provider,{value:w},t.createElement(Et.Provider,{value:Xe},t.createElement(Ct.Provider,{value:Ke},t.createElement(Rt.Provider,{value:He},d)),t.createElement(jt,{disabled:!1===(null==s?void 0:s.restoreFocus)})),t.createElement(re,{...s,hiddenTextDescribedById:V}))})),Bt=t.createContext(null),Tt="button",At="Droppable";function Mt(e){let{id:n,data:r,disabled:o=!1,attributes:i}=e;const a=H(At),{activators:l,activatorEvent:s,active:c,activeNodeRect:d,ariaDescribedById:u,draggableNodes:f,over:p}=t.useContext(Et),{role:h=Tt,roleDescription:g="draggable",tabIndex:v=0}=null!=i?i:{},m=(null==c?void 0:c.id)===n,b=t.useContext(m?Rt:Bt),[y,w]=z(),[x,k]=z(),E=function(e,n){return t.useMemo((()=>e.reduce(((e,t)=>{let{eventName:r,handler:o}=t;return e[r]=e=>{o(e,n)},e}),{})),[e,n])}(l,n),C=P(r);L((()=>(f.set(n,{id:n,key:a,node:y,activatorNode:x,data:C}),()=>{const e=f.get(n);e&&e.key===a&&f.delete(n)})),[f,n]);return{active:c,activatorEvent:s,activeNodeRect:d,attributes:t.useMemo((()=>({role:h,tabIndex:v,"aria-disabled":o,"aria-pressed":!(!m||h!==Tt)||void 0,"aria-roledescription":g,"aria-describedby":u.draggable})),[o,h,v,m,g,u.draggable]),isDragging:m,listeners:o?void 0:E,node:y,over:p,setNodeRef:w,setActivatorNodeRef:k,transform:b}}const Lt="Droppable",Nt={timeout:25};function Pt(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function It(e,t){return e.reduce(((e,n,r)=>{const o=t.get(n);return o&&(e[r]=o),e}),Array(e.length))}function zt(e){return null!==e&&e>=0}const Ft=e=>{let{rects:t,activeIndex:n,overIndex:r,index:o}=e;const i=Pt(t,r,n),a=t[o],l=i[o];return l&&a?{x:l.left-a.left,y:l.top-a.top,scaleX:l.width/a.width,scaleY:l.height/a.height}:null},Ut={scaleX:1,scaleY:1},Ht=e=>{var t;let{activeIndex:n,activeNodeRect:r,index:o,rects:i,overIndex:a}=e;const l=null!=(t=i[n])?t:r;if(!l)return null;if(o===n){const e=i[a];return e?{x:0,y:n<a?e.top+e.height-(l.top+l.height):e.top-l.top,...Ut}: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<=a?{x:0,y:-l.height-s,...Ut}:o<n&&o>=a?{x:0,y:l.height+s,...Ut}:{x:0,y:0,...Ut}};const Vt="Sortable",Yt=t.createContext({activeIndex:-1,containerId:Vt,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Ft,disabled:{draggable:!1,droppable:!1}});function Wt(e){let{children:n,id:r,items:o,strategy:i=Ft,disabled:a=!1}=e;const{active:l,dragOverlay:s,droppableRects:c,over:d,measureDroppableContainers:u}=t.useContext(Ct),f=H(Vt,r),p=Boolean(null!==s.rect),h=t.useMemo((()=>o.map((e=>"object"==typeof e&&"id"in e?e.id:e))),[o]),g=null!=l,v=l?h.indexOf(l.id):-1,m=d?h.indexOf(d.id):-1,b=t.useRef(h),y=!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}(h,b.current),w=-1!==m&&-1===v||y,x=function(e){return"boolean"==typeof e?{draggable:e,droppable:e}:e}(a);L((()=>{y&&g&&u(h)}),[y,h,g,u]),t.useEffect((()=>{b.current=h}),[h]);const k=t.useMemo((()=>({activeIndex:v,containerId:f,disabled:x,disableTransforms:w,items:h,overIndex:m,useDragOverlay:p,sortedRects:It(h,c),strategy:i})),[v,f,x.draggable,x.droppable,w,h,m,c,p,i]);return t.createElement(Yt.Provider,{value:k},n)}const Kt=e=>{let{id:t,items:n,activeIndex:r,overIndex:o}=e;return Pt(n,r,o).indexOf(t)},Xt=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:o,items:i,newIndex:a,previousItems:l,previousContainerId:s,transition:c}=e;return!(!c||!r)&&((l===i||o!==a)&&(!!n||a!==o&&t===s))},$t={duration:200,easing:"ease"},qt="transform",Zt=$.Transition.toString({property:qt,duration:0,easing:"linear"}),Gt={roleDescription:"sortable"};function Jt(e){let{animateLayoutChanges:n=Xt,attributes:r,disabled:o,data:i,getNewIndex:a=Kt,id:l,strategy:s,resizeObserverConfig:c,transition:d=$t}=e;const{items:u,containerId:f,activeIndex:p,disabled:h,disableTransforms:g,sortedRects:v,overIndex:m,useDragOverlay:b,strategy:y}=t.useContext(Yt),w=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}}(o,h),x=u.indexOf(l),k=t.useMemo((()=>({sortable:{containerId:f,index:x,items:u},...i})),[f,i,x,u]),E=t.useMemo((()=>u.slice(u.indexOf(l))),[u,l]),{rect:C,node:O,isOver:S,setNodeRef:j}=function(e){let{data:n,disabled:r=!1,id:o,resizeObserverConfig:i}=e;const a=H(Lt),{active:l,dispatch:s,over:c,measureDroppableContainers:d}=t.useContext(Et),u=t.useRef({disabled:r}),f=t.useRef(!1),p=t.useRef(null),h=t.useRef(null),{disabled:g,updateMeasurementsFor:v,timeout:m}={...Nt,...i},b=P(null!=v?v:o),y=ct({callback:t.useCallback((()=>{f.current?(null!=h.current&&clearTimeout(h.current),h.current=setTimeout((()=>{d(Array.isArray(b.current)?b.current:[b.current]),h.current=null}),m)):f.current=!0}),[m]),disabled:g||!l}),w=t.useCallback(((e,t)=>{y&&(t&&(y.unobserve(t),f.current=!1),e&&y.observe(e))}),[y]),[x,k]=z(w),E=P(n);return t.useEffect((()=>{y&&x.current&&(y.disconnect(),f.current=!1,y.observe(x.current))}),[x,y]),L((()=>(s({type:oe.RegisterDroppable,element:{id:o,key:a,disabled:r,node:x,rect:p,data:E}}),()=>s({type:oe.UnregisterDroppable,key:a,id:o}))),[o]),t.useEffect((()=>{r!==u.current.disabled&&(s({type:oe.SetDroppableDisabled,id:o,key:a,disabled:r}),u.current.disabled=r)}),[o,a,r,s]),{active:l,rect:p,isOver:(null==c?void 0:c.id)===o,node:x,over:c,setNodeRef:k}}({id:l,data:k,disabled:w.droppable,resizeObserverConfig:{updateMeasurementsFor:E,...c}}),{active:R,activatorEvent:_,activeNodeRect:D,attributes:B,setNodeRef:T,listeners:A,isDragging:M,over:N,setActivatorNodeRef:I,transform:F}=Mt({id:l,data:k,attributes:{...Gt,...r},disabled:w.draggable}),U=function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return t.useMemo((()=>e=>{n.forEach((t=>t(e)))}),n)}(j,T),V=Boolean(R),Y=V&&!g&&zt(p)&&zt(m),W=!b&&M,X=W&&Y?F:null,q=Y?null!=X?X:(null!=s?s:y)({rects:v,activeNodeRect:D,activeIndex:p,overIndex:m,index:x}):null,Z=zt(p)&&zt(m)?a({id:l,items:u,activeIndex:p,overIndex:m}):x,G=null==R?void 0:R.id,J=t.useRef({activeId:G,items:u,newIndex:Z,containerId:f}),Q=u!==J.current.items,ee=n({active:R,containerId:f,isDragging:M,isSorting:V,id:l,index:x,items:u,newIndex:J.current.newIndex,previousItems:J.current.items,previousContainerId:J.current.containerId,transition:d,wasDragging:null!=J.current.activeId}),te=function(e){let{disabled:n,index:r,node:o,rect:i}=e;const[a,l]=t.useState(null),s=t.useRef(r);return L((()=>{if(!n&&r!==s.current&&o.current){const e=i.current;if(e){const t=xe(o.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)}}r!==s.current&&(s.current=r)}),[n,r,o,i]),t.useEffect((()=>{a&&l(null)}),[a]),a}({disabled:!ee,index:x,node:O,rect:C});return t.useEffect((()=>{V&&J.current.newIndex!==Z&&(J.current.newIndex=Z),f!==J.current.containerId&&(J.current.containerId=f),u!==J.current.items&&(J.current.items=u)}),[V,Z,f,u]),t.useEffect((()=>{if(G===J.current.activeId)return;if(G&&!J.current.activeId)return void(J.current.activeId=G);const e=setTimeout((()=>{J.current.activeId=G}),50);return()=>clearTimeout(e)}),[G]),{active:R,activeIndex:p,attributes:B,data:k,rect:C,index:x,newIndex:Z,items:u,isOver:S,isSorting:V,isDragging:M,listeners:A,node:O,overIndex:m,over:N,setNodeRef:U,setActivatorNodeRef:I,setDroppableNodeRef:j,setDraggableNodeRef:T,transform:null!=te?te:q,transition:function(){if(te||Q&&J.current.newIndex===x)return Zt;if(W&&!K(_)||!d)return;if(V||ee)return $.Transition.toString({...d,property:qt});return}()}}function Qt(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 en=[Ue.Down,Ue.Right,Ue.Up,Ue.Left],tn=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:o,droppableContainers:i,over:a,scrollableAncestors:l}}=t;if(en.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 Ue.Down:r.top<i.top&&t.push(n);break;case Ue.Up:r.top>i.top&&t.push(n);break;case Ue.Left:r.left>i.left&&t.push(n);break;case Ue.Right:r.left<i.left&&t.push(n)}}));const s=(e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=ue(t),i=[];for(const e of r){const{id:t}=e,r=n.get(t);if(r){const n=ue(r),a=o.reduce(((e,t,r)=>e+se(n[r],t)),0),l=Number((a/4).toFixed(4));i.push({id:t,data:{droppableContainer:e,value:l}})}}return i.sort(ce)})({active:n,collisionRect:r,droppableRects:o,droppableContainers:t,pointerCoordinates:null});let c=fe(s,"id");if(c===(null==a?void 0:a.id)&&s.length>1&&(c=s[1].id),null!=c){const e=i.get(n.id),t=i.get(c),a=t?o.get(t.id):null,s=null==t?void 0:t.node.current;if(s&&a&&e&&t){const n=Ee(s).some(((e,t)=>l[t]!==e)),o=nn(e,t),i=function(e,t){if(!Qt(e)||!Qt(t))return!1;if(!nn(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-a.width:0,y:i?r.height-a.height:0},d={x:a.left,y:a.top};return c.x&&c.y?d:W(d,c)}}}};function nn(e,t){return!(!Qt(e)||!Qt(t))&&e.data.current.sortable.containerId===t.data.current.sortable.containerId}var rn;function on(){return on=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},on.apply(this,arguments)}var an,ln=function(e){return l.createElement("svg",on({viewBox:"0 0 10 10",fill:"currentColor",style:{width:14,height:14,display:"block",flexShrink:0,backfaceVisibility:"hidden"}},e),rn||(rn=l.createElement("path",{d:"M3 2a1 1 0 1 1 0-2 1 1 0 0 1 0 2Zm0 4a1 1 0 1 1 0-2 1 1 0 0 1 0 2Zm0 4a1 1 0 1 1 0-2 1 1 0 0 1 0 2Zm4-8a1 1 0 1 1 0-2 1 1 0 0 1 0 2Zm0 4a1 1 0 1 1 0-2 1 1 0 0 1 0 2Zm0 4a1 1 0 1 1 0-2 1 1 0 0 1 0 2Z"})))};function sn(){return sn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},sn.apply(this,arguments)}var cn=function(e){return l.createElement("svg",sn({viewBox:"0 0 16 16",fill:"currentColor",style:{width:16,height:16,display:"block",flexShrink:0,backfaceVisibility:"hidden"}},e),an||(an=l.createElement("path",{d:"M7.977 14.963c.407 0 .747-.324.747-.723V8.72h5.362c.399 0 .74-.34.74-.747a.746.746 0 0 0-.74-.738H8.724V1.706c0-.398-.34-.722-.747-.722a.732.732 0 0 0-.739.722v5.529h-5.37a.746.746 0 0 0-.74.738c0 .407.341.747.74.747h5.37v5.52c0 .399.332.723.739.723z"})))};function dn(e,t={}){const n=Object.keys(e.children),{at:r=e.selection}=t,o=n.find((t=>e.children[t].meta.order===(null==r?void 0:r[0])));if(o)return e.blockEditorsMap[o]}function un(e){return hn(e)?(e.nodeName||"").toLowerCase():"#document"}function fn(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function pn(e){var t;return null==(t=(hn(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function hn(e){return e instanceof Node||e instanceof fn(e).Node}function gn(e){return e instanceof Element||e instanceof fn(e).Element}function vn(e){return e instanceof HTMLElement||e instanceof fn(e).HTMLElement}function mn(e){return"undefined"!=typeof ShadowRoot&&(e instanceof ShadowRoot||e instanceof fn(e).ShadowRoot)}function bn(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=En(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function yn(e){return["table","td","th"].includes(un(e))}function wn(e){const t=xn(),n=En(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 xn(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}function kn(e){return["html","body","#document"].includes(un(e))}function En(e){return fn(e).getComputedStyle(e)}function Cn(e){return gn(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function On(e){if("html"===un(e))return e;const t=e.assignedSlot||e.parentNode||mn(e)&&e.host||pn(e);return mn(t)?t.host:t}function Sn(e){const t=On(e);return kn(t)?e.ownerDocument?e.ownerDocument.body:e.body:vn(t)&&bn(t)?t:Sn(t)}function jn(e,t,n){var r;void 0===t&&(t=[]),void 0===n&&(n=!0);const o=Sn(e),i=o===(null==(r=e.ownerDocument)?void 0:r.body),a=fn(o);return i?t.concat(a,a.visualViewport||[],bn(o)?o:[],a.frameElement&&n?jn(a.frameElement):[]):t.concat(o,jn(o,[],n))}const Rn=Math.min,_n=Math.max,Dn=Math.round,Bn=Math.floor,Tn=e=>({x:e,y:e}),An={left:"right",right:"left",bottom:"top",top:"bottom"},Mn={start:"end",end:"start"};function Ln(e,t,n){return _n(e,Rn(t,n))}function Nn(e,t){return"function"==typeof e?e(t):e}function Pn(e){return e.split("-")[0]}function In(e){return e.split("-")[1]}function zn(e){return"x"===e?"y":"x"}function Fn(e){return"y"===e?"height":"width"}function Un(e){return["top","bottom"].includes(Pn(e))?"y":"x"}function Hn(e){return zn(Un(e))}function Vn(e){return e.replace(/start|end/g,(e=>Mn[e]))}function Yn(e){return e.replace(/left|right|bottom|top/g,(e=>An[e]))}function Wn(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 Kn(e){return{...e,top:e.y,left:e.x,right:e.x+e.width,bottom:e.y+e.height}}function Xn(e,t,n){let{reference:r,floating:o}=e;const i=Un(t),a=Hn(t),l=Fn(a),s=Pn(t),c="y"===i,d=r.x+r.width/2-o.width/2,u=r.y+r.height/2-o.height/2,f=r[l]/2-o[l]/2;let p;switch(s){case"top":p={x:d,y:r.y-o.height};break;case"bottom":p={x:d,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:u};break;case"left":p={x:r.x-o.width,y:u};break;default:p={x:r.x,y:r.y}}switch(In(t)){case"start":p[a]-=f*(n&&c?-1:1);break;case"end":p[a]+=f*(n&&c?-1:1)}return p}async function $n(e,t){var n;void 0===t&&(t={});const{x:r,y:o,platform:i,rects:a,elements:l,strategy:s}=e,{boundary:c="clippingAncestors",rootBoundary:d="viewport",elementContext:u="floating",altBoundary:f=!1,padding:p=0}=Nn(t,e),h=Wn(p),g=l[f?"floating"===u?"reference":"floating":u],v=Kn(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(l.floating)),boundary:c,rootBoundary:d,strategy:s})),m="floating"===u?{...a.floating,x:r,y:o}:a.reference,b=await(null==i.getOffsetParent?void 0:i.getOffsetParent(l.floating)),y=await(null==i.isElement?void 0:i.isElement(b))&&await(null==i.getScale?void 0:i.getScale(b))||{x:1,y:1},w=Kn(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:m,offsetParent:b,strategy:s}):m);return{top:(v.top-w.top+h.top)/y.y,bottom:(w.bottom-v.bottom+h.bottom)/y.y,left:(v.left-w.left+h.left)/y.x,right:(w.right-v.right+h.right)/y.x}}function qn(e){const t=Rn(...e.map((e=>e.left))),n=Rn(...e.map((e=>e.top)));return{x:t,y:n,width:_n(...e.map((e=>e.right)))-t,height:_n(...e.map((e=>e.bottom)))-n}}const Zn=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:i,placement:a,middlewareData:l}=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)),a=Pn(n),l=In(n),s="y"===Un(n),c=["left","top"].includes(a)?-1:1,d=i&&s?-1:1,u=Nn(t,e);let{mainAxis:f,crossAxis:p,alignmentAxis:h}="number"==typeof u?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...u};return l&&"number"==typeof h&&(p="end"===l?-1*h:h),s?{x:p*d,y:f*c}:{x:f*c,y:p*d}}(t,e);return a===(null==(n=l.offset)?void 0:n.placement)&&null!=(r=l.arrow)&&r.alignmentOffset?{}:{x:o+s.x,y:i+s.y,data:{...s,placement:a}}}}};function Gn(e){const t=En(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=vn(e),i=o?e.offsetWidth:n,a=o?e.offsetHeight:r,l=Dn(n)!==i||Dn(r)!==a;return l&&(n=i,r=a),{width:n,height:r,$:l}}function Jn(e){return gn(e)?e:e.contextElement}function Qn(e){const t=Jn(e);if(!vn(t))return Tn(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=Gn(t);let a=(i?Dn(n.width):n.width)/r,l=(i?Dn(n.height):n.height)/o;return a&&Number.isFinite(a)||(a=1),l&&Number.isFinite(l)||(l=1),{x:a,y:l}}const er=Tn(0);function tr(e){const t=fn(e);return xn()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:er}function nr(e,t,n,r){void 0===t&&(t=!1),void 0===n&&(n=!1);const o=e.getBoundingClientRect(),i=Jn(e);let a=Tn(1);t&&(r?gn(r)&&(a=Qn(r)):a=Qn(e));const l=function(e,t,n){return void 0===t&&(t=!1),!(!n||t&&n!==fn(e))&&t}(i,n,r)?tr(i):Tn(0);let s=(o.left+l.x)/a.x,c=(o.top+l.y)/a.y,d=o.width/a.x,u=o.height/a.y;if(i){const e=fn(i),t=r&&gn(r)?fn(r):r;let n=e,o=n.frameElement;for(;o&&r&&t!==n;){const e=Qn(o),t=o.getBoundingClientRect(),r=En(o),i=t.left+(o.clientLeft+parseFloat(r.paddingLeft))*e.x,a=t.top+(o.clientTop+parseFloat(r.paddingTop))*e.y;s*=e.x,c*=e.y,d*=e.x,u*=e.y,s+=i,c+=a,n=fn(o),o=n.frameElement}}return Kn({width:d,height:u,x:s,y:c})}const rr=[":popover-open",":modal"];function or(e){return rr.some((t=>{try{return e.matches(t)}catch(e){return!1}}))}function ir(e){return nr(pn(e)).left+Cn(e).scrollLeft}function ar(e,t,n){let r;if("viewport"===t)r=function(e,t){const n=fn(e),r=pn(e),o=n.visualViewport;let i=r.clientWidth,a=r.clientHeight,l=0,s=0;if(o){i=o.width,a=o.height;const e=xn();(!e||e&&"fixed"===t)&&(l=o.offsetLeft,s=o.offsetTop)}return{width:i,height:a,x:l,y:s}}(e,n);else if("document"===t)r=function(e){const t=pn(e),n=Cn(e),r=e.ownerDocument.body,o=_n(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=_n(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let a=-n.scrollLeft+ir(e);const l=-n.scrollTop;return"rtl"===En(r).direction&&(a+=_n(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:a,y:l}}(pn(e));else if(gn(t))r=function(e,t){const n=nr(e,!0,"fixed"===t),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=vn(e)?Qn(e):Tn(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=tr(e);r={...t,x:t.x-n.x,y:t.y-n.y}}return Kn(r)}function lr(e,t){const n=On(e);return!(n===t||!gn(n)||kn(n))&&("fixed"===En(n).position||lr(n,t))}function sr(e,t,n){const r=vn(t),o=pn(t),i="fixed"===n,a=nr(e,!0,i,t);let l={scrollLeft:0,scrollTop:0};const s=Tn(0);if(r||!r&&!i)if(("body"!==un(t)||bn(o))&&(l=Cn(t)),r){const e=nr(t,!0,i,t);s.x=e.x+t.clientLeft,s.y=e.y+t.clientTop}else o&&(s.x=ir(o));return{x:a.left+l.scrollLeft-s.x,y:a.top+l.scrollTop-s.y,width:a.width,height:a.height}}function cr(e,t){return vn(e)&&"fixed"!==En(e).position?t?t(e):e.offsetParent:null}function dr(e,t){const n=fn(e);if(!vn(e)||or(e))return n;let r=cr(e,t);for(;r&&yn(r)&&"static"===En(r).position;)r=cr(r,t);return r&&("html"===un(r)||"body"===un(r)&&"static"===En(r).position&&!wn(r))?n:r||function(e){let t=On(e);for(;vn(t)&&!kn(t);){if(wn(t))return t;t=On(t)}return null}(e)||n}const ur={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i="fixed"===o,a=pn(r),l=!!t&&or(t.floating);if(r===a||l&&i)return n;let s={scrollLeft:0,scrollTop:0},c=Tn(1);const d=Tn(0),u=vn(r);if((u||!u&&!i)&&(("body"!==un(r)||bn(a))&&(s=Cn(r)),vn(r))){const e=nr(r);c=Qn(r),d.x=e.x+r.clientLeft,d.y=e.y+r.clientTop}return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-s.scrollLeft*c.x+d.x,y:n.y*c.y-s.scrollTop*c.y+d.y}},getDocumentElement:pn,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=jn(e,[],!1).filter((e=>gn(e)&&"body"!==un(e))),o=null;const i="fixed"===En(e).position;let a=i?On(e):e;for(;gn(a)&&!kn(a);){const t=En(a),n=wn(a);n||"fixed"!==t.position||(o=null),(i?!n&&!o:!n&&"static"===t.position&&o&&["absolute","fixed"].includes(o.position)||bn(a)&&!n&&lr(e,a))?r=r.filter((e=>e!==a)):o=t,a=On(a)}return t.set(e,r),r}(t,this._c):[].concat(n),r],a=i[0],l=i.reduce(((e,n)=>{const r=ar(t,n,o);return e.top=_n(r.top,e.top),e.right=Rn(r.right,e.right),e.bottom=Rn(r.bottom,e.bottom),e.left=_n(r.left,e.left),e}),ar(t,a,o));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}},getOffsetParent:dr,getElementRects:async function(e){const t=this.getOffsetParent||dr,n=this.getDimensions;return{reference:sr(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}=Gn(e);return{width:t,height:n}},getScale:Qn,isElement:gn,isRTL:function(e){return"rtl"===En(e).direction}};function fr(e,t,n,r){void 0===r&&(r={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:a="function"==typeof ResizeObserver,layoutShift:l="function"==typeof IntersectionObserver,animationFrame:s=!1}=r,c=Jn(e),d=o||i?[...c?jn(c):[],...jn(t)]:[];d.forEach((e=>{o&&e.addEventListener("scroll",n,{passive:!0}),i&&e.addEventListener("resize",n)}));const u=c&&l?function(e,t){let n,r=null;const o=pn(e);function i(){var e;clearTimeout(n),null==(e=r)||e.disconnect(),r=null}return function a(l,s){void 0===l&&(l=!1),void 0===s&&(s=1),i();const{left:c,top:d,width:u,height:f}=e.getBoundingClientRect();if(l||t(),!u||!f)return;const p={rootMargin:-Bn(d)+"px "+-Bn(o.clientWidth-(c+u))+"px "+-Bn(o.clientHeight-(d+f))+"px "+-Bn(c)+"px",threshold:_n(0,Rn(1,s))||1};let h=!0;function g(e){const t=e[0].intersectionRatio;if(t!==s){if(!h)return a();t?a(!1,t):n=setTimeout((()=>{a(!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;a&&(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?nr(e):null;return s&&function t(){const r=nr(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;d.forEach((e=>{o&&e.removeEventListener("scroll",n),i&&e.removeEventListener("resize",n)})),null==u||u(),null==(e=h)||e.disconnect(),h=null,s&&cancelAnimationFrame(f)}}const pr=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:i=!0,crossAxis:a=!1,limiter:l={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...s}=Nn(e,t),c={x:n,y:r},d=await $n(t,s),u=Un(Pn(o)),f=zn(u);let p=c[f],h=c[u];if(i){const e="y"===f?"bottom":"right";p=Ln(p+d["y"===f?"top":"left"],p,p-d[e])}if(a){const e="y"===u?"bottom":"right";h=Ln(h+d["y"===u?"top":"left"],h,h-d[e])}const g=l.fn({...t,[f]:p,[u]:h});return{...g,data:{x:g.x-n,y:g.y-r}}}}},hr=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:i,rects:a,initialPlacement:l,platform:s,elements:c}=t,{mainAxis:d=!0,crossAxis:u=!0,fallbackPlacements:f,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:h="none",flipAlignment:g=!0,...v}=Nn(e,t);if(null!=(n=i.arrow)&&n.alignmentOffset)return{};const m=Pn(o),b=Pn(l)===l,y=await(null==s.isRTL?void 0:s.isRTL(c.floating)),w=f||(b||!g?[Yn(l)]:function(e){const t=Yn(e);return[Vn(e),t,Vn(t)]}(l));f||"none"===h||w.push(...function(e,t,n,r){const o=In(e);let i=function(e,t,n){const r=["left","right"],o=["right","left"],i=["top","bottom"],a=["bottom","top"];switch(e){case"top":case"bottom":return n?t?o:r:t?r:o;case"left":case"right":return t?i:a;default:return[]}}(Pn(e),"start"===n,r);return o&&(i=i.map((e=>e+"-"+o)),t&&(i=i.concat(i.map(Vn)))),i}(l,g,h,y));const x=[l,...w],k=await $n(t,v),E=[];let C=(null==(r=i.flip)?void 0:r.overflows)||[];if(d&&E.push(k[m]),u){const e=function(e,t,n){void 0===n&&(n=!1);const r=In(e),o=Hn(e),i=Fn(o);let a="x"===o?r===(n?"end":"start")?"right":"left":"start"===r?"bottom":"top";return t.reference[i]>t.floating[i]&&(a=Yn(a)),[a,Yn(a)]}(o,a,y);E.push(k[e[0]],k[e[1]])}if(C=[...C,{placement:o,overflows:E}],!E.every((e=>e<=0))){var O,S;const e=((null==(O=i.flip)?void 0:O.index)||0)+1,t=x[e];if(t)return{data:{index:e,overflows:C},reset:{placement:t}};let n=null==(S=C.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 j;const e=null==(j=C.map((e=>[e.placement,e.overflows.filter((e=>e>0)).reduce(((e,t)=>e+t),0)])).sort(((e,t)=>e[1]-t[1]))[0])?void 0:j[0];e&&(n=e);break}case"initialPlacement":n=l}if(o!==n)return{reset:{placement:n}}}return{}}}},gr=function(e){return void 0===e&&(e={}),{name:"inline",options:e,async fn(t){const{placement:n,elements:r,rects:o,platform:i,strategy:a}=t,{padding:l=2,x:s,y:c}=Nn(e,t),d=Array.from(await(null==i.getClientRects?void 0:i.getClientRects(r.reference))||[]),u=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=>Kn(qn(e))))}(d),f=Kn(qn(d)),p=Wn(l);const h=await i.getElementRects({reference:{getBoundingClientRect:function(){if(2===u.length&&u[0].left>u[1].right&&null!=s&&null!=c)return u.find((e=>s>e.left-p.left&&s<e.right+p.right&&c>e.top-p.top&&c<e.bottom+p.bottom))||f;if(u.length>=2){if("y"===Un(n)){const e=u[0],t=u[u.length-1],r="top"===Pn(n),o=e.top,i=t.bottom,a=r?e.left:t.left,l=r?e.right:t.right;return{top:o,bottom:i,left:a,right:l,width:l-a,height:i-o,x:a,y:o}}const e="left"===Pn(n),t=_n(...u.map((e=>e.right))),r=Rn(...u.map((e=>e.left))),o=u.filter((n=>e?n.left===r:n.right===t)),i=o[0].top,a=o[o.length-1].bottom;return{top:i,bottom:a,left:r,right:t,width:t-r,height:a-i,x:r,y:i}}return f}},floating:r.floating,strategy:a});return o.reference.x!==h.reference.x||o.reference.y!==h.reference.y||o.reference.width!==h.reference.width||o.reference.height!==h.reference.height?{reset:{rects:h}}:{}}}},vr=(e,t,n)=>{const r=new Map,o={platform:ur,...n},i={...o.platform,_c:r};return(async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:a}=n,l=i.filter(Boolean),s=await(null==a.isRTL?void 0:a.isRTL(t));let c=await a.getElementRects({reference:e,floating:t,strategy:o}),{x:d,y:u}=Xn(c,r,s),f=r,p={},h=0;for(let n=0;n<l.length;n++){const{name:i,fn:g}=l[n],{x:v,y:m,data:b,reset:y}=await g({x:d,y:u,initialPlacement:r,placement:f,strategy:o,middlewareData:p,rects:c,platform:a,elements:{reference:e,floating:t}});d=null!=v?v:d,u=null!=m?m:u,p={...p,[i]:{...p[i],...b}},y&&h<=50&&(h++,"object"==typeof y&&(y.placement&&(f=y.placement),y.rects&&(c=!0===y.rects?await a.getElementRects({reference:e,floating:t,strategy:o}):y.rects),({x:d,y:u}=Xn(c,f,s))),n=-1)}return{x:d,y:u,placement:f,strategy:o,middlewareData:p}})(e,t,{...o,platform:i})};var mr="undefined"!=typeof document?t.useLayoutEffect:t.useEffect;function br(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(!br(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)&&!br(e[n],t[n]))return!1}return!0}return e!=e&&t!=t}function yr(e){if("undefined"==typeof window)return 1;return(e.ownerDocument.defaultView||window).devicePixelRatio||1}function wr(e,t){const n=yr(e);return Math.round(t*n)/n}function xr(e){const t=l.useRef(e);return mr((()=>{t.current=e})),t}
|
|
2
2
|
/*!
|
|
3
3
|
* tabbable 6.2.0
|
|
4
4
|
* @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
|
|
5
5
|
*/
|
|
6
|
-
var Zr=["input:not([inert])","select:not([inert])","textarea:not([inert])","a[href]:not([inert])","button:not([inert])","[tabindex]:not(slot):not([inert])","audio[controls]:not([inert])","video[controls]:not([inert])",'[contenteditable]:not([contenteditable="false"]):not([inert])',"details>summary:first-of-type:not([inert])","details:not([inert])"].join(","),qr="undefined"==typeof Element,Gr=qr?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Jr=!qr&&Element.prototype.getRootNode?function(e){var t;return null==e||null===(t=e.getRootNode)||void 0===t?void 0:t.call(e)}:function(e){return null==e?void 0:e.ownerDocument},Qr=function e(t,n){var r;void 0===n&&(n=!0);var o=null==t||null===(r=t.getAttribute)||void 0===r?void 0:r.call(t,"inert");return""===o||"true"===o||n&&t&&e(t.parentNode)},eo=function e(t,n,r){for(var o=[],i=Array.from(t);i.length;){var a=i.shift();if(!Qr(a,!1))if("SLOT"===a.tagName){var l=a.assignedElements(),c=e(l.length?l:a.children,!0,r);r.flatten?o.push.apply(o,c):o.push({scopeParent:a,candidates:c})}else{Gr.call(a,Zr)&&r.filter(a)&&(n||!t.includes(a))&&o.push(a);var s=a.shadowRoot||"function"==typeof r.getShadowRoot&&r.getShadowRoot(a),d=!Qr(s,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(a));if(s&&d){var u=e(!0===s?a.children:s.children,!0,r);r.flatten?o.push.apply(o,u):o.push({scopeParent:a,candidates:u})}else i.unshift.apply(i,a.children)}}return o},to=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},no=function(e){if(!e)throw new Error("No node provided");return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||function(e){var t,n=null==e||null===(t=e.getAttribute)||void 0===t?void 0:t.call(e,"contenteditable");return""===n||"true"===n}(e))&&!to(e)?0:e.tabIndex},ro=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},oo=function(e){return"INPUT"===e.tagName},io=function(e){return function(e){return oo(e)&&"radio"===e.type}(e)&&!function(e){if(!e.name)return!0;var t,n=e.form||Jr(e),r=function(e){return n.querySelectorAll('input[type="radio"][name="'+e+'"]')};if("undefined"!=typeof window&&void 0!==window.CSS&&"function"==typeof window.CSS.escape)t=r(window.CSS.escape(e.name));else try{t=r(e.name)}catch(e){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",e.message),!1}var o=function(e,t){for(var n=0;n<e.length;n++)if(e[n].checked&&e[n].form===t)return e[n]}(t,e.form);return!o||o===e}(e)},ao=function(e){var t=e.getBoundingClientRect(),n=t.width,r=t.height;return 0===n&&0===r},lo=function(e,t){var n=t.displayCheck,r=t.getShadowRoot;if("hidden"===getComputedStyle(e).visibility)return!0;var o=Gr.call(e,"details>summary:first-of-type")?e.parentElement:e;if(Gr.call(o,"details:not([open]) *"))return!0;if(n&&"full"!==n&&"legacy-full"!==n){if("non-zero-area"===n)return ao(e)}else{if("function"==typeof r){for(var i=e;e;){var a=e.parentElement,l=Jr(e);if(a&&!a.shadowRoot&&!0===r(a))return ao(e);e=e.assignedSlot?e.assignedSlot:a||l===e.ownerDocument?a:l.host}e=i}if(function(e){var t,n,r,o,i=e&&Jr(e),a=null===(t=i)||void 0===t?void 0:t.host,l=!1;if(i&&i!==e)for(l=!!(null!==(n=a)&&void 0!==n&&null!==(r=n.ownerDocument)&&void 0!==r&&r.contains(a)||null!=e&&null!==(o=e.ownerDocument)&&void 0!==o&&o.contains(e));!l&&a;){var c,s,d;l=!(null===(s=a=null===(c=i=Jr(a))||void 0===c?void 0:c.host)||void 0===s||null===(d=s.ownerDocument)||void 0===d||!d.contains(a))}return l}(e))return!e.getClientRects().length;if("legacy-full"!==n)return!0}return!1},co=function(e,t){return!(t.disabled||Qr(t)||function(e){return oo(e)&&"hidden"===e.type}(t)||lo(t,e)||function(e){return"DETAILS"===e.tagName&&Array.prototype.slice.apply(e.children).some((function(e){return"SUMMARY"===e.tagName}))}(t)||function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var t=e.parentElement;t;){if("FIELDSET"===t.tagName&&t.disabled){for(var n=0;n<t.children.length;n++){var r=t.children.item(n);if("LEGEND"===r.tagName)return!!Gr.call(t,"fieldset[disabled] *")||!r.contains(e)}return!0}t=t.parentElement}return!1}(t))},so=function(e,t){return!(io(t)||no(t)<0||!co(e,t))},uo=function(e){var t=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(t)||t>=0)},fo=function e(t){var n=[],r=[];return t.forEach((function(t,o){var i=!!t.scopeParent,a=i?t.scopeParent:t,l=function(e,t){var n=no(e);return n<0&&t&&!to(e)?0:n}(a,i),c=i?e(t.candidates):a;0===l?i?n.push.apply(n,c):n.push(a):r.push({documentOrder:o,tabIndex:l,item:t,isScope:i,content:c})})),r.sort(ro).reduce((function(e,t){return t.isScope?e.push.apply(e,t.content):e.push(t.content),e}),[]).concat(n)},po=function(e,t){var n;return n=(t=t||{}).getShadowRoot?eo([e],t.includeContainer,{filter:so.bind(null,t),flatten:!1,getShadowRoot:t.getShadowRoot,shadowRootFilter:uo}):function(e,t,n){if(Qr(e))return[];var r=Array.prototype.slice.apply(e.querySelectorAll(Zr));return t&&Gr.call(e,Zr)&&r.unshift(e),r.filter(n)}(e,t.includeContainer,so.bind(null,t)),fo(n)};const ho=r["useInsertionEffect".toString()]||(e=>e());var go="undefined"!=typeof document?c:s;function vo(){return vo=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},vo.apply(this,arguments)}let mo=!1,bo=0;const yo=()=>"floating-ui-"+bo++;const wo=r["useId".toString()]||function(){const[e,t]=r.useState((()=>mo?yo():void 0));return go((()=>{null==e&&t(yo())}),[]),r.useEffect((()=>{mo||(mo=!0)}),[]),e};const xo=r.createContext(null),ko=r.createContext(null);function Eo(e){return"data-floating-ui-"+e}function Co(e){const t=l(e);return go((()=>{t.current=e})),t}const Oo=()=>({getShadowRoot:!0,displayCheck:"function"==typeof ResizeObserver&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function So(e,t){const n=po(e,Oo());"prev"===t&&n.reverse();const r=n.indexOf(function(e){let t=e.activeElement;for(;null!=(null==(n=t)||null==(n=n.shadowRoot)?void 0:n.activeElement);){var n;t=t.shadowRoot.activeElement}return t}((null==(o=e)?void 0:o.ownerDocument)||document));var o;return n.slice(r+1)[0]}function Do(e,t){const n=t||e.currentTarget,r=e.relatedTarget;return!r||!function(e,t){if(!e||!t)return!1;const n=null==t.getRootNode?void 0:t.getRootNode();if(e.contains(t))return!0;if(n&&Wn(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}(n,r)}function _o(e){po(e,Oo()).forEach((e=>{e.dataset.tabindex=e.getAttribute("tabindex")||"",e.setAttribute("tabindex","-1")}))}function Ro(e){e.querySelectorAll("[data-tabindex]").forEach((e=>{const t=e.dataset.tabindex;delete e.dataset.tabindex,t?e.setAttribute("tabindex",t):e.removeAttribute("tabindex")}))}const jo={border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"fixed",whiteSpace:"nowrap",width:"1px",top:0,left:0};function Bo(e){"Tab"===e.key&&(e.target,clearTimeout(undefined))}const Ao=r.forwardRef((function(e,t){const[n,o]=r.useState();go((()=>(/apple/i.test(navigator.vendor)&&o("button"),document.addEventListener("keydown",Bo),()=>{document.removeEventListener("keydown",Bo)})),[]);const i={ref:t,tabIndex:0,role:n,"aria-hidden":!n||void 0,[Eo("focus-guard")]:"",style:jo};return r.createElement("span",vo({},e,i))})),To=r.createContext(null),Lo=Eo("portal");function No(e){let{children:t,id:n,root:o=null,preserveTabOrder:i=!0}=e;const a=function(e){let{id:t,root:n}=void 0===e?{}:e;const[o,i]=r.useState(null),a=wo(),l=Mo(),c=r.useRef(null);return go((()=>()=>{null==o||o.remove(),queueMicrotask((()=>{c.current=null}))}),[o]),go((()=>{if(c.current)return;const e=t?document.getElementById(t):null;if(!e)return;const n=document.createElement("div");n.id=a,n.setAttribute(Lo,""),e.appendChild(n),c.current=n,i(n)}),[t,a]),go((()=>{if(c.current)return;let e=n||(null==l?void 0:l.portalNode);e&&!Vn(e)&&(e=e.current),e=e||document.body;let r=null;t&&(r=document.createElement("div"),r.id=t,e.appendChild(r));const o=document.createElement("div");o.id=a,o.setAttribute(Lo,""),e=r||e,e.appendChild(o),c.current=o,i(o)}),[t,n,a,l]),o}({id:n,root:o}),[l,c]=r.useState(null),s=r.useRef(null),d=r.useRef(null),u=r.useRef(null),f=r.useRef(null),p=!!l&&!l.modal&&l.open&&i&&!(!o&&!a);return r.useEffect((()=>{if(a&&i&&(null==l||!l.modal))return a.addEventListener("focusin",e,!0),a.addEventListener("focusout",e,!0),()=>{a.removeEventListener("focusin",e,!0),a.removeEventListener("focusout",e,!0)};function e(e){if(a&&Do(e)){("focusin"===e.type?Ro:_o)(a)}}}),[a,i,null==l?void 0:l.modal]),r.createElement(To.Provider,{value:r.useMemo((()=>({preserveTabOrder:i,beforeOutsideRef:s,afterOutsideRef:d,beforeInsideRef:u,afterInsideRef:f,portalNode:a,setFocusManagerState:c})),[i,a])},p&&a&&r.createElement(Ao,{"data-type":"outside",ref:s,onFocus:e=>{if(Do(e,a)){var t;null==(t=u.current)||t.focus()}else{const e=So(document.body,"prev")||(null==l?void 0:l.refs.domReference.current);null==e||e.focus()}}}),p&&a&&r.createElement("span",{"aria-owns":a.id,style:jo}),a&&w(t,a),p&&a&&r.createElement(Ao,{"data-type":"outside",ref:d,onFocus:e=>{if(Do(e,a)){var t;null==(t=f.current)||t.focus()}else{const t=So(document.body,"next")||(null==l?void 0:l.refs.domReference.current);null==t||t.focus(),(null==l?void 0:l.closeOnFocusOut)&&(null==l||l.onOpenChange(!1,e.nativeEvent))}}}))}const Mo=()=>r.useContext(To),Io=new Set,Po=r.forwardRef((function(e,t){let{lockScroll:n=!1,...o}=e;const i=wo();return go((()=>{if(!n)return;Io.add(i);const e=/iP(hone|ad|od)|iOS/.test(function(){const e=navigator.userAgentData;return null!=e&&e.platform?e.platform:navigator.platform}()),t=document.body.style,r=Math.round(document.documentElement.getBoundingClientRect().left)+document.documentElement.scrollLeft?"paddingLeft":"paddingRight",o=window.innerWidth-document.documentElement.clientWidth,a=t.left?parseFloat(t.left):window.pageXOffset,l=t.top?parseFloat(t.top):window.pageYOffset;if(t.overflow="hidden",o&&(t[r]=o+"px"),e){var c,s;const e=(null==(c=window.visualViewport)?void 0:c.offsetLeft)||0,n=(null==(s=window.visualViewport)?void 0:s.offsetTop)||0;Object.assign(t,{position:"fixed",top:-(l-Math.floor(n))+"px",left:-(a-Math.floor(e))+"px",right:"0"})}return()=>{Io.delete(i),0===Io.size&&(Object.assign(t,{overflow:"",[r]:""}),e&&(Object.assign(t,{position:"",top:"",left:"",right:""}),window.scrollTo(a,l)))}}),[i,n]),r.createElement("div",vo({ref:t},o,{style:{position:"fixed",overflow:"auto",top:0,right:0,bottom:0,left:0,...o.style}}))}));function zo(e){var t;void 0===e&&(e={});const{open:n=!1,onOpenChange:o,nodeId:i}=e,[a,l]=r.useState(null),c=(null==(t=e.elements)?void 0:t.reference)||a,s=function(e){void 0===e&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:o=[],platform:i,elements:{reference:a,floating:l}={},transform:c=!0,whileElementsMounted:s,open:d}=e,[u,f]=r.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,h]=r.useState(o);Kr(p,o)||h(o);const[g,v]=r.useState(null),[m,y]=r.useState(null),w=r.useCallback((e=>{e!==C.current&&(C.current=e,v(e))}),[]),x=r.useCallback((e=>{e!==O.current&&(O.current=e,y(e))}),[]),k=a||g,E=l||m,C=r.useRef(null),O=r.useRef(null),S=r.useRef(u),D=null!=s,_=$r(s),R=$r(i),j=r.useCallback((()=>{if(!C.current||!O.current)return;const e={placement:t,strategy:n,middleware:p};R.current&&(e.platform=R.current),Hr(C.current,O.current,e).then((e=>{const t={...e,isPositioned:!0};B.current&&!Kr(S.current,t)&&(S.current=t,b.flushSync((()=>{f(t)})))}))}),[p,t,n,R]);Wr((()=>{!1===d&&S.current.isPositioned&&(S.current.isPositioned=!1,f((e=>({...e,isPositioned:!1}))))}),[d]);const B=r.useRef(!1);Wr((()=>(B.current=!0,()=>{B.current=!1})),[]),Wr((()=>{if(k&&(C.current=k),E&&(O.current=E),k&&E){if(_.current)return _.current(k,E,j);j()}}),[k,E,j,_,D]);const A=r.useMemo((()=>({reference:C,floating:O,setReference:w,setFloating:x})),[w,x]),T=r.useMemo((()=>({reference:k,floating:E})),[k,E]),L=r.useMemo((()=>{const e={position:n,left:0,top:0};if(!T.floating)return e;const t=Xr(T.floating,u.x),r=Xr(T.floating,u.y);return c?{...e,transform:"translate("+t+"px, "+r+"px)",...Yr(T.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:t,top:r}}),[n,c,T.floating,u.x,u.y]);return r.useMemo((()=>({...u,update:j,refs:A,elements:T,floatingStyles:L})),[u,j,A,T,L])}(e),d=r.useContext(ko),u=null!=((null==(f=r.useContext(xo))?void 0:f.id)||null);var f;const p=function(e){const t=r.useRef((()=>{}));return ho((()=>{t.current=e})),r.useCallback((function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return null==t.current?void 0:t.current(...n)}),[])}(((e,t,n)=>{e&&(g.current.openEvent=t),v.emit("openchange",{open:e,event:t,reason:n,nested:u}),null==o||o(e,t,n)})),h=r.useRef(null),g=r.useRef({}),v=r.useState((()=>function(){const e=new Map;return{emit(t,n){var r;null==(r=e.get(t))||r.forEach((e=>e(n)))},on(t,n){e.set(t,[...e.get(t)||[],n])},off(t,n){var r;e.set(t,(null==(r=e.get(t))?void 0:r.filter((e=>e!==n)))||[])}}}()))[0],m=wo(),y=r.useCallback((e=>{const t=Vn(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),contextElement:e}:e;s.refs.setReference(t)}),[s.refs]),w=r.useCallback((e=>{(Vn(e)||null===e)&&(h.current=e,l(e)),(Vn(s.refs.reference.current)||null===s.refs.reference.current||null!==e&&!Vn(e))&&s.refs.setReference(e)}),[s.refs]),x=r.useMemo((()=>({...s.refs,setReference:w,setPositionReference:y,domReference:h})),[s.refs,w,y]),k=r.useMemo((()=>({...s.elements,domReference:c})),[s.elements,c]),E=r.useMemo((()=>({...s,refs:x,elements:k,dataRef:g,nodeId:i,floatingId:m,events:v,open:n,onOpenChange:p})),[s,i,m,v,n,p,x,k]);return go((()=>{const e=null==d?void 0:d.nodesRef.current.find((e=>e.id===i));e&&(e.context=E)})),r.useMemo((()=>({...s,context:E,refs:x,elements:k})),[s,x,k,E])}const Fo=e=>e.replace(/[A-Z]+(?![a-z])|[A-Z]/g,((e,t)=>(t?"-":"")+e.toLowerCase()));function Uo(e,t){return"function"==typeof e?e(t):e}function Vo(e,t){void 0===t&&(t={});const{open:n,elements:{floating:o}}=e,{duration:i=250}=t,a=("number"==typeof i?i:i.close)||0,[l,c]=r.useState(!1),[s,d]=r.useState("unmounted"),u=function(e,t){const[n,o]=r.useState(e);return e&&!n&&o(!0),r.useEffect((()=>{if(!e){const e=setTimeout((()=>o(!1)),t);return()=>clearTimeout(e)}}),[e,t]),n}(n,a);return go((()=>{l&&!u&&d("unmounted")}),[l,u]),go((()=>{if(o){if(n){d("initial");const e=requestAnimationFrame((()=>{d("open")}));return()=>{cancelAnimationFrame(e)}}c(!0),d("close")}}),[n,o]),{isMounted:u,status:s}}function Ho(e,t){void 0===t&&(t={});const{initial:n={opacity:0},open:o,close:i,common:a,duration:l=250}=t,c=e.placement,s=c.split("-")[0],d=r.useMemo((()=>({side:s,placement:c})),[s,c]),u="number"==typeof l,f=(u?l:l.open)||0,p=(u?l:l.close)||0,[h,g]=r.useState((()=>({...Uo(a,d),...Uo(n,d)}))),{isMounted:v,status:m}=Vo(e,{duration:l}),b=Co(n),y=Co(o),w=Co(i),x=Co(a);return go((()=>{const e=Uo(b.current,d),t=Uo(w.current,d),n=Uo(x.current,d),r=Uo(y.current,d)||Object.keys(e).reduce(((e,t)=>(e[t]="",e)),{});if("initial"===m&&g((t=>({transitionProperty:t.transitionProperty,...n,...e}))),"open"===m&&g({transitionProperty:Object.keys(r).map(Fo).join(","),transitionDuration:f+"ms",...n,...r}),"close"===m){const r=t||e;g({transitionProperty:Object.keys(r).map(Fo).join(","),transitionDuration:p+"ms",...n,...r})}}),[p,w,b,y,x,f,m,d]),{isMounted:v,styles:h}}var Wo;function Ko(){return Ko=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Ko.apply(this,arguments)}var Yo=function(e){return r.createElement("svg",Ko({viewBox:"0 0 16 16",className:"turn_svg__loop",style:{width:16,height:16,display:"block",fill:"currentcolor",flexShrink:0,backfaceVisibility:"hidden"}},e),Wo||(Wo=r.createElement("path",{d:"M5.804 3.123c.006.38.254.622.673.622h4.887c.59 0 .914.305.914.92v6.628l-.901-.978-.514-.514c-.267-.254-.629-.273-.895-.013-.254.26-.248.635.012.895l2.165 2.158c.476.47 1.022.47 1.498 0l2.165-2.158c.26-.26.266-.635.012-.895-.266-.26-.628-.241-.895.013l-.514.514-.895.971V4.564c0-1.358-.71-2.063-2.082-2.063H6.477c-.42 0-.68.241-.673.622ZM.186 7.06c.26.266.622.247.889-.013l.52-.508.889-.971v6.722c0 1.359.71 2.063 2.082 2.063h4.957c.42 0 .68-.241.673-.622-.006-.387-.254-.622-.673-.622h-4.88c-.591 0-.915-.311-.915-.927V5.554l.895.984.52.508c.26.26.629.28.89.013.26-.26.253-.629-.013-.89L3.855 4.013c-.476-.476-1.016-.476-1.492 0L.2 6.17c-.267.26-.273.628-.013.889Z"})))};function Xo(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}var $o=["color"],Zo=g((function(e,t){var n=e.color,r=void 0===n?"currentColor":n,o=Xo(e,$o);return v("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o,{ref:t}),v("path",{d:"M1 9.50006C1 10.3285 1.67157 11.0001 2.5 11.0001H4L4 10.0001H2.5C2.22386 10.0001 2 9.7762 2 9.50006L2 2.50006C2 2.22392 2.22386 2.00006 2.5 2.00006L9.5 2.00006C9.77614 2.00006 10 2.22392 10 2.50006V4.00002H5.5C4.67158 4.00002 4 4.67159 4 5.50002V12.5C4 13.3284 4.67158 14 5.5 14H12.5C13.3284 14 14 13.3284 14 12.5V5.50002C14 4.67159 13.3284 4.00002 12.5 4.00002H11V2.50006C11 1.67163 10.3284 1.00006 9.5 1.00006H2.5C1.67157 1.00006 1 1.67163 1 2.50006V9.50006ZM5 5.50002C5 5.22388 5.22386 5.00002 5.5 5.00002H12.5C12.7761 5.00002 13 5.22388 13 5.50002V12.5C13 12.7762 12.7761 13 12.5 13H5.5C5.22386 13 5 12.7762 5 12.5V5.50002Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))})),qo=["color"],Go=g((function(e,t){var n=e.color,r=void 0===n?"currentColor":n,o=Xo(e,qo);return v("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o,{ref:t}),v("path",{d:"M3.625 7.5C3.625 8.12132 3.12132 8.625 2.5 8.625C1.87868 8.625 1.375 8.12132 1.375 7.5C1.375 6.87868 1.87868 6.375 2.5 6.375C3.12132 6.375 3.625 6.87868 3.625 7.5ZM8.625 7.5C8.625 8.12132 8.12132 8.625 7.5 8.625C6.87868 8.625 6.375 8.12132 6.375 7.5C6.375 6.87868 6.87868 6.375 7.5 6.375C8.12132 6.375 8.625 6.87868 8.625 7.5ZM12.5 8.625C13.1213 8.625 13.625 8.12132 13.625 7.5C13.625 6.87868 13.1213 6.375 12.5 6.375C11.8787 6.375 11.375 6.87868 11.375 7.5C11.375 8.12132 11.8787 8.625 12.5 8.625Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))})),Jo=["color"],Qo=g((function(e,t){var n=e.color,r=void 0===n?"currentColor":n,o=Xo(e,Jo);return v("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o,{ref:t}),v("path",{d:"M8.51194 3.00541C9.18829 2.54594 10.0435 2.53694 10.6788 2.95419C10.8231 3.04893 10.9771 3.1993 11.389 3.61119C11.8009 4.02307 11.9513 4.17714 12.046 4.32141C12.4633 4.95675 12.4543 5.81192 11.9948 6.48827C11.8899 6.64264 11.7276 6.80811 11.3006 7.23511L10.6819 7.85383C10.4867 8.04909 10.4867 8.36567 10.6819 8.56093C10.8772 8.7562 11.1938 8.7562 11.389 8.56093L12.0077 7.94221L12.0507 7.89929C12.4203 7.52976 12.6568 7.2933 12.822 7.0502C13.4972 6.05623 13.5321 4.76252 12.8819 3.77248C12.7233 3.53102 12.4922 3.30001 12.1408 2.94871L12.0961 2.90408L12.0515 2.85942C11.7002 2.508 11.4692 2.27689 11.2277 2.11832C10.2377 1.46813 8.94398 1.50299 7.95001 2.17822C7.70691 2.34336 7.47044 2.57991 7.1009 2.94955L7.058 2.99247L6.43928 3.61119C6.24401 3.80645 6.24401 4.12303 6.43928 4.31829C6.63454 4.51355 6.95112 4.51355 7.14638 4.31829L7.7651 3.69957C8.1921 3.27257 8.35757 3.11027 8.51194 3.00541ZM4.31796 7.14672C4.51322 6.95146 4.51322 6.63487 4.31796 6.43961C4.12269 6.24435 3.80611 6.24435 3.61085 6.43961L2.99213 7.05833L2.94922 7.10124C2.57957 7.47077 2.34303 7.70724 2.17788 7.95035C1.50265 8.94432 1.4678 10.238 2.11799 11.2281C2.27656 11.4695 2.50766 11.7005 2.8591 12.0518L2.90374 12.0965L2.94837 12.1411C3.29967 12.4925 3.53068 12.7237 3.77214 12.8822C4.76219 13.5324 6.05589 13.4976 7.04986 12.8223C7.29296 12.6572 7.52943 12.4206 7.89896 12.051L7.89897 12.051L7.94188 12.0081L8.5606 11.3894C8.75586 11.1941 8.75586 10.8775 8.5606 10.6823C8.36533 10.487 8.04875 10.487 7.85349 10.6823L7.23477 11.301C6.80777 11.728 6.6423 11.8903 6.48794 11.9951C5.81158 12.4546 4.95642 12.4636 4.32107 12.0464C4.17681 11.9516 4.02274 11.8012 3.61085 11.3894C3.19896 10.9775 3.0486 10.8234 2.95385 10.6791C2.53661 10.0438 2.54561 9.18863 3.00507 8.51227C3.10993 8.35791 3.27224 8.19244 3.69924 7.76544L4.31796 7.14672ZM9.62172 6.08558C9.81698 5.89032 9.81698 5.57373 9.62172 5.37847C9.42646 5.18321 9.10988 5.18321 8.91461 5.37847L5.37908 8.91401C5.18382 9.10927 5.18382 9.42585 5.37908 9.62111C5.57434 9.81637 5.89092 9.81637 6.08619 9.62111L9.62172 6.08558Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))})),ei=["color"],ti=g((function(e,t){var n=e.color,r=void 0===n?"currentColor":n,o=Xo(e,ei);return v("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o,{ref:t}),v("path",{d:"M5.5 1C5.22386 1 5 1.22386 5 1.5C5 1.77614 5.22386 2 5.5 2H9.5C9.77614 2 10 1.77614 10 1.5C10 1.22386 9.77614 1 9.5 1H5.5ZM3 3.5C3 3.22386 3.22386 3 3.5 3H5H10H11.5C11.7761 3 12 3.22386 12 3.5C12 3.77614 11.7761 4 11.5 4H11V12C11 12.5523 10.5523 13 10 13H5C4.44772 13 4 12.5523 4 12V4L3.5 4C3.22386 4 3 3.77614 3 3.5ZM5 4H10V12H5V4Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))})),ni=function(){var e=document.getSelection();if(!e.rangeCount)return function(){};for(var t=document.activeElement,n=[],r=0;r<e.rangeCount;r++)n.push(e.getRangeAt(r));switch(t.tagName.toUpperCase()){case"INPUT":case"TEXTAREA":t.blur();break;default:t=null}return e.removeAllRanges(),function(){"Caret"===e.type&&e.removeAllRanges(),e.rangeCount||n.forEach((function(t){e.addRange(t)})),t&&t.focus()}},ri={"text/plain":"Text","text/html":"Url",default:"Text"};var oi=function(e,t){var n,r,o,i,a,l,c=!1;t||(t={}),n=t.debug||!1;try{if(o=ni(),i=document.createRange(),a=document.getSelection(),(l=document.createElement("span")).textContent=e,l.ariaHidden="true",l.style.all="unset",l.style.position="fixed",l.style.top=0,l.style.clip="rect(0, 0, 0, 0)",l.style.whiteSpace="pre",l.style.webkitUserSelect="text",l.style.MozUserSelect="text",l.style.msUserSelect="text",l.style.userSelect="text",l.addEventListener("copy",(function(r){if(r.stopPropagation(),t.format)if(r.preventDefault(),void 0===r.clipboardData){n&&console.warn("unable to use e.clipboardData"),n&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var o=ri[t.format]||ri.default;window.clipboardData.setData(o,e)}else r.clipboardData.clearData(),r.clipboardData.setData(t.format,e);t.onCopy&&(r.preventDefault(),t.onCopy(r.clipboardData))})),document.body.appendChild(l),i.selectNodeContents(l),a.addRange(i),!document.execCommand("copy"))throw new Error("copy command was unsuccessful");c=!0}catch(o){n&&console.error("unable to copy using execCommand: ",o),n&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(t.format||"text",e),t.onCopy&&t.onCopy(window.clipboardData),c=!0}catch(o){n&&console.error("unable to copy using clipboardData: ",o),n&&console.error("falling back to prompt"),r=function(e){var t=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return e.replace(/#{\s*key\s*}/g,t)}("message"in t?t.message:"Copy to clipboard: #{key}, Enter"),window.prompt(r,e)}}finally{a&&("function"==typeof a.removeRange?a.removeRange(i):a.removeAllRanges()),l&&document.body.removeChild(l),o()}return c};function ii(e){if(!e)return;const t=Object.keys(e);return 1===t.length?t[0]:t.find((t=>e[t].asRoot))}function ai(e){if(!e)return;const t=ii(e);return t?e[t]:void 0}const li=i(void 0),ci=({children:r,tools:o})=>{const i=H(),a=d((()=>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]),l=d((()=>!o||i?null:Object.keys(o).map((t=>{var n,r,i;const a=null===(n=null==o?void 0:o[t])||void 0===n?void 0:n.tool,l=null===(r=null==o?void 0:o[t])||void 0===r?void 0:r.render,c=null===(i=null==o?void 0:o[t])||void 0===i?void 0:i.props;return a?e(a,Object.assign({render:l},c),t):null}))),[d]);return e(li.Provider,Object.assign({value:a},{children:t(n,{children:[l,r]})}))},si=()=>{const e=a(li);if(void 0===e)throw new Error("useYooptaTools must be used within a ToolsProvider");return e},di=({children:t})=>e("div",Object.assign({className:"flex flex-col"},{children:t})),ui=({children:t})=>e("div",Object.assign({onClick:e=>e.stopPropagation(),className:"bg-[#FFF] relative min-w-[200px] w-auto overflow-hidden rounded-md border bg-popover py-[6px] px-0 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2"},{children:t})),fi=({children:t})=>e("div",Object.assign({className:"relative flex cursor-default select-none items-center text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50"},{children:t})),pi=({isOpen:n,onClose:r,refs:o,style:i,children:a})=>{var l,c;const s=z(),d=si(),[u,p]=f(!1),{refs:h,floatingStyles:g,context:v}=zo({placement:"right",open:u,onOpenChange:p,middleware:[Vr(),Ur(),Fr(),Er(10)],whileElementsMounted:zr}),{isMounted:m,styles:b}=Ho(v,{duration:100});if(!n)return null;const y=N(s,{at:s.selection}),w=ai(s.blocks[(null==y?void 0:y.type)||""].elements),x="void"===(null===(l=null==w?void 0:w.props)||void 0===l?void 0:l.nodeType),k=d.ActionMenu,E=Object.assign(Object.assign({},g),b);return e(No,Object.assign({root:document.getElementById("yoopta-editor")},{children:e(Po,Object.assign({lockScroll:!0,className:"z-[100]",onClick:r},{children:e("div",Object.assign({style:i,ref:o.setFloating},{children:t(ui,{children:[t(di,{children:[e(fi,{children:t("button",Object.assign({type:"button",className:"rounded-sm hover:bg-[#37352f14] leading-[120%] px-2 py-1.5 mx-[4px] cursor-pointer w-full flex justify-start",onClick:()=>{const e=s.selection;s.deleteBlock({at:e}),s.setBlockSelected(null),s.setSelection(null),r()}},{children:[e(ti,{className:"w-4 h-4 mr-2"}),"Delete"]}))}),e(fi,{children:t("button",Object.assign({type:"button",className:"rounded-sm hover:bg-[#37352f14] leading-[120%] px-2 py-1.5 mx-[4px] cursor-pointer w-full flex justify-start",onClick:()=>{s.duplicateBlock({at:s.selection,focus:!0}),s.setBlockSelected(null),r()}},{children:[e(Zo,{className:"w-4 h-4 mr-2"}),"Duplicate"]}))}),!x&&!(null===(c=s.blocks[(null==y?void 0:y.type)||""])||void 0===c?void 0:c.hasCustomEditor)&&t(fi,{children:[m&&!!k&&e(No,Object.assign({root:document.getElementById("yoopta-editor")},{children:e(Po,Object.assign({lockScroll:!0,className:"z-[100]",onClick:()=>p(!1)},{children:e("div",Object.assign({style:E,ref:h.setFloating},{children:e(k,{actions:Object.keys(s.blocks),editor:s,selectedAction:"",onClose:()=>{p(!1),r()},empty:!1,onMouseEnter:()=>{},mode:"toggle"})}))}))})),t("button",Object.assign({type:"button",className:"rounded-sm hover:bg-[#37352f14] leading-[120%] px-2 py-1.5 mx-[4px] cursor-pointer w-full flex justify-start",ref:h.setReference,onClick:()=>p((e=>!e))},{children:[e(Yo,{className:"w-4 h-4 mr-2"}),"Turn into"]}))]}),e(fi,{children:t("button",Object.assign({type:"button",className:"rounded-sm hover:bg-[#37352f14] leading-[120%] px-2 py-1.5 mx-[4px] cursor-pointer w-full flex justify-start",onClick:()=>{const e=N(s);e&&(oi(`${window.location.origin}${window.location.pathname}#${e.id}`),s.emit("block:copy",e)),r()}},{children:[e(Qo,{className:"w-4 h-4 mr-2"}),"Copy link to block"]}))})]}),a]})}))}))}))};var hi=Object.freeze({__proto__:null,BlockOptions:pi,BlockOptionsMenuContent:ui,BlockOptionsMenuGroup:di,BlockOptionsMenuItem:fi,BlockOptionsSeparator:({className:t})=>e("div",{className:`h-[1px] bg-[#37352f14] my-[4px] w-full ${t}`})});function gi(e,t){void 0===t&&(t={});var n=t.insertAt;if(e&&"undefined"!=typeof document){var r=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===n&&r.firstChild?r.insertBefore(o,r.firstChild):r.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}var vi={actions:"vuZgncnq",hovered:"_8Eqjiv7m",actionButton:"WabGEp54",plusButton:"_0C8RpLmz"};function mi(...e){return e.filter(Boolean).join(" ")}gi(".vuZgncnq{display:flex;left:-50px;opacity:0;position:absolute;top:2px;transition:opacity .18s ease-in}._8Eqjiv7m{opacity:1}.WabGEp54{all:unset;align-items:center;background-color:inherit;background-color:transparent;border-radius:6px;color:rgba(55,53,47,.35);cursor:pointer;display:flex;height:24px;justify-content:center;margin:0 1px;padding:0;position:relative;transition:background-color .18s cubic-bezier(.4,0,.2,1);width:auto;width:18px}.WabGEp54:active,.WabGEp54:focus,.WabGEp54:hover{background-color:rgba(55,54,47,.08)}._0C8RpLmz{width:24px}");const bi=({block:n,editor:r,dragHandleProps:o,showActions:i,onChangeActiveBlock:a})=>{const[l,c]=f(!1),{refs:s,floatingStyles:d,context:u}=zo({placement:"right-start",open:l,onOpenChange:c,middleware:[Vr(),Ur(),Fr(),Er()]}),{isMounted:p,styles:h}=Ho(u,{duration:100}),{setActivatorNodeRef:g,attributes:v,listeners:m}=o,b=Object.assign(Object.assign({},d),h);return t("div",Object.assign({contentEditable:!1,className:mi(vi.actions,i&&vi.hovered,"yoopta-element-actions")},{children:[e("button",Object.assign({type:"button",onClick:()=>{const e=ee({id:J()}),t=[n.meta.order+1];r.setSelection([n.meta.order]),r.insertBlock(e,{at:t,focus:!0})},className:mi(vi.actionButton,vi.plusButton,"yoopta-element-actions-plus")},{children:e(Mn,{})})),e("button",Object.assign({type:"button",className:mi(vi.actionButton,"yoopta-element-actions-drag"),ref:e=>{g(e),s.setReference(e)}},v,m,{onClick:e=>{e.stopPropagation(),a(n.id);const t=In(r,{at:[n.meta.order]});r.focusBlock(n.id),t&&setTimeout((()=>{r.blocks[n.type].hasCustomEditor||(x.blur(t),x.deselect(t),R.deselect(t)),r.setBlockSelected([n.meta.order],{only:!0}),r.setSelection([n.meta.order]),c(!0)}),10)}},{children:e(Ln,{})})),e(pi,{isOpen:p,refs:s,style:b,onClose:()=>c(!1)})]}))},yi=({children:n,block:r,blockId:o})=>{var i;const a=z(),[l,c]=f(null),{attributes:s,listeners:d,setNodeRef:u,setActivatorNodeRef:p,transform:h,transition:g,isOver:v,isDragging:m}=Sn({id:o,disabled:a.readOnly}),b={transform:h?`translate3d(${h.x}px, ${h.y}px, 0)`:"none",transition:g,opacity:m?.7:1,marginLeft:20*r.meta.depth+"px"},y=null===(i=a.selectedBlocks)||void 0===i?void 0:i.includes(r.meta.order),w=l===o,x={borderBottom:v&&!m?"2px solid #007aff":"none"};return t("div",Object.assign({className:"relative py-0 px-[2px] mt-[2px] mb-[1px] rounded yoopta-block-wrapper",onMouseEnter:()=>{a.readOnly||c(o)},onMouseLeave:()=>{a.readOnly||c(null)},"data-yoopta-block-id":o,style:b,"data-yoopta-block":!0,ref:u},{children:[!a.readOnly&&e(bi,{block:r,editor:a,dragHandleProps:{setActivatorNodeRef:p,attributes:s,listeners:d},showActions:w,onChangeActiveBlock:e=>c(e)}),e("div",Object.assign({className:vi.content,style:x},{children:n})),y&&!a.readOnly&&e("div",{className:"absolute left-0 top-0 bg-[#2383e224] z-[90] rounded opacity-100 h-full w-full pointer-events-none yoopta-selection-block"})]}))};function wi(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}"function"==typeof SuppressedError&&SuppressedError;var xi={};Object.defineProperty(xi,"__esModule",{value:!0});for(var ki="undefined"!=typeof window&&/Mac|iPod|iPhone|iPad/.test(window.navigator.platform),Ei={alt:"altKey",control:"ctrlKey",meta:"metaKey",shift:"shiftKey"},Ci={add:"+",break:"pause",cmd:"meta",command:"meta",ctl:"control",ctrl:"control",del:"delete",down:"arrowdown",esc:"escape",ins:"insert",left:"arrowleft",mod:ki?"meta":"control",opt:"alt",option:"alt",return:"enter",right:"arrowright",space:" ",spacebar:" ",up:"arrowup",win:"meta",windows:"meta"},Oi={backspace:8,tab:9,enter:13,shift:16,control:17,alt:18,pause:19,capslock:20,escape:27," ":32,pageup:33,pagedown:34,end:35,home:36,arrowleft:37,arrowup:38,arrowright:39,arrowdown:40,insert:45,delete:46,meta:91,numlock:144,scrolllock:145,";":186,"=":187,",":188,"-":189,".":190,"/":191,"`":192,"[":219,"\\":220,"]":221,"'":222},Si=1;Si<20;Si++)Oi["f"+Si]=111+Si;function Di(e,t,n){t&&!("byKey"in t)&&(n=t,t=null),Array.isArray(e)||(e=[e]);var r=e.map((function(e){return _i(e,t)})),o=function(e){return r.some((function(t){return Ri(t,e)}))};return null==n?o:o(n)}function _i(e,t){var n=t&&t.byKey,r={},o=(e=e.replace("++","+add")).split("+"),i=o.length;for(var a in Ei)r[Ei[a]]=!1;var l=!0,c=!1,s=void 0;try{for(var d,u=o[Symbol.iterator]();!(l=(d=u.next()).done);l=!0){var f=d.value,p=f.endsWith("?")&&f.length>1;p&&(f=f.slice(0,-1));var h=Bi(f),g=Ei[h];if(f.length>1&&!g&&!Ci[f]&&!Oi[h])throw new TypeError('Unknown modifier: "'+f+'"');1!==i&&g||(n?r.key=h:r.which=ji(f)),g&&(r[g]=!p||null)}}catch(e){c=!0,s=e}finally{try{!l&&u.return&&u.return()}finally{if(c)throw s}}return r}function Ri(e,t){for(var n in e){var r=e[n],o=void 0;if(null!=r&&((null!=(o="key"===n&&null!=t.key?t.key.toLowerCase():"which"===n?91===r&&93===t.which?91:t.which:t[n])||!1!==r)&&o!==r))return!1}return!0}function ji(e){return e=Bi(e),Oi[e]||e.toUpperCase().charCodeAt(0)}function Bi(e){return e=e.toLowerCase(),e=Ci[e]||e}xi.default=Di,xi.isHotkey=Di,xi.isCodeHotkey=function(e,t){return Di(e,t)};var Ai=xi.isKeyHotkey=function(e,t){return Di(e,{byKey:!0},t)};xi.parseHotkey=_i,xi.compareHotkey=Ri,xi.toKeyCode=ji,xi.toKeyName=Bi;const Ti={bold:"mod+b",italic:"mod+i",compose:["down","left","right","up","backspace","enter"],arrowLeft:"left",arrowUp:"up",arrowDown:"down",arrowRight:"right",ctrlLeft:"ctrl+left",escape:"esc",ctrlRight:"ctrl+right",deleteBackward:"shift?+backspace",backspace:"backspace",deleteForward:"shift?+delete",extendBackward:"shift+left",extendForward:"shift+right",shiftEnter:"shift+enter",enter:"enter",space:"space",undo:"mod+z",select:"mod+a",shiftTab:"shift+tab",shiftArrowUp:"shift+up",shiftArrowDown:"shift+down",tab:"tab",cmd:"mod",cmdEnter:"mod+enter",slashCommand:"/",kekCeburek:"mod+enter"},Li={moveLineBackward:"opt+up",moveLineForward:"opt+down",ctrlLeft:"opt+left",ctrlRight:"opt+right",deleteBackward:["ctrl+backspace","ctrl+h"],deleteForward:["ctrl+delete","ctrl+d"],deleteLineBackward:"cmd+shift?+backspace",deleteLineForward:["cmd+shift?+delete","ctrl+k"],deleteWordBackward:"opt+shift?+backspace",deleteWordForward:"opt+shift?+delete",extendLineBackward:"opt+shift+up",extendLineForward:"opt+shift+down",redo:"cmd+shift+z",transposeCharacter:"ctrl+t"},Ni={deleteWordBackward:"ctrl+shift?+backspace",deleteWordForward:"ctrl+shift?+delete",redo:["ctrl+y","ctrl+shift+z"]},Mi=e=>{const t=Ti[e],n=Li[e],r=Ni[e],o=t&&Ai(t),i=n&&Ai(n),a=r&&Ai(r);return e=>!(!o||!o(e))||(!(!i||!i(e))||!(!a||!a(e)))},Ii={isBold:Mi("bold"),isCompose:Mi("compose"),isArrowLeft:Mi("arrowLeft"),isArrowRight:Mi("arrowRight"),isArrowUp:Mi("arrowUp"),isArrowDown:Mi("arrowDown"),isDeleteBackward:Mi("deleteBackward"),isDeleteForward:Mi("deleteForward"),isDeleteLineBackward:Mi("deleteLineBackward"),isDeleteLineForward:Mi("deleteLineForward"),isDeleteWordBackward:Mi("deleteWordBackward"),isDeleteWordForward:Mi("deleteWordForward"),isExtendBackward:Mi("extendBackward"),isExtendForward:Mi("extendForward"),isExtendLineBackward:Mi("extendLineBackward"),isExtendLineForward:Mi("extendLineForward"),isItalic:Mi("italic"),isMoveLineBackward:Mi("moveLineBackward"),isMoveLineForward:Mi("moveLineForward"),isCtrlLeft:Mi("ctrlLeft"),isCtrlRight:Mi("ctrlRight"),isRedo:Mi("redo"),isShiftEnter:Mi("shiftEnter"),isEnter:Mi("enter"),isTransposeCharacter:Mi("transposeCharacter"),isUndo:Mi("undo"),isSpace:Mi("space"),isSelect:Mi("select"),isTab:Mi("tab"),isShiftTab:Mi("shiftTab"),isBackspace:Mi("backspace"),isCmdEnter:Mi("cmdEnter"),isCmd:Mi("cmd"),isEscape:Mi("escape"),isSlashCommand:Mi("slashCommand"),isShiftArrowUp:Mi("shiftArrowUp"),isShiftArrowDown:Mi("shiftArrowDown"),isKekceburek:Mi("kekCeburek")};const Pi={onKeyDown:function(e){return t=>{const n=In(e,{at:e.selection});if(!n||!n.selection)return;const r=S.parent(n.selection.anchor.path);if(Ii.isShiftEnter(t)){if(t.isDefaultPrevented())return;return t.preventDefault(),void n.insertText("\n")}if(Ii.isEnter(t)){if(t.isDefaultPrevented())return;t.preventDefault();const o=D.isStart(n,n.selection.anchor,r),i=D.isEnd(n,n.selection.anchor,r);if(!o&&!i)return void e.splitBlock({slate:n,focus:!0});const a=ee({id:J()}),l=e.selection?[e.selection[0]+1]:[0];e.insertBlock(a,{at:l,slate:n,focus:!0})}else if(Ii.isBackspace(t)){if(t.isDefaultPrevented())return;const r=N(e,{at:e.selection}),o=e.blocks[(null==r?void 0:r.type)||""],i=S.parent(n.selection.anchor.path);if(D.isStart(n,n.selection.anchor,i)){t.preventDefault();const r=D.string(n,i),a=e.selection?e.selection[0]-1:0,l=In(e,{at:[a]});let c;if(l&&!o.hasCustomEditor&&(c=function(e,t){const[,n]=D.last(e,t);return{path:n,offset:D.string(e,n).length}}(l,i)),0===r.trim().length)return e.deleteBlock({at:e.selection,focus:!0,focusAt:c});{if(j.isExpanded(n.selection))return R.delete(n,{at:n.selection});if(!l)return;if(0===D.string(l,[0,0]).length)return e.deleteBlock({at:[a],focus:!0,focusAt:c});const t=Array.from(D.nodes(n,{at:[0],match:e=>!D.isEditor(e)&&(B.isText(e)||D.isInline(n,e)),mode:"highest"})).map((([e])=>e));return R.insertNodes(l,t,{at:D.end(l,[])}),e.deleteBlock({at:e.selection,focus:!0,focusAt:c})}}}else{if(Ii.isSelect(t)){if(t.isDefaultPrevented())return;const[,r]=D.first(n,[0]),[,o]=D.last(n,[n.children.length-1]),i=D.range(n,r,o),a=j.equals(n.selection,i);if(j.isExpanded(n.selection)&&a)return t.preventDefault(),x.blur(n),x.deselect(n),R.deselect(n),void e.setBlockSelected([],{allSelected:!0})}if(Ii.isShiftTab(t)){if(t.isDefaultPrevented())return;return t.preventDefault(),void e.decreaseBlockDepth()}if(Ii.isTab(t)){if(t.isDefaultPrevented())return;return t.preventDefault(),void e.increaseBlockDepth()}if(Ii.isArrowUp(t)){if(t.isDefaultPrevented())return;const r=S.parent(n.selection.anchor.path);if(D.isStart(n,n.selection.anchor,r)){const n=e.selection?[e.selection[0]-1]:null,r=In(e,{at:n}),o=N(e,{at:n});if(r&&o){const[,n]=D.last(r,[0]),i={path:n,offset:D.string(r,n).length};return t.preventDefault(),void e.focusBlock(o.id,{focusAt:i,waitExecution:!1,shouldUpdateBlockSelection:!0})}}}if(Ii.isArrowDown(t)){const r=S.parent(n.selection.anchor.path);if(D.isEnd(n,n.selection.anchor,r)){const n=e.selection?[e.selection[0]+1]:null,o=In(e,{at:n}),i=N(e,{at:n});if(o&&i){const n=function(e,t){const[,n]=D.first(e,t);return{path:n,offset:0}}(o,r);return t.preventDefault(),void e.focusBlock(i.id,{focusAt:n,waitExecution:!1})}}}if(j.isExpanded(n.selection)){if(Object.values(e.formats).length>0)for(const n of Object.values(e.formats))if(n.hotkey&&Ai(n.hotkey)(t)){t.preventDefault(),e.formats[n.type].toggle();break}}}}}},zi=({children:t,attributes:n,placeholder:r})=>{const o=k(),i=Object.assign({},n);return o&&r&&(i["data-placeholder"]=r,i.className="yoopta-placeholder"),e("span",Object.assign({},i,{children:t}))};function Fi(e){try{return new URL(e),!0}catch(e){return!1}}const Ui=(e,t)=>{(e=>{const[t]=D.nodes(e,{match:e=>!D.isEditor(e)&&_.isElement(e)&&"link"===e.type});return!!t})(e)&&(e=>{R.unwrapNodes(e,{match:e=>!D.isEditor(e)&&_.isElement(e)&&"link"===e.type})})(e);const{selection:n}=e,r=n&&j.isCollapsed(n),o={type:"link",children:r?[{text:t}]:[],props:{url:t,target:"_blank",rel:"noreferrer"}};r?R.insertNodes(e,o):(R.wrapNodes(e,o,{split:!0}),R.collapse(e,{edge:"end"}))};function Vi(e){return!!(e&&e.id&&e.type&&e.value&&e.meta)}const Hi={B:{type:"bold"},STRONG:{type:"bold"},I:{type:"italic"},U:{type:"underline"},S:{type:"strike"},CODE:{type:"code"},EM:{type:"code"}};function Wi(e,t,n){var r,o,i;if(3===n.nodeType){return null===(r=n.textContent)||void 0===r?void 0:r.replace(/[\t\n\r\f\v]+/g," ")}if(1!==n.nodeType)return null;if("BR"===n.nodeName)return"\n";const a=n;let l=Array.from(a.childNodes).map((n=>Wi(e,t,n))).flat();if(Hi[n.nodeName]){return{[Hi[n.nodeName].type]:!0,text:null===(o=n.textContent)||void 0===o?void 0:o.replace(/[\t\n\r\f\v]+/g," ")}}if(t[n.nodeName]){const r=t[n.nodeName],o=e.blocks[r.type],a=ii(o.elements)||"",c=o.elements[a],s="void"===(null===(i=c.props)||void 0===i?void 0:i.nodeType);let d={id:J(),type:a,children:s&&!o.hasCustomEditor?[{text:""}]:l.map(Ki),props:Object.assign({nodeType:"block"},c.props)};if(r.parse){const e=r.parse(n);if(e)if(_.isElement(e))d=e;else if(Array.isArray(e)){return e}}0===d.children.length&&(d.children=[{text:""}]);return ee({id:J(),type:r.type,value:[d],meta:{order:0,depth:0}})}return l}function Ki(e){if("string"==typeof e)return{text:e};if(Array.isArray(e))return{text:e[0]};if(e.text)return e;if(Vi(e)){let t="";return e.value[0].children.forEach((e=>{t+=`${e.text}`})),{text:t}}return{text:""}}const Yi={html:{deserialize:function(e,t){const n=function(e){const t={};return Object.keys(e.plugins).forEach((n=>{const r=e.plugins[n],{parsers:o}=r;if(o){const{html:e}=o;if(e){const{deserialize:r}=e;if(r){const{nodeNames:e}=r;e&&e.forEach((e=>{t[e]={type:n,parse:r.parse}}))}}}})),t}(e),r=Wi(e,n,t).filter(Vi);return console.log("html",t),r},serialize:function(){}},markdown:{}},Xi=({id:t,customEditor:r,elements:o,marks:i,events:a,options:c,placeholder:s="Type '/' for commands"})=>{const u=z(),f=F(t),p=l(f.value).current,h=f.type,g=d((()=>(e=>{const t={};return Object.keys(e).forEach((n=>t[n]=e[n].render)),t})(o)),[o]),v=d((()=>(e=>{const t={};return e?(e.forEach((e=>t[e.type]=e)),t):t})(i)),[i]),m=d((()=>{let e=u.blockEditorsMap[t];return Object.keys(o).forEach((t=>{var n;const r=null===(n=o[t].props)||void 0===n?void 0:n.nodeType,i="inline"===r,a="void"===r,l="inlineVoid"===r;l&&(e.markableVoid=e=>e.type===t),(a||l)&&(e.isVoid=e=>e.type===t),(i||l)&&(e.isInline=e=>e.type===t,e=(e=>{const{insertData:t,insertText:n}=e;return e.insertText=t=>{t&&Fi(t)?Ui(e,t):n(t)},e.insertData=n=>{const r=n.getData("text/plain");r&&Fi(r)?Ui(e,r):t(n)},e})(e))})),e}),[]),b=d((()=>{if(!a||u.readOnly)return{};const e={hotkeys:Ii,currentBlock:f,defaultBlock:ee({id:J()})},t={};return Object.keys(a).forEach((n=>{t[n]=function(t){if(a[n]){a[n](u,m,e)(t)}}})),t}),[a,u,f]);return e("div",Object.assign({"data-plugin-id":t,"data-plugin-type":h},{children:e($i,{id:t,slate:m,initialValue:p,onChange:e=>u.updateBlock(t,{value:e}),decorate:e=>{var t;const n=[];if(u.readOnly)return n;const[r,o]=e,i=(null===(t=u.selection)||void 0===t?void 0:t[0])===f.meta.order;return m.selection&&i&&!D.isEditor(r)&&""===D.string(m,[o[0]])&&j.includes(m.selection,o)&&j.isCollapsed(m.selection)&&n.push(Object.assign(Object.assign({},m.selection),{withPlaceholder:!0})),n},renderLeaf:t=>{var n,r,o,i,a;let{children:l,leaf:c,attributes:d}=t;const p=wi(c,["text"]),h=(null===(n=u.selection)||void 0===n?void 0:n[0])===f.meta.order;p&&Object.keys(p).forEach((e=>{const t=v[e];t&&(l=t.render({children:l,leaf:c}))}));const g=!("void"===(null===(a=null===(i=null===(o=null===(r=t.children)||void 0===r?void 0:r.props)||void 0===o?void 0:o.parent)||void 0===i?void 0:i.props)||void 0===a?void 0:a.nodeType))&&h&&c.withPlaceholder;return e(zi,Object.assign({attributes:d,placeholder:g?s:void 0},{children:l}))},renderElement:r=>{const o=g[r.element.type];return o?e(o,Object.assign({},r,{blockId:t,options:c})):e(n,{})},eventHandlers:b,onKeyDown:e=>{var t;u.readOnly||(null===(t=b.onKeyDown)||void 0===t||t.call(b,e),Pi.onKeyDown(u)(e))},onKeyUp:e=>{var t;u.readOnly||null===(t=null==b?void 0:b.onKeyUp)||void 0===t||t.call(b,e)},onFocus:e=>{var t;u.readOnly||null===(t=null==b?void 0:b.onFocus)||void 0===t||t.call(b,e)},onClick:e=>{var t,n;u.readOnly||((null===(t=u.selection)||void 0===t?void 0:t[0])!==f.meta.order&&u.setSelection([f.meta.order]),null===(n=null==b?void 0:b.onClick)||void 0===n||n.call(b,e))},onBlur:e=>{var t;u.readOnly||(e.preventDefault(),null===(t=null==b?void 0:b.onBlur)||void 0===t||t.call(b,e))},customEditor:r,readOnly:u.readOnly,onPaste:e=>{var t;if(u.readOnly)return;null===(t=null==b?void 0:b.onPaste)||void 0===t||t.call(b,e);const n=e.clipboardData.getData("text/html"),r=(new DOMParser).parseFromString(n,"text/html");if(r.body.childNodes.length>0){e.preventDefault();const t=Yi.html.deserialize(u,r.body);if(t.length>0)return void u.insertBlocks(t,{at:u.selection,focus:!0})}},onCopy:e=>{var t;u.readOnly||null===(t=null==b?void 0:b.onCopy)||void 0===t||t.call(b,e)}})}))},$i=p((({id:t,slate:n,initialValue:r,onChange:o,renderLeaf:i,renderElement:a,eventHandlers:l,onKeyDown:c,onKeyUp:s,onFocus:d,onClick:u,onBlur:f,onPaste:p,customEditor:h,decorate:g,readOnly:v})=>"function"==typeof h?h({blockId:t}):e(E,Object.assign({editor:n,initialValue:r,onChange:o},{children:e(C,Object.assign({renderElement:a,renderLeaf:i,className:"focus-visible:outline-none focus:outline-none",spellCheck:!0},l,{onKeyDown:c,onKeyUp:s,onFocus:d,onClick:u,decorate:g,onBlur:f,readOnly:v,onPaste:p}),`editable-${t}`)}),`slate-${t}`)));$i.displayName="SlateEditorInstance";const Zi=({editor:e})=>({sensors:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return d((()=>[...t].filter((e=>null!=e))),[...t])}(Le(Ot,{activationConstraint:{delay:100,tolerance:0}}),Le(wt,{coordinateGetter:Rn})),handleDragEnd:u((t=>{const{active:n,over:r}=t;if(n&&r&&n.id!==r.id){const t=e.children[r.id].meta.order;e.moveBlock(n.id,[t])}}),[]),handleDragStart:u((t=>{e.setBlockSelected(null)}),[])}),qi=[],Gi=({editor:t,marks:r,placeholder:o})=>{const i=H(),{sensors:a,handleDragEnd:l,handleDragStart:c}=Zi({editor:t}),s=Object.keys(t.children),u=d((()=>0===s.length?qi:s.sort(((e,n)=>t.children[e].meta.order-t.children[n].meta.order))),[s]),f=[];for(let n=0;n<u.length;n++){const i=u[n],a=t.children[i],l=t.plugins[a.type];a&&l?f.push(e(yi,Object.assign({block:a,blockId:i},{children:e(Xi,{type:a.type,id:i,marks:r,customEditor:l.customEditor,events:l.events,elements:l.elements,options:l.options,placeholder:o},i)}),i)):console.error(`Plugin ${a.type} not found`)}return i?e(n,{children:f}):e(rn,Object.assign({sensors:a,collisionDetection:Ve,onDragStart:c,onDragEnd:l},{children:e(yn,Object.assign({disabled:i,items:u,strategy:vn},{children:f}))}))},Ji=({editor:e,yooptaEditorRef:t,root:n})=>{const[r,o]=f({origin:[0,0],coords:[0,0],selection:!1}),i=n=>{var i;if(e.readOnly)return;const a=null===(i=t.current)||void 0===i?void 0:i.contains(n.target);if(!a&&!r.selection&&Array.isArray(e.selectedBlocks)&&e.selectedBlocks.length>0)return e.setBlockSelected(null),c();a||o({origin:[n.pageX,n.pageY-window.pageYOffset],coords:[n.pageX,n.pageY-window.pageYOffset],selection:!0})},a=t=>{if(!r.selection||e.readOnly)return;o((e=>Object.assign(Object.assign({},e),{coords:[t.pageX,t.pageY-window.pageYOffset]})));const n=((e,t)=>{const n=[];return document.querySelectorAll("[data-yoopta-block]").forEach(((r,o)=>{if(!r)return;const i=r.getBoundingClientRect(),a=Math.min(e[1],t[1]),l=Math.min(e[0],t[0]),c=Math.max(e[1],t[1]),s=Math.max(e[0],t[0]);a<i.bottom&&c>i.top&&l<i.right&&s>i.left&&n.push(o)})),n})(r.origin,[t.pageX,t.pageY-window.pageYOffset]);e.setBlockSelected(n,{only:!0})},l=()=>{e.readOnly||c()};s((()=>{var r;if(e.readOnly)return;const o=n&&"current"in n?n.current:n||document;if(!o)throw new Error("Root element not found. Please check the `selectionBoxRoot` prop");if(!("nodeType"in o))throw new Error("Root element should be a DOM element or a ref object. Please check the `selectionBoxRoot` prop");if(null===(r=t.current)||void 0===r?void 0:r.contains(o))throw new Error("Root element should not be a child of the editor. Please check the `selectionBoxRoot` prop");return o.addEventListener("mousedown",i),o.addEventListener("mousemove",a),o.addEventListener("mouseup",l),()=>{o.removeEventListener("mousedown",i),o.removeEventListener("mousemove",a),o.removeEventListener("mouseup",l)}}),[e.selectedBlocks,r,n,e.readOnly]);const c=()=>{o({origin:[0,0],coords:[0,0],selection:!1})};return Object.assign(Object.assign({},r),{onClose:c})},Qi=({origin:t,coords:n,isOpen:r})=>{if(!r)return null;const o={zIndex:10,left:t[0],top:t[1],height:Math.abs(n[1]-t[1]-1),width:Math.abs(n[0]-t[0]-1),userSelect:"none",transformOrigin:"top left",transform:t[1]>n[1]&&t[0]>n[0]?"scaleY(-1) scaleX(-1)":t[1]>n[1]?"scaleY(-1)":t[0]>n[0]?"scaleX(-1)":void 0,position:"fixed",backgroundColor:"rgba(35, 131, 226, 0.14)"};return e("div",{style:o})},ea={selectionStarted:!1,indexToSelect:null,startedIndexToSelect:null},ta=({placeholder:n,marks:r,className:o,autoFocus:i=!0,selectionBoxRoot:a})=>{const c=z(),d=H(),u=l(null),f=Ji({editor:c,yooptaEditorRef:u,root:a});console.log("editor",c.blocks);let p=l(ea).current;s((()=>{if(!i||d)return;const e=N(c,{at:[0]});e&&c.focusBlock(e.id,{waitExecution:!0})}),[i,d]),s((()=>{if(!d)return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)}),[c.selectedBlocks,d]);const h=()=>{d||Array.isArray(c.selectedBlocks)&&c.selectedBlocks.length>0&&c.setBlockSelected(null)},g=()=>{p.indexToSelect=null,p.startedIndexToSelect=null,p.selectionStarted=!1},v=e=>{var t,n,r,o,i;if(!d){if(Ii.isSelect(e)){if((null===(t=c.selectedBlocks)||void 0===t?void 0:t.length)===Object.keys(c.children).length)return void e.preventDefault();if(p.selectionStarted)return e.preventDefault(),void c.setBlockSelected([],{allSelected:!0})}if(Ii.isBackspace(e)){e.stopPropagation();if(Array.isArray(c.selectedBlocks)&&(null===(n=c.selectedBlocks)||void 0===n?void 0:n.length)===Object.keys(c.children).length)return e.preventDefault(),c.deleteBlock({deleteAll:!0}),c.setBlockSelected(null),void g();if(Array.isArray(c.selectedBlocks)&&(null===(r=c.selectedBlocks)||void 0===r?void 0:r.length)>0)return e.preventDefault(),c.deleteBlock({fromPaths:c.selectedBlocks}),c.setBlockSelected(null),void g()}if(Ii.isShiftArrowUp(e)){if("function"==typeof e.isDefaultPrevented&&e.isDefaultPrevented())return;if(p.selectionStarted&&null!==p.startedIndexToSelect&&null!==p.indexToSelect){const e=p.indexToSelect,t=e-1;if(0===e)return;if(e===p.startedIndexToSelect)return c.setBlockSelected([t]),void(p.indexToSelect=t);if(t<p.startedIndexToSelect)return c.setBlockSelected([t]),void(p.indexToSelect=t);if((null===(o=c.selectedBlocks)||void 0===o?void 0:o.includes(e))&&e!==p.startedIndexToSelect){const n=c.selectedBlocks.filter((t=>t!==e));return c.setBlockSelected(n,{only:!0}),void(p.indexToSelect=t)}return}const t=N(c),n=In(c);if(!n||!n.selection||!t)return;const r=S.parent(n.selection.anchor.path),i=D.isStart(n,n.selection.focus,r);if(j.isExpanded(n.selection)&&i){const r=c.selection?[c.selection[0]-1]:[0],o=N(c,{at:r});t&&o&&(e.preventDefault(),x.blur(n),x.deselect(n),R.deselect(n),c.setSelection(null),c.setBlockSelected([null==t?void 0:t.meta.order,t.meta.order-1]),p.startedIndexToSelect=t.meta.order,p.indexToSelect=t.meta.order-1,p.selectionStarted=!0)}}if(Ii.isShiftArrowDown(e)){if(p.selectionStarted&&null!==p.indexToSelect&&null!==p.startedIndexToSelect){const e=p.indexToSelect,t=e+1;if(t===Object.keys(c.children).length)return;if(e===p.startedIndexToSelect)return c.setBlockSelected([t]),void(p.indexToSelect=t);if(t>p.startedIndexToSelect)return c.setBlockSelected([t]),void(p.indexToSelect=t);if((null===(i=c.selectedBlocks)||void 0===i?void 0:i.includes(e))&&e!==p.startedIndexToSelect){const n=c.selectedBlocks.filter((t=>t!==e));return c.setBlockSelected(n,{only:!0}),void(p.indexToSelect=t)}return}const t=N(c),n=In(c);if(!n||!n.selection||!t)return;const r=S.parent(n.selection.anchor.path),o=D.isEnd(n,n.selection.focus,r);if(j.isExpanded(n.selection)&&o){const r=c.selection?[c.selection[0]+1]:[0],o=N(c,{at:r});t&&o&&(e.preventDefault(),x.blur(n),x.deselect(n),R.deselect(n),c.setSelection(null),c.setBlockSelected([null==t?void 0:t.meta.order,(null==t?void 0:t.meta.order)+1]),p.startedIndexToSelect=t.meta.order,p.indexToSelect=t.meta.order+1,p.selectionStarted=!0)}}}},m=(b={userSelect:f.selection?"none":"auto",pointerEvents:f.selection?"none":"auto"},Object.assign({paddingBottom:150},b));var b;return t("div",Object.assign({id:"yoopta-editor",className:o,style:m,ref:u,onClick:e=>{d||(g(),(e=>{var t;const n=u.current;if(!n)return;const{bottom:r}=n.getBoundingClientRect(),o=r-parseInt(getComputedStyle(n).paddingBottom,10),i=ee({id:J()});if(e.clientY>=o){const e=Object.keys(c.children).length-1,n=N(c,{at:[e]}),r=In(c,{at:[e]});if(n&&r&&r.selection){const e=D.string(r,r.selection.anchor.path),o=S.parent(r.selection.anchor.path),[a]=D.node(r,o);if(n.type===i.type&&_.isElement(a)&&"void"!==(null===(t=a.props)||void 0===t?void 0:t.nodeType)&&0===e.trim().length)return void c.focusBlock(n.id,{slate:r})}const o=e+1;c.insertBlock(i,{at:[o],focus:!0})}})(e),h())},onBlur:e=>{var t;(null===(t=u.current)||void 0===t?void 0:t.contains(e.relatedTarget))||d||(g(),h())}},{children:[e(Gi,{editor:c,marks:r,placeholder:n}),e(Qi,{origin:f.origin,coords:f.coords,isOpen:f.selection&&!d||null===a})]}))},na=({children:e,fallback:t=null})=>{const[n,r]=f(!1);return s((()=>r(!0)),[]),n?e:t};var ra=Symbol.for("immer-nothing"),oa=Symbol.for("immer-draftable"),ia=Symbol.for("immer-state");function aa(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var la=Object.getPrototypeOf;function ca(e){return!!e&&!!e[ia]}function sa(e){return!!e&&(ua(e)||Array.isArray(e)||!!e[oa]||!!e.constructor?.[oa]||va(e)||ma(e))}var da=Object.prototype.constructor.toString();function ua(e){if(!e||"object"!=typeof e)return!1;const t=la(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)===da}function fa(e,t){0===pa(e)?Reflect.ownKeys(e).forEach((n=>{t(n,e[n],e)})):e.forEach(((n,r)=>t(r,n,e)))}function pa(e){const t=e[ia];return t?t.type_:Array.isArray(e)?1:va(e)?2:ma(e)?3:0}function ha(e,t){return 2===pa(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function ga(e,t,n){const r=pa(e);2===r?e.set(t,n):3===r?e.add(n):e[t]=n}function va(e){return e instanceof Map}function ma(e){return e instanceof Set}function ba(e){return e.copy_||e.base_}function ya(e,t){if(va(e))return new Map(e);if(ma(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);if(!t&&ua(e)){if(!la(e)){const t=Object.create(null);return Object.assign(t,e)}return{...e}}const n=Object.getOwnPropertyDescriptors(e);delete n[ia];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(la(e),n)}function wa(e,t=!1){return ka(e)||ca(e)||!sa(e)||(pa(e)>1&&(e.set=e.add=e.clear=e.delete=xa),Object.freeze(e),t&&Object.entries(e).forEach((([e,t])=>wa(t,!0)))),e}function xa(){aa(2)}function ka(e){return Object.isFrozen(e)}var Ea,Ca={};function Oa(e){const t=Ca[e];return t||aa(0),t}function Sa(){return Ea}function Da(e,t){t&&(Oa("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function _a(e){Ra(e),e.drafts_.forEach(Ba),e.drafts_=null}function Ra(e){e===Ea&&(Ea=e.parent_)}function ja(e){return Ea={drafts_:[],parent_:Ea,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Ba(e){const t=e[ia];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function Aa(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return void 0!==e&&e!==n?(n[ia].modified_&&(_a(t),aa(4)),sa(e)&&(e=Ta(t,e),t.parent_||Na(t,e)),t.patches_&&Oa("Patches").generateReplacementPatches_(n[ia].base_,e,t.patches_,t.inversePatches_)):e=Ta(t,n,[]),_a(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==ra?e:void 0}function Ta(e,t,n){if(ka(t))return t;const r=t[ia];if(!r)return fa(t,((o,i)=>La(e,r,t,o,i,n))),t;if(r.scope_!==e)return t;if(!r.modified_)return Na(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),fa(o,((o,a)=>La(e,r,t,o,a,n,i))),Na(e,t,!1),n&&e.patches_&&Oa("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function La(e,t,n,r,o,i,a){if(ca(o)){const a=Ta(e,o,i&&t&&3!==t.type_&&!ha(t.assigned_,r)?i.concat(r):void 0);if(ga(n,r,a),!ca(a))return;e.canAutoFreeze_=!1}else a&&n.add(o);if(sa(o)&&!ka(o)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;Ta(e,o),t&&t.scope_.parent_||"symbol"==typeof r||!Object.prototype.propertyIsEnumerable.call(n,r)||Na(e,o)}}function Na(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&wa(t,n)}var Ma={get(e,t){if(t===ia)return e;const n=ba(e);if(!ha(n,t))return function(e,t,n){const r=za(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_||!sa(r)?r:r===Pa(e.base_,t)?(Ua(e),e.copy_[t]=Va(r,e)):r},has:(e,t)=>t in ba(e),ownKeys:e=>Reflect.ownKeys(ba(e)),set(e,t,n){const r=za(ba(e),t);if(r?.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const r=Pa(ba(e),t),a=r?.[ia];if(a&&a.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(((o=n)===(i=r)?0!==o||1/o==1/i:o!=o&&i!=i)&&(void 0!==n||ha(e.base_,t)))return!0;Ua(e),Fa(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!==Pa(e.base_,t)||t in e.base_?(e.assigned_[t]=!1,Ua(e),Fa(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0),getOwnPropertyDescriptor(e,t){const n=ba(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r?{writable:!0,configurable:1!==e.type_||"length"!==t,enumerable:r.enumerable,value:n[t]}:r},defineProperty(){aa(11)},getPrototypeOf:e=>la(e.base_),setPrototypeOf(){aa(12)}},Ia={};function Pa(e,t){const n=e[ia];return(n?ba(n):e)[t]}function za(e,t){if(!(t in e))return;let n=la(e);for(;n;){const e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=la(n)}}function Fa(e){e.modified_||(e.modified_=!0,e.parent_&&Fa(e.parent_))}function Ua(e){e.copy_||(e.copy_=ya(e.base_,e.scope_.immer_.useStrictShallowCopy_))}fa(Ma,((e,t)=>{Ia[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),Ia.deleteProperty=function(e,t){return Ia.set.call(this,e,t,void 0)},Ia.set=function(e,t,n){return Ma.set.call(this,e[0],t,n,e[0])};function Va(e,t){const n=va(e)?Oa("MapSet").proxyMap_(e,t):ma(e)?Oa("MapSet").proxySet_(e,t):function(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:Sa(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let o=r,i=Ma;n&&(o=[r],i=Ia);const{revoke:a,proxy:l}=Proxy.revocable(o,i);return r.draft_=l,r.revoke_=a,l}(e,t);return(t?t.scope_:Sa()).drafts_.push(n),n}function Ha(e){if(!sa(e)||ka(e))return e;const t=e[ia];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=ya(e,t.scope_.immer_.useStrictShallowCopy_)}else n=ya(e,!0);return fa(n,((e,t)=>{ga(n,e,Ha(t))})),t&&(t.finalized_=!1),n}var Wa=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&&aa(6),void 0!==n&&"function"!=typeof n&&aa(7),sa(e)){const o=ja(this),i=Va(e,void 0);let a=!0;try{r=t(i),a=!1}finally{a?_a(o):Ra(o)}return Da(o,n),Aa(r,o)}if(!e||"object"!=typeof e){if(r=t(e),void 0===r&&(r=e),r===ra&&(r=void 0),this.autoFreeze_&&wa(r,!0),n){const t=[],o=[];Oa("Patches").generateReplacementPatches_(e,r,t,o),n(t,o)}return r}aa(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){sa(e)||aa(8),ca(e)&&(e=function(e){ca(e)||aa(10);return Ha(e)}(e));const t=ja(this),n=Va(e,void 0);return n[ia].isManual_=!0,Ra(t),n}finishDraft(e,t){const n=e&&e[ia];n&&n.isManual_||aa(9);const{scope_:r}=n;return Da(r,t),Aa(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=Oa("Patches").applyPatches_;return ca(e)?r(e,t):this.produce(e,(e=>r(e,t)))}};Wa.produce,Wa.produceWithPatches.bind(Wa),Wa.setAutoFreeze.bind(Wa),Wa.setUseStrictShallowCopy.bind(Wa),Wa.applyPatches.bind(Wa);var Ka=Wa.createDraft.bind(Wa),Ya=Wa.finishDraft.bind(Wa);function Xa(e,t){const n=In(e);if(!n)return!1;const r=D.marks(n);return!!(null==r?void 0:r[t])}const $a=(e,t)=>{const{insertText:n}=t;return t.insertText=r=>{var o;const{selection:i}=t;if(" "===r&&i&&j.isCollapsed(i)){const{anchor:a}=i,l=D.above(t,{match:e=>_.isElement(e)&&D.isBlock(t,e),mode:"lowest"});if(!l)return;const[,c]=l,s=D.parent(t,c),[d]=s;if(_.isElement(d)&&!B.isText(d.children[0]))return n(r);const u=l?c:[],f={anchor:a,focus:D.start(t,u)},p=D.string(t,f),h=null===(o=e.shortcuts)||void 0===o?void 0:o[p];if(!!h&&!h.isActive())return R.select(t,f),R.delete(t),void h.create({deleteText:!1})}n(r)},t};function Za(e,t,n){e.children=Ka(e.children);let r=!1;const o=e.children[t];if(!o)throw Error(`Block with id ${t} not found`);n.id&&(o.id=n.id,r=!0),n.type&&(o.type=n.type,r=!0),n.meta&&(o.meta=n.meta,r=!0),n.value&&(o.value=n.value),e.children=Ya(e.children),r&&e.applyChanges(),e.emit("change",e.children)}function qa(e,t,n){e.children=Ka(e.children);const r=N(e,{at:e.selection});if(!r)throw new Error("Block from not found at current selection");const o=ii(e.blocks[r.type].elements);if(r.type===t)return void(e.children=Ya(e.children));const i=In(e,{at:[r.meta.order]});if(!i)throw new Error(`Slate not found for block in position ${r.meta.order}`);const a=ii(e.blocks[t].elements);D.withoutNormalizing(i,(()=>{!function(e,t={}){var n;const{at:r,elementType:o}=t,i=r||(null===(n=e.selection)||void 0===n?void 0:n.anchor.path);if(!i)return;let a=e=>!D.isEditor(e)&&_.isElement(e);o&&(a=e=>!D.isEditor(e)&&_.isElement(e)&&e.type===o);const l=S.parent(i),c=D.nodes(e,{at:l,match:a,mode:"lowest"});if(c){const[e]=c}}(i,{elementType:o}),R.setNodes(i,{type:a},{at:[0],mode:"lowest",match:e=>_.isElement(e)&&!D.isInline(i,e)});const n={id:r.id,type:t,meta:Object.assign(Object.assign({},r.meta),{order:r.meta.order}),value:i.children};e.blockEditorsMap[r.id]=i,e.children[r.id]=n,e.children=Ya(e.children),e.applyChanges(),e.emit("change",e.children)}))}function Ga(e,t={}){const{at:n=e.selection,deleteAll:r=!1,fromPaths:o,focus:i}=t;if(Array.isArray(o)&&o.length>0){e.children=Ka(e.children),o.forEach((t=>{const n=N(e,{at:[t]});n&&(delete e.children[n.id],delete e.blockEditorsMap[n.id])}));return Object.keys(e.children).forEach(((t,n)=>{e.children[t].meta.order=n})),e.children=Ya(e.children),e.applyChanges(),void e.emit("change",e.children)}if(r||1===Object.keys(e.children).length){e.children={},e.blockEditorsMap={};const t=ee({id:J()}),n=el(e);return e.children[t.id]=t,e.blockEditorsMap[t.id]=n,e.setSelection([0]),e.setBlockSelected(null),e.focusBlock(t.id,{slate:n,waitExecution:!0}),e.applyChanges(),void e.emit("change",e.children)}if(!n)return;e.children=Ka(e.children);const[a]=n,l=Object.keys(e.children),c=l.find((t=>e.children[t].meta.order===a));if(l.forEach((t=>{const n=e.children[t];n.meta.order>a&&(n.meta.order-=1)})),c&&(delete e.children[c],delete e.blockEditorsMap[c]),e.children=Ya(e.children),e.applyChanges(),e.emit("change",e.children),i){const n=e.selection?e.selection[0]-1:0,r=N(e,{at:[n]});r&&e.focusBlock(r.id,{focusAt:t.focusAt})}}function Ja(e,t){const n={};return t.forEach((t=>{const r=t.type;n[r]={hotkey:t.hotkey,type:r,getValue:()=>function(e,t){const n=In(e);if(!n)return null;const r=D.marks(n);return null==r?void 0:r[t]}(e,r),isActive:()=>Xa(e,r),toggle:()=>function(e,t){const n=In(e),r=Xa(e,t);n&&(r?D.removeMark(n,t):D.addMark(n,t,!0),e.applyChanges(),e.emit("change",e.children))}(e,r),update:t=>function(e,t,n){const r=In(e);r&&r.selection&&j.isExpanded(r.selection)&&(D.addMark(r,t,n),e.applyChanges(),e.emit("change",e.children))}(e,r,t)}})),n}function Qa(e,t){const n={};return t.forEach(((t,r)=>{var o;const i=ai(t.elements),a=null===(o=null==i?void 0:i.props)||void 0===o?void 0:o.nodeType;if(!("inline"===a||"inlineVoid"===a)){const r={};Object.keys(t.elements).forEach((e=>{const n=wi(t.elements[e],["render"]);r[e]=n}));const{display:o,placeholder:i,align:a,shortcuts:l}=t.options||{};n[t.type]={type:t.type,elements:r,hasCustomEditor:!!t.customEditor,options:{display:o,placeholder:i,align:a,shortcuts:l},isActive:()=>{const n=N(e,{at:e.selection});return(null==n?void 0:n.type)===t.type},toggle:(t,n)=>{qa(e,t)},create:n=>{!function(e,t,n){var r;e.children=Ka(e.children);const o=N(e);if(!o)throw new Error(`No block found in the current selection path. Passed path: ${e.selection}`);const i=(null==n?void 0:n.slate)||In(e,{at:[null==o?void 0:o.meta.order]});if(!i||!i.selection)return;const a=e.blocks[t],l=ii(a.elements),c=a.elements[l];if(!c)return;const s=Object.assign({nodeType:(null===(r=c.props)||void 0===r?void 0:r.nodeType)||"block"},c.props),d=Q({id:J(),type:l,props:s});R.setNodes(i,d,{at:[0,0],match:e=>_.isElement(e),mode:"highest"}),(null==n?void 0:n.deleteText)&&R.delete(i,{at:[0,0]});const u=ee({id:o.id,type:a.type,meta:{order:o.meta.order,depth:o.meta.depth},value:[d]}),f=u.id;e.children[f]=u,e.blockEditorsMap[f]=i,e.children=Ya(e.children),e.applyChanges(),e.emit("change",e.children),(null==n?void 0:n.focus)&&e.focusBlock(f,{slate:i,waitExecution:!0})}(e,t.type,n)},update:(t,n)=>{Za(e,t,n)},updateElement:(t,n,r)=>{!function(e,t,n,r){const o=e.children[t];if(!o)throw new Error(`Block with id ${t} not found`);const i=In(e,{at:[o.meta.order]});i?D.withoutNormalizing(i,(()=>{const[t]=D.nodes(i,{at:[0],match:e=>_.isElement(e)&&e.type===n}),o=null==t?void 0:t[0],a=(null==o?void 0:o.props)||{},l={props:Object.assign(Object.assign({},a),r)};R.setNodes(i,l,{at:[0],match:e=>_.isElement(e)&&e.type===n,mode:"lowest"}),e.applyChanges(),e.emit("change",e.children)})):console.warn("No slate found")}(e,t,n,r)},delete:t=>{Ga(e,t)}}}})),n}function el(e){return $a(e,O(A()))}function tl({type:e,hotkey:t,render:n}){return{type:e,hotkey:t,render:n}}const nl=tl({type:"fakeSelection",render:t=>e("span",Object.assign({style:{backgroundColor:"#d7e6fa"}},{children:t.children}))}),rl=(()=>{const e=J();return{[e]:ee({id:e})}})(),ol=new $,il=(e,t)=>ol.on(e,t),al=(e,t)=>ol.once(e,t),ll=(e,t)=>ol.off(e,t),cl=(e,t)=>ol.emit(e,t);const sl=({editor:n,value:r,marks:o,plugins:i,autoFocus:a,className:l,tools:c,selectionBoxRoot:s,children:u,placeholder:p,readOnly:h})=>{const g=()=>{y((e=>Object.assign(Object.assign({},e),{version:e.version+1})))},v=d((()=>o?[nl,...o]:[nl]),[o]),m=d((()=>i.map((e=>e.getPlugin))),[i]),[b,y]=f((()=>(n.applyChanges=g,n.readOnly=h||!1,v&&(n.formats=Ja(n,v)),n.blocks=Qa(n,m),n.children=function(e){return!!e&&"object"==typeof e&&0!==Object.keys(e).length}(r)?r:rl,n.blockEditorsMap=function(e){const t={};return Object.keys(e.children).forEach((n=>{const r=el(e);t[n]=r})),t}(n),n.shortcuts=function(e){const t={};return Object.values(e.blocks).forEach((e=>{var n,r,o,i;e.options&&Array.isArray(null===(n=e.options)||void 0===n?void 0:n.shortcuts)&&(null===(r=e.options)||void 0===r?void 0:r.shortcuts.length)>0&&(null===(i=null===(o=e.options)||void 0===o?void 0:o.shortcuts)||void 0===i||i.forEach((n=>{t[n]=e})))})),t}(n),n.plugins=function(e){const t={},n={};return e.forEach((e=>{e.elements&&Object.keys(e.elements).forEach((t=>{var r;const o=e.elements[t],i=null===(r=o.props)||void 0===r?void 0:r.nodeType;"inline"!==i&&"inlineVoid"!==i||(n[t]=o)})),t[e.type]=e})),e.forEach((e=>{if(e.elements){const r=Object.assign(Object.assign({},e.elements),n);t[e.type]=Object.assign(Object.assign({},e),{elements:r})}})),t}(m),n.on=il,n.once=al,n.off=ll,n.emit=cl,{editor:n,version:0})));return e(na,{children:e(P,Object.assign({editorState:b},{children:t(ci,Object.assign({tools:c},{children:[e(ta,{placeholder:p,marks:v,autoFocus:a,className:l,selectionBoxRoot:s}),u]}))}))})},dl=Object.assign(Object.assign({},hi),{ExtendedBlockActions:({className:r,style:o,onClick:i,children:a})=>{const l=H(),[c,s]=f(!1),{refs:d,floatingStyles:u,context:p}=zo({placement:"bottom-start",open:c,onOpenChange:s,middleware:[Vr(),Ur(),Fr(),Er(10)],whileElementsMounted:zr}),{isMounted:h,styles:g}=Ho(p,{duration:100}),v=Object.assign(Object.assign({},g),u);return l?null:t(n,{children:[h&&e(pi,Object.assign({isOpen:!0,onClose:()=>s(!1),refs:d,style:v},{children:a})),e("button",Object.assign({type:"button",ref:d.setReference,className:`absolute right-[8px] top-[8px] flex items-center justify-between z-10 opacity-1 bg-[#eee] w-[22px] h-[22px] transition-opacity duration-150 ease-in border-none cursor-pointer rounded-[2px] p-[0_4px] ${r||""} yoopta-extended-block-actions`,onClick:()=>{null==i||i(),s(!0)},style:c?Object.assign(Object.assign({},o),{opacity:1}):o},{children:e(Go,{})}))]})}});function ul(e,t){const n=Object.keys(e.children),{type:r}=t||{},o=n.find((t=>e.children[t].type===r));return o?e.children[o]:null}function fl(e,t,n={}){const{focusAt:r,waitExecution:o=!0,waitExecutionMs:i=0,shouldUpdateBlockSelection:a=!0}=n,l=()=>{const o=n.slate||e.blockEditorsMap[t],i=e.children[t];if(!o||!i)return;if(!e.blocks[i.type].hasCustomEditor){const e=function(e,t){if(T.isPoint(t))return t;if(S.isPath(t))return{path:t,offset:0};const[,n]=D.first(e,[0]);return{path:n||[0,0],offset:0}}(o,r);R.select(o,e),x.focus(o)}a&&setTimeout((()=>{e.setSelection([i.meta.order])}),0)};o?setTimeout((()=>l()),i):l()}function pl(e){return Array.from(new Set(e))}var hl={};!function(e,t){var n="__lodash_hash_undefined__",r=9007199254740991,o="[object Arguments]",i="[object Boolean]",a="[object Date]",l="[object Function]",c="[object GeneratorFunction]",s="[object Map]",d="[object Number]",u="[object Object]",f="[object Promise]",p="[object RegExp]",h="[object Set]",g="[object String]",v="[object Symbol]",m="[object WeakMap]",b="[object ArrayBuffer]",y="[object DataView]",w="[object Float32Array]",x="[object Float64Array]",k="[object Int8Array]",E="[object Int16Array]",C="[object Int32Array]",O="[object Uint8Array]",S="[object Uint8ClampedArray]",D="[object Uint16Array]",_="[object Uint32Array]",R=/\w*$/,j=/^\[object .+?Constructor\]$/,B=/^(?:0|[1-9]\d*)$/,A={};A[o]=A["[object Array]"]=A[b]=A[y]=A[i]=A[a]=A[w]=A[x]=A[k]=A[E]=A[C]=A[s]=A[d]=A[u]=A[p]=A[h]=A[g]=A[v]=A[O]=A[S]=A[D]=A[_]=!0,A["[object Error]"]=A[l]=A[m]=!1;var T="object"==typeof Y&&Y&&Y.Object===Object&&Y,L="object"==typeof self&&self&&self.Object===Object&&self,N=T||L||Function("return this")(),M=t&&!t.nodeType&&t,I=M&&e&&!e.nodeType&&e,P=I&&I.exports===M;function z(e,t){return e.set(t[0],t[1]),e}function F(e,t){return e.add(t),e}function U(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 V(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(e){}return t}function H(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function W(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 X,$=Array.prototype,Z=Function.prototype,q=Object.prototype,G=N["__core-js_shared__"],J=(X=/[^.]+$/.exec(G&&G.keys&&G.keys.IE_PROTO||""))?"Symbol(src)_1."+X:"",Q=Z.toString,ee=q.hasOwnProperty,te=q.toString,ne=RegExp("^"+Q.call(ee).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),re=P?N.Buffer:void 0,oe=N.Symbol,ie=N.Uint8Array,ae=W(Object.getPrototypeOf,Object),le=Object.create,ce=q.propertyIsEnumerable,se=$.splice,de=Object.getOwnPropertySymbols,ue=re?re.isBuffer:void 0,fe=W(Object.keys,Object),pe=Pe(N,"DataView"),he=Pe(N,"Map"),ge=Pe(N,"Promise"),ve=Pe(N,"Set"),me=Pe(N,"WeakMap"),be=Pe(Object,"create"),ye=He(pe),we=He(he),xe=He(ge),ke=He(ve),Ee=He(me),Ce=oe?oe.prototype:void 0,Oe=Ce?Ce.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 De(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 _e(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Re(e){this.__data__=new De(e)}function je(e,t){var n=Ke(e)||function(e){return function(e){return function(e){return!!e&&"object"==typeof e}(e)&&Ye(e)}(e)&&ee.call(e,"callee")&&(!ce.call(e,"callee")||te.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 a in e)!t&&!ee.call(e,a)||i&&("length"==a||Ue(a,r))||n.push(a);return n}function Be(e,t,n){var r=e[t];ee.call(e,t)&&We(r,n)&&(void 0!==n||t in e)||(e[t]=n)}function Ae(e,t){for(var n=e.length;n--;)if(We(e[n][0],t))return n;return-1}function Te(e,t,n,r,f,m,j){var B;if(r&&(B=m?r(e,f,m,j):r(e)),void 0!==B)return B;if(!Ze(e))return e;var T=Ke(e);if(T){if(B=function(e){var t=e.length,n=e.constructor(t);t&&"string"==typeof e[0]&&ee.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,B)}else{var L=Fe(e),N=L==l||L==c;if(Xe(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(L==u||L==o||N&&!m){if(V(e))return m?e:{};if(B=function(e){return"function"!=typeof e.constructor||Ve(e)?{}:(t=ae(e),Ze(t)?le(t):{});var t}(N?{}:e),!t)return function(e,t){return Me(e,ze(e),t)}(e,function(e,t){return e&&Me(t,qe(t),e)}(B,e))}else{if(!A[L])return m?e:{};B=function(e,t,n,r){var o=e.constructor;switch(t){case b:return Ne(e);case i:case a:return new o(+e);case y:return function(e,t){var n=t?Ne(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,r);case w:case x:case k:case E:case C:case O:case S:case D:case _:return function(e,t){var n=t?Ne(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}(e,r);case s:return function(e,t,n){var r=t?n(H(e),!0):H(e);return U(r,z,new e.constructor)}(e,r,n);case d:case g:return new o(e);case p:return function(e){var t=new e.constructor(e.source,R.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 U(r,F,new e.constructor)}(e,r,n);case v:return l=e,Oe?Object(Oe.call(l)):{}}var l}(e,L,Te,t)}}j||(j=new Re);var M=j.get(e);if(M)return M;if(j.set(e,B),!T)var I=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,qe,ze)}(e):qe(e);return function(e,t){for(var n=-1,r=e?e.length:0;++n<r&&!1!==t(e[n],n,e););}(I||e,(function(o,i){I&&(o=e[i=o]),Be(B,i,Te(o,t,n,r,i,e,j))})),B}function Le(e){return!(!Ze(e)||(t=e,J&&J in t))&&($e(e)||V(e)?ne:j).test(He(e));var t}function Ne(e){var t=new e.constructor(e.byteLength);return new ie(t).set(new ie(e)),t}function Me(e,t,n,r){n||(n={});for(var o=-1,i=t.length;++o<i;){var a=t[o],l=r?r(n[a],e[a],a,n,e):void 0;Be(n,a,void 0===l?e[a]:l)}return n}function Ie(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 Pe(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return Le(n)?n:void 0}Se.prototype.clear=function(){this.__data__=be?be(null):{}},Se.prototype.delete=function(e){return this.has(e)&&delete this.__data__[e]},Se.prototype.get=function(e){var t=this.__data__;if(be){var r=t[e];return r===n?void 0:r}return ee.call(t,e)?t[e]:void 0},Se.prototype.has=function(e){var t=this.__data__;return be?void 0!==t[e]:ee.call(t,e)},Se.prototype.set=function(e,t){return this.__data__[e]=be&&void 0===t?n:t,this},De.prototype.clear=function(){this.__data__=[]},De.prototype.delete=function(e){var t=this.__data__,n=Ae(t,e);return!(n<0)&&(n==t.length-1?t.pop():se.call(t,n,1),!0)},De.prototype.get=function(e){var t=this.__data__,n=Ae(t,e);return n<0?void 0:t[n][1]},De.prototype.has=function(e){return Ae(this.__data__,e)>-1},De.prototype.set=function(e,t){var n=this.__data__,r=Ae(n,e);return r<0?n.push([e,t]):n[r][1]=t,this},_e.prototype.clear=function(){this.__data__={hash:new Se,map:new(he||De),string:new Se}},_e.prototype.delete=function(e){return Ie(this,e).delete(e)},_e.prototype.get=function(e){return Ie(this,e).get(e)},_e.prototype.has=function(e){return Ie(this,e).has(e)},_e.prototype.set=function(e,t){return Ie(this,e).set(e,t),this},Re.prototype.clear=function(){this.__data__=new De},Re.prototype.delete=function(e){return this.__data__.delete(e)},Re.prototype.get=function(e){return this.__data__.get(e)},Re.prototype.has=function(e){return this.__data__.has(e)},Re.prototype.set=function(e,t){var n=this.__data__;if(n instanceof De){var r=n.__data__;if(!he||r.length<199)return r.push([e,t]),this;n=this.__data__=new _e(r)}return n.set(e,t),this};var ze=de?W(de,Object):function(){return[]},Fe=function(e){return te.call(e)};function Ue(e,t){return!!(t=null==t?r:t)&&("number"==typeof e||B.test(e))&&e>-1&&e%1==0&&e<t}function Ve(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||q)}function He(e){if(null!=e){try{return Q.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function We(e,t){return e===t||e!=e&&t!=t}(pe&&Fe(new pe(new ArrayBuffer(1)))!=y||he&&Fe(new he)!=s||ge&&Fe(ge.resolve())!=f||ve&&Fe(new ve)!=h||me&&Fe(new me)!=m)&&(Fe=function(e){var t=te.call(e),n=t==u?e.constructor:void 0,r=n?He(n):void 0;if(r)switch(r){case ye:return y;case we:return s;case xe:return f;case ke:return h;case Ee:return m}return t});var Ke=Array.isArray;function Ye(e){return null!=e&&function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=r}(e.length)&&!$e(e)}var Xe=ue||function(){return!1};function $e(e){var t=Ze(e)?te.call(e):"";return t==l||t==c}function Ze(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function qe(e){return Ye(e)?je(e):function(e){if(!Ve(e))return fe(e);var t=[];for(var n in Object(e))ee.call(e,n)&&"constructor"!=n&&t.push(n);return t}(e)}e.exports=function(e){return Te(e,!0,!0)}}({get exports(){return hl},set exports(e){hl=e}},hl);var gl=hl;function vl(e,t={}){const{blockId:n,focus:r}=t;if(!n&&!t.at)throw new Error("blockId or path should be provided");let o=null;if(n&&(o=e.children[n],!o))throw new Error(`Block not with blockId: ${n} found`);if(t.at&&(o=N(e,{at:t.at}),!o))throw new Error(`Block in path ${t.at} not found`);if(!o)throw new Error("Block not found");e.children=Ka(e.children);Object.values(e.children).forEach((e=>{e.meta.order>o.meta.order&&(e.meta.order+=1)}));const i=(a=o,"function"==typeof window.structuredClone?window.structuredClone(a):gl(a));var a;const l=el(e);i.id=J(),i.meta.order=o.meta.order+1,e.children[i.id]=i,e.blockEditorsMap[i.id]=l;const c=i.id;e.children=Ya(e.children),e.applyChanges(),e.emit("change",e.children),r&&e.focusBlock(c,{waitExecution:!0})}function ml(e,t){x.blur(t),x.deselect(t),R.deselect(t),e.setBlockSelected(null),e.setSelection(null)}const bl=()=>{const e={children:{},selection:null,selectedBlocks:null,readOnly:!1,getEditorValue:()=>function(e){return e.applyChanges(),e.children}(e),applyChanges:()=>{},insertBlock:(...t)=>function(e,t,n={}){e.children=Ka(e.children);const{at:r=null,focus:o=!1,slate:i=null}=n,a=N(e),l=r,c={id:J(),value:t.value,type:t.type,meta:Object.assign(Object.assign({},t.meta),{order:0})};let s=!1;if(i&&i.selection){const e=D.string(i,i.selection.anchor.path);s=D.isStart(i,i.selection.anchor,i.selection.anchor.path)&&e.length>0}if(l){const[t]=l;Object.values(e.children).forEach((e=>{e.meta.order>=t&&(e.meta.order+=1)})),c.meta.order=t}else{const t=Object.keys(e.children).length;c.meta.order=t}const d=el(e);e.blockEditorsMap[c.id]=d,s&&a&&(c.meta.order=a.meta.order,a.meta.order+=1),e.children[c.id]=c;const u=null==a?void 0:a.id;e.children=Ya(e.children),e.applyChanges(),e.emit("change",e.children),o&&e.focusBlock(s&&u?u:c.id)}(e,...t),insertBlocks:(...t)=>function(e,t,n={}){e.children=Ka(e.children);const{at:r,focus:o}=n;let i=r||[0];const a=N(e),l=In(e);let c=!1,s=!1;if(l&&l.selection){const t=S.parent(l.selection.anchor.path),n=D.string(l,t).trim(),r=D.isStart(l,l.selection.anchor,t);c=""===n&&r,s=!r||n.length>0,x.blur(l),e.setSelection(null)}s&&(i=[i[0]+1]),Object.values(e.children).forEach((e=>{e.meta.order>=i[0]&&(e.meta.order+=t.length)}));const d=[];if(t.forEach(((t,n)=>{const r={id:t.id,value:t.value,type:t.type,meta:Object.assign(Object.assign({},t.meta),{order:i[0]+n})};d.push([r.meta.order]),e.children[r.id]=r;const o=el(e);e.blockEditorsMap[r.id]=o})),a&&c){const t=a.meta.order;delete e.children[a.id],delete e.blockEditorsMap[a.id],Object.keys(e.children).forEach((n=>{const r=e.children[n];r.meta.order>t&&(r.meta.order-=1)}))}e.children=Ya(e.children),e.applyChanges(),e.emit("change",e.children),o&&e.setBlockSelected(d)}(e,...t),deleteBlock:(...t)=>Ga(e,...t),duplicateBlock:(...t)=>vl(e,...t),toggleBlock:(...t)=>qa(e,...t),increaseBlockDepth:(...t)=>function(e,t={}){const{at:n=e.selection}=t;if(!n)return;e.children=Ka(e.children);const r=N(e);r&&(r.meta.depth=r.meta.depth+1,e.children=Ya(e.children),e.applyChanges(),e.emit("change",e.children))}(e,...t),decreaseBlockDepth:(...t)=>function(e,t={}){const{at:n=e.selection}=t;if(!n)return;e.children=Ka(e.children);const r=N(e);r&&(r.meta.depth=0===r.meta.depth?0:r.meta.depth-1,e.children=Ya(e.children),e.applyChanges(),e.emit("change",e.children))}(e,...t),moveBlock:(...t)=>function(e,t,n){e.children=Ka(e.children);const[r]=n,o=e.children[t],i=Object.values(e.children).find((e=>e.meta.order===r)),a=o.meta.order<i.meta.order,l=o.meta.order>i.meta.order;Object.values(e.children).forEach((e=>{a?e.meta.order>o.meta.order&&e.meta.order<=i.meta.order&&e.meta.order--:l&&e.meta.order<o.meta.order&&e.meta.order>=i.meta.order&&e.meta.order++})),o.meta.order=r,o.meta.depth=i.meta.depth,e.children=Ya(e.children),e.applyChanges(),e.emit("change",e.children)}(e,...t),focusBlock:(...t)=>fl(e,...t),getBlock:(...e)=>{},updateBlock:(...t)=>Za(e,...t),splitBlock:(...t)=>function(e,t={}){const{slate:n,focus:r=!0}=t,o=N(e);n&&n.selection&&o&&D.withoutNormalizing(n,(()=>{e.children=Ka(e.children);const t=S.parent(n.selection.anchor.path);R.splitNodes(n,{at:n.selection,match:e=>_.isElement(e),always:!0,mode:"highest"});const i=t[0]+1,a=n.children.slice()[i];R.removeNodes(n,{at:[i],match:e=>_.isElement(e),mode:"highest"});const l={id:J(),type:o.type,meta:{order:o.meta.order+1,depth:o.meta.depth},value:[a]};Object.values(e.children).forEach((e=>{e.meta.order>=l.meta.order&&(e.meta.order+=1)}));const c=el(e);e.blockEditorsMap[l.id]=c,e.children[l.id]=l,e.children=Ya(e.children),e.applyChanges(),e.emit("change",e.children),r&&e.focusBlock(l.id,{slate:c})}))}(e,...t),setSelection:(...t)=>function(e,t,n={}){const{applyChanges:r=!0}=n;e.selection=t,r&&e.applyChanges()}(e,...t),setBlockSelected:(...t)=>function(e,t,n={}){const{only:r=!1,allSelected:o=!1}=n,i=e.selectedBlocks||[];if(null===t)e.selectedBlocks=null;else if(t.length>1)e.selectedBlocks=t.flat();else if(r)e.selectedBlocks=t.flat();else if(o){const t=Object.keys(e.children).map(((e,t)=>t));e.selectedBlocks=pl(t)}else e.selectedBlocks=pl(i.concat(t.flat()));e.applyChanges()}(e,...t),blur:(...t)=>function(e,t={}){var n;const r=null!==(n=t.slate)&&void 0!==n?n:In(e);if(!r)return;const{waitExecution:o,waitExecutionMs:i}=t;o?setTimeout((()=>ml(e,r)),i):(ml(e,r),e.applyChanges())}(e,...t),blockEditorsMap:{},blocks:{},formats:{},shortcuts:{},plugins:{},on:(e,t)=>{},off:(e,t)=>{},emit:(e,...t)=>{},once:(e,t)=>{}};return e};gi('/*! tailwindcss v3.4.1 | MIT License | https://tailwindcss.com*/*,:after,:before{border:0 solid #e5e7eb;box-sizing:border-box}:after,:before{--tw-content:""}:host,html{-webkit-text-size-adjust:100%;font-feature-settings:normal;-webkit-tap-highlight-color:transparent;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-variation-settings:normal;line-height:1.5;-moz-tab-size:4;-o-tab-size:4;tab-size:4}body{line-height:inherit;margin:0}hr{border-top-width:1px;color:inherit;height:0}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-feature-settings:normal;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em;font-variation-settings:normal}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{border-collapse:collapse;border-color:inherit;text-indent:0}button,input,optgroup,select,textarea{font-feature-settings:inherit;color:inherit;font-family:inherit;font-size:100%;font-variation-settings:inherit;font-weight:inherit;line-height:inherit;margin:0;padding:0}button,select{text-transform:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset{margin:0}fieldset,legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{color:#9ca3af;opacity:1}input::placeholder,textarea::placeholder{color:#9ca3af;opacity:1}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{height:auto;max-width:100%}[hidden]{display:none}*,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }.container{width:100%}@media (min-width:640px){.container{max-width:640px}}@media (min-width:768px){.container{max-width:768px}}@media (min-width:1024px){.container{max-width:1024px}}@media (min-width:1280px){.container{max-width:1280px}}@media (min-width:1536px){.container{max-width:1536px}}.pointer-events-none{pointer-events:none}.collapse{visibility:collapse}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.left-0{left:0}.right-\\[8px\\]{right:8px}.top-0{top:0}.top-\\[8px\\]{top:8px}.z-10{z-index:10}.z-\\[100\\]{z-index:100}.z-\\[90\\]{z-index:90}.mx-\\[4px\\]{margin-left:4px;margin-right:4px}.my-\\[4px\\]{margin-bottom:4px;margin-top:4px}.mb-\\[1px\\]{margin-bottom:1px}.mr-2{margin-right:.5rem}.mt-\\[2px\\]{margin-top:2px}.\\!block{display:block!important}.block{display:block}.inline{display:inline}.flex{display:flex}.h-4{height:1rem}.h-\\[1px\\]{height:1px}.h-\\[22px\\]{height:22px}.h-full{height:100%}.w-4{width:1rem}.w-\\[22px\\]{width:22px}.w-auto{width:auto}.w-full{width:100%}.min-w-\\[200px\\]{min-width:200px}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.cursor-default{cursor:default}.cursor-pointer{cursor:pointer}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.flex-col{flex-direction:column}.items-center{align-items:center}.justify-start{justify-content:flex-start}.justify-between{justify-content:space-between}.overflow-hidden{overflow:hidden}.rounded{border-radius:.25rem}.rounded-\\[2px\\]{border-radius:2px}.rounded-md{border-radius:.375rem}.rounded-sm{border-radius:.125rem}.border{border-width:1px}.border-none{border-style:none}.bg-\\[\\#2383e224\\]{background-color:#2383e224}.bg-\\[\\#37352f14\\]{background-color:#37352f14}.bg-\\[\\#FFF\\]{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity))}.bg-\\[\\#eee\\]{--tw-bg-opacity:1;background-color:rgb(238 238 238/var(--tw-bg-opacity))}.p-\\[0_4px\\]{padding:0 4px}.px-0{padding-left:0;padding-right:0}.px-2{padding-left:.5rem;padding-right:.5rem}.px-\\[2px\\]{padding-left:2px;padding-right:2px}.py-0{padding-bottom:0;padding-top:0}.py-1{padding-bottom:.25rem;padding-top:.25rem}.py-1\\.5{padding-bottom:.375rem;padding-top:.375rem}.py-\\[6px\\]{padding-bottom:6px;padding-top:6px}.text-sm{font-size:.875rem;line-height:1.25rem}.italic{font-style:italic}.leading-\\[120\\%\\]{line-height:120%}.underline{text-decoration-line:underline}.opacity-100{opacity:1}.shadow-md{--tw-shadow:0 4px 6px -1px rgba(0,0,0,.1),0 2px 4px -2px rgba(0,0,0,.1);--tw-shadow-colored:0 4px 6px -1px var(--tw-shadow-color),0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.outline-none{outline:2px solid transparent;outline-offset:2px}.blur{--tw-blur:blur(8px)}.blur,.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.transition{transition-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-colors{transition-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1)}.duration-150,.transition-opacity{transition-duration:.15s}.ease-in{transition-timing-function:cubic-bezier(.4,0,1,1)}::-moz-selection{background:#c6ddf8}::selection{background:#c6ddf8}.yoopta-placeholder:after{color:inherit;content:attr(data-placeholder);font-size:75%;font-style:inherit;font-weight:inherit;opacity:.5;padding-left:5px;position:absolute;text-indent:2px;top:50%;transform:translateY(-50%);-webkit-user-select:none;-moz-user-select:none;user-select:none}.hover\\:bg-\\[\\#37352f14\\]:hover{background-color:#37352f14}.focus\\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus-visible\\:outline-none:focus-visible{outline:2px solid transparent;outline-offset:2px}.data-\\[disabled\\]\\:pointer-events-none[data-disabled]{pointer-events:none}.data-\\[disabled\\]\\:opacity-50[data-disabled]{opacity:.5}');export{Ii as HOTKEYS,dl as UI,L as YooptaPlugin,ee as buildBlockData,Q as buildBlockElement,bl as createYooptaEditor,tl as createYooptaMark,sl as default,N as findPluginBlockBySelectionPath,ul as findPluginBlockByType,In as findSlateBySelectionPath,J as generateId,ai as getRootBlockElement,ii as getRootBlockElementType,F as useBlockData,K as useBlockSelected,U as useYooptaBlock,z as useYooptaEditor,V as useYooptaPlugin,W as useYooptaPluginOptions,H as useYooptaReadOnly,si as useYooptaTools};
|
|
6
|
+
var kr=["input:not([inert])","select:not([inert])","textarea:not([inert])","a[href]:not([inert])","button:not([inert])","[tabindex]:not(slot):not([inert])","audio[controls]:not([inert])","video[controls]:not([inert])",'[contenteditable]:not([contenteditable="false"]):not([inert])',"details>summary:first-of-type:not([inert])","details:not([inert])"].join(","),Er="undefined"==typeof Element,Cr=Er?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Or=!Er&&Element.prototype.getRootNode?function(e){var t;return null==e||null===(t=e.getRootNode)||void 0===t?void 0:t.call(e)}:function(e){return null==e?void 0:e.ownerDocument},Sr=function e(t,n){var r;void 0===n&&(n=!0);var o=null==t||null===(r=t.getAttribute)||void 0===r?void 0:r.call(t,"inert");return""===o||"true"===o||n&&t&&e(t.parentNode)},jr=function e(t,n,r){for(var o=[],i=Array.from(t);i.length;){var a=i.shift();if(!Sr(a,!1))if("SLOT"===a.tagName){var l=a.assignedElements(),s=e(l.length?l:a.children,!0,r);r.flatten?o.push.apply(o,s):o.push({scopeParent:a,candidates:s})}else{Cr.call(a,kr)&&r.filter(a)&&(n||!t.includes(a))&&o.push(a);var c=a.shadowRoot||"function"==typeof r.getShadowRoot&&r.getShadowRoot(a),d=!Sr(c,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(a));if(c&&d){var u=e(!0===c?a.children:c.children,!0,r);r.flatten?o.push.apply(o,u):o.push({scopeParent:a,candidates:u})}else i.unshift.apply(i,a.children)}}return o},Rr=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},_r=function(e){if(!e)throw new Error("No node provided");return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||function(e){var t,n=null==e||null===(t=e.getAttribute)||void 0===t?void 0:t.call(e,"contenteditable");return""===n||"true"===n}(e))&&!Rr(e)?0:e.tabIndex},Dr=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},Br=function(e){return"INPUT"===e.tagName},Tr=function(e){return function(e){return Br(e)&&"radio"===e.type}(e)&&!function(e){if(!e.name)return!0;var t,n=e.form||Or(e),r=function(e){return n.querySelectorAll('input[type="radio"][name="'+e+'"]')};if("undefined"!=typeof window&&void 0!==window.CSS&&"function"==typeof window.CSS.escape)t=r(window.CSS.escape(e.name));else try{t=r(e.name)}catch(e){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",e.message),!1}var o=function(e,t){for(var n=0;n<e.length;n++)if(e[n].checked&&e[n].form===t)return e[n]}(t,e.form);return!o||o===e}(e)},Ar=function(e){var t=e.getBoundingClientRect(),n=t.width,r=t.height;return 0===n&&0===r},Mr=function(e,t){var n=t.displayCheck,r=t.getShadowRoot;if("hidden"===getComputedStyle(e).visibility)return!0;var o=Cr.call(e,"details>summary:first-of-type")?e.parentElement:e;if(Cr.call(o,"details:not([open]) *"))return!0;if(n&&"full"!==n&&"legacy-full"!==n){if("non-zero-area"===n)return Ar(e)}else{if("function"==typeof r){for(var i=e;e;){var a=e.parentElement,l=Or(e);if(a&&!a.shadowRoot&&!0===r(a))return Ar(e);e=e.assignedSlot?e.assignedSlot:a||l===e.ownerDocument?a:l.host}e=i}if(function(e){var t,n,r,o,i=e&&Or(e),a=null===(t=i)||void 0===t?void 0:t.host,l=!1;if(i&&i!==e)for(l=!!(null!==(n=a)&&void 0!==n&&null!==(r=n.ownerDocument)&&void 0!==r&&r.contains(a)||null!=e&&null!==(o=e.ownerDocument)&&void 0!==o&&o.contains(e));!l&&a;){var s,c,d;l=!(null===(c=a=null===(s=i=Or(a))||void 0===s?void 0:s.host)||void 0===c||null===(d=c.ownerDocument)||void 0===d||!d.contains(a))}return l}(e))return!e.getClientRects().length;if("legacy-full"!==n)return!0}return!1},Lr=function(e,t){return!(t.disabled||Sr(t)||function(e){return Br(e)&&"hidden"===e.type}(t)||Mr(t,e)||function(e){return"DETAILS"===e.tagName&&Array.prototype.slice.apply(e.children).some((function(e){return"SUMMARY"===e.tagName}))}(t)||function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var t=e.parentElement;t;){if("FIELDSET"===t.tagName&&t.disabled){for(var n=0;n<t.children.length;n++){var r=t.children.item(n);if("LEGEND"===r.tagName)return!!Cr.call(t,"fieldset[disabled] *")||!r.contains(e)}return!0}t=t.parentElement}return!1}(t))},Nr=function(e,t){return!(Tr(t)||_r(t)<0||!Lr(e,t))},Pr=function(e){var t=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(t)||t>=0)},Ir=function e(t){var n=[],r=[];return t.forEach((function(t,o){var i=!!t.scopeParent,a=i?t.scopeParent:t,l=function(e,t){var n=_r(e);return n<0&&t&&!Rr(e)?0:n}(a,i),s=i?e(t.candidates):a;0===l?i?n.push.apply(n,s):n.push(a):r.push({documentOrder:o,tabIndex:l,item:t,isScope:i,content:s})})),r.sort(Dr).reduce((function(e,t){return t.isScope?e.push.apply(e,t.content):e.push(t.content),e}),[]).concat(n)},zr=function(e,t){var n;return n=(t=t||{}).getShadowRoot?jr([e],t.includeContainer,{filter:Nr.bind(null,t),flatten:!1,getShadowRoot:t.getShadowRoot,shadowRootFilter:Pr}):function(e,t,n){if(Sr(e))return[];var r=Array.prototype.slice.apply(e.querySelectorAll(kr));return t&&Cr.call(e,kr)&&r.unshift(e),r.filter(n)}(e,t.includeContainer,Nr.bind(null,t)),Ir(n)};const Fr=l["useInsertionEffect".toString()]||(e=>e());var Ur="undefined"!=typeof document?t.useLayoutEffect:t.useEffect;function Hr(){return Hr=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Hr.apply(this,arguments)}let Vr=!1,Yr=0;const Wr=()=>"floating-ui-"+Yr++;const Kr=l["useId".toString()]||function(){const[e,t]=l.useState((()=>Vr?Wr():void 0));return Ur((()=>{null==e&&t(Wr())}),[]),l.useEffect((()=>{Vr||(Vr=!0)}),[]),e};const Xr=l.createContext(null),$r=l.createContext(null);function qr(e){return"data-floating-ui-"+e}function Zr(e){const n=t.useRef(e);return Ur((()=>{n.current=e})),n}const Gr=()=>({getShadowRoot:!0,displayCheck:"function"==typeof ResizeObserver&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function Jr(e,t){const n=zr(e,Gr());"prev"===t&&n.reverse();const r=n.indexOf(function(e){let t=e.activeElement;for(;null!=(null==(n=t)||null==(n=n.shadowRoot)?void 0:n.activeElement);){var n;t=t.shadowRoot.activeElement}return t}((null==(o=e)?void 0:o.ownerDocument)||document));var o;return n.slice(r+1)[0]}function Qr(e,t){const n=t||e.currentTarget,r=e.relatedTarget;return!r||!function(e,t){if(!e||!t)return!1;const n=null==t.getRootNode?void 0:t.getRootNode();if(e.contains(t))return!0;if(n&&mn(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}(n,r)}function eo(e){zr(e,Gr()).forEach((e=>{e.dataset.tabindex=e.getAttribute("tabindex")||"",e.setAttribute("tabindex","-1")}))}function to(e){e.querySelectorAll("[data-tabindex]").forEach((e=>{const t=e.dataset.tabindex;delete e.dataset.tabindex,t?e.setAttribute("tabindex",t):e.removeAttribute("tabindex")}))}const no={border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"fixed",whiteSpace:"nowrap",width:"1px",top:0,left:0};function ro(e){"Tab"===e.key&&(e.target,clearTimeout(undefined))}const oo=l.forwardRef((function(e,t){const[n,r]=l.useState();Ur((()=>(/apple/i.test(navigator.vendor)&&r("button"),document.addEventListener("keydown",ro),()=>{document.removeEventListener("keydown",ro)})),[]);const o={ref:t,tabIndex:0,role:n,"aria-hidden":!n||void 0,[qr("focus-guard")]:"",style:no};return l.createElement("span",Hr({},e,o))})),io=l.createContext(null),ao=qr("portal");function lo(e){let{children:t,id:n,root:o=null,preserveTabOrder:i=!0}=e;const a=function(e){let{id:t,root:n}=void 0===e?{}:e;const[r,o]=l.useState(null),i=Kr(),a=so(),s=l.useRef(null);return Ur((()=>()=>{null==r||r.remove(),queueMicrotask((()=>{s.current=null}))}),[r]),Ur((()=>{if(s.current)return;const e=t?document.getElementById(t):null;if(!e)return;const n=document.createElement("div");n.id=i,n.setAttribute(ao,""),e.appendChild(n),s.current=n,o(n)}),[t,i]),Ur((()=>{if(s.current)return;let e=n||(null==a?void 0:a.portalNode);e&&!gn(e)&&(e=e.current),e=e||document.body;let r=null;t&&(r=document.createElement("div"),r.id=t,e.appendChild(r));const l=document.createElement("div");l.id=i,l.setAttribute(ao,""),e=r||e,e.appendChild(l),s.current=l,o(l)}),[t,n,i,a]),r}({id:n,root:o}),[s,c]=l.useState(null),d=l.useRef(null),u=l.useRef(null),f=l.useRef(null),p=l.useRef(null),h=!!s&&!s.modal&&s.open&&i&&!(!o&&!a);return l.useEffect((()=>{if(a&&i&&(null==s||!s.modal))return a.addEventListener("focusin",e,!0),a.addEventListener("focusout",e,!0),()=>{a.removeEventListener("focusin",e,!0),a.removeEventListener("focusout",e,!0)};function e(e){if(a&&Qr(e)){("focusin"===e.type?to:eo)(a)}}}),[a,i,null==s?void 0:s.modal]),l.createElement(io.Provider,{value:l.useMemo((()=>({preserveTabOrder:i,beforeOutsideRef:d,afterOutsideRef:u,beforeInsideRef:f,afterInsideRef:p,portalNode:a,setFocusManagerState:c})),[i,a])},h&&a&&l.createElement(oo,{"data-type":"outside",ref:d,onFocus:e=>{if(Qr(e,a)){var t;null==(t=f.current)||t.focus()}else{const e=Jr(document.body,"prev")||(null==s?void 0:s.refs.domReference.current);null==e||e.focus()}}}),h&&a&&l.createElement("span",{"aria-owns":a.id,style:no}),a&&r.createPortal(t,a),h&&a&&l.createElement(oo,{"data-type":"outside",ref:u,onFocus:e=>{if(Qr(e,a)){var t;null==(t=p.current)||t.focus()}else{const t=Jr(document.body,"next")||(null==s?void 0:s.refs.domReference.current);null==t||t.focus(),(null==s?void 0:s.closeOnFocusOut)&&(null==s||s.onOpenChange(!1,e.nativeEvent))}}}))}const so=()=>l.useContext(io),co=new Set,uo=l.forwardRef((function(e,t){let{lockScroll:n=!1,...r}=e;const o=Kr();return Ur((()=>{if(!n)return;co.add(o);const e=/iP(hone|ad|od)|iOS/.test(function(){const e=navigator.userAgentData;return null!=e&&e.platform?e.platform:navigator.platform}()),t=document.body.style,r=Math.round(document.documentElement.getBoundingClientRect().left)+document.documentElement.scrollLeft?"paddingLeft":"paddingRight",i=window.innerWidth-document.documentElement.clientWidth,a=t.left?parseFloat(t.left):window.pageXOffset,l=t.top?parseFloat(t.top):window.pageYOffset;if(t.overflow="hidden",i&&(t[r]=i+"px"),e){var s,c;const e=(null==(s=window.visualViewport)?void 0:s.offsetLeft)||0,n=(null==(c=window.visualViewport)?void 0:c.offsetTop)||0;Object.assign(t,{position:"fixed",top:-(l-Math.floor(n))+"px",left:-(a-Math.floor(e))+"px",right:"0"})}return()=>{co.delete(o),0===co.size&&(Object.assign(t,{overflow:"",[r]:""}),e&&(Object.assign(t,{position:"",top:"",left:"",right:""}),window.scrollTo(a,l)))}}),[o,n]),l.createElement("div",Hr({ref:t},r,{style:{position:"fixed",overflow:"auto",top:0,right:0,bottom:0,left:0,...r.style}}))}));function fo(e){var t;void 0===e&&(e={});const{open:n=!1,onOpenChange:r,nodeId:o}=e,[i,a]=l.useState(null),c=(null==(t=e.elements)?void 0:t.reference)||i,d=function(e){void 0===e&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:i,floating:a}={},transform:c=!0,whileElementsMounted:d,open:u}=e,[f,p]=l.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[h,g]=l.useState(r);br(h,r)||g(r);const[v,m]=l.useState(null),[b,y]=l.useState(null),w=l.useCallback((e=>{e!==C.current&&(C.current=e,m(e))}),[]),x=l.useCallback((e=>{e!==O.current&&(O.current=e,y(e))}),[]),k=i||v,E=a||b,C=l.useRef(null),O=l.useRef(null),S=l.useRef(f),j=null!=d,R=xr(d),_=xr(o),D=l.useCallback((()=>{if(!C.current||!O.current)return;const e={placement:t,strategy:n,middleware:h};_.current&&(e.platform=_.current),vr(C.current,O.current,e).then((e=>{const t={...e,isPositioned:!0};B.current&&!br(S.current,t)&&(S.current=t,s.flushSync((()=>{p(t)})))}))}),[h,t,n,_]);mr((()=>{!1===u&&S.current.isPositioned&&(S.current.isPositioned=!1,p((e=>({...e,isPositioned:!1}))))}),[u]);const B=l.useRef(!1);mr((()=>(B.current=!0,()=>{B.current=!1})),[]),mr((()=>{if(k&&(C.current=k),E&&(O.current=E),k&&E){if(R.current)return R.current(k,E,D);D()}}),[k,E,D,R,j]);const T=l.useMemo((()=>({reference:C,floating:O,setReference:w,setFloating:x})),[w,x]),A=l.useMemo((()=>({reference:k,floating:E})),[k,E]),M=l.useMemo((()=>{const e={position:n,left:0,top:0};if(!A.floating)return e;const t=wr(A.floating,f.x),r=wr(A.floating,f.y);return c?{...e,transform:"translate("+t+"px, "+r+"px)",...yr(A.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:t,top:r}}),[n,c,A.floating,f.x,f.y]);return l.useMemo((()=>({...f,update:D,refs:T,elements:A,floatingStyles:M})),[f,D,T,A,M])}(e),u=l.useContext($r),f=null!=((null==(p=l.useContext(Xr))?void 0:p.id)||null);var p;const h=function(e){const t=l.useRef((()=>{}));return Fr((()=>{t.current=e})),l.useCallback((function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return null==t.current?void 0:t.current(...n)}),[])}(((e,t,n)=>{e&&(v.current.openEvent=t),m.emit("openchange",{open:e,event:t,reason:n,nested:f}),null==r||r(e,t,n)})),g=l.useRef(null),v=l.useRef({}),m=l.useState((()=>function(){const e=new Map;return{emit(t,n){var r;null==(r=e.get(t))||r.forEach((e=>e(n)))},on(t,n){e.set(t,[...e.get(t)||[],n])},off(t,n){var r;e.set(t,(null==(r=e.get(t))?void 0:r.filter((e=>e!==n)))||[])}}}()))[0],b=Kr(),y=l.useCallback((e=>{const t=gn(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),contextElement:e}:e;d.refs.setReference(t)}),[d.refs]),w=l.useCallback((e=>{(gn(e)||null===e)&&(g.current=e,a(e)),(gn(d.refs.reference.current)||null===d.refs.reference.current||null!==e&&!gn(e))&&d.refs.setReference(e)}),[d.refs]),x=l.useMemo((()=>({...d.refs,setReference:w,setPositionReference:y,domReference:g})),[d.refs,w,y]),k=l.useMemo((()=>({...d.elements,domReference:c})),[d.elements,c]),E=l.useMemo((()=>({...d,refs:x,elements:k,dataRef:v,nodeId:o,floatingId:b,events:m,open:n,onOpenChange:h})),[d,o,b,m,n,h,x,k]);return Ur((()=>{const e=null==u?void 0:u.nodesRef.current.find((e=>e.id===o));e&&(e.context=E)})),l.useMemo((()=>({...d,context:E,refs:x,elements:k})),[d,x,k,E])}const po=e=>e.replace(/[A-Z]+(?![a-z])|[A-Z]/g,((e,t)=>(t?"-":"")+e.toLowerCase()));function ho(e,t){return"function"==typeof e?e(t):e}function go(e,t){void 0===t&&(t={});const{open:n,elements:{floating:r}}=e,{duration:o=250}=t,i=("number"==typeof o?o:o.close)||0,[a,s]=l.useState(!1),[c,d]=l.useState("unmounted"),u=function(e,t){const[n,r]=l.useState(e);return e&&!n&&r(!0),l.useEffect((()=>{if(!e){const e=setTimeout((()=>r(!1)),t);return()=>clearTimeout(e)}}),[e,t]),n}(n,i);return Ur((()=>{a&&!u&&d("unmounted")}),[a,u]),Ur((()=>{if(r){if(n){d("initial");const e=requestAnimationFrame((()=>{d("open")}));return()=>{cancelAnimationFrame(e)}}s(!0),d("close")}}),[n,r]),{isMounted:u,status:c}}function vo(e,t){void 0===t&&(t={});const{initial:n={opacity:0},open:r,close:o,common:i,duration:a=250}=t,s=e.placement,c=s.split("-")[0],d=l.useMemo((()=>({side:c,placement:s})),[c,s]),u="number"==typeof a,f=(u?a:a.open)||0,p=(u?a:a.close)||0,[h,g]=l.useState((()=>({...ho(i,d),...ho(n,d)}))),{isMounted:v,status:m}=go(e,{duration:a}),b=Zr(n),y=Zr(r),w=Zr(o),x=Zr(i);return Ur((()=>{const e=ho(b.current,d),t=ho(w.current,d),n=ho(x.current,d),r=ho(y.current,d)||Object.keys(e).reduce(((e,t)=>(e[t]="",e)),{});if("initial"===m&&g((t=>({transitionProperty:t.transitionProperty,...n,...e}))),"open"===m&&g({transitionProperty:Object.keys(r).map(po).join(","),transitionDuration:f+"ms",...n,...r}),"close"===m){const r=t||e;g({transitionProperty:Object.keys(r).map(po).join(","),transitionDuration:p+"ms",...n,...r})}}),[p,w,b,y,x,f,m,d]),{isMounted:v,styles:h}}var mo;function bo(){return bo=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},bo.apply(this,arguments)}var yo=function(e){return l.createElement("svg",bo({viewBox:"0 0 16 16",className:"turn_svg__loop",style:{width:16,height:16,display:"block",fill:"currentcolor",flexShrink:0,backfaceVisibility:"hidden"}},e),mo||(mo=l.createElement("path",{d:"M5.804 3.123c.006.38.254.622.673.622h4.887c.59 0 .914.305.914.92v6.628l-.901-.978-.514-.514c-.267-.254-.629-.273-.895-.013-.254.26-.248.635.012.895l2.165 2.158c.476.47 1.022.47 1.498 0l2.165-2.158c.26-.26.266-.635.012-.895-.266-.26-.628-.241-.895.013l-.514.514-.895.971V4.564c0-1.358-.71-2.063-2.082-2.063H6.477c-.42 0-.68.241-.673.622ZM.186 7.06c.26.266.622.247.889-.013l.52-.508.889-.971v6.722c0 1.359.71 2.063 2.082 2.063h4.957c.42 0 .68-.241.673-.622-.006-.387-.254-.622-.673-.622h-4.88c-.591 0-.915-.311-.915-.927V5.554l.895.984.52.508c.26.26.629.28.89.013.26-.26.253-.629-.013-.89L3.855 4.013c-.476-.476-1.016-.476-1.492 0L.2 6.17c-.267.26-.273.628-.013.889Z"})))};function wo(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}var xo=["color"],ko=t.forwardRef((function(e,n){var r=e.color,o=void 0===r?"currentColor":r,i=wo(e,xo);return t.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},i,{ref:n}),t.createElement("path",{d:"M1 9.50006C1 10.3285 1.67157 11.0001 2.5 11.0001H4L4 10.0001H2.5C2.22386 10.0001 2 9.7762 2 9.50006L2 2.50006C2 2.22392 2.22386 2.00006 2.5 2.00006L9.5 2.00006C9.77614 2.00006 10 2.22392 10 2.50006V4.00002H5.5C4.67158 4.00002 4 4.67159 4 5.50002V12.5C4 13.3284 4.67158 14 5.5 14H12.5C13.3284 14 14 13.3284 14 12.5V5.50002C14 4.67159 13.3284 4.00002 12.5 4.00002H11V2.50006C11 1.67163 10.3284 1.00006 9.5 1.00006H2.5C1.67157 1.00006 1 1.67163 1 2.50006V9.50006ZM5 5.50002C5 5.22388 5.22386 5.00002 5.5 5.00002H12.5C12.7761 5.00002 13 5.22388 13 5.50002V12.5C13 12.7762 12.7761 13 12.5 13H5.5C5.22386 13 5 12.7762 5 12.5V5.50002Z",fill:o,fillRule:"evenodd",clipRule:"evenodd"}))})),Eo=["color"],Co=t.forwardRef((function(e,n){var r=e.color,o=void 0===r?"currentColor":r,i=wo(e,Eo);return t.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},i,{ref:n}),t.createElement("path",{d:"M3.625 7.5C3.625 8.12132 3.12132 8.625 2.5 8.625C1.87868 8.625 1.375 8.12132 1.375 7.5C1.375 6.87868 1.87868 6.375 2.5 6.375C3.12132 6.375 3.625 6.87868 3.625 7.5ZM8.625 7.5C8.625 8.12132 8.12132 8.625 7.5 8.625C6.87868 8.625 6.375 8.12132 6.375 7.5C6.375 6.87868 6.87868 6.375 7.5 6.375C8.12132 6.375 8.625 6.87868 8.625 7.5ZM12.5 8.625C13.1213 8.625 13.625 8.12132 13.625 7.5C13.625 6.87868 13.1213 6.375 12.5 6.375C11.8787 6.375 11.375 6.87868 11.375 7.5C11.375 8.12132 11.8787 8.625 12.5 8.625Z",fill:o,fillRule:"evenodd",clipRule:"evenodd"}))})),Oo=["color"],So=t.forwardRef((function(e,n){var r=e.color,o=void 0===r?"currentColor":r,i=wo(e,Oo);return t.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},i,{ref:n}),t.createElement("path",{d:"M8.51194 3.00541C9.18829 2.54594 10.0435 2.53694 10.6788 2.95419C10.8231 3.04893 10.9771 3.1993 11.389 3.61119C11.8009 4.02307 11.9513 4.17714 12.046 4.32141C12.4633 4.95675 12.4543 5.81192 11.9948 6.48827C11.8899 6.64264 11.7276 6.80811 11.3006 7.23511L10.6819 7.85383C10.4867 8.04909 10.4867 8.36567 10.6819 8.56093C10.8772 8.7562 11.1938 8.7562 11.389 8.56093L12.0077 7.94221L12.0507 7.89929C12.4203 7.52976 12.6568 7.2933 12.822 7.0502C13.4972 6.05623 13.5321 4.76252 12.8819 3.77248C12.7233 3.53102 12.4922 3.30001 12.1408 2.94871L12.0961 2.90408L12.0515 2.85942C11.7002 2.508 11.4692 2.27689 11.2277 2.11832C10.2377 1.46813 8.94398 1.50299 7.95001 2.17822C7.70691 2.34336 7.47044 2.57991 7.1009 2.94955L7.058 2.99247L6.43928 3.61119C6.24401 3.80645 6.24401 4.12303 6.43928 4.31829C6.63454 4.51355 6.95112 4.51355 7.14638 4.31829L7.7651 3.69957C8.1921 3.27257 8.35757 3.11027 8.51194 3.00541ZM4.31796 7.14672C4.51322 6.95146 4.51322 6.63487 4.31796 6.43961C4.12269 6.24435 3.80611 6.24435 3.61085 6.43961L2.99213 7.05833L2.94922 7.10124C2.57957 7.47077 2.34303 7.70724 2.17788 7.95035C1.50265 8.94432 1.4678 10.238 2.11799 11.2281C2.27656 11.4695 2.50766 11.7005 2.8591 12.0518L2.90374 12.0965L2.94837 12.1411C3.29967 12.4925 3.53068 12.7237 3.77214 12.8822C4.76219 13.5324 6.05589 13.4976 7.04986 12.8223C7.29296 12.6572 7.52943 12.4206 7.89896 12.051L7.89897 12.051L7.94188 12.0081L8.5606 11.3894C8.75586 11.1941 8.75586 10.8775 8.5606 10.6823C8.36533 10.487 8.04875 10.487 7.85349 10.6823L7.23477 11.301C6.80777 11.728 6.6423 11.8903 6.48794 11.9951C5.81158 12.4546 4.95642 12.4636 4.32107 12.0464C4.17681 11.9516 4.02274 11.8012 3.61085 11.3894C3.19896 10.9775 3.0486 10.8234 2.95385 10.6791C2.53661 10.0438 2.54561 9.18863 3.00507 8.51227C3.10993 8.35791 3.27224 8.19244 3.69924 7.76544L4.31796 7.14672ZM9.62172 6.08558C9.81698 5.89032 9.81698 5.57373 9.62172 5.37847C9.42646 5.18321 9.10988 5.18321 8.91461 5.37847L5.37908 8.91401C5.18382 9.10927 5.18382 9.42585 5.37908 9.62111C5.57434 9.81637 5.89092 9.81637 6.08619 9.62111L9.62172 6.08558Z",fill:o,fillRule:"evenodd",clipRule:"evenodd"}))})),jo=["color"],Ro=t.forwardRef((function(e,n){var r=e.color,o=void 0===r?"currentColor":r,i=wo(e,jo);return t.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},i,{ref:n}),t.createElement("path",{d:"M5.5 1C5.22386 1 5 1.22386 5 1.5C5 1.77614 5.22386 2 5.5 2H9.5C9.77614 2 10 1.77614 10 1.5C10 1.22386 9.77614 1 9.5 1H5.5ZM3 3.5C3 3.22386 3.22386 3 3.5 3H5H10H11.5C11.7761 3 12 3.22386 12 3.5C12 3.77614 11.7761 4 11.5 4H11V12C11 12.5523 10.5523 13 10 13H5C4.44772 13 4 12.5523 4 12V4L3.5 4C3.22386 4 3 3.77614 3 3.5ZM5 4H10V12H5V4Z",fill:o,fillRule:"evenodd",clipRule:"evenodd"}))})),_o=function(){var e=document.getSelection();if(!e.rangeCount)return function(){};for(var t=document.activeElement,n=[],r=0;r<e.rangeCount;r++)n.push(e.getRangeAt(r));switch(t.tagName.toUpperCase()){case"INPUT":case"TEXTAREA":t.blur();break;default:t=null}return e.removeAllRanges(),function(){"Caret"===e.type&&e.removeAllRanges(),e.rangeCount||n.forEach((function(t){e.addRange(t)})),t&&t.focus()}},Do={"text/plain":"Text","text/html":"Url",default:"Text"};var Bo=function(e,t){var n,r,o,i,a,l,s=!1;t||(t={}),n=t.debug||!1;try{if(o=_o(),i=document.createRange(),a=document.getSelection(),(l=document.createElement("span")).textContent=e,l.ariaHidden="true",l.style.all="unset",l.style.position="fixed",l.style.top=0,l.style.clip="rect(0, 0, 0, 0)",l.style.whiteSpace="pre",l.style.webkitUserSelect="text",l.style.MozUserSelect="text",l.style.msUserSelect="text",l.style.userSelect="text",l.addEventListener("copy",(function(r){if(r.stopPropagation(),t.format)if(r.preventDefault(),void 0===r.clipboardData){n&&console.warn("unable to use e.clipboardData"),n&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var o=Do[t.format]||Do.default;window.clipboardData.setData(o,e)}else r.clipboardData.clearData(),r.clipboardData.setData(t.format,e);t.onCopy&&(r.preventDefault(),t.onCopy(r.clipboardData))})),document.body.appendChild(l),i.selectNodeContents(l),a.addRange(i),!document.execCommand("copy"))throw new Error("copy command was unsuccessful");s=!0}catch(o){n&&console.error("unable to copy using execCommand: ",o),n&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(t.format||"text",e),t.onCopy&&t.onCopy(window.clipboardData),s=!0}catch(o){n&&console.error("unable to copy using clipboardData: ",o),n&&console.error("falling back to prompt"),r=function(e){var t=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return e.replace(/#{\s*key\s*}/g,t)}("message"in t?t.message:"Copy to clipboard: #{key}, Enter"),window.prompt(r,e)}}finally{a&&("function"==typeof a.removeRange?a.removeRange(i):a.removeAllRanges()),l&&document.body.removeChild(l),o()}return s};function To(e){if(!e)return;const t=Object.keys(e);return 1===t.length?t[0]:t.find((t=>e[t].asRoot))}function Ao(e){if(!e)return;const t=To(e);return t?e[t]:void 0}const Mo=t.createContext(void 0),Lo=({children:n,tools:r})=>{const o=m(),i=t.useMemo((()=>r?Object.keys(r).reduce(((e,t)=>{var n;return Object.assign(Object.assign({},e),{[t]:null===(n=r[t])||void 0===n?void 0:n.render})}),{}):{}),[r]),a=t.useMemo((()=>!r||o?null:Object.keys(r).map((t=>{var n,o,i;const a=null===(n=null==r?void 0:r[t])||void 0===n?void 0:n.tool,l=null===(o=null==r?void 0:r[t])||void 0===o?void 0:o.render,s=null===(i=null==r?void 0:r[t])||void 0===i?void 0:i.props;return a?e.jsx(a,Object.assign({render:l},s),t):null}))),[t.useMemo]);return e.jsx(Mo.Provider,Object.assign({value:i},{children:e.jsxs(e.Fragment,{children:[a,n]})}))},No=()=>{const e=t.useContext(Mo);if(void 0===e)throw new Error("useYooptaTools must be used within a ToolsProvider");return e},Po=({children:t})=>e.jsx("div",Object.assign({className:"flex flex-col"},{children:t})),Io=({children:t})=>e.jsx("div",Object.assign({onClick:e=>e.stopPropagation(),className:"bg-[#FFF] relative min-w-[200px] w-auto overflow-hidden rounded-md border bg-popover py-[6px] px-0 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2"},{children:t})),zo=({children:t})=>e.jsx("div",Object.assign({className:"relative flex cursor-default select-none items-center text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50"},{children:t})),Fo=({isOpen:n,onClose:r,refs:o,style:i,children:a})=>{var l,s;const c=h(),u=No(),[f,p]=t.useState(!1),{refs:g,floatingStyles:v,context:m}=fo({placement:"right",open:f,onOpenChange:p,middleware:[gr(),hr(),pr(),Zn(10)],whileElementsMounted:fr}),{isMounted:b,styles:y}=vo(m,{duration:100});if(!n)return null;const w=d(c,{at:c.selection}),x=Ao(c.blocks[(null==w?void 0:w.type)||""].elements),k="void"===(null===(l=null==x?void 0:x.props)||void 0===l?void 0:l.nodeType),E=u.ActionMenu,C=Object.assign(Object.assign({},v),y);return e.jsx(lo,Object.assign({root:document.getElementById("yoopta-editor")},{children:e.jsx(uo,Object.assign({lockScroll:!0,className:"z-[100]",onClick:r},{children:e.jsx("div",Object.assign({style:i,ref:o.setFloating},{children:e.jsxs(Io,{children:[e.jsxs(Po,{children:[e.jsx(zo,{children:e.jsxs("button",Object.assign({type:"button",className:"rounded-sm hover:bg-[#37352f14] leading-[120%] px-2 py-1.5 mx-[4px] cursor-pointer w-full flex justify-start",onClick:()=>{const e=c.selection;c.deleteBlock({at:e}),c.setBlockSelected(null),c.setSelection(null),r()}},{children:[e.jsx(Ro,{className:"w-4 h-4 mr-2"}),"Delete"]}))}),e.jsx(zo,{children:e.jsxs("button",Object.assign({type:"button",className:"rounded-sm hover:bg-[#37352f14] leading-[120%] px-2 py-1.5 mx-[4px] cursor-pointer w-full flex justify-start",onClick:()=>{c.duplicateBlock({at:c.selection,focus:!0}),c.setBlockSelected(null),r()}},{children:[e.jsx(ko,{className:"w-4 h-4 mr-2"}),"Duplicate"]}))}),!k&&!(null===(s=c.blocks[(null==w?void 0:w.type)||""])||void 0===s?void 0:s.hasCustomEditor)&&e.jsxs(zo,{children:[b&&!!E&&e.jsx(lo,Object.assign({root:document.getElementById("yoopta-editor")},{children:e.jsx(uo,Object.assign({lockScroll:!0,className:"z-[100]",onClick:()=>p(!1)},{children:e.jsx("div",Object.assign({style:C,ref:g.setFloating},{children:e.jsx(E,{actions:Object.keys(c.blocks),editor:c,selectedAction:"",onClose:()=>{p(!1),r()},empty:!1,onMouseEnter:()=>{},mode:"toggle"})}))}))})),e.jsxs("button",Object.assign({type:"button",className:"rounded-sm hover:bg-[#37352f14] leading-[120%] px-2 py-1.5 mx-[4px] cursor-pointer w-full flex justify-start",ref:g.setReference,onClick:()=>p((e=>!e))},{children:[e.jsx(yo,{className:"w-4 h-4 mr-2"}),"Turn into"]}))]}),e.jsx(zo,{children:e.jsxs("button",Object.assign({type:"button",className:"rounded-sm hover:bg-[#37352f14] leading-[120%] px-2 py-1.5 mx-[4px] cursor-pointer w-full flex justify-start",onClick:()=>{const e=d(c);e&&(Bo(`${window.location.origin}${window.location.pathname}#${e.id}`),c.emit("block:copy",e)),r()}},{children:[e.jsx(So,{className:"w-4 h-4 mr-2"}),"Copy link to block"]}))})]}),a]})}))}))}))};var Uo=Object.freeze({__proto__:null,BlockOptions:Fo,BlockOptionsMenuContent:Io,BlockOptionsMenuGroup:Po,BlockOptionsMenuItem:zo,BlockOptionsSeparator:({className:t})=>e.jsx("div",{className:`h-[1px] bg-[#37352f14] my-[4px] w-full ${t}`})});function Ho(e,t){void 0===t&&(t={});var n=t.insertAt;if(e&&"undefined"!=typeof document){var r=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===n&&r.firstChild?r.insertBefore(o,r.firstChild):r.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}var Vo={actions:"vuZgncnq",hovered:"_8Eqjiv7m",actionButton:"WabGEp54",plusButton:"_0C8RpLmz"};function Yo(...e){return e.filter(Boolean).join(" ")}Ho(".vuZgncnq{display:flex;left:-50px;opacity:0;position:absolute;top:2px;transition:opacity .18s ease-in}._8Eqjiv7m{opacity:1}.WabGEp54{all:unset;align-items:center;background-color:inherit;background-color:transparent;border-radius:6px;color:rgba(55,53,47,.35);cursor:pointer;display:flex;height:24px;justify-content:center;margin:0 1px;padding:0;position:relative;transition:background-color .18s cubic-bezier(.4,0,.2,1);width:auto;width:18px}.WabGEp54:active,.WabGEp54:focus,.WabGEp54:hover{background-color:rgba(55,54,47,.08)}._0C8RpLmz{width:24px}");const Wo=({block:n,editor:r,dragHandleProps:a,showActions:l,onChangeActiveBlock:s})=>{const[c,d]=t.useState(!1),{refs:u,floatingStyles:f,context:p}=fo({placement:"right-start",open:c,onOpenChange:d,middleware:[gr(),hr(),pr(),Zn()]}),{isMounted:h,styles:g}=vo(p,{duration:100}),{setActivatorNodeRef:v,attributes:m,listeners:b}=a,y=Object.assign(Object.assign({},f),g);return e.jsxs("div",Object.assign({contentEditable:!1,className:Yo(Vo.actions,l&&Vo.hovered,"yoopta-element-actions")},{children:[e.jsx("button",Object.assign({type:"button",onClick:()=>{const e=S({id:C()}),t=[n.meta.order+1];r.setSelection([n.meta.order]),r.insertBlock(e,{at:t,focus:!0})},className:Yo(Vo.actionButton,Vo.plusButton,"yoopta-element-actions-plus")},{children:e.jsx(cn,{})})),e.jsx("button",Object.assign({type:"button",className:Yo(Vo.actionButton,"yoopta-element-actions-drag"),ref:e=>{v(e),u.setReference(e)}},m,b,{onClick:e=>{e.stopPropagation(),s(n.id);const t=dn(r,{at:[n.meta.order]});r.focusBlock(n.id),t&&setTimeout((()=>{r.blocks[n.type].hasCustomEditor||(o.ReactEditor.blur(t),o.ReactEditor.deselect(t),i.Transforms.deselect(t)),r.setBlockSelected([n.meta.order],{only:!0}),r.setSelection([n.meta.order]),d(!0)}),10)}},{children:e.jsx(ln,{})})),e.jsx(Fo,{isOpen:h,refs:u,style:y,onClose:()=>d(!1)})]}))},Ko=({children:n,block:r,blockId:o})=>{var i;const a=h(),[l,s]=t.useState(null),{attributes:c,listeners:d,setNodeRef:u,setActivatorNodeRef:f,transform:p,transition:g,isOver:v,isDragging:m}=Jt({id:o,disabled:a.readOnly}),b={transform:p?`translate3d(${p.x}px, ${p.y}px, 0)`:"none",transition:g,opacity:m?.7:1,marginLeft:20*r.meta.depth+"px"},y=null===(i=a.selectedBlocks)||void 0===i?void 0:i.includes(r.meta.order),w=l===o,x={borderBottom:v&&!m?"2px solid #007aff":"none"};return e.jsxs("div",Object.assign({className:"relative py-0 px-[2px] mt-[2px] mb-[1px] rounded yoopta-block-wrapper",onMouseEnter:()=>{a.readOnly||s(o)},onMouseLeave:()=>{a.readOnly||s(null)},"data-yoopta-block-id":o,style:b,"data-yoopta-block":!0,ref:u},{children:[!a.readOnly&&e.jsx(Wo,{block:r,editor:a,dragHandleProps:{setActivatorNodeRef:f,attributes:c,listeners:d},showActions:w,onChangeActiveBlock:e=>s(e)}),e.jsx("div",Object.assign({className:Vo.content,style:x},{children:n})),y&&!a.readOnly&&e.jsx("div",{className:"absolute left-0 top-0 bg-[#2383e224] z-[90] rounded opacity-100 h-full w-full pointer-events-none yoopta-selection-block"})]}))};function Xo(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}"function"==typeof SuppressedError&&SuppressedError;var $o={};Object.defineProperty($o,"__esModule",{value:!0});for(var qo="undefined"!=typeof window&&/Mac|iPod|iPhone|iPad/.test(window.navigator.platform),Zo={alt:"altKey",control:"ctrlKey",meta:"metaKey",shift:"shiftKey"},Go={add:"+",break:"pause",cmd:"meta",command:"meta",ctl:"control",ctrl:"control",del:"delete",down:"arrowdown",esc:"escape",ins:"insert",left:"arrowleft",mod:qo?"meta":"control",opt:"alt",option:"alt",return:"enter",right:"arrowright",space:" ",spacebar:" ",up:"arrowup",win:"meta",windows:"meta"},Jo={backspace:8,tab:9,enter:13,shift:16,control:17,alt:18,pause:19,capslock:20,escape:27," ":32,pageup:33,pagedown:34,end:35,home:36,arrowleft:37,arrowup:38,arrowright:39,arrowdown:40,insert:45,delete:46,meta:91,numlock:144,scrolllock:145,";":186,"=":187,",":188,"-":189,".":190,"/":191,"`":192,"[":219,"\\":220,"]":221,"'":222},Qo=1;Qo<20;Qo++)Jo["f"+Qo]=111+Qo;function ei(e,t,n){t&&!("byKey"in t)&&(n=t,t=null),Array.isArray(e)||(e=[e]);var r=e.map((function(e){return ti(e,t)})),o=function(e){return r.some((function(t){return ni(t,e)}))};return null==n?o:o(n)}function ti(e,t){var n=t&&t.byKey,r={},o=(e=e.replace("++","+add")).split("+"),i=o.length;for(var a in Zo)r[Zo[a]]=!1;var l=!0,s=!1,c=void 0;try{for(var d,u=o[Symbol.iterator]();!(l=(d=u.next()).done);l=!0){var f=d.value,p=f.endsWith("?")&&f.length>1;p&&(f=f.slice(0,-1));var h=oi(f),g=Zo[h];if(f.length>1&&!g&&!Go[f]&&!Jo[h])throw new TypeError('Unknown modifier: "'+f+'"');1!==i&&g||(n?r.key=h:r.which=ri(f)),g&&(r[g]=!p||null)}}catch(e){s=!0,c=e}finally{try{!l&&u.return&&u.return()}finally{if(s)throw c}}return r}function ni(e,t){for(var n in e){var r=e[n],o=void 0;if(null!=r&&((null!=(o="key"===n&&null!=t.key?t.key.toLowerCase():"which"===n?91===r&&93===t.which?91:t.which:t[n])||!1!==r)&&o!==r))return!1}return!0}function ri(e){return e=oi(e),Jo[e]||e.toUpperCase().charCodeAt(0)}function oi(e){return e=e.toLowerCase(),e=Go[e]||e}$o.default=ei,$o.isHotkey=ei,$o.isCodeHotkey=function(e,t){return ei(e,t)};var ii=$o.isKeyHotkey=function(e,t){return ei(e,{byKey:!0},t)};$o.parseHotkey=ti,$o.compareHotkey=ni,$o.toKeyCode=ri,$o.toKeyName=oi;const ai={bold:"mod+b",italic:"mod+i",compose:["down","left","right","up","backspace","enter"],arrowLeft:"left",arrowUp:"up",arrowDown:"down",arrowRight:"right",ctrlLeft:"ctrl+left",escape:"esc",ctrlRight:"ctrl+right",deleteBackward:"shift?+backspace",backspace:"backspace",deleteForward:"shift?+delete",extendBackward:"shift+left",extendForward:"shift+right",shiftEnter:"shift+enter",enter:"enter",space:"space",undo:"mod+z",select:"mod+a",shiftTab:"shift+tab",shiftArrowUp:"shift+up",shiftArrowDown:"shift+down",tab:"tab",cmd:"mod",cmdEnter:"mod+enter",slashCommand:"/",kekCeburek:"mod+enter"},li={moveLineBackward:"opt+up",moveLineForward:"opt+down",ctrlLeft:"opt+left",ctrlRight:"opt+right",deleteBackward:["ctrl+backspace","ctrl+h"],deleteForward:["ctrl+delete","ctrl+d"],deleteLineBackward:"cmd+shift?+backspace",deleteLineForward:["cmd+shift?+delete","ctrl+k"],deleteWordBackward:"opt+shift?+backspace",deleteWordForward:"opt+shift?+delete",extendLineBackward:"opt+shift+up",extendLineForward:"opt+shift+down",redo:"cmd+shift+z",transposeCharacter:"ctrl+t"},si={deleteWordBackward:"ctrl+shift?+backspace",deleteWordForward:"ctrl+shift?+delete",redo:["ctrl+y","ctrl+shift+z"]},ci=e=>{const t=ai[e],n=li[e],r=si[e],o=t&&ii(t),i=n&&ii(n),a=r&&ii(r);return e=>!(!o||!o(e))||(!(!i||!i(e))||!(!a||!a(e)))},di={isBold:ci("bold"),isCompose:ci("compose"),isArrowLeft:ci("arrowLeft"),isArrowRight:ci("arrowRight"),isArrowUp:ci("arrowUp"),isArrowDown:ci("arrowDown"),isDeleteBackward:ci("deleteBackward"),isDeleteForward:ci("deleteForward"),isDeleteLineBackward:ci("deleteLineBackward"),isDeleteLineForward:ci("deleteLineForward"),isDeleteWordBackward:ci("deleteWordBackward"),isDeleteWordForward:ci("deleteWordForward"),isExtendBackward:ci("extendBackward"),isExtendForward:ci("extendForward"),isExtendLineBackward:ci("extendLineBackward"),isExtendLineForward:ci("extendLineForward"),isItalic:ci("italic"),isMoveLineBackward:ci("moveLineBackward"),isMoveLineForward:ci("moveLineForward"),isCtrlLeft:ci("ctrlLeft"),isCtrlRight:ci("ctrlRight"),isRedo:ci("redo"),isShiftEnter:ci("shiftEnter"),isEnter:ci("enter"),isTransposeCharacter:ci("transposeCharacter"),isUndo:ci("undo"),isSpace:ci("space"),isSelect:ci("select"),isTab:ci("tab"),isShiftTab:ci("shiftTab"),isBackspace:ci("backspace"),isCmdEnter:ci("cmdEnter"),isCmd:ci("cmd"),isEscape:ci("escape"),isSlashCommand:ci("slashCommand"),isShiftArrowUp:ci("shiftArrowUp"),isShiftArrowDown:ci("shiftArrowDown"),isKekceburek:ci("kekCeburek")};const ui={onKeyDown:function(e){return t=>{const n=dn(e,{at:e.selection});if(!n||!n.selection)return;const r=i.Path.parent(n.selection.anchor.path);if(di.isShiftEnter(t)){if(t.isDefaultPrevented())return;return t.preventDefault(),void n.insertText("\n")}if(di.isEnter(t)){if(t.isDefaultPrevented())return;t.preventDefault();const o=i.Editor.isStart(n,n.selection.anchor,r),a=i.Editor.isEnd(n,n.selection.anchor,r);if(!o&&!a)return void e.splitBlock({slate:n,focus:!0});const l=S({id:C()}),s=e.selection?[e.selection[0]+1]:[0];e.insertBlock(l,{at:s,slate:n,focus:!0})}else if(di.isBackspace(t)){if(t.isDefaultPrevented())return;const r=d(e,{at:e.selection}),o=e.blocks[(null==r?void 0:r.type)||""],a=i.Path.parent(n.selection.anchor.path);if(i.Editor.isStart(n,n.selection.anchor,a)){t.preventDefault();const r=i.Editor.string(n,a),l=e.selection?e.selection[0]-1:0,s=dn(e,{at:[l]});let c;if(s&&!o.hasCustomEditor&&(c=function(e,t){const[,n]=i.Editor.last(e,t);return{path:n,offset:i.Editor.string(e,n).length}}(s,a)),0===r.trim().length)return e.deleteBlock({at:e.selection,focus:!0,focusAt:c});{if(i.Range.isExpanded(n.selection))return i.Transforms.delete(n,{at:n.selection});if(!s)return;if(0===i.Editor.string(s,[0,0]).length)return e.deleteBlock({at:[l],focus:!0,focusAt:c});const t=Array.from(i.Editor.nodes(n,{at:[0],match:e=>!i.Editor.isEditor(e)&&(i.Text.isText(e)||i.Editor.isInline(n,e)),mode:"highest"})).map((([e])=>e));return i.Transforms.insertNodes(s,t,{at:i.Editor.end(s,[])}),e.deleteBlock({at:e.selection,focus:!0,focusAt:c})}}}else{if(di.isSelect(t)){if(t.isDefaultPrevented())return;const[,r]=i.Editor.first(n,[0]),[,a]=i.Editor.last(n,[n.children.length-1]),l=i.Editor.range(n,r,a),s=i.Range.equals(n.selection,l);if(i.Range.isExpanded(n.selection)&&s)return t.preventDefault(),o.ReactEditor.blur(n),o.ReactEditor.deselect(n),i.Transforms.deselect(n),void e.setBlockSelected([],{allSelected:!0})}if(di.isShiftTab(t)){if(t.isDefaultPrevented())return;return t.preventDefault(),void e.decreaseBlockDepth()}if(di.isTab(t)){if(t.isDefaultPrevented())return;return t.preventDefault(),void e.increaseBlockDepth()}if(di.isArrowUp(t)){if(t.isDefaultPrevented())return;const r=i.Path.parent(n.selection.anchor.path);if(i.Editor.isStart(n,n.selection.anchor,r)){const n=e.selection?[e.selection[0]-1]:null,r=dn(e,{at:n}),o=d(e,{at:n});if(r&&o){const[,n]=i.Editor.last(r,[0]),a={path:n,offset:i.Editor.string(r,n).length};return t.preventDefault(),void e.focusBlock(o.id,{focusAt:a,waitExecution:!1,shouldUpdateBlockSelection:!0})}}}if(di.isArrowDown(t)){const r=i.Path.parent(n.selection.anchor.path);if(i.Editor.isEnd(n,n.selection.anchor,r)){const n=e.selection?[e.selection[0]+1]:null,o=dn(e,{at:n}),a=d(e,{at:n});if(o&&a){const n=function(e,t){const[,n]=i.Editor.first(e,t);return{path:n,offset:0}}(o,r);return t.preventDefault(),void e.focusBlock(a.id,{focusAt:n,waitExecution:!1})}}}if(i.Range.isExpanded(n.selection)){if(Object.values(e.formats).length>0)for(const n of Object.values(e.formats))if(n.hotkey&&ii(n.hotkey)(t)){t.preventDefault(),e.formats[n.type].toggle();break}}}}}},fi=({children:t,attributes:n,placeholder:r})=>{const i=o.useSelected(),a=Object.assign({},n);return i&&r&&(a["data-placeholder"]=r,a.className="yoopta-placeholder"),e.jsx("span",Object.assign({},a,{children:t}))};function pi(e){try{return new URL(e),!0}catch(e){return!1}}const hi=(e,t)=>{(e=>{const[t]=i.Editor.nodes(e,{match:e=>!i.Editor.isEditor(e)&&i.Element.isElement(e)&&"link"===e.type});return!!t})(e)&&(e=>{i.Transforms.unwrapNodes(e,{match:e=>!i.Editor.isEditor(e)&&i.Element.isElement(e)&&"link"===e.type})})(e);const{selection:n}=e,r=n&&i.Range.isCollapsed(n),o={type:"link",children:r?[{text:t}]:[],props:{url:t,target:"_blank",rel:"noreferrer"}};r?i.Transforms.insertNodes(e,o):(i.Transforms.wrapNodes(e,o,{split:!0}),i.Transforms.collapse(e,{edge:"end"}))};function gi(e){return!!(e&&e.id&&e.type&&e.value&&e.meta)}const vi={B:{type:"bold"},STRONG:{type:"bold"},I:{type:"italic"},U:{type:"underline"},S:{type:"strike"},CODE:{type:"code"},EM:{type:"code"}};function mi(e,t,n){var r,o,a;if(3===n.nodeType){return null===(r=n.textContent)||void 0===r?void 0:r.replace(/[\t\n\r\f\v]+/g," ")}if(1!==n.nodeType)return null;if("BR"===n.nodeName)return"\n";const l=n;let s=Array.from(l.childNodes).map((n=>mi(e,t,n))).flat();if(vi[n.nodeName]){return{[vi[n.nodeName].type]:!0,text:null===(o=n.textContent)||void 0===o?void 0:o.replace(/[\t\n\r\f\v]+/g," ")}}if(t[n.nodeName]){const r=t[n.nodeName],o=e.blocks[r.type],l=To(o.elements)||"",c=o.elements[l],d="void"===(null===(a=c.props)||void 0===a?void 0:a.nodeType);let u={id:C(),type:l,children:d&&!o.hasCustomEditor?[{text:""}]:s.map(bi),props:Object.assign({nodeType:"block"},c.props)};if(r.parse){const e=r.parse(n);if(e)if(i.Element.isElement(e))u=e;else if(Array.isArray(e)){return e}}0===u.children.length&&(u.children=[{text:""}]);return S({id:C(),type:r.type,value:[u],meta:{order:0,depth:0}})}return s}function bi(e){if("string"==typeof e)return{text:e};if(Array.isArray(e))return{text:e[0]};if(e.text)return e;if(gi(e)){let t="";return e.value[0].children.forEach((e=>{t+=`${e.text}`})),{text:t}}return{text:""}}const yi={html:{deserialize:function(e,t){const n=function(e){const t={};return Object.keys(e.plugins).forEach((n=>{const r=e.plugins[n],{parsers:o}=r;if(o){const{html:e}=o;if(e){const{deserialize:r}=e;if(r){const{nodeNames:e}=r;e&&e.forEach((e=>{t[e]={type:n,parse:r.parse}}))}}}})),t}(e),r=mi(e,n,t).filter(gi);return console.log("html",t),r},serialize:function(){}},markdown:{}},wi=({id:n,customEditor:r,elements:a,marks:l,events:s,options:c,placeholder:d="Type '/' for commands"})=>{const u=h(),f=g(n),p=t.useRef(f.value).current,v=f.type,m=t.useMemo((()=>(e=>{const t={};return Object.keys(e).forEach((n=>t[n]=e[n].render)),t})(a)),[a]),b=t.useMemo((()=>(e=>{const t={};return e?(e.forEach((e=>t[e.type]=e)),t):t})(l)),[l]),y=t.useMemo((()=>{let e=u.blockEditorsMap[n];return Object.keys(a).forEach((t=>{var n;const r=null===(n=a[t].props)||void 0===n?void 0:n.nodeType,o="inline"===r,i="void"===r,l="inlineVoid"===r;l&&(e.markableVoid=e=>e.type===t),(i||l)&&(e.isVoid=e=>e.type===t),(o||l)&&(e.isInline=e=>e.type===t,e=(e=>{const{insertData:t,insertText:n}=e;return e.insertText=t=>{t&&pi(t)?hi(e,t):n(t)},e.insertData=n=>{const r=n.getData("text/plain");r&&pi(r)?hi(e,r):t(n)},e})(e))})),e}),[]),w=t.useMemo((()=>{if(!s||u.readOnly)return{};const e={hotkeys:di,currentBlock:f,defaultBlock:S({id:C()})},t={};return Object.keys(s).forEach((n=>{t[n]=function(t){if(s[n]){s[n](u,y,e)(t)}}})),t}),[s,u,f]);return e.jsx("div",Object.assign({"data-plugin-id":n,"data-plugin-type":v},{children:e.jsx(xi,{id:n,slate:y,initialValue:p,onChange:e=>u.updateBlock(n,{value:e}),decorate:e=>{var t;const n=[];if(u.readOnly)return n;const[r,o]=e,a=(null===(t=u.selection)||void 0===t?void 0:t[0])===f.meta.order;return y.selection&&a&&!i.Editor.isEditor(r)&&""===i.Editor.string(y,[o[0]])&&i.Range.includes(y.selection,o)&&i.Range.isCollapsed(y.selection)&&n.push(Object.assign(Object.assign({},y.selection),{withPlaceholder:!0})),n},renderLeaf:t=>{var n,r,o,i,a;let{children:l,leaf:s,attributes:c}=t;const p=Xo(s,["text"]),h=(null===(n=u.selection)||void 0===n?void 0:n[0])===f.meta.order;p&&Object.keys(p).forEach((e=>{const t=b[e];t&&(l=t.render({children:l,leaf:s}))}));const g=!("void"===(null===(a=null===(i=null===(o=null===(r=t.children)||void 0===r?void 0:r.props)||void 0===o?void 0:o.parent)||void 0===i?void 0:i.props)||void 0===a?void 0:a.nodeType))&&h&&s.withPlaceholder;return e.jsx(fi,Object.assign({attributes:c,placeholder:g?d:void 0},{children:l}))},renderElement:t=>{const r=m[t.element.type];return r?e.jsx(r,Object.assign({},t,{blockId:n,HTMLAttributes:null==c?void 0:c.HTMLAttributes})):e.jsx(o.DefaultElement,Object.assign({},t))},eventHandlers:w,onKeyDown:e=>{var t;u.readOnly||(null===(t=w.onKeyDown)||void 0===t||t.call(w,e),ui.onKeyDown(u)(e))},onKeyUp:e=>{var t;u.readOnly||null===(t=null==w?void 0:w.onKeyUp)||void 0===t||t.call(w,e)},onFocus:e=>{var t;u.readOnly||null===(t=null==w?void 0:w.onFocus)||void 0===t||t.call(w,e)},onClick:e=>{var t,n;u.readOnly||((null===(t=u.selection)||void 0===t?void 0:t[0])!==f.meta.order&&u.setSelection([f.meta.order]),null===(n=null==w?void 0:w.onClick)||void 0===n||n.call(w,e))},onBlur:e=>{var t;u.readOnly||(e.preventDefault(),null===(t=null==w?void 0:w.onBlur)||void 0===t||t.call(w,e))},customEditor:r,readOnly:u.readOnly,onPaste:e=>{var t;if(u.readOnly)return;null===(t=null==w?void 0:w.onPaste)||void 0===t||t.call(w,e);const n=e.clipboardData.getData("text/html"),r=(new DOMParser).parseFromString(n,"text/html");if(r.body.childNodes.length>0){e.preventDefault();const t=yi.html.deserialize(u,r.body);if(t.length>0)return void u.insertBlocks(t,{at:u.selection,focus:!0})}},onCopy:e=>{var t;u.readOnly||null===(t=null==w?void 0:w.onCopy)||void 0===t||t.call(w,e)}})}))},xi=t.memo((({id:t,slate:n,initialValue:r,onChange:i,renderLeaf:a,renderElement:l,eventHandlers:s,onKeyDown:c,onKeyUp:d,onFocus:u,onClick:f,onBlur:p,onPaste:h,customEditor:g,decorate:v,readOnly:m})=>"function"==typeof g?g({blockId:t}):e.jsx(o.Slate,Object.assign({editor:n,initialValue:r,onChange:i},{children:e.jsx(o.Editable,Object.assign({renderElement:l,renderLeaf:a,className:"focus-visible:outline-none focus:outline-none",spellCheck:!0},s,{onKeyDown:c,onKeyUp:d,onFocus:u,onClick:f,decorate:v,onBlur:p,readOnly:m,onPaste:h}),`editable-${t}`)}),`slate-${t}`)));xi.displayName="SlateEditorInstance";const ki=({editor:e})=>({sensors:function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return t.useMemo((()=>[...n].filter((e=>null!=e))),[...n])}(ae(Ge,{activationConstraint:{delay:100,tolerance:0}}),ae(Ke,{coordinateGetter:tn})),handleDragEnd:t.useCallback((t=>{const{active:n,over:r}=t;if(n&&r&&n.id!==r.id){const t=e.children[r.id].meta.order;e.moveBlock(n.id,[t])}}),[]),handleDragStart:t.useCallback((t=>{e.setBlockSelected(null)}),[])}),Ei=[],Ci=({editor:n,marks:r,placeholder:o})=>{const i=m(),{sensors:a,handleDragEnd:l,handleDragStart:s}=ki({editor:n}),c=Object.keys(n.children),d=t.useMemo((()=>0===c.length?Ei:c.sort(((e,t)=>n.children[e].meta.order-n.children[t].meta.order))),[c]),u=[];for(let t=0;t<d.length;t++){const i=d[t],a=n.children[i],l=n.plugins[a.type];a&&l?u.push(e.jsx(Ko,Object.assign({block:a,blockId:i},{children:e.jsx(wi,{type:a.type,id:i,marks:r,customEditor:l.customEditor,events:l.events,elements:l.elements,options:l.options,placeholder:o},i)}),i)):console.error(`Plugin ${a.type} not found`)}return i?e.jsx(e.Fragment,{children:u}):e.jsx(Dt,Object.assign({sensors:a,collisionDetection:he,onDragStart:s,onDragEnd:l},{children:e.jsx(Wt,Object.assign({disabled:i,items:d,strategy:Ht},{children:u}))}))},Oi=({editor:e,yooptaEditorRef:n,root:r})=>{const[o,i]=t.useState({origin:[0,0],coords:[0,0],selection:!1}),a=t=>{var r;if(e.readOnly)return;const a=null===(r=n.current)||void 0===r?void 0:r.contains(t.target);if(!a&&!o.selection&&Array.isArray(e.selectedBlocks)&&e.selectedBlocks.length>0)return e.setBlockSelected(null),c();a||i({origin:[t.pageX,t.pageY-window.pageYOffset],coords:[t.pageX,t.pageY-window.pageYOffset],selection:!0})},l=t=>{if(!o.selection||e.readOnly)return;i((e=>Object.assign(Object.assign({},e),{coords:[t.pageX,t.pageY-window.pageYOffset]})));const n=((e,t)=>{const n=[];return document.querySelectorAll("[data-yoopta-block]").forEach(((r,o)=>{if(!r)return;const i=r.getBoundingClientRect(),a=Math.min(e[1],t[1]),l=Math.min(e[0],t[0]),s=Math.max(e[1],t[1]),c=Math.max(e[0],t[0]);a<i.bottom&&s>i.top&&l<i.right&&c>i.left&&n.push(o)})),n})(o.origin,[t.pageX,t.pageY-window.pageYOffset]);e.setBlockSelected(n,{only:!0})},s=()=>{e.readOnly||c()};t.useEffect((()=>{var t;if(e.readOnly)return;const o=r&&"current"in r?r.current:r||document;if(!o)throw new Error("Root element not found. Please check the `selectionBoxRoot` prop");if(!("nodeType"in o))throw new Error("Root element should be a DOM element or a ref object. Please check the `selectionBoxRoot` prop");if(null===(t=n.current)||void 0===t?void 0:t.contains(o))throw new Error("Root element should not be a child of the editor. Please check the `selectionBoxRoot` prop");return o.addEventListener("mousedown",a),o.addEventListener("mousemove",l),o.addEventListener("mouseup",s),()=>{o.removeEventListener("mousedown",a),o.removeEventListener("mousemove",l),o.removeEventListener("mouseup",s)}}),[e.selectedBlocks,o,r,e.readOnly]);const c=()=>{i({origin:[0,0],coords:[0,0],selection:!1})};return Object.assign(Object.assign({},o),{onClose:c})},Si=({origin:t,coords:n,isOpen:r})=>{if(!r)return null;const o={zIndex:10,left:t[0],top:t[1],height:Math.abs(n[1]-t[1]-1),width:Math.abs(n[0]-t[0]-1),userSelect:"none",transformOrigin:"top left",transform:t[1]>n[1]&&t[0]>n[0]?"scaleY(-1) scaleX(-1)":t[1]>n[1]?"scaleY(-1)":t[0]>n[0]?"scaleX(-1)":void 0,position:"fixed",backgroundColor:"rgba(35, 131, 226, 0.14)"};return e.jsx("div",{style:o})},ji={selectionStarted:!1,indexToSelect:null,startedIndexToSelect:null},Ri=({placeholder:n,marks:r,className:a,autoFocus:l=!0,selectionBoxRoot:s})=>{const c=h(),u=m(),f=t.useRef(null),p=Oi({editor:c,yooptaEditorRef:f,root:s});let g=t.useRef(ji).current;t.useEffect((()=>{if(!l||u)return;const e=d(c,{at:[0]});e&&c.focusBlock(e.id,{waitExecution:!0})}),[l,u]),t.useEffect((()=>{if(!u)return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)}),[c.selectedBlocks,u]);const v=()=>{u||Array.isArray(c.selectedBlocks)&&c.selectedBlocks.length>0&&c.setBlockSelected(null)},b=()=>{g.indexToSelect=null,g.startedIndexToSelect=null,g.selectionStarted=!1},y=e=>{var t,n,r,a,l;if(!u){if(di.isSelect(e)){if((null===(t=c.selectedBlocks)||void 0===t?void 0:t.length)===Object.keys(c.children).length)return void e.preventDefault();if(g.selectionStarted)return e.preventDefault(),void c.setBlockSelected([],{allSelected:!0})}if(di.isBackspace(e)){e.stopPropagation();if(Array.isArray(c.selectedBlocks)&&(null===(n=c.selectedBlocks)||void 0===n?void 0:n.length)===Object.keys(c.children).length)return e.preventDefault(),c.deleteBlock({deleteAll:!0}),c.setBlockSelected(null),void b();if(Array.isArray(c.selectedBlocks)&&(null===(r=c.selectedBlocks)||void 0===r?void 0:r.length)>0)return e.preventDefault(),c.deleteBlock({fromPaths:c.selectedBlocks}),c.setBlockSelected(null),void b()}if(di.isShiftArrowUp(e)){if("function"==typeof e.isDefaultPrevented&&e.isDefaultPrevented())return;if(g.selectionStarted&&null!==g.startedIndexToSelect&&null!==g.indexToSelect){const e=g.indexToSelect,t=e-1;if(0===e)return;if(e===g.startedIndexToSelect)return c.setBlockSelected([t]),void(g.indexToSelect=t);if(t<g.startedIndexToSelect)return c.setBlockSelected([t]),void(g.indexToSelect=t);if((null===(a=c.selectedBlocks)||void 0===a?void 0:a.includes(e))&&e!==g.startedIndexToSelect){const n=c.selectedBlocks.filter((t=>t!==e));return c.setBlockSelected(n,{only:!0}),void(g.indexToSelect=t)}return}const t=d(c),n=dn(c);if(!n||!n.selection||!t)return;const r=i.Path.parent(n.selection.anchor.path),l=i.Editor.isStart(n,n.selection.focus,r);if(i.Range.isExpanded(n.selection)&&l){const r=c.selection?[c.selection[0]-1]:[0],a=d(c,{at:r});t&&a&&(e.preventDefault(),o.ReactEditor.blur(n),o.ReactEditor.deselect(n),i.Transforms.deselect(n),c.setSelection(null),c.setBlockSelected([null==t?void 0:t.meta.order,t.meta.order-1]),g.startedIndexToSelect=t.meta.order,g.indexToSelect=t.meta.order-1,g.selectionStarted=!0)}}if(di.isShiftArrowDown(e)){if(g.selectionStarted&&null!==g.indexToSelect&&null!==g.startedIndexToSelect){const e=g.indexToSelect,t=e+1;if(t===Object.keys(c.children).length)return;if(e===g.startedIndexToSelect)return c.setBlockSelected([t]),void(g.indexToSelect=t);if(t>g.startedIndexToSelect)return c.setBlockSelected([t]),void(g.indexToSelect=t);if((null===(l=c.selectedBlocks)||void 0===l?void 0:l.includes(e))&&e!==g.startedIndexToSelect){const n=c.selectedBlocks.filter((t=>t!==e));return c.setBlockSelected(n,{only:!0}),void(g.indexToSelect=t)}return}const t=d(c),n=dn(c);if(!n||!n.selection||!t)return;const r=i.Path.parent(n.selection.anchor.path),a=i.Editor.isEnd(n,n.selection.focus,r);if(i.Range.isExpanded(n.selection)&&a){const r=c.selection?[c.selection[0]+1]:[0],a=d(c,{at:r});t&&a&&(e.preventDefault(),o.ReactEditor.blur(n),o.ReactEditor.deselect(n),i.Transforms.deselect(n),c.setSelection(null),c.setBlockSelected([null==t?void 0:t.meta.order,(null==t?void 0:t.meta.order)+1]),g.startedIndexToSelect=t.meta.order,g.indexToSelect=t.meta.order+1,g.selectionStarted=!0)}}}},w=(x={userSelect:p.selection?"none":"auto",pointerEvents:p.selection?"none":"auto"},Object.assign({paddingBottom:150},x));var x;return e.jsxs("div",Object.assign({id:"yoopta-editor",className:a,style:w,ref:f,onClick:e=>{u||(b(),(e=>{var t;const n=f.current;if(!n)return;const{bottom:r}=n.getBoundingClientRect(),o=r-parseInt(getComputedStyle(n).paddingBottom,10),a=S({id:C()});if(e.clientY>=o){const e=Object.keys(c.children).length-1,n=d(c,{at:[e]}),r=dn(c,{at:[e]});if(n&&r&&r.selection){const e=i.Editor.string(r,r.selection.anchor.path),o=i.Path.parent(r.selection.anchor.path),[l]=i.Editor.node(r,o);if(n.type===a.type&&i.Element.isElement(l)&&"void"!==(null===(t=l.props)||void 0===t?void 0:t.nodeType)&&0===e.trim().length)return void c.focusBlock(n.id,{slate:r})}const o=e+1;c.insertBlock(a,{at:[o],focus:!0})}})(e),v())},onBlur:e=>{var t;(null===(t=f.current)||void 0===t?void 0:t.contains(e.relatedTarget))||u||(b(),v())}},{children:[e.jsx(Ci,{editor:c,marks:r,placeholder:n}),e.jsx(Si,{origin:p.origin,coords:p.coords,isOpen:p.selection&&!u||null===s})]}))},_i=({children:e,fallback:n=null})=>{const[r,o]=t.useState(!1);return t.useEffect((()=>o(!0)),[]),r?e:n};var Di=Symbol.for("immer-nothing"),Bi=Symbol.for("immer-draftable"),Ti=Symbol.for("immer-state");function Ai(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var Mi=Object.getPrototypeOf;function Li(e){return!!e&&!!e[Ti]}function Ni(e){return!!e&&(Ii(e)||Array.isArray(e)||!!e[Bi]||!!e.constructor?.[Bi]||Vi(e)||Yi(e))}var Pi=Object.prototype.constructor.toString();function Ii(e){if(!e||"object"!=typeof e)return!1;const t=Mi(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)===Pi}function zi(e,t){0===Fi(e)?Reflect.ownKeys(e).forEach((n=>{t(n,e[n],e)})):e.forEach(((n,r)=>t(r,n,e)))}function Fi(e){const t=e[Ti];return t?t.type_:Array.isArray(e)?1:Vi(e)?2:Yi(e)?3:0}function Ui(e,t){return 2===Fi(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function Hi(e,t,n){const r=Fi(e);2===r?e.set(t,n):3===r?e.add(n):e[t]=n}function Vi(e){return e instanceof Map}function Yi(e){return e instanceof Set}function Wi(e){return e.copy_||e.base_}function Ki(e,t){if(Vi(e))return new Map(e);if(Yi(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);if(!t&&Ii(e)){if(!Mi(e)){const t=Object.create(null);return Object.assign(t,e)}return{...e}}const n=Object.getOwnPropertyDescriptors(e);delete n[Ti];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(Mi(e),n)}function Xi(e,t=!1){return qi(e)||Li(e)||!Ni(e)||(Fi(e)>1&&(e.set=e.add=e.clear=e.delete=$i),Object.freeze(e),t&&Object.entries(e).forEach((([e,t])=>Xi(t,!0)))),e}function $i(){Ai(2)}function qi(e){return Object.isFrozen(e)}var Zi,Gi={};function Ji(e){const t=Gi[e];return t||Ai(0),t}function Qi(){return Zi}function ea(e,t){t&&(Ji("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function ta(e){na(e),e.drafts_.forEach(oa),e.drafts_=null}function na(e){e===Zi&&(Zi=e.parent_)}function ra(e){return Zi={drafts_:[],parent_:Zi,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function oa(e){const t=e[Ti];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function ia(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return void 0!==e&&e!==n?(n[Ti].modified_&&(ta(t),Ai(4)),Ni(e)&&(e=aa(t,e),t.parent_||sa(t,e)),t.patches_&&Ji("Patches").generateReplacementPatches_(n[Ti].base_,e,t.patches_,t.inversePatches_)):e=aa(t,n,[]),ta(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==Di?e:void 0}function aa(e,t,n){if(qi(t))return t;const r=t[Ti];if(!r)return zi(t,((o,i)=>la(e,r,t,o,i,n))),t;if(r.scope_!==e)return t;if(!r.modified_)return sa(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),zi(o,((o,a)=>la(e,r,t,o,a,n,i))),sa(e,t,!1),n&&e.patches_&&Ji("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function la(e,t,n,r,o,i,a){if(Li(o)){const a=aa(e,o,i&&t&&3!==t.type_&&!Ui(t.assigned_,r)?i.concat(r):void 0);if(Hi(n,r,a),!Li(a))return;e.canAutoFreeze_=!1}else a&&n.add(o);if(Ni(o)&&!qi(o)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;aa(e,o),t&&t.scope_.parent_||"symbol"==typeof r||!Object.prototype.propertyIsEnumerable.call(n,r)||sa(e,o)}}function sa(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Xi(t,n)}var ca={get(e,t){if(t===Ti)return e;const n=Wi(e);if(!Ui(n,t))return function(e,t,n){const r=fa(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_||!Ni(r)?r:r===ua(e.base_,t)?(ha(e),e.copy_[t]=ga(r,e)):r},has:(e,t)=>t in Wi(e),ownKeys:e=>Reflect.ownKeys(Wi(e)),set(e,t,n){const r=fa(Wi(e),t);if(r?.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const r=ua(Wi(e),t),a=r?.[Ti];if(a&&a.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(((o=n)===(i=r)?0!==o||1/o==1/i:o!=o&&i!=i)&&(void 0!==n||Ui(e.base_,t)))return!0;ha(e),pa(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!==ua(e.base_,t)||t in e.base_?(e.assigned_[t]=!1,ha(e),pa(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0),getOwnPropertyDescriptor(e,t){const n=Wi(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r?{writable:!0,configurable:1!==e.type_||"length"!==t,enumerable:r.enumerable,value:n[t]}:r},defineProperty(){Ai(11)},getPrototypeOf:e=>Mi(e.base_),setPrototypeOf(){Ai(12)}},da={};function ua(e,t){const n=e[Ti];return(n?Wi(n):e)[t]}function fa(e,t){if(!(t in e))return;let n=Mi(e);for(;n;){const e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=Mi(n)}}function pa(e){e.modified_||(e.modified_=!0,e.parent_&&pa(e.parent_))}function ha(e){e.copy_||(e.copy_=Ki(e.base_,e.scope_.immer_.useStrictShallowCopy_))}zi(ca,((e,t)=>{da[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),da.deleteProperty=function(e,t){return da.set.call(this,e,t,void 0)},da.set=function(e,t,n){return ca.set.call(this,e[0],t,n,e[0])};function ga(e,t){const n=Vi(e)?Ji("MapSet").proxyMap_(e,t):Yi(e)?Ji("MapSet").proxySet_(e,t):function(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:Qi(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let o=r,i=ca;n&&(o=[r],i=da);const{revoke:a,proxy:l}=Proxy.revocable(o,i);return r.draft_=l,r.revoke_=a,l}(e,t);return(t?t.scope_:Qi()).drafts_.push(n),n}function va(e){if(!Ni(e)||qi(e))return e;const t=e[Ti];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=Ki(e,t.scope_.immer_.useStrictShallowCopy_)}else n=Ki(e,!0);return zi(n,((e,t)=>{Hi(n,e,va(t))})),t&&(t.finalized_=!1),n}var ma=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&&Ai(6),void 0!==n&&"function"!=typeof n&&Ai(7),Ni(e)){const o=ra(this),i=ga(e,void 0);let a=!0;try{r=t(i),a=!1}finally{a?ta(o):na(o)}return ea(o,n),ia(r,o)}if(!e||"object"!=typeof e){if(r=t(e),void 0===r&&(r=e),r===Di&&(r=void 0),this.autoFreeze_&&Xi(r,!0),n){const t=[],o=[];Ji("Patches").generateReplacementPatches_(e,r,t,o),n(t,o)}return r}Ai(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){Ni(e)||Ai(8),Li(e)&&(e=function(e){Li(e)||Ai(10);return va(e)}(e));const t=ra(this),n=ga(e,void 0);return n[Ti].isManual_=!0,na(t),n}finishDraft(e,t){const n=e&&e[Ti];n&&n.isManual_||Ai(9);const{scope_:r}=n;return ea(r,t),ia(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=Ji("Patches").applyPatches_;return Li(e)?r(e,t):this.produce(e,(e=>r(e,t)))}};ma.produce,ma.produceWithPatches.bind(ma),ma.setAutoFreeze.bind(ma),ma.setUseStrictShallowCopy.bind(ma),ma.applyPatches.bind(ma);var ba=ma.createDraft.bind(ma),ya=ma.finishDraft.bind(ma);function wa(e,t){const n=dn(e);if(!n)return!1;const r=i.Editor.marks(n);return!!(null==r?void 0:r[t])}const xa=(e,t)=>{const{insertText:n}=t;return t.insertText=r=>{var o;const{selection:a}=t;if(" "===r&&a&&i.Range.isCollapsed(a)){const{anchor:l}=a,s=i.Editor.above(t,{match:e=>i.Element.isElement(e)&&i.Editor.isBlock(t,e),mode:"lowest"});if(!s)return;const[,c]=s,d=i.Editor.parent(t,c),[u]=d;if(i.Element.isElement(u)&&!i.Text.isText(u.children[0]))return n(r);const f=s?c:[],p={anchor:l,focus:i.Editor.start(t,f)},h=i.Editor.string(t,p),g=null===(o=e.shortcuts)||void 0===o?void 0:o[h];if(!!g&&!g.isActive())return i.Transforms.select(t,p),i.Transforms.delete(t),void g.create({deleteText:!1})}n(r)},t};function ka(e,t,n){e.children=ba(e.children);let r=!1;const o=e.children[t];if(!o)throw Error(`Block with id ${t} not found`);n.id&&(o.id=n.id,r=!0),n.type&&(o.type=n.type,r=!0),n.meta&&(o.meta=n.meta,r=!0),n.value&&(o.value=n.value),e.children=ya(e.children),r&&e.applyChanges(),e.emit("change",e.children)}function Ea(e,t,n){e.children=ba(e.children);const r=d(e,{at:e.selection});if(!r)throw new Error("Block from not found at current selection");const o=To(e.blocks[r.type].elements);if(r.type===t)return void(e.children=ya(e.children));const a=dn(e,{at:[r.meta.order]});if(!a)throw new Error(`Slate not found for block in position ${r.meta.order}`);const l=To(e.blocks[t].elements);i.Editor.withoutNormalizing(a,(()=>{!function(e,t={}){var n;const{at:r,elementType:o}=t,a=r||(null===(n=e.selection)||void 0===n?void 0:n.anchor.path);if(!a)return;let l=e=>!i.Editor.isEditor(e)&&i.Element.isElement(e);o&&(l=e=>!i.Editor.isEditor(e)&&i.Element.isElement(e)&&e.type===o);const s=i.Path.parent(a),c=i.Editor.nodes(e,{at:s,match:l,mode:"lowest"});if(c){const[e]=c}}(a,{elementType:o}),i.Transforms.setNodes(a,{type:l},{at:[0],mode:"lowest",match:e=>i.Element.isElement(e)&&!i.Editor.isInline(a,e)});const n={id:r.id,type:t,meta:Object.assign(Object.assign({},r.meta),{order:r.meta.order}),value:a.children};e.blockEditorsMap[r.id]=a,e.children[r.id]=n,e.children=ya(e.children),e.applyChanges(),e.emit("change",e.children)}))}function Ca(e,t={}){const{at:n=e.selection,deleteAll:r=!1,fromPaths:o,focus:i}=t;if(Array.isArray(o)&&o.length>0){e.children=ba(e.children),o.forEach((t=>{const n=d(e,{at:[t]});n&&(delete e.children[n.id],delete e.blockEditorsMap[n.id])}));return Object.keys(e.children).forEach(((t,n)=>{e.children[t].meta.order=n})),e.children=ya(e.children),e.applyChanges(),void e.emit("change",e.children)}if(r||1===Object.keys(e.children).length){e.children={},e.blockEditorsMap={};const t=S({id:C()}),n=ja(e);return e.children[t.id]=t,e.blockEditorsMap[t.id]=n,e.setSelection([0]),e.setBlockSelected(null),e.focusBlock(t.id,{slate:n,waitExecution:!0}),e.applyChanges(),void e.emit("change",e.children)}if(!n)return;e.children=ba(e.children);const[a]=n,l=Object.keys(e.children),s=l.find((t=>e.children[t].meta.order===a));if(l.forEach((t=>{const n=e.children[t];n.meta.order>a&&(n.meta.order-=1)})),s&&(delete e.children[s],delete e.blockEditorsMap[s]),e.children=ya(e.children),e.applyChanges(),e.emit("change",e.children),i){const n=e.selection?e.selection[0]-1:0,r=d(e,{at:[n]});r&&e.focusBlock(r.id,{focusAt:t.focusAt})}}function Oa(e,t){const n={};return t.forEach((t=>{const r=t.type;n[r]={hotkey:t.hotkey,type:r,getValue:()=>function(e,t){const n=dn(e);if(!n)return null;const r=i.Editor.marks(n);return null==r?void 0:r[t]}(e,r),isActive:()=>wa(e,r),toggle:()=>function(e,t){const n=dn(e),r=wa(e,t);n&&(r?i.Editor.removeMark(n,t):i.Editor.addMark(n,t,!0),e.applyChanges(),e.emit("change",e.children))}(e,r),update:t=>function(e,t,n){const r=dn(e);r&&r.selection&&i.Range.isExpanded(r.selection)&&(i.Editor.addMark(r,t,n),e.applyChanges(),e.emit("change",e.children))}(e,r,t)}})),n}function Sa(e,t){const n={};return t.forEach(((t,r)=>{var o;const a=Ao(t.elements),l=null===(o=null==a?void 0:a.props)||void 0===o?void 0:o.nodeType;if(!("inline"===l||"inlineVoid"===l)){const r={};Object.keys(t.elements).forEach((e=>{const n=Xo(t.elements[e],["render"]);r[e]=n}));const{display:o,placeholder:a,align:l,shortcuts:s}=t.options||{};n[t.type]={type:t.type,elements:r,hasCustomEditor:!!t.customEditor,options:{display:o,placeholder:a,align:l,shortcuts:s},isActive:()=>{const n=d(e,{at:e.selection});return(null==n?void 0:n.type)===t.type},toggle:(t,n)=>{Ea(e,t)},create:n=>{!function(e,t,n){var r;e.children=ba(e.children);const o=d(e);if(!o)throw new Error(`No block found in the current selection path. Passed path: ${e.selection}`);const a=(null==n?void 0:n.slate)||dn(e,{at:[null==o?void 0:o.meta.order]});if(!a||!a.selection)return;const l=e.blocks[t],s=To(l.elements),c=l.elements[s];if(!c)return;const u=Object.assign({nodeType:(null===(r=c.props)||void 0===r?void 0:r.nodeType)||"block"},c.props),f=O({id:C(),type:s,props:u});i.Transforms.setNodes(a,f,{at:[0,0],match:e=>i.Element.isElement(e),mode:"highest"}),(null==n?void 0:n.deleteText)&&i.Transforms.delete(a,{at:[0,0]});const p=S({id:o.id,type:l.type,meta:{order:o.meta.order,depth:o.meta.depth},value:[f]}),h=p.id;e.children[h]=p,e.blockEditorsMap[h]=a,e.children=ya(e.children),e.applyChanges(),e.emit("change",e.children),(null==n?void 0:n.focus)&&e.focusBlock(h,{slate:a,waitExecution:!0})}(e,t.type,n)},update:(t,n)=>{ka(e,t,n)},updateElement:(t,n,r)=>{!function(e,t,n,r){const o=e.children[t];if(!o)throw new Error(`Block with id ${t} not found`);const a=dn(e,{at:[o.meta.order]});a?i.Editor.withoutNormalizing(a,(()=>{const[t]=i.Editor.nodes(a,{at:[0],match:e=>i.Element.isElement(e)&&e.type===n}),o=null==t?void 0:t[0],l=(null==o?void 0:o.props)||{},s={props:Object.assign(Object.assign({},l),r)};i.Transforms.setNodes(a,s,{at:[0],match:e=>i.Element.isElement(e)&&e.type===n,mode:"lowest"}),e.applyChanges(),e.emit("change",e.children)})):console.warn("No slate found")}(e,t,n,r)},delete:t=>{Ca(e,t)}}}})),n}function ja(e){return xa(e,o.withReact(i.createEditor()))}function Ra({type:e,hotkey:t,render:n}){return{type:e,hotkey:t,render:n}}const _a=Ra({type:"fakeSelection",render:t=>e.jsx("span",Object.assign({style:{backgroundColor:"#d7e6fa"}},{children:t.children}))}),Da=(()=>{const e=C();return{[e]:S({id:e})}})(),Ba=new w,Ta=(e,t)=>Ba.on(e,t),Aa=(e,t)=>Ba.once(e,t),Ma=(e,t)=>Ba.off(e,t),La=(e,t)=>Ba.emit(e,t);const Na=Object.assign(Object.assign({},Uo),{ExtendedBlockActions:({className:n,style:r,onClick:o,children:i})=>{const a=m(),[l,s]=t.useState(!1),{refs:c,floatingStyles:d,context:u}=fo({placement:"bottom-start",open:l,onOpenChange:s,middleware:[gr(),hr(),pr(),Zn(10)],whileElementsMounted:fr}),{isMounted:f,styles:p}=vo(u,{duration:100}),h=Object.assign(Object.assign({},p),d);return a?null:e.jsxs(e.Fragment,{children:[f&&e.jsx(Fo,Object.assign({isOpen:!0,onClose:()=>s(!1),refs:c,style:h},{children:i})),e.jsx("button",Object.assign({type:"button",ref:c.setReference,className:`absolute right-[8px] top-[8px] flex items-center justify-between z-10 opacity-1 bg-[#eee] w-[22px] h-[22px] transition-opacity duration-150 ease-in border-none cursor-pointer rounded-[2px] p-[0_4px] ${n||""} yoopta-extended-block-actions`,onClick:()=>{null==o||o(),s(!0)},style:l?Object.assign(Object.assign({},r),{opacity:1}):r},{children:e.jsx(Co,{})}))]})}});function Pa(e,t,n={}){const{focusAt:r,waitExecution:a=!0,waitExecutionMs:l=0,shouldUpdateBlockSelection:s=!0}=n,c=()=>{const a=n.slate||e.blockEditorsMap[t],l=e.children[t];if(!a||!l)return;if(!e.blocks[l.type].hasCustomEditor){const e=function(e,t){if(i.Point.isPoint(t))return t;if(i.Path.isPath(t))return{path:t,offset:0};const[,n]=i.Editor.first(e,[0]);return{path:n||[0,0],offset:0}}(a,r);i.Transforms.select(a,e),o.ReactEditor.focus(a)}s&&setTimeout((()=>{e.setSelection([l.meta.order])}),0)};a?setTimeout((()=>c()),l):c()}function Ia(e){return Array.from(new Set(e))}var za={};!function(e,t){var n="__lodash_hash_undefined__",r=9007199254740991,o="[object Arguments]",i="[object Boolean]",a="[object Date]",l="[object Function]",s="[object GeneratorFunction]",c="[object Map]",d="[object Number]",u="[object Object]",f="[object Promise]",p="[object RegExp]",h="[object Set]",g="[object String]",v="[object Symbol]",m="[object WeakMap]",y="[object ArrayBuffer]",w="[object DataView]",x="[object Float32Array]",k="[object Float64Array]",E="[object Int8Array]",C="[object Int16Array]",O="[object Int32Array]",S="[object Uint8Array]",j="[object Uint8ClampedArray]",R="[object Uint16Array]",_="[object Uint32Array]",D=/\w*$/,B=/^\[object .+?Constructor\]$/,T=/^(?:0|[1-9]\d*)$/,A={};A[o]=A["[object Array]"]=A[y]=A[w]=A[i]=A[a]=A[x]=A[k]=A[E]=A[C]=A[O]=A[c]=A[d]=A[u]=A[p]=A[h]=A[g]=A[v]=A[S]=A[j]=A[R]=A[_]=!0,A["[object Error]"]=A[l]=A[m]=!1;var M="object"==typeof b&&b&&b.Object===Object&&b,L="object"==typeof self&&self&&self.Object===Object&&self,N=M||L||Function("return this")(),P=t&&!t.nodeType&&t,I=P&&e&&!e.nodeType&&e,z=I&&I.exports===P;function F(e,t){return e.set(t[0],t[1]),e}function U(e,t){return e.add(t),e}function H(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 V(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(e){}return t}function Y(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function W(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 X,$=Array.prototype,q=Function.prototype,Z=Object.prototype,G=N["__core-js_shared__"],J=(X=/[^.]+$/.exec(G&&G.keys&&G.keys.IE_PROTO||""))?"Symbol(src)_1."+X:"",Q=q.toString,ee=Z.hasOwnProperty,te=Z.toString,ne=RegExp("^"+Q.call(ee).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),re=z?N.Buffer:void 0,oe=N.Symbol,ie=N.Uint8Array,ae=W(Object.getPrototypeOf,Object),le=Object.create,se=Z.propertyIsEnumerable,ce=$.splice,de=Object.getOwnPropertySymbols,ue=re?re.isBuffer:void 0,fe=W(Object.keys,Object),pe=Ie(N,"DataView"),he=Ie(N,"Map"),ge=Ie(N,"Promise"),ve=Ie(N,"Set"),me=Ie(N,"WeakMap"),be=Ie(Object,"create"),ye=Ve(pe),we=Ve(he),xe=Ve(ge),ke=Ve(ve),Ee=Ve(me),Ce=oe?oe.prototype:void 0,Oe=Ce?Ce.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 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 Re(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 _e(e){this.__data__=new je(e)}function De(e,t){var n=We(e)||function(e){return function(e){return function(e){return!!e&&"object"==typeof e}(e)&&Ke(e)}(e)&&ee.call(e,"callee")&&(!se.call(e,"callee")||te.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 a in e)!t&&!ee.call(e,a)||i&&("length"==a||Ue(a,r))||n.push(a);return n}function Be(e,t,n){var r=e[t];ee.call(e,t)&&Ye(r,n)&&(void 0!==n||t in e)||(e[t]=n)}function Te(e,t){for(var n=e.length;n--;)if(Ye(e[n][0],t))return n;return-1}function Ae(e,t,n,r,f,m,b){var B;if(r&&(B=m?r(e,f,m,b):r(e)),void 0!==B)return B;if(!qe(e))return e;var T=We(e);if(T){if(B=function(e){var t=e.length,n=e.constructor(t);t&&"string"==typeof e[0]&&ee.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,B)}else{var M=Fe(e),L=M==l||M==s;if(Xe(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(M==u||M==o||L&&!m){if(V(e))return m?e:{};if(B=function(e){return"function"!=typeof e.constructor||He(e)?{}:(t=ae(e),qe(t)?le(t):{});var t}(L?{}:e),!t)return function(e,t){return Ne(e,ze(e),t)}(e,function(e,t){return e&&Ne(t,Ze(t),e)}(B,e))}else{if(!A[M])return m?e:{};B=function(e,t,n,r){var o=e.constructor;switch(t){case y:return Le(e);case i:case a:return new o(+e);case w:return function(e,t){var n=t?Le(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,r);case x:case k:case E:case C:case O:case S:case j:case R:case _:return function(e,t){var n=t?Le(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(Y(e),!0):Y(e);return H(r,F,new e.constructor)}(e,r,n);case d: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 H(r,U,new e.constructor)}(e,r,n);case v:return l=e,Oe?Object(Oe.call(l)):{}}var l}(e,M,Ae,t)}}b||(b=new _e);var N=b.get(e);if(N)return N;if(b.set(e,B),!T)var P=n?function(e){return function(e,t,n){var r=t(e);return We(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,ze)}(e):Ze(e);return function(e,t){for(var n=-1,r=e?e.length:0;++n<r&&!1!==t(e[n],n,e););}(P||e,(function(o,i){P&&(o=e[i=o]),Be(B,i,Ae(o,t,n,r,i,e,b))})),B}function Me(e){return!(!qe(e)||(t=e,J&&J in t))&&($e(e)||V(e)?ne:B).test(Ve(e));var t}function Le(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 a=t[o],l=r?r(n[a],e[a],a,n,e):void 0;Be(n,a,void 0===l?e[a]:l)}return n}function Pe(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 Me(n)?n:void 0}Se.prototype.clear=function(){this.__data__=be?be(null):{}},Se.prototype.delete=function(e){return this.has(e)&&delete this.__data__[e]},Se.prototype.get=function(e){var t=this.__data__;if(be){var r=t[e];return r===n?void 0:r}return ee.call(t,e)?t[e]:void 0},Se.prototype.has=function(e){var t=this.__data__;return be?void 0!==t[e]:ee.call(t,e)},Se.prototype.set=function(e,t){return this.__data__[e]=be&&void 0===t?n:t,this},je.prototype.clear=function(){this.__data__=[]},je.prototype.delete=function(e){var t=this.__data__,n=Te(t,e);return!(n<0)&&(n==t.length-1?t.pop():ce.call(t,n,1),!0)},je.prototype.get=function(e){var t=this.__data__,n=Te(t,e);return n<0?void 0:t[n][1]},je.prototype.has=function(e){return Te(this.__data__,e)>-1},je.prototype.set=function(e,t){var n=this.__data__,r=Te(n,e);return r<0?n.push([e,t]):n[r][1]=t,this},Re.prototype.clear=function(){this.__data__={hash:new Se,map:new(he||je),string:new Se}},Re.prototype.delete=function(e){return Pe(this,e).delete(e)},Re.prototype.get=function(e){return Pe(this,e).get(e)},Re.prototype.has=function(e){return Pe(this,e).has(e)},Re.prototype.set=function(e,t){return Pe(this,e).set(e,t),this},_e.prototype.clear=function(){this.__data__=new je},_e.prototype.delete=function(e){return this.__data__.delete(e)},_e.prototype.get=function(e){return this.__data__.get(e)},_e.prototype.has=function(e){return this.__data__.has(e)},_e.prototype.set=function(e,t){var n=this.__data__;if(n instanceof je){var r=n.__data__;if(!he||r.length<199)return r.push([e,t]),this;n=this.__data__=new Re(r)}return n.set(e,t),this};var ze=de?W(de,Object):function(){return[]},Fe=function(e){return te.call(e)};function Ue(e,t){return!!(t=null==t?r:t)&&("number"==typeof e||T.test(e))&&e>-1&&e%1==0&&e<t}function He(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||Z)}function Ve(e){if(null!=e){try{return Q.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function Ye(e,t){return e===t||e!=e&&t!=t}(pe&&Fe(new pe(new ArrayBuffer(1)))!=w||he&&Fe(new he)!=c||ge&&Fe(ge.resolve())!=f||ve&&Fe(new ve)!=h||me&&Fe(new me)!=m)&&(Fe=function(e){var t=te.call(e),n=t==u?e.constructor:void 0,r=n?Ve(n):void 0;if(r)switch(r){case ye:return w;case we:return c;case xe:return f;case ke:return h;case Ee:return m}return t});var We=Array.isArray;function Ke(e){return null!=e&&function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=r}(e.length)&&!$e(e)}var Xe=ue||function(){return!1};function $e(e){var t=qe(e)?te.call(e):"";return t==l||t==s}function qe(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function Ze(e){return Ke(e)?De(e):function(e){if(!He(e))return fe(e);var t=[];for(var n in Object(e))ee.call(e,n)&&"constructor"!=n&&t.push(n);return t}(e)}e.exports=function(e){return Ae(e,!0,!0)}}({get exports(){return za},set exports(e){za=e}},za);var Fa=za;function Ua(e,t={}){const{blockId:n,focus:r}=t;if(!n&&!t.at)throw new Error("blockId or path should be provided");let o=null;if(n&&(o=e.children[n],!o))throw new Error(`Block not with blockId: ${n} found`);if(t.at&&(o=d(e,{at:t.at}),!o))throw new Error(`Block in path ${t.at} not found`);if(!o)throw new Error("Block not found");e.children=ba(e.children);Object.values(e.children).forEach((e=>{e.meta.order>o.meta.order&&(e.meta.order+=1)}));const i=(a=o,"function"==typeof window.structuredClone?window.structuredClone(a):Fa(a));var a;const l=ja(e);i.id=C(),i.meta.order=o.meta.order+1,e.children[i.id]=i,e.blockEditorsMap[i.id]=l;const s=i.id;e.children=ya(e.children),e.applyChanges(),e.emit("change",e.children),r&&e.focusBlock(s,{waitExecution:!0})}function Ha(e,t){o.ReactEditor.blur(t),o.ReactEditor.deselect(t),i.Transforms.deselect(t),e.setBlockSelected(null),e.setSelection(null)}Ho('/*! tailwindcss v3.4.1 | MIT License | https://tailwindcss.com*/*,:after,:before{border:0 solid #e5e7eb;box-sizing:border-box}:after,:before{--tw-content:""}:host,html{-webkit-text-size-adjust:100%;font-feature-settings:normal;-webkit-tap-highlight-color:transparent;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-variation-settings:normal;line-height:1.5;-moz-tab-size:4;-o-tab-size:4;tab-size:4}body{line-height:inherit;margin:0}hr{border-top-width:1px;color:inherit;height:0}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-feature-settings:normal;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em;font-variation-settings:normal}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{border-collapse:collapse;border-color:inherit;text-indent:0}button,input,optgroup,select,textarea{font-feature-settings:inherit;color:inherit;font-family:inherit;font-size:100%;font-variation-settings:inherit;font-weight:inherit;line-height:inherit;margin:0;padding:0}button,select{text-transform:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset{margin:0}fieldset,legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{color:#9ca3af;opacity:1}input::placeholder,textarea::placeholder{color:#9ca3af;opacity:1}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{height:auto;max-width:100%}[hidden]{display:none}*,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }.container{width:100%}@media (min-width:640px){.container{max-width:640px}}@media (min-width:768px){.container{max-width:768px}}@media (min-width:1024px){.container{max-width:1024px}}@media (min-width:1280px){.container{max-width:1280px}}@media (min-width:1536px){.container{max-width:1536px}}.pointer-events-none{pointer-events:none}.collapse{visibility:collapse}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.left-0{left:0}.right-\\[8px\\]{right:8px}.top-0{top:0}.top-\\[8px\\]{top:8px}.z-10{z-index:10}.z-\\[100\\]{z-index:100}.z-\\[90\\]{z-index:90}.mx-\\[4px\\]{margin-left:4px;margin-right:4px}.my-\\[4px\\]{margin-bottom:4px;margin-top:4px}.mb-\\[1px\\]{margin-bottom:1px}.mr-2{margin-right:.5rem}.mt-\\[2px\\]{margin-top:2px}.\\!block{display:block!important}.block{display:block}.inline{display:inline}.flex{display:flex}.h-4{height:1rem}.h-\\[1px\\]{height:1px}.h-\\[22px\\]{height:22px}.h-full{height:100%}.w-4{width:1rem}.w-\\[22px\\]{width:22px}.w-auto{width:auto}.w-full{width:100%}.min-w-\\[200px\\]{min-width:200px}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.cursor-default{cursor:default}.cursor-pointer{cursor:pointer}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.flex-col{flex-direction:column}.items-center{align-items:center}.justify-start{justify-content:flex-start}.justify-between{justify-content:space-between}.overflow-hidden{overflow:hidden}.rounded{border-radius:.25rem}.rounded-\\[2px\\]{border-radius:2px}.rounded-md{border-radius:.375rem}.rounded-sm{border-radius:.125rem}.border{border-width:1px}.border-none{border-style:none}.bg-\\[\\#2383e224\\]{background-color:#2383e224}.bg-\\[\\#37352f14\\]{background-color:#37352f14}.bg-\\[\\#FFF\\]{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity))}.bg-\\[\\#eee\\]{--tw-bg-opacity:1;background-color:rgb(238 238 238/var(--tw-bg-opacity))}.p-\\[0_4px\\]{padding:0 4px}.px-0{padding-left:0;padding-right:0}.px-2{padding-left:.5rem;padding-right:.5rem}.px-\\[2px\\]{padding-left:2px;padding-right:2px}.py-0{padding-bottom:0;padding-top:0}.py-1{padding-bottom:.25rem;padding-top:.25rem}.py-1\\.5{padding-bottom:.375rem;padding-top:.375rem}.py-\\[6px\\]{padding-bottom:6px;padding-top:6px}.text-sm{font-size:.875rem;line-height:1.25rem}.italic{font-style:italic}.leading-\\[120\\%\\]{line-height:120%}.underline{text-decoration-line:underline}.opacity-100{opacity:1}.shadow-md{--tw-shadow:0 4px 6px -1px rgba(0,0,0,.1),0 2px 4px -2px rgba(0,0,0,.1);--tw-shadow-colored:0 4px 6px -1px var(--tw-shadow-color),0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.outline-none{outline:2px solid transparent;outline-offset:2px}.blur{--tw-blur:blur(8px)}.blur,.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.transition{transition-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-colors{transition-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1)}.duration-150,.transition-opacity{transition-duration:.15s}.ease-in{transition-timing-function:cubic-bezier(.4,0,1,1)}::-moz-selection{background:#c6ddf8}::selection{background:#c6ddf8}.yoopta-placeholder:after{color:inherit;content:attr(data-placeholder);font-size:75%;font-style:inherit;font-weight:inherit;opacity:.5;padding-left:5px;position:absolute;text-indent:2px;top:50%;transform:translateY(-50%);-webkit-user-select:none;-moz-user-select:none;user-select:none}.hover\\:bg-\\[\\#37352f14\\]:hover{background-color:#37352f14}.focus\\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus-visible\\:outline-none:focus-visible{outline:2px solid transparent;outline-offset:2px}.data-\\[disabled\\]\\:pointer-events-none[data-disabled]{pointer-events:none}.data-\\[disabled\\]\\:opacity-50[data-disabled]{opacity:.5}'),exports.HOTKEYS=di,exports.UI=Na,exports.YooptaPlugin=c,exports.buildBlockData=S,exports.buildBlockElement=O,exports.createYooptaEditor=()=>{const e={children:{},selection:null,selectedBlocks:null,readOnly:!1,getEditorValue:()=>function(e){return e.applyChanges(),e.children}(e),applyChanges:()=>{},insertBlock:(...t)=>function(e,t,n={}){e.children=ba(e.children);const{at:r=null,focus:o=!1,slate:a=null}=n,l=d(e),s=r,c={id:C(),value:t.value,type:t.type,meta:Object.assign(Object.assign({},t.meta),{order:0})};let u=!1;if(a&&a.selection){const e=i.Editor.string(a,a.selection.anchor.path);u=i.Editor.isStart(a,a.selection.anchor,a.selection.anchor.path)&&e.length>0}if(s){const[t]=s;Object.values(e.children).forEach((e=>{e.meta.order>=t&&(e.meta.order+=1)})),c.meta.order=t}else{const t=Object.keys(e.children).length;c.meta.order=t}const f=ja(e);e.blockEditorsMap[c.id]=f,u&&l&&(c.meta.order=l.meta.order,l.meta.order+=1),e.children[c.id]=c;const p=null==l?void 0:l.id;e.children=ya(e.children),e.applyChanges(),e.emit("change",e.children),o&&e.focusBlock(u&&p?p:c.id)}(e,...t),insertBlocks:(...t)=>function(e,t,n={}){e.children=ba(e.children);const{at:r,focus:a}=n;let l=r||[0];const s=d(e),c=dn(e);let u=!1,f=!1;if(c&&c.selection){const t=i.Path.parent(c.selection.anchor.path),n=i.Editor.string(c,t).trim(),r=i.Editor.isStart(c,c.selection.anchor,t);u=""===n&&r,f=!r||n.length>0,o.ReactEditor.blur(c),e.setSelection(null)}f&&(l=[l[0]+1]),Object.values(e.children).forEach((e=>{e.meta.order>=l[0]&&(e.meta.order+=t.length)}));const p=[];if(t.forEach(((t,n)=>{const r={id:t.id,value:t.value,type:t.type,meta:Object.assign(Object.assign({},t.meta),{order:l[0]+n})};p.push([r.meta.order]),e.children[r.id]=r;const o=ja(e);e.blockEditorsMap[r.id]=o})),s&&u){const t=s.meta.order;delete e.children[s.id],delete e.blockEditorsMap[s.id],Object.keys(e.children).forEach((n=>{const r=e.children[n];r.meta.order>t&&(r.meta.order-=1)}))}e.children=ya(e.children),e.applyChanges(),e.emit("change",e.children),a&&e.setBlockSelected(p)}(e,...t),deleteBlock:(...t)=>Ca(e,...t),duplicateBlock:(...t)=>Ua(e,...t),toggleBlock:(...t)=>Ea(e,...t),increaseBlockDepth:(...t)=>function(e,t={}){const{at:n=e.selection}=t;if(!n)return;e.children=ba(e.children);const r=d(e);r&&(r.meta.depth=r.meta.depth+1,e.children=ya(e.children),e.applyChanges(),e.emit("change",e.children))}(e,...t),decreaseBlockDepth:(...t)=>function(e,t={}){const{at:n=e.selection}=t;if(!n)return;e.children=ba(e.children);const r=d(e);r&&(r.meta.depth=0===r.meta.depth?0:r.meta.depth-1,e.children=ya(e.children),e.applyChanges(),e.emit("change",e.children))}(e,...t),moveBlock:(...t)=>function(e,t,n){e.children=ba(e.children);const[r]=n,o=e.children[t],i=Object.values(e.children).find((e=>e.meta.order===r)),a=o.meta.order<i.meta.order,l=o.meta.order>i.meta.order;Object.values(e.children).forEach((e=>{a?e.meta.order>o.meta.order&&e.meta.order<=i.meta.order&&e.meta.order--:l&&e.meta.order<o.meta.order&&e.meta.order>=i.meta.order&&e.meta.order++})),o.meta.order=r,o.meta.depth=i.meta.depth,e.children=ya(e.children),e.applyChanges(),e.emit("change",e.children)}(e,...t),focusBlock:(...t)=>Pa(e,...t),getBlock:(...e)=>{},updateBlock:(...t)=>ka(e,...t),splitBlock:(...t)=>function(e,t={}){const{slate:n,focus:r=!0}=t,o=d(e);n&&n.selection&&o&&i.Editor.withoutNormalizing(n,(()=>{e.children=ba(e.children);const t=i.Path.parent(n.selection.anchor.path);i.Transforms.splitNodes(n,{at:n.selection,match:e=>i.Element.isElement(e),always:!0,mode:"highest"});const a=t[0]+1,l=n.children.slice()[a];i.Transforms.removeNodes(n,{at:[a],match:e=>i.Element.isElement(e),mode:"highest"});const s={id:C(),type:o.type,meta:{order:o.meta.order+1,depth:o.meta.depth},value:[l]};Object.values(e.children).forEach((e=>{e.meta.order>=s.meta.order&&(e.meta.order+=1)}));const c=ja(e);e.blockEditorsMap[s.id]=c,e.children[s.id]=s,e.children=ya(e.children),e.applyChanges(),e.emit("change",e.children),r&&e.focusBlock(s.id,{slate:c})}))}(e,...t),setSelection:(...t)=>function(e,t,n={}){const{applyChanges:r=!0}=n;e.selection=t,r&&e.applyChanges()}(e,...t),setBlockSelected:(...t)=>function(e,t,n={}){const{only:r=!1,allSelected:o=!1}=n,i=e.selectedBlocks||[];if(null===t)e.selectedBlocks=null;else if(t.length>1)e.selectedBlocks=t.flat();else if(r)e.selectedBlocks=t.flat();else if(o){const t=Object.keys(e.children).map(((e,t)=>t));e.selectedBlocks=Ia(t)}else e.selectedBlocks=Ia(i.concat(t.flat()));e.applyChanges()}(e,...t),blur:(...t)=>function(e,t={}){var n;const r=null!==(n=t.slate)&&void 0!==n?n:dn(e);if(!r)return;const{waitExecution:o,waitExecutionMs:i}=t;o?setTimeout((()=>Ha(e,r)),i):(Ha(e,r),e.applyChanges())}(e,...t),blockEditorsMap:{},blocks:{},formats:{},shortcuts:{},plugins:{},on:(e,t)=>{},off:(e,t)=>{},emit:(e,...t)=>{},once:(e,t)=>{}};return e},exports.createYooptaMark=Ra,exports.default=({editor:n,value:r,marks:o,plugins:i,autoFocus:a,className:l,tools:s,selectionBoxRoot:c,children:d,placeholder:u,readOnly:f})=>{const h=()=>{b((e=>Object.assign(Object.assign({},e),{version:e.version+1})))},g=t.useMemo((()=>o?[_a,...o]:[_a]),[o]),v=t.useMemo((()=>i.map((e=>e.getPlugin))),[i]),[m,b]=t.useState((()=>(n.applyChanges=h,n.readOnly=f||!1,g&&(n.formats=Oa(n,g)),n.blocks=Sa(n,v),n.children=function(e){return!!e&&"object"==typeof e&&0!==Object.keys(e).length}(r)?r:Da,n.blockEditorsMap=function(e){const t={};return Object.keys(e.children).forEach((n=>{const r=ja(e);t[n]=r})),t}(n),n.shortcuts=function(e){const t={};return Object.values(e.blocks).forEach((e=>{var n,r,o,i;e.options&&Array.isArray(null===(n=e.options)||void 0===n?void 0:n.shortcuts)&&(null===(r=e.options)||void 0===r?void 0:r.shortcuts.length)>0&&(null===(i=null===(o=e.options)||void 0===o?void 0:o.shortcuts)||void 0===i||i.forEach((n=>{t[n]=e})))})),t}(n),n.plugins=function(e){const t={},n={};return e.forEach((e=>{e.elements&&Object.keys(e.elements).forEach((t=>{var r;const o=e.elements[t],i=null===(r=o.props)||void 0===r?void 0:r.nodeType;"inline"!==i&&"inlineVoid"!==i||(n[t]=o)})),t[e.type]=e})),e.forEach((e=>{if(e.elements){const r=Object.assign(Object.assign({},e.elements),n);t[e.type]=Object.assign(Object.assign({},e),{elements:r})}})),t}(v),n.on=Ta,n.once=Aa,n.off=Ma,n.emit=La,{editor:n,version:0})));return e.jsx(_i,{children:e.jsx(p,Object.assign({editorState:m},{children:e.jsxs(Lo,Object.assign({tools:s},{children:[e.jsx(Ri,{placeholder:u,marks:g,autoFocus:a,className:l,selectionBoxRoot:c}),d]}))}))})},exports.findPluginBlockBySelectionPath=d,exports.findPluginBlockByType=function(e,t){const n=Object.keys(e.children),{type:r}=t||{},o=n.find((t=>e.children[t].type===r));return o?e.children[o]:null},exports.findSlateBySelectionPath=dn,exports.generateId=C,exports.getRootBlockElement=Ao,exports.getRootBlockElementType=To,exports.useBlockData=g,exports.useBlockSelected=({blockId:e,path:t})=>{var n;const r=h();if(!e&&!t)throw new Error("useBlockSelected must receive either blockId or path");let o;return e&&(o=r.children[e]),t&&(o=d(r,{at:t})),(null===(n=r.selection)||void 0===n?void 0:n[0])===(null==o?void 0:o.meta.order)},exports.useYooptaBlock=e=>h().blocks[e],exports.useYooptaEditor=h,exports.useYooptaPlugin=v,exports.useYooptaPluginOptions=e=>{var t;return null===(t=v(e))||void 0===t?void 0:t.options},exports.useYooptaReadOnly=m,exports.useYooptaTools=No;
|