@yoopta/ui 6.0.0-beta.4 → 6.0.0-beta.5
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/action-menu-list.js +1 -0
- package/dist/block-options.js +1 -0
- package/dist/chunks/_tslib-5e145dfd.js +1 -0
- package/dist/chunks/floating-ui.react-0123aadf.js +5 -0
- package/dist/chunks/highlight-color-picker-13e8f1eb.js +1 -0
- package/dist/chunks/hooks-8cbb0736.js +1 -0
- package/dist/chunks/hooks-907f8ea7.js +1 -0
- package/dist/chunks/index-06d5c4e7.js +10 -0
- package/dist/chunks/style-inject.es-e87a8d02.js +1 -0
- package/dist/chunks/throttle-dea4a39e.js +1 -0
- package/dist/floating-block-actions.js +1 -1
- package/dist/highlight-color-picker.js +1 -0
- package/dist/index.js +1 -5
- package/dist/overlay.js +1 -0
- package/dist/portal.js +1 -0
- package/dist/slash-command-menu/index.d.ts +0 -1
- package/dist/slash-command-menu/index.d.ts.map +1 -1
- package/dist/slash-command-menu.js +1 -0
- package/dist/theme.js +1 -0
- package/dist/toolbar.js +1 -0
- package/package.json +73 -7
- package/dist/index-16ebe43d.js +0 -10
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{A as ActionMenuList,u as useActionMenuList,a as useActionMenuListActions,b as useActionMenuListStore}from"./chunks/hooks-8cbb0736.js";import{s as o}from"./chunks/style-inject.es-e87a8d02.js";import"./chunks/_tslib-5e145dfd.js";import"react/jsx-runtime";import"react";import"./chunks/floating-ui.react-0123aadf.js";import"react-dom";import"@yoopta/editor";import"./chunks/index-06d5c4e7.js";o(".yoopta-ui-action-menu-list{bottom:auto;left:0;margin:0;position:absolute;right:auto;top:0;z-index:var(--yoopta-ui-action-menu-z-index,9999)}.yoopta-ui-action-menu-list-content{background:hsl(var(--yoopta-ui-background));border:1px solid hsl(var(--yoopta-ui-border));border-radius:var(--yoopta-ui-action-menu-radius,.5rem);box-shadow:var(\n --yoopta-ui-action-menu-shadow,0 4px 6px -1px rgba(0,0,0,.1),0 2px 4px -2px rgba(0,0,0,.1)\n );max-height:var(--yoopta-ui-action-menu-max-height,330px);overflow-x:hidden;overflow-y:auto;padding:var(--yoopta-ui-action-menu-padding,.5rem);-webkit-user-select:none;-moz-user-select:none;user-select:none}.yoopta-ui-action-menu-list-group{color:hsl(var(--yoopta-ui-foreground));overflow:hidden;padding:0}.yoopta-ui-action-menu-list-item{align-items:center;background:transparent;border:none;border-radius:var(--yoopta-ui-action-menu-item-radius,.375rem);color:hsl(var(--yoopta-ui-foreground));cursor:pointer;display:flex;font-size:var(--yoopta-ui-action-menu-item-font-size,.875rem);gap:var(--yoopta-ui-action-menu-item-gap,.5rem);margin-bottom:.125rem;outline:none;padding:var(--yoopta-ui-action-menu-item-padding,.5rem);text-align:left;transition:background-color .15s ease-out;width:100%}.yoopta-ui-action-menu-list-item:last-child{margin-bottom:0}.yoopta-ui-action-menu-list-item:hover,.yoopta-ui-action-menu-list-item[aria-selected=true]{background:hsl(var(--yoopta-ui-accent))}.yoopta-ui-action-menu-list-item:focus-visible{outline:2px solid hsl(var(--yoopta-ui-ring));outline-offset:2px}.yoopta-ui-action-menu-list-item-icon{align-items:center;background:hsl(var(--yoopta-ui-background));border:1px solid hsl(var(--yoopta-ui-border));border-radius:var(--yoopta-ui-action-menu-icon-radius,.375rem);display:flex;flex-shrink:0;justify-content:center}.yoopta-ui-action-menu-list-item-icon img,.yoopta-ui-action-menu-list-item-icon svg{height:100%;-o-object-fit:contain;object-fit:contain;width:100%}.yoopta-ui-action-menu-list-item-content{flex:1;min-width:0}.yoopta-ui-action-menu-list-item-title{font-weight:500;line-height:1.25}.yoopta-ui-action-menu-list-item-description{color:hsl(var(--yoopta-ui-muted-foreground));font-size:var(--yoopta-ui-action-menu-item-description-font-size,.75rem);line-height:1.25;margin-top:.125rem;max-width:200px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.yoopta-ui-action-menu-list-empty{color:hsl(var(--yoopta-ui-muted-foreground));font-size:var(--yoopta-ui-action-menu-empty-font-size,.75rem);padding:var(--yoopta-ui-action-menu-empty-padding,.5rem);text-align:left}.yoopta-ui-action-menu-list-content::-webkit-scrollbar{width:8px}.yoopta-ui-action-menu-list-content::-webkit-scrollbar-track{background:transparent}.yoopta-ui-action-menu-list-content::-webkit-scrollbar-thumb{background:hsl(var(--yoopta-ui-border));border-radius:4px}.yoopta-ui-action-menu-list-content::-webkit-scrollbar-thumb:hover{background:hsl(var(--yoopta-ui-muted-foreground))}");
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{useCallback as o,useEffect as t,forwardRef as e}from"react";import{u as i,i as n,f as a,s as r,o as c,a as s,b as l}from"./chunks/floating-ui.react-0123aadf.js";import{useYooptaEditor as p}from"@yoopta/editor";import{c as u}from"./chunks/index-06d5c4e7.js";import{_ as d}from"./chunks/_tslib-5e145dfd.js";import{jsx as b,jsxs as k}from"react/jsx-runtime";import{s as y}from"./chunks/style-inject.es-e87a8d02.js";import{Portal as g}from"./portal.js";import{Overlay as h}from"./overlay.js";import"react-dom";const v=u()(o=>({blockId:null,state:"closed",reference:null,open(t){const{reference:e,blockId:i}=t;o({state:"open",reference:e,blockId:i||null})},close(){o({state:"closed",reference:null,blockId:null})},toggle(t,e,i){o("closed"===t?{state:"closed",reference:null,blockId:null}:o=>Object.assign(Object.assign({},o),{state:t,reference:void 0!==e?e:o.reference,blockId:void 0!==i?i:o.blockId}))},setReference(t){o({reference:t})},reset(){o({blockId:null,state:"closed",reference:null})}})),m=()=>{const t=p(),e=v(),i=o(o=>{if(!o)throw new Error("Block ID is required to duplicate block");t.duplicateBlock({blockId:o,focus:!0}),e.close()},[t,e]),n=o(o=>{var i;if(!o)throw new Error("Block ID is required to copy block link");const n=t.children[o];if(n){const o=`${window.location.origin}${window.location.pathname}#${n.id}`;if(navigator.clipboard&&navigator.clipboard.writeText)navigator.clipboard.writeText(o).then(()=>{});else{const t=document.createElement("textarea");t.value=o,t.style.position="fixed",t.style.opacity="0",document.body.appendChild(t),t.select(),document.execCommand("copy"),document.body.removeChild(t)}null===(i=t.emit)||void 0===i||i.call(t,"block:copy",n)}e.close()},[t,e]),a=o(o=>{if(!o)throw new Error("Block ID is required to delete block");t.deleteBlock({blockId:o}),t.setPath({current:null}),e.close()},[t,e]);return{open:e.open,close:e.close,state:e.state,blockId:e.blockId,reference:e.reference,duplicateBlock:i,copyBlockLink:n,deleteBlock:a}},f=()=>{const e=p(),{state:u,reference:d,open:b,close:k}=v(),y="open"===u,{refs:g,floatingStyles:h,context:m,update:f}=i({placement:"right-start",open:y,middleware:[n(),a(),r(),c({mainAxis:5})],whileElementsMounted:s,strategy:"fixed"}),{isMounted:x,styles:w}=l(m,{duration:150});t(()=>{d&&g.setReference(d),y&&f()},[g,d,y,f]);const B=o(({reference:o,blockId:t})=>{b({reference:o,blockId:t})},[b]),I=o(()=>{k()},[k]),j=o(o=>{if(!o)throw new Error("Block ID is required to duplicate block");e.duplicateBlock({blockId:o,focus:!0}),I()},[e,I]),O=o(o=>{var t;if(!o)throw new Error("Block ID is required to copy block link");const i=e.children[o];if(i){const o=`${window.location.origin}${window.location.pathname}#${i.id}`;if(navigator.clipboard&&navigator.clipboard.writeText)navigator.clipboard.writeText(o).then(()=>{});else{const t=document.createElement("textarea");t.value=o,t.style.position="fixed",t.style.opacity="0",document.body.appendChild(t),t.select(),document.execCommand("copy"),document.body.removeChild(t)}null===(t=e.emit)||void 0===t||t.call(e,"block:copy",i)}I()},[e,I]),N=o(o=>{if(!o)throw new Error("Block ID is required to delete block");e.deleteBlock({blockId:o}),e.setPath({current:null}),I()},[e,I]);return{isOpen:x,getRootProps:()=>({ref:g.setFloating,style:Object.assign(Object.assign({},h),w),onClick:o=>o.stopPropagation(),onMouseDown:o=>o.stopPropagation()}),open:B,close:I,duplicateBlock:j,copyBlockLink:O,deleteBlock:N}};y(":root{--yoopta-ui-block-options-bg:var(--yoopta-ui-background);--yoopta-ui-block-options-border:var(--yoopta-ui-border);--yoopta-ui-block-options-shadow:0 10px 15px -3px rgba(0,0,0,.1),0 4px 6px -4px rgba(0,0,0,.1);--yoopta-ui-block-options-radius:0.5rem;--yoopta-ui-block-options-padding:4px;--yoopta-ui-block-options-min-width:220px;--yoopta-ui-block-options-z-index:200;--yoopta-ui-block-options-group-gap:1px;--yoopta-ui-block-options-button-padding-y:8px;--yoopta-ui-block-options-button-padding-x:12px;--yoopta-ui-block-options-button-font-size:0.875rem;--yoopta-ui-block-options-button-line-height:1.25rem;--yoopta-ui-block-options-button-color:var(--yoopta-ui-foreground);--yoopta-ui-block-options-button-bg:transparent;--yoopta-ui-block-options-button-hover:var(--yoopta-ui-accent);--yoopta-ui-block-options-button-active:var(--yoopta-ui-accent);--yoopta-ui-block-options-button-radius:0.375rem;--yoopta-ui-destructive:0 84.2% 60.2%;--yoopta-ui-destructive-foreground:210 40% 98%;--yoopta-ui-block-options-button-destructive-color:hsl(var(--yoopta-ui-destructive));--yoopta-ui-block-options-button-destructive-hover:hsl(var(--yoopta-ui-destructive)/0.1);--yoopta-ui-block-options-icon-size:1rem;--yoopta-ui-block-options-icon-gap:8px;--yoopta-ui-block-options-separator-color:var(--yoopta-ui-border);--yoopta-ui-block-options-separator-height:1px;--yoopta-ui-block-options-separator-margin:4px 0;--yoopta-ui-block-options-transition:color 0.15s ease-in-out,background-color 0.15s ease-in-out,border-color 0.15s ease-in-out,box-shadow 0.15s ease-in-out}.dark,[data-theme=dark],[data-yoopta-theme=dark]{--yoopta-ui-block-options-shadow:0 10px 15px -3px rgba(0,0,0,.5),0 4px 6px -4px rgba(0,0,0,.3)}.yoopta-ui-block-options{background-color:hsl(var(--yoopta-ui-block-options-bg));border:1px solid hsl(var(--yoopta-ui-block-options-border));border-radius:var(--yoopta-ui-block-options-radius);box-shadow:var(--yoopta-ui-block-options-shadow);min-width:var(--yoopta-ui-block-options-min-width);padding:var(--yoopta-ui-block-options-padding);position:fixed;z-index:var(--yoopta-ui-block-options-z-index)}.yoopta-ui-block-options-content{display:flex;flex-direction:column;gap:var(--yoopta-ui-block-options-group-gap)}.yoopta-ui-block-options-group{display:flex;flex-direction:column;gap:1px}.yoopta-ui-block-options-button{align-items:center;background-color:var(--yoopta-ui-block-options-button-bg);border:none;border-radius:var(--yoopta-ui-block-options-button-radius);color:hsl(var(--yoopta-ui-block-options-button-color));cursor:pointer;display:flex;font-size:var(--yoopta-ui-block-options-button-font-size);font-weight:400;line-height:var(--yoopta-ui-block-options-button-line-height);outline:none;padding:var(--yoopta-ui-block-options-button-padding-y) var(--yoopta-ui-block-options-button-padding-x);text-align:left;transition:var(--yoopta-ui-block-options-transition);-moz-user-select:none;user-select:none;-webkit-user-select:none;width:100%}.yoopta-ui-block-options-button:hover{background-color:hsl(var(--yoopta-ui-block-options-button-hover));color:hsl(var(--yoopta-ui-accent-foreground))}.yoopta-ui-block-options-button:active{background-color:hsl(var(--yoopta-ui-block-options-button-active))}.yoopta-ui-block-options-button:focus-visible{box-shadow:0 0 0 2px hsl(var(--yoopta-ui-background)),0 0 0 4px hsl(var(--yoopta-ui-ring));outline:none}.yoopta-ui-block-options-button:disabled{opacity:.5;pointer-events:none}.yoopta-ui-block-options-button-destructive{color:var(--yoopta-ui-block-options-button-destructive-color)}.yoopta-ui-block-options-button-destructive:hover{background-color:var(--yoopta-ui-block-options-button-destructive-hover);color:hsl(var(--yoopta-ui-destructive))}.yoopta-ui-block-options-button-icon{align-items:center;display:inline-flex;flex-shrink:0;justify-content:center;margin-right:var(--yoopta-ui-block-options-icon-gap)}.yoopta-ui-block-options-button-icon svg{height:var(--yoopta-ui-block-options-icon-size);width:var(--yoopta-ui-block-options-icon-size)}.yoopta-ui-block-options-button-text{flex:1}.yoopta-ui-block-options-separator{background-color:hsl(var(--yoopta-ui-block-options-separator-color));height:var(--yoopta-ui-block-options-separator-height);margin:var(--yoopta-ui-block-options-separator-margin)}@media (prefers-color-scheme:dark){:root:not([data-theme=light]){--yoopta-ui-block-options-shadow:0 10px 15px -3px rgba(0,0,0,.5),0 4px 6px -4px rgba(0,0,0,.3)}}");const x=e((o,t)=>{var{children:e,className:i="",onClose:n}=o,a=d(o,["children","className","onClose"]);return b(g,Object.assign({id:"yoopta-ui-block-options-portal"},{children:b(h,Object.assign({lockScroll:!0,onMouseDown:o=>o.stopPropagation(),onClick:n},{children:b("div",Object.assign({ref:t,className:`yoopta-ui-block-options ${i}`,contentEditable:!1},a,{children:e}))}))}))});x.displayName="BlockOptions.Root";const w=e(({children:o,className:t=""},e)=>b("div",Object.assign({ref:e,className:`yoopta-ui-block-options-group ${t}`},{children:o})));w.displayName="BlockOptions.Group";const B=e((o,t)=>{var{children:e,onClick:i,className:n="",disabled:a,icon:r,variant:c="default"}=o,s=d(o,["children","onClick","className","disabled","icon","variant"]);return k("button",Object.assign({ref:t,type:"button",className:`yoopta-ui-block-options-button yoopta-ui-block-options-button-${c} ${n}`,onClick:i,disabled:a},s,{children:[r&&b("span",Object.assign({className:"yoopta-ui-block-options-button-icon"},{children:r})),b("span",Object.assign({className:"yoopta-ui-block-options-button-text"},{children:e}))]}))});B.displayName="BlockOptions.Button";const I=e(({className:o=""},t)=>b("div",{ref:t,className:`yoopta-ui-block-options-separator ${o}`}));I.displayName="BlockOptions.Separator";const j=Object.assign(x,{Root:x,Group:w,Button:B,Separator:I});export{j as BlockOptions,f as useBlockOptions,m as useBlockOptionsActions,v as useBlockOptionsStore};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function r(r,e){var t={};for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&e.indexOf(o)<0&&(t[o]=r[o]);if(null!=r&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(o=Object.getOwnPropertySymbols(r);n<o.length;n++)e.indexOf(o[n])<0&&Object.prototype.propertyIsEnumerable.call(r,o[n])&&(t[o[n]]=r[o[n]])}return t}"function"==typeof SuppressedError&&SuppressedError;export{r as _};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import*as t from"react";import{useLayoutEffect as e,useEffect as n,useRef as o}from"react";import*as r from"react-dom";function i(){return"undefined"!=typeof window}function l(t){return s(t)?(t.nodeName||"").toLowerCase():"#document"}function c(t){var e;return(null==t||null==(e=t.ownerDocument)?void 0:e.defaultView)||window}function a(t){var e;return null==(e=(s(t)?t.ownerDocument:t.document)||window.document)?void 0:e.documentElement}function s(t){return!!i()&&(t instanceof Node||t instanceof c(t).Node)}function u(t){return!!i()&&(t instanceof Element||t instanceof c(t).Element)}function f(t){return!!i()&&(t instanceof HTMLElement||t instanceof c(t).HTMLElement)}function d(t){return!(!i()||"undefined"==typeof ShadowRoot)&&(t instanceof ShadowRoot||t instanceof c(t).ShadowRoot)}const p=new Set(["inline","contents"]);function m(t){const{overflow:e,overflowX:n,overflowY:o,display:r}=A(t);return/auto|scroll|overlay|hidden|clip/.test(e+o+n)&&!p.has(r)}const h=new Set(["table","td","th"]);function g(t){return h.has(l(t))}const y=[":popover-open",":modal"];function v(t){return y.some(e=>{try{return t.matches(e)}catch(t){return!1}})}const w=["transform","translate","scale","rotate","perspective"],b=["transform","translate","scale","rotate","perspective","filter"],x=["paint","layout","strict","content"];function R(t){const e=S(),n=u(t)?A(t):t;return w.some(t=>!!n[t]&&"none"!==n[t])||!!n.containerType&&"normal"!==n.containerType||!e&&!!n.backdropFilter&&"none"!==n.backdropFilter||!e&&!!n.filter&&"none"!==n.filter||b.some(t=>(n.willChange||"").includes(t))||x.some(t=>(n.contain||"").includes(t))}function S(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}const E=new Set(["html","body","#document"]);function C(t){return E.has(l(t))}function A(t){return c(t).getComputedStyle(t)}function T(t){return u(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function L(t){if("html"===l(t))return t;const e=t.assignedSlot||t.parentNode||d(t)&&t.host||a(t);return d(e)?e.host:e}function O(t){const e=L(t);return C(e)?t.ownerDocument?t.ownerDocument.body:t.body:f(e)&&m(e)?e:O(e)}function D(t,e,n){var o;void 0===e&&(e=[]),void 0===n&&(n=!0);const r=O(t),i=r===(null==(o=t.ownerDocument)?void 0:o.body),l=c(r);if(i){const t=P(l);return e.concat(l,l.visualViewport||[],m(r)?r:[],t&&n?D(t):[])}return e.concat(r,D(r,[],n))}function P(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}const k=Math.min,M=Math.max,F=Math.round,N=Math.floor,I=t=>({x:t,y:t}),B={left:"right",right:"left",bottom:"top",top:"bottom"},j={start:"end",end:"start"};function V(t,e,n){return M(t,k(e,n))}function W(t,e){return"function"==typeof t?t(e):t}function z(t){return t.split("-")[0]}function H(t){return t.split("-")[1]}function q(t){return"x"===t?"y":"x"}function $(t){return"y"===t?"height":"width"}const U=new Set(["top","bottom"]);function X(t){return U.has(z(t))?"y":"x"}function Y(t){return q(X(t))}function _(t){return t.replace(/start|end/g,t=>j[t])}const Z=["left","right"],G=["right","left"],J=["top","bottom"],K=["bottom","top"];function Q(t,e,n,o){const r=H(t);let i=function(t,e,n){switch(t){case"top":case"bottom":return n?e?G:Z:e?Z:G;case"left":case"right":return e?J:K;default:return[]}}(z(t),"start"===n,o);return r&&(i=i.map(t=>t+"-"+r),e&&(i=i.concat(i.map(_)))),i}function tt(t){return t.replace(/left|right|bottom|top/g,t=>B[t])}function et(t){return"number"!=typeof t?function(t){return{top:0,right:0,bottom:0,left:0,...t}}(t):{top:t,right:t,bottom:t,left:t}}function nt(t){const{x:e,y:n,width:o,height:r}=t;return{width:o,height:r,top:n,left:e,right:e+o,bottom:n+r,x:e,y:n}}
|
|
2
|
+
/*!
|
|
3
|
+
* tabbable 6.4.0
|
|
4
|
+
* @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
|
|
5
|
+
*/var ot=["input:not([inert]):not([inert] *)","select:not([inert]):not([inert] *)","textarea:not([inert]):not([inert] *)","a[href]:not([inert]):not([inert] *)","button:not([inert]):not([inert] *)","[tabindex]:not(slot):not([inert]):not([inert] *)","audio[controls]:not([inert]):not([inert] *)","video[controls]:not([inert]):not([inert] *)",'[contenteditable]:not([contenteditable="false"]):not([inert]):not([inert] *)',"details>summary:first-of-type:not([inert]):not([inert] *)","details:not([inert]):not([inert] *)"].join(","),rt="undefined"==typeof Element,it=rt?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,lt=!rt&&Element.prototype.getRootNode?function(t){var e;return null==t||null===(e=t.getRootNode)||void 0===e?void 0:e.call(t)}:function(t){return null==t?void 0:t.ownerDocument},ct=function(t,e){var n;void 0===e&&(e=!0);var o=null==t||null===(n=t.getAttribute)||void 0===n?void 0:n.call(t,"inert");return""===o||"true"===o||e&&t&&("function"==typeof t.closest?t.closest("[inert]"):ct(t.parentNode))},at=function(t,e,n){for(var o=[],r=Array.from(t);r.length;){var i=r.shift();if(!ct(i,!1))if("SLOT"===i.tagName){var l=i.assignedElements(),c=l.length?l:i.children,a=at(c,!0,n);n.flatten?o.push.apply(o,a):o.push({scopeParent:i,candidates:a})}else{it.call(i,ot)&&n.filter(i)&&(e||!t.includes(i))&&o.push(i);var s=i.shadowRoot||"function"==typeof n.getShadowRoot&&n.getShadowRoot(i),u=!ct(s,!1)&&(!n.shadowRootFilter||n.shadowRootFilter(i));if(s&&u){var f=at(!0===s?i.children:s.children,!0,n);n.flatten?o.push.apply(o,f):o.push({scopeParent:i,candidates:f})}else r.unshift.apply(r,i.children)}}return o},st=function(t){return!isNaN(parseInt(t.getAttribute("tabindex"),10))},ut=function(t){if(!t)throw new Error("No node provided");return t.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(t.tagName)||function(t){var e,n=null==t||null===(e=t.getAttribute)||void 0===e?void 0:e.call(t,"contenteditable");return""===n||"true"===n}(t))&&!st(t)?0:t.tabIndex},ft=function(t,e){return t.tabIndex===e.tabIndex?t.documentOrder-e.documentOrder:t.tabIndex-e.tabIndex},dt=function(t){return"INPUT"===t.tagName},pt=function(t){return function(t){return dt(t)&&"radio"===t.type}(t)&&!function(t){if(!t.name)return!0;var e,n=t.form||lt(t),o=function(t){return n.querySelectorAll('input[type="radio"][name="'+t+'"]')};if("undefined"!=typeof window&&void 0!==window.CSS&&"function"==typeof window.CSS.escape)e=o(window.CSS.escape(t.name));else try{e=o(t.name)}catch(t){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",t.message),!1}var r=function(t,e){for(var n=0;n<t.length;n++)if(t[n].checked&&t[n].form===e)return t[n]}(e,t.form);return!r||r===t}(t)},mt=function(t){var e=t.getBoundingClientRect(),n=e.width,o=e.height;return 0===n&&0===o},ht=function(t,e){var n=e.displayCheck,o=e.getShadowRoot;if("full-native"===n&&"checkVisibility"in t)return!t.checkVisibility({checkOpacity:!1,opacityProperty:!1,contentVisibilityAuto:!0,visibilityProperty:!0,checkVisibilityCSS:!0});if("hidden"===getComputedStyle(t).visibility)return!0;var r=it.call(t,"details>summary:first-of-type")?t.parentElement:t;if(it.call(r,"details:not([open]) *"))return!0;if(n&&"full"!==n&&"full-native"!==n&&"legacy-full"!==n){if("non-zero-area"===n)return mt(t)}else{if("function"==typeof o){for(var i=t;t;){var l=t.parentElement,c=lt(t);if(l&&!l.shadowRoot&&!0===o(l))return mt(t);t=t.assignedSlot?t.assignedSlot:l||c===t.ownerDocument?l:c.host}t=i}if(function(t){var e,n,o,r,i=t&<(t),l=null===(e=i)||void 0===e?void 0:e.host,c=!1;if(i&&i!==t)for(c=!!(null!==(n=l)&&void 0!==n&&null!==(o=n.ownerDocument)&&void 0!==o&&o.contains(l)||null!=t&&null!==(r=t.ownerDocument)&&void 0!==r&&r.contains(t));!c&&l;){var a,s,u;c=!(null===(s=l=null===(a=i=lt(l))||void 0===a?void 0:a.host)||void 0===s||null===(u=s.ownerDocument)||void 0===u||!u.contains(l))}return c}(t))return!t.getClientRects().length;if("legacy-full"!==n)return!0}return!1},gt=function(t,e){return!(e.disabled||function(t){return dt(t)&&"hidden"===t.type}(e)||ht(e,t)||function(t){return"DETAILS"===t.tagName&&Array.prototype.slice.apply(t.children).some(function(t){return"SUMMARY"===t.tagName})}(e)||function(t){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(t.tagName))for(var e=t.parentElement;e;){if("FIELDSET"===e.tagName&&e.disabled){for(var n=0;n<e.children.length;n++){var o=e.children.item(n);if("LEGEND"===o.tagName)return!!it.call(e,"fieldset[disabled] *")||!o.contains(t)}return!0}e=e.parentElement}return!1}(e))},yt=function(t,e){return!(pt(e)||ut(e)<0||!gt(t,e))},vt=function(t){var e=parseInt(t.getAttribute("tabindex"),10);return!!(isNaN(e)||e>=0)},wt=function(t){var e=[],n=[];return t.forEach(function(t,o){var r=!!t.scopeParent,i=r?t.scopeParent:t,l=function(t,e){var n=ut(t);return n<0&&e&&!st(t)?0:n}(i,r),c=r?wt(t.candidates):i;0===l?r?e.push.apply(e,c):e.push(i):n.push({documentOrder:o,tabIndex:l,item:t,isScope:r,content:c})}),n.sort(ft).reduce(function(t,e){return e.isScope?t.push.apply(t,e.content):t.push(e.content),t},[]).concat(e)},bt=function(t,e){var n;return n=(e=e||{}).getShadowRoot?at([t],e.includeContainer,{filter:yt.bind(null,e),flatten:!1,getShadowRoot:e.getShadowRoot,shadowRootFilter:vt}):function(t,e,n){if(ct(t))return[];var o=Array.prototype.slice.apply(t.querySelectorAll(ot));return e&&it.call(t,ot)&&o.unshift(t),o.filter(n)}(t,e.includeContainer,yt.bind(null,e)),wt(n)};function xt(t,e,n){let{reference:o,floating:r}=t;const i=X(e),l=Y(e),c=$(l),a=z(e),s="y"===i,u=o.x+o.width/2-r.width/2,f=o.y+o.height/2-r.height/2,d=o[c]/2-r[c]/2;let p;switch(a){case"top":p={x:u,y:o.y-r.height};break;case"bottom":p={x:u,y:o.y+o.height};break;case"right":p={x:o.x+o.width,y:f};break;case"left":p={x:o.x-r.width,y:f};break;default:p={x:o.x,y:o.y}}switch(H(e)){case"start":p[l]-=d*(n&&s?-1:1);break;case"end":p[l]+=d*(n&&s?-1:1)}return p}async function Rt(t,e){var n;void 0===e&&(e={});const{x:o,y:r,platform:i,rects:l,elements:c,strategy:a}=t,{boundary:s="clippingAncestors",rootBoundary:u="viewport",elementContext:f="floating",altBoundary:d=!1,padding:p=0}=W(e,t),m=et(p),h=c[d?"floating"===f?"reference":"floating":f],g=nt(await i.getClippingRect({element:null==(n=await(null==i.isElement?void 0:i.isElement(h)))||n?h:h.contextElement||await(null==i.getDocumentElement?void 0:i.getDocumentElement(c.floating)),boundary:s,rootBoundary:u,strategy:a})),y="floating"===f?{x:o,y:r,width:l.floating.width,height:l.floating.height}:l.reference,v=await(null==i.getOffsetParent?void 0:i.getOffsetParent(c.floating)),w=await(null==i.isElement?void 0:i.isElement(v))&&await(null==i.getScale?void 0:i.getScale(v))||{x:1,y:1},b=nt(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:y,offsetParent:v,strategy:a}):y);return{top:(g.top-b.top+m.top)/w.y,bottom:(b.bottom-g.bottom+m.bottom)/w.y,left:(g.left-b.left+m.left)/w.x,right:(b.right-g.right+m.right)/w.x}}function St(t){const e=k(...t.map(t=>t.left)),n=k(...t.map(t=>t.top));return{x:e,y:n,width:M(...t.map(t=>t.right))-e,height:M(...t.map(t=>t.bottom))-n}}const Et=new Set(["left","top"]);function Ct(t){const e=A(t);let n=parseFloat(e.width)||0,o=parseFloat(e.height)||0;const r=f(t),i=r?t.offsetWidth:n,l=r?t.offsetHeight:o,c=F(n)!==i||F(o)!==l;return c&&(n=i,o=l),{width:n,height:o,$:c}}function At(t){return u(t)?t:t.contextElement}function Tt(t){const e=At(t);if(!f(e))return I(1);const n=e.getBoundingClientRect(),{width:o,height:r,$:i}=Ct(e);let l=(i?F(n.width):n.width)/o,c=(i?F(n.height):n.height)/r;return l&&Number.isFinite(l)||(l=1),c&&Number.isFinite(c)||(c=1),{x:l,y:c}}const Lt=I(0);function Ot(t){const e=c(t);return S()&&e.visualViewport?{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}:Lt}function Dt(t,e,n,o){void 0===e&&(e=!1),void 0===n&&(n=!1);const r=t.getBoundingClientRect(),i=At(t);let l=I(1);e&&(o?u(o)&&(l=Tt(o)):l=Tt(t));const a=function(t,e,n){return void 0===e&&(e=!1),!(!n||e&&n!==c(t))&&e}(i,n,o)?Ot(i):I(0);let s=(r.left+a.x)/l.x,f=(r.top+a.y)/l.y,d=r.width/l.x,p=r.height/l.y;if(i){const t=c(i),e=o&&u(o)?c(o):o;let n=t,r=P(n);for(;r&&o&&e!==n;){const t=Tt(r),e=r.getBoundingClientRect(),o=A(r),i=e.left+(r.clientLeft+parseFloat(o.paddingLeft))*t.x,l=e.top+(r.clientTop+parseFloat(o.paddingTop))*t.y;s*=t.x,f*=t.y,d*=t.x,p*=t.y,s+=i,f+=l,n=c(r),r=P(n)}}return nt({width:d,height:p,x:s,y:f})}function Pt(t,e){const n=T(t).scrollLeft;return e?e.left+n:Dt(a(t)).left+n}function kt(t,e){const n=t.getBoundingClientRect();return{x:n.left+e.scrollLeft-Pt(t,n),y:n.top+e.scrollTop}}const Mt=new Set(["absolute","fixed"]);function Ft(t,e,n){let o;if("viewport"===e)o=function(t,e){const n=c(t),o=a(t),r=n.visualViewport;let i=o.clientWidth,l=o.clientHeight,s=0,u=0;if(r){i=r.width,l=r.height;const t=S();(!t||t&&"fixed"===e)&&(s=r.offsetLeft,u=r.offsetTop)}const f=Pt(o);if(f<=0){const t=o.ownerDocument,e=t.body,n=getComputedStyle(e),r="CSS1Compat"===t.compatMode&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,l=Math.abs(o.clientWidth-e.clientWidth-r);l<=25&&(i-=l)}else f<=25&&(i+=f);return{width:i,height:l,x:s,y:u}}(t,n);else if("document"===e)o=function(t){const e=a(t),n=T(t),o=t.ownerDocument.body,r=M(e.scrollWidth,e.clientWidth,o.scrollWidth,o.clientWidth),i=M(e.scrollHeight,e.clientHeight,o.scrollHeight,o.clientHeight);let l=-n.scrollLeft+Pt(t);const c=-n.scrollTop;return"rtl"===A(o).direction&&(l+=M(e.clientWidth,o.clientWidth)-r),{width:r,height:i,x:l,y:c}}(a(t));else if(u(e))o=function(t,e){const n=Dt(t,!0,"fixed"===e),o=n.top+t.clientTop,r=n.left+t.clientLeft,i=f(t)?Tt(t):I(1);return{width:t.clientWidth*i.x,height:t.clientHeight*i.y,x:r*i.x,y:o*i.y}}(e,n);else{const n=Ot(t);o={x:e.x-n.x,y:e.y-n.y,width:e.width,height:e.height}}return nt(o)}function Nt(t,e){const n=L(t);return!(n===e||!u(n)||C(n))&&("fixed"===A(n).position||Nt(n,e))}function It(t,e,n){const o=f(e),r=a(e),i="fixed"===n,c=Dt(t,!0,i,e);let s={scrollLeft:0,scrollTop:0};const u=I(0);function d(){u.x=Pt(r)}if(o||!o&&!i)if(("body"!==l(e)||m(r))&&(s=T(e)),o){const t=Dt(e,!0,i,e);u.x=t.x+e.clientLeft,u.y=t.y+e.clientTop}else r&&d();i&&!o&&r&&d();const p=!r||o||i?I(0):kt(r,s);return{x:c.left+s.scrollLeft-u.x-p.x,y:c.top+s.scrollTop-u.y-p.y,width:c.width,height:c.height}}function Bt(t){return"static"===A(t).position}function jt(t,e){if(!f(t)||"fixed"===A(t).position)return null;if(e)return e(t);let n=t.offsetParent;return a(t)===n&&(n=n.ownerDocument.body),n}function Vt(t,e){const n=c(t);if(v(t))return n;if(!f(t)){let e=L(t);for(;e&&!C(e);){if(u(e)&&!Bt(e))return e;e=L(e)}return n}let o=jt(t,e);for(;o&&g(o)&&Bt(o);)o=jt(o,e);return o&&C(o)&&Bt(o)&&!R(o)?n:o||function(t){let e=L(t);for(;f(e)&&!C(e);){if(R(e))return e;if(v(e))return null;e=L(e)}return null}(t)||n}const Wt={convertOffsetParentRelativeRectToViewportRelativeRect:function(t){let{elements:e,rect:n,offsetParent:o,strategy:r}=t;const i="fixed"===r,c=a(o),s=!!e&&v(e.floating);if(o===c||s&&i)return n;let u={scrollLeft:0,scrollTop:0},d=I(1);const p=I(0),h=f(o);if((h||!h&&!i)&&(("body"!==l(o)||m(c))&&(u=T(o)),f(o))){const t=Dt(o);d=Tt(o),p.x=t.x+o.clientLeft,p.y=t.y+o.clientTop}const g=!c||h||i?I(0):kt(c,u);return{width:n.width*d.x,height:n.height*d.y,x:n.x*d.x-u.scrollLeft*d.x+p.x+g.x,y:n.y*d.y-u.scrollTop*d.y+p.y+g.y}},getDocumentElement:a,getClippingRect:function(t){let{element:e,boundary:n,rootBoundary:o,strategy:r}=t;const i=[..."clippingAncestors"===n?v(e)?[]:function(t,e){const n=e.get(t);if(n)return n;let o=D(t,[],!1).filter(t=>u(t)&&"body"!==l(t)),r=null;const i="fixed"===A(t).position;let c=i?L(t):t;for(;u(c)&&!C(c);){const e=A(c),n=R(c);n||"fixed"!==e.position||(r=null),(i?!n&&!r:!n&&"static"===e.position&&r&&Mt.has(r.position)||m(c)&&!n&&Nt(t,c))?o=o.filter(t=>t!==c):r=e,c=L(c)}return e.set(t,o),o}(e,this._c):[].concat(n),o],c=i[0],a=i.reduce((t,n)=>{const o=Ft(e,n,r);return t.top=M(o.top,t.top),t.right=k(o.right,t.right),t.bottom=k(o.bottom,t.bottom),t.left=M(o.left,t.left),t},Ft(e,c,r));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}},getOffsetParent:Vt,getElementRects:async function(t){const e=this.getOffsetParent||Vt,n=this.getDimensions,o=await n(t.floating);return{reference:It(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}},getClientRects:function(t){return Array.from(t.getClientRects())},getDimensions:function(t){const{width:e,height:n}=Ct(t);return{width:e,height:n}},getScale:Tt,isElement:u,isRTL:function(t){return"rtl"===A(t).direction}};function zt(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function Ht(t,e,n,o){void 0===o&&(o={});const{ancestorScroll:r=!0,ancestorResize:i=!0,elementResize:l="function"==typeof ResizeObserver,layoutShift:c="function"==typeof IntersectionObserver,animationFrame:s=!1}=o,u=At(t),f=r||i?[...u?D(u):[],...D(e)]:[];f.forEach(t=>{r&&t.addEventListener("scroll",n,{passive:!0}),i&&t.addEventListener("resize",n)});const d=u&&c?function(t,e){let n,o=null;const r=a(t);function i(){var t;clearTimeout(n),null==(t=o)||t.disconnect(),o=null}return function l(c,a){void 0===c&&(c=!1),void 0===a&&(a=1),i();const s=t.getBoundingClientRect(),{left:u,top:f,width:d,height:p}=s;if(c||e(),!d||!p)return;const m={rootMargin:-N(f)+"px "+-N(r.clientWidth-(u+d))+"px "+-N(r.clientHeight-(f+p))+"px "+-N(u)+"px",threshold:M(0,k(1,a))||1};let h=!0;function g(e){const o=e[0].intersectionRatio;if(o!==a){if(!h)return l();o?l(!1,o):n=setTimeout(()=>{l(!1,1e-7)},1e3)}1!==o||zt(s,t.getBoundingClientRect())||l(),h=!1}try{o=new IntersectionObserver(g,{...m,root:r.ownerDocument})}catch(t){o=new IntersectionObserver(g,m)}o.observe(t)}(!0),i}(u,n):null;let p,m=-1,h=null;l&&(h=new ResizeObserver(t=>{let[o]=t;o&&o.target===u&&h&&(h.unobserve(e),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var t;null==(t=h)||t.observe(e)})),n()}),u&&!s&&h.observe(u),h.observe(e));let g=s?Dt(t):null;return s&&function e(){const o=Dt(t);g&&!zt(g,o)&&n();g=o,p=requestAnimationFrame(e)}(),n(),()=>{var t;f.forEach(t=>{r&&t.removeEventListener("scroll",n),i&&t.removeEventListener("resize",n)}),null==d||d(),null==(t=h)||t.disconnect(),h=null,s&&cancelAnimationFrame(p)}}const qt=function(t){return void 0===t&&(t=0),{name:"offset",options:t,async fn(e){var n,o;const{x:r,y:i,placement:l,middlewareData:c}=e,a=await async function(t,e){const{placement:n,platform:o,elements:r}=t,i=await(null==o.isRTL?void 0:o.isRTL(r.floating)),l=z(n),c=H(n),a="y"===X(n),s=Et.has(l)?-1:1,u=i&&a?-1:1,f=W(e,t);let{mainAxis:d,crossAxis:p,alignmentAxis:m}="number"==typeof f?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return c&&"number"==typeof m&&(p="end"===c?-1*m:m),a?{x:p*u,y:d*s}:{x:d*s,y:p*u}}(e,t);return l===(null==(n=c.offset)?void 0:n.placement)&&null!=(o=c.arrow)&&o.alignmentOffset?{}:{x:r+a.x,y:i+a.y,data:{...a,placement:l}}}}},$t=function(t){return void 0===t&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:o,placement:r}=e,{mainAxis:i=!0,crossAxis:l=!1,limiter:c={fn:t=>{let{x:e,y:n}=t;return{x:e,y:n}}},...a}=W(t,e),s={x:n,y:o},u=await Rt(e,a),f=X(z(r)),d=q(f);let p=s[d],m=s[f];if(i){const t="y"===d?"bottom":"right";p=V(p+u["y"===d?"top":"left"],p,p-u[t])}if(l){const t="y"===f?"bottom":"right";m=V(m+u["y"===f?"top":"left"],m,m-u[t])}const h=c.fn({...e,[d]:p,[f]:m});return{...h,data:{x:h.x-n,y:h.y-o,enabled:{[d]:i,[f]:l}}}}}},Ut=function(t){return void 0===t&&(t={}),{name:"flip",options:t,async fn(e){var n,o;const{placement:r,middlewareData:i,rects:l,initialPlacement:c,platform:a,elements:s}=e,{mainAxis:u=!0,crossAxis:f=!0,fallbackPlacements:d,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:h=!0,...g}=W(t,e);if(null!=(n=i.arrow)&&n.alignmentOffset)return{};const y=z(r),v=X(c),w=z(c)===c,b=await(null==a.isRTL?void 0:a.isRTL(s.floating)),x=d||(w||!h?[tt(c)]:function(t){const e=tt(t);return[_(t),e,_(e)]}(c)),R="none"!==m;!d&&R&&x.push(...Q(c,h,m,b));const S=[c,...x],E=await Rt(e,g),C=[];let A=(null==(o=i.flip)?void 0:o.overflows)||[];if(u&&C.push(E[y]),f){const t=function(t,e,n){void 0===n&&(n=!1);const o=H(t),r=Y(t),i=$(r);let l="x"===r?o===(n?"end":"start")?"right":"left":"start"===o?"bottom":"top";return e.reference[i]>e.floating[i]&&(l=tt(l)),[l,tt(l)]}(r,l,b);C.push(E[t[0]],E[t[1]])}if(A=[...A,{placement:r,overflows:C}],!C.every(t=>t<=0)){var T,L;const t=((null==(T=i.flip)?void 0:T.index)||0)+1,e=S[t];if(e){if(!("alignment"===f&&v!==X(e))||A.every(t=>X(t.placement)!==v||t.overflows[0]>0))return{data:{index:t,overflows:A},reset:{placement:e}}}let n=null==(L=A.filter(t=>t.overflows[0]<=0).sort((t,e)=>t.overflows[1]-e.overflows[1])[0])?void 0:L.placement;if(!n)switch(p){case"bestFit":{var O;const t=null==(O=A.filter(t=>{if(R){const e=X(t.placement);return e===v||"y"===e}return!0}).map(t=>[t.placement,t.overflows.filter(t=>t>0).reduce((t,e)=>t+e,0)]).sort((t,e)=>t[1]-e[1])[0])?void 0:O[0];t&&(n=t);break}case"initialPlacement":n=c}if(r!==n)return{reset:{placement:n}}}return{}}}},Xt=function(t){return void 0===t&&(t={}),{name:"size",options:t,async fn(e){var n,o;const{placement:r,rects:i,platform:l,elements:c}=e,{apply:a=()=>{},...s}=W(t,e),u=await Rt(e,s),f=z(r),d=H(r),p="y"===X(r),{width:m,height:h}=i.floating;let g,y;"top"===f||"bottom"===f?(g=f,y=d===(await(null==l.isRTL?void 0:l.isRTL(c.floating))?"start":"end")?"left":"right"):(y=f,g="end"===d?"top":"bottom");const v=h-u.top-u.bottom,w=m-u.left-u.right,b=k(h-u[g],v),x=k(m-u[y],w),R=!e.middlewareData.shift;let S=b,E=x;if(null!=(n=e.middlewareData.shift)&&n.enabled.x&&(E=w),null!=(o=e.middlewareData.shift)&&o.enabled.y&&(S=v),R&&!d){const t=M(u.left,0),e=M(u.right,0),n=M(u.top,0),o=M(u.bottom,0);p?E=m-2*(0!==t||0!==e?t+e:M(u.left,u.right)):S=h-2*(0!==n||0!==o?n+o:M(u.top,u.bottom))}await a({...e,availableWidth:E,availableHeight:S});const C=await l.getDimensions(c.floating);return m!==C.width||h!==C.height?{reset:{rects:!0}}:{}}}},Yt=function(t){return void 0===t&&(t={}),{name:"inline",options:t,async fn(e){const{placement:n,elements:o,rects:r,platform:i,strategy:l}=e,{padding:c=2,x:a,y:s}=W(t,e),u=Array.from(await(null==i.getClientRects?void 0:i.getClientRects(o.reference))||[]),f=function(t){const e=t.slice().sort((t,e)=>t.y-e.y),n=[];let o=null;for(let t=0;t<e.length;t++){const r=e[t];!o||r.y-o.y>o.height/2?n.push([r]):n[n.length-1].push(r),o=r}return n.map(t=>nt(St(t)))}(u),d=nt(St(u)),p=et(c);const m=await i.getElementRects({reference:{getBoundingClientRect:function(){if(2===f.length&&f[0].left>f[1].right&&null!=a&&null!=s)return f.find(t=>a>t.left-p.left&&a<t.right+p.right&&s>t.top-p.top&&s<t.bottom+p.bottom)||d;if(f.length>=2){if("y"===X(n)){const t=f[0],e=f[f.length-1],o="top"===z(n),r=t.top,i=e.bottom,l=o?t.left:e.left,c=o?t.right:e.right;return{top:r,bottom:i,left:l,right:c,width:c-l,height:i-r,x:l,y:r}}const t="left"===z(n),e=M(...f.map(t=>t.right)),o=k(...f.map(t=>t.left)),r=f.filter(n=>t?n.left===o:n.right===e),i=r[0].top,l=r[r.length-1].bottom;return{top:i,bottom:l,left:o,right:e,width:e-o,height:l-i,x:o,y:i}}return d}},floating:o.floating,strategy:l});return r.reference.x!==m.reference.x||r.reference.y!==m.reference.y||r.reference.width!==m.reference.width||r.reference.height!==m.reference.height?{reset:{rects:m}}:{}}}},_t=(t,e,n)=>{const o=new Map,r={platform:Wt,...n},i={...r.platform,_c:o};return(async(t,e,n)=>{const{placement:o="bottom",strategy:r="absolute",middleware:i=[],platform:l}=n,c=i.filter(Boolean),a=await(null==l.isRTL?void 0:l.isRTL(e));let s=await l.getElementRects({reference:t,floating:e,strategy:r}),{x:u,y:f}=xt(s,o,a),d=o,p={},m=0;for(let n=0;n<c.length;n++){const{name:i,fn:h}=c[n],{x:g,y:y,data:v,reset:w}=await h({x:u,y:f,initialPlacement:o,placement:d,strategy:r,middlewareData:p,rects:s,platform:l,elements:{reference:t,floating:e}});u=null!=g?g:u,f=null!=y?y:f,p={...p,[i]:{...p[i],...v}},w&&m<=50&&(m++,"object"==typeof w&&(w.placement&&(d=w.placement),w.rects&&(s=!0===w.rects?await l.getElementRects({reference:t,floating:e,strategy:r}):w.rects),({x:u,y:f}=xt(s,d,a))),n=-1)}return{x:u,y:f,placement:d,strategy:r,middlewareData:p}})(t,e,{...r,platform:i})};var Zt="undefined"!=typeof document?e:function(){};function Gt(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if("function"==typeof t&&t.toString()===e.toString())return!0;let n,o,r;if(t&&e&&"object"==typeof t){if(Array.isArray(t)){if(n=t.length,n!==e.length)return!1;for(o=n;0!==o--;)if(!Gt(t[o],e[o]))return!1;return!0}if(r=Object.keys(t),n=r.length,n!==Object.keys(e).length)return!1;for(o=n;0!==o--;)if(!{}.hasOwnProperty.call(e,r[o]))return!1;for(o=n;0!==o--;){const n=r[o];if(("_owner"!==n||!t.$$typeof)&&!Gt(t[n],e[n]))return!1}return!0}return t!=t&&e!=e}function Jt(t){if("undefined"==typeof window)return 1;return(t.ownerDocument.defaultView||window).devicePixelRatio||1}function Kt(t,e){const n=Jt(t);return Math.round(e*n)/n}function Qt(e){const n=t.useRef(e);return Zt(()=>{n.current=e}),n}const te=(t,e)=>({...qt(t),options:[t,e]}),ee=(t,e)=>({...$t(t),options:[t,e]}),ne=(t,e)=>({...Ut(t),options:[t,e]}),oe=(t,e)=>({...Xt(t),options:[t,e]}),re=(t,e)=>({...Yt(t),options:[t,e]}),ie={...t},le=ie.useInsertionEffect||(t=>t());var ce="undefined"!=typeof document?e:n;function ae(){return ae=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},ae.apply(this,arguments)}let se=!1,ue=0;const fe=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+ue++;const de=ie.useId||function(){const[e,n]=t.useState(()=>se?fe():void 0);return ce(()=>{null==e&&n(fe())},[]),t.useEffect(()=>{se=!0},[]),e};const pe=t.createContext(null),me=t.createContext(null);function he(t){return"data-floating-ui-"+t}function ge(t){const e=o(t);return ce(()=>{e.current=t}),e}const ye=()=>({getShadowRoot:!0,displayCheck:"function"==typeof ResizeObserver&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function ve(t,e){const n=bt(t,ye());"prev"===e&&n.reverse();const o=n.indexOf(function(t){let e=t.activeElement;for(;null!=(null==(n=e)||null==(n=n.shadowRoot)?void 0:n.activeElement);){var n;e=e.shadowRoot.activeElement}return e}((null==(r=t)?void 0:r.ownerDocument)||document));var r;return n.slice(o+1)[0]}function we(t,e){const n=e||t.currentTarget,o=t.relatedTarget;return!o||!function(t,e){if(!t||!e)return!1;const n=null==e.getRootNode?void 0:e.getRootNode();if(t.contains(e))return!0;if(n&&d(n)){let n=e;for(;n;){if(t===n)return!0;n=n.parentNode||n.host}}return!1}(n,o)}function be(t){bt(t,ye()).forEach(t=>{t.dataset.tabindex=t.getAttribute("tabindex")||"",t.setAttribute("tabindex","-1")})}function xe(t){t.querySelectorAll("[data-tabindex]").forEach(t=>{const e=t.dataset.tabindex;delete t.dataset.tabindex,e?t.setAttribute("tabindex",e):t.removeAttribute("tabindex")})}const Re={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 Se(t){"Tab"===t.key&&(t.target,clearTimeout(undefined))}const Ee=t.forwardRef(function(e,n){const[o,r]=t.useState();ce(()=>(/apple/i.test(navigator.vendor)&&r("button"),document.addEventListener("keydown",Se),()=>{document.removeEventListener("keydown",Se)}),[]);const i={ref:n,tabIndex:0,role:o,"aria-hidden":!o||void 0,[he("focus-guard")]:"",style:Re};return t.createElement("span",ae({},e,i))}),Ce=t.createContext(null),Ae=he("portal");function Te(e){const{children:n,id:o,root:i,preserveTabOrder:l=!0}=e,c=function(e){void 0===e&&(e={});const{id:n,root:o}=e,r=de(),i=Le(),[l,c]=t.useState(null),a=t.useRef(null);return ce(()=>()=>{null==l||l.remove(),queueMicrotask(()=>{a.current=null})},[l]),ce(()=>{if(!r)return;if(a.current)return;const t=n?document.getElementById(n):null;if(!t)return;const e=document.createElement("div");e.id=r,e.setAttribute(Ae,""),t.appendChild(e),a.current=e,c(e)},[n,r]),ce(()=>{if(null===o)return;if(!r)return;if(a.current)return;let t=o||(null==i?void 0:i.portalNode);t&&!u(t)&&(t=t.current),t=t||document.body;let e=null;n&&(e=document.createElement("div"),e.id=n,t.appendChild(e));const l=document.createElement("div");l.id=r,l.setAttribute(Ae,""),t=e||t,t.appendChild(l),a.current=l,c(l)},[n,o,r,i]),l}({id:o,root:i}),[a,s]=t.useState(null),f=t.useRef(null),d=t.useRef(null),p=t.useRef(null),m=t.useRef(null),h=null==a?void 0:a.modal,g=null==a?void 0:a.open,y=!!a&&!a.modal&&a.open&&l&&!(!i&&!c);return t.useEffect(()=>{if(c&&l&&!h)return c.addEventListener("focusin",t,!0),c.addEventListener("focusout",t,!0),()=>{c.removeEventListener("focusin",t,!0),c.removeEventListener("focusout",t,!0)};function t(t){if(c&&we(t)){("focusin"===t.type?xe:be)(c)}}},[c,l,h]),t.useEffect(()=>{c&&(g||xe(c))},[g,c]),t.createElement(Ce.Provider,{value:t.useMemo(()=>({preserveTabOrder:l,beforeOutsideRef:f,afterOutsideRef:d,beforeInsideRef:p,afterInsideRef:m,portalNode:c,setFocusManagerState:s}),[l,c])},y&&c&&t.createElement(Ee,{"data-type":"outside",ref:f,onFocus:t=>{if(we(t,c)){var e;null==(e=p.current)||e.focus()}else{const t=ve(document.body,"prev")||(null==a?void 0:a.refs.domReference.current);null==t||t.focus()}}}),y&&c&&t.createElement("span",{"aria-owns":c.id,style:Re}),c&&r.createPortal(n,c),y&&c&&t.createElement(Ee,{"data-type":"outside",ref:d,onFocus:t=>{if(we(t,c)){var e;null==(e=m.current)||e.focus()}else{const e=ve(document.body,"next")||(null==a?void 0:a.refs.domReference.current);null==e||e.focus(),(null==a?void 0:a.closeOnFocusOut)&&(null==a||a.onOpenChange(!1,t.nativeEvent,"focus-out"))}}}))}const Le=()=>t.useContext(Ce);let Oe=0;function De(){const t=/iP(hone|ad|od)|iOS/.test(function(){const t=navigator.userAgentData;return null!=t&&t.platform?t.platform:navigator.platform}()),e=document.body.style,n=Math.round(document.documentElement.getBoundingClientRect().left)+document.documentElement.scrollLeft?"paddingLeft":"paddingRight",o=window.innerWidth-document.documentElement.clientWidth,r=e.left?parseFloat(e.left):window.scrollX,i=e.top?parseFloat(e.top):window.scrollY;if(e.overflow="hidden",o&&(e[n]=o+"px"),t){var l,c;const t=(null==(l=window.visualViewport)?void 0:l.offsetLeft)||0,n=(null==(c=window.visualViewport)?void 0:c.offsetTop)||0;Object.assign(e,{position:"fixed",top:-(i-Math.floor(n))+"px",left:-(r-Math.floor(t))+"px",right:"0"})}return()=>{Object.assign(e,{overflow:"",[n]:""}),t&&(Object.assign(e,{position:"",top:"",left:"",right:""}),window.scrollTo(r,i))}}let Pe=()=>{};const ke=t.forwardRef(function(e,n){const{lockScroll:o=!1,...r}=e;return ce(()=>{if(o)return Oe++,1===Oe&&(Pe=De()),()=>{Oe--,0===Oe&&Pe()}},[o]),t.createElement("div",ae({ref:n},r,{style:{position:"fixed",overflow:"auto",top:0,right:0,bottom:0,left:0,...r.style}}))});function Me(e){const{open:n=!1,onOpenChange:o,elements:r}=e,i=de(),l=t.useRef({}),[c]=t.useState(()=>function(){const t=new Map;return{emit(e,n){var o;null==(o=t.get(e))||o.forEach(t=>t(n))},on(e,n){t.set(e,[...t.get(e)||[],n])},off(e,n){var o;t.set(e,(null==(o=t.get(e))?void 0:o.filter(t=>t!==n))||[])}}}()),a=null!=((null==(s=t.useContext(pe))?void 0:s.id)||null);var s;const[u,f]=t.useState(r.reference),d=function(e){const n=t.useRef(()=>{});return le(()=>{n.current=e}),t.useCallback(function(){for(var t=arguments.length,e=new Array(t),o=0;o<t;o++)e[o]=arguments[o];return null==n.current?void 0:n.current(...e)},[])}((t,e,n)=>{l.current.openEvent=t?e:void 0,c.emit("openchange",{open:t,event:e,reason:n,nested:a}),null==o||o(t,e,n)}),p=t.useMemo(()=>({setPositionReference:f}),[]),m=t.useMemo(()=>({reference:u||r.reference||null,floating:r.floating||null,domReference:r.reference}),[u,r.reference,r.floating]);return t.useMemo(()=>({dataRef:l,open:n,onOpenChange:d,elements:m,events:c,floatingId:i,refs:p}),[n,d,m,c,i,p])}function Fe(e){void 0===e&&(e={});const{nodeId:n}=e,o=Me({...e,elements:{reference:null,floating:null,...e.elements}}),i=e.rootContext||o,l=i.elements,[c,a]=t.useState(null),[s,f]=t.useState(null),d=(null==l?void 0:l.domReference)||c,p=t.useRef(null),m=t.useContext(me);ce(()=>{d&&(p.current=d)},[d]);const h=function(e){void 0===e&&(e={});const{placement:n="bottom",strategy:o="absolute",middleware:i=[],platform:l,elements:{reference:c,floating:a}={},transform:s=!0,whileElementsMounted:u,open:f}=e,[d,p]=t.useState({x:0,y:0,strategy:o,placement:n,middlewareData:{},isPositioned:!1}),[m,h]=t.useState(i);Gt(m,i)||h(i);const[g,y]=t.useState(null),[v,w]=t.useState(null),b=t.useCallback(t=>{t!==E.current&&(E.current=t,y(t))},[]),x=t.useCallback(t=>{t!==C.current&&(C.current=t,w(t))},[]),R=c||g,S=a||v,E=t.useRef(null),C=t.useRef(null),A=t.useRef(d),T=null!=u,L=Qt(u),O=Qt(l),D=Qt(f),P=t.useCallback(()=>{if(!E.current||!C.current)return;const t={placement:n,strategy:o,middleware:m};O.current&&(t.platform=O.current),_t(E.current,C.current,t).then(t=>{const e={...t,isPositioned:!1!==D.current};k.current&&!Gt(A.current,e)&&(A.current=e,r.flushSync(()=>{p(e)}))})},[m,n,o,O,D]);Zt(()=>{!1===f&&A.current.isPositioned&&(A.current.isPositioned=!1,p(t=>({...t,isPositioned:!1})))},[f]);const k=t.useRef(!1);Zt(()=>(k.current=!0,()=>{k.current=!1}),[]),Zt(()=>{if(R&&(E.current=R),S&&(C.current=S),R&&S){if(L.current)return L.current(R,S,P);P()}},[R,S,P,L,T]);const M=t.useMemo(()=>({reference:E,floating:C,setReference:b,setFloating:x}),[b,x]),F=t.useMemo(()=>({reference:R,floating:S}),[R,S]),N=t.useMemo(()=>{const t={position:o,left:0,top:0};if(!F.floating)return t;const e=Kt(F.floating,d.x),n=Kt(F.floating,d.y);return s?{...t,transform:"translate("+e+"px, "+n+"px)",...Jt(F.floating)>=1.5&&{willChange:"transform"}}:{position:o,left:e,top:n}},[o,s,F.floating,d.x,d.y]);return t.useMemo(()=>({...d,update:P,refs:M,elements:F,floatingStyles:N}),[d,P,M,F,N])}({...e,elements:{...l,...s&&{reference:s}}}),g=t.useCallback(t=>{const e=u(t)?{getBoundingClientRect:()=>t.getBoundingClientRect(),contextElement:t}:t;f(e),h.refs.setReference(e)},[h.refs]),y=t.useCallback(t=>{(u(t)||null===t)&&(p.current=t,a(t)),(u(h.refs.reference.current)||null===h.refs.reference.current||null!==t&&!u(t))&&h.refs.setReference(t)},[h.refs]),v=t.useMemo(()=>({...h.refs,setReference:y,setPositionReference:g,domReference:p}),[h.refs,y,g]),w=t.useMemo(()=>({...h.elements,domReference:d}),[h.elements,d]),b=t.useMemo(()=>({...h,...i,refs:v,elements:w,nodeId:n}),[h,v,w,n,i]);return ce(()=>{i.dataRef.current.floatingContext=b;const t=null==m?void 0:m.nodesRef.current.find(t=>t.id===n);t&&(t.context=b)}),t.useMemo(()=>({...h,context:b,refs:v,elements:w}),[h,v,w,b])}const Ne=t=>t.replace(/[A-Z]+(?![a-z])|[A-Z]/g,(t,e)=>(e?"-":"")+t.toLowerCase());function Ie(t,e){return"function"==typeof t?t(e):t}function Be(e,n){void 0===n&&(n={});const{open:o,elements:{floating:r}}=e,{duration:i=250}=n,l=("number"==typeof i?i:i.close)||0,[c,a]=t.useState("unmounted"),s=function(e,n){const[o,r]=t.useState(e);return e&&!o&&r(!0),t.useEffect(()=>{if(!e&&o){const t=setTimeout(()=>r(!1),n);return()=>clearTimeout(t)}},[e,o,n]),o}(o,l);return s||"close"!==c||a("unmounted"),ce(()=>{if(r){if(o){a("initial");const t=requestAnimationFrame(()=>{a("open")});return()=>{cancelAnimationFrame(t)}}a("close")}},[o,r]),{isMounted:s,status:c}}function je(e,n){void 0===n&&(n={});const{initial:o={opacity:0},open:r,close:i,common:l,duration:c=250}=n,a=e.placement,s=a.split("-")[0],u=t.useMemo(()=>({side:s,placement:a}),[s,a]),f="number"==typeof c,d=(f?c:c.open)||0,p=(f?c:c.close)||0,[m,h]=t.useState(()=>({...Ie(l,u),...Ie(o,u)})),{isMounted:g,status:y}=Be(e,{duration:c}),v=ge(o),w=ge(r),b=ge(i),x=ge(l);return ce(()=>{const t=Ie(v.current,u),e=Ie(b.current,u),n=Ie(x.current,u),o=Ie(w.current,u)||Object.keys(t).reduce((t,e)=>(t[e]="",t),{});if("initial"===y&&h(e=>({transitionProperty:e.transitionProperty,...n,...t})),"open"===y&&h({transitionProperty:Object.keys(o).map(Ne).join(","),transitionDuration:d+"ms",...n,...o}),"close"===y){const o=e||t;h({transitionProperty:Object.keys(o).map(Ne).join(","),transitionDuration:p+"ms",...n,...o})}},[p,b,v,w,x,d,y,u]),{isMounted:g,styles:m}}export{Te as F,Ht as a,je as b,oe as c,ke as d,ne as f,re as i,te as o,ee as s,Fe as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsxs as e,Fragment as r,jsx as o}from"react/jsx-runtime";import t,{useRef as n,useMemo as a,useEffect as c,useCallback as l,useState as i,useLayoutEffect as u,forwardRef as s,cloneElement as f}from"react";import{u as h,o as d,f as p,s as g,a as v}from"./floating-ui.react-0123aadf.js";function m(){return(m=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var o=arguments[r];for(var t in o)Object.prototype.hasOwnProperty.call(o,t)&&(e[t]=o[t])}return e}).apply(this,arguments)}function b(e,r){if(null==e)return{};var o,t,n={},a=Object.keys(e);for(t=0;t<a.length;t++)r.indexOf(o=a[t])>=0||(n[o]=e[o]);return n}function _(e){var r=n(e),o=n(function(e){r.current&&r.current(e)});return r.current=e,o.current}var C=function(e,r,o){return void 0===r&&(r=0),void 0===o&&(o=1),e>o?o:e<r?r:e},k=function(e){return"touches"in e},x=function(e){return e&&e.ownerDocument.defaultView||self},w=function(e,r,o){var t=e.getBoundingClientRect(),n=k(r)?function(e,r){for(var o=0;o<e.length;o++)if(e[o].identifier===r)return e[o];return e[0]}(r.touches,o):r;return{left:C((n.pageX-(t.left+x(e).pageXOffset))/t.width),top:C((n.pageY-(t.top+x(e).pageYOffset))/t.height)}},y=function(e){!k(e)&&e.preventDefault()},F=t.memo(function(e){var r=e.onMove,o=e.onKey,l=b(e,["onMove","onKey"]),i=n(null),u=_(r),s=_(o),f=n(null),h=n(!1),d=a(function(){var e=function(e){y(e),(k(e)?e.touches.length>0:e.buttons>0)&&i.current?u(w(i.current,e,f.current)):o(!1)},r=function(){return o(!1)};function o(o){var t=h.current,n=x(i.current),a=o?n.addEventListener:n.removeEventListener;a(t?"touchmove":"mousemove",e),a(t?"touchend":"mouseup",r)}return[function(e){var r=e.nativeEvent,t=i.current;if(t&&(y(r),!function(e,r){return r&&!k(e)}(r,h.current)&&t)){if(k(r)){h.current=!0;var n=r.changedTouches||[];n.length&&(f.current=n[0].identifier)}t.focus(),u(w(t,r,f.current)),o(!0)}},function(e){var r=e.which||e.keyCode;r<37||r>40||(e.preventDefault(),s({left:39===r?.05:37===r?-.05:0,top:40===r?.05:38===r?-.05:0}))},o]},[s,u]),p=d[0],g=d[1],v=d[2];return c(function(){return v},[v]),t.createElement("div",m({},l,{onTouchStart:p,onMouseDown:p,className:"react-colorful__interactive",ref:i,onKeyDown:g,tabIndex:0,role:"slider"}))}),N=function(e){return e.filter(Boolean).join(" ")},E=function(e){var r=e.color,o=e.left,n=e.top,a=void 0===n?.5:n,c=N(["react-colorful__pointer",e.className]);return t.createElement("div",{className:c,style:{top:100*a+"%",left:100*o+"%"}},t.createElement("div",{className:"react-colorful__pointer-fill",style:{backgroundColor:r}}))},O=function(e,r,o){return void 0===r&&(r=0),void 0===o&&(o=Math.pow(10,r)),Math.round(o*e)/o},M=function(e){return"#"===e[0]&&(e=e.substring(1)),e.length<6?{r:parseInt(e[0]+e[0],16),g:parseInt(e[1]+e[1],16),b:parseInt(e[2]+e[2],16),a:4===e.length?O(parseInt(e[3]+e[3],16)/255,2):1}:{r:parseInt(e.substring(0,2),16),g:parseInt(e.substring(2,4),16),b:parseInt(e.substring(4,6),16),a:8===e.length?O(parseInt(e.substring(6,8),16)/255,2):1}},j=function(e){var r=function(e){var r=e.s,o=e.v,t=e.a,n=(200-r)*o/100;return{h:O(e.h),s:O(n>0&&n<200?r*o/100/(n<=100?n:200-n)*100:0),l:O(n/2),a:O(t,2)}}(e);return"hsl("+r.h+", "+r.s+"%, "+r.l+"%)"},H=function(e){var r=e.h,o=e.s,t=e.v,n=e.a;r=r/360*6,o/=100,t/=100;var a=Math.floor(r),c=t*(1-o),l=t*(1-(r-a)*o),i=t*(1-(1-r+a)*o),u=a%6;return{r:O(255*[t,l,c,c,i,t][u]),g:O(255*[i,t,t,l,c,c][u]),b:O(255*[c,c,i,t,t,l][u]),a:O(n,2)}},I=function(e){var r=e.toString(16);return r.length<2?"0"+r:r},L=function(e){var r=e.r,o=e.g,t=e.b,n=e.a,a=n<1?I(O(255*n)):"";return"#"+I(r)+I(o)+I(t)+a},B=function(e){var r=e.r,o=e.g,t=e.b,n=e.a,a=Math.max(r,o,t),c=a-Math.min(r,o,t),l=c?a===r?(o-t)/c:a===o?2+(t-r)/c:4+(r-o)/c:0;return{h:O(60*(l<0?l+6:l)),s:O(a?c/a*100:0),v:O(a/255*100),a:n}},z=t.memo(function(e){var r=e.hue,o=e.onChange,n=N(["react-colorful__hue",e.className]);return t.createElement("div",{className:n},t.createElement(F,{onMove:function(e){o({h:360*e.left})},onKey:function(e){o({h:C(r+360*e.left,0,360)})},"aria-label":"Hue","aria-valuenow":O(r),"aria-valuemax":"360","aria-valuemin":"0"},t.createElement(E,{className:"react-colorful__hue-pointer",left:r/360,color:j({h:r,s:100,v:100,a:1})})))}),D=t.memo(function(e){var r=e.hsva,o=e.onChange,n={backgroundColor:j({h:r.h,s:100,v:100,a:1})};return t.createElement("div",{className:"react-colorful__saturation",style:n},t.createElement(F,{onMove:function(e){o({s:100*e.left,v:100-100*e.top})},onKey:function(e){o({s:C(r.s+100*e.left,0,100),v:C(r.v-100*e.top,0,100)})},"aria-label":"Color","aria-valuetext":"Saturation "+O(r.s)+"%, Brightness "+O(r.v)+"%"},t.createElement(E,{className:"react-colorful__saturation-pointer",top:1-r.v/100,left:r.s/100,color:j(r)})))}),K=function(e,r){if(e===r)return!0;for(var o in e)if(e[o]!==r[o])return!1;return!0};function P(e,r,o){var t=_(o),a=i(function(){return e.toHsva(r)}),u=a[0],s=a[1],f=n({color:r,hsva:u});c(function(){if(!e.equal(r,f.current.color)){var o=e.toHsva(r);f.current={hsva:o,color:r},s(o)}},[r,e]),c(function(){var r;K(u,f.current.hsva)||e.equal(r=e.fromHsva(u),f.current.color)||(f.current={hsva:u,color:r},t(r))},[u,e,t]);var h=l(function(e){s(function(r){return Object.assign({},r,e)})},[]);return[u,h]}var S="undefined"!=typeof window?u:c,T=new Map,q=function(e){S(function(){var r=e.current?e.current.ownerDocument:document;if(void 0!==r&&!T.has(r)){var o=r.createElement("style");o.innerHTML='.react-colorful{position:relative;display:flex;flex-direction:column;width:200px;height:200px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:default}.react-colorful__saturation{position:relative;flex-grow:1;border-color:transparent;border-bottom:12px solid #000;border-radius:8px 8px 0 0;background-image:linear-gradient(0deg,#000,transparent),linear-gradient(90deg,#fff,hsla(0,0%,100%,0))}.react-colorful__alpha-gradient,.react-colorful__pointer-fill{content:"";position:absolute;left:0;top:0;right:0;bottom:0;pointer-events:none;border-radius:inherit}.react-colorful__alpha-gradient,.react-colorful__saturation{box-shadow:inset 0 0 0 1px rgba(0,0,0,.05)}.react-colorful__alpha,.react-colorful__hue{position:relative;height:24px}.react-colorful__hue{background:linear-gradient(90deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red)}.react-colorful__last-control{border-radius:0 0 8px 8px}.react-colorful__interactive{position:absolute;left:0;top:0;right:0;bottom:0;border-radius:inherit;outline:none;touch-action:none}.react-colorful__pointer{position:absolute;z-index:1;box-sizing:border-box;width:28px;height:28px;transform:translate(-50%,-50%);background-color:#fff;border:2px solid #fff;border-radius:50%;box-shadow:0 2px 4px rgba(0,0,0,.2)}.react-colorful__interactive:focus .react-colorful__pointer{transform:translate(-50%,-50%) scale(1.1)}.react-colorful__alpha,.react-colorful__alpha-pointer{background-color:#fff;background-image:url(\'data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill-opacity=".05"><path d="M8 0h8v8H8zM0 8h8v8H0z"/></svg>\')}.react-colorful__saturation-pointer{z-index:3}.react-colorful__hue-pointer{z-index:2}',T.set(r,o);var t="undefined"!=typeof __webpack_nonce__?__webpack_nonce__:void 0;t&&o.setAttribute("nonce",t),r.head.appendChild(o)}},[])},A=function(e){var r=e.className,o=e.colorModel,a=e.color,c=void 0===a?o.defaultColor:a,l=e.onChange,i=b(e,["className","colorModel","color","onChange"]),u=n(null);q(u);var s=P(o,c,l),f=s[0],h=s[1],d=N(["react-colorful",r]);return t.createElement("div",m({},i,{ref:u,className:d}),t.createElement(D,{hsva:f,onChange:h}),t.createElement(z,{hue:f.h,onChange:h,className:"react-colorful__last-control"}))},$={defaultColor:"000",toHsva:function(e){return B(M(e))},fromHsva:function(e){return function(e){return L(H(e))}({h:e.h,s:e.s,v:e.v,a:1})},equal:function(e,r){return e.toLowerCase()===r.toLowerCase()||K(M(e),M(r))}},R=function(e){return t.createElement(A,m({},e,{colorModel:$}))},X=/^#?([0-9A-F]{3,8})$/i,Y=function(e){var r=e.color,o=void 0===r?"":r,n=e.onChange,a=e.onBlur,u=e.escape,s=e.validate,f=e.format,h=e.process,d=b(e,["color","onChange","onBlur","escape","validate","format","process"]),p=i(function(){return u(o)}),g=p[0],v=p[1],C=_(n),k=_(a),x=l(function(e){var r=u(e.target.value);v(r),s(r)&&C(h?h(r):r)},[u,h,s,C]),w=l(function(e){s(e.target.value)||v(u(o)),k(e)},[o,u,s,k]);return c(function(){v(u(o))},[o,u]),t.createElement("input",m({},d,{value:f?f(g):g,spellCheck:"false",onChange:x,onBlur:w}))},V=function(e){return"#"+e},G=function(e){var r=e.prefixed,o=e.alpha,n=b(e,["prefixed","alpha"]),a=l(function(e){return e.replace(/([^0-9A-F]+)/gi,"").substring(0,o?8:6)},[o]),c=l(function(e){return function(e,r){var o=X.exec(e),t=o?o[1].length:0;return 3===t||6===t||!!r&&4===t||!!r&&8===t}(e,o)},[o]);return t.createElement(Y,m({},n,{escape:a,format:r?V:void 0,process:V,validate:c}))};const J=["#FFFF00","#FFE066","#FFCC99","#FF9999","#99CCFF","#99FF99","#FF99FF","#CC99FF"],Q=s(({value:t={backgroundColor:"#FFFF00"},onChange:n,presets:a=J,showInput:l=!0,className:u,children:s,placement:m="bottom",offset:b=8},_)=>{const[C,k]=i(!1),[x,w]=i("backgroundColor"),[y,F]=i(t.backgroundColor),[N,E]=i(t.color),{refs:O,floatingStyles:M}=h({open:C,onOpenChange:k,placement:m,middleware:[d(b),p(),g()],whileElementsMounted:v});c(()=>{t.backgroundColor&&F(t.backgroundColor),t.color&&E(t.color)},[t]),c(()=>{if(!C)return;const e=e=>{const r=e.target,o=O.reference.current,t=O.floating.current;o&&o instanceof Element&&o.contains(r)||(null==t?void 0:t.contains(r))||k(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[C,O.floating,O.reference]);const j=e=>{"backgroundColor"===x?(F(e),null==n||n(Object.assign(Object.assign({},t),{backgroundColor:e}))):(E(e),null==n||n(Object.assign(Object.assign({},t),{color:e})))},H="backgroundColor"===x?y:N,I=f(s,{ref:O.setReference,onClick:e=>{var r,o;e.stopPropagation(),k(e=>!e),null===(o=(r=s.props).onClick)||void 0===o||o.call(r,e)}});return e(r,{children:[I,C&&e("div",Object.assign({ref:e=>{O.setFloating(e),_&&("function"==typeof _?_(e):_.current=e)},style:M,className:`yoopta-highlight-color-picker ${null!=u?u:""}`,onClick:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation()},{children:[e("div",Object.assign({className:"yoopta-highlight-color-picker__mode-toggle"},{children:[o("button",Object.assign({type:"button",className:"yoopta-highlight-color-picker__mode-btn","data-active":"backgroundColor"===x,onClick:()=>w("backgroundColor"),"aria-label":"Background color"},{children:"Background"})),o("button",Object.assign({type:"button",className:"yoopta-highlight-color-picker__mode-btn","data-active":"color"===x,onClick:()=>w("color"),"aria-label":"Text color"},{children:"Text"}))]})),o("div",Object.assign({className:"yoopta-highlight-color-picker__picker"},{children:o(R,{color:H,onChange:j,className:"yoopta-highlight-color-picker__react-colorful"})})),a.length>0&&o("div",Object.assign({className:"yoopta-highlight-color-picker__presets"},{children:a.map(e=>{const r=(null==H?void 0:H.toLowerCase())===e.toLowerCase();return o("button",{type:"button",className:"yoopta-highlight-color-picker__preset","data-selected":r,style:{backgroundColor:e},onClick:()=>j(e),"aria-label":`Select color ${e}`},e)})})),l&&e("div",Object.assign({className:"yoopta-highlight-color-picker__hex-row"},{children:[o("div",{className:"yoopta-highlight-color-picker__swatch",style:{backgroundColor:H}}),o(G,{color:H,onChange:j,className:"yoopta-highlight-color-picker__hex-input",prefixed:!0})]}))]}))]})});Q.displayName="HighlightColorPicker";export{Q as H};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{_ as e}from"./_tslib-5e145dfd.js";import{jsx as t,jsxs as n}from"react/jsx-runtime";import{forwardRef as o,isValidElement as i,cloneElement as s,useMemo as a,useState as l,useCallback as c,useEffect as r}from"react";import{u as p,f as d,s as u,o as m,a as v,b as f}from"./floating-ui.react-0123aadf.js";import{Blocks as g,getAllowedPluginsFromElement as y,getRootBlockElement as b,useYooptaEditor as N}from"@yoopta/editor";import{c as h}from"./index-06d5c4e7.js";const w=o((n,o)=>{var{children:i,style:s,className:a}=n,l=e(n,["children","style","className"]);return t("div",Object.assign({ref:o,role:"listbox",tabIndex:0,style:s,className:`yoopta-ui-action-menu-list-content ${a||""}`,onMouseDown:e=>e.stopPropagation(),onClick:e=>e.stopPropagation()},l,{children:i}))});w.displayName="ActionMenuList.Root";const j=o((n,o)=>{var{children:i,className:s}=n,a=e(n,["children","className"]);return t("div",Object.assign({ref:o,className:`yoopta-ui-action-menu-list-group ${s||""}`},a,{children:i}))});j.displayName="ActionMenuList.Group";const k=o((o,a)=>{var{action:l,selected:c,icon:r,className:p}=o,d=e(o,["action","selected","icon","className"]);return n("button",Object.assign({ref:a,type:"button",className:`yoopta-ui-action-menu-list-item ${c?"selected":""} ${p||""}`},d,{children:[r&&t("div",Object.assign({className:"yoopta-ui-action-menu-list-item-icon"},{children:(e=>{if(!e)return null;if("string"==typeof e)return t("img",{src:e,alt:"icon"});if(i(e))return s(e);return t(e,{})})(r)})),n("div",Object.assign({className:"yoopta-ui-action-menu-list-item-content"},{children:[t("div",Object.assign({className:"yoopta-ui-action-menu-list-item-title"},{children:l.title})),l.description&&t("div",Object.assign({className:"yoopta-ui-action-menu-list-item-description"},{children:l.description}))]}))]}))});k.displayName="ActionMenuList.Item";const O=o((n,o)=>{var{children:i,className:s}=n,a=e(n,["children","className"]);return t("div",Object.assign({ref:o,className:`yoopta-ui-action-menu-list-empty ${s||""}`},a,{children:i||"No actions available"}))});O.displayName="ActionMenuList.Empty";const I={Root:w,Group:j,Item:k,Empty:O},M=h()(e=>({state:"closed",view:"default",reference:null,placement:"bottom-start",blockId:null,open(t={}){const{reference:n,view:o,placement:i,blockId:s}=t;e(e=>({state:"open",reference:void 0!==n?n:e.reference,view:void 0!==o?o:e.view,placement:void 0!==i?i:e.placement,blockId:void 0!==s?s:e.blockId}))},close(){e({state:"closed",view:"default",placement:"bottom-start",blockId:null})},toggle(t){e({state:t})},setView(t){e({view:t})},setReference(t){e({reference:t})},reset(){e({state:"closed",view:"default",reference:null,placement:"bottom-start",blockId:null})}}));const P=()=>{const e=M();return{open:e.open,close:e.close,toggle:e.toggle,isOpen:"open"===e.state}},A=({view:e="default"}={})=>{const t=N(),n=M(),{state:o,view:i,reference:s,blockId:h,open:w,close:j,setView:k,placement:O}=n,{refs:I,floatingStyles:P,context:A,update:x}=p({placement:O,open:"open"===o,middleware:[d(),u(),m(10)],whileElementsMounted:v}),{isMounted:R,styles:$}=f(A,{duration:100}),C=a(()=>function(e){const t=Object.keys(e.plugins);let n=null;if("number"==typeof e.path.current){const t=g.getBlockSlate(e,{at:e.path.current});t&&(n=y(e,t))}let o=t;return n&&n.length>0&&(o="string"==typeof t[0]?t.filter(e=>n.includes(e)):t.filter(e=>n.includes(e.type))),o.map(t=>{var n,o,i,s,a,l;return"string"==typeof t?{type:t,title:(null===(o=null===(n=e.plugins[t].options)||void 0===n?void 0:n.display)||void 0===o?void 0:o.title)||t,description:null===(s=null===(i=e.plugins[t].options)||void 0===i?void 0:i.display)||void 0===s?void 0:s.description,icon:null===(l=null===(a=e.plugins[t].options)||void 0===a?void 0:a.display)||void 0===l?void 0:l.icon}:t})}(t).filter(e=>function(e,t){var n;const o=e.plugins[t];if(!o)return!1;const i=b(o.elements);return"void"!==(null===(n=null==i?void 0:i.props)||void 0===n?void 0:n.nodeType)}(t,e.type)),[t]),[E,L]=l(C[0]),[B,D]=l(C),F=c(()=>{j(),D(C),L(C[0]),k(e)},[j,C,e,k]);r(()=>{s&&I.setReference(s),"open"===o&&x()},[s,o,I,x]);const G=c(e=>{const{reference:t,view:n,placement:o,blockId:i}=e;n&&k(n),w({reference:t,view:n,placement:o,blockId:i})},[w,k]),S=c(e=>{const t=e.currentTarget.getAttribute("data-action-menu-item-type"),n=C.find(e=>e.type===t);L(n)},[C]),T=c(e=>({onMouseEnter:S,onMouseDown:e=>e.stopPropagation(),onClick:n=>{if(!h)return;const o=g.getBlock(t,{id:h});o&&(n.stopPropagation(),t.toggleBlock(e,{preserveContent:!0,focus:!0,at:o.meta.order}),F())},"data-action-menu-item":!0,"data-action-menu-item-type":e,"aria-selected":e===(null==E?void 0:E.type)}),[S,E,t,F]),V=c(()=>({"data-action-menu-list":!0,ref:I.setFloating,style:Object.assign(Object.assign(Object.assign({},P),$),{minWidth:"small"===i?200:244}),onMouseDown:e=>e.stopPropagation(),onClick:e=>e.stopPropagation()}),[I.setFloating,P,$,i]);return{isOpen:R,state:o,actions:B,selectedAction:E,empty:0===B.length,view:i,open:G,close:F,getItemProps:T,getRootProps:V}};export{I as A,P as a,M as b,A as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{_ as e}from"./_tslib-5e145dfd.js";import{jsx as t}from"react/jsx-runtime";import{forwardRef as o,useCallback as a,useMemo as s,useEffect as n}from"react";import{Portal as r}from"../portal.js";import{u as i,i as l,f as c,s as d,o as p,a as u,b as m}from"./floating-ui.react-0123aadf.js";import{useYooptaEditor as f}from"@yoopta/editor";import{c as g}from"./index-06d5c4e7.js";import{t as h}from"./throttle-dea4a39e.js";const v=o((o,a)=>{var{className:s,children:n}=o,i=e(o,["className","children"]);return t(r,Object.assign({id:"yoopta-ui-toolbar-portal"},{children:t("div",Object.assign({ref:a,className:`yoopta-ui-toolbar ${s||""}`,onClick:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation()},i,{children:n}))}))});v.displayName="Toolbar.Root";const b=o((o,a)=>{var{className:s,children:n}=o,r=e(o,["className","children"]);return t("div",Object.assign({ref:a,className:`yoopta-ui-toolbar-group ${s}`},r,{children:n}))});b.displayName="Toolbar.Group";const y=o((o,a)=>{var{className:s}=o,n=e(o,["className"]);return t("div",Object.assign({ref:a,className:`yoopta-ui-toolbar-separator ${s}`},n))});y.displayName="Toolbar.Separator";const N=o((o,a)=>{var{className:s,children:n,active:r,disabled:i,type:l="button"}=o,c=e(o,["className","children","active","disabled","type"]);return t("button",Object.assign({ref:a,type:l,disabled:i,"data-active":r,className:`yoopta-ui-toolbar-button ${s}`},c,{children:n}))});N.displayName="Toolbar.Button";const j={Root:v,Group:b,Separator:y,Button:N},w=g()(e=>({state:"closed",frozen:!1,open(){e({state:"open"})},close(){e({state:"closed",frozen:!1})},toggle(t){e({state:t})},setFrozen(t){e({frozen:t})},reset(){e({state:"closed",frozen:!1})}})),O=()=>{const e=f(),{state:t,frozen:o,open:r,close:g,setFrozen:v,toggle:b,reset:y}=w(),{refs:N,floatingStyles:j,context:O}=i({placement:"top",open:"open"===t,middleware:[l(),c(),d(),p(10)],whileElementsMounted:u}),{isMounted:R,styles:z}=m(O,{duration:100}),A=a(()=>{var a,s;if(o)return;const n=N.floating.current;if(n&&n.contains(document.activeElement))return;const i=window.getSelection();if(!i||(null==i?void 0:i.isCollapsed)||(null==i?void 0:i.anchorOffset)===(null==i?void 0:i.focusOffset))return void("open"===t&&g());const l=i.getRangeAt(0),c=l.getBoundingClientRect(),d=l.toString().trim(),p=null==l?void 0:l.commonAncestorContainer,u=!!(null===(a=null==p?void 0:p.closest)||void 0===a?void 0:a.call(p,"[data-custom-editor]"));if((null===(s=e.refElement)||void 0===s?void 0:s.contains(p))&&!u){if(l&&d.length>0){const e={getBoundingClientRect:()=>c,getClientRects:()=>l.getClientRects()};N.setReference(e),"open"!==t&&r()}}else"open"===t&&g()},[o,N,e.refElement,g,r,t]),C=a(()=>{var o;if(!Array.isArray(e.path.selected)||0===e.path.selected.length||"mousemove"!==e.path.source&&"keyboard"!==e.path.source)return void("open"===t&&g());const a=Math.min(...e.path.selected),s=Math.max(...e.path.selected);let n=!0;"number"==typeof e.path.current&&(n=Math.abs(e.path.current-s)<=Math.abs(e.path.current-a));const i=e.getBlock({at:n?s:a});if(!i)return;const l=null===(o=e.refElement)||void 0===o?void 0:o.querySelector(`[data-yoopta-block-id="${i.id}"]`);l&&(N.setReference(l),"open"!==t&&r())},[e,N,g,r,t]),M=s(()=>h(A,200,{leading:!0,trailing:!0}),[A]);n(()=>{if(Array.isArray(e.path.selected)||e.path.selection){if(!Array.isArray(e.path.selected)||e.path.selection)return window.document.addEventListener("selectionchange",M),()=>window.document.removeEventListener("selectionchange",M);C()}else"open"===t&&g()},[e.path.selected,e.path.selection,t,M,g,C]);const E=s(()=>Object.assign(Object.assign({},j),z),[j,z]);return{isOpen:R,state:t,frozen:o,open:r,close:g,toggle:b,setFrozen:v,reset:y,getRootProps:()=>({ref:N.setFloating,style:E,onClick:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation()})}};export{j as T,w as a,O as u};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import e from"react";const t=e=>{let t;const n=new Set,r=(e,r)=>{const u="function"==typeof e?e(t):e;if(!Object.is(u,t)){const e=t;t=(null!=r?r:"object"!=typeof u||null===u)?u:Object.assign({},t,u),n.forEach(n=>n(t,e))}},u=()=>t,o={setState:r,getState:u,getInitialState:()=>i,subscribe:e=>(n.add(e),()=>n.delete(e)),destroy:()=>{"production"!==(import.meta.env?import.meta.env.MODE:void 0)&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},i=t=e(r,u,o);return o};function n(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var r,u,o,i={},s={get exports(){return i},set exports(e){i=e}},a={},c={},l={get exports(){return c},set exports(e){c=e}},f={};function d(){return u||(u=1,l.exports=function(){if(r)return f;r=1;var t=e,n="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},u=t.useState,o=t.useEffect,i=t.useLayoutEffect,s=t.useDebugValue;function a(e){var t=e.getSnapshot;e=e.value;try{var r=t();return!n(e,r)}catch(e){return!0}}var c="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,t){var n=t(),r=u({inst:{value:n,getSnapshot:t}}),c=r[0].inst,l=r[1];return i(function(){c.value=n,c.getSnapshot=t,a(c)&&l({inst:c})},[e,n,t]),o(function(){return a(c)&&l({inst:c}),e(function(){a(c)&&l({inst:c})})},[e]),s(n),n};return f.useSyncExternalStore=void 0!==t.useSyncExternalStore?t.useSyncExternalStore:c,f}()),c}
|
|
2
|
+
/**
|
|
3
|
+
* @license React
|
|
4
|
+
* use-sync-external-store-shim/with-selector.production.js
|
|
5
|
+
*
|
|
6
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
7
|
+
*
|
|
8
|
+
* This source code is licensed under the MIT license found in the
|
|
9
|
+
* LICENSE file in the root directory of this source tree.
|
|
10
|
+
*/s.exports=function(){if(o)return a;o=1;var t=e,n=d(),r="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},u=n.useSyncExternalStore,i=t.useRef,s=t.useEffect,c=t.useMemo,l=t.useDebugValue;return a.useSyncExternalStoreWithSelector=function(e,t,n,o,a){var f=i(null);if(null===f.current){var d={hasValue:!1,value:null};f.current=d}else d=f.current;f=c(function(){function e(e){if(!s){if(s=!0,u=e,e=o(e),void 0!==a&&d.hasValue){var t=d.value;if(a(t,e))return i=t}return i=e}if(t=i,r(u,e))return t;var n=o(e);return void 0!==a&&a(t,n)?(u=e,t):(u=e,i=n)}var u,i,s=!1,c=void 0===n?null:n;return[function(){return e(t())},null===c?void 0:function(){return e(c())}]},[t,n,o,a]);var v=u(e,f[0],f[1]);return s(function(){d.hasValue=!0,d.value=v},[v]),l(v),v},a}();var v=n(i);const{useDebugValue:p}=e,{useSyncExternalStoreWithSelector:S}=v;let b=!1;const E=e=>e;const m=e=>{"production"!==(import.meta.env?import.meta.env.MODE:void 0)&&"function"!=typeof e&&console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");const n="function"==typeof e?(e=>e?t(e):t)(e):e,r=(e,t)=>function(e,t=E,n){"production"!==(import.meta.env?import.meta.env.MODE:void 0)&&n&&!b&&(console.warn("[DEPRECATED] Use `createWithEqualityFn` instead of `create` or use `useStoreWithEqualityFn` instead of `useStore`. They can be imported from 'zustand/traditional'. https://github.com/pmndrs/zustand/discussions/1937"),b=!0);const r=S(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return p(r),r}(n,e,t);return Object.assign(r,n),r},y=e=>e?m(e):m;export{y as c};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function e(e,t){void 0===t&&(t={});var d=t.insertAt;if(e&&"undefined"!=typeof document){var n=document.head||document.getElementsByTagName("head")[0],s=document.createElement("style");s.type="text/css","top"===d&&n.firstChild?n.insertBefore(s,n.firstChild):n.appendChild(s),s.styleSheet?s.styleSheet.cssText=e:s.appendChild(document.createTextNode(e))}}export{e as s};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function l(l,n,{leading:t=!0,trailing:e=!0}={}){let u=0,o=null,a=null;const c=n=>{l(...a),u=n,a=null},i=(...l)=>{const i=Date.now();u||t||(u=i);const r=n-(i-u);a=l,r<=0||r>n?(o&&(clearTimeout(o),o=null),c(i)):!o&&e&&(o=setTimeout(()=>{o=null,e&&a&&c(Date.now())},r))};return i.cancel=()=>{o&&(clearTimeout(o),o=null),a=null,u=0},i}export{l as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import{_ as o}from"./chunks/_tslib-5e145dfd.js";import{jsx as t}from"react/jsx-runtime";import{memo as a,forwardRef as e,useCallback as i,useEffect as n}from"react";import{s as r}from"./chunks/style-inject.es-e87a8d02.js";import{c as l}from"./chunks/index-06d5c4e7.js";import{useYooptaEditor as s}from"@yoopta/editor";import{t as u}from"./chunks/throttle-dea4a39e.js";r(":root{--yoopta-ui-background:0 0% 100%;--yoopta-ui-foreground:222.2 84% 4.9%;--yoopta-ui-muted:210 40% 96.1%;--yoopta-ui-muted-foreground:215.4 16.3% 46.9%;--yoopta-ui-border:214.3 31.8% 91.4%;--yoopta-ui-ring:222.2 84% 4.9%;--yoopta-ui-accent:210 40% 96.1%;--yoopta-ui-accent-foreground:222.2 47.4% 11.2%;--yoopta-ui-floating-bg:var(--yoopta-ui-background);--yoopta-ui-floating-border:var(--yoopta-ui-border);--yoopta-ui-floating-shadow:0 1px 2px 0 rgba(0,0,0,.05);--yoopta-ui-floating-shadow-md:0 4px 6px -1px rgba(0,0,0,.1),0 2px 4px -2px rgba(0,0,0,.1);--yoopta-ui-floating-z-index:100;--yoopta-ui-floating-gap:1px;--yoopta-ui-floating-padding:3px;--yoopta-ui-floating-radius:0.5rem;--yoopta-ui-floating-offset:46px;--yoopta-ui-floating-button-min-width:24px;--yoopta-ui-floating-button-min-height:24px;--yoopta-ui-floating-button-padding-y:4px;--yoopta-ui-floating-button-padding-x:6px;--yoopta-ui-floating-button-color:var(--yoopta-ui-foreground);--yoopta-ui-floating-button-bg:transparent;--yoopta-ui-floating-button-hover:var(--yoopta-ui-accent);--yoopta-ui-floating-button-active:var(--yoopta-ui-accent);--yoopta-ui-floating-button-radius:0.375rem;--yoopta-ui-floating-transition:color 0.15s ease-in-out,background-color 0.15s ease-in-out,border-color 0.15s ease-in-out,box-shadow 0.15s ease-in-out;--yoopta-ui-floating-ring-offset:2px;--yoopta-ui-floating-ring:var(--yoopta-ui-ring);--yoopta-ui-floating-icon-size:1rem}.dark,[data-theme=dark],[data-yoopta-theme=dark]{--yoopta-ui-background:222.2 84% 4.9%;--yoopta-ui-foreground:210 40% 98%;--yoopta-ui-muted:217.2 32.6% 17.5%;--yoopta-ui-muted-foreground:215 20.2% 65.1%;--yoopta-ui-border:217.2 32.6% 17.5%;--yoopta-ui-ring:212.7 26.8% 83.9%;--yoopta-ui-accent:217.2 32.6% 17.5%;--yoopta-ui-accent-foreground:210 40% 98%;--yoopta-ui-floating-shadow:0 1px 2px 0 rgba(0,0,0,.3);--yoopta-ui-floating-shadow-md:0 4px 6px -1px rgba(0,0,0,.5),0 2px 4px -2px rgba(0,0,0,.3)}.yoopta-ui-floating-block-actions{align-items:center;background-color:hsl(var(--yoopta-ui-floating-bg));border:1px solid hsl(var(--yoopta-ui-floating-border));border-radius:var(--yoopta-ui-floating-radius);box-shadow:var(--yoopta-ui-floating-shadow-md);display:inline-flex;gap:var(--yoopta-ui-floating-gap);padding:var(--yoopta-ui-floating-padding);z-index:var(--yoopta-ui-floating-z-index)}.yoopta-ui-floating-action-button{align-items:center;background-color:var(--yoopta-ui-floating-button-bg);border:none;border-radius:var(--yoopta-ui-floating-button-radius);color:hsl(var(--yoopta-ui-floating-button-color));cursor:pointer;display:inline-flex;font-size:.875rem;font-weight:500;justify-content:center;line-height:1;min-height:var(--yoopta-ui-floating-button-min-height);min-width:var(--yoopta-ui-floating-button-min-width);outline:none;padding:var(--yoopta-ui-floating-button-padding-y) var(--yoopta-ui-floating-button-padding-x);touch-action:manipulation;transition:var(--yoopta-ui-floating-transition);-moz-user-select:none;user-select:none;-webkit-user-select:none;white-space:nowrap}.yoopta-ui-floating-action-button:hover{background-color:hsl(var(--yoopta-ui-floating-button-hover));color:hsl(var(--yoopta-ui-accent-foreground))}.yoopta-ui-floating-action-button:active{background-color:hsl(var(--yoopta-ui-floating-button-active));transform:scale(.98)}.yoopta-ui-floating-action-button:focus-visible{box-shadow:0 0 0 var(--yoopta-ui-floating-ring-offset) hsl(var(--yoopta-ui-background)),0 0 0 calc(var(--yoopta-ui-floating-ring-offset) + 2px) hsl(var(--yoopta-ui-floating-ring));outline:none}.yoopta-ui-floating-action-button:disabled{opacity:.5;pointer-events:none}.yoopta-ui-floating-action-button svg{flex-shrink:0;height:var(--yoopta-ui-floating-icon-size);width:var(--yoopta-ui-floating-icon-size)}@media (prefers-color-scheme:dark){:root:not([data-theme=light]){--yoopta-ui-background:222.2 84% 4.9%;--yoopta-ui-foreground:210 40% 98%;--yoopta-ui-muted:217.2 32.6% 17.5%;--yoopta-ui-muted-foreground:215 20.2% 65.1%;--yoopta-ui-border:217.2 32.6% 17.5%;--yoopta-ui-ring:212.7 26.8% 83.9%;--yoopta-ui-accent:217.2 32.6% 17.5%;--yoopta-ui-accent-foreground:210 40% 98%}}");const p={position:"fixed",top:0,left:0,opacity:0,pointerEvents:"none",transform:"scale(0.95) translateX(-46px)",transition:"opacity 150ms ease-out, transform 150ms ease-out"},c=l()((o,t)=>({blockId:null,state:"closed",position:{top:0,left:0},styles:p,reference:null,setReference(t){o({reference:t})},toggle(t,a){o({state:t,blockId:a||null})},updatePosition(a,e,i=46){o({position:{top:a,left:e},styles:Object.assign(Object.assign({},t().styles),{top:a,left:e,opacity:1,transform:`scale(1) translateX(-${i+2}px)`,pointerEvents:"auto"})})},hide(){o({state:"closed",blockId:null,styles:Object.assign(Object.assign({},t().styles),{opacity:0,transform:p.transform,pointerEvents:"none"})})},reset(){o({blockId:null,state:"closed",position:{top:0,left:0},styles:p})}})),d=a(({children:o,className:a})=>{const{setReference:e,styles:i}=c();return t("div",Object.assign({ref:e,className:`yoopta-ui-floating-block-actions ${a}`,style:i,contentEditable:!1,onClick:o=>o.stopPropagation(),onMouseDown:o=>o.stopPropagation()},{children:o}))});d.displayName="FloatingBlockActions.Root";const g=e((a,e)=>{var{children:i,onClick:n,className:r="",disabled:l,title:s}=a,u=o(a,["children","onClick","className","disabled","title"]);return t("button",Object.assign({ref:e,type:"button",className:`yoopta-ui-floating-action-button ${r}`,onClick:n,disabled:l,title:s,"aria-label":s},u,{children:i}))});g.displayName="FloatingBlockActions.Button";const f=Object.assign(d,{Root:d,Button:g}),y=()=>{const o=c();return{reference:o.reference,floatingBlockId:o.blockId,state:o.state,styles:o.styles,toggle:o.toggle,hide:o.hide,reset:o.reset}},b=()=>{const o=s(),t=c(),a=i((o,a)=>{var e;const i=o.getBoundingClientRect(),n=(null===(e=t.reference)||void 0===e?void 0:e.offsetWidth)||46;t.updatePosition(i.top+2,i.left,n)},[t]),e=i(()=>{t.hide()},[t]),r=i(t=>{if(!o.refElement)return null;const a=o.refElement.querySelectorAll("[data-yoopta-block]"),e=window.innerHeight;let i=null,n=1/0;if(a.forEach(o=>{const a=o.getBoundingClientRect();if(a.bottom<-200||a.top>e+200)return;if(t>=a.top&&t<=a.bottom)return i=o,void(n=0);const r=t<a.top?a.top-t:t-a.bottom;r<n&&(n=r,i=o)}),i&&n<=100){const t=i.getAttribute("data-yoopta-block-id"),a=t?o.children[t]:null;if(t&&a)return{element:i,data:a}}return null},[o]),l=i(i=>{var n,l;if("frozen"===t.state)return;const s=i.target,u=null===(n=o.refElement)||void 0===n?void 0:n.contains(i.target),p=null===(l=t.reference)||void 0===l?void 0:l.contains(s);if(!u)return e();if(o.readOnly)return;if(p)return;const c=r(i.clientY);if(c){const{element:o,data:e}=c;e.id!==t.blockId&&(t.toggle("hovering",e.id),a(o,e))}else null!==t.blockId&&e()},[t,o,e,r,a]),p=u(l,100,{leading:!0,trailing:!0});return n(()=>{const o=()=>{"frozen"!==t.state&&e()};return document.addEventListener("mousemove",p),document.addEventListener("scroll",o,!0),()=>{document.removeEventListener("mousemove",p),document.removeEventListener("scroll",o,!0)}},[p,e,t.state]),{reference:t.reference,floatingBlockId:t.blockId,state:t.state,styles:t.styles,toggle:t.toggle,hide:t.hide,reset:t.reset}};export{f as FloatingBlockActions,b as useFloatingBlockActions,y as useFloatingBlockActionsActions,c as useFloatingBlockActionsStore};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{s as r}from"./chunks/style-inject.es-e87a8d02.js";export{H as HighlightColorPicker}from"./chunks/highlight-color-picker-13e8f1eb.js";import"react/jsx-runtime";import"react";import"./chunks/floating-ui.react-0123aadf.js";import"react-dom";r(".yoopta-highlight-color-picker{--hcp-bg:#fff;--hcp-fg:#18181b;--hcp-muted:#71717a;--hcp-border:#e4e4e7;--hcp-ring:#3b82f6;--hcp-shadow:0 16px 48px -12px rgba(0,0,0,.18),0 4px 16px -4px rgba(0,0,0,.1);--hcp-radius:10px;--hcp-pad:10px;--hcp-gap:10px;--hcp-width:224px;--hcp-picker-height:120px;--hcp-preset-size:24px;--hcp-input-height:26px;background:var(--hcp-bg);border:1px solid var(--hcp-border);border-radius:var(--hcp-radius);box-shadow:var(--hcp-shadow);color:var(--hcp-fg);display:flex;flex-direction:column;gap:8px;outline:none;padding:var(--hcp-pad);-webkit-user-select:none;-moz-user-select:none;user-select:none;width:var(--hcp-width);z-index:9999}.dark .yoopta-highlight-color-picker,.yoopta-highlight-color-picker[data-theme=dark]{--hcp-bg:#18181b;--hcp-fg:#fafafa;--hcp-muted:#a1a1aa;--hcp-border:#3f3f46;--hcp-shadow:0 16px 48px -12px rgba(0,0,0,.5),0 4px 16px -4px rgba(0,0,0,.3)}.yoopta-highlight-color-picker__mode-toggle{background:var(--hcp-border);border-radius:8px;display:flex;flex-shrink:0;gap:4px;padding:4px}.yoopta-highlight-color-picker__mode-btn{background:transparent;border:none;border-radius:6px;color:var(--hcp-muted);cursor:pointer;flex:1;font-size:11px;font-weight:500;line-height:1.4;outline:none;padding:4px 8px;text-align:center;transition:background-color .12s ease,color .12s ease}.yoopta-highlight-color-picker__mode-btn:hover{color:var(--hcp-fg)}.yoopta-highlight-color-picker__mode-btn[data-active=true]{background:var(--hcp-bg);box-shadow:0 1px 2px rgba(0,0,0,.1);color:var(--hcp-fg)}.yoopta-highlight-color-picker__mode-btn:focus-visible{outline:2px solid var(--hcp-ring);outline-offset:2px}.yoopta-highlight-color-picker__react-colorful{height:var(--hcp-picker-height)!important;width:100%!important}.yoopta-highlight-color-picker__react-colorful .react-colorful__saturation{border:1px solid var(--hcp-border);border-radius:8px}.yoopta-highlight-color-picker__react-colorful .react-colorful__hue{border:1px solid var(--hcp-border);border-radius:999px;height:10px;margin-top:8px}.yoopta-highlight-color-picker__react-colorful .react-colorful__pointer{border:2px solid var(--hcp-bg);border-radius:999px;box-shadow:0 2px 6px rgba(0,0,0,.22);height:16px;width:16px}.yoopta-highlight-color-picker__presets{align-items:center;display:flex;flex-direction:row;flex-wrap:nowrap;gap:6px;overflow-x:auto;padding-bottom:2px;scrollbar-color:var(--hcp-border) transparent;scrollbar-width:thin}.yoopta-highlight-color-picker__presets::-webkit-scrollbar{height:6px}.yoopta-highlight-color-picker__presets::-webkit-scrollbar-track{background:transparent}.yoopta-highlight-color-picker__presets::-webkit-scrollbar-thumb{background-color:var(--hcp-border);border-radius:999px}.yoopta-highlight-color-picker__preset{border:2px solid var(--hcp-border);border-radius:7px;cursor:pointer;flex:0 0 auto;height:var(--hcp-preset-size);outline:none;padding:0;transition:transform .12s ease,border-color .12s ease,box-shadow .12s ease;width:var(--hcp-preset-size)}.yoopta-highlight-color-picker__preset:hover{transform:scale(1.08)}.yoopta-highlight-color-picker__preset:focus-visible{border-color:var(--hcp-ring);box-shadow:0 0 0 2px var(--hcp-ring)}.yoopta-highlight-color-picker__preset[data-selected=true]{border-color:var(--hcp-ring);box-shadow:0 0 0 2px rgba(59,130,246,.35)}.yoopta-highlight-color-picker__hex-row{align-items:center;display:flex;gap:8px}.yoopta-highlight-color-picker__swatch{border:1px solid var(--hcp-border);border-radius:7px;flex:0 0 auto;height:var(--hcp-input-height);width:var(--hcp-input-height)}.yoopta-highlight-color-picker__hex-input{background:transparent;border:1px solid var(--hcp-border);border-radius:9px;color:var(--hcp-fg);flex:1;font-size:12px;height:var(--hcp-input-height);line-height:1;min-width:0;outline:none;padding:0 10px}.yoopta-highlight-color-picker__hex-input:focus{border-color:var(--hcp-ring);box-shadow:0 0 0 2px rgba(59,130,246,.25)}.yoopta-highlight-color-picker__hex-input::-moz-placeholder{color:var(--hcp-muted)}.yoopta-highlight-color-picker__hex-input::placeholder{color:var(--hcp-muted)}");
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1 @@
|
|
|
1
|
-
|
|
2
|
-
/*!
|
|
3
|
-
* tabbable 6.4.0
|
|
4
|
-
* @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
|
|
5
|
-
*/var Se=["input:not([inert]):not([inert] *)","select:not([inert]):not([inert] *)","textarea:not([inert]):not([inert] *)","a[href]:not([inert]):not([inert] *)","button:not([inert]):not([inert] *)","[tabindex]:not(slot):not([inert]):not([inert] *)","audio[controls]:not([inert]):not([inert] *)","video[controls]:not([inert]):not([inert] *)",'[contenteditable]:not([contenteditable="false"]):not([inert]):not([inert] *)',"details>summary:first-of-type:not([inert]):not([inert] *)","details:not([inert]):not([inert] *)"].join(","),Pe="undefined"==typeof Element,_e=Pe?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Re=!Pe&&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},Te=function(e,t){var o;void 0===t&&(t=!0);var n=null==e||null===(o=e.getAttribute)||void 0===o?void 0:o.call(e,"inert");return""===n||"true"===n||t&&e&&("function"==typeof e.closest?e.closest("[inert]"):Te(e.parentNode))},Ae=function(e,t,o){for(var n=[],r=Array.from(e);r.length;){var i=r.shift();if(!Te(i,!1))if("SLOT"===i.tagName){var a=i.assignedElements(),s=a.length?a:i.children,l=Ae(s,!0,o);o.flatten?n.push.apply(n,l):n.push({scopeParent:i,candidates:l})}else{_e.call(i,Se)&&o.filter(i)&&(t||!e.includes(i))&&n.push(i);var c=i.shadowRoot||"function"==typeof o.getShadowRoot&&o.getShadowRoot(i),u=!Te(c,!1)&&(!o.shadowRootFilter||o.shadowRootFilter(i));if(c&&u){var d=Ae(!0===c?i.children:c.children,!0,o);o.flatten?n.push.apply(n,d):n.push({scopeParent:i,candidates:d})}else r.unshift.apply(r,i.children)}}return n},Ie=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},Me=function(e){if(!e)throw new Error("No node provided");return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||function(e){var t,o=null==e||null===(t=e.getAttribute)||void 0===t?void 0:t.call(e,"contenteditable");return""===o||"true"===o}(e))&&!Ie(e)?0:e.tabIndex},Le=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},De=function(e){return"INPUT"===e.tagName},Be=function(e){return function(e){return De(e)&&"radio"===e.type}(e)&&!function(e){if(!e.name)return!0;var t,o=e.form||Re(e),n=function(e){return o.querySelectorAll('input[type="radio"][name="'+e+'"]')};if("undefined"!=typeof window&&void 0!==window.CSS&&"function"==typeof window.CSS.escape)t=n(window.CSS.escape(e.name));else try{t=n(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 o=0;o<e.length;o++)if(e[o].checked&&e[o].form===t)return e[o]}(t,e.form);return!r||r===e}(e)},ze=function(e){var t=e.getBoundingClientRect(),o=t.width,n=t.height;return 0===o&&0===n},Fe=function(e,t){var o=t.displayCheck,n=t.getShadowRoot;if("full-native"===o&&"checkVisibility"in e)return!e.checkVisibility({checkOpacity:!1,opacityProperty:!1,contentVisibilityAuto:!0,visibilityProperty:!0,checkVisibilityCSS:!0});if("hidden"===getComputedStyle(e).visibility)return!0;var r=_e.call(e,"details>summary:first-of-type")?e.parentElement:e;if(_e.call(r,"details:not([open]) *"))return!0;if(o&&"full"!==o&&"full-native"!==o&&"legacy-full"!==o){if("non-zero-area"===o)return ze(e)}else{if("function"==typeof n){for(var i=e;e;){var a=e.parentElement,s=Re(e);if(a&&!a.shadowRoot&&!0===n(a))return ze(e);e=e.assignedSlot?e.assignedSlot:a||s===e.ownerDocument?a:s.host}e=i}if(function(e){var t,o,n,r,i=e&&Re(e),a=null===(t=i)||void 0===t?void 0:t.host,s=!1;if(i&&i!==e)for(s=!!(null!==(o=a)&&void 0!==o&&null!==(n=o.ownerDocument)&&void 0!==n&&n.contains(a)||null!=e&&null!==(r=e.ownerDocument)&&void 0!==r&&r.contains(e));!s&&a;){var l,c,u;s=!(null===(c=a=null===(l=i=Re(a))||void 0===l?void 0:l.host)||void 0===c||null===(u=c.ownerDocument)||void 0===u||!u.contains(a))}return s}(e))return!e.getClientRects().length;if("legacy-full"!==o)return!0}return!1},qe=function(e,t){return!(t.disabled||function(e){return De(e)&&"hidden"===e.type}(t)||Fe(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 o=0;o<t.children.length;o++){var n=t.children.item(o);if("LEGEND"===n.tagName)return!!_e.call(t,"fieldset[disabled] *")||!n.contains(e)}return!0}t=t.parentElement}return!1}(t))},$e=function(e,t){return!(Be(t)||Me(t)<0||!qe(e,t))},Ve=function(e){var t=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(t)||t>=0)},He=function(e){var t=[],o=[];return e.forEach(function(e,n){var r=!!e.scopeParent,i=r?e.scopeParent:e,a=function(e,t){var o=Me(e);return o<0&&t&&!Ie(e)?0:o}(i,r),s=r?He(e.candidates):i;0===a?r?t.push.apply(t,s):t.push(i):o.push({documentOrder:n,tabIndex:a,item:e,isScope:r,content:s})}),o.sort(Le).reduce(function(e,t){return t.isScope?e.push.apply(e,t.content):e.push(t.content),e},[]).concat(t)},We=function(e,t){var o;return o=(t=t||{}).getShadowRoot?Ae([e],t.includeContainer,{filter:$e.bind(null,t),flatten:!1,getShadowRoot:t.getShadowRoot,shadowRootFilter:Ve}):function(e,t,o){if(Te(e))return[];var n=Array.prototype.slice.apply(e.querySelectorAll(Se));return t&&_e.call(e,Se)&&n.unshift(e),n.filter(o)}(e,t.includeContainer,$e.bind(null,t)),He(o)};function Ge(e,t,o){let{reference:n,floating:r}=e;const i=ve(t),a=be(t),s=me(a),l=pe(t),c="y"===i,u=n.x+n.width/2-r.width/2,d=n.y+n.height/2-r.height/2,p=n[s]/2-r[s]/2;let f;switch(l){case"top":f={x:u,y:n.y-r.height};break;case"bottom":f={x:u,y:n.y+n.height};break;case"right":f={x:n.x+n.width,y:d};break;case"left":f={x:n.x-r.width,y:d};break;default:f={x:n.x,y:n.y}}switch(fe(t)){case"start":f[a]-=p*(o&&c?-1:1);break;case"end":f[a]+=p*(o&&c?-1:1)}return f}async function Xe(e,t){var o;void 0===t&&(t={});const{x:n,y:r,platform:i,rects:a,elements:s,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:d="floating",altBoundary:p=!1,padding:f=0}=de(t,e),h=je(f),m=s[p?"floating"===d?"reference":"floating":d],g=Ne(await i.getClippingRect({element:null==(o=await(null==i.isElement?void 0:i.isElement(m)))||o?m:m.contextElement||await(null==i.getDocumentElement?void 0:i.getDocumentElement(s.floating)),boundary:c,rootBoundary:u,strategy:l})),v="floating"===d?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,b=await(null==i.getOffsetParent?void 0:i.getOffsetParent(s.floating)),y=await(null==i.isElement?void 0:i.isElement(b))&&await(null==i.getScale?void 0:i.getScale(b))||{x:1,y:1},x=Ne(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:v,offsetParent:b,strategy:l}):v);return{top:(g.top-x.top+h.top)/y.y,bottom:(x.bottom-g.bottom+h.bottom)/y.y,left:(g.left-x.left+h.left)/y.x,right:(x.right-g.right+h.right)/y.x}}function Ye(e){const t=ne(...e.map(e=>e.left)),o=ne(...e.map(e=>e.top));return{x:t,y:o,width:re(...e.map(e=>e.right))-t,height:re(...e.map(e=>e.bottom))-o}}const Ue=new Set(["left","top"]);function Ke(e){const t=Z(e);let o=parseFloat(t.width)||0,n=parseFloat(t.height)||0;const r=M(e),i=r?e.offsetWidth:o,a=r?e.offsetHeight:n,s=ie(o)!==i||ie(n)!==a;return s&&(o=i,n=a),{width:o,height:n,$:s}}function Ze(e){return I(e)?e:e.contextElement}function Je(e){const t=Ze(e);if(!M(t))return se(1);const o=t.getBoundingClientRect(),{width:n,height:r,$:i}=Ke(t);let a=(i?ie(o.width):o.width)/n,s=(i?ie(o.height):o.height)/r;return a&&Number.isFinite(a)||(a=1),s&&Number.isFinite(s)||(s=1),{x:a,y:s}}const Qe=se(0);function et(e){const t=R(e);return Y()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:Qe}function tt(e,t,o,n){void 0===t&&(t=!1),void 0===o&&(o=!1);const r=e.getBoundingClientRect(),i=Ze(e);let a=se(1);t&&(n?I(n)&&(a=Je(n)):a=Je(e));const s=function(e,t,o){return void 0===t&&(t=!1),!(!o||t&&o!==R(e))&&t}(i,o,n)?et(i):se(0);let l=(r.left+s.x)/a.x,c=(r.top+s.y)/a.y,u=r.width/a.x,d=r.height/a.y;if(i){const e=R(i),t=n&&I(n)?R(n):n;let o=e,r=oe(o);for(;r&&n&&t!==o;){const e=Je(r),t=r.getBoundingClientRect(),n=Z(r),i=t.left+(r.clientLeft+parseFloat(n.paddingLeft))*e.x,a=t.top+(r.clientTop+parseFloat(n.paddingTop))*e.y;l*=e.x,c*=e.y,u*=e.x,d*=e.y,l+=i,c+=a,o=R(r),r=oe(o)}}return Ne({width:u,height:d,x:l,y:c})}function ot(e,t){const o=J(e).scrollLeft;return t?t.left+o:tt(T(e)).left+o}function nt(e,t){const o=e.getBoundingClientRect();return{x:o.left+t.scrollLeft-ot(e,o),y:o.top+t.scrollTop}}const rt=new Set(["absolute","fixed"]);function it(e,t,o){let n;if("viewport"===t)n=function(e,t){const o=R(e),n=T(e),r=o.visualViewport;let i=n.clientWidth,a=n.clientHeight,s=0,l=0;if(r){i=r.width,a=r.height;const e=Y();(!e||e&&"fixed"===t)&&(s=r.offsetLeft,l=r.offsetTop)}const c=ot(n);if(c<=0){const e=n.ownerDocument,t=e.body,o=getComputedStyle(t),r="CSS1Compat"===e.compatMode&&parseFloat(o.marginLeft)+parseFloat(o.marginRight)||0,a=Math.abs(n.clientWidth-t.clientWidth-r);a<=25&&(i-=a)}else c<=25&&(i+=c);return{width:i,height:a,x:s,y:l}}(e,o);else if("document"===t)n=function(e){const t=T(e),o=J(e),n=e.ownerDocument.body,r=re(t.scrollWidth,t.clientWidth,n.scrollWidth,n.clientWidth),i=re(t.scrollHeight,t.clientHeight,n.scrollHeight,n.clientHeight);let a=-o.scrollLeft+ot(e);const s=-o.scrollTop;return"rtl"===Z(n).direction&&(a+=re(t.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:s}}(T(e));else if(I(t))n=function(e,t){const o=tt(e,!0,"fixed"===t),n=o.top+e.clientTop,r=o.left+e.clientLeft,i=M(e)?Je(e):se(1);return{width:e.clientWidth*i.x,height:e.clientHeight*i.y,x:r*i.x,y:n*i.y}}(t,o);else{const o=et(e);n={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return Ne(n)}function at(e,t){const o=Q(e);return!(o===t||!I(o)||K(o))&&("fixed"===Z(o).position||at(o,t))}function st(e,t,o){const n=M(t),r=T(t),i="fixed"===o,a=tt(e,!0,i,t);let s={scrollLeft:0,scrollTop:0};const l=se(0);function c(){l.x=ot(r)}if(n||!n&&!i)if(("body"!==_(t)||B(r))&&(s=J(t)),n){const e=tt(t,!0,i,t);l.x=e.x+t.clientLeft,l.y=e.y+t.clientTop}else r&&c();i&&!n&&r&&c();const u=!r||n||i?se(0):nt(r,s);return{x:a.left+s.scrollLeft-l.x-u.x,y:a.top+s.scrollTop-l.y-u.y,width:a.width,height:a.height}}function lt(e){return"static"===Z(e).position}function ct(e,t){if(!M(e)||"fixed"===Z(e).position)return null;if(t)return t(e);let o=e.offsetParent;return T(e)===o&&(o=o.ownerDocument.body),o}function ut(e,t){const o=R(e);if(V(e))return o;if(!M(e)){let t=Q(e);for(;t&&!K(t);){if(I(t)&&!lt(t))return t;t=Q(t)}return o}let n=ct(e,t);for(;n&&q(n)&<(n);)n=ct(n,t);return n&&K(n)&<(n)&&!X(n)?o:n||function(e){let t=Q(e);for(;M(t)&&!K(t);){if(X(t))return t;if(V(t))return null;t=Q(t)}return null}(e)||o}const dt={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:o,offsetParent:n,strategy:r}=e;const i="fixed"===r,a=T(n),s=!!t&&V(t.floating);if(n===a||s&&i)return o;let l={scrollLeft:0,scrollTop:0},c=se(1);const u=se(0),d=M(n);if((d||!d&&!i)&&(("body"!==_(n)||B(a))&&(l=J(n)),M(n))){const e=tt(n);c=Je(n),u.x=e.x+n.clientLeft,u.y=e.y+n.clientTop}const p=!a||d||i?se(0):nt(a,l);return{width:o.width*c.x,height:o.height*c.y,x:o.x*c.x-l.scrollLeft*c.x+u.x+p.x,y:o.y*c.y-l.scrollTop*c.y+u.y+p.y}},getDocumentElement:T,getClippingRect:function(e){let{element:t,boundary:o,rootBoundary:n,strategy:r}=e;const i=[..."clippingAncestors"===o?V(t)?[]:function(e,t){const o=t.get(e);if(o)return o;let n=te(e,[],!1).filter(e=>I(e)&&"body"!==_(e)),r=null;const i="fixed"===Z(e).position;let a=i?Q(e):e;for(;I(a)&&!K(a);){const t=Z(a),o=X(a);o||"fixed"!==t.position||(r=null),(i?!o&&!r:!o&&"static"===t.position&&r&&rt.has(r.position)||B(a)&&!o&&at(e,a))?n=n.filter(e=>e!==a):r=t,a=Q(a)}return t.set(e,n),n}(t,this._c):[].concat(o),n],a=i[0],s=i.reduce((e,o)=>{const n=it(t,o,r);return e.top=re(n.top,e.top),e.right=ne(n.right,e.right),e.bottom=ne(n.bottom,e.bottom),e.left=re(n.left,e.left),e},it(t,a,r));return{width:s.right-s.left,height:s.bottom-s.top,x:s.left,y:s.top}},getOffsetParent:ut,getElementRects:async function(e){const t=this.getOffsetParent||ut,o=this.getDimensions,n=await o(e.floating);return{reference:st(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}},getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){const{width:t,height:o}=Ke(e);return{width:t,height:o}},getScale:Je,isElement:I,isRTL:function(e){return"rtl"===Z(e).direction}};function pt(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function ft(e,t,o,n){void 0===n&&(n={});const{ancestorScroll:r=!0,ancestorResize:i=!0,elementResize:a="function"==typeof ResizeObserver,layoutShift:s="function"==typeof IntersectionObserver,animationFrame:l=!1}=n,c=Ze(e),u=r||i?[...c?te(c):[],...te(t)]:[];u.forEach(e=>{r&&e.addEventListener("scroll",o,{passive:!0}),i&&e.addEventListener("resize",o)});const d=c&&s?function(e,t){let o,n=null;const r=T(e);function i(){var e;clearTimeout(o),null==(e=n)||e.disconnect(),n=null}return function a(s,l){void 0===s&&(s=!1),void 0===l&&(l=1),i();const c=e.getBoundingClientRect(),{left:u,top:d,width:p,height:f}=c;if(s||t(),!p||!f)return;const h={rootMargin:-ae(d)+"px "+-ae(r.clientWidth-(u+p))+"px "+-ae(r.clientHeight-(d+f))+"px "+-ae(u)+"px",threshold:re(0,ne(1,l))||1};let m=!0;function g(t){const n=t[0].intersectionRatio;if(n!==l){if(!m)return a();n?a(!1,n):o=setTimeout(()=>{a(!1,1e-7)},1e3)}1!==n||pt(c,e.getBoundingClientRect())||a(),m=!1}try{n=new IntersectionObserver(g,{...h,root:r.ownerDocument})}catch(e){n=new IntersectionObserver(g,h)}n.observe(e)}(!0),i}(c,o):null;let p,f=-1,h=null;a&&(h=new ResizeObserver(e=>{let[n]=e;n&&n.target===c&&h&&(h.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;null==(e=h)||e.observe(t)})),o()}),c&&!l&&h.observe(c),h.observe(t));let m=l?tt(e):null;return l&&function t(){const n=tt(e);m&&!pt(m,n)&&o();m=n,p=requestAnimationFrame(t)}(),o(),()=>{var e;u.forEach(e=>{r&&e.removeEventListener("scroll",o),i&&e.removeEventListener("resize",o)}),null==d||d(),null==(e=h)||e.disconnect(),h=null,l&&cancelAnimationFrame(p)}}const ht=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var o,n;const{x:r,y:i,placement:a,middlewareData:s}=t,l=await async function(e,t){const{placement:o,platform:n,elements:r}=e,i=await(null==n.isRTL?void 0:n.isRTL(r.floating)),a=pe(o),s=fe(o),l="y"===ve(o),c=Ue.has(a)?-1:1,u=i&&l?-1:1,d=de(t,e);let{mainAxis:p,crossAxis:f,alignmentAxis:h}="number"==typeof d?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&"number"==typeof h&&(f="end"===s?-1*h:h),l?{x:f*u,y:p*c}:{x:p*c,y:f*u}}(t,e);return a===(null==(o=s.offset)?void 0:o.placement)&&null!=(n=s.arrow)&&n.alignmentOffset?{}:{x:r+l.x,y:i+l.y,data:{...l,placement:a}}}}},mt=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){const{x:o,y:n,placement:r}=t,{mainAxis:i=!0,crossAxis:a=!1,limiter:s={fn:e=>{let{x:t,y:o}=e;return{x:t,y:o}}},...l}=de(e,t),c={x:o,y:n},u=await Xe(t,l),d=ve(pe(r)),p=he(d);let f=c[p],h=c[d];if(i){const e="y"===p?"bottom":"right";f=ue(f+u["y"===p?"top":"left"],f,f-u[e])}if(a){const e="y"===d?"bottom":"right";h=ue(h+u["y"===d?"top":"left"],h,h-u[e])}const m=s.fn({...t,[p]:f,[d]:h});return{...m,data:{x:m.x-o,y:m.y-n,enabled:{[p]:i,[d]:a}}}}}},gt=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var o,n;const{placement:r,middlewareData:i,rects:a,initialPlacement:s,platform:l,elements:c}=t,{mainAxis:u=!0,crossAxis:d=!0,fallbackPlacements:p,fallbackStrategy:f="bestFit",fallbackAxisSideDirection:h="none",flipAlignment:m=!0,...g}=de(e,t);if(null!=(o=i.arrow)&&o.alignmentOffset)return{};const v=pe(r),b=ve(s),y=pe(s)===s,x=await(null==l.isRTL?void 0:l.isRTL(c.floating)),w=p||(y||!m?[Ce(s)]:function(e){const t=Ce(e);return[ye(e),t,ye(t)]}(s)),k="none"!==h;!p&&k&&w.push(...Ee(s,m,h,x));const O=[s,...w],E=await Xe(t,g),C=[];let j=(null==(n=i.flip)?void 0:n.overflows)||[];if(u&&C.push(E[v]),d){const e=function(e,t,o){void 0===o&&(o=!1);const n=fe(e),r=be(e),i=me(r);let a="x"===r?n===(o?"end":"start")?"right":"left":"start"===n?"bottom":"top";return t.reference[i]>t.floating[i]&&(a=Ce(a)),[a,Ce(a)]}(r,a,x);C.push(E[e[0]],E[e[1]])}if(j=[...j,{placement:r,overflows:C}],!C.every(e=>e<=0)){var N,S;const e=((null==(N=i.flip)?void 0:N.index)||0)+1,t=O[e];if(t){if(!("alignment"===d&&b!==ve(t))||j.every(e=>ve(e.placement)!==b||e.overflows[0]>0))return{data:{index:e,overflows:j},reset:{placement:t}}}let o=null==(S=j.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0])?void 0:S.placement;if(!o)switch(f){case"bestFit":{var P;const e=null==(P=j.filter(e=>{if(k){const t=ve(e.placement);return t===b||"y"===t}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0])?void 0:P[0];e&&(o=e);break}case"initialPlacement":o=s}if(r!==o)return{reset:{placement:o}}}return{}}}},vt=function(e){return void 0===e&&(e={}),{name:"size",options:e,async fn(t){var o,n;const{placement:r,rects:i,platform:a,elements:s}=t,{apply:l=()=>{},...c}=de(e,t),u=await Xe(t,c),d=pe(r),p=fe(r),f="y"===ve(r),{width:h,height:m}=i.floating;let g,v;"top"===d||"bottom"===d?(g=d,v=p===(await(null==a.isRTL?void 0:a.isRTL(s.floating))?"start":"end")?"left":"right"):(v=d,g="end"===p?"top":"bottom");const b=m-u.top-u.bottom,y=h-u.left-u.right,x=ne(m-u[g],b),w=ne(h-u[v],y),k=!t.middlewareData.shift;let O=x,E=w;if(null!=(o=t.middlewareData.shift)&&o.enabled.x&&(E=y),null!=(n=t.middlewareData.shift)&&n.enabled.y&&(O=b),k&&!p){const e=re(u.left,0),t=re(u.right,0),o=re(u.top,0),n=re(u.bottom,0);f?E=h-2*(0!==e||0!==t?e+t:re(u.left,u.right)):O=m-2*(0!==o||0!==n?o+n:re(u.top,u.bottom))}await l({...t,availableWidth:E,availableHeight:O});const C=await a.getDimensions(s.floating);return h!==C.width||m!==C.height?{reset:{rects:!0}}:{}}}},bt=function(e){return void 0===e&&(e={}),{name:"inline",options:e,async fn(t){const{placement:o,elements:n,rects:r,platform:i,strategy:a}=t,{padding:s=2,x:l,y:c}=de(e,t),u=Array.from(await(null==i.getClientRects?void 0:i.getClientRects(n.reference))||[]),d=function(e){const t=e.slice().sort((e,t)=>e.y-t.y),o=[];let n=null;for(let e=0;e<t.length;e++){const r=t[e];!n||r.y-n.y>n.height/2?o.push([r]):o[o.length-1].push(r),n=r}return o.map(e=>Ne(Ye(e)))}(u),p=Ne(Ye(u)),f=je(s);const h=await i.getElementRects({reference:{getBoundingClientRect:function(){if(2===d.length&&d[0].left>d[1].right&&null!=l&&null!=c)return d.find(e=>l>e.left-f.left&&l<e.right+f.right&&c>e.top-f.top&&c<e.bottom+f.bottom)||p;if(d.length>=2){if("y"===ve(o)){const e=d[0],t=d[d.length-1],n="top"===pe(o),r=e.top,i=t.bottom,a=n?e.left:t.left,s=n?e.right:t.right;return{top:r,bottom:i,left:a,right:s,width:s-a,height:i-r,x:a,y:r}}const e="left"===pe(o),t=re(...d.map(e=>e.right)),n=ne(...d.map(e=>e.left)),r=d.filter(o=>e?o.left===n:o.right===t),i=r[0].top,a=r[r.length-1].bottom;return{top:i,bottom:a,left:n,right:t,width:t-n,height:a-i,x:n,y:i}}return p}},floating:n.floating,strategy:a});return r.reference.x!==h.reference.x||r.reference.y!==h.reference.y||r.reference.width!==h.reference.width||r.reference.height!==h.reference.height?{reset:{rects:h}}:{}}}},yt=(e,t,o)=>{const n=new Map,r={platform:dt,...o},i={...r.platform,_c:n};return(async(e,t,o)=>{const{placement:n="bottom",strategy:r="absolute",middleware:i=[],platform:a}=o,s=i.filter(Boolean),l=await(null==a.isRTL?void 0:a.isRTL(t));let c=await a.getElementRects({reference:e,floating:t,strategy:r}),{x:u,y:d}=Ge(c,n,l),p=n,f={},h=0;for(let o=0;o<s.length;o++){const{name:i,fn:m}=s[o],{x:g,y:v,data:b,reset:y}=await m({x:u,y:d,initialPlacement:n,placement:p,strategy:r,middlewareData:f,rects:c,platform:a,elements:{reference:e,floating:t}});u=null!=g?g:u,d=null!=v?v:d,f={...f,[i]:{...f[i],...b}},y&&h<=50&&(h++,"object"==typeof y&&(y.placement&&(p=y.placement),y.rects&&(c=!0===y.rects?await a.getElementRects({reference:e,floating:t,strategy:r}):y.rects),({x:u,y:d}=Ge(c,p,l))),o=-1)}return{x:u,y:d,placement:p,strategy:r,middlewareData:f}})(e,t,{...r,platform:i})};var xt="undefined"!=typeof document?s:function(){};function wt(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if("function"==typeof e&&e.toString()===t.toString())return!0;let o,n,r;if(e&&t&&"object"==typeof e){if(Array.isArray(e)){if(o=e.length,o!==t.length)return!1;for(n=o;0!==n--;)if(!wt(e[n],t[n]))return!1;return!0}if(r=Object.keys(e),o=r.length,o!==Object.keys(t).length)return!1;for(n=o;0!==n--;)if(!{}.hasOwnProperty.call(t,r[n]))return!1;for(n=o;0!==n--;){const o=r[n];if(("_owner"!==o||!e.$$typeof)&&!wt(e[o],t[o]))return!1}return!0}return e!=e&&t!=t}function kt(e){if("undefined"==typeof window)return 1;return(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Ot(e,t){const o=kt(e);return Math.round(t*o)/o}function Et(e){const t=r.useRef(e);return xt(()=>{t.current=e}),t}const Ct=(e,t)=>({...ht(e),options:[e,t]}),jt=(e,t)=>({...mt(e),options:[e,t]}),Nt=(e,t)=>({...gt(e),options:[e,t]}),St=(e,t)=>({...bt(e),options:[e,t]}),Pt={...r},_t=Pt.useInsertionEffect||(e=>e());var Rt="undefined"!=typeof document?s:l;function Tt(){return Tt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var n in o)Object.prototype.hasOwnProperty.call(o,n)&&(e[n]=o[n])}return e},Tt.apply(this,arguments)}let At=!1,It=0;const Mt=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+It++;const Lt=Pt.useId||function(){const[e,t]=r.useState(()=>At?Mt():void 0);return Rt(()=>{null==e&&t(Mt())},[]),r.useEffect(()=>{At=!0},[]),e};const Dt=r.createContext(null),Bt=r.createContext(null);function zt(e){return"data-floating-ui-"+e}function Ft(e){const t=c(e);return Rt(()=>{t.current=e}),t}const qt=()=>({getShadowRoot:!0,displayCheck:"function"==typeof ResizeObserver&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function $t(e,t){const o=We(e,qt());"prev"===t&&o.reverse();const n=o.indexOf(function(e){let t=e.activeElement;for(;null!=(null==(o=t)||null==(o=o.shadowRoot)?void 0:o.activeElement);){var o;t=t.shadowRoot.activeElement}return t}((null==(r=e)?void 0:r.ownerDocument)||document));var r;return o.slice(n+1)[0]}function Vt(e,t){const o=t||e.currentTarget,n=e.relatedTarget;return!n||!function(e,t){if(!e||!t)return!1;const o=null==t.getRootNode?void 0:t.getRootNode();if(e.contains(t))return!0;if(o&&L(o)){let o=t;for(;o;){if(e===o)return!0;o=o.parentNode||o.host}}return!1}(o,n)}function Ht(e){We(e,qt()).forEach(e=>{e.dataset.tabindex=e.getAttribute("tabindex")||"",e.setAttribute("tabindex","-1")})}function Wt(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 Gt={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 Xt(e){"Tab"===e.key&&(e.target,clearTimeout(undefined))}const Yt=r.forwardRef(function(e,t){const[o,n]=r.useState();Rt(()=>(/apple/i.test(navigator.vendor)&&n("button"),document.addEventListener("keydown",Xt),()=>{document.removeEventListener("keydown",Xt)}),[]);const i={ref:t,tabIndex:0,role:o,"aria-hidden":!o||void 0,[zt("focus-guard")]:"",style:Gt};return r.createElement("span",Tt({},e,i))}),Ut=r.createContext(null),Kt=zt("portal");function Zt(e){const{children:t,id:o,root:n,preserveTabOrder:i=!0}=e,a=function(e){void 0===e&&(e={});const{id:t,root:o}=e,n=Lt(),i=Jt(),[a,s]=r.useState(null),l=r.useRef(null);return Rt(()=>()=>{null==a||a.remove(),queueMicrotask(()=>{l.current=null})},[a]),Rt(()=>{if(!n)return;if(l.current)return;const e=t?document.getElementById(t):null;if(!e)return;const o=document.createElement("div");o.id=n,o.setAttribute(Kt,""),e.appendChild(o),l.current=o,s(o)},[t,n]),Rt(()=>{if(null===o)return;if(!n)return;if(l.current)return;let e=o||(null==i?void 0:i.portalNode);e&&!I(e)&&(e=e.current),e=e||document.body;let r=null;t&&(r=document.createElement("div"),r.id=t,e.appendChild(r));const a=document.createElement("div");a.id=n,a.setAttribute(Kt,""),e=r||e,e.appendChild(a),l.current=a,s(a)},[t,o,n,i]),a}({id:o,root:n}),[s,l]=r.useState(null),c=r.useRef(null),u=r.useRef(null),d=r.useRef(null),p=r.useRef(null),f=null==s?void 0:s.modal,h=null==s?void 0:s.open,m=!!s&&!s.modal&&s.open&&i&&!(!n&&!a);return r.useEffect(()=>{if(a&&i&&!f)return a.addEventListener("focusin",e,!0),a.addEventListener("focusout",e,!0),()=>{a.removeEventListener("focusin",e,!0),a.removeEventListener("focusout",e,!0)};function e(e){if(a&&Vt(e)){("focusin"===e.type?Wt:Ht)(a)}}},[a,i,f]),r.useEffect(()=>{a&&(h||Wt(a))},[h,a]),r.createElement(Ut.Provider,{value:r.useMemo(()=>({preserveTabOrder:i,beforeOutsideRef:c,afterOutsideRef:u,beforeInsideRef:d,afterInsideRef:p,portalNode:a,setFocusManagerState:l}),[i,a])},m&&a&&r.createElement(Yt,{"data-type":"outside",ref:c,onFocus:e=>{if(Vt(e,a)){var t;null==(t=d.current)||t.focus()}else{const e=$t(document.body,"prev")||(null==s?void 0:s.refs.domReference.current);null==e||e.focus()}}}),m&&a&&r.createElement("span",{"aria-owns":a.id,style:Gt}),a&&x.createPortal(t,a),m&&a&&r.createElement(Yt,{"data-type":"outside",ref:u,onFocus:e=>{if(Vt(e,a)){var t;null==(t=p.current)||t.focus()}else{const t=$t(document.body,"next")||(null==s?void 0:s.refs.domReference.current);null==t||t.focus(),(null==s?void 0:s.closeOnFocusOut)&&(null==s||s.onOpenChange(!1,e.nativeEvent,"focus-out"))}}}))}const Jt=()=>r.useContext(Ut);let Qt=0;function eo(){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",n=window.innerWidth-document.documentElement.clientWidth,r=t.left?parseFloat(t.left):window.scrollX,i=t.top?parseFloat(t.top):window.scrollY;if(t.overflow="hidden",n&&(t[o]=n+"px"),e){var a,s;const e=(null==(a=window.visualViewport)?void 0:a.offsetLeft)||0,o=(null==(s=window.visualViewport)?void 0:s.offsetTop)||0;Object.assign(t,{position:"fixed",top:-(i-Math.floor(o))+"px",left:-(r-Math.floor(e))+"px",right:"0"})}return()=>{Object.assign(t,{overflow:"",[o]:""}),e&&(Object.assign(t,{position:"",top:"",left:"",right:""}),window.scrollTo(r,i))}}let to=()=>{};const oo=r.forwardRef(function(e,t){const{lockScroll:o=!1,...n}=e;return Rt(()=>{if(o)return Qt++,1===Qt&&(to=eo()),()=>{Qt--,0===Qt&&to()}},[o]),r.createElement("div",Tt({ref:t},n,{style:{position:"fixed",overflow:"auto",top:0,right:0,bottom:0,left:0,...n.style}}))});function no(e){const{open:t=!1,onOpenChange:o,elements:n}=e,i=Lt(),a=r.useRef({}),[s]=r.useState(()=>function(){const e=new Map;return{emit(t,o){var n;null==(n=e.get(t))||n.forEach(e=>e(o))},on(t,o){e.set(t,[...e.get(t)||[],o])},off(t,o){var n;e.set(t,(null==(n=e.get(t))?void 0:n.filter(e=>e!==o))||[])}}}()),l=null!=((null==(c=r.useContext(Dt))?void 0:c.id)||null);var c;const[u,d]=r.useState(n.reference),p=function(e){const t=r.useRef(()=>{});return _t(()=>{t.current=e}),r.useCallback(function(){for(var e=arguments.length,o=new Array(e),n=0;n<e;n++)o[n]=arguments[n];return null==t.current?void 0:t.current(...o)},[])}((e,t,n)=>{a.current.openEvent=e?t:void 0,s.emit("openchange",{open:e,event:t,reason:n,nested:l}),null==o||o(e,t,n)}),f=r.useMemo(()=>({setPositionReference:d}),[]),h=r.useMemo(()=>({reference:u||n.reference||null,floating:n.floating||null,domReference:n.reference}),[u,n.reference,n.floating]);return r.useMemo(()=>({dataRef:a,open:t,onOpenChange:p,elements:h,events:s,floatingId:i,refs:f}),[t,p,h,s,i,f])}function ro(e){void 0===e&&(e={});const{nodeId:t}=e,o=no({...e,elements:{reference:null,floating:null,...e.elements}}),n=e.rootContext||o,i=n.elements,[a,s]=r.useState(null),[l,c]=r.useState(null),u=(null==i?void 0:i.domReference)||a,d=r.useRef(null),p=r.useContext(Bt);Rt(()=>{u&&(d.current=u)},[u]);const f=function(e){void 0===e&&(e={});const{placement:t="bottom",strategy:o="absolute",middleware:n=[],platform:i,elements:{reference:a,floating:s}={},transform:l=!0,whileElementsMounted:c,open:u}=e,[d,p]=r.useState({x:0,y:0,strategy:o,placement:t,middlewareData:{},isPositioned:!1}),[f,h]=r.useState(n);wt(f,n)||h(n);const[m,g]=r.useState(null),[v,b]=r.useState(null),y=r.useCallback(e=>{e!==E.current&&(E.current=e,g(e))},[]),w=r.useCallback(e=>{e!==C.current&&(C.current=e,b(e))},[]),k=a||m,O=s||v,E=r.useRef(null),C=r.useRef(null),j=r.useRef(d),N=null!=c,S=Et(c),P=Et(i),_=Et(u),R=r.useCallback(()=>{if(!E.current||!C.current)return;const e={placement:t,strategy:o,middleware:f};P.current&&(e.platform=P.current),yt(E.current,C.current,e).then(e=>{const t={...e,isPositioned:!1!==_.current};T.current&&!wt(j.current,t)&&(j.current=t,x.flushSync(()=>{p(t)}))})},[f,t,o,P,_]);xt(()=>{!1===u&&j.current.isPositioned&&(j.current.isPositioned=!1,p(e=>({...e,isPositioned:!1})))},[u]);const T=r.useRef(!1);xt(()=>(T.current=!0,()=>{T.current=!1}),[]),xt(()=>{if(k&&(E.current=k),O&&(C.current=O),k&&O){if(S.current)return S.current(k,O,R);R()}},[k,O,R,S,N]);const A=r.useMemo(()=>({reference:E,floating:C,setReference:y,setFloating:w}),[y,w]),I=r.useMemo(()=>({reference:k,floating:O}),[k,O]),M=r.useMemo(()=>{const e={position:o,left:0,top:0};if(!I.floating)return e;const t=Ot(I.floating,d.x),n=Ot(I.floating,d.y);return l?{...e,transform:"translate("+t+"px, "+n+"px)",...kt(I.floating)>=1.5&&{willChange:"transform"}}:{position:o,left:t,top:n}},[o,l,I.floating,d.x,d.y]);return r.useMemo(()=>({...d,update:R,refs:A,elements:I,floatingStyles:M}),[d,R,A,I,M])}({...e,elements:{...i,...l&&{reference:l}}}),h=r.useCallback(e=>{const t=I(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),contextElement:e}:e;c(t),f.refs.setReference(t)},[f.refs]),m=r.useCallback(e=>{(I(e)||null===e)&&(d.current=e,s(e)),(I(f.refs.reference.current)||null===f.refs.reference.current||null!==e&&!I(e))&&f.refs.setReference(e)},[f.refs]),g=r.useMemo(()=>({...f.refs,setReference:m,setPositionReference:h,domReference:d}),[f.refs,m,h]),v=r.useMemo(()=>({...f.elements,domReference:u}),[f.elements,u]),b=r.useMemo(()=>({...f,...n,refs:g,elements:v,nodeId:t}),[f,g,v,t,n]);return Rt(()=>{n.dataRef.current.floatingContext=b;const e=null==p?void 0:p.nodesRef.current.find(e=>e.id===t);e&&(e.context=b)}),r.useMemo(()=>({...f,context:b,refs:g,elements:v}),[f,g,v,b])}const io=e=>e.replace(/[A-Z]+(?![a-z])|[A-Z]/g,(e,t)=>(t?"-":"")+e.toLowerCase());function ao(e,t){return"function"==typeof e?e(t):e}function so(e,t){void 0===t&&(t={});const{open:o,elements:{floating:n}}=e,{duration:i=250}=t,a=("number"==typeof i?i:i.close)||0,[s,l]=r.useState("unmounted"),c=function(e,t){const[o,n]=r.useState(e);return e&&!o&&n(!0),r.useEffect(()=>{if(!e&&o){const e=setTimeout(()=>n(!1),t);return()=>clearTimeout(e)}},[e,o,t]),o}(o,a);return c||"close"!==s||l("unmounted"),Rt(()=>{if(n){if(o){l("initial");const e=requestAnimationFrame(()=>{l("open")});return()=>{cancelAnimationFrame(e)}}l("close")}},[o,n]),{isMounted:c,status:s}}function lo(e,t){void 0===t&&(t={});const{initial:o={opacity:0},open:n,close:i,common:a,duration:s=250}=t,l=e.placement,c=l.split("-")[0],u=r.useMemo(()=>({side:c,placement:l}),[c,l]),d="number"==typeof s,p=(d?s:s.open)||0,f=(d?s:s.close)||0,[h,m]=r.useState(()=>({...ao(a,u),...ao(o,u)})),{isMounted:g,status:v}=so(e,{duration:s}),b=Ft(o),y=Ft(n),x=Ft(i),w=Ft(a);return Rt(()=>{const e=ao(b.current,u),t=ao(x.current,u),o=ao(w.current,u),n=ao(y.current,u)||Object.keys(e).reduce((e,t)=>(e[t]="",e),{});if("initial"===v&&m(t=>({transitionProperty:t.transitionProperty,...o,...e})),"open"===v&&m({transitionProperty:Object.keys(n).map(io).join(","),transitionDuration:p+"ms",...o,...n}),"close"===v){const n=t||e;m({transitionProperty:Object.keys(n).map(io).join(","),transitionDuration:f+"ms",...o,...n})}},[f,x,b,y,w,p,v,u]),{isMounted:g,styles:h}}const co=e()(e=>({blockId:null,state:"closed",reference:null,open(t){const{reference:o,blockId:n}=t;e({state:"open",reference:o,blockId:n||null})},close(){e({state:"closed",reference:null,blockId:null})},toggle(t,o,n){e("closed"===t?{state:"closed",reference:null,blockId:null}:e=>Object.assign(Object.assign({},e),{state:t,reference:void 0!==o?o:e.reference,blockId:void 0!==n?n:e.blockId}))},setReference(t){e({reference:t})},reset(){e({blockId:null,state:"closed",reference:null})}})),uo=()=>{const e=w(),t=co(),o=d(o=>{if(!o)throw new Error("Block ID is required to duplicate block");e.duplicateBlock({blockId:o,focus:!0}),t.close()},[e,t]),n=d(o=>{var n;if(!o)throw new Error("Block ID is required to copy block link");const r=e.children[o];if(r){const t=`${window.location.origin}${window.location.pathname}#${r.id}`;if(navigator.clipboard&&navigator.clipboard.writeText)navigator.clipboard.writeText(t).then(()=>{});else{const e=document.createElement("textarea");e.value=t,e.style.position="fixed",e.style.opacity="0",document.body.appendChild(e),e.select(),document.execCommand("copy"),document.body.removeChild(e)}null===(n=e.emit)||void 0===n||n.call(e,"block:copy",r)}t.close()},[e,t]),r=d(o=>{if(!o)throw new Error("Block ID is required to delete block");e.deleteBlock({blockId:o}),e.setPath({current:null}),t.close()},[e,t]);return{open:t.open,close:t.close,state:t.state,blockId:t.blockId,reference:t.reference,duplicateBlock:o,copyBlockLink:n,deleteBlock:r}},po=()=>{const e=w(),{state:t,reference:o,open:n,close:r}=co(),i="open"===t,{refs:a,floatingStyles:s,context:c,update:u}=ro({placement:"right-start",open:i,middleware:[St(),Nt(),jt(),Ct({mainAxis:5})],whileElementsMounted:ft,strategy:"fixed"}),{isMounted:p,styles:f}=lo(c,{duration:150});l(()=>{o&&a.setReference(o),i&&u()},[a,o,i,u]);const h=d(({reference:e,blockId:t})=>{n({reference:e,blockId:t})},[n]),m=d(()=>{r()},[r]),g=d(t=>{if(!t)throw new Error("Block ID is required to duplicate block");e.duplicateBlock({blockId:t,focus:!0}),m()},[e,m]),v=d(t=>{var o;if(!t)throw new Error("Block ID is required to copy block link");const n=e.children[t];if(n){const t=`${window.location.origin}${window.location.pathname}#${n.id}`;if(navigator.clipboard&&navigator.clipboard.writeText)navigator.clipboard.writeText(t).then(()=>{});else{const e=document.createElement("textarea");e.value=t,e.style.position="fixed",e.style.opacity="0",document.body.appendChild(e),e.select(),document.execCommand("copy"),document.body.removeChild(e)}null===(o=e.emit)||void 0===o||o.call(e,"block:copy",n)}m()},[e,m]),b=d(t=>{if(!t)throw new Error("Block ID is required to delete block");e.deleteBlock({blockId:t}),e.setPath({current:null}),m()},[e,m]);return{isOpen:p,getRootProps:()=>({ref:a.setFloating,style:Object.assign(Object.assign({},s),f),onClick:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation()}),open:h,close:m,duplicateBlock:g,copyBlockLink:v,deleteBlock:b}},fo=e=>{var{className:o,children:n,lockScroll:r=!0}=e,i=t(e,["className","children","lockScroll"]);return j(oo,Object.assign({lockScroll:r,className:o},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:n}))},ho=new WeakMap,mo=e=>{const[t,o]=p(!1),n=c(null),r=w();return l(()=>{o(!0);const e=r.refElement;if(!e)return;let t=e.querySelector(".yoopta-portal-container");t||(t=document.createElement("div"),t.className="yoopta-portal-container",e.appendChild(t),ho.set(t,0));const i=ho.get(t)||0;return ho.set(t,i+1),n.current=t,()=>{if(n.current){const e=ho.get(n.current)||0,t=Math.max(0,e-1);ho.set(n.current,t),0===t&&n.current.parentNode&&(n.current.remove(),ho.delete(n.current))}}},[r]),t&&n.current?j(Zt,Object.assign({id:`${e.id}-${r.id}`,root:n.current},{children:e.children})):null};o(":root{--yoopta-ui-block-options-bg:var(--yoopta-ui-background);--yoopta-ui-block-options-border:var(--yoopta-ui-border);--yoopta-ui-block-options-shadow:0 10px 15px -3px rgba(0,0,0,.1),0 4px 6px -4px rgba(0,0,0,.1);--yoopta-ui-block-options-radius:0.5rem;--yoopta-ui-block-options-padding:4px;--yoopta-ui-block-options-min-width:220px;--yoopta-ui-block-options-z-index:200;--yoopta-ui-block-options-group-gap:1px;--yoopta-ui-block-options-button-padding-y:8px;--yoopta-ui-block-options-button-padding-x:12px;--yoopta-ui-block-options-button-font-size:0.875rem;--yoopta-ui-block-options-button-line-height:1.25rem;--yoopta-ui-block-options-button-color:var(--yoopta-ui-foreground);--yoopta-ui-block-options-button-bg:transparent;--yoopta-ui-block-options-button-hover:var(--yoopta-ui-accent);--yoopta-ui-block-options-button-active:var(--yoopta-ui-accent);--yoopta-ui-block-options-button-radius:0.375rem;--yoopta-ui-destructive:0 84.2% 60.2%;--yoopta-ui-destructive-foreground:210 40% 98%;--yoopta-ui-block-options-button-destructive-color:hsl(var(--yoopta-ui-destructive));--yoopta-ui-block-options-button-destructive-hover:hsl(var(--yoopta-ui-destructive)/0.1);--yoopta-ui-block-options-icon-size:1rem;--yoopta-ui-block-options-icon-gap:8px;--yoopta-ui-block-options-separator-color:var(--yoopta-ui-border);--yoopta-ui-block-options-separator-height:1px;--yoopta-ui-block-options-separator-margin:4px 0;--yoopta-ui-block-options-transition:color 0.15s ease-in-out,background-color 0.15s ease-in-out,border-color 0.15s ease-in-out,box-shadow 0.15s ease-in-out}.dark,[data-theme=dark],[data-yoopta-theme=dark]{--yoopta-ui-block-options-shadow:0 10px 15px -3px rgba(0,0,0,.5),0 4px 6px -4px rgba(0,0,0,.3)}.yoopta-ui-block-options{background-color:hsl(var(--yoopta-ui-block-options-bg));border:1px solid hsl(var(--yoopta-ui-block-options-border));border-radius:var(--yoopta-ui-block-options-radius);box-shadow:var(--yoopta-ui-block-options-shadow);min-width:var(--yoopta-ui-block-options-min-width);padding:var(--yoopta-ui-block-options-padding);position:fixed;z-index:var(--yoopta-ui-block-options-z-index)}.yoopta-ui-block-options-content{display:flex;flex-direction:column;gap:var(--yoopta-ui-block-options-group-gap)}.yoopta-ui-block-options-group{display:flex;flex-direction:column;gap:1px}.yoopta-ui-block-options-button{align-items:center;background-color:var(--yoopta-ui-block-options-button-bg);border:none;border-radius:var(--yoopta-ui-block-options-button-radius);color:hsl(var(--yoopta-ui-block-options-button-color));cursor:pointer;display:flex;font-size:var(--yoopta-ui-block-options-button-font-size);font-weight:400;line-height:var(--yoopta-ui-block-options-button-line-height);outline:none;padding:var(--yoopta-ui-block-options-button-padding-y) var(--yoopta-ui-block-options-button-padding-x);text-align:left;transition:var(--yoopta-ui-block-options-transition);-moz-user-select:none;user-select:none;-webkit-user-select:none;width:100%}.yoopta-ui-block-options-button:hover{background-color:hsl(var(--yoopta-ui-block-options-button-hover));color:hsl(var(--yoopta-ui-accent-foreground))}.yoopta-ui-block-options-button:active{background-color:hsl(var(--yoopta-ui-block-options-button-active))}.yoopta-ui-block-options-button:focus-visible{box-shadow:0 0 0 2px hsl(var(--yoopta-ui-background)),0 0 0 4px hsl(var(--yoopta-ui-ring));outline:none}.yoopta-ui-block-options-button:disabled{opacity:.5;pointer-events:none}.yoopta-ui-block-options-button-destructive{color:var(--yoopta-ui-block-options-button-destructive-color)}.yoopta-ui-block-options-button-destructive:hover{background-color:var(--yoopta-ui-block-options-button-destructive-hover);color:hsl(var(--yoopta-ui-destructive))}.yoopta-ui-block-options-button-icon{align-items:center;display:inline-flex;flex-shrink:0;justify-content:center;margin-right:var(--yoopta-ui-block-options-icon-gap)}.yoopta-ui-block-options-button-icon svg{height:var(--yoopta-ui-block-options-icon-size);width:var(--yoopta-ui-block-options-icon-size)}.yoopta-ui-block-options-button-text{flex:1}.yoopta-ui-block-options-separator{background-color:hsl(var(--yoopta-ui-block-options-separator-color));height:var(--yoopta-ui-block-options-separator-height);margin:var(--yoopta-ui-block-options-separator-margin)}@media (prefers-color-scheme:dark){:root:not([data-theme=light]){--yoopta-ui-block-options-shadow:0 10px 15px -3px rgba(0,0,0,.5),0 4px 6px -4px rgba(0,0,0,.3)}}");const go=f((e,o)=>{var{children:n,className:r="",onClose:i}=e,a=t(e,["children","className","onClose"]);return j(mo,Object.assign({id:"yoopta-ui-block-options-portal"},{children:j(fo,Object.assign({lockScroll:!0,onMouseDown:e=>e.stopPropagation(),onClick:i},{children:j("div",Object.assign({ref:o,className:`yoopta-ui-block-options ${r}`,contentEditable:!1},a,{children:n}))}))}))});go.displayName="BlockOptions.Root";const vo=f(({children:e,className:t=""},o)=>j("div",Object.assign({ref:o,className:`yoopta-ui-block-options-group ${t}`},{children:e})));vo.displayName="BlockOptions.Group";const bo=f((e,o)=>{var{children:n,onClick:r,className:i="",disabled:a,icon:s,variant:l="default"}=e,c=t(e,["children","onClick","className","disabled","icon","variant"]);return N("button",Object.assign({ref:o,type:"button",className:`yoopta-ui-block-options-button yoopta-ui-block-options-button-${l} ${i}`,onClick:r,disabled:a},c,{children:[s&&j("span",Object.assign({className:"yoopta-ui-block-options-button-icon"},{children:s})),j("span",Object.assign({className:"yoopta-ui-block-options-button-text"},{children:n}))]}))});bo.displayName="BlockOptions.Button";const yo=f(({className:e=""},t)=>j("div",{ref:t,className:`yoopta-ui-block-options-separator ${e}`}));yo.displayName="BlockOptions.Separator";const xo=Object.assign(go,{Root:go,Group:vo,Button:bo,Separator:yo}),wo=f((e,o)=>{var{className:n,children:r}=e,i=t(e,["className","children"]);return j(mo,Object.assign({id:"yoopta-ui-toolbar-portal"},{children:j("div",Object.assign({ref:o,className:`yoopta-ui-toolbar ${n||""}`,onClick:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation()},i,{children:r}))}))});wo.displayName="Toolbar.Root";const ko=f((e,o)=>{var{className:n,children:r}=e,i=t(e,["className","children"]);return j("div",Object.assign({ref:o,className:`yoopta-ui-toolbar-group ${n}`},i,{children:r}))});ko.displayName="Toolbar.Group";const Oo=f((e,o)=>{var{className:n}=e,r=t(e,["className"]);return j("div",Object.assign({ref:o,className:`yoopta-ui-toolbar-separator ${n}`},r))});Oo.displayName="Toolbar.Separator";const Eo=f((e,o)=>{var{className:n,children:r,active:i,disabled:a,type:s="button"}=e,l=t(e,["className","children","active","disabled","type"]);return j("button",Object.assign({ref:o,type:s,disabled:a,"data-active":i,className:`yoopta-ui-toolbar-button ${n}`},l,{children:r}))});Eo.displayName="Toolbar.Button";const Co={Root:wo,Group:ko,Separator:Oo,Button:Eo},jo=e()(e=>({state:"closed",frozen:!1,open(){e({state:"open"})},close(){e({state:"closed",frozen:!1})},toggle(t){e({state:t})},setFrozen(t){e({frozen:t})},reset(){e({state:"closed",frozen:!1})}})),No=()=>{const e=w(),{state:t,frozen:o,open:r,close:i,setFrozen:a,toggle:s,reset:c}=jo(),{refs:u,floatingStyles:p,context:f}=ro({placement:"top",open:"open"===t,middleware:[St(),Nt(),jt(),Ct(10)],whileElementsMounted:ft}),{isMounted:m,styles:g}=lo(f,{duration:100}),v=d(()=>{var n,a;if(o)return;const s=u.floating.current;if(s&&s.contains(document.activeElement))return;const l=window.getSelection();if(!l||(null==l?void 0:l.isCollapsed)||(null==l?void 0:l.anchorOffset)===(null==l?void 0:l.focusOffset))return void("open"===t&&i());const c=l.getRangeAt(0),d=c.getBoundingClientRect(),p=c.toString().trim(),f=null==c?void 0:c.commonAncestorContainer,h=!!(null===(n=null==f?void 0:f.closest)||void 0===n?void 0:n.call(f,"[data-custom-editor]"));if((null===(a=e.refElement)||void 0===a?void 0:a.contains(f))&&!h){if(c&&p.length>0){const e={getBoundingClientRect:()=>d,getClientRects:()=>c.getClientRects()};u.setReference(e),"open"!==t&&r()}}else"open"===t&&i()},[o,u,e.refElement,i,r,t]),b=d(()=>{var o;if(!Array.isArray(e.path.selected)||0===e.path.selected.length||"mousemove"!==e.path.source&&"keyboard"!==e.path.source)return void("open"===t&&i());const n=Math.min(...e.path.selected),a=Math.max(...e.path.selected);let s=!0;"number"==typeof e.path.current&&(s=Math.abs(e.path.current-a)<=Math.abs(e.path.current-n));const l=e.getBlock({at:s?a:n});if(!l)return;const c=null===(o=e.refElement)||void 0===o?void 0:o.querySelector(`[data-yoopta-block-id="${l.id}"]`);c&&(u.setReference(c),"open"!==t&&r())},[e,u,i,r,t]),y=h(()=>n(v,200,{leading:!0,trailing:!0}),[v]);l(()=>{if(Array.isArray(e.path.selected)||e.path.selection){if(!Array.isArray(e.path.selected)||e.path.selection)return window.document.addEventListener("selectionchange",y),()=>window.document.removeEventListener("selectionchange",y);b()}else"open"===t&&i()},[e.path.selected,e.path.selection,t,y,i,b]);const x=h(()=>Object.assign(Object.assign({},p),g),[p,g]);return{isOpen:m,state:t,frozen:o,open:r,close:i,toggle:s,setFrozen:a,reset:c,getRootProps:()=>({ref:u.setFloating,style:x,onClick:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation()})}};o(".yoopta-ui-toolbar{align-items:center;background:hsl(var(--yoopta-ui-background));border:1px solid hsl(var(--yoopta-ui-border));border-radius:var(--yoopta-ui-toolbar-radius,.5rem);box-shadow:var(\n --yoopta-ui-toolbar-shadow,0 4px 6px -1px rgba(0,0,0,.1),0 2px 4px -2px rgba(0,0,0,.1)\n );display:flex;gap:var(--yoopta-ui-toolbar-gap,4px);padding:var(--yoopta-ui-toolbar-padding,6px);-webkit-user-select:none;-moz-user-select:none;user-select:none;z-index:var(--yoopta-ui-toolbar-z-index,99)}.yoopta-ui-toolbar-group{align-items:center;display:flex;gap:var(--yoopta-ui-toolbar-group-gap,2px)}.yoopta-ui-toolbar-separator{background:hsl(var(--yoopta-ui-border));height:var(--yoopta-ui-toolbar-separator-height,24px);margin:0 var(--yoopta-ui-toolbar-separator-margin,4px);width:1px}.yoopta-ui-toolbar-button{align-items:center;background:transparent;border:none;border-radius:var(--yoopta-ui-toolbar-button-radius,.375rem);color:hsl(var(--yoopta-ui-foreground));cursor:pointer;display:inline-flex;font-size:var(--yoopta-ui-toolbar-button-font-size,.875rem);font-weight:var(--yoopta-ui-toolbar-button-font-weight,500);gap:var(--yoopta-ui-toolbar-button-gap,4px);justify-content:center;min-height:var(--yoopta-ui-toolbar-button-min-height,32px);min-width:var(--yoopta-ui-toolbar-button-min-width,32px);outline:none;padding:var(--yoopta-ui-toolbar-button-padding-y,6px) var(--yoopta-ui-toolbar-button-padding-x,8px);transition:all .15s cubic-bezier(.4,0,.2,1);white-space:nowrap}.yoopta-ui-toolbar-button:hover:not(:disabled){background:hsl(var(--yoopta-ui-accent))}.yoopta-ui-toolbar-button:focus-visible{outline:2px solid hsl(var(--yoopta-ui-ring));outline-offset:var(--yoopta-ui-toolbar-ring-offset,2px)}.yoopta-ui-toolbar-button[data-active=true]{background:hsl(var(--yoopta-ui-primary,221.2 83.2% 53.3%));color:hsl(var(--yoopta-ui-primary-foreground,210 40% 98%))}.yoopta-ui-toolbar-button:disabled{cursor:not-allowed;opacity:.5}.yoopta-ui-toolbar-button svg{height:var(--yoopta-ui-toolbar-icon-size,1rem);width:var(--yoopta-ui-toolbar-icon-size,1rem)}:root{--yoopta-ui-background:0 0% 100%;--yoopta-ui-foreground:222.2 84% 4.9%;--yoopta-ui-border:214.3 31.8% 91.4%;--yoopta-ui-accent:210 40% 96.1%;--yoopta-ui-ring:222.2 84% 4.9%;--yoopta-ui-primary:221.2 83.2% 53.3%;--yoopta-ui-primary-foreground:210 40% 98%;--yoopta-ui-toolbar-gap:4px;--yoopta-ui-toolbar-padding:6px;--yoopta-ui-toolbar-radius:0.5rem;--yoopta-ui-toolbar-shadow:0 4px 6px -1px rgba(0,0,0,.1),0 2px 4px -2px rgba(0,0,0,.1);--yoopta-ui-toolbar-z-index:99;--yoopta-ui-toolbar-group-gap:2px;--yoopta-ui-toolbar-separator-height:24px;--yoopta-ui-toolbar-separator-margin:4px;--yoopta-ui-toolbar-button-min-width:32px;--yoopta-ui-toolbar-button-min-height:32px;--yoopta-ui-toolbar-button-padding-y:6px;--yoopta-ui-toolbar-button-padding-x:8px;--yoopta-ui-toolbar-button-font-size:0.875rem;--yoopta-ui-toolbar-button-font-weight:500;--yoopta-ui-toolbar-button-gap:4px;--yoopta-ui-toolbar-button-radius:0.375rem;--yoopta-ui-toolbar-icon-size:1rem;--yoopta-ui-toolbar-ring-offset:2px}.dark,[data-theme=dark]{--yoopta-ui-background:222.2 84% 4.9%;--yoopta-ui-foreground:210 40% 98%;--yoopta-ui-border:217.2 32.6% 17.5%;--yoopta-ui-accent:217.2 32.6% 17.5%;--yoopta-ui-ring:212.7 26.8% 83.9%}");const So=f((e,o)=>{var{children:n,style:r,className:i}=e,a=t(e,["children","style","className"]);return j("div",Object.assign({ref:o,role:"listbox",tabIndex:0,style:r,className:`yoopta-ui-action-menu-list-content ${i||""}`,onMouseDown:e=>e.stopPropagation(),onClick:e=>e.stopPropagation()},a,{children:n}))});So.displayName="ActionMenuList.Root";const Po=f((e,o)=>{var{children:n,className:r}=e,i=t(e,["children","className"]);return j("div",Object.assign({ref:o,className:`yoopta-ui-action-menu-list-group ${r||""}`},i,{children:n}))});Po.displayName="ActionMenuList.Group";const _o=f((e,o)=>{var{action:n,selected:r,icon:i,className:a}=e,s=t(e,["action","selected","icon","className"]);return N("button",Object.assign({ref:o,type:"button",className:`yoopta-ui-action-menu-list-item ${r?"selected":""} ${a||""}`},s,{children:[i&&j("div",Object.assign({className:"yoopta-ui-action-menu-list-item-icon"},{children:(e=>{if(!e)return null;if("string"==typeof e)return j("img",{src:e,alt:"icon"});if(m(e))return g(e);return j(e,{})})(i)})),N("div",Object.assign({className:"yoopta-ui-action-menu-list-item-content"},{children:[j("div",Object.assign({className:"yoopta-ui-action-menu-list-item-title"},{children:n.title})),n.description&&j("div",Object.assign({className:"yoopta-ui-action-menu-list-item-description"},{children:n.description}))]}))]}))});_o.displayName="ActionMenuList.Item";const Ro=f((e,o)=>{var{children:n,className:r}=e,i=t(e,["children","className"]);return j("div",Object.assign({ref:o,className:`yoopta-ui-action-menu-list-empty ${r||""}`},i,{children:n||"No actions available"}))});Ro.displayName="ActionMenuList.Empty";const To={Root:So,Group:Po,Item:_o,Empty:Ro},Ao=e()(e=>({state:"closed",view:"default",reference:null,placement:"bottom-start",blockId:null,open(t={}){const{reference:o,view:n,placement:r,blockId:i}=t;e(e=>({state:"open",reference:void 0!==o?o:e.reference,view:void 0!==n?n:e.view,placement:void 0!==r?r:e.placement,blockId:void 0!==i?i:e.blockId}))},close(){e({state:"closed",view:"default",placement:"bottom-start",blockId:null})},toggle(t){e({state:t})},setView(t){e({view:t})},setReference(t){e({reference:t})},reset(){e({state:"closed",view:"default",reference:null,placement:"bottom-start",blockId:null})}}));const Io=()=>{const e=Ao();return{open:e.open,close:e.close,toggle:e.toggle,isOpen:"open"===e.state}},Mo=({view:e="default"}={})=>{const t=w(),o=Ao(),{state:n,view:r,reference:i,blockId:a,open:s,close:c,setView:u,placement:f}=o,{refs:m,floatingStyles:g,context:v,update:b}=ro({placement:f,open:"open"===n,middleware:[Nt(),jt(),Ct(10)],whileElementsMounted:ft}),{isMounted:y,styles:x}=lo(v,{duration:100}),C=h(()=>function(e){const t=Object.keys(e.plugins);let o=null;if("number"==typeof e.path.current){const t=k.getBlockSlate(e,{at:e.path.current});t&&(o=O(e,t))}let n=t;return o&&o.length>0&&(n="string"==typeof t[0]?t.filter(e=>o.includes(e)):t.filter(e=>o.includes(e.type))),n.map(t=>{var o,n,r,i,a,s;return"string"==typeof t?{type:t,title:(null===(n=null===(o=e.plugins[t].options)||void 0===o?void 0:o.display)||void 0===n?void 0:n.title)||t,description:null===(i=null===(r=e.plugins[t].options)||void 0===r?void 0:r.display)||void 0===i?void 0:i.description,icon:null===(s=null===(a=e.plugins[t].options)||void 0===a?void 0:a.display)||void 0===s?void 0:s.icon}:t})}(t).filter(e=>function(e,t){var o;const n=e.plugins[t];if(!n)return!1;const r=E(n.elements);return"void"!==(null===(o=null==r?void 0:r.props)||void 0===o?void 0:o.nodeType)}(t,e.type)),[t]),[j,N]=p(C[0]),[S,P]=p(C),_=d(()=>{c(),P(C),N(C[0]),u(e)},[c,C,e,u]);l(()=>{i&&m.setReference(i),"open"===n&&b()},[i,n,m,b]);const R=d(e=>{const{reference:t,view:o,placement:n,blockId:r}=e;o&&u(o),s({reference:t,view:o,placement:n,blockId:r})},[s,u]),T=d(e=>{const t=e.currentTarget.getAttribute("data-action-menu-item-type"),o=C.find(e=>e.type===t);N(o)},[C]),A=d(e=>({onMouseEnter:T,onMouseDown:e=>e.stopPropagation(),onClick:o=>{if(!a)return;const n=k.getBlock(t,{id:a});n&&(o.stopPropagation(),t.toggleBlock(e,{preserveContent:!0,focus:!0,at:n.meta.order}),_())},"data-action-menu-item":!0,"data-action-menu-item-type":e,"aria-selected":e===(null==j?void 0:j.type)}),[T,j,t,_]),I=d(()=>({"data-action-menu-list":!0,ref:m.setFloating,style:Object.assign(Object.assign(Object.assign({},g),x),{minWidth:"small"===r?200:244}),onMouseDown:e=>e.stopPropagation(),onClick:e=>e.stopPropagation()}),[m.setFloating,g,x,r]);return{isOpen:y,state:n,actions:S,selectedAction:j,empty:0===S.length,view:r,open:R,close:_,getItemProps:A,getRootProps:I}};o(".yoopta-ui-action-menu-list{bottom:auto;left:0;margin:0;position:absolute;right:auto;top:0;z-index:var(--yoopta-ui-action-menu-z-index,9999)}.yoopta-ui-action-menu-list-content{background:hsl(var(--yoopta-ui-background));border:1px solid hsl(var(--yoopta-ui-border));border-radius:var(--yoopta-ui-action-menu-radius,.5rem);box-shadow:var(\n --yoopta-ui-action-menu-shadow,0 4px 6px -1px rgba(0,0,0,.1),0 2px 4px -2px rgba(0,0,0,.1)\n );max-height:var(--yoopta-ui-action-menu-max-height,330px);overflow-x:hidden;overflow-y:auto;padding:var(--yoopta-ui-action-menu-padding,.5rem);-webkit-user-select:none;-moz-user-select:none;user-select:none}.yoopta-ui-action-menu-list-group{color:hsl(var(--yoopta-ui-foreground));overflow:hidden;padding:0}.yoopta-ui-action-menu-list-item{align-items:center;background:transparent;border:none;border-radius:var(--yoopta-ui-action-menu-item-radius,.375rem);color:hsl(var(--yoopta-ui-foreground));cursor:pointer;display:flex;font-size:var(--yoopta-ui-action-menu-item-font-size,.875rem);gap:var(--yoopta-ui-action-menu-item-gap,.5rem);margin-bottom:.125rem;outline:none;padding:var(--yoopta-ui-action-menu-item-padding,.5rem);text-align:left;transition:background-color .15s ease-out;width:100%}.yoopta-ui-action-menu-list-item:last-child{margin-bottom:0}.yoopta-ui-action-menu-list-item:hover,.yoopta-ui-action-menu-list-item[aria-selected=true]{background:hsl(var(--yoopta-ui-accent))}.yoopta-ui-action-menu-list-item:focus-visible{outline:2px solid hsl(var(--yoopta-ui-ring));outline-offset:2px}.yoopta-ui-action-menu-list-item-icon{align-items:center;background:hsl(var(--yoopta-ui-background));border:1px solid hsl(var(--yoopta-ui-border));border-radius:var(--yoopta-ui-action-menu-icon-radius,.375rem);display:flex;flex-shrink:0;justify-content:center}.yoopta-ui-action-menu-list-item-icon img,.yoopta-ui-action-menu-list-item-icon svg{height:100%;-o-object-fit:contain;object-fit:contain;width:100%}.yoopta-ui-action-menu-list-item-content{flex:1;min-width:0}.yoopta-ui-action-menu-list-item-title{font-weight:500;line-height:1.25}.yoopta-ui-action-menu-list-item-description{color:hsl(var(--yoopta-ui-muted-foreground));font-size:var(--yoopta-ui-action-menu-item-description-font-size,.75rem);line-height:1.25;margin-top:.125rem;max-width:200px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.yoopta-ui-action-menu-list-empty{color:hsl(var(--yoopta-ui-muted-foreground));font-size:var(--yoopta-ui-action-menu-empty-font-size,.75rem);padding:var(--yoopta-ui-action-menu-empty-padding,.5rem);text-align:left}.yoopta-ui-action-menu-list-content::-webkit-scrollbar{width:8px}.yoopta-ui-action-menu-list-content::-webkit-scrollbar-track{background:transparent}.yoopta-ui-action-menu-list-content::-webkit-scrollbar-thumb{background:hsl(var(--yoopta-ui-border));border-radius:4px}.yoopta-ui-action-menu-list-content::-webkit-scrollbar-thumb:hover{background:hsl(var(--yoopta-ui-muted-foreground))}");const Lo=({children:e,className:t})=>{const o=e=>{e.stopPropagation(),e.preventDefault()};return j("div",Object.assign({tabIndex:0,role:"listbox","aria-label":"Slash commands",className:`slash-command-content ${t||""}`,onMouseDown:o,onMouseMove:o},{children:e}))};Lo.displayName="SlashCommand.Content";const Do=v(null);function Bo(){const e=b(Do);if(!e)throw new Error("useSlashCommandContext must be used within a SlashCommandProvider");return e}Do.displayName="SlashCommandContext";const zo=({children:e,className:t})=>{const{filteredItems:o}=Bo();return o.length>0?null:j("div",Object.assign({className:`slash-command-empty ${t||""}`},{children:e||"No results found"}))};zo.displayName="SlashCommand.Empty";const Fo=()=>N(S,{children:[N("div",Object.assign({className:"slash-command-footer-hint"},{children:[j("kbd",Object.assign({className:"slash-command-kbd"},{children:"↑"})),j("kbd",Object.assign({className:"slash-command-kbd"},{children:"↓"})),j("span",{children:"Navigate"})]})),N("div",Object.assign({className:"slash-command-footer-hint"},{children:[j("kbd",Object.assign({className:"slash-command-kbd"},{children:"↵"})),j("span",{children:"Select"})]})),N("div",Object.assign({className:"slash-command-footer-hint"},{children:[j("kbd",Object.assign({className:"slash-command-kbd"},{children:"Esc"})),j("span",{children:"Close"})]}))]}),qo=({children:e,className:t,showHints:o=!0})=>j("div",Object.assign({className:`slash-command-footer ${t||""}`},{children:e||o&&j(Fo,{})}));qo.displayName="SlashCommand.Footer";const $o=({children:e,heading:t,className:o})=>N("div",Object.assign({role:"group","aria-label":t,className:`slash-command-group ${o||""}`},{children:[t&&j("div",Object.assign({className:"slash-command-group-heading"},{children:t})),e]}));$o.displayName="SlashCommand.Group";const Vo=f(({placeholder:e="Search blocks...",className:t,showTrigger:o=!0,showEscHint:n=!0},r)=>{const{state:i,actionHandlers:a}=Bo();return N("div",Object.assign({className:`slash-command-input-wrapper ${t||""}`},{children:[o&&j("span",Object.assign({className:"slash-command-input-trigger"},{children:"/"})),j("input",{ref:r,type:"text",className:"slash-command-input",placeholder:e,value:i.search,onChange:e=>a.setSearch(e.target.value),autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:!1}),n&&j("kbd",Object.assign({className:"slash-command-kbd"},{children:"ESC"}))]}))});Vo.displayName="SlashCommand.Input";const Ho=({children:e,value:t,title:o,description:n,icon:r,shortcut:i,disabled:a=!1,onSelect:s,className:u})=>{const{state:p,actionHandlers:f,filteredItems:h}=Bo(),m=c(null),g=h.findIndex(e=>e.id===t),v=g===p.selectedIndex&&-1!==g,b=-1!==g;l(()=>{v&&m.current&&m.current.scrollIntoView({block:"nearest",behavior:"smooth"})},[v]);const y=d(()=>{a||(s&&s(),f.selectItem(g),f.executeSelected())},[a,s,f,g]),x=d(()=>{a||-1===g||f.selectItem(g)},[a,g,f]);if(!b)return null;const w=e||N(S,{children:[r&&j("div",Object.assign({className:"slash-command-item-icon"},{children:r})),N("div",Object.assign({className:"slash-command-item-content"},{children:[o&&j("div",Object.assign({className:"slash-command-item-title"},{children:o})),n&&j("div",Object.assign({className:"slash-command-item-description"},{children:n}))]})),i&&i.length>0&&j("div",Object.assign({className:"slash-command-item-shortcut"},{children:i.map(e=>j("kbd",Object.assign({className:"slash-command-kbd"},{children:e}),e))}))]});return j("button",Object.assign({ref:m,type:"button",role:"option","aria-selected":v,"aria-disabled":a,"data-selected":v,"data-disabled":a,"data-value":t,className:`slash-command-item ${u||""}`,onClick:y,onMouseEnter:x,onMouseDown:e=>e.preventDefault(),disabled:a},{children:w}))};Ho.displayName="SlashCommand.Item";const Wo=({children:e,className:t,style:o})=>j("div",Object.assign({role:"group",className:`slash-command-list ${null!=t?t:""}`,style:o},{children:e}));Wo.displayName="SlashCommand.List";const Go=({children:e,className:t})=>j("div",Object.assign({className:`slash-command-loading ${t||""}`},{children:e||j("div",{className:"slash-command-spinner"})}));Go.displayName="SlashCommand.Loading";var Xo={ancestors(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{reverse:o=!1}=t,n=Xo.levels(e,t);return n=o?n.slice(1):n.slice(0,-1)},common(e,t){for(var o=[],n=0;n<e.length&&n<t.length;n++){var r=e[n];if(r!==t[n])break;o.push(r)}return o},compare(e,t){for(var o=Math.min(e.length,t.length),n=0;n<o;n++){if(e[n]<t[n])return-1;if(e[n]>t[n])return 1}return 0},endsAfter(e,t){var o=e.length-1,n=e.slice(0,o),r=t.slice(0,o),i=e[o],a=t[o];return Xo.equals(n,r)&&i>a},endsAt(e,t){var o=e.length,n=e.slice(0,o),r=t.slice(0,o);return Xo.equals(n,r)},endsBefore(e,t){var o=e.length-1,n=e.slice(0,o),r=t.slice(0,o),i=e[o],a=t[o];return Xo.equals(n,r)&&i<a},equals:(e,t)=>e.length===t.length&&e.every((e,o)=>e===t[o]),hasPrevious:e=>e[e.length-1]>0,isAfter:(e,t)=>1===Xo.compare(e,t),isAncestor:(e,t)=>e.length<t.length&&0===Xo.compare(e,t),isBefore:(e,t)=>-1===Xo.compare(e,t),isChild:(e,t)=>e.length===t.length+1&&0===Xo.compare(e,t),isCommon:(e,t)=>e.length<=t.length&&0===Xo.compare(e,t),isDescendant:(e,t)=>e.length>t.length&&0===Xo.compare(e,t),isParent:(e,t)=>e.length+1===t.length&&0===Xo.compare(e,t),isPath:e=>Array.isArray(e)&&(0===e.length||"number"==typeof e[0]),isSibling(e,t){if(e.length!==t.length)return!1;var o=e.slice(0,-1),n=t.slice(0,-1);return e[e.length-1]!==t[t.length-1]&&Xo.equals(o,n)},levels(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{reverse:o=!1}=t,n=[],r=0;r<=e.length;r++)n.push(e.slice(0,r));return o&&n.reverse(),n},next(e){if(0===e.length)throw new Error("Cannot get the next path of a root path [".concat(e,"], because it has no next index."));var t=e[e.length-1];return e.slice(0,-1).concat(t+1)},operationCanTransformPath(e){switch(e.type){case"insert_node":case"remove_node":case"merge_node":case"split_node":case"move_node":return!0;default:return!1}},parent(e){if(0===e.length)throw new Error("Cannot get the parent path of the root path [".concat(e,"]."));return e.slice(0,-1)},previous(e){if(0===e.length)throw new Error("Cannot get the previous path of a root path [".concat(e,"], because it has no previous index."));var t=e[e.length-1];if(t<=0)throw new Error("Cannot get the previous path of a first child path [".concat(e,"] because it would result in a negative index."));return e.slice(0,-1).concat(t-1)},relative(e,t){if(!Xo.isAncestor(t,e)&&!Xo.equals(e,t))throw new Error("Cannot get the relative path of [".concat(e,"] inside ancestor [").concat(t,"], because it is not above or equal to the path."));return e.slice(t.length)},transform(e,t){var o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!e)return null;var n=[...e],{affinity:r="forward"}=o;if(0===e.length)return n;switch(t.type){case"insert_node":var{path:i}=t;(Xo.equals(i,n)||Xo.endsBefore(i,n)||Xo.isAncestor(i,n))&&(n[i.length-1]+=1);break;case"remove_node":var{path:a}=t;if(Xo.equals(a,n)||Xo.isAncestor(a,n))return null;Xo.endsBefore(a,n)&&(n[a.length-1]-=1);break;case"merge_node":var{path:s,position:l}=t;Xo.equals(s,n)||Xo.endsBefore(s,n)?n[s.length-1]-=1:Xo.isAncestor(s,n)&&(n[s.length-1]-=1,n[s.length]+=l);break;case"split_node":var{path:c,position:u}=t;if(Xo.equals(c,n)){if("forward"===r)n[n.length-1]+=1;else if("backward"!==r)return null}else Xo.endsBefore(c,n)?n[c.length-1]+=1:Xo.isAncestor(c,n)&&e[c.length]>=u&&(n[c.length-1]+=1,n[c.length]-=u);break;case"move_node":var{path:d,newPath:p}=t;if(Xo.equals(d,p))return n;if(Xo.isAncestor(d,n)||Xo.equals(d,n)){var f=p.slice();return Xo.endsBefore(d,p)&&d.length<p.length&&(f[d.length-1]-=1),f.concat(n.slice(d.length))}Xo.isSibling(d,p)&&(Xo.isAncestor(p,n)||Xo.equals(p,n))?Xo.endsBefore(d,n)?n[d.length-1]-=1:n[d.length-1]+=1:Xo.endsBefore(p,n)||Xo.equals(p,n)||Xo.isAncestor(p,n)?(Xo.endsBefore(d,n)&&(n[d.length-1]-=1),n[p.length-1]+=1):Xo.endsBefore(d,n)&&(Xo.equals(p,n)&&(n[p.length-1]+=1),n[d.length-1]-=1)}return n}};function Yo(e){return Yo="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Yo(e)}function Uo(e){var t=function(e,t){if("object"!==Yo(e)||null===e)return e;var o=e[Symbol.toPrimitive];if(void 0!==o){var n=o.call(e,t||"default");if("object"!==Yo(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===Yo(t)?t:String(t)}function Ko(e,t,o){return(t=Uo(t))in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}function Zo(e,t){if(null==e)return{};var o,n,r=function(e,t){if(null==e)return{};var o,n,r={},i=Object.keys(e);for(n=0;n<i.length;n++)o=i[n],t.indexOf(o)>=0||(r[o]=e[o]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)o=i[n],t.indexOf(o)>=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(r[o]=e[o])}return r}var Jo=["anchor","focus"];function Qo(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),o.push.apply(o,n)}return o}var en={edges(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{reverse:o=!1}=t,{anchor:n,focus:r}=e;return en.isBackward(e)===o?[n,r]:[r,n]},end(e){var[,t]=en.edges(e);return t},equals:(e,t)=>yn.equals(e.anchor,t.anchor)&&yn.equals(e.focus,t.focus),surrounds(e,t){var o=en.intersection(e,t);return!!o&&en.equals(o,t)},includes(e,t){if(en.isRange(t)){if(en.includes(e,t.anchor)||en.includes(e,t.focus))return!0;var[o,n]=en.edges(e),[r,i]=en.edges(t);return yn.isBefore(o,r)&&yn.isAfter(n,i)}var[a,s]=en.edges(e),l=!1,c=!1;return yn.isPoint(t)?(l=yn.compare(t,a)>=0,c=yn.compare(t,s)<=0):(l=Xo.compare(t,a.path)>=0,c=Xo.compare(t,s.path)<=0),l&&c},intersection(e,t){var o=Zo(e,Jo),[n,r]=en.edges(e),[i,a]=en.edges(t),s=yn.isBefore(n,i)?i:n,l=yn.isBefore(r,a)?r:a;return yn.isBefore(l,s)?null:function(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?Qo(Object(o),!0).forEach(function(t){Ko(e,t,o[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):Qo(Object(o)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))})}return e}({anchor:s,focus:l},o)},isBackward(e){var{anchor:t,focus:o}=e;return yn.isAfter(t,o)},isCollapsed(e){var{anchor:t,focus:o}=e;return yn.equals(t,o)},isExpanded:e=>!en.isCollapsed(e),isForward:e=>!en.isBackward(e),isRange:e=>fn(e)&&yn.isPoint(e.anchor)&&yn.isPoint(e.focus),*points(e){yield[e.anchor,"anchor"],yield[e.focus,"focus"]},start(e){var[t]=en.edges(e);return t},transform(e,t){var o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(null===e)return null;var n,r,{affinity:i="inward"}=o;if("inward"===i){var a=en.isCollapsed(e);en.isForward(e)?(n="forward",r=a?n:"backward"):(n="backward",r=a?n:"forward")}else"outward"===i?en.isForward(e)?(n="backward",r="forward"):(n="forward",r="backward"):(n=i,r=i);var s=yn.transform(e.anchor,t,{affinity:n}),l=yn.transform(e.focus,t,{affinity:r});return s&&l?{anchor:s,focus:l}:null}},tn=function(e){var{deep:t=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return!!fn(e)&&("function"!=typeof e.apply&&(t?ln.isNodeList(e.children):Array.isArray(e.children)))},on={isAncestor(e){var{deep:t=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return fn(e)&&ln.isNodeList(e.children,{deep:t})},isElement:tn,isElementList(e){var{deep:t=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Array.isArray(e)&&e.every(e=>on.isElement(e,{deep:t}))},isElementProps:e=>void 0!==e.children,isElementType:function(e,t){var o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"type";return tn(e)&&e[o]===t},matches(e,t){for(var o in t)if("children"!==o&&e[o]!==t[o])return!1;return!0}},nn=["children"],rn=["text"];function an(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),o.push.apply(o,n)}return o}function sn(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?an(Object(o),!0).forEach(function(t){Ko(e,t,o[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):an(Object(o)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))})}return e}var ln={ancestor(e,t){var o=ln.get(e,t);if(jn.isText(o))throw new Error("Cannot get the ancestor node at path [".concat(t,"] because it refers to a text node instead: ").concat(wn.stringify(o)));return o},ancestors(e,t){var o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return function*(){for(var n of Xo.ancestors(t,o)){var r=[ln.ancestor(e,n),n];yield r}}()},child(e,t){if(jn.isText(e))throw new Error("Cannot get the child of a text node: ".concat(wn.stringify(e)));var o=e.children[t];if(null==o)throw new Error("Cannot get child at index `".concat(t,"` in node: ").concat(wn.stringify(e)));return o},children(e,t){var o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return function*(){for(var{reverse:n=!1}=o,r=ln.ancestor(e,t),{children:i}=r,a=n?i.length-1:0;n?a>=0:a<i.length;){var s=ln.child(r,a),l=t.concat(a);yield[s,l],a=n?a-1:a+1}}()},common(e,t,o){var n=Xo.common(t,o);return[ln.get(e,n),n]},descendant(e,t){var o=ln.get(e,t);if(gn.isEditor(o))throw new Error("Cannot get the descendant node at path [".concat(t,"] because it refers to the root editor node instead: ").concat(wn.stringify(o)));return o},descendants(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function*(){for(var[o,n]of ln.nodes(e,t))0!==n.length&&(yield[o,n])}()},elements(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function*(){for(var[o,n]of ln.nodes(e,t))on.isElement(o)&&(yield[o,n])}()},extractProps:e=>on.isAncestor(e)?Zo(e,nn):Zo(e,rn),first(e,t){for(var o=t.slice(),n=ln.get(e,o);n&&!jn.isText(n)&&0!==n.children.length;)n=n.children[0],o.push(0);return[n,o]},fragment(e,t){var o={children:e.children},[n,r]=en.edges(t),i=ln.nodes(o,{reverse:!0,pass:e=>{var[,o]=e;return!en.includes(t,o)}}),a=function(){if(!en.includes(t,s)){var e=s[s.length-1];An(o,Xo.parent(s),t=>Rn(t,e,1))}Xo.equals(s,r.path)&&In(o,s,e=>{var t=e.text.slice(0,r.offset);return sn(sn({},e),{},{text:t})}),Xo.equals(s,n.path)&&In(o,s,e=>{var t=e.text.slice(n.offset);return sn(sn({},e),{},{text:t})})};for(var[,s]of i)a();return o.children},get(e,t){var o=ln.getIf(e,t);if(void 0===o)throw new Error("Cannot find a descendant at path [".concat(t,"] in node: ").concat(wn.stringify(e)));return o},getIf(e,t){for(var o=e,n=0;n<t.length;n++){var r=t[n];if(jn.isText(o)||!o.children[r])return;o=o.children[r]}return o},has(e,t){for(var o=e,n=0;n<t.length;n++){var r=t[n];if(jn.isText(o)||!o.children[r])return!1;o=o.children[r]}return!0},isNode(e){var{deep:t=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return jn.isText(e)||on.isElement(e,{deep:t})||gn.isEditor(e,{deep:t})},isNodeList(e){var{deep:t=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Array.isArray(e)&&e.every(e=>ln.isNode(e,{deep:t}))},last(e,t){for(var o=t.slice(),n=ln.get(e,o);n&&!jn.isText(n)&&0!==n.children.length;){var r=n.children.length-1;n=n.children[r],o.push(r)}return[n,o]},leaf(e,t){var o=ln.get(e,t);if(!jn.isText(o))throw new Error("Cannot get the leaf node at path [".concat(t,"] because it refers to a non-leaf node: ").concat(wn.stringify(o)));return o},levels(e,t){var o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return function*(){for(var n of Xo.levels(t,o)){var r=ln.get(e,n);yield[r,n]}}()},matches:(e,t)=>on.isElement(e)&&on.isElementProps(t)&&on.matches(e,t)||jn.isText(e)&&jn.isTextProps(t)&&jn.matches(e,t),nodes(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function*(){for(var{pass:o,reverse:n=!1}=t,{from:r=[],to:i}=t,a=new Set,s=[],l=e;!i||!(n?Xo.isBefore(s,i):Xo.isAfter(s,i));)if(a.has(l)||(yield[l,s]),a.has(l)||jn.isText(l)||0===l.children.length||null!=o&&!1!==o([l,s])){if(0===s.length)break;if(!n){var c=Xo.next(s);if(ln.has(e,c)){s=c,l=ln.get(e,s);continue}}if(n&&0!==s[s.length-1])s=Xo.previous(s),l=ln.get(e,s);else s=Xo.parent(s),l=ln.get(e,s),a.add(l)}else{a.add(l);var u=n?l.children.length-1:0;Xo.isAncestor(s,r)&&(u=r[s.length]),s=s.concat(u),l=ln.get(e,s)}}()},parent(e,t){var o=Xo.parent(t),n=ln.get(e,o);if(jn.isText(n))throw new Error("Cannot get the parent of path [".concat(t,"] because it does not exist in the root."));return n},string:e=>jn.isText(e)?e.text:e.children.map(ln.string).join(""),texts(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function*(){for(var[o,n]of ln.nodes(e,t))jn.isText(o)&&(yield[o,n])}()}};function cn(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),o.push.apply(o,n)}return o}function un(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?cn(Object(o),!0).forEach(function(t){Ko(e,t,o[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):cn(Object(o)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))})}return e}var dn,pn={isNodeOperation:e=>pn.isOperation(e)&&e.type.endsWith("_node"),isOperation(e){if(!fn(e))return!1;switch(e.type){case"insert_node":case"remove_node":return Xo.isPath(e.path)&&ln.isNode(e.node);case"insert_text":case"remove_text":return"number"==typeof e.offset&&"string"==typeof e.text&&Xo.isPath(e.path);case"merge_node":return"number"==typeof e.position&&Xo.isPath(e.path)&&fn(e.properties);case"move_node":return Xo.isPath(e.path)&&Xo.isPath(e.newPath);case"set_node":return Xo.isPath(e.path)&&fn(e.properties)&&fn(e.newProperties);case"set_selection":return null===e.properties&&en.isRange(e.newProperties)||null===e.newProperties&&en.isRange(e.properties)||fn(e.properties)&&fn(e.newProperties);case"split_node":return Xo.isPath(e.path)&&"number"==typeof e.position&&fn(e.properties);default:return!1}},isOperationList:e=>Array.isArray(e)&&e.every(e=>pn.isOperation(e)),isSelectionOperation:e=>pn.isOperation(e)&&e.type.endsWith("_selection"),isTextOperation:e=>pn.isOperation(e)&&e.type.endsWith("_text"),inverse(e){switch(e.type){case"insert_node":return un(un({},e),{},{type:"remove_node"});case"insert_text":return un(un({},e),{},{type:"remove_text"});case"merge_node":return un(un({},e),{},{type:"split_node",path:Xo.previous(e.path)});case"move_node":var{newPath:t,path:o}=e;if(Xo.equals(t,o))return e;if(Xo.isSibling(o,t))return un(un({},e),{},{path:t,newPath:o});var n=Xo.transform(o,e),r=Xo.transform(Xo.next(o),e);return un(un({},e),{},{path:n,newPath:r});case"remove_node":return un(un({},e),{},{type:"insert_node"});case"remove_text":return un(un({},e),{},{type:"insert_text"});case"set_node":var{properties:i,newProperties:a}=e;return un(un({},e),{},{properties:a,newProperties:i});case"set_selection":var{properties:s,newProperties:l}=e;return un(un({},e),{},null==s?{properties:l,newProperties:null}:null==l?{properties:null,newProperties:s}:{properties:l,newProperties:s});case"split_node":return un(un({},e),{},{type:"merge_node",path:Xo.next(e.path)})}}},fn=e=>"object"==typeof e&&null!==e,hn=(e,t)=>{for(var o in e){var n=e[o],r=t[o];if(Array.isArray(n)&&Array.isArray(r)){if(n.length!==r.length)return!1;for(var i=0;i<n.length;i++)if(n[i]!==r[i])return!1}else if(fn(n)&&fn(r)){if(!hn(n,r))return!1}else if(n!==r)return!1}for(var a in t)if(void 0===e[a]&&void 0!==t[a])return!1;return!0},mn=e=>e.selection?e.selection:e.children.length>0?gn.end(e,[]):[0];!function(e){e[e.None=0]="None",e[e.Extend=1]="Extend",e[e.ZWJ=2]="ZWJ",e[e.RI=4]="RI",e[e.Prepend=8]="Prepend",e[e.SpacingMark=16]="SpacingMark",e[e.L=32]="L",e[e.V=64]="V",e[e.T=128]="T",e[e.LV=256]="LV",e[e.LVT=512]="LVT",e[e.ExtPict=1024]="ExtPict",e[e.Any=2048]="Any"}(dn||(dn={})),dn.L,dn.L,dn.V,dn.LV,dn.LVT,dn.LV,dn.V,dn.V,dn.T,dn.LVT,dn.T,dn.T,dn.Any,dn.Extend,dn.ZWJ,dn.Any,dn.SpacingMark,dn.Prepend,dn.Any,dn.ZWJ,dn.ExtPict,dn.RI,dn.RI;var gn={above:(e,t)=>e.above(t),addMark(e,t,o){e.addMark(t,o)},after:(e,t,o)=>e.after(t,o),before:(e,t,o)=>e.before(t,o),deleteBackward(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{unit:o="character"}=t;e.deleteBackward(o)},deleteForward(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{unit:o="character"}=t;e.deleteForward(o)},deleteFragment(e,t){e.deleteFragment(t)},edges:(e,t)=>e.edges(t),elementReadOnly(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e.elementReadOnly(t)},end:(e,t)=>e.end(t),first:(e,t)=>e.first(t),fragment:(e,t)=>e.fragment(t),hasBlocks:(e,t)=>e.hasBlocks(t),hasInlines:(e,t)=>e.hasInlines(t),hasPath:(e,t)=>e.hasPath(t),hasTexts:(e,t)=>e.hasTexts(t),insertBreak(e){e.insertBreak()},insertFragment(e,t,o){e.insertFragment(t,o)},insertNode(e,t){e.insertNode(t)},insertSoftBreak(e){e.insertSoftBreak()},insertText(e,t){e.insertText(t)},isBlock:(e,t)=>e.isBlock(t),isEdge:(e,t,o)=>e.isEdge(t,o),isEditor:e=>function(e){var{deep:t=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!fn(e))return!1;var o="function"==typeof e.addMark&&"function"==typeof e.apply&&"function"==typeof e.deleteFragment&&"function"==typeof e.insertBreak&&"function"==typeof e.insertSoftBreak&&"function"==typeof e.insertFragment&&"function"==typeof e.insertNode&&"function"==typeof e.insertText&&"function"==typeof e.isElementReadOnly&&"function"==typeof e.isInline&&"function"==typeof e.isSelectable&&"function"==typeof e.isVoid&&"function"==typeof e.normalizeNode&&"function"==typeof e.onChange&&"function"==typeof e.removeMark&&"function"==typeof e.getDirtyPaths&&(null===e.marks||fn(e.marks))&&(null===e.selection||en.isRange(e.selection))&&(!t||ln.isNodeList(e.children))&&pn.isOperationList(e.operations);return o}(e),isElementReadOnly:(e,t)=>e.isElementReadOnly(t),isEmpty:(e,t)=>e.isEmpty(t),isEnd:(e,t,o)=>e.isEnd(t,o),isInline:(e,t)=>e.isInline(t),isNormalizing:e=>e.isNormalizing(),isSelectable:(e,t)=>e.isSelectable(t),isStart:(e,t,o)=>e.isStart(t,o),isVoid:(e,t)=>e.isVoid(t),last:(e,t)=>e.last(t),leaf:(e,t,o)=>e.leaf(t,o),levels:(e,t)=>e.levels(t),marks:e=>e.getMarks(),next:(e,t)=>e.next(t),node:(e,t,o)=>e.node(t,o),nodes:(e,t)=>e.nodes(t),normalize(e,t){e.normalize(t)},parent:(e,t,o)=>e.parent(t,o),path:(e,t,o)=>e.path(t,o),pathRef:(e,t,o)=>e.pathRef(t,o),pathRefs:e=>e.pathRefs(),point:(e,t,o)=>e.point(t,o),pointRef:(e,t,o)=>e.pointRef(t,o),pointRefs:e=>e.pointRefs(),positions:(e,t)=>e.positions(t),previous:(e,t)=>e.previous(t),range:(e,t,o)=>e.range(t,o),rangeRef:(e,t,o)=>e.rangeRef(t,o),rangeRefs:e=>e.rangeRefs(),removeMark(e,t){e.removeMark(t)},setNormalizing(e,t){e.setNormalizing(t)},start:(e,t)=>e.start(t),string:(e,t,o)=>e.string(t,o),unhangRange:(e,t,o)=>e.unhangRange(t,o),void:(e,t)=>e.void(t),withoutNormalizing(e,t){e.withoutNormalizing(t)},shouldMergeNodesRemovePrevNode:(e,t,o)=>e.shouldMergeNodesRemovePrevNode(t,o)};function vn(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),o.push.apply(o,n)}return o}function bn(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?vn(Object(o),!0).forEach(function(t){Ko(e,t,o[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):vn(Object(o)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))})}return e}var yn={compare(e,t){var o=Xo.compare(e.path,t.path);return 0===o?e.offset<t.offset?-1:e.offset>t.offset?1:0:o},isAfter:(e,t)=>1===yn.compare(e,t),isBefore:(e,t)=>-1===yn.compare(e,t),equals:(e,t)=>e.offset===t.offset&&Xo.equals(e.path,t.path),isPoint:e=>fn(e)&&"number"==typeof e.offset&&Xo.isPath(e.path),transform(e,t){var o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(null===e)return null;var{affinity:n="forward"}=o,{path:r,offset:i}=e;switch(t.type){case"insert_node":case"move_node":r=Xo.transform(r,t,o);break;case"insert_text":Xo.equals(t.path,r)&&(t.offset<i||t.offset===i&&"forward"===n)&&(i+=t.text.length);break;case"merge_node":Xo.equals(t.path,r)&&(i+=t.position),r=Xo.transform(r,t,o);break;case"remove_text":Xo.equals(t.path,r)&&t.offset<=i&&(i-=Math.min(i-t.offset,t.text.length));break;case"remove_node":if(Xo.equals(t.path,r)||Xo.isAncestor(t.path,r))return null;r=Xo.transform(r,t,o);break;case"split_node":if(Xo.equals(t.path,r)){if(t.position===i&&null==n)return null;(t.position<i||t.position===i&&"forward"===n)&&(i-=t.position,r=Xo.transform(r,t,bn(bn({},o),{},{affinity:"forward"})))}else r=Xo.transform(r,t,o);break;default:return e}return{path:r,offset:i}}},xn=void 0,wn={setScrubber(e){xn=e},stringify:e=>JSON.stringify(e,xn)},kn=["text"],On=["anchor","focus","merge"];function En(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),o.push.apply(o,n)}return o}function Cn(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?En(Object(o),!0).forEach(function(t){Ko(e,t,o[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):En(Object(o)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))})}return e}var jn={equals(e,t){var o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},{loose:n=!1}=o;function r(e){return Zo(e,kn)}return hn(n?r(e):e,n?r(t):t)},isText:e=>fn(e)&&"string"==typeof e.text,isTextList:e=>Array.isArray(e)&&e.every(e=>jn.isText(e)),isTextProps:e=>void 0!==e.text,matches(e,t){for(var o in t)if("text"!==o&&(!e.hasOwnProperty(o)||e[o]!==t[o]))return!1;return!0},decorations(e,t){var o=[{leaf:Cn({},e)}];for(var n of t){var{anchor:r,focus:i,merge:a}=n,s=Zo(n,On),[l,c]=en.edges(n),u=[],d=0,p=l.offset,f=c.offset,h=null!=a?a:Object.assign;for(var{leaf:m}of o){var{length:g}=m.text,v=d;if(d+=g,p<=v&&d<=f)h(m,s),u.push({leaf:m});else if(p!==f&&(p===d||f===v)||p>d||f<v||f===v&&0!==v)u.push({leaf:m});else{var b=m,y=void 0,x=void 0;if(f<d){var w=f-v;x={leaf:Cn(Cn({},b),{},{text:b.text.slice(w)})},b=Cn(Cn({},b),{},{text:b.text.slice(0,w)})}if(p>v){var k=p-v;y={leaf:Cn(Cn({},b),{},{text:b.text.slice(0,k)})},b=Cn(Cn({},b),{},{text:b.text.slice(k)})}h(b,s),y&&u.push(y),u.push({leaf:b}),x&&u.push(x)}}o=u}if(o.length>1){var O=0;for(var[E,C]of o.entries()){var j=O,N=j+C.leaf.text.length,S={start:j,end:N};0===E&&(S.isFirst=!0),E===o.length-1&&(S.isLast=!0),C.position=S,O=N}}return o}};function Nn(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),o.push.apply(o,n)}return o}function Sn(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?Nn(Object(o),!0).forEach(function(t){Ko(e,t,o[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):Nn(Object(o)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))})}return e}var Pn=function(e,t){for(var o=arguments.length,n=new Array(o>2?o-2:0),r=2;r<o;r++)n[r-2]=arguments[r];return[...e.slice(0,t),...n,...e.slice(t)]},_n=function(e,t,o){for(var n=arguments.length,r=new Array(n>3?n-3:0),i=3;i<n;i++)r[i-3]=arguments[i];return[...e.slice(0,t),...r,...e.slice(t+o)]},Rn=_n,Tn=(e,t,o)=>{if(0===t.length)throw new Error("Cannot modify the editor");for(var n=ln.get(e,t),r=t.slice(),i=o(n);r.length>1;){var a=r.pop(),s=ln.get(e,r);i=Sn(Sn({},s),{},{children:_n(s.children,a,1,i)})}var l=r.pop();e.children=_n(e.children,l,1,i)},An=(e,t,o)=>{0===t.length?e.children=o(e.children):Tn(e,t,e=>{if(jn.isText(e))throw new Error("Cannot get the element at path [".concat(t,"] because it refers to a leaf node: ").concat(wn.stringify(e)));return Sn(Sn({},e),{},{children:o(e.children)})})},In=(e,t,o)=>Tn(e,t,e=>{if(!jn.isText(e))throw new Error("Cannot get the leaf node at path [".concat(t,"] because it refers to a non-leaf node: ").concat(wn.stringify(e)));return o(e)});function Mn(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),o.push.apply(o,n)}return o}function Ln(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?Mn(Object(o),!0).forEach(function(t){Ko(e,t,o[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):Mn(Object(o)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))})}return e}var Dn={transform(e,t){var o=!1;switch(t.type){case"insert_node":var{path:n,node:r}=t;An(e,Xo.parent(n),e=>{var t=n[n.length-1];if(t>e.length)throw new Error('Cannot apply an "insert_node" operation at path ['.concat(n,"] because the destination is past the end of the node."));return Pn(e,t,r)}),o=!0;break;case"insert_text":var{path:i,offset:a,text:s}=t;if(0===s.length)break;In(e,i,e=>{var t=e.text.slice(0,a),o=e.text.slice(a);return Ln(Ln({},e),{},{text:t+s+o})}),o=!0;break;case"merge_node":var{path:l}=t,c=l[l.length-1],u=Xo.previous(l),d=u[u.length-1];An(e,Xo.parent(l),e=>{var t,o=e[c],n=e[d];if(jn.isText(o)&&jn.isText(n))t=Ln(Ln({},n),{},{text:n.text+o.text});else{if(jn.isText(o)||jn.isText(n))throw new Error('Cannot apply a "merge_node" operation at path ['.concat(l,"] to nodes of different interfaces: ").concat(wn.stringify(o)," ").concat(wn.stringify(n)));t=Ln(Ln({},n),{},{children:n.children.concat(o.children)})}return _n(e,d,2,t)}),o=!0;break;case"move_node":var{path:p,newPath:f}=t,h=p[p.length-1];if(Xo.isAncestor(p,f))throw new Error("Cannot move a path [".concat(p,"] to new path [").concat(f,"] because the destination is inside itself."));var m=ln.get(e,p);An(e,Xo.parent(p),e=>Rn(e,h,1));var g=Xo.transform(p,t),v=g[g.length-1];An(e,Xo.parent(g),e=>Pn(e,v,m)),o=!0;break;case"remove_node":var{path:b}=t,y=b[b.length-1];if(An(e,Xo.parent(b),e=>Rn(e,y,1)),e.selection){var x=Ln({},e.selection);for(var[w,k]of en.points(x)){var O=yn.transform(w,t);if(null!=x&&null!=O)x[k]=O;else{var E=void 0,C=void 0;for(var[j,N]of ln.texts(e)){if(-1!==Xo.compare(N,b)){C=[j,N];break}E=[j,N]}var S=!1;E&&C&&(S=!Xo.isSibling(E[1],b)&&(!!Xo.equals(C[1],b)||Xo.common(E[1],b).length<Xo.common(C[1],b).length)),E&&!S?x[k]={path:E[1],offset:E[0].text.length}:C?x[k]={path:C[1],offset:0}:x=null}}x&&en.equals(x,e.selection)||(e.selection=x)}break;case"remove_text":var{path:P,offset:_,text:R}=t;if(0===R.length)break;In(e,P,e=>{var t=e.text.slice(0,_),o=e.text.slice(_+R.length);return Ln(Ln({},e),{},{text:t+o})}),o=!0;break;case"set_node":var{path:T,properties:A,newProperties:I}=t;if(0===T.length)throw new Error("Cannot set properties on the root node!");Tn(e,T,e=>{var t=Ln({},e);for(var o in I){if("children"===o||"text"===o)throw new Error('Cannot set the "'.concat(o,'" property of nodes!'));var n=I[o];null==n?delete t[o]:t[o]=n}for(var r in A)I.hasOwnProperty(r)||delete t[r];return t});break;case"set_selection":var{newProperties:M}=t;if(null==M){e.selection=null;break}if(null==e.selection){if(!en.isRange(M))throw new Error('Cannot apply an incomplete "set_selection" operation properties '.concat(wn.stringify(M)," when there is no current selection."));e.selection=Ln({},M);break}var L=Ln({},e.selection);for(var D in M){var B=M[D];if(null==B){if("anchor"===D||"focus"===D)throw new Error('Cannot remove the "'.concat(D,'" selection property'));delete L[D]}else L[D]=B}e.selection=L;break;case"split_node":var{path:z,position:F,properties:q}=t,$=z[z.length-1];if(0===z.length)throw new Error('Cannot apply a "split_node" operation at path ['.concat(z,"] because the root node cannot be split."));An(e,Xo.parent(z),e=>{var t,o,n=e[$];if(jn.isText(n)){var r=n.text.slice(0,F),i=n.text.slice(F);t=Ln(Ln({},n),{},{text:r}),o=Ln(Ln({},q),{},{text:i})}else{var a=n.children.slice(0,F),s=n.children.slice(F);t=Ln(Ln({},n),{},{children:a}),o=Ln(Ln({},q),{},{children:s})}return _n(e,$,1,t,o)}),o=!0}if(o&&e.selection){var V=Ln({},e.selection);for(var[H,W]of en.points(V))V[W]=yn.transform(H,t);en.equals(V,e.selection)||(e.selection=V)}}},Bn={insertNodes(e,t,o){e.insertNodes(t,o)},liftNodes(e,t){e.liftNodes(t)},mergeNodes(e,t){e.mergeNodes(t)},moveNodes(e,t){e.moveNodes(t)},removeNodes(e,t){e.removeNodes(t)},setNodes(e,t,o){e.setNodes(t,o)},splitNodes(e,t){e.splitNodes(t)},unsetNodes(e,t,o){e.unsetNodes(t,o)},unwrapNodes(e,t){e.unwrapNodes(t)},wrapNodes(e,t,o){e.wrapNodes(t,o)}},zn={collapse(e,t){e.collapse(t)},deselect(e){e.deselect()},move(e,t){e.move(t)},select(e,t){e.select(t)},setPoint(e,t,o){e.setPoint(t,o)},setSelection(e,t){e.setSelection(t)}},Fn={delete(e,t){e.delete(t)},insertFragment(e,t,o){e.insertFragment(t,o)},insertText(e,t){var o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};gn.withoutNormalizing(e,()=>{var{voids:n=!1}=o,{at:r=mn(e)}=o;if(Xo.isPath(r)&&(r=gn.range(e,r)),en.isRange(r))if(en.isCollapsed(r))r=r.anchor;else{var i=en.end(r);if(!n&&gn.void(e,{at:i}))return;var a=en.start(r),s=gn.pointRef(e,a),l=gn.pointRef(e,i);Vn.delete(e,{at:r,voids:n});var c=s.unref(),u=l.unref();r=c||u,Vn.setSelection(e,{anchor:r,focus:r})}if(!(!n&&gn.void(e,{at:r})||gn.elementReadOnly(e,{at:r}))){var{path:d,offset:p}=r;t.length>0&&e.apply({type:"insert_text",path:d,offset:p,text:t})}})}};function qn(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),o.push.apply(o,n)}return o}function $n(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?qn(Object(o),!0).forEach(function(t){Ko(e,t,o[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):qn(Object(o)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))})}return e}var Vn=$n($n($n($n({},Dn),Bn),zn),Fn);const Hn="ArrowUp",Wn="ArrowDown",Gn="Enter",Xn="Escape";function Yn(e){return e.toLowerCase().trim()}function Un(e,t){var o,n,r;if(!t)return 0;const i=Yn(t),a=Yn(e.title),s=Yn(e.id);return a===i?100:a.startsWith(i)?80:s.startsWith(i)?70:(null===(o=e.keywords)||void 0===o?void 0:o.some(e=>Yn(e)===i))?60:a.includes(i)?50:(null===(n=e.keywords)||void 0===n?void 0:n.some(e=>Yn(e).startsWith(i)))?40:(null===(r=e.keywords)||void 0===r?void 0:r.some(e=>Yn(e).includes(i)))?30:e.description&&Yn(e.description).includes(i)?20:10}function Kn({items:e,search:t}){const o=h(()=>{const o=e.filter(e=>!e.disabled&&function(e,t){var o;if(!t)return!0;const n=Yn(t);return!!(Yn(e.title).includes(n)||Yn(e.id).includes(n)||e.description&&Yn(e.description).includes(n)||(null===(o=e.keywords)||void 0===o?void 0:o.some(e=>Yn(e).includes(n))))}(e,t));return t&&o.sort((e,o)=>Un(o,t)-Un(e,t)),o},[e,t]),n=h(()=>{const e=new Map;return o.forEach(t=>{const o=t.group||"default",n=e.get(o)||[];e.set(o,[...n,t])}),e},[o]);return{filteredItems:o,groupedItems:n,isEmpty:0===o.length}}const Zn="undefined"!=typeof window?s:l;const Jn={isOpen:!1,search:"",selectedIndex:0,virtualElement:null,floatingContext:null};function Qn(e,t){switch(t.type){case"OPEN":return Object.assign(Object.assign({},e),{isOpen:!0,search:"",selectedIndex:0,virtualElement:t.virtualElement,floatingContext:t.floatingContext});case"CLOSE":return Object.assign(Object.assign({},e),{isOpen:!1,search:"",selectedIndex:0,virtualElement:null,floatingContext:null});case"SET_SEARCH":return Object.assign(Object.assign({},e),{search:t.search,selectedIndex:0});case"SET_SELECTED_INDEX":return Object.assign(Object.assign({},e),{selectedIndex:t.index});case"RESET_SELECTION":return Object.assign(Object.assign({},e),{selectedIndex:0});default:return e}}function er({items:e,trigger:t="/",onSelect:o}){const n=w(),[r,i]=y(Qn,Jn),a=h(()=>{if(!r.isOpen)return e;let t=null;if("number"==typeof n.path.current){const e=k.getBlockSlate(n,{at:n.path.current});e&&(t=O(n,e))}return t&&t.length>0?t.map(e=>{var t,o;const r=null===(t=n.plugins[e].options)||void 0===t?void 0:t.display;return{id:e,title:null!==(o=null==r?void 0:r.title)&&void 0!==o?o:e,description:null==r?void 0:r.description,icon:null==r?void 0:r.icon}}):e},[e,r.isOpen,n]),{filteredItems:s,groupedItems:c,isEmpty:u}=Kn({items:a,search:r.search}),{refs:p,floatingStyles:f,floatingContext:m}=function({isOpen:e,virtualElement:t}){const{refs:o,floatingStyles:n,context:r,update:i}=ro({open:e,placement:"bottom-start",whileElementsMounted:ft,middleware:[St(),Ct(10),Nt({fallbackPlacements:["top-start","top","bottom"],padding:10,crossAxis:!1,fallbackStrategy:"bestFit"}),jt({padding:10}),(a={apply({availableHeight:e,elements:t}){Object.assign(t.floating.style,{maxHeight:`${Math.max(200,e-20)}px`})},padding:10},{...vt(a),options:[a,s]})],strategy:"fixed"});var a,s;return Zn(()=>{t&&(o.setReference(t),i())},[o,e,t,i]),{refs:o,floatingStyles:n,floatingContext:r}}({isOpen:r.isOpen,virtualElement:r.virtualElement}),{isMounted:g,styles:v}=lo(m,{duration:100}),b=d((e,t)=>{i({type:"OPEN",virtualElement:e,floatingContext:t})},[]),x=d(()=>{i({type:"CLOSE"})},[]),E=d(e=>{i({type:"SET_SEARCH",search:e})},[]),C=e=>{i({type:"SET_SELECTED_INDEX",index:e})},j=()=>{const e=s[r.selectedIndex];e&&(e.onSelect&&e.onSelect(),o?o(e):n.toggleBlock(e.id,{scope:"auto",focus:!0,preserveContent:!1}),x())};l(()=>{var e,o;if("number"!=typeof n.path.current)return;if(!k.getBlock(n,{at:n.path.current}))return;const i=n.refElement;if(!i)return;const a=e=>{if(e.isComposing)return;const t=k.getBlockSlate(n,{at:n.path.current});if(!(null==t?void 0:t.selection))return;if(i.contains(e.target)){if(function(e){return function(e){return"/"===e.key||191===e.keyCode||191===e.which||"Slash"===e.code||"/"===e.key||"."===e.key&&e.shiftKey}(e)}(e)){const e=Xo.parent(t.selection.anchor.path),o=gn.string(t,e);if(gn.isStart(t,t.selection.anchor,t.selection.focus)&&0===o.trim().length){const e=function(){const e=window.getSelection();if(!e||0===e.rangeCount)return null;const t=e.getRangeAt(0),o=t.getBoundingClientRect(),n=t.getClientRects();return{getBoundingClientRect:()=>o,getClientRects:()=>n}}();e&&b(e,m)}}r.isOpen&&(e.key===Wn?(e.preventDefault(),e.stopPropagation(),C(r.selectedIndex===s.length-1?0:r.selectedIndex+1)):e.key===Hn?(e.preventDefault(),e.stopPropagation(),C(0===r.selectedIndex?s.length-1:r.selectedIndex-1)):e.key===Gn?(e.preventDefault(),e.stopPropagation(),j()):e.key===Xn&&(e.preventDefault(),e.stopPropagation(),x()))}},l=e=>{if(e.isComposing)return;if(!r.isOpen)return;if(e.key===Wn||e.key===Hn)return;const o=k.getBlockSlate(n,{at:n.path.current});if(!(null==o?void 0:o.selection))return;const i=Xo.parent(o.selection.anchor.path),a=gn.string(o,i);if(0===a.length)return void x();const s=a.replace(t,"").trim();E(s)};return null===(e=n.refElement)||void 0===e||e.addEventListener("keydown",a),null===(o=n.refElement)||void 0===o||o.addEventListener("keyup",l),()=>{var e,t;null===(e=n.refElement)||void 0===e||e.removeEventListener("keydown",a),null===(t=n.refElement)||void 0===t||t.removeEventListener("keyup",l)}},[n.path.current,r.isOpen,r.selectedIndex,p.setReference,t,b,x,E,s.length]),l(()=>{if(!r.isOpen)return;const e=e=>{var t,o;const n=e.target;(null===(o=null===(t=p.floating)||void 0===t?void 0:t.current)||void 0===o?void 0:o.contains(n))||x()},t=setTimeout(()=>{document.addEventListener("mousedown",e)},0);return()=>{clearTimeout(t),document.removeEventListener("mousedown",e)}},[r.isOpen,x,p.floating]),l(()=>{if(!r.isOpen||!u||0===r.search.length)return;const e=setTimeout(()=>{u&&x()},2e3);return()=>clearTimeout(e)},[r.isOpen,u,r.search,x]),l(()=>{if(!r.isOpen)return;const e=document.body.style.overflow,t=document.body.style.paddingRight,o=window.innerWidth-document.documentElement.clientWidth;return document.body.style.overflow="hidden",o>0&&(document.body.style.paddingRight=`${o}px`),()=>{document.body.style.overflow=e,document.body.style.paddingRight=t}},[r.isOpen]);return{refs:p,state:r,items:e,isEmpty:u,actionHandlers:{open:b,close:x,setSearch:E,selectItem:C,executeSelected:j},groupedItems:c,filteredItems:s,floatingStyles:f,transitionStyles:v,isMounted:g}}o('.slash-command-root{--slash-command-bg:#fff;--slash-command-bg-hover:#f4f4f5;--slash-command-bg-selected:#f4f4f5;--slash-command-border:#e4e4e7;--slash-command-border-radius:.375rem;--slash-command-shadow:0 16px 48px -12px rgba(0,0,0,.18),0 4px 16px -4px rgba(0,0,0,.1);--slash-command-text:#18181b;--slash-command-text-muted:#71717a;--slash-command-text-disabled:#a1a1aa;--slash-command-accent:#3b82f6;--slash-command-item-radius:8px;--slash-command-icon-bg:#fff;--slash-command-icon-border:#e4e4e7;--slash-command-font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif;--slash-command-font-mono:ui-monospace,SFMono-Regular,"SF Mono",Menlo,monospace}.dark .slash-command-root,.slash-command-root[data-theme=dark]{--slash-command-bg:#18181b;--slash-command-bg-hover:#27272a;--slash-command-bg-selected:#27272a;--slash-command-border:#3f3f46;--slash-command-text:#fafafa;--slash-command-text-muted:#a1a1aa;--slash-command-text-disabled:#52525b;--slash-command-icon-bg:#27272a;--slash-command-icon-border:#3f3f46}.slash-command-content{animation:slash-command-in .15s ease-out;background-color:var(--slash-command-bg);border:1px solid var(--slash-command-border);border-radius:var(--slash-command-border-radius);box-shadow:var(--slash-command-shadow);display:flex;flex-direction:column;font-family:var(--slash-command-font-family);max-height:400px;overflow:hidden;width:300px;z-index:9999}@keyframes slash-command-in{0%{opacity:0;transform:translateY(-8px) scale(.96)}to{opacity:1;transform:translateY(0) scale(1)}}.slash-command-input-wrapper{align-items:center;border-bottom:1px solid var(--slash-command-border);display:flex;flex-shrink:0;gap:8px;padding:12px 14px}.slash-command-input-trigger{color:var(--slash-command-text-muted);font-family:var(--slash-command-font-mono);font-size:14px;font-weight:500;-webkit-user-select:none;-moz-user-select:none;user-select:none}.slash-command-input{background-color:transparent;border:none;color:var(--slash-command-text);flex:1;font-family:var(--slash-command-font-family);font-size:14px;min-width:0;outline:none}.slash-command-input::-moz-placeholder{color:var(--slash-command-text-muted)}.slash-command-input::placeholder{color:var(--slash-command-text-muted)}.slash-command-kbd{align-items:center;background-color:var(--slash-command-bg-hover);border:1px solid var(--slash-command-border);border-radius:4px;color:var(--slash-command-text-muted);display:inline-flex;font-family:var(--slash-command-font-family);font-size:10px;font-weight:500;justify-content:center;padding:2px 6px;-webkit-user-select:none;-moz-user-select:none;user-select:none}.slash-command-list{display:flex;flex:1;flex-direction:column;gap:2px;overflow-x:hidden;overflow-y:auto;overscroll-behavior:contain;padding:.5rem .25rem}.slash-command-list::-webkit-scrollbar{width:6px}.slash-command-list::-webkit-scrollbar-track{background:transparent}.slash-command-list::-webkit-scrollbar-thumb{background-color:var(--slash-command-border);border-radius:3px}.slash-command-list::-webkit-scrollbar-thumb:hover{background-color:var(--slash-command-text-muted)}.slash-command-group{margin-bottom:8px}.slash-command-group:last-child{margin-bottom:0}.slash-command-group-heading{color:var(--slash-command-text-muted);font-size:11px;font-weight:600;letter-spacing:.05em;padding:8px 12px 6px;text-transform:uppercase;-webkit-user-select:none;-moz-user-select:none;user-select:none}.slash-command-item{align-items:center;background-color:transparent;border:none;border-radius:var(--slash-command-item-radius);cursor:pointer;display:flex;font-family:var(--slash-command-font-family);gap:12px;outline:none;padding:4px 6px;text-align:left;transition:background-color .1s ease;width:100%}.slash-command-item:hover,.slash-command-item[data-selected=true]{background-color:var(--slash-command-bg-selected)}.slash-command-item:focus-visible{outline:2px solid var(--slash-command-accent);outline-offset:-2px}.slash-command-item[data-disabled=true]{cursor:not-allowed;opacity:.5;pointer-events:none}.slash-command-item-icon{align-items:center;background-color:var(--slash-command-icon-bg);border:1px solid var(--slash-command-icon-border);border-radius:8px;color:var(--slash-command-text-muted);display:flex;flex-shrink:0;height:40px;justify-content:center;transition:border-color .1s ease,box-shadow .1s ease;width:40px}.slash-command-item[data-selected=true] .slash-command-item-icon{border-color:var(--slash-command-text-muted);box-shadow:0 1px 3px rgba(0,0,0,.06)}.slash-command-item-icon svg{height:20px;width:20px}.slash-command-item-content{flex:1;min-width:0}.slash-command-item-title{color:var(--slash-command-text);font-size:14px;font-weight:500}.slash-command-item-description,.slash-command-item-title{line-height:1.4;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.slash-command-item-description{color:var(--slash-command-text-muted);font-size:12px;margin-top:1px}.slash-command-item-shortcut{align-items:center;display:flex;flex-shrink:0;gap:4px}.slash-command-empty{align-items:center;color:var(--slash-command-text-muted);display:flex;flex-direction:column;font-size:14px;justify-content:center;padding:32px 16px;text-align:center}.slash-command-empty-icon{margin-bottom:8px;opacity:.5}.slash-command-separator{background-color:var(--slash-command-border);height:1px;margin:8px 12px}.slash-command-footer{align-items:center;background-color:var(--slash-command-bg-hover);border-top:1px solid var(--slash-command-border);display:flex;flex-shrink:0;gap:16px;padding:8px 14px}.slash-command-footer-hint{align-items:center;color:var(--slash-command-text-muted);display:flex;font-size:11px;gap:4px}.slash-command-loading{align-items:center;display:flex;justify-content:center;padding:24px}.slash-command-spinner{animation:slash-command-spin .6s linear infinite;border:2px solid var(--slash-command-border);border-radius:50%;border-top-color:var(--slash-command-accent);height:20px;width:20px}@keyframes slash-command-spin{to{transform:rotate(1turn)}}');const tr=({children:e,items:t,trigger:o="/",onSelect:n,className:r})=>{const i=w(),a=h(()=>{if(Array.isArray(t)&&t.length>0)return t;return Object.keys(i.plugins).filter(e=>{var t,o;const n=C(i.plugins[e].elements),r=n?i.plugins[e].elements[n]:void 0;return"inline"!==(null===(t=null==r?void 0:r.props)||void 0===t?void 0:t.nodeType)&&"inlineVoid"!==(null===(o=null==r?void 0:r.props)||void 0===o?void 0:o.nodeType)}).map(e=>{var t,o;const n=null===(t=i.plugins[e].options)||void 0===t?void 0:t.display;return{id:e,title:null!==(o=null==n?void 0:n.title)&&void 0!==o?o:e,description:null==n?void 0:n.description,icon:null==n?void 0:n.icon}})},[t,i]),{state:s,actionHandlers:l,filteredItems:c,groupedItems:u,refs:d,floatingStyles:p,transitionStyles:f,isMounted:m}=er({items:a,trigger:o,onSelect:n}),g=h(()=>({state:s,actionHandlers:l,items:a,filteredItems:c,groupedItems:u,refs:d,floatingStyles:p}),[s,l,a,c,u,d,p]),v=Object.assign(Object.assign({},p),f),b="function"==typeof e?e({groupedItems:u,items:a}):e;return j(Do.Provider,Object.assign({value:g},{children:j("div",Object.assign({ref:d.setFloating,style:v,className:`slash-command-root ${null!=r?r:""}`},{children:m?b:null}))}))};tr.displayName="SlashCommand.Root";const or=({className:e})=>j("div",{role:"separator","aria-orientation":"horizontal",className:`slash-command-separator ${e||""}`});or.displayName="SlashCommand.Separator";const nr=Object.assign(tr,{Root:tr,Content:Lo,Input:Vo,List:Wo,Group:$o,Item:Ho,Empty:zo,Separator:or,Footer:qo,Loading:Go}),rr="yoopta-ui-theme",ir=()=>"undefined"==typeof window?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",ar=e=>{if("undefined"==typeof document)return;const t=document.documentElement;t.classList.remove("light","dark"),t.classList.add(e),t.setAttribute("data-theme",e),t.setAttribute("data-yoopta-theme",e)},sr=()=>{const[e,t]=p("system"),[o,n]=p("light");l(()=>{const e=(()=>{if("undefined"==typeof window)return"system";const e=localStorage.getItem(rr);return"light"===e||"dark"===e||"system"===e?e:"system"})();t(e);const o="system"===e?ir():e;n(o),ar(o)},[]),l(()=>{if("system"!==e)return;const t=window.matchMedia("(prefers-color-scheme: dark)"),o=e=>{const t=e.matches?"dark":"light";n(t),ar(t)};return t.addEventListener("change",o),()=>t.removeEventListener("change",o)},[e]);const r=e=>{t(e),localStorage.setItem(rr,e);const o="system"===e?ir():e;n(o),ar(o)};return{theme:e,resolvedTheme:o,setTheme:r,toggleTheme:()=>{r("light"===o?"dark":"light")}}},lr=v(void 0),cr=()=>{const e=b(lr);if(!e)throw new Error("useThemeContext must be used within ThemeProvider");return e},ur=({children:e,defaultTheme:t="system"})=>{const o=sr();return j(lr.Provider,Object.assign({value:o},{children:e}))},dr=({className:e})=>{const{resolvedTheme:t,toggleTheme:o}=sr();return j("button",Object.assign({onClick:o,className:e||"yoopta-ui-theme-toggle","aria-label":"Toggle theme",title:`Switch to ${"light"===t?"dark":"light"} mode`},{children:"light"===t?j("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},{children:j("path",{d:"M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"})})):N("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},{children:[j("circle",{cx:"12",cy:"12",r:"4"}),j("path",{d:"M12 2v2"}),j("path",{d:"M12 20v2"}),j("path",{d:"m4.93 4.93 1.41 1.41"}),j("path",{d:"m17.66 17.66 1.41 1.41"}),j("path",{d:"M2 12h2"}),j("path",{d:"M20 12h2"}),j("path",{d:"m6.34 17.66-1.41 1.41"}),j("path",{d:"m19.07 4.93-1.41 1.41"})]}))}))};function pr(){return(pr=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var n in o)Object.prototype.hasOwnProperty.call(o,n)&&(e[n]=o[n])}return e}).apply(this,arguments)}function fr(e,t){if(null==e)return{};var o,n,r={},i=Object.keys(e);for(n=0;n<i.length;n++)t.indexOf(o=i[n])>=0||(r[o]=e[o]);return r}function hr(e){var t=c(e),o=c(function(e){t.current&&t.current(e)});return t.current=e,o.current}o(".yoopta-highlight-color-picker{--hcp-bg:#fff;--hcp-fg:#18181b;--hcp-muted:#71717a;--hcp-border:#e4e4e7;--hcp-ring:#3b82f6;--hcp-shadow:0 16px 48px -12px rgba(0,0,0,.18),0 4px 16px -4px rgba(0,0,0,.1);--hcp-radius:10px;--hcp-pad:10px;--hcp-gap:10px;--hcp-width:224px;--hcp-picker-height:120px;--hcp-preset-size:24px;--hcp-input-height:26px;background:var(--hcp-bg);border:1px solid var(--hcp-border);border-radius:var(--hcp-radius);box-shadow:var(--hcp-shadow);color:var(--hcp-fg);display:flex;flex-direction:column;gap:8px;outline:none;padding:var(--hcp-pad);-webkit-user-select:none;-moz-user-select:none;user-select:none;width:var(--hcp-width);z-index:9999}.dark .yoopta-highlight-color-picker,.yoopta-highlight-color-picker[data-theme=dark]{--hcp-bg:#18181b;--hcp-fg:#fafafa;--hcp-muted:#a1a1aa;--hcp-border:#3f3f46;--hcp-shadow:0 16px 48px -12px rgba(0,0,0,.5),0 4px 16px -4px rgba(0,0,0,.3)}.yoopta-highlight-color-picker__mode-toggle{background:var(--hcp-border);border-radius:8px;display:flex;flex-shrink:0;gap:4px;padding:4px}.yoopta-highlight-color-picker__mode-btn{background:transparent;border:none;border-radius:6px;color:var(--hcp-muted);cursor:pointer;flex:1;font-size:11px;font-weight:500;line-height:1.4;outline:none;padding:4px 8px;text-align:center;transition:background-color .12s ease,color .12s ease}.yoopta-highlight-color-picker__mode-btn:hover{color:var(--hcp-fg)}.yoopta-highlight-color-picker__mode-btn[data-active=true]{background:var(--hcp-bg);box-shadow:0 1px 2px rgba(0,0,0,.1);color:var(--hcp-fg)}.yoopta-highlight-color-picker__mode-btn:focus-visible{outline:2px solid var(--hcp-ring);outline-offset:2px}.yoopta-highlight-color-picker__react-colorful{height:var(--hcp-picker-height)!important;width:100%!important}.yoopta-highlight-color-picker__react-colorful .react-colorful__saturation{border:1px solid var(--hcp-border);border-radius:8px}.yoopta-highlight-color-picker__react-colorful .react-colorful__hue{border:1px solid var(--hcp-border);border-radius:999px;height:10px;margin-top:8px}.yoopta-highlight-color-picker__react-colorful .react-colorful__pointer{border:2px solid var(--hcp-bg);border-radius:999px;box-shadow:0 2px 6px rgba(0,0,0,.22);height:16px;width:16px}.yoopta-highlight-color-picker__presets{align-items:center;display:flex;flex-direction:row;flex-wrap:nowrap;gap:6px;overflow-x:auto;padding-bottom:2px;scrollbar-color:var(--hcp-border) transparent;scrollbar-width:thin}.yoopta-highlight-color-picker__presets::-webkit-scrollbar{height:6px}.yoopta-highlight-color-picker__presets::-webkit-scrollbar-track{background:transparent}.yoopta-highlight-color-picker__presets::-webkit-scrollbar-thumb{background-color:var(--hcp-border);border-radius:999px}.yoopta-highlight-color-picker__preset{border:2px solid var(--hcp-border);border-radius:7px;cursor:pointer;flex:0 0 auto;height:var(--hcp-preset-size);outline:none;padding:0;transition:transform .12s ease,border-color .12s ease,box-shadow .12s ease;width:var(--hcp-preset-size)}.yoopta-highlight-color-picker__preset:hover{transform:scale(1.08)}.yoopta-highlight-color-picker__preset:focus-visible{border-color:var(--hcp-ring);box-shadow:0 0 0 2px var(--hcp-ring)}.yoopta-highlight-color-picker__preset[data-selected=true]{border-color:var(--hcp-ring);box-shadow:0 0 0 2px rgba(59,130,246,.35)}.yoopta-highlight-color-picker__hex-row{align-items:center;display:flex;gap:8px}.yoopta-highlight-color-picker__swatch{border:1px solid var(--hcp-border);border-radius:7px;flex:0 0 auto;height:var(--hcp-input-height);width:var(--hcp-input-height)}.yoopta-highlight-color-picker__hex-input{background:transparent;border:1px solid var(--hcp-border);border-radius:9px;color:var(--hcp-fg);flex:1;font-size:12px;height:var(--hcp-input-height);line-height:1;min-width:0;outline:none;padding:0 10px}.yoopta-highlight-color-picker__hex-input:focus{border-color:var(--hcp-ring);box-shadow:0 0 0 2px rgba(59,130,246,.25)}.yoopta-highlight-color-picker__hex-input::-moz-placeholder{color:var(--hcp-muted)}.yoopta-highlight-color-picker__hex-input::placeholder{color:var(--hcp-muted)}");var mr=function(e,t,o){return void 0===t&&(t=0),void 0===o&&(o=1),e>o?o:e<t?t:e},gr=function(e){return"touches"in e},vr=function(e){return e&&e.ownerDocument.defaultView||self},br=function(e,t,o){var n=e.getBoundingClientRect(),r=gr(t)?function(e,t){for(var o=0;o<e.length;o++)if(e[o].identifier===t)return e[o];return e[0]}(t.touches,o):t;return{left:mr((r.pageX-(n.left+vr(e).pageXOffset))/n.width),top:mr((r.pageY-(n.top+vr(e).pageYOffset))/n.height)}},yr=function(e){!gr(e)&&e.preventDefault()},xr=i.memo(function(e){var t=e.onMove,o=e.onKey,n=fr(e,["onMove","onKey"]),r=c(null),a=hr(t),s=hr(o),u=c(null),d=c(!1),p=h(function(){var e=function(e){yr(e),(gr(e)?e.touches.length>0:e.buttons>0)&&r.current?a(br(r.current,e,u.current)):o(!1)},t=function(){return o(!1)};function o(o){var n=d.current,i=vr(r.current),a=o?i.addEventListener:i.removeEventListener;a(n?"touchmove":"mousemove",e),a(n?"touchend":"mouseup",t)}return[function(e){var t=e.nativeEvent,n=r.current;if(n&&(yr(t),!function(e,t){return t&&!gr(e)}(t,d.current)&&n)){if(gr(t)){d.current=!0;var i=t.changedTouches||[];i.length&&(u.current=i[0].identifier)}n.focus(),a(br(n,t,u.current)),o(!0)}},function(e){var t=e.which||e.keyCode;t<37||t>40||(e.preventDefault(),s({left:39===t?.05:37===t?-.05:0,top:40===t?.05:38===t?-.05:0}))},o]},[s,a]),f=p[0],m=p[1],g=p[2];return l(function(){return g},[g]),i.createElement("div",pr({},n,{onTouchStart:f,onMouseDown:f,className:"react-colorful__interactive",ref:r,onKeyDown:m,tabIndex:0,role:"slider"}))}),wr=function(e){return e.filter(Boolean).join(" ")},kr=function(e){var t=e.color,o=e.left,n=e.top,r=void 0===n?.5:n,a=wr(["react-colorful__pointer",e.className]);return i.createElement("div",{className:a,style:{top:100*r+"%",left:100*o+"%"}},i.createElement("div",{className:"react-colorful__pointer-fill",style:{backgroundColor:t}}))},Or=function(e,t,o){return void 0===t&&(t=0),void 0===o&&(o=Math.pow(10,t)),Math.round(o*e)/o},Er=function(e){return"#"===e[0]&&(e=e.substring(1)),e.length<6?{r:parseInt(e[0]+e[0],16),g:parseInt(e[1]+e[1],16),b:parseInt(e[2]+e[2],16),a:4===e.length?Or(parseInt(e[3]+e[3],16)/255,2):1}:{r:parseInt(e.substring(0,2),16),g:parseInt(e.substring(2,4),16),b:parseInt(e.substring(4,6),16),a:8===e.length?Or(parseInt(e.substring(6,8),16)/255,2):1}},Cr=function(e){var t=function(e){var t=e.s,o=e.v,n=e.a,r=(200-t)*o/100;return{h:Or(e.h),s:Or(r>0&&r<200?t*o/100/(r<=100?r:200-r)*100:0),l:Or(r/2),a:Or(n,2)}}(e);return"hsl("+t.h+", "+t.s+"%, "+t.l+"%)"},jr=function(e){var t=e.h,o=e.s,n=e.v,r=e.a;t=t/360*6,o/=100,n/=100;var i=Math.floor(t),a=n*(1-o),s=n*(1-(t-i)*o),l=n*(1-(1-t+i)*o),c=i%6;return{r:Or(255*[n,s,a,a,l,n][c]),g:Or(255*[l,n,n,s,a,a][c]),b:Or(255*[a,a,l,n,n,s][c]),a:Or(r,2)}},Nr=function(e){var t=e.toString(16);return t.length<2?"0"+t:t},Sr=function(e){var t=e.r,o=e.g,n=e.b,r=e.a,i=r<1?Nr(Or(255*r)):"";return"#"+Nr(t)+Nr(o)+Nr(n)+i},Pr=function(e){var t=e.r,o=e.g,n=e.b,r=e.a,i=Math.max(t,o,n),a=i-Math.min(t,o,n),s=a?i===t?(o-n)/a:i===o?2+(n-t)/a:4+(t-o)/a:0;return{h:Or(60*(s<0?s+6:s)),s:Or(i?a/i*100:0),v:Or(i/255*100),a:r}},_r=i.memo(function(e){var t=e.hue,o=e.onChange,n=wr(["react-colorful__hue",e.className]);return i.createElement("div",{className:n},i.createElement(xr,{onMove:function(e){o({h:360*e.left})},onKey:function(e){o({h:mr(t+360*e.left,0,360)})},"aria-label":"Hue","aria-valuenow":Or(t),"aria-valuemax":"360","aria-valuemin":"0"},i.createElement(kr,{className:"react-colorful__hue-pointer",left:t/360,color:Cr({h:t,s:100,v:100,a:1})})))}),Rr=i.memo(function(e){var t=e.hsva,o=e.onChange,n={backgroundColor:Cr({h:t.h,s:100,v:100,a:1})};return i.createElement("div",{className:"react-colorful__saturation",style:n},i.createElement(xr,{onMove:function(e){o({s:100*e.left,v:100-100*e.top})},onKey:function(e){o({s:mr(t.s+100*e.left,0,100),v:mr(t.v-100*e.top,0,100)})},"aria-label":"Color","aria-valuetext":"Saturation "+Or(t.s)+"%, Brightness "+Or(t.v)+"%"},i.createElement(kr,{className:"react-colorful__saturation-pointer",top:1-t.v/100,left:t.s/100,color:Cr(t)})))}),Tr=function(e,t){if(e===t)return!0;for(var o in e)if(e[o]!==t[o])return!1;return!0};function Ar(e,t,o){var n=hr(o),r=p(function(){return e.toHsva(t)}),i=r[0],a=r[1],s=c({color:t,hsva:i});l(function(){if(!e.equal(t,s.current.color)){var o=e.toHsva(t);s.current={hsva:o,color:t},a(o)}},[t,e]),l(function(){var t;Tr(i,s.current.hsva)||e.equal(t=e.fromHsva(i),s.current.color)||(s.current={hsva:i,color:t},n(t))},[i,e,n]);var u=d(function(e){a(function(t){return Object.assign({},t,e)})},[]);return[i,u]}var Ir="undefined"!=typeof window?s:l,Mr=new Map,Lr=function(e){Ir(function(){var t=e.current?e.current.ownerDocument:document;if(void 0!==t&&!Mr.has(t)){var o=t.createElement("style");o.innerHTML='.react-colorful{position:relative;display:flex;flex-direction:column;width:200px;height:200px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:default}.react-colorful__saturation{position:relative;flex-grow:1;border-color:transparent;border-bottom:12px solid #000;border-radius:8px 8px 0 0;background-image:linear-gradient(0deg,#000,transparent),linear-gradient(90deg,#fff,hsla(0,0%,100%,0))}.react-colorful__alpha-gradient,.react-colorful__pointer-fill{content:"";position:absolute;left:0;top:0;right:0;bottom:0;pointer-events:none;border-radius:inherit}.react-colorful__alpha-gradient,.react-colorful__saturation{box-shadow:inset 0 0 0 1px rgba(0,0,0,.05)}.react-colorful__alpha,.react-colorful__hue{position:relative;height:24px}.react-colorful__hue{background:linear-gradient(90deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red)}.react-colorful__last-control{border-radius:0 0 8px 8px}.react-colorful__interactive{position:absolute;left:0;top:0;right:0;bottom:0;border-radius:inherit;outline:none;touch-action:none}.react-colorful__pointer{position:absolute;z-index:1;box-sizing:border-box;width:28px;height:28px;transform:translate(-50%,-50%);background-color:#fff;border:2px solid #fff;border-radius:50%;box-shadow:0 2px 4px rgba(0,0,0,.2)}.react-colorful__interactive:focus .react-colorful__pointer{transform:translate(-50%,-50%) scale(1.1)}.react-colorful__alpha,.react-colorful__alpha-pointer{background-color:#fff;background-image:url(\'data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill-opacity=".05"><path d="M8 0h8v8H8zM0 8h8v8H0z"/></svg>\')}.react-colorful__saturation-pointer{z-index:3}.react-colorful__hue-pointer{z-index:2}',Mr.set(t,o);var n="undefined"!=typeof __webpack_nonce__?__webpack_nonce__:void 0;n&&o.setAttribute("nonce",n),t.head.appendChild(o)}},[])},Dr=function(e){var t=e.className,o=e.colorModel,n=e.color,r=void 0===n?o.defaultColor:n,a=e.onChange,s=fr(e,["className","colorModel","color","onChange"]),l=c(null);Lr(l);var u=Ar(o,r,a),d=u[0],p=u[1],f=wr(["react-colorful",t]);return i.createElement("div",pr({},s,{ref:l,className:f}),i.createElement(Rr,{hsva:d,onChange:p}),i.createElement(_r,{hue:d.h,onChange:p,className:"react-colorful__last-control"}))},Br={defaultColor:"000",toHsva:function(e){return Pr(Er(e))},fromHsva:function(e){return function(e){return Sr(jr(e))}({h:e.h,s:e.s,v:e.v,a:1})},equal:function(e,t){return e.toLowerCase()===t.toLowerCase()||Tr(Er(e),Er(t))}},zr=function(e){return i.createElement(Dr,pr({},e,{colorModel:Br}))},Fr=/^#?([0-9A-F]{3,8})$/i,qr=function(e){var t=e.color,o=void 0===t?"":t,n=e.onChange,r=e.onBlur,a=e.escape,s=e.validate,c=e.format,u=e.process,f=fr(e,["color","onChange","onBlur","escape","validate","format","process"]),h=p(function(){return a(o)}),m=h[0],g=h[1],v=hr(n),b=hr(r),y=d(function(e){var t=a(e.target.value);g(t),s(t)&&v(u?u(t):t)},[a,u,s,v]),x=d(function(e){s(e.target.value)||g(a(o)),b(e)},[o,a,s,b]);return l(function(){g(a(o))},[o,a]),i.createElement("input",pr({},f,{value:c?c(m):m,spellCheck:"false",onChange:y,onBlur:x}))},$r=function(e){return"#"+e},Vr=function(e){var t=e.prefixed,o=e.alpha,n=fr(e,["prefixed","alpha"]),r=d(function(e){return e.replace(/([^0-9A-F]+)/gi,"").substring(0,o?8:6)},[o]),a=d(function(e){return function(e,t){var o=Fr.exec(e),n=o?o[1].length:0;return 3===n||6===n||!!t&&4===n||!!t&&8===n}(e,o)},[o]);return i.createElement(qr,pr({},n,{escape:r,format:t?$r:void 0,process:$r,validate:a}))};const Hr=["#FFFF00","#FFE066","#FFCC99","#FF9999","#99CCFF","#99FF99","#FF99FF","#CC99FF"],Wr=f(({value:e={backgroundColor:"#FFFF00"},onChange:t,presets:o=Hr,showInput:n=!0,className:r,children:i,placement:a="bottom",offset:s=8},c)=>{const[u,d]=p(!1),[f,h]=p("backgroundColor"),[m,v]=p(e.backgroundColor),[b,y]=p(e.color),{refs:x,floatingStyles:w}=ro({open:u,onOpenChange:d,placement:a,middleware:[Ct(s),Nt(),jt()],whileElementsMounted:ft});l(()=>{e.backgroundColor&&v(e.backgroundColor),e.color&&y(e.color)},[e]),l(()=>{if(!u)return;const e=e=>{const t=e.target,o=x.reference.current,n=x.floating.current;o&&o instanceof Element&&o.contains(t)||(null==n?void 0:n.contains(t))||d(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[u,x.floating,x.reference]);const k=o=>{"backgroundColor"===f?(v(o),null==t||t(Object.assign(Object.assign({},e),{backgroundColor:o}))):(y(o),null==t||t(Object.assign(Object.assign({},e),{color:o})))},O="backgroundColor"===f?m:b,E=g(i,{ref:x.setReference,onClick:e=>{var t,o;e.stopPropagation(),d(e=>!e),null===(o=(t=i.props).onClick)||void 0===o||o.call(t,e)}});return N(S,{children:[E,u&&N("div",Object.assign({ref:e=>{x.setFloating(e),c&&("function"==typeof c?c(e):c.current=e)},style:w,className:`yoopta-highlight-color-picker ${null!=r?r:""}`,onClick:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation()},{children:[N("div",Object.assign({className:"yoopta-highlight-color-picker__mode-toggle"},{children:[j("button",Object.assign({type:"button",className:"yoopta-highlight-color-picker__mode-btn","data-active":"backgroundColor"===f,onClick:()=>h("backgroundColor"),"aria-label":"Background color"},{children:"Background"})),j("button",Object.assign({type:"button",className:"yoopta-highlight-color-picker__mode-btn","data-active":"color"===f,onClick:()=>h("color"),"aria-label":"Text color"},{children:"Text"}))]})),j("div",Object.assign({className:"yoopta-highlight-color-picker__picker"},{children:j(zr,{color:O,onChange:k,className:"yoopta-highlight-color-picker__react-colorful"})})),o.length>0&&j("div",Object.assign({className:"yoopta-highlight-color-picker__presets"},{children:o.map(e=>{const t=(null==O?void 0:O.toLowerCase())===e.toLowerCase();return j("button",{type:"button",className:"yoopta-highlight-color-picker__preset","data-selected":t,style:{backgroundColor:e},onClick:()=>k(e),"aria-label":`Select color ${e}`},e)})})),n&&N("div",Object.assign({className:"yoopta-highlight-color-picker__hex-row"},{children:[j("div",{className:"yoopta-highlight-color-picker__swatch",style:{backgroundColor:O}}),j(Vr,{color:O,onChange:k,className:"yoopta-highlight-color-picker__hex-input",prefixed:!0})]}))]}))]})});Wr.displayName="HighlightColorPicker";export{To as ActionMenuList,xo as BlockOptions,Wr as HighlightColorPicker,fo as Overlay,mo as Portal,nr as SlashCommandMenu,ur as ThemeProvider,dr as ThemeToggle,Co as Toolbar,Mo as useActionMenuList,Io as useActionMenuListActions,po as useBlockOptions,uo as useBlockOptionsActions,sr as useTheme,cr as useThemeContext,No as useToolbar};
|
|
1
|
+
export{SlashCommandMenu}from"./slash-command-menu.js";export{FloatingBlockActions,useFloatingBlockActions,useFloatingBlockActionsActions}from"./floating-block-actions.js";export{BlockOptions,useBlockOptions,useBlockOptionsActions}from"./block-options.js";export{T as Toolbar,u as useToolbar}from"./chunks/hooks-907f8ea7.js";export{A as ActionMenuList,u as useActionMenuList,a as useActionMenuListActions}from"./chunks/hooks-8cbb0736.js";export{ThemeProvider,ThemeToggle,useTheme,useThemeContext}from"./theme.js";export{Portal}from"./portal.js";export{Overlay}from"./overlay.js";export{H as HighlightColorPicker}from"./chunks/highlight-color-picker-13e8f1eb.js";import"react/jsx-runtime";import"react";import"@yoopta/editor";import"./chunks/floating-ui.react-0123aadf.js";import"react-dom";import"./chunks/style-inject.es-e87a8d02.js";import"./chunks/_tslib-5e145dfd.js";import"./chunks/index-06d5c4e7.js";import"./chunks/throttle-dea4a39e.js";
|
package/dist/overlay.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{_ as o}from"./chunks/_tslib-5e145dfd.js";import{jsx as l}from"react/jsx-runtime";import{d as r}from"./chunks/floating-ui.react-0123aadf.js";import"react";import"react-dom";const c=c=>{var{className:a,children:s,lockScroll:n=!0}=c,t=o(c,["className","children","lockScroll"]);return l(r,Object.assign({lockScroll:n,className:a},t,{onClick:o=>{var l;o.stopPropagation(),null===(l=t.onClick)||void 0===l||l.call(t,o)},onMouseDown:o=>{var l;o.stopPropagation(),null===(l=t.onMouseDown)||void 0===l||l.call(t,o)}},{children:s}))};export{c as Overlay};
|
package/dist/portal.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as r}from"react/jsx-runtime";import{useState as t,useRef as e,useEffect as n}from"react";import{F as o}from"./chunks/floating-ui.react-0123aadf.js";import{useYooptaEditor as c}from"@yoopta/editor";import"react-dom";const a=new WeakMap,i=i=>{const[u,m]=t(!1),l=e(null),s=c();return n(()=>{m(!0);const r=s.refElement;if(!r)return;let t=r.querySelector(".yoopta-portal-container");t||(t=document.createElement("div"),t.className="yoopta-portal-container",r.appendChild(t),a.set(t,0));const e=a.get(t)||0;return a.set(t,e+1),l.current=t,()=>{if(l.current){const r=a.get(l.current)||0,t=Math.max(0,r-1);a.set(l.current,t),0===t&&l.current.parentNode&&(l.current.remove(),a.delete(l.current))}}},[s]),u&&l.current?r(o,Object.assign({id:`${i.id}-${s.id}`,root:l.current},{children:i.children})):null};export{i as Portal};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/slash-command-menu/index.ts"],"names":[],"mappings":";AAWA,YAAY,EACV,gBAAgB,IAAI,oBAAoB,EACxC,iBAAiB,IAAI,qBAAqB,EAC1C,iBAAiB,EACjB,mBAAmB,EACnB,wBAAwB,EACxB,YAAY,GACb,MAAM,SAAS,CAAC;AAGjB,OAAO,EACL,mBAAmB,EACnB,sBAAsB,EACtB,oBAAoB,EACpB,sBAAsB,EACtB,oBAAoB,EACpB,mBAAmB,GACpB,MAAM,+BAA+B,CAAC;AAGvC,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAG1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AACvE,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAGvE,YAAY,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAC3E,YAAY,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AACjF,YAAY,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAC7E,YAAY,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAC3E,YAAY,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAC7E,YAAY,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAC3E,YAAY,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAC7E,YAAY,EAAE,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;AACrF,YAAY,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAC/E,YAAY,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAEjF,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAW3B,CAAC
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/slash-command-menu/index.ts"],"names":[],"mappings":";AAWA,YAAY,EACV,gBAAgB,IAAI,oBAAoB,EACxC,iBAAiB,IAAI,qBAAqB,EAC1C,iBAAiB,EACjB,mBAAmB,EACnB,wBAAwB,EACxB,YAAY,GACb,MAAM,SAAS,CAAC;AAGjB,OAAO,EACL,mBAAmB,EACnB,sBAAsB,EACtB,oBAAoB,EACpB,sBAAsB,EACtB,oBAAoB,EACpB,mBAAmB,GACpB,MAAM,+BAA+B,CAAC;AAGvC,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAG1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AACvE,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAGvE,YAAY,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAC3E,YAAY,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AACjF,YAAY,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAC7E,YAAY,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAC3E,YAAY,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAC7E,YAAY,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAC3E,YAAY,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAC7E,YAAY,EAAE,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;AACrF,YAAY,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAC/E,YAAY,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAEjF,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAW3B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import{createContext as r,useContext as o,forwardRef as s,useRef as a,useEffect as i,useCallback as l,useMemo as c,useLayoutEffect as d,useReducer as p}from"react";import{useYooptaEditor as f,Blocks as h,getAllowedPluginsFromElement as m,getRootBlockElementType as u}from"@yoopta/editor";import{u as g,a as v,i as b,o as y,f as x,s as w,c as O,b as j}from"./chunks/floating-ui.react-0123aadf.js";import{s as k}from"./chunks/style-inject.es-e87a8d02.js";import"react-dom";const P=({children:t,className:n})=>{const r=e=>{e.stopPropagation(),e.preventDefault()};return e("div",Object.assign({tabIndex:0,role:"listbox","aria-label":"Slash commands",className:`slash-command-content ${n||""}`,onMouseDown:r,onMouseMove:r},{children:t}))};P.displayName="SlashCommand.Content";const E=r(null);function S(){const e=o(E);if(!e)throw new Error("useSlashCommandContext must be used within a SlashCommandProvider");return e}function N(){const{state:e}=S();return e}function C(){const{actionHandlers:e}=S();return e}function _(){const{filteredItems:e,groupedItems:t}=S();return{filteredItems:e,groupedItems:t}}function T(){const{refs:e,floatingStyles:t}=S();return{refs:e,floatingStyles:t}}E.displayName="SlashCommandContext";const I=({children:t,className:n})=>{const{filteredItems:r}=S();return r.length>0?null:e("div",Object.assign({className:`slash-command-empty ${n||""}`},{children:t||"No results found"}))};I.displayName="SlashCommand.Empty";const A=()=>t(n,{children:[t("div",Object.assign({className:"slash-command-footer-hint"},{children:[e("kbd",Object.assign({className:"slash-command-kbd"},{children:"↑"})),e("kbd",Object.assign({className:"slash-command-kbd"},{children:"↓"})),e("span",{children:"Navigate"})]})),t("div",Object.assign({className:"slash-command-footer-hint"},{children:[e("kbd",Object.assign({className:"slash-command-kbd"},{children:"↵"})),e("span",{children:"Select"})]})),t("div",Object.assign({className:"slash-command-footer-hint"},{children:[e("kbd",Object.assign({className:"slash-command-kbd"},{children:"Esc"})),e("span",{children:"Close"})]}))]}),R=({children:t,className:n,showHints:r=!0})=>e("div",Object.assign({className:`slash-command-footer ${n||""}`},{children:t||r&&e(A,{})}));R.displayName="SlashCommand.Footer";const D=({children:n,heading:r,className:o})=>t("div",Object.assign({role:"group","aria-label":r,className:`slash-command-group ${o||""}`},{children:[r&&e("div",Object.assign({className:"slash-command-group-heading"},{children:r})),n]}));D.displayName="SlashCommand.Group";const B=s(({placeholder:n="Search blocks...",className:r,showTrigger:o=!0,showEscHint:s=!0},a)=>{const{state:i,actionHandlers:l}=S();return t("div",Object.assign({className:`slash-command-input-wrapper ${r||""}`},{children:[o&&e("span",Object.assign({className:"slash-command-input-trigger"},{children:"/"})),e("input",{ref:a,type:"text",className:"slash-command-input",placeholder:n,value:i.search,onChange:e=>l.setSearch(e.target.value),autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:!1}),s&&e("kbd",Object.assign({className:"slash-command-kbd"},{children:"ESC"}))]}))});B.displayName="SlashCommand.Input";const L=({children:r,value:o,title:s,description:c,icon:d,shortcut:p,disabled:f=!1,onSelect:h,className:m})=>{const{state:u,actionHandlers:g,filteredItems:v}=S(),b=a(null),y=v.findIndex(e=>e.id===o),x=y===u.selectedIndex&&-1!==y,w=-1!==y;i(()=>{x&&b.current&&b.current.scrollIntoView({block:"nearest",behavior:"smooth"})},[x]);const O=l(()=>{f||(h&&h(),g.selectItem(y),g.executeSelected())},[f,h,g,y]),j=l(()=>{f||-1===y||g.selectItem(y)},[f,y,g]);if(!w)return null;const k=r||t(n,{children:[d&&e("div",Object.assign({className:"slash-command-item-icon"},{children:d})),t("div",Object.assign({className:"slash-command-item-content"},{children:[s&&e("div",Object.assign({className:"slash-command-item-title"},{children:s})),c&&e("div",Object.assign({className:"slash-command-item-description"},{children:c}))]})),p&&p.length>0&&e("div",Object.assign({className:"slash-command-item-shortcut"},{children:p.map(t=>e("kbd",Object.assign({className:"slash-command-kbd"},{children:t}),t))}))]});return e("button",Object.assign({ref:b,type:"button",role:"option","aria-selected":x,"aria-disabled":f,"data-selected":x,"data-disabled":f,"data-value":o,className:`slash-command-item ${m||""}`,onClick:O,onMouseEnter:j,onMouseDown:e=>e.preventDefault(),disabled:f},{children:k}))};L.displayName="SlashCommand.Item";const q=({children:t,className:n,style:r})=>e("div",Object.assign({role:"group",className:`slash-command-list ${null!=n?n:""}`,style:r},{children:t}));q.displayName="SlashCommand.List";const M=({children:t,className:n})=>e("div",Object.assign({className:`slash-command-loading ${n||""}`},{children:t||e("div",{className:"slash-command-spinner"})}));M.displayName="SlashCommand.Loading";var z={ancestors(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{reverse:n=!1}=t,r=z.levels(e,t);return r=n?r.slice(1):r.slice(0,-1)},common(e,t){for(var n=[],r=0;r<e.length&&r<t.length;r++){var o=e[r];if(o!==t[r])break;n.push(o)}return n},compare(e,t){for(var n=Math.min(e.length,t.length),r=0;r<n;r++){if(e[r]<t[r])return-1;if(e[r]>t[r])return 1}return 0},endsAfter(e,t){var n=e.length-1,r=e.slice(0,n),o=t.slice(0,n),s=e[n],a=t[n];return z.equals(r,o)&&s>a},endsAt(e,t){var n=e.length,r=e.slice(0,n),o=t.slice(0,n);return z.equals(r,o)},endsBefore(e,t){var n=e.length-1,r=e.slice(0,n),o=t.slice(0,n),s=e[n],a=t[n];return z.equals(r,o)&&s<a},equals:(e,t)=>e.length===t.length&&e.every((e,n)=>e===t[n]),hasPrevious:e=>e[e.length-1]>0,isAfter:(e,t)=>1===z.compare(e,t),isAncestor:(e,t)=>e.length<t.length&&0===z.compare(e,t),isBefore:(e,t)=>-1===z.compare(e,t),isChild:(e,t)=>e.length===t.length+1&&0===z.compare(e,t),isCommon:(e,t)=>e.length<=t.length&&0===z.compare(e,t),isDescendant:(e,t)=>e.length>t.length&&0===z.compare(e,t),isParent:(e,t)=>e.length+1===t.length&&0===z.compare(e,t),isPath:e=>Array.isArray(e)&&(0===e.length||"number"==typeof e[0]),isSibling(e,t){if(e.length!==t.length)return!1;var n=e.slice(0,-1),r=t.slice(0,-1);return e[e.length-1]!==t[t.length-1]&&z.equals(n,r)},levels(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{reverse:n=!1}=t,r=[],o=0;o<=e.length;o++)r.push(e.slice(0,o));return n&&r.reverse(),r},next(e){if(0===e.length)throw new Error("Cannot get the next path of a root path [".concat(e,"], because it has no next index."));var t=e[e.length-1];return e.slice(0,-1).concat(t+1)},operationCanTransformPath(e){switch(e.type){case"insert_node":case"remove_node":case"merge_node":case"split_node":case"move_node":return!0;default:return!1}},parent(e){if(0===e.length)throw new Error("Cannot get the parent path of the root path [".concat(e,"]."));return e.slice(0,-1)},previous(e){if(0===e.length)throw new Error("Cannot get the previous path of a root path [".concat(e,"], because it has no previous index."));var t=e[e.length-1];if(t<=0)throw new Error("Cannot get the previous path of a first child path [".concat(e,"] because it would result in a negative index."));return e.slice(0,-1).concat(t-1)},relative(e,t){if(!z.isAncestor(t,e)&&!z.equals(e,t))throw new Error("Cannot get the relative path of [".concat(e,"] inside ancestor [").concat(t,"], because it is not above or equal to the path."));return e.slice(t.length)},transform(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!e)return null;var r=[...e],{affinity:o="forward"}=n;if(0===e.length)return r;switch(t.type){case"insert_node":var{path:s}=t;(z.equals(s,r)||z.endsBefore(s,r)||z.isAncestor(s,r))&&(r[s.length-1]+=1);break;case"remove_node":var{path:a}=t;if(z.equals(a,r)||z.isAncestor(a,r))return null;z.endsBefore(a,r)&&(r[a.length-1]-=1);break;case"merge_node":var{path:i,position:l}=t;z.equals(i,r)||z.endsBefore(i,r)?r[i.length-1]-=1:z.isAncestor(i,r)&&(r[i.length-1]-=1,r[i.length]+=l);break;case"split_node":var{path:c,position:d}=t;if(z.equals(c,r)){if("forward"===o)r[r.length-1]+=1;else if("backward"!==o)return null}else z.endsBefore(c,r)?r[c.length-1]+=1:z.isAncestor(c,r)&&e[c.length]>=d&&(r[c.length-1]+=1,r[c.length]-=d);break;case"move_node":var{path:p,newPath:f}=t;if(z.equals(p,f))return r;if(z.isAncestor(p,r)||z.equals(p,r)){var h=f.slice();return z.endsBefore(p,f)&&p.length<f.length&&(h[p.length-1]-=1),h.concat(r.slice(p.length))}z.isSibling(p,f)&&(z.isAncestor(f,r)||z.equals(f,r))?z.endsBefore(p,r)?r[p.length-1]-=1:r[p.length-1]+=1:z.endsBefore(f,r)||z.equals(f,r)||z.isAncestor(f,r)?(z.endsBefore(p,r)&&(r[p.length-1]-=1),r[f.length-1]+=1):z.endsBefore(p,r)&&(z.equals(f,r)&&(r[f.length-1]+=1),r[p.length-1]-=1)}return r}};function F(e){return F="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},F(e)}function V(e){var t=function(e,t){if("object"!==F(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==F(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===F(t)?t:String(t)}function H(e,t,n){return(t=V(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function W(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},s=Object.keys(e);for(r=0;r<s.length;r++)n=s[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r<s.length;r++)n=s[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var $=["anchor","focus"];function J(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}var Z={edges(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{reverse:n=!1}=t,{anchor:r,focus:o}=e;return Z.isBackward(e)===n?[r,o]:[o,r]},end(e){var[,t]=Z.edges(e);return t},equals:(e,t)=>pe.equals(e.anchor,t.anchor)&&pe.equals(e.focus,t.focus),surrounds(e,t){var n=Z.intersection(e,t);return!!n&&Z.equals(n,t)},includes(e,t){if(Z.isRange(t)){if(Z.includes(e,t.anchor)||Z.includes(e,t.focus))return!0;var[n,r]=Z.edges(e),[o,s]=Z.edges(t);return pe.isBefore(n,o)&&pe.isAfter(r,s)}var[a,i]=Z.edges(e),l=!1,c=!1;return pe.isPoint(t)?(l=pe.compare(t,a)>=0,c=pe.compare(t,i)<=0):(l=z.compare(t,a.path)>=0,c=z.compare(t,i.path)<=0),l&&c},intersection(e,t){var n=W(e,$),[r,o]=Z.edges(e),[s,a]=Z.edges(t),i=pe.isBefore(r,s)?s:r,l=pe.isBefore(o,a)?o:a;return pe.isBefore(l,i)?null:function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?J(Object(n),!0).forEach(function(t){H(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):J(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}({anchor:i,focus:l},n)},isBackward(e){var{anchor:t,focus:n}=e;return pe.isAfter(t,n)},isCollapsed(e){var{anchor:t,focus:n}=e;return pe.equals(t,n)},isExpanded:e=>!Z.isCollapsed(e),isForward:e=>!Z.isBackward(e),isRange:e=>se(e)&&pe.isPoint(e.anchor)&&pe.isPoint(e.focus),*points(e){yield[e.anchor,"anchor"],yield[e.focus,"focus"]},start(e){var[t]=Z.edges(e);return t},transform(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(null===e)return null;var r,o,{affinity:s="inward"}=n;if("inward"===s){var a=Z.isCollapsed(e);Z.isForward(e)?(r="forward",o=a?r:"backward"):(r="backward",o=a?r:"forward")}else"outward"===s?Z.isForward(e)?(r="backward",o="forward"):(r="forward",o="backward"):(r=s,o=s);var i=pe.transform(e.anchor,t,{affinity:r}),l=pe.transform(e.focus,t,{affinity:o});return i&&l?{anchor:i,focus:l}:null}},G=function(e){var{deep:t=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return!!se(e)&&("function"!=typeof e.apply&&(t?ee.isNodeList(e.children):Array.isArray(e.children)))},U={isAncestor(e){var{deep:t=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return se(e)&&ee.isNodeList(e.children,{deep:t})},isElement:G,isElementList(e){var{deep:t=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Array.isArray(e)&&e.every(e=>U.isElement(e,{deep:t}))},isElementProps:e=>void 0!==e.children,isElementType:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"type";return G(e)&&e[n]===t},matches(e,t){for(var n in t)if("children"!==n&&e[n]!==t[n])return!1;return!0}},X=["children"],Y=["text"];function K(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Q(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?K(Object(n),!0).forEach(function(t){H(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):K(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var ee={ancestor(e,t){var n=ee.get(e,t);if(be.isText(n))throw new Error("Cannot get the ancestor node at path [".concat(t,"] because it refers to a text node instead: ").concat(he.stringify(n)));return n},ancestors(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return function*(){for(var r of z.ancestors(t,n)){var o=[ee.ancestor(e,r),r];yield o}}()},child(e,t){if(be.isText(e))throw new Error("Cannot get the child of a text node: ".concat(he.stringify(e)));var n=e.children[t];if(null==n)throw new Error("Cannot get child at index `".concat(t,"` in node: ").concat(he.stringify(e)));return n},children(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return function*(){for(var{reverse:r=!1}=n,o=ee.ancestor(e,t),{children:s}=o,a=r?s.length-1:0;r?a>=0:a<s.length;){var i=ee.child(o,a),l=t.concat(a);yield[i,l],a=r?a-1:a+1}}()},common(e,t,n){var r=z.common(t,n);return[ee.get(e,r),r]},descendant(e,t){var n=ee.get(e,t);if(le.isEditor(n))throw new Error("Cannot get the descendant node at path [".concat(t,"] because it refers to the root editor node instead: ").concat(he.stringify(n)));return n},descendants(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function*(){for(var[n,r]of ee.nodes(e,t))0!==r.length&&(yield[n,r])}()},elements(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function*(){for(var[n,r]of ee.nodes(e,t))U.isElement(n)&&(yield[n,r])}()},extractProps:e=>U.isAncestor(e)?W(e,X):W(e,Y),first(e,t){for(var n=t.slice(),r=ee.get(e,n);r&&!be.isText(r)&&0!==r.children.length;)r=r.children[0],n.push(0);return[r,n]},fragment(e,t){var n={children:e.children},[r,o]=Z.edges(t),s=ee.nodes(n,{reverse:!0,pass:e=>{var[,n]=e;return!Z.includes(t,n)}}),a=function(){if(!Z.includes(t,i)){var e=i[i.length-1];Pe(n,z.parent(i),t=>je(t,e,1))}z.equals(i,o.path)&&Ee(n,i,e=>{var t=e.text.slice(0,o.offset);return Q(Q({},e),{},{text:t})}),z.equals(i,r.path)&&Ee(n,i,e=>{var t=e.text.slice(r.offset);return Q(Q({},e),{},{text:t})})};for(var[,i]of s)a();return n.children},get(e,t){var n=ee.getIf(e,t);if(void 0===n)throw new Error("Cannot find a descendant at path [".concat(t,"] in node: ").concat(he.stringify(e)));return n},getIf(e,t){for(var n=e,r=0;r<t.length;r++){var o=t[r];if(be.isText(n)||!n.children[o])return;n=n.children[o]}return n},has(e,t){for(var n=e,r=0;r<t.length;r++){var o=t[r];if(be.isText(n)||!n.children[o])return!1;n=n.children[o]}return!0},isNode(e){var{deep:t=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return be.isText(e)||U.isElement(e,{deep:t})||le.isEditor(e,{deep:t})},isNodeList(e){var{deep:t=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Array.isArray(e)&&e.every(e=>ee.isNode(e,{deep:t}))},last(e,t){for(var n=t.slice(),r=ee.get(e,n);r&&!be.isText(r)&&0!==r.children.length;){var o=r.children.length-1;r=r.children[o],n.push(o)}return[r,n]},leaf(e,t){var n=ee.get(e,t);if(!be.isText(n))throw new Error("Cannot get the leaf node at path [".concat(t,"] because it refers to a non-leaf node: ").concat(he.stringify(n)));return n},levels(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return function*(){for(var r of z.levels(t,n)){var o=ee.get(e,r);yield[o,r]}}()},matches:(e,t)=>U.isElement(e)&&U.isElementProps(t)&&U.matches(e,t)||be.isText(e)&&be.isTextProps(t)&&be.matches(e,t),nodes(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function*(){for(var{pass:n,reverse:r=!1}=t,{from:o=[],to:s}=t,a=new Set,i=[],l=e;!s||!(r?z.isBefore(i,s):z.isAfter(i,s));)if(a.has(l)||(yield[l,i]),a.has(l)||be.isText(l)||0===l.children.length||null!=n&&!1!==n([l,i])){if(0===i.length)break;if(!r){var c=z.next(i);if(ee.has(e,c)){i=c,l=ee.get(e,i);continue}}if(r&&0!==i[i.length-1])i=z.previous(i),l=ee.get(e,i);else i=z.parent(i),l=ee.get(e,i),a.add(l)}else{a.add(l);var d=r?l.children.length-1:0;z.isAncestor(i,o)&&(d=o[i.length]),i=i.concat(d),l=ee.get(e,i)}}()},parent(e,t){var n=z.parent(t),r=ee.get(e,n);if(be.isText(r))throw new Error("Cannot get the parent of path [".concat(t,"] because it does not exist in the root."));return r},string:e=>be.isText(e)?e.text:e.children.map(ee.string).join(""),texts(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function*(){for(var[n,r]of ee.nodes(e,t))be.isText(n)&&(yield[n,r])}()}};function te(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function ne(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?te(Object(n),!0).forEach(function(t){H(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):te(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var re,oe={isNodeOperation:e=>oe.isOperation(e)&&e.type.endsWith("_node"),isOperation(e){if(!se(e))return!1;switch(e.type){case"insert_node":case"remove_node":return z.isPath(e.path)&&ee.isNode(e.node);case"insert_text":case"remove_text":return"number"==typeof e.offset&&"string"==typeof e.text&&z.isPath(e.path);case"merge_node":return"number"==typeof e.position&&z.isPath(e.path)&&se(e.properties);case"move_node":return z.isPath(e.path)&&z.isPath(e.newPath);case"set_node":return z.isPath(e.path)&&se(e.properties)&&se(e.newProperties);case"set_selection":return null===e.properties&&Z.isRange(e.newProperties)||null===e.newProperties&&Z.isRange(e.properties)||se(e.properties)&&se(e.newProperties);case"split_node":return z.isPath(e.path)&&"number"==typeof e.position&&se(e.properties);default:return!1}},isOperationList:e=>Array.isArray(e)&&e.every(e=>oe.isOperation(e)),isSelectionOperation:e=>oe.isOperation(e)&&e.type.endsWith("_selection"),isTextOperation:e=>oe.isOperation(e)&&e.type.endsWith("_text"),inverse(e){switch(e.type){case"insert_node":return ne(ne({},e),{},{type:"remove_node"});case"insert_text":return ne(ne({},e),{},{type:"remove_text"});case"merge_node":return ne(ne({},e),{},{type:"split_node",path:z.previous(e.path)});case"move_node":var{newPath:t,path:n}=e;if(z.equals(t,n))return e;if(z.isSibling(n,t))return ne(ne({},e),{},{path:t,newPath:n});var r=z.transform(n,e),o=z.transform(z.next(n),e);return ne(ne({},e),{},{path:r,newPath:o});case"remove_node":return ne(ne({},e),{},{type:"insert_node"});case"remove_text":return ne(ne({},e),{},{type:"insert_text"});case"set_node":var{properties:s,newProperties:a}=e;return ne(ne({},e),{},{properties:a,newProperties:s});case"set_selection":var{properties:i,newProperties:l}=e;return ne(ne({},e),{},null==i?{properties:l,newProperties:null}:null==l?{properties:null,newProperties:i}:{properties:l,newProperties:i});case"split_node":return ne(ne({},e),{},{type:"merge_node",path:z.next(e.path)})}}},se=e=>"object"==typeof e&&null!==e,ae=(e,t)=>{for(var n in e){var r=e[n],o=t[n];if(Array.isArray(r)&&Array.isArray(o)){if(r.length!==o.length)return!1;for(var s=0;s<r.length;s++)if(r[s]!==o[s])return!1}else if(se(r)&&se(o)){if(!ae(r,o))return!1}else if(r!==o)return!1}for(var a in t)if(void 0===e[a]&&void 0!==t[a])return!1;return!0},ie=e=>e.selection?e.selection:e.children.length>0?le.end(e,[]):[0];!function(e){e[e.None=0]="None",e[e.Extend=1]="Extend",e[e.ZWJ=2]="ZWJ",e[e.RI=4]="RI",e[e.Prepend=8]="Prepend",e[e.SpacingMark=16]="SpacingMark",e[e.L=32]="L",e[e.V=64]="V",e[e.T=128]="T",e[e.LV=256]="LV",e[e.LVT=512]="LVT",e[e.ExtPict=1024]="ExtPict",e[e.Any=2048]="Any"}(re||(re={})),re.L,re.L,re.V,re.LV,re.LVT,re.LV,re.V,re.V,re.T,re.LVT,re.T,re.T,re.Any,re.Extend,re.ZWJ,re.Any,re.SpacingMark,re.Prepend,re.Any,re.ZWJ,re.ExtPict,re.RI,re.RI;var le={above:(e,t)=>e.above(t),addMark(e,t,n){e.addMark(t,n)},after:(e,t,n)=>e.after(t,n),before:(e,t,n)=>e.before(t,n),deleteBackward(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{unit:n="character"}=t;e.deleteBackward(n)},deleteForward(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{unit:n="character"}=t;e.deleteForward(n)},deleteFragment(e,t){e.deleteFragment(t)},edges:(e,t)=>e.edges(t),elementReadOnly(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e.elementReadOnly(t)},end:(e,t)=>e.end(t),first:(e,t)=>e.first(t),fragment:(e,t)=>e.fragment(t),hasBlocks:(e,t)=>e.hasBlocks(t),hasInlines:(e,t)=>e.hasInlines(t),hasPath:(e,t)=>e.hasPath(t),hasTexts:(e,t)=>e.hasTexts(t),insertBreak(e){e.insertBreak()},insertFragment(e,t,n){e.insertFragment(t,n)},insertNode(e,t){e.insertNode(t)},insertSoftBreak(e){e.insertSoftBreak()},insertText(e,t){e.insertText(t)},isBlock:(e,t)=>e.isBlock(t),isEdge:(e,t,n)=>e.isEdge(t,n),isEditor:e=>function(e){var{deep:t=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!se(e))return!1;var n="function"==typeof e.addMark&&"function"==typeof e.apply&&"function"==typeof e.deleteFragment&&"function"==typeof e.insertBreak&&"function"==typeof e.insertSoftBreak&&"function"==typeof e.insertFragment&&"function"==typeof e.insertNode&&"function"==typeof e.insertText&&"function"==typeof e.isElementReadOnly&&"function"==typeof e.isInline&&"function"==typeof e.isSelectable&&"function"==typeof e.isVoid&&"function"==typeof e.normalizeNode&&"function"==typeof e.onChange&&"function"==typeof e.removeMark&&"function"==typeof e.getDirtyPaths&&(null===e.marks||se(e.marks))&&(null===e.selection||Z.isRange(e.selection))&&(!t||ee.isNodeList(e.children))&&oe.isOperationList(e.operations);return n}(e),isElementReadOnly:(e,t)=>e.isElementReadOnly(t),isEmpty:(e,t)=>e.isEmpty(t),isEnd:(e,t,n)=>e.isEnd(t,n),isInline:(e,t)=>e.isInline(t),isNormalizing:e=>e.isNormalizing(),isSelectable:(e,t)=>e.isSelectable(t),isStart:(e,t,n)=>e.isStart(t,n),isVoid:(e,t)=>e.isVoid(t),last:(e,t)=>e.last(t),leaf:(e,t,n)=>e.leaf(t,n),levels:(e,t)=>e.levels(t),marks:e=>e.getMarks(),next:(e,t)=>e.next(t),node:(e,t,n)=>e.node(t,n),nodes:(e,t)=>e.nodes(t),normalize(e,t){e.normalize(t)},parent:(e,t,n)=>e.parent(t,n),path:(e,t,n)=>e.path(t,n),pathRef:(e,t,n)=>e.pathRef(t,n),pathRefs:e=>e.pathRefs(),point:(e,t,n)=>e.point(t,n),pointRef:(e,t,n)=>e.pointRef(t,n),pointRefs:e=>e.pointRefs(),positions:(e,t)=>e.positions(t),previous:(e,t)=>e.previous(t),range:(e,t,n)=>e.range(t,n),rangeRef:(e,t,n)=>e.rangeRef(t,n),rangeRefs:e=>e.rangeRefs(),removeMark(e,t){e.removeMark(t)},setNormalizing(e,t){e.setNormalizing(t)},start:(e,t)=>e.start(t),string:(e,t,n)=>e.string(t,n),unhangRange:(e,t,n)=>e.unhangRange(t,n),void:(e,t)=>e.void(t),withoutNormalizing(e,t){e.withoutNormalizing(t)},shouldMergeNodesRemovePrevNode:(e,t,n)=>e.shouldMergeNodesRemovePrevNode(t,n)};function ce(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function de(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ce(Object(n),!0).forEach(function(t){H(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ce(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var pe={compare(e,t){var n=z.compare(e.path,t.path);return 0===n?e.offset<t.offset?-1:e.offset>t.offset?1:0:n},isAfter:(e,t)=>1===pe.compare(e,t),isBefore:(e,t)=>-1===pe.compare(e,t),equals:(e,t)=>e.offset===t.offset&&z.equals(e.path,t.path),isPoint:e=>se(e)&&"number"==typeof e.offset&&z.isPath(e.path),transform(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(null===e)return null;var{affinity:r="forward"}=n,{path:o,offset:s}=e;switch(t.type){case"insert_node":case"move_node":o=z.transform(o,t,n);break;case"insert_text":z.equals(t.path,o)&&(t.offset<s||t.offset===s&&"forward"===r)&&(s+=t.text.length);break;case"merge_node":z.equals(t.path,o)&&(s+=t.position),o=z.transform(o,t,n);break;case"remove_text":z.equals(t.path,o)&&t.offset<=s&&(s-=Math.min(s-t.offset,t.text.length));break;case"remove_node":if(z.equals(t.path,o)||z.isAncestor(t.path,o))return null;o=z.transform(o,t,n);break;case"split_node":if(z.equals(t.path,o)){if(t.position===s&&null==r)return null;(t.position<s||t.position===s&&"forward"===r)&&(s-=t.position,o=z.transform(o,t,de(de({},n),{},{affinity:"forward"})))}else o=z.transform(o,t,n);break;default:return e}return{path:o,offset:s}}},fe=void 0,he={setScrubber(e){fe=e},stringify:e=>JSON.stringify(e,fe)},me=["text"],ue=["anchor","focus","merge"];function ge(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function ve(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ge(Object(n),!0).forEach(function(t){H(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ge(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var be={equals(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},{loose:r=!1}=n;function o(e){return W(e,me)}return ae(r?o(e):e,r?o(t):t)},isText:e=>se(e)&&"string"==typeof e.text,isTextList:e=>Array.isArray(e)&&e.every(e=>be.isText(e)),isTextProps:e=>void 0!==e.text,matches(e,t){for(var n in t)if("text"!==n&&(!e.hasOwnProperty(n)||e[n]!==t[n]))return!1;return!0},decorations(e,t){var n=[{leaf:ve({},e)}];for(var r of t){var{anchor:o,focus:s,merge:a}=r,i=W(r,ue),[l,c]=Z.edges(r),d=[],p=0,f=l.offset,h=c.offset,m=null!=a?a:Object.assign;for(var{leaf:u}of n){var{length:g}=u.text,v=p;if(p+=g,f<=v&&p<=h)m(u,i),d.push({leaf:u});else if(f!==h&&(f===p||h===v)||f>p||h<v||h===v&&0!==v)d.push({leaf:u});else{var b=u,y=void 0,x=void 0;if(h<p){var w=h-v;x={leaf:ve(ve({},b),{},{text:b.text.slice(w)})},b=ve(ve({},b),{},{text:b.text.slice(0,w)})}if(f>v){var O=f-v;y={leaf:ve(ve({},b),{},{text:b.text.slice(0,O)})},b=ve(ve({},b),{},{text:b.text.slice(O)})}m(b,i),y&&d.push(y),d.push({leaf:b}),x&&d.push(x)}}n=d}if(n.length>1){var j=0;for(var[k,P]of n.entries()){var E=j,S=E+P.leaf.text.length,N={start:E,end:S};0===k&&(N.isFirst=!0),k===n.length-1&&(N.isLast=!0),P.position=N,j=S}}return n}};function ye(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function xe(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ye(Object(n),!0).forEach(function(t){H(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ye(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var we=function(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),o=2;o<n;o++)r[o-2]=arguments[o];return[...e.slice(0,t),...r,...e.slice(t)]},Oe=function(e,t,n){for(var r=arguments.length,o=new Array(r>3?r-3:0),s=3;s<r;s++)o[s-3]=arguments[s];return[...e.slice(0,t),...o,...e.slice(t+n)]},je=Oe,ke=(e,t,n)=>{if(0===t.length)throw new Error("Cannot modify the editor");for(var r=ee.get(e,t),o=t.slice(),s=n(r);o.length>1;){var a=o.pop(),i=ee.get(e,o);s=xe(xe({},i),{},{children:Oe(i.children,a,1,s)})}var l=o.pop();e.children=Oe(e.children,l,1,s)},Pe=(e,t,n)=>{0===t.length?e.children=n(e.children):ke(e,t,e=>{if(be.isText(e))throw new Error("Cannot get the element at path [".concat(t,"] because it refers to a leaf node: ").concat(he.stringify(e)));return xe(xe({},e),{},{children:n(e.children)})})},Ee=(e,t,n)=>ke(e,t,e=>{if(!be.isText(e))throw new Error("Cannot get the leaf node at path [".concat(t,"] because it refers to a non-leaf node: ").concat(he.stringify(e)));return n(e)});function Se(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Ne(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Se(Object(n),!0).forEach(function(t){H(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Se(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var Ce={transform(e,t){var n=!1;switch(t.type){case"insert_node":var{path:r,node:o}=t;Pe(e,z.parent(r),e=>{var t=r[r.length-1];if(t>e.length)throw new Error('Cannot apply an "insert_node" operation at path ['.concat(r,"] because the destination is past the end of the node."));return we(e,t,o)}),n=!0;break;case"insert_text":var{path:s,offset:a,text:i}=t;if(0===i.length)break;Ee(e,s,e=>{var t=e.text.slice(0,a),n=e.text.slice(a);return Ne(Ne({},e),{},{text:t+i+n})}),n=!0;break;case"merge_node":var{path:l}=t,c=l[l.length-1],d=z.previous(l),p=d[d.length-1];Pe(e,z.parent(l),e=>{var t,n=e[c],r=e[p];if(be.isText(n)&&be.isText(r))t=Ne(Ne({},r),{},{text:r.text+n.text});else{if(be.isText(n)||be.isText(r))throw new Error('Cannot apply a "merge_node" operation at path ['.concat(l,"] to nodes of different interfaces: ").concat(he.stringify(n)," ").concat(he.stringify(r)));t=Ne(Ne({},r),{},{children:r.children.concat(n.children)})}return Oe(e,p,2,t)}),n=!0;break;case"move_node":var{path:f,newPath:h}=t,m=f[f.length-1];if(z.isAncestor(f,h))throw new Error("Cannot move a path [".concat(f,"] to new path [").concat(h,"] because the destination is inside itself."));var u=ee.get(e,f);Pe(e,z.parent(f),e=>je(e,m,1));var g=z.transform(f,t),v=g[g.length-1];Pe(e,z.parent(g),e=>we(e,v,u)),n=!0;break;case"remove_node":var{path:b}=t,y=b[b.length-1];if(Pe(e,z.parent(b),e=>je(e,y,1)),e.selection){var x=Ne({},e.selection);for(var[w,O]of Z.points(x)){var j=pe.transform(w,t);if(null!=x&&null!=j)x[O]=j;else{var k=void 0,P=void 0;for(var[E,S]of ee.texts(e)){if(-1!==z.compare(S,b)){P=[E,S];break}k=[E,S]}var N=!1;k&&P&&(N=!z.isSibling(k[1],b)&&(!!z.equals(P[1],b)||z.common(k[1],b).length<z.common(P[1],b).length)),k&&!N?x[O]={path:k[1],offset:k[0].text.length}:P?x[O]={path:P[1],offset:0}:x=null}}x&&Z.equals(x,e.selection)||(e.selection=x)}break;case"remove_text":var{path:C,offset:_,text:T}=t;if(0===T.length)break;Ee(e,C,e=>{var t=e.text.slice(0,_),n=e.text.slice(_+T.length);return Ne(Ne({},e),{},{text:t+n})}),n=!0;break;case"set_node":var{path:I,properties:A,newProperties:R}=t;if(0===I.length)throw new Error("Cannot set properties on the root node!");ke(e,I,e=>{var t=Ne({},e);for(var n in R){if("children"===n||"text"===n)throw new Error('Cannot set the "'.concat(n,'" property of nodes!'));var r=R[n];null==r?delete t[n]:t[n]=r}for(var o in A)R.hasOwnProperty(o)||delete t[o];return t});break;case"set_selection":var{newProperties:D}=t;if(null==D){e.selection=null;break}if(null==e.selection){if(!Z.isRange(D))throw new Error('Cannot apply an incomplete "set_selection" operation properties '.concat(he.stringify(D)," when there is no current selection."));e.selection=Ne({},D);break}var B=Ne({},e.selection);for(var L in D){var q=D[L];if(null==q){if("anchor"===L||"focus"===L)throw new Error('Cannot remove the "'.concat(L,'" selection property'));delete B[L]}else B[L]=q}e.selection=B;break;case"split_node":var{path:M,position:F,properties:V}=t,H=M[M.length-1];if(0===M.length)throw new Error('Cannot apply a "split_node" operation at path ['.concat(M,"] because the root node cannot be split."));Pe(e,z.parent(M),e=>{var t,n,r=e[H];if(be.isText(r)){var o=r.text.slice(0,F),s=r.text.slice(F);t=Ne(Ne({},r),{},{text:o}),n=Ne(Ne({},V),{},{text:s})}else{var a=r.children.slice(0,F),i=r.children.slice(F);t=Ne(Ne({},r),{},{children:a}),n=Ne(Ne({},V),{},{children:i})}return Oe(e,H,1,t,n)}),n=!0}if(n&&e.selection){var W=Ne({},e.selection);for(var[$,J]of Z.points(W))W[J]=pe.transform($,t);Z.equals(W,e.selection)||(e.selection=W)}}},_e={insertNodes(e,t,n){e.insertNodes(t,n)},liftNodes(e,t){e.liftNodes(t)},mergeNodes(e,t){e.mergeNodes(t)},moveNodes(e,t){e.moveNodes(t)},removeNodes(e,t){e.removeNodes(t)},setNodes(e,t,n){e.setNodes(t,n)},splitNodes(e,t){e.splitNodes(t)},unsetNodes(e,t,n){e.unsetNodes(t,n)},unwrapNodes(e,t){e.unwrapNodes(t)},wrapNodes(e,t,n){e.wrapNodes(t,n)}},Te={collapse(e,t){e.collapse(t)},deselect(e){e.deselect()},move(e,t){e.move(t)},select(e,t){e.select(t)},setPoint(e,t,n){e.setPoint(t,n)},setSelection(e,t){e.setSelection(t)}},Ie={delete(e,t){e.delete(t)},insertFragment(e,t,n){e.insertFragment(t,n)},insertText(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};le.withoutNormalizing(e,()=>{var{voids:r=!1}=n,{at:o=ie(e)}=n;if(z.isPath(o)&&(o=le.range(e,o)),Z.isRange(o))if(Z.isCollapsed(o))o=o.anchor;else{var s=Z.end(o);if(!r&&le.void(e,{at:s}))return;var a=Z.start(o),i=le.pointRef(e,a),l=le.pointRef(e,s);De.delete(e,{at:o,voids:r});var c=i.unref(),d=l.unref();o=c||d,De.setSelection(e,{anchor:o,focus:o})}if(!(!r&&le.void(e,{at:o})||le.elementReadOnly(e,{at:o}))){var{path:p,offset:f}=o;t.length>0&&e.apply({type:"insert_text",path:p,offset:f,text:t})}})}};function Ae(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Re(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ae(Object(n),!0).forEach(function(t){H(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ae(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var De=Re(Re(Re(Re({},Ce),_e),Te),Ie);const Be="ArrowUp",Le="ArrowDown",qe="Enter",Me="Escape";function ze(e){return e.toLowerCase().trim()}function Fe(e,t){var n,r,o;if(!t)return 0;const s=ze(t),a=ze(e.title),i=ze(e.id);return a===s?100:a.startsWith(s)?80:i.startsWith(s)?70:(null===(n=e.keywords)||void 0===n?void 0:n.some(e=>ze(e)===s))?60:a.includes(s)?50:(null===(r=e.keywords)||void 0===r?void 0:r.some(e=>ze(e).startsWith(s)))?40:(null===(o=e.keywords)||void 0===o?void 0:o.some(e=>ze(e).includes(s)))?30:e.description&&ze(e.description).includes(s)?20:10}function Ve({items:e,search:t}){const n=c(()=>{const n=e.filter(e=>!e.disabled&&function(e,t){var n;if(!t)return!0;const r=ze(t);return!!(ze(e.title).includes(r)||ze(e.id).includes(r)||e.description&&ze(e.description).includes(r)||(null===(n=e.keywords)||void 0===n?void 0:n.some(e=>ze(e).includes(r))))}(e,t));return t&&n.sort((e,n)=>Fe(n,t)-Fe(e,t)),n},[e,t]),r=c(()=>{const e=new Map;return n.forEach(t=>{const n=t.group||"default",r=e.get(n)||[];e.set(n,[...r,t])}),e},[n]);return{filteredItems:n,groupedItems:r,isEmpty:0===n.length}}const He="undefined"!=typeof window?d:i;const We={isOpen:!1,search:"",selectedIndex:0,virtualElement:null,floatingContext:null};function $e(e,t){switch(t.type){case"OPEN":return Object.assign(Object.assign({},e),{isOpen:!0,search:"",selectedIndex:0,virtualElement:t.virtualElement,floatingContext:t.floatingContext});case"CLOSE":return Object.assign(Object.assign({},e),{isOpen:!1,search:"",selectedIndex:0,virtualElement:null,floatingContext:null});case"SET_SEARCH":return Object.assign(Object.assign({},e),{search:t.search,selectedIndex:0});case"SET_SELECTED_INDEX":return Object.assign(Object.assign({},e),{selectedIndex:t.index});case"RESET_SELECTION":return Object.assign(Object.assign({},e),{selectedIndex:0});default:return e}}function Je({items:e,trigger:t="/",onSelect:n}){const r=f(),[o,s]=p($e,We),a=c(()=>{if(!o.isOpen)return e;let t=null;if("number"==typeof r.path.current){const e=h.getBlockSlate(r,{at:r.path.current});e&&(t=m(r,e))}return t&&t.length>0?t.map(e=>{var t,n;const o=null===(t=r.plugins[e].options)||void 0===t?void 0:t.display;return{id:e,title:null!==(n=null==o?void 0:o.title)&&void 0!==n?n:e,description:null==o?void 0:o.description,icon:null==o?void 0:o.icon}}):e},[e,o.isOpen,r]),{filteredItems:d,groupedItems:u,isEmpty:k}=Ve({items:a,search:o.search}),{refs:P,floatingStyles:E,floatingContext:S}=function({isOpen:e,virtualElement:t}){const{refs:n,floatingStyles:r,context:o,update:s}=g({open:e,placement:"bottom-start",whileElementsMounted:v,middleware:[b(),y(10),x({fallbackPlacements:["top-start","top","bottom"],padding:10,crossAxis:!1,fallbackStrategy:"bestFit"}),w({padding:10}),O({apply({availableHeight:e,elements:t}){Object.assign(t.floating.style,{maxHeight:`${Math.max(200,e-20)}px`})},padding:10})],strategy:"fixed"});return He(()=>{t&&(n.setReference(t),s())},[n,e,t,s]),{refs:n,floatingStyles:r,floatingContext:o}}({isOpen:o.isOpen,virtualElement:o.virtualElement}),{isMounted:N,styles:C}=j(S,{duration:100}),_=l((e,t)=>{s({type:"OPEN",virtualElement:e,floatingContext:t})},[]),T=l(()=>{s({type:"CLOSE"})},[]),I=l(e=>{s({type:"SET_SEARCH",search:e})},[]),A=e=>{s({type:"SET_SELECTED_INDEX",index:e})},R=()=>{const e=d[o.selectedIndex];e&&(e.onSelect&&e.onSelect(),n?n(e):r.toggleBlock(e.id,{scope:"auto",focus:!0,preserveContent:!1}),T())};i(()=>{var e,n;if("number"!=typeof r.path.current)return;if(!h.getBlock(r,{at:r.path.current}))return;const s=r.refElement;if(!s)return;const a=e=>{if(e.isComposing)return;const t=h.getBlockSlate(r,{at:r.path.current});if(!(null==t?void 0:t.selection))return;if(s.contains(e.target)){if(function(e){return function(e){return"/"===e.key||191===e.keyCode||191===e.which||"Slash"===e.code||"/"===e.key||"."===e.key&&e.shiftKey}(e)}(e)){const e=z.parent(t.selection.anchor.path),n=le.string(t,e);if(le.isStart(t,t.selection.anchor,t.selection.focus)&&0===n.trim().length){const e=function(){const e=window.getSelection();if(!e||0===e.rangeCount)return null;const t=e.getRangeAt(0),n=t.getBoundingClientRect(),r=t.getClientRects();return{getBoundingClientRect:()=>n,getClientRects:()=>r}}();e&&_(e,S)}}o.isOpen&&(e.key===Le?(e.preventDefault(),e.stopPropagation(),A(o.selectedIndex===d.length-1?0:o.selectedIndex+1)):e.key===Be?(e.preventDefault(),e.stopPropagation(),A(0===o.selectedIndex?d.length-1:o.selectedIndex-1)):e.key===qe?(e.preventDefault(),e.stopPropagation(),R()):e.key===Me&&(e.preventDefault(),e.stopPropagation(),T()))}},i=e=>{if(e.isComposing)return;if(!o.isOpen)return;if(e.key===Le||e.key===Be)return;const n=h.getBlockSlate(r,{at:r.path.current});if(!(null==n?void 0:n.selection))return;const s=z.parent(n.selection.anchor.path),a=le.string(n,s);if(0===a.length)return void T();const i=a.replace(t,"").trim();I(i)};return null===(e=r.refElement)||void 0===e||e.addEventListener("keydown",a),null===(n=r.refElement)||void 0===n||n.addEventListener("keyup",i),()=>{var e,t;null===(e=r.refElement)||void 0===e||e.removeEventListener("keydown",a),null===(t=r.refElement)||void 0===t||t.removeEventListener("keyup",i)}},[r.path.current,o.isOpen,o.selectedIndex,P.setReference,t,_,T,I,d.length]),i(()=>{if(!o.isOpen)return;const e=e=>{var t,n;const r=e.target;(null===(n=null===(t=P.floating)||void 0===t?void 0:t.current)||void 0===n?void 0:n.contains(r))||T()},t=setTimeout(()=>{document.addEventListener("mousedown",e)},0);return()=>{clearTimeout(t),document.removeEventListener("mousedown",e)}},[o.isOpen,T,P.floating]),i(()=>{if(!o.isOpen||!k||0===o.search.length)return;const e=setTimeout(()=>{k&&T()},2e3);return()=>clearTimeout(e)},[o.isOpen,k,o.search,T]),i(()=>{if(!o.isOpen)return;const e=document.body.style.overflow,t=document.body.style.paddingRight,n=window.innerWidth-document.documentElement.clientWidth;return document.body.style.overflow="hidden",n>0&&(document.body.style.paddingRight=`${n}px`),()=>{document.body.style.overflow=e,document.body.style.paddingRight=t}},[o.isOpen]);return{refs:P,state:o,items:e,isEmpty:k,actionHandlers:{open:_,close:T,setSearch:I,selectItem:A,executeSelected:R},groupedItems:u,filteredItems:d,floatingStyles:E,transitionStyles:C,isMounted:N}}k('.slash-command-root{--slash-command-bg:#fff;--slash-command-bg-hover:#f4f4f5;--slash-command-bg-selected:#f4f4f5;--slash-command-border:#e4e4e7;--slash-command-border-radius:.375rem;--slash-command-shadow:0 16px 48px -12px rgba(0,0,0,.18),0 4px 16px -4px rgba(0,0,0,.1);--slash-command-text:#18181b;--slash-command-text-muted:#71717a;--slash-command-text-disabled:#a1a1aa;--slash-command-accent:#3b82f6;--slash-command-item-radius:8px;--slash-command-icon-bg:#fff;--slash-command-icon-border:#e4e4e7;--slash-command-font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif;--slash-command-font-mono:ui-monospace,SFMono-Regular,"SF Mono",Menlo,monospace}.dark .slash-command-root,.slash-command-root[data-theme=dark]{--slash-command-bg:#18181b;--slash-command-bg-hover:#27272a;--slash-command-bg-selected:#27272a;--slash-command-border:#3f3f46;--slash-command-text:#fafafa;--slash-command-text-muted:#a1a1aa;--slash-command-text-disabled:#52525b;--slash-command-icon-bg:#27272a;--slash-command-icon-border:#3f3f46}.slash-command-content{animation:slash-command-in .15s ease-out;background-color:var(--slash-command-bg);border:1px solid var(--slash-command-border);border-radius:var(--slash-command-border-radius);box-shadow:var(--slash-command-shadow);display:flex;flex-direction:column;font-family:var(--slash-command-font-family);max-height:400px;overflow:hidden;width:300px;z-index:9999}@keyframes slash-command-in{0%{opacity:0;transform:translateY(-8px) scale(.96)}to{opacity:1;transform:translateY(0) scale(1)}}.slash-command-input-wrapper{align-items:center;border-bottom:1px solid var(--slash-command-border);display:flex;flex-shrink:0;gap:8px;padding:12px 14px}.slash-command-input-trigger{color:var(--slash-command-text-muted);font-family:var(--slash-command-font-mono);font-size:14px;font-weight:500;-webkit-user-select:none;-moz-user-select:none;user-select:none}.slash-command-input{background-color:transparent;border:none;color:var(--slash-command-text);flex:1;font-family:var(--slash-command-font-family);font-size:14px;min-width:0;outline:none}.slash-command-input::-moz-placeholder{color:var(--slash-command-text-muted)}.slash-command-input::placeholder{color:var(--slash-command-text-muted)}.slash-command-kbd{align-items:center;background-color:var(--slash-command-bg-hover);border:1px solid var(--slash-command-border);border-radius:4px;color:var(--slash-command-text-muted);display:inline-flex;font-family:var(--slash-command-font-family);font-size:10px;font-weight:500;justify-content:center;padding:2px 6px;-webkit-user-select:none;-moz-user-select:none;user-select:none}.slash-command-list{display:flex;flex:1;flex-direction:column;gap:2px;overflow-x:hidden;overflow-y:auto;overscroll-behavior:contain;padding:.5rem .25rem}.slash-command-list::-webkit-scrollbar{width:6px}.slash-command-list::-webkit-scrollbar-track{background:transparent}.slash-command-list::-webkit-scrollbar-thumb{background-color:var(--slash-command-border);border-radius:3px}.slash-command-list::-webkit-scrollbar-thumb:hover{background-color:var(--slash-command-text-muted)}.slash-command-group{margin-bottom:8px}.slash-command-group:last-child{margin-bottom:0}.slash-command-group-heading{color:var(--slash-command-text-muted);font-size:11px;font-weight:600;letter-spacing:.05em;padding:8px 12px 6px;text-transform:uppercase;-webkit-user-select:none;-moz-user-select:none;user-select:none}.slash-command-item{align-items:center;background-color:transparent;border:none;border-radius:var(--slash-command-item-radius);cursor:pointer;display:flex;font-family:var(--slash-command-font-family);gap:12px;outline:none;padding:4px 6px;text-align:left;transition:background-color .1s ease;width:100%}.slash-command-item:hover,.slash-command-item[data-selected=true]{background-color:var(--slash-command-bg-selected)}.slash-command-item:focus-visible{outline:2px solid var(--slash-command-accent);outline-offset:-2px}.slash-command-item[data-disabled=true]{cursor:not-allowed;opacity:.5;pointer-events:none}.slash-command-item-icon{align-items:center;background-color:var(--slash-command-icon-bg);border:1px solid var(--slash-command-icon-border);border-radius:8px;color:var(--slash-command-text-muted);display:flex;flex-shrink:0;height:40px;justify-content:center;transition:border-color .1s ease,box-shadow .1s ease;width:40px}.slash-command-item[data-selected=true] .slash-command-item-icon{border-color:var(--slash-command-text-muted);box-shadow:0 1px 3px rgba(0,0,0,.06)}.slash-command-item-icon svg{height:20px;width:20px}.slash-command-item-content{flex:1;min-width:0}.slash-command-item-title{color:var(--slash-command-text);font-size:14px;font-weight:500}.slash-command-item-description,.slash-command-item-title{line-height:1.4;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.slash-command-item-description{color:var(--slash-command-text-muted);font-size:12px;margin-top:1px}.slash-command-item-shortcut{align-items:center;display:flex;flex-shrink:0;gap:4px}.slash-command-empty{align-items:center;color:var(--slash-command-text-muted);display:flex;flex-direction:column;font-size:14px;justify-content:center;padding:32px 16px;text-align:center}.slash-command-empty-icon{margin-bottom:8px;opacity:.5}.slash-command-separator{background-color:var(--slash-command-border);height:1px;margin:8px 12px}.slash-command-footer{align-items:center;background-color:var(--slash-command-bg-hover);border-top:1px solid var(--slash-command-border);display:flex;flex-shrink:0;gap:16px;padding:8px 14px}.slash-command-footer-hint{align-items:center;color:var(--slash-command-text-muted);display:flex;font-size:11px;gap:4px}.slash-command-loading{align-items:center;display:flex;justify-content:center;padding:24px}.slash-command-spinner{animation:slash-command-spin .6s linear infinite;border:2px solid var(--slash-command-border);border-radius:50%;border-top-color:var(--slash-command-accent);height:20px;width:20px}@keyframes slash-command-spin{to{transform:rotate(1turn)}}');const Ze=({children:t,items:n,trigger:r="/",onSelect:o,className:s})=>{const a=f(),i=c(()=>{if(Array.isArray(n)&&n.length>0)return n;return Object.keys(a.plugins).filter(e=>{var t,n;const r=u(a.plugins[e].elements),o=r?a.plugins[e].elements[r]:void 0;return"inline"!==(null===(t=null==o?void 0:o.props)||void 0===t?void 0:t.nodeType)&&"inlineVoid"!==(null===(n=null==o?void 0:o.props)||void 0===n?void 0:n.nodeType)}).map(e=>{var t,n;const r=null===(t=a.plugins[e].options)||void 0===t?void 0:t.display;return{id:e,title:null!==(n=null==r?void 0:r.title)&&void 0!==n?n:e,description:null==r?void 0:r.description,icon:null==r?void 0:r.icon}})},[n,a]),{state:l,actionHandlers:d,filteredItems:p,groupedItems:h,refs:m,floatingStyles:g,transitionStyles:v,isMounted:b}=Je({items:i,trigger:r,onSelect:o}),y=c(()=>({state:l,actionHandlers:d,items:i,filteredItems:p,groupedItems:h,refs:m,floatingStyles:g}),[l,d,i,p,h,m,g]),x=Object.assign(Object.assign({},g),v),w="function"==typeof t?t({groupedItems:h,items:i}):t;return e(E.Provider,Object.assign({value:y},{children:e("div",Object.assign({ref:m.setFloating,style:x,className:`slash-command-root ${null!=s?s:""}`},{children:b?w:null}))}))};Ze.displayName="SlashCommand.Root";const Ge=({className:t})=>e("div",{role:"separator","aria-orientation":"horizontal",className:`slash-command-separator ${t||""}`});Ge.displayName="SlashCommand.Separator";const Ue=Object.assign(Ze,{Root:Ze,Content:P,Input:B,List:q,Group:D,Item:L,Empty:I,Separator:Ge,Footer:R,Loading:M});export{P as SlashCommandContent,E as SlashCommandContext,I as SlashCommandEmpty,R as SlashCommandFooter,D as SlashCommandGroup,B as SlashCommandInput,L as SlashCommandItem,q as SlashCommandList,M as SlashCommandLoading,Ue as SlashCommandMenu,Ze as SlashCommandRoot,Ge as SlashCommandSeparator,Je as useSlashCommand,C as useSlashCommandActions,S as useSlashCommandContext,_ as useSlashCommandItems,T as useSlashCommandRefs,N as useSlashCommandState};
|
package/dist/theme.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{useState as e,useEffect as t,createContext as r,useContext as o}from"react";import{jsx as s,jsxs as n}from"react/jsx-runtime";const i="yoopta-ui-theme",h=()=>"undefined"==typeof window?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",d=e=>{if("undefined"==typeof document)return;const t=document.documentElement;t.classList.remove("light","dark"),t.classList.add(e),t.setAttribute("data-theme",e),t.setAttribute("data-yoopta-theme",e)},a=()=>{const[r,o]=e("system"),[s,n]=e("light");t(()=>{const e=(()=>{if("undefined"==typeof window)return"system";const e=localStorage.getItem(i);return"light"===e||"dark"===e||"system"===e?e:"system"})();o(e);const t="system"===e?h():e;n(t),d(t)},[]),t(()=>{if("system"!==r)return;const e=window.matchMedia("(prefers-color-scheme: dark)"),t=e=>{const t=e.matches?"dark":"light";n(t),d(t)};return e.addEventListener("change",t),()=>e.removeEventListener("change",t)},[r]);const a=e=>{o(e),localStorage.setItem(i,e);const t="system"===e?h():e;n(t),d(t)};return{theme:r,resolvedTheme:s,setTheme:a,toggleTheme:()=>{a("light"===s?"dark":"light")}}},c=r(void 0),m=()=>{const e=o(c);if(!e)throw new Error("useThemeContext must be used within ThemeProvider");return e},l=({children:e,defaultTheme:t="system"})=>{const r=a();return s(c.Provider,Object.assign({value:r},{children:e}))},g=({className:e})=>{const{resolvedTheme:t,toggleTheme:r}=a();return s("button",Object.assign({onClick:r,className:e||"yoopta-ui-theme-toggle","aria-label":"Toggle theme",title:`Switch to ${"light"===t?"dark":"light"} mode`},{children:"light"===t?s("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},{children:s("path",{d:"M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"})})):n("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},{children:[s("circle",{cx:"12",cy:"12",r:"4"}),s("path",{d:"M12 2v2"}),s("path",{d:"M12 20v2"}),s("path",{d:"m4.93 4.93 1.41 1.41"}),s("path",{d:"m17.66 17.66 1.41 1.41"}),s("path",{d:"M2 12h2"}),s("path",{d:"M20 12h2"}),s("path",{d:"m6.34 17.66-1.41 1.41"}),s("path",{d:"m19.07 4.93-1.41 1.41"})]}))}))};export{l as ThemeProvider,g as ThemeToggle,a as useTheme,m as useThemeContext};
|
package/dist/toolbar.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{T as Toolbar,u as useToolbar,a as useToolbarStore}from"./chunks/hooks-907f8ea7.js";import{s as o}from"./chunks/style-inject.es-e87a8d02.js";import"./chunks/_tslib-5e145dfd.js";import"react/jsx-runtime";import"react";import"./portal.js";import"./chunks/floating-ui.react-0123aadf.js";import"react-dom";import"@yoopta/editor";import"./chunks/index-06d5c4e7.js";import"./chunks/throttle-dea4a39e.js";o(".yoopta-ui-toolbar{align-items:center;background:hsl(var(--yoopta-ui-background));border:1px solid hsl(var(--yoopta-ui-border));border-radius:var(--yoopta-ui-toolbar-radius,.5rem);box-shadow:var(\n --yoopta-ui-toolbar-shadow,0 4px 6px -1px rgba(0,0,0,.1),0 2px 4px -2px rgba(0,0,0,.1)\n );display:flex;gap:var(--yoopta-ui-toolbar-gap,4px);padding:var(--yoopta-ui-toolbar-padding,6px);-webkit-user-select:none;-moz-user-select:none;user-select:none;z-index:var(--yoopta-ui-toolbar-z-index,99)}.yoopta-ui-toolbar-group{align-items:center;display:flex;gap:var(--yoopta-ui-toolbar-group-gap,2px)}.yoopta-ui-toolbar-separator{background:hsl(var(--yoopta-ui-border));height:var(--yoopta-ui-toolbar-separator-height,24px);margin:0 var(--yoopta-ui-toolbar-separator-margin,4px);width:1px}.yoopta-ui-toolbar-button{align-items:center;background:transparent;border:none;border-radius:var(--yoopta-ui-toolbar-button-radius,.375rem);color:hsl(var(--yoopta-ui-foreground));cursor:pointer;display:inline-flex;font-size:var(--yoopta-ui-toolbar-button-font-size,.875rem);font-weight:var(--yoopta-ui-toolbar-button-font-weight,500);gap:var(--yoopta-ui-toolbar-button-gap,4px);justify-content:center;min-height:var(--yoopta-ui-toolbar-button-min-height,32px);min-width:var(--yoopta-ui-toolbar-button-min-width,32px);outline:none;padding:var(--yoopta-ui-toolbar-button-padding-y,6px) var(--yoopta-ui-toolbar-button-padding-x,8px);transition:all .15s cubic-bezier(.4,0,.2,1);white-space:nowrap}.yoopta-ui-toolbar-button:hover:not(:disabled){background:hsl(var(--yoopta-ui-accent))}.yoopta-ui-toolbar-button:focus-visible{outline:2px solid hsl(var(--yoopta-ui-ring));outline-offset:var(--yoopta-ui-toolbar-ring-offset,2px)}.yoopta-ui-toolbar-button[data-active=true]{background:hsl(var(--yoopta-ui-primary,221.2 83.2% 53.3%));color:hsl(var(--yoopta-ui-primary-foreground,210 40% 98%))}.yoopta-ui-toolbar-button:disabled{cursor:not-allowed;opacity:.5}.yoopta-ui-toolbar-button svg{height:var(--yoopta-ui-toolbar-icon-size,1rem);width:var(--yoopta-ui-toolbar-icon-size,1rem)}:root{--yoopta-ui-background:0 0% 100%;--yoopta-ui-foreground:222.2 84% 4.9%;--yoopta-ui-border:214.3 31.8% 91.4%;--yoopta-ui-accent:210 40% 96.1%;--yoopta-ui-ring:222.2 84% 4.9%;--yoopta-ui-primary:221.2 83.2% 53.3%;--yoopta-ui-primary-foreground:210 40% 98%;--yoopta-ui-toolbar-gap:4px;--yoopta-ui-toolbar-padding:6px;--yoopta-ui-toolbar-radius:0.5rem;--yoopta-ui-toolbar-shadow:0 4px 6px -1px rgba(0,0,0,.1),0 2px 4px -2px rgba(0,0,0,.1);--yoopta-ui-toolbar-z-index:99;--yoopta-ui-toolbar-group-gap:2px;--yoopta-ui-toolbar-separator-height:24px;--yoopta-ui-toolbar-separator-margin:4px;--yoopta-ui-toolbar-button-min-width:32px;--yoopta-ui-toolbar-button-min-height:32px;--yoopta-ui-toolbar-button-padding-y:6px;--yoopta-ui-toolbar-button-padding-x:8px;--yoopta-ui-toolbar-button-font-size:0.875rem;--yoopta-ui-toolbar-button-font-weight:500;--yoopta-ui-toolbar-button-gap:4px;--yoopta-ui-toolbar-button-radius:0.375rem;--yoopta-ui-toolbar-icon-size:1rem;--yoopta-ui-toolbar-ring-offset:2px}.dark,[data-theme=dark]{--yoopta-ui-background:222.2 84% 4.9%;--yoopta-ui-foreground:210 40% 98%;--yoopta-ui-border:217.2 32.6% 17.5%;--yoopta-ui-accent:217.2 32.6% 17.5%;--yoopta-ui-ring:212.7 26.8% 83.9%}");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yoopta/ui",
|
|
3
|
-
"version": "6.0.0-beta.
|
|
3
|
+
"version": "6.0.0-beta.5",
|
|
4
4
|
"description": "UI components for Yoopta Editor",
|
|
5
5
|
"author": "Darginec05 <devopsbanda@gmail.com>",
|
|
6
6
|
"homepage": "https://github.com/Darginec05/Yoopta-Editor#readme",
|
|
@@ -10,21 +10,87 @@
|
|
|
10
10
|
"type": "module",
|
|
11
11
|
"module": "dist/index.js",
|
|
12
12
|
"types": "./dist/index.d.ts",
|
|
13
|
+
"typesVersions": {
|
|
14
|
+
"*": {
|
|
15
|
+
"toolbar": [
|
|
16
|
+
"./dist/toolbar/index.d.ts"
|
|
17
|
+
],
|
|
18
|
+
"action-menu-list": [
|
|
19
|
+
"./dist/action-menu-list/index.d.ts"
|
|
20
|
+
],
|
|
21
|
+
"slash-command-menu": [
|
|
22
|
+
"./dist/slash-command-menu/index.d.ts"
|
|
23
|
+
],
|
|
24
|
+
"block-options": [
|
|
25
|
+
"./dist/block-options/index.d.ts"
|
|
26
|
+
],
|
|
27
|
+
"floating-block-actions": [
|
|
28
|
+
"./dist/floating-block-actions/index.d.ts"
|
|
29
|
+
],
|
|
30
|
+
"highlight-color-picker": [
|
|
31
|
+
"./dist/highlight-color-picker/index.d.ts"
|
|
32
|
+
],
|
|
33
|
+
"portal": [
|
|
34
|
+
"./dist/portal/index.d.ts"
|
|
35
|
+
],
|
|
36
|
+
"overlay": [
|
|
37
|
+
"./dist/overlay/index.d.ts"
|
|
38
|
+
],
|
|
39
|
+
"theme": [
|
|
40
|
+
"./dist/theme/index.d.ts"
|
|
41
|
+
]
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
"sideEffects": [
|
|
45
|
+
"**/*.css"
|
|
46
|
+
],
|
|
13
47
|
"exports": {
|
|
14
48
|
".": {
|
|
15
|
-
"
|
|
16
|
-
"
|
|
49
|
+
"types": "./dist/index.d.ts",
|
|
50
|
+
"import": "./dist/index.js"
|
|
51
|
+
},
|
|
52
|
+
"./toolbar": {
|
|
53
|
+
"types": "./dist/toolbar/index.d.ts",
|
|
54
|
+
"import": "./dist/toolbar.js"
|
|
55
|
+
},
|
|
56
|
+
"./action-menu-list": {
|
|
57
|
+
"types": "./dist/action-menu-list/index.d.ts",
|
|
58
|
+
"import": "./dist/action-menu-list.js"
|
|
59
|
+
},
|
|
60
|
+
"./slash-command-menu": {
|
|
61
|
+
"types": "./dist/slash-command-menu/index.d.ts",
|
|
62
|
+
"import": "./dist/slash-command-menu.js"
|
|
63
|
+
},
|
|
64
|
+
"./block-options": {
|
|
65
|
+
"types": "./dist/block-options/index.d.ts",
|
|
66
|
+
"import": "./dist/block-options.js"
|
|
17
67
|
},
|
|
18
68
|
"./floating-block-actions": {
|
|
19
|
-
"
|
|
20
|
-
"
|
|
69
|
+
"types": "./dist/floating-block-actions/index.d.ts",
|
|
70
|
+
"import": "./dist/floating-block-actions.js"
|
|
71
|
+
},
|
|
72
|
+
"./highlight-color-picker": {
|
|
73
|
+
"types": "./dist/highlight-color-picker/index.d.ts",
|
|
74
|
+
"import": "./dist/highlight-color-picker.js"
|
|
75
|
+
},
|
|
76
|
+
"./portal": {
|
|
77
|
+
"types": "./dist/portal/index.d.ts",
|
|
78
|
+
"import": "./dist/portal.js"
|
|
79
|
+
},
|
|
80
|
+
"./overlay": {
|
|
81
|
+
"types": "./dist/overlay/index.d.ts",
|
|
82
|
+
"import": "./dist/overlay.js"
|
|
83
|
+
},
|
|
84
|
+
"./theme": {
|
|
85
|
+
"types": "./dist/theme/index.d.ts",
|
|
86
|
+
"import": "./dist/theme.js"
|
|
21
87
|
}
|
|
22
88
|
},
|
|
23
89
|
"files": [
|
|
24
90
|
"dist/"
|
|
25
91
|
],
|
|
26
92
|
"peerDependencies": {
|
|
27
|
-
"@yoopta/editor": "
|
|
93
|
+
"@yoopta/editor": "6.0.0-beta.4",
|
|
28
94
|
"react": ">=18.2.0",
|
|
29
95
|
"react-dom": ">=18.2.0"
|
|
30
96
|
},
|
|
@@ -57,5 +123,5 @@
|
|
|
57
123
|
"bugs": {
|
|
58
124
|
"url": "https://github.com/Darginec05/Yoopta-Editor/issues"
|
|
59
125
|
},
|
|
60
|
-
"gitHead": "
|
|
126
|
+
"gitHead": "057e2317fa9f18704c8343af6b021c9355de4056"
|
|
61
127
|
}
|
package/dist/index-16ebe43d.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import{jsx as t}from"react/jsx-runtime";import o,{memo as e,forwardRef as n,useCallback as a,useEffect as i}from"react";import{useYooptaEditor as r}from"@yoopta/editor";function u(t,o){var e={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&o.indexOf(n)<0&&(e[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(n=Object.getOwnPropertySymbols(t);a<n.length;a++)o.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(t,n[a])&&(e[n[a]]=t[n[a]])}return e}function s(t,o){void 0===o&&(o={});var e=o.insertAt;if(t&&"undefined"!=typeof document){var n=document.head||document.getElementsByTagName("head")[0],a=document.createElement("style");a.type="text/css","top"===e&&n.firstChild?n.insertBefore(a,n.firstChild):n.appendChild(a),a.styleSheet?a.styleSheet.cssText=t:a.appendChild(document.createTextNode(t))}}"function"==typeof SuppressedError&&SuppressedError;s(":root{--yoopta-ui-background:0 0% 100%;--yoopta-ui-foreground:222.2 84% 4.9%;--yoopta-ui-muted:210 40% 96.1%;--yoopta-ui-muted-foreground:215.4 16.3% 46.9%;--yoopta-ui-border:214.3 31.8% 91.4%;--yoopta-ui-ring:222.2 84% 4.9%;--yoopta-ui-accent:210 40% 96.1%;--yoopta-ui-accent-foreground:222.2 47.4% 11.2%;--yoopta-ui-floating-bg:var(--yoopta-ui-background);--yoopta-ui-floating-border:var(--yoopta-ui-border);--yoopta-ui-floating-shadow:0 1px 2px 0 rgba(0,0,0,.05);--yoopta-ui-floating-shadow-md:0 4px 6px -1px rgba(0,0,0,.1),0 2px 4px -2px rgba(0,0,0,.1);--yoopta-ui-floating-z-index:100;--yoopta-ui-floating-gap:1px;--yoopta-ui-floating-padding:3px;--yoopta-ui-floating-radius:0.5rem;--yoopta-ui-floating-offset:46px;--yoopta-ui-floating-button-min-width:24px;--yoopta-ui-floating-button-min-height:24px;--yoopta-ui-floating-button-padding-y:4px;--yoopta-ui-floating-button-padding-x:6px;--yoopta-ui-floating-button-color:var(--yoopta-ui-foreground);--yoopta-ui-floating-button-bg:transparent;--yoopta-ui-floating-button-hover:var(--yoopta-ui-accent);--yoopta-ui-floating-button-active:var(--yoopta-ui-accent);--yoopta-ui-floating-button-radius:0.375rem;--yoopta-ui-floating-transition:color 0.15s ease-in-out,background-color 0.15s ease-in-out,border-color 0.15s ease-in-out,box-shadow 0.15s ease-in-out;--yoopta-ui-floating-ring-offset:2px;--yoopta-ui-floating-ring:var(--yoopta-ui-ring);--yoopta-ui-floating-icon-size:1rem}.dark,[data-theme=dark],[data-yoopta-theme=dark]{--yoopta-ui-background:222.2 84% 4.9%;--yoopta-ui-foreground:210 40% 98%;--yoopta-ui-muted:217.2 32.6% 17.5%;--yoopta-ui-muted-foreground:215 20.2% 65.1%;--yoopta-ui-border:217.2 32.6% 17.5%;--yoopta-ui-ring:212.7 26.8% 83.9%;--yoopta-ui-accent:217.2 32.6% 17.5%;--yoopta-ui-accent-foreground:210 40% 98%;--yoopta-ui-floating-shadow:0 1px 2px 0 rgba(0,0,0,.3);--yoopta-ui-floating-shadow-md:0 4px 6px -1px rgba(0,0,0,.5),0 2px 4px -2px rgba(0,0,0,.3)}.yoopta-ui-floating-block-actions{align-items:center;background-color:hsl(var(--yoopta-ui-floating-bg));border:1px solid hsl(var(--yoopta-ui-floating-border));border-radius:var(--yoopta-ui-floating-radius);box-shadow:var(--yoopta-ui-floating-shadow-md);display:inline-flex;gap:var(--yoopta-ui-floating-gap);padding:var(--yoopta-ui-floating-padding);z-index:var(--yoopta-ui-floating-z-index)}.yoopta-ui-floating-action-button{align-items:center;background-color:var(--yoopta-ui-floating-button-bg);border:none;border-radius:var(--yoopta-ui-floating-button-radius);color:hsl(var(--yoopta-ui-floating-button-color));cursor:pointer;display:inline-flex;font-size:.875rem;font-weight:500;justify-content:center;line-height:1;min-height:var(--yoopta-ui-floating-button-min-height);min-width:var(--yoopta-ui-floating-button-min-width);outline:none;padding:var(--yoopta-ui-floating-button-padding-y) var(--yoopta-ui-floating-button-padding-x);touch-action:manipulation;transition:var(--yoopta-ui-floating-transition);-moz-user-select:none;user-select:none;-webkit-user-select:none;white-space:nowrap}.yoopta-ui-floating-action-button:hover{background-color:hsl(var(--yoopta-ui-floating-button-hover));color:hsl(var(--yoopta-ui-accent-foreground))}.yoopta-ui-floating-action-button:active{background-color:hsl(var(--yoopta-ui-floating-button-active));transform:scale(.98)}.yoopta-ui-floating-action-button:focus-visible{box-shadow:0 0 0 var(--yoopta-ui-floating-ring-offset) hsl(var(--yoopta-ui-background)),0 0 0 calc(var(--yoopta-ui-floating-ring-offset) + 2px) hsl(var(--yoopta-ui-floating-ring));outline:none}.yoopta-ui-floating-action-button:disabled{opacity:.5;pointer-events:none}.yoopta-ui-floating-action-button svg{flex-shrink:0;height:var(--yoopta-ui-floating-icon-size);width:var(--yoopta-ui-floating-icon-size)}@media (prefers-color-scheme:dark){:root:not([data-theme=light]){--yoopta-ui-background:222.2 84% 4.9%;--yoopta-ui-foreground:210 40% 98%;--yoopta-ui-muted:217.2 32.6% 17.5%;--yoopta-ui-muted-foreground:215 20.2% 65.1%;--yoopta-ui-border:217.2 32.6% 17.5%;--yoopta-ui-ring:212.7 26.8% 83.9%;--yoopta-ui-accent:217.2 32.6% 17.5%;--yoopta-ui-accent-foreground:210 40% 98%}}");const l=t=>{let o;const e=new Set,n=(t,n)=>{const a="function"==typeof t?t(o):t;if(!Object.is(a,o)){const t=o;o=(null!=n?n:"object"!=typeof a||null===a)?a:Object.assign({},o,a),e.forEach(e=>e(o,t))}},a=()=>o,i={setState:n,getState:a,getInitialState:()=>r,subscribe:t=>(e.add(t),()=>e.delete(t)),destroy:()=>{"production"!==(import.meta.env?import.meta.env.MODE:void 0)&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),e.clear()}},r=o=t(n,a,i);return i};function c(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var p,d,f,g={},y={get exports(){return g},set exports(t){g=t}},b={},v={},m={get exports(){return v},set exports(t){v=t}},h={};function x(){return d||(d=1,m.exports=function(){if(p)return h;p=1;var t=o,e="function"==typeof Object.is?Object.is:function(t,o){return t===o&&(0!==t||1/t==1/o)||t!=t&&o!=o},n=t.useState,a=t.useEffect,i=t.useLayoutEffect,r=t.useDebugValue;function u(t){var o=t.getSnapshot;t=t.value;try{var n=o();return!e(t,n)}catch(t){return!0}}var s="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(t,o){return o()}:function(t,o){var e=o(),s=n({inst:{value:e,getSnapshot:o}}),l=s[0].inst,c=s[1];return i(function(){l.value=e,l.getSnapshot=o,u(l)&&c({inst:l})},[t,e,o]),a(function(){return u(l)&&c({inst:l}),t(function(){u(l)&&c({inst:l})})},[t]),r(e),e};return h.useSyncExternalStore=void 0!==t.useSyncExternalStore?t.useSyncExternalStore:s,h}()),v}
|
|
2
|
-
/**
|
|
3
|
-
* @license React
|
|
4
|
-
* use-sync-external-store-shim/with-selector.production.js
|
|
5
|
-
*
|
|
6
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
7
|
-
*
|
|
8
|
-
* This source code is licensed under the MIT license found in the
|
|
9
|
-
* LICENSE file in the root directory of this source tree.
|
|
10
|
-
*/y.exports=function(){if(f)return b;f=1;var t=o,e=x(),n="function"==typeof Object.is?Object.is:function(t,o){return t===o&&(0!==t||1/t==1/o)||t!=t&&o!=o},a=e.useSyncExternalStore,i=t.useRef,r=t.useEffect,u=t.useMemo,s=t.useDebugValue;return b.useSyncExternalStoreWithSelector=function(t,o,e,l,c){var p=i(null);if(null===p.current){var d={hasValue:!1,value:null};p.current=d}else d=p.current;p=u(function(){function t(t){if(!r){if(r=!0,a=t,t=l(t),void 0!==c&&d.hasValue){var o=d.value;if(c(o,t))return i=o}return i=t}if(o=i,n(a,t))return o;var e=l(t);return void 0!==c&&c(o,e)?(a=t,o):(a=t,i=e)}var a,i,r=!1,u=void 0===e?null:e;return[function(){return t(o())},null===u?void 0:function(){return t(u())}]},[o,e,l,c]);var f=a(t,p[0],p[1]);return r(function(){d.hasValue=!0,d.value=f},[f]),s(f),f},b}();var E=c(g);const{useDebugValue:w}=o,{useSyncExternalStoreWithSelector:k}=E;let S=!1;const O=t=>t;const j=t=>{"production"!==(import.meta.env?import.meta.env.MODE:void 0)&&"function"!=typeof t&&console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");const o="function"==typeof t?(t=>t?l(t):l)(t):t,e=(t,e)=>function(t,o=O,e){"production"!==(import.meta.env?import.meta.env.MODE:void 0)&&e&&!S&&(console.warn("[DEPRECATED] Use `createWithEqualityFn` instead of `create` or use `useStoreWithEqualityFn` instead of `useStore`. They can be imported from 'zustand/traditional'. https://github.com/pmndrs/zustand/discussions/1937"),S=!0);const n=k(t.subscribe,t.getState,t.getServerState||t.getInitialState,o,e);return w(n),n}(o,t,e);return Object.assign(e,o),e},D=t=>t?j(t):j,I={position:"fixed",top:0,left:0,opacity:0,pointerEvents:"none",transform:"scale(0.95) translateX(-46px)",transition:"opacity 150ms ease-out, transform 150ms ease-out"},z=D()((t,o)=>({blockId:null,state:"closed",position:{top:0,left:0},styles:I,reference:null,setReference(o){t({reference:o})},toggle(o,e){t({state:o,blockId:e||null})},updatePosition(e,n,a=46){t({position:{top:e,left:n},styles:Object.assign(Object.assign({},o().styles),{top:e,left:n,opacity:1,transform:`scale(1) translateX(-${a+2}px)`,pointerEvents:"auto"})})},hide(){t({state:"closed",blockId:null,styles:Object.assign(Object.assign({},o().styles),{opacity:0,transform:I.transform,pointerEvents:"none"})})},reset(){t({blockId:null,state:"closed",position:{top:0,left:0},styles:I})}})),C=e(({children:o,className:e})=>{const{setReference:n,styles:a}=z();return t("div",Object.assign({ref:n,className:`yoopta-ui-floating-block-actions ${e}`,style:a,contentEditable:!1,onClick:t=>t.stopPropagation(),onMouseDown:t=>t.stopPropagation()},{children:o}))});C.displayName="FloatingBlockActions.Root";const P=n((o,e)=>{var{children:n,onClick:a,className:i="",disabled:r,title:s}=o,l=u(o,["children","onClick","className","disabled","title"]);return t("button",Object.assign({ref:e,type:"button",className:`yoopta-ui-floating-action-button ${i}`,onClick:a,disabled:r,title:s,"aria-label":s},l,{children:n}))});P.displayName="FloatingBlockActions.Button";const T=Object.assign(C,{Root:C,Button:P});function B(t,o,{leading:e=!0,trailing:n=!0}={}){let a=0,i=null,r=null;const u=o=>{t(...r),a=o,r=null},s=(...t)=>{const s=Date.now();a||e||(a=s);const l=o-(s-a);r=t,l<=0||l>o?(i&&(clearTimeout(i),i=null),u(s)):!i&&n&&(i=setTimeout(()=>{i=null,n&&r&&u(Date.now())},l))};return s.cancel=()=>{i&&(clearTimeout(i),i=null),r=null,a=0},s}const R=()=>{const t=z();return{reference:t.reference,floatingBlockId:t.blockId,state:t.state,styles:t.styles,toggle:t.toggle,hide:t.hide,reset:t.reset}},N=()=>{const t=r(),o=z(),e=a((t,e)=>{var n;const a=t.getBoundingClientRect(),i=(null===(n=o.reference)||void 0===n?void 0:n.offsetWidth)||46;o.updatePosition(a.top+2,a.left,i)},[o]),n=a(()=>{o.hide()},[o]),u=a(o=>{if(!t.refElement)return null;const e=t.refElement.querySelectorAll("[data-yoopta-block]"),n=window.innerHeight;let a=null,i=1/0;if(e.forEach(t=>{const e=t.getBoundingClientRect();if(e.bottom<-200||e.top>n+200)return;if(o>=e.top&&o<=e.bottom)return a=t,void(i=0);const r=o<e.top?e.top-o:o-e.bottom;r<i&&(i=r,a=t)}),a&&i<=100){const o=a.getAttribute("data-yoopta-block-id"),e=o?t.children[o]:null;if(o&&e)return{element:a,data:e}}return null},[t]),s=B(a(a=>{var i,r;if("frozen"===o.state)return;const s=a.target,l=null===(i=t.refElement)||void 0===i?void 0:i.contains(a.target),c=null===(r=o.reference)||void 0===r?void 0:r.contains(s);if(!l)return n();if(t.readOnly)return;if(c)return;const p=u(a.clientY);if(p){const{element:t,data:n}=p;n.id!==o.blockId&&(o.toggle("hovering",n.id),e(t,n))}else null!==o.blockId&&n()},[o,t,n,u,e]),100,{leading:!0,trailing:!0});return i(()=>{const t=()=>{"frozen"!==o.state&&n()};return document.addEventListener("mousemove",s),document.addEventListener("scroll",t,!0),()=>{document.removeEventListener("mousemove",s),document.removeEventListener("scroll",t,!0)}},[s,n,o.state]),{reference:o.reference,floatingBlockId:o.blockId,state:o.state,styles:o.styles,toggle:o.toggle,hide:o.hide,reset:o.reset}};export{T as F,u as _,R as a,z as b,D as c,s,B as t,N as u};
|