chesai-ui 0.12.0 → 0.12.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -229,7 +229,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
229
229
  `)});function R(B,V,H,W){var te=H?"":W.css;if(B.styleSheet)B.styleSheet.cssText=F(V,te);else{var se=document.createTextNode(te),X=B.childNodes;X[V]&&B.removeChild(X[V]),X.length?B.insertBefore(se,X[V]):B.appendChild(se)}}},function(n,r){n.exports=function(i){var o=typeof window<"u"&&window.location;if(!o)throw new Error("fixUrls requires window.location");if(!i||typeof i!="string")return i;var s=o.protocol+"//"+o.host,a=s+o.pathname.replace(/\/[^\/]*$/,"/");return i.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi,function(l,c){var u,d=c.trim().replace(/^"(.*)"$/,function(p,g){return g}).replace(/^'(.*)'$/,function(p,g){return g});return/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/|\s*$)/i.test(d)?l:(u=d.indexOf("//")===0?d:d.indexOf("/")===0?s+d:a+d.replace(/^\.\//,""),"url("+JSON.stringify(u)+")")})}},function(n,r,i){var o,s,a,l,c,u,d,p,g;n.exports=(o="cdx-notifies",s="cdx-notify",a="cdx-notify__cross",l="cdx-notify__button--confirm",c="cdx-notify__button--cancel",u="cdx-notify__input",d="cdx-notify__button",p="cdx-notify__btns-wrapper",{alert:g=function(b){var w=document.createElement("DIV"),_=document.createElement("DIV"),E=b.message,A=b.style;return w.classList.add(s),A&&w.classList.add(s+"--"+A),w.innerHTML=E,_.classList.add(a),_.addEventListener("click",w.remove.bind(w)),w.appendChild(_),w},confirm:function(b){var w=g(b),_=document.createElement("div"),E=document.createElement("button"),A=document.createElement("button"),k=w.querySelector("."+a),M=b.cancelHandler,L=b.okHandler;return _.classList.add(p),E.innerHTML=b.okText||"Confirm",A.innerHTML=b.cancelText||"Cancel",E.classList.add(d),A.classList.add(d),E.classList.add(l),A.classList.add(c),M&&typeof M=="function"&&(A.addEventListener("click",M),k.addEventListener("click",M)),L&&typeof L=="function"&&E.addEventListener("click",L),E.addEventListener("click",w.remove.bind(w)),A.addEventListener("click",w.remove.bind(w)),_.appendChild(E),_.appendChild(A),w.appendChild(_),w},prompt:function(b){var w=g(b),_=document.createElement("div"),E=document.createElement("button"),A=document.createElement("input"),k=w.querySelector("."+a),M=b.cancelHandler,L=b.okHandler;return _.classList.add(p),E.innerHTML=b.okText||"Ok",E.classList.add(d),E.classList.add(l),A.classList.add(u),b.placeholder&&A.setAttribute("placeholder",b.placeholder),b.default&&(A.value=b.default),b.inputType&&(A.type=b.inputType),M&&typeof M=="function"&&k.addEventListener("click",M),L&&typeof L=="function"&&E.addEventListener("click",function(){L(A.value)}),E.addEventListener("click",w.remove.bind(w)),_.appendChild(A),_.appendChild(E),w.appendChild(_),w},getWrapper:function(){var b=document.createElement("DIV");return b.classList.add(o),b}})}])})})(B5e);var iNt=B5e.exports;const oNt=OM(iNt);class sNt{show(e){oNt.show(e)}}class aNt extends Ir{constructor({config:e,eventsDispatcher:n}){super({config:e,eventsDispatcher:n}),this.notifier=new sNt}get methods(){return{show:e=>this.show(e)}}show(e){return this.notifier.show(e)}}class lNt extends Ir{get methods(){const e=()=>this.isEnabled;return{toggle:n=>this.toggle(n),get isEnabled(){return e()}}}toggle(e){return this.Editor.ReadOnly.toggle(e)}get isEnabled(){return this.Editor.ReadOnly.isEnabled}}var z5e={exports:{}};(function(t,e){(function(n,r){t.exports=r()})(ME,function(){function n(d){var p=d.tags,g=Object.keys(p),b=g.map(function(w){return typeof p[w]}).every(function(w){return w==="object"||w==="boolean"||w==="function"});if(!b)throw new Error("The configuration was invalid");this.config=d}var r=["P","LI","TD","TH","DIV","H1","H2","H3","H4","H5","H6","PRE"];function i(d){return r.indexOf(d.nodeName)!==-1}var o=["A","B","STRONG","I","EM","SUB","SUP","U","STRIKE"];function s(d){return o.indexOf(d.nodeName)!==-1}n.prototype.clean=function(d){const p=document.implementation.createHTMLDocument(),g=p.createElement("div");return g.innerHTML=d,this._sanitize(p,g),g.innerHTML},n.prototype._sanitize=function(d,p){var g=a(d,p),b=g.firstChild();if(b)do{if(b.nodeType===Node.TEXT_NODE)if(b.data.trim()===""&&(b.previousElementSibling&&i(b.previousElementSibling)||b.nextElementSibling&&i(b.nextElementSibling))){p.removeChild(b),this._sanitize(d,p);break}else continue;if(b.nodeType===Node.COMMENT_NODE){p.removeChild(b),this._sanitize(d,p);break}var w=s(b),_;w&&(_=Array.prototype.some.call(b.childNodes,i));var E=!!p.parentNode,A=i(p)&&i(b)&&E,k=b.nodeName.toLowerCase(),M=l(this.config,k,b),L=w&&_;if(L||c(b,M)||!this.config.keepNestedBlockElements&&A){if(!(b.nodeName==="SCRIPT"||b.nodeName==="STYLE"))for(;b.childNodes.length>0;)p.insertBefore(b.childNodes[0],b);p.removeChild(b),this._sanitize(d,p);break}for(var F=0;F<b.attributes.length;F+=1){var R=b.attributes[F];u(R,M,b)&&(b.removeAttribute(R.name),F=F-1)}this._sanitize(d,b)}while(b=g.nextSibling())};function a(d,p){return d.createTreeWalker(p,NodeFilter.SHOW_TEXT|NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_COMMENT,null,!1)}function l(d,p,g){return typeof d.tags[p]=="function"?d.tags[p](g):d.tags[p]}function c(d,p){return typeof p>"u"?!0:typeof p=="boolean"?!p:!1}function u(d,p,g){var b=d.name.toLowerCase();return p===!0?!1:typeof p[b]=="function"?!p[b](d.value,g):typeof p[b]>"u"||p[b]===!1?!0:typeof p[b]=="string"?p[b]!==d.value:!1}return n})})(z5e);var cNt=z5e.exports;const uNt=OM(cNt);function XG(t,e){return t.map(n=>{const r=bo(e)?e(n.tool):e;return Xc(r)||(n.data=QG(n.data,r)),n})}function Gd(t,e={}){const n={tags:e};return new uNt(n).clean(t)}function QG(t,e){return Array.isArray(t)?dNt(t,e):oa(t)?fNt(t,e):Mh(t)?hNt(t,e):t}function dNt(t,e){return t.map(n=>QG(n,e))}function fNt(t,e){const n={};for(const r in t){if(!Object.prototype.hasOwnProperty.call(t,r))continue;const i=t[r],o=pNt(e[r])?e[r]:e;n[r]=QG(i,o)}return n}function hNt(t,e){return oa(e)?Gd(t,e):e===!1?Gd(t,{}):t}function pNt(t){return oa(t)||D6t(t)||bo(t)}class gNt extends Ir{get methods(){return{clean:(e,n)=>this.clean(e,n)}}clean(e,n){return Gd(e,n)}}class mNt extends Ir{get methods(){return{save:()=>this.save()}}save(){const e="Editor's content can not be saved in read-only mode";return this.Editor.ReadOnly.isEnabled?(Zc(e,"warn"),Promise.reject(new Error(e))):this.Editor.Saver.save()}}class yNt extends Ir{constructor(){super(...arguments),this.selectionUtils=new er}get methods(){return{findParentTag:(e,n)=>this.findParentTag(e,n),expandToTag:e=>this.expandToTag(e),save:()=>this.selectionUtils.save(),restore:()=>this.selectionUtils.restore(),setFakeBackground:()=>this.selectionUtils.setFakeBackground(),removeFakeBackground:()=>this.selectionUtils.removeFakeBackground()}}findParentTag(e,n){return this.selectionUtils.findParentTag(e,n)}expandToTag(e){this.selectionUtils.expandToTag(e)}}class vNt extends Ir{get methods(){return{getBlockTools:()=>Array.from(this.Editor.Tools.blockTools.values())}}}class bNt extends Ir{get classes(){return{block:"cdx-block",inlineToolButton:"ce-inline-tool",inlineToolButtonActive:"ce-inline-tool--active",input:"cdx-input",loader:"cdx-loader",button:"cdx-button",settingsButton:"cdx-settings-button",settingsButtonActive:"cdx-settings-button--active"}}}class xNt extends Ir{get methods(){return{close:()=>this.close(),open:()=>this.open(),toggleBlockSettings:e=>this.toggleBlockSettings(e),toggleToolbox:e=>this.toggleToolbox(e)}}open(){this.Editor.Toolbar.moveAndOpen()}close(){this.Editor.Toolbar.close()}toggleBlockSettings(e){if(this.Editor.BlockManager.currentBlockIndex===-1){Zc("Could't toggle the Toolbar because there is no block selected ","warn");return}e??!this.Editor.BlockSettings.opened?(this.Editor.Toolbar.moveAndOpen(),this.Editor.BlockSettings.open()):this.Editor.BlockSettings.close()}toggleToolbox(e){if(this.Editor.BlockManager.currentBlockIndex===-1){Zc("Could't toggle the Toolbox because there is no block selected ","warn");return}e??!this.Editor.Toolbar.toolbox.opened?(this.Editor.Toolbar.moveAndOpen(),this.Editor.Toolbar.toolbox.open()):this.Editor.Toolbar.toolbox.close()}}var R5e={exports:{}};(function(t,e){(function(n,r){t.exports=r()})(window,function(){return(function(n){var r={};function i(o){if(r[o])return r[o].exports;var s=r[o]={i:o,l:!1,exports:{}};return n[o].call(s.exports,s,s.exports,i),s.l=!0,s.exports}return i.m=n,i.c=r,i.d=function(o,s,a){i.o(o,s)||Object.defineProperty(o,s,{enumerable:!0,get:a})},i.r=function(o){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(o,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(o,"__esModule",{value:!0})},i.t=function(o,s){if(1&s&&(o=i(o)),8&s||4&s&&typeof o=="object"&&o&&o.__esModule)return o;var a=Object.create(null);if(i.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:o}),2&s&&typeof o!="string")for(var l in o)i.d(a,l,(function(c){return o[c]}).bind(null,l));return a},i.n=function(o){var s=o&&o.__esModule?function(){return o.default}:function(){return o};return i.d(s,"a",s),s},i.o=function(o,s){return Object.prototype.hasOwnProperty.call(o,s)},i.p="",i(i.s=0)})([function(n,r,i){n.exports=i(1)},function(n,r,i){i.r(r),i.d(r,"default",function(){return o});class o{constructor(){this.nodes={wrapper:null,content:null},this.showed=!1,this.offsetTop=10,this.offsetLeft=10,this.offsetRight=10,this.hidingDelay=0,this.handleWindowScroll=()=>{this.showed&&this.hide(!0)},this.loadStyles(),this.prepare(),window.addEventListener("scroll",this.handleWindowScroll,{passive:!0})}get CSS(){return{tooltip:"ct",tooltipContent:"ct__content",tooltipShown:"ct--shown",placement:{left:"ct--left",bottom:"ct--bottom",right:"ct--right",top:"ct--top"}}}show(a,l,c){this.nodes.wrapper||this.prepare(),this.hidingTimeout&&clearTimeout(this.hidingTimeout);const u=Object.assign({placement:"bottom",marginTop:0,marginLeft:0,marginRight:0,marginBottom:0,delay:70,hidingDelay:0},c);if(u.hidingDelay&&(this.hidingDelay=u.hidingDelay),this.nodes.content.innerHTML="",typeof l=="string")this.nodes.content.appendChild(document.createTextNode(l));else{if(!(l instanceof Node))throw Error("[CodeX Tooltip] Wrong type of «content» passed. It should be an instance of Node or String. But "+typeof l+" given.");this.nodes.content.appendChild(l)}switch(this.nodes.wrapper.classList.remove(...Object.values(this.CSS.placement)),u.placement){case"top":this.placeTop(a,u);break;case"left":this.placeLeft(a,u);break;case"right":this.placeRight(a,u);break;default:this.placeBottom(a,u)}u&&u.delay?this.showingTimeout=setTimeout(()=>{this.nodes.wrapper.classList.add(this.CSS.tooltipShown),this.showed=!0},u.delay):(this.nodes.wrapper.classList.add(this.CSS.tooltipShown),this.showed=!0)}hide(a=!1){if(this.hidingDelay&&!a)return this.hidingTimeout&&clearTimeout(this.hidingTimeout),void(this.hidingTimeout=setTimeout(()=>{this.hide(!0)},this.hidingDelay));this.nodes.wrapper.classList.remove(this.CSS.tooltipShown),this.showed=!1,this.showingTimeout&&clearTimeout(this.showingTimeout)}onHover(a,l,c){a.addEventListener("mouseenter",()=>{this.show(a,l,c)}),a.addEventListener("mouseleave",()=>{this.hide()})}destroy(){this.nodes.wrapper.remove(),window.removeEventListener("scroll",this.handleWindowScroll)}prepare(){this.nodes.wrapper=this.make("div",this.CSS.tooltip),this.nodes.content=this.make("div",this.CSS.tooltipContent),this.append(this.nodes.wrapper,this.nodes.content),this.append(document.body,this.nodes.wrapper)}loadStyles(){const a="codex-tooltips-style";if(document.getElementById(a))return;const l=i(2),c=this.make("style",null,{textContent:l.toString(),id:a});this.prepend(document.head,c)}placeBottom(a,l){const c=a.getBoundingClientRect(),u=c.left+a.clientWidth/2-this.nodes.wrapper.offsetWidth/2,d=c.bottom+window.pageYOffset+this.offsetTop+l.marginTop;this.applyPlacement("bottom",u,d)}placeTop(a,l){const c=a.getBoundingClientRect(),u=c.left+a.clientWidth/2-this.nodes.wrapper.offsetWidth/2,d=c.top+window.pageYOffset-this.nodes.wrapper.clientHeight-this.offsetTop;this.applyPlacement("top",u,d)}placeLeft(a,l){const c=a.getBoundingClientRect(),u=c.left-this.nodes.wrapper.offsetWidth-this.offsetLeft-l.marginLeft,d=c.top+window.pageYOffset+a.clientHeight/2-this.nodes.wrapper.offsetHeight/2;this.applyPlacement("left",u,d)}placeRight(a,l){const c=a.getBoundingClientRect(),u=c.right+this.offsetRight+l.marginRight,d=c.top+window.pageYOffset+a.clientHeight/2-this.nodes.wrapper.offsetHeight/2;this.applyPlacement("right",u,d)}applyPlacement(a,l,c){this.nodes.wrapper.classList.add(this.CSS.placement[a]),this.nodes.wrapper.style.left=l+"px",this.nodes.wrapper.style.top=c+"px"}make(a,l=null,c={}){const u=document.createElement(a);Array.isArray(l)?u.classList.add(...l):l&&u.classList.add(l);for(const d in c)c.hasOwnProperty(d)&&(u[d]=c[d]);return u}append(a,l){Array.isArray(l)?l.forEach(c=>a.appendChild(c)):a.appendChild(l)}prepend(a,l){Array.isArray(l)?(l=l.reverse()).forEach(c=>a.prepend(c)):a.prepend(l)}}},function(n,r){n.exports=`.ct{z-index:999;opacity:0;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;pointer-events:none;-webkit-transition:opacity 50ms ease-in,-webkit-transform 70ms cubic-bezier(.215,.61,.355,1);transition:opacity 50ms ease-in,-webkit-transform 70ms cubic-bezier(.215,.61,.355,1);transition:opacity 50ms ease-in,transform 70ms cubic-bezier(.215,.61,.355,1);transition:opacity 50ms ease-in,transform 70ms cubic-bezier(.215,.61,.355,1),-webkit-transform 70ms cubic-bezier(.215,.61,.355,1);will-change:opacity,top,left;-webkit-box-shadow:0 8px 12px 0 rgba(29,32,43,.17),0 4px 5px -3px rgba(5,6,12,.49);box-shadow:0 8px 12px 0 rgba(29,32,43,.17),0 4px 5px -3px rgba(5,6,12,.49);border-radius:9px}.ct,.ct:before{position:absolute;top:0;left:0}.ct:before{content:"";bottom:0;right:0;background-color:#1d202b;z-index:-1;border-radius:4px}@supports(-webkit-mask-box-image:url("")){.ct:before{border-radius:0;-webkit-mask-box-image:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24"><path d="M10.71 0h2.58c3.02 0 4.64.42 6.1 1.2a8.18 8.18 0 013.4 3.4C23.6 6.07 24 7.7 24 10.71v2.58c0 3.02-.42 4.64-1.2 6.1a8.18 8.18 0 01-3.4 3.4c-1.47.8-3.1 1.21-6.11 1.21H10.7c-3.02 0-4.64-.42-6.1-1.2a8.18 8.18 0 01-3.4-3.4C.4 17.93 0 16.3 0 13.29V10.7c0-3.02.42-4.64 1.2-6.1a8.18 8.18 0 013.4-3.4C6.07.4 7.7 0 10.71 0z"/></svg>') 48% 41% 37.9% 53.3%}}@media (--mobile){.ct{display:none}}.ct__content{padding:6px 10px;color:#cdd1e0;font-size:12px;text-align:center;letter-spacing:.02em;line-height:1em}.ct:after{content:"";width:8px;height:8px;position:absolute;background-color:#1d202b;z-index:-1}.ct--bottom{-webkit-transform:translateY(5px);transform:translateY(5px)}.ct--bottom:after{top:-3px;left:50%;-webkit-transform:translateX(-50%) rotate(-45deg);transform:translateX(-50%) rotate(-45deg)}.ct--top{-webkit-transform:translateY(-5px);transform:translateY(-5px)}.ct--top:after{top:auto;bottom:-3px;left:50%;-webkit-transform:translateX(-50%) rotate(-45deg);transform:translateX(-50%) rotate(-45deg)}.ct--left{-webkit-transform:translateX(-5px);transform:translateX(-5px)}.ct--left:after{top:50%;left:auto;right:0;-webkit-transform:translate(41.6%,-50%) rotate(-45deg);transform:translate(41.6%,-50%) rotate(-45deg)}.ct--right{-webkit-transform:translateX(5px);transform:translateX(5px)}.ct--right:after{top:50%;left:0;-webkit-transform:translate(-41.6%,-50%) rotate(-45deg);transform:translate(-41.6%,-50%) rotate(-45deg)}.ct--shown{opacity:1;-webkit-transform:none;transform:none}`}]).default})})(R5e);var wNt=R5e.exports;const _Nt=OM(wNt);let Vu=null;function JG(){Vu||(Vu=new _Nt)}function SNt(t,e,n){JG(),Vu?.show(t,e,n)}function zM(t=!1){JG(),Vu?.hide(t)}function RM(t,e,n){JG(),Vu?.onHover(t,e,n)}function ENt(){Vu?.destroy(),Vu=null}class CNt extends Ir{constructor({config:e,eventsDispatcher:n}){super({config:e,eventsDispatcher:n})}get methods(){return{show:(e,n,r)=>this.show(e,n,r),hide:()=>this.hide(),onHover:(e,n,r)=>this.onHover(e,n,r)}}show(e,n,r){SNt(e,n,r)}hide(){zM()}onHover(e,n,r){RM(e,n,r)}}class TNt extends Ir{get methods(){return{nodes:this.editorNodes}}get editorNodes(){return{wrapper:this.Editor.UI.nodes.wrapper,redactor:this.Editor.UI.nodes.redactor}}}function V5e(t,e){const n={};return Object.entries(t).forEach(([r,i])=>{if(oa(i)){const o=e?`${e}.${r}`:r;Object.values(i).every(s=>Mh(s))?n[r]=o:n[r]=V5e(i,o);return}n[r]=i}),n}const ec=V5e(P5e);function kNt(t,e){const n={};return Object.keys(t).forEach(r=>{const i=e[r];i!==void 0?n[i]=t[r]:n[r]=t[r]}),n}const j5e=class J3{constructor(e,n){this.cursor=-1,this.items=[],this.items=e||[],this.focusedCssClass=n}get currentItem(){return this.cursor===-1?null:this.items[this.cursor]}setCursor(e){e<this.items.length&&e>=-1&&(this.dropCursor(),this.cursor=e,this.items[this.cursor].classList.add(this.focusedCssClass))}setItems(e){this.items=e}next(){this.cursor=this.leafNodesAndReturnIndex(J3.directions.RIGHT)}previous(){this.cursor=this.leafNodesAndReturnIndex(J3.directions.LEFT)}dropCursor(){this.cursor!==-1&&(this.items[this.cursor].classList.remove(this.focusedCssClass),this.cursor=-1)}leafNodesAndReturnIndex(e){if(this.items.length===0)return this.cursor;let n=this.cursor;return n===-1?n=e===J3.directions.RIGHT?-1:0:this.items[n].classList.remove(this.focusedCssClass),e===J3.directions.RIGHT?n=(n+1)%this.items.length:n=(this.items.length+n-1)%this.items.length,Rt.canSetCaret(this.items[n])&&$M(()=>er.setCursor(this.items[n]),50)(),this.items[n].classList.add(this.focusedCssClass),n}};j5e.directions={RIGHT:"right",LEFT:"left"};let $E=j5e,VM=class hJ{constructor(e){this.iterator=null,this.activated=!1,this.flipCallbacks=[],this.onKeyDown=n=>{if(!(!this.isEventReadyForHandling(n)||n.shiftKey===!0))switch(hJ.usedKeys.includes(n.keyCode)&&n.preventDefault(),n.keyCode){case ur.TAB:this.handleTabPress(n);break;case ur.LEFT:case ur.UP:this.flipLeft();break;case ur.RIGHT:case ur.DOWN:this.flipRight();break;case ur.ENTER:this.handleEnterPress(n);break}},this.iterator=new $E(e.items,e.focusedItemClass),this.activateCallback=e.activateCallback,this.allowedKeys=e.allowedKeys||hJ.usedKeys}get isActivated(){return this.activated}static get usedKeys(){return[ur.TAB,ur.LEFT,ur.RIGHT,ur.ENTER,ur.UP,ur.DOWN]}activate(e,n){this.activated=!0,e&&this.iterator.setItems(e),n!==void 0&&this.iterator.setCursor(n),document.addEventListener("keydown",this.onKeyDown,!0)}deactivate(){this.activated=!1,this.dropCursor(),document.removeEventListener("keydown",this.onKeyDown)}focusFirst(){this.dropCursor(),this.flipRight()}flipLeft(){this.iterator.previous(),this.flipCallback()}flipRight(){this.iterator.next(),this.flipCallback()}hasFocus(){return!!this.iterator.currentItem}onFlip(e){this.flipCallbacks.push(e)}removeOnFlip(e){this.flipCallbacks=this.flipCallbacks.filter(n=>n!==e)}dropCursor(){this.iterator.dropCursor()}isEventReadyForHandling(e){return this.activated&&this.allowedKeys.includes(e.keyCode)}handleTabPress(e){switch(e.shiftKey?$E.directions.LEFT:$E.directions.RIGHT){case $E.directions.RIGHT:this.flipRight();break;case $E.directions.LEFT:this.flipLeft();break}}handleEnterPress(e){this.activated&&(this.iterator.currentItem&&(e.stopPropagation(),e.preventDefault(),this.iterator.currentItem.click()),bo(this.activateCallback)&&this.activateCallback(this.iterator.currentItem))}flipCallback(){this.iterator.currentItem&&this.iterator.currentItem.scrollIntoViewIfNeeded(),this.flipCallbacks.forEach(e=>e())}};const PNt='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M9 12L9 7.1C9 7.04477 9.04477 7 9.1 7H10.4C11.5 7 14 7.1 14 9.5C14 9.5 14 12 11 12M9 12V16.8C9 16.9105 9.08954 17 9.2 17H12.5C14 17 15 16 15 14.5C15 11.7046 11 12 11 12M9 12H11"/></svg>',ANt='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M7 10L11.8586 14.8586C11.9367 14.9367 12.0633 14.9367 12.1414 14.8586L17 10"/></svg>',INt='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M14.5 17.5L9.64142 12.6414C9.56331 12.5633 9.56331 12.4367 9.64142 12.3586L14.5 7.5"/></svg>',MNt='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M9.58284 17.5L14.4414 12.6414C14.5195 12.5633 14.5195 12.4367 14.4414 12.3586L9.58284 7.5"/></svg>',DNt='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M7 15L11.8586 10.1414C11.9367 10.0633 12.0633 10.0633 12.1414 10.1414L17 15"/></svg>',NNt='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M8 8L12 12M12 12L16 16M12 12L16 8M12 12L8 16"/></svg>',LNt='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><circle cx="12" cy="12" r="4" stroke="currentColor" stroke-width="2"/></svg>',ONt='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M13.34 10C12.4223 12.7337 11 17 11 17"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M14.21 7H14.2"/></svg>',U5e='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M7.69998 12.6L7.67896 12.62C6.53993 13.7048 6.52012 15.5155 7.63516 16.625V16.625C8.72293 17.7073 10.4799 17.7102 11.5712 16.6314L13.0263 15.193C14.0703 14.1609 14.2141 12.525 13.3662 11.3266L13.22 11.12"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M16.22 11.12L16.3564 10.9805C17.2895 10.0265 17.3478 8.5207 16.4914 7.49733V7.49733C15.5691 6.39509 13.9269 6.25143 12.8271 7.17675L11.3901 8.38588C10.0935 9.47674 9.95706 11.4241 11.0888 12.6852L11.12 12.72"/></svg>',$Nt='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2.6" d="M9.40999 7.29999H9.4"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2.6" d="M14.6 7.29999H14.59"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2.6" d="M9.30999 12H9.3"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2.6" d="M14.6 12H14.59"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2.6" d="M9.40999 16.7H9.4"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2.6" d="M14.6 16.7H14.59"/></svg>',FNt='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M12 7V12M12 17V12M17 12H12M12 12H7"/></svg>',H5e='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M11.5 17.5L5 11M5 11V15.5M5 11H9.5"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M12.5 6.5L19 13M19 13V8.5M19 13H14.5"/></svg>',BNt='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><circle cx="10.5" cy="10.5" r="5.5" stroke="currentColor" stroke-width="2"/><line x1="15.4142" x2="19" y1="15" y2="18.5858" stroke="currentColor" stroke-linecap="round" stroke-width="2"/></svg>',zNt='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M15.7795 11.5C15.7795 11.5 16.053 11.1962 16.5497 10.6722C17.4442 9.72856 17.4701 8.2475 16.5781 7.30145V7.30145C15.6482 6.31522 14.0873 6.29227 13.1288 7.25073L11.8796 8.49999"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M8.24517 12.3883C8.24517 12.3883 7.97171 12.6922 7.47504 13.2161C6.58051 14.1598 6.55467 15.6408 7.44666 16.5869V16.5869C8.37653 17.5731 9.93744 17.5961 10.8959 16.6376L12.1452 15.3883"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M17.7802 15.1032L16.597 14.9422C16.0109 14.8624 15.4841 15.3059 15.4627 15.8969L15.4199 17.0818"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M6.39064 9.03238L7.58432 9.06668C8.17551 9.08366 8.6522 8.58665 8.61056 7.99669L8.5271 6.81397"/><line x1="12.1142" x2="11.7" y1="12.2" y2="11.7858" stroke="currentColor" stroke-linecap="round" stroke-width="2"/></svg>',RNt='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><rect width="14" height="14" x="5" y="5" stroke="currentColor" stroke-width="2" rx="4"/><line x1="12" x2="12" y1="9" y2="12" stroke="currentColor" stroke-linecap="round" stroke-width="2"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M12 15.02V15.01"/></svg>',VNt="__",jNt="--";function jg(t){return(e,n)=>[[t,e].filter(r=>!!r).join(VNt),n].filter(r=>!!r).join(jNt)}const FE=jg("ce-hint"),BE={root:FE(),alignedStart:FE(null,"align-left"),alignedCenter:FE(null,"align-center"),title:FE("title"),description:FE("description")};class UNt{constructor(e){this.nodes={root:Rt.make("div",[BE.root,e.alignment==="center"?BE.alignedCenter:BE.alignedStart]),title:Rt.make("div",BE.title,{textContent:e.title})},this.nodes.root.appendChild(this.nodes.title),e.description!==void 0&&(this.nodes.description=Rt.make("div",BE.description,{textContent:e.description}),this.nodes.root.appendChild(this.nodes.description))}getElement(){return this.nodes.root}}let eW=class{constructor(e){this.params=e}get name(){if(this.params!==void 0&&"name"in this.params)return this.params.name}destroy(){zM()}onChildrenOpen(){var e;this.params!==void 0&&"children"in this.params&&typeof((e=this.params.children)==null?void 0:e.onOpen)=="function"&&this.params.children.onOpen()}onChildrenClose(){var e;this.params!==void 0&&"children"in this.params&&typeof((e=this.params.children)==null?void 0:e.onClose)=="function"&&this.params.children.onClose()}handleClick(){var e,n;this.params!==void 0&&"onActivate"in this.params&&((n=(e=this.params).onActivate)==null||n.call(e,this.params))}addHint(e,n){const r=new UNt(n);RM(e,r.getElement(),{placement:n.position,hidingDelay:100})}get children(){var e;return this.params!==void 0&&"children"in this.params&&((e=this.params.children)==null?void 0:e.items)!==void 0?this.params.children.items:[]}get hasChildren(){return this.children.length>0}get isChildrenOpen(){var e;return this.params!==void 0&&"children"in this.params&&((e=this.params.children)==null?void 0:e.isOpen)===!0}get isChildrenFlippable(){var e;return!(this.params===void 0||!("children"in this.params)||((e=this.params.children)==null?void 0:e.isFlippable)===!1)}get isChildrenSearchable(){var e;return this.params!==void 0&&"children"in this.params&&((e=this.params.children)==null?void 0:e.searchable)===!0}get closeOnActivate(){return this.params!==void 0&&"closeOnActivate"in this.params&&this.params.closeOnActivate}get isActive(){return this.params===void 0||!("isActive"in this.params)?!1:typeof this.params.isActive=="function"?this.params.isActive():this.params.isActive===!0}};const tc=jg("ce-popover-item"),Do={container:tc(),active:tc(null,"active"),disabled:tc(null,"disabled"),focused:tc(null,"focused"),hidden:tc(null,"hidden"),confirmationState:tc(null,"confirmation"),noHover:tc(null,"no-hover"),noFocus:tc(null,"no-focus"),title:tc("title"),secondaryTitle:tc("secondary-title"),icon:tc("icon"),iconTool:tc("icon","tool"),iconChevronRight:tc("icon","chevron-right"),wobbleAnimation:jg("wobble")()};let Cy=class extends eW{constructor(e,n){super(e),this.params=e,this.nodes={root:null,icon:null},this.confirmationState=null,this.removeSpecialFocusBehavior=()=>{var r;(r=this.nodes.root)==null||r.classList.remove(Do.noFocus)},this.removeSpecialHoverBehavior=()=>{var r;(r=this.nodes.root)==null||r.classList.remove(Do.noHover)},this.onErrorAnimationEnd=()=>{var r,i;(r=this.nodes.icon)==null||r.classList.remove(Do.wobbleAnimation),(i=this.nodes.icon)==null||i.removeEventListener("animationend",this.onErrorAnimationEnd)},this.nodes.root=this.make(e,n)}get isDisabled(){return this.params.isDisabled===!0}get toggle(){return this.params.toggle}get title(){return this.params.title}get isConfirmationStateEnabled(){return this.confirmationState!==null}get isFocused(){return this.nodes.root===null?!1:this.nodes.root.classList.contains(Do.focused)}getElement(){return this.nodes.root}handleClick(){if(this.isConfirmationStateEnabled&&this.confirmationState!==null){this.activateOrEnableConfirmationMode(this.confirmationState);return}this.activateOrEnableConfirmationMode(this.params)}toggleActive(e){var n;(n=this.nodes.root)==null||n.classList.toggle(Do.active,e)}toggleHidden(e){var n;(n=this.nodes.root)==null||n.classList.toggle(Do.hidden,e)}reset(){this.isConfirmationStateEnabled&&this.disableConfirmationMode()}onFocus(){this.disableSpecialHoverAndFocusBehavior()}make(e,n){var r,i;const o=n?.wrapperTag||"div",s=Rt.make(o,Do.container,{type:o==="button"?"button":void 0});return e.name&&(s.dataset.itemName=e.name),this.nodes.icon=Rt.make("div",[Do.icon,Do.iconTool],{innerHTML:e.icon||LNt}),s.appendChild(this.nodes.icon),e.title!==void 0&&s.appendChild(Rt.make("div",Do.title,{innerHTML:e.title||""})),e.secondaryLabel&&s.appendChild(Rt.make("div",Do.secondaryTitle,{textContent:e.secondaryLabel})),this.hasChildren&&s.appendChild(Rt.make("div",[Do.icon,Do.iconChevronRight],{innerHTML:MNt})),this.isActive&&s.classList.add(Do.active),e.isDisabled&&s.classList.add(Do.disabled),e.hint!==void 0&&((r=n?.hint)==null?void 0:r.enabled)!==!1&&this.addHint(s,{...e.hint,position:((i=n?.hint)==null?void 0:i.position)||"right"}),s}enableConfirmationMode(e){if(this.nodes.root===null)return;const n={...this.params,...e,confirmation:"confirmation"in e?e.confirmation:void 0},r=this.make(n);this.nodes.root.innerHTML=r.innerHTML,this.nodes.root.classList.add(Do.confirmationState),this.confirmationState=e,this.enableSpecialHoverAndFocusBehavior()}disableConfirmationMode(){if(this.nodes.root===null)return;const e=this.make(this.params);this.nodes.root.innerHTML=e.innerHTML,this.nodes.root.classList.remove(Do.confirmationState),this.confirmationState=null,this.disableSpecialHoverAndFocusBehavior()}enableSpecialHoverAndFocusBehavior(){var e,n,r;(e=this.nodes.root)==null||e.classList.add(Do.noHover),(n=this.nodes.root)==null||n.classList.add(Do.noFocus),(r=this.nodes.root)==null||r.addEventListener("mouseleave",this.removeSpecialHoverBehavior,{once:!0})}disableSpecialHoverAndFocusBehavior(){var e;this.removeSpecialFocusBehavior(),this.removeSpecialHoverBehavior(),(e=this.nodes.root)==null||e.removeEventListener("mouseleave",this.removeSpecialHoverBehavior)}activateOrEnableConfirmationMode(e){var n;if(!("confirmation"in e)||e.confirmation===void 0)try{(n=e.onActivate)==null||n.call(e,e),this.disableConfirmationMode()}catch{this.animateError()}else this.enableConfirmationMode(e.confirmation)}animateError(){var e,n,r;(e=this.nodes.icon)!=null&&e.classList.contains(Do.wobbleAnimation)||((n=this.nodes.icon)==null||n.classList.add(Do.wobbleAnimation),(r=this.nodes.icon)==null||r.addEventListener("animationend",this.onErrorAnimationEnd))}};const tW=jg("ce-popover-item-separator"),nW={container:tW(),line:tW("line"),hidden:tW(null,"hidden")};class G5e extends eW{constructor(){super(),this.nodes={root:Rt.make("div",nW.container),line:Rt.make("div",nW.line)},this.nodes.root.appendChild(this.nodes.line)}getElement(){return this.nodes.root}toggleHidden(e){var n;(n=this.nodes.root)==null||n.classList.toggle(nW.hidden,e)}}var Wd=(t=>(t.Closed="closed",t.ClosedOnActivate="closed-on-activate",t))(Wd||{});const Wa=jg("ce-popover"),Uo={popover:Wa(),popoverContainer:Wa("container"),popoverOpenTop:Wa(null,"open-top"),popoverOpenLeft:Wa(null,"open-left"),popoverOpened:Wa(null,"opened"),search:Wa("search"),nothingFoundMessage:Wa("nothing-found-message"),nothingFoundMessageDisplayed:Wa("nothing-found-message","displayed"),items:Wa("items"),overlay:Wa("overlay"),overlayHidden:Wa("overlay","hidden"),popoverNested:Wa(null,"nested"),getPopoverNestedClass:t=>Wa(null,`nested-level-${t.toString()}`),popoverInline:Wa(null,"inline"),popoverHeader:Wa("header")};var rx=(t=>(t.NestingLevel="--nesting-level",t.PopoverHeight="--popover-height",t.InlinePopoverWidth="--inline-popover-width",t.TriggerItemLeft="--trigger-item-left",t.TriggerItemTop="--trigger-item-top",t))(rx||{});const W5e=jg("ce-popover-item-html"),K5e={root:W5e(),hidden:W5e(null,"hidden")};let zE=class extends eW{constructor(e,n){var r,i;super(e),this.nodes={root:Rt.make("div",K5e.root)},this.nodes.root.appendChild(e.element),e.name&&(this.nodes.root.dataset.itemName=e.name),e.hint!==void 0&&((r=n?.hint)==null?void 0:r.enabled)!==!1&&this.addHint(this.nodes.root,{...e.hint,position:((i=n?.hint)==null?void 0:i.position)||"right"})}getElement(){return this.nodes.root}toggleHidden(e){var n;(n=this.nodes.root)==null||n.classList.toggle(K5e.hidden,e)}getControls(){const e=this.nodes.root.querySelectorAll(`button, ${Rt.allInputsSelector}`);return Array.from(e)}};class q5e extends NE{constructor(e,n={}){super(),this.params=e,this.itemsRenderParams=n,this.listeners=new LE,this.messages={nothingFound:"Nothing found",search:"Search"},this.items=this.buildItems(e.items),e.messages&&(this.messages={...this.messages,...e.messages}),this.nodes={},this.nodes.popoverContainer=Rt.make("div",[Uo.popoverContainer]),this.nodes.nothingFoundMessage=Rt.make("div",[Uo.nothingFoundMessage],{textContent:this.messages.nothingFound}),this.nodes.popoverContainer.appendChild(this.nodes.nothingFoundMessage),this.nodes.items=Rt.make("div",[Uo.items]),this.items.forEach(r=>{const i=r.getElement();i!==null&&this.nodes.items.appendChild(i)}),this.nodes.popoverContainer.appendChild(this.nodes.items),this.listeners.on(this.nodes.popoverContainer,"click",r=>this.handleClick(r)),this.nodes.popover=Rt.make("div",[Uo.popover,this.params.class]),this.nodes.popover.appendChild(this.nodes.popoverContainer)}get itemsDefault(){return this.items.filter(e=>e instanceof Cy)}getElement(){return this.nodes.popover}show(){this.nodes.popover.classList.add(Uo.popoverOpened),this.search!==void 0&&this.search.focus()}hide(){this.nodes.popover.classList.remove(Uo.popoverOpened),this.nodes.popover.classList.remove(Uo.popoverOpenTop),this.itemsDefault.forEach(e=>e.reset()),this.search!==void 0&&this.search.clear(),this.emit(Wd.Closed)}destroy(){var e;this.items.forEach(n=>n.destroy()),this.nodes.popover.remove(),this.listeners.removeAll(),(e=this.search)==null||e.destroy()}activateItemByName(e){const n=this.items.find(r=>r.name===e);this.handleItemClick(n)}buildItems(e){return e.map(n=>{switch(n.type){case eo.Separator:return new G5e;case eo.Html:return new zE(n,this.itemsRenderParams[eo.Html]);default:return new Cy(n,this.itemsRenderParams[eo.Default])}})}getTargetItem(e){return this.items.filter(n=>n instanceof Cy||n instanceof zE).find(n=>{const r=n.getElement();return r===null?!1:e.composedPath().includes(r)})}handleItemClick(e){if(!("isDisabled"in e&&e.isDisabled)){if(e.hasChildren){this.showNestedItems(e),"handleClick"in e&&typeof e.handleClick=="function"&&e.handleClick();return}this.itemsDefault.filter(n=>n!==e).forEach(n=>n.reset()),"handleClick"in e&&typeof e.handleClick=="function"&&e.handleClick(),this.toggleItemActivenessIfNeeded(e),e.closeOnActivate&&(this.hide(),this.emit(Wd.ClosedOnActivate))}}handleClick(e){const n=this.getTargetItem(e);n!==void 0&&this.handleItemClick(n)}toggleItemActivenessIfNeeded(e){if(e instanceof Cy&&(e.toggle===!0&&e.toggleActive(),typeof e.toggle=="string")){const n=this.itemsDefault.filter(r=>r.toggle===e.toggle);if(n.length===1){e.toggleActive();return}n.forEach(r=>{r.toggleActive(r===e)})}}}var jM=(t=>(t.Search="search",t))(jM||{});const rW=jg("cdx-search-field"),iW={wrapper:rW(),icon:rW("icon"),input:rW("input")};class HNt extends NE{constructor({items:e,placeholder:n}){super(),this.listeners=new LE,this.items=e,this.wrapper=Rt.make("div",iW.wrapper);const r=Rt.make("div",iW.icon,{innerHTML:BNt});this.input=Rt.make("input",iW.input,{placeholder:n,tabIndex:-1}),this.wrapper.appendChild(r),this.wrapper.appendChild(this.input),this.listeners.on(this.input,"input",()=>{this.searchQuery=this.input.value,this.emit(jM.Search,{query:this.searchQuery,items:this.foundItems})})}getElement(){return this.wrapper}focus(){this.input.focus()}clear(){this.input.value="",this.searchQuery="",this.emit(jM.Search,{query:"",items:this.foundItems})}destroy(){this.listeners.removeAll()}get foundItems(){return this.items.filter(e=>this.checkItem(e))}checkItem(e){var n,r;const i=((n=e.title)==null?void 0:n.toLowerCase())||"",o=(r=this.searchQuery)==null?void 0:r.toLowerCase();return o!==void 0?i.includes(o):!1}}var GNt=Object.defineProperty,WNt=Object.getOwnPropertyDescriptor,KNt=(t,e,n,r)=>{for(var i=WNt(e,n),o=t.length-1,s;o>=0;o--)(s=t[o])&&(i=s(e,n,i)||i);return i&&GNt(e,n,i),i};const Y5e=class lze extends q5e{constructor(e,n){super(e,n),this.nestingLevel=0,this.nestedPopoverTriggerItem=null,this.previouslyHoveredItem=null,this.scopeElement=document.body,this.hide=()=>{var r;super.hide(),this.destroyNestedPopoverIfExists(),(r=this.flipper)==null||r.deactivate(),this.previouslyHoveredItem=null},this.onFlip=()=>{const r=this.itemsDefault.find(i=>i.isFocused);r?.onFocus()},this.onSearch=r=>{var i;const o=r.query==="",s=r.items.length===0;this.items.forEach(l=>{let c=!1;l instanceof Cy?c=!r.items.includes(l):(l instanceof G5e||l instanceof zE)&&(c=s||!o),l.toggleHidden(c)}),this.toggleNothingFoundMessage(s);const a=r.query===""?this.flippableElements:r.items.map(l=>l.getElement());(i=this.flipper)!=null&&i.isActivated&&(this.flipper.deactivate(),this.flipper.activate(a))},e.nestingLevel!==void 0&&(this.nestingLevel=e.nestingLevel),this.nestingLevel>0&&this.nodes.popover.classList.add(Uo.popoverNested),e.scopeElement!==void 0&&(this.scopeElement=e.scopeElement),this.nodes.popoverContainer!==null&&this.listeners.on(this.nodes.popoverContainer,"mouseover",r=>this.handleHover(r)),e.searchable&&this.addSearch(),e.flippable!==!1&&(this.flipper=new VM({items:this.flippableElements,focusedItemClass:Do.focused,allowedKeys:[ur.TAB,ur.UP,ur.DOWN,ur.ENTER]}),this.flipper.onFlip(this.onFlip))}hasFocus(){return this.flipper===void 0?!1:this.flipper.hasFocus()}get scrollTop(){return this.nodes.items===null?0:this.nodes.items.scrollTop}get offsetTop(){return this.nodes.popoverContainer===null?0:this.nodes.popoverContainer.offsetTop}show(){var e;this.nodes.popover.style.setProperty(rx.PopoverHeight,this.size.height+"px"),this.shouldOpenBottom||this.nodes.popover.classList.add(Uo.popoverOpenTop),this.shouldOpenRight||this.nodes.popover.classList.add(Uo.popoverOpenLeft),super.show(),(e=this.flipper)==null||e.activate(this.flippableElements)}destroy(){this.hide(),super.destroy()}showNestedItems(e){this.nestedPopover!==null&&this.nestedPopover!==void 0||(this.nestedPopoverTriggerItem=e,this.showNestedPopoverForItem(e))}handleHover(e){const n=this.getTargetItem(e);n!==void 0&&this.previouslyHoveredItem!==n&&(this.destroyNestedPopoverIfExists(),this.previouslyHoveredItem=n,n.hasChildren&&this.showNestedPopoverForItem(n))}setTriggerItemPosition(e,n){const r=n.getElement(),i=(r?r.offsetTop:0)-this.scrollTop,o=this.offsetTop+i;e.style.setProperty(rx.TriggerItemTop,o+"px")}destroyNestedPopoverIfExists(){var e,n;this.nestedPopover===void 0||this.nestedPopover===null||(this.nestedPopover.off(Wd.ClosedOnActivate,this.hide),this.nestedPopover.hide(),this.nestedPopover.destroy(),this.nestedPopover.getElement().remove(),this.nestedPopover=null,(e=this.flipper)==null||e.activate(this.flippableElements),(n=this.nestedPopoverTriggerItem)==null||n.onChildrenClose())}showNestedPopoverForItem(e){var n;this.nestedPopover=new lze({searchable:e.isChildrenSearchable,items:e.children,nestingLevel:this.nestingLevel+1,flippable:e.isChildrenFlippable,messages:this.messages}),e.onChildrenOpen(),this.nestedPopover.on(Wd.ClosedOnActivate,this.hide);const r=this.nestedPopover.getElement();return this.nodes.popover.appendChild(r),this.setTriggerItemPosition(r,e),r.style.setProperty(rx.NestingLevel,this.nestedPopover.nestingLevel.toString()),this.nestedPopover.show(),(n=this.flipper)==null||n.deactivate(),this.nestedPopover}get shouldOpenBottom(){if(this.nodes.popover===void 0||this.nodes.popover===null)return!1;const e=this.nodes.popoverContainer.getBoundingClientRect(),n=this.scopeElement.getBoundingClientRect(),r=this.size.height,i=e.top+r,o=e.top-r,s=Math.min(window.innerHeight,n.bottom);return o<n.top||i<=s}get shouldOpenRight(){if(this.nodes.popover===void 0||this.nodes.popover===null)return!1;const e=this.nodes.popover.getBoundingClientRect(),n=this.scopeElement.getBoundingClientRect(),r=this.size.width,i=e.right+r,o=e.left-r,s=Math.min(window.innerWidth,n.right);return o<n.left||i<=s}get size(){var e;const n={height:0,width:0};if(this.nodes.popover===null)return n;const r=this.nodes.popover.cloneNode(!0);r.style.visibility="hidden",r.style.position="absolute",r.style.top="-1000px",r.classList.add(Uo.popoverOpened),(e=r.querySelector("."+Uo.popoverNested))==null||e.remove(),document.body.appendChild(r);const i=r.querySelector("."+Uo.popoverContainer);return n.height=i.offsetHeight,n.width=i.offsetWidth,r.remove(),n}get flippableElements(){return this.items.map(e=>{if(e instanceof Cy)return e.getElement();if(e instanceof zE)return e.getControls()}).flat().filter(e=>e!=null)}addSearch(){this.search=new HNt({items:this.itemsDefault,placeholder:this.messages.search}),this.search.on(jM.Search,this.onSearch);const e=this.search.getElement();e.classList.add(Uo.search),this.nodes.popoverContainer.insertBefore(e,this.nodes.popoverContainer.firstChild)}toggleNothingFoundMessage(e){this.nodes.nothingFoundMessage.classList.toggle(Uo.nothingFoundMessageDisplayed,e)}};KNt([tx],Y5e.prototype,"size");let oW=Y5e;class qNt extends oW{constructor(e){const n=!nx();super({...e,class:Uo.popoverInline},{[eo.Default]:{wrapperTag:"button",hint:{position:"top",alignment:"center",enabled:n}},[eo.Html]:{hint:{position:"top",alignment:"center",enabled:n}}}),this.items.forEach(r=>{!(r instanceof Cy)&&!(r instanceof zE)||r.hasChildren&&r.isChildrenOpen&&this.showNestedItems(r)})}get offsetLeft(){return this.nodes.popoverContainer===null?0:this.nodes.popoverContainer.offsetLeft}show(){this.nestingLevel===0&&this.nodes.popover.style.setProperty(rx.InlinePopoverWidth,this.size.width+"px"),super.show()}handleHover(){}setTriggerItemPosition(e,n){const r=n.getElement(),i=r?r.offsetLeft:0,o=this.offsetLeft+i;e.style.setProperty(rx.TriggerItemLeft,o+"px")}showNestedItems(e){if(this.nestedPopoverTriggerItem===e){this.destroyNestedPopoverIfExists(),this.nestedPopoverTriggerItem=null;return}super.showNestedItems(e)}showNestedPopoverForItem(e){const n=super.showNestedPopoverForItem(e);return n.getElement().classList.add(Uo.getPopoverNestedClass(n.nestingLevel)),n}handleItemClick(e){var n;e!==this.nestedPopoverTriggerItem&&((n=this.nestedPopoverTriggerItem)==null||n.handleClick(),super.destroyNestedPopoverIfExists()),super.handleItemClick(e)}}const Z5e=class eT{constructor(){this.scrollPosition=null}lock(){qG?this.lockHard():document.body.classList.add(eT.CSS.scrollLocked)}unlock(){qG?this.unlockHard():document.body.classList.remove(eT.CSS.scrollLocked)}lockHard(){this.scrollPosition=window.pageYOffset,document.documentElement.style.setProperty("--window-scroll-offset",`${this.scrollPosition}px`),document.body.classList.add(eT.CSS.scrollLockedHard)}unlockHard(){document.body.classList.remove(eT.CSS.scrollLockedHard),this.scrollPosition!==null&&window.scrollTo(0,this.scrollPosition),this.scrollPosition=null}};Z5e.CSS={scrollLocked:"ce-scroll-locked",scrollLockedHard:"ce-scroll-locked--hard"};let YNt=Z5e;const sW=jg("ce-popover-header"),aW={root:sW(),text:sW("text"),backButton:sW("back-button")};class ZNt{constructor({text:e,onBackButtonClick:n}){this.listeners=new LE,this.text=e,this.onBackButtonClick=n,this.nodes={root:Rt.make("div",[aW.root]),backButton:Rt.make("button",[aW.backButton]),text:Rt.make("div",[aW.text])},this.nodes.backButton.innerHTML=INt,this.nodes.root.appendChild(this.nodes.backButton),this.listeners.on(this.nodes.backButton,"click",this.onBackButtonClick),this.nodes.text.innerText=this.text,this.nodes.root.appendChild(this.nodes.text)}getElement(){return this.nodes.root}destroy(){this.nodes.root.remove(),this.listeners.destroy()}}class XNt{constructor(){this.history=[]}push(e){this.history.push(e)}pop(){return this.history.pop()}get currentTitle(){return this.history.length===0?"":this.history[this.history.length-1].title}get currentItems(){return this.history.length===0?[]:this.history[this.history.length-1].items}reset(){for(;this.history.length>1;)this.pop()}}let X5e=class extends q5e{constructor(e){super(e,{[eo.Default]:{hint:{enabled:!1}},[eo.Html]:{hint:{enabled:!1}}}),this.scrollLocker=new YNt,this.history=new XNt,this.isHidden=!0,this.nodes.overlay=Rt.make("div",[Uo.overlay,Uo.overlayHidden]),this.nodes.popover.insertBefore(this.nodes.overlay,this.nodes.popover.firstChild),this.listeners.on(this.nodes.overlay,"click",()=>{this.hide()}),this.history.push({items:e.items})}show(){this.nodes.overlay.classList.remove(Uo.overlayHidden),super.show(),this.scrollLocker.lock(),this.isHidden=!1}hide(){this.isHidden||(super.hide(),this.nodes.overlay.classList.add(Uo.overlayHidden),this.scrollLocker.unlock(),this.history.reset(),this.isHidden=!0)}destroy(){super.destroy(),this.scrollLocker.unlock()}showNestedItems(e){this.updateItemsAndHeader(e.children,e.title),this.history.push({title:e.title,items:e.children})}updateItemsAndHeader(e,n){if(this.header!==null&&this.header!==void 0&&(this.header.destroy(),this.header=null),n!==void 0){this.header=new ZNt({text:n,onBackButtonClick:()=>{this.history.pop(),this.updateItemsAndHeader(this.history.currentItems,this.history.currentTitle)}});const r=this.header.getElement();r!==null&&this.nodes.popoverContainer.insertBefore(r,this.nodes.popoverContainer.firstChild)}this.items.forEach(r=>{var i;return(i=r.getElement())==null?void 0:i.remove()}),this.items=this.buildItems(e),this.items.forEach(r=>{var i;const o=r.getElement();o!==null&&((i=this.nodes.items)==null||i.appendChild(o))})}};class QNt extends Ir{constructor(){super(...arguments),this.opened=!1,this.hasMobileLayoutToggleListener=!1,this.selection=new er,this.popover=null,this.close=()=>{this.opened&&(this.opened=!1,er.isAtEditor||this.selection.restore(),this.selection.clearSaved(),!this.Editor.CrossBlockSelection.isCrossBlockSelectionStarted&&this.Editor.BlockManager.currentBlock&&this.Editor.BlockSelection.unselectBlock(this.Editor.BlockManager.currentBlock),this.eventsDispatcher.emit(this.events.closed),this.popover&&(this.popover.off(Wd.Closed,this.onPopoverClose),this.popover.destroy(),this.popover.getElement().remove(),this.popover=null))},this.onPopoverClose=()=>{this.close()}}get events(){return{opened:"block-settings-opened",closed:"block-settings-closed"}}get CSS(){return{settings:"ce-settings"}}get flipper(){var e;if(this.popover!==null)return"flipper"in this.popover?(e=this.popover)==null?void 0:e.flipper:void 0}make(){this.nodes.wrapper=Rt.make("div",[this.CSS.settings]),this.eventsDispatcher.on(OE,this.close),this.hasMobileLayoutToggleListener=!0}destroy(){this.removeAllNodes(),this.listeners.destroy(),this.hasMobileLayoutToggleListener&&(this.eventsDispatcher.off(OE,this.close),this.hasMobileLayoutToggleListener=!1)}async open(e=this.Editor.BlockManager.currentBlock){var n;this.opened=!0,this.selection.save(),this.Editor.BlockSelection.selectBlock(e),this.Editor.BlockSelection.clearCache();const{toolTunes:r,commonTunes:i}=e.getTunes();this.eventsDispatcher.emit(this.events.opened);const o=nx()?X5e:oW;this.popover=new o({searchable:!0,items:await this.getTunesItems(e,i,r),scopeElement:this.Editor.API.methods.ui.nodes.redactor,messages:{nothingFound:Ga.ui(ec.ui.popover,"Nothing found"),search:Ga.ui(ec.ui.popover,"Filter")}}),this.popover.on(Wd.Closed,this.onPopoverClose),(n=this.nodes.wrapper)==null||n.append(this.popover.getElement()),this.popover.show()}getElement(){return this.nodes.wrapper}async getTunesItems(e,n,r){const i=[];r!==void 0&&r.length>0&&(i.push(...r),i.push({type:eo.Separator}));const o=Array.from(this.Editor.Tools.blockTools.values()),s=(await O5e(e,o)).reduce((a,l)=>(l.toolbox.forEach(c=>{a.push({icon:c.icon,title:Ga.t(ec.toolNames,c.title),name:l.name,closeOnActivate:!0,onActivate:async()=>{const{BlockManager:u,Caret:d,Toolbar:p}=this.Editor,g=await u.convert(e,l.name,c.data);p.close(),d.setToBlock(g,d.positions.END)}})}),a),[]);return s.length>0&&(i.push({icon:H5e,name:"convert-to",title:Ga.ui(ec.ui.popover,"Convert to"),children:{searchable:!0,items:s}}),i.push({type:eo.Separator})),i.push(...n),i.map(a=>this.resolveTuneAliases(a))}resolveTuneAliases(e){if(e.type===eo.Separator||e.type===eo.Html)return e;const n=kNt(e,{label:"title"});return e.confirmation&&(n.confirmation=this.resolveTuneAliases(e.confirmation)),n}}var Q5e={exports:{}};(function(t,e){(function(n,r){t.exports=r()})(window,function(){return(function(n){var r={};function i(o){if(r[o])return r[o].exports;var s=r[o]={i:o,l:!1,exports:{}};return n[o].call(s.exports,s,s.exports,i),s.l=!0,s.exports}return i.m=n,i.c=r,i.d=function(o,s,a){i.o(o,s)||Object.defineProperty(o,s,{enumerable:!0,get:a})},i.r=function(o){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(o,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(o,"__esModule",{value:!0})},i.t=function(o,s){if(1&s&&(o=i(o)),8&s||4&s&&typeof o=="object"&&o&&o.__esModule)return o;var a=Object.create(null);if(i.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:o}),2&s&&typeof o!="string")for(var l in o)i.d(a,l,(function(c){return o[c]}).bind(null,l));return a},i.n=function(o){var s=o&&o.__esModule?function(){return o.default}:function(){return o};return i.d(s,"a",s),s},i.o=function(o,s){return Object.prototype.hasOwnProperty.call(o,s)},i.p="",i(i.s=0)})([function(n,r,i){function o(l,c){for(var u=0;u<c.length;u++){var d=c[u];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(l,d.key,d)}}function s(l,c,u){return c&&o(l.prototype,c),u&&o(l,u),l}i.r(r);var a=(function(){function l(c){var u=this;(function(d,p){if(!(d instanceof p))throw new TypeError("Cannot call a class as a function")})(this,l),this.commands={},this.keys={},this.name=c.name,this.parseShortcutName(c.name),this.element=c.on,this.callback=c.callback,this.executeShortcut=function(d){u.execute(d)},this.element.addEventListener("keydown",this.executeShortcut,!1)}return s(l,null,[{key:"supportedCommands",get:function(){return{SHIFT:["SHIFT"],CMD:["CMD","CONTROL","COMMAND","WINDOWS","CTRL"],ALT:["ALT","OPTION"]}}},{key:"keyCodes",get:function(){return{0:48,1:49,2:50,3:51,4:52,5:53,6:54,7:55,8:56,9:57,A:65,B:66,C:67,D:68,E:69,F:70,G:71,H:72,I:73,J:74,K:75,L:76,M:77,N:78,O:79,P:80,Q:81,R:82,S:83,T:84,U:85,V:86,W:87,X:88,Y:89,Z:90,BACKSPACE:8,ENTER:13,ESCAPE:27,LEFT:37,UP:38,RIGHT:39,DOWN:40,INSERT:45,DELETE:46,".":190}}}]),s(l,[{key:"parseShortcutName",value:function(c){c=c.split("+");for(var u=0;u<c.length;u++){c[u]=c[u].toUpperCase();var d=!1;for(var p in l.supportedCommands)if(l.supportedCommands[p].includes(c[u])){d=this.commands[p]=!0;break}d||(this.keys[c[u]]=!0)}for(var g in l.supportedCommands)this.commands[g]||(this.commands[g]=!1)}},{key:"execute",value:function(c){var u,d={CMD:c.ctrlKey||c.metaKey,SHIFT:c.shiftKey,ALT:c.altKey},p=!0;for(u in this.commands)this.commands[u]!==d[u]&&(p=!1);var g,b=!0;for(g in this.keys)b=b&&c.keyCode===l.keyCodes[g];p&&b&&this.callback(c)}},{key:"remove",value:function(){this.element.removeEventListener("keydown",this.executeShortcut)}}]),l})();r.default=a}]).default})})(Q5e);var JNt=Q5e.exports;const eLt=OM(JNt);class tLt{constructor(){this.registeredShortcuts=new Map}add(e){if(this.findShortcut(e.on,e.name))throw Error(`Shortcut ${e.name} is already registered for ${e.on}. Please remove it before add a new handler.`);const n=new eLt({name:e.name,on:e.on,callback:e.handler}),r=this.registeredShortcuts.get(e.on)||[];this.registeredShortcuts.set(e.on,[...r,n])}remove(e,n){const r=this.findShortcut(e,n);if(!r)return;r.remove();const i=this.registeredShortcuts.get(e).filter(o=>o!==r);if(i.length===0){this.registeredShortcuts.delete(e);return}this.registeredShortcuts.set(e,i)}findShortcut(e,n){return(this.registeredShortcuts.get(e)||[]).find(({name:r})=>r===n)}}const ix=new tLt;var nLt=Object.defineProperty,rLt=Object.getOwnPropertyDescriptor,J5e=(t,e,n,r)=>{for(var i=rLt(e,n),o=t.length-1,s;o>=0;o--)(s=t[o])&&(i=s(e,n,i)||i);return i&&nLt(e,n,i),i},UM=(t=>(t.Opened="toolbox-opened",t.Closed="toolbox-closed",t.BlockAdded="toolbox-block-added",t))(UM||{});const lW=class cze extends NE{constructor({api:e,tools:n,i18nLabels:r}){super(),this.opened=!1,this.listeners=new LE,this.popover=null,this.handleMobileLayoutToggle=()=>{this.destroyPopover(),this.initPopover()},this.onPopoverClose=()=>{this.opened=!1,this.emit("toolbox-closed")},this.api=e,this.tools=n,this.i18nLabels=r,this.enableShortcuts(),this.nodes={toolbox:Rt.make("div",cze.CSS.toolbox)},this.initPopover(),this.api.events.on(OE,this.handleMobileLayoutToggle)}get isEmpty(){return this.toolsToBeDisplayed.length===0}static get CSS(){return{toolbox:"ce-toolbox"}}getElement(){return this.nodes.toolbox}hasFocus(){if(this.popover!==null)return"hasFocus"in this.popover?this.popover.hasFocus():void 0}destroy(){var e;super.destroy(),this.nodes&&this.nodes.toolbox&&this.nodes.toolbox.remove(),this.removeAllShortcuts(),(e=this.popover)==null||e.off(Wd.Closed,this.onPopoverClose),this.listeners.destroy(),this.api.events.off(OE,this.handleMobileLayoutToggle)}toolButtonActivated(e,n){this.insertNewBlock(e,n)}open(){var e;this.isEmpty||((e=this.popover)==null||e.show(),this.opened=!0,this.emit("toolbox-opened"))}close(){var e;(e=this.popover)==null||e.hide(),this.opened=!1,this.emit("toolbox-closed")}toggle(){this.opened?this.close():this.open()}initPopover(){var e;const n=nx()?X5e:oW;this.popover=new n({scopeElement:this.api.ui.nodes.redactor,searchable:!0,messages:{nothingFound:this.i18nLabels.nothingFound,search:this.i18nLabels.filter},items:this.toolboxItemsToBeDisplayed}),this.popover.on(Wd.Closed,this.onPopoverClose),(e=this.nodes.toolbox)==null||e.append(this.popover.getElement())}destroyPopover(){this.popover!==null&&(this.popover.hide(),this.popover.off(Wd.Closed,this.onPopoverClose),this.popover.destroy(),this.popover=null),this.nodes.toolbox!==null&&(this.nodes.toolbox.innerHTML="")}get toolsToBeDisplayed(){const e=[];return this.tools.forEach(n=>{n.toolbox&&e.push(n)}),e}get toolboxItemsToBeDisplayed(){const e=(n,r,i=!0)=>({icon:n.icon,title:Ga.t(ec.toolNames,n.title||FM(r.name)),name:r.name,onActivate:()=>{this.toolButtonActivated(r.name,n.data)},secondaryLabel:r.shortcut&&i?WG(r.shortcut):""});return this.toolsToBeDisplayed.reduce((n,r)=>(Array.isArray(r.toolbox)?r.toolbox.forEach((i,o)=>{n.push(e(i,r,o===0))}):r.toolbox!==void 0&&n.push(e(r.toolbox,r)),n),[])}enableShortcuts(){this.toolsToBeDisplayed.forEach(e=>{const n=e.shortcut;n&&this.enableShortcutForTool(e.name,n)})}enableShortcutForTool(e,n){ix.add({name:n,on:this.api.ui.nodes.redactor,handler:async r=>{r.preventDefault();const i=this.api.blocks.getCurrentBlockIndex(),o=this.api.blocks.getBlockByIndex(i);if(o)try{const s=await this.api.blocks.convert(o.id,e);this.api.caret.setToBlock(s,"end");return}catch{}this.insertNewBlock(e)}})}removeAllShortcuts(){this.toolsToBeDisplayed.forEach(e=>{const n=e.shortcut;n&&ix.remove(this.api.ui.nodes.redactor,n)})}async insertNewBlock(e,n){const r=this.api.blocks.getCurrentBlockIndex(),i=this.api.blocks.getBlockByIndex(r);if(!i)return;const o=i.isEmpty?r:r+1;let s;if(n){const l=await this.api.blocks.composeBlockData(e);s=Object.assign(l,n)}const a=this.api.blocks.insert(e,s,void 0,o,void 0,i.isEmpty);a.call(Nh.APPEND_CALLBACK),this.api.caret.setToBlock(o),this.emit("toolbox-block-added",{block:a}),this.api.toolbar.close()}};J5e([tx],lW.prototype,"toolsToBeDisplayed"),J5e([tx],lW.prototype,"toolboxItemsToBeDisplayed");let iLt=lW;const eAe="block hovered";async function oLt(t,e){const n=navigator.keyboard;if(!n)return e;try{return(await n.getLayoutMap()).get(t)||e}catch(r){return console.error(r),e}}class sLt extends Ir{constructor({config:e,eventsDispatcher:n}){super({config:e,eventsDispatcher:n}),this.toolboxInstance=null}get CSS(){return{toolbar:"ce-toolbar",content:"ce-toolbar__content",actions:"ce-toolbar__actions",actionsOpened:"ce-toolbar__actions--opened",toolbarOpened:"ce-toolbar--opened",openedToolboxHolderModifier:"codex-editor--toolbox-opened",plusButton:"ce-toolbar__plus",plusButtonShortcut:"ce-toolbar__plus-shortcut",settingsToggler:"ce-toolbar__settings-btn",settingsTogglerHidden:"ce-toolbar__settings-btn--hidden"}}get opened(){return this.nodes.wrapper.classList.contains(this.CSS.toolbarOpened)}get toolbox(){var e;return{opened:(e=this.toolboxInstance)==null?void 0:e.opened,close:()=>{var n;(n=this.toolboxInstance)==null||n.close()},open:()=>{if(this.toolboxInstance===null){Qr("toolbox.open() called before initialization is finished","warn");return}this.Editor.BlockManager.currentBlock=this.hoveredBlock,this.toolboxInstance.open()},toggle:()=>{if(this.toolboxInstance===null){Qr("toolbox.toggle() called before initialization is finished","warn");return}this.toolboxInstance.toggle()},hasFocus:()=>{var n;return(n=this.toolboxInstance)==null?void 0:n.hasFocus()}}}get blockActions(){return{hide:()=>{this.nodes.actions.classList.remove(this.CSS.actionsOpened)},show:()=>{this.nodes.actions.classList.add(this.CSS.actionsOpened)}}}get blockTunesToggler(){return{hide:()=>this.nodes.settingsToggler.classList.add(this.CSS.settingsTogglerHidden),show:()=>this.nodes.settingsToggler.classList.remove(this.CSS.settingsTogglerHidden)}}toggleReadOnly(e){e?(this.destroy(),this.Editor.BlockSettings.destroy(),this.disableModuleBindings()):window.requestIdleCallback(()=>{this.drawUI(),this.enableModuleBindings()},{timeout:2e3})}moveAndOpen(e=this.Editor.BlockManager.currentBlock){if(this.toolboxInstance===null){Qr("Can't open Toolbar since Editor initialization is not finished yet","warn");return}if(this.toolboxInstance.opened&&this.toolboxInstance.close(),this.Editor.BlockSettings.opened&&this.Editor.BlockSettings.close(),!e)return;this.hoveredBlock=e;const n=e.holder,{isMobile:r}=this.Editor.UI;let i;const o=20,s=e.firstInput,a=n.getBoundingClientRect(),l=s!==void 0?s.getBoundingClientRect():null,c=l!==null?l.top-a.top:null,u=c!==null?c>o:void 0;if(r)i=n.offsetTop+n.offsetHeight;else if(s===void 0||u){const d=parseInt(window.getComputedStyle(e.pluginsContent).paddingTop);i=n.offsetTop+d}else{const d=U6t(s),p=parseInt(window.getComputedStyle(this.nodes.plusButton).height,10);i=n.offsetTop+d-p+8+c}this.nodes.wrapper.style.top=`${Math.floor(i)}px`,this.Editor.BlockManager.blocks.length===1&&e.isEmpty?this.blockTunesToggler.hide():this.blockTunesToggler.show(),this.open()}close(){var e,n;this.Editor.ReadOnly.isEnabled||((e=this.nodes.wrapper)==null||e.classList.remove(this.CSS.toolbarOpened),this.blockActions.hide(),(n=this.toolboxInstance)==null||n.close(),this.Editor.BlockSettings.close(),this.reset())}reset(){this.nodes.wrapper.style.top="unset"}open(e=!0){this.nodes.wrapper.classList.add(this.CSS.toolbarOpened),e?this.blockActions.show():this.blockActions.hide()}async make(){this.nodes.wrapper=Rt.make("div",this.CSS.toolbar),["content","actions"].forEach(o=>{this.nodes[o]=Rt.make("div",this.CSS[o])}),Rt.append(this.nodes.wrapper,this.nodes.content),Rt.append(this.nodes.content,this.nodes.actions),this.nodes.plusButton=Rt.make("div",this.CSS.plusButton,{innerHTML:FNt}),Rt.append(this.nodes.actions,this.nodes.plusButton),this.readOnlyMutableListeners.on(this.nodes.plusButton,"click",()=>{zM(!0),this.plusButtonClicked()},!1);const e=Rt.make("div");e.appendChild(document.createTextNode(Ga.ui(ec.ui.toolbar.toolbox,"Add"))),e.appendChild(Rt.make("div",this.CSS.plusButtonShortcut,{textContent:"/"})),RM(this.nodes.plusButton,e,{hidingDelay:400}),this.nodes.settingsToggler=Rt.make("span",this.CSS.settingsToggler,{innerHTML:$Nt}),Rt.append(this.nodes.actions,this.nodes.settingsToggler);const n=Rt.make("div"),r=Rt.text(Ga.ui(ec.ui.blockTunes.toggler,"Click to tune")),i=await oLt("Slash","/");n.appendChild(r),n.appendChild(Rt.make("div",this.CSS.plusButtonShortcut,{textContent:WG(`CMD + ${i}`)})),RM(this.nodes.settingsToggler,n,{hidingDelay:400}),Rt.append(this.nodes.actions,this.makeToolbox()),Rt.append(this.nodes.actions,this.Editor.BlockSettings.getElement()),Rt.append(this.Editor.UI.nodes.wrapper,this.nodes.wrapper)}makeToolbox(){return this.toolboxInstance=new iLt({api:this.Editor.API.methods,tools:this.Editor.Tools.blockTools,i18nLabels:{filter:Ga.ui(ec.ui.popover,"Filter"),nothingFound:Ga.ui(ec.ui.popover,"Nothing found")}}),this.toolboxInstance.on(UM.Opened,()=>{this.Editor.UI.nodes.wrapper.classList.add(this.CSS.openedToolboxHolderModifier)}),this.toolboxInstance.on(UM.Closed,()=>{this.Editor.UI.nodes.wrapper.classList.remove(this.CSS.openedToolboxHolderModifier)}),this.toolboxInstance.on(UM.BlockAdded,({block:e})=>{const{BlockManager:n,Caret:r}=this.Editor,i=n.getBlockById(e.id);i.inputs.length===0&&(i===n.lastBlock?(n.insertAtEnd(),r.setToBlock(n.lastBlock)):r.setToBlock(n.nextBlock))}),this.toolboxInstance.getElement()}plusButtonClicked(){var e;this.Editor.BlockManager.currentBlock=this.hoveredBlock,(e=this.toolboxInstance)==null||e.toggle()}enableModuleBindings(){this.readOnlyMutableListeners.on(this.nodes.settingsToggler,"mousedown",e=>{var n;e.stopPropagation(),this.settingsTogglerClicked(),(n=this.toolboxInstance)!=null&&n.opened&&this.toolboxInstance.close(),zM(!0)},!0),nx()||this.eventsDispatcher.on(eAe,e=>{var n;this.Editor.BlockSettings.opened||(n=this.toolboxInstance)!=null&&n.opened||this.moveAndOpen(e.block)})}disableModuleBindings(){this.readOnlyMutableListeners.clearAll()}settingsTogglerClicked(){this.Editor.BlockManager.currentBlock=this.hoveredBlock,this.Editor.BlockSettings.opened?this.Editor.BlockSettings.close():this.Editor.BlockSettings.open(this.hoveredBlock)}drawUI(){this.Editor.BlockSettings.make(),this.make()}destroy(){this.removeAllNodes(),this.toolboxInstance&&this.toolboxInstance.destroy()}}var Ty=(t=>(t[t.Block=0]="Block",t[t.Inline=1]="Inline",t[t.Tune=2]="Tune",t))(Ty||{}),HM=(t=>(t.Shortcut="shortcut",t.Toolbox="toolbox",t.EnabledInlineTools="inlineToolbar",t.EnabledBlockTunes="tunes",t.Config="config",t))(HM||{}),tAe=(t=>(t.Shortcut="shortcut",t.SanitizeConfig="sanitize",t))(tAe||{}),ox=(t=>(t.IsEnabledLineBreaks="enableLineBreaks",t.Toolbox="toolbox",t.ConversionConfig="conversionConfig",t.IsReadOnlySupported="isReadOnlySupported",t.PasteConfig="pasteConfig",t))(ox||{}),GM=(t=>(t.IsInline="isInline",t.Title="title",t.IsReadOnlySupported="isReadOnlySupported",t))(GM||{}),cW=(t=>(t.IsTune="isTune",t))(cW||{});let uW=class{constructor({name:e,constructable:n,config:r,api:i,isDefault:o,isInternal:s=!1,defaultPlaceholder:a}){this.api=i,this.name=e,this.constructable=n,this.config=r,this.isDefault=o,this.isInternal=s,this.defaultPlaceholder=a}get settings(){const e=this.config.config||{};return this.isDefault&&!("placeholder"in e)&&this.defaultPlaceholder&&(e.placeholder=this.defaultPlaceholder),e}reset(){if(bo(this.constructable.reset))return this.constructable.reset()}prepare(){if(bo(this.constructable.prepare))return this.constructable.prepare({toolName:this.name,config:this.settings})}get shortcut(){const e=this.constructable.shortcut;return this.config.shortcut||e}get sanitizeConfig(){return this.constructable.sanitize||{}}isInline(){return this.type===Ty.Inline}isBlock(){return this.type===Ty.Block}isTune(){return this.type===Ty.Tune}};class aLt extends Ir{constructor({config:e,eventsDispatcher:n}){super({config:e,eventsDispatcher:n}),this.CSS={inlineToolbar:"ce-inline-toolbar"},this.opened=!1,this.popover=null,this.toolbarVerticalMargin=nx()?20:6,this.tools=new Map,window.requestIdleCallback(()=>{this.make()},{timeout:2e3})}async tryToShow(e=!1){e&&this.close(),this.allowedToShow()&&(await this.open(),this.Editor.Toolbar.close())}close(){var e,n;if(this.opened){for(const[r,i]of this.tools){const o=this.getToolShortcut(r.name);o!==void 0&&ix.remove(this.Editor.UI.nodes.redactor,o),bo(i.clear)&&i.clear()}this.tools=new Map,this.reset(),this.opened=!1,(e=this.popover)==null||e.hide(),(n=this.popover)==null||n.destroy(),this.popover=null}}containsNode(e){return this.nodes.wrapper===void 0?!1:this.nodes.wrapper.contains(e)}destroy(){var e;this.removeAllNodes(),(e=this.popover)==null||e.destroy(),this.popover=null}make(){this.nodes.wrapper=Rt.make("div",[this.CSS.inlineToolbar,...this.isRtl?[this.Editor.UI.CSS.editorRtlFix]:[]]),Rt.append(this.Editor.UI.nodes.wrapper,this.nodes.wrapper)}async open(){var e;if(this.opened)return;this.opened=!0,this.popover!==null&&this.popover.destroy(),this.createToolsInstances();const n=await this.getPopoverItems();this.popover=new qNt({items:n,scopeElement:this.Editor.API.methods.ui.nodes.redactor,messages:{nothingFound:Ga.ui(ec.ui.popover,"Nothing found"),search:Ga.ui(ec.ui.popover,"Filter")}}),this.move(this.popover.size.width),(e=this.nodes.wrapper)==null||e.append(this.popover.getElement()),this.popover.show()}move(e){const n=er.rect,r=this.Editor.UI.nodes.wrapper.getBoundingClientRect(),i={x:n.x-r.x,y:n.y+n.height-r.top+this.toolbarVerticalMargin};i.x+e+r.x>this.Editor.UI.contentRect.right&&(i.x=this.Editor.UI.contentRect.right-e-r.x),this.nodes.wrapper.style.left=Math.floor(i.x)+"px",this.nodes.wrapper.style.top=Math.floor(i.y)+"px"}reset(){this.nodes.wrapper.style.left="0",this.nodes.wrapper.style.top="0"}allowedToShow(){const e=["IMG","INPUT"],n=er.get(),r=er.text;if(!n||!n.anchorNode||n.isCollapsed||r.length<1)return!1;const i=Rt.isElement(n.anchorNode)?n.anchorNode:n.anchorNode.parentElement;if(i===null||n!==null&&e.includes(i.tagName))return!1;const o=this.Editor.BlockManager.getBlock(n.anchorNode);return!o||this.getTools().some(s=>o.tool.inlineTools.has(s.name))===!1?!1:i.closest("[contenteditable]")!==null}getTools(){const e=this.Editor.BlockManager.currentBlock;return e?Array.from(e.tool.inlineTools.values()).filter(n=>!(this.Editor.ReadOnly.isEnabled&&n.isReadOnlySupported!==!0)):[]}createToolsInstances(){this.tools=new Map,this.getTools().forEach(e=>{const n=e.create();this.tools.set(e,n)})}async getPopoverItems(){const e=[];let n=0;for(const[r,i]of this.tools){const o=await i.render(),s=this.getToolShortcut(r.name);if(s!==void 0)try{this.enableShortcuts(r.name,s)}catch{}const a=s!==void 0?WG(s):void 0,l=Ga.t(ec.toolNames,r.title||FM(r.name));[o].flat().forEach(c=>{var u,d;const p={name:r.name,onActivate:()=>{this.toolClicked(i)},hint:{title:l,description:a}};if(Rt.isElement(c)){const g={...p,element:c,type:eo.Html};if(bo(i.renderActions)){const b=i.renderActions();g.children={isOpen:(u=i.checkState)==null?void 0:u.call(i,er.get()),isFlippable:!1,items:[{type:eo.Html,element:b}]}}else(d=i.checkState)==null||d.call(i,er.get());e.push(g)}else if(c.type===eo.Html)e.push({...p,...c,type:eo.Html});else if(c.type===eo.Separator)e.push({type:eo.Separator});else{const g={...p,...c,type:eo.Default};"children"in g&&n!==0&&e.push({type:eo.Separator}),e.push(g),"children"in g&&n<this.tools.size-1&&e.push({type:eo.Separator})}}),n++}return e}getToolShortcut(e){const{Tools:n}=this.Editor,r=n.inlineTools.get(e),i=n.internal.inlineTools;return Array.from(i.keys()).includes(e)?this.inlineTools[e][tAe.Shortcut]:r?.shortcut}enableShortcuts(e,n){ix.add({name:n,handler:r=>{var i;const{currentBlock:o}=this.Editor.BlockManager;o&&o.tool.enabledInlineTools&&(r.preventDefault(),(i=this.popover)==null||i.activateItemByName(e))},on:document})}toolClicked(e){var n;const r=er.range;(n=e.surround)==null||n.call(e,r),this.checkToolsState()}checkToolsState(){var e;(e=this.tools)==null||e.forEach(n=>{var r;(r=n.checkState)==null||r.call(n,er.get())})}get inlineTools(){const e={};return Array.from(this.Editor.Tools.inlineTools.entries()).forEach(([n,r])=>{e[n]=r.create()}),e}}function nAe(){const t=window.getSelection();if(t===null)return[null,0];let e=t.focusNode,n=t.focusOffset;return e===null?[null,0]:(e.nodeType!==Node.TEXT_NODE&&e.childNodes.length>0&&(e.childNodes[n]?(e=e.childNodes[n],n=0):(e=e.childNodes[n-1],n=e.textContent.length)),[e,n])}function rAe(t,e,n,r){const i=document.createRange();r==="left"?(i.setStart(t,0),i.setEnd(e,n)):(i.setStart(e,n),i.setEnd(t,t.childNodes.length));const o=i.cloneContents(),s=document.createElement("div");s.appendChild(o);const a=s.textContent||"";return j6t(a)}function WM(t){const e=Rt.getDeepestNode(t);if(e===null||Rt.isEmpty(t))return!0;if(Rt.isNativeInput(e))return e.selectionEnd===0;if(Rt.isEmpty(t))return!0;const[n,r]=nAe();return n===null?!1:rAe(t,n,r,"left")}function KM(t){const e=Rt.getDeepestNode(t,!0);if(e===null)return!0;if(Rt.isNativeInput(e))return e.selectionEnd===e.value.length;const[n,r]=nAe();return n===null?!1:rAe(t,n,r,"right")}var iAe={},dW={},qM={},ky={},fW={},hW={};Object.defineProperty(hW,"__esModule",{value:!0}),hW.allInputsSelector=lLt;function lLt(){var t=["text","password","email","number","search","tel","url"];return"[contenteditable=true], textarea, input:not([type]), "+t.map(function(e){return'input[type="'.concat(e,'"]')}).join(", ")}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.allInputsSelector=void 0;var e=hW;Object.defineProperty(t,"allInputsSelector",{enumerable:!0,get:function(){return e.allInputsSelector}})})(fW);var Py={},pW={};Object.defineProperty(pW,"__esModule",{value:!0}),pW.isNativeInput=cLt;function cLt(t){var e=["INPUT","TEXTAREA"];return t&&t.tagName?e.includes(t.tagName):!1}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.isNativeInput=void 0;var e=pW;Object.defineProperty(t,"isNativeInput",{enumerable:!0,get:function(){return e.isNativeInput}})})(Py);var oAe={},gW={};Object.defineProperty(gW,"__esModule",{value:!0}),gW.append=uLt;function uLt(t,e){Array.isArray(e)?e.forEach(function(n){t.appendChild(n)}):t.appendChild(e)}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.append=void 0;var e=gW;Object.defineProperty(t,"append",{enumerable:!0,get:function(){return e.append}})})(oAe);var mW={},yW={};Object.defineProperty(yW,"__esModule",{value:!0}),yW.blockElements=dLt;function dLt(){return["address","article","aside","blockquote","canvas","div","dl","dt","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","li","main","nav","noscript","ol","output","p","pre","ruby","section","table","tbody","thead","tr","tfoot","ul","video"]}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.blockElements=void 0;var e=yW;Object.defineProperty(t,"blockElements",{enumerable:!0,get:function(){return e.blockElements}})})(mW);var sAe={},vW={};Object.defineProperty(vW,"__esModule",{value:!0}),vW.calculateBaseline=fLt;function fLt(t){var e=window.getComputedStyle(t),n=parseFloat(e.fontSize),r=parseFloat(e.lineHeight)||n*1.2,i=parseFloat(e.paddingTop),o=parseFloat(e.borderTopWidth),s=parseFloat(e.marginTop),a=n*.8,l=(r-n)/2,c=s+o+i+l+a;return c}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.calculateBaseline=void 0;var e=vW;Object.defineProperty(t,"calculateBaseline",{enumerable:!0,get:function(){return e.calculateBaseline}})})(sAe);var aAe={},bW={},xW={},wW={};Object.defineProperty(wW,"__esModule",{value:!0}),wW.isContentEditable=hLt;function hLt(t){return t.contentEditable==="true"}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.isContentEditable=void 0;var e=wW;Object.defineProperty(t,"isContentEditable",{enumerable:!0,get:function(){return e.isContentEditable}})})(xW),Object.defineProperty(bW,"__esModule",{value:!0}),bW.canSetCaret=mLt;var pLt=Py,gLt=xW;function mLt(t){var e=!0;if((0,pLt.isNativeInput)(t))switch(t.type){case"file":case"checkbox":case"radio":case"hidden":case"submit":case"button":case"image":case"reset":e=!1;break}else e=(0,gLt.isContentEditable)(t);return e}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.canSetCaret=void 0;var e=bW;Object.defineProperty(t,"canSetCaret",{enumerable:!0,get:function(){return e.canSetCaret}})})(aAe);var YM={},_W={};function yLt(t,e,n){const r=n.value!==void 0?"value":"get",i=n[r],o=`#${e}Cache`;if(n[r]=function(...s){return this[o]===void 0&&(this[o]=i.apply(this,s)),this[o]},r==="get"&&n.set){const s=n.set;n.set=function(a){delete t[o],s.apply(this,a)}}return n}function lAe(){const t={win:!1,mac:!1,x11:!1,linux:!1},e=Object.keys(t).find(n=>window.navigator.appVersion.toLowerCase().indexOf(n)!==-1);return e!==void 0&&(t[e]=!0),t}function SW(t){return t!=null&&t!==""&&(typeof t!="object"||Object.keys(t).length>0)}function vLt(t){return!SW(t)}const bLt=()=>typeof window<"u"&&window.navigator!==null&&SW(window.navigator.platform)&&(/iP(ad|hone|od)/.test(window.navigator.platform)||window.navigator.platform==="MacIntel"&&window.navigator.maxTouchPoints>1);function xLt(t){const e=lAe();return t=t.replace(/shift/gi,"⇧").replace(/backspace/gi,"⌫").replace(/enter/gi,"⏎").replace(/up/gi,"↑").replace(/left/gi,"→").replace(/down/gi,"↓").replace(/right/gi,"←").replace(/escape/gi,"⎋").replace(/insert/gi,"Ins").replace(/delete/gi,"␡").replace(/\+/gi,"+"),e.mac?t=t.replace(/ctrl|cmd/gi,"⌘").replace(/alt/gi,"⌥"):t=t.replace(/cmd/gi,"Ctrl").replace(/windows/gi,"WIN"),t}function wLt(t){return t[0].toUpperCase()+t.slice(1)}function _Lt(t){const e=document.createElement("div");e.style.position="absolute",e.style.left="-999px",e.style.bottom="-999px",e.innerHTML=t,document.body.appendChild(e);const n=window.getSelection(),r=document.createRange();if(r.selectNode(e),n===null)throw new Error("Cannot copy text to clipboard");n.removeAllRanges(),n.addRange(r),document.execCommand("copy"),document.body.removeChild(e)}function SLt(t,e,n){let r;return(...i)=>{const o=this,s=()=>{r=void 0,n!==!0&&t.apply(o,i)},a=n===!0&&r!==void 0;window.clearTimeout(r),r=window.setTimeout(s,e),a&&t.apply(o,i)}}function Ug(t){return Object.prototype.toString.call(t).match(/\s([a-zA-Z]+)/)[1].toLowerCase()}function ELt(t){return Ug(t)==="boolean"}function cAe(t){return Ug(t)==="function"||Ug(t)==="asyncfunction"}function CLt(t){return cAe(t)&&/^\s*class\s+/.test(t.toString())}function TLt(t){return Ug(t)==="number"}function ZM(t){return Ug(t)==="object"}function kLt(t){return Promise.resolve(t)===t}function PLt(t){return Ug(t)==="string"}function ALt(t){return Ug(t)==="undefined"}function EW(t,...e){if(!e.length)return t;const n=e.shift();if(ZM(t)&&ZM(n))for(const r in n)ZM(n[r])?(t[r]===void 0&&Object.assign(t,{[r]:{}}),EW(t[r],n[r])):Object.assign(t,{[r]:n[r]});return EW(t,...e)}function ILt(t,e,n){const r=`«${e}» is deprecated and will be removed in the next major release. Please use the «${n}» instead.`;t&&console.warn(r)}function MLt(t){try{return new URL(t).href}catch{}return t.substring(0,2)==="//"?window.location.protocol+t:window.location.origin+t}function DLt(t){return t>47&&t<58||t===32||t===13||t===229||t>64&&t<91||t>95&&t<112||t>185&&t<193||t>218&&t<223}const NLt={BACKSPACE:8,TAB:9,ENTER:13,SHIFT:16,CTRL:17,ALT:18,ESC:27,SPACE:32,LEFT:37,UP:38,DOWN:40,RIGHT:39,DELETE:46,META:91,SLASH:191},LLt={LEFT:0,WHEEL:1,RIGHT:2,BACKWARD:3,FORWARD:4};let OLt=class{constructor(){this.completed=Promise.resolve()}add(t){return new Promise((e,n)=>{this.completed=this.completed.then(t).then(e).catch(n)})}};function $Lt(t,e,n=void 0){let r,i,o,s=null,a=0;n||(n={});const l=function(){a=n.leading===!1?0:Date.now(),s=null,o=t.apply(r,i),s===null&&(r=i=null)};return function(){const c=Date.now();!a&&n.leading===!1&&(a=c);const u=e-(c-a);return r=this,i=arguments,u<=0||u>e?(s&&(clearTimeout(s),s=null),a=c,o=t.apply(r,i),s===null&&(r=i=null)):!s&&n.trailing!==!1&&(s=setTimeout(l,u)),o}}const FLt=Object.freeze(Object.defineProperty({__proto__:null,PromiseQueue:OLt,beautifyShortcut:xLt,cacheable:yLt,capitalize:wLt,copyTextToClipboard:_Lt,debounce:SLt,deepMerge:EW,deprecationAssert:ILt,getUserOS:lAe,getValidUrl:MLt,isBoolean:ELt,isClass:CLt,isEmpty:vLt,isFunction:cAe,isIosDevice:bLt,isNumber:TLt,isObject:ZM,isPrintableKey:DLt,isPromise:kLt,isString:PLt,isUndefined:ALt,keyCodes:NLt,mouseButtons:LLt,notEmpty:SW,throttle:$Lt,typeOf:Ug},Symbol.toStringTag,{value:"Module"})),CW=P6t(FLt);Object.defineProperty(_W,"__esModule",{value:!0}),_W.containsOnlyInlineElements=RLt;var BLt=CW,zLt=mW;function RLt(t){var e;(0,BLt.isString)(t)?(e=document.createElement("div"),e.innerHTML=t):e=t;var n=function(r){return!(0,zLt.blockElements)().includes(r.tagName.toLowerCase())&&Array.from(r.children).every(n)};return Array.from(e.children).every(n)}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.containsOnlyInlineElements=void 0;var e=_W;Object.defineProperty(t,"containsOnlyInlineElements",{enumerable:!0,get:function(){return e.containsOnlyInlineElements}})})(YM);var uAe={},TW={},XM={},kW={};Object.defineProperty(kW,"__esModule",{value:!0}),kW.make=VLt;function VLt(t,e,n){var r;e===void 0&&(e=null),n===void 0&&(n={});var i=document.createElement(t);if(Array.isArray(e)){var o=e.filter(function(a){return a!==void 0});(r=i.classList).add.apply(r,o)}else e!==null&&i.classList.add(e);for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(i[s]=n[s]);return i}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.make=void 0;var e=kW;Object.defineProperty(t,"make",{enumerable:!0,get:function(){return e.make}})})(XM),Object.defineProperty(TW,"__esModule",{value:!0}),TW.fragmentToString=ULt;var jLt=XM;function ULt(t){var e=(0,jLt.make)("div");return e.appendChild(t),e.innerHTML}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.fragmentToString=void 0;var e=TW;Object.defineProperty(t,"fragmentToString",{enumerable:!0,get:function(){return e.fragmentToString}})})(uAe);var dAe={},PW={};Object.defineProperty(PW,"__esModule",{value:!0}),PW.getContentLength=GLt;var HLt=Py;function GLt(t){var e,n;return(0,HLt.isNativeInput)(t)?t.value.length:t.nodeType===Node.TEXT_NODE?t.length:(n=(e=t.textContent)===null||e===void 0?void 0:e.length)!==null&&n!==void 0?n:0}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.getContentLength=void 0;var e=PW;Object.defineProperty(t,"getContentLength",{enumerable:!0,get:function(){return e.getContentLength}})})(dAe);var AW={},IW={},fAe=ME&&ME.__spreadArray||function(t,e,n){if(n||arguments.length===2)for(var r=0,i=e.length,o;r<i;r++)(o||!(r in e))&&(o||(o=Array.prototype.slice.call(e,0,r)),o[r]=e[r]);return t.concat(o||Array.prototype.slice.call(e))};Object.defineProperty(IW,"__esModule",{value:!0}),IW.getDeepestBlockElements=hAe;var WLt=YM;function hAe(t){return(0,WLt.containsOnlyInlineElements)(t)?[t]:Array.from(t.children).reduce(function(e,n){return fAe(fAe([],e,!0),hAe(n),!0)},[])}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.getDeepestBlockElements=void 0;var e=IW;Object.defineProperty(t,"getDeepestBlockElements",{enumerable:!0,get:function(){return e.getDeepestBlockElements}})})(AW);var pAe={},MW={},QM={},DW={};Object.defineProperty(DW,"__esModule",{value:!0}),DW.isLineBreakTag=KLt;function KLt(t){return["BR","WBR"].includes(t.tagName)}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.isLineBreakTag=void 0;var e=DW;Object.defineProperty(t,"isLineBreakTag",{enumerable:!0,get:function(){return e.isLineBreakTag}})})(QM);var JM={},NW={};Object.defineProperty(NW,"__esModule",{value:!0}),NW.isSingleTag=qLt;function qLt(t){return["AREA","BASE","BR","COL","COMMAND","EMBED","HR","IMG","INPUT","KEYGEN","LINK","META","PARAM","SOURCE","TRACK","WBR"].includes(t.tagName)}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.isSingleTag=void 0;var e=NW;Object.defineProperty(t,"isSingleTag",{enumerable:!0,get:function(){return e.isSingleTag}})})(JM),Object.defineProperty(MW,"__esModule",{value:!0}),MW.getDeepestNode=gAe;var YLt=Py,ZLt=QM,XLt=JM;function gAe(t,e){e===void 0&&(e=!1);var n=e?"lastChild":"firstChild",r=e?"previousSibling":"nextSibling";if(t.nodeType===Node.ELEMENT_NODE&&t[n]){var i=t[n];if((0,XLt.isSingleTag)(i)&&!(0,YLt.isNativeInput)(i)&&!(0,ZLt.isLineBreakTag)(i))if(i[r])i=i[r];else if(i.parentNode!==null&&i.parentNode[r])i=i.parentNode[r];else return i.parentNode;return gAe(i,e)}return t}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.getDeepestNode=void 0;var e=MW;Object.defineProperty(t,"getDeepestNode",{enumerable:!0,get:function(){return e.getDeepestNode}})})(pAe);var mAe={},LW={},eD=ME&&ME.__spreadArray||function(t,e,n){if(n||arguments.length===2)for(var r=0,i=e.length,o;r<i;r++)(o||!(r in e))&&(o||(o=Array.prototype.slice.call(e,0,r)),o[r]=e[r]);return t.concat(o||Array.prototype.slice.call(e))};Object.defineProperty(LW,"__esModule",{value:!0}),LW.findAllInputs=n8t;var QLt=YM,JLt=AW,e8t=fW,t8t=Py;function n8t(t){return Array.from(t.querySelectorAll((0,e8t.allInputsSelector)())).reduce(function(e,n){return(0,t8t.isNativeInput)(n)||(0,QLt.containsOnlyInlineElements)(n)?eD(eD([],e,!0),[n],!1):eD(eD([],e,!0),(0,JLt.getDeepestBlockElements)(n),!0)},[])}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.findAllInputs=void 0;var e=LW;Object.defineProperty(t,"findAllInputs",{enumerable:!0,get:function(){return e.findAllInputs}})})(mAe);var yAe={},OW={};Object.defineProperty(OW,"__esModule",{value:!0}),OW.isCollapsedWhitespaces=r8t;function r8t(t){return!/[^\t\n\r ]/.test(t)}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.isCollapsedWhitespaces=void 0;var e=OW;Object.defineProperty(t,"isCollapsedWhitespaces",{enumerable:!0,get:function(){return e.isCollapsedWhitespaces}})})(yAe);var $W={},FW={};Object.defineProperty(FW,"__esModule",{value:!0}),FW.isElement=o8t;var i8t=CW;function o8t(t){return(0,i8t.isNumber)(t)?!1:!!t&&!!t.nodeType&&t.nodeType===Node.ELEMENT_NODE}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.isElement=void 0;var e=FW;Object.defineProperty(t,"isElement",{enumerable:!0,get:function(){return e.isElement}})})($W);var vAe={},BW={},zW={},RW={};Object.defineProperty(RW,"__esModule",{value:!0}),RW.isLeaf=s8t;function s8t(t){return t===null?!1:t.childNodes.length===0}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.isLeaf=void 0;var e=RW;Object.defineProperty(t,"isLeaf",{enumerable:!0,get:function(){return e.isLeaf}})})(zW);var VW={},jW={};Object.defineProperty(jW,"__esModule",{value:!0}),jW.isNodeEmpty=d8t;var a8t=QM,l8t=$W,c8t=Py,u8t=JM;function d8t(t,e){var n="";return(0,u8t.isSingleTag)(t)&&!(0,a8t.isLineBreakTag)(t)?!1:((0,l8t.isElement)(t)&&(0,c8t.isNativeInput)(t)?n=t.value:t.textContent!==null&&(n=t.textContent.replace("​","")),e!==void 0&&(n=n.replace(new RegExp(e,"g"),"")),n.trim().length===0)}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.isNodeEmpty=void 0;var e=jW;Object.defineProperty(t,"isNodeEmpty",{enumerable:!0,get:function(){return e.isNodeEmpty}})})(VW),Object.defineProperty(BW,"__esModule",{value:!0}),BW.isEmpty=p8t;var f8t=zW,h8t=VW;function p8t(t,e){t.normalize();for(var n=[t];n.length>0;){var r=n.shift();if(r){if(t=r,(0,f8t.isLeaf)(t)&&!(0,h8t.isNodeEmpty)(t,e))return!1;n.push.apply(n,Array.from(t.childNodes))}}return!0}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.isEmpty=void 0;var e=BW;Object.defineProperty(t,"isEmpty",{enumerable:!0,get:function(){return e.isEmpty}})})(vAe);var bAe={},UW={};Object.defineProperty(UW,"__esModule",{value:!0}),UW.isFragment=m8t;var g8t=CW;function m8t(t){return(0,g8t.isNumber)(t)?!1:!!t&&!!t.nodeType&&t.nodeType===Node.DOCUMENT_FRAGMENT_NODE}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.isFragment=void 0;var e=UW;Object.defineProperty(t,"isFragment",{enumerable:!0,get:function(){return e.isFragment}})})(bAe);var xAe={},HW={};Object.defineProperty(HW,"__esModule",{value:!0}),HW.isHTMLString=v8t;var y8t=XM;function v8t(t){var e=(0,y8t.make)("div");return e.innerHTML=t,e.childElementCount>0}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.isHTMLString=void 0;var e=HW;Object.defineProperty(t,"isHTMLString",{enumerable:!0,get:function(){return e.isHTMLString}})})(xAe);var wAe={},GW={};Object.defineProperty(GW,"__esModule",{value:!0}),GW.offset=b8t;function b8t(t){var e=t.getBoundingClientRect(),n=window.pageXOffset||document.documentElement.scrollLeft,r=window.pageYOffset||document.documentElement.scrollTop,i=e.top+r,o=e.left+n;return{top:i,left:o,bottom:i+e.height,right:o+e.width}}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.offset=void 0;var e=GW;Object.defineProperty(t,"offset",{enumerable:!0,get:function(){return e.offset}})})(wAe);var _Ae={},WW={};Object.defineProperty(WW,"__esModule",{value:!0}),WW.prepend=x8t;function x8t(t,e){Array.isArray(e)?(e=e.reverse(),e.forEach(function(n){return t.prepend(n)})):t.prepend(e)}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.prepend=void 0;var e=WW;Object.defineProperty(t,"prepend",{enumerable:!0,get:function(){return e.prepend}})})(_Ae),(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.prepend=t.offset=t.make=t.isLineBreakTag=t.isSingleTag=t.isNodeEmpty=t.isLeaf=t.isHTMLString=t.isFragment=t.isEmpty=t.isElement=t.isContentEditable=t.isCollapsedWhitespaces=t.findAllInputs=t.isNativeInput=t.allInputsSelector=t.getDeepestNode=t.getDeepestBlockElements=t.getContentLength=t.fragmentToString=t.containsOnlyInlineElements=t.canSetCaret=t.calculateBaseline=t.blockElements=t.append=void 0;var e=fW;Object.defineProperty(t,"allInputsSelector",{enumerable:!0,get:function(){return e.allInputsSelector}});var n=Py;Object.defineProperty(t,"isNativeInput",{enumerable:!0,get:function(){return n.isNativeInput}});var r=oAe;Object.defineProperty(t,"append",{enumerable:!0,get:function(){return r.append}});var i=mW;Object.defineProperty(t,"blockElements",{enumerable:!0,get:function(){return i.blockElements}});var o=sAe;Object.defineProperty(t,"calculateBaseline",{enumerable:!0,get:function(){return o.calculateBaseline}});var s=aAe;Object.defineProperty(t,"canSetCaret",{enumerable:!0,get:function(){return s.canSetCaret}});var a=YM;Object.defineProperty(t,"containsOnlyInlineElements",{enumerable:!0,get:function(){return a.containsOnlyInlineElements}});var l=uAe;Object.defineProperty(t,"fragmentToString",{enumerable:!0,get:function(){return l.fragmentToString}});var c=dAe;Object.defineProperty(t,"getContentLength",{enumerable:!0,get:function(){return c.getContentLength}});var u=AW;Object.defineProperty(t,"getDeepestBlockElements",{enumerable:!0,get:function(){return u.getDeepestBlockElements}});var d=pAe;Object.defineProperty(t,"getDeepestNode",{enumerable:!0,get:function(){return d.getDeepestNode}});var p=mAe;Object.defineProperty(t,"findAllInputs",{enumerable:!0,get:function(){return p.findAllInputs}});var g=yAe;Object.defineProperty(t,"isCollapsedWhitespaces",{enumerable:!0,get:function(){return g.isCollapsedWhitespaces}});var b=xW;Object.defineProperty(t,"isContentEditable",{enumerable:!0,get:function(){return b.isContentEditable}});var w=$W;Object.defineProperty(t,"isElement",{enumerable:!0,get:function(){return w.isElement}});var _=vAe;Object.defineProperty(t,"isEmpty",{enumerable:!0,get:function(){return _.isEmpty}});var E=bAe;Object.defineProperty(t,"isFragment",{enumerable:!0,get:function(){return E.isFragment}});var A=xAe;Object.defineProperty(t,"isHTMLString",{enumerable:!0,get:function(){return A.isHTMLString}});var k=zW;Object.defineProperty(t,"isLeaf",{enumerable:!0,get:function(){return k.isLeaf}});var M=VW;Object.defineProperty(t,"isNodeEmpty",{enumerable:!0,get:function(){return M.isNodeEmpty}});var L=QM;Object.defineProperty(t,"isLineBreakTag",{enumerable:!0,get:function(){return L.isLineBreakTag}});var F=JM;Object.defineProperty(t,"isSingleTag",{enumerable:!0,get:function(){return F.isSingleTag}});var R=XM;Object.defineProperty(t,"make",{enumerable:!0,get:function(){return R.make}});var B=wAe;Object.defineProperty(t,"offset",{enumerable:!0,get:function(){return B.offset}});var V=_Ae;Object.defineProperty(t,"prepend",{enumerable:!0,get:function(){return V.prepend}})})(ky);var tD={};Object.defineProperty(tD,"__esModule",{value:!0}),tD.getContenteditableSlice=_8t;var w8t=ky;function _8t(t,e,n,r,i){var o;i===void 0&&(i=!1);var s=document.createRange();if(r==="left"?(s.setStart(t,0),s.setEnd(e,n)):(s.setStart(e,n),s.setEnd(t,t.childNodes.length)),i===!0){var a=s.extractContents();return(0,w8t.fragmentToString)(a)}var l=s.cloneContents(),c=document.createElement("div");c.appendChild(l);var u=(o=c.textContent)!==null&&o!==void 0?o:"";return u}Object.defineProperty(qM,"__esModule",{value:!0}),qM.checkContenteditableSliceForEmptiness=C8t;var S8t=ky,E8t=tD;function C8t(t,e,n,r){var i=(0,E8t.getContenteditableSlice)(t,e,n,r);return(0,S8t.isCollapsedWhitespaces)(i)}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.checkContenteditableSliceForEmptiness=void 0;var e=qM;Object.defineProperty(t,"checkContenteditableSliceForEmptiness",{enumerable:!0,get:function(){return e.checkContenteditableSliceForEmptiness}})})(dW);var SAe={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.getContenteditableSlice=void 0;var e=tD;Object.defineProperty(t,"getContenteditableSlice",{enumerable:!0,get:function(){return e.getContenteditableSlice}})})(SAe);var EAe={},KW={};Object.defineProperty(KW,"__esModule",{value:!0}),KW.focus=k8t;var T8t=ky;function k8t(t,e){var n,r;if(e===void 0&&(e=!0),(0,T8t.isNativeInput)(t)){t.focus();var i=e?0:t.value.length;t.setSelectionRange(i,i)}else{var o=document.createRange(),s=window.getSelection();if(!s)return;var a=function(p){var g=document.createTextNode("");p.appendChild(g),o.setStart(g,0),o.setEnd(g,0)},l=function(p){return p!=null},c=t.childNodes,u=e?c[0]:c[c.length-1];if(l(u)){for(;l(u)&&u.nodeType!==Node.TEXT_NODE;)u=e?u.firstChild:u.lastChild;if(l(u)&&u.nodeType===Node.TEXT_NODE){var d=(r=(n=u.textContent)===null||n===void 0?void 0:n.length)!==null&&r!==void 0?r:0,i=e?0:d;o.setStart(u,i),o.setEnd(u,i)}else a(t)}else a(t);s.removeAllRanges(),s.addRange(o)}}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.focus=void 0;var e=KW;Object.defineProperty(t,"focus",{enumerable:!0,get:function(){return e.focus}})})(EAe);var qW={},nD={};Object.defineProperty(nD,"__esModule",{value:!0}),nD.getCaretNodeAndOffset=P8t;function P8t(){var t=window.getSelection();if(t===null)return[null,0];var e=t.focusNode,n=t.focusOffset;return e===null?[null,0]:(e.nodeType!==Node.TEXT_NODE&&e.childNodes.length>0&&(e.childNodes[n]!==void 0?(e=e.childNodes[n],n=0):(e=e.childNodes[n-1],e.textContent!==null&&(n=e.textContent.length))),[e,n])}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.getCaretNodeAndOffset=void 0;var e=nD;Object.defineProperty(t,"getCaretNodeAndOffset",{enumerable:!0,get:function(){return e.getCaretNodeAndOffset}})})(qW);var CAe={},rD={};Object.defineProperty(rD,"__esModule",{value:!0}),rD.getRange=A8t;function A8t(){var t=window.getSelection();return t&&t.rangeCount?t.getRangeAt(0):null}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.getRange=void 0;var e=rD;Object.defineProperty(t,"getRange",{enumerable:!0,get:function(){return e.getRange}})})(CAe);var TAe={},YW={};Object.defineProperty(YW,"__esModule",{value:!0}),YW.isCaretAtEndOfInput=D8t;var kAe=ky,I8t=qW,M8t=dW;function D8t(t){var e=(0,kAe.getDeepestNode)(t,!0);if(e===null)return!0;if((0,kAe.isNativeInput)(e))return e.selectionEnd===e.value.length;var n=(0,I8t.getCaretNodeAndOffset)(),r=n[0],i=n[1];return r===null?!1:(0,M8t.checkContenteditableSliceForEmptiness)(t,r,i,"right")}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.isCaretAtEndOfInput=void 0;var e=YW;Object.defineProperty(t,"isCaretAtEndOfInput",{enumerable:!0,get:function(){return e.isCaretAtEndOfInput}})})(TAe);var PAe={},ZW={};Object.defineProperty(ZW,"__esModule",{value:!0}),ZW.isCaretAtStartOfInput=O8t;var iD=ky,N8t=nD,L8t=qM;function O8t(t){var e=(0,iD.getDeepestNode)(t);if(e===null||(0,iD.isEmpty)(t))return!0;if((0,iD.isNativeInput)(e))return e.selectionEnd===0;if((0,iD.isEmpty)(t))return!0;var n=(0,N8t.getCaretNodeAndOffset)(),r=n[0],i=n[1];return r===null?!1:(0,L8t.checkContenteditableSliceForEmptiness)(t,r,i,"left")}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.isCaretAtStartOfInput=void 0;var e=ZW;Object.defineProperty(t,"isCaretAtStartOfInput",{enumerable:!0,get:function(){return e.isCaretAtStartOfInput}})})(PAe);var AAe={},XW={};Object.defineProperty(XW,"__esModule",{value:!0}),XW.save=B8t;var $8t=ky,F8t=rD;function B8t(){var t=(0,F8t.getRange)(),e=(0,$8t.make)("span");if(e.id="cursor",e.hidden=!0,!!t)return t.insertNode(e),function(){var n=window.getSelection();n&&(t.setStartAfter(e),t.setEndAfter(e),n.removeAllRanges(),n.addRange(t),setTimeout(function(){e.remove()},150))}}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.save=void 0;var e=XW;Object.defineProperty(t,"save",{enumerable:!0,get:function(){return e.save}})})(AAe),(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.save=t.isCaretAtStartOfInput=t.isCaretAtEndOfInput=t.getRange=t.getCaretNodeAndOffset=t.focus=t.getContenteditableSlice=t.checkContenteditableSliceForEmptiness=void 0;var e=dW;Object.defineProperty(t,"checkContenteditableSliceForEmptiness",{enumerable:!0,get:function(){return e.checkContenteditableSliceForEmptiness}});var n=SAe;Object.defineProperty(t,"getContenteditableSlice",{enumerable:!0,get:function(){return n.getContenteditableSlice}});var r=EAe;Object.defineProperty(t,"focus",{enumerable:!0,get:function(){return r.focus}});var i=qW;Object.defineProperty(t,"getCaretNodeAndOffset",{enumerable:!0,get:function(){return i.getCaretNodeAndOffset}});var o=CAe;Object.defineProperty(t,"getRange",{enumerable:!0,get:function(){return o.getRange}});var s=TAe;Object.defineProperty(t,"isCaretAtEndOfInput",{enumerable:!0,get:function(){return s.isCaretAtEndOfInput}});var a=PAe;Object.defineProperty(t,"isCaretAtStartOfInput",{enumerable:!0,get:function(){return a.isCaretAtStartOfInput}});var l=AAe;Object.defineProperty(t,"save",{enumerable:!0,get:function(){return l.save}})})(iAe);class z8t extends Ir{keydown(e){switch(this.beforeKeydownProcessing(e),e.keyCode){case ur.BACKSPACE:this.backspace(e);break;case ur.DELETE:this.delete(e);break;case ur.ENTER:this.enter(e);break;case ur.DOWN:case ur.RIGHT:this.arrowRightAndDown(e);break;case ur.UP:case ur.LEFT:this.arrowLeftAndUp(e);break;case ur.TAB:this.tabPressed(e);break}e.key==="/"&&!e.ctrlKey&&!e.metaKey&&this.slashPressed(e),e.code==="Slash"&&(e.ctrlKey||e.metaKey)&&(e.preventDefault(),this.commandSlashPressed())}beforeKeydownProcessing(e){this.needToolbarClosing(e)&&S5e(e.keyCode)&&(this.Editor.Toolbar.close(),e.ctrlKey||e.metaKey||e.altKey||e.shiftKey||this.Editor.BlockSelection.clearSelection(e))}keyup(e){e.shiftKey||this.Editor.UI.checkEmptiness()}dragOver(e){const n=this.Editor.BlockManager.getBlockByChildNode(e.target);n.dropTarget=!0}dragLeave(e){const n=this.Editor.BlockManager.getBlockByChildNode(e.target);n.dropTarget=!1}handleCommandC(e){const{BlockSelection:n}=this.Editor;n.anyBlockSelected&&n.copySelectedBlocks(e)}handleCommandX(e){const{BlockSelection:n,BlockManager:r,Caret:i}=this.Editor;n.anyBlockSelected&&n.copySelectedBlocks(e).then(()=>{const o=r.removeSelectedBlocks(),s=r.insertDefaultBlockAtIndex(o,!0);i.setToBlock(s,i.positions.START),n.clearSelection(e)})}tabPressed(e){const{InlineToolbar:n,Caret:r}=this.Editor;n.opened||(e.shiftKey?r.navigatePrevious(!0):r.navigateNext(!0))&&e.preventDefault()}commandSlashPressed(){this.Editor.BlockSelection.selectedBlocks.length>1||this.activateBlockSettings()}slashPressed(e){!this.Editor.UI.nodes.wrapper.contains(e.target)||!this.Editor.BlockManager.currentBlock.isEmpty||(e.preventDefault(),this.Editor.Caret.insertContentAtCaretPosition("/"),this.activateToolbox())}enter(e){const{BlockManager:n,UI:r}=this.Editor,i=n.currentBlock;if(i===void 0||i.tool.isLineBreaksEnabled||r.someToolbarOpened&&r.someFlipperButtonFocused||e.shiftKey&&!qG)return;let o=i;i.currentInput!==void 0&&WM(i.currentInput)&&!i.hasMedia?this.Editor.BlockManager.insertDefaultBlockAtIndex(this.Editor.BlockManager.currentBlockIndex):i.currentInput&&KM(i.currentInput)?o=this.Editor.BlockManager.insertDefaultBlockAtIndex(this.Editor.BlockManager.currentBlockIndex+1):o=this.Editor.BlockManager.split(),this.Editor.Caret.setToBlock(o),this.Editor.Toolbar.moveAndOpen(o),e.preventDefault()}backspace(e){const{BlockManager:n,Caret:r}=this.Editor,{currentBlock:i,previousBlock:o}=n;if(!(i===void 0||!er.isCollapsed||!i.currentInput||!WM(i.currentInput))){if(e.preventDefault(),this.Editor.Toolbar.close(),i.currentInput!==i.firstInput){r.navigatePrevious();return}if(o!==null){if(o.isEmpty){n.removeBlock(o);return}if(i.isEmpty){n.removeBlock(i);const s=n.currentBlock;r.setToBlock(s,r.positions.END);return}$5e(o,i)?this.mergeBlocks(o,i):r.setToBlock(o,r.positions.END)}}}delete(e){const{BlockManager:n,Caret:r}=this.Editor,{currentBlock:i,nextBlock:o}=n;if(!(!er.isCollapsed||!KM(i.currentInput))){if(e.preventDefault(),this.Editor.Toolbar.close(),i.currentInput!==i.lastInput){r.navigateNext();return}if(o!==null){if(o.isEmpty){n.removeBlock(o);return}if(i.isEmpty){n.removeBlock(i),r.setToBlock(o,r.positions.START);return}$5e(i,o)?this.mergeBlocks(i,o):r.setToBlock(o,r.positions.START)}}}mergeBlocks(e,n){const{BlockManager:r,Toolbar:i}=this.Editor;e.lastInput!==void 0&&(iAe.focus(e.lastInput,!1),r.mergeBlocks(e,n).then(()=>{i.close()}))}arrowRightAndDown(e){const n=VM.usedKeys.includes(e.keyCode)&&(!e.shiftKey||e.keyCode===ur.TAB);if(this.Editor.UI.someToolbarOpened&&n)return;this.Editor.Toolbar.close();const{currentBlock:r}=this.Editor.BlockManager,i=(r?.currentInput!==void 0?KM(r.currentInput):void 0)||this.Editor.BlockSelection.anyBlockSelected;if(e.shiftKey&&e.keyCode===ur.DOWN&&i){this.Editor.CrossBlockSelection.toggleBlockSelectedState();return}if(e.keyCode===ur.DOWN||e.keyCode===ur.RIGHT&&!this.isRtl?this.Editor.Caret.navigateNext():this.Editor.Caret.navigatePrevious()){e.preventDefault();return}$M(()=>{this.Editor.BlockManager.currentBlock&&this.Editor.BlockManager.currentBlock.updateCurrentInput()},20)(),this.Editor.BlockSelection.clearSelection(e)}arrowLeftAndUp(e){if(this.Editor.UI.someToolbarOpened){if(VM.usedKeys.includes(e.keyCode)&&(!e.shiftKey||e.keyCode===ur.TAB))return;this.Editor.UI.closeAllToolbars()}this.Editor.Toolbar.close();const{currentBlock:n}=this.Editor.BlockManager,r=(n?.currentInput!==void 0?WM(n.currentInput):void 0)||this.Editor.BlockSelection.anyBlockSelected;if(e.shiftKey&&e.keyCode===ur.UP&&r){this.Editor.CrossBlockSelection.toggleBlockSelectedState(!1);return}if(e.keyCode===ur.UP||e.keyCode===ur.LEFT&&!this.isRtl?this.Editor.Caret.navigatePrevious():this.Editor.Caret.navigateNext()){e.preventDefault();return}$M(()=>{this.Editor.BlockManager.currentBlock&&this.Editor.BlockManager.currentBlock.updateCurrentInput()},20)(),this.Editor.BlockSelection.clearSelection(e)}needToolbarClosing(e){const n=e.keyCode===ur.ENTER&&this.Editor.Toolbar.toolbox.opened,r=e.keyCode===ur.ENTER&&this.Editor.BlockSettings.opened,i=e.keyCode===ur.ENTER&&this.Editor.InlineToolbar.opened,o=e.keyCode===ur.TAB;return!(e.shiftKey||o||n||r||i)}activateToolbox(){this.Editor.Toolbar.opened||this.Editor.Toolbar.moveAndOpen(),this.Editor.Toolbar.toolbox.open()}activateBlockSettings(){this.Editor.Toolbar.opened||this.Editor.Toolbar.moveAndOpen(),this.Editor.BlockSettings.opened||this.Editor.BlockSettings.open()}}class QW{constructor(e){this.blocks=[],this.workingArea=e}get length(){return this.blocks.length}get array(){return this.blocks}get nodes(){return E5e(this.workingArea.children)}static set(e,n,r){return isNaN(Number(n))?(Reflect.set(e,n,r),!0):(e.insert(+n,r),!0)}static get(e,n){return isNaN(Number(n))?Reflect.get(e,n):e.get(+n)}push(e){this.blocks.push(e),this.insertToDOM(e)}swap(e,n){const r=this.blocks[n];Rt.swap(this.blocks[e].holder,r.holder),this.blocks[n]=this.blocks[e],this.blocks[e]=r}move(e,n){const r=this.blocks.splice(n,1)[0],i=e-1,o=Math.max(0,i),s=this.blocks[o];e>0?this.insertToDOM(r,"afterend",s):this.insertToDOM(r,"beforebegin",s),this.blocks.splice(e,0,r);const a=this.composeBlockEvent("move",{fromIndex:n,toIndex:e});r.call(Nh.MOVED,a)}insert(e,n,r=!1){if(!this.length){this.push(n);return}e>this.length&&(e=this.length),r&&(this.blocks[e].holder.remove(),this.blocks[e].call(Nh.REMOVED));const i=r?1:0;if(this.blocks.splice(e,i,n),e>0){const o=this.blocks[e-1];this.insertToDOM(n,"afterend",o)}else{const o=this.blocks[e+1];o?this.insertToDOM(n,"beforebegin",o):this.insertToDOM(n)}}replace(e,n){if(this.blocks[e]===void 0)throw Error("Incorrect index");this.blocks[e].holder.replaceWith(n.holder),this.blocks[e]=n}insertMany(e,n){const r=new DocumentFragment;for(const i of e)r.appendChild(i.holder);if(this.length>0){if(n>0){const i=Math.min(n-1,this.length-1);this.blocks[i].holder.after(r)}else n===0&&this.workingArea.prepend(r);this.blocks.splice(n,0,...e)}else this.blocks.push(...e),this.workingArea.appendChild(r);e.forEach(i=>i.call(Nh.RENDERED))}remove(e){isNaN(e)&&(e=this.length-1),this.blocks[e].holder.remove(),this.blocks[e].call(Nh.REMOVED),this.blocks.splice(e,1)}removeAll(){this.workingArea.innerHTML="",this.blocks.forEach(e=>e.call(Nh.REMOVED)),this.blocks.length=0}insertAfter(e,n){const r=this.blocks.indexOf(e);this.insert(r+1,n)}get(e){return this.blocks[e]}indexOf(e){return this.blocks.indexOf(e)}insertToDOM(e,n,r){n?r.holder.insertAdjacentElement(n,e.holder):this.workingArea.appendChild(e.holder),e.call(Nh.RENDERED)}composeBlockEvent(e,n){return new CustomEvent(e,{detail:n})}}const IAe="block-removed",MAe="block-added",R8t="block-moved",DAe="block-changed";class V8t{constructor(){this.completed=Promise.resolve()}add(e){return new Promise((n,r)=>{this.completed=this.completed.then(e).then(n).catch(r)})}}class j8t extends Ir{constructor(){super(...arguments),this._currentBlockIndex=-1,this._blocks=null}get currentBlockIndex(){return this._currentBlockIndex}set currentBlockIndex(e){this._currentBlockIndex=e}get firstBlock(){return this._blocks[0]}get lastBlock(){return this._blocks[this._blocks.length-1]}get currentBlock(){return this._blocks[this.currentBlockIndex]}set currentBlock(e){this.currentBlockIndex=this.getBlockIndex(e)}get nextBlock(){return this.currentBlockIndex===this._blocks.length-1?null:this._blocks[this.currentBlockIndex+1]}get nextContentfulBlock(){return this.blocks.slice(this.currentBlockIndex+1).find(e=>!!e.inputs.length)}get previousContentfulBlock(){return this.blocks.slice(0,this.currentBlockIndex).reverse().find(e=>!!e.inputs.length)}get previousBlock(){return this.currentBlockIndex===0?null:this._blocks[this.currentBlockIndex-1]}get blocks(){return this._blocks.array}get isEditorEmpty(){return this.blocks.every(e=>e.isEmpty)}prepare(){const e=new QW(this.Editor.UI.nodes.redactor);this._blocks=new Proxy(e,{set:QW.set,get:QW.get}),this.listeners.on(document,"copy",n=>this.Editor.BlockEvents.handleCommandC(n))}toggleReadOnly(e){e?this.disableModuleBindings():this.enableModuleBindings()}composeBlock({tool:e,data:n={},id:r=void 0,tunes:i={}}){const o=this.Editor.ReadOnly.isEnabled,s=this.Editor.Tools.blockTools.get(e),a=new Lh({id:r,data:n,tool:s,api:this.Editor.API,readOnly:o,tunesData:i},this.eventsDispatcher);return o||window.requestIdleCallback(()=>{this.bindBlockEvents(a)},{timeout:2e3}),a}insert({id:e=void 0,tool:n=this.config.defaultBlock,data:r={},index:i,needToFocus:o=!0,replace:s=!1,tunes:a={}}={}){let l=i;l===void 0&&(l=this.currentBlockIndex+(s?0:1));const c=this.composeBlock({id:e,tool:n,data:r,tunes:a});return s&&this.blockDidMutated(IAe,this.getBlockByIndex(l),{index:l}),this._blocks.insert(l,c,s),this.blockDidMutated(MAe,c,{index:l}),o?this.currentBlockIndex=l:l<=this.currentBlockIndex&&this.currentBlockIndex++,c}insertMany(e,n=0){this._blocks.insertMany(e,n)}async update(e,n,r){if(!n&&!r)return e;const i=await e.data,o=this.composeBlock({id:e.id,tool:e.name,data:Object.assign({},i,n??{}),tunes:r??e.tunes}),s=this.getBlockIndex(e);return this._blocks.replace(s,o),this.blockDidMutated(DAe,o,{index:s}),o}replace(e,n,r){const i=this.getBlockIndex(e);return this.insert({tool:n,data:r,index:i,replace:!0})}paste(e,n,r=!1){const i=this.insert({tool:e,replace:r});try{window.requestIdleCallback(()=>{i.call(Nh.ON_PASTE,n)})}catch(o){Qr(`${e}: onPaste callback call is failed`,"error",o)}return i}insertDefaultBlockAtIndex(e,n=!1){const r=this.composeBlock({tool:this.config.defaultBlock});return this._blocks[e]=r,this.blockDidMutated(MAe,r,{index:e}),n?this.currentBlockIndex=e:e<=this.currentBlockIndex&&this.currentBlockIndex++,r}insertAtEnd(){return this.currentBlockIndex=this.blocks.length-1,this.insert()}async mergeBlocks(e,n){let r;if(e.name===n.name&&e.mergeable){const i=await n.data;if(Xc(i)){console.error("Could not merge Block. Failed to extract original Block data.");return}const[o]=XG([i],e.tool.sanitizeConfig);r=o}else if(e.mergeable&&BM(n,"export")&&BM(e,"import")){const i=await n.exportDataAsString(),o=Gd(i,e.tool.sanitizeConfig);r=F5e(o,e.tool.conversionConfig)}r!==void 0&&(await e.mergeWith(r),this.removeBlock(n),this.currentBlockIndex=this._blocks.indexOf(e))}removeBlock(e,n=!0){return new Promise(r=>{const i=this._blocks.indexOf(e);if(!this.validateIndex(i))throw new Error("Can't find a Block to remove");this._blocks.remove(i),e.destroy(),this.blockDidMutated(IAe,e,{index:i}),this.currentBlockIndex>=i&&this.currentBlockIndex--,this.blocks.length?i===0&&(this.currentBlockIndex=0):(this.unsetCurrentBlock(),n&&this.insert()),r()})}removeSelectedBlocks(){let e;for(let n=this.blocks.length-1;n>=0;n--)this.blocks[n].selected&&(this.removeBlock(this.blocks[n]),e=n);return e}removeAllBlocks(){for(let e=this.blocks.length-1;e>=0;e--)this._blocks.remove(e);this.unsetCurrentBlock(),this.insert(),this.currentBlock.firstInput.focus()}split(){const e=this.Editor.Caret.extractFragmentFromCaretPosition(),n=Rt.make("div");n.appendChild(e);const r={text:Rt.isEmpty(n)?"":n.innerHTML};return this.insert({data:r})}getBlockByIndex(e){return e===-1&&(e=this._blocks.length-1),this._blocks[e]}getBlockIndex(e){return this._blocks.indexOf(e)}getBlockById(e){return this._blocks.array.find(n=>n.id===e)}getBlock(e){Rt.isElement(e)||(e=e.parentNode);const n=this._blocks.nodes,r=e.closest(`.${Lh.CSS.wrapper}`),i=n.indexOf(r);if(i>=0)return this._blocks[i]}setCurrentBlockByChildNode(e){Rt.isElement(e)||(e=e.parentNode);const n=e.closest(`.${Lh.CSS.wrapper}`);if(!n)return;const r=n.closest(`.${this.Editor.UI.CSS.editorWrapper}`);if(r!=null&&r.isEqualNode(this.Editor.UI.nodes.wrapper))return this.currentBlockIndex=this._blocks.nodes.indexOf(n),this.currentBlock.updateCurrentInput(),this.currentBlock}getBlockByChildNode(e){if(!e||!(e instanceof Node))return;Rt.isElement(e)||(e=e.parentNode);const n=e.closest(`.${Lh.CSS.wrapper}`);return this.blocks.find(r=>r.holder===n)}swap(e,n){this._blocks.swap(e,n),this.currentBlockIndex=n}move(e,n=this.currentBlockIndex){if(isNaN(e)||isNaN(n)){Qr("Warning during 'move' call: incorrect indices provided.","warn");return}if(!this.validateIndex(e)||!this.validateIndex(n)){Qr("Warning during 'move' call: indices cannot be lower than 0 or greater than the amount of blocks.","warn");return}this._blocks.move(e,n),this.currentBlockIndex=e,this.blockDidMutated(R8t,this.currentBlock,{fromIndex:n,toIndex:e})}async convert(e,n,r){if(!await e.save())throw new Error("Could not convert Block. Failed to extract original Block data.");const i=this.Editor.Tools.blockTools.get(n);if(!i)throw new Error(`Could not convert Block. Tool «${n}» not found.`);const o=await e.exportDataAsString(),s=Gd(o,i.sanitizeConfig);let a=F5e(s,i.conversionConfig,i.settings);return r&&(a=Object.assign(a,r)),this.replace(e,i.name,a)}unsetCurrentBlock(){this.currentBlockIndex=-1}async clear(e=!1){const n=new V8t;[...this.blocks].forEach(r=>{n.add(async()=>{await this.removeBlock(r,!1)})}),await n.completed,this.unsetCurrentBlock(),e&&this.insert(),this.Editor.UI.checkEmptiness()}async destroy(){await Promise.all(this.blocks.map(e=>e.destroy()))}bindBlockEvents(e){const{BlockEvents:n}=this.Editor;this.readOnlyMutableListeners.on(e.holder,"keydown",r=>{n.keydown(r)}),this.readOnlyMutableListeners.on(e.holder,"keyup",r=>{n.keyup(r)}),this.readOnlyMutableListeners.on(e.holder,"dragover",r=>{n.dragOver(r)}),this.readOnlyMutableListeners.on(e.holder,"dragleave",r=>{n.dragLeave(r)}),e.on("didMutated",r=>this.blockDidMutated(DAe,r,{index:this.getBlockIndex(r)}))}disableModuleBindings(){this.readOnlyMutableListeners.clearAll()}enableModuleBindings(){this.readOnlyMutableListeners.on(document,"cut",e=>this.Editor.BlockEvents.handleCommandX(e)),this.blocks.forEach(e=>{this.bindBlockEvents(e)})}validateIndex(e){return!(e<0||e>=this._blocks.length)}blockDidMutated(e,n,r){const i=new CustomEvent(e,{detail:{target:new Dh(n),...r}});return this.eventsDispatcher.emit(M5e,{event:i}),n}}class U8t extends Ir{constructor(){super(...arguments),this.anyBlockSelectedCache=null,this.needToSelectAll=!1,this.nativeInputSelected=!1,this.readyToBlockSelection=!1}get sanitizerConfig(){return{p:{},h1:{},h2:{},h3:{},h4:{},h5:{},h6:{},ol:{},ul:{},li:{},br:!0,img:{src:!0,width:!0,height:!0},a:{href:!0},b:{},i:{},u:{}}}get allBlocksSelected(){const{BlockManager:e}=this.Editor;return e.blocks.every(n=>n.selected===!0)}set allBlocksSelected(e){const{BlockManager:n}=this.Editor;n.blocks.forEach(r=>{r.selected=e}),this.clearCache()}get anyBlockSelected(){const{BlockManager:e}=this.Editor;return this.anyBlockSelectedCache===null&&(this.anyBlockSelectedCache=e.blocks.some(n=>n.selected===!0)),this.anyBlockSelectedCache}get selectedBlocks(){return this.Editor.BlockManager.blocks.filter(e=>e.selected)}prepare(){this.selection=new er,ix.add({name:"CMD+A",handler:e=>{const{BlockManager:n,ReadOnly:r}=this.Editor;if(r.isEnabled){e.preventDefault(),this.selectAllBlocks();return}n.currentBlock&&this.handleCommandA(e)},on:this.Editor.UI.nodes.redactor})}toggleReadOnly(){er.get().removeAllRanges(),this.allBlocksSelected=!1}unSelectBlockByIndex(e){const{BlockManager:n}=this.Editor;let r;isNaN(e)?r=n.currentBlock:r=n.getBlockByIndex(e),r.selected=!1,this.clearCache()}clearSelection(e,n=!1){const{BlockManager:r,Caret:i,RectangleSelection:o}=this.Editor;this.needToSelectAll=!1,this.nativeInputSelected=!1,this.readyToBlockSelection=!1;const s=e&&e instanceof KeyboardEvent,a=s&&S5e(e.keyCode);if(this.anyBlockSelected&&s&&a&&!er.isSelectionExists){const l=r.removeSelectedBlocks();r.insertDefaultBlockAtIndex(l,!0),i.setToBlock(r.currentBlock),$M(()=>{const c=e.key;i.insertContentAtCaretPosition(c.length>1?"":c)},20)()}if(this.Editor.CrossBlockSelection.clear(e),!this.anyBlockSelected||o.isRectActivated()){this.Editor.RectangleSelection.clearSelection();return}n&&this.selection.restore(),this.allBlocksSelected=!1}copySelectedBlocks(e){e.preventDefault();const n=Rt.make("div");this.selectedBlocks.forEach(o=>{const s=Gd(o.holder.innerHTML,this.sanitizerConfig),a=Rt.make("p");a.innerHTML=s,n.appendChild(a)});const r=Array.from(n.childNodes).map(o=>o.textContent).join(`
230
230
 
231
231
  `),i=n.innerHTML;return e.clipboardData.setData("text/plain",r),e.clipboardData.setData("text/html",i),Promise.all(this.selectedBlocks.map(o=>o.save())).then(o=>{try{e.clipboardData.setData(this.Editor.Paste.MIME_TYPE,JSON.stringify(o))}catch{}})}selectBlockByIndex(e){const{BlockManager:n}=this.Editor,r=n.getBlockByIndex(e);r!==void 0&&this.selectBlock(r)}selectBlock(e){this.selection.save(),er.get().removeAllRanges(),e.selected=!0,this.clearCache(),this.Editor.InlineToolbar.close()}unselectBlock(e){e.selected=!1,this.clearCache()}clearCache(){this.anyBlockSelectedCache=null}destroy(){ix.remove(this.Editor.UI.nodes.redactor,"CMD+A")}handleCommandA(e){if(this.Editor.RectangleSelection.clearSelection(),Rt.isNativeInput(e.target)&&!this.readyToBlockSelection){this.readyToBlockSelection=!0;return}const n=this.Editor.BlockManager.getBlock(e.target),r=n.inputs;if(r.length>1&&!this.readyToBlockSelection){this.readyToBlockSelection=!0;return}if(r.length===1&&!this.needToSelectAll){this.needToSelectAll=!0;return}this.needToSelectAll?(e.preventDefault(),this.selectAllBlocks(),this.needToSelectAll=!1,this.readyToBlockSelection=!1):this.readyToBlockSelection&&(e.preventDefault(),this.selectBlock(n),this.needToSelectAll=!0)}selectAllBlocks(){this.selection.save(),er.get().removeAllRanges(),this.allBlocksSelected=!0,this.Editor.InlineToolbar.close()}}let H8t=class pJ extends Ir{get positions(){return{START:"start",END:"end",DEFAULT:"default"}}static get CSS(){return{shadowCaret:"cdx-shadow-caret"}}setToBlock(e,n=this.positions.DEFAULT,r=0){var i;const{BlockManager:o,BlockSelection:s}=this.Editor;if(s.clearSelection(),!e.focusable){(i=window.getSelection())==null||i.removeAllRanges(),s.selectBlock(e),o.currentBlock=e;return}let a;switch(n){case this.positions.START:a=e.firstInput;break;case this.positions.END:a=e.lastInput;break;default:a=e.currentInput}if(!a)return;let l,c=r;if(n===this.positions.START)l=Rt.getDeepestNode(a,!1),c=0;else if(n===this.positions.END)l=Rt.getDeepestNode(a,!0),c=Rt.getContentLength(l);else{const{node:u,offset:d}=Rt.getNodeByOffset(a,r);u?(l=u,c=d):(l=Rt.getDeepestNode(a,!1),c=0)}this.set(l,c),o.setCurrentBlockByChildNode(e.holder),o.currentBlock.currentInput=a}setToInput(e,n=this.positions.DEFAULT,r=0){const{currentBlock:i}=this.Editor.BlockManager,o=Rt.getDeepestNode(e);switch(n){case this.positions.START:this.set(o,0);break;case this.positions.END:this.set(o,Rt.getContentLength(o));break;default:r&&this.set(o,r)}i.currentInput=e}set(e,n=0){const{top:r,bottom:i}=er.setCursor(e,n),{innerHeight:o}=window;r<0?window.scrollBy(0,r-30):i>o&&window.scrollBy(0,i-o+30)}setToTheLastBlock(){const e=this.Editor.BlockManager.lastBlock;if(e)if(e.tool.isDefault&&e.isEmpty)this.setToBlock(e);else{const n=this.Editor.BlockManager.insertAtEnd();this.setToBlock(n)}}extractFragmentFromCaretPosition(){const e=er.get();if(e.rangeCount){const n=e.getRangeAt(0),r=this.Editor.BlockManager.currentBlock.currentInput;if(n.deleteContents(),r)if(Rt.isNativeInput(r)){const i=r,o=document.createDocumentFragment(),s=i.value.substring(0,i.selectionStart),a=i.value.substring(i.selectionStart);return o.textContent=a,i.value=s,o}else{const i=n.cloneRange();return i.selectNodeContents(r),i.setStart(n.endContainer,n.endOffset),i.extractContents()}}}navigateNext(e=!1){const{BlockManager:n}=this.Editor,{currentBlock:r,nextBlock:i}=n;if(r===void 0)return!1;const{nextInput:o,currentInput:s}=r,a=s!==void 0?KM(s):void 0;let l=i;const c=e||a||!r.focusable;if(o&&c)return this.setToInput(o,this.positions.START),!0;if(l===null){if(r.tool.isDefault||!c)return!1;l=n.insertAtEnd()}return c?(this.setToBlock(l,this.positions.START),!0):!1}navigatePrevious(e=!1){const{currentBlock:n,previousBlock:r}=this.Editor.BlockManager;if(!n)return!1;const{previousInput:i,currentInput:o}=n,s=o!==void 0?WM(o):void 0,a=e||s||!n.focusable;return i&&a?(this.setToInput(i,this.positions.END),!0):r!==null&&a?(this.setToBlock(r,this.positions.END),!0):!1}createShadow(e){const n=document.createElement("span");n.classList.add(pJ.CSS.shadowCaret),e.insertAdjacentElement("beforeend",n)}restoreCaret(e){const n=e.querySelector(`.${pJ.CSS.shadowCaret}`);if(!n)return;new er().expandToTag(n);const r=document.createRange();r.selectNode(n),r.extractContents()}insertContentAtCaretPosition(e){const n=document.createDocumentFragment(),r=document.createElement("div"),i=er.get(),o=er.range;r.innerHTML=e,Array.from(r.childNodes).forEach(c=>n.appendChild(c)),n.childNodes.length===0&&n.appendChild(new Text);const s=n.lastChild;o.deleteContents(),o.insertNode(n);const a=document.createRange(),l=s.nodeType===Node.TEXT_NODE?s:s.firstChild;l!==null&&l.textContent!==null&&a.setStart(l,l.textContent.length),i.removeAllRanges(),i.addRange(a)}};class G8t extends Ir{constructor(){super(...arguments),this.onMouseUp=()=>{this.listeners.off(document,"mouseover",this.onMouseOver),this.listeners.off(document,"mouseup",this.onMouseUp)},this.onMouseOver=e=>{const{BlockManager:n,BlockSelection:r}=this.Editor;if(e.relatedTarget===null&&e.target===null)return;const i=n.getBlockByChildNode(e.relatedTarget)||this.lastSelectedBlock,o=n.getBlockByChildNode(e.target);if(!(!i||!o)&&o!==i){if(i===this.firstSelectedBlock){er.get().removeAllRanges(),i.selected=!0,o.selected=!0,r.clearCache();return}if(o===this.firstSelectedBlock){i.selected=!1,o.selected=!1,r.clearCache();return}this.Editor.InlineToolbar.close(),this.toggleBlocksSelectedState(i,o),this.lastSelectedBlock=o}}}async prepare(){this.listeners.on(document,"mousedown",e=>{this.enableCrossBlockSelection(e)})}watchSelection(e){if(e.button!==I6t.LEFT)return;const{BlockManager:n}=this.Editor;this.firstSelectedBlock=n.getBlock(e.target),this.lastSelectedBlock=this.firstSelectedBlock,this.listeners.on(document,"mouseover",this.onMouseOver),this.listeners.on(document,"mouseup",this.onMouseUp)}get isCrossBlockSelectionStarted(){return!!this.firstSelectedBlock&&!!this.lastSelectedBlock&&this.firstSelectedBlock!==this.lastSelectedBlock}toggleBlockSelectedState(e=!0){const{BlockManager:n,BlockSelection:r}=this.Editor;this.lastSelectedBlock||(this.lastSelectedBlock=this.firstSelectedBlock=n.currentBlock),this.firstSelectedBlock===this.lastSelectedBlock&&(this.firstSelectedBlock.selected=!0,r.clearCache(),er.get().removeAllRanges());const i=n.blocks.indexOf(this.lastSelectedBlock)+(e?1:-1),o=n.blocks[i];o&&(this.lastSelectedBlock.selected!==o.selected?(o.selected=!0,r.clearCache()):(this.lastSelectedBlock.selected=!1,r.clearCache()),this.lastSelectedBlock=o,this.Editor.InlineToolbar.close(),o.holder.scrollIntoView({block:"nearest"}))}clear(e){const{BlockManager:n,BlockSelection:r,Caret:i}=this.Editor,o=n.blocks.indexOf(this.firstSelectedBlock),s=n.blocks.indexOf(this.lastSelectedBlock);if(r.anyBlockSelected&&o>-1&&s>-1&&e&&e instanceof KeyboardEvent)switch(e.keyCode){case ur.DOWN:case ur.RIGHT:i.setToBlock(n.blocks[Math.max(o,s)],i.positions.END);break;case ur.UP:case ur.LEFT:i.setToBlock(n.blocks[Math.min(o,s)],i.positions.START);break;default:i.setToBlock(n.blocks[Math.max(o,s)],i.positions.END)}this.firstSelectedBlock=this.lastSelectedBlock=null}enableCrossBlockSelection(e){const{UI:n}=this.Editor;er.isCollapsed||this.Editor.BlockSelection.clearSelection(e),n.nodes.redactor.contains(e.target)?this.watchSelection(e):this.Editor.BlockSelection.clearSelection(e)}toggleBlocksSelectedState(e,n){const{BlockManager:r,BlockSelection:i}=this.Editor,o=r.blocks.indexOf(e),s=r.blocks.indexOf(n),a=e.selected!==n.selected;for(let l=Math.min(o,s);l<=Math.max(o,s);l++){const c=r.blocks[l];c!==this.firstSelectedBlock&&c!==(a?e:n)&&(r.blocks[l].selected=!r.blocks[l].selected,i.clearCache())}}}class W8t extends Ir{constructor(){super(...arguments),this.isStartedAtEditor=!1}toggleReadOnly(e){e?this.disableModuleBindings():this.enableModuleBindings()}enableModuleBindings(){const{UI:e}=this.Editor;this.readOnlyMutableListeners.on(e.nodes.holder,"drop",async n=>{await this.processDrop(n)},!0),this.readOnlyMutableListeners.on(e.nodes.holder,"dragstart",()=>{this.processDragStart()}),this.readOnlyMutableListeners.on(e.nodes.holder,"dragover",n=>{this.processDragOver(n)},!0)}disableModuleBindings(){this.readOnlyMutableListeners.clearAll()}async processDrop(e){const{BlockManager:n,Paste:r,Caret:i}=this.Editor;e.preventDefault(),n.blocks.forEach(s=>{s.dropTarget=!1}),er.isAtEditor&&!er.isCollapsed&&this.isStartedAtEditor&&document.execCommand("delete"),this.isStartedAtEditor=!1;const o=n.setCurrentBlockByChildNode(e.target);if(o)this.Editor.Caret.setToBlock(o,i.positions.END);else{const s=n.setCurrentBlockByChildNode(n.lastBlock.holder);this.Editor.Caret.setToBlock(s,i.positions.END)}await r.processDataTransfer(e.dataTransfer,!0)}processDragStart(){er.isAtEditor&&!er.isCollapsed&&(this.isStartedAtEditor=!0),this.Editor.InlineToolbar.close()}processDragOver(e){e.preventDefault()}}const K8t=180,q8t=400;class Y8t extends Ir{constructor({config:e,eventsDispatcher:n}){super({config:e,eventsDispatcher:n}),this.disabled=!1,this.batchingTimeout=null,this.batchingOnChangeQueue=new Map,this.batchTime=q8t,this.mutationObserver=new MutationObserver(r=>{this.redactorChanged(r)}),this.eventsDispatcher.on(M5e,r=>{this.particularBlockChanged(r.event)}),this.eventsDispatcher.on(D5e,()=>{this.disable()}),this.eventsDispatcher.on(N5e,()=>{this.enable()})}enable(){this.mutationObserver.observe(this.Editor.UI.nodes.redactor,{childList:!0,subtree:!0,characterData:!0,attributes:!0}),this.disabled=!1}disable(){this.mutationObserver.disconnect(),this.disabled=!0}particularBlockChanged(e){this.disabled||!bo(this.config.onChange)||(this.batchingOnChangeQueue.set(`block:${e.detail.target.id}:event:${e.type}`,e),this.batchingTimeout&&clearTimeout(this.batchingTimeout),this.batchingTimeout=setTimeout(()=>{let n;this.batchingOnChangeQueue.size===1?n=this.batchingOnChangeQueue.values().next().value:n=Array.from(this.batchingOnChangeQueue.values()),this.config.onChange&&this.config.onChange(this.Editor.API.methods,n),this.batchingOnChangeQueue.clear()},this.batchTime))}redactorChanged(e){this.eventsDispatcher.emit(YG,{mutations:e})}}const NAe=class uze extends Ir{constructor(){super(...arguments),this.MIME_TYPE="application/x-editor-js",this.toolsTags={},this.tagsByTool={},this.toolsPatterns=[],this.toolsFiles={},this.exceptionList=[],this.processTool=e=>{try{const n=e.create({},{},!1);if(e.pasteConfig===!1){this.exceptionList.push(e.name);return}if(!bo(n.onPaste))return;this.getTagsConfig(e),this.getFilesConfig(e),this.getPatternsConfig(e)}catch(n){Qr(`Paste handling for «${e.name}» Tool hasn't been set up because of the error`,"warn",n)}},this.handlePasteEvent=async e=>{const{BlockManager:n,Toolbar:r}=this.Editor,i=n.setCurrentBlockByChildNode(e.target);!i||this.isNativeBehaviour(e.target)&&!e.clipboardData.types.includes("Files")||i&&this.exceptionList.includes(i.name)||(e.preventDefault(),this.processDataTransfer(e.clipboardData),r.close())}}async prepare(){this.processTools()}toggleReadOnly(e){e?this.unsetCallback():this.setCallback()}async processDataTransfer(e,n=!1){const{Tools:r}=this.Editor,i=e.types;if((i.includes?i.includes("Files"):i.contains("Files"))&&!Xc(this.toolsFiles)){await this.processFiles(e.files);return}const o=e.getData(this.MIME_TYPE),s=e.getData("text/plain");let a=e.getData("text/html");if(o)try{this.insertEditorJSData(JSON.parse(o));return}catch{}n&&s.trim()&&a.trim()&&(a="<p>"+(a.trim()?a:s)+"</p>");const l=Object.keys(this.toolsTags).reduce((d,p)=>(d[p.toLowerCase()]=this.toolsTags[p].sanitizationConfig??{},d),{}),c=Object.assign({},l,r.getAllInlineToolsSanitizeConfig(),{br:{}}),u=Gd(a,c);!u.trim()||u.trim()===s||!Rt.isHTMLString(u)?await this.processText(s):await this.processText(u,!0)}async processText(e,n=!1){const{Caret:r,BlockManager:i}=this.Editor,o=n?this.processHTML(e):this.processPlain(e);if(!o.length)return;if(o.length===1){o[0].isBlock?this.processSingleBlock(o.pop()):this.processInlinePaste(o.pop());return}const s=i.currentBlock&&i.currentBlock.tool.isDefault&&i.currentBlock.isEmpty;o.map(async(a,l)=>this.insertBlock(a,l===0&&s)),i.currentBlock&&r.setToBlock(i.currentBlock,r.positions.END)}setCallback(){this.listeners.on(this.Editor.UI.nodes.holder,"paste",this.handlePasteEvent)}unsetCallback(){this.listeners.off(this.Editor.UI.nodes.holder,"paste",this.handlePasteEvent)}processTools(){const e=this.Editor.Tools.blockTools;Array.from(e.values()).forEach(this.processTool)}collectTagNames(e){return Mh(e)?[e]:oa(e)?Object.keys(e):[]}getTagsConfig(e){if(e.pasteConfig===!1)return;const n=e.pasteConfig.tags||[],r=[];n.forEach(i=>{const o=this.collectTagNames(i);r.push(...o),o.forEach(s=>{if(Object.prototype.hasOwnProperty.call(this.toolsTags,s)){Qr(`Paste handler for «${e.name}» Tool on «${s}» tag is skipped because it is already used by «${this.toolsTags[s].tool.name}» Tool.`,"warn");return}const a=oa(i)?i[s]:null;this.toolsTags[s.toUpperCase()]={tool:e,sanitizationConfig:a}})}),this.tagsByTool[e.name]=r.map(i=>i.toUpperCase())}getFilesConfig(e){if(e.pasteConfig===!1)return;const{files:n={}}=e.pasteConfig;let{extensions:r,mimeTypes:i}=n;!r&&!i||(r&&!Array.isArray(r)&&(Qr(`«extensions» property of the onDrop config for «${e.name}» Tool should be an array`),r=[]),i&&!Array.isArray(i)&&(Qr(`«mimeTypes» property of the onDrop config for «${e.name}» Tool should be an array`),i=[]),i&&(i=i.filter(o=>O6t(o)?!0:(Qr(`MIME type value «${o}» for the «${e.name}» Tool is not a valid MIME type`,"warn"),!1))),this.toolsFiles[e.name]={extensions:r||[],mimeTypes:i||[]})}getPatternsConfig(e){e.pasteConfig===!1||!e.pasteConfig.patterns||Xc(e.pasteConfig.patterns)||Object.entries(e.pasteConfig.patterns).forEach(([n,r])=>{r instanceof RegExp||Qr(`Pattern ${r} for «${e.name}» Tool is skipped because it should be a Regexp instance.`,"warn"),this.toolsPatterns.push({key:n,pattern:r,tool:e})})}isNativeBehaviour(e){return Rt.isNativeInput(e)}async processFiles(e){const{BlockManager:n}=this.Editor;let r;r=await Promise.all(Array.from(e).map(o=>this.processFile(o))),r=r.filter(o=>!!o);const i=n.currentBlock.tool.isDefault&&n.currentBlock.isEmpty;r.forEach((o,s)=>{n.paste(o.type,o.event,s===0&&i)})}async processFile(e){const n=L6t(e),r=Object.entries(this.toolsFiles).find(([o,{mimeTypes:s,extensions:a}])=>{const[l,c]=e.type.split("/"),u=a.find(p=>p.toLowerCase()===n.toLowerCase()),d=s.find(p=>{const[g,b]=p.split("/");return g===l&&(b===c||b==="*")});return!!u||!!d});if(!r)return;const[i]=r;return{event:this.composePasteEvent("file",{file:e}),type:i}}processHTML(e){const{Tools:n}=this.Editor,r=Rt.make("DIV");return r.innerHTML=e,this.getNodes(r).map(i=>{let o,s=n.defaultTool,a=!1;switch(i.nodeType){case Node.DOCUMENT_FRAGMENT_NODE:o=Rt.make("div"),o.appendChild(i);break;case Node.ELEMENT_NODE:o=i,a=!0,this.toolsTags[o.tagName]&&(s=this.toolsTags[o.tagName].tool);break}const{tags:l}=s.pasteConfig||{tags:[]},c=l.reduce((p,g)=>(this.collectTagNames(g).forEach(b=>{const w=oa(g)?g[b]:null;p[b.toLowerCase()]=w||{}}),p),{}),u=Object.assign({},c,s.baseSanitizeConfig);if(o.tagName.toLowerCase()==="table"){const p=Gd(o.outerHTML,u);o=Rt.make("div",void 0,{innerHTML:p}).firstChild}else o.innerHTML=Gd(o.innerHTML,u);const d=this.composePasteEvent("tag",{data:o});return{content:o,isBlock:a,tool:s.name,event:d}}).filter(i=>{const o=Rt.isEmpty(i.content),s=Rt.isSingleTag(i.content);return!o||s})}processPlain(e){const{defaultBlock:n}=this.config;if(!e)return[];const r=n;return e.split(/\r?\n/).filter(i=>i.trim()).map(i=>{const o=Rt.make("div");o.textContent=i;const s=this.composePasteEvent("tag",{data:o});return{content:o,tool:r,isBlock:!1,event:s}})}async processSingleBlock(e){const{Caret:n,BlockManager:r}=this.Editor,{currentBlock:i}=r;if(!i||e.tool!==i.name||!Rt.containsOnlyInlineElements(e.content.innerHTML)){this.insertBlock(e,i?.tool.isDefault&&i.isEmpty);return}n.insertContentAtCaretPosition(e.content.innerHTML)}async processInlinePaste(e){const{BlockManager:n,Caret:r}=this.Editor,{content:i}=e;if(n.currentBlock&&n.currentBlock.tool.isDefault&&i.textContent.length<uze.PATTERN_PROCESSING_MAX_LENGTH){const o=await this.processPattern(i.textContent);if(o){const s=n.currentBlock&&n.currentBlock.tool.isDefault&&n.currentBlock.isEmpty,a=n.paste(o.tool,o.event,s);r.setToBlock(a,r.positions.END);return}}if(n.currentBlock&&n.currentBlock.currentInput){const o=n.currentBlock.tool.baseSanitizeConfig;document.execCommand("insertHTML",!1,Gd(i.innerHTML,o))}else this.insertBlock(e)}async processPattern(e){const n=this.toolsPatterns.find(r=>{const i=r.pattern.exec(e);return i?e===i.shift():!1});return n?{event:this.composePasteEvent("pattern",{key:n.key,data:e}),tool:n.tool.name}:void 0}insertBlock(e,n=!1){const{BlockManager:r,Caret:i}=this.Editor,{currentBlock:o}=r;let s;if(n&&o&&o.isEmpty){s=r.paste(e.tool,e.event,!0),i.setToBlock(s,i.positions.END);return}s=r.paste(e.tool,e.event),i.setToBlock(s,i.positions.END)}insertEditorJSData(e){const{BlockManager:n,Caret:r,Tools:i}=this.Editor;XG(e,o=>i.blockTools.get(o).sanitizeConfig).forEach(({tool:o,data:s},a)=>{let l=!1;a===0&&(l=n.currentBlock&&n.currentBlock.tool.isDefault&&n.currentBlock.isEmpty);const c=n.insert({tool:o,data:s,replace:l});r.setToBlock(c,r.positions.END)})}processElementNode(e,n,r){const i=Object.keys(this.toolsTags),o=e,{tool:s}=this.toolsTags[o.tagName]||{},a=this.tagsByTool[s?.name]||[],l=i.includes(o.tagName),c=Rt.blockElements.includes(o.tagName.toLowerCase()),u=Array.from(o.children).some(({tagName:p})=>i.includes(p)&&!a.includes(p)),d=Array.from(o.children).some(({tagName:p})=>Rt.blockElements.includes(p.toLowerCase()));if(!c&&!l&&!u)return r.appendChild(o),[...n,r];if(l&&!u||c&&!d&&!u)return[...n,r,o]}getNodes(e){const n=Array.from(e.childNodes);let r;const i=(o,s)=>{if(Rt.isEmpty(s)&&!Rt.isSingleTag(s))return o;const a=o[o.length-1];let l=new DocumentFragment;switch(a&&Rt.isFragment(a)&&(l=o.pop()),s.nodeType){case Node.ELEMENT_NODE:if(r=this.processElementNode(s,o,l),r)return r;break;case Node.TEXT_NODE:return l.appendChild(s),[...o,l];default:return[...o,l]}return[...o,...Array.from(s.childNodes).reduce(i,[])]};return n.reduce(i,[])}composePasteEvent(e,n){return new CustomEvent(e,{detail:n})}};NAe.PATTERN_PROCESSING_MAX_LENGTH=450;let Z8t=NAe;class X8t extends Ir{constructor(){super(...arguments),this.toolsDontSupportReadOnly=[],this.readOnlyEnabled=!1}get isEnabled(){return this.readOnlyEnabled}async prepare(){const{Tools:e}=this.Editor,{blockTools:n}=e,r=[];Array.from(n.entries()).forEach(([i,o])=>{o.isReadOnlySupported||r.push(i)}),this.toolsDontSupportReadOnly=r,this.config.readOnly&&r.length>0&&this.throwCriticalError(),this.toggle(this.config.readOnly,!0)}async toggle(e=!this.readOnlyEnabled,n=!1){e&&this.toolsDontSupportReadOnly.length>0&&this.throwCriticalError();const r=this.readOnlyEnabled;this.readOnlyEnabled=e;for(const o in this.Editor)this.Editor[o].toggleReadOnly&&this.Editor[o].toggleReadOnly(e);if(r===e)return this.readOnlyEnabled;if(n)return this.readOnlyEnabled;this.Editor.ModificationsObserver.disable();const i=await this.Editor.Saver.save();return await this.Editor.BlockManager.clear(),await this.Editor.Renderer.render(i.blocks),this.Editor.ModificationsObserver.enable(),this.readOnlyEnabled}throwCriticalError(){throw new I5e(`To enable read-only mode all connected tools should support it. Tools ${this.toolsDontSupportReadOnly.join(", ")} don't support read-only mode.`)}}let Q8t=class l8 extends Ir{constructor(){super(...arguments),this.isRectSelectionActivated=!1,this.SCROLL_SPEED=3,this.HEIGHT_OF_SCROLL_ZONE=40,this.BOTTOM_SCROLL_ZONE=1,this.TOP_SCROLL_ZONE=2,this.MAIN_MOUSE_BUTTON=0,this.mousedown=!1,this.isScrolling=!1,this.inScrollZone=null,this.startX=0,this.startY=0,this.mouseX=0,this.mouseY=0,this.stackOfSelected=[],this.listenerIds=[]}static get CSS(){return{overlay:"codex-editor-overlay",overlayContainer:"codex-editor-overlay__container",rect:"codex-editor-overlay__rectangle",topScrollZone:"codex-editor-overlay__scroll-zone--top",bottomScrollZone:"codex-editor-overlay__scroll-zone--bottom"}}prepare(){this.enableModuleBindings()}startSelection(e,n){const r=document.elementFromPoint(e-window.pageXOffset,n-window.pageYOffset);r.closest(`.${this.Editor.Toolbar.CSS.toolbar}`)||(this.Editor.BlockSelection.allBlocksSelected=!1,this.clearSelection(),this.stackOfSelected=[]);const i=[`.${Lh.CSS.content}`,`.${this.Editor.Toolbar.CSS.toolbar}`,`.${this.Editor.InlineToolbar.CSS.inlineToolbar}`],o=r.closest("."+this.Editor.UI.CSS.editorWrapper),s=i.some(a=>!!r.closest(a));!o||s||(this.mousedown=!0,this.startX=e,this.startY=n)}endSelection(){this.mousedown=!1,this.startX=0,this.startY=0,this.overlayRectangle.style.display="none"}isRectActivated(){return this.isRectSelectionActivated}clearSelection(){this.isRectSelectionActivated=!1}enableModuleBindings(){const{container:e}=this.genHTML();this.listeners.on(e,"mousedown",n=>{this.processMouseDown(n)},!1),this.listeners.on(document.body,"mousemove",HG(n=>{this.processMouseMove(n)},10),{passive:!0}),this.listeners.on(document.body,"mouseleave",()=>{this.processMouseLeave()}),this.listeners.on(window,"scroll",HG(n=>{this.processScroll(n)},10),{passive:!0}),this.listeners.on(document.body,"mouseup",()=>{this.processMouseUp()},!1)}processMouseDown(e){e.button===this.MAIN_MOUSE_BUTTON&&(e.target.closest(Rt.allInputsSelector)!==null||this.startSelection(e.pageX,e.pageY))}processMouseMove(e){this.changingRectangle(e),this.scrollByZones(e.clientY)}processMouseLeave(){this.clearSelection(),this.endSelection()}processScroll(e){this.changingRectangle(e)}processMouseUp(){this.clearSelection(),this.endSelection()}scrollByZones(e){if(this.inScrollZone=null,e<=this.HEIGHT_OF_SCROLL_ZONE&&(this.inScrollZone=this.TOP_SCROLL_ZONE),document.documentElement.clientHeight-e<=this.HEIGHT_OF_SCROLL_ZONE&&(this.inScrollZone=this.BOTTOM_SCROLL_ZONE),!this.inScrollZone){this.isScrolling=!1;return}this.isScrolling||(this.scrollVertical(this.inScrollZone===this.TOP_SCROLL_ZONE?-this.SCROLL_SPEED:this.SCROLL_SPEED),this.isScrolling=!0)}genHTML(){const{UI:e}=this.Editor,n=e.nodes.holder.querySelector("."+e.CSS.editorWrapper),r=Rt.make("div",l8.CSS.overlay,{}),i=Rt.make("div",l8.CSS.overlayContainer,{}),o=Rt.make("div",l8.CSS.rect,{});return i.appendChild(o),r.appendChild(i),n.appendChild(r),this.overlayRectangle=o,{container:n,overlay:r}}scrollVertical(e){if(!(this.inScrollZone&&this.mousedown))return;const n=window.pageYOffset;window.scrollBy(0,e),this.mouseY+=window.pageYOffset-n,setTimeout(()=>{this.scrollVertical(e)},0)}changingRectangle(e){if(!this.mousedown)return;e.pageY!==void 0&&(this.mouseX=e.pageX,this.mouseY=e.pageY);const{rightPos:n,leftPos:r,index:i}=this.genInfoForMouseSelection(),o=this.startX>n&&this.mouseX>n,s=this.startX<r&&this.mouseX<r;this.rectCrossesBlocks=!(o||s),this.isRectSelectionActivated||(this.rectCrossesBlocks=!1,this.isRectSelectionActivated=!0,this.shrinkRectangleToPoint(),this.overlayRectangle.style.display="block"),this.updateRectangleSize(),this.Editor.Toolbar.close(),i!==void 0&&(this.trySelectNextBlock(i),this.inverseSelection(),er.get().removeAllRanges())}shrinkRectangleToPoint(){this.overlayRectangle.style.left=`${this.startX-window.pageXOffset}px`,this.overlayRectangle.style.top=`${this.startY-window.pageYOffset}px`,this.overlayRectangle.style.bottom=`calc(100% - ${this.startY-window.pageYOffset}px`,this.overlayRectangle.style.right=`calc(100% - ${this.startX-window.pageXOffset}px`}inverseSelection(){const e=this.Editor.BlockManager.getBlockByIndex(this.stackOfSelected[0]).selected;if(this.rectCrossesBlocks&&!e)for(const n of this.stackOfSelected)this.Editor.BlockSelection.selectBlockByIndex(n);if(!this.rectCrossesBlocks&&e)for(const n of this.stackOfSelected)this.Editor.BlockSelection.unSelectBlockByIndex(n)}updateRectangleSize(){this.mouseY>=this.startY?(this.overlayRectangle.style.top=`${this.startY-window.pageYOffset}px`,this.overlayRectangle.style.bottom=`calc(100% - ${this.mouseY-window.pageYOffset}px`):(this.overlayRectangle.style.bottom=`calc(100% - ${this.startY-window.pageYOffset}px`,this.overlayRectangle.style.top=`${this.mouseY-window.pageYOffset}px`),this.mouseX>=this.startX?(this.overlayRectangle.style.left=`${this.startX-window.pageXOffset}px`,this.overlayRectangle.style.right=`calc(100% - ${this.mouseX-window.pageXOffset}px`):(this.overlayRectangle.style.right=`calc(100% - ${this.startX-window.pageXOffset}px`,this.overlayRectangle.style.left=`${this.mouseX-window.pageXOffset}px`)}genInfoForMouseSelection(){const e=document.body.offsetWidth/2,n=this.mouseY-window.pageYOffset,r=document.elementFromPoint(e,n),i=this.Editor.BlockManager.getBlockByChildNode(r);let o;i!==void 0&&(o=this.Editor.BlockManager.blocks.findIndex(u=>u.holder===i.holder));const s=this.Editor.BlockManager.lastBlock.holder.querySelector("."+Lh.CSS.content),a=Number.parseInt(window.getComputedStyle(s).width,10)/2,l=e-a,c=e+a;return{index:o,leftPos:l,rightPos:c}}addBlockInSelection(e){this.rectCrossesBlocks&&this.Editor.BlockSelection.selectBlockByIndex(e),this.stackOfSelected.push(e)}trySelectNextBlock(e){const n=this.stackOfSelected[this.stackOfSelected.length-1]===e,r=this.stackOfSelected.length,i=1,o=-1,s=0;if(n)return;const a=this.stackOfSelected[r-1]-this.stackOfSelected[r-2]>0;let l=s;r>1&&(l=a?i:o);const c=e>this.stackOfSelected[r-1]&&l===i,u=e<this.stackOfSelected[r-1]&&l===o,d=!(c||u||l===s);if(!d&&(e>this.stackOfSelected[r-1]||this.stackOfSelected[r-1]===void 0)){let b=this.stackOfSelected[r-1]+1||e;for(b;b<=e;b++)this.addBlockInSelection(b);return}if(!d&&e<this.stackOfSelected[r-1]){for(let b=this.stackOfSelected[r-1]-1;b>=e;b--)this.addBlockInSelection(b);return}if(!d)return;let p=r-1,g;for(e>this.stackOfSelected[r-1]?g=()=>e>this.stackOfSelected[p]:g=()=>e<this.stackOfSelected[p];g();)this.rectCrossesBlocks&&this.Editor.BlockSelection.unSelectBlockByIndex(this.stackOfSelected[p]),this.stackOfSelected.pop(),p--}};class J8t extends Ir{async render(e){return new Promise(n=>{const{Tools:r,BlockManager:i}=this.Editor;if(e.length===0)i.insert();else{const o=e.map(({type:s,data:a,tunes:l,id:c})=>{r.available.has(s)===!1&&(Zc(`Tool «${s}» is not found. Check 'tools' property at the Editor.js config.`,"warn"),a=this.composeStubDataForTool(s,a,c),s=r.stubTool);let u;try{u=i.composeBlock({id:c,tool:s,data:a,tunes:l})}catch(d){Qr(`Block «${s}» skipped because of plugins error`,"error",{data:a,error:d}),a=this.composeStubDataForTool(s,a,c),s=r.stubTool,u=i.composeBlock({id:c,tool:s,data:a,tunes:l})}return u});i.insertMany(o)}window.requestIdleCallback(()=>{n()},{timeout:2e3})})}composeStubDataForTool(e,n,r){const{Tools:i}=this.Editor;let o=e;if(i.unavailable.has(e)){const s=i.unavailable.get(e).toolbox;s!==void 0&&s[0].title!==void 0&&(o=s[0].title)}return{savedData:{id:r,type:e,data:n},title:o}}}class eOt extends Ir{async save(){const{BlockManager:e,Tools:n}=this.Editor,r=e.blocks,i=[];try{r.forEach(a=>{i.push(this.getSavedData(a))});const o=await Promise.all(i),s=await XG(o,a=>n.blockTools.get(a).sanitizeConfig);return this.makeOutput(s)}catch(o){Zc("Saving failed due to the Error %o","error",o)}}async getSavedData(e){const n=await e.save(),r=n&&await e.validate(n.data);return{...n,isValid:r}}makeOutput(e){const n=[];return e.forEach(({id:r,tool:i,data:o,tunes:s,isValid:a})=>{if(!a){Qr(`Block «${i}» skipped because saved data is invalid`);return}if(i===this.Editor.Tools.stubTool){n.push(o);return}const l={id:r,type:i,data:o,...!Xc(s)&&{tunes:s}};n.push(l)}),{time:+new Date,blocks:n,version:"2.31.3"}}}(function(){try{if(typeof document<"u"){var t=document.createElement("style");t.appendChild(document.createTextNode(".ce-paragraph{line-height:1.6em;outline:none}.ce-block:only-of-type .ce-paragraph[data-placeholder-active]:empty:before,.ce-block:only-of-type .ce-paragraph[data-placeholder-active][data-empty=true]:before{content:attr(data-placeholder-active)}.ce-paragraph p:first-of-type{margin-top:0}.ce-paragraph p:last-of-type{margin-bottom:0}")),document.head.appendChild(t)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();const tOt='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M8 9V7.2C8 7.08954 8.08954 7 8.2 7L12 7M16 9V7.2C16 7.08954 15.9105 7 15.8 7L12 7M12 7L12 17M12 17H10M12 17H14"/></svg>';function nOt(t){const e=document.createElement("div");e.innerHTML=t.trim();const n=document.createDocumentFragment();return n.append(...Array.from(e.childNodes)),n}class JW{static get DEFAULT_PLACEHOLDER(){return""}constructor({data:e,config:n,api:r,readOnly:i}){this.api=r,this.readOnly=i,this._CSS={block:this.api.styles.block,wrapper:"ce-paragraph"},this.readOnly||(this.onKeyUp=this.onKeyUp.bind(this)),this._placeholder=n.placeholder?n.placeholder:JW.DEFAULT_PLACEHOLDER,this._data=e??{},this._element=null,this._preserveBlank=n.preserveBlank??!1}onKeyUp(e){if(e.code!=="Backspace"&&e.code!=="Delete"||!this._element)return;const{textContent:n}=this._element;n===""&&(this._element.innerHTML="")}drawView(){const e=document.createElement("DIV");return e.classList.add(this._CSS.wrapper,this._CSS.block),e.contentEditable="false",e.dataset.placeholderActive=this.api.i18n.t(this._placeholder),this._data.text&&(e.innerHTML=this._data.text),this.readOnly||(e.contentEditable="true",e.addEventListener("keyup",this.onKeyUp)),e}render(){return this._element=this.drawView(),this._element}merge(e){if(!this._element)return;this._data.text+=e.text;const n=nOt(e.text);this._element.appendChild(n),this._element.normalize()}validate(e){return!(e.text.trim()===""&&!this._preserveBlank)}save(e){return{text:e.innerHTML}}onPaste(e){const n={text:e.detail.data.innerHTML};this._data=n,window.requestAnimationFrame(()=>{this._element&&(this._element.innerHTML=this._data.text||"")})}static get conversionConfig(){return{export:"text",import:"text"}}static get sanitize(){return{text:{br:!0}}}static get isReadOnlySupported(){return!0}static get pasteConfig(){return{tags:["P"]}}static get toolbox(){return{icon:tOt,title:"Text"}}}class eK{constructor(){this.commandName="bold"}static get sanitize(){return{b:{}}}render(){return{icon:PNt,name:"bold",onActivate:()=>{document.execCommand(this.commandName)},isActive:()=>document.queryCommandState(this.commandName)}}get shortcut(){return"CMD+B"}}eK.isInline=!0,eK.title="Bold";class tK{constructor(){this.commandName="italic",this.CSS={button:"ce-inline-tool",buttonActive:"ce-inline-tool--active",buttonModifier:"ce-inline-tool--italic"},this.nodes={button:null}}static get sanitize(){return{i:{}}}render(){return this.nodes.button=document.createElement("button"),this.nodes.button.type="button",this.nodes.button.classList.add(this.CSS.button,this.CSS.buttonModifier),this.nodes.button.innerHTML=ONt,this.nodes.button}surround(){document.execCommand(this.commandName)}checkState(){const e=document.queryCommandState(this.commandName);return this.nodes.button.classList.toggle(this.CSS.buttonActive,e),e}get shortcut(){return"CMD+I"}}tK.isInline=!0,tK.title="Italic";class nK{constructor({api:e}){this.commandLink="createLink",this.commandUnlink="unlink",this.ENTER_KEY=13,this.CSS={button:"ce-inline-tool",buttonActive:"ce-inline-tool--active",buttonModifier:"ce-inline-tool--link",buttonUnlink:"ce-inline-tool--unlink",input:"ce-inline-tool-input",inputShowed:"ce-inline-tool-input--showed"},this.nodes={button:null,input:null},this.inputOpened=!1,this.toolbar=e.toolbar,this.inlineToolbar=e.inlineToolbar,this.notifier=e.notifier,this.i18n=e.i18n,this.selection=new er}static get sanitize(){return{a:{href:!0,target:"_blank",rel:"nofollow"}}}render(){return this.nodes.button=document.createElement("button"),this.nodes.button.type="button",this.nodes.button.classList.add(this.CSS.button,this.CSS.buttonModifier),this.nodes.button.innerHTML=U5e,this.nodes.button}renderActions(){return this.nodes.input=document.createElement("input"),this.nodes.input.placeholder=this.i18n.t("Add a link"),this.nodes.input.enterKeyHint="done",this.nodes.input.classList.add(this.CSS.input),this.nodes.input.addEventListener("keydown",e=>{e.keyCode===this.ENTER_KEY&&this.enterPressed(e)}),this.nodes.input}surround(e){if(e){this.inputOpened?(this.selection.restore(),this.selection.removeFakeBackground()):(this.selection.setFakeBackground(),this.selection.save());const n=this.selection.findParentTag("A");if(n){this.inputOpened?(this.closeActions(!1),this.checkState()):(this.selection.expandToTag(n),this.unlink(),this.closeActions(),this.checkState(),this.toolbar.close());return}}this.toggleActions()}checkState(){const e=this.selection.findParentTag("A");if(e){this.nodes.button.innerHTML=zNt,this.nodes.button.classList.add(this.CSS.buttonUnlink),this.nodes.button.classList.add(this.CSS.buttonActive),this.openActions();const n=e.getAttribute("href");this.nodes.input.value=n!=="null"?n:"",this.selection.save()}else this.nodes.button.innerHTML=U5e,this.nodes.button.classList.remove(this.CSS.buttonUnlink),this.nodes.button.classList.remove(this.CSS.buttonActive);return!!e}clear(){this.closeActions()}get shortcut(){return"CMD+K"}toggleActions(){this.inputOpened?this.closeActions(!1):this.openActions(!0)}openActions(e=!1){this.nodes.input.classList.add(this.CSS.inputShowed),e&&this.nodes.input.focus(),this.inputOpened=!0}closeActions(e=!0){if(this.selection.isFakeBackgroundEnabled){const n=new er;n.save(),this.selection.restore(),this.selection.removeFakeBackground(),n.restore()}this.nodes.input.classList.remove(this.CSS.inputShowed),this.nodes.input.value="",e&&this.selection.clearSaved(),this.inputOpened=!1}enterPressed(e){let n=this.nodes.input.value||"";if(!n.trim()){this.selection.restore(),this.unlink(),e.preventDefault(),this.closeActions();return}if(!this.validateURL(n)){this.notifier.show({message:"Pasted link is not valid.",style:"error"}),Qr("Incorrect Link pasted","warn",n);return}n=this.prepareLink(n),this.selection.restore(),this.selection.removeFakeBackground(),this.insertLink(n),e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),this.selection.collapseToEnd(),this.inlineToolbar.close()}validateURL(e){return!/\s/.test(e)}prepareLink(e){return e=e.trim(),e=this.addProtocol(e),e}addProtocol(e){if(/^(\w+):(\/\/)?/.test(e))return e;const n=/^\/[^/\s]/.test(e),r=e.substring(0,1)==="#",i=/^\/\/[^/\s]/.test(e);return!n&&!r&&!i&&(e="http://"+e),e}insertLink(e){const n=this.selection.findParentTag("A");n&&this.selection.expandToTag(n),document.execCommand(this.commandLink,!1,e)}unlink(){document.execCommand(this.commandUnlink)}}nK.isInline=!0,nK.title="Link";let LAe=class{constructor({api:e}){this.i18nAPI=e.i18n,this.blocksAPI=e.blocks,this.selectionAPI=e.selection,this.toolsAPI=e.tools,this.caretAPI=e.caret}async render(){const e=er.get(),n=this.blocksAPI.getBlockByElement(e.anchorNode);if(n===void 0)return[];const r=this.toolsAPI.getBlockTools(),i=await O5e(n,r);if(i.length===0)return[];const o=i.reduce((c,u)=>{var d;return(d=u.toolbox)==null||d.forEach(p=>{c.push({icon:p.icon,title:Ga.t(ec.toolNames,p.title),name:u.name,closeOnActivate:!0,onActivate:async()=>{const g=await this.blocksAPI.convert(n.id,u.name,p.data);this.caretAPI.setToBlock(g,"end")}})}),c},[]),s=await n.getActiveToolboxEntry(),a=s!==void 0?s.icon:H5e,l=!nx();return{icon:a,name:"convert-to",hint:{title:this.i18nAPI.t("Convert to")},children:{searchable:l,items:o,onOpen:()=>{l&&(this.selectionAPI.setFakeBackground(),this.selectionAPI.save())},onClose:()=>{l&&(this.selectionAPI.restore(),this.selectionAPI.removeFakeBackground())}}}}};LAe.isInline=!0;let OAe=class{constructor({data:e,api:n}){this.CSS={wrapper:"ce-stub",info:"ce-stub__info",title:"ce-stub__title",subtitle:"ce-stub__subtitle"},this.api=n,this.title=e.title||this.api.i18n.t("Error"),this.subtitle=this.api.i18n.t("The block can not be displayed correctly."),this.savedData=e.savedData,this.wrapper=this.make()}render(){return this.wrapper}save(){return this.savedData}make(){const e=Rt.make("div",this.CSS.wrapper),n=RNt,r=Rt.make("div",this.CSS.info),i=Rt.make("div",this.CSS.title,{textContent:this.title}),o=Rt.make("div",this.CSS.subtitle,{textContent:this.subtitle});return e.innerHTML=n,r.appendChild(i),r.appendChild(o),e.appendChild(r),e}};OAe.isReadOnlySupported=!0;class rOt extends uW{constructor(){super(...arguments),this.type=Ty.Inline}get title(){return this.constructable[GM.Title]}create(){return new this.constructable({api:this.api,config:this.settings})}get isReadOnlySupported(){return this.constructable[GM.IsReadOnlySupported]??!1}}class iOt extends uW{constructor(){super(...arguments),this.type=Ty.Tune}create(e,n){return new this.constructable({api:this.api,config:this.settings,block:n,data:e})}}let Kd=class Zw extends Map{get blockTools(){const e=Array.from(this.entries()).filter(([,n])=>n.isBlock());return new Zw(e)}get inlineTools(){const e=Array.from(this.entries()).filter(([,n])=>n.isInline());return new Zw(e)}get blockTunes(){const e=Array.from(this.entries()).filter(([,n])=>n.isTune());return new Zw(e)}get internalTools(){const e=Array.from(this.entries()).filter(([,n])=>n.isInternal);return new Zw(e)}get externalTools(){const e=Array.from(this.entries()).filter(([,n])=>!n.isInternal);return new Zw(e)}};var oOt=Object.defineProperty,sOt=Object.getOwnPropertyDescriptor,$Ae=(t,e,n,r)=>{for(var i=sOt(e,n),o=t.length-1,s;o>=0;o--)(s=t[o])&&(i=s(e,n,i)||i);return i&&oOt(e,n,i),i};class rK extends uW{constructor(){super(...arguments),this.type=Ty.Block,this.inlineTools=new Kd,this.tunes=new Kd}create(e,n,r){return new this.constructable({data:e,block:n,readOnly:r,api:this.api,config:this.settings})}get isReadOnlySupported(){return this.constructable[ox.IsReadOnlySupported]===!0}get isLineBreaksEnabled(){return this.constructable[ox.IsEnabledLineBreaks]}get toolbox(){const e=this.constructable[ox.Toolbox],n=this.config[HM.Toolbox];if(!Xc(e)&&n!==!1)return n?Array.isArray(e)?Array.isArray(n)?n.map((r,i)=>{const o=e[i];return o?{...o,...r}:r}):[n]:Array.isArray(n)?n:[{...e,...n}]:Array.isArray(e)?e:[e]}get conversionConfig(){return this.constructable[ox.ConversionConfig]}get enabledInlineTools(){return this.config[HM.EnabledInlineTools]||!1}get enabledBlockTunes(){return this.config[HM.EnabledBlockTunes]}get pasteConfig(){return this.constructable[ox.PasteConfig]??{}}get sanitizeConfig(){const e=super.sanitizeConfig,n=this.baseSanitizeConfig;if(Xc(e))return n;const r={};for(const i in e)if(Object.prototype.hasOwnProperty.call(e,i)){const o=e[i];oa(o)?r[i]=Object.assign({},n,o):r[i]=o}return r}get baseSanitizeConfig(){const e={};return Array.from(this.inlineTools.values()).forEach(n=>Object.assign(e,n.sanitizeConfig)),Array.from(this.tunes.values()).forEach(n=>Object.assign(e,n.sanitizeConfig)),e}}$Ae([tx],rK.prototype,"sanitizeConfig"),$Ae([tx],rK.prototype,"baseSanitizeConfig");class aOt{constructor(e,n,r){this.api=r,this.config=e,this.editorConfig=n}get(e){const{class:n,isInternal:r=!1,...i}=this.config[e],o=this.getConstructor(n),s=n[cW.IsTune];return new o({name:e,constructable:n,config:i,api:this.api.getMethodsForTool(e,s),isDefault:e===this.editorConfig.defaultBlock,defaultPlaceholder:this.editorConfig.placeholder,isInternal:r})}getConstructor(e){switch(!0){case e[GM.IsInline]:return rOt;case e[cW.IsTune]:return iOt;default:return rK}}}let FAe=class{constructor({api:e}){this.CSS={animation:"wobble"},this.api=e}render(){return{icon:ANt,title:this.api.i18n.t("Move down"),onActivate:()=>this.handleClick(),name:"move-down"}}handleClick(){const e=this.api.blocks.getCurrentBlockIndex(),n=this.api.blocks.getBlockByIndex(e+1);if(!n)throw new Error("Unable to move Block down since it is already the last");const r=n.holder,i=r.getBoundingClientRect();let o=Math.abs(window.innerHeight-r.offsetHeight);i.top<window.innerHeight&&(o=window.scrollY+r.offsetHeight),window.scrollTo(0,o),this.api.blocks.move(e+1),this.api.toolbar.toggleBlockSettings(!0)}};FAe.isTune=!0;let BAe=class{constructor({api:e}){this.api=e}render(){return{icon:NNt,title:this.api.i18n.t("Delete"),name:"delete",confirmation:{title:this.api.i18n.t("Click to delete"),onActivate:()=>this.handleClick()}}}handleClick(){this.api.blocks.delete()}};BAe.isTune=!0;let zAe=class{constructor({api:e}){this.CSS={animation:"wobble"},this.api=e}render(){return{icon:DNt,title:this.api.i18n.t("Move up"),onActivate:()=>this.handleClick(),name:"move-up"}}handleClick(){const e=this.api.blocks.getCurrentBlockIndex(),n=this.api.blocks.getBlockByIndex(e),r=this.api.blocks.getBlockByIndex(e-1);if(e===0||!n||!r)throw new Error("Unable to move Block up since it is already the first");const i=n.holder,o=r.holder,s=i.getBoundingClientRect(),a=o.getBoundingClientRect();let l;a.top>0?l=Math.abs(s.top)-Math.abs(a.top):l=Math.abs(s.top)+a.height,window.scrollBy(0,-1*l),this.api.blocks.move(e-1),this.api.toolbar.toggleBlockSettings(!0)}};zAe.isTune=!0;var lOt=Object.defineProperty,cOt=Object.getOwnPropertyDescriptor,uOt=(t,e,n,r)=>{for(var i=cOt(e,n),o=t.length-1,s;o>=0;o--)(s=t[o])&&(i=s(e,n,i)||i);return i&&lOt(e,n,i),i};let RAe=class extends Ir{constructor(){super(...arguments),this.stubTool="stub",this.toolsAvailable=new Kd,this.toolsUnavailable=new Kd}get available(){return this.toolsAvailable}get unavailable(){return this.toolsUnavailable}get inlineTools(){return this.available.inlineTools}get blockTools(){return this.available.blockTools}get blockTunes(){return this.available.blockTunes}get defaultTool(){return this.blockTools.get(this.config.defaultBlock)}get internal(){return this.available.internalTools}async prepare(){if(this.validateTools(),this.config.tools=GG({},this.internalTools,this.config.tools),!Object.prototype.hasOwnProperty.call(this.config,"tools")||Object.keys(this.config.tools).length===0)throw Error("Can't start without tools");const e=this.prepareConfig();this.factory=new aOt(e,this.config,this.Editor.API);const n=this.getListOfPrepareFunctions(e);if(n.length===0)return Promise.resolve();await N6t(n,r=>{this.toolPrepareMethodSuccess(r)},r=>{this.toolPrepareMethodFallback(r)}),this.prepareBlockTools()}getAllInlineToolsSanitizeConfig(){const e={};return Array.from(this.inlineTools.values()).forEach(n=>{Object.assign(e,n.sanitizeConfig)}),e}destroy(){Object.values(this.available).forEach(async e=>{bo(e.reset)&&await e.reset()})}get internalTools(){return{convertTo:{class:LAe,isInternal:!0},link:{class:nK,isInternal:!0},bold:{class:eK,isInternal:!0},italic:{class:tK,isInternal:!0},paragraph:{class:JW,inlineToolbar:!0,isInternal:!0},stub:{class:OAe,isInternal:!0},moveUp:{class:zAe,isInternal:!0},delete:{class:BAe,isInternal:!0},moveDown:{class:FAe,isInternal:!0}}}toolPrepareMethodSuccess(e){const n=this.factory.get(e.toolName);if(n.isInline()){const r=["render"].filter(i=>!n.create()[i]);if(r.length){Qr(`Incorrect Inline Tool: ${n.name}. Some of required methods is not implemented %o`,"warn",r),this.toolsUnavailable.set(n.name,n);return}}this.toolsAvailable.set(n.name,n)}toolPrepareMethodFallback(e){this.toolsUnavailable.set(e.toolName,this.factory.get(e.toolName))}getListOfPrepareFunctions(e){const n=[];return Object.entries(e).forEach(([r,i])=>{n.push({function:bo(i.class.prepare)?i.class.prepare:()=>{},data:{toolName:r,config:i.config}})}),n}prepareBlockTools(){Array.from(this.blockTools.values()).forEach(e=>{this.assignInlineToolsToBlockTool(e),this.assignBlockTunesToBlockTool(e)})}assignInlineToolsToBlockTool(e){if(this.config.inlineToolbar!==!1){if(e.enabledInlineTools===!0){e.inlineTools=new Kd(Array.isArray(this.config.inlineToolbar)?this.config.inlineToolbar.map(n=>[n,this.inlineTools.get(n)]):Array.from(this.inlineTools.entries()));return}Array.isArray(e.enabledInlineTools)&&(e.inlineTools=new Kd(["convertTo",...e.enabledInlineTools].map(n=>[n,this.inlineTools.get(n)])))}}assignBlockTunesToBlockTool(e){if(e.enabledBlockTunes!==!1){if(Array.isArray(e.enabledBlockTunes)){const n=new Kd(e.enabledBlockTunes.map(r=>[r,this.blockTunes.get(r)]));e.tunes=new Kd([...n,...this.blockTunes.internalTools]);return}if(Array.isArray(this.config.tunes)){const n=new Kd(this.config.tunes.map(r=>[r,this.blockTunes.get(r)]));e.tunes=new Kd([...n,...this.blockTunes.internalTools]);return}e.tunes=this.blockTunes.internalTools}}validateTools(){for(const e in this.config.tools)if(Object.prototype.hasOwnProperty.call(this.config.tools,e)){if(e in this.internalTools)return;const n=this.config.tools[e];if(!bo(n)&&!bo(n.class))throw Error(`Tool «${e}» must be a constructor function or an object with function in the «class» property`)}}prepareConfig(){const e={};for(const n in this.config.tools)oa(this.config.tools[n])?e[n]=this.config.tools[n]:e[n]={class:this.config.tools[n]};return e}};uOt([tx],RAe.prototype,"getAllInlineToolsSanitizeConfig");const dOt=`:root{--selectionColor: #e1f2ff;--inlineSelectionColor: #d4ecff;--bg-light: #eff2f5;--grayText: #707684;--color-dark: #1D202B;--color-active-icon: #388AE5;--color-gray-border: rgba(201, 201, 204, .48);--content-width: 650px;--narrow-mode-right-padding: 50px;--toolbox-buttons-size: 26px;--toolbox-buttons-size--mobile: 36px;--icon-size: 20px;--icon-size--mobile: 28px;--block-padding-vertical: .4em;--color-line-gray: #EFF0F1 }.codex-editor{position:relative;-webkit-box-sizing:border-box;box-sizing:border-box;z-index:1}.codex-editor .hide{display:none}.codex-editor__redactor [contenteditable]:empty:after{content:"\\feff"}@media (min-width: 651px){.codex-editor--narrow .codex-editor__redactor{margin-right:50px}}@media (min-width: 651px){.codex-editor--narrow.codex-editor--rtl .codex-editor__redactor{margin-left:50px;margin-right:0}}@media (min-width: 651px){.codex-editor--narrow .ce-toolbar__actions{right:-5px}}.codex-editor-copyable{position:absolute;height:1px;width:1px;top:-400%;opacity:.001}.codex-editor-overlay{position:fixed;top:0;left:0;right:0;bottom:0;z-index:999;pointer-events:none;overflow:hidden}.codex-editor-overlay__container{position:relative;pointer-events:auto;z-index:0}.codex-editor-overlay__rectangle{position:absolute;pointer-events:none;background-color:#2eaadc33;border:1px solid transparent}.codex-editor svg{max-height:100%}.codex-editor path{stroke:currentColor}.codex-editor ::-moz-selection{background-color:#d4ecff}.codex-editor ::selection{background-color:#d4ecff}.codex-editor--toolbox-opened [contentEditable=true][data-placeholder]:focus:before{opacity:0!important}.ce-scroll-locked{overflow:hidden}.ce-scroll-locked--hard{overflow:hidden;top:calc(-1 * var(--window-scroll-offset));position:fixed;width:100%}.ce-toolbar{position:absolute;left:0;right:0;top:0;-webkit-transition:opacity .1s ease;transition:opacity .1s ease;will-change:opacity,top;display:none}.ce-toolbar--opened{display:block}.ce-toolbar__content{max-width:650px;margin:0 auto;position:relative}.ce-toolbar__plus{color:#1d202b;cursor:pointer;width:26px;height:26px;border-radius:7px;display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-ms-flex-negative:0;flex-shrink:0}@media (max-width: 650px){.ce-toolbar__plus{width:36px;height:36px}}@media (hover: hover){.ce-toolbar__plus:hover{background-color:#eff2f5}}.ce-toolbar__plus--active{background-color:#eff2f5;-webkit-animation:bounceIn .75s 1;animation:bounceIn .75s 1;-webkit-animation-fill-mode:forwards;animation-fill-mode:forwards}.ce-toolbar__plus-shortcut{opacity:.6;word-spacing:-2px;margin-top:5px}@media (max-width: 650px){.ce-toolbar__plus{position:absolute;background-color:#fff;border:1px solid #E8E8EB;-webkit-box-shadow:0 3px 15px -3px rgba(13,20,33,.13);box-shadow:0 3px 15px -3px #0d142121;border-radius:6px;z-index:2;position:static}.ce-toolbar__plus--left-oriented:before{left:15px;margin-left:0}.ce-toolbar__plus--right-oriented:before{left:auto;right:15px;margin-left:0}}.ce-toolbar__actions{position:absolute;right:100%;opacity:0;display:-webkit-box;display:-ms-flexbox;display:flex;padding-right:5px}.ce-toolbar__actions--opened{opacity:1}@media (max-width: 650px){.ce-toolbar__actions{right:auto}}.ce-toolbar__settings-btn{color:#1d202b;width:26px;height:26px;border-radius:7px;display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;margin-left:3px;cursor:pointer;user-select:none}@media (max-width: 650px){.ce-toolbar__settings-btn{width:36px;height:36px}}@media (hover: hover){.ce-toolbar__settings-btn:hover{background-color:#eff2f5}}.ce-toolbar__settings-btn--active{background-color:#eff2f5;-webkit-animation:bounceIn .75s 1;animation:bounceIn .75s 1;-webkit-animation-fill-mode:forwards;animation-fill-mode:forwards}@media (min-width: 651px){.ce-toolbar__settings-btn{width:24px}}.ce-toolbar__settings-btn--hidden{display:none}@media (max-width: 650px){.ce-toolbar__settings-btn{position:absolute;background-color:#fff;border:1px solid #E8E8EB;-webkit-box-shadow:0 3px 15px -3px rgba(13,20,33,.13);box-shadow:0 3px 15px -3px #0d142121;border-radius:6px;z-index:2;position:static}.ce-toolbar__settings-btn--left-oriented:before{left:15px;margin-left:0}.ce-toolbar__settings-btn--right-oriented:before{left:auto;right:15px;margin-left:0}}.ce-toolbar__plus svg,.ce-toolbar__settings-btn svg{width:24px;height:24px}@media (min-width: 651px){.codex-editor--narrow .ce-toolbar__plus{left:5px}}@media (min-width: 651px){.codex-editor--narrow .ce-toolbox .ce-popover{right:0;left:auto;left:initial}}.ce-inline-toolbar{--y-offset: 8px;--color-background-icon-active: rgba(56, 138, 229, .1);--color-text-icon-active: #388AE5;--color-text-primary: black;position:absolute;visibility:hidden;-webkit-transition:opacity .25s ease;transition:opacity .25s ease;will-change:opacity,left,top;top:0;left:0;z-index:3;opacity:1;visibility:visible}.ce-inline-toolbar [hidden]{display:none!important}.ce-inline-toolbar__toggler-and-button-wrapper{display:-webkit-box;display:-ms-flexbox;display:flex;width:100%;padding:0 6px}.ce-inline-toolbar__buttons{display:-webkit-box;display:-ms-flexbox;display:flex}.ce-inline-toolbar__dropdown{display:-webkit-box;display:-ms-flexbox;display:flex;padding:6px;margin:0 6px 0 -6px;-webkit-box-align:center;-ms-flex-align:center;align-items:center;cursor:pointer;border-right:1px solid rgba(201,201,204,.48);-webkit-box-sizing:border-box;box-sizing:border-box}@media (hover: hover){.ce-inline-toolbar__dropdown:hover{background:#eff2f5}}.ce-inline-toolbar__dropdown--hidden{display:none}.ce-inline-toolbar__dropdown-content,.ce-inline-toolbar__dropdown-arrow{display:-webkit-box;display:-ms-flexbox;display:flex}.ce-inline-toolbar__dropdown-content svg,.ce-inline-toolbar__dropdown-arrow svg{width:20px;height:20px}.ce-inline-toolbar__shortcut{opacity:.6;word-spacing:-3px;margin-top:3px}.ce-inline-tool{color:var(--color-text-primary);display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;border:0;border-radius:4px;line-height:normal;height:100%;padding:0;width:28px;background-color:transparent;cursor:pointer}@media (max-width: 650px){.ce-inline-tool{width:36px;height:36px}}@media (hover: hover){.ce-inline-tool:hover{background-color:#f8f8f8}}.ce-inline-tool svg{display:block;width:20px;height:20px}@media (max-width: 650px){.ce-inline-tool svg{width:28px;height:28px}}.ce-inline-tool--link .icon--unlink,.ce-inline-tool--unlink .icon--link{display:none}.ce-inline-tool--unlink .icon--unlink{display:inline-block;margin-bottom:-1px}.ce-inline-tool-input{background:#F8F8F8;border:1px solid rgba(226,226,229,.2);border-radius:6px;padding:4px 8px;font-size:14px;line-height:22px;outline:none;margin:0;width:100%;-webkit-box-sizing:border-box;box-sizing:border-box;display:none;font-weight:500;-webkit-appearance:none;font-family:inherit}@media (max-width: 650px){.ce-inline-tool-input{font-size:15px;font-weight:500}}.ce-inline-tool-input::-webkit-input-placeholder{color:#707684}.ce-inline-tool-input::-moz-placeholder{color:#707684}.ce-inline-tool-input:-ms-input-placeholder{color:#707684}.ce-inline-tool-input::-ms-input-placeholder{color:#707684}.ce-inline-tool-input::placeholder{color:#707684}.ce-inline-tool-input--showed{display:block}.ce-inline-tool--active{background:var(--color-background-icon-active);color:var(--color-text-icon-active)}@-webkit-keyframes fade-in{0%{opacity:0}to{opacity:1}}@keyframes fade-in{0%{opacity:0}to{opacity:1}}.ce-block{-webkit-animation:fade-in .3s ease;animation:fade-in .3s ease;-webkit-animation-fill-mode:none;animation-fill-mode:none;-webkit-animation-fill-mode:initial;animation-fill-mode:initial}.ce-block:first-of-type{margin-top:0}.ce-block--selected .ce-block__content{background:#e1f2ff}.ce-block--selected .ce-block__content [contenteditable]{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.ce-block--selected .ce-block__content img,.ce-block--selected .ce-block__content .ce-stub{opacity:.55}.ce-block--stretched .ce-block__content{max-width:none}.ce-block__content{position:relative;max-width:650px;margin:0 auto;-webkit-transition:background-color .15s ease;transition:background-color .15s ease}.ce-block--drop-target .ce-block__content:before{content:"";position:absolute;top:100%;left:-20px;margin-top:-1px;height:8px;width:8px;border:solid #388AE5;border-width:1px 1px 0 0;-webkit-transform-origin:right;transform-origin:right;-webkit-transform:rotate(45deg);transform:rotate(45deg)}.ce-block--drop-target .ce-block__content:after{content:"";position:absolute;top:100%;height:1px;width:100%;color:#388ae5;background:repeating-linear-gradient(90deg,#388AE5,#388AE5 1px,#fff 1px,#fff 6px)}.ce-block a{cursor:pointer;-webkit-text-decoration:underline;text-decoration:underline}.ce-block b{font-weight:700}.ce-block i{font-style:italic}@-webkit-keyframes bounceIn{0%,20%,40%,60%,80%,to{-webkit-animation-timing-function:cubic-bezier(.215,.61,.355,1);animation-timing-function:cubic-bezier(.215,.61,.355,1)}0%{-webkit-transform:scale3d(.9,.9,.9);transform:scale3d(.9,.9,.9)}20%{-webkit-transform:scale3d(1.03,1.03,1.03);transform:scale3d(1.03,1.03,1.03)}60%{-webkit-transform:scale3d(1,1,1);transform:scaleZ(1)}}@keyframes bounceIn{0%,20%,40%,60%,80%,to{-webkit-animation-timing-function:cubic-bezier(.215,.61,.355,1);animation-timing-function:cubic-bezier(.215,.61,.355,1)}0%{-webkit-transform:scale3d(.9,.9,.9);transform:scale3d(.9,.9,.9)}20%{-webkit-transform:scale3d(1.03,1.03,1.03);transform:scale3d(1.03,1.03,1.03)}60%{-webkit-transform:scale3d(1,1,1);transform:scaleZ(1)}}@-webkit-keyframes selectionBounce{0%,20%,40%,60%,80%,to{-webkit-animation-timing-function:cubic-bezier(.215,.61,.355,1);animation-timing-function:cubic-bezier(.215,.61,.355,1)}50%{-webkit-transform:scale3d(1.01,1.01,1.01);transform:scale3d(1.01,1.01,1.01)}70%{-webkit-transform:scale3d(1,1,1);transform:scaleZ(1)}}@keyframes selectionBounce{0%,20%,40%,60%,80%,to{-webkit-animation-timing-function:cubic-bezier(.215,.61,.355,1);animation-timing-function:cubic-bezier(.215,.61,.355,1)}50%{-webkit-transform:scale3d(1.01,1.01,1.01);transform:scale3d(1.01,1.01,1.01)}70%{-webkit-transform:scale3d(1,1,1);transform:scaleZ(1)}}@-webkit-keyframes buttonClicked{0%,20%,40%,60%,80%,to{-webkit-animation-timing-function:cubic-bezier(.215,.61,.355,1);animation-timing-function:cubic-bezier(.215,.61,.355,1)}0%{-webkit-transform:scale3d(.95,.95,.95);transform:scale3d(.95,.95,.95)}60%{-webkit-transform:scale3d(1.02,1.02,1.02);transform:scale3d(1.02,1.02,1.02)}80%{-webkit-transform:scale3d(1,1,1);transform:scaleZ(1)}}@keyframes buttonClicked{0%,20%,40%,60%,80%,to{-webkit-animation-timing-function:cubic-bezier(.215,.61,.355,1);animation-timing-function:cubic-bezier(.215,.61,.355,1)}0%{-webkit-transform:scale3d(.95,.95,.95);transform:scale3d(.95,.95,.95)}60%{-webkit-transform:scale3d(1.02,1.02,1.02);transform:scale3d(1.02,1.02,1.02)}80%{-webkit-transform:scale3d(1,1,1);transform:scaleZ(1)}}.cdx-block{padding:.4em 0}.cdx-block::-webkit-input-placeholder{line-height:normal!important}.cdx-input{border:1px solid rgba(201,201,204,.48);-webkit-box-shadow:inset 0 1px 2px 0 rgba(35,44,72,.06);box-shadow:inset 0 1px 2px #232c480f;border-radius:3px;padding:10px 12px;outline:none;width:100%;-webkit-box-sizing:border-box;box-sizing:border-box}.cdx-input[data-placeholder]:before{position:static!important}.cdx-input[data-placeholder]:before{display:inline-block;width:0;white-space:nowrap;pointer-events:none}.cdx-settings-button{display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;border-radius:3px;cursor:pointer;border:0;outline:none;background-color:transparent;vertical-align:bottom;color:inherit;margin:0;min-width:26px;min-height:26px}.cdx-settings-button--focused{background:rgba(34,186,255,.08)!important}.cdx-settings-button--focused{-webkit-box-shadow:inset 0 0 0px 1px rgba(7,161,227,.08);box-shadow:inset 0 0 0 1px #07a1e314}.cdx-settings-button--focused-animated{-webkit-animation-name:buttonClicked;animation-name:buttonClicked;-webkit-animation-duration:.25s;animation-duration:.25s}.cdx-settings-button--active{color:#388ae5}.cdx-settings-button svg{width:auto;height:auto}@media (max-width: 650px){.cdx-settings-button svg{width:28px;height:28px}}@media (max-width: 650px){.cdx-settings-button{width:36px;height:36px;border-radius:8px}}@media (hover: hover){.cdx-settings-button:hover{background-color:#eff2f5}}.cdx-loader{position:relative;border:1px solid rgba(201,201,204,.48)}.cdx-loader:before{content:"";position:absolute;left:50%;top:50%;width:18px;height:18px;margin:-11px 0 0 -11px;border:2px solid rgba(201,201,204,.48);border-left-color:#388ae5;border-radius:50%;-webkit-animation:cdxRotation 1.2s infinite linear;animation:cdxRotation 1.2s infinite linear}@-webkit-keyframes cdxRotation{0%{-webkit-transform:rotate(0deg);transform:rotate(0)}to{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes cdxRotation{0%{-webkit-transform:rotate(0deg);transform:rotate(0)}to{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}.cdx-button{padding:13px;border-radius:3px;border:1px solid rgba(201,201,204,.48);font-size:14.9px;background:#fff;-webkit-box-shadow:0 2px 2px 0 rgba(18,30,57,.04);box-shadow:0 2px 2px #121e390a;color:#707684;text-align:center;cursor:pointer}@media (hover: hover){.cdx-button:hover{background:#FBFCFE;-webkit-box-shadow:0 1px 3px 0 rgba(18,30,57,.08);box-shadow:0 1px 3px #121e3914}}.cdx-button svg{height:20px;margin-right:.2em;margin-top:-2px}.ce-stub{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;padding:12px 18px;margin:10px 0;border-radius:10px;background:#eff2f5;border:1px solid #EFF0F1;color:#707684;font-size:14px}.ce-stub svg{width:20px;height:20px}.ce-stub__info{margin-left:14px}.ce-stub__title{font-weight:500;text-transform:capitalize}.codex-editor.codex-editor--rtl{direction:rtl}.codex-editor.codex-editor--rtl .cdx-list{padding-left:0;padding-right:40px}.codex-editor.codex-editor--rtl .ce-toolbar__plus{right:-26px;left:auto}.codex-editor.codex-editor--rtl .ce-toolbar__actions{right:auto;left:-26px}@media (max-width: 650px){.codex-editor.codex-editor--rtl .ce-toolbar__actions{margin-left:0;margin-right:auto;padding-right:0;padding-left:10px}}.codex-editor.codex-editor--rtl .ce-settings{left:5px;right:auto}.codex-editor.codex-editor--rtl .ce-settings:before{right:auto;left:25px}.codex-editor.codex-editor--rtl .ce-settings__button:not(:nth-child(3n+3)){margin-left:3px;margin-right:0}.codex-editor.codex-editor--rtl .ce-conversion-tool__icon{margin-right:0;margin-left:10px}.codex-editor.codex-editor--rtl .ce-inline-toolbar__dropdown{border-right:0px solid transparent;border-left:1px solid rgba(201,201,204,.48);margin:0 -6px 0 6px}.codex-editor.codex-editor--rtl .ce-inline-toolbar__dropdown .icon--toggler-down{margin-left:0;margin-right:4px}@media (min-width: 651px){.codex-editor--narrow.codex-editor--rtl .ce-toolbar__plus{left:0;right:5px}}@media (min-width: 651px){.codex-editor--narrow.codex-editor--rtl .ce-toolbar__actions{left:-5px}}.cdx-search-field{--icon-margin-right: 10px;background:#F8F8F8;border:1px solid rgba(226,226,229,.2);border-radius:6px;padding:2px;display:grid;grid-template-columns:auto auto 1fr;grid-template-rows:auto}.cdx-search-field__icon{width:26px;height:26px;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;margin-right:var(--icon-margin-right)}.cdx-search-field__icon svg{width:20px;height:20px;color:#707684}.cdx-search-field__input{font-size:14px;outline:none;font-weight:500;font-family:inherit;border:0;background:transparent;margin:0;padding:0;line-height:22px;min-width:calc(100% - 26px - var(--icon-margin-right))}.cdx-search-field__input::-webkit-input-placeholder{color:#707684;font-weight:500}.cdx-search-field__input::-moz-placeholder{color:#707684;font-weight:500}.cdx-search-field__input:-ms-input-placeholder{color:#707684;font-weight:500}.cdx-search-field__input::-ms-input-placeholder{color:#707684;font-weight:500}.cdx-search-field__input::placeholder{color:#707684;font-weight:500}.ce-popover{--border-radius: 6px;--width: 200px;--max-height: 270px;--padding: 6px;--offset-from-target: 8px;--color-border: #EFF0F1;--color-shadow: rgba(13, 20, 33, .1);--color-background: white;--color-text-primary: black;--color-text-secondary: #707684;--color-border-icon: rgba(201, 201, 204, .48);--color-border-icon-disabled: #EFF0F1;--color-text-icon-active: #388AE5;--color-background-icon-active: rgba(56, 138, 229, .1);--color-background-item-focus: rgba(34, 186, 255, .08);--color-shadow-item-focus: rgba(7, 161, 227, .08);--color-background-item-hover: #F8F8F8;--color-background-item-confirm: #E24A4A;--color-background-item-confirm-hover: #CE4343;--popover-top: calc(100% + var(--offset-from-target));--popover-left: 0;--nested-popover-overlap: 4px;--icon-size: 20px;--item-padding: 3px;--item-height: calc(var(--icon-size) + 2 * var(--item-padding))}.ce-popover__container{min-width:var(--width);width:var(--width);max-height:var(--max-height);border-radius:var(--border-radius);overflow:hidden;-webkit-box-sizing:border-box;box-sizing:border-box;-webkit-box-shadow:0px 3px 15px -3px var(--color-shadow);box-shadow:0 3px 15px -3px var(--color-shadow);position:absolute;left:var(--popover-left);top:var(--popover-top);background:var(--color-background);display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;z-index:4;opacity:0;max-height:0;pointer-events:none;padding:0;border:none}.ce-popover--opened>.ce-popover__container{opacity:1;padding:var(--padding);max-height:var(--max-height);pointer-events:auto;-webkit-animation:panelShowing .1s ease;animation:panelShowing .1s ease;border:1px solid var(--color-border)}@media (max-width: 650px){.ce-popover--opened>.ce-popover__container{-webkit-animation:panelShowingMobile .25s ease;animation:panelShowingMobile .25s ease}}.ce-popover--open-top .ce-popover__container{--popover-top: calc(-1 * (var(--offset-from-target) + var(--popover-height)))}.ce-popover--open-left .ce-popover__container{--popover-left: calc(-1 * var(--width) + 100%)}.ce-popover__items{overflow-y:auto;-ms-scroll-chaining:none;overscroll-behavior:contain}@media (max-width: 650px){.ce-popover__overlay{position:fixed;top:0;bottom:0;left:0;right:0;background:#1D202B;z-index:3;opacity:.5;-webkit-transition:opacity .12s ease-in;transition:opacity .12s ease-in;will-change:opacity;visibility:visible}}.ce-popover__overlay--hidden{display:none}@media (max-width: 650px){.ce-popover .ce-popover__container{--offset: 5px;position:fixed;max-width:none;min-width:calc(100% - var(--offset) * 2);left:var(--offset);right:var(--offset);bottom:calc(var(--offset) + env(safe-area-inset-bottom));top:auto;border-radius:10px}}.ce-popover__search{margin-bottom:5px}.ce-popover__nothing-found-message{color:#707684;display:none;cursor:default;padding:3px;font-size:14px;line-height:20px;font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.ce-popover__nothing-found-message--displayed{display:block}.ce-popover--nested .ce-popover__container{--popover-left: calc(var(--nesting-level) * (var(--width) - var(--nested-popover-overlap)));top:calc(var(--trigger-item-top) - var(--nested-popover-overlap));position:absolute}.ce-popover--open-top.ce-popover--nested .ce-popover__container{top:calc(var(--trigger-item-top) - var(--popover-height) + var(--item-height) + var(--offset-from-target) + var(--nested-popover-overlap))}.ce-popover--open-left .ce-popover--nested .ce-popover__container{--popover-left: calc(-1 * (var(--nesting-level) + 1) * var(--width) + 100%)}.ce-popover-item-separator{padding:4px 3px}.ce-popover-item-separator--hidden{display:none}.ce-popover-item-separator__line{height:1px;background:var(--color-border);width:100%}.ce-popover-item-html--hidden{display:none}.ce-popover-item{--border-radius: 6px;border-radius:var(--border-radius);display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;padding:var(--item-padding);color:var(--color-text-primary);-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;border:none;background:transparent}@media (max-width: 650px){.ce-popover-item{padding:4px}}.ce-popover-item:not(:last-of-type){margin-bottom:1px}.ce-popover-item__icon{width:26px;height:26px;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center}.ce-popover-item__icon svg{width:20px;height:20px}@media (max-width: 650px){.ce-popover-item__icon{width:36px;height:36px;border-radius:8px}.ce-popover-item__icon svg{width:28px;height:28px}}.ce-popover-item__icon--tool{margin-right:4px}.ce-popover-item__title{font-size:14px;line-height:20px;font-weight:500;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;margin-right:auto}@media (max-width: 650px){.ce-popover-item__title{font-size:16px}}.ce-popover-item__secondary-title{color:var(--color-text-secondary);font-size:12px;white-space:nowrap;letter-spacing:-.1em;padding-right:5px;opacity:.6}@media (max-width: 650px){.ce-popover-item__secondary-title{display:none}}.ce-popover-item--active{background:var(--color-background-icon-active);color:var(--color-text-icon-active)}.ce-popover-item--disabled{color:var(--color-text-secondary);cursor:default;pointer-events:none}.ce-popover-item--focused:not(.ce-popover-item--no-focus){background:var(--color-background-item-focus)!important}.ce-popover-item--hidden{display:none}@media (hover: hover){.ce-popover-item:hover{cursor:pointer}.ce-popover-item:hover:not(.ce-popover-item--no-hover){background-color:var(--color-background-item-hover)}}.ce-popover-item--confirmation{background:var(--color-background-item-confirm)}.ce-popover-item--confirmation .ce-popover-item__title,.ce-popover-item--confirmation .ce-popover-item__icon{color:#fff}@media (hover: hover){.ce-popover-item--confirmation:not(.ce-popover-item--no-hover):hover{background:var(--color-background-item-confirm-hover)}}.ce-popover-item--confirmation:not(.ce-popover-item--no-focus).ce-popover-item--focused{background:var(--color-background-item-confirm-hover)!important}@-webkit-keyframes panelShowing{0%{opacity:0;-webkit-transform:translateY(-8px) scale(.9);transform:translateY(-8px) scale(.9)}70%{opacity:1;-webkit-transform:translateY(2px);transform:translateY(2px)}to{-webkit-transform:translateY(0);transform:translateY(0)}}@keyframes panelShowing{0%{opacity:0;-webkit-transform:translateY(-8px) scale(.9);transform:translateY(-8px) scale(.9)}70%{opacity:1;-webkit-transform:translateY(2px);transform:translateY(2px)}to{-webkit-transform:translateY(0);transform:translateY(0)}}@-webkit-keyframes panelShowingMobile{0%{opacity:0;-webkit-transform:translateY(14px) scale(.98);transform:translateY(14px) scale(.98)}70%{opacity:1;-webkit-transform:translateY(-4px);transform:translateY(-4px)}to{-webkit-transform:translateY(0);transform:translateY(0)}}@keyframes panelShowingMobile{0%{opacity:0;-webkit-transform:translateY(14px) scale(.98);transform:translateY(14px) scale(.98)}70%{opacity:1;-webkit-transform:translateY(-4px);transform:translateY(-4px)}to{-webkit-transform:translateY(0);transform:translateY(0)}}.wobble{-webkit-animation-name:wobble;animation-name:wobble;-webkit-animation-duration:.4s;animation-duration:.4s}@-webkit-keyframes wobble{0%{-webkit-transform:translate3d(0,0,0);transform:translateZ(0)}15%{-webkit-transform:translate3d(-9%,0,0);transform:translate3d(-9%,0,0)}30%{-webkit-transform:translate3d(9%,0,0);transform:translate3d(9%,0,0)}45%{-webkit-transform:translate3d(-4%,0,0);transform:translate3d(-4%,0,0)}60%{-webkit-transform:translate3d(4%,0,0);transform:translate3d(4%,0,0)}75%{-webkit-transform:translate3d(-1%,0,0);transform:translate3d(-1%,0,0)}to{-webkit-transform:translate3d(0,0,0);transform:translateZ(0)}}@keyframes wobble{0%{-webkit-transform:translate3d(0,0,0);transform:translateZ(0)}15%{-webkit-transform:translate3d(-9%,0,0);transform:translate3d(-9%,0,0)}30%{-webkit-transform:translate3d(9%,0,0);transform:translate3d(9%,0,0)}45%{-webkit-transform:translate3d(-4%,0,0);transform:translate3d(-4%,0,0)}60%{-webkit-transform:translate3d(4%,0,0);transform:translate3d(4%,0,0)}75%{-webkit-transform:translate3d(-1%,0,0);transform:translate3d(-1%,0,0)}to{-webkit-transform:translate3d(0,0,0);transform:translateZ(0)}}.ce-popover-header{margin-bottom:8px;margin-top:4px;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.ce-popover-header__text{font-size:18px;font-weight:600}.ce-popover-header__back-button{border:0;background:transparent;width:36px;height:36px;color:var(--color-text-primary)}.ce-popover-header__back-button svg{display:block;width:28px;height:28px}.ce-popover--inline{--height: 38px;--height-mobile: 46px;--container-padding: 4px;position:relative}.ce-popover--inline .ce-popover__custom-content{margin-bottom:0}.ce-popover--inline .ce-popover__items{display:-webkit-box;display:-ms-flexbox;display:flex}.ce-popover--inline .ce-popover__container{-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-direction:row;flex-direction:row;padding:var(--container-padding);height:var(--height);top:0;min-width:-webkit-max-content;min-width:-moz-max-content;min-width:max-content;width:-webkit-max-content;width:-moz-max-content;width:max-content;-webkit-animation:none;animation:none}@media (max-width: 650px){.ce-popover--inline .ce-popover__container{height:var(--height-mobile);position:absolute}}.ce-popover--inline .ce-popover-item-separator{padding:0 4px}.ce-popover--inline .ce-popover-item-separator__line{height:100%;width:1px}.ce-popover--inline .ce-popover-item{border-radius:4px;padding:4px}.ce-popover--inline .ce-popover-item__icon--tool{-webkit-box-shadow:none;box-shadow:none;background:transparent;margin-right:0}.ce-popover--inline .ce-popover-item__icon{width:auto;width:initial;height:auto;height:initial}.ce-popover--inline .ce-popover-item__icon svg{width:20px;height:20px}@media (max-width: 650px){.ce-popover--inline .ce-popover-item__icon svg{width:28px;height:28px}}.ce-popover--inline .ce-popover-item:not(:last-of-type){margin-bottom:0;margin-bottom:initial}.ce-popover--inline .ce-popover-item-html{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.ce-popover--inline .ce-popover-item__icon--chevron-right{-webkit-transform:rotate(90deg);transform:rotate(90deg)}.ce-popover--inline .ce-popover--nested-level-1 .ce-popover__container{--offset: 3px;left:0;top:calc(var(--height) + var(--offset))}@media (max-width: 650px){.ce-popover--inline .ce-popover--nested-level-1 .ce-popover__container{top:calc(var(--height-mobile) + var(--offset))}}.ce-popover--inline .ce-popover--nested .ce-popover__container{min-width:var(--width);width:var(--width);height:-webkit-fit-content;height:-moz-fit-content;height:fit-content;padding:6px;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column}.ce-popover--inline .ce-popover--nested .ce-popover__items{display:block;width:100%}.ce-popover--inline .ce-popover--nested .ce-popover-item{border-radius:6px;padding:3px}@media (max-width: 650px){.ce-popover--inline .ce-popover--nested .ce-popover-item{padding:4px}}.ce-popover--inline .ce-popover--nested .ce-popover-item__icon--tool{margin-right:4px}.ce-popover--inline .ce-popover--nested .ce-popover-item__icon{width:26px;height:26px}.ce-popover--inline .ce-popover--nested .ce-popover-item-separator{padding:4px 3px}.ce-popover--inline .ce-popover--nested .ce-popover-item-separator__line{width:100%;height:1px}.codex-editor [data-placeholder]:empty:before,.codex-editor [data-placeholder][data-empty=true]:before{pointer-events:none;color:#707684;cursor:text;content:attr(data-placeholder)}.codex-editor [data-placeholder-active]:empty:before,.codex-editor [data-placeholder-active][data-empty=true]:before{pointer-events:none;color:#707684;cursor:text}.codex-editor [data-placeholder-active]:empty:focus:before,.codex-editor [data-placeholder-active][data-empty=true]:focus:before{content:attr(data-placeholder-active)}
232
- `;class fOt extends Ir{constructor(){super(...arguments),this.isMobile=!1,this.contentRectCache=null,this.resizeDebouncer=C5e(()=>{this.windowResize()},200),this.selectionChangeDebounced=C5e(()=>{this.selectionChanged()},K8t),this.documentTouchedListener=e=>{this.documentTouched(e)}}get CSS(){return{editorWrapper:"codex-editor",editorWrapperNarrow:"codex-editor--narrow",editorZone:"codex-editor__redactor",editorZoneHidden:"codex-editor__redactor--hidden",editorEmpty:"codex-editor--empty",editorRtlFix:"codex-editor--rtl"}}get contentRect(){if(this.contentRectCache!==null)return this.contentRectCache;const e=this.nodes.wrapper.querySelector(`.${Lh.CSS.content}`);return e?(this.contentRectCache=e.getBoundingClientRect(),this.contentRectCache):{width:650,left:0,right:0}}async prepare(){this.setIsMobile(),this.make(),this.loadStyles()}toggleReadOnly(e){e?this.unbindReadOnlySensitiveListeners():window.requestIdleCallback(()=>{this.bindReadOnlySensitiveListeners()},{timeout:2e3})}checkEmptiness(){const{BlockManager:e}=this.Editor;this.nodes.wrapper.classList.toggle(this.CSS.editorEmpty,e.isEditorEmpty)}get someToolbarOpened(){const{Toolbar:e,BlockSettings:n,InlineToolbar:r}=this.Editor;return!!(n.opened||r.opened||e.toolbox.opened)}get someFlipperButtonFocused(){return this.Editor.Toolbar.toolbox.hasFocus()?!0:Object.entries(this.Editor).filter(([e,n])=>n.flipper instanceof VM).some(([e,n])=>n.flipper.hasFocus())}destroy(){this.nodes.holder.innerHTML="",this.unbindReadOnlyInsensitiveListeners()}closeAllToolbars(){const{Toolbar:e,BlockSettings:n,InlineToolbar:r}=this.Editor;n.close(),r.close(),e.toolbox.close()}setIsMobile(){const e=window.innerWidth<T5e;e!==this.isMobile&&this.eventsDispatcher.emit(OE,{isEnabled:this.isMobile}),this.isMobile=e}make(){this.nodes.holder=Rt.getHolder(this.config.holder),this.nodes.wrapper=Rt.make("div",[this.CSS.editorWrapper,...this.isRtl?[this.CSS.editorRtlFix]:[]]),this.nodes.redactor=Rt.make("div",this.CSS.editorZone),this.nodes.holder.offsetWidth<this.contentRect.width&&this.nodes.wrapper.classList.add(this.CSS.editorWrapperNarrow),this.nodes.redactor.style.paddingBottom=this.config.minHeight+"px",this.nodes.wrapper.appendChild(this.nodes.redactor),this.nodes.holder.appendChild(this.nodes.wrapper),this.bindReadOnlyInsensitiveListeners()}loadStyles(){const e="editor-js-styles";if(Rt.get(e))return;const n=Rt.make("style",null,{id:e,textContent:dOt.toString()});this.config.style&&!Xc(this.config.style)&&this.config.style.nonce&&n.setAttribute("nonce",this.config.style.nonce),Rt.prepend(document.head,n)}bindReadOnlyInsensitiveListeners(){this.listeners.on(document,"selectionchange",this.selectionChangeDebounced),this.listeners.on(window,"resize",this.resizeDebouncer,{passive:!0}),this.listeners.on(this.nodes.redactor,"mousedown",this.documentTouchedListener,{capture:!0,passive:!0}),this.listeners.on(this.nodes.redactor,"touchstart",this.documentTouchedListener,{capture:!0,passive:!0})}unbindReadOnlyInsensitiveListeners(){this.listeners.off(document,"selectionchange",this.selectionChangeDebounced),this.listeners.off(window,"resize",this.resizeDebouncer),this.listeners.off(this.nodes.redactor,"mousedown",this.documentTouchedListener),this.listeners.off(this.nodes.redactor,"touchstart",this.documentTouchedListener)}bindReadOnlySensitiveListeners(){this.readOnlyMutableListeners.on(this.nodes.redactor,"click",e=>{this.redactorClicked(e)},!1),this.readOnlyMutableListeners.on(document,"keydown",e=>{this.documentKeydown(e)},!0),this.readOnlyMutableListeners.on(document,"mousedown",e=>{this.documentClicked(e)},!0),this.watchBlockHoveredEvents(),this.enableInputsEmptyMark()}watchBlockHoveredEvents(){let e;this.readOnlyMutableListeners.on(this.nodes.redactor,"mousemove",HG(n=>{const r=n.target.closest(".ce-block");this.Editor.BlockSelection.anyBlockSelected||r&&e!==r&&(e=r,this.eventsDispatcher.emit(eAe,{block:this.Editor.BlockManager.getBlockByChildNode(r)}))},20),{passive:!0})}unbindReadOnlySensitiveListeners(){this.readOnlyMutableListeners.clearAll()}windowResize(){this.contentRectCache=null,this.setIsMobile()}documentKeydown(e){switch(e.keyCode){case ur.ENTER:this.enterPressed(e);break;case ur.BACKSPACE:case ur.DELETE:this.backspacePressed(e);break;case ur.ESC:this.escapePressed(e);break;default:this.defaultBehaviour(e);break}}defaultBehaviour(e){const{currentBlock:n}=this.Editor.BlockManager,r=e.target.closest(`.${this.CSS.editorWrapper}`),i=e.altKey||e.ctrlKey||e.metaKey||e.shiftKey;if(n!==void 0&&r===null){this.Editor.BlockEvents.keydown(e);return}r||n&&i||(this.Editor.BlockManager.unsetCurrentBlock(),this.Editor.Toolbar.close())}backspacePressed(e){const{BlockManager:n,BlockSelection:r,Caret:i}=this.Editor;if(r.anyBlockSelected&&!er.isSelectionExists){const o=n.removeSelectedBlocks(),s=n.insertDefaultBlockAtIndex(o,!0);i.setToBlock(s,i.positions.START),r.clearSelection(e),e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation()}}escapePressed(e){this.Editor.BlockSelection.clearSelection(e),this.Editor.Toolbar.toolbox.opened?(this.Editor.Toolbar.toolbox.close(),this.Editor.Caret.setToBlock(this.Editor.BlockManager.currentBlock,this.Editor.Caret.positions.END)):this.Editor.BlockSettings.opened?this.Editor.BlockSettings.close():this.Editor.InlineToolbar.opened?this.Editor.InlineToolbar.close():this.Editor.Toolbar.close()}enterPressed(e){const{BlockManager:n,BlockSelection:r}=this.Editor;if(this.someToolbarOpened)return;const i=n.currentBlockIndex>=0;if(r.anyBlockSelected&&!er.isSelectionExists){r.clearSelection(e),e.preventDefault(),e.stopImmediatePropagation(),e.stopPropagation();return}if(!this.someToolbarOpened&&i&&e.target.tagName==="BODY"){const o=this.Editor.BlockManager.insert();e.preventDefault(),this.Editor.Caret.setToBlock(o),this.Editor.Toolbar.moveAndOpen(o)}this.Editor.BlockSelection.clearSelection(e)}documentClicked(e){var n,r;if(!e.isTrusted)return;const i=e.target;this.nodes.holder.contains(i)||er.isAtEditor||(this.Editor.BlockManager.unsetCurrentBlock(),this.Editor.Toolbar.close());const o=(n=this.Editor.BlockSettings.nodes.wrapper)==null?void 0:n.contains(i),s=(r=this.Editor.Toolbar.nodes.settingsToggler)==null?void 0:r.contains(i),a=o||s;if(this.Editor.BlockSettings.opened&&!a){this.Editor.BlockSettings.close();const l=this.Editor.BlockManager.getBlockByChildNode(i);this.Editor.Toolbar.moveAndOpen(l)}this.Editor.BlockSelection.clearSelection(e)}documentTouched(e){let n=e.target;if(n===this.nodes.redactor){const r=e instanceof MouseEvent?e.clientX:e.touches[0].clientX,i=e instanceof MouseEvent?e.clientY:e.touches[0].clientY;n=document.elementFromPoint(r,i)}try{this.Editor.BlockManager.setCurrentBlockByChildNode(n)}catch{this.Editor.RectangleSelection.isRectActivated()||this.Editor.Caret.setToTheLastBlock()}this.Editor.ReadOnly.isEnabled||this.Editor.Toolbar.moveAndOpen()}redactorClicked(e){if(!er.isCollapsed)return;const n=e.target,r=e.metaKey||e.ctrlKey;if(Rt.isAnchor(n)&&r){e.stopImmediatePropagation(),e.stopPropagation();const i=n.getAttribute("href"),o=F6t(i);z6t(o);return}this.processBottomZoneClick(e)}processBottomZoneClick(e){const n=this.Editor.BlockManager.getBlockByIndex(-1),r=Rt.offset(n.holder).bottom,i=e.pageY,{BlockSelection:o}=this.Editor;if(e.target instanceof Element&&e.target.isEqualNode(this.nodes.redactor)&&!o.anyBlockSelected&&r<i){e.stopImmediatePropagation(),e.stopPropagation();const{BlockManager:s,Caret:a,Toolbar:l}=this.Editor;(!s.lastBlock.tool.isDefault||!s.lastBlock.isEmpty)&&s.insertAtEnd(),a.setToTheLastBlock(),l.moveAndOpen(s.lastBlock)}}selectionChanged(){const{CrossBlockSelection:e,BlockSelection:n}=this.Editor,r=er.anchorElement;if(e.isCrossBlockSelectionStarted&&n.anyBlockSelected&&er.get().removeAllRanges(),!r){er.range||this.Editor.InlineToolbar.close();return}const i=r.closest(`.${Lh.CSS.content}`);(i===null||i.closest(`.${er.CSS.editorWrapper}`)!==this.nodes.wrapper)&&(this.Editor.InlineToolbar.containsNode(r)||this.Editor.InlineToolbar.close(),r.dataset.inlineToolbar!=="true")||(this.Editor.BlockManager.currentBlock||this.Editor.BlockManager.setCurrentBlockByChildNode(r),this.Editor.InlineToolbar.tryToShow(!0))}enableInputsEmptyMark(){function e(n){const r=n.target;k5e(r)}this.readOnlyMutableListeners.on(this.nodes.wrapper,"input",e),this.readOnlyMutableListeners.on(this.nodes.wrapper,"focusin",e),this.readOnlyMutableListeners.on(this.nodes.wrapper,"focusout",e)}}const hOt={BlocksAPI:Z6t,CaretAPI:Q6t,EventsAPI:J6t,I18nAPI:eNt,API:tNt,InlineToolbarAPI:nNt,ListenersAPI:rNt,NotifierAPI:aNt,ReadOnlyAPI:lNt,SanitizerAPI:gNt,SaverAPI:mNt,SelectionAPI:yNt,ToolsAPI:vNt,StylesAPI:bNt,ToolbarAPI:xNt,TooltipAPI:CNt,UiAPI:TNt,BlockSettings:QNt,Toolbar:sLt,InlineToolbar:aLt,BlockEvents:z8t,BlockManager:j8t,BlockSelection:U8t,Caret:H8t,CrossBlockSelection:G8t,DragNDrop:W8t,ModificationsObserver:Y8t,Paste:Z8t,ReadOnly:X8t,RectangleSelection:Q8t,Renderer:J8t,Saver:eOt,Tools:RAe,UI:fOt};class pOt{constructor(e){this.moduleInstances={},this.eventsDispatcher=new NE;let n,r;this.isReady=new Promise((i,o)=>{n=i,r=o}),Promise.resolve().then(async()=>{this.configuration=e,this.validate(),this.init(),await this.start(),await this.render();const{BlockManager:i,Caret:o,UI:s,ModificationsObserver:a}=this.moduleInstances;s.checkEmptiness(),a.enable(),this.configuration.autofocus===!0&&this.configuration.readOnly!==!0&&o.setToBlock(i.blocks[0],o.positions.START),n()}).catch(i=>{Qr(`Editor.js is not ready because of ${i}`,"error"),r(i)})}set configuration(e){var n,r;oa(e)?this.config={...e}:this.config={holder:e},KG(!!this.config.holderId,"config.holderId","config.holder"),this.config.holderId&&!this.config.holder&&(this.config.holder=this.config.holderId,this.config.holderId=null),this.config.holder==null&&(this.config.holder="editorjs"),this.config.logLevel||(this.config.logLevel=x5e.VERBOSE),M6t(this.config.logLevel),KG(!!this.config.initialBlock,"config.initialBlock","config.defaultBlock"),this.config.defaultBlock=this.config.defaultBlock||this.config.initialBlock||"paragraph",this.config.minHeight=this.config.minHeight!==void 0?this.config.minHeight:300;const i={type:this.config.defaultBlock,data:{}};this.config.placeholder=this.config.placeholder||!1,this.config.sanitizer=this.config.sanitizer||{p:!0,b:!0,a:!0},this.config.hideToolbar=this.config.hideToolbar?this.config.hideToolbar:!1,this.config.tools=this.config.tools||{},this.config.i18n=this.config.i18n||{},this.config.data=this.config.data||{blocks:[]},this.config.onReady=this.config.onReady||(()=>{}),this.config.onChange=this.config.onChange||(()=>{}),this.config.inlineToolbar=this.config.inlineToolbar!==void 0?this.config.inlineToolbar:!0,(Xc(this.config.data)||!this.config.data.blocks||this.config.data.blocks.length===0)&&(this.config.data={blocks:[i]}),this.config.readOnly=this.config.readOnly||!1,(n=this.config.i18n)!=null&&n.messages&&Ga.setDictionary(this.config.i18n.messages),this.config.i18n.direction=((r=this.config.i18n)==null?void 0:r.direction)||"ltr"}get configuration(){return this.config}validate(){const{holderId:e,holder:n}=this.config;if(e&&n)throw Error("«holderId» and «holder» param can't assign at the same time.");if(Mh(n)&&!Rt.get(n))throw Error(`element with ID «${n}» is missing. Pass correct holder's ID.`);if(n&&oa(n)&&!Rt.isElement(n))throw Error("«holder» value must be an Element node")}init(){this.constructModules(),this.configureModules()}async start(){await["Tools","UI","BlockManager","Paste","BlockSelection","RectangleSelection","CrossBlockSelection","ReadOnly"].reduce((e,n)=>e.then(async()=>{try{await this.moduleInstances[n].prepare()}catch(r){if(r instanceof I5e)throw new Error(r.message);Qr(`Module ${n} was skipped because of %o`,"warn",r)}}),Promise.resolve())}render(){return this.moduleInstances.Renderer.render(this.config.data.blocks)}constructModules(){Object.entries(hOt).forEach(([e,n])=>{try{this.moduleInstances[e]=new n({config:this.configuration,eventsDispatcher:this.eventsDispatcher})}catch(r){Qr("[constructModules]",`Module ${e} skipped because`,"error",r)}})}configureModules(){for(const e in this.moduleInstances)Object.prototype.hasOwnProperty.call(this.moduleInstances,e)&&(this.moduleInstances[e].state=this.getModulesDiff(e))}getModulesDiff(e){const n={};for(const r in this.moduleInstances)r!==e&&(n[r]=this.moduleInstances[r]);return n}}class gOt{static get version(){return"2.31.3"}constructor(e){let n=()=>{};oa(e)&&bo(e.onReady)&&(n=e.onReady);const r=new pOt(e);this.isReady=r.isReady.then(()=>{this.exportAPI(r),n()})}exportAPI(e){const n=["configuration"],r=()=>{Object.values(e.moduleInstances).forEach(i=>{bo(i.destroy)&&i.destroy(),i.listeners.removeAll()}),ENt(),e=null;for(const i in this)Object.prototype.hasOwnProperty.call(this,i)&&delete this[i];Object.setPrototypeOf(this,null)};n.forEach(i=>{this[i]=e[i]}),this.destroy=r,Object.setPrototypeOf(this,e.moduleInstances.API.methods),delete this.exportAPI,Object.entries({blocks:{clear:"clear",render:"render"},caret:{focus:"focus"},events:{on:"on",off:"off",emit:"emit"},saver:{save:"save"}}).forEach(([i,o])=>{Object.entries(o).forEach(([s,a])=>{this[a]=e.moduleInstances.API.methods[i][s]})})}}(function(){try{if(typeof document<"u"){var t=document.createElement("style");t.appendChild(document.createTextNode(".ce-header{padding:.6em 0 3px;margin:0;line-height:1.25em;outline:none}.ce-header p,.ce-header div{padding:0!important;margin:0!important}")),document.head.appendChild(t)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();const mOt='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M6 7L6 12M6 17L6 12M6 12L12 12M12 7V12M12 17L12 12"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M19 17V10.2135C19 10.1287 18.9011 10.0824 18.836 10.1367L16 12.5"/></svg>',yOt='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M6 7L6 12M6 17L6 12M6 12L12 12M12 7V12M12 17L12 12"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M16 11C16 10 19 9.5 19 12C19 13.9771 16.0684 13.9997 16.0012 16.8981C15.9999 16.9533 16.0448 17 16.1 17L19.3 17"/></svg>',vOt='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M6 7L6 12M6 17L6 12M6 12L12 12M12 7V12M12 17L12 12"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M16 11C16 10.5 16.8323 10 17.6 10C18.3677 10 19.5 10.311 19.5 11.5C19.5 12.5315 18.7474 12.9022 18.548 12.9823C18.5378 12.9864 18.5395 13.0047 18.5503 13.0063C18.8115 13.0456 20 13.3065 20 14.8C20 16 19.5 17 17.8 17C17.8 17 16 17 16 16.3"/></svg>',bOt='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M6 7L6 12M6 17L6 12M6 12L12 12M12 7V12M12 17L12 12"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M18 10L15.2834 14.8511C15.246 14.9178 15.294 15 15.3704 15C16.8489 15 18.7561 15 20.2 15M19 17C19 15.7187 19 14.8813 19 13.6"/></svg>',xOt='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M6 7L6 12M6 17L6 12M6 12L12 12M12 7V12M12 17L12 12"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M16 15.9C16 15.9 16.3768 17 17.8 17C19.5 17 20 15.6199 20 14.7C20 12.7323 17.6745 12.0486 16.1635 12.9894C16.094 13.0327 16 12.9846 16 12.9027V10.1C16 10.0448 16.0448 10 16.1 10H19.8"/></svg>',wOt='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M6 7L6 12M6 17L6 12M6 12L12 12M12 7V12M12 17L12 12"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M19.5 10C16.5 10.5 16 13.3285 16 15M16 15V15C16 16.1046 16.8954 17 18 17H18.3246C19.3251 17 20.3191 16.3492 20.2522 15.3509C20.0612 12.4958 16 12.6611 16 15Z"/></svg>',_Ot='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M9 7L9 12M9 17V12M9 12L15 12M15 7V12M15 17L15 12"/></svg>';let SOt=class{constructor({data:e,config:n,api:r,readOnly:i}){this.api=r,this.readOnly=i,this._settings=n,this._data=this.normalizeData(e),this._element=this.getTag()}get _CSS(){return{block:this.api.styles.block,wrapper:"ce-header"}}isHeaderData(e){return e.text!==void 0}normalizeData(e){const n={text:"",level:this.defaultLevel.number};return this.isHeaderData(e)&&(n.text=e.text||"",e.level!==void 0&&!isNaN(parseInt(e.level.toString()))&&(n.level=parseInt(e.level.toString()))),n}render(){return this._element}renderSettings(){return this.levels.map(e=>({icon:e.svg,label:this.api.i18n.t(`Heading ${e.number}`),onActivate:()=>this.setLevel(e.number),closeOnActivate:!0,isActive:this.currentLevel.number===e.number,render:()=>document.createElement("div")}))}setLevel(e){this.data={level:e,text:this.data.text}}merge(e){this._element.insertAdjacentHTML("beforeend",e.text)}validate(e){return e.text.trim()!==""}save(e){return{text:e.innerHTML,level:this.currentLevel.number}}static get conversionConfig(){return{export:"text",import:"text"}}static get sanitize(){return{level:!1,text:{}}}static get isReadOnlySupported(){return!0}get data(){return this._data.text=this._element.innerHTML,this._data.level=this.currentLevel.number,this._data}set data(e){if(this._data=this.normalizeData(e),e.level!==void 0&&this._element.parentNode){const n=this.getTag();n.innerHTML=this._element.innerHTML,this._element.parentNode.replaceChild(n,this._element),this._element=n}e.text!==void 0&&(this._element.innerHTML=this._data.text||"")}getTag(){const e=document.createElement(this.currentLevel.tag);return e.innerHTML=this._data.text||"",e.classList.add(this._CSS.wrapper),e.contentEditable=this.readOnly?"false":"true",e.dataset.placeholder=this.api.i18n.t(this._settings.placeholder||""),e}get currentLevel(){let e=this.levels.find(n=>n.number===this._data.level);return e||(e=this.defaultLevel),e}get defaultLevel(){if(this._settings.defaultLevel){const e=this.levels.find(n=>n.number===this._settings.defaultLevel);if(e)return e;console.warn("(ง'̀-'́)ง Heading Tool: the default level specified was not found in available levels")}return this.levels[1]}get levels(){const e=[{number:1,tag:"H1",svg:mOt},{number:2,tag:"H2",svg:yOt},{number:3,tag:"H3",svg:vOt},{number:4,tag:"H4",svg:bOt},{number:5,tag:"H5",svg:xOt},{number:6,tag:"H6",svg:wOt}];return this._settings.levels?e.filter(n=>this._settings.levels.includes(n.number)):e}onPaste(e){const n=e.detail;if("data"in n){const r=n.data;let i=this.defaultLevel.number;switch(r.tagName){case"H1":i=1;break;case"H2":i=2;break;case"H3":i=3;break;case"H4":i=4;break;case"H5":i=5;break;case"H6":i=6;break}this._settings.levels&&(i=this._settings.levels.reduce((o,s)=>Math.abs(s-i)<Math.abs(o-i)?s:o)),this.data={level:i,text:r.innerHTML}}}static get pasteConfig(){return{tags:["H1","H2","H3","H4","H5","H6"]}}static get toolbox(){return{icon:_Ot,title:"Heading"}}};(function(){try{if(typeof document<"u"){var t=document.createElement("style");t.appendChild(document.createTextNode('.cdx-list{margin:0;padding:0;outline:none;display:grid;counter-reset:item;gap:var(--spacing-s);padding:var(--spacing-xs);--spacing-s: 8px;--spacing-xs: 6px;--list-counter-type: numeric;--radius-border: 5px;--checkbox-background: #fff;--color-border: #C9C9C9;--color-bg-checked: #369FFF;--line-height: 1.45em;--color-bg-checked-hover: #0059AB;--color-tick: #fff;--size-checkbox: 1.2em}.cdx-list__item{line-height:var(--line-height);display:grid;grid-template-columns:auto 1fr;grid-template-rows:auto auto;grid-template-areas:"checkbox content" ". child"}.cdx-list__item-children{display:grid;grid-area:child;gap:var(--spacing-s);padding-top:var(--spacing-s)}.cdx-list__item [contenteditable]{outline:none}.cdx-list__item-content{word-break:break-word;white-space:pre-wrap;grid-area:content;padding-left:var(--spacing-s)}.cdx-list__item:before{counter-increment:item;white-space:nowrap}.cdx-list-ordered .cdx-list__item:before{content:counters(item,".",var(--list-counter-type)) "."}.cdx-list-ordered{counter-reset:item}.cdx-list-unordered .cdx-list__item:before{content:"•"}.cdx-list-checklist .cdx-list__item:before{content:""}.cdx-list__settings .cdx-settings-button{width:50%}.cdx-list__checkbox{padding-top:calc((var(--line-height) - var(--size-checkbox)) / 2);grid-area:checkbox;width:var(--size-checkbox);height:var(--size-checkbox);display:flex;cursor:pointer}.cdx-list__checkbox svg{opacity:0;height:var(--size-checkbox);width:var(--size-checkbox);left:-1px;top:-1px;position:absolute}@media (hover: hover){.cdx-list__checkbox:not(.cdx-list__checkbox--no-hover):hover .cdx-list__checkbox-check svg{opacity:1}}.cdx-list__checkbox--checked{line-height:var(--line-height)}@media (hover: hover){.cdx-list__checkbox--checked:not(.cdx-list__checkbox--checked--no-hover):hover .cdx-checklist__checkbox-check{background:var(--color-bg-checked-hover);border-color:var(--color-bg-checked-hover)}}.cdx-list__checkbox--checked .cdx-list__checkbox-check{background:var(--color-bg-checked);border-color:var(--color-bg-checked)}.cdx-list__checkbox--checked .cdx-list__checkbox-check svg{opacity:1}.cdx-list__checkbox--checked .cdx-list__checkbox-check svg path{stroke:var(--color-tick)}.cdx-list__checkbox--checked .cdx-list__checkbox-check:before{opacity:0;visibility:visible;transform:scale(2.5)}.cdx-list__checkbox-check{cursor:pointer;display:inline-block;position:relative;margin:0 auto;width:var(--size-checkbox);height:var(--size-checkbox);box-sizing:border-box;border-radius:var(--radius-border);border:1px solid var(--color-border);background:var(--checkbox-background)}.cdx-list__checkbox-check:before{content:"";position:absolute;top:0;right:0;bottom:0;left:0;border-radius:100%;background-color:var(--color-bg-checked);visibility:hidden;pointer-events:none;transform:scale(1);transition:transform .4s ease-out,opacity .4s}.cdx-list__checkbox-check--disabled{pointer-events:none}.cdx-list-start-with-field{background:#F8F8F8;border:1px solid rgba(226,226,229,.2);border-radius:6px;padding:2px;display:grid;grid-template-columns:auto auto 1fr;grid-template-rows:auto}.cdx-list-start-with-field--invalid{background:#FFECED;border:1px solid #E13F3F}.cdx-list-start-with-field--invalid .cdx-list-start-with-field__input{color:#e13f3f}.cdx-list-start-with-field__input{font-size:14px;outline:none;font-weight:500;font-family:inherit;border:0;background:transparent;margin:0;padding:0;line-height:22px;min-width:calc(100% - var(--toolbox-buttons-size) - var(--icon-margin-right))}.cdx-list-start-with-field__input::placeholder{color:var(--grayText);font-weight:500}')),document.head.appendChild(t)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();const EOt='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M7 12L10.4884 15.8372C10.5677 15.9245 10.705 15.9245 10.7844 15.8372L17 9"/></svg>',VAe='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M9.2 12L11.0586 13.8586C11.1367 13.9367 11.2633 13.9367 11.3414 13.8586L14.7 10.5"/><rect width="14" height="14" x="5" y="5" stroke="currentColor" stroke-width="2" rx="4"/></svg>',jAe='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><line x1="9" x2="19" y1="7" y2="7" stroke="currentColor" stroke-linecap="round" stroke-width="2"/><line x1="9" x2="19" y1="12" y2="12" stroke="currentColor" stroke-linecap="round" stroke-width="2"/><line x1="9" x2="19" y1="17" y2="17" stroke="currentColor" stroke-linecap="round" stroke-width="2"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M5.00001 17H4.99002"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M5.00001 12H4.99002"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M5.00001 7H4.99002"/></svg>',UAe='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><line x1="12" x2="19" y1="7" y2="7" stroke="currentColor" stroke-linecap="round" stroke-width="2"/><line x1="12" x2="19" y1="12" y2="12" stroke="currentColor" stroke-linecap="round" stroke-width="2"/><line x1="12" x2="19" y1="17" y2="17" stroke="currentColor" stroke-linecap="round" stroke-width="2"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M7.79999 14L7.79999 7.2135C7.79999 7.12872 7.7011 7.0824 7.63597 7.13668L4.79999 9.5"/></svg>',COt='<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M10 14.2L10 7.4135C10 7.32872 9.90111 7.28241 9.83598 7.33668L7 9.7" stroke="black" stroke-width="1.6" stroke-linecap="round"/><path d="M13.2087 14.2H13.2" stroke="black" stroke-width="1.6" stroke-linecap="round"/></svg>',TOt='<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M13.2087 14.2H13.2" stroke="black" stroke-width="1.6" stroke-linecap="round"/><path d="M10 14.2L10 9.5" stroke="black" stroke-width="1.6" stroke-linecap="round"/><path d="M10 7.01L10 7" stroke="black" stroke-width="1.8" stroke-linecap="round"/></svg>',kOt='<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M13.2087 14.2H13.2" stroke="black" stroke-width="1.6" stroke-linecap="round"/><path d="M10 14.2L10 7.2" stroke="black" stroke-width="1.6" stroke-linecap="round"/></svg>',POt='<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M16.0087 14.2H16" stroke="black" stroke-width="1.6" stroke-linecap="round"/><path d="M7 14.2L7.78865 12M13 14.2L12.1377 12M7.78865 12C7.78865 12 9.68362 7 10 7C10.3065 7 12.1377 12 12.1377 12M7.78865 12L12.1377 12" stroke="black" stroke-width="1.6" stroke-linecap="round"/></svg>',AOt='<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M14.2087 14.2H14.2" stroke="black" stroke-width="1.6" stroke-linecap="round"/><path d="M11.5 14.5C11.5 14.5 11 13.281 11 12.5M7 9.5C7 9.5 7.5 8.5 9 8.5C10.5 8.5 11 9.5 11 10.5L11 11.5M11 11.5L11 12.5M11 11.5C11 11.5 7 11 7 13C7 15.3031 11 15 11 12.5" stroke="black" stroke-width="1.6" stroke-linecap="round"/></svg>',IOt='<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M8 14.2L8 7.4135C8 7.32872 7.90111 7.28241 7.83598 7.33668L5 9.7" stroke="black" stroke-width="1.6" stroke-linecap="round"/><path d="M14 13L16.4167 10.7778M16.4167 10.7778L14 8.5M16.4167 10.7778H11.6562" stroke="black" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/></svg>';var oD=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function MOt(t){if(t.__esModule)return t;var e=t.default;if(typeof e=="function"){var n=function r(){return this instanceof r?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};n.prototype=e.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(t).forEach(function(r){var i=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(n,r,i.get?i:{enumerable:!0,get:function(){return t[r]}})}),n}var Li={},iK={},oK={};Object.defineProperty(oK,"__esModule",{value:!0}),oK.allInputsSelector=DOt;function DOt(){var t=["text","password","email","number","search","tel","url"];return"[contenteditable=true], textarea, input:not([type]), "+t.map(function(e){return'input[type="'.concat(e,'"]')}).join(", ")}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.allInputsSelector=void 0;var e=oK;Object.defineProperty(t,"allInputsSelector",{enumerable:!0,get:function(){return e.allInputsSelector}})})(iK);var Ay={},sK={};Object.defineProperty(sK,"__esModule",{value:!0}),sK.isNativeInput=NOt;function NOt(t){var e=["INPUT","TEXTAREA"];return t&&t.tagName?e.includes(t.tagName):!1}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.isNativeInput=void 0;var e=sK;Object.defineProperty(t,"isNativeInput",{enumerable:!0,get:function(){return e.isNativeInput}})})(Ay);var HAe={},aK={};Object.defineProperty(aK,"__esModule",{value:!0}),aK.append=LOt;function LOt(t,e){Array.isArray(e)?e.forEach(function(n){t.appendChild(n)}):t.appendChild(e)}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.append=void 0;var e=aK;Object.defineProperty(t,"append",{enumerable:!0,get:function(){return e.append}})})(HAe);var lK={},cK={};Object.defineProperty(cK,"__esModule",{value:!0}),cK.blockElements=OOt;function OOt(){return["address","article","aside","blockquote","canvas","div","dl","dt","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","li","main","nav","noscript","ol","output","p","pre","ruby","section","table","tbody","thead","tr","tfoot","ul","video"]}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.blockElements=void 0;var e=cK;Object.defineProperty(t,"blockElements",{enumerable:!0,get:function(){return e.blockElements}})})(lK);var GAe={},uK={};Object.defineProperty(uK,"__esModule",{value:!0}),uK.calculateBaseline=$Ot;function $Ot(t){var e=window.getComputedStyle(t),n=parseFloat(e.fontSize),r=parseFloat(e.lineHeight)||n*1.2,i=parseFloat(e.paddingTop),o=parseFloat(e.borderTopWidth),s=parseFloat(e.marginTop),a=n*.8,l=(r-n)/2,c=s+o+i+l+a;return c}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.calculateBaseline=void 0;var e=uK;Object.defineProperty(t,"calculateBaseline",{enumerable:!0,get:function(){return e.calculateBaseline}})})(GAe);var WAe={},dK={},fK={},hK={};Object.defineProperty(hK,"__esModule",{value:!0}),hK.isContentEditable=FOt;function FOt(t){return t.contentEditable==="true"}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.isContentEditable=void 0;var e=hK;Object.defineProperty(t,"isContentEditable",{enumerable:!0,get:function(){return e.isContentEditable}})})(fK),Object.defineProperty(dK,"__esModule",{value:!0}),dK.canSetCaret=ROt;var BOt=Ay,zOt=fK;function ROt(t){var e=!0;if((0,BOt.isNativeInput)(t))switch(t.type){case"file":case"checkbox":case"radio":case"hidden":case"submit":case"button":case"image":case"reset":e=!1;break}else e=(0,zOt.isContentEditable)(t);return e}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.canSetCaret=void 0;var e=dK;Object.defineProperty(t,"canSetCaret",{enumerable:!0,get:function(){return e.canSetCaret}})})(WAe);var sD={},pK={};function VOt(t,e,n){const r=n.value!==void 0?"value":"get",i=n[r],o=`#${e}Cache`;if(n[r]=function(...s){return this[o]===void 0&&(this[o]=i.apply(this,s)),this[o]},r==="get"&&n.set){const s=n.set;n.set=function(a){delete t[o],s.apply(this,a)}}return n}function KAe(){const t={win:!1,mac:!1,x11:!1,linux:!1},e=Object.keys(t).find(n=>window.navigator.appVersion.toLowerCase().indexOf(n)!==-1);return e!==void 0&&(t[e]=!0),t}function gK(t){return t!=null&&t!==""&&(typeof t!="object"||Object.keys(t).length>0)}function jOt(t){return!gK(t)}const UOt=()=>typeof window<"u"&&window.navigator!==null&&gK(window.navigator.platform)&&(/iP(ad|hone|od)/.test(window.navigator.platform)||window.navigator.platform==="MacIntel"&&window.navigator.maxTouchPoints>1);function HOt(t){const e=KAe();return t=t.replace(/shift/gi,"⇧").replace(/backspace/gi,"⌫").replace(/enter/gi,"⏎").replace(/up/gi,"↑").replace(/left/gi,"→").replace(/down/gi,"↓").replace(/right/gi,"←").replace(/escape/gi,"⎋").replace(/insert/gi,"Ins").replace(/delete/gi,"␡").replace(/\+/gi,"+"),e.mac?t=t.replace(/ctrl|cmd/gi,"⌘").replace(/alt/gi,"⌥"):t=t.replace(/cmd/gi,"Ctrl").replace(/windows/gi,"WIN"),t}function GOt(t){return t[0].toUpperCase()+t.slice(1)}function WOt(t){const e=document.createElement("div");e.style.position="absolute",e.style.left="-999px",e.style.bottom="-999px",e.innerHTML=t,document.body.appendChild(e);const n=window.getSelection(),r=document.createRange();if(r.selectNode(e),n===null)throw new Error("Cannot copy text to clipboard");n.removeAllRanges(),n.addRange(r),document.execCommand("copy"),document.body.removeChild(e)}function KOt(t,e,n){let r;return(...i)=>{const o=this,s=()=>{r=void 0,n!==!0&&t.apply(o,i)},a=n===!0&&r!==void 0;window.clearTimeout(r),r=window.setTimeout(s,e),a&&t.apply(o,i)}}function Hg(t){return Object.prototype.toString.call(t).match(/\s([a-zA-Z]+)/)[1].toLowerCase()}function qOt(t){return Hg(t)==="boolean"}function qAe(t){return Hg(t)==="function"||Hg(t)==="asyncfunction"}function YOt(t){return qAe(t)&&/^\s*class\s+/.test(t.toString())}function ZOt(t){return Hg(t)==="number"}function aD(t){return Hg(t)==="object"}function XOt(t){return Promise.resolve(t)===t}function QOt(t){return Hg(t)==="string"}function JOt(t){return Hg(t)==="undefined"}function mK(t,...e){if(!e.length)return t;const n=e.shift();if(aD(t)&&aD(n))for(const r in n)aD(n[r])?(t[r]===void 0&&Object.assign(t,{[r]:{}}),mK(t[r],n[r])):Object.assign(t,{[r]:n[r]});return mK(t,...e)}function e7t(t,e,n){const r=`«${e}» is deprecated and will be removed in the next major release. Please use the «${n}» instead.`;t&&console.warn(r)}function t7t(t){try{return new URL(t).href}catch{}return t.substring(0,2)==="//"?window.location.protocol+t:window.location.origin+t}function n7t(t){return t>47&&t<58||t===32||t===13||t===229||t>64&&t<91||t>95&&t<112||t>185&&t<193||t>218&&t<223}const r7t={BACKSPACE:8,TAB:9,ENTER:13,SHIFT:16,CTRL:17,ALT:18,ESC:27,SPACE:32,LEFT:37,UP:38,DOWN:40,RIGHT:39,DELETE:46,META:91,SLASH:191},i7t={LEFT:0,WHEEL:1,RIGHT:2,BACKWARD:3,FORWARD:4};class o7t{constructor(){this.completed=Promise.resolve()}add(e){return new Promise((n,r)=>{this.completed=this.completed.then(e).then(n).catch(r)})}}function s7t(t,e,n=void 0){let r,i,o,s=null,a=0;n||(n={});const l=function(){a=n.leading===!1?0:Date.now(),s=null,o=t.apply(r,i),s===null&&(r=i=null)};return function(){const c=Date.now();!a&&n.leading===!1&&(a=c);const u=e-(c-a);return r=this,i=arguments,u<=0||u>e?(s&&(clearTimeout(s),s=null),a=c,o=t.apply(r,i),s===null&&(r=i=null)):!s&&n.trailing!==!1&&(s=setTimeout(l,u)),o}}const a7t=Object.freeze(Object.defineProperty({__proto__:null,PromiseQueue:o7t,beautifyShortcut:HOt,cacheable:VOt,capitalize:GOt,copyTextToClipboard:WOt,debounce:KOt,deepMerge:mK,deprecationAssert:e7t,getUserOS:KAe,getValidUrl:t7t,isBoolean:qOt,isClass:YOt,isEmpty:jOt,isFunction:qAe,isIosDevice:UOt,isNumber:ZOt,isObject:aD,isPrintableKey:n7t,isPromise:XOt,isString:QOt,isUndefined:JOt,keyCodes:r7t,mouseButtons:i7t,notEmpty:gK,throttle:s7t,typeOf:Hg},Symbol.toStringTag,{value:"Module"})),yK=MOt(a7t);Object.defineProperty(pK,"__esModule",{value:!0}),pK.containsOnlyInlineElements=u7t;var l7t=yK,c7t=lK;function u7t(t){var e;(0,l7t.isString)(t)?(e=document.createElement("div"),e.innerHTML=t):e=t;var n=function(r){return!(0,c7t.blockElements)().includes(r.tagName.toLowerCase())&&Array.from(r.children).every(n)};return Array.from(e.children).every(n)}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.containsOnlyInlineElements=void 0;var e=pK;Object.defineProperty(t,"containsOnlyInlineElements",{enumerable:!0,get:function(){return e.containsOnlyInlineElements}})})(sD);var YAe={},vK={},lD={},bK={};Object.defineProperty(bK,"__esModule",{value:!0}),bK.make=d7t;function d7t(t,e,n){var r;e===void 0&&(e=null),n===void 0&&(n={});var i=document.createElement(t);if(Array.isArray(e)){var o=e.filter(function(a){return a!==void 0});(r=i.classList).add.apply(r,o)}else e!==null&&i.classList.add(e);for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(i[s]=n[s]);return i}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.make=void 0;var e=bK;Object.defineProperty(t,"make",{enumerable:!0,get:function(){return e.make}})})(lD),Object.defineProperty(vK,"__esModule",{value:!0}),vK.fragmentToString=h7t;var f7t=lD;function h7t(t){var e=(0,f7t.make)("div");return e.appendChild(t),e.innerHTML}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.fragmentToString=void 0;var e=vK;Object.defineProperty(t,"fragmentToString",{enumerable:!0,get:function(){return e.fragmentToString}})})(YAe);var ZAe={},xK={};Object.defineProperty(xK,"__esModule",{value:!0}),xK.getContentLength=g7t;var p7t=Ay;function g7t(t){var e,n;return(0,p7t.isNativeInput)(t)?t.value.length:t.nodeType===Node.TEXT_NODE?t.length:(n=(e=t.textContent)===null||e===void 0?void 0:e.length)!==null&&n!==void 0?n:0}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.getContentLength=void 0;var e=xK;Object.defineProperty(t,"getContentLength",{enumerable:!0,get:function(){return e.getContentLength}})})(ZAe);var wK={},_K={},XAe=oD&&oD.__spreadArray||function(t,e,n){if(n||arguments.length===2)for(var r=0,i=e.length,o;r<i;r++)(o||!(r in e))&&(o||(o=Array.prototype.slice.call(e,0,r)),o[r]=e[r]);return t.concat(o||Array.prototype.slice.call(e))};Object.defineProperty(_K,"__esModule",{value:!0}),_K.getDeepestBlockElements=QAe;var m7t=sD;function QAe(t){return(0,m7t.containsOnlyInlineElements)(t)?[t]:Array.from(t.children).reduce(function(e,n){return XAe(XAe([],e,!0),QAe(n),!0)},[])}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.getDeepestBlockElements=void 0;var e=_K;Object.defineProperty(t,"getDeepestBlockElements",{enumerable:!0,get:function(){return e.getDeepestBlockElements}})})(wK);var JAe={},SK={},cD={},EK={};Object.defineProperty(EK,"__esModule",{value:!0}),EK.isLineBreakTag=y7t;function y7t(t){return["BR","WBR"].includes(t.tagName)}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.isLineBreakTag=void 0;var e=EK;Object.defineProperty(t,"isLineBreakTag",{enumerable:!0,get:function(){return e.isLineBreakTag}})})(cD);var uD={},CK={};Object.defineProperty(CK,"__esModule",{value:!0}),CK.isSingleTag=v7t;function v7t(t){return["AREA","BASE","BR","COL","COMMAND","EMBED","HR","IMG","INPUT","KEYGEN","LINK","META","PARAM","SOURCE","TRACK","WBR"].includes(t.tagName)}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.isSingleTag=void 0;var e=CK;Object.defineProperty(t,"isSingleTag",{enumerable:!0,get:function(){return e.isSingleTag}})})(uD),Object.defineProperty(SK,"__esModule",{value:!0}),SK.getDeepestNode=eIe;var b7t=Ay,x7t=cD,w7t=uD;function eIe(t,e){e===void 0&&(e=!1);var n=e?"lastChild":"firstChild",r=e?"previousSibling":"nextSibling";if(t.nodeType===Node.ELEMENT_NODE&&t[n]){var i=t[n];if((0,w7t.isSingleTag)(i)&&!(0,b7t.isNativeInput)(i)&&!(0,x7t.isLineBreakTag)(i))if(i[r])i=i[r];else if(i.parentNode!==null&&i.parentNode[r])i=i.parentNode[r];else return i.parentNode;return eIe(i,e)}return t}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.getDeepestNode=void 0;var e=SK;Object.defineProperty(t,"getDeepestNode",{enumerable:!0,get:function(){return e.getDeepestNode}})})(JAe);var tIe={},TK={},dD=oD&&oD.__spreadArray||function(t,e,n){if(n||arguments.length===2)for(var r=0,i=e.length,o;r<i;r++)(o||!(r in e))&&(o||(o=Array.prototype.slice.call(e,0,r)),o[r]=e[r]);return t.concat(o||Array.prototype.slice.call(e))};Object.defineProperty(TK,"__esModule",{value:!0}),TK.findAllInputs=T7t;var _7t=sD,S7t=wK,E7t=iK,C7t=Ay;function T7t(t){return Array.from(t.querySelectorAll((0,E7t.allInputsSelector)())).reduce(function(e,n){return(0,C7t.isNativeInput)(n)||(0,_7t.containsOnlyInlineElements)(n)?dD(dD([],e,!0),[n],!1):dD(dD([],e,!0),(0,S7t.getDeepestBlockElements)(n),!0)},[])}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.findAllInputs=void 0;var e=TK;Object.defineProperty(t,"findAllInputs",{enumerable:!0,get:function(){return e.findAllInputs}})})(tIe);var nIe={},kK={};Object.defineProperty(kK,"__esModule",{value:!0}),kK.isCollapsedWhitespaces=k7t;function k7t(t){return!/[^\t\n\r ]/.test(t)}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.isCollapsedWhitespaces=void 0;var e=kK;Object.defineProperty(t,"isCollapsedWhitespaces",{enumerable:!0,get:function(){return e.isCollapsedWhitespaces}})})(nIe);var PK={},AK={};Object.defineProperty(AK,"__esModule",{value:!0}),AK.isElement=A7t;var P7t=yK;function A7t(t){return(0,P7t.isNumber)(t)?!1:!!t&&!!t.nodeType&&t.nodeType===Node.ELEMENT_NODE}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.isElement=void 0;var e=AK;Object.defineProperty(t,"isElement",{enumerable:!0,get:function(){return e.isElement}})})(PK);var rIe={},IK={},MK={},DK={};Object.defineProperty(DK,"__esModule",{value:!0}),DK.isLeaf=I7t;function I7t(t){return t===null?!1:t.childNodes.length===0}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.isLeaf=void 0;var e=DK;Object.defineProperty(t,"isLeaf",{enumerable:!0,get:function(){return e.isLeaf}})})(MK);var NK={},LK={};Object.defineProperty(LK,"__esModule",{value:!0}),LK.isNodeEmpty=O7t;var M7t=cD,D7t=PK,N7t=Ay,L7t=uD;function O7t(t,e){var n="";return(0,L7t.isSingleTag)(t)&&!(0,M7t.isLineBreakTag)(t)?!1:((0,D7t.isElement)(t)&&(0,N7t.isNativeInput)(t)?n=t.value:t.textContent!==null&&(n=t.textContent.replace("​","")),e!==void 0&&(n=n.replace(new RegExp(e,"g"),"")),n.trim().length===0)}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.isNodeEmpty=void 0;var e=LK;Object.defineProperty(t,"isNodeEmpty",{enumerable:!0,get:function(){return e.isNodeEmpty}})})(NK),Object.defineProperty(IK,"__esModule",{value:!0}),IK.isEmpty=B7t;var $7t=MK,F7t=NK;function B7t(t,e){t.normalize();for(var n=[t];n.length>0;){var r=n.shift();if(r){if(t=r,(0,$7t.isLeaf)(t)&&!(0,F7t.isNodeEmpty)(t,e))return!1;n.push.apply(n,Array.from(t.childNodes))}}return!0}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.isEmpty=void 0;var e=IK;Object.defineProperty(t,"isEmpty",{enumerable:!0,get:function(){return e.isEmpty}})})(rIe);var iIe={},OK={};Object.defineProperty(OK,"__esModule",{value:!0}),OK.isFragment=R7t;var z7t=yK;function R7t(t){return(0,z7t.isNumber)(t)?!1:!!t&&!!t.nodeType&&t.nodeType===Node.DOCUMENT_FRAGMENT_NODE}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.isFragment=void 0;var e=OK;Object.defineProperty(t,"isFragment",{enumerable:!0,get:function(){return e.isFragment}})})(iIe);var oIe={},$K={};Object.defineProperty($K,"__esModule",{value:!0}),$K.isHTMLString=j7t;var V7t=lD;function j7t(t){var e=(0,V7t.make)("div");return e.innerHTML=t,e.childElementCount>0}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.isHTMLString=void 0;var e=$K;Object.defineProperty(t,"isHTMLString",{enumerable:!0,get:function(){return e.isHTMLString}})})(oIe);var sIe={},FK={};Object.defineProperty(FK,"__esModule",{value:!0}),FK.offset=U7t;function U7t(t){var e=t.getBoundingClientRect(),n=window.pageXOffset||document.documentElement.scrollLeft,r=window.pageYOffset||document.documentElement.scrollTop,i=e.top+r,o=e.left+n;return{top:i,left:o,bottom:i+e.height,right:o+e.width}}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.offset=void 0;var e=FK;Object.defineProperty(t,"offset",{enumerable:!0,get:function(){return e.offset}})})(sIe);var aIe={},BK={};Object.defineProperty(BK,"__esModule",{value:!0}),BK.prepend=H7t;function H7t(t,e){Array.isArray(e)?(e=e.reverse(),e.forEach(function(n){return t.prepend(n)})):t.prepend(e)}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.prepend=void 0;var e=BK;Object.defineProperty(t,"prepend",{enumerable:!0,get:function(){return e.prepend}})})(aIe),(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.prepend=t.offset=t.make=t.isLineBreakTag=t.isSingleTag=t.isNodeEmpty=t.isLeaf=t.isHTMLString=t.isFragment=t.isEmpty=t.isElement=t.isContentEditable=t.isCollapsedWhitespaces=t.findAllInputs=t.isNativeInput=t.allInputsSelector=t.getDeepestNode=t.getDeepestBlockElements=t.getContentLength=t.fragmentToString=t.containsOnlyInlineElements=t.canSetCaret=t.calculateBaseline=t.blockElements=t.append=void 0;var e=iK;Object.defineProperty(t,"allInputsSelector",{enumerable:!0,get:function(){return e.allInputsSelector}});var n=Ay;Object.defineProperty(t,"isNativeInput",{enumerable:!0,get:function(){return n.isNativeInput}});var r=HAe;Object.defineProperty(t,"append",{enumerable:!0,get:function(){return r.append}});var i=lK;Object.defineProperty(t,"blockElements",{enumerable:!0,get:function(){return i.blockElements}});var o=GAe;Object.defineProperty(t,"calculateBaseline",{enumerable:!0,get:function(){return o.calculateBaseline}});var s=WAe;Object.defineProperty(t,"canSetCaret",{enumerable:!0,get:function(){return s.canSetCaret}});var a=sD;Object.defineProperty(t,"containsOnlyInlineElements",{enumerable:!0,get:function(){return a.containsOnlyInlineElements}});var l=YAe;Object.defineProperty(t,"fragmentToString",{enumerable:!0,get:function(){return l.fragmentToString}});var c=ZAe;Object.defineProperty(t,"getContentLength",{enumerable:!0,get:function(){return c.getContentLength}});var u=wK;Object.defineProperty(t,"getDeepestBlockElements",{enumerable:!0,get:function(){return u.getDeepestBlockElements}});var d=JAe;Object.defineProperty(t,"getDeepestNode",{enumerable:!0,get:function(){return d.getDeepestNode}});var p=tIe;Object.defineProperty(t,"findAllInputs",{enumerable:!0,get:function(){return p.findAllInputs}});var g=nIe;Object.defineProperty(t,"isCollapsedWhitespaces",{enumerable:!0,get:function(){return g.isCollapsedWhitespaces}});var b=fK;Object.defineProperty(t,"isContentEditable",{enumerable:!0,get:function(){return b.isContentEditable}});var w=PK;Object.defineProperty(t,"isElement",{enumerable:!0,get:function(){return w.isElement}});var _=rIe;Object.defineProperty(t,"isEmpty",{enumerable:!0,get:function(){return _.isEmpty}});var E=iIe;Object.defineProperty(t,"isFragment",{enumerable:!0,get:function(){return E.isFragment}});var A=oIe;Object.defineProperty(t,"isHTMLString",{enumerable:!0,get:function(){return A.isHTMLString}});var k=MK;Object.defineProperty(t,"isLeaf",{enumerable:!0,get:function(){return k.isLeaf}});var M=NK;Object.defineProperty(t,"isNodeEmpty",{enumerable:!0,get:function(){return M.isNodeEmpty}});var L=cD;Object.defineProperty(t,"isLineBreakTag",{enumerable:!0,get:function(){return L.isLineBreakTag}});var F=uD;Object.defineProperty(t,"isSingleTag",{enumerable:!0,get:function(){return F.isSingleTag}});var R=lD;Object.defineProperty(t,"make",{enumerable:!0,get:function(){return R.make}});var B=sIe;Object.defineProperty(t,"offset",{enumerable:!0,get:function(){return B.offset}});var V=aIe;Object.defineProperty(t,"prepend",{enumerable:!0,get:function(){return V.prepend}})})(Li);const Ka="cdx-list",ka={wrapper:Ka,item:`${Ka}__item`,itemContent:`${Ka}__item-content`,itemChildren:`${Ka}__item-children`};class qd{static get CSS(){return{...ka,orderedList:`${Ka}-ordered`}}constructor(e,n){this.config=n,this.readOnly=e}renderWrapper(e){let n;return e===!0?n=Li.make("ol",[qd.CSS.wrapper,qd.CSS.orderedList]):n=Li.make("ol",[qd.CSS.orderedList,qd.CSS.itemChildren]),n}renderItem(e,n){const r=Li.make("li",qd.CSS.item),i=Li.make("div",qd.CSS.itemContent,{innerHTML:e,contentEditable:(!this.readOnly).toString()});return r.appendChild(i),r}getItemContent(e){const n=e.querySelector(`.${qd.CSS.itemContent}`);return!n||Li.isEmpty(n)?"":n.innerHTML}getItemMeta(){return{}}composeDefaultMeta(){return{}}}class Yd{static get CSS(){return{...ka,unorderedList:`${Ka}-unordered`}}constructor(e,n){this.config=n,this.readOnly=e}renderWrapper(e){let n;return e===!0?n=Li.make("ul",[Yd.CSS.wrapper,Yd.CSS.unorderedList]):n=Li.make("ul",[Yd.CSS.unorderedList,Yd.CSS.itemChildren]),n}renderItem(e,n){const r=Li.make("li",Yd.CSS.item),i=Li.make("div",Yd.CSS.itemContent,{innerHTML:e,contentEditable:(!this.readOnly).toString()});return r.appendChild(i),r}getItemContent(e){const n=e.querySelector(`.${Yd.CSS.itemContent}`);return!n||Li.isEmpty(n)?"":n.innerHTML}getItemMeta(){return{}}composeDefaultMeta(){return{}}}function Iy(t){return t.nodeType===Node.ELEMENT_NODE}var RE={},zK={},fD={},hD={};Object.defineProperty(hD,"__esModule",{value:!0}),hD.getContenteditableSlice=W7t;var G7t=Li;function W7t(t,e,n,r,i){var o;i===void 0&&(i=!1);var s=document.createRange();if(r==="left"?(s.setStart(t,0),s.setEnd(e,n)):(s.setStart(e,n),s.setEnd(t,t.childNodes.length)),i===!0){var a=s.extractContents();return(0,G7t.fragmentToString)(a)}var l=s.cloneContents(),c=document.createElement("div");c.appendChild(l);var u=(o=c.textContent)!==null&&o!==void 0?o:"";return u}Object.defineProperty(fD,"__esModule",{value:!0}),fD.checkContenteditableSliceForEmptiness=Y7t;var K7t=Li,q7t=hD;function Y7t(t,e,n,r){var i=(0,q7t.getContenteditableSlice)(t,e,n,r);return(0,K7t.isCollapsedWhitespaces)(i)}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.checkContenteditableSliceForEmptiness=void 0;var e=fD;Object.defineProperty(t,"checkContenteditableSliceForEmptiness",{enumerable:!0,get:function(){return e.checkContenteditableSliceForEmptiness}})})(zK);var lIe={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.getContenteditableSlice=void 0;var e=hD;Object.defineProperty(t,"getContenteditableSlice",{enumerable:!0,get:function(){return e.getContenteditableSlice}})})(lIe);var cIe={},RK={};Object.defineProperty(RK,"__esModule",{value:!0}),RK.focus=X7t;var Z7t=Li;function X7t(t,e){var n,r;if(e===void 0&&(e=!0),(0,Z7t.isNativeInput)(t)){t.focus();var i=e?0:t.value.length;t.setSelectionRange(i,i)}else{var o=document.createRange(),s=window.getSelection();if(!s)return;var a=function(p,g){g===void 0&&(g=!1);var b=document.createTextNode("");g?p.insertBefore(b,p.firstChild):p.appendChild(b),o.setStart(b,0),o.setEnd(b,0)},l=function(p){return p!=null},c=t.childNodes,u=e?c[0]:c[c.length-1];if(l(u)){for(;l(u)&&u.nodeType!==Node.TEXT_NODE;)u=e?u.firstChild:u.lastChild;if(l(u)&&u.nodeType===Node.TEXT_NODE){var d=(r=(n=u.textContent)===null||n===void 0?void 0:n.length)!==null&&r!==void 0?r:0,i=e?0:d;o.setStart(u,i),o.setEnd(u,i)}else a(t,e)}else a(t);s.removeAllRanges(),s.addRange(o)}}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.focus=void 0;var e=RK;Object.defineProperty(t,"focus",{enumerable:!0,get:function(){return e.focus}})})(cIe);var VK={},pD={};Object.defineProperty(pD,"__esModule",{value:!0}),pD.getCaretNodeAndOffset=Q7t;function Q7t(){var t=window.getSelection();if(t===null)return[null,0];var e=t.focusNode,n=t.focusOffset;return e===null?[null,0]:(e.nodeType!==Node.TEXT_NODE&&e.childNodes.length>0&&(e.childNodes[n]!==void 0?(e=e.childNodes[n],n=0):(e=e.childNodes[n-1],e.textContent!==null&&(n=e.textContent.length))),[e,n])}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.getCaretNodeAndOffset=void 0;var e=pD;Object.defineProperty(t,"getCaretNodeAndOffset",{enumerable:!0,get:function(){return e.getCaretNodeAndOffset}})})(VK);var uIe={},gD={};Object.defineProperty(gD,"__esModule",{value:!0}),gD.getRange=J7t;function J7t(){var t=window.getSelection();return t&&t.rangeCount?t.getRangeAt(0):null}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.getRange=void 0;var e=gD;Object.defineProperty(t,"getRange",{enumerable:!0,get:function(){return e.getRange}})})(uIe);var dIe={},jK={};Object.defineProperty(jK,"__esModule",{value:!0}),jK.isCaretAtEndOfInput=n$t;var fIe=Li,e$t=VK,t$t=zK;function n$t(t){var e=(0,fIe.getDeepestNode)(t,!0);if(e===null)return!0;if((0,fIe.isNativeInput)(e))return e.selectionEnd===e.value.length;var n=(0,e$t.getCaretNodeAndOffset)(),r=n[0],i=n[1];return r===null?!1:(0,t$t.checkContenteditableSliceForEmptiness)(t,r,i,"right")}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.isCaretAtEndOfInput=void 0;var e=jK;Object.defineProperty(t,"isCaretAtEndOfInput",{enumerable:!0,get:function(){return e.isCaretAtEndOfInput}})})(dIe);var hIe={},UK={};Object.defineProperty(UK,"__esModule",{value:!0}),UK.isCaretAtStartOfInput=o$t;var mD=Li,r$t=pD,i$t=fD;function o$t(t){var e=(0,mD.getDeepestNode)(t);if(e===null||(0,mD.isEmpty)(t))return!0;if((0,mD.isNativeInput)(e))return e.selectionEnd===0;if((0,mD.isEmpty)(t))return!0;var n=(0,r$t.getCaretNodeAndOffset)(),r=n[0],i=n[1];return r===null?!1:(0,i$t.checkContenteditableSliceForEmptiness)(t,r,i,"left")}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.isCaretAtStartOfInput=void 0;var e=UK;Object.defineProperty(t,"isCaretAtStartOfInput",{enumerable:!0,get:function(){return e.isCaretAtStartOfInput}})})(hIe);var pIe={},HK={};Object.defineProperty(HK,"__esModule",{value:!0}),HK.save=l$t;var s$t=Li,a$t=gD;function l$t(){var t=(0,a$t.getRange)(),e=(0,s$t.make)("span");if(e.id="cursor",e.hidden=!0,!!t)return t.insertNode(e),function(){var n=window.getSelection();n&&(t.setStartAfter(e),t.setEndAfter(e),n.removeAllRanges(),n.addRange(t),setTimeout(function(){e.remove()},150))}}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.save=void 0;var e=HK;Object.defineProperty(t,"save",{enumerable:!0,get:function(){return e.save}})})(pIe),(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.save=t.isCaretAtStartOfInput=t.isCaretAtEndOfInput=t.getRange=t.getCaretNodeAndOffset=t.focus=t.getContenteditableSlice=t.checkContenteditableSliceForEmptiness=void 0;var e=zK;Object.defineProperty(t,"checkContenteditableSliceForEmptiness",{enumerable:!0,get:function(){return e.checkContenteditableSliceForEmptiness}});var n=lIe;Object.defineProperty(t,"getContenteditableSlice",{enumerable:!0,get:function(){return n.getContenteditableSlice}});var r=cIe;Object.defineProperty(t,"focus",{enumerable:!0,get:function(){return r.focus}});var i=VK;Object.defineProperty(t,"getCaretNodeAndOffset",{enumerable:!0,get:function(){return i.getCaretNodeAndOffset}});var o=uIe;Object.defineProperty(t,"getRange",{enumerable:!0,get:function(){return o.getRange}});var s=dIe;Object.defineProperty(t,"isCaretAtEndOfInput",{enumerable:!0,get:function(){return s.isCaretAtEndOfInput}});var a=hIe;Object.defineProperty(t,"isCaretAtStartOfInput",{enumerable:!0,get:function(){return a.isCaretAtStartOfInput}});var l=pIe;Object.defineProperty(t,"save",{enumerable:!0,get:function(){return l.save}})})(RE);class Jo{static get CSS(){return{...ka,checklist:`${Ka}-checklist`,itemChecked:`${Ka}__checkbox--checked`,noHover:`${Ka}__checkbox--no-hover`,checkbox:`${Ka}__checkbox-check`,checkboxContainer:`${Ka}__checkbox`,checkboxCheckDisabled:`${Ka}__checkbox-check--disabled`}}constructor(e,n){this.config=n,this.readOnly=e}renderWrapper(e){let n;return e===!0?(n=Li.make("ul",[Jo.CSS.wrapper,Jo.CSS.checklist]),n.addEventListener("click",r=>{const i=r.target;if(i){const o=i.closest(`.${Jo.CSS.checkboxContainer}`);o&&o.contains(i)&&this.toggleCheckbox(o)}})):n=Li.make("ul",[Jo.CSS.checklist,Jo.CSS.itemChildren]),n}renderItem(e,n){const r=Li.make("li",[Jo.CSS.item,Jo.CSS.item]),i=Li.make("div",Jo.CSS.itemContent,{innerHTML:e,contentEditable:(!this.readOnly).toString()}),o=Li.make("span",Jo.CSS.checkbox),s=Li.make("div",Jo.CSS.checkboxContainer);return n.checked===!0&&s.classList.add(Jo.CSS.itemChecked),this.readOnly&&s.classList.add(Jo.CSS.checkboxCheckDisabled),o.innerHTML=EOt,s.appendChild(o),r.appendChild(s),r.appendChild(i),r}getItemContent(e){const n=e.querySelector(`.${Jo.CSS.itemContent}`);return!n||Li.isEmpty(n)?"":n.innerHTML}getItemMeta(e){const n=e.querySelector(`.${Jo.CSS.checkboxContainer}`);return{checked:n?n.classList.contains(Jo.CSS.itemChecked):!1}}composeDefaultMeta(){return{checked:!1}}toggleCheckbox(e){e.classList.toggle(Jo.CSS.itemChecked),e.classList.add(Jo.CSS.noHover),e.addEventListener("mouseleave",()=>this.removeSpecialHoverBehavior(e),{once:!0})}removeSpecialHoverBehavior(e){e.classList.remove(Jo.CSS.noHover)}}function GK(t,e="after"){const n=[];let r;function i(o){switch(e){case"after":return o.nextElementSibling;case"before":return o.previousElementSibling}}for(r=i(t);r!==null;)n.push(r),r=i(r);return n.length!==0?n:null}function Oh(t,e=!0){let n=t;return t.classList.contains(ka.item)&&(n=t.querySelector(`.${ka.itemChildren}`)),n===null?[]:Array.from(e?n.querySelectorAll(`:scope > .${ka.item}`):n.querySelectorAll(`.${ka.item}`))}function c$t(t){return t.nextElementSibling===null}function u$t(t){return t.querySelector(`.${ka.itemChildren}`)!==null}function Gg(t){return t.querySelector(`.${ka.itemChildren}`)}function WK(t){let e=t;t.classList.contains(ka.item)&&(e=Gg(t)),e!==null&&Oh(e).length===0&&e.remove()}function yD(t){return t.querySelector(`.${ka.itemContent}`)}function sx(t,e=!0){const n=yD(t);n&&RE.focus(n,e)}class KK{get currentItem(){const e=window.getSelection();if(!e)return null;let n=e.anchorNode;return!n||(Iy(n)||(n=n.parentNode),!n)||!Iy(n)?null:n.closest(`.${ka.item}`)}get currentItemLevel(){const e=this.currentItem;if(e===null)return null;let n=e.parentNode,r=0;for(;n!==null&&n!==this.listWrapper;)Iy(n)&&n.classList.contains(ka.item)&&(r+=1),n=n.parentNode;return r+1}constructor({data:e,config:n,api:r,readOnly:i,block:o},s){this.config=n,this.data=e,this.readOnly=i,this.api=r,this.block=o,this.renderer=s}render(){return this.listWrapper=this.renderer.renderWrapper(!0),this.data.items.length?this.appendItems(this.data.items,this.listWrapper):this.appendItems([{content:"",meta:{},items:[]}],this.listWrapper),this.readOnly||this.listWrapper.addEventListener("keydown",e=>{switch(e.key){case"Enter":e.shiftKey||this.enterPressed(e);break;case"Backspace":this.backspace(e);break;case"Tab":e.shiftKey?this.shiftTab(e):this.addTab(e);break}},!1),"start"in this.data.meta&&this.data.meta.start!==void 0&&this.changeStartWith(this.data.meta.start),"counterType"in this.data.meta&&this.data.meta.counterType!==void 0&&this.changeCounters(this.data.meta.counterType),this.listWrapper}save(e){const n=e??this.listWrapper,r=s=>Oh(s).map(a=>{const l=Gg(a),c=this.renderer.getItemContent(a),u=this.renderer.getItemMeta(a),d=l?r(l):[];return{content:c,meta:u,items:d}}),i=n?r(n):[];let o={style:this.data.style,meta:{},items:i};return this.data.style==="ordered"&&(o.meta={start:this.data.meta.start,counterType:this.data.meta.counterType}),o}static get pasteConfig(){return{tags:["OL","UL","LI"]}}merge(e){const n=this.block.holder.querySelectorAll(`.${ka.item}`),r=n[n.length-1],i=yD(r);if(r===null||i===null||(i.insertAdjacentHTML("beforeend",e.items[0].content),this.listWrapper===void 0))return;const o=Oh(this.listWrapper);if(o.length===0)return;const s=o[o.length-1];let a=Gg(s);const l=e.items.shift();l!==void 0&&(l.items.length!==0&&(a===null&&(a=this.renderer.renderWrapper(!1)),this.appendItems(l.items,a)),e.items.length>0&&this.appendItems(e.items,this.listWrapper))}onPaste(e){const n=e.detail.data;this.data=this.pasteHandler(n);const r=this.listWrapper;r&&r.parentNode&&r.parentNode.replaceChild(this.render(),r)}pasteHandler(e){const{tagName:n}=e;let r="unordered",i;switch(n){case"OL":r="ordered",i="ol";break;case"UL":case"LI":r="unordered",i="ul"}const o={style:r,meta:{},items:[]};r==="ordered"&&(this.data.meta.counterType="numeric",this.data.meta.start=1);const s=a=>Array.from(a.querySelectorAll(":scope > li")).map(l=>{const c=l.querySelector(`:scope > ${i}`),u=c?s(c):[];return{content:l.innerHTML??"",meta:{},items:u}});return o.items=s(e),o}changeStartWith(e){this.listWrapper.style.setProperty("counter-reset",`item ${e-1}`),this.data.meta.start=e}changeCounters(e){this.listWrapper.style.setProperty("--list-counter-type",e),this.data.meta.counterType=e}enterPressed(e){var n;const r=this.currentItem;if(e.stopPropagation(),e.preventDefault(),e.isComposing||r===null)return;const i=((n=this.renderer)==null?void 0:n.getItemContent(r).trim().length)===0,o=r.parentNode===this.listWrapper,s=r.previousElementSibling===null,a=this.api.blocks.getCurrentBlockIndex();if(o&&i)if(c$t(r)&&!u$t(r)){s?this.convertItemToDefaultBlock(a,!0):this.convertItemToDefaultBlock();return}else{this.splitList(r);return}else if(i){this.unshiftItem(r);return}else this.splitItem(r)}backspace(e){var n;const r=this.currentItem;if(r!==null&&RE.isCaretAtStartOfInput(r)&&((n=window.getSelection())==null?void 0:n.isCollapsed)!==!1){if(e.stopPropagation(),r.parentNode===this.listWrapper&&r.previousElementSibling===null){this.convertFirstItemToDefaultBlock();return}e.preventDefault(),this.mergeItemWithPrevious(r)}}shiftTab(e){e.stopPropagation(),e.preventDefault(),this.currentItem!==null&&this.unshiftItem(this.currentItem)}unshiftItem(e){if(!e.parentNode||!Iy(e.parentNode))return;const n=e.parentNode.closest(`.${ka.item}`);if(!n)return;let r=Gg(e);if(e.parentElement===null)return;const i=GK(e);i!==null&&(r===null&&(r=this.renderer.renderWrapper(!1)),i.forEach(o=>{r.appendChild(o)}),e.appendChild(r)),n.after(e),sx(e,!1),WK(n)}splitList(e){const n=Oh(e),r=this.block,i=this.api.blocks.getCurrentBlockIndex();if(n.length!==0){const l=n[0];this.unshiftItem(l),sx(e,!1)}if(e.previousElementSibling===null&&e.parentNode===this.listWrapper){this.convertItemToDefaultBlock(i);return}const o=GK(e);if(o===null)return;const s=this.renderer.renderWrapper(!0);o.forEach(l=>{s.appendChild(l)});const a=this.save(s);a.meta.start=this.data.style=="ordered"?1:void 0,this.api.blocks.insert(r?.name,a,this.config,i+1),this.convertItemToDefaultBlock(i+1),s.remove()}splitItem(e){const[n,r]=RE.getCaretNodeAndOffset();if(n===null)return;const i=yD(e);let o;i===null?o="":o=RE.getContenteditableSlice(i,n,r,"right",!0);const s=Gg(e),a=this.renderItem(o);e?.after(a),s&&a.appendChild(s),sx(a)}mergeItemWithPrevious(e){const n=e.previousElementSibling,r=e.parentNode;if(r===null||!Iy(r))return;const i=r.closest(`.${ka.item}`);if(!n&&!i||n&&!Iy(n))return;let o;if(n){const d=Oh(n,!1);d.length!==0&&d.length!==0?o=d[d.length-1]:o=n}else o=i;const s=this.renderer.getItemContent(e);if(!o)return;sx(o,!1);const a=yD(o);if(a===null)return;a.insertAdjacentHTML("beforeend",s);const l=Oh(e);if(l.length===0){e.remove(),WK(o);return}const c=n||i,u=Gg(c)??this.renderer.renderWrapper(!1);n?l.forEach(d=>{u.appendChild(d)}):l.forEach(d=>{u.prepend(d)}),Gg(c)===null&&o.appendChild(u),e.remove()}addTab(e){var n;e.stopPropagation(),e.preventDefault();const r=this.currentItem;if(!r)return;if(((n=this.config)==null?void 0:n.maxLevel)!==void 0){const s=this.currentItemLevel;if(s!==null&&s===this.config.maxLevel)return}const i=r.previousSibling;if(i===null||!Iy(i))return;const o=Gg(i);if(o)o.appendChild(r),Oh(r).forEach(s=>{o.appendChild(s)});else{const s=this.renderer.renderWrapper(!1);s.appendChild(r),Oh(r).forEach(a=>{s.appendChild(a)}),i.appendChild(s)}WK(r),sx(r,!1)}convertItemToDefaultBlock(e,n){let r;const i=this.currentItem,o=i!==null?this.renderer.getItemContent(i):"";n===!0&&this.api.blocks.delete(),e!==void 0?r=this.api.blocks.insert(void 0,{text:o},void 0,e):r=this.api.blocks.insert(),i?.remove(),this.api.caret.setToBlock(r,"start")}convertFirstItemToDefaultBlock(){const e=this.currentItem;if(e===null)return;const n=Oh(e);if(n.length!==0){const s=n[0];this.unshiftItem(s),sx(e)}const r=GK(e),i=this.api.blocks.getCurrentBlockIndex(),o=r===null;this.convertItemToDefaultBlock(i,o)}renderItem(e,n){const r=n??this.renderer.composeDefaultMeta();switch(!0){case this.renderer instanceof qd:return this.renderer.renderItem(e,r);case this.renderer instanceof Yd:return this.renderer.renderItem(e,r);default:return this.renderer.renderItem(e,r)}}appendItems(e,n){e.forEach(r=>{var i;const o=this.renderItem(r.content,r.meta);if(n.appendChild(o),r.items.length){const s=(i=this.renderer)==null?void 0:i.renderWrapper(!1);this.appendItems(r.items,s),o.appendChild(s)}})}}const ax={wrapper:`${Ka}-start-with-field`,input:`${Ka}-start-with-field__input`,startWithElementWrapperInvalid:`${Ka}-start-with-field--invalid`};function d$t(t,{value:e,placeholder:n,attributes:r,sanitize:i}){const o=Li.make("div",ax.wrapper),s=Li.make("input",ax.input,{placeholder:n,tabIndex:-1,value:e});for(const a in r)s.setAttribute(a,r[a]);return o.appendChild(s),s.addEventListener("input",()=>{i!==void 0&&(s.value=i(s.value));const a=s.checkValidity();!a&&!o.classList.contains(ax.startWithElementWrapperInvalid)&&o.classList.add(ax.startWithElementWrapperInvalid),a&&o.classList.contains(ax.startWithElementWrapperInvalid)&&o.classList.remove(ax.startWithElementWrapperInvalid),a&&t(s.value)}),o}const VE=new Map([["Numeric","numeric"],["Lower Roman","lower-roman"],["Upper Roman","upper-roman"],["Lower Alpha","lower-alpha"],["Upper Alpha","upper-alpha"]]),gIe=new Map([["numeric",COt],["lower-roman",TOt],["upper-roman",kOt],["lower-alpha",AOt],["upper-alpha",POt]]);function f$t(t){return t.replace(/\D+/g,"")}function h$t(t){return typeof t.items[0]=="string"}function p$t(t){return!("meta"in t)}function g$t(t){return typeof t.items[0]!="string"&&"text"in t.items[0]&&"checked"in t.items[0]&&typeof t.items[0].text=="string"&&typeof t.items[0].checked=="boolean"}function m$t(t){const e=[];return h$t(t)?(t.items.forEach(n=>{e.push({content:n,meta:{},items:[]})}),{style:t.style,meta:{},items:e}):g$t(t)?(t.items.forEach(n=>{e.push({content:n.text,meta:{checked:n.checked},items:[]})}),{style:"checklist",meta:{},items:e}):p$t(t)?{style:t.style,meta:{},items:t.items}:structuredClone(t)}class vD{static get isReadOnlySupported(){return!0}static get enableLineBreaks(){return!0}static get toolbox(){return[{icon:jAe,title:"Unordered List",data:{style:"unordered"}},{icon:UAe,title:"Ordered List",data:{style:"ordered"}},{icon:VAe,title:"Checklist",data:{style:"checklist"}}]}static get pasteConfig(){return{tags:["OL","UL","LI"]}}static get conversionConfig(){return{export:e=>vD.joinRecursive(e),import:(e,n)=>({meta:{},items:[{content:e,meta:{},items:[]}],style:n?.defaultStyle!==void 0?n.defaultStyle:"unordered"})}}get listStyle(){return this.data.style||this.defaultListStyle}set listStyle(e){var n;this.data.style=e,this.changeTabulatorByStyle();const r=this.list.render();(n=this.listElement)==null||n.replaceWith(r),this.listElement=r}constructor({data:e,config:n,api:r,readOnly:i,block:o}){var s;this.api=r,this.readOnly=i,this.config=n,this.block=o,this.defaultListStyle=((s=this.config)==null?void 0:s.defaultStyle)||"unordered",this.defaultCounterTypes=this.config.counterTypes||Array.from(VE.values());const a={style:this.defaultListStyle,meta:{},items:[]};this.data=Object.keys(e).length?m$t(e):a,this.listStyle==="ordered"&&this.data.meta.counterType===void 0&&(this.data.meta.counterType="numeric"),this.changeTabulatorByStyle()}static joinRecursive(e){return e.items.map(n=>`${n.content} ${vD.joinRecursive(n)}`).join("")}render(){return this.listElement=this.list.render(),this.listElement}save(){return this.data=this.list.save(),this.data}merge(e){this.list.merge(e)}renderSettings(){const e=[{label:this.api.i18n.t("Unordered"),icon:jAe,closeOnActivate:!0,isActive:this.listStyle=="unordered",onActivate:()=>{this.listStyle="unordered"}},{label:this.api.i18n.t("Ordered"),icon:UAe,closeOnActivate:!0,isActive:this.listStyle=="ordered",onActivate:()=>{this.listStyle="ordered"}},{label:this.api.i18n.t("Checklist"),icon:VAe,closeOnActivate:!0,isActive:this.listStyle=="checklist",onActivate:()=>{this.listStyle="checklist"}}];if(this.listStyle==="ordered"){const n=d$t(o=>this.changeStartWith(Number(o)),{value:String(this.data.meta.start??1),placeholder:"",attributes:{required:"true"},sanitize:o=>f$t(o)}),r=[{label:this.api.i18n.t("Start with"),icon:IOt,children:{items:[{element:n,type:"html"}]}}],i={label:this.api.i18n.t("Counter type"),icon:gIe.get(this.data.meta.counterType),children:{items:[]}};VE.forEach((o,s)=>{const a=VE.get(s);this.defaultCounterTypes.includes(a)&&i.children.items.push({title:this.api.i18n.t(s),icon:gIe.get(a),isActive:this.data.meta.counterType===VE.get(s),closeOnActivate:!0,onActivate:()=>{this.changeCounters(VE.get(s))}})}),i.children.items.length>1&&r.push(i),e.push({type:"separator"},...r)}return e}onPaste(e){const{tagName:n}=e.detail.data;switch(n){case"OL":this.listStyle="ordered";break;case"UL":case"LI":this.listStyle="unordered"}this.list.onPaste(e)}pasteHandler(e){return this.list.pasteHandler(e)}changeCounters(e){var n;(n=this.list)==null||n.changeCounters(e),this.data.meta.counterType=e}changeStartWith(e){var n;(n=this.list)==null||n.changeStartWith(e),this.data.meta.start=e}changeTabulatorByStyle(){switch(this.listStyle){case"ordered":this.list=new KK({data:this.data,readOnly:this.readOnly,api:this.api,config:this.config,block:this.block},new qd(this.readOnly,this.config));break;case"unordered":this.list=new KK({data:this.data,readOnly:this.readOnly,api:this.api,config:this.config,block:this.block},new Yd(this.readOnly,this.config));break;case"checklist":this.list=new KK({data:this.data,readOnly:this.readOnly,api:this.api,config:this.config,block:this.block},new Jo(this.readOnly,this.config));break}}}const mIe=({data:t,onChange:e,placeholder:n,readOnly:r=!1,className:i,minHeight:o=300})=>{const s=P.useRef(`editorjs-${Math.random().toString(36).slice(2,9)}`),a=P.useRef(null);return P.useEffect(()=>{if(!a.current){const l=new gOt({holder:s.current,data:t,readOnly:r,placeholder:n||"Start writing...",minHeight:o,tools:{header:{class:SOt,inlineToolbar:!0,config:{placeholder:"Heading",levels:[1,2,3],defaultLevel:2}},list:{class:vD,inlineToolbar:!0,config:{defaultStyle:"unordered"}}},onChange:async(c,u)=>{const d=await c.saver.save();e?.(d)}});a.current=l}return()=>{if(a.current&&typeof a.current.destroy=="function"){try{a.current.destroy()}catch{}a.current=null}}},[]),P.useEffect(()=>{a.current&&typeof a.current.readOnly<"u"&&a.current.readOnly.toggle(r)},[r]),v.jsx("div",{className:he("w-full relative",i),children:v.jsx("div",{id:s.current,className:"chesai-editor w-full",style:{minHeight:o}})})};mIe.displayName="MediumTextEditor";var My="NavigationMenu",[qK,yIe,y$t]=Gm(My),[YK,v$t,b$t]=Gm(My),[ZK,don]=pa(My,[y$t,b$t]),[x$t,Qc]=ZK(My),[w$t,_$t]=ZK(My),vIe=U.forwardRef((t,e)=>{const{__scopeNavigationMenu:n,value:r,onValueChange:i,defaultValue:o,delayDuration:s=200,skipDelayDuration:a=300,orientation:l="horizontal",dir:c,...u}=t,[d,p]=U.useState(null),g=Qn(e,V=>p(V)),b=If(c),w=U.useRef(0),_=U.useRef(0),E=U.useRef(0),[A,k]=U.useState(!0),[M,L]=qs({prop:r,onChange:V=>{const H=V!=="",W=a>0;H?(window.clearTimeout(E.current),W&&k(!1)):(window.clearTimeout(E.current),E.current=window.setTimeout(()=>k(!0),a)),i?.(V)},defaultProp:o??"",caller:My}),F=U.useCallback(()=>{window.clearTimeout(_.current),_.current=window.setTimeout(()=>L(""),150)},[L]),R=U.useCallback(V=>{window.clearTimeout(_.current),L(V)},[L]),B=U.useCallback(V=>{M===V?window.clearTimeout(_.current):w.current=window.setTimeout(()=>{window.clearTimeout(_.current),L(V)},s)},[M,L,s]);return U.useEffect(()=>()=>{window.clearTimeout(w.current),window.clearTimeout(_.current),window.clearTimeout(E.current)},[]),v.jsx(bIe,{scope:n,isRootMenu:!0,value:M,dir:b,orientation:l,rootNavigationMenu:d,onTriggerEnter:V=>{window.clearTimeout(w.current),A?B(V):R(V)},onTriggerLeave:()=>{window.clearTimeout(w.current),F()},onContentEnter:()=>window.clearTimeout(_.current),onContentLeave:F,onItemSelect:V=>{L(H=>H===V?"":V)},onItemDismiss:()=>L(""),children:v.jsx(Sn.nav,{"aria-label":"Main","data-orientation":l,dir:b,...u,ref:g})})});vIe.displayName=My;var XK="NavigationMenuSub",S$t=U.forwardRef((t,e)=>{const{__scopeNavigationMenu:n,value:r,onValueChange:i,defaultValue:o,orientation:s="horizontal",...a}=t,l=Qc(XK,n),[c,u]=qs({prop:r,onChange:i,defaultProp:o??"",caller:XK});return v.jsx(bIe,{scope:n,isRootMenu:!1,value:c,dir:l.dir,orientation:s,rootNavigationMenu:l.rootNavigationMenu,onTriggerEnter:d=>u(d),onItemSelect:d=>u(d),onItemDismiss:()=>u(""),children:v.jsx(Sn.div,{"data-orientation":s,...a,ref:e})})});S$t.displayName=XK;var bIe=t=>{const{scope:e,isRootMenu:n,rootNavigationMenu:r,dir:i,orientation:o,children:s,value:a,onItemSelect:l,onItemDismiss:c,onTriggerEnter:u,onTriggerLeave:d,onContentEnter:p,onContentLeave:g}=t,[b,w]=U.useState(null),[_,E]=U.useState(new Map),[A,k]=U.useState(null);return v.jsx(x$t,{scope:e,isRootMenu:n,rootNavigationMenu:r,value:a,previousValue:dV(a),baseId:Eo(),dir:i,orientation:o,viewport:b,onViewportChange:w,indicatorTrack:A,onIndicatorTrackChange:k,onTriggerEnter:vi(u),onTriggerLeave:vi(d),onContentEnter:vi(p),onContentLeave:vi(g),onItemSelect:vi(l),onItemDismiss:vi(c),onViewportContentChange:U.useCallback((M,L)=>{E(F=>(F.set(M,L),new Map(F)))},[]),onViewportContentRemove:U.useCallback(M=>{E(L=>L.has(M)?(L.delete(M),new Map(L)):L)},[]),children:v.jsx(qK.Provider,{scope:e,children:v.jsx(w$t,{scope:e,items:_,children:s})})})},xIe="NavigationMenuList",wIe=U.forwardRef((t,e)=>{const{__scopeNavigationMenu:n,...r}=t,i=Qc(xIe,n),o=v.jsx(Sn.ul,{"data-orientation":i.orientation,...r,ref:e});return v.jsx(Sn.div,{style:{position:"relative"},ref:i.onIndicatorTrackChange,children:v.jsx(qK.Slot,{scope:n,children:i.isRootMenu?v.jsx(DIe,{asChild:!0,children:o}):o})})});wIe.displayName=xIe;var _Ie="NavigationMenuItem",[E$t,SIe]=ZK(_Ie),EIe=U.forwardRef((t,e)=>{const{__scopeNavigationMenu:n,value:r,...i}=t,o=Eo(),s=r||o||"LEGACY_REACT_AUTO_VALUE",a=U.useRef(null),l=U.useRef(null),c=U.useRef(null),u=U.useRef(()=>{}),d=U.useRef(!1),p=U.useCallback((b="start")=>{if(a.current){u.current();const w=tq(a.current);w.length&&nq(b==="start"?w:w.reverse())}},[]),g=U.useCallback(()=>{if(a.current){const b=tq(a.current);b.length&&(u.current=M$t(b))}},[]);return v.jsx(E$t,{scope:n,value:s,triggerRef:l,contentRef:a,focusProxyRef:c,wasEscapeCloseRef:d,onEntryKeyDown:p,onFocusProxyEnter:p,onRootContentClose:g,onContentFocusOutside:g,children:v.jsx(Sn.li,{...i,ref:e})})});EIe.displayName=_Ie;var QK="NavigationMenuTrigger",CIe=U.forwardRef((t,e)=>{const{__scopeNavigationMenu:n,disabled:r,...i}=t,o=Qc(QK,t.__scopeNavigationMenu),s=SIe(QK,t.__scopeNavigationMenu),a=U.useRef(null),l=Qn(a,s.triggerRef,e),c=OIe(o.baseId,s.value),u=$Ie(o.baseId,s.value),d=U.useRef(!1),p=U.useRef(!1),g=s.value===o.value;return v.jsxs(v.Fragment,{children:[v.jsx(qK.ItemSlot,{scope:n,value:s.value,children:v.jsx(LIe,{asChild:!0,children:v.jsx(Sn.button,{id:c,disabled:r,"data-disabled":r?"":void 0,"data-state":iq(g),"aria-expanded":g,"aria-controls":u,...i,ref:l,onPointerEnter:Yt(t.onPointerEnter,()=>{p.current=!1,s.wasEscapeCloseRef.current=!1}),onPointerMove:Yt(t.onPointerMove,xD(()=>{r||p.current||s.wasEscapeCloseRef.current||d.current||(o.onTriggerEnter(s.value),d.current=!0)})),onPointerLeave:Yt(t.onPointerLeave,xD(()=>{r||(o.onTriggerLeave(),d.current=!1)})),onClick:Yt(t.onClick,()=>{o.onItemSelect(s.value),p.current=g}),onKeyDown:Yt(t.onKeyDown,b=>{const _={horizontal:"ArrowDown",vertical:o.dir==="rtl"?"ArrowLeft":"ArrowRight"}[o.orientation];g&&b.key===_&&(s.onEntryKeyDown(),b.preventDefault())})})})}),g&&v.jsxs(v.Fragment,{children:[v.jsx(K_t,{"aria-hidden":!0,tabIndex:0,ref:s.focusProxyRef,onFocus:b=>{const w=s.contentRef.current,_=b.relatedTarget,E=_===a.current,A=w?.contains(_);(E||!A)&&s.onFocusProxyEnter(E?"start":"end")}}),o.viewport&&v.jsx("span",{"aria-owns":u})]})]})});CIe.displayName=QK;var C$t="NavigationMenuLink",TIe="navigationMenu.linkSelect",kIe=U.forwardRef((t,e)=>{const{__scopeNavigationMenu:n,active:r,onSelect:i,...o}=t;return v.jsx(LIe,{asChild:!0,children:v.jsx(Sn.a,{"data-active":r?"":void 0,"aria-current":r?"page":void 0,...o,ref:e,onClick:Yt(t.onClick,s=>{const a=s.target,l=new CustomEvent(TIe,{bubbles:!0,cancelable:!0});if(a.addEventListener(TIe,c=>i?.(c),{once:!0}),nT(a,l),!l.defaultPrevented&&!s.metaKey){const c=new CustomEvent(bD,{bubbles:!0,cancelable:!0});nT(a,c)}},{checkForDefaultPrevented:!1})})})});kIe.displayName=C$t;var JK="NavigationMenuIndicator",PIe=U.forwardRef((t,e)=>{const{forceMount:n,...r}=t,i=Qc(JK,t.__scopeNavigationMenu),o=!!i.value;return i.indicatorTrack?$r.createPortal(v.jsx(ls,{present:n||o,children:v.jsx(T$t,{...r,ref:e})}),i.indicatorTrack):null});PIe.displayName=JK;var T$t=U.forwardRef((t,e)=>{const{__scopeNavigationMenu:n,...r}=t,i=Qc(JK,n),o=yIe(n),[s,a]=U.useState(null),[l,c]=U.useState(null),u=i.orientation==="horizontal",d=!!i.value;U.useEffect(()=>{const b=o().find(w=>w.value===i.value)?.ref.current;b&&a(b)},[o,i.value]);const p=()=>{s&&c({size:u?s.offsetWidth:s.offsetHeight,offset:u?s.offsetLeft:s.offsetTop})};return rq(s,p),rq(i.indicatorTrack,p),l?v.jsx(Sn.div,{"aria-hidden":!0,"data-state":d?"visible":"hidden","data-orientation":i.orientation,...r,ref:e,style:{position:"absolute",...u?{left:0,width:l.size+"px",transform:`translateX(${l.offset}px)`}:{top:0,height:l.size+"px",transform:`translateY(${l.offset}px)`},...r.style}}):null}),lx="NavigationMenuContent",AIe=U.forwardRef((t,e)=>{const{forceMount:n,...r}=t,i=Qc(lx,t.__scopeNavigationMenu),o=SIe(lx,t.__scopeNavigationMenu),s=Qn(o.contentRef,e),a=o.value===i.value,l={value:o.value,triggerRef:o.triggerRef,focusProxyRef:o.focusProxyRef,wasEscapeCloseRef:o.wasEscapeCloseRef,onContentFocusOutside:o.onContentFocusOutside,onRootContentClose:o.onRootContentClose,...r};return i.viewport?v.jsx(k$t,{forceMount:n,...l,ref:s}):v.jsx(ls,{present:n||a,children:v.jsx(IIe,{"data-state":iq(a),...l,ref:s,onPointerEnter:Yt(t.onPointerEnter,i.onContentEnter),onPointerLeave:Yt(t.onPointerLeave,xD(i.onContentLeave)),style:{pointerEvents:!a&&i.isRootMenu?"none":void 0,...l.style}})})});AIe.displayName=lx;var k$t=U.forwardRef((t,e)=>{const n=Qc(lx,t.__scopeNavigationMenu),{onViewportContentChange:r,onViewportContentRemove:i}=n;return Ki(()=>{r(t.value,{ref:e,...t})},[t,e,r]),Ki(()=>()=>i(t.value),[t.value,i]),null}),bD="navigationMenu.rootContentDismiss",IIe=U.forwardRef((t,e)=>{const{__scopeNavigationMenu:n,value:r,triggerRef:i,focusProxyRef:o,wasEscapeCloseRef:s,onRootContentClose:a,onContentFocusOutside:l,...c}=t,u=Qc(lx,n),d=U.useRef(null),p=Qn(d,e),g=OIe(u.baseId,r),b=$Ie(u.baseId,r),w=yIe(n),_=U.useRef(null),{onItemDismiss:E}=u;U.useEffect(()=>{const k=d.current;if(u.isRootMenu&&k){const M=()=>{E(),a(),k.contains(document.activeElement)&&i.current?.focus()};return k.addEventListener(bD,M),()=>k.removeEventListener(bD,M)}},[u.isRootMenu,t.value,i,E,a]);const A=U.useMemo(()=>{const M=w().map(H=>H.value);u.dir==="rtl"&&M.reverse();const L=M.indexOf(u.value),F=M.indexOf(u.previousValue),R=r===u.value,B=F===M.indexOf(r);if(!R&&!B)return _.current;const V=(()=>{if(L!==F){if(R&&F!==-1)return L>F?"from-end":"from-start";if(B&&L!==-1)return L>F?"to-start":"to-end"}return null})();return _.current=V,V},[u.previousValue,u.value,u.dir,w,r]);return v.jsx(DIe,{asChild:!0,children:v.jsx(o1,{id:b,"aria-labelledby":g,"data-motion":A,"data-orientation":u.orientation,...c,ref:p,disableOutsidePointerEvents:!1,onDismiss:()=>{const k=new Event(bD,{bubbles:!0,cancelable:!0});d.current?.dispatchEvent(k)},onFocusOutside:Yt(t.onFocusOutside,k=>{l();const M=k.target;u.rootNavigationMenu?.contains(M)&&k.preventDefault()}),onPointerDownOutside:Yt(t.onPointerDownOutside,k=>{const M=k.target,L=w().some(R=>R.ref.current?.contains(M)),F=u.isRootMenu&&u.viewport?.contains(M);(L||F||!u.isRootMenu)&&k.preventDefault()}),onKeyDown:Yt(t.onKeyDown,k=>{const M=k.altKey||k.ctrlKey||k.metaKey;if(k.key==="Tab"&&!M){const F=tq(k.currentTarget),R=document.activeElement,B=F.findIndex(W=>W===R),H=k.shiftKey?F.slice(0,B).reverse():F.slice(B+1,F.length);nq(H)?k.preventDefault():o.current?.focus()}}),onEscapeKeyDown:Yt(t.onEscapeKeyDown,k=>{s.current=!0})})})}),eq="NavigationMenuViewport",MIe=U.forwardRef((t,e)=>{const{forceMount:n,...r}=t,o=!!Qc(eq,t.__scopeNavigationMenu).value;return v.jsx(ls,{present:n||o,children:v.jsx(P$t,{...r,ref:e})})});MIe.displayName=eq;var P$t=U.forwardRef((t,e)=>{const{__scopeNavigationMenu:n,children:r,...i}=t,o=Qc(eq,n),s=Qn(e,o.onViewportChange),a=_$t(lx,t.__scopeNavigationMenu),[l,c]=U.useState(null),[u,d]=U.useState(null),p=l?l?.width+"px":void 0,g=l?l?.height+"px":void 0,b=!!o.value,w=b?o.value:o.previousValue;return rq(u,()=>{u&&c({width:u.offsetWidth,height:u.offsetHeight})}),v.jsx(Sn.div,{"data-state":iq(b),"data-orientation":o.orientation,...i,ref:s,style:{pointerEvents:!b&&o.isRootMenu?"none":void 0,"--radix-navigation-menu-viewport-width":p,"--radix-navigation-menu-viewport-height":g,...i.style},onPointerEnter:Yt(t.onPointerEnter,o.onContentEnter),onPointerLeave:Yt(t.onPointerLeave,xD(o.onContentLeave)),children:Array.from(a.items).map(([E,{ref:A,forceMount:k,...M}])=>{const L=w===E;return v.jsx(ls,{present:k||L,children:v.jsx(IIe,{...M,ref:sl(A,F=>{L&&F&&d(F)})})},E)})})}),A$t="FocusGroup",DIe=U.forwardRef((t,e)=>{const{__scopeNavigationMenu:n,...r}=t,i=Qc(A$t,n);return v.jsx(YK.Provider,{scope:n,children:v.jsx(YK.Slot,{scope:n,children:v.jsx(Sn.div,{dir:i.dir,...r,ref:e})})})}),NIe=["ArrowRight","ArrowLeft","ArrowUp","ArrowDown"],I$t="FocusGroupItem",LIe=U.forwardRef((t,e)=>{const{__scopeNavigationMenu:n,...r}=t,i=v$t(n),o=Qc(I$t,n);return v.jsx(YK.ItemSlot,{scope:n,children:v.jsx(Sn.button,{...r,ref:e,onKeyDown:Yt(t.onKeyDown,s=>{if(["Home","End",...NIe].includes(s.key)){let l=i().map(d=>d.ref.current);if([o.dir==="rtl"?"ArrowRight":"ArrowLeft","ArrowUp","End"].includes(s.key)&&l.reverse(),NIe.includes(s.key)){const d=l.indexOf(s.currentTarget);l=l.slice(d+1)}setTimeout(()=>nq(l)),s.preventDefault()}})})})});function tq(t){const e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const i=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||i?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)e.push(n.currentNode);return e}function nq(t){const e=document.activeElement;return t.some(n=>n===e?!0:(n.focus(),document.activeElement!==e))}function M$t(t){return t.forEach(e=>{e.dataset.tabindex=e.getAttribute("tabindex")||"",e.setAttribute("tabindex","-1")}),()=>{t.forEach(e=>{const n=e.dataset.tabindex;e.setAttribute("tabindex",n)})}}function rq(t,e){const n=vi(e);Ki(()=>{let r=0;if(t){const i=new ResizeObserver(()=>{cancelAnimationFrame(r),r=window.requestAnimationFrame(n)});return i.observe(t),()=>{window.cancelAnimationFrame(r),i.unobserve(t)}}},[t,n])}function iq(t){return t?"open":"closed"}function OIe(t,e){return`${t}-trigger-${e}`}function $Ie(t,e){return`${t}-content-${e}`}function xD(t){return e=>e.pointerType==="mouse"?t(e):void 0}var oq=vIe,sq=wIe,FIe=EIe,aq=CIe,wD=kIe,BIe=PIe,lq=AIe,cq=MIe;const zIe=t=>{switch(t){case"minimal":return"rounded-2xl";case"sharp":return"rounded-none";default:return"rounded-full"}},D$t=({onClose:t,onSelect:e,...n})=>{const r=gl("(max-width: 768px)"),{lock:i,unlock:o,isLocked:s}=VIe(),[a,l]=P.useState(null),c=async _=>{if(!(_.disabled||s)){if(_.onClick){const E=_.onClick();if(E instanceof Promise){l(_.id),i();try{await E,o(),e(_.id),_.keepOpen||t()}catch(A){console.error("ActionSheet Click Error:",A),o(),l(null)}return}}e(_.id),_.keepOpen||t()}},{cancelLabel:u,sections:d,title:p,description:g,header:b,contentProps:w}=n;return v.jsxs(ig,{className:he("p-0 pb-safe overflow-hidden flex flex-col",!r&&"max-w-md mx-auto",w?.className),...w,children:[v.jsx(Z5,{}),v.jsx("div",{className:"px-6 my-4 pt-0 text-center",children:(b||p||g)&&v.jsx("div",{children:b||v.jsxs(og,{children:[p&&v.jsx(O0,{children:p}),g&&v.jsx(HR,{children:g})]})})}),v.jsx("div",{className:"flex-1 overflow-y-auto [&::-webkit-scrollbar]:hidden [-ms-overflow-style:none] [scrollbar-width:none] mb-2",children:d.map((_,E)=>v.jsxs(P.Fragment,{children:[_.title&&v.jsx(un,{variant:"label-small",className:"px-6 py-2 mt-2 font-bold opacity-50 uppercase tracking-wider block",children:_.title}),_.type==="list"&&_.items&&v.jsx("div",{className:"flex flex-col gap-1 px-2",children:_.items.map(A=>v.jsxs(Zn,{variant:"ghost",size:A.size||"lg",shape:A.shape||"minimal",disabled:A.disabled||s&&a!==A.id,isLoading:a===A.id,className:he("justify-start h-14 px-4",A.variant==="destructive"&&"text-error hover:text-error hover:bg-error/10",A.className),onClick:()=>c(A),children:[A.icon&&v.jsx("span",{className:"mr-4 opacity-70",children:A.icon}),v.jsxs("div",{className:"flex flex-col items-start text-left",children:[v.jsx("span",{className:"text-base font-semibold",children:A.label}),A.subLabel&&v.jsx("span",{className:"text-xs font-normal opacity-60",children:A.subLabel})]})]},A.id))}),_.type==="grid"&&_.items&&v.jsx("div",{className:"grid gap-4 px-4 py-2",style:{gridTemplateColumns:`repeat(${_.gridColumns||4}, minmax(0, 1fr))`},children:_.items.map(A=>{const k=zIe(A.shape),M=a===A.id;return v.jsxs("div",{className:he("flex flex-col items-center gap-2 cursor-pointer group select-none transition-opacity",(A.disabled||s&&!M)&&"opacity-50 pointer-events-none",A.className),onClick:()=>c(A),children:[v.jsx("div",{className:he("flex h-12 w-12 items-center justify-center bg-surface-container-highest text-on-surface transition-transform group-active:scale-95 group-hover:bg-secondary-container",k),children:M?v.jsx("div",{className:"animate-spin h-5 w-5 border-2 border-primary border-t-transparent rounded-full"}):A.icon}),v.jsx("span",{className:"text-xs font-medium text-center leading-tight opacity-80 line-clamp-2",children:A.label})]},A.id)})}),_.type==="carousel"&&_.items&&v.jsx(Js,{orientation:"horizontal",scrollbarVisibility:"hidden",className:"!h-auto",children:v.jsx("div",{className:"flex gap-4 px-6 pb-4 pt-2",children:_.items.map(A=>{const k=zIe(A.shape),M=a===A.id;return v.jsxs("div",{className:he("flex w-[72px] shrink-0 flex-col items-center gap-2 cursor-pointer group select-none",(A.disabled||s&&!M)&&"opacity-50 pointer-events-none",A.className),onClick:()=>c(A),children:[A.variant==="image"?v.jsxs("div",{className:"relative",children:[v.jsx(qT,{src:A.imageSrc,fallback:A.label?.toString()[0],size:"lg",shape:A.shape||"full",className:"ring-2 ring-transparent group-hover:ring-primary transition-all"}),M&&v.jsx("div",{className:"absolute inset-0 bg-black/20 flex items-center justify-center rounded-full",children:v.jsx("div",{className:"animate-spin h-5 w-5 border-2 border-white border-t-transparent rounded-full"})})]}):v.jsx("div",{className:he("flex h-14 w-14 items-center justify-center bg-surface-container-highest text-on-surface transition-transform group-active:scale-95 group-hover:bg-secondary-container",k),children:M?v.jsx("div",{className:"animate-spin h-5 w-5 border-2 border-primary border-t-transparent rounded-full"}):A.icon}),v.jsx("div",{className:"flex flex-col items-center text-center",children:v.jsx("span",{className:"text-xs font-medium leading-tight line-clamp-1",children:A.label})})]},A.id)})})}),_.type==="custom"&&_.content,E<d.length-1&&v.jsx("div",{className:"h-px w-full bg-outline-variant/30 my-2"})]},E))}),u&&v.jsx(Y5,{className:"p-4 pt-2",children:v.jsx(Zn,{variant:"secondary",size:"lg",shape:"full",className:"w-full font-semibold",onClick:t,disabled:s,children:u})})]})},RIe=P.createContext(null),VIe=()=>{const t=P.useContext(RIe);if(!t)throw new Error("useActionSheet must be used within an ActionSheetProvider");return t},jIe=({children:t})=>{const e=P.useRef({}),[n,r]=P.useState([]),[i,o]=P.useState(!1),s=gl("(max-width: 768px)"),a=P.useCallback(()=>o(!0),[]),l=P.useCallback(()=>o(!1),[]),c=P.useCallback((g,b)=>{e.current[g]=b},[]),u=P.useCallback(g=>{i||r(b=>{if(g){const _=b.find(E=>E.id===g);return _?.props?.onOpenChange&&_.props.onOpenChange(!1),b.map(E=>E.id===g?{...E,isOpen:!1}:E)}const w=b.map(_=>_.isOpen).lastIndexOf(!0);if(w!==-1){const _=b[w];return _?.props?.onOpenChange&&_.props.onOpenChange(!1),b.map((E,A)=>A===w?{...E,isOpen:!1}:E)}return b})},[i]),d=P.useCallback((g,b)=>new Promise(w=>{const _=crypto.randomUUID();b?.onOpenChange&&b.onOpenChange(!0),r(E=>[...E,{id:_,name:g,props:b,isOpen:!0,resolve:w}])}),[]),p=P.useCallback(g=>d("standard",g),[d]);return P.useEffect(()=>{const g=n.filter(b=>!b.isOpen);if(g.length>0){const b=setTimeout(()=>{r(w=>w.filter(_=>_.isOpen)),g.forEach(w=>w.resolve(null))},300);return()=>clearTimeout(b)}},[n]),P.useEffect(()=>{c("standard",D$t)},[c]),v.jsxs(RIe.Provider,{value:{show:p,registerSheet:c,openSheet:d,close:u,lock:a,unlock:l,isLocked:i},children:[t,n.map((g,b)=>{const w=e.current[g.name];if(!w)return null;const _=g.name==="standard",E=50+b;return v.jsx(sg,{open:g.isOpen,isLocked:i,onOpenChange:A=>{g.props.onOpenChange&&g.props.onOpenChange(A),!A&&!i&&u(g.id)},forceBottomSheet:s,mode:"detached",..._&&g.props.sheetProps||{},style:{zIndex:E,position:"relative"},children:v.jsx(w,{...g.props,onClose:()=>u(g.id),onSelect:A=>g.resolve(A)})},g.id)})]})};function N$t(t){if(typeof document>"u")return;let e=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",e.appendChild(n),n.styleSheet?n.styleSheet.cssText=t:n.appendChild(document.createTextNode(t))}const L$t=t=>{switch(t){case"success":return F$t;case"info":return z$t;case"warning":return B$t;case"error":return R$t;default:return null}},O$t=Array(12).fill(0),$$t=({visible:t,className:e})=>P.createElement("div",{className:["sonner-loading-wrapper",e].filter(Boolean).join(" "),"data-visible":t},P.createElement("div",{className:"sonner-spinner"},O$t.map((n,r)=>P.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${r}`})))),F$t=P.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},P.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),B$t=P.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},P.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),z$t=P.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},P.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),R$t=P.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},P.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),V$t=P.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},P.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),P.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),j$t=()=>{const[t,e]=P.useState(document.hidden);return P.useEffect(()=>{const n=()=>{e(document.hidden)};return document.addEventListener("visibilitychange",n),()=>window.removeEventListener("visibilitychange",n)},[]),t};let uq=1;class U$t{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{const n=this.subscribers.indexOf(e);this.subscribers.splice(n,1)}),this.publish=e=>{this.subscribers.forEach(n=>n(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]},this.create=e=>{var n;const{message:r,...i}=e,o=typeof e?.id=="number"||((n=e.id)==null?void 0:n.length)>0?e.id:uq++,s=this.toasts.find(l=>l.id===o),a=e.dismissible===void 0?!0:e.dismissible;return this.dismissedToasts.has(o)&&this.dismissedToasts.delete(o),s?this.toasts=this.toasts.map(l=>l.id===o?(this.publish({...l,...e,id:o,title:r}),{...l,...e,id:o,dismissible:a,title:r}):l):this.addToast({title:r,...i,dismissible:a,id:o}),o},this.dismiss=e=>(e?(this.dismissedToasts.add(e),requestAnimationFrame(()=>this.subscribers.forEach(n=>n({id:e,dismiss:!0})))):this.toasts.forEach(n=>{this.subscribers.forEach(r=>r({id:n.id,dismiss:!0}))}),e),this.message=(e,n)=>this.create({...n,message:e}),this.error=(e,n)=>this.create({...n,message:e,type:"error"}),this.success=(e,n)=>this.create({...n,type:"success",message:e}),this.info=(e,n)=>this.create({...n,type:"info",message:e}),this.warning=(e,n)=>this.create({...n,type:"warning",message:e}),this.loading=(e,n)=>this.create({...n,type:"loading",message:e}),this.promise=(e,n)=>{if(!n)return;let r;n.loading!==void 0&&(r=this.create({...n,promise:e,type:"loading",message:n.loading,description:typeof n.description!="function"?n.description:void 0}));const i=Promise.resolve(e instanceof Function?e():e);let o=r!==void 0,s;const a=i.then(async c=>{if(s=["resolve",c],P.isValidElement(c))o=!1,this.create({id:r,type:"default",message:c});else if(G$t(c)&&!c.ok){o=!1;const d=typeof n.error=="function"?await n.error(`HTTP error! status: ${c.status}`):n.error,p=typeof n.description=="function"?await n.description(`HTTP error! status: ${c.status}`):n.description,b=typeof d=="object"&&!P.isValidElement(d)?d:{message:d};this.create({id:r,type:"error",description:p,...b})}else if(c instanceof Error){o=!1;const d=typeof n.error=="function"?await n.error(c):n.error,p=typeof n.description=="function"?await n.description(c):n.description,b=typeof d=="object"&&!P.isValidElement(d)?d:{message:d};this.create({id:r,type:"error",description:p,...b})}else if(n.success!==void 0){o=!1;const d=typeof n.success=="function"?await n.success(c):n.success,p=typeof n.description=="function"?await n.description(c):n.description,b=typeof d=="object"&&!P.isValidElement(d)?d:{message:d};this.create({id:r,type:"success",description:p,...b})}}).catch(async c=>{if(s=["reject",c],n.error!==void 0){o=!1;const u=typeof n.error=="function"?await n.error(c):n.error,d=typeof n.description=="function"?await n.description(c):n.description,g=typeof u=="object"&&!P.isValidElement(u)?u:{message:u};this.create({id:r,type:"error",description:d,...g})}}).finally(()=>{o&&(this.dismiss(r),r=void 0),n.finally==null||n.finally.call(n)}),l=()=>new Promise((c,u)=>a.then(()=>s[0]==="reject"?u(s[1]):c(s[1])).catch(u));return typeof r!="string"&&typeof r!="number"?{unwrap:l}:Object.assign(r,{unwrap:l})},this.custom=(e,n)=>{const r=n?.id||uq++;return this.create({jsx:e(r),id:r,...n}),r},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}}const Sl=new U$t,H$t=(t,e)=>{const n=e?.id||uq++;return Sl.addToast({title:t,...e,id:n}),n},G$t=t=>t&&typeof t=="object"&&"ok"in t&&typeof t.ok=="boolean"&&"status"in t&&typeof t.status=="number",W$t=H$t,K$t=()=>Sl.toasts,q$t=()=>Sl.getActiveToasts(),jE=Object.assign(W$t,{success:Sl.success,info:Sl.info,warning:Sl.warning,error:Sl.error,custom:Sl.custom,message:Sl.message,promise:Sl.promise,dismiss:Sl.dismiss,loading:Sl.loading},{getHistory:K$t,getToasts:q$t});N$t("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");function _D(t){return t.label!==void 0}const Y$t=3,Z$t="24px",X$t="16px",UIe=4e3,Q$t=356,J$t=14,e9t=45,t9t=200;function Zd(...t){return t.filter(Boolean).join(" ")}function n9t(t){const[e,n]=t.split("-"),r=[];return e&&r.push(e),n&&r.push(n),r}const r9t=t=>{var e,n,r,i,o,s,a,l,c;const{invert:u,toast:d,unstyled:p,interacting:g,setHeights:b,visibleToasts:w,heights:_,index:E,toasts:A,expanded:k,removeToast:M,defaultRichColors:L,closeButton:F,style:R,cancelButtonStyle:B,actionButtonStyle:V,className:H="",descriptionClassName:W="",duration:te,position:se,gap:X,expandByDefault:ee,classNames:K,icons:Q,closeButtonAriaLabel:Y="Close toast"}=t,[re,J]=P.useState(null),[ce,ie]=P.useState(null),[de,ve]=P.useState(!1),[ye,Ie]=P.useState(!1),[Pe,ke]=P.useState(!1),[De,Oe]=P.useState(!1),[Ye,Te]=P.useState(!1),[lt,Be]=P.useState(0),[it,ut]=P.useState(0),It=P.useRef(d.duration||te||UIe),nn=P.useRef(null),Zt=P.useRef(null),qt=E===0,Ct=E+1<=w,Mt=d.type,an=d.dismissible!==!1,en=d.className||"",on=d.descriptionClassName||"",Xe=P.useMemo(()=>_.findIndex(Ht=>Ht.toastId===d.id)||0,[_,d.id]),xe=P.useMemo(()=>{var Ht;return(Ht=d.closeButton)!=null?Ht:F},[d.closeButton,F]),Ee=P.useMemo(()=>d.duration||te||UIe,[d.duration,te]),Ae=P.useRef(0),je=P.useRef(0),$e=P.useRef(0),nt=P.useRef(null),[ot,He]=se.split("-"),Qe=P.useMemo(()=>_.reduce((Ht,En,Jt)=>Jt>=Xe?Ht:Ht+En.height,0),[_,Xe]),dt=j$t(),at=d.invert||u,Et=Mt==="loading";je.current=P.useMemo(()=>Xe*X+Qe,[Xe,Qe]),P.useEffect(()=>{It.current=Ee},[Ee]),P.useEffect(()=>{ve(!0)},[]),P.useEffect(()=>{const Ht=Zt.current;if(Ht){const En=Ht.getBoundingClientRect().height;return ut(En),b(Jt=>[{toastId:d.id,height:En,position:d.position},...Jt]),()=>b(Jt=>Jt.filter(yn=>yn.toastId!==d.id))}},[b,d.id]),P.useLayoutEffect(()=>{if(!de)return;const Ht=Zt.current,En=Ht.style.height;Ht.style.height="auto";const Jt=Ht.getBoundingClientRect().height;Ht.style.height=En,ut(Jt),b(yn=>yn.find(Nn=>Nn.toastId===d.id)?yn.map(Nn=>Nn.toastId===d.id?{...Nn,height:Jt}:Nn):[{toastId:d.id,height:Jt,position:d.position},...yn])},[de,d.title,d.description,b,d.id,d.jsx,d.action,d.cancel]);const pt=P.useCallback(()=>{Ie(!0),Be(je.current),b(Ht=>Ht.filter(En=>En.toastId!==d.id)),setTimeout(()=>{M(d)},t9t)},[d,M,b,je]);P.useEffect(()=>{if(d.promise&&Mt==="loading"||d.duration===1/0||d.type==="loading")return;let Ht;return k||g||dt?(()=>{if($e.current<Ae.current){const yn=new Date().getTime()-Ae.current;It.current=It.current-yn}$e.current=new Date().getTime()})():It.current!==1/0&&(Ae.current=new Date().getTime(),Ht=setTimeout(()=>{d.onAutoClose==null||d.onAutoClose.call(d,d),pt()},It.current)),()=>clearTimeout(Ht)},[k,g,d,Mt,dt,pt]),P.useEffect(()=>{d.delete&&(pt(),d.onDismiss==null||d.onDismiss.call(d,d))},[pt,d.delete]);function Nt(){var Ht;if(Q?.loading){var En;return P.createElement("div",{className:Zd(K?.loader,d==null||(En=d.classNames)==null?void 0:En.loader,"sonner-loader"),"data-visible":Mt==="loading"},Q.loading)}return P.createElement($$t,{className:Zd(K?.loader,d==null||(Ht=d.classNames)==null?void 0:Ht.loader),visible:Mt==="loading"})}const Qt=d.icon||Q?.[Mt]||L$t(Mt);var Gt,st;return P.createElement("li",{tabIndex:0,ref:Zt,className:Zd(H,en,K?.toast,d==null||(e=d.classNames)==null?void 0:e.toast,K?.default,K?.[Mt],d==null||(n=d.classNames)==null?void 0:n[Mt]),"data-sonner-toast":"","data-rich-colors":(Gt=d.richColors)!=null?Gt:L,"data-styled":!(d.jsx||d.unstyled||p),"data-mounted":de,"data-promise":!!d.promise,"data-swiped":Ye,"data-removed":ye,"data-visible":Ct,"data-y-position":ot,"data-x-position":He,"data-index":E,"data-front":qt,"data-swiping":Pe,"data-dismissible":an,"data-type":Mt,"data-invert":at,"data-swipe-out":De,"data-swipe-direction":ce,"data-expanded":!!(k||ee&&de),"data-testid":d.testId,style:{"--index":E,"--toasts-before":E,"--z-index":A.length-E,"--offset":`${ye?lt:je.current}px`,"--initial-height":ee?"auto":`${it}px`,...R,...d.style},onDragEnd:()=>{ke(!1),J(null),nt.current=null},onPointerDown:Ht=>{Ht.button!==2&&(Et||!an||(nn.current=new Date,Be(je.current),Ht.target.setPointerCapture(Ht.pointerId),Ht.target.tagName!=="BUTTON"&&(ke(!0),nt.current={x:Ht.clientX,y:Ht.clientY})))},onPointerUp:()=>{var Ht,En,Jt;if(De||!an)return;nt.current=null;const yn=Number(((Ht=Zt.current)==null?void 0:Ht.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),ar=Number(((En=Zt.current)==null?void 0:En.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),Nn=new Date().getTime()-((Jt=nn.current)==null?void 0:Jt.getTime()),Cn=re==="x"?yn:ar,Wn=Math.abs(Cn)/Nn;if(Math.abs(Cn)>=e9t||Wn>.11){Be(je.current),d.onDismiss==null||d.onDismiss.call(d,d),ie(re==="x"?yn>0?"right":"left":ar>0?"down":"up"),pt(),Oe(!0);return}else{var Yn,Ur;(Yn=Zt.current)==null||Yn.style.setProperty("--swipe-amount-x","0px"),(Ur=Zt.current)==null||Ur.style.setProperty("--swipe-amount-y","0px")}Te(!1),ke(!1),J(null)},onPointerMove:Ht=>{var En,Jt,yn;if(!nt.current||!an||((En=window.getSelection())==null?void 0:En.toString().length)>0)return;const Nn=Ht.clientY-nt.current.y,Cn=Ht.clientX-nt.current.x;var Wn;const Yn=(Wn=t.swipeDirections)!=null?Wn:n9t(se);!re&&(Math.abs(Cn)>1||Math.abs(Nn)>1)&&J(Math.abs(Cn)>Math.abs(Nn)?"x":"y");let Ur={x:0,y:0};const Vs=Ft=>1/(1.5+Math.abs(Ft)/20);if(re==="y"){if(Yn.includes("top")||Yn.includes("bottom"))if(Yn.includes("top")&&Nn<0||Yn.includes("bottom")&&Nn>0)Ur.y=Nn;else{const Ft=Nn*Vs(Nn);Ur.y=Math.abs(Ft)<Math.abs(Nn)?Ft:Nn}}else if(re==="x"&&(Yn.includes("left")||Yn.includes("right")))if(Yn.includes("left")&&Cn<0||Yn.includes("right")&&Cn>0)Ur.x=Cn;else{const Ft=Cn*Vs(Cn);Ur.x=Math.abs(Ft)<Math.abs(Cn)?Ft:Cn}(Math.abs(Ur.x)>0||Math.abs(Ur.y)>0)&&Te(!0),(Jt=Zt.current)==null||Jt.style.setProperty("--swipe-amount-x",`${Ur.x}px`),(yn=Zt.current)==null||yn.style.setProperty("--swipe-amount-y",`${Ur.y}px`)}},xe&&!d.jsx&&Mt!=="loading"?P.createElement("button",{"aria-label":Y,"data-disabled":Et,"data-close-button":!0,onClick:Et||!an?()=>{}:()=>{pt(),d.onDismiss==null||d.onDismiss.call(d,d)},className:Zd(K?.closeButton,d==null||(r=d.classNames)==null?void 0:r.closeButton)},(st=Q?.close)!=null?st:V$t):null,(Mt||d.icon||d.promise)&&d.icon!==null&&(Q?.[Mt]!==null||d.icon)?P.createElement("div",{"data-icon":"",className:Zd(K?.icon,d==null||(i=d.classNames)==null?void 0:i.icon)},d.promise||d.type==="loading"&&!d.icon?d.icon||Nt():null,d.type!=="loading"?Qt:null):null,P.createElement("div",{"data-content":"",className:Zd(K?.content,d==null||(o=d.classNames)==null?void 0:o.content)},P.createElement("div",{"data-title":"",className:Zd(K?.title,d==null||(s=d.classNames)==null?void 0:s.title)},d.jsx?d.jsx:typeof d.title=="function"?d.title():d.title),d.description?P.createElement("div",{"data-description":"",className:Zd(W,on,K?.description,d==null||(a=d.classNames)==null?void 0:a.description)},typeof d.description=="function"?d.description():d.description):null),P.isValidElement(d.cancel)?d.cancel:d.cancel&&_D(d.cancel)?P.createElement("button",{"data-button":!0,"data-cancel":!0,style:d.cancelButtonStyle||B,onClick:Ht=>{_D(d.cancel)&&an&&(d.cancel.onClick==null||d.cancel.onClick.call(d.cancel,Ht),pt())},className:Zd(K?.cancelButton,d==null||(l=d.classNames)==null?void 0:l.cancelButton)},d.cancel.label):null,P.isValidElement(d.action)?d.action:d.action&&_D(d.action)?P.createElement("button",{"data-button":!0,"data-action":!0,style:d.actionButtonStyle||V,onClick:Ht=>{_D(d.action)&&(d.action.onClick==null||d.action.onClick.call(d.action,Ht),!Ht.defaultPrevented&&pt())},className:Zd(K?.actionButton,d==null||(c=d.classNames)==null?void 0:c.actionButton)},d.action.label):null)};function HIe(){if(typeof window>"u"||typeof document>"u")return"ltr";const t=document.documentElement.getAttribute("dir");return t==="auto"||!t?window.getComputedStyle(document.documentElement).direction:t}function i9t(t,e){const n={};return[t,e].forEach((r,i)=>{const o=i===1,s=o?"--mobile-offset":"--offset",a=o?X$t:Z$t;function l(c){["top","right","bottom","left"].forEach(u=>{n[`${s}-${u}`]=typeof c=="number"?`${c}px`:c})}typeof r=="number"||typeof r=="string"?l(r):typeof r=="object"?["top","right","bottom","left"].forEach(c=>{r[c]===void 0?n[`${s}-${c}`]=a:n[`${s}-${c}`]=typeof r[c]=="number"?`${r[c]}px`:r[c]}):l(a)}),n}const o9t=P.forwardRef(function(e,n){const{id:r,invert:i,position:o="bottom-right",hotkey:s=["altKey","KeyT"],expand:a,closeButton:l,className:c,offset:u,mobileOffset:d,theme:p="light",richColors:g,duration:b,style:w,visibleToasts:_=Y$t,toastOptions:E,dir:A=HIe(),gap:k=J$t,icons:M,containerAriaLabel:L="Notifications"}=e,[F,R]=P.useState([]),B=P.useMemo(()=>r?F.filter(de=>de.toasterId===r):F.filter(de=>!de.toasterId),[F,r]),V=P.useMemo(()=>Array.from(new Set([o].concat(B.filter(de=>de.position).map(de=>de.position)))),[B,o]),[H,W]=P.useState([]),[te,se]=P.useState(!1),[X,ee]=P.useState(!1),[K,Q]=P.useState(p!=="system"?p:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),Y=P.useRef(null),re=s.join("+").replace(/Key/g,"").replace(/Digit/g,""),J=P.useRef(null),ce=P.useRef(!1),ie=P.useCallback(de=>{R(ve=>{var ye;return(ye=ve.find(Ie=>Ie.id===de.id))!=null&&ye.delete||Sl.dismiss(de.id),ve.filter(({id:Ie})=>Ie!==de.id)})},[]);return P.useEffect(()=>Sl.subscribe(de=>{if(de.dismiss){requestAnimationFrame(()=>{R(ve=>ve.map(ye=>ye.id===de.id?{...ye,delete:!0}:ye))});return}setTimeout(()=>{$r.flushSync(()=>{R(ve=>{const ye=ve.findIndex(Ie=>Ie.id===de.id);return ye!==-1?[...ve.slice(0,ye),{...ve[ye],...de},...ve.slice(ye+1)]:[de,...ve]})})})}),[F]),P.useEffect(()=>{if(p!=="system"){Q(p);return}if(p==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?Q("dark"):Q("light")),typeof window>"u")return;const de=window.matchMedia("(prefers-color-scheme: dark)");try{de.addEventListener("change",({matches:ve})=>{Q(ve?"dark":"light")})}catch{de.addListener(({matches:ye})=>{try{Q(ye?"dark":"light")}catch(Ie){console.error(Ie)}})}},[p]),P.useEffect(()=>{F.length<=1&&se(!1)},[F]),P.useEffect(()=>{const de=ve=>{var ye;if(s.every(ke=>ve[ke]||ve.code===ke)){var Pe;se(!0),(Pe=Y.current)==null||Pe.focus()}ve.code==="Escape"&&(document.activeElement===Y.current||(ye=Y.current)!=null&&ye.contains(document.activeElement))&&se(!1)};return document.addEventListener("keydown",de),()=>document.removeEventListener("keydown",de)},[s]),P.useEffect(()=>{if(Y.current)return()=>{J.current&&(J.current.focus({preventScroll:!0}),J.current=null,ce.current=!1)}},[Y.current]),P.createElement("section",{ref:n,"aria-label":`${L} ${re}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},V.map((de,ve)=>{var ye;const[Ie,Pe]=de.split("-");return B.length?P.createElement("ol",{key:de,dir:A==="auto"?HIe():A,tabIndex:-1,ref:Y,className:c,"data-sonner-toaster":!0,"data-sonner-theme":K,"data-y-position":Ie,"data-x-position":Pe,style:{"--front-toast-height":`${((ye=H[0])==null?void 0:ye.height)||0}px`,"--width":`${Q$t}px`,"--gap":`${k}px`,...w,...i9t(u,d)},onBlur:ke=>{ce.current&&!ke.currentTarget.contains(ke.relatedTarget)&&(ce.current=!1,J.current&&(J.current.focus({preventScroll:!0}),J.current=null))},onFocus:ke=>{ke.target instanceof HTMLElement&&ke.target.dataset.dismissible==="false"||ce.current||(ce.current=!0,J.current=ke.relatedTarget)},onMouseEnter:()=>se(!0),onMouseMove:()=>se(!0),onMouseLeave:()=>{X||se(!1)},onDragEnd:()=>se(!1),onPointerDown:ke=>{ke.target instanceof HTMLElement&&ke.target.dataset.dismissible==="false"||ee(!0)},onPointerUp:()=>ee(!1)},B.filter(ke=>!ke.position&&ve===0||ke.position===de).map((ke,De)=>{var Oe,Ye;return P.createElement(r9t,{key:ke.id,icons:M,index:De,toast:ke,defaultRichColors:g,duration:(Oe=E?.duration)!=null?Oe:b,className:E?.className,descriptionClassName:E?.descriptionClassName,invert:i,visibleToasts:_,closeButton:(Ye=E?.closeButton)!=null?Ye:l,interacting:X,position:de,style:E?.style,unstyled:E?.unstyled,classNames:E?.classNames,cancelButtonStyle:E?.cancelButtonStyle,actionButtonStyle:E?.actionButtonStyle,closeButtonAriaLabel:E?.closeButtonAriaLabel,removeToast:ie,toasts:B.filter(Te=>Te.position==ke.position),heights:H.filter(Te=>Te.position==ke.position),setHeights:W,expandByDefault:a,gap:k,expanded:te,swipeDirections:e.swipeDirections})})):null}))}),s9t=gn("group toast group-[.toaster]:flex group-[.toaster]:flex-wrap group-[.toaster]:gap-3 group-[.toaster]:items-start group-[.toaster]:w-full md:group-[.toaster]:w-[356px] group-[.toaster]:p-4 group-[.toaster]:font-manrope group-[.toaster]:text-sm group-[.toaster]:pointer-events-auto group-[.toaster]:transition-all group-[.toaster]:border group-[.toaster]:select-none [&>[data-button]:first-of-type]:ml-auto",{variants:{variant:{primary:"group-[.toaster]:bg-surface-container-low group-[.toaster]:text-on-surface group-[.toaster]:border-outline-variant/50",secondary:"group-[.toaster]:bg-surface-container-high group-[.toaster]:text-on-surface group-[.toaster]:border-outline-variant/50",tertiary:"group-[.toaster]:bg-tertiary-container group-[.toaster]:text-on-tertiary-container group-[.toaster]:border-tertiary-container","high-contrast":"group-[.toaster]:bg-inverse-surface group-[.toaster]:text-inverse-on-surface group-[.toaster]:border-inverse-surface",ghost:"group-[.toaster]:bg-surface-container-low/80 group-[.toaster]:backdrop-blur-md group-[.toaster]:text-on-surface group-[.toaster]:border-outline-variant/30",surface:"group-[.toaster]:bg-surface group-[.toaster]:text-on-surface group-[.toaster]:border-outline-variant"},shape:{full:"group-[.toaster]:rounded-[28px]",minimal:"group-[.toaster]:rounded-xl",sharp:"group-[.toaster]:rounded-none"},shadow:{none:"group-[.toaster]:shadow-none",sm:"group-[.toaster]:shadow-sm",md:"group-[.toaster]:shadow-md",lg:"group-[.toaster]:shadow-xl"}},defaultVariants:{variant:"secondary",shape:"minimal",shadow:"lg"}}),GIe=({variant:t="secondary",shape:e="minimal",shadow:n="lg",position:r="bottom-right",...i})=>{const{resolvedTheme:o}=Ul();return v.jsx(o9t,{theme:o,className:"toaster group",position:r,toastOptions:{unstyled:!0,classNames:{toast:he(s9t({variant:t,shape:e,shadow:n}),"group-data-[type=error]:bg-error-container group-data-[type=error]:text-on-error-container group-data-[type=error]:border-error/20","group-data-[type=warning]:bg-surface-container-high group-data-[type=warning]:border-yellow-500/50","group-data-[type=success]:bg-surface-container-high group-data-[type=success]:border-green-500/50"),content:"w-[calc(100%-2.5rem)]",title:"group-[.toast]:font-bold group-[.toast]:text-base",description:"group-[.toast]:text-xs group-[.toast]:opacity-90 group-[.toast]:leading-relaxed",actionButton:he("group-[.toast]:bg-primary group-[.toast]:text-on-primary","group-[.toast]:font-semibold group-[.toast]:text-xs","group-[.toast]:h-8 group-[.toast]:px-3 group-[.toast]:w-auto","group-[.toast]:rounded-lg","group-[.toast]:shrink-0","group-[.toast]:transition-transform group-[.toast]:active:scale-95"),cancelButton:he("group-[.toast]:bg-secondary-container group-[.toast]:text-on-secondary-container","group-[.toast]:font-semibold group-[.toast]:text-xs","group-[.toast]:h-8 group-[.toast]:px-3 group-[.toast]:w-auto","group-[.toast]:rounded-lg","group-[.toast]:shrink-0","group-[.toast]:transition-transform group-[.toast]:active:scale-95"),icon:"group-data-[type=error]:text-on-error-container group-[.toast]:self-start group-[.toast]:mt-0.5 group-[.toast]:shrink-0"}},...i})};function a9t({children:t,defaultTheme:e="system",defaultContrast:n="standard",defaultAnimationStyle:r="expressive",initialDirection:i="ltr",themeStorageKey:o="chesai-ui-theme",layoutStorageKey:s="layout-direction",toasterProps:a}){return v.jsx(kye,{defaultTheme:e,defaultContrast:n,defaultAnimationStyle:r,storageKey:o,children:v.jsx(UCe,{initialDirection:i,storageKey:s,children:v.jsx(yh,{children:v.jsx(jIe,{children:v.jsxs(r5e,{children:[t,v.jsx(GIe,{...a})]})})})})})}const UE=P.createContext(0),$h=()=>P.useContext(UE),WIe=P.createContext({value:"",onValueChange:t=>{}}),KIe=P.createContext({shape:"minimal",isClickMode:!1,setIsClickMode:()=>{},closeMenu:()=>{}}),Wg=()=>P.useContext(KIe),SD="relative flex w-full cursor-pointer select-none items-center gap-2 rounded-lg px-3 py-2.5 text-sm outline-none overflow-hidden transition-colors duration-150 ease-[cubic-bezier(0.2,0,0,1)] z-0 focus:bg-secondary-container/60 hover:bg-surface-container-highest/50 data-[highlighted]:bg-secondary-container/60 focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-primary/20 data-[disabled]:pointer-events-none data-[disabled]:opacity-38 after:absolute after:inset-0 after:z-[-1] after:bg-secondary-container/60 after:opacity-0 after:scale-75 after:origin-center after:rounded-[inherit] after:transition-all after:duration-200 after:ease-out hover:after:opacity-100 hover:after:scale-100",qIe=P.forwardRef(({className:t,shape:e="minimal",children:n,...r},i)=>{const[o,s]=P.useState(""),[a,l]=P.useState(!1),c=P.useCallback(()=>{s(""),l(!1)},[]);return v.jsx(KIe.Provider,{value:{shape:e,isClickMode:a,setIsClickMode:l,closeMenu:c},children:v.jsx(UE.Provider,{value:0,children:v.jsxs(oq,{ref:i,value:o,onValueChange:u=>{s(u),u||l(!1)},className:he("relative z-10 flex h-10 w-max items-center space-x-1 rounded-lg bg-transparent p-1",t),...r,children:[v.jsx(sq,{className:"flex items-center space-x-1",children:n}),v.jsx("div",{className:"absolute left-0 top-full flex justify-start",children:v.jsx(cq,{className:he("origin-top-left relative mt-2 h-[var(--radix-navigation-menu-viewport-height)] w-full overflow-hidden border border-outline-variant bg-surface-container text-on-surface shadow-lg transition-[width,height] duration-300 data-[state=open]:animate-nav-scale-in data-[state=closed]:animate-nav-scale-out sm:w-[var(--radix-navigation-menu-viewport-width)]",e==="full"?"rounded-3xl":e==="minimal"?"rounded-xl":"rounded-none")})})]})})})});qIe.displayName="Menubar";const l9t=FIe,YIe=P.forwardRef(({className:t,children:e,...n},r)=>{const{isClickMode:i,setIsClickMode:o}=Wg();return v.jsx(aq,{ref:r,onPointerEnter:s=>{i||s.preventDefault(),n.onPointerEnter?.(s)},onPointerMove:s=>{i||s.preventDefault(),n.onPointerMove?.(s)},onClick:s=>{o(!0),n.onClick?.(s)},className:he("flex cursor-pointer select-none items-center rounded-md px-3 py-1.5 text-sm font-semibold outline-none text-on-surface relative z-0 overflow-hidden","transition-colors duration-150 ease-in-out","focus:bg-surface-container-highest","data-[state=open]:bg-surface-container-highest","after:absolute after:inset-0 after:z-[-1] after:bg-secondary-container/50 after:opacity-0 after:scale-75 after:origin-center after:rounded-[inherit] after:transition-all after:duration-200 after:ease-out","hover:after:opacity-100 hover:after:scale-100 hover:bg-surface-container-highest/50",t),...n,children:e})});YIe.displayName="Menubar.Trigger";const ZIe=P.forwardRef(({className:t,children:e,...n},r)=>{const{closeMenu:i}=Wg();return v.jsx(lq,{ref:r,onFocusOutside:o=>{o.preventDefault(),n.onFocusOutside?.(o)},onInteractOutside:o=>{const s=o.target;s.closest('[role="menu"]')||s.closest("[data-radix-popper-content-wrapper]")?o.preventDefault():i(),n.onInteractOutside?.(o)},className:he("flex flex-col p-1.5 w-auto min-w-[12rem] outline-none","data-[motion^=from-]:animate-nav-enter-from data-[motion^=to-]:animate-nav-exit-to","data-[motion=from-end]:animate-nav-enter-from-right data-[motion=from-start]:animate-nav-enter-from-left","data-[motion=to-end]:animate-nav-exit-to-right data-[motion=to-start]:animate-nav-exit-to-left","absolute top-0 left-0",t),...n,children:v.jsx(UE.Provider,{value:1,children:e})})});ZIe.displayName="Menubar.Content";const XIe=P.forwardRef(({className:t,inset:e,...n},r)=>{const i=$h(),{shape:o,closeMenu:s}=Wg(),{theme:a}=Ul(),l=P.useRef(null),[,c]=Nr({ref:l,color:a==="dark"?"var(--color-ripple-dark)":"var(--color-ripple-light)",duration:400});return P.useImperativeHandle(r,()=>l.current),i===1?v.jsx(wD,{asChild:!0,children:v.jsx("button",{ref:l,onPointerDown:c,onClick:u=>{s(),n.onClick?.(u)},className:he(SD,"[&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",e&&"pl-8",o==="sharp"&&"!rounded-none",t),...n})}):v.jsx(pr,{ref:r,inset:e,className:t,onSelect:u=>{s(),n.onSelect?.(u)},...n})});XIe.displayName="Menubar.Item";const QIe=P.forwardRef(({className:t,...e},n)=>$h()===1?v.jsx("div",{ref:n,className:he("-mx-1 my-1.5 h-px bg-outline-variant",t),...e}):v.jsx(Ys,{ref:n,className:t,...e}));QIe.displayName="Menubar.Separator";const JIe=P.forwardRef(({className:t,inset:e,...n},r)=>$h()===1?v.jsx("div",{ref:r,className:he("px-3 py-2 text-xs font-medium text-on-surface-variant tracking-wide",e&&"pl-8",t),...n}):v.jsx(Ff,{ref:r,inset:e,className:t,...n}));JIe.displayName="Menubar.Label";const c9t=t=>{const e=$h(),{shape:n}=Wg();return e===1?v.jsx(UE.Provider,{value:e+1,children:v.jsx(Fa,{shape:n,modal:!1,...t})}):v.jsx(UE.Provider,{value:e+1,children:v.jsx(qse,{...t})})},eMe=P.forwardRef(({className:t,children:e,inset:n,...r},i)=>{const o=$h(),{shape:s}=Wg(),{theme:a}=Ul(),l=P.useRef(null),[,c]=Nr({ref:l,color:a==="dark"?"var(--color-ripple-dark)":"var(--color-ripple-light)",duration:400});return P.useImperativeHandle(i,()=>l.current),o===2?v.jsx(cl,{asChild:!0,children:v.jsx("button",{ref:l,onPointerDown:c,className:he(SD,"data-[state=open]:bg-secondary-container/60","[&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",n&&"pl-8",s==="sharp"&&"!rounded-none",t),...r,children:v.jsxs("span",{className:"relative z-10 flex flex-1 items-center gap-2",children:[e,v.jsx(ld,{className:"ml-auto h-4 w-4"})]})})}):v.jsx(V7,{ref:i,inset:n,className:t,...r,children:e})});eMe.displayName="Menubar.SubTrigger";const tMe=P.forwardRef(({className:t,...e},n)=>{const r=$h(),{shape:i}=Wg();return r===2?v.jsx(ma,{ref:n,side:"right",sideOffset:12,align:"start",className:t,...e}):v.jsx(j7,{ref:n,className:t,...e})});tMe.displayName="Menubar.SubContent";const u9t=Kse,nMe=({className:t,...e})=>v.jsx("span",{className:he("ml-auto text-xs font-mono tracking-wider text-on-surface-variant/50",t),...e});nMe.displayName="MenubarShortcut";const rMe=P.forwardRef(({className:t,children:e,checked:n,onCheckedChange:r,inset:i,...o},s)=>{const a=$h(),{shape:l,closeMenu:c}=Wg(),{theme:u}=Ul(),d=P.useRef(null),[,p]=Nr({ref:d,color:u==="dark"?"var(--color-ripple-dark)":"var(--color-ripple-light)",duration:400});return P.useImperativeHandle(s,()=>d.current),a===1?v.jsx(wD,{asChild:!0,children:v.jsxs("button",{ref:d,onPointerDown:p,className:he(SD,"pl-8 pr-3",l==="sharp"&&"!rounded-none",t),onClick:g=>{r?.(!n),c(),o.onClick?.(g)},...o,children:[v.jsx("span",{className:"absolute left-2 flex h-4 w-4 items-center justify-center z-10",children:n&&v.jsx(cs,{className:"h-4 w-4 animate-check-in text-primary"})}),v.jsx("span",{className:"relative z-10",children:e})]})}):v.jsx(A_,{ref:s,checked:n,onCheckedChange:r,className:t,onSelect:g=>{c(),o.onSelect?.(g)},...o,children:e})});rMe.displayName="Menubar.CheckboxItem";const iMe=P.forwardRef(({value:t,onValueChange:e,children:n,...r},i)=>$h()===1?v.jsx(WIe.Provider,{value:{value:t||"",onValueChange:e||(()=>{})},children:v.jsx("div",{ref:i,...r,children:n})}):v.jsx(Yse,{ref:i,value:t,onValueChange:e,...r,children:n}));iMe.displayName="Menubar.RadioGroup";const oMe=P.forwardRef(({className:t,children:e,value:n,inset:r,...i},o)=>{const s=$h(),{shape:a,closeMenu:l}=Wg(),c=P.useContext(WIe),{theme:u}=Ul(),d=P.useRef(null),[,p]=Nr({ref:d,color:u==="dark"?"var(--color-ripple-dark)":"var(--color-ripple-light)",duration:400});if(P.useImperativeHandle(o,()=>d.current),s===1){const g=c.value===n;return v.jsx(wD,{asChild:!0,children:v.jsxs("button",{ref:d,onPointerDown:p,className:he(SD,"pl-8 pr-3",a==="sharp"&&"!rounded-none",t),onClick:b=>{c.onValueChange(n),l(),i.onClick?.(b)},...i,children:[v.jsx("span",{className:"absolute left-2 flex h-4 w-4 items-center justify-center z-10",children:g&&v.jsx(v8,{className:"h-2 w-2 fill-current animate-check-in text-primary"})}),v.jsx("span",{className:"relative z-10",children:e})]})})}return v.jsx(R7,{ref:o,value:n,className:t,onSelect:g=>{l(),i.onSelect?.(g)},...i,children:e})});oMe.displayName="Menubar.RadioItem";const d9t=Object.assign(qIe,{Menu:l9t,Trigger:YIe,Content:ZIe,Item:XIe,Separator:QIe,Label:JIe,CheckboxItem:rMe,RadioGroup:iMe,RadioItem:oMe,Portal:u9t,Sub:c9t,SubContent:tMe,SubTrigger:eMe,Shortcut:nMe}),f9t=gn("group flex flex-col w-full relative",{variants:{variant:{filled:"","filled-inverted":"",outlined:"","outlined-inverted":"",underlined:"","underlined-inverted":"",ghost:"","ghost-inverted":""},color:{primary:"",secondary:"",error:""},size:{sm:"",md:"",lg:""},shape:{full:"",minimal:"",sharp:""},labelPlacement:{inside:"",outside:"","outside-left":"flex-row items-start flex-wrap md:flex-nowrap gap-x-4"},isInvalid:{true:"",false:""},isDisabled:{true:"opacity-disabled pointer-events-none"}},defaultVariants:{variant:"filled",color:"primary",size:"md",shape:"minimal",labelPlacement:"inside"}}),Kg={base:"group flex flex-col w-full relative",label:["absolute z-10 block subpixel-antialiased text-on-surface-variant/70 pointer-events-none","origin-top-left transition-all duration-200 ease-out will-change-transform","cursor-text group-data-[filled=true]:cursor-default"],trigger:["relative w-full inline-flex tap-highlight-transparent flex-row items-center flex-wrap gap-2 transition-colors duration-200 ease-out overflow-hidden outline-none","min-h-14 pr-10"],placeholder:"text-on-surface-variant/50 font-normal select-none",selectorIcon:"absolute right-3 top-1/2 -translate-y-1/2 flex items-center gap-1 text-on-surface-variant/50 pointer-events-none",helperWrapper:"p-1 relative flex flex-col gap-1.5",description:"text-xs text-on-surface-variant",errorMessage:"text-xs text-error"},h9t=t=>{const{variant:e,size:n,labelPlacement:r,isInvalid:i,shape:o,hasLabel:s,isFilled:a}=t;let l="rounded-2xl";o==="full"&&(l="rounded-3xl"),o==="sharp"&&(l="rounded-none");const c=[l];switch(e){case"filled":c.push("bg-surface-container-highest/60 hover:bg-surface-container-highest","data-[state=open]:bg-surface-container-highest");break;case"filled-inverted":c.push("bg-surface-container-low hover:bg-surface-container","data-[state=open]:bg-surface-container");break;case"outlined":c.push("bg-transparent border-2 border-outline-variant hover:border-on-surface-variant data-[state=open]:border-primary");break;case"outlined-inverted":c.push("bg-transparent border-2 border-primary/50 hover:border-primary data-[state=open]:border-primary data-[state=open]:ring-2 data-[state=open]:ring-primary/20");break;case"underlined":c.push("bg-transparent border-b-2 border-outline-variant rounded-none! px-0 data-[state=open]:border-primary");break;case"underlined-inverted":c.push("bg-surface-container-highest/30 border-b-2 border-primary/50 hover:bg-surface-container-highest/50 rounded-t-lg rounded-b-none data-[state=open]:border-primary");break;case"ghost":c.push("bg-transparent hover:bg-surface-container-highest/30 data-[state=open]:bg-surface-container-highest/50");break;case"ghost-inverted":c.push("bg-transparent hover:bg-primary/10 data-[state=open]:bg-primary/10 text-primary");break}i&&(e?.includes("filled")?c.push("bg-error-container/20 !text-error ring-inset ring-2 ring-error"):c.push("!border-error text-error"));let u="px-3",d="left-3",p="py-3";if(o==="full"?(u="px-5",d="left-5"):(u="px-4",d="left-4"),r==="inside")if(s){d+=" absolute top-1/2 -translate-y-1/2 font-normal";const g=["group-data-[filled=true]:top-1.5 group-data-[filled=true]:-translate-y-0","group-data-[filled=true]:scale-85","group-data-[filled=true]:opacity-70"].join(" ");d+=` ${g}`,a?n==="sm"?p="pt-5 pb-1":p="pt-6 pb-2":p="py-3"}else p="py-3";else d="static mb-1.5 ml-1 text-sm font-medium pointer-events-auto scale-100 translate-y-0",p="py-2";return e==="underlined"&&(u="px-0",d=d.replace(/left-\d+/,"left-0")),{base:"",label:[i?"text-error":"group-focus-within:text-primary text-on-surface-variant/70",d].join(" "),trigger:[c.join(" "),u,p].join(" ")}},sMe=U.forwardRef(({options:t,defaultValue:e=[],value:n,onValueChange:r,placeholder:i="Select items...",searchPlaceholder:o="Search...",emptyMessage:s="No item found.",maxCount:a=10,variant:l="filled",size:c="md",shape:u="minimal",labelPlacement:d="inside",disabled:p=!1,isInvalid:g=!1,className:b,classNames:w,label:_,description:E,errorMessage:A,mobileLayout:k="bottom-sheet",...M},L)=>{const[F,R]=U.useState(!1),[B,V]=U.useState(n!==void 0?n:e),[H,W]=U.useState(""),se=gl("(max-width: 768px)")&&k!=="default",X=Te=>{R(Te),Te||setTimeout(()=>W(""),200)},ee=F;U.useEffect(()=>{n!==void 0&&V(Te=>Te.length===n.length&&Te.every((lt,Be)=>lt===n[Be])?Te:n)},[n]);const K=Te=>{const lt=B.includes(Te)?B.filter(Be=>Be!==Te):[...B,Te];V(lt),r?.(lt)},Q=Te=>{Te.stopPropagation(),V([]),r?.([])},Y=(Te,lt)=>{Te.stopPropagation();const Be=B.filter(it=>it!==lt);V(Be),r?.(Be)},re=t.filter(Te=>B.includes(Te.value)),J=U.useMemo(()=>H?t.filter(Te=>Te.label.toLowerCase().includes(H.toLowerCase())):t,[t,H]),ce=a?re.slice(0,a):re,ie=re.length-ce.length,de=B.length>0||ee,ve=h9t({variant:l,size:c,shape:u,labelPlacement:d,isInvalid:g,isFilled:de,hasLabel:!!_}),ye=_?v.jsx("span",{className:he(Kg.label,ve.label,w?.label),children:_}):null,Ie=d==="outside"||d==="outside-left",Pe=B.length===0&&(!_||d!=="inside"||ee),ke=()=>v.jsxs("div",{className:"flex flex-col h-full w-full",children:[v.jsx("div",{className:"p-2 border-b border-outline-variant/10 shrink-0",children:v.jsx(hi,{variant:"filled",size:"sm",placeholder:o,startContent:v.jsx(ud,{className:"w-4 h-4 text-on-surface-variant"}),value:H,onChange:Te=>W(Te.target.value),className:"bg-transparent",onClick:Te=>Te.stopPropagation(),onPointerDown:Te=>Te.stopPropagation()})}),v.jsx("div",{className:"flex-1 min-h-0 relative",children:v.jsx(Js,{className:"h-full w-full",children:v.jsx("div",{className:"p-1 flex flex-col gap-0.5 pb-safe",children:J.length>0?J.map(Te=>{const lt=B.includes(Te.value);return v.jsxs("div",{onClick:()=>K(Te.value),className:he("relative flex cursor-pointer select-none items-center rounded-lg px-2 py-2 text-sm outline-none transition-colors shrink-0",lt?"bg-secondary-container/60 text-on-surface":"hover:bg-surface-container-highest text-on-surface"),children:[v.jsx("div",{className:he("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary",lt?"bg-primary text-on-primary":"opacity-50"),children:lt&&v.jsx(cs,{className:"h-3 w-3"})}),Te.icon&&v.jsx(Te.icon,{className:"mr-2 h-4 w-4 text-muted-foreground"}),v.jsx("span",{children:Te.label})]},Te.value)}):v.jsx("div",{className:"py-6 text-center text-sm text-on-surface-variant",children:s})})})}),B.length>0&&v.jsx("div",{className:"p-2 border-t border-outline-variant/10 shrink-0",children:v.jsx(Zn,{variant:"ghost",size:"sm",className:"w-full",onClick:Te=>Q(Te),children:"Clear selection"})})]}),De=v.jsxs("button",{ref:L,type:"button",disabled:p,className:he(Kg.trigger,ve.trigger,w?.trigger),...M,children:[!Ie&&ye,re.length>0?v.jsxs(v.Fragment,{children:[ce.map(Te=>v.jsxs(Nf,{variant:"secondary",shape:u==="full"?"full":"minimal",className:"pr-1 pl-2 h-6 pointer-events-auto z-10",onClick:lt=>Y(lt,Te.value),children:[Te.icon&&v.jsx(Te.icon,{className:"mr-1 h-3 w-3"}),Te.label,v.jsx("div",{className:"ml-1 rounded-full p-0.5 hover:bg-black/10 dark:hover:bg-white/10 cursor-pointer transition-colors",children:v.jsx(ao,{className:"h-3 w-3"})})]},Te.value)),ie>0&&v.jsxs(Nf,{variant:"secondary",shape:"minimal",className:"h-6 px-2 pointer-events-auto z-10",children:["+",ie," more"]})]}):null,Pe&&v.jsx("span",{className:he(Kg.placeholder),children:i}),v.jsxs("div",{className:Kg.selectorIcon,children:[B.length>0&&!p&&v.jsx("div",{role:"button",onClick:Q,className:"p-1 rounded-full hover:bg-on-surface/10 hover:text-on-surface transition-colors pointer-events-auto",children:v.jsx(ao,{className:"h-4 w-4"})}),v.jsx(WJ,{className:"h-4 w-4 shrink-0 opacity-50"})]})]}),Oe=(E||g&&A)&&v.jsx("div",{className:he(Kg.helperWrapper,w?.helperWrapper),children:g&&A?v.jsx("div",{className:he(Kg.errorMessage,w?.errorMessage),children:A}):v.jsx("div",{className:he(Kg.description,w?.description),children:E})}),Ye=({children:Te})=>v.jsxs("div",{className:he(Kg.base,f9t({labelPlacement:d}),b,w?.base),"data-filled":de,"data-invalid":g,"data-disabled":p,children:[Ie&&ye,Te,Oe]});if(se){const Te=k==="bottom-sheet"?sg:Gl,lt=k==="bottom-sheet"?aS:ng,Be=k==="bottom-sheet"?ig:yl;return v.jsxs(Te,{open:F,onOpenChange:X,children:[v.jsx(Ye,{children:v.jsx(lt,{asChild:!0,children:De})}),v.jsxs(Be,{padding:"none",className:he("p-0 flex flex-col overflow-hidden",k==="dialog"&&"max-w-[90vw] h-[60vh]",k==="bottom-sheet"&&"max-h-[85vh] h-[500px]"),shape:u,children:[k==="bottom-sheet"&&v.jsx(og,{className:"px-4 py-3 border-b border-outline-variant/20 shrink-0",children:v.jsx(O0,{className:"text-left",children:_||"Select Items"})}),ke()]})]})}return v.jsxs(G2,{open:F,onOpenChange:X,children:[v.jsx(Ye,{children:v.jsx(W2,{asChild:!0,children:De})}),v.jsx(K2,{children:v.jsx(q2,{className:he("z-50 w-[var(--radix-popover-trigger-width)] min-w-48 overflow-hidden p-0","max-h-80 flex flex-col","rounded-xl border border-outline-variant bg-surface-container text-on-surface shadow-md","data-[state=open]:animate-menu-enter data-[state=closed]:animate-menu-exit"),align:"start",sideOffset:4,children:ke()})})]})});sMe.displayName="MultiSelect";const aMe=gn("group inline-flex h-10 w-max items-center justify-center rounded-lg bg-transparent px-4 py-2 text-sm font-semibold transition-colors focus:bg-graphite-secondary focus:outline-none focus:ring-2 focus:ring-graphite-ring focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[active]:bg-graphite-secondary/50 data-[state=open]:bg-graphite-secondary/50 relative z-0 overflow-hidden after:absolute after:inset-0 after:z-[-1] after:bg-graphite-secondary after:opacity-0 after:scale-75 after:origin-center after:rounded-[inherit] after:transition-all after:duration-200 after:ease-out hover:after:opacity-100 hover:after:scale-100"),p9t=gn(["relative block w-full select-none space-y-1 rounded-lg p-3 text-left leading-none no-underline outline-none transition-colors duration-150 ease-in-out overflow-hidden z-0","focus:bg-graphite-secondary","focus-visible:ring-2 focus-visible:ring-graphite-ring focus-visible:ring-offset-2 focus-visible:ring-offset-graphite-card","after:absolute after:inset-0 after:z-[-1] after:bg-graphite-secondary after:opacity-0 after:scale-75 after:origin-center after:rounded-[inherit] after:transition-all after:duration-200 after:ease-out","hover:after:opacity-100 hover:after:scale-100"]),lMe=P.forwardRef(({className:t,children:e,...n},r)=>v.jsxs(oq,{ref:r,className:he("relative z-10 flex max-w-max flex-1 items-center justify-center",t),...n,children:[e,v.jsx(dq,{})]}));lMe.displayName=oq.displayName;const cMe=P.forwardRef(({className:t,...e},n)=>v.jsx(sq,{ref:n,className:he("group flex flex-1 list-none items-center justify-center space-x-1",t),...e}));cMe.displayName=sq.displayName;const g9t=FIe,uMe=P.forwardRef(({className:t,children:e,...n},r)=>v.jsx(aq,{ref:r,className:he(aMe(),"group",t),...n,children:v.jsxs("span",{className:"relative z-10 flex items-center",children:[e,v.jsx(Cs,{className:"relative top-[1px] ml-1 h-4 w-4 transition duration-200 group-data-[state=open]:rotate-180","aria-hidden":"true"})]})}));uMe.displayName=aq.displayName;const dMe=P.forwardRef(({className:t,...e},n)=>v.jsx(lq,{ref:n,className:he("left-0 top-0 w-full data-[motion^=from-]:animate-nav-enter-from data-[motion^=to-]:animate-nav-exit-to data-[motion=from-end]:animate-nav-enter-from-right data-[motion=from-start]:animate-nav-enter-from-left data-[motion=to-end]:animate-nav-exit-to-right data-[motion=to-start]:animate-nav-exit-to-left md:absolute md:w-auto",t),...e}));dMe.displayName=lq.displayName;const fMe=wD,hMe=P.forwardRef(({className:t,grid:e="cols-1",...n},r)=>{const i={"cols-1":"md:grid-cols-1","cols-2":"md:grid-cols-2","cols-3":"md:grid-cols-3"};return v.jsx("ul",{ref:r,className:he("grid gap-3 p-4","w-[400px]",i[e],t),...n})});hMe.displayName="NavigationMenu.ContentList";const pMe=P.forwardRef(({className:t,title:e,children:n,startIcon:r,endAdornment:i,onPointerDown:o,...s},a)=>{const l=P.useRef(null);P.useImperativeHandle(a,()=>l.current);const[,c]=Nr({ref:l,color:"var(--color-ripple-light)",duration:400}),u=!!n;return v.jsx("li",{children:v.jsx(fMe,{ref:l,onPointerDown:d=>{c(d),o?.(d)},className:p9t({className:t}),...s,children:v.jsxs("div",{className:he("flex gap-4 relative z-10 w-full",u?"items-start":"items-center"),children:[r&&v.jsx("div",{className:he("text-graphite-primary flex-shrink-0 flex items-center justify-center",u&&"mt-0.5"),children:r}),v.jsxs("div",{className:"flex-1 min-w-0",children:[v.jsxs("div",{className:"flex justify-between items-center",children:[v.jsx(un,{variant:"body-small",className:"font-semibold !leading-none",children:e}),i]}),n&&v.jsx(un,{variant:"body-small",muted:!0,className:"!text-sm !leading-snug line-clamp-2 mt-1",children:n})]})]})})})});pMe.displayName="NavigationMenu.ContentItem";const dq=P.forwardRef(({className:t,...e},n)=>v.jsx("div",{className:he("absolute left-0 top-full flex justify-center"),children:v.jsx(cq,{className:he("origin-top-center relative mt-2 h-(--radix-navigation-menu-viewport-height) w-full overflow-hidden rounded-xl border border-graphite-border bg-graphite-card text-graphite-foreground shadow-lg data-[state=open]:animate-nav-scale-in data-[state=closed]:animate-nav-scale-out md:w-(--radix-navigation-menu-viewport-width)",t),ref:n,...e})}));dq.displayName=cq.displayName;const gMe=P.forwardRef(({className:t,...e},n)=>v.jsx(BIe,{ref:n,className:he("top-full z-[1] flex h-2.5 items-end justify-center overflow-hidden data-[state=visible]:animate-nav-fade-in data-[state=hidden]:animate-nav-fade-out",t),...e,children:v.jsx("div",{className:"relative top-[60%] h-3 w-3 rotate-45 rounded-tl-sm bg-graphite-border"})}));gMe.displayName=BIe.displayName;const m9t=Object.assign(lMe,{List:cMe,Item:g9t,Content:dMe,Trigger:uMe,Link:fMe,Indicator:gMe,Viewport:dq,ContentList:hMe,ContentItem:pMe}),mMe=P.createContext(null),ED=()=>{const t=P.useContext(mMe);if(!t)throw new Error("NavigationRail components must be used within a <NavigationRail.Navigator>");return t},y9t=gn("flex flex-col h-full transition-shadow duration-300 ease-in-out z-20 overflow-hidden text-on-surface",{variants:{variant:{primary:"bg-surface-container-low",secondary:"bg-surface-container-high",tertiary:"bg-tertiary-container text-on-tertiary-container",surface:"bg-surface",ghost:"bg-transparent"},behavior:{push:"relative",overlay:"absolute"},shape:{full:"rounded-e-3xl",minimal:"rounded-e-xl",sharp:"rounded-none"},bordered:{true:"border-e border-outline-variant",false:""}},compoundVariants:[{variant:"tertiary",bordered:!0,className:"border-transparent!"}],defaultVariants:{variant:"primary",behavior:"push",shape:"minimal",bordered:!0}}),fq=()=>null;fq.displayName="NavigationRail.Screen";const CD=({children:t,className:e,...n})=>v.jsx("div",{className:he("flex items-center w-full min-w-0 transition-all duration-300",e),...n,children:t});CD.displayName="NavigationRail.Header";const yMe=({children:t,className:e,...n})=>{const{isExpanded:r,itemLayout:i}=ED(),o=i==="stacked";return v.jsx("li",{className:"w-full list-none flex justify-start",...n,children:v.jsx(vn,{initial:!1,mode:"wait",children:r&&!o?v.jsx(gt.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},transition:{duration:.15},className:he("w-full px-4 py-2 overflow-hidden",e),children:typeof t=="string"?v.jsx(un,{variant:"label-small",className:"text-on-surface-variant/70 uppercase tracking-widest font-bold block truncate",children:t}):t}):v.jsx(gt.div,{initial:{opacity:0},animate:{opacity:.4},exit:{opacity:0},className:"w-full flex justify-center py-2",children:v.jsx("div",{className:"w-8 border-t border-outline-variant"})})})})};yMe.displayName="NavigationRail.Label";const TD=P.forwardRef(({icon:t,label:e,className:n,variant:r,...i},o)=>{const{isExpanded:s,itemVariant:a,itemLayout:l,isRtl:c,disableRipple:u}=ED(),d=r||(a==="ghost"?"secondary":"primary"),p=l==="stacked",g=P.useRef(null);P.useImperativeHandle(o,()=>g.current);const[,b]=Nr({ref:g,color:d==="primary"?"var(--color-ripple-dark)":"var(--color-ripple-light)",duration:400}),w={primary:"bg-primary-container text-on-primary-container hover:bg-primary-container/90 shadow-md hover:shadow-lg",secondary:"bg-secondary-container text-on-secondary-container hover:bg-secondary-container/80 shadow-sm hover:shadow-md",tertiary:"bg-tertiary-container text-on-tertiary-container hover:bg-tertiary-container/80 shadow-sm hover:shadow-md",ghost:"bg-transparent text-on-surface hover:bg-surface-container-highest/50 shadow-none"},_=c?5:-5;return v.jsx("div",{className:he("w-full mb-6 mt-2 flex",p?"justify-center px-0":"justify-start px-4"),children:v.jsxs(gt.button,{ref:g,type:"button",onPointerDown:u?void 0:b,initial:!1,animate:{width:s&&!p?Math.max(140,(e?.toString().length||0)*12+60):"3.5rem",borderRadius:"1rem"},transition:{type:"spring",stiffness:300,damping:28,mass:1},className:he("h-14 relative flex items-center overflow-hidden transition-colors","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2",p&&"justify-center",w[d],n),...i,children:[v.jsx(gt.div,{layout:"position",className:"min-w-[3.5rem] h-full flex items-center justify-center shrink-0 z-10",children:t}),v.jsx("div",{className:"flex items-center h-full overflow-hidden",children:v.jsx(vn,{mode:"popLayout",initial:!1,children:s&&!p&&e&&v.jsx(gt.span,{initial:{opacity:0,x:_},animate:{opacity:1,x:0},exit:{opacity:0,x:_},transition:{duration:.15,delay:.05},className:"pe-6 font-semibold text-base text-inherit whitespace-nowrap",children:e})})})]})})});TD.displayName="NavigationRail.FAB";const v9t=({screen:t})=>{const{name:e,label:n,icon:r,shape:i}=t,{activeTab:o,onTabPress:s,isExpanded:a,indicatorId:l,navigatorShape:c,itemVariant:u,itemLayout:d,pillStyle:p,disableRipple:g,indicatorAnimation:b}=ED(),w=o===e,_=i||c,E=d==="stacked",A=p==="icon",k=P.useRef(null),L=w&&(u==="primary"||u==="tertiary")?"var(--color-ripple-light)":"var(--color-ripple-dark)",[,F]=Nr({ref:k,color:L,duration:400});let R="bg-secondary-container",B="text-on-secondary-container";u==="primary"?(R="bg-primary",B="text-on-primary"):u==="tertiary"?(R="bg-tertiary-container",B="text-on-tertiary-container"):u==="ghost"&&(R="bg-transparent",B="text-primary font-bold");const V={full:99,minimal:12,sharp:0},H={full:"rounded-full",minimal:"rounded-lg",sharp:"rounded-none"},W=!w&&!A,te=b==="slide",se={layoutId:te?l:void 0,initial:te?!1:{opacity:0,scale:.7},animate:te?void 0:{opacity:1,scale:1},exit:te?void 0:{opacity:0,scale:.7},transition:te?{type:"spring",stiffness:300,damping:28,mass:1}:{duration:.3,ease:"easeOut"},className:he("absolute inset-0 z-0",R),style:{borderRadius:V[_]}};return v.jsx("li",{className:he("flex w-full",E?"justify-center":"justify-start"),children:v.jsxs("button",{ref:k,type:"button",role:"tab","aria-selected":w,onClick:()=>s(e),onPointerDown:g?void 0:F,className:he("relative z-10 flex transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2",A&&"group",E?"flex-col items-center justify-center gap-1 h-[4.5rem] w-[4.5rem] px-1":"flex-row items-center justify-start gap-2 px-4 py-2 h-14 w-fit max-w-full",w?A?"text-on-surface":`${B} font-semibold`:"text-on-surface-variant",H[_],W&&["after:absolute after:inset-0 after:z-[-1] after:bg-secondary-container/50 after:opacity-0 after:scale-70 after:origin-center after:rounded-[inherit] after:transition-all after:duration-300 after:ease-out","hover:after:opacity-100 hover:after:scale-100","disabled:after:opacity-0"]),children:[v.jsx(vn,{children:w&&!A&&v.jsx(gt.div,{...se})}),v.jsxs("div",{className:he("relative flex items-center justify-center shrink-0 transition-colors",A?"w-14 h-8":"h-6 w-6",A&&H[_],A?w?B:"text-on-surface-variant":"text-inherit",A&&!w&&["after:absolute after:inset-0 after:z-[-1] after:bg-secondary-container/50 after:opacity-0 after:scale-70 after:origin-center after:rounded-[inherit] after:transition-all after:duration-300 after:ease-out","group-hover:after:opacity-100 group-hover:after:scale-100","group-disabled:after:opacity-0"]),children:[v.jsx(vn,{children:w&&A&&v.jsx(gt.div,{...se})}),v.jsx("div",{className:"relative z-10 flex items-center justify-center",children:r({isActive:w})})]}),E?v.jsx("span",{className:"relative z-10 text-[11px] font-semibold tracking-wide text-inherit truncate max-w-full mt-0.5",children:n}):v.jsx(vn,{children:a&&v.jsx(gt.div,{initial:{width:0,opacity:0},animate:{width:"auto",opacity:1,transition:{delay:.1,duration:.2}},exit:{width:0,opacity:0,transition:{duration:.1}},className:"relative z-10 overflow-hidden whitespace-nowrap",children:v.jsx(un,{"body-medium":!0,className:"font-semibold text-inherit!",children:n})})})]})})},vMe=({children:t,activeTab:e,onTabPress:n,shape:r="minimal",bordered:i=!0,variant:o="primary",itemVariant:s="secondary",itemLayout:a="inline",width:l="6rem",expandedWidth:c="12rem",forceExpanded:u=!1,expandOnHover:d=!1,overlay:p=!1,expandable:g=!0,pillStyle:b="full",disableRipple:w=!1,indicatorAnimation:_="slide",hideMenuButton:E=!1,className:A,style:k,...M})=>{const L=P.useId(),[F,R]=P.useState(!1),B=gl("(max-width: 768px)"),{isRtl:V}=vI(),H=B?"inline":a,W=H==="stacked"?!1:g,te=W?B?F:u||F:!1,se=B||p?"overlay":"push",X=typeof c=="number"?`${c}px`:c,ee=typeof l=="number"?`${l}px`:l,K=()=>{W&&!B&&d&&!u&&R(!0)},Q=()=>{W&&!B&&d&&!u&&R(!1)},Y=()=>{W&&R(!F)},re=P.Children.toArray(t),J=re.find(de=>P.isValidElement(de)&&de.type===CD),ce=re.find(de=>P.isValidElement(de)&&de.type===TD),ie=P.useMemo(()=>({activeTab:e,onTabPress:n,isExpanded:te,navigatorShape:r,indicatorId:L,variant:o,itemVariant:s,itemLayout:H,isRtl:V,pillStyle:b,disableRipple:w,indicatorAnimation:_}),[e,n,te,r,L,o,s,H,V,b,w,_]);return v.jsxs(mMe.Provider,{value:ie,children:[se==="overlay"&&v.jsx("div",{style:{width:ee,flexShrink:0}}),v.jsx(vn,{children:te&&se==="overlay"&&v.jsx(gt.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.3},className:"fixed inset-0 bg-black/50 z-10 select-none",onClick:()=>R(!1)})}),v.jsxs(gt.nav,{className:he(y9t({behavior:se,shape:r,bordered:i,variant:o,className:A})),onMouseEnter:K,onMouseLeave:Q,animate:{width:te?X:ee},transition:{type:"spring",stiffness:300,damping:28,mass:1},style:{display:"block",minWidth:"96px",...k},...M,children:[v.jsxs("div",{className:he("flex h-20 w-full shrink-0 items-center px-4 gap-2",te&&H!=="stacked"?"justify-between":"justify-center"),children:[J&&v.jsx("div",{className:"min-w-0 flex-1",children:J}),W&&(!u||B)&&!E&&v.jsx(zn,{variant:"ghost",size:"md",shape:"minimal",onClick:B||!d?Y:void 0,className:he(te&&"ml-auto"),"aria-label":te?"Collapse Menu":"Expand Menu",children:te?v.jsx(Xw,{className:he("w-5 h-5",V&&"rotate-180")}):v.jsx(nee,{className:"w-5 h-5"})})]}),ce&&v.jsx("div",{className:"shrink-0 pb-6",children:ce}),v.jsx("ul",{className:he("flex flex-1 flex-col items-center justify-start gap-2 pt-0 overflow-y-auto overflow-x-hidden",H==="stacked"?"px-2 w-full":"p-4 pe-6 w-full"),children:re.map((de,ve)=>{if(!P.isValidElement(de)||de.type===TD||de.type===CD)return null;if(de.type===fq){const ye=de;return v.jsx(v9t,{screen:ye.props},ye.props.name||ve)}return P.cloneElement(de,{key:de.key||ve})})})]})]})};vMe.displayName="NavigationRail.Navigator";const b9t={Navigator:vMe,Screen:fq,FAB:TD,Header:CD,Label:yMe};var x9t=Object.defineProperty,w9t=Object.defineProperties,_9t=Object.getOwnPropertyDescriptors,kD=Object.getOwnPropertySymbols,bMe=Object.prototype.hasOwnProperty,xMe=Object.prototype.propertyIsEnumerable,wMe=(t,e,n)=>e in t?x9t(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,S9t=(t,e)=>{for(var n in e||(e={}))bMe.call(e,n)&&wMe(t,n,e[n]);if(kD)for(var n of kD(e))xMe.call(e,n)&&wMe(t,n,e[n]);return t},E9t=(t,e)=>w9t(t,_9t(e)),C9t=(t,e)=>{var n={};for(var r in t)bMe.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&kD)for(var r of kD(t))e.indexOf(r)<0&&xMe.call(t,r)&&(n[r]=t[r]);return n};function T9t(t){let e=setTimeout(t,0),n=setTimeout(t,10),r=setTimeout(t,50);return[e,n,r]}function k9t(t){let e=U.useRef();return U.useEffect(()=>{e.current=t}),e.current}var P9t=18,_Me=40,A9t=`${_Me}px`,I9t=["[data-lastpass-icon-root]","com-1password-button","[data-dashlanecreated]",'[style$="2147483647 !important;"]'].join(",");function M9t({containerRef:t,inputRef:e,pushPasswordManagerStrategy:n,isFocused:r}){let[i,o]=U.useState(!1),[s,a]=U.useState(!1),[l,c]=U.useState(!1),u=U.useMemo(()=>n==="none"?!1:(n==="increase-width"||n==="experimental-no-flickering")&&i&&s,[i,s,n]),d=U.useCallback(()=>{let p=t.current,g=e.current;if(!p||!g||l||n==="none")return;let b=p,w=b.getBoundingClientRect().left+b.offsetWidth,_=b.getBoundingClientRect().top+b.offsetHeight/2,E=w-P9t,A=_;document.querySelectorAll(I9t).length===0&&document.elementFromPoint(E,A)===p||(o(!0),c(!0))},[t,e,l,n]);return U.useEffect(()=>{let p=t.current;if(!p||n==="none")return;function g(){let w=window.innerWidth-p.getBoundingClientRect().right;a(w>=_Me)}g();let b=setInterval(g,1e3);return()=>{clearInterval(b)}},[t,n]),U.useEffect(()=>{let p=r||document.activeElement===e.current;if(n==="none"||!p)return;let g=setTimeout(d,0),b=setTimeout(d,2e3),w=setTimeout(d,5e3),_=setTimeout(()=>{c(!0)},6e3);return()=>{clearTimeout(g),clearTimeout(b),clearTimeout(w),clearTimeout(_)}},[e,r,n,d]),{hasPWMBadge:i,willPushPWMBadge:u,PWM_BADGE_SPACE_WIDTH:A9t}}var SMe=U.createContext({}),EMe=U.forwardRef((t,e)=>{var n=t,{value:r,onChange:i,maxLength:o,textAlign:s="left",pattern:a,placeholder:l,inputMode:c="numeric",onComplete:u,pushPasswordManagerStrategy:d="increase-width",pasteTransformer:p,containerClassName:g,noScriptCSSFallback:b=D9t,render:w,children:_}=n,E=C9t(n,["value","onChange","maxLength","textAlign","pattern","placeholder","inputMode","onComplete","pushPasswordManagerStrategy","pasteTransformer","containerClassName","noScriptCSSFallback","render","children"]),A,k,M,L,F;let[R,B]=U.useState(typeof E.defaultValue=="string"?E.defaultValue:""),V=r??R,H=k9t(V),W=U.useCallback(Be=>{i?.(Be),B(Be)},[i]),te=U.useMemo(()=>a?typeof a=="string"?new RegExp(a):a:null,[a]),se=U.useRef(null),X=U.useRef(null),ee=U.useRef({value:V,onChange:W,isIOS:typeof window<"u"&&((k=(A=window?.CSS)==null?void 0:A.supports)==null?void 0:k.call(A,"-webkit-touch-callout","none"))}),K=U.useRef({prev:[(M=se.current)==null?void 0:M.selectionStart,(L=se.current)==null?void 0:L.selectionEnd,(F=se.current)==null?void 0:F.selectionDirection]});U.useImperativeHandle(e,()=>se.current,[]),U.useEffect(()=>{let Be=se.current,it=X.current;if(!Be||!it)return;ee.current.value!==Be.value&&ee.current.onChange(Be.value),K.current.prev=[Be.selectionStart,Be.selectionEnd,Be.selectionDirection];function ut(){if(document.activeElement!==Be){ie(null),ve(null);return}let Zt=Be.selectionStart,qt=Be.selectionEnd,Ct=Be.selectionDirection,Mt=Be.maxLength,an=Be.value,en=K.current.prev,on=-1,Xe=-1,xe;if(an.length!==0&&Zt!==null&&qt!==null){let $e=Zt===qt,nt=Zt===an.length&&an.length<Mt;if($e&&!nt){let ot=Zt;if(ot===0)on=0,Xe=1,xe="forward";else if(ot===Mt)on=ot-1,Xe=ot,xe="backward";else if(Mt>1&&an.length>1){let He=0;if(en[0]!==null&&en[1]!==null){xe=ot<en[1]?"backward":"forward";let Qe=en[0]===en[1]&&en[0]<Mt;xe==="backward"&&!Qe&&(He=-1)}on=He+ot,Xe=He+ot+1}}on!==-1&&Xe!==-1&&on!==Xe&&se.current.setSelectionRange(on,Xe,xe)}let Ee=on!==-1?on:Zt,Ae=Xe!==-1?Xe:qt,je=xe??Ct;ie(Ee),ve(Ae),K.current.prev=[Ee,Ae,je]}if(document.addEventListener("selectionchange",ut,{capture:!0}),ut(),document.activeElement===Be&&J(!0),!document.getElementById("input-otp-style")){let Zt=document.createElement("style");if(Zt.id="input-otp-style",document.head.appendChild(Zt),Zt.sheet){let qt="background: transparent !important; color: transparent !important; border-color: transparent !important; opacity: 0 !important; box-shadow: none !important; -webkit-box-shadow: none !important; -webkit-text-fill-color: transparent !important;";HE(Zt.sheet,"[data-input-otp]::selection { background: transparent !important; color: transparent !important; }"),HE(Zt.sheet,`[data-input-otp]:autofill { ${qt} }`),HE(Zt.sheet,`[data-input-otp]:-webkit-autofill { ${qt} }`),HE(Zt.sheet,"@supports (-webkit-touch-callout: none) { [data-input-otp] { letter-spacing: -.6em !important; font-weight: 100 !important; font-stretch: ultra-condensed; font-optical-sizing: none !important; left: -1px !important; right: 1px !important; } }"),HE(Zt.sheet,"[data-input-otp] + * { pointer-events: all !important; }")}}let It=()=>{it&&it.style.setProperty("--root-height",`${Be.clientHeight}px`)};It();let nn=new ResizeObserver(It);return nn.observe(Be),()=>{document.removeEventListener("selectionchange",ut,{capture:!0}),nn.disconnect()}},[]);let[Q,Y]=U.useState(!1),[re,J]=U.useState(!1),[ce,ie]=U.useState(null),[de,ve]=U.useState(null);U.useEffect(()=>{T9t(()=>{var Be,it,ut,It;(Be=se.current)==null||Be.dispatchEvent(new Event("input"));let nn=(it=se.current)==null?void 0:it.selectionStart,Zt=(ut=se.current)==null?void 0:ut.selectionEnd,qt=(It=se.current)==null?void 0:It.selectionDirection;nn!==null&&Zt!==null&&(ie(nn),ve(Zt),K.current.prev=[nn,Zt,qt])})},[V,re]),U.useEffect(()=>{H!==void 0&&V!==H&&H.length<o&&V.length===o&&u?.(V)},[o,u,H,V]);let ye=M9t({containerRef:X,inputRef:se,pushPasswordManagerStrategy:d,isFocused:re}),Ie=U.useCallback(Be=>{let it=Be.currentTarget.value.slice(0,o);if(it.length>0&&te&&!te.test(it)){Be.preventDefault();return}typeof H=="string"&&it.length<H.length&&document.dispatchEvent(new Event("selectionchange")),W(it)},[o,W,H,te]),Pe=U.useCallback(()=>{var Be;if(se.current){let it=Math.min(se.current.value.length,o-1),ut=se.current.value.length;(Be=se.current)==null||Be.setSelectionRange(it,ut),ie(it),ve(ut)}J(!0)},[o]),ke=U.useCallback(Be=>{var it,ut;let It=se.current;if(!p&&(!ee.current.isIOS||!Be.clipboardData||!It))return;let nn=Be.clipboardData.getData("text/plain"),Zt=p?p(nn):nn;Be.preventDefault();let qt=(it=se.current)==null?void 0:it.selectionStart,Ct=(ut=se.current)==null?void 0:ut.selectionEnd,Mt=(qt!==Ct?V.slice(0,qt)+Zt+V.slice(Ct):V.slice(0,qt)+Zt+V.slice(qt)).slice(0,o);if(Mt.length>0&&te&&!te.test(Mt))return;It.value=Mt,W(Mt);let an=Math.min(Mt.length,o-1),en=Mt.length;It.setSelectionRange(an,en),ie(an),ve(en)},[o,W,te,V]),De=U.useMemo(()=>({position:"relative",cursor:E.disabled?"default":"text",userSelect:"none",WebkitUserSelect:"none",pointerEvents:"none"}),[E.disabled]),Oe=U.useMemo(()=>({position:"absolute",inset:0,width:ye.willPushPWMBadge?`calc(100% + ${ye.PWM_BADGE_SPACE_WIDTH})`:"100%",clipPath:ye.willPushPWMBadge?`inset(0 ${ye.PWM_BADGE_SPACE_WIDTH} 0 0)`:void 0,height:"100%",display:"flex",textAlign:s,opacity:"1",color:"transparent",pointerEvents:"all",background:"transparent",caretColor:"transparent",border:"0 solid transparent",outline:"0 solid transparent",boxShadow:"none",lineHeight:"1",letterSpacing:"-.5em",fontSize:"var(--root-height)",fontFamily:"monospace",fontVariantNumeric:"tabular-nums"}),[ye.PWM_BADGE_SPACE_WIDTH,ye.willPushPWMBadge,s]),Ye=U.useMemo(()=>U.createElement("input",E9t(S9t({autoComplete:E.autoComplete||"one-time-code"},E),{"data-input-otp":!0,"data-input-otp-placeholder-shown":V.length===0||void 0,"data-input-otp-mss":ce,"data-input-otp-mse":de,inputMode:c,pattern:te?.source,"aria-placeholder":l,style:Oe,maxLength:o,value:V,ref:se,onPaste:Be=>{var it;ke(Be),(it=E.onPaste)==null||it.call(E,Be)},onChange:Ie,onMouseOver:Be=>{var it;Y(!0),(it=E.onMouseOver)==null||it.call(E,Be)},onMouseLeave:Be=>{var it;Y(!1),(it=E.onMouseLeave)==null||it.call(E,Be)},onFocus:Be=>{var it;Pe(),(it=E.onFocus)==null||it.call(E,Be)},onBlur:Be=>{var it;J(!1),(it=E.onBlur)==null||it.call(E,Be)}})),[Ie,Pe,ke,c,Oe,o,de,ce,E,te?.source,V]),Te=U.useMemo(()=>({slots:Array.from({length:o}).map((Be,it)=>{var ut;let It=re&&ce!==null&&de!==null&&(ce===de&&it===ce||it>=ce&&it<de),nn=V[it]!==void 0?V[it]:null,Zt=V[0]!==void 0?null:(ut=l?.[it])!=null?ut:null;return{char:nn,placeholderChar:Zt,isActive:It,hasFakeCaret:It&&nn===null}}),isFocused:re,isHovering:!E.disabled&&Q}),[re,Q,o,de,ce,E.disabled,V]),lt=U.useMemo(()=>w?w(Te):U.createElement(SMe.Provider,{value:Te},_),[_,Te,w]);return U.createElement(U.Fragment,null,b!==null&&U.createElement("noscript",null,U.createElement("style",null,b)),U.createElement("div",{ref:X,"data-input-otp-container":!0,style:De,className:g},lt,U.createElement("div",{style:{position:"absolute",inset:0,pointerEvents:"none"}},Ye)))});EMe.displayName="Input";function HE(t,e){try{t.insertRule(e)}catch{console.error("input-otp could not insert CSS rule:",e)}}var D9t=`
232
+ `;class fOt extends Ir{constructor(){super(...arguments),this.isMobile=!1,this.contentRectCache=null,this.resizeDebouncer=C5e(()=>{this.windowResize()},200),this.selectionChangeDebounced=C5e(()=>{this.selectionChanged()},K8t),this.documentTouchedListener=e=>{this.documentTouched(e)}}get CSS(){return{editorWrapper:"codex-editor",editorWrapperNarrow:"codex-editor--narrow",editorZone:"codex-editor__redactor",editorZoneHidden:"codex-editor__redactor--hidden",editorEmpty:"codex-editor--empty",editorRtlFix:"codex-editor--rtl"}}get contentRect(){if(this.contentRectCache!==null)return this.contentRectCache;const e=this.nodes.wrapper.querySelector(`.${Lh.CSS.content}`);return e?(this.contentRectCache=e.getBoundingClientRect(),this.contentRectCache):{width:650,left:0,right:0}}async prepare(){this.setIsMobile(),this.make(),this.loadStyles()}toggleReadOnly(e){e?this.unbindReadOnlySensitiveListeners():window.requestIdleCallback(()=>{this.bindReadOnlySensitiveListeners()},{timeout:2e3})}checkEmptiness(){const{BlockManager:e}=this.Editor;this.nodes.wrapper.classList.toggle(this.CSS.editorEmpty,e.isEditorEmpty)}get someToolbarOpened(){const{Toolbar:e,BlockSettings:n,InlineToolbar:r}=this.Editor;return!!(n.opened||r.opened||e.toolbox.opened)}get someFlipperButtonFocused(){return this.Editor.Toolbar.toolbox.hasFocus()?!0:Object.entries(this.Editor).filter(([e,n])=>n.flipper instanceof VM).some(([e,n])=>n.flipper.hasFocus())}destroy(){this.nodes.holder.innerHTML="",this.unbindReadOnlyInsensitiveListeners()}closeAllToolbars(){const{Toolbar:e,BlockSettings:n,InlineToolbar:r}=this.Editor;n.close(),r.close(),e.toolbox.close()}setIsMobile(){const e=window.innerWidth<T5e;e!==this.isMobile&&this.eventsDispatcher.emit(OE,{isEnabled:this.isMobile}),this.isMobile=e}make(){this.nodes.holder=Rt.getHolder(this.config.holder),this.nodes.wrapper=Rt.make("div",[this.CSS.editorWrapper,...this.isRtl?[this.CSS.editorRtlFix]:[]]),this.nodes.redactor=Rt.make("div",this.CSS.editorZone),this.nodes.holder.offsetWidth<this.contentRect.width&&this.nodes.wrapper.classList.add(this.CSS.editorWrapperNarrow),this.nodes.redactor.style.paddingBottom=this.config.minHeight+"px",this.nodes.wrapper.appendChild(this.nodes.redactor),this.nodes.holder.appendChild(this.nodes.wrapper),this.bindReadOnlyInsensitiveListeners()}loadStyles(){const e="editor-js-styles";if(Rt.get(e))return;const n=Rt.make("style",null,{id:e,textContent:dOt.toString()});this.config.style&&!Xc(this.config.style)&&this.config.style.nonce&&n.setAttribute("nonce",this.config.style.nonce),Rt.prepend(document.head,n)}bindReadOnlyInsensitiveListeners(){this.listeners.on(document,"selectionchange",this.selectionChangeDebounced),this.listeners.on(window,"resize",this.resizeDebouncer,{passive:!0}),this.listeners.on(this.nodes.redactor,"mousedown",this.documentTouchedListener,{capture:!0,passive:!0}),this.listeners.on(this.nodes.redactor,"touchstart",this.documentTouchedListener,{capture:!0,passive:!0})}unbindReadOnlyInsensitiveListeners(){this.listeners.off(document,"selectionchange",this.selectionChangeDebounced),this.listeners.off(window,"resize",this.resizeDebouncer),this.listeners.off(this.nodes.redactor,"mousedown",this.documentTouchedListener),this.listeners.off(this.nodes.redactor,"touchstart",this.documentTouchedListener)}bindReadOnlySensitiveListeners(){this.readOnlyMutableListeners.on(this.nodes.redactor,"click",e=>{this.redactorClicked(e)},!1),this.readOnlyMutableListeners.on(document,"keydown",e=>{this.documentKeydown(e)},!0),this.readOnlyMutableListeners.on(document,"mousedown",e=>{this.documentClicked(e)},!0),this.watchBlockHoveredEvents(),this.enableInputsEmptyMark()}watchBlockHoveredEvents(){let e;this.readOnlyMutableListeners.on(this.nodes.redactor,"mousemove",HG(n=>{const r=n.target.closest(".ce-block");this.Editor.BlockSelection.anyBlockSelected||r&&e!==r&&(e=r,this.eventsDispatcher.emit(eAe,{block:this.Editor.BlockManager.getBlockByChildNode(r)}))},20),{passive:!0})}unbindReadOnlySensitiveListeners(){this.readOnlyMutableListeners.clearAll()}windowResize(){this.contentRectCache=null,this.setIsMobile()}documentKeydown(e){switch(e.keyCode){case ur.ENTER:this.enterPressed(e);break;case ur.BACKSPACE:case ur.DELETE:this.backspacePressed(e);break;case ur.ESC:this.escapePressed(e);break;default:this.defaultBehaviour(e);break}}defaultBehaviour(e){const{currentBlock:n}=this.Editor.BlockManager,r=e.target.closest(`.${this.CSS.editorWrapper}`),i=e.altKey||e.ctrlKey||e.metaKey||e.shiftKey;if(n!==void 0&&r===null){this.Editor.BlockEvents.keydown(e);return}r||n&&i||(this.Editor.BlockManager.unsetCurrentBlock(),this.Editor.Toolbar.close())}backspacePressed(e){const{BlockManager:n,BlockSelection:r,Caret:i}=this.Editor;if(r.anyBlockSelected&&!er.isSelectionExists){const o=n.removeSelectedBlocks(),s=n.insertDefaultBlockAtIndex(o,!0);i.setToBlock(s,i.positions.START),r.clearSelection(e),e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation()}}escapePressed(e){this.Editor.BlockSelection.clearSelection(e),this.Editor.Toolbar.toolbox.opened?(this.Editor.Toolbar.toolbox.close(),this.Editor.Caret.setToBlock(this.Editor.BlockManager.currentBlock,this.Editor.Caret.positions.END)):this.Editor.BlockSettings.opened?this.Editor.BlockSettings.close():this.Editor.InlineToolbar.opened?this.Editor.InlineToolbar.close():this.Editor.Toolbar.close()}enterPressed(e){const{BlockManager:n,BlockSelection:r}=this.Editor;if(this.someToolbarOpened)return;const i=n.currentBlockIndex>=0;if(r.anyBlockSelected&&!er.isSelectionExists){r.clearSelection(e),e.preventDefault(),e.stopImmediatePropagation(),e.stopPropagation();return}if(!this.someToolbarOpened&&i&&e.target.tagName==="BODY"){const o=this.Editor.BlockManager.insert();e.preventDefault(),this.Editor.Caret.setToBlock(o),this.Editor.Toolbar.moveAndOpen(o)}this.Editor.BlockSelection.clearSelection(e)}documentClicked(e){var n,r;if(!e.isTrusted)return;const i=e.target;this.nodes.holder.contains(i)||er.isAtEditor||(this.Editor.BlockManager.unsetCurrentBlock(),this.Editor.Toolbar.close());const o=(n=this.Editor.BlockSettings.nodes.wrapper)==null?void 0:n.contains(i),s=(r=this.Editor.Toolbar.nodes.settingsToggler)==null?void 0:r.contains(i),a=o||s;if(this.Editor.BlockSettings.opened&&!a){this.Editor.BlockSettings.close();const l=this.Editor.BlockManager.getBlockByChildNode(i);this.Editor.Toolbar.moveAndOpen(l)}this.Editor.BlockSelection.clearSelection(e)}documentTouched(e){let n=e.target;if(n===this.nodes.redactor){const r=e instanceof MouseEvent?e.clientX:e.touches[0].clientX,i=e instanceof MouseEvent?e.clientY:e.touches[0].clientY;n=document.elementFromPoint(r,i)}try{this.Editor.BlockManager.setCurrentBlockByChildNode(n)}catch{this.Editor.RectangleSelection.isRectActivated()||this.Editor.Caret.setToTheLastBlock()}this.Editor.ReadOnly.isEnabled||this.Editor.Toolbar.moveAndOpen()}redactorClicked(e){if(!er.isCollapsed)return;const n=e.target,r=e.metaKey||e.ctrlKey;if(Rt.isAnchor(n)&&r){e.stopImmediatePropagation(),e.stopPropagation();const i=n.getAttribute("href"),o=F6t(i);z6t(o);return}this.processBottomZoneClick(e)}processBottomZoneClick(e){const n=this.Editor.BlockManager.getBlockByIndex(-1),r=Rt.offset(n.holder).bottom,i=e.pageY,{BlockSelection:o}=this.Editor;if(e.target instanceof Element&&e.target.isEqualNode(this.nodes.redactor)&&!o.anyBlockSelected&&r<i){e.stopImmediatePropagation(),e.stopPropagation();const{BlockManager:s,Caret:a,Toolbar:l}=this.Editor;(!s.lastBlock.tool.isDefault||!s.lastBlock.isEmpty)&&s.insertAtEnd(),a.setToTheLastBlock(),l.moveAndOpen(s.lastBlock)}}selectionChanged(){const{CrossBlockSelection:e,BlockSelection:n}=this.Editor,r=er.anchorElement;if(e.isCrossBlockSelectionStarted&&n.anyBlockSelected&&er.get().removeAllRanges(),!r){er.range||this.Editor.InlineToolbar.close();return}const i=r.closest(`.${Lh.CSS.content}`);(i===null||i.closest(`.${er.CSS.editorWrapper}`)!==this.nodes.wrapper)&&(this.Editor.InlineToolbar.containsNode(r)||this.Editor.InlineToolbar.close(),r.dataset.inlineToolbar!=="true")||(this.Editor.BlockManager.currentBlock||this.Editor.BlockManager.setCurrentBlockByChildNode(r),this.Editor.InlineToolbar.tryToShow(!0))}enableInputsEmptyMark(){function e(n){const r=n.target;k5e(r)}this.readOnlyMutableListeners.on(this.nodes.wrapper,"input",e),this.readOnlyMutableListeners.on(this.nodes.wrapper,"focusin",e),this.readOnlyMutableListeners.on(this.nodes.wrapper,"focusout",e)}}const hOt={BlocksAPI:Z6t,CaretAPI:Q6t,EventsAPI:J6t,I18nAPI:eNt,API:tNt,InlineToolbarAPI:nNt,ListenersAPI:rNt,NotifierAPI:aNt,ReadOnlyAPI:lNt,SanitizerAPI:gNt,SaverAPI:mNt,SelectionAPI:yNt,ToolsAPI:vNt,StylesAPI:bNt,ToolbarAPI:xNt,TooltipAPI:CNt,UiAPI:TNt,BlockSettings:QNt,Toolbar:sLt,InlineToolbar:aLt,BlockEvents:z8t,BlockManager:j8t,BlockSelection:U8t,Caret:H8t,CrossBlockSelection:G8t,DragNDrop:W8t,ModificationsObserver:Y8t,Paste:Z8t,ReadOnly:X8t,RectangleSelection:Q8t,Renderer:J8t,Saver:eOt,Tools:RAe,UI:fOt};class pOt{constructor(e){this.moduleInstances={},this.eventsDispatcher=new NE;let n,r;this.isReady=new Promise((i,o)=>{n=i,r=o}),Promise.resolve().then(async()=>{this.configuration=e,this.validate(),this.init(),await this.start(),await this.render();const{BlockManager:i,Caret:o,UI:s,ModificationsObserver:a}=this.moduleInstances;s.checkEmptiness(),a.enable(),this.configuration.autofocus===!0&&this.configuration.readOnly!==!0&&o.setToBlock(i.blocks[0],o.positions.START),n()}).catch(i=>{Qr(`Editor.js is not ready because of ${i}`,"error"),r(i)})}set configuration(e){var n,r;oa(e)?this.config={...e}:this.config={holder:e},KG(!!this.config.holderId,"config.holderId","config.holder"),this.config.holderId&&!this.config.holder&&(this.config.holder=this.config.holderId,this.config.holderId=null),this.config.holder==null&&(this.config.holder="editorjs"),this.config.logLevel||(this.config.logLevel=x5e.VERBOSE),M6t(this.config.logLevel),KG(!!this.config.initialBlock,"config.initialBlock","config.defaultBlock"),this.config.defaultBlock=this.config.defaultBlock||this.config.initialBlock||"paragraph",this.config.minHeight=this.config.minHeight!==void 0?this.config.minHeight:300;const i={type:this.config.defaultBlock,data:{}};this.config.placeholder=this.config.placeholder||!1,this.config.sanitizer=this.config.sanitizer||{p:!0,b:!0,a:!0},this.config.hideToolbar=this.config.hideToolbar?this.config.hideToolbar:!1,this.config.tools=this.config.tools||{},this.config.i18n=this.config.i18n||{},this.config.data=this.config.data||{blocks:[]},this.config.onReady=this.config.onReady||(()=>{}),this.config.onChange=this.config.onChange||(()=>{}),this.config.inlineToolbar=this.config.inlineToolbar!==void 0?this.config.inlineToolbar:!0,(Xc(this.config.data)||!this.config.data.blocks||this.config.data.blocks.length===0)&&(this.config.data={blocks:[i]}),this.config.readOnly=this.config.readOnly||!1,(n=this.config.i18n)!=null&&n.messages&&Ga.setDictionary(this.config.i18n.messages),this.config.i18n.direction=((r=this.config.i18n)==null?void 0:r.direction)||"ltr"}get configuration(){return this.config}validate(){const{holderId:e,holder:n}=this.config;if(e&&n)throw Error("«holderId» and «holder» param can't assign at the same time.");if(Mh(n)&&!Rt.get(n))throw Error(`element with ID «${n}» is missing. Pass correct holder's ID.`);if(n&&oa(n)&&!Rt.isElement(n))throw Error("«holder» value must be an Element node")}init(){this.constructModules(),this.configureModules()}async start(){await["Tools","UI","BlockManager","Paste","BlockSelection","RectangleSelection","CrossBlockSelection","ReadOnly"].reduce((e,n)=>e.then(async()=>{try{await this.moduleInstances[n].prepare()}catch(r){if(r instanceof I5e)throw new Error(r.message);Qr(`Module ${n} was skipped because of %o`,"warn",r)}}),Promise.resolve())}render(){return this.moduleInstances.Renderer.render(this.config.data.blocks)}constructModules(){Object.entries(hOt).forEach(([e,n])=>{try{this.moduleInstances[e]=new n({config:this.configuration,eventsDispatcher:this.eventsDispatcher})}catch(r){Qr("[constructModules]",`Module ${e} skipped because`,"error",r)}})}configureModules(){for(const e in this.moduleInstances)Object.prototype.hasOwnProperty.call(this.moduleInstances,e)&&(this.moduleInstances[e].state=this.getModulesDiff(e))}getModulesDiff(e){const n={};for(const r in this.moduleInstances)r!==e&&(n[r]=this.moduleInstances[r]);return n}}class gOt{static get version(){return"2.31.3"}constructor(e){let n=()=>{};oa(e)&&bo(e.onReady)&&(n=e.onReady);const r=new pOt(e);this.isReady=r.isReady.then(()=>{this.exportAPI(r),n()})}exportAPI(e){const n=["configuration"],r=()=>{Object.values(e.moduleInstances).forEach(i=>{bo(i.destroy)&&i.destroy(),i.listeners.removeAll()}),ENt(),e=null;for(const i in this)Object.prototype.hasOwnProperty.call(this,i)&&delete this[i];Object.setPrototypeOf(this,null)};n.forEach(i=>{this[i]=e[i]}),this.destroy=r,Object.setPrototypeOf(this,e.moduleInstances.API.methods),delete this.exportAPI,Object.entries({blocks:{clear:"clear",render:"render"},caret:{focus:"focus"},events:{on:"on",off:"off",emit:"emit"},saver:{save:"save"}}).forEach(([i,o])=>{Object.entries(o).forEach(([s,a])=>{this[a]=e.moduleInstances.API.methods[i][s]})})}}(function(){try{if(typeof document<"u"){var t=document.createElement("style");t.appendChild(document.createTextNode(".ce-header{padding:.6em 0 3px;margin:0;line-height:1.25em;outline:none}.ce-header p,.ce-header div{padding:0!important;margin:0!important}")),document.head.appendChild(t)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();const mOt='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M6 7L6 12M6 17L6 12M6 12L12 12M12 7V12M12 17L12 12"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M19 17V10.2135C19 10.1287 18.9011 10.0824 18.836 10.1367L16 12.5"/></svg>',yOt='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M6 7L6 12M6 17L6 12M6 12L12 12M12 7V12M12 17L12 12"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M16 11C16 10 19 9.5 19 12C19 13.9771 16.0684 13.9997 16.0012 16.8981C15.9999 16.9533 16.0448 17 16.1 17L19.3 17"/></svg>',vOt='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M6 7L6 12M6 17L6 12M6 12L12 12M12 7V12M12 17L12 12"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M16 11C16 10.5 16.8323 10 17.6 10C18.3677 10 19.5 10.311 19.5 11.5C19.5 12.5315 18.7474 12.9022 18.548 12.9823C18.5378 12.9864 18.5395 13.0047 18.5503 13.0063C18.8115 13.0456 20 13.3065 20 14.8C20 16 19.5 17 17.8 17C17.8 17 16 17 16 16.3"/></svg>',bOt='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M6 7L6 12M6 17L6 12M6 12L12 12M12 7V12M12 17L12 12"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M18 10L15.2834 14.8511C15.246 14.9178 15.294 15 15.3704 15C16.8489 15 18.7561 15 20.2 15M19 17C19 15.7187 19 14.8813 19 13.6"/></svg>',xOt='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M6 7L6 12M6 17L6 12M6 12L12 12M12 7V12M12 17L12 12"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M16 15.9C16 15.9 16.3768 17 17.8 17C19.5 17 20 15.6199 20 14.7C20 12.7323 17.6745 12.0486 16.1635 12.9894C16.094 13.0327 16 12.9846 16 12.9027V10.1C16 10.0448 16.0448 10 16.1 10H19.8"/></svg>',wOt='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M6 7L6 12M6 17L6 12M6 12L12 12M12 7V12M12 17L12 12"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M19.5 10C16.5 10.5 16 13.3285 16 15M16 15V15C16 16.1046 16.8954 17 18 17H18.3246C19.3251 17 20.3191 16.3492 20.2522 15.3509C20.0612 12.4958 16 12.6611 16 15Z"/></svg>',_Ot='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M9 7L9 12M9 17V12M9 12L15 12M15 7V12M15 17L15 12"/></svg>';let SOt=class{constructor({data:e,config:n,api:r,readOnly:i}){this.api=r,this.readOnly=i,this._settings=n,this._data=this.normalizeData(e),this._element=this.getTag()}get _CSS(){return{block:this.api.styles.block,wrapper:"ce-header"}}isHeaderData(e){return e.text!==void 0}normalizeData(e){const n={text:"",level:this.defaultLevel.number};return this.isHeaderData(e)&&(n.text=e.text||"",e.level!==void 0&&!isNaN(parseInt(e.level.toString()))&&(n.level=parseInt(e.level.toString()))),n}render(){return this._element}renderSettings(){return this.levels.map(e=>({icon:e.svg,label:this.api.i18n.t(`Heading ${e.number}`),onActivate:()=>this.setLevel(e.number),closeOnActivate:!0,isActive:this.currentLevel.number===e.number,render:()=>document.createElement("div")}))}setLevel(e){this.data={level:e,text:this.data.text}}merge(e){this._element.insertAdjacentHTML("beforeend",e.text)}validate(e){return e.text.trim()!==""}save(e){return{text:e.innerHTML,level:this.currentLevel.number}}static get conversionConfig(){return{export:"text",import:"text"}}static get sanitize(){return{level:!1,text:{}}}static get isReadOnlySupported(){return!0}get data(){return this._data.text=this._element.innerHTML,this._data.level=this.currentLevel.number,this._data}set data(e){if(this._data=this.normalizeData(e),e.level!==void 0&&this._element.parentNode){const n=this.getTag();n.innerHTML=this._element.innerHTML,this._element.parentNode.replaceChild(n,this._element),this._element=n}e.text!==void 0&&(this._element.innerHTML=this._data.text||"")}getTag(){const e=document.createElement(this.currentLevel.tag);return e.innerHTML=this._data.text||"",e.classList.add(this._CSS.wrapper),e.contentEditable=this.readOnly?"false":"true",e.dataset.placeholder=this.api.i18n.t(this._settings.placeholder||""),e}get currentLevel(){let e=this.levels.find(n=>n.number===this._data.level);return e||(e=this.defaultLevel),e}get defaultLevel(){if(this._settings.defaultLevel){const e=this.levels.find(n=>n.number===this._settings.defaultLevel);if(e)return e;console.warn("(ง'̀-'́)ง Heading Tool: the default level specified was not found in available levels")}return this.levels[1]}get levels(){const e=[{number:1,tag:"H1",svg:mOt},{number:2,tag:"H2",svg:yOt},{number:3,tag:"H3",svg:vOt},{number:4,tag:"H4",svg:bOt},{number:5,tag:"H5",svg:xOt},{number:6,tag:"H6",svg:wOt}];return this._settings.levels?e.filter(n=>this._settings.levels.includes(n.number)):e}onPaste(e){const n=e.detail;if("data"in n){const r=n.data;let i=this.defaultLevel.number;switch(r.tagName){case"H1":i=1;break;case"H2":i=2;break;case"H3":i=3;break;case"H4":i=4;break;case"H5":i=5;break;case"H6":i=6;break}this._settings.levels&&(i=this._settings.levels.reduce((o,s)=>Math.abs(s-i)<Math.abs(o-i)?s:o)),this.data={level:i,text:r.innerHTML}}}static get pasteConfig(){return{tags:["H1","H2","H3","H4","H5","H6"]}}static get toolbox(){return{icon:_Ot,title:"Heading"}}};(function(){try{if(typeof document<"u"){var t=document.createElement("style");t.appendChild(document.createTextNode('.cdx-list{margin:0;padding:0;outline:none;display:grid;counter-reset:item;gap:var(--spacing-s);padding:var(--spacing-xs);--spacing-s: 8px;--spacing-xs: 6px;--list-counter-type: numeric;--radius-border: 5px;--checkbox-background: #fff;--color-border: #C9C9C9;--color-bg-checked: #369FFF;--line-height: 1.45em;--color-bg-checked-hover: #0059AB;--color-tick: #fff;--size-checkbox: 1.2em}.cdx-list__item{line-height:var(--line-height);display:grid;grid-template-columns:auto 1fr;grid-template-rows:auto auto;grid-template-areas:"checkbox content" ". child"}.cdx-list__item-children{display:grid;grid-area:child;gap:var(--spacing-s);padding-top:var(--spacing-s)}.cdx-list__item [contenteditable]{outline:none}.cdx-list__item-content{word-break:break-word;white-space:pre-wrap;grid-area:content;padding-left:var(--spacing-s)}.cdx-list__item:before{counter-increment:item;white-space:nowrap}.cdx-list-ordered .cdx-list__item:before{content:counters(item,".",var(--list-counter-type)) "."}.cdx-list-ordered{counter-reset:item}.cdx-list-unordered .cdx-list__item:before{content:"•"}.cdx-list-checklist .cdx-list__item:before{content:""}.cdx-list__settings .cdx-settings-button{width:50%}.cdx-list__checkbox{padding-top:calc((var(--line-height) - var(--size-checkbox)) / 2);grid-area:checkbox;width:var(--size-checkbox);height:var(--size-checkbox);display:flex;cursor:pointer}.cdx-list__checkbox svg{opacity:0;height:var(--size-checkbox);width:var(--size-checkbox);left:-1px;top:-1px;position:absolute}@media (hover: hover){.cdx-list__checkbox:not(.cdx-list__checkbox--no-hover):hover .cdx-list__checkbox-check svg{opacity:1}}.cdx-list__checkbox--checked{line-height:var(--line-height)}@media (hover: hover){.cdx-list__checkbox--checked:not(.cdx-list__checkbox--checked--no-hover):hover .cdx-checklist__checkbox-check{background:var(--color-bg-checked-hover);border-color:var(--color-bg-checked-hover)}}.cdx-list__checkbox--checked .cdx-list__checkbox-check{background:var(--color-bg-checked);border-color:var(--color-bg-checked)}.cdx-list__checkbox--checked .cdx-list__checkbox-check svg{opacity:1}.cdx-list__checkbox--checked .cdx-list__checkbox-check svg path{stroke:var(--color-tick)}.cdx-list__checkbox--checked .cdx-list__checkbox-check:before{opacity:0;visibility:visible;transform:scale(2.5)}.cdx-list__checkbox-check{cursor:pointer;display:inline-block;position:relative;margin:0 auto;width:var(--size-checkbox);height:var(--size-checkbox);box-sizing:border-box;border-radius:var(--radius-border);border:1px solid var(--color-border);background:var(--checkbox-background)}.cdx-list__checkbox-check:before{content:"";position:absolute;top:0;right:0;bottom:0;left:0;border-radius:100%;background-color:var(--color-bg-checked);visibility:hidden;pointer-events:none;transform:scale(1);transition:transform .4s ease-out,opacity .4s}.cdx-list__checkbox-check--disabled{pointer-events:none}.cdx-list-start-with-field{background:#F8F8F8;border:1px solid rgba(226,226,229,.2);border-radius:6px;padding:2px;display:grid;grid-template-columns:auto auto 1fr;grid-template-rows:auto}.cdx-list-start-with-field--invalid{background:#FFECED;border:1px solid #E13F3F}.cdx-list-start-with-field--invalid .cdx-list-start-with-field__input{color:#e13f3f}.cdx-list-start-with-field__input{font-size:14px;outline:none;font-weight:500;font-family:inherit;border:0;background:transparent;margin:0;padding:0;line-height:22px;min-width:calc(100% - var(--toolbox-buttons-size) - var(--icon-margin-right))}.cdx-list-start-with-field__input::placeholder{color:var(--grayText);font-weight:500}')),document.head.appendChild(t)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();const EOt='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M7 12L10.4884 15.8372C10.5677 15.9245 10.705 15.9245 10.7844 15.8372L17 9"/></svg>',VAe='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M9.2 12L11.0586 13.8586C11.1367 13.9367 11.2633 13.9367 11.3414 13.8586L14.7 10.5"/><rect width="14" height="14" x="5" y="5" stroke="currentColor" stroke-width="2" rx="4"/></svg>',jAe='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><line x1="9" x2="19" y1="7" y2="7" stroke="currentColor" stroke-linecap="round" stroke-width="2"/><line x1="9" x2="19" y1="12" y2="12" stroke="currentColor" stroke-linecap="round" stroke-width="2"/><line x1="9" x2="19" y1="17" y2="17" stroke="currentColor" stroke-linecap="round" stroke-width="2"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M5.00001 17H4.99002"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M5.00001 12H4.99002"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M5.00001 7H4.99002"/></svg>',UAe='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><line x1="12" x2="19" y1="7" y2="7" stroke="currentColor" stroke-linecap="round" stroke-width="2"/><line x1="12" x2="19" y1="12" y2="12" stroke="currentColor" stroke-linecap="round" stroke-width="2"/><line x1="12" x2="19" y1="17" y2="17" stroke="currentColor" stroke-linecap="round" stroke-width="2"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M7.79999 14L7.79999 7.2135C7.79999 7.12872 7.7011 7.0824 7.63597 7.13668L4.79999 9.5"/></svg>',COt='<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M10 14.2L10 7.4135C10 7.32872 9.90111 7.28241 9.83598 7.33668L7 9.7" stroke="black" stroke-width="1.6" stroke-linecap="round"/><path d="M13.2087 14.2H13.2" stroke="black" stroke-width="1.6" stroke-linecap="round"/></svg>',TOt='<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M13.2087 14.2H13.2" stroke="black" stroke-width="1.6" stroke-linecap="round"/><path d="M10 14.2L10 9.5" stroke="black" stroke-width="1.6" stroke-linecap="round"/><path d="M10 7.01L10 7" stroke="black" stroke-width="1.8" stroke-linecap="round"/></svg>',kOt='<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M13.2087 14.2H13.2" stroke="black" stroke-width="1.6" stroke-linecap="round"/><path d="M10 14.2L10 7.2" stroke="black" stroke-width="1.6" stroke-linecap="round"/></svg>',POt='<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M16.0087 14.2H16" stroke="black" stroke-width="1.6" stroke-linecap="round"/><path d="M7 14.2L7.78865 12M13 14.2L12.1377 12M7.78865 12C7.78865 12 9.68362 7 10 7C10.3065 7 12.1377 12 12.1377 12M7.78865 12L12.1377 12" stroke="black" stroke-width="1.6" stroke-linecap="round"/></svg>',AOt='<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M14.2087 14.2H14.2" stroke="black" stroke-width="1.6" stroke-linecap="round"/><path d="M11.5 14.5C11.5 14.5 11 13.281 11 12.5M7 9.5C7 9.5 7.5 8.5 9 8.5C10.5 8.5 11 9.5 11 10.5L11 11.5M11 11.5L11 12.5M11 11.5C11 11.5 7 11 7 13C7 15.3031 11 15 11 12.5" stroke="black" stroke-width="1.6" stroke-linecap="round"/></svg>',IOt='<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M8 14.2L8 7.4135C8 7.32872 7.90111 7.28241 7.83598 7.33668L5 9.7" stroke="black" stroke-width="1.6" stroke-linecap="round"/><path d="M14 13L16.4167 10.7778M16.4167 10.7778L14 8.5M16.4167 10.7778H11.6562" stroke="black" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/></svg>';var oD=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function MOt(t){if(t.__esModule)return t;var e=t.default;if(typeof e=="function"){var n=function r(){return this instanceof r?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};n.prototype=e.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(t).forEach(function(r){var i=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(n,r,i.get?i:{enumerable:!0,get:function(){return t[r]}})}),n}var Li={},iK={},oK={};Object.defineProperty(oK,"__esModule",{value:!0}),oK.allInputsSelector=DOt;function DOt(){var t=["text","password","email","number","search","tel","url"];return"[contenteditable=true], textarea, input:not([type]), "+t.map(function(e){return'input[type="'.concat(e,'"]')}).join(", ")}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.allInputsSelector=void 0;var e=oK;Object.defineProperty(t,"allInputsSelector",{enumerable:!0,get:function(){return e.allInputsSelector}})})(iK);var Ay={},sK={};Object.defineProperty(sK,"__esModule",{value:!0}),sK.isNativeInput=NOt;function NOt(t){var e=["INPUT","TEXTAREA"];return t&&t.tagName?e.includes(t.tagName):!1}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.isNativeInput=void 0;var e=sK;Object.defineProperty(t,"isNativeInput",{enumerable:!0,get:function(){return e.isNativeInput}})})(Ay);var HAe={},aK={};Object.defineProperty(aK,"__esModule",{value:!0}),aK.append=LOt;function LOt(t,e){Array.isArray(e)?e.forEach(function(n){t.appendChild(n)}):t.appendChild(e)}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.append=void 0;var e=aK;Object.defineProperty(t,"append",{enumerable:!0,get:function(){return e.append}})})(HAe);var lK={},cK={};Object.defineProperty(cK,"__esModule",{value:!0}),cK.blockElements=OOt;function OOt(){return["address","article","aside","blockquote","canvas","div","dl","dt","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","li","main","nav","noscript","ol","output","p","pre","ruby","section","table","tbody","thead","tr","tfoot","ul","video"]}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.blockElements=void 0;var e=cK;Object.defineProperty(t,"blockElements",{enumerable:!0,get:function(){return e.blockElements}})})(lK);var GAe={},uK={};Object.defineProperty(uK,"__esModule",{value:!0}),uK.calculateBaseline=$Ot;function $Ot(t){var e=window.getComputedStyle(t),n=parseFloat(e.fontSize),r=parseFloat(e.lineHeight)||n*1.2,i=parseFloat(e.paddingTop),o=parseFloat(e.borderTopWidth),s=parseFloat(e.marginTop),a=n*.8,l=(r-n)/2,c=s+o+i+l+a;return c}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.calculateBaseline=void 0;var e=uK;Object.defineProperty(t,"calculateBaseline",{enumerable:!0,get:function(){return e.calculateBaseline}})})(GAe);var WAe={},dK={},fK={},hK={};Object.defineProperty(hK,"__esModule",{value:!0}),hK.isContentEditable=FOt;function FOt(t){return t.contentEditable==="true"}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.isContentEditable=void 0;var e=hK;Object.defineProperty(t,"isContentEditable",{enumerable:!0,get:function(){return e.isContentEditable}})})(fK),Object.defineProperty(dK,"__esModule",{value:!0}),dK.canSetCaret=ROt;var BOt=Ay,zOt=fK;function ROt(t){var e=!0;if((0,BOt.isNativeInput)(t))switch(t.type){case"file":case"checkbox":case"radio":case"hidden":case"submit":case"button":case"image":case"reset":e=!1;break}else e=(0,zOt.isContentEditable)(t);return e}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.canSetCaret=void 0;var e=dK;Object.defineProperty(t,"canSetCaret",{enumerable:!0,get:function(){return e.canSetCaret}})})(WAe);var sD={},pK={};function VOt(t,e,n){const r=n.value!==void 0?"value":"get",i=n[r],o=`#${e}Cache`;if(n[r]=function(...s){return this[o]===void 0&&(this[o]=i.apply(this,s)),this[o]},r==="get"&&n.set){const s=n.set;n.set=function(a){delete t[o],s.apply(this,a)}}return n}function KAe(){const t={win:!1,mac:!1,x11:!1,linux:!1},e=Object.keys(t).find(n=>window.navigator.appVersion.toLowerCase().indexOf(n)!==-1);return e!==void 0&&(t[e]=!0),t}function gK(t){return t!=null&&t!==""&&(typeof t!="object"||Object.keys(t).length>0)}function jOt(t){return!gK(t)}const UOt=()=>typeof window<"u"&&window.navigator!==null&&gK(window.navigator.platform)&&(/iP(ad|hone|od)/.test(window.navigator.platform)||window.navigator.platform==="MacIntel"&&window.navigator.maxTouchPoints>1);function HOt(t){const e=KAe();return t=t.replace(/shift/gi,"⇧").replace(/backspace/gi,"⌫").replace(/enter/gi,"⏎").replace(/up/gi,"↑").replace(/left/gi,"→").replace(/down/gi,"↓").replace(/right/gi,"←").replace(/escape/gi,"⎋").replace(/insert/gi,"Ins").replace(/delete/gi,"␡").replace(/\+/gi,"+"),e.mac?t=t.replace(/ctrl|cmd/gi,"⌘").replace(/alt/gi,"⌥"):t=t.replace(/cmd/gi,"Ctrl").replace(/windows/gi,"WIN"),t}function GOt(t){return t[0].toUpperCase()+t.slice(1)}function WOt(t){const e=document.createElement("div");e.style.position="absolute",e.style.left="-999px",e.style.bottom="-999px",e.innerHTML=t,document.body.appendChild(e);const n=window.getSelection(),r=document.createRange();if(r.selectNode(e),n===null)throw new Error("Cannot copy text to clipboard");n.removeAllRanges(),n.addRange(r),document.execCommand("copy"),document.body.removeChild(e)}function KOt(t,e,n){let r;return(...i)=>{const o=this,s=()=>{r=void 0,n!==!0&&t.apply(o,i)},a=n===!0&&r!==void 0;window.clearTimeout(r),r=window.setTimeout(s,e),a&&t.apply(o,i)}}function Hg(t){return Object.prototype.toString.call(t).match(/\s([a-zA-Z]+)/)[1].toLowerCase()}function qOt(t){return Hg(t)==="boolean"}function qAe(t){return Hg(t)==="function"||Hg(t)==="asyncfunction"}function YOt(t){return qAe(t)&&/^\s*class\s+/.test(t.toString())}function ZOt(t){return Hg(t)==="number"}function aD(t){return Hg(t)==="object"}function XOt(t){return Promise.resolve(t)===t}function QOt(t){return Hg(t)==="string"}function JOt(t){return Hg(t)==="undefined"}function mK(t,...e){if(!e.length)return t;const n=e.shift();if(aD(t)&&aD(n))for(const r in n)aD(n[r])?(t[r]===void 0&&Object.assign(t,{[r]:{}}),mK(t[r],n[r])):Object.assign(t,{[r]:n[r]});return mK(t,...e)}function e7t(t,e,n){const r=`«${e}» is deprecated and will be removed in the next major release. Please use the «${n}» instead.`;t&&console.warn(r)}function t7t(t){try{return new URL(t).href}catch{}return t.substring(0,2)==="//"?window.location.protocol+t:window.location.origin+t}function n7t(t){return t>47&&t<58||t===32||t===13||t===229||t>64&&t<91||t>95&&t<112||t>185&&t<193||t>218&&t<223}const r7t={BACKSPACE:8,TAB:9,ENTER:13,SHIFT:16,CTRL:17,ALT:18,ESC:27,SPACE:32,LEFT:37,UP:38,DOWN:40,RIGHT:39,DELETE:46,META:91,SLASH:191},i7t={LEFT:0,WHEEL:1,RIGHT:2,BACKWARD:3,FORWARD:4};class o7t{constructor(){this.completed=Promise.resolve()}add(e){return new Promise((n,r)=>{this.completed=this.completed.then(e).then(n).catch(r)})}}function s7t(t,e,n=void 0){let r,i,o,s=null,a=0;n||(n={});const l=function(){a=n.leading===!1?0:Date.now(),s=null,o=t.apply(r,i),s===null&&(r=i=null)};return function(){const c=Date.now();!a&&n.leading===!1&&(a=c);const u=e-(c-a);return r=this,i=arguments,u<=0||u>e?(s&&(clearTimeout(s),s=null),a=c,o=t.apply(r,i),s===null&&(r=i=null)):!s&&n.trailing!==!1&&(s=setTimeout(l,u)),o}}const a7t=Object.freeze(Object.defineProperty({__proto__:null,PromiseQueue:o7t,beautifyShortcut:HOt,cacheable:VOt,capitalize:GOt,copyTextToClipboard:WOt,debounce:KOt,deepMerge:mK,deprecationAssert:e7t,getUserOS:KAe,getValidUrl:t7t,isBoolean:qOt,isClass:YOt,isEmpty:jOt,isFunction:qAe,isIosDevice:UOt,isNumber:ZOt,isObject:aD,isPrintableKey:n7t,isPromise:XOt,isString:QOt,isUndefined:JOt,keyCodes:r7t,mouseButtons:i7t,notEmpty:gK,throttle:s7t,typeOf:Hg},Symbol.toStringTag,{value:"Module"})),yK=MOt(a7t);Object.defineProperty(pK,"__esModule",{value:!0}),pK.containsOnlyInlineElements=u7t;var l7t=yK,c7t=lK;function u7t(t){var e;(0,l7t.isString)(t)?(e=document.createElement("div"),e.innerHTML=t):e=t;var n=function(r){return!(0,c7t.blockElements)().includes(r.tagName.toLowerCase())&&Array.from(r.children).every(n)};return Array.from(e.children).every(n)}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.containsOnlyInlineElements=void 0;var e=pK;Object.defineProperty(t,"containsOnlyInlineElements",{enumerable:!0,get:function(){return e.containsOnlyInlineElements}})})(sD);var YAe={},vK={},lD={},bK={};Object.defineProperty(bK,"__esModule",{value:!0}),bK.make=d7t;function d7t(t,e,n){var r;e===void 0&&(e=null),n===void 0&&(n={});var i=document.createElement(t);if(Array.isArray(e)){var o=e.filter(function(a){return a!==void 0});(r=i.classList).add.apply(r,o)}else e!==null&&i.classList.add(e);for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(i[s]=n[s]);return i}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.make=void 0;var e=bK;Object.defineProperty(t,"make",{enumerable:!0,get:function(){return e.make}})})(lD),Object.defineProperty(vK,"__esModule",{value:!0}),vK.fragmentToString=h7t;var f7t=lD;function h7t(t){var e=(0,f7t.make)("div");return e.appendChild(t),e.innerHTML}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.fragmentToString=void 0;var e=vK;Object.defineProperty(t,"fragmentToString",{enumerable:!0,get:function(){return e.fragmentToString}})})(YAe);var ZAe={},xK={};Object.defineProperty(xK,"__esModule",{value:!0}),xK.getContentLength=g7t;var p7t=Ay;function g7t(t){var e,n;return(0,p7t.isNativeInput)(t)?t.value.length:t.nodeType===Node.TEXT_NODE?t.length:(n=(e=t.textContent)===null||e===void 0?void 0:e.length)!==null&&n!==void 0?n:0}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.getContentLength=void 0;var e=xK;Object.defineProperty(t,"getContentLength",{enumerable:!0,get:function(){return e.getContentLength}})})(ZAe);var wK={},_K={},XAe=oD&&oD.__spreadArray||function(t,e,n){if(n||arguments.length===2)for(var r=0,i=e.length,o;r<i;r++)(o||!(r in e))&&(o||(o=Array.prototype.slice.call(e,0,r)),o[r]=e[r]);return t.concat(o||Array.prototype.slice.call(e))};Object.defineProperty(_K,"__esModule",{value:!0}),_K.getDeepestBlockElements=QAe;var m7t=sD;function QAe(t){return(0,m7t.containsOnlyInlineElements)(t)?[t]:Array.from(t.children).reduce(function(e,n){return XAe(XAe([],e,!0),QAe(n),!0)},[])}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.getDeepestBlockElements=void 0;var e=_K;Object.defineProperty(t,"getDeepestBlockElements",{enumerable:!0,get:function(){return e.getDeepestBlockElements}})})(wK);var JAe={},SK={},cD={},EK={};Object.defineProperty(EK,"__esModule",{value:!0}),EK.isLineBreakTag=y7t;function y7t(t){return["BR","WBR"].includes(t.tagName)}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.isLineBreakTag=void 0;var e=EK;Object.defineProperty(t,"isLineBreakTag",{enumerable:!0,get:function(){return e.isLineBreakTag}})})(cD);var uD={},CK={};Object.defineProperty(CK,"__esModule",{value:!0}),CK.isSingleTag=v7t;function v7t(t){return["AREA","BASE","BR","COL","COMMAND","EMBED","HR","IMG","INPUT","KEYGEN","LINK","META","PARAM","SOURCE","TRACK","WBR"].includes(t.tagName)}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.isSingleTag=void 0;var e=CK;Object.defineProperty(t,"isSingleTag",{enumerable:!0,get:function(){return e.isSingleTag}})})(uD),Object.defineProperty(SK,"__esModule",{value:!0}),SK.getDeepestNode=eIe;var b7t=Ay,x7t=cD,w7t=uD;function eIe(t,e){e===void 0&&(e=!1);var n=e?"lastChild":"firstChild",r=e?"previousSibling":"nextSibling";if(t.nodeType===Node.ELEMENT_NODE&&t[n]){var i=t[n];if((0,w7t.isSingleTag)(i)&&!(0,b7t.isNativeInput)(i)&&!(0,x7t.isLineBreakTag)(i))if(i[r])i=i[r];else if(i.parentNode!==null&&i.parentNode[r])i=i.parentNode[r];else return i.parentNode;return eIe(i,e)}return t}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.getDeepestNode=void 0;var e=SK;Object.defineProperty(t,"getDeepestNode",{enumerable:!0,get:function(){return e.getDeepestNode}})})(JAe);var tIe={},TK={},dD=oD&&oD.__spreadArray||function(t,e,n){if(n||arguments.length===2)for(var r=0,i=e.length,o;r<i;r++)(o||!(r in e))&&(o||(o=Array.prototype.slice.call(e,0,r)),o[r]=e[r]);return t.concat(o||Array.prototype.slice.call(e))};Object.defineProperty(TK,"__esModule",{value:!0}),TK.findAllInputs=T7t;var _7t=sD,S7t=wK,E7t=iK,C7t=Ay;function T7t(t){return Array.from(t.querySelectorAll((0,E7t.allInputsSelector)())).reduce(function(e,n){return(0,C7t.isNativeInput)(n)||(0,_7t.containsOnlyInlineElements)(n)?dD(dD([],e,!0),[n],!1):dD(dD([],e,!0),(0,S7t.getDeepestBlockElements)(n),!0)},[])}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.findAllInputs=void 0;var e=TK;Object.defineProperty(t,"findAllInputs",{enumerable:!0,get:function(){return e.findAllInputs}})})(tIe);var nIe={},kK={};Object.defineProperty(kK,"__esModule",{value:!0}),kK.isCollapsedWhitespaces=k7t;function k7t(t){return!/[^\t\n\r ]/.test(t)}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.isCollapsedWhitespaces=void 0;var e=kK;Object.defineProperty(t,"isCollapsedWhitespaces",{enumerable:!0,get:function(){return e.isCollapsedWhitespaces}})})(nIe);var PK={},AK={};Object.defineProperty(AK,"__esModule",{value:!0}),AK.isElement=A7t;var P7t=yK;function A7t(t){return(0,P7t.isNumber)(t)?!1:!!t&&!!t.nodeType&&t.nodeType===Node.ELEMENT_NODE}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.isElement=void 0;var e=AK;Object.defineProperty(t,"isElement",{enumerable:!0,get:function(){return e.isElement}})})(PK);var rIe={},IK={},MK={},DK={};Object.defineProperty(DK,"__esModule",{value:!0}),DK.isLeaf=I7t;function I7t(t){return t===null?!1:t.childNodes.length===0}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.isLeaf=void 0;var e=DK;Object.defineProperty(t,"isLeaf",{enumerable:!0,get:function(){return e.isLeaf}})})(MK);var NK={},LK={};Object.defineProperty(LK,"__esModule",{value:!0}),LK.isNodeEmpty=O7t;var M7t=cD,D7t=PK,N7t=Ay,L7t=uD;function O7t(t,e){var n="";return(0,L7t.isSingleTag)(t)&&!(0,M7t.isLineBreakTag)(t)?!1:((0,D7t.isElement)(t)&&(0,N7t.isNativeInput)(t)?n=t.value:t.textContent!==null&&(n=t.textContent.replace("​","")),e!==void 0&&(n=n.replace(new RegExp(e,"g"),"")),n.trim().length===0)}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.isNodeEmpty=void 0;var e=LK;Object.defineProperty(t,"isNodeEmpty",{enumerable:!0,get:function(){return e.isNodeEmpty}})})(NK),Object.defineProperty(IK,"__esModule",{value:!0}),IK.isEmpty=B7t;var $7t=MK,F7t=NK;function B7t(t,e){t.normalize();for(var n=[t];n.length>0;){var r=n.shift();if(r){if(t=r,(0,$7t.isLeaf)(t)&&!(0,F7t.isNodeEmpty)(t,e))return!1;n.push.apply(n,Array.from(t.childNodes))}}return!0}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.isEmpty=void 0;var e=IK;Object.defineProperty(t,"isEmpty",{enumerable:!0,get:function(){return e.isEmpty}})})(rIe);var iIe={},OK={};Object.defineProperty(OK,"__esModule",{value:!0}),OK.isFragment=R7t;var z7t=yK;function R7t(t){return(0,z7t.isNumber)(t)?!1:!!t&&!!t.nodeType&&t.nodeType===Node.DOCUMENT_FRAGMENT_NODE}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.isFragment=void 0;var e=OK;Object.defineProperty(t,"isFragment",{enumerable:!0,get:function(){return e.isFragment}})})(iIe);var oIe={},$K={};Object.defineProperty($K,"__esModule",{value:!0}),$K.isHTMLString=j7t;var V7t=lD;function j7t(t){var e=(0,V7t.make)("div");return e.innerHTML=t,e.childElementCount>0}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.isHTMLString=void 0;var e=$K;Object.defineProperty(t,"isHTMLString",{enumerable:!0,get:function(){return e.isHTMLString}})})(oIe);var sIe={},FK={};Object.defineProperty(FK,"__esModule",{value:!0}),FK.offset=U7t;function U7t(t){var e=t.getBoundingClientRect(),n=window.pageXOffset||document.documentElement.scrollLeft,r=window.pageYOffset||document.documentElement.scrollTop,i=e.top+r,o=e.left+n;return{top:i,left:o,bottom:i+e.height,right:o+e.width}}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.offset=void 0;var e=FK;Object.defineProperty(t,"offset",{enumerable:!0,get:function(){return e.offset}})})(sIe);var aIe={},BK={};Object.defineProperty(BK,"__esModule",{value:!0}),BK.prepend=H7t;function H7t(t,e){Array.isArray(e)?(e=e.reverse(),e.forEach(function(n){return t.prepend(n)})):t.prepend(e)}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.prepend=void 0;var e=BK;Object.defineProperty(t,"prepend",{enumerable:!0,get:function(){return e.prepend}})})(aIe),(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.prepend=t.offset=t.make=t.isLineBreakTag=t.isSingleTag=t.isNodeEmpty=t.isLeaf=t.isHTMLString=t.isFragment=t.isEmpty=t.isElement=t.isContentEditable=t.isCollapsedWhitespaces=t.findAllInputs=t.isNativeInput=t.allInputsSelector=t.getDeepestNode=t.getDeepestBlockElements=t.getContentLength=t.fragmentToString=t.containsOnlyInlineElements=t.canSetCaret=t.calculateBaseline=t.blockElements=t.append=void 0;var e=iK;Object.defineProperty(t,"allInputsSelector",{enumerable:!0,get:function(){return e.allInputsSelector}});var n=Ay;Object.defineProperty(t,"isNativeInput",{enumerable:!0,get:function(){return n.isNativeInput}});var r=HAe;Object.defineProperty(t,"append",{enumerable:!0,get:function(){return r.append}});var i=lK;Object.defineProperty(t,"blockElements",{enumerable:!0,get:function(){return i.blockElements}});var o=GAe;Object.defineProperty(t,"calculateBaseline",{enumerable:!0,get:function(){return o.calculateBaseline}});var s=WAe;Object.defineProperty(t,"canSetCaret",{enumerable:!0,get:function(){return s.canSetCaret}});var a=sD;Object.defineProperty(t,"containsOnlyInlineElements",{enumerable:!0,get:function(){return a.containsOnlyInlineElements}});var l=YAe;Object.defineProperty(t,"fragmentToString",{enumerable:!0,get:function(){return l.fragmentToString}});var c=ZAe;Object.defineProperty(t,"getContentLength",{enumerable:!0,get:function(){return c.getContentLength}});var u=wK;Object.defineProperty(t,"getDeepestBlockElements",{enumerable:!0,get:function(){return u.getDeepestBlockElements}});var d=JAe;Object.defineProperty(t,"getDeepestNode",{enumerable:!0,get:function(){return d.getDeepestNode}});var p=tIe;Object.defineProperty(t,"findAllInputs",{enumerable:!0,get:function(){return p.findAllInputs}});var g=nIe;Object.defineProperty(t,"isCollapsedWhitespaces",{enumerable:!0,get:function(){return g.isCollapsedWhitespaces}});var b=fK;Object.defineProperty(t,"isContentEditable",{enumerable:!0,get:function(){return b.isContentEditable}});var w=PK;Object.defineProperty(t,"isElement",{enumerable:!0,get:function(){return w.isElement}});var _=rIe;Object.defineProperty(t,"isEmpty",{enumerable:!0,get:function(){return _.isEmpty}});var E=iIe;Object.defineProperty(t,"isFragment",{enumerable:!0,get:function(){return E.isFragment}});var A=oIe;Object.defineProperty(t,"isHTMLString",{enumerable:!0,get:function(){return A.isHTMLString}});var k=MK;Object.defineProperty(t,"isLeaf",{enumerable:!0,get:function(){return k.isLeaf}});var M=NK;Object.defineProperty(t,"isNodeEmpty",{enumerable:!0,get:function(){return M.isNodeEmpty}});var L=cD;Object.defineProperty(t,"isLineBreakTag",{enumerable:!0,get:function(){return L.isLineBreakTag}});var F=uD;Object.defineProperty(t,"isSingleTag",{enumerable:!0,get:function(){return F.isSingleTag}});var R=lD;Object.defineProperty(t,"make",{enumerable:!0,get:function(){return R.make}});var B=sIe;Object.defineProperty(t,"offset",{enumerable:!0,get:function(){return B.offset}});var V=aIe;Object.defineProperty(t,"prepend",{enumerable:!0,get:function(){return V.prepend}})})(Li);const Ka="cdx-list",ka={wrapper:Ka,item:`${Ka}__item`,itemContent:`${Ka}__item-content`,itemChildren:`${Ka}__item-children`};class qd{static get CSS(){return{...ka,orderedList:`${Ka}-ordered`}}constructor(e,n){this.config=n,this.readOnly=e}renderWrapper(e){let n;return e===!0?n=Li.make("ol",[qd.CSS.wrapper,qd.CSS.orderedList]):n=Li.make("ol",[qd.CSS.orderedList,qd.CSS.itemChildren]),n}renderItem(e,n){const r=Li.make("li",qd.CSS.item),i=Li.make("div",qd.CSS.itemContent,{innerHTML:e,contentEditable:(!this.readOnly).toString()});return r.appendChild(i),r}getItemContent(e){const n=e.querySelector(`.${qd.CSS.itemContent}`);return!n||Li.isEmpty(n)?"":n.innerHTML}getItemMeta(){return{}}composeDefaultMeta(){return{}}}class Yd{static get CSS(){return{...ka,unorderedList:`${Ka}-unordered`}}constructor(e,n){this.config=n,this.readOnly=e}renderWrapper(e){let n;return e===!0?n=Li.make("ul",[Yd.CSS.wrapper,Yd.CSS.unorderedList]):n=Li.make("ul",[Yd.CSS.unorderedList,Yd.CSS.itemChildren]),n}renderItem(e,n){const r=Li.make("li",Yd.CSS.item),i=Li.make("div",Yd.CSS.itemContent,{innerHTML:e,contentEditable:(!this.readOnly).toString()});return r.appendChild(i),r}getItemContent(e){const n=e.querySelector(`.${Yd.CSS.itemContent}`);return!n||Li.isEmpty(n)?"":n.innerHTML}getItemMeta(){return{}}composeDefaultMeta(){return{}}}function Iy(t){return t.nodeType===Node.ELEMENT_NODE}var RE={},zK={},fD={},hD={};Object.defineProperty(hD,"__esModule",{value:!0}),hD.getContenteditableSlice=W7t;var G7t=Li;function W7t(t,e,n,r,i){var o;i===void 0&&(i=!1);var s=document.createRange();if(r==="left"?(s.setStart(t,0),s.setEnd(e,n)):(s.setStart(e,n),s.setEnd(t,t.childNodes.length)),i===!0){var a=s.extractContents();return(0,G7t.fragmentToString)(a)}var l=s.cloneContents(),c=document.createElement("div");c.appendChild(l);var u=(o=c.textContent)!==null&&o!==void 0?o:"";return u}Object.defineProperty(fD,"__esModule",{value:!0}),fD.checkContenteditableSliceForEmptiness=Y7t;var K7t=Li,q7t=hD;function Y7t(t,e,n,r){var i=(0,q7t.getContenteditableSlice)(t,e,n,r);return(0,K7t.isCollapsedWhitespaces)(i)}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.checkContenteditableSliceForEmptiness=void 0;var e=fD;Object.defineProperty(t,"checkContenteditableSliceForEmptiness",{enumerable:!0,get:function(){return e.checkContenteditableSliceForEmptiness}})})(zK);var lIe={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.getContenteditableSlice=void 0;var e=hD;Object.defineProperty(t,"getContenteditableSlice",{enumerable:!0,get:function(){return e.getContenteditableSlice}})})(lIe);var cIe={},RK={};Object.defineProperty(RK,"__esModule",{value:!0}),RK.focus=X7t;var Z7t=Li;function X7t(t,e){var n,r;if(e===void 0&&(e=!0),(0,Z7t.isNativeInput)(t)){t.focus();var i=e?0:t.value.length;t.setSelectionRange(i,i)}else{var o=document.createRange(),s=window.getSelection();if(!s)return;var a=function(p,g){g===void 0&&(g=!1);var b=document.createTextNode("");g?p.insertBefore(b,p.firstChild):p.appendChild(b),o.setStart(b,0),o.setEnd(b,0)},l=function(p){return p!=null},c=t.childNodes,u=e?c[0]:c[c.length-1];if(l(u)){for(;l(u)&&u.nodeType!==Node.TEXT_NODE;)u=e?u.firstChild:u.lastChild;if(l(u)&&u.nodeType===Node.TEXT_NODE){var d=(r=(n=u.textContent)===null||n===void 0?void 0:n.length)!==null&&r!==void 0?r:0,i=e?0:d;o.setStart(u,i),o.setEnd(u,i)}else a(t,e)}else a(t);s.removeAllRanges(),s.addRange(o)}}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.focus=void 0;var e=RK;Object.defineProperty(t,"focus",{enumerable:!0,get:function(){return e.focus}})})(cIe);var VK={},pD={};Object.defineProperty(pD,"__esModule",{value:!0}),pD.getCaretNodeAndOffset=Q7t;function Q7t(){var t=window.getSelection();if(t===null)return[null,0];var e=t.focusNode,n=t.focusOffset;return e===null?[null,0]:(e.nodeType!==Node.TEXT_NODE&&e.childNodes.length>0&&(e.childNodes[n]!==void 0?(e=e.childNodes[n],n=0):(e=e.childNodes[n-1],e.textContent!==null&&(n=e.textContent.length))),[e,n])}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.getCaretNodeAndOffset=void 0;var e=pD;Object.defineProperty(t,"getCaretNodeAndOffset",{enumerable:!0,get:function(){return e.getCaretNodeAndOffset}})})(VK);var uIe={},gD={};Object.defineProperty(gD,"__esModule",{value:!0}),gD.getRange=J7t;function J7t(){var t=window.getSelection();return t&&t.rangeCount?t.getRangeAt(0):null}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.getRange=void 0;var e=gD;Object.defineProperty(t,"getRange",{enumerable:!0,get:function(){return e.getRange}})})(uIe);var dIe={},jK={};Object.defineProperty(jK,"__esModule",{value:!0}),jK.isCaretAtEndOfInput=n$t;var fIe=Li,e$t=VK,t$t=zK;function n$t(t){var e=(0,fIe.getDeepestNode)(t,!0);if(e===null)return!0;if((0,fIe.isNativeInput)(e))return e.selectionEnd===e.value.length;var n=(0,e$t.getCaretNodeAndOffset)(),r=n[0],i=n[1];return r===null?!1:(0,t$t.checkContenteditableSliceForEmptiness)(t,r,i,"right")}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.isCaretAtEndOfInput=void 0;var e=jK;Object.defineProperty(t,"isCaretAtEndOfInput",{enumerable:!0,get:function(){return e.isCaretAtEndOfInput}})})(dIe);var hIe={},UK={};Object.defineProperty(UK,"__esModule",{value:!0}),UK.isCaretAtStartOfInput=o$t;var mD=Li,r$t=pD,i$t=fD;function o$t(t){var e=(0,mD.getDeepestNode)(t);if(e===null||(0,mD.isEmpty)(t))return!0;if((0,mD.isNativeInput)(e))return e.selectionEnd===0;if((0,mD.isEmpty)(t))return!0;var n=(0,r$t.getCaretNodeAndOffset)(),r=n[0],i=n[1];return r===null?!1:(0,i$t.checkContenteditableSliceForEmptiness)(t,r,i,"left")}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.isCaretAtStartOfInput=void 0;var e=UK;Object.defineProperty(t,"isCaretAtStartOfInput",{enumerable:!0,get:function(){return e.isCaretAtStartOfInput}})})(hIe);var pIe={},HK={};Object.defineProperty(HK,"__esModule",{value:!0}),HK.save=l$t;var s$t=Li,a$t=gD;function l$t(){var t=(0,a$t.getRange)(),e=(0,s$t.make)("span");if(e.id="cursor",e.hidden=!0,!!t)return t.insertNode(e),function(){var n=window.getSelection();n&&(t.setStartAfter(e),t.setEndAfter(e),n.removeAllRanges(),n.addRange(t),setTimeout(function(){e.remove()},150))}}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.save=void 0;var e=HK;Object.defineProperty(t,"save",{enumerable:!0,get:function(){return e.save}})})(pIe),(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.save=t.isCaretAtStartOfInput=t.isCaretAtEndOfInput=t.getRange=t.getCaretNodeAndOffset=t.focus=t.getContenteditableSlice=t.checkContenteditableSliceForEmptiness=void 0;var e=zK;Object.defineProperty(t,"checkContenteditableSliceForEmptiness",{enumerable:!0,get:function(){return e.checkContenteditableSliceForEmptiness}});var n=lIe;Object.defineProperty(t,"getContenteditableSlice",{enumerable:!0,get:function(){return n.getContenteditableSlice}});var r=cIe;Object.defineProperty(t,"focus",{enumerable:!0,get:function(){return r.focus}});var i=VK;Object.defineProperty(t,"getCaretNodeAndOffset",{enumerable:!0,get:function(){return i.getCaretNodeAndOffset}});var o=uIe;Object.defineProperty(t,"getRange",{enumerable:!0,get:function(){return o.getRange}});var s=dIe;Object.defineProperty(t,"isCaretAtEndOfInput",{enumerable:!0,get:function(){return s.isCaretAtEndOfInput}});var a=hIe;Object.defineProperty(t,"isCaretAtStartOfInput",{enumerable:!0,get:function(){return a.isCaretAtStartOfInput}});var l=pIe;Object.defineProperty(t,"save",{enumerable:!0,get:function(){return l.save}})})(RE);class Jo{static get CSS(){return{...ka,checklist:`${Ka}-checklist`,itemChecked:`${Ka}__checkbox--checked`,noHover:`${Ka}__checkbox--no-hover`,checkbox:`${Ka}__checkbox-check`,checkboxContainer:`${Ka}__checkbox`,checkboxCheckDisabled:`${Ka}__checkbox-check--disabled`}}constructor(e,n){this.config=n,this.readOnly=e}renderWrapper(e){let n;return e===!0?(n=Li.make("ul",[Jo.CSS.wrapper,Jo.CSS.checklist]),n.addEventListener("click",r=>{const i=r.target;if(i){const o=i.closest(`.${Jo.CSS.checkboxContainer}`);o&&o.contains(i)&&this.toggleCheckbox(o)}})):n=Li.make("ul",[Jo.CSS.checklist,Jo.CSS.itemChildren]),n}renderItem(e,n){const r=Li.make("li",[Jo.CSS.item,Jo.CSS.item]),i=Li.make("div",Jo.CSS.itemContent,{innerHTML:e,contentEditable:(!this.readOnly).toString()}),o=Li.make("span",Jo.CSS.checkbox),s=Li.make("div",Jo.CSS.checkboxContainer);return n.checked===!0&&s.classList.add(Jo.CSS.itemChecked),this.readOnly&&s.classList.add(Jo.CSS.checkboxCheckDisabled),o.innerHTML=EOt,s.appendChild(o),r.appendChild(s),r.appendChild(i),r}getItemContent(e){const n=e.querySelector(`.${Jo.CSS.itemContent}`);return!n||Li.isEmpty(n)?"":n.innerHTML}getItemMeta(e){const n=e.querySelector(`.${Jo.CSS.checkboxContainer}`);return{checked:n?n.classList.contains(Jo.CSS.itemChecked):!1}}composeDefaultMeta(){return{checked:!1}}toggleCheckbox(e){e.classList.toggle(Jo.CSS.itemChecked),e.classList.add(Jo.CSS.noHover),e.addEventListener("mouseleave",()=>this.removeSpecialHoverBehavior(e),{once:!0})}removeSpecialHoverBehavior(e){e.classList.remove(Jo.CSS.noHover)}}function GK(t,e="after"){const n=[];let r;function i(o){switch(e){case"after":return o.nextElementSibling;case"before":return o.previousElementSibling}}for(r=i(t);r!==null;)n.push(r),r=i(r);return n.length!==0?n:null}function Oh(t,e=!0){let n=t;return t.classList.contains(ka.item)&&(n=t.querySelector(`.${ka.itemChildren}`)),n===null?[]:Array.from(e?n.querySelectorAll(`:scope > .${ka.item}`):n.querySelectorAll(`.${ka.item}`))}function c$t(t){return t.nextElementSibling===null}function u$t(t){return t.querySelector(`.${ka.itemChildren}`)!==null}function Gg(t){return t.querySelector(`.${ka.itemChildren}`)}function WK(t){let e=t;t.classList.contains(ka.item)&&(e=Gg(t)),e!==null&&Oh(e).length===0&&e.remove()}function yD(t){return t.querySelector(`.${ka.itemContent}`)}function sx(t,e=!0){const n=yD(t);n&&RE.focus(n,e)}class KK{get currentItem(){const e=window.getSelection();if(!e)return null;let n=e.anchorNode;return!n||(Iy(n)||(n=n.parentNode),!n)||!Iy(n)?null:n.closest(`.${ka.item}`)}get currentItemLevel(){const e=this.currentItem;if(e===null)return null;let n=e.parentNode,r=0;for(;n!==null&&n!==this.listWrapper;)Iy(n)&&n.classList.contains(ka.item)&&(r+=1),n=n.parentNode;return r+1}constructor({data:e,config:n,api:r,readOnly:i,block:o},s){this.config=n,this.data=e,this.readOnly=i,this.api=r,this.block=o,this.renderer=s}render(){return this.listWrapper=this.renderer.renderWrapper(!0),this.data.items.length?this.appendItems(this.data.items,this.listWrapper):this.appendItems([{content:"",meta:{},items:[]}],this.listWrapper),this.readOnly||this.listWrapper.addEventListener("keydown",e=>{switch(e.key){case"Enter":e.shiftKey||this.enterPressed(e);break;case"Backspace":this.backspace(e);break;case"Tab":e.shiftKey?this.shiftTab(e):this.addTab(e);break}},!1),"start"in this.data.meta&&this.data.meta.start!==void 0&&this.changeStartWith(this.data.meta.start),"counterType"in this.data.meta&&this.data.meta.counterType!==void 0&&this.changeCounters(this.data.meta.counterType),this.listWrapper}save(e){const n=e??this.listWrapper,r=s=>Oh(s).map(a=>{const l=Gg(a),c=this.renderer.getItemContent(a),u=this.renderer.getItemMeta(a),d=l?r(l):[];return{content:c,meta:u,items:d}}),i=n?r(n):[];let o={style:this.data.style,meta:{},items:i};return this.data.style==="ordered"&&(o.meta={start:this.data.meta.start,counterType:this.data.meta.counterType}),o}static get pasteConfig(){return{tags:["OL","UL","LI"]}}merge(e){const n=this.block.holder.querySelectorAll(`.${ka.item}`),r=n[n.length-1],i=yD(r);if(r===null||i===null||(i.insertAdjacentHTML("beforeend",e.items[0].content),this.listWrapper===void 0))return;const o=Oh(this.listWrapper);if(o.length===0)return;const s=o[o.length-1];let a=Gg(s);const l=e.items.shift();l!==void 0&&(l.items.length!==0&&(a===null&&(a=this.renderer.renderWrapper(!1)),this.appendItems(l.items,a)),e.items.length>0&&this.appendItems(e.items,this.listWrapper))}onPaste(e){const n=e.detail.data;this.data=this.pasteHandler(n);const r=this.listWrapper;r&&r.parentNode&&r.parentNode.replaceChild(this.render(),r)}pasteHandler(e){const{tagName:n}=e;let r="unordered",i;switch(n){case"OL":r="ordered",i="ol";break;case"UL":case"LI":r="unordered",i="ul"}const o={style:r,meta:{},items:[]};r==="ordered"&&(this.data.meta.counterType="numeric",this.data.meta.start=1);const s=a=>Array.from(a.querySelectorAll(":scope > li")).map(l=>{const c=l.querySelector(`:scope > ${i}`),u=c?s(c):[];return{content:l.innerHTML??"",meta:{},items:u}});return o.items=s(e),o}changeStartWith(e){this.listWrapper.style.setProperty("counter-reset",`item ${e-1}`),this.data.meta.start=e}changeCounters(e){this.listWrapper.style.setProperty("--list-counter-type",e),this.data.meta.counterType=e}enterPressed(e){var n;const r=this.currentItem;if(e.stopPropagation(),e.preventDefault(),e.isComposing||r===null)return;const i=((n=this.renderer)==null?void 0:n.getItemContent(r).trim().length)===0,o=r.parentNode===this.listWrapper,s=r.previousElementSibling===null,a=this.api.blocks.getCurrentBlockIndex();if(o&&i)if(c$t(r)&&!u$t(r)){s?this.convertItemToDefaultBlock(a,!0):this.convertItemToDefaultBlock();return}else{this.splitList(r);return}else if(i){this.unshiftItem(r);return}else this.splitItem(r)}backspace(e){var n;const r=this.currentItem;if(r!==null&&RE.isCaretAtStartOfInput(r)&&((n=window.getSelection())==null?void 0:n.isCollapsed)!==!1){if(e.stopPropagation(),r.parentNode===this.listWrapper&&r.previousElementSibling===null){this.convertFirstItemToDefaultBlock();return}e.preventDefault(),this.mergeItemWithPrevious(r)}}shiftTab(e){e.stopPropagation(),e.preventDefault(),this.currentItem!==null&&this.unshiftItem(this.currentItem)}unshiftItem(e){if(!e.parentNode||!Iy(e.parentNode))return;const n=e.parentNode.closest(`.${ka.item}`);if(!n)return;let r=Gg(e);if(e.parentElement===null)return;const i=GK(e);i!==null&&(r===null&&(r=this.renderer.renderWrapper(!1)),i.forEach(o=>{r.appendChild(o)}),e.appendChild(r)),n.after(e),sx(e,!1),WK(n)}splitList(e){const n=Oh(e),r=this.block,i=this.api.blocks.getCurrentBlockIndex();if(n.length!==0){const l=n[0];this.unshiftItem(l),sx(e,!1)}if(e.previousElementSibling===null&&e.parentNode===this.listWrapper){this.convertItemToDefaultBlock(i);return}const o=GK(e);if(o===null)return;const s=this.renderer.renderWrapper(!0);o.forEach(l=>{s.appendChild(l)});const a=this.save(s);a.meta.start=this.data.style=="ordered"?1:void 0,this.api.blocks.insert(r?.name,a,this.config,i+1),this.convertItemToDefaultBlock(i+1),s.remove()}splitItem(e){const[n,r]=RE.getCaretNodeAndOffset();if(n===null)return;const i=yD(e);let o;i===null?o="":o=RE.getContenteditableSlice(i,n,r,"right",!0);const s=Gg(e),a=this.renderItem(o);e?.after(a),s&&a.appendChild(s),sx(a)}mergeItemWithPrevious(e){const n=e.previousElementSibling,r=e.parentNode;if(r===null||!Iy(r))return;const i=r.closest(`.${ka.item}`);if(!n&&!i||n&&!Iy(n))return;let o;if(n){const d=Oh(n,!1);d.length!==0&&d.length!==0?o=d[d.length-1]:o=n}else o=i;const s=this.renderer.getItemContent(e);if(!o)return;sx(o,!1);const a=yD(o);if(a===null)return;a.insertAdjacentHTML("beforeend",s);const l=Oh(e);if(l.length===0){e.remove(),WK(o);return}const c=n||i,u=Gg(c)??this.renderer.renderWrapper(!1);n?l.forEach(d=>{u.appendChild(d)}):l.forEach(d=>{u.prepend(d)}),Gg(c)===null&&o.appendChild(u),e.remove()}addTab(e){var n;e.stopPropagation(),e.preventDefault();const r=this.currentItem;if(!r)return;if(((n=this.config)==null?void 0:n.maxLevel)!==void 0){const s=this.currentItemLevel;if(s!==null&&s===this.config.maxLevel)return}const i=r.previousSibling;if(i===null||!Iy(i))return;const o=Gg(i);if(o)o.appendChild(r),Oh(r).forEach(s=>{o.appendChild(s)});else{const s=this.renderer.renderWrapper(!1);s.appendChild(r),Oh(r).forEach(a=>{s.appendChild(a)}),i.appendChild(s)}WK(r),sx(r,!1)}convertItemToDefaultBlock(e,n){let r;const i=this.currentItem,o=i!==null?this.renderer.getItemContent(i):"";n===!0&&this.api.blocks.delete(),e!==void 0?r=this.api.blocks.insert(void 0,{text:o},void 0,e):r=this.api.blocks.insert(),i?.remove(),this.api.caret.setToBlock(r,"start")}convertFirstItemToDefaultBlock(){const e=this.currentItem;if(e===null)return;const n=Oh(e);if(n.length!==0){const s=n[0];this.unshiftItem(s),sx(e)}const r=GK(e),i=this.api.blocks.getCurrentBlockIndex(),o=r===null;this.convertItemToDefaultBlock(i,o)}renderItem(e,n){const r=n??this.renderer.composeDefaultMeta();switch(!0){case this.renderer instanceof qd:return this.renderer.renderItem(e,r);case this.renderer instanceof Yd:return this.renderer.renderItem(e,r);default:return this.renderer.renderItem(e,r)}}appendItems(e,n){e.forEach(r=>{var i;const o=this.renderItem(r.content,r.meta);if(n.appendChild(o),r.items.length){const s=(i=this.renderer)==null?void 0:i.renderWrapper(!1);this.appendItems(r.items,s),o.appendChild(s)}})}}const ax={wrapper:`${Ka}-start-with-field`,input:`${Ka}-start-with-field__input`,startWithElementWrapperInvalid:`${Ka}-start-with-field--invalid`};function d$t(t,{value:e,placeholder:n,attributes:r,sanitize:i}){const o=Li.make("div",ax.wrapper),s=Li.make("input",ax.input,{placeholder:n,tabIndex:-1,value:e});for(const a in r)s.setAttribute(a,r[a]);return o.appendChild(s),s.addEventListener("input",()=>{i!==void 0&&(s.value=i(s.value));const a=s.checkValidity();!a&&!o.classList.contains(ax.startWithElementWrapperInvalid)&&o.classList.add(ax.startWithElementWrapperInvalid),a&&o.classList.contains(ax.startWithElementWrapperInvalid)&&o.classList.remove(ax.startWithElementWrapperInvalid),a&&t(s.value)}),o}const VE=new Map([["Numeric","numeric"],["Lower Roman","lower-roman"],["Upper Roman","upper-roman"],["Lower Alpha","lower-alpha"],["Upper Alpha","upper-alpha"]]),gIe=new Map([["numeric",COt],["lower-roman",TOt],["upper-roman",kOt],["lower-alpha",AOt],["upper-alpha",POt]]);function f$t(t){return t.replace(/\D+/g,"")}function h$t(t){return typeof t.items[0]=="string"}function p$t(t){return!("meta"in t)}function g$t(t){return typeof t.items[0]!="string"&&"text"in t.items[0]&&"checked"in t.items[0]&&typeof t.items[0].text=="string"&&typeof t.items[0].checked=="boolean"}function m$t(t){const e=[];return h$t(t)?(t.items.forEach(n=>{e.push({content:n,meta:{},items:[]})}),{style:t.style,meta:{},items:e}):g$t(t)?(t.items.forEach(n=>{e.push({content:n.text,meta:{checked:n.checked},items:[]})}),{style:"checklist",meta:{},items:e}):p$t(t)?{style:t.style,meta:{},items:t.items}:structuredClone(t)}class vD{static get isReadOnlySupported(){return!0}static get enableLineBreaks(){return!0}static get toolbox(){return[{icon:jAe,title:"Unordered List",data:{style:"unordered"}},{icon:UAe,title:"Ordered List",data:{style:"ordered"}},{icon:VAe,title:"Checklist",data:{style:"checklist"}}]}static get pasteConfig(){return{tags:["OL","UL","LI"]}}static get conversionConfig(){return{export:e=>vD.joinRecursive(e),import:(e,n)=>({meta:{},items:[{content:e,meta:{},items:[]}],style:n?.defaultStyle!==void 0?n.defaultStyle:"unordered"})}}get listStyle(){return this.data.style||this.defaultListStyle}set listStyle(e){var n;this.data.style=e,this.changeTabulatorByStyle();const r=this.list.render();(n=this.listElement)==null||n.replaceWith(r),this.listElement=r}constructor({data:e,config:n,api:r,readOnly:i,block:o}){var s;this.api=r,this.readOnly=i,this.config=n,this.block=o,this.defaultListStyle=((s=this.config)==null?void 0:s.defaultStyle)||"unordered",this.defaultCounterTypes=this.config.counterTypes||Array.from(VE.values());const a={style:this.defaultListStyle,meta:{},items:[]};this.data=Object.keys(e).length?m$t(e):a,this.listStyle==="ordered"&&this.data.meta.counterType===void 0&&(this.data.meta.counterType="numeric"),this.changeTabulatorByStyle()}static joinRecursive(e){return e.items.map(n=>`${n.content} ${vD.joinRecursive(n)}`).join("")}render(){return this.listElement=this.list.render(),this.listElement}save(){return this.data=this.list.save(),this.data}merge(e){this.list.merge(e)}renderSettings(){const e=[{label:this.api.i18n.t("Unordered"),icon:jAe,closeOnActivate:!0,isActive:this.listStyle=="unordered",onActivate:()=>{this.listStyle="unordered"}},{label:this.api.i18n.t("Ordered"),icon:UAe,closeOnActivate:!0,isActive:this.listStyle=="ordered",onActivate:()=>{this.listStyle="ordered"}},{label:this.api.i18n.t("Checklist"),icon:VAe,closeOnActivate:!0,isActive:this.listStyle=="checklist",onActivate:()=>{this.listStyle="checklist"}}];if(this.listStyle==="ordered"){const n=d$t(o=>this.changeStartWith(Number(o)),{value:String(this.data.meta.start??1),placeholder:"",attributes:{required:"true"},sanitize:o=>f$t(o)}),r=[{label:this.api.i18n.t("Start with"),icon:IOt,children:{items:[{element:n,type:"html"}]}}],i={label:this.api.i18n.t("Counter type"),icon:gIe.get(this.data.meta.counterType),children:{items:[]}};VE.forEach((o,s)=>{const a=VE.get(s);this.defaultCounterTypes.includes(a)&&i.children.items.push({title:this.api.i18n.t(s),icon:gIe.get(a),isActive:this.data.meta.counterType===VE.get(s),closeOnActivate:!0,onActivate:()=>{this.changeCounters(VE.get(s))}})}),i.children.items.length>1&&r.push(i),e.push({type:"separator"},...r)}return e}onPaste(e){const{tagName:n}=e.detail.data;switch(n){case"OL":this.listStyle="ordered";break;case"UL":case"LI":this.listStyle="unordered"}this.list.onPaste(e)}pasteHandler(e){return this.list.pasteHandler(e)}changeCounters(e){var n;(n=this.list)==null||n.changeCounters(e),this.data.meta.counterType=e}changeStartWith(e){var n;(n=this.list)==null||n.changeStartWith(e),this.data.meta.start=e}changeTabulatorByStyle(){switch(this.listStyle){case"ordered":this.list=new KK({data:this.data,readOnly:this.readOnly,api:this.api,config:this.config,block:this.block},new qd(this.readOnly,this.config));break;case"unordered":this.list=new KK({data:this.data,readOnly:this.readOnly,api:this.api,config:this.config,block:this.block},new Yd(this.readOnly,this.config));break;case"checklist":this.list=new KK({data:this.data,readOnly:this.readOnly,api:this.api,config:this.config,block:this.block},new Jo(this.readOnly,this.config));break}}}const mIe=({data:t,onChange:e,placeholder:n,readOnly:r=!1,className:i,minHeight:o=300})=>{const s=P.useRef(`editorjs-${Math.random().toString(36).slice(2,9)}`),a=P.useRef(null);return P.useEffect(()=>{if(!a.current){const l=new gOt({holder:s.current,data:t,readOnly:r,placeholder:n||"Start writing...",minHeight:o,tools:{header:{class:SOt,inlineToolbar:!0,config:{placeholder:"Heading",levels:[1,2,3],defaultLevel:2}},list:{class:vD,inlineToolbar:!0,config:{defaultStyle:"unordered"}}},onChange:async(c,u)=>{const d=await c.saver.save();e?.(d)}});a.current=l}return()=>{if(a.current&&typeof a.current.destroy=="function"){try{a.current.destroy()}catch{}a.current=null}}},[]),P.useEffect(()=>{a.current&&typeof a.current.readOnly<"u"&&a.current.readOnly.toggle(r)},[r]),v.jsx("div",{className:he("w-full relative",i),children:v.jsx("div",{id:s.current,className:"chesai-editor w-full",style:{minHeight:o}})})};mIe.displayName="MediumTextEditor";var My="NavigationMenu",[qK,yIe,y$t]=Gm(My),[YK,v$t,b$t]=Gm(My),[ZK,don]=pa(My,[y$t,b$t]),[x$t,Qc]=ZK(My),[w$t,_$t]=ZK(My),vIe=U.forwardRef((t,e)=>{const{__scopeNavigationMenu:n,value:r,onValueChange:i,defaultValue:o,delayDuration:s=200,skipDelayDuration:a=300,orientation:l="horizontal",dir:c,...u}=t,[d,p]=U.useState(null),g=Qn(e,V=>p(V)),b=If(c),w=U.useRef(0),_=U.useRef(0),E=U.useRef(0),[A,k]=U.useState(!0),[M,L]=qs({prop:r,onChange:V=>{const H=V!=="",W=a>0;H?(window.clearTimeout(E.current),W&&k(!1)):(window.clearTimeout(E.current),E.current=window.setTimeout(()=>k(!0),a)),i?.(V)},defaultProp:o??"",caller:My}),F=U.useCallback(()=>{window.clearTimeout(_.current),_.current=window.setTimeout(()=>L(""),150)},[L]),R=U.useCallback(V=>{window.clearTimeout(_.current),L(V)},[L]),B=U.useCallback(V=>{M===V?window.clearTimeout(_.current):w.current=window.setTimeout(()=>{window.clearTimeout(_.current),L(V)},s)},[M,L,s]);return U.useEffect(()=>()=>{window.clearTimeout(w.current),window.clearTimeout(_.current),window.clearTimeout(E.current)},[]),v.jsx(bIe,{scope:n,isRootMenu:!0,value:M,dir:b,orientation:l,rootNavigationMenu:d,onTriggerEnter:V=>{window.clearTimeout(w.current),A?B(V):R(V)},onTriggerLeave:()=>{window.clearTimeout(w.current),F()},onContentEnter:()=>window.clearTimeout(_.current),onContentLeave:F,onItemSelect:V=>{L(H=>H===V?"":V)},onItemDismiss:()=>L(""),children:v.jsx(Sn.nav,{"aria-label":"Main","data-orientation":l,dir:b,...u,ref:g})})});vIe.displayName=My;var XK="NavigationMenuSub",S$t=U.forwardRef((t,e)=>{const{__scopeNavigationMenu:n,value:r,onValueChange:i,defaultValue:o,orientation:s="horizontal",...a}=t,l=Qc(XK,n),[c,u]=qs({prop:r,onChange:i,defaultProp:o??"",caller:XK});return v.jsx(bIe,{scope:n,isRootMenu:!1,value:c,dir:l.dir,orientation:s,rootNavigationMenu:l.rootNavigationMenu,onTriggerEnter:d=>u(d),onItemSelect:d=>u(d),onItemDismiss:()=>u(""),children:v.jsx(Sn.div,{"data-orientation":s,...a,ref:e})})});S$t.displayName=XK;var bIe=t=>{const{scope:e,isRootMenu:n,rootNavigationMenu:r,dir:i,orientation:o,children:s,value:a,onItemSelect:l,onItemDismiss:c,onTriggerEnter:u,onTriggerLeave:d,onContentEnter:p,onContentLeave:g}=t,[b,w]=U.useState(null),[_,E]=U.useState(new Map),[A,k]=U.useState(null);return v.jsx(x$t,{scope:e,isRootMenu:n,rootNavigationMenu:r,value:a,previousValue:dV(a),baseId:Eo(),dir:i,orientation:o,viewport:b,onViewportChange:w,indicatorTrack:A,onIndicatorTrackChange:k,onTriggerEnter:vi(u),onTriggerLeave:vi(d),onContentEnter:vi(p),onContentLeave:vi(g),onItemSelect:vi(l),onItemDismiss:vi(c),onViewportContentChange:U.useCallback((M,L)=>{E(F=>(F.set(M,L),new Map(F)))},[]),onViewportContentRemove:U.useCallback(M=>{E(L=>L.has(M)?(L.delete(M),new Map(L)):L)},[]),children:v.jsx(qK.Provider,{scope:e,children:v.jsx(w$t,{scope:e,items:_,children:s})})})},xIe="NavigationMenuList",wIe=U.forwardRef((t,e)=>{const{__scopeNavigationMenu:n,...r}=t,i=Qc(xIe,n),o=v.jsx(Sn.ul,{"data-orientation":i.orientation,...r,ref:e});return v.jsx(Sn.div,{style:{position:"relative"},ref:i.onIndicatorTrackChange,children:v.jsx(qK.Slot,{scope:n,children:i.isRootMenu?v.jsx(DIe,{asChild:!0,children:o}):o})})});wIe.displayName=xIe;var _Ie="NavigationMenuItem",[E$t,SIe]=ZK(_Ie),EIe=U.forwardRef((t,e)=>{const{__scopeNavigationMenu:n,value:r,...i}=t,o=Eo(),s=r||o||"LEGACY_REACT_AUTO_VALUE",a=U.useRef(null),l=U.useRef(null),c=U.useRef(null),u=U.useRef(()=>{}),d=U.useRef(!1),p=U.useCallback((b="start")=>{if(a.current){u.current();const w=tq(a.current);w.length&&nq(b==="start"?w:w.reverse())}},[]),g=U.useCallback(()=>{if(a.current){const b=tq(a.current);b.length&&(u.current=M$t(b))}},[]);return v.jsx(E$t,{scope:n,value:s,triggerRef:l,contentRef:a,focusProxyRef:c,wasEscapeCloseRef:d,onEntryKeyDown:p,onFocusProxyEnter:p,onRootContentClose:g,onContentFocusOutside:g,children:v.jsx(Sn.li,{...i,ref:e})})});EIe.displayName=_Ie;var QK="NavigationMenuTrigger",CIe=U.forwardRef((t,e)=>{const{__scopeNavigationMenu:n,disabled:r,...i}=t,o=Qc(QK,t.__scopeNavigationMenu),s=SIe(QK,t.__scopeNavigationMenu),a=U.useRef(null),l=Qn(a,s.triggerRef,e),c=OIe(o.baseId,s.value),u=$Ie(o.baseId,s.value),d=U.useRef(!1),p=U.useRef(!1),g=s.value===o.value;return v.jsxs(v.Fragment,{children:[v.jsx(qK.ItemSlot,{scope:n,value:s.value,children:v.jsx(LIe,{asChild:!0,children:v.jsx(Sn.button,{id:c,disabled:r,"data-disabled":r?"":void 0,"data-state":iq(g),"aria-expanded":g,"aria-controls":u,...i,ref:l,onPointerEnter:Yt(t.onPointerEnter,()=>{p.current=!1,s.wasEscapeCloseRef.current=!1}),onPointerMove:Yt(t.onPointerMove,xD(()=>{r||p.current||s.wasEscapeCloseRef.current||d.current||(o.onTriggerEnter(s.value),d.current=!0)})),onPointerLeave:Yt(t.onPointerLeave,xD(()=>{r||(o.onTriggerLeave(),d.current=!1)})),onClick:Yt(t.onClick,()=>{o.onItemSelect(s.value),p.current=g}),onKeyDown:Yt(t.onKeyDown,b=>{const _={horizontal:"ArrowDown",vertical:o.dir==="rtl"?"ArrowLeft":"ArrowRight"}[o.orientation];g&&b.key===_&&(s.onEntryKeyDown(),b.preventDefault())})})})}),g&&v.jsxs(v.Fragment,{children:[v.jsx(K_t,{"aria-hidden":!0,tabIndex:0,ref:s.focusProxyRef,onFocus:b=>{const w=s.contentRef.current,_=b.relatedTarget,E=_===a.current,A=w?.contains(_);(E||!A)&&s.onFocusProxyEnter(E?"start":"end")}}),o.viewport&&v.jsx("span",{"aria-owns":u})]})]})});CIe.displayName=QK;var C$t="NavigationMenuLink",TIe="navigationMenu.linkSelect",kIe=U.forwardRef((t,e)=>{const{__scopeNavigationMenu:n,active:r,onSelect:i,...o}=t;return v.jsx(LIe,{asChild:!0,children:v.jsx(Sn.a,{"data-active":r?"":void 0,"aria-current":r?"page":void 0,...o,ref:e,onClick:Yt(t.onClick,s=>{const a=s.target,l=new CustomEvent(TIe,{bubbles:!0,cancelable:!0});if(a.addEventListener(TIe,c=>i?.(c),{once:!0}),nT(a,l),!l.defaultPrevented&&!s.metaKey){const c=new CustomEvent(bD,{bubbles:!0,cancelable:!0});nT(a,c)}},{checkForDefaultPrevented:!1})})})});kIe.displayName=C$t;var JK="NavigationMenuIndicator",PIe=U.forwardRef((t,e)=>{const{forceMount:n,...r}=t,i=Qc(JK,t.__scopeNavigationMenu),o=!!i.value;return i.indicatorTrack?$r.createPortal(v.jsx(ls,{present:n||o,children:v.jsx(T$t,{...r,ref:e})}),i.indicatorTrack):null});PIe.displayName=JK;var T$t=U.forwardRef((t,e)=>{const{__scopeNavigationMenu:n,...r}=t,i=Qc(JK,n),o=yIe(n),[s,a]=U.useState(null),[l,c]=U.useState(null),u=i.orientation==="horizontal",d=!!i.value;U.useEffect(()=>{const b=o().find(w=>w.value===i.value)?.ref.current;b&&a(b)},[o,i.value]);const p=()=>{s&&c({size:u?s.offsetWidth:s.offsetHeight,offset:u?s.offsetLeft:s.offsetTop})};return rq(s,p),rq(i.indicatorTrack,p),l?v.jsx(Sn.div,{"aria-hidden":!0,"data-state":d?"visible":"hidden","data-orientation":i.orientation,...r,ref:e,style:{position:"absolute",...u?{left:0,width:l.size+"px",transform:`translateX(${l.offset}px)`}:{top:0,height:l.size+"px",transform:`translateY(${l.offset}px)`},...r.style}}):null}),lx="NavigationMenuContent",AIe=U.forwardRef((t,e)=>{const{forceMount:n,...r}=t,i=Qc(lx,t.__scopeNavigationMenu),o=SIe(lx,t.__scopeNavigationMenu),s=Qn(o.contentRef,e),a=o.value===i.value,l={value:o.value,triggerRef:o.triggerRef,focusProxyRef:o.focusProxyRef,wasEscapeCloseRef:o.wasEscapeCloseRef,onContentFocusOutside:o.onContentFocusOutside,onRootContentClose:o.onRootContentClose,...r};return i.viewport?v.jsx(k$t,{forceMount:n,...l,ref:s}):v.jsx(ls,{present:n||a,children:v.jsx(IIe,{"data-state":iq(a),...l,ref:s,onPointerEnter:Yt(t.onPointerEnter,i.onContentEnter),onPointerLeave:Yt(t.onPointerLeave,xD(i.onContentLeave)),style:{pointerEvents:!a&&i.isRootMenu?"none":void 0,...l.style}})})});AIe.displayName=lx;var k$t=U.forwardRef((t,e)=>{const n=Qc(lx,t.__scopeNavigationMenu),{onViewportContentChange:r,onViewportContentRemove:i}=n;return Ki(()=>{r(t.value,{ref:e,...t})},[t,e,r]),Ki(()=>()=>i(t.value),[t.value,i]),null}),bD="navigationMenu.rootContentDismiss",IIe=U.forwardRef((t,e)=>{const{__scopeNavigationMenu:n,value:r,triggerRef:i,focusProxyRef:o,wasEscapeCloseRef:s,onRootContentClose:a,onContentFocusOutside:l,...c}=t,u=Qc(lx,n),d=U.useRef(null),p=Qn(d,e),g=OIe(u.baseId,r),b=$Ie(u.baseId,r),w=yIe(n),_=U.useRef(null),{onItemDismiss:E}=u;U.useEffect(()=>{const k=d.current;if(u.isRootMenu&&k){const M=()=>{E(),a(),k.contains(document.activeElement)&&i.current?.focus()};return k.addEventListener(bD,M),()=>k.removeEventListener(bD,M)}},[u.isRootMenu,t.value,i,E,a]);const A=U.useMemo(()=>{const M=w().map(H=>H.value);u.dir==="rtl"&&M.reverse();const L=M.indexOf(u.value),F=M.indexOf(u.previousValue),R=r===u.value,B=F===M.indexOf(r);if(!R&&!B)return _.current;const V=(()=>{if(L!==F){if(R&&F!==-1)return L>F?"from-end":"from-start";if(B&&L!==-1)return L>F?"to-start":"to-end"}return null})();return _.current=V,V},[u.previousValue,u.value,u.dir,w,r]);return v.jsx(DIe,{asChild:!0,children:v.jsx(o1,{id:b,"aria-labelledby":g,"data-motion":A,"data-orientation":u.orientation,...c,ref:p,disableOutsidePointerEvents:!1,onDismiss:()=>{const k=new Event(bD,{bubbles:!0,cancelable:!0});d.current?.dispatchEvent(k)},onFocusOutside:Yt(t.onFocusOutside,k=>{l();const M=k.target;u.rootNavigationMenu?.contains(M)&&k.preventDefault()}),onPointerDownOutside:Yt(t.onPointerDownOutside,k=>{const M=k.target,L=w().some(R=>R.ref.current?.contains(M)),F=u.isRootMenu&&u.viewport?.contains(M);(L||F||!u.isRootMenu)&&k.preventDefault()}),onKeyDown:Yt(t.onKeyDown,k=>{const M=k.altKey||k.ctrlKey||k.metaKey;if(k.key==="Tab"&&!M){const F=tq(k.currentTarget),R=document.activeElement,B=F.findIndex(W=>W===R),H=k.shiftKey?F.slice(0,B).reverse():F.slice(B+1,F.length);nq(H)?k.preventDefault():o.current?.focus()}}),onEscapeKeyDown:Yt(t.onEscapeKeyDown,k=>{s.current=!0})})})}),eq="NavigationMenuViewport",MIe=U.forwardRef((t,e)=>{const{forceMount:n,...r}=t,o=!!Qc(eq,t.__scopeNavigationMenu).value;return v.jsx(ls,{present:n||o,children:v.jsx(P$t,{...r,ref:e})})});MIe.displayName=eq;var P$t=U.forwardRef((t,e)=>{const{__scopeNavigationMenu:n,children:r,...i}=t,o=Qc(eq,n),s=Qn(e,o.onViewportChange),a=_$t(lx,t.__scopeNavigationMenu),[l,c]=U.useState(null),[u,d]=U.useState(null),p=l?l?.width+"px":void 0,g=l?l?.height+"px":void 0,b=!!o.value,w=b?o.value:o.previousValue;return rq(u,()=>{u&&c({width:u.offsetWidth,height:u.offsetHeight})}),v.jsx(Sn.div,{"data-state":iq(b),"data-orientation":o.orientation,...i,ref:s,style:{pointerEvents:!b&&o.isRootMenu?"none":void 0,"--radix-navigation-menu-viewport-width":p,"--radix-navigation-menu-viewport-height":g,...i.style},onPointerEnter:Yt(t.onPointerEnter,o.onContentEnter),onPointerLeave:Yt(t.onPointerLeave,xD(o.onContentLeave)),children:Array.from(a.items).map(([E,{ref:A,forceMount:k,...M}])=>{const L=w===E;return v.jsx(ls,{present:k||L,children:v.jsx(IIe,{...M,ref:sl(A,F=>{L&&F&&d(F)})})},E)})})}),A$t="FocusGroup",DIe=U.forwardRef((t,e)=>{const{__scopeNavigationMenu:n,...r}=t,i=Qc(A$t,n);return v.jsx(YK.Provider,{scope:n,children:v.jsx(YK.Slot,{scope:n,children:v.jsx(Sn.div,{dir:i.dir,...r,ref:e})})})}),NIe=["ArrowRight","ArrowLeft","ArrowUp","ArrowDown"],I$t="FocusGroupItem",LIe=U.forwardRef((t,e)=>{const{__scopeNavigationMenu:n,...r}=t,i=v$t(n),o=Qc(I$t,n);return v.jsx(YK.ItemSlot,{scope:n,children:v.jsx(Sn.button,{...r,ref:e,onKeyDown:Yt(t.onKeyDown,s=>{if(["Home","End",...NIe].includes(s.key)){let l=i().map(d=>d.ref.current);if([o.dir==="rtl"?"ArrowRight":"ArrowLeft","ArrowUp","End"].includes(s.key)&&l.reverse(),NIe.includes(s.key)){const d=l.indexOf(s.currentTarget);l=l.slice(d+1)}setTimeout(()=>nq(l)),s.preventDefault()}})})})});function tq(t){const e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const i=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||i?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)e.push(n.currentNode);return e}function nq(t){const e=document.activeElement;return t.some(n=>n===e?!0:(n.focus(),document.activeElement!==e))}function M$t(t){return t.forEach(e=>{e.dataset.tabindex=e.getAttribute("tabindex")||"",e.setAttribute("tabindex","-1")}),()=>{t.forEach(e=>{const n=e.dataset.tabindex;e.setAttribute("tabindex",n)})}}function rq(t,e){const n=vi(e);Ki(()=>{let r=0;if(t){const i=new ResizeObserver(()=>{cancelAnimationFrame(r),r=window.requestAnimationFrame(n)});return i.observe(t),()=>{window.cancelAnimationFrame(r),i.unobserve(t)}}},[t,n])}function iq(t){return t?"open":"closed"}function OIe(t,e){return`${t}-trigger-${e}`}function $Ie(t,e){return`${t}-content-${e}`}function xD(t){return e=>e.pointerType==="mouse"?t(e):void 0}var oq=vIe,sq=wIe,FIe=EIe,aq=CIe,wD=kIe,BIe=PIe,lq=AIe,cq=MIe;const zIe=t=>{switch(t){case"minimal":return"rounded-2xl";case"sharp":return"rounded-none";default:return"rounded-full"}},D$t=({onClose:t,onSelect:e,...n})=>{const r=gl("(max-width: 768px)"),{lock:i,unlock:o,isLocked:s}=VIe(),[a,l]=P.useState(null),c=async _=>{if(!(_.disabled||s)){if(_.onClick){const E=_.onClick();if(E instanceof Promise){l(_.id),i();try{await E,o(),e(_.id),_.keepOpen||t()}catch(A){console.error("ActionSheet Click Error:",A),o(),l(null)}return}}e(_.id),_.keepOpen||t()}},{cancelLabel:u,sections:d,title:p,description:g,header:b,contentProps:w}=n;return v.jsxs(ig,{className:he("p-0 pb-safe overflow-hidden flex flex-col",!r&&"max-w-md mx-auto",w?.className),...w,children:[v.jsx(Z5,{}),v.jsx("div",{className:"px-6 my-4 pt-0 text-center",children:(b||p||g)&&v.jsx("div",{children:b||v.jsxs(og,{children:[p&&v.jsx(O0,{children:p}),g&&v.jsx(HR,{children:g})]})})}),v.jsx("div",{className:"flex-1 overflow-y-auto [&::-webkit-scrollbar]:hidden [-ms-overflow-style:none] [scrollbar-width:none] mb-2",children:d.map((_,E)=>v.jsxs(P.Fragment,{children:[_.title&&v.jsx(un,{variant:"label-small",className:"px-6 py-2 mt-2 font-bold opacity-50 uppercase tracking-wider block",children:_.title}),_.type==="list"&&_.items&&v.jsx("div",{className:"flex flex-col gap-1 px-2",children:_.items.map(A=>v.jsxs(Zn,{variant:"ghost",size:A.size||"lg",shape:A.shape||"minimal",disabled:A.disabled||s&&a!==A.id,isLoading:a===A.id,className:he("justify-start h-14 px-4",A.variant==="destructive"&&"text-error hover:text-error hover:bg-error/10",A.className),onClick:()=>c(A),children:[A.icon&&v.jsx("span",{className:"mr-4 opacity-70",children:A.icon}),v.jsxs("div",{className:"flex flex-col items-start text-left",children:[v.jsx("span",{className:"text-base font-semibold",children:A.label}),A.subLabel&&v.jsx("span",{className:"text-xs font-normal opacity-60",children:A.subLabel})]})]},A.id))}),_.type==="grid"&&_.items&&v.jsx("div",{className:"grid gap-4 px-4 py-2",style:{gridTemplateColumns:`repeat(${_.gridColumns||4}, minmax(0, 1fr))`},children:_.items.map(A=>{const k=zIe(A.shape),M=a===A.id;return v.jsxs("div",{className:he("flex flex-col items-center gap-2 cursor-pointer group select-none transition-opacity",(A.disabled||s&&!M)&&"opacity-50 pointer-events-none",A.className),onClick:()=>c(A),children:[v.jsx("div",{className:he("flex h-12 w-12 items-center justify-center bg-surface-container-highest text-on-surface transition-transform group-active:scale-95 group-hover:bg-secondary-container",k),children:M?v.jsx("div",{className:"animate-spin h-5 w-5 border-2 border-primary border-t-transparent rounded-full"}):A.icon}),v.jsx("span",{className:"text-xs font-medium text-center leading-tight opacity-80 line-clamp-2",children:A.label})]},A.id)})}),_.type==="carousel"&&_.items&&v.jsx(Js,{orientation:"horizontal",scrollbarVisibility:"hidden",className:"!h-auto",children:v.jsx("div",{className:"flex gap-4 px-6 pb-4 pt-2",children:_.items.map(A=>{const k=zIe(A.shape),M=a===A.id;return v.jsxs("div",{className:he("flex w-[72px] shrink-0 flex-col items-center gap-2 cursor-pointer group select-none",(A.disabled||s&&!M)&&"opacity-50 pointer-events-none",A.className),onClick:()=>c(A),children:[A.variant==="image"?v.jsxs("div",{className:"relative",children:[v.jsx(qT,{src:A.imageSrc,fallback:A.label?.toString()[0],size:"lg",shape:A.shape||"full",className:"ring-2 ring-transparent group-hover:ring-primary transition-all"}),M&&v.jsx("div",{className:"absolute inset-0 bg-black/20 flex items-center justify-center rounded-full",children:v.jsx("div",{className:"animate-spin h-5 w-5 border-2 border-white border-t-transparent rounded-full"})})]}):v.jsx("div",{className:he("flex h-14 w-14 items-center justify-center bg-surface-container-highest text-on-surface transition-transform group-active:scale-95 group-hover:bg-secondary-container",k),children:M?v.jsx("div",{className:"animate-spin h-5 w-5 border-2 border-primary border-t-transparent rounded-full"}):A.icon}),v.jsx("div",{className:"flex flex-col items-center text-center",children:v.jsx("span",{className:"text-xs font-medium leading-tight line-clamp-1",children:A.label})})]},A.id)})})}),_.type==="custom"&&_.content,E<d.length-1&&v.jsx("div",{className:"h-px w-full bg-outline-variant/30 my-2"})]},E))}),u&&v.jsx(Y5,{className:"p-4 pt-2",children:v.jsx(Zn,{variant:"secondary",size:"lg",shape:"full",className:"w-full font-semibold",onClick:t,disabled:s,children:u})})]})},RIe=P.createContext(null),VIe=()=>{const t=P.useContext(RIe);if(!t)throw new Error("useActionSheet must be used within an ActionSheetProvider");return t},jIe=({children:t})=>{const e=P.useRef({}),[n,r]=P.useState([]),[i,o]=P.useState(!1),s=gl("(max-width: 768px)"),a=P.useCallback(()=>o(!0),[]),l=P.useCallback(()=>o(!1),[]),c=P.useCallback((g,b)=>{e.current[g]=b},[]),u=P.useCallback(g=>{i||r(b=>{if(g){const _=b.find(E=>E.id===g);return _?.props?.onOpenChange&&_.props.onOpenChange(!1),b.map(E=>E.id===g?{...E,isOpen:!1}:E)}const w=b.map(_=>_.isOpen).lastIndexOf(!0);if(w!==-1){const _=b[w];return _?.props?.onOpenChange&&_.props.onOpenChange(!1),b.map((E,A)=>A===w?{...E,isOpen:!1}:E)}return b})},[i]),d=P.useCallback((g,b)=>new Promise(w=>{const _=crypto.randomUUID();b?.onOpenChange&&b.onOpenChange(!0),r(E=>[...E,{id:_,name:g,props:b,isOpen:!0,resolve:w}])}),[]),p=P.useCallback(g=>d("standard",g),[d]);return P.useEffect(()=>{const g=n.filter(b=>!b.isOpen);if(g.length>0){const b=setTimeout(()=>{r(w=>w.filter(_=>_.isOpen)),g.forEach(w=>w.resolve(null))},300);return()=>clearTimeout(b)}},[n]),P.useEffect(()=>{c("standard",D$t)},[c]),v.jsxs(RIe.Provider,{value:{show:p,registerSheet:c,openSheet:d,close:u,lock:a,unlock:l,isLocked:i},children:[t,n.map((g,b)=>{const w=e.current[g.name];if(!w)return null;const _=g.name==="standard",E=50+b;return v.jsx(sg,{open:g.isOpen,isLocked:i,onOpenChange:A=>{g.props.onOpenChange&&g.props.onOpenChange(A),!A&&!i&&u(g.id)},forceBottomSheet:s,mode:"detached",..._&&g.props.sheetProps||{},style:{zIndex:E,position:"relative"},children:v.jsx(w,{...g.props,onClose:()=>u(g.id),onSelect:A=>g.resolve(A)})},g.id)})]})};function N$t(t){if(typeof document>"u")return;let e=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",e.appendChild(n),n.styleSheet?n.styleSheet.cssText=t:n.appendChild(document.createTextNode(t))}const L$t=t=>{switch(t){case"success":return F$t;case"info":return z$t;case"warning":return B$t;case"error":return R$t;default:return null}},O$t=Array(12).fill(0),$$t=({visible:t,className:e})=>P.createElement("div",{className:["sonner-loading-wrapper",e].filter(Boolean).join(" "),"data-visible":t},P.createElement("div",{className:"sonner-spinner"},O$t.map((n,r)=>P.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${r}`})))),F$t=P.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},P.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),B$t=P.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},P.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),z$t=P.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},P.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),R$t=P.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},P.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),V$t=P.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},P.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),P.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),j$t=()=>{const[t,e]=P.useState(document.hidden);return P.useEffect(()=>{const n=()=>{e(document.hidden)};return document.addEventListener("visibilitychange",n),()=>window.removeEventListener("visibilitychange",n)},[]),t};let uq=1;class U$t{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{const n=this.subscribers.indexOf(e);this.subscribers.splice(n,1)}),this.publish=e=>{this.subscribers.forEach(n=>n(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]},this.create=e=>{var n;const{message:r,...i}=e,o=typeof e?.id=="number"||((n=e.id)==null?void 0:n.length)>0?e.id:uq++,s=this.toasts.find(l=>l.id===o),a=e.dismissible===void 0?!0:e.dismissible;return this.dismissedToasts.has(o)&&this.dismissedToasts.delete(o),s?this.toasts=this.toasts.map(l=>l.id===o?(this.publish({...l,...e,id:o,title:r}),{...l,...e,id:o,dismissible:a,title:r}):l):this.addToast({title:r,...i,dismissible:a,id:o}),o},this.dismiss=e=>(e?(this.dismissedToasts.add(e),requestAnimationFrame(()=>this.subscribers.forEach(n=>n({id:e,dismiss:!0})))):this.toasts.forEach(n=>{this.subscribers.forEach(r=>r({id:n.id,dismiss:!0}))}),e),this.message=(e,n)=>this.create({...n,message:e}),this.error=(e,n)=>this.create({...n,message:e,type:"error"}),this.success=(e,n)=>this.create({...n,type:"success",message:e}),this.info=(e,n)=>this.create({...n,type:"info",message:e}),this.warning=(e,n)=>this.create({...n,type:"warning",message:e}),this.loading=(e,n)=>this.create({...n,type:"loading",message:e}),this.promise=(e,n)=>{if(!n)return;let r;n.loading!==void 0&&(r=this.create({...n,promise:e,type:"loading",message:n.loading,description:typeof n.description!="function"?n.description:void 0}));const i=Promise.resolve(e instanceof Function?e():e);let o=r!==void 0,s;const a=i.then(async c=>{if(s=["resolve",c],P.isValidElement(c))o=!1,this.create({id:r,type:"default",message:c});else if(G$t(c)&&!c.ok){o=!1;const d=typeof n.error=="function"?await n.error(`HTTP error! status: ${c.status}`):n.error,p=typeof n.description=="function"?await n.description(`HTTP error! status: ${c.status}`):n.description,b=typeof d=="object"&&!P.isValidElement(d)?d:{message:d};this.create({id:r,type:"error",description:p,...b})}else if(c instanceof Error){o=!1;const d=typeof n.error=="function"?await n.error(c):n.error,p=typeof n.description=="function"?await n.description(c):n.description,b=typeof d=="object"&&!P.isValidElement(d)?d:{message:d};this.create({id:r,type:"error",description:p,...b})}else if(n.success!==void 0){o=!1;const d=typeof n.success=="function"?await n.success(c):n.success,p=typeof n.description=="function"?await n.description(c):n.description,b=typeof d=="object"&&!P.isValidElement(d)?d:{message:d};this.create({id:r,type:"success",description:p,...b})}}).catch(async c=>{if(s=["reject",c],n.error!==void 0){o=!1;const u=typeof n.error=="function"?await n.error(c):n.error,d=typeof n.description=="function"?await n.description(c):n.description,g=typeof u=="object"&&!P.isValidElement(u)?u:{message:u};this.create({id:r,type:"error",description:d,...g})}}).finally(()=>{o&&(this.dismiss(r),r=void 0),n.finally==null||n.finally.call(n)}),l=()=>new Promise((c,u)=>a.then(()=>s[0]==="reject"?u(s[1]):c(s[1])).catch(u));return typeof r!="string"&&typeof r!="number"?{unwrap:l}:Object.assign(r,{unwrap:l})},this.custom=(e,n)=>{const r=n?.id||uq++;return this.create({jsx:e(r),id:r,...n}),r},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}}const Sl=new U$t,H$t=(t,e)=>{const n=e?.id||uq++;return Sl.addToast({title:t,...e,id:n}),n},G$t=t=>t&&typeof t=="object"&&"ok"in t&&typeof t.ok=="boolean"&&"status"in t&&typeof t.status=="number",W$t=H$t,K$t=()=>Sl.toasts,q$t=()=>Sl.getActiveToasts(),jE=Object.assign(W$t,{success:Sl.success,info:Sl.info,warning:Sl.warning,error:Sl.error,custom:Sl.custom,message:Sl.message,promise:Sl.promise,dismiss:Sl.dismiss,loading:Sl.loading},{getHistory:K$t,getToasts:q$t});N$t("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");function _D(t){return t.label!==void 0}const Y$t=3,Z$t="24px",X$t="16px",UIe=4e3,Q$t=356,J$t=14,e9t=45,t9t=200;function Zd(...t){return t.filter(Boolean).join(" ")}function n9t(t){const[e,n]=t.split("-"),r=[];return e&&r.push(e),n&&r.push(n),r}const r9t=t=>{var e,n,r,i,o,s,a,l,c;const{invert:u,toast:d,unstyled:p,interacting:g,setHeights:b,visibleToasts:w,heights:_,index:E,toasts:A,expanded:k,removeToast:M,defaultRichColors:L,closeButton:F,style:R,cancelButtonStyle:B,actionButtonStyle:V,className:H="",descriptionClassName:W="",duration:te,position:se,gap:X,expandByDefault:ee,classNames:K,icons:Q,closeButtonAriaLabel:Y="Close toast"}=t,[re,J]=P.useState(null),[ce,ie]=P.useState(null),[de,ve]=P.useState(!1),[ye,Ie]=P.useState(!1),[Pe,ke]=P.useState(!1),[De,Oe]=P.useState(!1),[Ye,Te]=P.useState(!1),[lt,Be]=P.useState(0),[it,ut]=P.useState(0),It=P.useRef(d.duration||te||UIe),nn=P.useRef(null),Zt=P.useRef(null),qt=E===0,Ct=E+1<=w,Mt=d.type,an=d.dismissible!==!1,en=d.className||"",on=d.descriptionClassName||"",Xe=P.useMemo(()=>_.findIndex(Ht=>Ht.toastId===d.id)||0,[_,d.id]),xe=P.useMemo(()=>{var Ht;return(Ht=d.closeButton)!=null?Ht:F},[d.closeButton,F]),Ee=P.useMemo(()=>d.duration||te||UIe,[d.duration,te]),Ae=P.useRef(0),je=P.useRef(0),$e=P.useRef(0),nt=P.useRef(null),[ot,He]=se.split("-"),Qe=P.useMemo(()=>_.reduce((Ht,En,Jt)=>Jt>=Xe?Ht:Ht+En.height,0),[_,Xe]),dt=j$t(),at=d.invert||u,Et=Mt==="loading";je.current=P.useMemo(()=>Xe*X+Qe,[Xe,Qe]),P.useEffect(()=>{It.current=Ee},[Ee]),P.useEffect(()=>{ve(!0)},[]),P.useEffect(()=>{const Ht=Zt.current;if(Ht){const En=Ht.getBoundingClientRect().height;return ut(En),b(Jt=>[{toastId:d.id,height:En,position:d.position},...Jt]),()=>b(Jt=>Jt.filter(yn=>yn.toastId!==d.id))}},[b,d.id]),P.useLayoutEffect(()=>{if(!de)return;const Ht=Zt.current,En=Ht.style.height;Ht.style.height="auto";const Jt=Ht.getBoundingClientRect().height;Ht.style.height=En,ut(Jt),b(yn=>yn.find(Nn=>Nn.toastId===d.id)?yn.map(Nn=>Nn.toastId===d.id?{...Nn,height:Jt}:Nn):[{toastId:d.id,height:Jt,position:d.position},...yn])},[de,d.title,d.description,b,d.id,d.jsx,d.action,d.cancel]);const pt=P.useCallback(()=>{Ie(!0),Be(je.current),b(Ht=>Ht.filter(En=>En.toastId!==d.id)),setTimeout(()=>{M(d)},t9t)},[d,M,b,je]);P.useEffect(()=>{if(d.promise&&Mt==="loading"||d.duration===1/0||d.type==="loading")return;let Ht;return k||g||dt?(()=>{if($e.current<Ae.current){const yn=new Date().getTime()-Ae.current;It.current=It.current-yn}$e.current=new Date().getTime()})():It.current!==1/0&&(Ae.current=new Date().getTime(),Ht=setTimeout(()=>{d.onAutoClose==null||d.onAutoClose.call(d,d),pt()},It.current)),()=>clearTimeout(Ht)},[k,g,d,Mt,dt,pt]),P.useEffect(()=>{d.delete&&(pt(),d.onDismiss==null||d.onDismiss.call(d,d))},[pt,d.delete]);function Nt(){var Ht;if(Q?.loading){var En;return P.createElement("div",{className:Zd(K?.loader,d==null||(En=d.classNames)==null?void 0:En.loader,"sonner-loader"),"data-visible":Mt==="loading"},Q.loading)}return P.createElement($$t,{className:Zd(K?.loader,d==null||(Ht=d.classNames)==null?void 0:Ht.loader),visible:Mt==="loading"})}const Qt=d.icon||Q?.[Mt]||L$t(Mt);var Gt,st;return P.createElement("li",{tabIndex:0,ref:Zt,className:Zd(H,en,K?.toast,d==null||(e=d.classNames)==null?void 0:e.toast,K?.default,K?.[Mt],d==null||(n=d.classNames)==null?void 0:n[Mt]),"data-sonner-toast":"","data-rich-colors":(Gt=d.richColors)!=null?Gt:L,"data-styled":!(d.jsx||d.unstyled||p),"data-mounted":de,"data-promise":!!d.promise,"data-swiped":Ye,"data-removed":ye,"data-visible":Ct,"data-y-position":ot,"data-x-position":He,"data-index":E,"data-front":qt,"data-swiping":Pe,"data-dismissible":an,"data-type":Mt,"data-invert":at,"data-swipe-out":De,"data-swipe-direction":ce,"data-expanded":!!(k||ee&&de),"data-testid":d.testId,style:{"--index":E,"--toasts-before":E,"--z-index":A.length-E,"--offset":`${ye?lt:je.current}px`,"--initial-height":ee?"auto":`${it}px`,...R,...d.style},onDragEnd:()=>{ke(!1),J(null),nt.current=null},onPointerDown:Ht=>{Ht.button!==2&&(Et||!an||(nn.current=new Date,Be(je.current),Ht.target.setPointerCapture(Ht.pointerId),Ht.target.tagName!=="BUTTON"&&(ke(!0),nt.current={x:Ht.clientX,y:Ht.clientY})))},onPointerUp:()=>{var Ht,En,Jt;if(De||!an)return;nt.current=null;const yn=Number(((Ht=Zt.current)==null?void 0:Ht.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),ar=Number(((En=Zt.current)==null?void 0:En.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),Nn=new Date().getTime()-((Jt=nn.current)==null?void 0:Jt.getTime()),Cn=re==="x"?yn:ar,Wn=Math.abs(Cn)/Nn;if(Math.abs(Cn)>=e9t||Wn>.11){Be(je.current),d.onDismiss==null||d.onDismiss.call(d,d),ie(re==="x"?yn>0?"right":"left":ar>0?"down":"up"),pt(),Oe(!0);return}else{var Yn,Ur;(Yn=Zt.current)==null||Yn.style.setProperty("--swipe-amount-x","0px"),(Ur=Zt.current)==null||Ur.style.setProperty("--swipe-amount-y","0px")}Te(!1),ke(!1),J(null)},onPointerMove:Ht=>{var En,Jt,yn;if(!nt.current||!an||((En=window.getSelection())==null?void 0:En.toString().length)>0)return;const Nn=Ht.clientY-nt.current.y,Cn=Ht.clientX-nt.current.x;var Wn;const Yn=(Wn=t.swipeDirections)!=null?Wn:n9t(se);!re&&(Math.abs(Cn)>1||Math.abs(Nn)>1)&&J(Math.abs(Cn)>Math.abs(Nn)?"x":"y");let Ur={x:0,y:0};const Vs=Ft=>1/(1.5+Math.abs(Ft)/20);if(re==="y"){if(Yn.includes("top")||Yn.includes("bottom"))if(Yn.includes("top")&&Nn<0||Yn.includes("bottom")&&Nn>0)Ur.y=Nn;else{const Ft=Nn*Vs(Nn);Ur.y=Math.abs(Ft)<Math.abs(Nn)?Ft:Nn}}else if(re==="x"&&(Yn.includes("left")||Yn.includes("right")))if(Yn.includes("left")&&Cn<0||Yn.includes("right")&&Cn>0)Ur.x=Cn;else{const Ft=Cn*Vs(Cn);Ur.x=Math.abs(Ft)<Math.abs(Cn)?Ft:Cn}(Math.abs(Ur.x)>0||Math.abs(Ur.y)>0)&&Te(!0),(Jt=Zt.current)==null||Jt.style.setProperty("--swipe-amount-x",`${Ur.x}px`),(yn=Zt.current)==null||yn.style.setProperty("--swipe-amount-y",`${Ur.y}px`)}},xe&&!d.jsx&&Mt!=="loading"?P.createElement("button",{"aria-label":Y,"data-disabled":Et,"data-close-button":!0,onClick:Et||!an?()=>{}:()=>{pt(),d.onDismiss==null||d.onDismiss.call(d,d)},className:Zd(K?.closeButton,d==null||(r=d.classNames)==null?void 0:r.closeButton)},(st=Q?.close)!=null?st:V$t):null,(Mt||d.icon||d.promise)&&d.icon!==null&&(Q?.[Mt]!==null||d.icon)?P.createElement("div",{"data-icon":"",className:Zd(K?.icon,d==null||(i=d.classNames)==null?void 0:i.icon)},d.promise||d.type==="loading"&&!d.icon?d.icon||Nt():null,d.type!=="loading"?Qt:null):null,P.createElement("div",{"data-content":"",className:Zd(K?.content,d==null||(o=d.classNames)==null?void 0:o.content)},P.createElement("div",{"data-title":"",className:Zd(K?.title,d==null||(s=d.classNames)==null?void 0:s.title)},d.jsx?d.jsx:typeof d.title=="function"?d.title():d.title),d.description?P.createElement("div",{"data-description":"",className:Zd(W,on,K?.description,d==null||(a=d.classNames)==null?void 0:a.description)},typeof d.description=="function"?d.description():d.description):null),P.isValidElement(d.cancel)?d.cancel:d.cancel&&_D(d.cancel)?P.createElement("button",{"data-button":!0,"data-cancel":!0,style:d.cancelButtonStyle||B,onClick:Ht=>{_D(d.cancel)&&an&&(d.cancel.onClick==null||d.cancel.onClick.call(d.cancel,Ht),pt())},className:Zd(K?.cancelButton,d==null||(l=d.classNames)==null?void 0:l.cancelButton)},d.cancel.label):null,P.isValidElement(d.action)?d.action:d.action&&_D(d.action)?P.createElement("button",{"data-button":!0,"data-action":!0,style:d.actionButtonStyle||V,onClick:Ht=>{_D(d.action)&&(d.action.onClick==null||d.action.onClick.call(d.action,Ht),!Ht.defaultPrevented&&pt())},className:Zd(K?.actionButton,d==null||(c=d.classNames)==null?void 0:c.actionButton)},d.action.label):null)};function HIe(){if(typeof window>"u"||typeof document>"u")return"ltr";const t=document.documentElement.getAttribute("dir");return t==="auto"||!t?window.getComputedStyle(document.documentElement).direction:t}function i9t(t,e){const n={};return[t,e].forEach((r,i)=>{const o=i===1,s=o?"--mobile-offset":"--offset",a=o?X$t:Z$t;function l(c){["top","right","bottom","left"].forEach(u=>{n[`${s}-${u}`]=typeof c=="number"?`${c}px`:c})}typeof r=="number"||typeof r=="string"?l(r):typeof r=="object"?["top","right","bottom","left"].forEach(c=>{r[c]===void 0?n[`${s}-${c}`]=a:n[`${s}-${c}`]=typeof r[c]=="number"?`${r[c]}px`:r[c]}):l(a)}),n}const o9t=P.forwardRef(function(e,n){const{id:r,invert:i,position:o="bottom-right",hotkey:s=["altKey","KeyT"],expand:a,closeButton:l,className:c,offset:u,mobileOffset:d,theme:p="light",richColors:g,duration:b,style:w,visibleToasts:_=Y$t,toastOptions:E,dir:A=HIe(),gap:k=J$t,icons:M,containerAriaLabel:L="Notifications"}=e,[F,R]=P.useState([]),B=P.useMemo(()=>r?F.filter(de=>de.toasterId===r):F.filter(de=>!de.toasterId),[F,r]),V=P.useMemo(()=>Array.from(new Set([o].concat(B.filter(de=>de.position).map(de=>de.position)))),[B,o]),[H,W]=P.useState([]),[te,se]=P.useState(!1),[X,ee]=P.useState(!1),[K,Q]=P.useState(p!=="system"?p:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),Y=P.useRef(null),re=s.join("+").replace(/Key/g,"").replace(/Digit/g,""),J=P.useRef(null),ce=P.useRef(!1),ie=P.useCallback(de=>{R(ve=>{var ye;return(ye=ve.find(Ie=>Ie.id===de.id))!=null&&ye.delete||Sl.dismiss(de.id),ve.filter(({id:Ie})=>Ie!==de.id)})},[]);return P.useEffect(()=>Sl.subscribe(de=>{if(de.dismiss){requestAnimationFrame(()=>{R(ve=>ve.map(ye=>ye.id===de.id?{...ye,delete:!0}:ye))});return}setTimeout(()=>{$r.flushSync(()=>{R(ve=>{const ye=ve.findIndex(Ie=>Ie.id===de.id);return ye!==-1?[...ve.slice(0,ye),{...ve[ye],...de},...ve.slice(ye+1)]:[de,...ve]})})})}),[F]),P.useEffect(()=>{if(p!=="system"){Q(p);return}if(p==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?Q("dark"):Q("light")),typeof window>"u")return;const de=window.matchMedia("(prefers-color-scheme: dark)");try{de.addEventListener("change",({matches:ve})=>{Q(ve?"dark":"light")})}catch{de.addListener(({matches:ye})=>{try{Q(ye?"dark":"light")}catch(Ie){console.error(Ie)}})}},[p]),P.useEffect(()=>{F.length<=1&&se(!1)},[F]),P.useEffect(()=>{const de=ve=>{var ye;if(s.every(ke=>ve[ke]||ve.code===ke)){var Pe;se(!0),(Pe=Y.current)==null||Pe.focus()}ve.code==="Escape"&&(document.activeElement===Y.current||(ye=Y.current)!=null&&ye.contains(document.activeElement))&&se(!1)};return document.addEventListener("keydown",de),()=>document.removeEventListener("keydown",de)},[s]),P.useEffect(()=>{if(Y.current)return()=>{J.current&&(J.current.focus({preventScroll:!0}),J.current=null,ce.current=!1)}},[Y.current]),P.createElement("section",{ref:n,"aria-label":`${L} ${re}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},V.map((de,ve)=>{var ye;const[Ie,Pe]=de.split("-");return B.length?P.createElement("ol",{key:de,dir:A==="auto"?HIe():A,tabIndex:-1,ref:Y,className:c,"data-sonner-toaster":!0,"data-sonner-theme":K,"data-y-position":Ie,"data-x-position":Pe,style:{"--front-toast-height":`${((ye=H[0])==null?void 0:ye.height)||0}px`,"--width":`${Q$t}px`,"--gap":`${k}px`,...w,...i9t(u,d)},onBlur:ke=>{ce.current&&!ke.currentTarget.contains(ke.relatedTarget)&&(ce.current=!1,J.current&&(J.current.focus({preventScroll:!0}),J.current=null))},onFocus:ke=>{ke.target instanceof HTMLElement&&ke.target.dataset.dismissible==="false"||ce.current||(ce.current=!0,J.current=ke.relatedTarget)},onMouseEnter:()=>se(!0),onMouseMove:()=>se(!0),onMouseLeave:()=>{X||se(!1)},onDragEnd:()=>se(!1),onPointerDown:ke=>{ke.target instanceof HTMLElement&&ke.target.dataset.dismissible==="false"||ee(!0)},onPointerUp:()=>ee(!1)},B.filter(ke=>!ke.position&&ve===0||ke.position===de).map((ke,De)=>{var Oe,Ye;return P.createElement(r9t,{key:ke.id,icons:M,index:De,toast:ke,defaultRichColors:g,duration:(Oe=E?.duration)!=null?Oe:b,className:E?.className,descriptionClassName:E?.descriptionClassName,invert:i,visibleToasts:_,closeButton:(Ye=E?.closeButton)!=null?Ye:l,interacting:X,position:de,style:E?.style,unstyled:E?.unstyled,classNames:E?.classNames,cancelButtonStyle:E?.cancelButtonStyle,actionButtonStyle:E?.actionButtonStyle,closeButtonAriaLabel:E?.closeButtonAriaLabel,removeToast:ie,toasts:B.filter(Te=>Te.position==ke.position),heights:H.filter(Te=>Te.position==ke.position),setHeights:W,expandByDefault:a,gap:k,expanded:te,swipeDirections:e.swipeDirections})})):null}))}),s9t=gn("group toast group-[.toaster]:flex group-[.toaster]:flex-wrap group-[.toaster]:gap-3 group-[.toaster]:items-start group-[.toaster]:w-full md:group-[.toaster]:w-[356px] group-[.toaster]:p-4 group-[.toaster]:font-manrope group-[.toaster]:text-sm group-[.toaster]:pointer-events-auto group-[.toaster]:transition-all group-[.toaster]:border group-[.toaster]:select-none [&>[data-button]:first-of-type]:ml-auto",{variants:{variant:{primary:"group-[.toaster]:bg-surface-container-low group-[.toaster]:text-on-surface group-[.toaster]:border-outline-variant/50",secondary:"group-[.toaster]:bg-surface-container-high group-[.toaster]:text-on-surface group-[.toaster]:border-outline-variant/50",tertiary:"group-[.toaster]:bg-tertiary-container group-[.toaster]:text-on-tertiary-container group-[.toaster]:border-tertiary-container","high-contrast":"group-[.toaster]:bg-inverse-surface group-[.toaster]:text-inverse-on-surface group-[.toaster]:border-inverse-surface",ghost:"group-[.toaster]:bg-surface-container-low/80 group-[.toaster]:backdrop-blur-md group-[.toaster]:text-on-surface group-[.toaster]:border-outline-variant/30",surface:"group-[.toaster]:bg-surface group-[.toaster]:text-on-surface group-[.toaster]:border-outline-variant"},shape:{full:"group-[.toaster]:rounded-[28px]",minimal:"group-[.toaster]:rounded-xl",sharp:"group-[.toaster]:rounded-none"},shadow:{none:"group-[.toaster]:shadow-none",sm:"group-[.toaster]:shadow-sm",md:"group-[.toaster]:shadow-md",lg:"group-[.toaster]:shadow-xl"}},defaultVariants:{variant:"secondary",shape:"minimal",shadow:"lg"}}),GIe=({variant:t="secondary",shape:e="minimal",shadow:n="lg",position:r="bottom-right",...i})=>{const{resolvedTheme:o}=Ul();return v.jsx(o9t,{theme:o,className:"toaster group",position:r,toastOptions:{unstyled:!0,classNames:{toast:he(s9t({variant:t,shape:e,shadow:n}),"group-data-[type=error]:bg-error-container group-data-[type=error]:text-on-error-container group-data-[type=error]:border-error/20","group-data-[type=warning]:bg-surface-container-high group-data-[type=warning]:border-yellow-500/50","group-data-[type=success]:bg-surface-container-high group-data-[type=success]:border-green-500/50"),content:"w-[calc(100%-2.5rem)]",title:"group-[.toast]:font-bold group-[.toast]:text-base",description:"group-[.toast]:text-xs group-[.toast]:opacity-90 group-[.toast]:leading-relaxed",actionButton:he("group-[.toast]:bg-primary group-[.toast]:text-on-primary","group-[.toast]:font-semibold group-[.toast]:text-xs","group-[.toast]:h-8 group-[.toast]:px-3 group-[.toast]:w-auto","group-[.toast]:rounded-lg","group-[.toast]:shrink-0","group-[.toast]:transition-transform group-[.toast]:active:scale-95"),cancelButton:he("group-[.toast]:bg-secondary-container group-[.toast]:text-on-secondary-container","group-[.toast]:font-semibold group-[.toast]:text-xs","group-[.toast]:h-8 group-[.toast]:px-3 group-[.toast]:w-auto","group-[.toast]:rounded-lg","group-[.toast]:shrink-0","group-[.toast]:transition-transform group-[.toast]:active:scale-95"),icon:"group-data-[type=error]:text-on-error-container group-[.toast]:self-start group-[.toast]:mt-0.5 group-[.toast]:shrink-0"}},...i})};function a9t({children:t,defaultTheme:e="system",defaultContrast:n="standard",defaultAnimationStyle:r="expressive",defaultSeedColor:i=null,defaultFonts:o,defaultOverrides:s,initialDirection:a="ltr",themeStorageKey:l="chesai-ui-theme",layoutStorageKey:c="layout-direction",toasterProps:u}){return v.jsx(kye,{defaultTheme:e,defaultContrast:n,defaultAnimationStyle:r,defaultSeedColor:i,defaultFonts:o,defaultOverrides:s,storageKey:l,children:v.jsx(UCe,{initialDirection:a,storageKey:c,children:v.jsx(yh,{children:v.jsx(jIe,{children:v.jsxs(r5e,{children:[t,v.jsx(GIe,{...u})]})})})})})}const UE=P.createContext(0),$h=()=>P.useContext(UE),WIe=P.createContext({value:"",onValueChange:t=>{}}),KIe=P.createContext({shape:"minimal",isClickMode:!1,setIsClickMode:()=>{},closeMenu:()=>{}}),Wg=()=>P.useContext(KIe),SD="relative flex w-full cursor-pointer select-none items-center gap-2 rounded-lg px-3 py-2.5 text-sm outline-none overflow-hidden transition-colors duration-150 ease-[cubic-bezier(0.2,0,0,1)] z-0 focus:bg-secondary-container/60 hover:bg-surface-container-highest/50 data-[highlighted]:bg-secondary-container/60 focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-primary/20 data-[disabled]:pointer-events-none data-[disabled]:opacity-38 after:absolute after:inset-0 after:z-[-1] after:bg-secondary-container/60 after:opacity-0 after:scale-75 after:origin-center after:rounded-[inherit] after:transition-all after:duration-200 after:ease-out hover:after:opacity-100 hover:after:scale-100",qIe=P.forwardRef(({className:t,shape:e="minimal",children:n,...r},i)=>{const[o,s]=P.useState(""),[a,l]=P.useState(!1),c=P.useCallback(()=>{s(""),l(!1)},[]);return v.jsx(KIe.Provider,{value:{shape:e,isClickMode:a,setIsClickMode:l,closeMenu:c},children:v.jsx(UE.Provider,{value:0,children:v.jsxs(oq,{ref:i,value:o,onValueChange:u=>{s(u),u||l(!1)},className:he("relative z-10 flex h-10 w-max items-center space-x-1 rounded-lg bg-transparent p-1",t),...r,children:[v.jsx(sq,{className:"flex items-center space-x-1",children:n}),v.jsx("div",{className:"absolute left-0 top-full flex justify-start",children:v.jsx(cq,{className:he("origin-top-left relative mt-2 h-[var(--radix-navigation-menu-viewport-height)] w-full overflow-hidden border border-outline-variant bg-surface-container text-on-surface shadow-lg transition-[width,height] duration-300 data-[state=open]:animate-nav-scale-in data-[state=closed]:animate-nav-scale-out sm:w-[var(--radix-navigation-menu-viewport-width)]",e==="full"?"rounded-3xl":e==="minimal"?"rounded-xl":"rounded-none")})})]})})})});qIe.displayName="Menubar";const l9t=FIe,YIe=P.forwardRef(({className:t,children:e,...n},r)=>{const{isClickMode:i,setIsClickMode:o}=Wg();return v.jsx(aq,{ref:r,onPointerEnter:s=>{i||s.preventDefault(),n.onPointerEnter?.(s)},onPointerMove:s=>{i||s.preventDefault(),n.onPointerMove?.(s)},onClick:s=>{o(!0),n.onClick?.(s)},className:he("flex cursor-pointer select-none items-center rounded-md px-3 py-1.5 text-sm font-semibold outline-none text-on-surface relative z-0 overflow-hidden","transition-colors duration-150 ease-in-out","focus:bg-surface-container-highest","data-[state=open]:bg-surface-container-highest","after:absolute after:inset-0 after:z-[-1] after:bg-secondary-container/50 after:opacity-0 after:scale-75 after:origin-center after:rounded-[inherit] after:transition-all after:duration-200 after:ease-out","hover:after:opacity-100 hover:after:scale-100 hover:bg-surface-container-highest/50",t),...n,children:e})});YIe.displayName="Menubar.Trigger";const ZIe=P.forwardRef(({className:t,children:e,...n},r)=>{const{closeMenu:i}=Wg();return v.jsx(lq,{ref:r,onFocusOutside:o=>{o.preventDefault(),n.onFocusOutside?.(o)},onInteractOutside:o=>{const s=o.target;s.closest('[role="menu"]')||s.closest("[data-radix-popper-content-wrapper]")?o.preventDefault():i(),n.onInteractOutside?.(o)},className:he("flex flex-col p-1.5 w-auto min-w-[12rem] outline-none","data-[motion^=from-]:animate-nav-enter-from data-[motion^=to-]:animate-nav-exit-to","data-[motion=from-end]:animate-nav-enter-from-right data-[motion=from-start]:animate-nav-enter-from-left","data-[motion=to-end]:animate-nav-exit-to-right data-[motion=to-start]:animate-nav-exit-to-left","absolute top-0 left-0",t),...n,children:v.jsx(UE.Provider,{value:1,children:e})})});ZIe.displayName="Menubar.Content";const XIe=P.forwardRef(({className:t,inset:e,...n},r)=>{const i=$h(),{shape:o,closeMenu:s}=Wg(),{theme:a}=Ul(),l=P.useRef(null),[,c]=Nr({ref:l,color:a==="dark"?"var(--color-ripple-dark)":"var(--color-ripple-light)",duration:400});return P.useImperativeHandle(r,()=>l.current),i===1?v.jsx(wD,{asChild:!0,children:v.jsx("button",{ref:l,onPointerDown:c,onClick:u=>{s(),n.onClick?.(u)},className:he(SD,"[&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",e&&"pl-8",o==="sharp"&&"!rounded-none",t),...n})}):v.jsx(pr,{ref:r,inset:e,className:t,onSelect:u=>{s(),n.onSelect?.(u)},...n})});XIe.displayName="Menubar.Item";const QIe=P.forwardRef(({className:t,...e},n)=>$h()===1?v.jsx("div",{ref:n,className:he("-mx-1 my-1.5 h-px bg-outline-variant",t),...e}):v.jsx(Ys,{ref:n,className:t,...e}));QIe.displayName="Menubar.Separator";const JIe=P.forwardRef(({className:t,inset:e,...n},r)=>$h()===1?v.jsx("div",{ref:r,className:he("px-3 py-2 text-xs font-medium text-on-surface-variant tracking-wide",e&&"pl-8",t),...n}):v.jsx(Ff,{ref:r,inset:e,className:t,...n}));JIe.displayName="Menubar.Label";const c9t=t=>{const e=$h(),{shape:n}=Wg();return e===1?v.jsx(UE.Provider,{value:e+1,children:v.jsx(Fa,{shape:n,modal:!1,...t})}):v.jsx(UE.Provider,{value:e+1,children:v.jsx(qse,{...t})})},eMe=P.forwardRef(({className:t,children:e,inset:n,...r},i)=>{const o=$h(),{shape:s}=Wg(),{theme:a}=Ul(),l=P.useRef(null),[,c]=Nr({ref:l,color:a==="dark"?"var(--color-ripple-dark)":"var(--color-ripple-light)",duration:400});return P.useImperativeHandle(i,()=>l.current),o===2?v.jsx(cl,{asChild:!0,children:v.jsx("button",{ref:l,onPointerDown:c,className:he(SD,"data-[state=open]:bg-secondary-container/60","[&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",n&&"pl-8",s==="sharp"&&"!rounded-none",t),...r,children:v.jsxs("span",{className:"relative z-10 flex flex-1 items-center gap-2",children:[e,v.jsx(ld,{className:"ml-auto h-4 w-4"})]})})}):v.jsx(V7,{ref:i,inset:n,className:t,...r,children:e})});eMe.displayName="Menubar.SubTrigger";const tMe=P.forwardRef(({className:t,...e},n)=>{const r=$h(),{shape:i}=Wg();return r===2?v.jsx(ma,{ref:n,side:"right",sideOffset:12,align:"start",className:t,...e}):v.jsx(j7,{ref:n,className:t,...e})});tMe.displayName="Menubar.SubContent";const u9t=Kse,nMe=({className:t,...e})=>v.jsx("span",{className:he("ml-auto text-xs font-mono tracking-wider text-on-surface-variant/50",t),...e});nMe.displayName="MenubarShortcut";const rMe=P.forwardRef(({className:t,children:e,checked:n,onCheckedChange:r,inset:i,...o},s)=>{const a=$h(),{shape:l,closeMenu:c}=Wg(),{theme:u}=Ul(),d=P.useRef(null),[,p]=Nr({ref:d,color:u==="dark"?"var(--color-ripple-dark)":"var(--color-ripple-light)",duration:400});return P.useImperativeHandle(s,()=>d.current),a===1?v.jsx(wD,{asChild:!0,children:v.jsxs("button",{ref:d,onPointerDown:p,className:he(SD,"pl-8 pr-3",l==="sharp"&&"!rounded-none",t),onClick:g=>{r?.(!n),c(),o.onClick?.(g)},...o,children:[v.jsx("span",{className:"absolute left-2 flex h-4 w-4 items-center justify-center z-10",children:n&&v.jsx(cs,{className:"h-4 w-4 animate-check-in text-primary"})}),v.jsx("span",{className:"relative z-10",children:e})]})}):v.jsx(A_,{ref:s,checked:n,onCheckedChange:r,className:t,onSelect:g=>{c(),o.onSelect?.(g)},...o,children:e})});rMe.displayName="Menubar.CheckboxItem";const iMe=P.forwardRef(({value:t,onValueChange:e,children:n,...r},i)=>$h()===1?v.jsx(WIe.Provider,{value:{value:t||"",onValueChange:e||(()=>{})},children:v.jsx("div",{ref:i,...r,children:n})}):v.jsx(Yse,{ref:i,value:t,onValueChange:e,...r,children:n}));iMe.displayName="Menubar.RadioGroup";const oMe=P.forwardRef(({className:t,children:e,value:n,inset:r,...i},o)=>{const s=$h(),{shape:a,closeMenu:l}=Wg(),c=P.useContext(WIe),{theme:u}=Ul(),d=P.useRef(null),[,p]=Nr({ref:d,color:u==="dark"?"var(--color-ripple-dark)":"var(--color-ripple-light)",duration:400});if(P.useImperativeHandle(o,()=>d.current),s===1){const g=c.value===n;return v.jsx(wD,{asChild:!0,children:v.jsxs("button",{ref:d,onPointerDown:p,className:he(SD,"pl-8 pr-3",a==="sharp"&&"!rounded-none",t),onClick:b=>{c.onValueChange(n),l(),i.onClick?.(b)},...i,children:[v.jsx("span",{className:"absolute left-2 flex h-4 w-4 items-center justify-center z-10",children:g&&v.jsx(v8,{className:"h-2 w-2 fill-current animate-check-in text-primary"})}),v.jsx("span",{className:"relative z-10",children:e})]})})}return v.jsx(R7,{ref:o,value:n,className:t,onSelect:g=>{l(),i.onSelect?.(g)},...i,children:e})});oMe.displayName="Menubar.RadioItem";const d9t=Object.assign(qIe,{Menu:l9t,Trigger:YIe,Content:ZIe,Item:XIe,Separator:QIe,Label:JIe,CheckboxItem:rMe,RadioGroup:iMe,RadioItem:oMe,Portal:u9t,Sub:c9t,SubContent:tMe,SubTrigger:eMe,Shortcut:nMe}),f9t=gn("group flex flex-col w-full relative",{variants:{variant:{filled:"","filled-inverted":"",outlined:"","outlined-inverted":"",underlined:"","underlined-inverted":"",ghost:"","ghost-inverted":""},color:{primary:"",secondary:"",error:""},size:{sm:"",md:"",lg:""},shape:{full:"",minimal:"",sharp:""},labelPlacement:{inside:"",outside:"","outside-left":"flex-row items-start flex-wrap md:flex-nowrap gap-x-4"},isInvalid:{true:"",false:""},isDisabled:{true:"opacity-disabled pointer-events-none"}},defaultVariants:{variant:"filled",color:"primary",size:"md",shape:"minimal",labelPlacement:"inside"}}),Kg={base:"group flex flex-col w-full relative",label:["absolute z-10 block subpixel-antialiased text-on-surface-variant/70 pointer-events-none","origin-top-left transition-all duration-200 ease-out will-change-transform","cursor-text group-data-[filled=true]:cursor-default"],trigger:["relative w-full inline-flex tap-highlight-transparent flex-row items-center flex-wrap gap-2 transition-colors duration-200 ease-out overflow-hidden outline-none","min-h-14 pr-10"],placeholder:"text-on-surface-variant/50 font-normal select-none",selectorIcon:"absolute right-3 top-1/2 -translate-y-1/2 flex items-center gap-1 text-on-surface-variant/50 pointer-events-none",helperWrapper:"p-1 relative flex flex-col gap-1.5",description:"text-xs text-on-surface-variant",errorMessage:"text-xs text-error"},h9t=t=>{const{variant:e,size:n,labelPlacement:r,isInvalid:i,shape:o,hasLabel:s,isFilled:a}=t;let l="rounded-2xl";o==="full"&&(l="rounded-3xl"),o==="sharp"&&(l="rounded-none");const c=[l];switch(e){case"filled":c.push("bg-surface-container-highest/60 hover:bg-surface-container-highest","data-[state=open]:bg-surface-container-highest");break;case"filled-inverted":c.push("bg-surface-container-low hover:bg-surface-container","data-[state=open]:bg-surface-container");break;case"outlined":c.push("bg-transparent border-2 border-outline-variant hover:border-on-surface-variant data-[state=open]:border-primary");break;case"outlined-inverted":c.push("bg-transparent border-2 border-primary/50 hover:border-primary data-[state=open]:border-primary data-[state=open]:ring-2 data-[state=open]:ring-primary/20");break;case"underlined":c.push("bg-transparent border-b-2 border-outline-variant rounded-none! px-0 data-[state=open]:border-primary");break;case"underlined-inverted":c.push("bg-surface-container-highest/30 border-b-2 border-primary/50 hover:bg-surface-container-highest/50 rounded-t-lg rounded-b-none data-[state=open]:border-primary");break;case"ghost":c.push("bg-transparent hover:bg-surface-container-highest/30 data-[state=open]:bg-surface-container-highest/50");break;case"ghost-inverted":c.push("bg-transparent hover:bg-primary/10 data-[state=open]:bg-primary/10 text-primary");break}i&&(e?.includes("filled")?c.push("bg-error-container/20 !text-error ring-inset ring-2 ring-error"):c.push("!border-error text-error"));let u="px-3",d="left-3",p="py-3";if(o==="full"?(u="px-5",d="left-5"):(u="px-4",d="left-4"),r==="inside")if(s){d+=" absolute top-1/2 -translate-y-1/2 font-normal";const g=["group-data-[filled=true]:top-1.5 group-data-[filled=true]:-translate-y-0","group-data-[filled=true]:scale-85","group-data-[filled=true]:opacity-70"].join(" ");d+=` ${g}`,a?n==="sm"?p="pt-5 pb-1":p="pt-6 pb-2":p="py-3"}else p="py-3";else d="static mb-1.5 ml-1 text-sm font-medium pointer-events-auto scale-100 translate-y-0",p="py-2";return e==="underlined"&&(u="px-0",d=d.replace(/left-\d+/,"left-0")),{base:"",label:[i?"text-error":"group-focus-within:text-primary text-on-surface-variant/70",d].join(" "),trigger:[c.join(" "),u,p].join(" ")}},sMe=U.forwardRef(({options:t,defaultValue:e=[],value:n,onValueChange:r,placeholder:i="Select items...",searchPlaceholder:o="Search...",emptyMessage:s="No item found.",maxCount:a=10,variant:l="filled",size:c="md",shape:u="minimal",labelPlacement:d="inside",disabled:p=!1,isInvalid:g=!1,className:b,classNames:w,label:_,description:E,errorMessage:A,mobileLayout:k="bottom-sheet",...M},L)=>{const[F,R]=U.useState(!1),[B,V]=U.useState(n!==void 0?n:e),[H,W]=U.useState(""),se=gl("(max-width: 768px)")&&k!=="default",X=Te=>{R(Te),Te||setTimeout(()=>W(""),200)},ee=F;U.useEffect(()=>{n!==void 0&&V(Te=>Te.length===n.length&&Te.every((lt,Be)=>lt===n[Be])?Te:n)},[n]);const K=Te=>{const lt=B.includes(Te)?B.filter(Be=>Be!==Te):[...B,Te];V(lt),r?.(lt)},Q=Te=>{Te.stopPropagation(),V([]),r?.([])},Y=(Te,lt)=>{Te.stopPropagation();const Be=B.filter(it=>it!==lt);V(Be),r?.(Be)},re=t.filter(Te=>B.includes(Te.value)),J=U.useMemo(()=>H?t.filter(Te=>Te.label.toLowerCase().includes(H.toLowerCase())):t,[t,H]),ce=a?re.slice(0,a):re,ie=re.length-ce.length,de=B.length>0||ee,ve=h9t({variant:l,size:c,shape:u,labelPlacement:d,isInvalid:g,isFilled:de,hasLabel:!!_}),ye=_?v.jsx("span",{className:he(Kg.label,ve.label,w?.label),children:_}):null,Ie=d==="outside"||d==="outside-left",Pe=B.length===0&&(!_||d!=="inside"||ee),ke=()=>v.jsxs("div",{className:"flex flex-col h-full w-full",children:[v.jsx("div",{className:"p-2 border-b border-outline-variant/10 shrink-0",children:v.jsx(hi,{variant:"filled",size:"sm",placeholder:o,startContent:v.jsx(ud,{className:"w-4 h-4 text-on-surface-variant"}),value:H,onChange:Te=>W(Te.target.value),className:"bg-transparent",onClick:Te=>Te.stopPropagation(),onPointerDown:Te=>Te.stopPropagation()})}),v.jsx("div",{className:"flex-1 min-h-0 relative",children:v.jsx(Js,{className:"h-full w-full",children:v.jsx("div",{className:"p-1 flex flex-col gap-0.5 pb-safe",children:J.length>0?J.map(Te=>{const lt=B.includes(Te.value);return v.jsxs("div",{onClick:()=>K(Te.value),className:he("relative flex cursor-pointer select-none items-center rounded-lg px-2 py-2 text-sm outline-none transition-colors shrink-0",lt?"bg-secondary-container/60 text-on-surface":"hover:bg-surface-container-highest text-on-surface"),children:[v.jsx("div",{className:he("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary",lt?"bg-primary text-on-primary":"opacity-50"),children:lt&&v.jsx(cs,{className:"h-3 w-3"})}),Te.icon&&v.jsx(Te.icon,{className:"mr-2 h-4 w-4 text-muted-foreground"}),v.jsx("span",{children:Te.label})]},Te.value)}):v.jsx("div",{className:"py-6 text-center text-sm text-on-surface-variant",children:s})})})}),B.length>0&&v.jsx("div",{className:"p-2 border-t border-outline-variant/10 shrink-0",children:v.jsx(Zn,{variant:"ghost",size:"sm",className:"w-full",onClick:Te=>Q(Te),children:"Clear selection"})})]}),De=v.jsxs("button",{ref:L,type:"button",disabled:p,className:he(Kg.trigger,ve.trigger,w?.trigger),...M,children:[!Ie&&ye,re.length>0?v.jsxs(v.Fragment,{children:[ce.map(Te=>v.jsxs(Nf,{variant:"secondary",shape:u==="full"?"full":"minimal",className:"pr-1 pl-2 h-6 pointer-events-auto z-10",onClick:lt=>Y(lt,Te.value),children:[Te.icon&&v.jsx(Te.icon,{className:"mr-1 h-3 w-3"}),Te.label,v.jsx("div",{className:"ml-1 rounded-full p-0.5 hover:bg-black/10 dark:hover:bg-white/10 cursor-pointer transition-colors",children:v.jsx(ao,{className:"h-3 w-3"})})]},Te.value)),ie>0&&v.jsxs(Nf,{variant:"secondary",shape:"minimal",className:"h-6 px-2 pointer-events-auto z-10",children:["+",ie," more"]})]}):null,Pe&&v.jsx("span",{className:he(Kg.placeholder),children:i}),v.jsxs("div",{className:Kg.selectorIcon,children:[B.length>0&&!p&&v.jsx("div",{role:"button",onClick:Q,className:"p-1 rounded-full hover:bg-on-surface/10 hover:text-on-surface transition-colors pointer-events-auto",children:v.jsx(ao,{className:"h-4 w-4"})}),v.jsx(WJ,{className:"h-4 w-4 shrink-0 opacity-50"})]})]}),Oe=(E||g&&A)&&v.jsx("div",{className:he(Kg.helperWrapper,w?.helperWrapper),children:g&&A?v.jsx("div",{className:he(Kg.errorMessage,w?.errorMessage),children:A}):v.jsx("div",{className:he(Kg.description,w?.description),children:E})}),Ye=({children:Te})=>v.jsxs("div",{className:he(Kg.base,f9t({labelPlacement:d}),b,w?.base),"data-filled":de,"data-invalid":g,"data-disabled":p,children:[Ie&&ye,Te,Oe]});if(se){const Te=k==="bottom-sheet"?sg:Gl,lt=k==="bottom-sheet"?aS:ng,Be=k==="bottom-sheet"?ig:yl;return v.jsxs(Te,{open:F,onOpenChange:X,children:[v.jsx(Ye,{children:v.jsx(lt,{asChild:!0,children:De})}),v.jsxs(Be,{padding:"none",className:he("p-0 flex flex-col overflow-hidden",k==="dialog"&&"max-w-[90vw] h-[60vh]",k==="bottom-sheet"&&"max-h-[85vh] h-[500px]"),shape:u,children:[k==="bottom-sheet"&&v.jsx(og,{className:"px-4 py-3 border-b border-outline-variant/20 shrink-0",children:v.jsx(O0,{className:"text-left",children:_||"Select Items"})}),ke()]})]})}return v.jsxs(G2,{open:F,onOpenChange:X,children:[v.jsx(Ye,{children:v.jsx(W2,{asChild:!0,children:De})}),v.jsx(K2,{children:v.jsx(q2,{className:he("z-50 w-[var(--radix-popover-trigger-width)] min-w-48 overflow-hidden p-0","max-h-80 flex flex-col","rounded-xl border border-outline-variant bg-surface-container text-on-surface shadow-md","data-[state=open]:animate-menu-enter data-[state=closed]:animate-menu-exit"),align:"start",sideOffset:4,children:ke()})})]})});sMe.displayName="MultiSelect";const aMe=gn("group inline-flex h-10 w-max items-center justify-center rounded-lg bg-transparent px-4 py-2 text-sm font-semibold transition-colors focus:bg-graphite-secondary focus:outline-none focus:ring-2 focus:ring-graphite-ring focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[active]:bg-graphite-secondary/50 data-[state=open]:bg-graphite-secondary/50 relative z-0 overflow-hidden after:absolute after:inset-0 after:z-[-1] after:bg-graphite-secondary after:opacity-0 after:scale-75 after:origin-center after:rounded-[inherit] after:transition-all after:duration-200 after:ease-out hover:after:opacity-100 hover:after:scale-100"),p9t=gn(["relative block w-full select-none space-y-1 rounded-lg p-3 text-left leading-none no-underline outline-none transition-colors duration-150 ease-in-out overflow-hidden z-0","focus:bg-graphite-secondary","focus-visible:ring-2 focus-visible:ring-graphite-ring focus-visible:ring-offset-2 focus-visible:ring-offset-graphite-card","after:absolute after:inset-0 after:z-[-1] after:bg-graphite-secondary after:opacity-0 after:scale-75 after:origin-center after:rounded-[inherit] after:transition-all after:duration-200 after:ease-out","hover:after:opacity-100 hover:after:scale-100"]),lMe=P.forwardRef(({className:t,children:e,...n},r)=>v.jsxs(oq,{ref:r,className:he("relative z-10 flex max-w-max flex-1 items-center justify-center",t),...n,children:[e,v.jsx(dq,{})]}));lMe.displayName=oq.displayName;const cMe=P.forwardRef(({className:t,...e},n)=>v.jsx(sq,{ref:n,className:he("group flex flex-1 list-none items-center justify-center space-x-1",t),...e}));cMe.displayName=sq.displayName;const g9t=FIe,uMe=P.forwardRef(({className:t,children:e,...n},r)=>v.jsx(aq,{ref:r,className:he(aMe(),"group",t),...n,children:v.jsxs("span",{className:"relative z-10 flex items-center",children:[e,v.jsx(Cs,{className:"relative top-[1px] ml-1 h-4 w-4 transition duration-200 group-data-[state=open]:rotate-180","aria-hidden":"true"})]})}));uMe.displayName=aq.displayName;const dMe=P.forwardRef(({className:t,...e},n)=>v.jsx(lq,{ref:n,className:he("left-0 top-0 w-full data-[motion^=from-]:animate-nav-enter-from data-[motion^=to-]:animate-nav-exit-to data-[motion=from-end]:animate-nav-enter-from-right data-[motion=from-start]:animate-nav-enter-from-left data-[motion=to-end]:animate-nav-exit-to-right data-[motion=to-start]:animate-nav-exit-to-left md:absolute md:w-auto",t),...e}));dMe.displayName=lq.displayName;const fMe=wD,hMe=P.forwardRef(({className:t,grid:e="cols-1",...n},r)=>{const i={"cols-1":"md:grid-cols-1","cols-2":"md:grid-cols-2","cols-3":"md:grid-cols-3"};return v.jsx("ul",{ref:r,className:he("grid gap-3 p-4","w-[400px]",i[e],t),...n})});hMe.displayName="NavigationMenu.ContentList";const pMe=P.forwardRef(({className:t,title:e,children:n,startIcon:r,endAdornment:i,onPointerDown:o,...s},a)=>{const l=P.useRef(null);P.useImperativeHandle(a,()=>l.current);const[,c]=Nr({ref:l,color:"var(--color-ripple-light)",duration:400}),u=!!n;return v.jsx("li",{children:v.jsx(fMe,{ref:l,onPointerDown:d=>{c(d),o?.(d)},className:p9t({className:t}),...s,children:v.jsxs("div",{className:he("flex gap-4 relative z-10 w-full",u?"items-start":"items-center"),children:[r&&v.jsx("div",{className:he("text-graphite-primary flex-shrink-0 flex items-center justify-center",u&&"mt-0.5"),children:r}),v.jsxs("div",{className:"flex-1 min-w-0",children:[v.jsxs("div",{className:"flex justify-between items-center",children:[v.jsx(un,{variant:"body-small",className:"font-semibold !leading-none",children:e}),i]}),n&&v.jsx(un,{variant:"body-small",muted:!0,className:"!text-sm !leading-snug line-clamp-2 mt-1",children:n})]})]})})})});pMe.displayName="NavigationMenu.ContentItem";const dq=P.forwardRef(({className:t,...e},n)=>v.jsx("div",{className:he("absolute left-0 top-full flex justify-center"),children:v.jsx(cq,{className:he("origin-top-center relative mt-2 h-(--radix-navigation-menu-viewport-height) w-full overflow-hidden rounded-xl border border-graphite-border bg-graphite-card text-graphite-foreground shadow-lg data-[state=open]:animate-nav-scale-in data-[state=closed]:animate-nav-scale-out md:w-(--radix-navigation-menu-viewport-width)",t),ref:n,...e})}));dq.displayName=cq.displayName;const gMe=P.forwardRef(({className:t,...e},n)=>v.jsx(BIe,{ref:n,className:he("top-full z-[1] flex h-2.5 items-end justify-center overflow-hidden data-[state=visible]:animate-nav-fade-in data-[state=hidden]:animate-nav-fade-out",t),...e,children:v.jsx("div",{className:"relative top-[60%] h-3 w-3 rotate-45 rounded-tl-sm bg-graphite-border"})}));gMe.displayName=BIe.displayName;const m9t=Object.assign(lMe,{List:cMe,Item:g9t,Content:dMe,Trigger:uMe,Link:fMe,Indicator:gMe,Viewport:dq,ContentList:hMe,ContentItem:pMe}),mMe=P.createContext(null),ED=()=>{const t=P.useContext(mMe);if(!t)throw new Error("NavigationRail components must be used within a <NavigationRail.Navigator>");return t},y9t=gn("flex flex-col h-full transition-shadow duration-300 ease-in-out z-20 overflow-hidden text-on-surface",{variants:{variant:{primary:"bg-surface-container-low",secondary:"bg-surface-container-high",tertiary:"bg-tertiary-container text-on-tertiary-container",surface:"bg-surface",ghost:"bg-transparent"},behavior:{push:"relative",overlay:"absolute"},shape:{full:"rounded-e-3xl",minimal:"rounded-e-xl",sharp:"rounded-none"},bordered:{true:"border-e border-outline-variant",false:""}},compoundVariants:[{variant:"tertiary",bordered:!0,className:"border-transparent!"}],defaultVariants:{variant:"primary",behavior:"push",shape:"minimal",bordered:!0}}),fq=()=>null;fq.displayName="NavigationRail.Screen";const CD=({children:t,className:e,...n})=>v.jsx("div",{className:he("flex items-center w-full min-w-0 transition-all duration-300",e),...n,children:t});CD.displayName="NavigationRail.Header";const yMe=({children:t,className:e,...n})=>{const{isExpanded:r,itemLayout:i}=ED(),o=i==="stacked";return v.jsx("li",{className:"w-full list-none flex justify-start",...n,children:v.jsx(vn,{initial:!1,mode:"wait",children:r&&!o?v.jsx(gt.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},transition:{duration:.15},className:he("w-full px-4 py-2 overflow-hidden",e),children:typeof t=="string"?v.jsx(un,{variant:"label-small",className:"text-on-surface-variant/70 uppercase tracking-widest font-bold block truncate",children:t}):t}):v.jsx(gt.div,{initial:{opacity:0},animate:{opacity:.4},exit:{opacity:0},className:"w-full flex justify-center py-2",children:v.jsx("div",{className:"w-8 border-t border-outline-variant"})})})})};yMe.displayName="NavigationRail.Label";const TD=P.forwardRef(({icon:t,label:e,className:n,variant:r,...i},o)=>{const{isExpanded:s,itemVariant:a,itemLayout:l,isRtl:c,disableRipple:u}=ED(),d=r||(a==="ghost"?"secondary":"primary"),p=l==="stacked",g=P.useRef(null);P.useImperativeHandle(o,()=>g.current);const[,b]=Nr({ref:g,color:d==="primary"?"var(--color-ripple-dark)":"var(--color-ripple-light)",duration:400}),w={primary:"bg-primary-container text-on-primary-container hover:bg-primary-container/90 shadow-md hover:shadow-lg",secondary:"bg-secondary-container text-on-secondary-container hover:bg-secondary-container/80 shadow-sm hover:shadow-md",tertiary:"bg-tertiary-container text-on-tertiary-container hover:bg-tertiary-container/80 shadow-sm hover:shadow-md",ghost:"bg-transparent text-on-surface hover:bg-surface-container-highest/50 shadow-none"},_=c?5:-5;return v.jsx("div",{className:he("w-full mb-6 mt-2 flex",p?"justify-center px-0":"justify-start px-4"),children:v.jsxs(gt.button,{ref:g,type:"button",onPointerDown:u?void 0:b,initial:!1,animate:{width:s&&!p?Math.max(140,(e?.toString().length||0)*12+60):"3.5rem",borderRadius:"1rem"},transition:{type:"spring",stiffness:300,damping:28,mass:1},className:he("h-14 relative flex items-center overflow-hidden transition-colors","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2",p&&"justify-center",w[d],n),...i,children:[v.jsx(gt.div,{layout:"position",className:"min-w-[3.5rem] h-full flex items-center justify-center shrink-0 z-10",children:t}),v.jsx("div",{className:"flex items-center h-full overflow-hidden",children:v.jsx(vn,{mode:"popLayout",initial:!1,children:s&&!p&&e&&v.jsx(gt.span,{initial:{opacity:0,x:_},animate:{opacity:1,x:0},exit:{opacity:0,x:_},transition:{duration:.15,delay:.05},className:"pe-6 font-semibold text-base text-inherit whitespace-nowrap",children:e})})})]})})});TD.displayName="NavigationRail.FAB";const v9t=({screen:t})=>{const{name:e,label:n,icon:r,shape:i}=t,{activeTab:o,onTabPress:s,isExpanded:a,indicatorId:l,navigatorShape:c,itemVariant:u,itemLayout:d,pillStyle:p,disableRipple:g,indicatorAnimation:b}=ED(),w=o===e,_=i||c,E=d==="stacked",A=p==="icon",k=P.useRef(null),L=w&&(u==="primary"||u==="tertiary")?"var(--color-ripple-light)":"var(--color-ripple-dark)",[,F]=Nr({ref:k,color:L,duration:400});let R="bg-secondary-container",B="text-on-secondary-container";u==="primary"?(R="bg-primary",B="text-on-primary"):u==="tertiary"?(R="bg-tertiary-container",B="text-on-tertiary-container"):u==="ghost"&&(R="bg-transparent",B="text-primary font-bold");const V={full:99,minimal:12,sharp:0},H={full:"rounded-full",minimal:"rounded-lg",sharp:"rounded-none"},W=!w&&!A,te=b==="slide",se={layoutId:te?l:void 0,initial:te?!1:{opacity:0,scale:.7},animate:te?void 0:{opacity:1,scale:1},exit:te?void 0:{opacity:0,scale:.7},transition:te?{type:"spring",stiffness:300,damping:28,mass:1}:{duration:.3,ease:"easeOut"},className:he("absolute inset-0 z-0",R),style:{borderRadius:V[_]}};return v.jsx("li",{className:he("flex w-full",E?"justify-center":"justify-start"),children:v.jsxs("button",{ref:k,type:"button",role:"tab","aria-selected":w,onClick:()=>s(e),onPointerDown:g?void 0:F,className:he("relative z-10 flex transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2",A&&"group",E?"flex-col items-center justify-center gap-1 h-[4.5rem] w-[4.5rem] px-1":"flex-row items-center justify-start gap-2 px-4 py-2 h-14 w-fit max-w-full",w?A?"text-on-surface":`${B} font-semibold`:"text-on-surface-variant",H[_],W&&["after:absolute after:inset-0 after:z-[-1] after:bg-secondary-container/50 after:opacity-0 after:scale-70 after:origin-center after:rounded-[inherit] after:transition-all after:duration-300 after:ease-out","hover:after:opacity-100 hover:after:scale-100","disabled:after:opacity-0"]),children:[v.jsx(vn,{children:w&&!A&&v.jsx(gt.div,{...se})}),v.jsxs("div",{className:he("relative flex items-center justify-center shrink-0 transition-colors",A?"w-14 h-8":"h-6 w-6",A&&H[_],A?w?B:"text-on-surface-variant":"text-inherit",A&&!w&&["after:absolute after:inset-0 after:z-[-1] after:bg-secondary-container/50 after:opacity-0 after:scale-70 after:origin-center after:rounded-[inherit] after:transition-all after:duration-300 after:ease-out","group-hover:after:opacity-100 group-hover:after:scale-100","group-disabled:after:opacity-0"]),children:[v.jsx(vn,{children:w&&A&&v.jsx(gt.div,{...se})}),v.jsx("div",{className:"relative z-10 flex items-center justify-center",children:r({isActive:w})})]}),E?v.jsx("span",{className:"relative z-10 text-[11px] font-semibold tracking-wide text-inherit truncate max-w-full mt-0.5",children:n}):v.jsx(vn,{children:a&&v.jsx(gt.div,{initial:{width:0,opacity:0},animate:{width:"auto",opacity:1,transition:{delay:.1,duration:.2}},exit:{width:0,opacity:0,transition:{duration:.1}},className:"relative z-10 overflow-hidden whitespace-nowrap",children:v.jsx(un,{"body-medium":!0,className:"font-semibold text-inherit!",children:n})})})]})})},vMe=({children:t,activeTab:e,onTabPress:n,shape:r="minimal",bordered:i=!0,variant:o="primary",itemVariant:s="secondary",itemLayout:a="inline",width:l="6rem",expandedWidth:c="12rem",forceExpanded:u=!1,expandOnHover:d=!1,overlay:p=!1,expandable:g=!0,pillStyle:b="full",disableRipple:w=!1,indicatorAnimation:_="slide",hideMenuButton:E=!1,className:A,style:k,...M})=>{const L=P.useId(),[F,R]=P.useState(!1),B=gl("(max-width: 768px)"),{isRtl:V}=vI(),H=B?"inline":a,W=H==="stacked"?!1:g,te=W?B?F:u||F:!1,se=B||p?"overlay":"push",X=typeof c=="number"?`${c}px`:c,ee=typeof l=="number"?`${l}px`:l,K=()=>{W&&!B&&d&&!u&&R(!0)},Q=()=>{W&&!B&&d&&!u&&R(!1)},Y=()=>{W&&R(!F)},re=P.Children.toArray(t),J=re.find(de=>P.isValidElement(de)&&de.type===CD),ce=re.find(de=>P.isValidElement(de)&&de.type===TD),ie=P.useMemo(()=>({activeTab:e,onTabPress:n,isExpanded:te,navigatorShape:r,indicatorId:L,variant:o,itemVariant:s,itemLayout:H,isRtl:V,pillStyle:b,disableRipple:w,indicatorAnimation:_}),[e,n,te,r,L,o,s,H,V,b,w,_]);return v.jsxs(mMe.Provider,{value:ie,children:[se==="overlay"&&v.jsx("div",{style:{width:ee,flexShrink:0}}),v.jsx(vn,{children:te&&se==="overlay"&&v.jsx(gt.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.3},className:"fixed inset-0 bg-black/50 z-10 select-none",onClick:()=>R(!1)})}),v.jsxs(gt.nav,{className:he(y9t({behavior:se,shape:r,bordered:i,variant:o,className:A})),onMouseEnter:K,onMouseLeave:Q,animate:{width:te?X:ee},transition:{type:"spring",stiffness:300,damping:28,mass:1},style:{display:"block",minWidth:"96px",...k},...M,children:[v.jsxs("div",{className:he("flex h-20 w-full shrink-0 items-center px-4 gap-2",te&&H!=="stacked"?"justify-between":"justify-center"),children:[J&&v.jsx("div",{className:"min-w-0 flex-1",children:J}),W&&(!u||B)&&!E&&v.jsx(zn,{variant:"ghost",size:"md",shape:"minimal",onClick:B||!d?Y:void 0,className:he(te&&"ml-auto"),"aria-label":te?"Collapse Menu":"Expand Menu",children:te?v.jsx(Xw,{className:he("w-5 h-5",V&&"rotate-180")}):v.jsx(nee,{className:"w-5 h-5"})})]}),ce&&v.jsx("div",{className:"shrink-0 pb-6",children:ce}),v.jsx("ul",{className:he("flex flex-1 flex-col items-center justify-start gap-2 pt-0 overflow-y-auto overflow-x-hidden",H==="stacked"?"px-2 w-full":"p-4 pe-6 w-full"),children:re.map((de,ve)=>{if(!P.isValidElement(de)||de.type===TD||de.type===CD)return null;if(de.type===fq){const ye=de;return v.jsx(v9t,{screen:ye.props},ye.props.name||ve)}return P.cloneElement(de,{key:de.key||ve})})})]})]})};vMe.displayName="NavigationRail.Navigator";const b9t={Navigator:vMe,Screen:fq,FAB:TD,Header:CD,Label:yMe};var x9t=Object.defineProperty,w9t=Object.defineProperties,_9t=Object.getOwnPropertyDescriptors,kD=Object.getOwnPropertySymbols,bMe=Object.prototype.hasOwnProperty,xMe=Object.prototype.propertyIsEnumerable,wMe=(t,e,n)=>e in t?x9t(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,S9t=(t,e)=>{for(var n in e||(e={}))bMe.call(e,n)&&wMe(t,n,e[n]);if(kD)for(var n of kD(e))xMe.call(e,n)&&wMe(t,n,e[n]);return t},E9t=(t,e)=>w9t(t,_9t(e)),C9t=(t,e)=>{var n={};for(var r in t)bMe.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&kD)for(var r of kD(t))e.indexOf(r)<0&&xMe.call(t,r)&&(n[r]=t[r]);return n};function T9t(t){let e=setTimeout(t,0),n=setTimeout(t,10),r=setTimeout(t,50);return[e,n,r]}function k9t(t){let e=U.useRef();return U.useEffect(()=>{e.current=t}),e.current}var P9t=18,_Me=40,A9t=`${_Me}px`,I9t=["[data-lastpass-icon-root]","com-1password-button","[data-dashlanecreated]",'[style$="2147483647 !important;"]'].join(",");function M9t({containerRef:t,inputRef:e,pushPasswordManagerStrategy:n,isFocused:r}){let[i,o]=U.useState(!1),[s,a]=U.useState(!1),[l,c]=U.useState(!1),u=U.useMemo(()=>n==="none"?!1:(n==="increase-width"||n==="experimental-no-flickering")&&i&&s,[i,s,n]),d=U.useCallback(()=>{let p=t.current,g=e.current;if(!p||!g||l||n==="none")return;let b=p,w=b.getBoundingClientRect().left+b.offsetWidth,_=b.getBoundingClientRect().top+b.offsetHeight/2,E=w-P9t,A=_;document.querySelectorAll(I9t).length===0&&document.elementFromPoint(E,A)===p||(o(!0),c(!0))},[t,e,l,n]);return U.useEffect(()=>{let p=t.current;if(!p||n==="none")return;function g(){let w=window.innerWidth-p.getBoundingClientRect().right;a(w>=_Me)}g();let b=setInterval(g,1e3);return()=>{clearInterval(b)}},[t,n]),U.useEffect(()=>{let p=r||document.activeElement===e.current;if(n==="none"||!p)return;let g=setTimeout(d,0),b=setTimeout(d,2e3),w=setTimeout(d,5e3),_=setTimeout(()=>{c(!0)},6e3);return()=>{clearTimeout(g),clearTimeout(b),clearTimeout(w),clearTimeout(_)}},[e,r,n,d]),{hasPWMBadge:i,willPushPWMBadge:u,PWM_BADGE_SPACE_WIDTH:A9t}}var SMe=U.createContext({}),EMe=U.forwardRef((t,e)=>{var n=t,{value:r,onChange:i,maxLength:o,textAlign:s="left",pattern:a,placeholder:l,inputMode:c="numeric",onComplete:u,pushPasswordManagerStrategy:d="increase-width",pasteTransformer:p,containerClassName:g,noScriptCSSFallback:b=D9t,render:w,children:_}=n,E=C9t(n,["value","onChange","maxLength","textAlign","pattern","placeholder","inputMode","onComplete","pushPasswordManagerStrategy","pasteTransformer","containerClassName","noScriptCSSFallback","render","children"]),A,k,M,L,F;let[R,B]=U.useState(typeof E.defaultValue=="string"?E.defaultValue:""),V=r??R,H=k9t(V),W=U.useCallback(Be=>{i?.(Be),B(Be)},[i]),te=U.useMemo(()=>a?typeof a=="string"?new RegExp(a):a:null,[a]),se=U.useRef(null),X=U.useRef(null),ee=U.useRef({value:V,onChange:W,isIOS:typeof window<"u"&&((k=(A=window?.CSS)==null?void 0:A.supports)==null?void 0:k.call(A,"-webkit-touch-callout","none"))}),K=U.useRef({prev:[(M=se.current)==null?void 0:M.selectionStart,(L=se.current)==null?void 0:L.selectionEnd,(F=se.current)==null?void 0:F.selectionDirection]});U.useImperativeHandle(e,()=>se.current,[]),U.useEffect(()=>{let Be=se.current,it=X.current;if(!Be||!it)return;ee.current.value!==Be.value&&ee.current.onChange(Be.value),K.current.prev=[Be.selectionStart,Be.selectionEnd,Be.selectionDirection];function ut(){if(document.activeElement!==Be){ie(null),ve(null);return}let Zt=Be.selectionStart,qt=Be.selectionEnd,Ct=Be.selectionDirection,Mt=Be.maxLength,an=Be.value,en=K.current.prev,on=-1,Xe=-1,xe;if(an.length!==0&&Zt!==null&&qt!==null){let $e=Zt===qt,nt=Zt===an.length&&an.length<Mt;if($e&&!nt){let ot=Zt;if(ot===0)on=0,Xe=1,xe="forward";else if(ot===Mt)on=ot-1,Xe=ot,xe="backward";else if(Mt>1&&an.length>1){let He=0;if(en[0]!==null&&en[1]!==null){xe=ot<en[1]?"backward":"forward";let Qe=en[0]===en[1]&&en[0]<Mt;xe==="backward"&&!Qe&&(He=-1)}on=He+ot,Xe=He+ot+1}}on!==-1&&Xe!==-1&&on!==Xe&&se.current.setSelectionRange(on,Xe,xe)}let Ee=on!==-1?on:Zt,Ae=Xe!==-1?Xe:qt,je=xe??Ct;ie(Ee),ve(Ae),K.current.prev=[Ee,Ae,je]}if(document.addEventListener("selectionchange",ut,{capture:!0}),ut(),document.activeElement===Be&&J(!0),!document.getElementById("input-otp-style")){let Zt=document.createElement("style");if(Zt.id="input-otp-style",document.head.appendChild(Zt),Zt.sheet){let qt="background: transparent !important; color: transparent !important; border-color: transparent !important; opacity: 0 !important; box-shadow: none !important; -webkit-box-shadow: none !important; -webkit-text-fill-color: transparent !important;";HE(Zt.sheet,"[data-input-otp]::selection { background: transparent !important; color: transparent !important; }"),HE(Zt.sheet,`[data-input-otp]:autofill { ${qt} }`),HE(Zt.sheet,`[data-input-otp]:-webkit-autofill { ${qt} }`),HE(Zt.sheet,"@supports (-webkit-touch-callout: none) { [data-input-otp] { letter-spacing: -.6em !important; font-weight: 100 !important; font-stretch: ultra-condensed; font-optical-sizing: none !important; left: -1px !important; right: 1px !important; } }"),HE(Zt.sheet,"[data-input-otp] + * { pointer-events: all !important; }")}}let It=()=>{it&&it.style.setProperty("--root-height",`${Be.clientHeight}px`)};It();let nn=new ResizeObserver(It);return nn.observe(Be),()=>{document.removeEventListener("selectionchange",ut,{capture:!0}),nn.disconnect()}},[]);let[Q,Y]=U.useState(!1),[re,J]=U.useState(!1),[ce,ie]=U.useState(null),[de,ve]=U.useState(null);U.useEffect(()=>{T9t(()=>{var Be,it,ut,It;(Be=se.current)==null||Be.dispatchEvent(new Event("input"));let nn=(it=se.current)==null?void 0:it.selectionStart,Zt=(ut=se.current)==null?void 0:ut.selectionEnd,qt=(It=se.current)==null?void 0:It.selectionDirection;nn!==null&&Zt!==null&&(ie(nn),ve(Zt),K.current.prev=[nn,Zt,qt])})},[V,re]),U.useEffect(()=>{H!==void 0&&V!==H&&H.length<o&&V.length===o&&u?.(V)},[o,u,H,V]);let ye=M9t({containerRef:X,inputRef:se,pushPasswordManagerStrategy:d,isFocused:re}),Ie=U.useCallback(Be=>{let it=Be.currentTarget.value.slice(0,o);if(it.length>0&&te&&!te.test(it)){Be.preventDefault();return}typeof H=="string"&&it.length<H.length&&document.dispatchEvent(new Event("selectionchange")),W(it)},[o,W,H,te]),Pe=U.useCallback(()=>{var Be;if(se.current){let it=Math.min(se.current.value.length,o-1),ut=se.current.value.length;(Be=se.current)==null||Be.setSelectionRange(it,ut),ie(it),ve(ut)}J(!0)},[o]),ke=U.useCallback(Be=>{var it,ut;let It=se.current;if(!p&&(!ee.current.isIOS||!Be.clipboardData||!It))return;let nn=Be.clipboardData.getData("text/plain"),Zt=p?p(nn):nn;Be.preventDefault();let qt=(it=se.current)==null?void 0:it.selectionStart,Ct=(ut=se.current)==null?void 0:ut.selectionEnd,Mt=(qt!==Ct?V.slice(0,qt)+Zt+V.slice(Ct):V.slice(0,qt)+Zt+V.slice(qt)).slice(0,o);if(Mt.length>0&&te&&!te.test(Mt))return;It.value=Mt,W(Mt);let an=Math.min(Mt.length,o-1),en=Mt.length;It.setSelectionRange(an,en),ie(an),ve(en)},[o,W,te,V]),De=U.useMemo(()=>({position:"relative",cursor:E.disabled?"default":"text",userSelect:"none",WebkitUserSelect:"none",pointerEvents:"none"}),[E.disabled]),Oe=U.useMemo(()=>({position:"absolute",inset:0,width:ye.willPushPWMBadge?`calc(100% + ${ye.PWM_BADGE_SPACE_WIDTH})`:"100%",clipPath:ye.willPushPWMBadge?`inset(0 ${ye.PWM_BADGE_SPACE_WIDTH} 0 0)`:void 0,height:"100%",display:"flex",textAlign:s,opacity:"1",color:"transparent",pointerEvents:"all",background:"transparent",caretColor:"transparent",border:"0 solid transparent",outline:"0 solid transparent",boxShadow:"none",lineHeight:"1",letterSpacing:"-.5em",fontSize:"var(--root-height)",fontFamily:"monospace",fontVariantNumeric:"tabular-nums"}),[ye.PWM_BADGE_SPACE_WIDTH,ye.willPushPWMBadge,s]),Ye=U.useMemo(()=>U.createElement("input",E9t(S9t({autoComplete:E.autoComplete||"one-time-code"},E),{"data-input-otp":!0,"data-input-otp-placeholder-shown":V.length===0||void 0,"data-input-otp-mss":ce,"data-input-otp-mse":de,inputMode:c,pattern:te?.source,"aria-placeholder":l,style:Oe,maxLength:o,value:V,ref:se,onPaste:Be=>{var it;ke(Be),(it=E.onPaste)==null||it.call(E,Be)},onChange:Ie,onMouseOver:Be=>{var it;Y(!0),(it=E.onMouseOver)==null||it.call(E,Be)},onMouseLeave:Be=>{var it;Y(!1),(it=E.onMouseLeave)==null||it.call(E,Be)},onFocus:Be=>{var it;Pe(),(it=E.onFocus)==null||it.call(E,Be)},onBlur:Be=>{var it;J(!1),(it=E.onBlur)==null||it.call(E,Be)}})),[Ie,Pe,ke,c,Oe,o,de,ce,E,te?.source,V]),Te=U.useMemo(()=>({slots:Array.from({length:o}).map((Be,it)=>{var ut;let It=re&&ce!==null&&de!==null&&(ce===de&&it===ce||it>=ce&&it<de),nn=V[it]!==void 0?V[it]:null,Zt=V[0]!==void 0?null:(ut=l?.[it])!=null?ut:null;return{char:nn,placeholderChar:Zt,isActive:It,hasFakeCaret:It&&nn===null}}),isFocused:re,isHovering:!E.disabled&&Q}),[re,Q,o,de,ce,E.disabled,V]),lt=U.useMemo(()=>w?w(Te):U.createElement(SMe.Provider,{value:Te},_),[_,Te,w]);return U.createElement(U.Fragment,null,b!==null&&U.createElement("noscript",null,U.createElement("style",null,b)),U.createElement("div",{ref:X,"data-input-otp-container":!0,style:De,className:g},lt,U.createElement("div",{style:{position:"absolute",inset:0,pointerEvents:"none"}},Ye)))});EMe.displayName="Input";function HE(t,e){try{t.insertRule(e)}catch{console.error("input-otp could not insert CSS rule:",e)}}var D9t=`
233
233
  [data-input-otp] {
234
234
  --nojs-bg: white !important;
235
235
  --nojs-fg: black !important;