@yoopta/editor 4.8.1 → 4.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import*as o from
|
|
|
3
3
|
* tabbable 6.2.0
|
|
4
4
|
* @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
|
|
5
5
|
*/
|
|
6
|
-
var qo=["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(","),Zo="undefined"==typeof Element,Go=Zo?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Jo=!Zo&&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},Qo=function e(t,n){var o;void 0===n&&(n=!0);var r=null==t||null===(o=t.getAttribute)||void 0===o?void 0:o.call(t,"inert");return""===r||"true"===r||n&&t&&e(t.parentNode)},er=function e(t,n,o){for(var r=[],i=Array.from(t);i.length;){var l=i.shift();if(!Qo(l,!1))if("SLOT"===l.tagName){var c=l.assignedElements(),a=e(c.length?c:l.children,!0,o);o.flatten?r.push.apply(r,a):r.push({scopeParent:l,candidates:a})}else{Go.call(l,qo)&&o.filter(l)&&(n||!t.includes(l))&&r.push(l);var s=l.shadowRoot||"function"==typeof o.getShadowRoot&&o.getShadowRoot(l),d=!Qo(s,!1)&&(!o.shadowRootFilter||o.shadowRootFilter(l));if(s&&d){var u=e(!0===s?l.children:s.children,!0,o);o.flatten?r.push.apply(r,u):r.push({scopeParent:l,candidates:u})}else i.unshift.apply(i,l.children)}}return r},tr=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},nr=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))&&!tr(e)?0:e.tabIndex},or=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},rr=function(e){return"INPUT"===e.tagName},ir=function(e){return function(e){return rr(e)&&"radio"===e.type}(e)&&!function(e){if(!e.name)return!0;var t,n=e.form||Jo(e),o=function(e){return n.querySelectorAll('input[type="radio"][name="'+e+'"]')};if("undefined"!=typeof window&&void 0!==window.CSS&&"function"==typeof window.CSS.escape)t=o(window.CSS.escape(e.name));else try{t=o(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 r=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!r||r===e}(e)},lr=function(e){var t=e.getBoundingClientRect(),n=t.width,o=t.height;return 0===n&&0===o},cr=function(e,t){var n=t.displayCheck,o=t.getShadowRoot;if("hidden"===getComputedStyle(e).visibility)return!0;var r=Go.call(e,"details>summary:first-of-type")?e.parentElement:e;if(Go.call(r,"details:not([open]) *"))return!0;if(n&&"full"!==n&&"legacy-full"!==n){if("non-zero-area"===n)return lr(e)}else{if("function"==typeof o){for(var i=e;e;){var l=e.parentElement,c=Jo(e);if(l&&!l.shadowRoot&&!0===o(l))return lr(e);e=e.assignedSlot?e.assignedSlot:l||c===e.ownerDocument?l:c.host}e=i}if(function(e){var t,n,o,r,i=e&&Jo(e),l=null===(t=i)||void 0===t?void 0:t.host,c=!1;if(i&&i!==e)for(c=!!(null!==(n=l)&&void 0!==n&&null!==(o=n.ownerDocument)&&void 0!==o&&o.contains(l)||null!=e&&null!==(r=e.ownerDocument)&&void 0!==r&&r.contains(e));!c&&l;){var a,s,d;c=!(null===(s=l=null===(a=i=Jo(l))||void 0===a?void 0:a.host)||void 0===s||null===(d=s.ownerDocument)||void 0===d||!d.contains(l))}return c}(e))return!e.getClientRects().length;if("legacy-full"!==n)return!0}return!1},ar=function(e,t){return!(t.disabled||Qo(t)||function(e){return rr(e)&&"hidden"===e.type}(t)||cr(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 o=t.children.item(n);if("LEGEND"===o.tagName)return!!Go.call(t,"fieldset[disabled] *")||!o.contains(e)}return!0}t=t.parentElement}return!1}(t))},sr=function(e,t){return!(ir(t)||nr(t)<0||!ar(e,t))},dr=function(e){var t=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(t)||t>=0)},ur=function e(t){var n=[],o=[];return t.forEach((function(t,r){var i=!!t.scopeParent,l=i?t.scopeParent:t,c=function(e,t){var n=nr(e);return n<0&&t&&!tr(e)?0:n}(l,i),a=i?e(t.candidates):l;0===c?i?n.push.apply(n,a):n.push(l):o.push({documentOrder:r,tabIndex:c,item:t,isScope:i,content:a})})),o.sort(or).reduce((function(e,t){return t.isScope?e.push.apply(e,t.content):e.push(t.content),e}),[]).concat(n)},fr=function(e,t){var n;return n=(t=t||{}).getShadowRoot?er([e],t.includeContainer,{filter:sr.bind(null,t),flatten:!1,getShadowRoot:t.getShadowRoot,shadowRootFilter:dr}):function(e,t,n){if(Qo(e))return[];var o=Array.prototype.slice.apply(e.querySelectorAll(qo));return t&&Go.call(e,qo)&&o.unshift(e),o.filter(n)}(e,t.includeContainer,sr.bind(null,t)),ur(n)};const pr=o["useInsertionEffect".toString()]||(e=>e());var hr="undefined"!=typeof document?a:s;function gr(){return gr=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},gr.apply(this,arguments)}let vr=!1,mr=0;const yr=()=>"floating-ui-"+mr++;const br=o["useId".toString()]||function(){const[e,t]=o.useState((()=>vr?yr():void 0));return hr((()=>{null==e&&t(yr())}),[]),o.useEffect((()=>{vr||(vr=!0)}),[]),e};const wr=o.createContext(null),xr=o.createContext(null);function kr(e){return"data-floating-ui-"+e}function Er(e){const t=c(e);return hr((()=>{t.current=e})),t}const Or=()=>({getShadowRoot:!0,displayCheck:"function"==typeof ResizeObserver&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function Cr(e,t){const n=fr(e,Or());"prev"===t&&n.reverse();const o=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==(r=e)?void 0:r.ownerDocument)||document));var r;return n.slice(o+1)[0]}function Sr(e,t){const n=t||e.currentTarget,o=e.relatedTarget;return!o||!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&&Un(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}(n,o)}function Dr(e){fr(e,Or()).forEach((e=>{e.dataset.tabindex=e.getAttribute("tabindex")||"",e.setAttribute("tabindex","-1")}))}function jr(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 Br={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 Rr(e){"Tab"===e.key&&(e.target,clearTimeout(undefined))}const Ar=o.forwardRef((function(e,t){const[n,r]=o.useState();hr((()=>(/apple/i.test(navigator.vendor)&&r("button"),document.addEventListener("keydown",Rr),()=>{document.removeEventListener("keydown",Rr)})),[]);const i={ref:t,tabIndex:0,role:n,"aria-hidden":!n||void 0,[kr("focus-guard")]:"",style:Br};return o.createElement("span",gr({},e,i))})),_r=o.createContext(null),Nr=kr("portal");function Tr(e){let{children:t,id:n,root:r=null,preserveTabOrder:i=!0}=e;const l=function(e){let{id:t,root:n}=void 0===e?{}:e;const[r,i]=o.useState(null),l=br(),c=Mr(),a=o.useRef(null);return hr((()=>()=>{null==r||r.remove(),queueMicrotask((()=>{a.current=null}))}),[r]),hr((()=>{if(a.current)return;const e=t?document.getElementById(t):null;if(!e)return;const n=document.createElement("div");n.id=l,n.setAttribute(Nr,""),e.appendChild(n),a.current=n,i(n)}),[t,l]),hr((()=>{if(a.current)return;let e=n||(null==c?void 0:c.portalNode);e&&!$n(e)&&(e=e.current),e=e||document.body;let o=null;t&&(o=document.createElement("div"),o.id=t,e.appendChild(o));const r=document.createElement("div");r.id=l,r.setAttribute(Nr,""),e=o||e,e.appendChild(r),a.current=r,i(r)}),[t,n,l,c]),r}({id:n,root:r}),[c,a]=o.useState(null),s=o.useRef(null),d=o.useRef(null),u=o.useRef(null),f=o.useRef(null),p=!!c&&!c.modal&&c.open&&i&&!(!r&&!l);return o.useEffect((()=>{if(l&&i&&(null==c||!c.modal))return l.addEventListener("focusin",e,!0),l.addEventListener("focusout",e,!0),()=>{l.removeEventListener("focusin",e,!0),l.removeEventListener("focusout",e,!0)};function e(e){if(l&&Sr(e)){("focusin"===e.type?jr:Dr)(l)}}}),[l,i,null==c?void 0:c.modal]),o.createElement(_r.Provider,{value:o.useMemo((()=>({preserveTabOrder:i,beforeOutsideRef:s,afterOutsideRef:d,beforeInsideRef:u,afterInsideRef:f,portalNode:l,setFocusManagerState:a})),[i,l])},p&&l&&o.createElement(Ar,{"data-type":"outside",ref:s,onFocus:e=>{if(Sr(e,l)){var t;null==(t=u.current)||t.focus()}else{const e=Cr(document.body,"prev")||(null==c?void 0:c.refs.domReference.current);null==e||e.focus()}}}),p&&l&&o.createElement("span",{"aria-owns":l.id,style:Br}),l&&b(t,l),p&&l&&o.createElement(Ar,{"data-type":"outside",ref:d,onFocus:e=>{if(Sr(e,l)){var t;null==(t=f.current)||t.focus()}else{const t=Cr(document.body,"next")||(null==c?void 0:c.refs.domReference.current);null==t||t.focus(),(null==c?void 0:c.closeOnFocusOut)&&(null==c||c.onOpenChange(!1,e.nativeEvent))}}}))}const Mr=()=>o.useContext(_r),Lr=new Set,Pr=o.forwardRef((function(e,t){let{lockScroll:n=!1,...r}=e;const i=br();return hr((()=>{if(!n)return;Lr.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,o=Math.round(document.documentElement.getBoundingClientRect().left)+document.documentElement.scrollLeft?"paddingLeft":"paddingRight",r=window.innerWidth-document.documentElement.clientWidth,l=t.left?parseFloat(t.left):window.pageXOffset,c=t.top?parseFloat(t.top):window.pageYOffset;if(t.overflow="hidden",r&&(t[o]=r+"px"),e){var a,s;const e=(null==(a=window.visualViewport)?void 0:a.offsetLeft)||0,n=(null==(s=window.visualViewport)?void 0:s.offsetTop)||0;Object.assign(t,{position:"fixed",top:-(c-Math.floor(n))+"px",left:-(l-Math.floor(e))+"px",right:"0"})}return()=>{Lr.delete(i),0===Lr.size&&(Object.assign(t,{overflow:"",[o]:""}),e&&(Object.assign(t,{position:"",top:"",left:"",right:""}),window.scrollTo(l,c)))}}),[i,n]),o.createElement("div",gr({ref:t},r,{style:{position:"fixed",overflow:"auto",top:0,right:0,bottom:0,left:0,...r.style}}))}));function Ir(e){var t;void 0===e&&(e={});const{open:n=!1,onOpenChange:r,nodeId:i}=e,[l,c]=o.useState(null),a=(null==(t=e.elements)?void 0:t.reference)||l,s=function(e){void 0===e&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:i,elements:{reference:l,floating:c}={},transform:a=!0,whileElementsMounted:s,open:d}=e,[u,f]=o.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,h]=o.useState(r);Ko(p,r)||h(r);const[g,v]=o.useState(null),[y,b]=o.useState(null),w=o.useCallback((e=>{e!==O.current&&(O.current=e,v(e))}),[]),x=o.useCallback((e=>{e!==C.current&&(C.current=e,b(e))}),[]),k=l||g,E=c||y,O=o.useRef(null),C=o.useRef(null),S=o.useRef(u),D=null!=s,j=Xo(s),B=Xo(i),R=o.useCallback((()=>{if(!O.current||!C.current)return;const e={placement:t,strategy:n,middleware:p};B.current&&(e.platform=B.current),Uo(O.current,C.current,e).then((e=>{const t={...e,isPositioned:!0};A.current&&!Ko(S.current,t)&&(S.current=t,m.flushSync((()=>{f(t)})))}))}),[p,t,n,B]);Vo((()=>{!1===d&&S.current.isPositioned&&(S.current.isPositioned=!1,f((e=>({...e,isPositioned:!1}))))}),[d]);const A=o.useRef(!1);Vo((()=>(A.current=!0,()=>{A.current=!1})),[]),Vo((()=>{if(k&&(O.current=k),E&&(C.current=E),k&&E){if(j.current)return j.current(k,E,R);R()}}),[k,E,R,j,D]);const _=o.useMemo((()=>({reference:O,floating:C,setReference:w,setFloating:x})),[w,x]),N=o.useMemo((()=>({reference:k,floating:E})),[k,E]),T=o.useMemo((()=>{const e={position:n,left:0,top:0};if(!N.floating)return e;const t=Yo(N.floating,u.x),o=Yo(N.floating,u.y);return a?{...e,transform:"translate("+t+"px, "+o+"px)",...Wo(N.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:t,top:o}}),[n,a,N.floating,u.x,u.y]);return o.useMemo((()=>({...u,update:R,refs:_,elements:N,floatingStyles:T})),[u,R,_,N,T])}(e),d=o.useContext(xr),u=null!=((null==(f=o.useContext(wr))?void 0:f.id)||null);var f;const p=function(e){const t=o.useRef((()=>{}));return pr((()=>{t.current=e})),o.useCallback((function(){for(var e=arguments.length,n=new Array(e),o=0;o<e;o++)n[o]=arguments[o];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==r||r(e,t,n)})),h=o.useRef(null),g=o.useRef({}),v=o.useState((()=>function(){const e=new Map;return{emit(t,n){var o;null==(o=e.get(t))||o.forEach((e=>e(n)))},on(t,n){e.set(t,[...e.get(t)||[],n])},off(t,n){var o;e.set(t,(null==(o=e.get(t))?void 0:o.filter((e=>e!==n)))||[])}}}()))[0],y=br(),b=o.useCallback((e=>{const t=$n(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),contextElement:e}:e;s.refs.setReference(t)}),[s.refs]),w=o.useCallback((e=>{($n(e)||null===e)&&(h.current=e,c(e)),($n(s.refs.reference.current)||null===s.refs.reference.current||null!==e&&!$n(e))&&s.refs.setReference(e)}),[s.refs]),x=o.useMemo((()=>({...s.refs,setReference:w,setPositionReference:b,domReference:h})),[s.refs,w,b]),k=o.useMemo((()=>({...s.elements,domReference:a})),[s.elements,a]),E=o.useMemo((()=>({...s,refs:x,elements:k,dataRef:g,nodeId:i,floatingId:y,events:v,open:n,onOpenChange:p})),[s,i,y,v,n,p,x,k]);return hr((()=>{const e=null==d?void 0:d.nodesRef.current.find((e=>e.id===i));e&&(e.context=E)})),o.useMemo((()=>({...s,context:E,refs:x,elements:k})),[s,x,k,E])}const zr=e=>e.replace(/[A-Z]+(?![a-z])|[A-Z]/g,((e,t)=>(t?"-":"")+e.toLowerCase()));function Fr(e,t){return"function"==typeof e?e(t):e}function $r(e,t){void 0===t&&(t={});const{open:n,elements:{floating:r}}=e,{duration:i=250}=t,l=("number"==typeof i?i:i.close)||0,[c,a]=o.useState(!1),[s,d]=o.useState("unmounted"),u=function(e,t){const[n,r]=o.useState(e);return e&&!n&&r(!0),o.useEffect((()=>{if(!e){const e=setTimeout((()=>r(!1)),t);return()=>clearTimeout(e)}}),[e,t]),n}(n,l);return hr((()=>{c&&!u&&d("unmounted")}),[c,u]),hr((()=>{if(r){if(n){d("initial");const e=requestAnimationFrame((()=>{d("open")}));return()=>{cancelAnimationFrame(e)}}a(!0),d("close")}}),[n,r]),{isMounted:u,status:s}}function Hr(e,t){void 0===t&&(t={});const{initial:n={opacity:0},open:r,close:i,common:l,duration:c=250}=t,a=e.placement,s=a.split("-")[0],d=o.useMemo((()=>({side:s,placement:a})),[s,a]),u="number"==typeof c,f=(u?c:c.open)||0,p=(u?c:c.close)||0,[h,g]=o.useState((()=>({...Fr(l,d),...Fr(n,d)}))),{isMounted:v,status:m}=$r(e,{duration:c}),y=Er(n),b=Er(r),w=Er(i),x=Er(l);return hr((()=>{const e=Fr(y.current,d),t=Fr(w.current,d),n=Fr(x.current,d),o=Fr(b.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(o).map(zr).join(","),transitionDuration:f+"ms",...n,...o}),"close"===m){const o=t||e;g({transitionProperty:Object.keys(o).map(zr).join(","),transitionDuration:p+"ms",...n,...o})}}),[p,w,y,b,x,f,m,d]),{isMounted:v,styles:h}}var Ur;function Vr(){return Vr=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},Vr.apply(this,arguments)}var Kr=function(e){return o.createElement("svg",Vr({viewBox:"0 0 16 16",className:"turn_svg__loop",style:{width:16,height:16,display:"block",fill:"currentcolor",flexShrink:0,backfaceVisibility:"hidden"}},e),Ur||(Ur=o.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 Wr(e,t){if(null==e)return{};var n,o,r={},i=Object.keys(e);for(o=0;o<i.length;o++)n=i[o],t.indexOf(n)>=0||(r[n]=e[n]);return r}var Yr=["color"],Xr=g((function(e,t){var n=e.color,o=void 0===n?"currentColor":n,r=Wr(e,Yr);return v("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},r,{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:o,fillRule:"evenodd",clipRule:"evenodd"}))})),qr=["color"],Zr=g((function(e,t){var n=e.color,o=void 0===n?"currentColor":n,r=Wr(e,qr);return v("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},r,{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:o,fillRule:"evenodd",clipRule:"evenodd"}))})),Gr=["color"],Jr=g((function(e,t){var n=e.color,o=void 0===n?"currentColor":n,r=Wr(e,Gr);return v("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},r,{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:o,fillRule:"evenodd",clipRule:"evenodd"}))})),Qr=["color"],ei=g((function(e,t){var n=e.color,o=void 0===n?"currentColor":n,r=Wr(e,Qr);return v("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},r,{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:o,fillRule:"evenodd",clipRule:"evenodd"}))})),ti=function(){var e=document.getSelection();if(!e.rangeCount)return function(){};for(var t=document.activeElement,n=[],o=0;o<e.rangeCount;o++)n.push(e.getRangeAt(o));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()}},ni={"text/plain":"Text","text/html":"Url",default:"Text"};var oi=function(e,t){var n,o,r,i,l,c,a=!1;t||(t={}),n=t.debug||!1;try{if(r=ti(),i=document.createRange(),l=document.getSelection(),(c=document.createElement("span")).textContent=e,c.ariaHidden="true",c.style.all="unset",c.style.position="fixed",c.style.top=0,c.style.clip="rect(0, 0, 0, 0)",c.style.whiteSpace="pre",c.style.webkitUserSelect="text",c.style.MozUserSelect="text",c.style.msUserSelect="text",c.style.userSelect="text",c.addEventListener("copy",(function(o){if(o.stopPropagation(),t.format)if(o.preventDefault(),void 0===o.clipboardData){n&&console.warn("unable to use e.clipboardData"),n&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var r=ni[t.format]||ni.default;window.clipboardData.setData(r,e)}else o.clipboardData.clearData(),o.clipboardData.setData(t.format,e);t.onCopy&&(o.preventDefault(),t.onCopy(o.clipboardData))})),document.body.appendChild(c),i.selectNodeContents(c),l.addRange(i),!document.execCommand("copy"))throw new Error("copy command was unsuccessful");a=!0}catch(r){n&&console.error("unable to copy using execCommand: ",r),n&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(t.format||"text",e),t.onCopy&&t.onCopy(window.clipboardData),a=!0}catch(r){n&&console.error("unable to copy using clipboardData: ",r),n&&console.error("falling back to prompt"),o=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(o,e)}}finally{l&&("function"==typeof l.removeRange?l.removeRange(i):l.removeAllRanges()),c&&document.body.removeChild(c),r()}return a};function ri(e){if(!e)return;const t=Object.keys(e);return 1===t.length?t[0]:t.find((t=>e[t].asRoot))}function ii(e){if(!e)return;const t=ri(e);return t?e[t]:void 0}function li(e,t,n){var o;return(null===(o=e.children)||void 0===o?void 0:o.map((e=>{const o=t[e];if(!o)throw new Error(`Element definition for ${e} not found`);return J({id:G(),type:e,props:o.props,children:o.children&&o.children.length>0?li(o,t,n):[{text:(null==n?void 0:n[e])||""}]})})))||[]}function ci(e,t,n){e.plugins[t];const o=e.blocks[t].elements,r=ri(o);if(!r)throw new Error(`Root element type not found for block type ${t}`);const i=o[r];return{id:G(),type:r,props:i.props,children:i.children&&i.children.length>0?li(i,o,n):[{text:""}]}}const ai=i(void 0),si=({children:o,tools:r})=>{const i=V(),l=d((()=>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]),c=d((()=>!r||i?null:Object.keys(r).map((t=>{var n,o,i;const l=null===(n=null==r?void 0:r[t])||void 0===n?void 0:n.tool,c=null===(o=null==r?void 0:r[t])||void 0===o?void 0:o.render,a=null===(i=null==r?void 0:r[t])||void 0===i?void 0:i.props;return l?e(l,Object.assign({render:c},a),t):null}))),[r]);return e(ai.Provider,Object.assign({value:l},{children:t(n,{children:[c,o]})}))},di=()=>{const e=l(ai);if(void 0===e)throw new Error("useYooptaTools must be used within a ToolsProvider");return e};function ui({editor:e,view:t,onClose:n,mode:o="toggle"}){return{actions:(()=>{let t=Object.keys(e.blocks);return"toggle"===o&&(t=t.filter((t=>function(e,t){var n;const o=e.blocks[t];if(!o)return!1;const r=ii(o.elements);return"void"!==(null===(n=null==r?void 0:r.props)||void 0===n?void 0:n.nodeType)}(e,t)))),t.map((t=>{var n,o,r,i,l,c;return{type:t,title:(null===(o=null===(n=e.blocks[t].options)||void 0===n?void 0:n.display)||void 0===o?void 0:o.title)||t,description:null===(i=null===(r=e.blocks[t].options)||void 0===r?void 0:r.display)||void 0===i?void 0:i.description,icon:null===(c=null===(l=e.blocks[t].options)||void 0===l?void 0:l.display)||void 0===c?void 0:c.icon}}))})(),onClose:n,empty:!1,getItemProps:t=>({onMouseEnter:()=>{},"data-action-menu-item":!0,"data-action-menu-item-type":t,"aria-selected":!1,onClick:()=>{"toggle"===o&&e.blocks[t].toggle({focus:!0}),"create"===o&&e.blocks[t].create({deleteText:!0,focus:!0}),n()}}),getRootProps:()=>({"data-action-menu-list":!0}),editor:e,view:t}}function fi(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(o=Object.getOwnPropertySymbols(e);r<o.length;r++)t.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(n[o[r]]=e[o[r]])}return n}"function"==typeof SuppressedError&&SuppressedError;const pi=t=>{var{className:n,children:o,lockScroll:r=!0}=t,i=fi(t,["className","children","lockScroll"]);return e(Pr,Object.assign({lockScroll:r,className:n},i,{onClick:e=>{var t;e.stopPropagation(),null===(t=i.onClick)||void 0===t||t.call(i,e)},onMouseDown:e=>{var t;e.stopPropagation(),null===(t=i.onMouseDown)||void 0===t||t.call(i,e)}},{children:o}))},hi=t=>{const[n,o]=f(!1),r=c(null),i=$();return s((()=>{o(!0);const e=i.refElement;if(!e)return;return e.querySelector(".yoopta-overlays")||(r.current=document.createElement("div"),r.current.className="yoopta-overlays",e.appendChild(r.current)),()=>{r.current&&r.current.remove()}}),[]),n?e(Tr,Object.assign({id:`${t.id}-${i.id}`,root:r.current||i.refElement},{children:t.children})):null},gi=({children:t})=>e("div",Object.assign({className:"yoopta-block-options-group"},{children:t})),vi=({children:t})=>e("div",Object.assign({onClick:e=>e.stopPropagation(),className:"yoopta-block-options-menu-content data-[state=open]:yoo-editor-animate-in data-[state=closed]:yoo-editor-animate-out data-[state=closed]:yoo-editor-fade-out-0 data-[state=open]:yoo-editor-fade-in-0 data-[state=closed]:yoo-editor-zoom-out-95 data-[state=open]:yoo-editor-zoom-in-95 data-[side=bottom]:yoo-editor-slide-in-from-top-2 data-[side=left]:yoo-editor-slide-in-from-right-2 data-[side=right]:yoo-editor-slide-in-from-left-2 data-[side=top]:yoo-editor-slide-in-from-bottom-2"},{children:t})),mi=({children:t})=>e("div",Object.assign({className:"yoopta-block-options-item"},{children:t})),yi=["delete","duplicate","turnInto","copy"],bi=({isOpen:n,onClose:o,refs:r,style:i,actions:l=yi,children:c})=>{var a,s,d;const u=$(),p=di(),[h,g]=f(!1),{refs:v,floatingStyles:m,context:y}=Ir({placement:"right",open:h,onOpenChange:g,middleware:[Ho(),$o(),Fo(),Eo(10)],whileElementsMounted:zo}),{isMounted:b,styles:w}=Hr(y,{duration:100});if(!n)return null;const x=P(u,{at:u.selection}),k=ii(null===(a=u.blocks[(null==x?void 0:x.type)||""])||void 0===a?void 0:a.elements),E="void"===(null===(s=null==k?void 0:k.props)||void 0===s?void 0:s.nodeType),O=p.ActionMenu,C=Object.assign(Object.assign({},m),w),S=ui({editor:u,view:"small",onClose:()=>{g(!1),o()}});return e(hi,Object.assign({id:"yoo-block-options-portal"},{children:e(pi,Object.assign({lockScroll:!0,className:"yoo-editor-z-[100]",onClick:o},{children:e("div",Object.assign({style:i,ref:r.setFloating,contentEditable:!1},{children:t(vi,{children:[null!==l&&t(gi,{children:[e(mi,{children:t("button",Object.assign({type:"button",className:"yoopta-block-options-button",onClick:()=>{const e=u.selection;u.deleteBlock({at:e}),u.setBlockSelected(null),u.setSelection(null),o()}},{children:[e(ei,{className:"yoo-editor-w-4 yoo-editor-h-4 yoo-editor-mr-2"}),"Delete"]}))}),e(mi,{children:t("button",Object.assign({type:"button",className:"yoopta-block-options-button",onClick:()=>{u.duplicateBlock({at:u.selection,focus:!0}),u.setBlockSelected(null),o()}},{children:[e(Xr,{className:"yoo-editor-w-4 yoo-editor-h-4 yoo-editor-mr-2"}),"Duplicate"]}))}),!!O&&!E&&!(null===(d=u.blocks[(null==x?void 0:x.type)||""])||void 0===d?void 0:d.hasCustomEditor)&&t(mi,{children:[b&&e(hi,Object.assign({id:"yoo-block-options-portal"},{children:e(pi,Object.assign({lockScroll:!0,className:"yoo-editor-z-[100]",onClick:()=>g(!1)},{children:e("div",Object.assign({style:C,ref:v.setFloating},{children:e(O,Object.assign({},S))}))}))})),t("button",Object.assign({type:"button",className:"yoopta-block-options-button",ref:v.setReference,onClick:()=>g((e=>!e))},{children:[e(Kr,{className:"yoo-editor-w-4 yoo-editor-h-4 yoo-editor-mr-2"}),"Turn into"]}))]}),e(mi,{children:t("button",Object.assign({type:"button",className:"yoopta-block-options-button",onClick:()=>{const e=P(u);e&&(oi(`${window.location.origin}${window.location.pathname}#${e.id}`),u.emit("block:copy",e)),o()}},{children:[e(Jr,{className:"yoo-editor-w-4 yoo-editor-h-4 yoo-editor-mr-2"}),"Copy link to block"]}))})]}),c]})}))}))}))};var wi=Object.freeze({__proto__:null,BlockOptions:bi,BlockOptionsMenuContent:vi,BlockOptionsMenuGroup:gi,BlockOptionsMenuItem:mi,BlockOptionsSeparator:({className:t=""})=>e("div",{className:`yoopta-block-options-separator ${t}`})});const xi=({block:n,editor:o,dragHandleProps:r,onChangeActiveBlock:i,showActions:l})=>{const[c,a]=f(!1),{isActionMenuOpen:s,actionMenuRefs:d,hasActionMenu:u,actionMenuStyles:p,onChangeActionMenuOpen:h,onCloseActionMenu:g,actionMenuRenderProps:v,ActionMenu:m}=(({editor:e})=>{const t=di().ActionMenu,[n,o]=f(!1),{refs:r,floatingStyles:i,context:l}=Ir({placement:"bottom-start",open:n,onOpenChange:o,middleware:[Ho(),$o(),Fo(),Eo(10)],whileElementsMounted:zo}),{isMounted:c,styles:a}=Hr(l,{duration:100}),s=Object.assign(Object.assign({},i),a),d=e=>o(e),u=()=>d(!1),p=ui({editor:e,view:"default",mode:"create",onClose:u});return{isActionMenuOpen:c,actionMenuStyles:s,actionMenuRefs:r,hasActionMenu:!!t,onChangeActionMenuOpen:d,actionMenuRenderProps:p,onCloseActionMenu:u,ActionMenu:t}})({editor:o}),{refs:y,floatingStyles:b,context:x}=Ir({placement:"right-start",open:c,onOpenChange:a,middleware:[Ho(),$o(),Fo(),Eo()]}),{isMounted:k,styles:E}=Hr(x,{duration:100}),{setActivatorNodeRef:O,attributes:C,listeners:j}=r,B=Object.assign(Object.assign({},b),E);return t("div",Object.assign({contentEditable:!1,"data-hovered-state-open":l,className:"yoopta-block-actions"},{children:[s&&u&&e(hi,Object.assign({id:"yoo-block-options-portal"},{children:e(pi,Object.assign({lockScroll:!0,className:"yoo-editor-z-[100]",onClick:g},{children:e("div",Object.assign({style:p,ref:d.setFloating},{children:e(m,Object.assign({},v))}))}))})),e("button",Object.assign({type:"button",onClick:()=>{var e;const t=Ln(o,{at:[n.meta.order]}),r=o.blocks[n.type];if(!t)return;const i=document.querySelector(`[data-yoopta-block-id="${n.id}"]`),l=ii(r.elements);let c;r.hasCustomEditor||(c=S.string(t,[0]));const a="string"==typeof c&&0===c.trim().length;if(u&&a&&"void"!==(null===(e=null==l?void 0:l.props)||void 0===e?void 0:e.nodeType))o.setSelection([n.meta.order]),o.focusBlock(n.id),d.setReference(i),h(!0);else{const e=Q({id:G()}),t=[n.meta.order+1];o.setSelection([n.meta.order]),o.insertBlock(e,{at:t,focus:!0}),u&&setTimeout((()=>{i&&d.setReference(i.nextSibling),h(!0)}),0)}},className:"yoopta-block-actions-plus"},{children:e(Mn,{})})),e("button",Object.assign({type:"button",className:"yoopta-block-actions-drag",ref:e=>{O(e),y.setReference(e)}},C,j,{onClick:e=>{e.stopPropagation(),i(n.id);const t=Ln(o,{at:[n.meta.order]});o.focusBlock(n.id),t&&setTimeout((()=>{o.blocks[n.type].hasCustomEditor||(w.blur(t),w.deselect(t),D.deselect(t)),o.setBlockSelected([n.meta.order],{only:!0}),o.setSelection([n.meta.order]),a(!0)}),10)},onMouseDown:e=>e.stopPropagation()},{children:e(Nn,{})})),e(bi,{isOpen:k,refs:y,style:B,onClose:()=>a(!1)})]}))},ki=({children:n,block:o,blockId:i})=>{var l;const c=$(),[a,s]=r.useState(null),{attributes:f,listeners:p,setNodeRef:h,setActivatorNodeRef:g,transform:v,transition:m,isOver:y,isDragging:b}=Cn({id:i,disabled:c.readOnly}),w=((e,t,n,o,r)=>d((()=>({container:{marginLeft:20*e.meta.depth+"px",transform:t?`translate3d(${t.x}px, ${t.y}px, 0)`:"none",transition:n,opacity:o?.7:1},content:r&&!o?{borderBottom:"2px solid #007aff"}:void 0})),[e.meta.depth,t,n,o,r]))(o,v,m,b,y),x=`yoopta-block yoopta-align-${o.meta.align||"left"}`,k=null===(l=c.selectedBlocks)||void 0===l?void 0:l.includes(o.meta.order),E=a===i,O=u((()=>{c.readOnly||s(i)}),[c.readOnly,i]),C=u((()=>{c.readOnly||s(null)}),[c.readOnly]),S=d((()=>({setActivatorNodeRef:g,attributes:f,listeners:p})),[o]);return t("div",Object.assign({ref:h,className:x,onMouseEnter:O,onMouseLeave:C,style:w.container,"data-hovered-block":E,"data-yoopta-block":!0,"data-yoopta-block-id":i,"data-yoopta-block-type":o.type},{children:[!c.readOnly&&e(xi,{block:o,editor:c,dragHandleProps:S,showActions:E,onChangeActiveBlock:s}),e("div",Object.assign({style:w.content},{children:n})),k&&!c.readOnly&&e("div",{className:"yoopta-selection-block"})]}))};var Ei={};Object.defineProperty(Ei,"__esModule",{value:!0});for(var Oi="undefined"!=typeof window&&/Mac|iPod|iPhone|iPad/.test(window.navigator.platform),Ci={alt:"altKey",control:"ctrlKey",meta:"metaKey",shift:"shiftKey"},Si={add:"+",break:"pause",cmd:"meta",command:"meta",ctl:"control",ctrl:"control",del:"delete",down:"arrowdown",esc:"escape",ins:"insert",left:"arrowleft",mod:Oi?"meta":"control",opt:"alt",option:"alt",return:"enter",right:"arrowright",space:" ",spacebar:" ",up:"arrowup",win:"meta",windows:"meta"},Di={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},ji=1;ji<20;ji++)Di["f"+ji]=111+ji;function Bi(e,t,n){t&&!("byKey"in t)&&(n=t,t=null),Array.isArray(e)||(e=[e]);var o=e.map((function(e){return Ri(e,t)})),r=function(e){return o.some((function(t){return Ai(t,e)}))};return null==n?r:r(n)}function Ri(e,t){var n=t&&t.byKey,o={},r=(e=e.replace("++","+add")).split("+"),i=r.length;for(var l in Ci)o[Ci[l]]=!1;var c=!0,a=!1,s=void 0;try{for(var d,u=r[Symbol.iterator]();!(c=(d=u.next()).done);c=!0){var f=d.value,p=f.endsWith("?")&&f.length>1;p&&(f=f.slice(0,-1));var h=Ni(f),g=Ci[h];if(f.length>1&&!g&&!Si[f]&&!Di[h])throw new TypeError('Unknown modifier: "'+f+'"');1!==i&&g||(n?o.key=h:o.which=_i(f)),g&&(o[g]=!p||null)}}catch(e){a=!0,s=e}finally{try{!c&&u.return&&u.return()}finally{if(a)throw s}}return o}function Ai(e,t){for(var n in e){var o=e[n],r=void 0;if(null!=o&&((null!=(r="key"===n&&null!=t.key?t.key.toLowerCase():"which"===n?91===o&&93===t.which?91:t.which:t[n])||!1!==o)&&r!==o))return!1}return!0}function _i(e){return e=Ni(e),Di[e]||e.toUpperCase().charCodeAt(0)}function Ni(e){return e=e.toLowerCase(),e=Si[e]||e}Ei.default=Bi,Ei.isHotkey=Bi,Ei.isCodeHotkey=function(e,t){return Bi(e,t)};var Ti=Ei.isKeyHotkey=function(e,t){return Bi(e,{byKey:!0},t)};Ei.parseHotkey=Ri,Ei.compareHotkey=Ai,Ei.toKeyCode=_i,Ei.toKeyName=Ni;const Mi={bold:"mod+b",italic:"mod+i",compose:["down","left","right","up","backspace","enter"],arrowLeft:"left",arrowUp:"up",arrowDown:"down",arrowRight:"right",ctrlLeft:"ctrl+left",escape:"esc",ctrlRight:"ctrl+right",deleteBackward:"shift?+backspace",backspace:"backspace",deleteForward:"shift?+delete",extendBackward:"shift+left",shiftDelete:"shift+delete",extendForward:"shift+right",shiftEnter:"shift+enter",enter:"enter",space:"space",undo:"mod+z",select:"mod+a",shiftTab:"shift+tab",shiftArrowUp:"shift+up",shiftArrowDown:"shift+down",tab:"tab",cmd:"mod",cmdEnter:"mod+enter",cmdShiftEnter:"mod+shift+enter",slashCommand:"/",copy:"mod+c",cut:"mod+x",cmdShiftRight:"mod+shift+right",cmdShiftLeft:"mod+shift+left",cmdShiftDelete:"mod+shift+backspace",cmdShiftD:"mod+shift+d",cmdAltDelete:"mod+alt+backspace"},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"},Pi={deleteWordBackward:"ctrl+shift?+backspace",deleteWordForward:"ctrl+shift?+delete",redo:["ctrl+y","ctrl+shift+z"]},Ii=e=>{const t=Mi[e],n=Li[e],o=Pi[e],r=t&&Ti(t),i=n&&Ti(n),l=o&&Ti(o);return e=>!(!r||!r(e))||(!(!i||!i(e))||!(!l||!l(e)))},zi={isBold:Ii("bold"),isCompose:Ii("compose"),isArrowLeft:Ii("arrowLeft"),isArrowRight:Ii("arrowRight"),isArrowUp:Ii("arrowUp"),isArrowDown:Ii("arrowDown"),isDeleteBackward:Ii("deleteBackward"),isDeleteForward:Ii("deleteForward"),isDeleteLineBackward:Ii("deleteLineBackward"),isDeleteLineForward:Ii("deleteLineForward"),isDeleteWordBackward:Ii("deleteWordBackward"),isDeleteWordForward:Ii("deleteWordForward"),isExtendBackward:Ii("extendBackward"),isExtendForward:Ii("extendForward"),isExtendLineBackward:Ii("extendLineBackward"),isExtendLineForward:Ii("extendLineForward"),isItalic:Ii("italic"),isMoveLineBackward:Ii("moveLineBackward"),isMoveLineForward:Ii("moveLineForward"),isCtrlLeft:Ii("ctrlLeft"),isCtrlRight:Ii("ctrlRight"),isRedo:Ii("redo"),isShiftEnter:Ii("shiftEnter"),isEnter:Ii("enter"),isTransposeCharacter:Ii("transposeCharacter"),isUndo:Ii("undo"),isSpace:Ii("space"),isSelect:Ii("select"),isTab:Ii("tab"),isShiftTab:Ii("shiftTab"),isBackspace:Ii("backspace"),isCmdEnter:Ii("cmdEnter"),isCmd:Ii("cmd"),isEscape:Ii("escape"),isSlashCommand:Ii("slashCommand"),isShiftArrowUp:Ii("shiftArrowUp"),isShiftArrowDown:Ii("shiftArrowDown"),isCopy:Ii("copy"),isCut:Ii("cut"),isShiftDelete:Ii("shiftDelete"),isCmdShiftEnter:Ii("cmdShiftEnter"),isCmdShiftRight:Ii("cmdShiftRight"),isCmdShiftLeft:Ii("cmdShiftLeft"),isCmdShiftDelete:Ii("cmdShiftDelete"),isCmdAltDelete:Ii("cmdAltDelete"),isCmdShiftD:Ii("cmdShiftD")};const Fi={onKeyDown:function(e){return t=>{const n=Ln(e,{at:e.selection});if(!n||!n.selection)return;const o=j.parent(n.selection.anchor.path);if(zi.isShiftEnter(t)){if(t.isDefaultPrevented())return;return t.preventDefault(),void n.insertText("\n")}if(zi.isEnter(t)){if(t.isDefaultPrevented())return;t.preventDefault();const r=S.isStart(n,n.selection.anchor,o),i=S.isEnd(n,n.selection.anchor,o);if(!r&&!i)return void e.splitBlock({slate:n,focus:!0});const l=Q({id:G()}),c=e.selection?[e.selection[0]+1]:[0];e.insertBlock(l,{at:c,slate:n,focus:!0})}else if(zi.isBackspace(t)){if(t.isDefaultPrevented())return;const o=j.parent(n.selection.anchor.path);if(S.isStart(n,n.selection.anchor,o)){t.preventDefault();const r=S.string(n,o),i=e.selection?e.selection[0]-1:0,l=Ln(e,{at:[i]}),c=P(e,{at:[i]}),a=e.blocks[(null==c?void 0:c.type)||""];let s;if(l&&!a.hasCustomEditor&&(s=function(e,t){try{const[,n]=S.last(e,t);return{path:n,offset:S.string(e,n).length}}catch(e){return{path:[0,0],offset:0}}}(l,o)),0===r.trim().length)return e.deleteBlock({at:e.selection,focus:!0,focusAt:s});{if(B.isExpanded(n.selection))return D.delete(n,{at:n.selection});const t=e.selection?e.selection[0]-1:0,o=P(e,{at:[t]}),r=e.blocks[(null==o?void 0:o.type)||""];if(r&&r.hasCustomEditor)return;if(!l)return;if(0===S.string(l,[0,0]).length)return e.deleteBlock({at:[t],focus:!0,focusAt:s});const i=Array.from(S.nodes(n,{at:[0],match:e=>!S.isEditor(e)&&(R.isText(e)||S.isInline(n,e)),mode:"highest"})).map((([e])=>e));return D.insertNodes(l,i,{at:S.end(l,[])}),e.deleteBlock({at:e.selection,focus:!0,focusAt:s})}}}else{if(zi.isSelect(t)){if(t.isDefaultPrevented())return;const[,o]=S.first(n,[0]),[,r]=S.last(n,[n.children.length-1]),i=S.range(n,o,r),l=B.equals(n.selection,i),c=0===S.string(n,i).trim().length;if(B.isExpanded(n.selection)&&l||c)return t.preventDefault(),w.blur(n),w.deselect(n),D.deselect(n),void e.setBlockSelected([],{allSelected:!0})}if(zi.isShiftTab(t)){if(t.isDefaultPrevented())return;return t.preventDefault(),void e.decreaseBlockDepth()}if(zi.isTab(t)){if(t.isDefaultPrevented())return;return t.preventDefault(),void e.increaseBlockDepth()}if(zi.isArrowUp(t)){if(t.isDefaultPrevented())return;if(1===new Set(n.selection.anchor.path).size){const n=e.selection?[e.selection[0]-1]:null,o=Ln(e,{at:n}),r=P(e,{at:n});if(o&&r){const[,n]=S.last(o,[0]),i={path:n,offset:S.string(o,n).length};return t.preventDefault(),void e.focusBlock(r.id,{focusAt:i,waitExecution:!1,shouldUpdateBlockSelection:!0})}}}if(zi.isArrowDown(t)){if(t.isDefaultPrevented())return;const o=j.parent(n.selection.anchor.path);if(S.isEnd(n,n.selection.anchor,o)){const n=e.selection?[e.selection[0]+1]:null,r=Ln(e,{at:n}),i=P(e,{at:n});if(r&&i){const n=function(e,t){try{const[,n]=S.first(e,t);return{path:n,offset:0}}catch(e){return{path:[0,0],offset:0}}}(r,o);return t.preventDefault(),void e.focusBlock(i.id,{focusAt:n,waitExecution:!1})}}}if(B.isExpanded(n.selection)){if(Object.values(e.formats).length>0)for(const n of Object.values(e.formats))if(n.hotkey&&Ti(n.hotkey)(t)){t.preventDefault(),e.formats[n.type].toggle();break}}}}}},$i=({children:t,attributes:n,placeholder:o})=>{const r=x(),i=Object.assign({},n);return r&&o&&(i["data-placeholder"]=o,i.className="yoopta-placeholder"),e("span",Object.assign({},i,{children:t}))},Hi=new WeakMap;function Ui(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:"italic"}},Ki=["left","center","right",void 0];function Wi(e,t,n,o){var r,i;let l;if(t.parse){l=t.parse(n,e);if(A.isElement(l)&&"inline"===(null===(r=l.props)||void 0===r?void 0:r.nodeType))return l}const c=e.blocks[t.type],a=ri(c.elements)||"",s=c.elements[a],d="void"===(null===(i=s.props)||void 0===i?void 0:i.nodeType);let u={id:G(),type:a,children:d&&!c.hasCustomEditor?[{text:""}]:o.map(Xi).flat(),props:Object.assign({nodeType:"block"},s.props)};if(l)if(A.isElement(l))u=l;else if(Array.isArray(l)){return l}if(0===u.children.length&&(u.children=[{text:""}]),!l&&t.parse)return;const f=n.getAttribute("data-meta-align"),p=parseInt(n.getAttribute("data-meta-depth")||"0",10);return Q({id:G(),type:t.type,value:[u],meta:{order:0,depth:p,align:Ki.includes(f)?f:void 0}})}function Yi(e,t,n){var o;if(3===n.nodeType){return{text:null===(o=n.textContent)||void 0===o?void 0:o.replace(/[\t\n\r\f\v]+/g," ")}}if(1!==n.nodeType)return null;if("BR"===n.nodeName)return{text:"\n"};const r=n;let i=Array.from(r.childNodes).map((n=>Yi(e,t,n))).flat().filter(Boolean);if(Vi[r.nodeName]){const e=Vi[r.nodeName].type;return i.map((t=>"string"==typeof t?{[e]:!0,text:t}:t.text?Object.assign(Object.assign({},t),{[e]:!0}):t))}const l=t[r.nodeName];if(l){if(Array.isArray(l)){return l.map((t=>Wi(e,t,r,i))).filter(Boolean)}return Wi(e,l,r,i)}return i}function Xi(e){if("string"==typeof e)return{text:e};if(A.isElement(e))return e;if(Array.isArray(e))return e.map(Xi).flat();if(null==e?void 0:e.text)return e;if(Ui(e)){return e.value[0].children.map(Xi).flat()}return{text:""}}function qi(e,t){console.log("pasted html",t);const n=function(e){const t={};return Object.keys(e.plugins).forEach((n=>{const o=e.plugins[n],{parsers:r}=o;if(r){const{html:e}=r;if(e){const{deserialize:o}=e;if(o){const{nodeNames:e}=o;e&&e.forEach((e=>{const r=t[e];if(r){const i=Array.isArray(r)?r:[r];t[e]=[...i,{type:n,parse:o.parse}]}else t[e]={type:n,parse:o.parse}}))}}}})),t}(e);return Yi(e,n,t).flat().filter(Ui)}function Zi(e){return!!new RegExp("^(https?:\\/\\/)?((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|((\\d{1,3}\\.){3}\\d{1,3}))(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*(\\?[;&a-z\\d%_.~+=-]*)?(\\#[-a-z\\d_]*)?$","i").test(e)}const Gi=(e,t,n)=>{var o,r,i,l;(e=>{const[t]=S.nodes(e,{match:e=>!S.isEditor(e)&&A.isElement(e)&&"link"===e.type});return!!t})(t)&&(e=>{D.unwrapNodes(e,{match:e=>!S.isEditor(e)&&A.isElement(e)&&"link"===e.type})})(t);const{selection:c}=t,a=c&&B.isCollapsed(c),s=null===(l=null===(i=null===(r=null===(o=e.plugins)||void 0===o?void 0:o.LinkPlugin)||void 0===r?void 0:r.elements)||void 0===i?void 0:i.link)||void 0===l?void 0:l.props,d={type:"link",children:a?[{text:n}]:[],props:{url:n,target:(null==s?void 0:s.target)||"_self",rel:(null==s?void 0:s.rel)||"noopener noreferrer"}};a?D.insertNodes(t,d):(D.wrapNodes(t,d,{split:!0}),D.collapse(t,{edge:"end"}))},Ji=(e,t,n,o,r)=>d((()=>{let i=t.blockEditorsMap[e];const{normalizeNode:l,insertText:c,apply:a}=i,s=Object.keys(o);return s.forEach((e=>{var n;const r=null===(n=o[e].props)||void 0===n?void 0:n.nodeType,l="inline"===r,c="void"===r,a="inlineVoid"===r;a&&(i.markableVoid=t=>t.type===e),(c||a)&&(i.isVoid=t=>t.type===e),(l||a)&&(i.isInline=t=>t.type===e,i=((e,t)=>{const{insertData:n,insertText:o}=t;return t.insertText=n=>{n&&Zi(n)?Gi(e,t,n):o(n)},t.insertData=o=>{const r=o.getData("text/plain");r&&Zi(r)?Gi(e,t,r):n(o)},t})(t,i))})),i.insertText=e=>{Array.isArray(t.selectedBlocks)&&t.setBlockSelected(null),c(e)},i.apply=e=>{_.isSelectionOperation(e)&&Array.isArray(t.selectedBlocks)&&i.selection&&B.isExpanded(i.selection)&&t.setBlockSelected(null),a(e)},i.normalizeNode=e=>{const[o,r]=e,c=t.blocks[n.type].elements;if(Object.keys(c).length>1)return l(e);if(A.isElement(o)){const{type:e}=o,t=ri(c);if(!s.includes(e))return void D.setNodes(i,{type:t,props:Object.assign({},o.props)},{at:r});if(o.type===t)for(const[e,t]of N.children(i,r))if(A.isElement(e)&&!i.isInline(e))return void D.unwrapNodes(i,{at:t})}l(e)},r&&(i=r(i,t,e)),i}),[o,e,r]),Qi=({id:t,customEditor:n,elements:o,marks:r,events:i,options:l,extensions:a,placeholder:s="Type '/' for commands"})=>{var f,p;const h=$(),g=H(t);let v=c(g.value).current;const m=d((()=>(e=>{const t={};return Object.keys(e).forEach((n=>t[n]=e[n].render)),t})(o)),[o]),y=d((()=>(e=>{const t={};return e?(e.forEach((e=>t[e.type]=e)),t):t})(r)),[r]),b=Ji(t,h,g,o,a),w=((e,t,n,o)=>d((()=>{if(!e||t.readOnly)return{};const r=fi(e||{},["onBeforeCreate","onDestroy","onCreate"]),i={hotkeys:zi,currentBlock:n,defaultBlock:Q({id:G()})},l={};return Object.keys(r).forEach((e=>{l[e]=function(n){r[e]&&r[e](t,o,i)(n)}})),l}),[e,t,n]))(i,h,g,b),x=u((e=>{h.updateBlock(t,{value:e})}),[t,h]),k=u((n=>{const o=m[n.element.type],{attributes:r}=n,i=fi(n,["attributes"]);return r["data-element-type"]=i.element.type,o?e(o,Object.assign({},i,{attributes:r,blockId:t,HTMLAttributes:null==l?void 0:l.HTMLAttributes})):e(O,Object.assign({},i,{attributes:r}))}),[o,b.children]),E=u((t=>{var n,o,r,i,l;let{children:c,leaf:a,attributes:d}=t;const u=fi(a,["text"]),f=(null===(n=h.selection)||void 0===n?void 0:n[0])===g.meta.order;u&&Object.keys(u).forEach((e=>{const t=y[e];t&&(c=t.render({children:c,leaf:a}))}));const p=!("void"===(null===(l=null===(i=null===(r=null===(o=t.children)||void 0===o?void 0:o.props)||void 0===r?void 0:r.parent)||void 0===i?void 0:i.props)||void 0===l?void 0:l.nodeType))&&f&&a.withPlaceholder;return e($i,Object.assign({attributes:d,placeholder:p?s:void 0},{children:c}))}),[r]),C=u((e=>{var t;h.readOnly||(null===(t=w.onKeyDown)||void 0===t||t.call(w,e),Fi.onKeyDown(h)(e))}),[w.onKeyDown,h.readOnly,null===(f=h.selection)||void 0===f?void 0:f[0],g.meta.order]),D=u((e=>{var t;h.readOnly||null===(t=null==w?void 0:w.onKeyUp)||void 0===t||t.call(w,e)}),[w.onKeyUp,h.readOnly]),j=u((e=>{var t;h.readOnly||(e.preventDefault(),null===(t=null==w?void 0:w.onBlur)||void 0===t||t.call(w,e))}),[w.onBlur,h.readOnly]),R=u((e=>{var t;h.readOnly||(h.isFocused()||(Hi.set(h,!0),h.emit("focus",!0)),null===(t=null==w?void 0:w.onFocus)||void 0===t||t.call(w,e))}),[w.onFocus,h.readOnly]),A=u((e=>{var t;if(h.readOnly)return;null===(t=null==w?void 0:w.onPaste)||void 0===t||t.call(w,e);const n=e.clipboardData.getData("text/html"),o=(new DOMParser).parseFromString(n,"text/html");if(o.body.childNodes.length>0){const t=qi(h,o.body);if(t.length>0)return e.preventDefault(),void h.insertBlocks(t,{at:h.selection,focus:!0})}}),[w.onPaste,h.readOnly]),_=u((e=>{var t;const n=[];if(h.readOnly)return n;const[o,r]=e,i=(null===(t=h.selection)||void 0===t?void 0:t[0])===g.meta.order;return b.selection&&i&&!S.isEditor(o)&&""===S.string(b,[r[0]])&&B.includes(b.selection,r)&&B.isCollapsed(b.selection)&&n.push(Object.assign(Object.assign({},b.selection),{withPlaceholder:!0})),n}),[h.readOnly,null===(p=h.selection)||void 0===p?void 0:p[0],g.meta.order]);return e(el,{id:t,slate:b,initialValue:v,onChange:x,decorate:_,renderLeaf:E,renderElement:k,eventHandlers:w,onKeyDown:C,onKeyUp:D,onFocus:R,onBlur:j,customEditor:n,readOnly:h.readOnly,onPaste:A})},el=p((({id:t,slate:n,initialValue:o,onChange:r,renderLeaf:i,renderElement:l,eventHandlers:c,onKeyDown:a,onKeyUp:s,onFocus:d,onBlur:u,onPaste:f,customEditor:p,decorate:h,readOnly:g})=>"function"==typeof p?p({blockId:t}):e(k,Object.assign({editor:n,initialValue:o,onChange:r},{children:e(E,Object.assign({renderElement:l,renderLeaf:i,className:"yoopta-slate",spellCheck:!0},c,{onKeyDown:a,onKeyUp:s,onFocus:d,decorate:h,onBlur:u,readOnly:g,onPaste:f}),`editable-${t}`)}),`slate-${t}`)));el.displayName="SlateEditorInstance";const tl=({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])}(Ne(Ot,{activationConstraint:{distance:20}}),Ne(bt,{coordinateGetter:jn})),handleDragEnd:u((t=>{const{active:n,over:o}=t;if(n&&o&&n.id!==o.id){const t=e.children[o.id].meta.order;e.moveBlock(n.id,[t])}}),[]),handleDragStart:u((t=>{e.setBlockSelected(null)}),[])}),nl=[],ol=({editor:t,marks:o,placeholder:r})=>{const i=V(),{sensors:l,handleDragEnd:c,handleDragStart:a}=tl({editor:t}),s=Object.keys(t.children),u=d((()=>0===s.length?nl: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],l=t.children[i],c=t.plugins[l.type];l&&c?f.push(e(ki,Object.assign({block:l,blockId:i},{children:e(Qi,{type:l.type,id:i,marks:o,customEditor:c.customEditor,events:c.events,elements:c.elements,options:c.options,extensions:c.extensions,placeholder:r},i)}),i)):console.error(`Plugin ${l.type} not found`)}return i?e(n,{children:f}):e(nn,Object.assign({id:"yoopta-dnd-context",sensors:l,collisionDetection:$e,onDragStart:a,onDragEnd:c},{children:e(yn,Object.assign({disabled:i,items:u,strategy:gn},{children:f}))}))},rl=({editor:e,root:t})=>{const[n,o]=f({origin:[0,0],coords:[0,0],selection:!1}),r=r=>{var i;if(e.readOnly||!1===t)return;const l=null===(i=e.refElement)||void 0===i?void 0:i.contains(r.target);if(!l&&!n.selection&&Array.isArray(e.selectedBlocks)&&e.selectedBlocks.length>0)return e.setBlockSelected(null),c();l||o({origin:[r.pageX,r.pageY-window.pageYOffset],coords:[r.pageX,r.pageY-window.pageYOffset],selection:!0})},i=r=>{if(!n.selection||e.readOnly||!1===t)return;o((e=>Object.assign(Object.assign({},e),{coords:[r.pageX,r.pageY-window.pageYOffset]})));const i=((e,t,n)=>{var o;const r=[],i=null===(o=e.refElement)||void 0===o?void 0:o.querySelectorAll("[data-yoopta-block]");return i?(i.forEach(((e,o)=>{if(!e)return;const i=e.getBoundingClientRect(),l=Math.min(t[1],n[1]),c=Math.min(t[0],n[0]),a=Math.max(t[1],n[1]),s=Math.max(t[0],n[0]);l<i.bottom&&a>i.top&&c<i.right&&s>i.left&&r.push(o)})),r):r})(e,n.origin,[r.pageX,r.pageY-window.pageYOffset]);e.setBlockSelected(i,{only:!0})},l=()=>{e.readOnly||c()};s((()=>{var n;if(e.readOnly||!1===t)return;const o=t&&"current"in t?t.current:t||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===(n=e.refElement)||void 0===n?void 0:n.contains(o))throw new Error("Root element should not be a child of the editor. Please check the `selectionBoxRoot` prop");return o.addEventListener("mousedown",r),o.addEventListener("mousemove",i),o.addEventListener("mouseup",l),()=>{o.removeEventListener("mousedown",r),o.removeEventListener("mousemove",i),o.removeEventListener("mouseup",l)}}),[e.selectedBlocks,n,t,e.readOnly]);const c=()=>{o({origin:[0,0],coords:[0,0],selection:!1})};return Object.assign(Object.assign({},n),{onClose:c})},il=({origin:t,coords:n,isOpen:o})=>{if(!o)return null;const r={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:r})};var ll=Symbol.for("immer-nothing"),cl=Symbol.for("immer-draftable"),al=Symbol.for("immer-state");function sl(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var dl=Object.getPrototypeOf;function ul(e){return!!e&&!!e[al]}function fl(e){return!!e&&(hl(e)||Array.isArray(e)||!!e[cl]||!!e.constructor?.[cl]||bl(e)||wl(e))}var pl=Object.prototype.constructor.toString();function hl(e){if(!e||"object"!=typeof e)return!1;const t=dl(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)===pl}function gl(e,t){0===vl(e)?Reflect.ownKeys(e).forEach((n=>{t(n,e[n],e)})):e.forEach(((n,o)=>t(o,n,e)))}function vl(e){const t=e[al];return t?t.type_:Array.isArray(e)?1:bl(e)?2:wl(e)?3:0}function ml(e,t){return 2===vl(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function yl(e,t,n){const o=vl(e);2===o?e.set(t,n):3===o?e.add(n):e[t]=n}function bl(e){return e instanceof Map}function wl(e){return e instanceof Set}function xl(e){return e.copy_||e.base_}function kl(e,t){if(bl(e))return new Map(e);if(wl(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);if(!t&&hl(e)){if(!dl(e)){const t=Object.create(null);return Object.assign(t,e)}return{...e}}const n=Object.getOwnPropertyDescriptors(e);delete n[al];let o=Reflect.ownKeys(n);for(let t=0;t<o.length;t++){const r=o[t],i=n[r];!1===i.writable&&(i.writable=!0,i.configurable=!0),(i.get||i.set)&&(n[r]={configurable:!0,writable:!0,enumerable:i.enumerable,value:e[r]})}return Object.create(dl(e),n)}function El(e,t=!1){return Cl(e)||ul(e)||!fl(e)||(vl(e)>1&&(e.set=e.add=e.clear=e.delete=Ol),Object.freeze(e),t&&Object.entries(e).forEach((([e,t])=>El(t,!0)))),e}function Ol(){sl(2)}function Cl(e){return Object.isFrozen(e)}var Sl,Dl={};function jl(e){const t=Dl[e];return t||sl(0),t}function Bl(){return Sl}function Rl(e,t){t&&(jl("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Al(e){_l(e),e.drafts_.forEach(Tl),e.drafts_=null}function _l(e){e===Sl&&(Sl=e.parent_)}function Nl(e){return Sl={drafts_:[],parent_:Sl,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Tl(e){const t=e[al];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function Ml(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return void 0!==e&&e!==n?(n[al].modified_&&(Al(t),sl(4)),fl(e)&&(e=Ll(t,e),t.parent_||Il(t,e)),t.patches_&&jl("Patches").generateReplacementPatches_(n[al].base_,e,t.patches_,t.inversePatches_)):e=Ll(t,n,[]),Al(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==ll?e:void 0}function Ll(e,t,n){if(Cl(t))return t;const o=t[al];if(!o)return gl(t,((r,i)=>Pl(e,o,t,r,i,n))),t;if(o.scope_!==e)return t;if(!o.modified_)return Il(e,o.base_,!0),o.base_;if(!o.finalized_){o.finalized_=!0,o.scope_.unfinalizedDrafts_--;const t=o.copy_;let r=t,i=!1;3===o.type_&&(r=new Set(t),t.clear(),i=!0),gl(r,((r,l)=>Pl(e,o,t,r,l,n,i))),Il(e,t,!1),n&&e.patches_&&jl("Patches").generatePatches_(o,n,e.patches_,e.inversePatches_)}return o.copy_}function Pl(e,t,n,o,r,i,l){if(ul(r)){const l=Ll(e,r,i&&t&&3!==t.type_&&!ml(t.assigned_,o)?i.concat(o):void 0);if(yl(n,o,l),!ul(l))return;e.canAutoFreeze_=!1}else l&&n.add(r);if(fl(r)&&!Cl(r)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;Ll(e,r),t&&t.scope_.parent_||"symbol"==typeof o||!Object.prototype.propertyIsEnumerable.call(n,o)||Il(e,r)}}function Il(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&El(t,n)}var zl={get(e,t){if(t===al)return e;const n=xl(e);if(!ml(n,t))return function(e,t,n){const o=Hl(t,n);return o?"value"in o?o.value:o.get?.call(e.draft_):void 0}(e,n,t);const o=n[t];return e.finalized_||!fl(o)?o:o===$l(e.base_,t)?(Vl(e),e.copy_[t]=Kl(o,e)):o},has:(e,t)=>t in xl(e),ownKeys:e=>Reflect.ownKeys(xl(e)),set(e,t,n){const o=Hl(xl(e),t);if(o?.set)return o.set.call(e.draft_,n),!0;if(!e.modified_){const o=$l(xl(e),t),l=o?.[al];if(l&&l.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(((r=n)===(i=o)?0!==r||1/r==1/i:r!=r&&i!=i)&&(void 0!==n||ml(e.base_,t)))return!0;Vl(e),Ul(e)}var r,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!==$l(e.base_,t)||t in e.base_?(e.assigned_[t]=!1,Vl(e),Ul(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0),getOwnPropertyDescriptor(e,t){const n=xl(e),o=Reflect.getOwnPropertyDescriptor(n,t);return o?{writable:!0,configurable:1!==e.type_||"length"!==t,enumerable:o.enumerable,value:n[t]}:o},defineProperty(){sl(11)},getPrototypeOf:e=>dl(e.base_),setPrototypeOf(){sl(12)}},Fl={};function $l(e,t){const n=e[al];return(n?xl(n):e)[t]}function Hl(e,t){if(!(t in e))return;let n=dl(e);for(;n;){const e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=dl(n)}}function Ul(e){e.modified_||(e.modified_=!0,e.parent_&&Ul(e.parent_))}function Vl(e){e.copy_||(e.copy_=kl(e.base_,e.scope_.immer_.useStrictShallowCopy_))}gl(zl,((e,t)=>{Fl[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),Fl.deleteProperty=function(e,t){return Fl.set.call(this,e,t,void 0)},Fl.set=function(e,t,n){return zl.set.call(this,e[0],t,n,e[0])};function Kl(e,t){const n=bl(e)?jl("MapSet").proxyMap_(e,t):wl(e)?jl("MapSet").proxySet_(e,t):function(e,t){const n=Array.isArray(e),o={type_:n?1:0,scope_:t?t.scope_:Bl(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let r=o,i=zl;n&&(r=[o],i=Fl);const{revoke:l,proxy:c}=Proxy.revocable(r,i);return o.draft_=c,o.revoke_=l,c}(e,t);return(t?t.scope_:Bl()).drafts_.push(n),n}function Wl(e){if(!fl(e)||Cl(e))return e;const t=e[al];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=kl(e,t.scope_.immer_.useStrictShallowCopy_)}else n=kl(e,!0);return gl(n,((e,t)=>{yl(n,e,Wl(t))})),t&&(t.finalized_=!1),n}var Yl=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 o=this;return function(e=n,...r){return o.produce(e,(e=>t.call(this,e,...r)))}}let o;if("function"!=typeof t&&sl(6),void 0!==n&&"function"!=typeof n&&sl(7),fl(e)){const r=Nl(this),i=Kl(e,void 0);let l=!0;try{o=t(i),l=!1}finally{l?Al(r):_l(r)}return Rl(r,n),Ml(o,r)}if(!e||"object"!=typeof e){if(o=t(e),void 0===o&&(o=e),o===ll&&(o=void 0),this.autoFreeze_&&El(o,!0),n){const t=[],r=[];jl("Patches").generateReplacementPatches_(e,o,t,r),n(t,r)}return o}sl(1)},this.produceWithPatches=(e,t)=>{if("function"==typeof e)return(t,...n)=>this.produceWithPatches(t,(t=>e(t,...n)));let n,o;return[this.produce(e,t,((e,t)=>{n=e,o=t})),n,o]},"boolean"==typeof e?.autoFreeze&&this.setAutoFreeze(e.autoFreeze),"boolean"==typeof e?.useStrictShallowCopy&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){fl(e)||sl(8),ul(e)&&(e=function(e){ul(e)||sl(10);return Wl(e)}(e));const t=Nl(this),n=Kl(e,void 0);return n[al].isManual_=!0,_l(t),n}finishDraft(e,t){const n=e&&e[al];n&&n.isManual_||sl(9);const{scope_:o}=n;return Rl(o,t),Ml(void 0,o)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const o=t[n];if(0===o.path.length&&"replace"===o.op){e=o.value;break}}n>-1&&(t=t.slice(n+1));const o=jl("Patches").applyPatches_;return ul(e)?o(e,t):this.produce(e,(e=>o(e,t)))}};Yl.produce,Yl.produceWithPatches.bind(Yl),Yl.setAutoFreeze.bind(Yl),Yl.setUseStrictShallowCopy.bind(Yl),Yl.applyPatches.bind(Yl);var Xl=Yl.createDraft.bind(Yl),ql=Yl.finishDraft.bind(Yl);
|
|
6
|
+
var qo=["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(","),Zo="undefined"==typeof Element,Go=Zo?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Jo=!Zo&&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},Qo=function e(t,n){var o;void 0===n&&(n=!0);var r=null==t||null===(o=t.getAttribute)||void 0===o?void 0:o.call(t,"inert");return""===r||"true"===r||n&&t&&e(t.parentNode)},er=function e(t,n,o){for(var r=[],i=Array.from(t);i.length;){var l=i.shift();if(!Qo(l,!1))if("SLOT"===l.tagName){var c=l.assignedElements(),a=e(c.length?c:l.children,!0,o);o.flatten?r.push.apply(r,a):r.push({scopeParent:l,candidates:a})}else{Go.call(l,qo)&&o.filter(l)&&(n||!t.includes(l))&&r.push(l);var s=l.shadowRoot||"function"==typeof o.getShadowRoot&&o.getShadowRoot(l),d=!Qo(s,!1)&&(!o.shadowRootFilter||o.shadowRootFilter(l));if(s&&d){var u=e(!0===s?l.children:s.children,!0,o);o.flatten?r.push.apply(r,u):r.push({scopeParent:l,candidates:u})}else i.unshift.apply(i,l.children)}}return r},tr=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},nr=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))&&!tr(e)?0:e.tabIndex},or=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},rr=function(e){return"INPUT"===e.tagName},ir=function(e){return function(e){return rr(e)&&"radio"===e.type}(e)&&!function(e){if(!e.name)return!0;var t,n=e.form||Jo(e),o=function(e){return n.querySelectorAll('input[type="radio"][name="'+e+'"]')};if("undefined"!=typeof window&&void 0!==window.CSS&&"function"==typeof window.CSS.escape)t=o(window.CSS.escape(e.name));else try{t=o(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 r=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!r||r===e}(e)},lr=function(e){var t=e.getBoundingClientRect(),n=t.width,o=t.height;return 0===n&&0===o},cr=function(e,t){var n=t.displayCheck,o=t.getShadowRoot;if("hidden"===getComputedStyle(e).visibility)return!0;var r=Go.call(e,"details>summary:first-of-type")?e.parentElement:e;if(Go.call(r,"details:not([open]) *"))return!0;if(n&&"full"!==n&&"legacy-full"!==n){if("non-zero-area"===n)return lr(e)}else{if("function"==typeof o){for(var i=e;e;){var l=e.parentElement,c=Jo(e);if(l&&!l.shadowRoot&&!0===o(l))return lr(e);e=e.assignedSlot?e.assignedSlot:l||c===e.ownerDocument?l:c.host}e=i}if(function(e){var t,n,o,r,i=e&&Jo(e),l=null===(t=i)||void 0===t?void 0:t.host,c=!1;if(i&&i!==e)for(c=!!(null!==(n=l)&&void 0!==n&&null!==(o=n.ownerDocument)&&void 0!==o&&o.contains(l)||null!=e&&null!==(r=e.ownerDocument)&&void 0!==r&&r.contains(e));!c&&l;){var a,s,d;c=!(null===(s=l=null===(a=i=Jo(l))||void 0===a?void 0:a.host)||void 0===s||null===(d=s.ownerDocument)||void 0===d||!d.contains(l))}return c}(e))return!e.getClientRects().length;if("legacy-full"!==n)return!0}return!1},ar=function(e,t){return!(t.disabled||Qo(t)||function(e){return rr(e)&&"hidden"===e.type}(t)||cr(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 o=t.children.item(n);if("LEGEND"===o.tagName)return!!Go.call(t,"fieldset[disabled] *")||!o.contains(e)}return!0}t=t.parentElement}return!1}(t))},sr=function(e,t){return!(ir(t)||nr(t)<0||!ar(e,t))},dr=function(e){var t=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(t)||t>=0)},ur=function e(t){var n=[],o=[];return t.forEach((function(t,r){var i=!!t.scopeParent,l=i?t.scopeParent:t,c=function(e,t){var n=nr(e);return n<0&&t&&!tr(e)?0:n}(l,i),a=i?e(t.candidates):l;0===c?i?n.push.apply(n,a):n.push(l):o.push({documentOrder:r,tabIndex:c,item:t,isScope:i,content:a})})),o.sort(or).reduce((function(e,t){return t.isScope?e.push.apply(e,t.content):e.push(t.content),e}),[]).concat(n)},fr=function(e,t){var n;return n=(t=t||{}).getShadowRoot?er([e],t.includeContainer,{filter:sr.bind(null,t),flatten:!1,getShadowRoot:t.getShadowRoot,shadowRootFilter:dr}):function(e,t,n){if(Qo(e))return[];var o=Array.prototype.slice.apply(e.querySelectorAll(qo));return t&&Go.call(e,qo)&&o.unshift(e),o.filter(n)}(e,t.includeContainer,sr.bind(null,t)),ur(n)};const pr=o["useInsertionEffect".toString()]||(e=>e());var hr="undefined"!=typeof document?a:s;function gr(){return gr=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},gr.apply(this,arguments)}let vr=!1,mr=0;const yr=()=>"floating-ui-"+mr++;const br=o["useId".toString()]||function(){const[e,t]=o.useState((()=>vr?yr():void 0));return hr((()=>{null==e&&t(yr())}),[]),o.useEffect((()=>{vr||(vr=!0)}),[]),e};const wr=o.createContext(null),xr=o.createContext(null);function kr(e){return"data-floating-ui-"+e}function Er(e){const t=c(e);return hr((()=>{t.current=e})),t}const Or=()=>({getShadowRoot:!0,displayCheck:"function"==typeof ResizeObserver&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function Cr(e,t){const n=fr(e,Or());"prev"===t&&n.reverse();const o=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==(r=e)?void 0:r.ownerDocument)||document));var r;return n.slice(o+1)[0]}function Sr(e,t){const n=t||e.currentTarget,o=e.relatedTarget;return!o||!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&&Un(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}(n,o)}function Dr(e){fr(e,Or()).forEach((e=>{e.dataset.tabindex=e.getAttribute("tabindex")||"",e.setAttribute("tabindex","-1")}))}function jr(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 Br={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 Rr(e){"Tab"===e.key&&(e.target,clearTimeout(undefined))}const Ar=o.forwardRef((function(e,t){const[n,r]=o.useState();hr((()=>(/apple/i.test(navigator.vendor)&&r("button"),document.addEventListener("keydown",Rr),()=>{document.removeEventListener("keydown",Rr)})),[]);const i={ref:t,tabIndex:0,role:n,"aria-hidden":!n||void 0,[kr("focus-guard")]:"",style:Br};return o.createElement("span",gr({},e,i))})),_r=o.createContext(null),Nr=kr("portal");function Tr(e){let{children:t,id:n,root:r=null,preserveTabOrder:i=!0}=e;const l=function(e){let{id:t,root:n}=void 0===e?{}:e;const[r,i]=o.useState(null),l=br(),c=Mr(),a=o.useRef(null);return hr((()=>()=>{null==r||r.remove(),queueMicrotask((()=>{a.current=null}))}),[r]),hr((()=>{if(a.current)return;const e=t?document.getElementById(t):null;if(!e)return;const n=document.createElement("div");n.id=l,n.setAttribute(Nr,""),e.appendChild(n),a.current=n,i(n)}),[t,l]),hr((()=>{if(a.current)return;let e=n||(null==c?void 0:c.portalNode);e&&!$n(e)&&(e=e.current),e=e||document.body;let o=null;t&&(o=document.createElement("div"),o.id=t,e.appendChild(o));const r=document.createElement("div");r.id=l,r.setAttribute(Nr,""),e=o||e,e.appendChild(r),a.current=r,i(r)}),[t,n,l,c]),r}({id:n,root:r}),[c,a]=o.useState(null),s=o.useRef(null),d=o.useRef(null),u=o.useRef(null),f=o.useRef(null),p=!!c&&!c.modal&&c.open&&i&&!(!r&&!l);return o.useEffect((()=>{if(l&&i&&(null==c||!c.modal))return l.addEventListener("focusin",e,!0),l.addEventListener("focusout",e,!0),()=>{l.removeEventListener("focusin",e,!0),l.removeEventListener("focusout",e,!0)};function e(e){if(l&&Sr(e)){("focusin"===e.type?jr:Dr)(l)}}}),[l,i,null==c?void 0:c.modal]),o.createElement(_r.Provider,{value:o.useMemo((()=>({preserveTabOrder:i,beforeOutsideRef:s,afterOutsideRef:d,beforeInsideRef:u,afterInsideRef:f,portalNode:l,setFocusManagerState:a})),[i,l])},p&&l&&o.createElement(Ar,{"data-type":"outside",ref:s,onFocus:e=>{if(Sr(e,l)){var t;null==(t=u.current)||t.focus()}else{const e=Cr(document.body,"prev")||(null==c?void 0:c.refs.domReference.current);null==e||e.focus()}}}),p&&l&&o.createElement("span",{"aria-owns":l.id,style:Br}),l&&b(t,l),p&&l&&o.createElement(Ar,{"data-type":"outside",ref:d,onFocus:e=>{if(Sr(e,l)){var t;null==(t=f.current)||t.focus()}else{const t=Cr(document.body,"next")||(null==c?void 0:c.refs.domReference.current);null==t||t.focus(),(null==c?void 0:c.closeOnFocusOut)&&(null==c||c.onOpenChange(!1,e.nativeEvent))}}}))}const Mr=()=>o.useContext(_r),Lr=new Set,Pr=o.forwardRef((function(e,t){let{lockScroll:n=!1,...r}=e;const i=br();return hr((()=>{if(!n)return;Lr.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,o=Math.round(document.documentElement.getBoundingClientRect().left)+document.documentElement.scrollLeft?"paddingLeft":"paddingRight",r=window.innerWidth-document.documentElement.clientWidth,l=t.left?parseFloat(t.left):window.pageXOffset,c=t.top?parseFloat(t.top):window.pageYOffset;if(t.overflow="hidden",r&&(t[o]=r+"px"),e){var a,s;const e=(null==(a=window.visualViewport)?void 0:a.offsetLeft)||0,n=(null==(s=window.visualViewport)?void 0:s.offsetTop)||0;Object.assign(t,{position:"fixed",top:-(c-Math.floor(n))+"px",left:-(l-Math.floor(e))+"px",right:"0"})}return()=>{Lr.delete(i),0===Lr.size&&(Object.assign(t,{overflow:"",[o]:""}),e&&(Object.assign(t,{position:"",top:"",left:"",right:""}),window.scrollTo(l,c)))}}),[i,n]),o.createElement("div",gr({ref:t},r,{style:{position:"fixed",overflow:"auto",top:0,right:0,bottom:0,left:0,...r.style}}))}));function Ir(e){var t;void 0===e&&(e={});const{open:n=!1,onOpenChange:r,nodeId:i}=e;const[l,c]=o.useState(null),a=(null==(t=e.elements)?void 0:t.reference)||l,s=function(e){void 0===e&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:i,elements:{reference:l,floating:c}={},transform:a=!0,whileElementsMounted:s,open:d}=e,[u,f]=o.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,h]=o.useState(r);Ko(p,r)||h(r);const[g,v]=o.useState(null),[y,b]=o.useState(null),w=o.useCallback((e=>{e!==O.current&&(O.current=e,v(e))}),[]),x=o.useCallback((e=>{e!==C.current&&(C.current=e,b(e))}),[]),k=l||g,E=c||y,O=o.useRef(null),C=o.useRef(null),S=o.useRef(u),D=null!=s,j=Xo(s),B=Xo(i),R=o.useCallback((()=>{if(!O.current||!C.current)return;const e={placement:t,strategy:n,middleware:p};B.current&&(e.platform=B.current),Uo(O.current,C.current,e).then((e=>{const t={...e,isPositioned:!0};A.current&&!Ko(S.current,t)&&(S.current=t,m.flushSync((()=>{f(t)})))}))}),[p,t,n,B]);Vo((()=>{!1===d&&S.current.isPositioned&&(S.current.isPositioned=!1,f((e=>({...e,isPositioned:!1}))))}),[d]);const A=o.useRef(!1);Vo((()=>(A.current=!0,()=>{A.current=!1})),[]),Vo((()=>{if(k&&(O.current=k),E&&(C.current=E),k&&E){if(j.current)return j.current(k,E,R);R()}}),[k,E,R,j,D]);const _=o.useMemo((()=>({reference:O,floating:C,setReference:w,setFloating:x})),[w,x]),N=o.useMemo((()=>({reference:k,floating:E})),[k,E]),T=o.useMemo((()=>{const e={position:n,left:0,top:0};if(!N.floating)return e;const t=Yo(N.floating,u.x),o=Yo(N.floating,u.y);return a?{...e,transform:"translate("+t+"px, "+o+"px)",...Wo(N.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:t,top:o}}),[n,a,N.floating,u.x,u.y]);return o.useMemo((()=>({...u,update:R,refs:_,elements:N,floatingStyles:T})),[u,R,_,N,T])}(e),d=o.useContext(xr),u=null!=((null==(f=o.useContext(wr))?void 0:f.id)||null);var f;const p=function(e){const t=o.useRef((()=>{}));return pr((()=>{t.current=e})),o.useCallback((function(){for(var e=arguments.length,n=new Array(e),o=0;o<e;o++)n[o]=arguments[o];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==r||r(e,t,n)})),h=o.useRef(null),g=o.useRef({}),v=o.useState((()=>function(){const e=new Map;return{emit(t,n){var o;null==(o=e.get(t))||o.forEach((e=>e(n)))},on(t,n){e.set(t,[...e.get(t)||[],n])},off(t,n){var o;e.set(t,(null==(o=e.get(t))?void 0:o.filter((e=>e!==n)))||[])}}}()))[0],y=br(),b=o.useCallback((e=>{const t=$n(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),contextElement:e}:e;s.refs.setReference(t)}),[s.refs]),w=o.useCallback((e=>{($n(e)||null===e)&&(h.current=e,c(e)),($n(s.refs.reference.current)||null===s.refs.reference.current||null!==e&&!$n(e))&&s.refs.setReference(e)}),[s.refs]),x=o.useMemo((()=>({...s.refs,setReference:w,setPositionReference:b,domReference:h})),[s.refs,w,b]),k=o.useMemo((()=>({...s.elements,domReference:a})),[s.elements,a]),E=o.useMemo((()=>({...s,refs:x,elements:k,dataRef:g,nodeId:i,floatingId:y,events:v,open:n,onOpenChange:p})),[s,i,y,v,n,p,x,k]);return hr((()=>{const e=null==d?void 0:d.nodesRef.current.find((e=>e.id===i));e&&(e.context=E)})),o.useMemo((()=>({...s,context:E,refs:x,elements:k})),[s,x,k,E])}const zr=e=>e.replace(/[A-Z]+(?![a-z])|[A-Z]/g,((e,t)=>(t?"-":"")+e.toLowerCase()));function Fr(e,t){return"function"==typeof e?e(t):e}function $r(e,t){void 0===t&&(t={});const{open:n,elements:{floating:r}}=e,{duration:i=250}=t,l=("number"==typeof i?i:i.close)||0,[c,a]=o.useState(!1),[s,d]=o.useState("unmounted"),u=function(e,t){const[n,r]=o.useState(e);return e&&!n&&r(!0),o.useEffect((()=>{if(!e){const e=setTimeout((()=>r(!1)),t);return()=>clearTimeout(e)}}),[e,t]),n}(n,l);return hr((()=>{c&&!u&&d("unmounted")}),[c,u]),hr((()=>{if(r){if(n){d("initial");const e=requestAnimationFrame((()=>{d("open")}));return()=>{cancelAnimationFrame(e)}}a(!0),d("close")}}),[n,r]),{isMounted:u,status:s}}function Hr(e,t){void 0===t&&(t={});const{initial:n={opacity:0},open:r,close:i,common:l,duration:c=250}=t,a=e.placement,s=a.split("-")[0],d=o.useMemo((()=>({side:s,placement:a})),[s,a]),u="number"==typeof c,f=(u?c:c.open)||0,p=(u?c:c.close)||0,[h,g]=o.useState((()=>({...Fr(l,d),...Fr(n,d)}))),{isMounted:v,status:m}=$r(e,{duration:c}),y=Er(n),b=Er(r),w=Er(i),x=Er(l);return hr((()=>{const e=Fr(y.current,d),t=Fr(w.current,d),n=Fr(x.current,d),o=Fr(b.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(o).map(zr).join(","),transitionDuration:f+"ms",...n,...o}),"close"===m){const o=t||e;g({transitionProperty:Object.keys(o).map(zr).join(","),transitionDuration:p+"ms",...n,...o})}}),[p,w,y,b,x,f,m,d]),{isMounted:v,styles:h}}var Ur;function Vr(){return Vr=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},Vr.apply(this,arguments)}var Kr=function(e){return o.createElement("svg",Vr({viewBox:"0 0 16 16",className:"turn_svg__loop",style:{width:16,height:16,display:"block",fill:"currentcolor",flexShrink:0,backfaceVisibility:"hidden"}},e),Ur||(Ur=o.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 Wr(e,t){if(null==e)return{};var n,o,r={},i=Object.keys(e);for(o=0;o<i.length;o++)n=i[o],t.indexOf(n)>=0||(r[n]=e[n]);return r}var Yr=["color"],Xr=g((function(e,t){var n=e.color,o=void 0===n?"currentColor":n,r=Wr(e,Yr);return v("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},r,{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:o,fillRule:"evenodd",clipRule:"evenodd"}))})),qr=["color"],Zr=g((function(e,t){var n=e.color,o=void 0===n?"currentColor":n,r=Wr(e,qr);return v("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},r,{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:o,fillRule:"evenodd",clipRule:"evenodd"}))})),Gr=["color"],Jr=g((function(e,t){var n=e.color,o=void 0===n?"currentColor":n,r=Wr(e,Gr);return v("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},r,{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:o,fillRule:"evenodd",clipRule:"evenodd"}))})),Qr=["color"],ei=g((function(e,t){var n=e.color,o=void 0===n?"currentColor":n,r=Wr(e,Qr);return v("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},r,{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:o,fillRule:"evenodd",clipRule:"evenodd"}))})),ti=function(){var e=document.getSelection();if(!e.rangeCount)return function(){};for(var t=document.activeElement,n=[],o=0;o<e.rangeCount;o++)n.push(e.getRangeAt(o));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()}},ni={"text/plain":"Text","text/html":"Url",default:"Text"};var oi=function(e,t){var n,o,r,i,l,c,a=!1;t||(t={}),n=t.debug||!1;try{if(r=ti(),i=document.createRange(),l=document.getSelection(),(c=document.createElement("span")).textContent=e,c.ariaHidden="true",c.style.all="unset",c.style.position="fixed",c.style.top=0,c.style.clip="rect(0, 0, 0, 0)",c.style.whiteSpace="pre",c.style.webkitUserSelect="text",c.style.MozUserSelect="text",c.style.msUserSelect="text",c.style.userSelect="text",c.addEventListener("copy",(function(o){if(o.stopPropagation(),t.format)if(o.preventDefault(),void 0===o.clipboardData){n&&console.warn("unable to use e.clipboardData"),n&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var r=ni[t.format]||ni.default;window.clipboardData.setData(r,e)}else o.clipboardData.clearData(),o.clipboardData.setData(t.format,e);t.onCopy&&(o.preventDefault(),t.onCopy(o.clipboardData))})),document.body.appendChild(c),i.selectNodeContents(c),l.addRange(i),!document.execCommand("copy"))throw new Error("copy command was unsuccessful");a=!0}catch(r){n&&console.error("unable to copy using execCommand: ",r),n&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(t.format||"text",e),t.onCopy&&t.onCopy(window.clipboardData),a=!0}catch(r){n&&console.error("unable to copy using clipboardData: ",r),n&&console.error("falling back to prompt"),o=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(o,e)}}finally{l&&("function"==typeof l.removeRange?l.removeRange(i):l.removeAllRanges()),c&&document.body.removeChild(c),r()}return a};function ri(e){if(!e)return;const t=Object.keys(e);return 1===t.length?t[0]:t.find((t=>e[t].asRoot))}function ii(e){if(!e)return;const t=ri(e);return t?e[t]:void 0}function li(e,t,n){var o;return(null===(o=e.children)||void 0===o?void 0:o.map((e=>{const o=t[e];if(!o)throw new Error(`Element definition for ${e} not found`);return J({id:G(),type:e,props:o.props,children:o.children&&o.children.length>0?li(o,t,n):[{text:(null==n?void 0:n[e])||""}]})})))||[]}function ci(e,t,n){e.plugins[t];const o=e.blocks[t].elements,r=ri(o);if(!r)throw new Error(`Root element type not found for block type ${t}`);const i=o[r];return{id:G(),type:r,props:i.props,children:i.children&&i.children.length>0?li(i,o,n):[{text:""}]}}const ai=i(void 0),si=({children:o,tools:r})=>{const i=V(),l=d((()=>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]),c=d((()=>!r||i?null:Object.keys(r).map((t=>{var n,o,i;const l=null===(n=null==r?void 0:r[t])||void 0===n?void 0:n.tool,c=null===(o=null==r?void 0:r[t])||void 0===o?void 0:o.render,a=null===(i=null==r?void 0:r[t])||void 0===i?void 0:i.props;return l?e(l,Object.assign({render:c},a),t):null}))),[r]);return e(ai.Provider,Object.assign({value:l},{children:t(n,{children:[c,o]})}))},di=()=>{const e=l(ai);if(void 0===e)throw new Error("useYooptaTools must be used within a ToolsProvider");return e};function ui({editor:e,view:t,onClose:n,mode:o="toggle"}){return{actions:(()=>{let t=Object.keys(e.blocks);return"toggle"===o&&(t=t.filter((t=>function(e,t){var n;const o=e.blocks[t];if(!o)return!1;const r=ii(o.elements);return"void"!==(null===(n=null==r?void 0:r.props)||void 0===n?void 0:n.nodeType)}(e,t)))),t.map((t=>{var n,o,r,i,l,c;return{type:t,title:(null===(o=null===(n=e.blocks[t].options)||void 0===n?void 0:n.display)||void 0===o?void 0:o.title)||t,description:null===(i=null===(r=e.blocks[t].options)||void 0===r?void 0:r.display)||void 0===i?void 0:i.description,icon:null===(c=null===(l=e.blocks[t].options)||void 0===l?void 0:l.display)||void 0===c?void 0:c.icon}}))})(),onClose:n,empty:!1,getItemProps:t=>({onMouseEnter:()=>{},"data-action-menu-item":!0,"data-action-menu-item-type":t,"aria-selected":!1,onClick:()=>{"toggle"===o&&e.blocks[t].toggle({focus:!0}),"create"===o&&e.blocks[t].create({deleteText:!0,focus:!0}),n()}}),getRootProps:()=>({"data-action-menu-list":!0}),editor:e,view:t}}function fi(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(o=Object.getOwnPropertySymbols(e);r<o.length;r++)t.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(n[o[r]]=e[o[r]])}return n}"function"==typeof SuppressedError&&SuppressedError;const pi=t=>{var{className:n,children:o,lockScroll:r=!0}=t,i=fi(t,["className","children","lockScroll"]);return e(Pr,Object.assign({lockScroll:r,className:n},i,{onClick:e=>{var t;e.stopPropagation(),null===(t=i.onClick)||void 0===t||t.call(i,e)},onMouseDown:e=>{var t;e.stopPropagation(),null===(t=i.onMouseDown)||void 0===t||t.call(i,e)}},{children:o}))},hi=t=>{const[n,o]=f(!1),r=c(null),i=$();return s((()=>{o(!0);const e=i.refElement;if(!e)return;return e.querySelector(".yoopta-overlays")||(r.current=document.createElement("div"),r.current.className="yoopta-overlays",e.appendChild(r.current)),()=>{r.current&&r.current.remove()}}),[]),n?e(Tr,Object.assign({id:`${t.id}-${i.id}`,root:r.current||i.refElement},{children:t.children})):null},gi=({children:t})=>e("div",Object.assign({className:"yoopta-block-options-group"},{children:t})),vi=({children:t})=>e("div",Object.assign({onClick:e=>e.stopPropagation(),className:"yoopta-block-options-menu-content data-[state=open]:yoo-editor-animate-in data-[state=closed]:yoo-editor-animate-out data-[state=closed]:yoo-editor-fade-out-0 data-[state=open]:yoo-editor-fade-in-0 data-[state=closed]:yoo-editor-zoom-out-95 data-[state=open]:yoo-editor-zoom-in-95 data-[side=bottom]:yoo-editor-slide-in-from-top-2 data-[side=left]:yoo-editor-slide-in-from-right-2 data-[side=right]:yoo-editor-slide-in-from-left-2 data-[side=top]:yoo-editor-slide-in-from-bottom-2"},{children:t})),mi=({children:t})=>e("div",Object.assign({className:"yoopta-block-options-item"},{children:t})),yi=["delete","duplicate","turnInto","copy"],bi=({isOpen:n,onClose:o,refs:r,style:i,actions:l=yi,children:c})=>{var a,s,d;const u=$(),p=di(),[h,g]=f(!1),{refs:v,floatingStyles:m,context:y}=Ir({placement:"right",open:h,onOpenChange:g,middleware:[Ho(),$o(),Fo(),Eo(10)],whileElementsMounted:zo}),{isMounted:b,styles:w}=Hr(y,{duration:100});if(!n)return null;const x=P(u,{at:u.selection}),k=ii(null===(a=u.blocks[(null==x?void 0:x.type)||""])||void 0===a?void 0:a.elements),E="void"===(null===(s=null==k?void 0:k.props)||void 0===s?void 0:s.nodeType),O=p.ActionMenu,C=Object.assign(Object.assign({},m),w),S=ui({editor:u,view:"small",onClose:()=>{g(!1),o()}});return e(hi,Object.assign({id:"yoo-block-options-portal"},{children:e(pi,Object.assign({lockScroll:!0,className:"yoo-editor-z-[100]",onClick:o},{children:e("div",Object.assign({style:i,ref:r.setFloating,contentEditable:!1},{children:t(vi,{children:[null!==l&&t(gi,{children:[e(mi,{children:t("button",Object.assign({type:"button",className:"yoopta-block-options-button",onClick:()=>{const e=u.selection;u.deleteBlock({at:e}),u.setBlockSelected(null),u.setSelection(null),o()}},{children:[e(ei,{className:"yoo-editor-w-4 yoo-editor-h-4 yoo-editor-mr-2"}),"Delete"]}))}),e(mi,{children:t("button",Object.assign({type:"button",className:"yoopta-block-options-button",onClick:()=>{u.duplicateBlock({at:u.selection,focus:!0}),u.setBlockSelected(null),o()}},{children:[e(Xr,{className:"yoo-editor-w-4 yoo-editor-h-4 yoo-editor-mr-2"}),"Duplicate"]}))}),!!O&&!E&&!(null===(d=u.blocks[(null==x?void 0:x.type)||""])||void 0===d?void 0:d.hasCustomEditor)&&t(mi,{children:[b&&e(hi,Object.assign({id:"yoo-block-options-portal"},{children:e(pi,Object.assign({lockScroll:!0,className:"yoo-editor-z-[100]",onClick:()=>g(!1)},{children:e("div",Object.assign({style:C,ref:v.setFloating},{children:e(O,Object.assign({},S))}))}))})),t("button",Object.assign({type:"button",className:"yoopta-block-options-button",ref:v.setReference,onClick:()=>g((e=>!e))},{children:[e(Kr,{className:"yoo-editor-w-4 yoo-editor-h-4 yoo-editor-mr-2"}),"Turn into"]}))]}),e(mi,{children:t("button",Object.assign({type:"button",className:"yoopta-block-options-button",onClick:()=>{const e=P(u);e&&(oi(`${window.location.origin}${window.location.pathname}#${e.id}`),u.emit("block:copy",e)),o()}},{children:[e(Jr,{className:"yoo-editor-w-4 yoo-editor-h-4 yoo-editor-mr-2"}),"Copy link to block"]}))})]}),c]})}))}))}))};var wi=Object.freeze({__proto__:null,BlockOptions:bi,BlockOptionsMenuContent:vi,BlockOptionsMenuGroup:gi,BlockOptionsMenuItem:mi,BlockOptionsSeparator:({className:t=""})=>e("div",{className:`yoopta-block-options-separator ${t}`})});const xi=({block:n,editor:o,dragHandleProps:r,onChangeActiveBlock:i,showActions:l})=>{const[c,a]=f(!1),{isActionMenuOpen:s,actionMenuRefs:d,hasActionMenu:u,actionMenuStyles:p,onChangeActionMenuOpen:h,onCloseActionMenu:g,actionMenuRenderProps:v,ActionMenu:m}=(({editor:e})=>{const t=di().ActionMenu,[n,o]=f(!1),{refs:r,floatingStyles:i,context:l}=Ir({placement:"bottom-start",open:n,onOpenChange:o,middleware:[Ho(),$o(),Fo(),Eo(10)],whileElementsMounted:zo}),{isMounted:c,styles:a}=Hr(l,{duration:100}),s=Object.assign(Object.assign({},i),a),d=e=>o(e),u=()=>d(!1),p=ui({editor:e,view:"default",mode:"create",onClose:u});return{isActionMenuOpen:c,actionMenuStyles:s,actionMenuRefs:r,hasActionMenu:!!t,onChangeActionMenuOpen:d,actionMenuRenderProps:p,onCloseActionMenu:u,ActionMenu:t}})({editor:o}),{refs:y,floatingStyles:b,context:x}=Ir({placement:"right-start",open:c,onOpenChange:a,middleware:[Ho(),$o(),Fo(),Eo()]}),{isMounted:k,styles:E}=Hr(x,{duration:100}),{setActivatorNodeRef:O,attributes:C,listeners:j}=r,B=Object.assign(Object.assign({},b),E);return t("div",Object.assign({contentEditable:!1,"data-hovered-state-open":l,className:"yoopta-block-actions"},{children:[s&&u&&e(hi,Object.assign({id:"yoo-block-options-portal"},{children:e(pi,Object.assign({lockScroll:!0,className:"yoo-editor-z-[100]",onClick:g},{children:e("div",Object.assign({style:p,ref:d.setFloating},{children:e(m,Object.assign({},v))}))}))})),e("button",Object.assign({type:"button",onClick:()=>{var e;const t=Ln(o,{at:[n.meta.order]}),r=o.blocks[n.type];if(!t)return;const i=document.querySelector(`[data-yoopta-block-id="${n.id}"]`),l=ii(r.elements);let c;r.hasCustomEditor||(c=S.string(t,[0]));const a="string"==typeof c&&0===c.trim().length;if(u&&a&&"void"!==(null===(e=null==l?void 0:l.props)||void 0===e?void 0:e.nodeType))o.setSelection([n.meta.order]),o.focusBlock(n.id),d.setReference(i),h(!0);else{const e=Q({id:G()}),t=[n.meta.order+1];o.setSelection([n.meta.order]),o.insertBlock(e,{at:t,focus:!0}),u&&setTimeout((()=>{i&&d.setReference(i.nextSibling),h(!0)}),0)}},className:"yoopta-block-actions-plus"},{children:e(Mn,{})})),e("button",Object.assign({type:"button",className:"yoopta-block-actions-drag",ref:e=>{O(e),y.setReference(e)}},C,j,{onClick:e=>{e.stopPropagation(),i(n.id);const t=Ln(o,{at:[n.meta.order]});o.focusBlock(n.id),t&&setTimeout((()=>{o.blocks[n.type].hasCustomEditor||(w.blur(t),w.deselect(t),D.deselect(t)),o.setBlockSelected([n.meta.order],{only:!0}),o.setSelection([n.meta.order]),a(!0)}),10)},onMouseDown:e=>e.stopPropagation()},{children:e(Nn,{})})),e(bi,{isOpen:k,refs:y,style:B,onClose:()=>a(!1)})]}))},ki=({children:n,block:o,blockId:i})=>{var l;const c=$(),[a,s]=r.useState(null),{attributes:f,listeners:p,setNodeRef:h,setActivatorNodeRef:g,transform:v,transition:m,isOver:y,isDragging:b}=Cn({id:i,disabled:c.readOnly}),w=((e,t,n,o,r)=>d((()=>({container:{marginLeft:20*e.meta.depth+"px",transform:t?`translate3d(${t.x}px, ${t.y}px, 0)`:"none",transition:n,opacity:o?.7:1},content:r&&!o?{borderBottom:"2px solid #007aff"}:void 0})),[e.meta.depth,t,n,o,r]))(o,v,m,b,y),x=`yoopta-block yoopta-align-${o.meta.align||"left"}`,k=null===(l=c.selectedBlocks)||void 0===l?void 0:l.includes(o.meta.order),E=a===i,O=u((()=>{c.readOnly||s(i)}),[c.readOnly,i]),C=u((()=>{c.readOnly||s(null)}),[c.readOnly]),S=d((()=>({setActivatorNodeRef:g,attributes:f,listeners:p})),[o]);return t("div",Object.assign({ref:h,className:x,onMouseEnter:O,onMouseLeave:C,style:w.container,"data-hovered-block":E,"data-yoopta-block":!0,"data-yoopta-block-id":i,"data-yoopta-block-type":o.type},{children:[!c.readOnly&&e(xi,{block:o,editor:c,dragHandleProps:S,showActions:E,onChangeActiveBlock:s}),e("div",Object.assign({style:w.content},{children:n})),k&&!c.readOnly&&e("div",{className:"yoopta-selection-block"})]}))};var Ei={};Object.defineProperty(Ei,"__esModule",{value:!0});for(var Oi="undefined"!=typeof window&&/Mac|iPod|iPhone|iPad/.test(window.navigator.platform),Ci={alt:"altKey",control:"ctrlKey",meta:"metaKey",shift:"shiftKey"},Si={add:"+",break:"pause",cmd:"meta",command:"meta",ctl:"control",ctrl:"control",del:"delete",down:"arrowdown",esc:"escape",ins:"insert",left:"arrowleft",mod:Oi?"meta":"control",opt:"alt",option:"alt",return:"enter",right:"arrowright",space:" ",spacebar:" ",up:"arrowup",win:"meta",windows:"meta"},Di={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},ji=1;ji<20;ji++)Di["f"+ji]=111+ji;function Bi(e,t,n){t&&!("byKey"in t)&&(n=t,t=null),Array.isArray(e)||(e=[e]);var o=e.map((function(e){return Ri(e,t)})),r=function(e){return o.some((function(t){return Ai(t,e)}))};return null==n?r:r(n)}function Ri(e,t){var n=t&&t.byKey,o={},r=(e=e.replace("++","+add")).split("+"),i=r.length;for(var l in Ci)o[Ci[l]]=!1;var c=!0,a=!1,s=void 0;try{for(var d,u=r[Symbol.iterator]();!(c=(d=u.next()).done);c=!0){var f=d.value,p=f.endsWith("?")&&f.length>1;p&&(f=f.slice(0,-1));var h=Ni(f),g=Ci[h];if(f.length>1&&!g&&!Si[f]&&!Di[h])throw new TypeError('Unknown modifier: "'+f+'"');1!==i&&g||(n?o.key=h:o.which=_i(f)),g&&(o[g]=!p||null)}}catch(e){a=!0,s=e}finally{try{!c&&u.return&&u.return()}finally{if(a)throw s}}return o}function Ai(e,t){for(var n in e){var o=e[n],r=void 0;if(null!=o&&((null!=(r="key"===n&&null!=t.key?t.key.toLowerCase():"which"===n?91===o&&93===t.which?91:t.which:t[n])||!1!==o)&&r!==o))return!1}return!0}function _i(e){return e=Ni(e),Di[e]||e.toUpperCase().charCodeAt(0)}function Ni(e){return e=e.toLowerCase(),e=Si[e]||e}Ei.default=Bi,Ei.isHotkey=Bi,Ei.isCodeHotkey=function(e,t){return Bi(e,t)};var Ti=Ei.isKeyHotkey=function(e,t){return Bi(e,{byKey:!0},t)};Ei.parseHotkey=Ri,Ei.compareHotkey=Ai,Ei.toKeyCode=_i,Ei.toKeyName=Ni;const Mi={bold:"mod+b",italic:"mod+i",compose:["down","left","right","up","backspace","enter"],arrowLeft:"left",arrowUp:"up",arrowDown:"down",arrowRight:"right",ctrlLeft:"ctrl+left",escape:"esc",ctrlRight:"ctrl+right",deleteBackward:"shift?+backspace",backspace:"backspace",deleteForward:"shift?+delete",extendBackward:"shift+left",shiftDelete:"shift+delete",extendForward:"shift+right",shiftEnter:"shift+enter",enter:"enter",space:"space",undo:"mod+z",select:"mod+a",shiftTab:"shift+tab",shiftArrowUp:"shift+up",shiftArrowDown:"shift+down",tab:"tab",cmd:"mod",cmdEnter:"mod+enter",cmdShiftEnter:"mod+shift+enter",slashCommand:"/",copy:"mod+c",cut:"mod+x",cmdShiftRight:"mod+shift+right",cmdShiftLeft:"mod+shift+left",cmdShiftDelete:"mod+shift+backspace",cmdShiftD:"mod+shift+d",cmdAltDelete:"mod+alt+backspace"},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"},Pi={deleteWordBackward:"ctrl+shift?+backspace",deleteWordForward:"ctrl+shift?+delete",redo:["ctrl+y","ctrl+shift+z"]},Ii=e=>{const t=Mi[e],n=Li[e],o=Pi[e],r=t&&Ti(t),i=n&&Ti(n),l=o&&Ti(o);return e=>!(!r||!r(e))||(!(!i||!i(e))||!(!l||!l(e)))},zi={isBold:Ii("bold"),isCompose:Ii("compose"),isArrowLeft:Ii("arrowLeft"),isArrowRight:Ii("arrowRight"),isArrowUp:Ii("arrowUp"),isArrowDown:Ii("arrowDown"),isDeleteBackward:Ii("deleteBackward"),isDeleteForward:Ii("deleteForward"),isDeleteLineBackward:Ii("deleteLineBackward"),isDeleteLineForward:Ii("deleteLineForward"),isDeleteWordBackward:Ii("deleteWordBackward"),isDeleteWordForward:Ii("deleteWordForward"),isExtendBackward:Ii("extendBackward"),isExtendForward:Ii("extendForward"),isExtendLineBackward:Ii("extendLineBackward"),isExtendLineForward:Ii("extendLineForward"),isItalic:Ii("italic"),isMoveLineBackward:Ii("moveLineBackward"),isMoveLineForward:Ii("moveLineForward"),isCtrlLeft:Ii("ctrlLeft"),isCtrlRight:Ii("ctrlRight"),isRedo:Ii("redo"),isShiftEnter:Ii("shiftEnter"),isEnter:Ii("enter"),isTransposeCharacter:Ii("transposeCharacter"),isUndo:Ii("undo"),isSpace:Ii("space"),isSelect:Ii("select"),isTab:Ii("tab"),isShiftTab:Ii("shiftTab"),isBackspace:Ii("backspace"),isCmdEnter:Ii("cmdEnter"),isCmd:Ii("cmd"),isEscape:Ii("escape"),isSlashCommand:Ii("slashCommand"),isShiftArrowUp:Ii("shiftArrowUp"),isShiftArrowDown:Ii("shiftArrowDown"),isCopy:Ii("copy"),isCut:Ii("cut"),isShiftDelete:Ii("shiftDelete"),isCmdShiftEnter:Ii("cmdShiftEnter"),isCmdShiftRight:Ii("cmdShiftRight"),isCmdShiftLeft:Ii("cmdShiftLeft"),isCmdShiftDelete:Ii("cmdShiftDelete"),isCmdAltDelete:Ii("cmdAltDelete"),isCmdShiftD:Ii("cmdShiftD")};const Fi={onKeyDown:function(e){return t=>{const n=Ln(e,{at:e.selection});if(!n||!n.selection)return;const o=j.parent(n.selection.anchor.path);if(zi.isShiftEnter(t)){if(t.isDefaultPrevented())return;return t.preventDefault(),void n.insertText("\n")}if(zi.isEnter(t)){if(t.isDefaultPrevented())return;t.preventDefault();const r=S.isStart(n,n.selection.anchor,o),i=S.isEnd(n,n.selection.anchor,o);if(!r&&!i)return void e.splitBlock({slate:n,focus:!0});const l=Q({id:G()}),c=e.selection?[e.selection[0]+1]:[0];e.insertBlock(l,{at:c,slate:n,focus:!0})}else if(zi.isBackspace(t)){if(t.isDefaultPrevented())return;const o=j.parent(n.selection.anchor.path);if(S.isStart(n,n.selection.anchor,o)){t.preventDefault();const r=S.string(n,o),i=e.selection?e.selection[0]-1:0,l=Ln(e,{at:[i]}),c=P(e,{at:[i]}),a=e.blocks[(null==c?void 0:c.type)||""];let s;if(l&&!a.hasCustomEditor&&(s=function(e,t){try{const[,n]=S.last(e,t);return{path:n,offset:S.string(e,n).length}}catch(e){return{path:[0,0],offset:0}}}(l,o)),0===r.trim().length)return e.deleteBlock({at:e.selection,focus:!0,focusAt:s});{if(B.isExpanded(n.selection))return D.delete(n,{at:n.selection});const t=e.selection?e.selection[0]-1:0,o=P(e,{at:[t]}),r=e.blocks[(null==o?void 0:o.type)||""];if(r&&r.hasCustomEditor)return;if(!l)return;if(0===S.string(l,[0,0]).length)return e.deleteBlock({at:[t],focus:!0,focusAt:s});const i=Array.from(S.nodes(n,{at:[0],match:e=>!S.isEditor(e)&&(R.isText(e)||S.isInline(n,e)),mode:"highest"})).map((([e])=>e));return D.insertNodes(l,i,{at:S.end(l,[])}),e.deleteBlock({at:e.selection,focus:!0,focusAt:s})}}}else{if(zi.isSelect(t)){if(t.isDefaultPrevented())return;const[,o]=S.first(n,[0]),[,r]=S.last(n,[n.children.length-1]),i=S.range(n,o,r),l=B.equals(n.selection,i),c=0===S.string(n,i).trim().length;if(B.isExpanded(n.selection)&&l||c)return t.preventDefault(),w.blur(n),w.deselect(n),D.deselect(n),void e.setBlockSelected([],{allSelected:!0})}if(zi.isShiftTab(t)){if(t.isDefaultPrevented())return;return t.preventDefault(),void e.decreaseBlockDepth()}if(zi.isTab(t)){if(t.isDefaultPrevented())return;return t.preventDefault(),void e.increaseBlockDepth()}if(zi.isArrowUp(t)){if(t.isDefaultPrevented())return;if(1===new Set(n.selection.anchor.path).size){const n=e.selection?[e.selection[0]-1]:null,o=Ln(e,{at:n}),r=P(e,{at:n});if(o&&r){const[,n]=S.last(o,[0]),i={path:n,offset:S.string(o,n).length};return t.preventDefault(),void e.focusBlock(r.id,{focusAt:i,waitExecution:!1,shouldUpdateBlockSelection:!0})}}}if(zi.isArrowDown(t)){if(t.isDefaultPrevented())return;const o=j.parent(n.selection.anchor.path);if(S.isEnd(n,n.selection.anchor,o)){const n=e.selection?[e.selection[0]+1]:null,r=Ln(e,{at:n}),i=P(e,{at:n});if(r&&i){const n=function(e,t){try{const[,n]=S.first(e,t);return{path:n,offset:0}}catch(e){return{path:[0,0],offset:0}}}(r,o);return t.preventDefault(),void e.focusBlock(i.id,{focusAt:n,waitExecution:!1})}}}if(B.isExpanded(n.selection)){if(Object.values(e.formats).length>0)for(const n of Object.values(e.formats))if(n.hotkey&&Ti(n.hotkey)(t)){t.preventDefault(),e.formats[n.type].toggle();break}}}}}},$i=({children:t,attributes:n,placeholder:o})=>{const r=x(),i=Object.assign({},n);return r&&o&&(i["data-placeholder"]=o,i.className="yoopta-placeholder"),e("span",Object.assign({},i,{children:t}))},Hi=new WeakMap;function Ui(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:"italic"}},Ki=["left","center","right",void 0];function Wi(e,t,n,o){var r,i;let l;if(t.parse){l=t.parse(n,e);if(A.isElement(l)&&"inline"===(null===(r=l.props)||void 0===r?void 0:r.nodeType))return l}const c=e.blocks[t.type],a=ri(c.elements)||"",s=c.elements[a],d="void"===(null===(i=s.props)||void 0===i?void 0:i.nodeType);let u={id:G(),type:a,children:d&&!c.hasCustomEditor?[{text:""}]:o.map(Xi).flat(),props:Object.assign({nodeType:"block"},s.props)};if(l)if(A.isElement(l))u=l;else if(Array.isArray(l)){return l}if(0===u.children.length&&(u.children=[{text:""}]),!l&&t.parse)return;const f=n.getAttribute("data-meta-align"),p=parseInt(n.getAttribute("data-meta-depth")||"0",10);return Q({id:G(),type:t.type,value:[u],meta:{order:0,depth:p,align:Ki.includes(f)?f:void 0}})}function Yi(e,t,n){var o;if(3===n.nodeType){return{text:null===(o=n.textContent)||void 0===o?void 0:o.replace(/[\t\n\r\f\v]+/g," ")}}if(1!==n.nodeType)return null;if("BR"===n.nodeName)return{text:"\n"};const r=n;let i=Array.from(r.childNodes).map((n=>Yi(e,t,n))).flat().filter(Boolean);if(Vi[r.nodeName]){const e=Vi[r.nodeName].type;return i.map((t=>"string"==typeof t?{[e]:!0,text:t}:t.text?Object.assign(Object.assign({},t),{[e]:!0}):t))}const l=t[r.nodeName];if(l){if(Array.isArray(l)){return l.map((t=>Wi(e,t,r,i))).filter(Boolean)}return Wi(e,l,r,i)}return i}function Xi(e){if("string"==typeof e)return{text:e};if(A.isElement(e))return e;if(Array.isArray(e))return e.map(Xi).flat();if(null==e?void 0:e.text)return e;if(Ui(e)){return e.value[0].children.map(Xi).flat()}return{text:""}}function qi(e,t){console.log("pasted html",t);const n=function(e){const t={};return Object.keys(e.plugins).forEach((n=>{const o=e.plugins[n],{parsers:r}=o;if(r){const{html:e}=r;if(e){const{deserialize:o}=e;if(o){const{nodeNames:e}=o;e&&e.forEach((e=>{const r=t[e];if(r){const i=Array.isArray(r)?r:[r];t[e]=[...i,{type:n,parse:o.parse}]}else t[e]={type:n,parse:o.parse}}))}}}})),t}(e);return Yi(e,n,t).flat().filter(Ui)}function Zi(e){return!!new RegExp("^(https?:\\/\\/)?((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|((\\d{1,3}\\.){3}\\d{1,3}))(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*(\\?[;&a-z\\d%_.~+=-]*)?(\\#[-a-z\\d_]*)?$","i").test(e)}const Gi=(e,t,n)=>{var o,r,i,l;(e=>{const[t]=S.nodes(e,{match:e=>!S.isEditor(e)&&A.isElement(e)&&"link"===e.type});return!!t})(t)&&(e=>{D.unwrapNodes(e,{match:e=>!S.isEditor(e)&&A.isElement(e)&&"link"===e.type})})(t);const{selection:c}=t,a=c&&B.isCollapsed(c),s=null===(l=null===(i=null===(r=null===(o=e.plugins)||void 0===o?void 0:o.LinkPlugin)||void 0===r?void 0:r.elements)||void 0===i?void 0:i.link)||void 0===l?void 0:l.props,d={type:"link",children:a?[{text:n}]:[],props:{url:n,target:(null==s?void 0:s.target)||"_self",rel:(null==s?void 0:s.rel)||"noopener noreferrer"}};a?D.insertNodes(t,d):(D.wrapNodes(t,d,{split:!0}),D.collapse(t,{edge:"end"}))},Ji=(e,t,n,o,r)=>d((()=>{let i=t.blockEditorsMap[e];const{normalizeNode:l,insertText:c,apply:a}=i,s=Object.keys(o);return s.forEach((e=>{var n;const r=null===(n=o[e].props)||void 0===n?void 0:n.nodeType,l="inline"===r,c="void"===r,a="inlineVoid"===r;a&&(i.markableVoid=t=>t.type===e),(c||a)&&(i.isVoid=t=>t.type===e),(l||a)&&(i.isInline=t=>t.type===e,i=((e,t)=>{const{insertData:n,insertText:o}=t;return t.insertText=n=>{n&&Zi(n)?Gi(e,t,n):o(n)},t.insertData=o=>{const r=o.getData("text/plain");r&&Zi(r)?Gi(e,t,r):n(o)},t})(t,i))})),i.insertText=e=>{Array.isArray(t.selectedBlocks)&&t.setBlockSelected(null),c(e)},i.apply=e=>{_.isSelectionOperation(e)&&Array.isArray(t.selectedBlocks)&&i.selection&&B.isExpanded(i.selection)&&t.setBlockSelected(null),a(e)},i.normalizeNode=e=>{const[o,r]=e,c=t.blocks[n.type].elements;if(Object.keys(c).length>1)return l(e);if(A.isElement(o)){const{type:e}=o,t=ri(c);if(!s.includes(e))return void D.setNodes(i,{type:t,props:Object.assign({},o.props)},{at:r});if(o.type===t)for(const[e,t]of N.children(i,r))if(A.isElement(e)&&!i.isInline(e))return void D.unwrapNodes(i,{at:t})}l(e)},r&&(i=r(i,t,e)),i}),[o,e,r]),Qi=({id:t,customEditor:n,elements:o,marks:r,events:i,options:l,extensions:a,placeholder:s="Type '/' for commands"})=>{var f,p;const h=$(),g=H(t);let v=c(g.value).current;const m=d((()=>(e=>{const t={};return Object.keys(e).forEach((n=>t[n]=e[n].render)),t})(o)),[o]),y=d((()=>(e=>{const t={};return e?(e.forEach((e=>t[e.type]=e)),t):t})(r)),[r]),b=Ji(t,h,g,o,a),w=((e,t,n,o)=>d((()=>{if(!e||t.readOnly)return{};const r=fi(e||{},["onBeforeCreate","onDestroy","onCreate"]),i={hotkeys:zi,currentBlock:n,defaultBlock:Q({id:G()})},l={};return Object.keys(r).forEach((e=>{l[e]=function(n){r[e]&&r[e](t,o,i)(n)}})),l}),[e,t,n]))(i,h,g,b),x=u((e=>{h.updateBlock(t,{value:e})}),[t,h]),k=u((n=>{const o=m[n.element.type],{attributes:r}=n,i=fi(n,["attributes"]);return r["data-element-type"]=i.element.type,o?e(o,Object.assign({},i,{attributes:r,blockId:t,HTMLAttributes:null==l?void 0:l.HTMLAttributes})):e(O,Object.assign({},i,{attributes:r}))}),[o,b.children]),E=u((t=>{var n,o,r,i,l;let{children:c,leaf:a,attributes:d}=t;const u=fi(a,["text"]),f=(null===(n=h.selection)||void 0===n?void 0:n[0])===g.meta.order;u&&Object.keys(u).forEach((e=>{const t=y[e];t&&(c=t.render({children:c,leaf:a}))}));const p=!("void"===(null===(l=null===(i=null===(r=null===(o=t.children)||void 0===o?void 0:o.props)||void 0===r?void 0:r.parent)||void 0===i?void 0:i.props)||void 0===l?void 0:l.nodeType))&&f&&a.withPlaceholder;return e($i,Object.assign({attributes:d,placeholder:p?s:void 0},{children:c}))}),[r]),C=u((e=>{var t;h.readOnly||(null===(t=w.onKeyDown)||void 0===t||t.call(w,e),Fi.onKeyDown(h)(e))}),[w.onKeyDown,h.readOnly,null===(f=h.selection)||void 0===f?void 0:f[0],g.meta.order]),D=u((e=>{var t;h.readOnly||null===(t=null==w?void 0:w.onKeyUp)||void 0===t||t.call(w,e)}),[w.onKeyUp,h.readOnly]),j=u((e=>{var t;h.readOnly||(e.preventDefault(),null===(t=null==w?void 0:w.onBlur)||void 0===t||t.call(w,e))}),[w.onBlur,h.readOnly]),R=u((e=>{var t;h.readOnly||(h.isFocused()||(Hi.set(h,!0),h.emit("focus",!0)),null===(t=null==w?void 0:w.onFocus)||void 0===t||t.call(w,e))}),[w.onFocus,h.readOnly]),A=u((e=>{var t;if(h.readOnly)return;null===(t=null==w?void 0:w.onPaste)||void 0===t||t.call(w,e);const n=e.clipboardData.getData("text/html"),o=(new DOMParser).parseFromString(n,"text/html");if(o.body.childNodes.length>0){const t=qi(h,o.body);if(t.length>0)return e.preventDefault(),void h.insertBlocks(t,{at:h.selection,focus:!0})}}),[w.onPaste,h.readOnly]),_=u((e=>{var t;const n=[];if(h.readOnly)return n;const[o,r]=e,i=(null===(t=h.selection)||void 0===t?void 0:t[0])===g.meta.order;return b.selection&&i&&!S.isEditor(o)&&""===S.string(b,[r[0]])&&B.includes(b.selection,r)&&B.isCollapsed(b.selection)&&n.push(Object.assign(Object.assign({},b.selection),{withPlaceholder:!0})),n}),[h.readOnly,null===(p=h.selection)||void 0===p?void 0:p[0],g.meta.order]);return e(el,{id:t,slate:b,initialValue:v,onChange:x,decorate:_,renderLeaf:E,renderElement:k,eventHandlers:w,onKeyDown:C,onKeyUp:D,onFocus:R,onBlur:j,customEditor:n,readOnly:h.readOnly,onPaste:A})},el=p((({id:t,slate:n,initialValue:o,onChange:r,renderLeaf:i,renderElement:l,eventHandlers:c,onKeyDown:a,onKeyUp:s,onFocus:d,onBlur:u,onPaste:f,customEditor:p,decorate:h,readOnly:g})=>"function"==typeof p?p({blockId:t}):e(k,Object.assign({editor:n,initialValue:o,onChange:r},{children:e(E,Object.assign({renderElement:l,renderLeaf:i,className:"yoopta-slate",spellCheck:!0},c,{onKeyDown:a,onKeyUp:s,onFocus:d,decorate:h,onBlur:u,readOnly:g,onPaste:f}),`editable-${t}`)}),`slate-${t}`)));el.displayName="SlateEditorInstance";const tl=({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])}(Ne(Ot,{activationConstraint:{distance:20}}),Ne(bt,{coordinateGetter:jn})),handleDragEnd:u((t=>{const{active:n,over:o}=t;if(n&&o&&n.id!==o.id){const t=e.children[o.id].meta.order;e.moveBlock(n.id,[t])}}),[]),handleDragStart:u((t=>{e.setBlockSelected(null)}),[])}),nl=[],ol=({editor:t,marks:o,placeholder:r})=>{const i=V(),{sensors:l,handleDragEnd:c,handleDragStart:a}=tl({editor:t}),s=Object.keys(t.children),u=d((()=>0===s.length?nl: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],l=t.children[i],c=t.plugins[l.type];l&&c?f.push(e(ki,Object.assign({block:l,blockId:i},{children:e(Qi,{type:l.type,id:i,marks:o,customEditor:c.customEditor,events:c.events,elements:c.elements,options:c.options,extensions:c.extensions,placeholder:r},i)}),i)):console.error(`Plugin ${l.type} not found`)}return i?e(n,{children:f}):e(nn,Object.assign({id:"yoopta-dnd-context",sensors:l,collisionDetection:$e,onDragStart:a,onDragEnd:c},{children:e(yn,Object.assign({disabled:i,items:u,strategy:gn},{children:f}))}))},rl=({editor:e,root:t})=>{const[n,o]=f({origin:[0,0],coords:[0,0],selection:!1}),r=r=>{var i;if(e.readOnly||!1===t)return;const l=null===(i=e.refElement)||void 0===i?void 0:i.contains(r.target);if(!l&&!n.selection&&Array.isArray(e.selectedBlocks)&&e.selectedBlocks.length>0)return e.setBlockSelected(null),c();l||o({origin:[r.pageX,r.pageY-window.pageYOffset],coords:[r.pageX,r.pageY-window.pageYOffset],selection:!0})},i=r=>{if(!n.selection||e.readOnly||!1===t)return;o((e=>Object.assign(Object.assign({},e),{coords:[r.pageX,r.pageY-window.pageYOffset]})));const i=((e,t,n)=>{var o;const r=[],i=null===(o=e.refElement)||void 0===o?void 0:o.querySelectorAll("[data-yoopta-block]");return i?(i.forEach(((e,o)=>{if(!e)return;const i=e.getBoundingClientRect(),l=Math.min(t[1],n[1]),c=Math.min(t[0],n[0]),a=Math.max(t[1],n[1]),s=Math.max(t[0],n[0]);l<i.bottom&&a>i.top&&c<i.right&&s>i.left&&r.push(o)})),r):r})(e,n.origin,[r.pageX,r.pageY-window.pageYOffset]);e.setBlockSelected(i,{only:!0})},l=()=>{e.readOnly||c()};s((()=>{var n;if(e.readOnly||!1===t)return;const o=t&&"current"in t?t.current:t||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===(n=e.refElement)||void 0===n?void 0:n.contains(o))throw new Error("Root element should not be a child of the editor. Please check the `selectionBoxRoot` prop");return o.addEventListener("mousedown",r),o.addEventListener("mousemove",i),o.addEventListener("mouseup",l),()=>{o.removeEventListener("mousedown",r),o.removeEventListener("mousemove",i),o.removeEventListener("mouseup",l)}}),[e.selectedBlocks,n,t,e.readOnly]);const c=()=>{o({origin:[0,0],coords:[0,0],selection:!1})};return Object.assign(Object.assign({},n),{onClose:c})},il=({origin:t,coords:n,isOpen:o})=>{if(!o)return null;const r={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:r})};var ll=Symbol.for("immer-nothing"),cl=Symbol.for("immer-draftable"),al=Symbol.for("immer-state");function sl(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var dl=Object.getPrototypeOf;function ul(e){return!!e&&!!e[al]}function fl(e){return!!e&&(hl(e)||Array.isArray(e)||!!e[cl]||!!e.constructor?.[cl]||bl(e)||wl(e))}var pl=Object.prototype.constructor.toString();function hl(e){if(!e||"object"!=typeof e)return!1;const t=dl(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)===pl}function gl(e,t){0===vl(e)?Reflect.ownKeys(e).forEach((n=>{t(n,e[n],e)})):e.forEach(((n,o)=>t(o,n,e)))}function vl(e){const t=e[al];return t?t.type_:Array.isArray(e)?1:bl(e)?2:wl(e)?3:0}function ml(e,t){return 2===vl(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function yl(e,t,n){const o=vl(e);2===o?e.set(t,n):3===o?e.add(n):e[t]=n}function bl(e){return e instanceof Map}function wl(e){return e instanceof Set}function xl(e){return e.copy_||e.base_}function kl(e,t){if(bl(e))return new Map(e);if(wl(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);if(!t&&hl(e)){if(!dl(e)){const t=Object.create(null);return Object.assign(t,e)}return{...e}}const n=Object.getOwnPropertyDescriptors(e);delete n[al];let o=Reflect.ownKeys(n);for(let t=0;t<o.length;t++){const r=o[t],i=n[r];!1===i.writable&&(i.writable=!0,i.configurable=!0),(i.get||i.set)&&(n[r]={configurable:!0,writable:!0,enumerable:i.enumerable,value:e[r]})}return Object.create(dl(e),n)}function El(e,t=!1){return Cl(e)||ul(e)||!fl(e)||(vl(e)>1&&(e.set=e.add=e.clear=e.delete=Ol),Object.freeze(e),t&&Object.entries(e).forEach((([e,t])=>El(t,!0)))),e}function Ol(){sl(2)}function Cl(e){return Object.isFrozen(e)}var Sl,Dl={};function jl(e){const t=Dl[e];return t||sl(0),t}function Bl(){return Sl}function Rl(e,t){t&&(jl("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Al(e){_l(e),e.drafts_.forEach(Tl),e.drafts_=null}function _l(e){e===Sl&&(Sl=e.parent_)}function Nl(e){return Sl={drafts_:[],parent_:Sl,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Tl(e){const t=e[al];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function Ml(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return void 0!==e&&e!==n?(n[al].modified_&&(Al(t),sl(4)),fl(e)&&(e=Ll(t,e),t.parent_||Il(t,e)),t.patches_&&jl("Patches").generateReplacementPatches_(n[al].base_,e,t.patches_,t.inversePatches_)):e=Ll(t,n,[]),Al(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==ll?e:void 0}function Ll(e,t,n){if(Cl(t))return t;const o=t[al];if(!o)return gl(t,((r,i)=>Pl(e,o,t,r,i,n))),t;if(o.scope_!==e)return t;if(!o.modified_)return Il(e,o.base_,!0),o.base_;if(!o.finalized_){o.finalized_=!0,o.scope_.unfinalizedDrafts_--;const t=o.copy_;let r=t,i=!1;3===o.type_&&(r=new Set(t),t.clear(),i=!0),gl(r,((r,l)=>Pl(e,o,t,r,l,n,i))),Il(e,t,!1),n&&e.patches_&&jl("Patches").generatePatches_(o,n,e.patches_,e.inversePatches_)}return o.copy_}function Pl(e,t,n,o,r,i,l){if(ul(r)){const l=Ll(e,r,i&&t&&3!==t.type_&&!ml(t.assigned_,o)?i.concat(o):void 0);if(yl(n,o,l),!ul(l))return;e.canAutoFreeze_=!1}else l&&n.add(r);if(fl(r)&&!Cl(r)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;Ll(e,r),t&&t.scope_.parent_||"symbol"==typeof o||!Object.prototype.propertyIsEnumerable.call(n,o)||Il(e,r)}}function Il(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&El(t,n)}var zl={get(e,t){if(t===al)return e;const n=xl(e);if(!ml(n,t))return function(e,t,n){const o=Hl(t,n);return o?"value"in o?o.value:o.get?.call(e.draft_):void 0}(e,n,t);const o=n[t];return e.finalized_||!fl(o)?o:o===$l(e.base_,t)?(Vl(e),e.copy_[t]=Kl(o,e)):o},has:(e,t)=>t in xl(e),ownKeys:e=>Reflect.ownKeys(xl(e)),set(e,t,n){const o=Hl(xl(e),t);if(o?.set)return o.set.call(e.draft_,n),!0;if(!e.modified_){const o=$l(xl(e),t),l=o?.[al];if(l&&l.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(((r=n)===(i=o)?0!==r||1/r==1/i:r!=r&&i!=i)&&(void 0!==n||ml(e.base_,t)))return!0;Vl(e),Ul(e)}var r,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!==$l(e.base_,t)||t in e.base_?(e.assigned_[t]=!1,Vl(e),Ul(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0),getOwnPropertyDescriptor(e,t){const n=xl(e),o=Reflect.getOwnPropertyDescriptor(n,t);return o?{writable:!0,configurable:1!==e.type_||"length"!==t,enumerable:o.enumerable,value:n[t]}:o},defineProperty(){sl(11)},getPrototypeOf:e=>dl(e.base_),setPrototypeOf(){sl(12)}},Fl={};function $l(e,t){const n=e[al];return(n?xl(n):e)[t]}function Hl(e,t){if(!(t in e))return;let n=dl(e);for(;n;){const e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=dl(n)}}function Ul(e){e.modified_||(e.modified_=!0,e.parent_&&Ul(e.parent_))}function Vl(e){e.copy_||(e.copy_=kl(e.base_,e.scope_.immer_.useStrictShallowCopy_))}gl(zl,((e,t)=>{Fl[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),Fl.deleteProperty=function(e,t){return Fl.set.call(this,e,t,void 0)},Fl.set=function(e,t,n){return zl.set.call(this,e[0],t,n,e[0])};function Kl(e,t){const n=bl(e)?jl("MapSet").proxyMap_(e,t):wl(e)?jl("MapSet").proxySet_(e,t):function(e,t){const n=Array.isArray(e),o={type_:n?1:0,scope_:t?t.scope_:Bl(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let r=o,i=zl;n&&(r=[o],i=Fl);const{revoke:l,proxy:c}=Proxy.revocable(r,i);return o.draft_=c,o.revoke_=l,c}(e,t);return(t?t.scope_:Bl()).drafts_.push(n),n}function Wl(e){if(!fl(e)||Cl(e))return e;const t=e[al];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=kl(e,t.scope_.immer_.useStrictShallowCopy_)}else n=kl(e,!0);return gl(n,((e,t)=>{yl(n,e,Wl(t))})),t&&(t.finalized_=!1),n}var Yl=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 o=this;return function(e=n,...r){return o.produce(e,(e=>t.call(this,e,...r)))}}let o;if("function"!=typeof t&&sl(6),void 0!==n&&"function"!=typeof n&&sl(7),fl(e)){const r=Nl(this),i=Kl(e,void 0);let l=!0;try{o=t(i),l=!1}finally{l?Al(r):_l(r)}return Rl(r,n),Ml(o,r)}if(!e||"object"!=typeof e){if(o=t(e),void 0===o&&(o=e),o===ll&&(o=void 0),this.autoFreeze_&&El(o,!0),n){const t=[],r=[];jl("Patches").generateReplacementPatches_(e,o,t,r),n(t,r)}return o}sl(1)},this.produceWithPatches=(e,t)=>{if("function"==typeof e)return(t,...n)=>this.produceWithPatches(t,(t=>e(t,...n)));let n,o;return[this.produce(e,t,((e,t)=>{n=e,o=t})),n,o]},"boolean"==typeof e?.autoFreeze&&this.setAutoFreeze(e.autoFreeze),"boolean"==typeof e?.useStrictShallowCopy&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){fl(e)||sl(8),ul(e)&&(e=function(e){ul(e)||sl(10);return Wl(e)}(e));const t=Nl(this),n=Kl(e,void 0);return n[al].isManual_=!0,_l(t),n}finishDraft(e,t){const n=e&&e[al];n&&n.isManual_||sl(9);const{scope_:o}=n;return Rl(o,t),Ml(void 0,o)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const o=t[n];if(0===o.path.length&&"replace"===o.op){e=o.value;break}}n>-1&&(t=t.slice(n+1));const o=jl("Patches").applyPatches_;return ul(e)?o(e,t):this.produce(e,(e=>o(e,t)))}};Yl.produce,Yl.produceWithPatches.bind(Yl),Yl.setAutoFreeze.bind(Yl),Yl.setUseStrictShallowCopy.bind(Yl),Yl.applyPatches.bind(Yl);var Xl=Yl.createDraft.bind(Yl),ql=Yl.finishDraft.bind(Yl);
|
|
7
7
|
/*!
|
|
8
8
|
* is-plain-object <https://github.com/jonschlinkert/is-plain-object>
|
|
9
9
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yoopta/editor",
|
|
3
|
-
"version": "4.8.
|
|
3
|
+
"version": "4.8.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"private": false,
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -67,5 +67,5 @@
|
|
|
67
67
|
"url": "https://github.com/Darginec05/Yoopta-Editor/issues"
|
|
68
68
|
},
|
|
69
69
|
"homepage": "https://github.com/Darginec05/Yoopta-Editor#readme",
|
|
70
|
-
"gitHead": "
|
|
70
|
+
"gitHead": "130161a4859888b173c897741be1953e3de99d8e"
|
|
71
71
|
}
|