@editora/core 1.0.27 → 1.0.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/editora.min.js +16 -16
- package/dist/editora.umd.js +16 -16
- package/dist/{index-DHPPVQwx.js → index-B-Vt_adn.js} +2 -2
- package/dist/{index-gI4djib2.mjs → index-B3zKYrPA.mjs} +20 -18
- package/dist/index.cjs.js +1 -1
- package/dist/index.esm.js +2 -2
- package/dist/webcomponent-core.js +19 -17
- package/dist/webcomponent-core.min.js +1 -1
- package/dist/webcomponent.cjs.js +1 -1
- package/dist/webcomponent.esm.js +1 -1
- package/dist/webcomponent.js +19 -17
- package/dist/webcomponent.min.js +1 -1
- package/package.json +1 -1
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
`}),n+=`
|
|
9
9
|
`}),n}getShortcutCategory(e){return e.includes("toggle")&&(e.includes("Bold")||e.includes("Italic")||e.includes("Underline")||e.includes("Strike")||e.includes("Code")||e.includes("Super")||e.includes("Sub"))?"Text Formatting":e.includes("Heading")||e.includes("Paragraph")?"Block Formatting":e.includes("List")||e.includes("Checklist")?"Lists":e.includes("Alignment")||e.includes("Indent")?"Alignment & Indentation":e.includes("undo")||e.includes("redo")?"History":e.includes("insert")?"Insert":e.includes("find")||e.includes("replace")?"Find & Replace":e.includes("Accessibility")||e.includes("spell")?"Tools":"Other"}}function Ji(r,e){(e==null||e>r.length)&&(e=r.length);for(var t=0,n=Array(e);t<e;t++)n[t]=r[t];return n}function qr(r){if(Array.isArray(r))return r}function Yr(r,e){var t=r==null?null:typeof Symbol!="undefined"&&r[Symbol.iterator]||r["@@iterator"];if(t!=null){var n,i,o,s,l=[],c=!0,d=!1;try{if(o=(t=t.call(r)).next,e!==0)for(;!(c=(n=o.call(t)).done)&&(l.push(n.value),l.length!==e);c=!0);}catch(u){d=!0,i=u}finally{try{if(!c&&t.return!=null&&(s=t.return(),Object(s)!==s))return}finally{if(d)throw i}}return l}}function Xr(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
10
10
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Zr(r,e){return qr(r)||Yr(r,e)||Qr(r,e)||Xr()}function Qr(r,e){if(r){if(typeof r=="string")return Ji(r,e);var t={}.toString.call(r).slice(8,-1);return t==="Object"&&r.constructor&&(t=r.constructor.name),t==="Map"||t==="Set"?Array.from(r):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?Ji(r,e):void 0}}const eo=Object.entries,to=Object.setPrototypeOf,Jr=Object.isFrozen,es=Object.getPrototypeOf,ts=Object.getOwnPropertyDescriptor;let X=Object.freeze,te=Object.seal,kt=Object.create,no=typeof Reflect!="undefined"&&Reflect,Wn=no.apply,jn=no.construct;X||(X=function(e){return e}),te||(te=function(e){return e}),Wn||(Wn=function(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];return e.apply(t,i)}),jn||(jn=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return new e(...n)});const rt=q(Array.prototype.forEach),ns=q(Array.prototype.lastIndexOf),io=q(Array.prototype.pop),It=q(Array.prototype.push),is=q(Array.prototype.splice),Mt=Array.isArray,Dt=q(String.prototype.toLowerCase),Kn=q(String.prototype.toString),oo=q(String.prototype.match),Nt=q(String.prototype.replace),ro=q(String.prototype.indexOf),os=q(String.prototype.trim),rs=q(Number.prototype.toString),ss=q(Boolean.prototype.toString),so=typeof BigInt=="undefined"?null:q(BigInt.prototype.toString),ao=typeof Symbol=="undefined"?null:q(Symbol.prototype.toString),pe=q(Object.prototype.hasOwnProperty),Ht=q(Object.prototype.toString),ae=q(RegExp.prototype.test),Je=as(TypeError);function q(r){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return Wn(r,e,n)}}function as(r){return function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return jn(r,t)}}function H(r,e){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Dt;if(to&&to(r,null),!Mt(e))return r;let n=e.length;for(;n--;){let i=e[n];if(typeof i=="string"){const o=t(i);o!==i&&(Jr(e)||(e[n]=o),i=o)}r[i]=!0}return r}function ls(r){for(let e=0;e<r.length;e++)pe(r,e)||(r[e]=null);return r}function ye(r){const e=kt(null);for(const n of eo(r)){var t=Zr(n,2);const i=t[0],o=t[1];pe(r,i)&&(Mt(o)?e[i]=ls(o):o&&typeof o=="object"&&o.constructor===Object?e[i]=ye(o):e[i]=o)}return e}function cs(r){switch(typeof r){case"string":return r;case"number":return rs(r);case"boolean":return ss(r);case"bigint":return so?so(r):"0";case"symbol":return ao?ao(r):"Symbol()";case"undefined":return Ht(r);case"function":case"object":{if(r===null)return Ht(r);const e=r,t=Re(e,"toString");if(typeof t=="function"){const n=t(e);return typeof n=="string"?n:Ht(n)}return Ht(r)}default:return Ht(r)}}function Re(r,e){for(;r!==null;){const n=ts(r,e);if(n){if(n.get)return q(n.get);if(typeof n.value=="function")return q(n.value)}r=es(r)}function t(){return null}return t}function ds(r){try{return ae(r,""),!0}catch(e){return!1}}const lo=X(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),Vn=X(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Gn=X(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),us=X(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),qn=X(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),hs=X(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),co=X(["#text"]),uo=X(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","command","commandfor","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),Yn=X(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dominant-baseline","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","pointer-events","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-orientation","text-rendering","textlength","type","u1","u2","unicode","values","vector-effect","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),ho=X(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),Mn=X(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),fs=te(/{{[\w\W]*|^[\w\W]*}}/g),ps=te(/<%[\w\W]*|^[\w\W]*%>/g),gs=te(/\${[\w\W]*/g),ms=te(/^data-[\-\w.\u00B7-\uFFFF]+$/),bs=te(/^aria-[\-\w]+$/),fo=te(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),ys=te(/^(?:\w+script|data):/i),Ts=te(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Es=te(/^html$/i),vs=te(/^[a-z][.\w]*(-[.\w]+)+$/i),po=te(/<[/\w!]/g),go=te(/<[/\w]/g),Ss=te(/<\/no(script|embed|frames)/i),ws=te(/\/>/i),Te={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},mo=["style","script","xmp","iframe","noembed","noframes","plaintext","noscript"],xs=X(H({},mo)),Cs=(function(){const r={};return rt(mo,e=>{r[e]=te(new RegExp("</"+e+"(?=[\\t\\n\\f\\r />])","i"))}),X(r)})(),As=function(){return typeof window=="undefined"?null:window},ks=function(e,t){if(typeof e!="object"||typeof e.createPolicy!="function")return null;let n=null;const i="data-tt-policy-suffix";t&&t.hasAttribute(i)&&(n=t.getAttribute(i));const o="dompurify"+(n?"#"+n:"");try{return e.createPolicy(o,{createHTML(s){return s},createScriptURL(s){return s}})}catch(s){return console.warn("TrustedTypes policy "+o+" could not be created."),null}},bo=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},et=function(e,t,n,i){return pe(e,t)&&Mt(e[t])?H(i.base?ye(i.base):{},e[t],i.transform):n},Xn=function(e,t,n){const i=pe(e,t)?e[t]:void 0;return i&&typeof i=="object"?ye(i):n()};function yo(){let r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:As();const e=b=>yo(b);if(e.version="3.4.16",e.removed=[],!r||!r.document||r.document.nodeType!==Te.document||!r.Element)return e.isSupported=!1,e;let t=r.document;const n=t,i=n.currentScript;r.DocumentFragment;const o=r.HTMLTemplateElement,s=r.Node,l=r.Element,c=r.NodeFilter;r.NamedNodeMap===void 0&&(r.NamedNodeMap||r.MozNamedAttrMap),r.HTMLFormElement;const d=r.DOMParser,u=r.trustedTypes,f=l.prototype,p=Re(f,"cloneNode"),y=Re(f,"remove"),m=Re(f,"removeAttributeNode"),E=Re(f,"nextSibling"),v=Re(f,"childNodes"),w=Re(f,"parentNode"),A=Re(f,"shadowRoot"),B=Re(f,"attributes"),R=s&&s.prototype?Re(s.prototype,"nodeType"):null,D=s&&s.prototype?Re(s.prototype,"nodeName"):null,z=s&&s.prototype?Re(s.prototype,"ownerDocument"):null,J=function(a){return R?R(a):a.nodeType},be=function(a){return D?D(a):a.nodeName};if(typeof o=="function"){const b=t.createElement("template");b.content&&b.content.ownerDocument&&(t=b.content.ownerDocument)}let N,U="",ee,_e=!1,ce=0;const de=function(){if(ce>0)throw Je('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.')},ie=function(a){de(),ce++;try{return N.createHTML(a)}finally{ce--}},Ie=function(a){de(),ce++;try{return N.createScriptURL(a)}finally{ce--}},Yt=function(){return _e||(ee=ks(u,i),_e=!0),ee},De=t,Be=De.implementation,ct=De.createNodeIterator,Xt=De.createDocumentFragment,F=De.getElementsByTagName,$e=n.importNode;let k=bo();e.isSupported=typeof eo=="function"&&typeof w=="function"&&Be&&Be.createHTMLDocument!==void 0;const _t=fs,Oi=ps,_i=gs,Ii=ms,Di=bs,Ni=ys,Zt=Ts,Hi=vs;let Qt=fo,M=null;const dt=H({},[...lo,...Vn,...Gn,...qn,...co]);let L=null;const ut=H({},[...uo,...Yn,...ho,...Mn]);let K=Object.seal(kt(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Ne=null,Jt=null;const oe=Object.seal(kt(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let en=!0,ht=!0,tn=!1,nn=!0,re=!1,ue=!0,he=!1,ft=!1,ze=null,Ue=null,pt=!1,Se=!1,We=!1,je=!1,on=!0,rn=!1;const sn="user-content-";let gt=!0,mt=!1,we={},xe=null;const an=H({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","selectedcontent","style","svg","template","thead","title","video","xmp"]);let ln=null;const cn=H({},["audio","video","img","source","image","track"]);let dn=null;const un=H({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Ke="http://www.w3.org/1998/Math/MathML",Ve="http://www.w3.org/2000/svg",V="http://www.w3.org/1999/xhtml";let Ce=V,bt=!1,yt=null;const Pi=H({},[Ke,Ve,V],Kn),hn=X(["mi","mo","mn","ms","mtext"]);let Tt=H({},hn);const fn=X(["annotation-xml"]);let Et=H({},fn);const Fi=H({},["title","style","font","a","script"]);let He=null;const $i=["application/xhtml+xml","text/html"],Bi="text/html";let _=null,Ae=null;const zi=t.createElement("form"),pn=function(a){return a instanceof RegExp||a instanceof Function},vt=function(){let a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(Ae&&Ae===a)return;(!a||typeof a!="object")&&(a={}),a=ye(a),He=$i.indexOf(a.PARSER_MEDIA_TYPE)===-1?Bi:a.PARSER_MEDIA_TYPE,_=He==="application/xhtml+xml"?Kn:Dt,M=et(a,"ALLOWED_TAGS",dt,{transform:_}),L=et(a,"ALLOWED_ATTR",ut,{transform:_}),yt=et(a,"ALLOWED_NAMESPACES",Pi,{transform:Kn}),dn=et(a,"ADD_URI_SAFE_ATTR",un,{transform:_,base:un}),ln=et(a,"ADD_DATA_URI_TAGS",cn,{transform:_,base:cn}),xe=et(a,"FORBID_CONTENTS",an,{transform:_}),Ne=et(a,"FORBID_TAGS",ye({}),{transform:_}),Jt=et(a,"FORBID_ATTR",ye({}),{transform:_}),we=pe(a,"USE_PROFILES")?a.USE_PROFILES&&typeof a.USE_PROFILES=="object"?ye(a.USE_PROFILES):a.USE_PROFILES:!1,en=a.ALLOW_ARIA_ATTR!==!1,ht=a.ALLOW_DATA_ATTR!==!1,tn=a.ALLOW_UNKNOWN_PROTOCOLS||!1,nn=a.ALLOW_SELF_CLOSE_IN_ATTR!==!1,re=a.SAFE_FOR_TEMPLATES||!1,ue=a.SAFE_FOR_XML!==!1,he=a.WHOLE_DOCUMENT||!1,Se=a.RETURN_DOM||!1,We=a.RETURN_DOM_FRAGMENT||!1,je=a.RETURN_TRUSTED_TYPE||!1,pt=a.FORCE_BODY||!1,on=a.SANITIZE_DOM!==!1,rn=a.SANITIZE_NAMED_PROPS||!1,gt=a.KEEP_CONTENT!==!1,mt=a.IN_PLACE||!1,Qt=ds(a.ALLOWED_URI_REGEXP)?a.ALLOWED_URI_REGEXP:fo,Ce=typeof a.NAMESPACE=="string"?a.NAMESPACE:V,Tt=Xn(a,"MATHML_TEXT_INTEGRATION_POINTS",()=>H({},hn)),Et=Xn(a,"HTML_INTEGRATION_POINTS",()=>H({},fn));const h=Xn(a,"CUSTOM_ELEMENT_HANDLING",()=>kt(null));if(K=kt(null),pe(h,"tagNameCheck")&&pn(h.tagNameCheck)&&(K.tagNameCheck=h.tagNameCheck),pe(h,"attributeNameCheck")&&pn(h.attributeNameCheck)&&(K.attributeNameCheck=h.attributeNameCheck),pe(h,"allowCustomizedBuiltInElements")&&typeof h.allowCustomizedBuiltInElements=="boolean"&&(K.allowCustomizedBuiltInElements=h.allowCustomizedBuiltInElements),te(K),re&&(ht=!1),We&&(Se=!0),we&&(M=H({},co),L=kt(null),we.html===!0&&(H(M,lo),H(L,uo)),we.svg===!0&&(H(M,Vn),H(L,Yn),H(L,Mn)),we.svgFilters===!0&&(H(M,Gn),H(L,Yn),H(L,Mn)),we.mathMl===!0&&(H(M,qn),H(L,ho),H(L,Mn))),oe.tagCheck=null,oe.attributeCheck=null,pe(a,"ADD_TAGS")&&(typeof a.ADD_TAGS=="function"?oe.tagCheck=a.ADD_TAGS:Mt(a.ADD_TAGS)&&(M===dt&&(M=ye(M)),H(M,a.ADD_TAGS,_))),pe(a,"ADD_ATTR")&&(typeof a.ADD_ATTR=="function"?oe.attributeCheck=a.ADD_ATTR:Mt(a.ADD_ATTR)&&(L===ut&&(L=ye(L)),H(L,a.ADD_ATTR,_))),pe(a,"ADD_FORBID_CONTENTS")&&Mt(a.ADD_FORBID_CONTENTS)&&(xe===an&&(xe=ye(xe)),H(xe,a.ADD_FORBID_CONTENTS,_)),gt&&(M["#text"]=!0),he&&H(M,["html","head","body"]),M.table&&(H(M,["tbody"]),delete Ne.tbody),a.TRUSTED_TYPES_POLICY){if(typeof a.TRUSTED_TYPES_POLICY.createHTML!="function")throw Je('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof a.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Je('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const g=N;N=a.TRUSTED_TYPES_POLICY;try{U=ie("")}catch(T){throw N=g,T}}else a.TRUSTED_TYPES_POLICY===null?(N=void 0,U=""):(N===void 0&&(N=Yt()),N&&typeof U=="string"&&(U=ie("")));X&&X(a),Ae=a},gn=H({},[...Vn,...Gn,...us]),mn=H({},[...qn,...hs]),Ui=function(a,h,g){return h.namespaceURI===V?a==="svg":h.namespaceURI===Ke?a==="svg"&&(g==="annotation-xml"||Tt[g]):!!gn[a]},Wi=function(a,h,g){return h.namespaceURI===V?a==="math":h.namespaceURI===Ve?a==="math"&&Et[g]:!!mn[a]},ji=function(a,h,g){return h.namespaceURI===Ve&&!Et[g]||h.namespaceURI===Ke&&!Tt[g]?!1:!mn[a]&&(Fi[a]||!gn[a])},Ki=function(a){let h=w(a);(!h||!h.tagName)&&(h={namespaceURI:Ce,tagName:"template"});const g=Dt(a.tagName),T=Dt(h.tagName);return yt[a.namespaceURI]?a.namespaceURI===Ve?Ui(g,h,T):a.namespaceURI===Ke?Wi(g,h,T):a.namespaceURI===V?ji(g,h,T):!!(He==="application/xhtml+xml"&&yt[a.namespaceURI]):!1},se=function(a){It(e.removed,{element:a});try{w(a).removeChild(a)}catch(h){if(y(a),!w(a))throw Je("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},bn=function(a,h,g){try{m(a,h)}catch(T){try{a.removeAttribute(g)}catch(S){}}},Ge=function(a){qe(a);const h=v(a);if(h){const T=[];rt(h,S=>{It(T,S)}),rt(T,S=>{try{y(S)}catch(x){}})}const g=B(a);if(g)for(let T=g.length-1;T>=0;--T){const S=g[T],x=S&&S.name;typeof x=="string"&&bn(a,S,x)}},fe=function(a,h,g){if(!g)try{g=h.getAttributeNode(a)}catch(T){g=null}It(e.removed,{attribute:g||null,from:h});try{g?m(h,g):h.removeAttribute(a)}catch(T){try{h.removeAttribute(a)}catch(S){}}if(a==="is")if(Se||We)try{se(h)}catch(T){}else try{h.setAttribute(a,"")}catch(T){}},Vi=function(a){const h=B(a);if(h)for(let g=h.length-1;g>=0;--g){const T=h[g],S=T&&T.name;typeof S!="string"||L[_(S)]||bn(a,T,S)}},qe=function(a){const h=[a];for(;h.length>0;){const g=h.pop();J(g)===Te.element&&Vi(g);const T=v(g);if(T)for(let S=T.length-1;S>=0;--S)h.push(T[S])}},yn=function(a,h){return ue?a==="patchsrc"?!0:a==="for"&&h!=="label"&&h!=="output":!1},Gi=function(a){if(!ue)return;const h=[a];for(;h.length>0;){const g=h.pop(),T=J(g);if(T===Te.processingInstruction||T===Te.comment&&ae(go,g.data)){try{y(g)}catch(x){}continue}if(T===Te.element){const x=g,C=_(be(g));try{x.hasAttribute&&x.hasAttribute("patchsrc")&&x.removeAttribute("patchsrc"),x.hasAttribute&&x.hasAttribute("for")&&yn("for",C)&&x.removeAttribute("for")}catch(O){}}const S=v(g);if(S)for(let x=S.length-1;x>=0;--x)h.push(S[x])}},Tn=function(a){let h=null,g=null;if(pt)a="<remove></remove>"+a;else{const x=oo(a,/^[\r\n\t ]+/);g=x&&x[0]}He==="application/xhtml+xml"&&Ce===V&&(a='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+a+"</body></html>");const T=N?ie(a):a;if(Ce===V)try{h=new d().parseFromString(T,He)}catch(x){}if(!h||!h.documentElement){h=Be.createDocument(Ce,"template",null);try{h.documentElement.innerHTML=bt?U:T}catch(x){}}const S=h.body||h.documentElement;return a&&g&&S.insertBefore(t.createTextNode(g),S.childNodes[0]||null),Ce===V?F.call(h,he?"html":"body")[0]:he?h.documentElement:S},En=function(a){const h=z?z(a):a.ownerDocument;return ct.call(h||a,a,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},Ye=function(a){return a=Nt(a,_t," "),a=Nt(a,Oi," "),a=Nt(a,_i," "),a},St=function(a){var h;a.normalize();const g=z?z(a):a.ownerDocument,T=ct.call(g||a,a,c.SHOW_TEXT|c.SHOW_COMMENT|c.SHOW_CDATA_SECTION|c.SHOW_PROCESSING_INSTRUCTION,null);let S=T.nextNode();for(;S;)S.data=Ye(S.data),S=T.nextNode();const x=(h=a.querySelectorAll)===null||h===void 0?void 0:h.call(a,"template");x&&rt(x,C=>{ke(C.content)&&St(C.content)})},Xe=function(a){const h=D?D(a):null;return typeof h!="string"||_(h)!=="form"?!1:typeof a.nodeName!="string"||typeof a.textContent!="string"||typeof a.removeChild!="function"||a.attributes!==B(a)||typeof a.removeAttribute!="function"||typeof a.removeAttributeNode!="function"||typeof a.getAttributeNode!="function"||typeof a.setAttribute!="function"||typeof a.namespaceURI!="string"||typeof a.insertBefore!="function"||typeof a.hasChildNodes!="function"||a.nodeType!==R(a)||a.childNodes!==v(a)},ke=function(a){if(!R||typeof a!="object"||a===null)return!1;try{return R(a)===Te.documentFragment}catch(h){return!1}},Pe=function(a){if(!R||typeof a!="object"||a===null)return!1;try{return typeof R(a)=="number"}catch(h){return!1}};function G(b,a,h){b.length!==0&&rt(b,g=>{g.call(e,a,h,Ae)})}const qi=function(a,h){return!!(ue&&a.hasChildNodes()&&!Pe(a.firstElementChild)&&ae(po,a.textContent)&&ae(po,a.innerHTML)||ue&&a.namespaceURI===V&&xs[h]&&(Pe(a.firstElementChild)||typeof a.textContent=="string"&&ae(Cs[h],a.textContent))||a.nodeType===Te.processingInstruction||ue&&a.nodeType===Te.comment&&ae(go,a.data))},Ze=function(a,h){if(a instanceof RegExp)return ae(a,h);if(a instanceof Function){for(var g=arguments.length,T=new Array(g>2?g-2:0),S=2;S<g;S++)T[S-2]=arguments[S];return!!a(h,...T)}return!1},Yi=function(a,h,g){if(!Ne[h]&&xn(h)&&Ze(K.tagNameCheck,h))return!1;if(gt&&!xe[h]){const T=w(a),S=v(a);if(S&&T){const x=S.length;for(let C=x-1;C>=0;--C){const O=a===g?p(S[C],!0):S[C];T.insertBefore(O,E(a))}}}return se(a),!0},vn=function(a,h,g,T){return a.length===0?h:h===g||h===T?ye(h):h},Me=function(a,h){return a===h||w(a)!==null?!1:(mt&&qe(a),!0)},Sn=function(a,h){if(G(k.beforeSanitizeElements,a,null),Me(a,h))return!0;if(Xe(a))return se(a),!0;const g=_(be(a));if(M=vn(k.uponSanitizeElement,M,dt,ze),G(k.uponSanitizeElement,a,{tagName:g,allowedTags:M}),Me(a,h))return!0;if(qi(a,g))return se(a),!0;if(Ne[g]||!(oe.tagCheck instanceof Function&&oe.tagCheck(g))&&!M[g]){const T=Yi(a,g,h);return T===!1&&(G(k.afterSanitizeElements,a,null),Me(a,h))?!0:T}if(J(a)===Te.element&&!Ki(a)||(g==="noscript"||g==="noembed"||g==="noframes")&&ae(Ss,a.innerHTML))return se(a),!0;if(re&&a.nodeType===Te.text){const T=Ye(a.textContent);a.textContent!==T&&(It(e.removed,{element:a.cloneNode()}),a.textContent=T)}return G(k.afterSanitizeElements,a,null),Me(a,h)},wn=function(a,h,g){if(Jt[h]||yn(h,a)||on&&(h==="id"||h==="name")&&(g in t||g in zi))return!1;const T=L[h]||oe.attributeCheck instanceof Function&&oe.attributeCheck(h,a);return ht&&ae(Ii,h)||en&&ae(Di,h)?!0:T?dn[h]||ae(Qt,Nt(g,Zt,""))||(h==="src"||h==="xlink:href"||h==="href")&&a!=="script"&&ro(g,"data:")===0&&ln[a]||tn&&!ae(Ni,Nt(g,Zt,""))?!0:!g:xn(a)&&Ze(K.tagNameCheck,a)&&Ze(K.attributeNameCheck,h,a)||h==="is"&&K.allowCustomizedBuiltInElements&&Ze(K.tagNameCheck,g)},Xi=H({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),xn=function(a){return!Xi[Dt(a)]&&ae(Hi,a)},Zi=function(a,h,g,T){if(N&&typeof u=="object"&&typeof u.getAttributeType=="function"&&!g)switch(u.getAttributeType(a,h)){case"TrustedHTML":return ie(T);case"TrustedScriptURL":return Ie(T)}return T},Qi=function(a,h,g,T){try{return g?a.setAttributeNS(g,h,T):a.setAttribute(h,T),Xe(a)?(se(a),!1):!0}catch(S){return fe(h,a),!1}},Cn=function(a,h){if(G(k.beforeSanitizeAttributes,a,null),Me(a,h))return;const g=a.attributes;if(!g||Xe(a))return;L=vn(k.uponSanitizeAttribute,L,ut,Ue);const T={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:L,forceKeepAttr:void 0};let S=g.length;const x=_(a.nodeName);for(;S--;){const C=g[S],O=C.name,j=C.namespaceURI,W=C.value,Le=_(O),xt=W;let $=O==="value"?xt:os(xt),An=!1;if(T.attrName=Le,T.attrValue=$,T.keepAttr=!0,T.forceKeepAttr=void 0,G(k.uponSanitizeAttribute,a,T),$=T.attrValue,rn&&(Le==="id"||Le==="name")&&ro($,sn)!==0&&(fe(O,a,C),$=sn+$,An=!0),ue&&ae(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,$)){fe(O,a,C);continue}if(Le==="attributename"&&oo($,"href")){fe(O,a,C);continue}if(!T.forceKeepAttr){if(!T.keepAttr){fe(O,a,C);continue}if(!nn&&ae(ws,$)){fe(O,a,C);continue}if(re&&($=Ye($)),!wn(x,Le,$)){fe(O,a,C);continue}$=Zi(x,Le,j,$),$!==xt&&Qi(a,O,j,$)&&An&&io(e.removed)}}G(k.afterSanitizeAttributes,a,null),Me(a,h)},Qe=function(a){let h=null;const g=En(a);for(G(k.beforeSanitizeShadowDOM,a,null);h=g.nextNode();)if(G(k.uponSanitizeShadowNode,h,null),Sn(h,a),Cn(h,a),ke(h.content)&&Qe(h.content),J(h)===Te.element){const T=A(h);ke(T)&&(wt(T),Qe(T))}G(k.afterSanitizeShadowDOM,a,null)},wt=function(a){const h=[{node:a,shadow:null}];for(;h.length>0;){const g=h.pop();if(g.shadow){Qe(g.shadow);continue}const T=g.node,S=J(T)===Te.element,x=v(T);if(x)for(let C=x.length-1;C>=0;--C)h.push({node:x[C],shadow:null});if(S){const C=D?D(T):null;if(typeof C=="string"&&_(C)==="template"){const O=T.content;ke(O)&&h.push({node:O,shadow:null})}}if(S){const C=A(T);ke(C)&&h.push({node:null,shadow:C},{node:C,shadow:null})}}};return e.sanitize=function(b){let a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},h=null,g=null,T=null,S=null;if(bt=!b,bt&&(b="<!-->"),typeof b!="string"&&!Pe(b)&&(b=cs(b),typeof b!="string"))throw Je("dirty is not a string, aborting");if(!e.isSupported)return b;ft?(M=ze,L=Ue):vt(a),(k.uponSanitizeElement.length>0||k.uponSanitizeAttribute.length>0)&&(M=ye(M)),k.uponSanitizeAttribute.length>0&&(L=ye(L)),e.removed=[];const x=mt&&typeof b!="string"&&Pe(b);if(x){Gi(b);const j=be(b);if(typeof j=="string"){const W=_(j);if(!M[W]||Ne[W])throw Ge(b),Je("root node is forbidden and cannot be sanitized in-place")}if(Xe(b))throw Ge(b),Je("root node is clobbered and cannot be sanitized in-place");try{wt(b)}catch(W){throw Ge(b),W}}else if(Pe(b))h=Tn("<!---->"),g=h.ownerDocument.importNode(b,!0),g.nodeType===Te.element&&g.nodeName==="BODY"||g.nodeName==="HTML"?h=g:h.appendChild(g),wt(h);else{if(!Se&&!re&&!he&&b.indexOf("<")===-1)return N&&je?ie(b):b;if(h=Tn(b),!h)return Se?null:je?U:""}h&&pt&&se(h.firstChild);const C=x?b:h;try{const j=En(C);for(;T=j.nextNode();)Sn(T,C),Cn(T,C),ke(T.content)&&Qe(T.content)}catch(j){throw x&&(Ge(b),rt(e.removed,W=>{W.element&&qe(W.element)})),j}if(x){let j=!1;if(rt(e.removed,W=>{W.element&&(W.element===b&&(j=!0),qe(W.element))}),j)throw Je("a node selected for removal could not be safely returned; refusing to sanitize in place");return re&&St(b),b}if(Se){if(re&&St(h),We)for(S=Xt.call(h.ownerDocument);h.firstChild;)S.appendChild(h.firstChild);else S=h;return(L.shadowroot||L.shadowrootmode)&&(S=$e.call(n,S,!0)),S}let O=he?h.outerHTML:h.innerHTML;return he&&M["!doctype"]&&h.ownerDocument&&h.ownerDocument.doctype&&h.ownerDocument.doctype.name&&ae(Es,h.ownerDocument.doctype.name)&&(O="<!DOCTYPE "+h.ownerDocument.doctype.name+`>
|
|
11
|
-
`+O),re&&(O=Ye(O)),N&&je?ie(O):O},e.setConfig=function(){let b=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};vt(b),ft=!0,ze=M,Ue=L},e.clearConfig=function(){Ae=null,ft=!1,ze=null,Ue=null,N=ee,U=""},e.isValidAttribute=function(b,a,h){Ae||vt({});const g=_(b),T=_(a);return wn(g,T,h)},e.addHook=function(b,a){typeof a=="function"&&pe(k,b)&&It(k[b],a)},e.removeHook=function(b,a){if(pe(k,b)){if(a!==void 0){const h=ns(k[b],a);return h===-1?void 0:is(k[b],h,1)[0]}return io(k[b])}},e.removeHooks=function(b){pe(k,b)&&(k[b]=[])},e.removeAllHooks=function(){k=bo()},e}var Ln=yo();const Ms=["p","br","strong","em","u","s","strike","del","b","i","h1","h2","h3","h4","h5","h6","ul","ol","li","a","img","video","audio","table","thead","tbody","tr","th","td","blockquote","pre","code","span","div","section","figure","figcaption","sup","sub","hr"],Ls={"*":["class","style","id","data-*","role","aria-*","tabindex","contenteditable","spellcheck","dir","lang"],a:["href","target","rel","title"],img:["src","alt","width","height","loading"],video:["src","controls","width","height","autoplay","loop","muted"],audio:["src","controls","autoplay","loop","muted"],ol:["start","reversed"],table:["border","cellpadding","cellspacing"],td:["colspan","rowspan","align","valign"],th:["colspan","rowspan","align","valign"],iframe:["src","width","height","name","title","frameborder","scrolling","allowfullscreen","longdesc","allow"]},Rs="data-editora-embed";function Os(r){if(!r||/\s/.test(r.trim()))return!1;try{const e=new URL(r.trim());return(e.protocol==="https:"||e.protocol==="http:")&&e.hostname.length>0}catch(e){return!1}}function To(r,e,t,n){if((e==null?void 0:e.sanitize)===!1)return r;const i=e!=null&&e.allowedTags&&e.allowedTags.length>0?e.allowedTags:Ms,o=t!=null&&t.length?Array.from(new Set([...i,...t])):i,l=!!(e!=null&&e.allowedAttributes)&&Object.keys(e.allowedAttributes).length>0?e.allowedAttributes:Ls,c=new Set;for(const f of Object.values(l))for(const p of f)c.add(p);const d={ALLOWED_TAGS:o,ALLOWED_ATTR:Array.from(c)};if(!n)return Ln.sanitize(r,d);const u=o.includes("iframe");Ln.addHook("uponSanitizeElement",(f,p)=>{var m;if(p.tagName!=="iframe")return;const y=f;p.allowedTags.iframe=u||((m=y.getAttribute)==null?void 0:m.call(y,Rs))==="true"&&Os(y.getAttribute("src"))});try{return Ln.sanitize(r,d)}finally{Ln.removeHook("uponSanitizeElement")}}function _s(r,e,t,n){return To(r,e,n,!1)}function Is(r,e,t){return(t==null?void 0:t.sanitizeOnPaste)===!1?r:_s(r,e)}function Eo(r,e,t,n){return(t==null?void 0:t.sanitizeOnInput)===!1?r:To(r,e,n,!0)}const Ds=".resize-handle, .table-resize-handle, [data-rte-media-pending]",Ns=/resize-handle|data-rte-media-pending|rte-media/;function vo(r){if(!r||!Ns.test(r))return r;const e=document.createElement("template");e.innerHTML=r;const t=new Set;return e.content.querySelectorAll(Ds).forEach(n=>{const i=n.parentElement;i&&(i.tagName==="TD"||i.tagName==="TH")&&t.add(i),n.remove()}),t.forEach(n=>{var i;n.style.position==="relative"&&(n.style.removeProperty("position"),(i=n.getAttribute("style"))!=null&&i.trim()||n.removeAttribute("style"))}),e.content.querySelectorAll("figure.rte-media").forEach(n=>{var o;n.removeAttribute("contenteditable");const i=n.querySelector(":scope > figcaption");i&&(i.removeAttribute("contenteditable"),!((o=i.textContent)!=null&&o.trim())&&!i.querySelector("img, video, a")&&i.remove())}),e.innerHTML}function Pt(r){return r?vo(r.innerHTML):""}const Un=class Un{static resolve(e){const t={};if(Object.assign(t,this.EDITOR_DEFAULTS),e.pluginDefaults&&Object.assign(t,e.pluginDefaults),e.attributes){const n=this.parseAttributes(e.attributes);Object.assign(t,n)}return e.jsConfig&&Object.assign(t,e.jsConfig),this.normalizeConfig(t)}static normalizeConfig(e){const t={...e};if(t.toolbarFloating!==void 0||t.toolbarSticky!==void 0){const s=typeof t.toolbar=="object"&&t.toolbar?{...t.toolbar}:typeof t.toolbar=="string"?{items:t.toolbar}:{};t.toolbarFloating!==void 0&&(s.floating=!!t.toolbarFloating),t.toolbarSticky!==void 0&&(s.sticky=!!t.toolbarSticky),t.toolbar=s}if(t.toolbarItems!==void 0&&typeof t.toolbar=="object"&&t.toolbar&&(t.toolbar.items=t.toolbarItems),t.autosaveEnabled!==void 0||t.autosaveIntervalMs!==void 0||t.autosaveStorageKey!==void 0||t.autosaveProvider!==void 0||t.autosaveApiUrl!==void 0){const s=typeof t.autosave=="object"&&t.autosave?{...t.autosave}:{};t.autosaveEnabled!==void 0&&(s.enabled=!!t.autosaveEnabled),t.autosaveIntervalMs!==void 0&&(s.intervalMs=Number(t.autosaveIntervalMs)),t.autosaveStorageKey!==void 0&&(s.storageKey=t.autosaveStorageKey),t.autosaveProvider!==void 0&&(s.provider=t.autosaveProvider),t.autosaveApiUrl!==void 0&&(s.apiUrl=t.autosaveApiUrl),t.autosave=s}const n={enabled:!1,intervalMs:3e4,storageKey:"rte-autosave",provider:"localStorage",apiUrl:""};if(typeof t.autosave=="boolean")t.autosave={...n,enabled:t.autosave};else if(typeof t.autosave=="object"&&t.autosave){const s={...n,...t.autosave};s.intervalMs===void 0&&s.interval!==void 0&&(s.intervalMs=Number(s.interval)),s.enabled===void 0&&(s.enabled=!0),(!Number.isFinite(s.intervalMs)||s.intervalMs<=0)&&(s.intervalMs=n.intervalMs),t.autosave=s}else t.autosave=n;if(t.languageLocale!==void 0||t.languageDirection!==void 0){const s=typeof t.language=="object"&&t.language?{...t.language}:{};t.languageLocale!==void 0&&(s.locale=t.languageLocale),t.languageDirection!==void 0&&(s.direction=t.languageDirection),t.language=s}const i={locale:"en",direction:"ltr"};if(typeof t.language=="string"?t.language={locale:t.language,direction:i.direction}:typeof t.language=="object"&&t.language?t.language={...i,...t.language}:t.language=i,t.spellcheckEnabled!==void 0||t.spellcheckProvider!==void 0||t.spellcheckApiUrl!==void 0){const s=typeof t.spellcheck=="object"&&t.spellcheck?{...t.spellcheck}:{};t.spellcheckEnabled!==void 0&&(s.enabled=!!t.spellcheckEnabled),t.spellcheckProvider!==void 0&&(s.provider=t.spellcheckProvider),t.spellcheckApiUrl!==void 0&&(s.apiUrl=t.spellcheckApiUrl),t.spellcheck=s}const o={enabled:!1,provider:"browser",apiUrl:""};if(typeof t.spellcheck=="boolean")t.spellcheck={...o,enabled:t.spellcheck};else if(typeof t.spellcheck=="object"&&t.spellcheck){const s={...o,...t.spellcheck};!s.provider&&s.mode&&(s.provider=s.mode==="local"?"browser":"api"),s.enabled===void 0&&(s.enabled=!!(s.mode||s.provider||s.apiUrl)),t.spellcheck=s}else t.spellcheck=o;return t.contextMenuEnabled!==void 0&&(t.contextMenu={enabled:!!t.contextMenuEnabled}),typeof t.contextMenu=="boolean"?t.contextMenu={enabled:t.contextMenu}:typeof t.contextMenu=="object"&&t.contextMenu?t.contextMenu={enabled:t.contextMenu.enabled!==!1}:t.contextMenu={enabled:!0},(t.pasteClean!==void 0||t.pasteKeepFormatting!==void 0||t.pasteConvertWord!==void 0)&&(t.paste={...t.paste||{},...t.pasteClean!==void 0?{clean:!!t.pasteClean}:{},...t.pasteKeepFormatting!==void 0?{keepFormatting:!!t.pasteKeepFormatting}:{},...t.pasteConvertWord!==void 0?{convertWord:!!t.pasteConvertWord}:{}}),t.paste={clean:!0,keepFormatting:!1,convertWord:!0,...t.paste||{}},t.contentConfig={allowedTags:[],allowedAttributes:{},sanitize:!0,...t.contentConfig||{}},(t.securitySanitizeOnPaste!==void 0||t.securitySanitizeOnInput!==void 0)&&(t.security={...t.security||{},...t.securitySanitizeOnPaste!==void 0?{sanitizeOnPaste:!!t.securitySanitizeOnPaste}:{},...t.securitySanitizeOnInput!==void 0?{sanitizeOnInput:!!t.securitySanitizeOnInput}:{}}),t.security={sanitizeOnPaste:!0,sanitizeOnInput:!0,...t.security||{}},(t.accessibilityEnableAria!==void 0||t.accessibilityKeyboardNavigation!==void 0||t.accessibilityChecker!==void 0)&&(t.accessibility={...t.accessibility||{},...t.accessibilityEnableAria!==void 0?{enableARIA:!!t.accessibilityEnableAria}:{},...t.accessibilityKeyboardNavigation!==void 0?{keyboardNavigation:!!t.accessibilityKeyboardNavigation}:{},...t.accessibilityChecker!==void 0?{checker:!!t.accessibilityChecker}:{}}),typeof t.accessibility=="boolean"&&(t.accessibility={enableARIA:t.accessibility,keyboardNavigation:t.accessibility,checker:!1}),t.accessibility={enableARIA:!0,keyboardNavigation:!0,checker:!1,...t.accessibility||{}},(t.performanceDebounceInputMs!==void 0||t.performanceViewportOnlyScan!==void 0)&&(t.performance={...t.performance||{},...t.performanceDebounceInputMs!==void 0?{debounceInputMs:Number(t.performanceDebounceInputMs)}:{},...t.performanceViewportOnlyScan!==void 0?{viewportOnlyScan:!!t.performanceViewportOnlyScan}:{}}),typeof t.performance=="boolean"&&(t.performance={debounceInputMs:100,viewportOnlyScan:t.performance}),t.performance={debounceInputMs:100,viewportOnlyScan:!0,...t.performance||{}},(typeof t.performance.debounceInputMs!="number"||!Number.isFinite(t.performance.debounceInputMs)||t.performance.debounceInputMs<0)&&(t.performance.debounceInputMs=100),t}static parseAttributes(e){const t={};for(const[n,i]of Object.entries(e)){const o=this.kebabToCamel(n);t[o]=this.BOOLEAN_ATTRIBUTES.has(n)&&(i===""||i===n)?!0:this.parseAttributeValue(i)}return t}static parseAttributeValue(e){if(e==="true")return!0;if(e==="false")return!1;if(/^\d+$/.test(e))return parseInt(e,10);if(/^\d+\.\d+$/.test(e))return parseFloat(e);if(e.startsWith("{")||e.startsWith("["))try{return JSON.parse(e)}catch(t){return e}return e}static kebabToCamel(e){return e.replace(/-([a-z])/g,(t,n)=>n.toUpperCase())}static validate(e){const t=[];return e.height!==void 0&&typeof e.height=="number"&&e.height<0&&t.push("height must be a positive number"),e.width!==void 0&&typeof e.width=="number"&&e.width<0&&t.push("width must be a positive number"),e.plugins!==void 0&&!Array.isArray(e.plugins)&&typeof e.plugins!="string"&&t.push("plugins must be an array or string"),e.theme!==void 0&&typeof e.theme!="string"&&t.push("theme must be a string"),{valid:t.length===0,errors:t}}static getDefaults(){return{...this.EDITOR_DEFAULTS}}static merge(...e){const t={};for(const n of e)for(const[i,o]of Object.entries(n))o!=null&&(typeof o=="object"&&!Array.isArray(o)&&t[i]?t[i]=this.merge(t[i],o):t[i]=o);return t}};Un.EDITOR_DEFAULTS={height:400,width:"100%",readonly:!1,disabled:!1,menubar:!0,toolbar:!0,plugins:[],theme:"light",content:"",placeholder:"Start typing...",autofocus:!1,autosave:!1,accessibility:{enableARIA:!0,keyboardNavigation:!0,checker:!1},performance:{debounceInputMs:100,viewportOnlyScan:!0},spellcheck:{enabled:!1,provider:"browser",apiUrl:""},language:{locale:"en",direction:"ltr"},contextMenu:{enabled:!0},contentConfig:{allowedTags:[],allowedAttributes:{},sanitize:!0},paste:{clean:!0,keepFormatting:!1,convertWord:!0},security:{sanitizeOnPaste:!0,sanitizeOnInput:!0},statusbar:!1},Un.BOOLEAN_ATTRIBUTES=new Set(["readonly","disabled","autofocus","statusbar","toolbar-floating","toolbar-sticky","autosave-enabled","accessibility-enable-aria","accessibility-keyboard-navigation","accessibility-checker","performance-viewport-only-scan","spellcheck-enabled","context-menu-enabled","paste-clean","paste-keep-formatting","paste-convert-word","security-sanitize-on-paste","security-sanitize-on-input"]);let Zn=Un;const Hs='.editora-editor{display:flex;flex-direction:column;border:1px solid #ddd;border-radius:4px;background:#fff;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,sans-serif;font-size:14px;overflow:hidden}.editora-editor *{box-sizing:border-box}.editora-theme-light{background:#fff;color:#333}.editora-theme-dark{--editora-dark-toolbar-bg-start: #353d48;--editora-dark-toolbar-bg-end: #2d3540;--editora-dark-button-bg-start: #46505f;--editora-dark-button-bg-end: #3b4553;--editora-dark-button-hover-start: #525d6d;--editora-dark-button-hover-end: #465262;--editora-dark-button-active-start: #5eaaf6;--editora-dark-button-active-end: #4a95de;--editora-dark-border: #475263;--editora-dark-border-strong: #566275;--editora-dark-text: #e1e9f5;--editora-dark-text-strong: #f3f7ff;--editora-dark-text-muted: #aeb9cc;--editora-dark-surface: #1d242d;--editora-dark-content: #1f2732;background:linear-gradient(180deg,#1b2330,#1c2430);color:var(--editora-dark-text);border-color:var(--editora-dark-border)}.editora-toolbar{display:flex;align-items:center;gap:4px;padding:8px;background:#f5f5f5;border-bottom:1px solid #ddd;flex-wrap:wrap}.editora-theme-dark .editora-toolbar{background:linear-gradient(180deg,var(--editora-dark-toolbar-bg-start) 0%,var(--editora-dark-toolbar-bg-end) 100%);border-bottom-color:var(--editora-dark-border);box-shadow:inset 0 1px #ffffff0d}.editora-toolbar-sticky{position:sticky;top:0;z-index:100;position:-webkit-sticky}.editora-toolbar-group{display:flex;align-items:center;gap:2px}.editora-toolbar-button{padding:6px 12px;border:1px solid #ccc;background:#fff;cursor:pointer;border-radius:3px;font-weight:600;font-size:14px;height:30px;display:flex;align-items:center;white-space:nowrap}.editora-toolbar-group-button{display:flex;align-items:center}.editora-toolbar-input.font-size{width:40px;padding:.25rem;text-align:center;font-size:14px;background:#fff;border:1px solid var(--rte-color-border-light);border-radius:var(--rte-radius-sm)}.editora-toolbar-group-items{display:flex;align-items:center;border:1px solid #ccc;.editora-toolbar-button{border:none;border-radius:0;&:first-child{border-right:1px solid #ccc;border-top-left-radius:3px;border-bottom-left-radius:3px}&:last-child{border:0px solid #ccc;border-radius:0!important}&:hover{background:#e0e0e0;border-color:#ccc}}}.editora-theme-dark .editora-toolbar-button{background:linear-gradient(180deg,var(--editora-dark-button-bg-start) 0%,var(--editora-dark-button-bg-end) 100%);border-color:var(--editora-dark-border-strong);color:var(--editora-dark-text);box-shadow:inset 0 1px #ffffff14,0 1px 1px #00000059}.editora-theme-dark .editora-toolbar-group-items{border-color:var(--editora-dark-border-strong);background:linear-gradient(180deg,var(--editora-dark-button-bg-start) 0%,var(--editora-dark-button-bg-end) 100%)}.editora-theme-dark .editora-toolbar-group-items .editora-toolbar-button:first-child{border-right-color:#566275}.editora-theme-dark .editora-toolbar-group-items .editora-toolbar-button:last-child{border-left-color:#566275}.editora-theme-dark .editora-toolbar-input.font-size{background-color:#2e3642;color:var(--editora-dark-text-strong);border-color:var(--editora-dark-border-strong);caret-color:var(--editora-dark-text-strong)}.editora-theme-dark .editora-toolbar-input.font-size::placeholder{color:var(--editora-dark-text-strong);opacity:1}.editora-toolbar-button:hover{background:#e0e0e0;border-color:#ccc}.editora-theme-dark .editora-toolbar-button:hover{background:linear-gradient(180deg,var(--editora-dark-button-hover-start) 0%,var(--editora-dark-button-hover-end) 100%);border-color:#66748a;color:var(--editora-dark-text-strong)}.editora-toolbar-button:active,.editora-toolbar-button.active{background:#d0d0d0;border-color:#999}.editora-theme-dark .editora-toolbar-button:active,.editora-theme-dark .editora-toolbar-button.active{background:linear-gradient(180deg,var(--editora-dark-button-active-start) 0%,var(--editora-dark-button-active-end) 100%);border-color:#67adf4;color:#0f1b2a}.editora-theme-dark .editora-toolbar-button:disabled{background:#313946;border-color:#424d5e;color:#7f8ca1}.editora-theme-dark .editora-toolbar-button[data-command=insertTable],.editora-theme-dark .editora-toolbar-button[data-command=print],.editora-theme-dark .editora-toolbar-button[data-command=toggleSpellCheck],.editora-theme-dark .editora-toolbar-button[data-command=toggleA11yChecker],.editora-theme-dark .editora-toolbar-button[data-command=setDirectionLTR],.editora-theme-dark .editora-toolbar-button[data-command=setDirectionRTL]{color:#f1f6ff}.editora-toolbar-button:disabled{opacity:.5;cursor:not-allowed}.editora-toolbar-icon{display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;line-height:1}.editora-toolbar-button svg,.editora-toolbar-icon svg{width:20px;height:20px;display:block;color:currentColor}.editora-theme-dark .editora-toolbar-button svg:not([fill=none i]),.editora-theme-dark .editora-toolbar-icon svg:not([fill=none i]){fill:currentColor}.editora-theme-dark .editora-toolbar-icon,.editora-theme-dark .editora-toolbar-icon *{color:inherit}.editora-theme-dark :is(.editora-toolbar-button,.editora-toolbar-icon) svg :is([stroke="#000" i],[stroke="#000000" i],[stroke=black i],[stroke="#0f0f0f" i],[stroke="#111111" i],[style*="stroke:#000" i],[style*="stroke: #000" i],[style*="stroke:black" i],[style*="stroke: black" i],[style*="stroke:#0f0f0f" i],[style*="stroke: #0f0f0f" i]){stroke:currentColor!important}.editora-theme-dark :is(.editora-toolbar-button,.editora-toolbar-icon) svg :is([fill="#000" i],[fill="#000000" i],[fill=black i],[fill="#0f0f0f" i],[fill="#111111" i],[style*="fill:#000" i],[style*="fill: #000" i],[style*="fill:black" i],[style*="fill: black" i],[style*="fill:#0f0f0f" i],[style*="fill: #0f0f0f" i]){fill:currentColor!important}.editora-toolbar-separator{width:1px;height:24px;background:#ddd;margin:0 4px}.editora-theme-dark .editora-toolbar-separator{background:#4d596b}.editora-toolbar-items-container{display:flex;align-items:center;gap:4px;flex:1;min-width:0;overflow:hidden}.editora-toolbar-more-button{display:flex;align-items:center;justify-content:center;width:30px;height:30px;flex-shrink:0;padding:0;border:1px solid #ccc;background:#fff;cursor:pointer;border-radius:3px;font-size:16px}.editora-toolbar-more-button:hover{background:#e0e0e0}.editora-toolbar-more-button.active{background:#d0d0d0;border-color:#999}.editora-theme-dark .editora-toolbar-more-button{background:var(--editora-dark-content);border-color:var(--editora-dark-border);color:var(--editora-dark-text)}.editora-theme-dark .editora-toolbar-more-button:hover,.editora-theme-dark .editora-toolbar-more-button.active{background:#3a4554;border-color:#607088}.editora-toolbar-expanded-row{display:none;flex-wrap:wrap;align-items:center;gap:4px;width:100%;padding:8px;border-top:1px solid #ddd;background:#f5f5f5}.editora-toolbar-expanded-row.show{display:flex}.editora-theme-dark .editora-toolbar-expanded-row{border-top-color:var(--editora-dark-border);background:linear-gradient(180deg,var(--editora-dark-toolbar-bg-start) 0%,var(--editora-dark-toolbar-bg-end) 100%)}.editora-toolbar-dropdown{position:relative}.editora-toolbar-dropdown-menu{position:absolute;top:100%;left:0;min-width:150px;margin-top:4px;padding:4px 0;background:#fff;border:1px solid #ddd;border-radius:4px;box-shadow:0 2px 8px #00000026;z-index:1000}.editora-theme-dark .editora-toolbar-dropdown-menu{background:#29323d;border-color:#4d596b;box-shadow:0 8px 20px #00000073}.editora-toolbar-dropdown-item{display:block;width:100%;padding:8px 12px;border:none;background:transparent;color:#333;text-align:left;cursor:pointer;font-size:13px;transition:background .15s ease}.editora-theme-dark .editora-toolbar-dropdown-item{color:#d7deea}.editora-toolbar-dropdown-item:hover{background:#f5f5f5}.editora-theme-dark .editora-toolbar-dropdown-item:hover{background:#3a4554;color:#f0f6ff}.editora-content{flex:1;min-height:200px;padding:16px;outline:none;overflow-y:auto;line-height:1.6}.editora-theme-dark .editora-content{color:#ecf3ff;background:linear-gradient(180deg,var(--editora-dark-content) 0%,#1c232e 100%)}.editora-content:empty:before{content:attr(data-placeholder);color:#999;pointer-events:none}.editora-theme-dark .editora-content:empty:before{color:#8f9bb0}.editora-content h1{font-size:2em;margin:.67em 0;font-weight:600}.editora-content h2{font-size:1.5em;margin:.75em 0;font-weight:600}.editora-content h3{font-size:1.17em;margin:.83em 0;font-weight:600}.editora-content p{margin:1em 0}.editora-theme-dark .editora-content,.editora-theme-dark .editora-content :is(p,span,div,li,ul,ol,td,th,h1,h2,h3,h4,h5,h6,strong,em,u,s,small,sub,sup,blockquote,code,pre,a){color:#ecf3ff}.editora-content ul,.editora-content ol{margin:1em 0;padding-left:2em}.editora-content a{color:#06c;text-decoration:underline}.editora-theme-dark .editora-content a{color:#ecf3ff}.editora-content code{padding:2px 4px;background:#f5f5f5;border-radius:3px;font-family:Monaco,Menlo,Consolas,monospace;font-size:.9em}.editora-theme-dark .editora-content code{background:#1e1e1e}.editora-content pre{padding:12px;background:#f5f5f5;border-radius:4px;overflow-x:auto;margin:1em 0}.editora-theme-dark .editora-content pre{background:#1e1e1e}.editora-theme-dark .rte-code-block{background:linear-gradient(180deg,#212a36,#1b2430)!important;border-color:#4f5b70!important;color:#e7effc!important}.editora-theme-dark .rte-code-block code{color:#e7effc!important}.editora-theme-dark .rte-code-block:before{background:#111927!important;color:#dce8ff!important}.editora-theme-dark .rte-code-block .rte-code-copy{background:#2b3441!important;border-color:#5a667b!important;color:#dce8ff!important}.editora-content blockquote{margin:1em 0;padding-left:1em;border-left:4px solid #ddd;color:#666}.editora-theme-dark .editora-content blockquote{border-left-color:#3c3c3c;color:#ecf3ff}.editora-floating-toolbar{position:absolute;padding:4px;background:#fff;border:1px solid #ddd;border-radius:4px;box-shadow:0 2px 8px #00000026;z-index:1000}.editora-theme-dark .editora-floating-toolbar{background:#29323d;border-color:#4d596b;box-shadow:0 8px 20px #00000073}.editora-statusbar-container{display:flex;flex-direction:column}.editora-statusbar-left{display:flex;align-items:center;gap:8px}.editora-statusbar-right{display:flex;align-items:center;gap:8px;margin-left:auto}.editora-statusbar{display:flex;align-items:center;gap:12px;padding:6px 12px;background:#f5f5f5;border-top:1px solid #ddd;font-size:12px;color:#666}.editora-theme-dark .editora-statusbar{background:linear-gradient(180deg,#2c3440,#252d37);border-top-color:#3f4a5b;color:#d7deea}.editora-statusbar-item{white-space:nowrap}.editora-statusbar-separator{color:#ddd}.editora-theme-dark .editora-statusbar-separator{color:#566275}.editora-editor[readonly] .editora-content{background:#fafafa;cursor:not-allowed}.editora-theme-dark.editora-editor[readonly] .editora-content{background:#1a1a1a}.editora-editor:focus-within{border-color:#06c;box-shadow:0 0 0 3px #0066cc1a}.editora-theme-dark.editora-editor:focus-within{border-color:#4db8ff;box-shadow:0 0 0 3px #4db8ff1a}.editora-editor[disabled]{opacity:.6;pointer-events:none}@media(max-width:768px){.editora-toolbar{padding:4px}.editora-toolbar-button{min-width:28px;min-height:28px;padding:4px 8px;font-size:12px}.editora-content{padding:12px}}.editora-content ::selection{background:#06c3}.editora-theme-dark .editora-content ::selection{background:#4db8ff33}.editora-content table{border-collapse:collapse;width:100%;margin:1em 0}.editora-content th,.editora-content td{border:1px solid #ddd;padding:8px 12px;text-align:left}.editora-theme-dark .editora-content th,.editora-theme-dark .editora-content td{border-color:#3c3c3c}.editora-content th{background:#f5f5f5;font-weight:600}.editora-theme-dark .editora-content th{background:#252526}.editora-content img{max-width:100%;height:auto;border-radius:4px;display:block}.editora-content video{max-width:100%;height:auto;border-radius:4px;display:block}.editora-editor.loading{opacity:.7;pointer-events:none}.editora-editor.loading:after{content:"";position:absolute;top:50%;left:50%;width:24px;height:24px;margin:-12px 0 0 -12px;border:3px solid #ddd;border-top-color:#06c;border-radius:50%;animation:editora-spin .8s linear infinite}@keyframes editora-spin{to{transform:rotate(360deg)}}.toolbar-container-wrapper{display:flex;align-items:center;background:#fff;border-bottom:1px solid #e0e0e0;padding:0;margin:0;width:100%;box-sizing:border-box;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,sans-serif;font-size:14px;line-height:1.5;position:relative}.toolbar-container-wrapper[data-toolbar-sticky=true]{position:sticky;top:0;z-index:999;box-shadow:0 2px 4px #0000001a}.toolbar-container-wrapper[data-toolbar-floating=true]{position:fixed;top:0;left:0;right:0;z-index:1000;box-shadow:0 4px 12px #00000026}.toolbar-container-wrapper[data-toolbar-position=bottom]{border-bottom:none;border-top:1px solid #e0e0e0}.toolbar-container-wrapper .toolbar-wrapper{display:flex;width:100%;padding:8px;gap:4px;flex-wrap:wrap;align-items:center}.toolbar-container-wrapper .toolbar{display:flex;width:100%;gap:4px;flex-wrap:wrap;align-items:center}.toolbar-container-wrapper .toolbar-container{display:flex;gap:4px;flex-wrap:wrap;align-items:center;flex:1;position:relative}.toolbar-container-wrapper .toolbar-item{display:flex;align-items:center;gap:2px}.toolbar-container-wrapper .toolbar-button{padding:6px 10px;border:1px solid #d1d5db;background:#fff;border-radius:4px;cursor:pointer;font-size:13px;display:flex;align-items:center;justify-content:center;gap:4px;transition:all .15s ease;min-height:32px;white-space:nowrap}.toolbar-container-wrapper .toolbar-button:hover{background-color:#f3f4f6;border-color:#9ca3af}.toolbar-container-wrapper .toolbar-button:active,.toolbar-container-wrapper .toolbar-button[data-active=true]{background-color:#06c;color:#fff;border-color:#0052a3;box-shadow:inset 0 1px 3px #0000001a}.toolbar-container-wrapper .toolbar-button:disabled{opacity:.5;cursor:not-allowed;background-color:#f9fafb}.toolbar-container-wrapper .toolbar-more-button{padding:6px 8px;font-size:16px;font-weight:500;line-height:1}.toolbar-container-wrapper .toolbar-separator{width:1px;height:24px;background-color:#d1d5db;margin:0 4px}.toolbar-container-wrapper .toolbar-icon{display:inline-flex;align-items:center;justify-content:center;width:18px;height:18px;flex-shrink:0}.toolbar-container-wrapper .toolbar-icon svg{width:100%;height:100%}.toolbar-container-wrapper .toolbar-dropdown{position:relative;display:flex;align-items:center}.toolbar-container-wrapper .toolbar-dropdown-arrow{font-size:10px;margin-left:2px;line-height:1}.toolbar-container-wrapper .toolbar-dropdown-menu{position:absolute;top:100%;left:0;background:#fff;border:1px solid #d1d5db;border-radius:6px;box-shadow:0 4px 12px #00000026;z-index:1000;min-width:160px;padding:4px 0;margin-top:4px;display:none}.toolbar-container-wrapper .toolbar-dropdown-menu.show{display:block}.toolbar-container-wrapper .toolbar-dropdown-item{display:block;width:100%;padding:8px 12px;border:none;background:transparent;text-align:left;cursor:pointer;font-size:13px;color:#1f2937;transition:background-color .15s ease;font-family:inherit}.toolbar-container-wrapper .toolbar-dropdown-item:hover{background-color:#f3f4f6}.toolbar-container-wrapper .toolbar-dropdown-item:active{background-color:#e5e7eb}.toolbar-container-wrapper .toolbar-input{padding:6px 8px;border:1px solid #d1d5db;border-radius:4px;font-size:13px;font-family:inherit;background-color:#fff;color:#1f2937;transition:all .15s ease}.toolbar-container-wrapper .toolbar-input:focus{outline:none;border-color:#06c;box-shadow:0 0 0 3px #0066cc1a;background-color:#fff}.toolbar-container-wrapper .toolbar-input::placeholder{color:#9ca3af}.toolbar-overflow-menu{animation:slideDown .2s ease-out}@keyframes slideDown{0%{opacity:0;transform:translateY(-8px)}to{opacity:1;transform:translateY(0)}}.toolbar-overflow-item{transition:background-color .15s ease}.floating-toolbar{user-select:none;-webkit-user-select:none;font-family:system-ui,-apple-system,sans-serif;font-size:14px;animation:fadeInUp .15s ease-out}@keyframes fadeInUp{0%{opacity:0;transform:translate(-50%) translateY(10px)}to{opacity:1;transform:translate(-50%) translateY(0)}}.floating-toolbar-btn{display:flex;align-items:center;justify-content:center;width:32px;height:32px;border:none;background:transparent;border-radius:4px;color:#495057;cursor:pointer;font-size:14px;font-weight:500;transition:all .15s ease;outline:none}.floating-toolbar-btn:hover{background:#f8f9fa;color:#212529}.floating-toolbar-btn:active{background:#e9ecef;transform:scale(.95)}.floating-toolbar-btn.floating-toolbar-toggle{color:#dc3545;font-weight:700}.floating-toolbar-btn.floating-toolbar-toggle:hover{background:#f8d7da;color:#721c24}.floating-toolbar-separator{width:1px;height:20px;background:#e1e5e9;margin:0 2px}@media(max-width:768px){.toolbar-container-wrapper .toolbar-button{padding:5px 8px;font-size:12px;min-height:28px}.toolbar-container-wrapper .toolbar-icon{width:16px;height:16px}.toolbar-container-wrapper .toolbar-dropdown-menu{min-width:140px}.toolbar-container-wrapper .toolbar-dropdown-item{padding:6px 10px;font-size:12px}.floating-toolbar{padding:4px;gap:2px}.floating-toolbar-btn{width:28px;height:28px;font-size:12px}}@media(max-width:480px){.toolbar-container-wrapper{padding:4px}.toolbar-container-wrapper .toolbar-wrapper{padding:4px;gap:2px}.toolbar-container-wrapper .toolbar-button{padding:4px 6px;font-size:11px;min-height:24px}.toolbar-container-wrapper .toolbar-icon{width:14px;height:14px}}.floating-toolbar{pointer-events:auto}.floating-toolbar{max-width:calc(100vw - 20px);overflow-x:auto}@media(prefers-color-scheme:dark){.floating-toolbar{background:#2d3748;border-color:#4a5568;color:#e2e8f0}.floating-toolbar-btn:hover{background:#4a5568;color:#f7fafc}.floating-toolbar-btn:active{background:#718096}.floating-toolbar-separator{background:#4a5568}}';let Rn;const Ps="__editoraCommandEditorRoot",Fs="__editoraLastCommandButton",So="editora-editor, [data-editora-editor], .rte-editor, .editora-editor",wo=".rte-content, .editora-content",$s="Rich text editor",Qn=new Set;let tt=null,xo=!1,Jn=null,ei=null;function Co(r){if(!(r instanceof HTMLElement))return!1;const e=r;return typeof e.execCommand=="function"&&(e.tagName.toLowerCase()==="editora-editor"||e.classList.contains("editora-editor")||e.hasAttribute("data-editora-editor"))}function Bs(r){return r?r.nodeType===Node.ELEMENT_NODE?r:r.parentElement:null}function Ft(r){if(!r)return null;if(Co(r))return r;const e=r.matches(So)?r:r.closest(So);return!e||!Co(e)?null:e}function zs(){var i;if(typeof window=="undefined")return null;const r=window[Ps];if(r instanceof HTMLElement){const o=Ft(r);if(o)return o;const s=r.matches(wo)?r:r.querySelector(wo);if(s){const l=Ft(s);if(l)return l}}const e=window[Fs];if(e instanceof HTMLElement){const o=Ft(e);if(o)return o}const t=document.activeElement;if(t){const o=Ft(t);if(o)return o}const n=(i=window.getSelection)==null?void 0:i.call(window);if(n&&n.rangeCount>0){const o=Ft(Bs(n.getRangeAt(0).startContainer));if(o)return o}if(tt&&tt.isConnected)return tt;for(const o of Qn)if(o.isConnected)return o;return null}function Us(){if(typeof window=="undefined"||xo)return;Jn=typeof window.executeEditorCommand=="function"?window.executeEditorCommand.bind(window):null,ei=typeof window.execEditorCommand=="function"?window.execEditorCommand.bind(window):null;const r=(e,...t)=>{const n=zs();return n?n.execCommand(e,...t):Jn?Jn(e,...t):ei?ei(e,...t):!1};window.executeEditorCommand=r,window.execEditorCommand=r,xo=!0}function Ws(){const r="editora-webcomponent-styles";if(!document.getElementById(r)){const e=document.createElement("style");e.id=r,e.textContent=Hs,document.head.appendChild(e)}}function js(){if(!Rn){const r=Fe.__globalPluginLoader;r?Rn=r:Rn=new At}return Rn}class Fe extends HTMLElement{constructor(){if(super(),this.pluginLoader=js(),this.config={},this.isInitialized=!1,this.keyboardShortcutManager=new Gr,this.lastAutosavedContent="",this.preservedContent=null,this.loadedPlugins=[],this.lastBeforeInputType=null,this.pendingHistorySnapshot=null,Ws(),!this.hasAttribute("data-initial-content")){const e=this.innerHTML.trim();e&&this.setAttribute("data-initial-content",e)}}static get observedAttributes(){return["height","width","menubar","plugins","toolbar","toolbar-items","toolbar-floating","toolbar-sticky","readonly","disabled","theme","placeholder","aria-label","autofocus","autosave","autosave-enabled","autosave-interval-ms","autosave-storage-key","autosave-provider","autosave-api-url","accessibility","accessibility-enable-aria","accessibility-keyboard-navigation","accessibility-checker","performance","performance-debounce-input-ms","performance-viewport-only-scan","language","language-locale","language-direction","spellcheck","spellcheck-enabled","spellcheck-provider","context-menu","context-menu-enabled","paste","paste-clean","paste-keep-formatting","paste-convert-word","security","security-sanitize-on-paste","security-sanitize-on-input","statusbar"]}connectedCallback(){this.config=this.resolveConfig(),this.waitForPluginLoader().then(()=>{setTimeout(async()=>{await this.initialize()},0)})}async waitForPluginLoader(){if(Fe.__globalPluginLoader){this.pluginLoader=Fe.__globalPluginLoader;return}return new Promise(e=>{const t=()=>{Fe.__globalPluginLoader?(this.pluginLoader=Fe.__globalPluginLoader,e()):setTimeout(t,0)};t()})}disconnectedCallback(){this.destroy()}attributeChangedCallback(e,t,n){t!==n&&(this.config=this.resolveConfig(),this.handleAttributeChange(e,n))}async setConfig(e){this.jsConfig=e,this.config=this.resolveConfig(),this.isConnected&&(this.destroy(),await this.waitForPluginLoader(),await this.initialize())}async initialize(){var i;if(this.querySelector(".editora-toolbar")||this.isInitialized)return;this.setAttribute("data-editora-editor","true"),Qn.add(this),tt||(tt=this),Us(),this.config.height&&(this.style.height=typeof this.config.height=="number"?`${this.config.height}px`:this.config.height),this.config.width&&(this.style.width=typeof this.config.width=="number"?`${this.config.width}px`:this.config.width),this.classList.add("editora-editor"),this.config.theme&&this.classList.add(`editora-theme-${this.config.theme}`);const e=await this.loadPlugins();if(this.loadedPlugins=e,e.forEach(o=>{if(o.init&&typeof o.init=="function")try{o.init({editorElement:this})}catch(s){console.error(`[RichTextEditor] Error initializing plugin ${o.name}:`,s)}}),!this.hasAttribute("data-initial-content")&&!this.contentElement){const o=this.innerHTML.trim();o&&this.setAttribute("data-initial-content",o)}const t=this.preservedContent;this.preservedContent=null;const n=this.sanitizeLoadedContent((i=t!=null?t:this.restoreAutosavedContent())!=null?i:this.getAttribute("data-initial-content")||"");this.engine=new Fr({content:n,plugins:e,readonly:this.config.readonly}),this.createUI(e,n),this.setupEventListeners(),this.startAutosave(),this.isInitialized=!0,this.dispatchEvent(new CustomEvent("editor-ready",{detail:{api:this.getAPI()},bubbles:!0}))}getInitialContent(){if(this.config.content)return this.config.content;const e=this.querySelector("[slot]");return e?e.innerHTML:this.hasChildNodes()?Array.from(this.childNodes).map(n=>n.nodeType===Node.TEXT_NODE?n.textContent:n.nodeType===Node.ELEMENT_NODE?n.outerHTML:"").join("").trim():""}async loadPlugins(){this.pluginLoader||await this.waitForPluginLoader();const e=[],t=this.config.plugins&&(typeof this.config.plugins=="string"&&this.config.plugins.length>0||Array.isArray(this.config.plugins)&&this.config.plugins.length>0),i=this.getAccessibilityConfig().checker===!0;if(t){if(typeof this.config.plugins=="string"){const o=this.config.plugins.split(/\s+/).filter(Boolean);i&&!o.includes("a11yChecker")&&o.push("a11yChecker");for(const s of o){const l=await this.pluginLoader.load(s,this.getPluginLoadConfig(s));l&&e.push(l)}}else if(Array.isArray(this.config.plugins)){for(const o of this.config.plugins)if(typeof o=="string"){const s=await this.pluginLoader.load(o,this.getPluginLoadConfig(o));s&&e.push(s)}else e.push(o);if(i&&!e.some(o=>(o==null?void 0:o.name)==="a11yChecker")){const o=await this.pluginLoader.load("a11yChecker",this.getPluginLoadConfig("a11yChecker"));o&&e.push(o)}}}else{const o=this.pluginLoader.getRegisteredPluginNames();for(const s of o){const l=await this.pluginLoader.load(s,this.getPluginLoadConfig(s));l&&e.push(l)}}return e}resolveToolbarItems(){const e=this.config.toolbarItems;if(typeof e=="string")return e;if(Array.isArray(e))return e.join(" ");const t=this.config.toolbar;if(typeof t=="string")return t;if(!t||typeof t!="object")return;const n=t.items;if(typeof n=="string")return n;if(Array.isArray(n))return n.join(" ")}isToolbarStickyEnabled(){const e=this.config.toolbar;return!e||typeof e!="object"?!1:!!e.sticky}isToolbarFloatingEnabled(){const e=this.config.toolbar;return!e||typeof e!="object"?!1:!!e.floating}isStatusbarEnabled(){const e=this.config.statusbar;return typeof e=="boolean"?e:e&&typeof e=="object"?e.enabled!==!1:!1}getStatusbarPosition(){const e=this.config.statusbar;return e&&typeof e=="object"&&e.position==="top"?"top":"bottom"}getLanguageConfig(){const e=this.config.language;return typeof e=="string"?{locale:e,direction:"ltr"}:e&&typeof e=="object"?{locale:e.locale||"en",direction:e.direction==="rtl"?"rtl":"ltr"}:{locale:"en",direction:"ltr"}}getAccessibilityConfig(){const e=this.config.accessibility;return typeof e=="boolean"?{enableARIA:e,keyboardNavigation:e,checker:!1}:e&&typeof e=="object"?{enableARIA:e.enableARIA!==!1,keyboardNavigation:e.keyboardNavigation!==!1,checker:!!e.checker}:{enableARIA:!0,keyboardNavigation:!0,checker:!1}}getPerformanceConfig(){var t;const e=this.config.performance;if(typeof e=="boolean")return{debounceInputMs:100,viewportOnlyScan:e};if(e&&typeof e=="object"){const n=Number((t=e.debounceInputMs)!=null?t:100);return{debounceInputMs:Number.isFinite(n)&&n>=0?n:100,viewportOnlyScan:e.viewportOnlyScan!==!1}}return{debounceInputMs:100,viewportOnlyScan:!0}}isEditorInViewport(){if(!this.contentElement||typeof window=="undefined")return!0;const e=this.contentElement.getBoundingClientRect();return e.bottom>=0&&e.top<=window.innerHeight}applyAccessibilitySettings(){var t;if(!this.contentElement)return;const e=this.getAccessibilityConfig();if(e.enableARIA){this.contentElement.setAttribute("role","textbox"),this.contentElement.setAttribute("aria-multiline","true"),this.contentElement.setAttribute("aria-disabled",this.config.readonly?"true":"false");const n=(t=this.getAttribute("aria-label"))==null?void 0:t.trim(),i=typeof this.config.placeholder=="string"?this.config.placeholder.trim():"";this.contentElement.setAttribute("aria-label",n||i||$s)}else this.contentElement.removeAttribute("role"),this.contentElement.removeAttribute("aria-multiline"),this.contentElement.removeAttribute("aria-disabled"),this.contentElement.removeAttribute("aria-label");this.contentElement.tabIndex=e.keyboardNavigation?0:-1}applyLanguageSettings(){if(!this.contentElement)return;const e=this.getLanguageConfig();this.contentElement.setAttribute("lang",e.locale),this.contentElement.setAttribute("dir",e.direction)}getSpellcheckConfig(){const e=this.config.spellcheck;if(typeof e=="boolean")return{enabled:e,provider:"browser"};if(e&&typeof e=="object"){const t=e.provider||"browser";return{enabled:!!e.enabled,provider:t,mode:e.mode}}return{enabled:!1,provider:"browser"}}applySpellcheckSettings(){if(!this.contentElement)return;const e=this.getSpellcheckConfig(),t=e.enabled&&e.provider==="browser";this.contentElement.spellcheck=t,this.contentElement.setAttribute("spellcheck",t?"true":"false")}executeCommand(e,...t){var o;typeof window!="undefined"&&(window.__editoraCommandEditorRoot=this);const n={editorElement:this,contentElement:this.contentElement,toolbarElement:this.toolbarElement},i=this.loadedPlugins.find(s=>s.commands&&s.commands[e]);if(i&&i.commands){const s=i.commands[e];if(typeof s=="function")try{return e==="toggleFullscreen"?s(this,n):s(...t,n),!0}catch(l){return console.error(`[RichTextEditor] Error executing native command ${e}:`,l),!1}}return((o=this.engine)==null?void 0:o.execCommand(e,...t))||!1}getPluginLoadConfig(e){const t=this.config.pluginConfig;if(t&&typeof t=="object"){const o=t[e];if(o&&typeof o=="object")return o}const n={spellCheck:["spellcheck","spellCheck"],trackChanges:["trackchanges","track-changes","trackChanges"],versionDiff:["versiondiff","version-diff","versionDiff"],"version-diff":["versiondiff","version-diff","versionDiff"],conditionalContent:["conditionalcontent","conditional-content","conditionalContent"],"conditional-content":["conditionalcontent","conditional-content","conditionalContent"],dataBinding:["databinding","data-binding","dataBinding"],"data-binding":["databinding","data-binding","dataBinding"],contentRules:["contentrules","content-rules","contentRules"],"content-rules":["contentrules","content-rules","contentRules"],mentions:["mention","mentions"],mention:["mention","mentions"],slashCommands:["slashcommands","slash-commands","slashCommands"],"slash-commands":["slashcommands","slash-commands","slashCommands"],formatPainter:["formatpainter","format-painter","formatPainter"],"format-painter":["formatpainter","format-painter","formatPainter"]},i=[e,e.toLowerCase(),...n[e]||[]];for(const o of i){const s=this.config[o];if(s&&typeof s=="object"&&!Array.isArray(s))return s}}getContentSanitizeConfig(){const e=this.config.contentConfig;return e&&typeof e=="object"?e:{sanitize:!0}}getSecurityConfig(){const e=this.config.security;return e&&typeof e=="object"?e:{sanitizeOnPaste:!0,sanitizeOnInput:!0}}sanitizeLoadedContent(e){return Eo(e,this.getContentSanitizeConfig(),this.getSecurityConfig())}getAutosaveConfig(){var t,n;const e=this.config.autosave;if(typeof e=="boolean")return{enabled:e,intervalMs:3e4,storageKey:"rte-autosave",provider:"localStorage"};if(e&&typeof e=="object"){const i=Number((n=(t=e.intervalMs)!=null?t:e.interval)!=null?n:3e4);return{enabled:!!e.enabled,intervalMs:Number.isFinite(i)&&i>0?i:3e4,storageKey:String(e.storageKey||"rte-autosave"),provider:e.provider||"localStorage",apiUrl:e.apiUrl}}return{enabled:!1,intervalMs:3e4,storageKey:"rte-autosave",provider:"localStorage"}}persistAutosave(e){const t=this.getAutosaveConfig();if(t.enabled&&e!==this.lastAutosavedContent){if(this.lastAutosavedContent=e,t.provider==="localStorage"){try{localStorage.setItem(t.storageKey,e),localStorage.setItem(`${t.storageKey}-timestamp`,Date.now().toString())}catch(n){console.error("[RichTextEditor] Failed to save autosave content to localStorage:",n)}return}t.provider==="api"&&t.apiUrl&&fetch(t.apiUrl,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:e,timestamp:Date.now()})}).catch(n=>{console.error("[RichTextEditor] Failed to save autosave content to API:",n)})}}restoreAutosavedContent(){const e=this.getAutosaveConfig();if(!e.enabled||e.provider!=="localStorage")return null;try{const t=localStorage.getItem(e.storageKey);if(t)return this.lastAutosavedContent=t,t}catch(t){console.error("[RichTextEditor] Failed to restore autosaved content:",t)}return null}stopAutosave(){this.autosaveTimer&&(clearInterval(this.autosaveTimer),this.autosaveTimer=void 0)}startAutosave(){this.stopAutosave();const e=this.getAutosaveConfig();!e.enabled||!this.contentElement||(this.autosaveTimer=setInterval(()=>{this.persistAutosave(Pt(this.contentElement))},e.intervalMs))}insertHTMLAtSelection(e){if(!this.contentElement)return;const t=window.getSelection();if(t&&t.rangeCount>0){const n=t.getRangeAt(0);n.deleteContents();const i=document.createElement("div");i.innerHTML=e;const o=document.createDocumentFragment();for(;i.firstChild;)o.appendChild(i.firstChild);n.insertNode(o),n.collapse(!1),t.removeAllRanges(),t.addRange(n)}else this.contentElement.focus(),document.execCommand("insertHTML",!1,e)}createUI(e,t){const n=this.querySelector('[slot="toolbar"]'),i=this.querySelector('[slot="statusbar"]');this.innerHTML="",this.config.toolbar!==!1&&!n?(this.toolbarElement=document.createElement("div"),this.toolbarElement.className="editora-toolbar-container",this.appendChild(this.toolbarElement),this.toolbar=new $r({items:this.resolveToolbarItems(),sticky:this.isToolbarStickyEnabled(),position:"top"},e,this.pluginLoader),this.toolbar.setCommandHandler((o,s)=>{var l;if(this.contentElement){this.contentElement.focus();const c=window.getSelection();if(!c||c.rangeCount===0||!this.contentElement.contains(c.anchorNode)){const d=document.createRange(),u=this.contentElement.lastChild||this.contentElement;u.nodeType===Node.TEXT_NODE?d.setStart(u,((l=u.textContent)==null?void 0:l.length)||0):u.nodeType===Node.ELEMENT_NODE?(d.selectNodeContents(u),d.collapse(!1)):d.setStart(this.contentElement,0),d.collapse(!0),c==null||c.removeAllRanges(),c==null||c.addRange(d)}}return this.executeCommand(o,s)}),this.toolbar.render(this.toolbarElement)):n&&this.appendChild(n),this.contentElement=document.createElement("div"),this.contentElement.className="editora-content rte-content",this.contentElement.contentEditable=this.config.readonly?"false":"true",this.applyLanguageSettings(),this.applyAccessibilitySettings(),this.applySpellcheckSettings(),this.config.placeholder&&this.contentElement.setAttribute("data-placeholder",this.config.placeholder);try{document.execCommand("defaultParagraphSeparator",!1,"p")}catch(o){console.warn("defaultParagraphSeparator not supported:",o)}if(t){const o=document.createElement("div");o.innerHTML=t.trim(),!Array.from(o.childNodes).some(l=>{if(l.nodeType===Node.ELEMENT_NODE){const c=l.tagName;return["P","DIV","H1","H2","H3","H4","H5","H6","UL","OL","BLOCKQUOTE","PRE"].includes(c)}return!1})&&t.trim()?this.contentElement.innerHTML=`<p>${t.trim()}</p>`:this.contentElement.innerHTML=t}else this.config.placeholder?this.contentElement.innerHTML="":this.contentElement.innerHTML="<p><br></p>";this.appendChild(this.contentElement),this.isToolbarFloatingEnabled()&&(this.floatingToolbar=new Br({enabled:!0}),this.floatingToolbar.create(this)),i?this.appendChild(i):this.isStatusbarEnabled()&&(this.statusBarElement=document.createElement("div"),this.statusBarElement.className="editora-statusbar-container",this.appendChild(this.statusBarElement),this.statusBar=new zr({position:this.getStatusbarPosition()}),this.statusBar.create(this.statusBarElement)),this.config.autofocus&&setTimeout(()=>{var o;return(o=this.contentElement)==null?void 0:o.focus()},0)}recordInputHistory(e){const t=this.pendingHistorySnapshot;if(this.pendingHistorySnapshot=null,!t||!this.contentElement||t.beforeHTML===e)return;const n=window.execEditorCommand;typeof n=="function"&&n("recordDomTransaction",this.contentElement,t.beforeHTML,e,{inputType:t.inputType,data:t.data,selectionCollapsed:t.selectionCollapsed})}setupEventListeners(){if(!this.contentElement||!this.engine)return;const e=this.keyboardShortcutManager;this.contentElement.addEventListener("beforeinput",n=>{var i,o;this.lastBeforeInputType=n.inputType||null,n.inputType==="historyUndo"||n.inputType==="historyRedo"?this.pendingHistorySnapshot=null:this.contentElement&&(this.pendingHistorySnapshot={beforeHTML:this.contentElement.innerHTML,inputType:n.inputType||null,data:typeof n.data=="string"?n.data:null,selectionCollapsed:(o=(i=window.getSelection())==null?void 0:i.isCollapsed)!=null?o:!0})}),this.contentElement.addEventListener("input",n=>{var p;if(!this.contentElement)return;let i=this.contentElement.innerHTML;const o=(p=n==null?void 0:n.detail)==null?void 0:p.allowedTags,s=this.getPerformanceConfig(),l=this.getContentSanitizeConfig(),c=this.getSecurityConfig(),d=this.lastBeforeInputType;if(this.lastBeforeInputType=null,c.sanitizeOnInput!==!1&&l.sanitize!==!1&&!d){const y=Eo(i,l,c,o);if(y!==i){const m=window.getSelection(),E=m&&m.rangeCount>0?m.getRangeAt(0):null;if(this.contentElement.innerHTML=y,E&&m)try{m.removeAllRanges(),m.addRange(E)}catch(v){}i=y}}this.recordInputHistory(i),this.contentChangeDebounceTimer&&clearTimeout(this.contentChangeDebounceTimer);const f=()=>{this.dispatchEvent(new CustomEvent("content-change",{detail:{html:vo(i)},bubbles:!0}))};s.debounceInputMs>0?this.contentChangeDebounceTimer=setTimeout(f,s.debounceInputMs):f(),this.updateStatusBar()}),this.contentElement.addEventListener("contextmenu",n=>{const i=this.config.contextMenu;(i===!1||typeof i=="object"&&i!==null&&i.enabled===!1)&&n.preventDefault()}),this.contentElement.addEventListener("paste",n=>{var u,f;if(n.__editoraSmartPasteHandled===!0||n.defaultPrevented)return;n.preventDefault();const i=this.config.paste||{};let o=((u=n.clipboardData)==null?void 0:u.getData("text/html"))||"";const s=((f=n.clipboardData)==null?void 0:f.getData("text/plain"))||"",l=this.getContentSanitizeConfig(),c=this.getSecurityConfig(),d=!!o&&/class=["'][^"']*Mso|xmlns:w=|urn:schemas-microsoft-com:office/i.test(o);if((i.clean||!i.keepFormatting)&&s){document.execCommand("insertText",!1,s);return}if(i.convertWord===!1&&d&&s){document.execCommand("insertText",!1,s);return}if(o){c.sanitizeOnPaste!==!1&&l.sanitize!==!1&&(o=Is(o,l,c)),this.insertHTMLAtSelection(o);return}s&&document.execCommand("insertText",!1,s)}),this.contentElement.addEventListener("focus",()=>{tt=this,this.dispatchEvent(new Event("editor-focus",{bubbles:!0})),this.updateStatusBar()}),this.contentElement.addEventListener("blur",()=>{this.contentChangeDebounceTimer&&(clearTimeout(this.contentChangeDebounceTimer),this.contentChangeDebounceTimer=void 0),this.contentElement&&this.dispatchEvent(new CustomEvent("content-change",{detail:{html:Pt(this.contentElement)},bubbles:!0})),this.dispatchEvent(new Event("editor-blur",{bubbles:!0})),this.updateFloatingToolbar(),this.updateStatusBar()}),this.contentElement.addEventListener("keydown",n=>{this.getAccessibilityConfig().keyboardNavigation&&e.handleKeyDown(n,(o,s)=>{this.executeCommand(o,s)})});const t=()=>{const n=this.getSelectionRangeInEditor(),i=document.activeElement,o=!!i&&!!this.contentElement&&(i===this.contentElement||this.contentElement.contains(i));this.getPerformanceConfig().viewportOnlyScan&&!this.isEditorInViewport()&&!o||!n&&!o||(this.updateFloatingToolbar(),this.updateStatusBar())};this.selectionChangeHandler=t,document.addEventListener("selectionchange",this.selectionChangeHandler)}getSelectionRangeInEditor(){if(!this.contentElement)return null;const e=window.getSelection();if(!e||e.rangeCount===0)return null;const t=e.getRangeAt(0),n=t.commonAncestorContainer;return this.contentElement.contains(n)?t:null}isSelectionBackward(e){if(!e.anchorNode||!e.focusNode)return!1;try{const t=document.createRange();return t.setStart(e.anchorNode,e.anchorOffset),t.setEnd(e.focusNode,e.focusOffset),t.collapsed}catch(t){return!1}}getSelectionAnchorRect(e,t){const n=Array.from(t.getClientRects()).filter(o=>o.width>0||o.height>0);return n.length===0?t.getBoundingClientRect():this.isSelectionBackward(e)?n[0]:n[n.length-1]}updateFloatingToolbar(){if(!this.floatingToolbar||!this.contentElement)return;if(this.config.readonly||this.contentElement.contentEditable==="false"||this.contentElement.getAttribute("data-readonly")==="true"||this.isReadonlyAttribute(this.getAttribute("readonly"))||this.getAttribute("data-readonly")==="true"){this.floatingToolbar.hide();return}const t=this.getPerformanceConfig(),n=document.activeElement===this.contentElement||!!this.contentElement&&this.contentElement.contains(document.activeElement);if(t.viewportOnlyScan&&!this.isEditorInViewport()&&!n){this.floatingToolbar.hide();return}const i=this.getSelectionRangeInEditor();if(!i){this.floatingToolbar.hide();return}if(i.collapsed){this.floatingToolbar.hide();return}const o=window.getSelection();if(!o){this.floatingToolbar.hide();return}const s=this.getSelectionAnchorRect(o,i);if(!s){this.floatingToolbar.hide();return}this.floatingToolbar.show(s.left,s.top-40)}updateStatusBar(){if(!this.statusBar||!this.contentElement)return;const e=this.getPerformanceConfig(),t=document.activeElement===this.contentElement||this.contentElement.contains(document.activeElement);if(e.viewportOnlyScan&&!this.isEditorInViewport()&&!t)return;const n=this.contentElement.textContent||"",{words:i,chars:o}=Kr(n),s=jr(this.contentElement);let l,c;const d=this.getSelectionRangeInEditor();d&&(l=Ur(this.contentElement,d),d.collapsed||(c=Vr(d,l),l=void 0)),this.statusBar.update({wordCount:i,charCount:o,lineCount:s,cursorPosition:l,selectionInfo:c})}isReadonlyAttribute(e){return e!==null&&e!=="false"}handleAttributeChange(e,t){switch(e){case"readonly":this.contentElement&&(this.contentElement.contentEditable=this.isReadonlyAttribute(t)?"false":"true",this.applyAccessibilitySettings()),this.engine&&this.engine.setReadonly(this.isReadonlyAttribute(t));break;case"theme":this.classList.forEach(n=>{n.startsWith("editora-theme-")&&this.classList.remove(n)}),t&&this.classList.add(`editora-theme-${t}`);break;case"placeholder":this.contentElement&&(this.contentElement.setAttribute("data-placeholder",t),this.applyAccessibilitySettings());break;case"aria-label":case"accessibility":case"accessibility-enable-aria":case"accessibility-keyboard-navigation":case"accessibility-checker":this.applyAccessibilitySettings();break;case"performance":case"performance-debounce-input-ms":case"performance-viewport-only-scan":break;case"language":case"language-locale":case"language-direction":this.applyLanguageSettings();break;case"spellcheck":case"spellcheck-enabled":case"spellcheck-provider":this.applySpellcheckSettings();break;case"autosave":case"autosave-enabled":case"autosave-interval-ms":case"autosave-storage-key":case"autosave-provider":case"autosave-api-url":this.startAutosave();break;case"security":case"security-sanitize-on-paste":case"security-sanitize-on-input":case"paste":case"paste-clean":case"paste-keep-formatting":case"paste-convert-word":case"context-menu":case"context-menu-enabled":break;case"toolbar":case"toolbar-items":case"toolbar-floating":case"toolbar-sticky":case"plugins":case"statusbar":this.isConnected&&(this.destroy(),this.waitForPluginLoader().then(()=>{this.initialize().catch(n=>{console.error("[RichTextEditor] Error during attribute change re-initialization:",n)})}));break}}resolveConfig(){const e={};for(let t=0;t<this.attributes.length;t++){const n=this.attributes[t];e[n.name]=n.value}return Zn.resolve({jsConfig:this.jsConfig,attributes:e})}getAPI(){return{getContent:()=>Pt(this.contentElement),setContent:e=>{this.contentElement&&(this.contentElement.innerHTML=this.sanitizeLoadedContent(e))},execCommand:(e,t)=>this.executeCommand(e,t),focus:()=>{var e;(e=this.contentElement)==null||e.focus()},blur:()=>{var e;(e=this.contentElement)==null||e.blur()},destroy:()=>{this.destroy()},on:(e,t)=>(this.addEventListener(e,t),()=>this.removeEventListener(e,t)),getConfig:()=>({...this.config}),setReadonly:e=>{this.setAttribute("readonly",e.toString())}}}destroy(){var e,t,n,i;this.contentChangeDebounceTimer&&(clearTimeout(this.contentChangeDebounceTimer),this.contentChangeDebounceTimer=void 0),this.contentElement&&(this.preservedContent=Pt(this.contentElement),this.persistAutosave(this.preservedContent)),this.stopAutosave(),this.selectionChangeHandler&&(document.removeEventListener("selectionchange",this.selectionChangeHandler),this.selectionChangeHandler=void 0),(e=this.engine)==null||e.destroy(),(t=this.toolbar)==null||t.destroy(),(n=this.floatingToolbar)==null||n.destroy(),(i=this.statusBar)==null||i.destroy(),this.innerHTML="",this.contentElement=void 0,this.toolbarElement=void 0,this.statusBarElement=void 0,this.loadedPlugins=[],this.isInitialized=!1,Qn.delete(this),tt===this&&(tt=null),this.dispatchEvent(new Event("editor-destroy",{bubbles:!0}))}getContent(){return Pt(this.contentElement)}setContent(e){this.contentElement&&(this.contentElement.innerHTML=this.sanitizeLoadedContent(e))}execCommand(e,...t){return this.executeCommand(e,...t)}focus(){var e;(e=this.contentElement)==null||e.focus()}blur(){var e;(e=this.contentElement)==null||e.blur()}}const ti=new At;Fe.__globalPluginLoader=ti;const Ks={bold:()=>Promise.resolve().then(()=>Zs).then(r=>r.BoldPlugin()),italic:()=>Promise.resolve().then(()=>Js).then(r=>r.ItalicPlugin()),underline:()=>Promise.resolve().then(()=>ea).then(r=>r.UnderlinePlugin()),strikethrough:()=>Promise.resolve().then(()=>ia).then(r=>r.StrikethroughPlugin()),clearFormatting:()=>Promise.resolve().then(()=>ma).then(r=>r.ClearFormattingPlugin()),heading:()=>Promise.resolve().then(()=>Oa).then(r=>r.HeadingPlugin()),blockquote:()=>Promise.resolve().then(()=>Wa).then(r=>r.BlockquotePlugin()),code:()=>Promise.resolve().then(()=>rc).then(r=>r.CodePlugin()),list:()=>Promise.resolve().then(()=>mc).then(r=>r.ListPlugin()),history:()=>Promise.resolve().then(()=>kc).then(r=>r.HistoryPlugin())};async function Ao(){return Object.entries(Ks).forEach(([r,e])=>{ti.register(r,e)}),ti}typeof window!="undefined"&&Ao().then(r=>{Fe.__globalPluginLoader=r,customElements.get("editora-editor")||customElements.define("editora-editor",Fe);const e=document.querySelectorAll("editora-editor:not([data-initial-content])"),t=[];e.forEach(n=>{const i=n.innerHTML.trim();i&&(t.push(i),n.setAttribute("data-initial-content",i),n.innerHTML="")}),e.forEach((n,i)=>{n instanceof Fe&&!n.isInitialized&&t[i]&&n.setAttribute("content",t[i])})});const On="data-editora-selection-marker";function Vs(r){return r?r.nodeType===Node.ELEMENT_NODE?r:r.parentElement:null}function ko(r){return r?r.getAttribute("contenteditable")==="true"?r:r.querySelector('[contenteditable="true"]'):null}function Gs(r){var s;if((r==null?void 0:r.contentElement)instanceof HTMLElement)return r.contentElement;const e=ko((s=r==null?void 0:r.editorElement)!=null?s:null);if(e)return e;const t=typeof window!="undefined"?window.__editoraCommandEditorRoot:null,n=t instanceof HTMLElement?ko(t):null;if(n)return n;const i=window.getSelection();if(i&&i.rangeCount>0){const l=Vs(i.getRangeAt(0).startContainer),c=l==null?void 0:l.closest('.rte-content, .editora-content, [contenteditable="true"]');if(c instanceof HTMLElement)return c}const o=document.activeElement;if(o instanceof HTMLElement){const l=o.closest('.rte-content, .editora-content, [contenteditable="true"]');if(l instanceof HTMLElement)return l}return document.querySelector('.rte-content, .editora-content, [contenteditable="true"]')}function qs(r){const e=window.getSelection();if(!e||e.rangeCount===0)return!1;const t=e.getRangeAt(0);return r.contains(t.startContainer)&&r.contains(t.endContainer)}function Mo(r){const e=document.createElement("span");return e.setAttribute(On,r),e.style.display="inline-block",e.style.width="0",e.style.height="0",e.style.overflow="hidden",e.style.lineHeight="0",e.appendChild(document.createTextNode("\uFEFF")),e}function Ys(r){const e=window.getSelection();if(!e||e.rangeCount===0)return null;const t=e.getRangeAt(0);if(!r.contains(t.startContainer)||!r.contains(t.endContainer))return null;const n=t.collapsed,i=Mo("start"),o=n?null:Mo("end"),s=t.cloneRange();if(o){const c=s.cloneRange();c.collapse(!1),c.insertNode(o)}const l=s.cloneRange();return l.collapse(!0),l.insertNode(i),()=>{const c=window.getSelection(),d=document.createRange(),u=r.querySelector(`[${On}="start"]`),f=r.querySelector(`[${On}="end"]`);if(!c||!u){r.querySelectorAll(`[${On}]`).forEach(p=>p.remove());return}n||!f?(d.setStartBefore(u),d.collapse(!0)):(d.setStartAfter(u),d.setEndBefore(f)),c.removeAllRanges(),c.addRange(d),u.remove(),f==null||f.remove()}}function Xs(r,e,t){if(e!==t){if(typeof window.execEditorCommand=="function"){window.execEditorCommand("recordDomTransaction",r,e,t);return}if(typeof window.executeEditorCommand=="function")try{window.executeEditorCommand("recordDomTransaction",{editor:r,beforeHTML:e,afterHTML:t})}catch(n){}}}function _n(r){const e=Gs(r.context);if(!e)return!1;const t=e.innerHTML;qs(e)&&e.focus({preventScroll:!0});let n=!1;try{n=document.execCommand(r.command,!1)}catch(s){n=!1}const i=e.innerHTML;if(r.normalize&&i!==t){const s=Ys(e);r.normalize(e),s==null||s()}const o=e.innerHTML;return t!==o&&(Xs(e,t,o),e.dispatchEvent(new Event("input",{bubbles:!0}))),n!==!1||t!==o}const Zs=Object.freeze(Object.defineProperty({__proto__:null,BoldPlugin:()=>({name:"bold",marks:{bold:{parseDOM:[{tag:"strong"},{tag:"b"},{style:"font-weight",getAttrs:r=>{const e=typeof r=="string"?r:r.style.fontWeight;return/^(bold(er)?|[5-9]\d{2,})$/.test(e)&&null}}],toDOM:()=>["strong",0]}},toolbar:[{label:"Bold",command:"toggleBold",icon:'<svg width="24" height="24" focusable="false"><path d="M7.8 19c-.3 0-.5 0-.6-.2l-.2-.5V5.7c0-.2 0-.4.2-.5l.6-.2h5c1.5 0 2.7.3 3.5 1 .7.6 1.1 1.4 1.1 2.5a3 3 0 0 1-.6 1.9c-.4.6-1 1-1.6 1.2.4.1.9.3 1.3.6s.8.7 1 1.2c.4.4.5 1 .5 1.6 0 1.3-.4 2.3-1.3 3-.8.7-2.1 1-3.8 1H7.8Zm5-8.3c.6 0 1.2-.1 1.6-.5.4-.3.6-.7.6-1.3 0-1.1-.8-1.7-2.3-1.7H9.3v3.5h3.4Zm.5 6c.7 0 1.3-.1 1.7-.4.4-.4.6-.9.6-1.5s-.2-1-.7-1.4c-.4-.3-1-.4-2-.4H9.4v3.8h4Z" fill-rule="evenodd"></path></svg>',shortcut:"Mod-b"}],commands:{toggleBold:(r,e)=>_n({command:"bold",context:e})},keymap:{"Mod-b":"toggleBold","Mod-B":"toggleBold"}})},Symbol.toStringTag,{value:"Module"})),ni=(r,e)=>_n({command:"italic",context:e}),Qs=(r,e)=>{var t;typeof window!="undefined"&&((t=window.registerEditorCommand)==null||t.call(window,r,e))},Lo=()=>{Qs("toggleItalic",ni)};typeof window!="undefined"&&(document.readyState==="loading"?document.addEventListener("DOMContentLoaded",Lo):Lo());const Js=Object.freeze(Object.defineProperty({__proto__:null,ItalicPlugin:()=>({name:"italic",marks:{italic:{parseDOM:[{tag:"i"},{tag:"em"},{style:"font-style=italic"}],toDOM:()=>["em",0]}},toolbar:[{label:"Italic",command:"toggleItalic",type:"button",icon:'<svg width="24" height="24" focusable="false"><path d="M16.7 4.7l-.1.9h-.3c-.6 0-1 0-1.4.3-.3.3-.4.6-.5 1.1l-2.1 9.8v.6c0 .5.4.8 1.4.8h.2l-.2.8H8l.2-.8h.2c1.1 0 1.8-.5 2-1.5l2-9.8.1-.5c0-.6-.4-.8-1.4-.8h-.3l.2-.9h5.8Z" fill-rule="evenodd"></path></svg>',shortcut:"Mod-i"}],commands:{toggleItalic:ni},keymap:{"Mod-i":"toggleItalic","Mod-I":"toggleItalic"}}),toggleItalic:ni},Symbol.toStringTag,{value:"Module"})),ea=Object.freeze(Object.defineProperty({__proto__:null,UnderlinePlugin:()=>({name:"underline",marks:{underline:{parseDOM:[{tag:"u"}],toDOM:()=>["u",{},0]}},toolbar:[{label:"Underline",command:"toggleUnderline",icon:'<svg width="24" height="24" focusable="false"><path d="M16 5c.6 0 1 .4 1 1v7c0 2.8-2.2 5-5 5s-5-2.2-5-5V6c0-.6.4-1 1-1s1 .4 1 1v7c0 1.7 1.3 3 3 3s3-1.3 3-3V6c0-.6.4-1 1-1ZM4 17h16c.6 0 1 .4 1 1s-.4 1-1 1H4a1 1 0 1 1 0-2Z" fill-rule="evenodd"></path></svg>',shortcut:"Mod-u"}],commands:{toggleUnderline:(r,e)=>_n({command:"underline",context:e})},keymap:{"Mod-u":"toggleUnderline","Mod-U":"toggleUnderline"}})},Symbol.toStringTag,{value:"Module"})),ta=()=>({name:"strikethrough",marks:{strikethrough:{parseDOM:[{tag:"s"},{tag:"strike"},{tag:"del"},{style:"text-decoration",getAttrs:r=>(typeof r=="string"?r:r.style.textDecoration)==="line-through"&&null}],toDOM:()=>["s",0]}},toolbar:[{label:"Strikethrough",command:"toggleStrikethrough",icon:'<svg width="24" height="24" focusable="false"><g fill-rule="evenodd"><path d="M15.6 8.5c-.5-.7-1-1.1-1.3-1.3-.6-.4-1.3-.6-2-.6-2.7 0-2.8 1.7-2.8 2.1 0 1.6 1.8 2 3.2 2.3 4.4.9 4.6 2.8 4.6 3.9 0 1.4-.7 4.1-5 4.1A6.2 6.2 0 0 1 7 16.4l1.5-1.1c.4.6 1.6 2 3.7 2 1.6 0 2.5-.4 3-1.2.4-.8.3-2-.8-2.6-.7-.4-1.6-.7-2.9-1-1-.2-3.9-.8-3.9-3.6C7.6 6 10.3 5 12.4 5c2.9 0 4.2 1.6 4.7 2.4l-1.5 1.1Z"></path><path d="M5 11h14a1 1 0 0 1 0 2H5a1 1 0 0 1 0-2Z" fill-rule="nonzero"></path></g></svg>',shortcut:"Mod-Shift-x"}],commands:{toggleStrikethrough:(r,e)=>_n({command:"strikeThrough",context:e,normalize:na})},keymap:{"Mod-Shift-x":"toggleStrikethrough","Mod-Shift-X":"toggleStrikethrough"}});function na(r){r.querySelectorAll("strike, del").forEach(t=>{var i;const n=document.createElement("s");for(const o of Array.from(t.attributes))o.name!=="style"&&n.setAttribute(o.name,o.value);for(;t.firstChild;)n.appendChild(t.firstChild);(i=t.parentNode)==null||i.replaceChild(n,t)})}const ia=Object.freeze(Object.defineProperty({__proto__:null,StrikethroughPlugin:ta},Symbol.toStringTag,{value:"Module"}));function Ro(r,e,t=r==null?void 0:r.innerHTML){if(!r||typeof t!="string"||e===t)return!1;try{if(typeof window.execEditorCommand=="function")return window.execEditorCommand("recordDomTransaction",r,e,t)!==!1;if(typeof window.executeEditorCommand=="function")return window.executeEditorCommand("recordDomTransaction",{editor:r,beforeHTML:e,afterHTML:t})!==!1}catch(n){}return!1}const oa=()=>({name:"clearFormatting",toolbar:[{label:"Clear Formatting",command:"clearFormatting",icon:'<svg width="24" height="24" focusable="false"><path d="M13.2 6a1 1 0 0 1 0 .2l-2.6 10a1 1 0 0 1-1 .8h-.2a.8.8 0 0 1-.8-1l2.6-10H8a1 1 0 1 1 0-2h9a1 1 0 0 1 0 2h-3.8ZM5 18h7a1 1 0 0 1 0 2H5a1 1 0 0 1 0-2Zm13 1.5L16.5 18 15 19.5a.7.7 0 0 1-1-1l1.5-1.5-1.5-1.5a.7.7 0 0 1 1-1l1.5 1.5 1.5-1.5a.7.7 0 0 1 1 1L17.5 17l1.5 1.5a.7.7 0 0 1-1 1Z" fill-rule="evenodd"></path></svg>',shortcut:"Mod-\\"}],commands:{clearFormatting:()=>{const r=la();if(!r)return!1;const e=window.getSelection();if(!e||e.rangeCount===0)return!1;const t=e.getRangeAt(0);if(!r.contains(t.commonAncestorContainer))return!1;const n=t.cloneRange(),i=r.innerHTML;return r.focus({preventScroll:!0}),ga(r,n),pa(r,n),Ro(r,i),r.dispatchEvent(new Event("input",{bubbles:!0})),!0}},keymap:{"Mod-\\":"clearFormatting"}}),ra=new Set(["A","B","STRONG","I","EM","U","S","STRIKE","DEL","FONT","MARK","CODE","SUB","SUP"]),sa=new Set(["H1","H2","H3","H4","H5","H6","BLOCKQUOTE","PRE"]),aa=["color","background-color","font-size","font-family","font-weight","font-style","text-decoration","text-transform","line-height","letter-spacing","word-spacing","vertical-align","text-align","padding-left"];function la(){const r=window.getSelection();if(r&&r.rangeCount>0){const t=r.getRangeAt(0).startContainer,n=t.nodeType===Node.ELEMENT_NODE?t:t.parentElement,i=n==null?void 0:n.closest('[contenteditable="true"], .rte-content, .editora-content');if(i)return i}const e=document.activeElement;return e?e.getAttribute("contenteditable")==="true"?e:e.closest('[contenteditable="true"], .rte-content, .editora-content'):null}function Oo(r,e){try{if(typeof r.intersectsNode=="function")return r.intersectsNode(e)}catch(n){}const t=document.createRange();return e.nodeType===Node.ELEMENT_NODE?t.selectNodeContents(e):t.selectNode(e),r.compareBoundaryPoints(Range.END_TO_START,t)>0&&r.compareBoundaryPoints(Range.START_TO_END,t)<0}function In(r){let e=0,t=r;for(;t&&t.parentNode;)e+=1,t=t.parentNode;return e}function ca(r){aa.forEach(e=>{r.style.removeProperty(e)}),(!r.getAttribute("style")||r.style.length===0)&&r.removeAttribute("style"),r.classList.contains("rte-text-color")&&r.classList.remove("rte-text-color"),r.classList.contains("rte-bg-color")&&r.classList.remove("rte-bg-color"),r.classList.contains("rte-format-painted")&&r.classList.remove("rte-format-painted"),r.classList.length===0&&r.removeAttribute("class")}function ii(r){const e=r.parentNode;if(e){for(;r.firstChild;)e.insertBefore(r.firstChild,r);e.removeChild(r)}}function da(r){return r.tagName!=="P"||r.attributes.length>0||(r.textContent||"").trim()!==""?!1:!r.querySelector("img, video, table, iframe, hr, pre, ul, ol")}function _o(r){Array.from(r.children).forEach(e=>{da(e)&&e.remove()})}function Io(r){_o(r),ii(r)}function Do(r){var t;const e=document.createElement("p");for(Array.from(r.attributes).forEach(n=>{e.setAttribute(n.name,n.value)});r.firstChild;)e.appendChild(r.firstChild);e.innerHTML.trim()||(e.innerHTML="<br>"),(t=r.parentNode)==null||t.replaceChild(e,r)}function ua(r){return!/^(A|B|STRONG|I|EM|U|S|STRIKE|DEL|FONT|MARK|CODE|SUB|SUP|SPAN)$/.test(r.tagName)||(r.textContent||"").trim()!==""?!1:!r.querySelector("img, video, table, iframe, hr, svg, math")}function ha(r){Array.from(r.querySelectorAll("a,b,strong,i,em,u,s,strike,del,font,mark,code,sub,sup,span")).sort((t,n)=>In(n)-In(t)).forEach(t=>{t.isConnected&&ua(t)&&t.remove()})}function fa(r){if(_o(r),r.parentElement instanceof HTMLLIElement){Io(r);return}if(Array.from(r.childNodes).filter(i=>i.nodeType!==Node.TEXT_NODE||(i.textContent||"").trim()!=="").some(i=>i instanceof HTMLElement&&/^(P|DIV|H[1-6]|UL|OL|PRE|TABLE|BLOCKQUOTE)$/.test(i.tagName))){Io(r);return}Do(r)}function pa(r,e){Array.from(r.querySelectorAll("h1,h2,h3,h4,h5,h6,blockquote,pre")).forEach(n=>{if(Oo(e,n)&&sa.has(n.tagName)){if(n.tagName==="BLOCKQUOTE"){fa(n);return}Do(n)}})}function ga(r,e){const t=Array.from(r.querySelectorAll("a,b,strong,i,em,u,s,strike,del,font,mark,code,sub,sup,span,[style],[class]"));t.sort((n,i)=>In(i)-In(n)),t.forEach(n=>{if(n.isConnected&&Oo(e,n)&&!(n.getAttribute("contenteditable")==="false"||n.closest('[contenteditable="false"]'))){if(ca(n),ra.has(n.tagName)){ii(n);return}n.tagName==="SPAN"&&n.attributes.length===0&&ii(n)}}),ha(r)}const ma=Object.freeze(Object.defineProperty({__proto__:null,ClearFormattingPlugin:oa},Symbol.toStringTag,{value:"Module"})),$t='.rte-content, .editora-content, [contenteditable="true"]',ba="[data-editora-editor], .rte-editor, .editora-editor, editora-editor",No=new Set(["P","DIV","H1","H2","H3","H4","H5","H6","PRE"]),Ho="p,div,h1,h2,h3,h4,h5,h6,ul,ol,blockquote,pre,table",ya=new Set(["p","h1","h2","h3","h4","h5","h6"]);function Po(r){return r?r.nodeType===Node.ELEMENT_NODE?r:r.parentElement:null}function Ta(r){const e=r==null?void 0:r.contentElement;if(e instanceof HTMLElement)return e;const t=r==null?void 0:r.editorElement;if(t instanceof HTMLElement){const s=t.querySelector($t);if(s instanceof HTMLElement)return s;if(t.getAttribute("contenteditable")==="true")return t}const n=window.getSelection();if(n&&n.rangeCount>0){const s=Po(n.getRangeAt(0).startContainer),l=s==null?void 0:s.closest($t);if(l instanceof HTMLElement)return l;const c=s==null?void 0:s.closest(ba),d=c==null?void 0:c.querySelector($t);if(d instanceof HTMLElement)return d}const i=document.activeElement,o=i==null?void 0:i.closest($t);return o instanceof HTMLElement?o:document.querySelector($t)}function Ea(r){const e=window.getSelection();if(!e||e.rangeCount===0)return null;const t=e.getRangeAt(0);return!r.contains(t.startContainer)||!r.contains(t.endContainer)?null:t}function Fo(r,e){let t=Po(e);if(!t||t===r||!r.contains(t))return null;for(;t.parentElement&&t.parentElement!==r;)t=t.parentElement;if(t.parentElement!==r)return null;if(t.matches(Ho))return t;const n=t.closest(Ho);return n instanceof HTMLElement&&n.parentElement===r?n:t}function $o(r,e){if(typeof r.intersectsNode=="function")try{return r.intersectsNode(e)}catch(n){return!1}const t=document.createRange();return t.selectNode(e),r.compareBoundaryPoints(Range.END_TO_START,t)<0&&r.compareBoundaryPoints(Range.START_TO_END,t)>0}function va(r,e){const t=Fo(r,e.startContainer),n=Fo(r,e.endContainer);if(!t)return[];if(!n||t===n)return[t];const o=Array.from(r.children).filter(s=>s instanceof HTMLElement).filter(s=>$o(e,s));return o.length>0?o:[t]}function Sa(r,e){Array.from(r.attributes).forEach(t=>{e.setAttribute(t.name,t.value)})}function oi(r,e){for(;r.firstChild;)e.appendChild(r.firstChild)}function wa(r){return r.tagName!=="P"||r.attributes.length>0||(r.textContent||"").trim()!==""?!1:!r.querySelector("img, video, table, iframe, hr, pre, ul, ol")}function Dn(r,e){const t=document.createElement(r);return e&&Sa(e,t),t}function Bo(r,e){const t=Dn(e,r);return oi(r,t),t.innerHTML.trim()||(t.innerHTML="<br>"),t}function xa(r){const e=r.cloneNode(!1);return e instanceof HTMLElement?e:document.createElement(r.tagName.toLowerCase())}function zo(r,e,t){const n=r.parentNode;if(!n)return[];const i=document.createDocumentFragment(),o=[];let s=null;const l=()=>{s&&s.children.length>0&&i.appendChild(s),s=null};return Array.from(r.children).forEach(c=>{if(c instanceof HTMLLIElement){if(e.has(c)){l();const d=Bo(c,t);i.appendChild(d),o.push(d);return}s||(s=xa(r)),s.appendChild(c)}}),l(),n.insertBefore(i,r),n.removeChild(r),o}function Ca(r,e){var n;if(r.tagName.toLowerCase()===e)return[r];const t=Dn(e,r);return oi(r,t),t.innerHTML.trim()||(t.innerHTML="<br>"),(n=r.parentNode)==null||n.replaceChild(t,r),[t]}function Aa(r,e){const t=r.parentNode;if(!t)return[];const n=document.createDocumentFragment(),i=[];return Array.from(r.childNodes).forEach(o=>{if(o instanceof HTMLElement&&wa(o)){o.remove();return}if(o instanceof HTMLUListElement||o instanceof HTMLOListElement){Array.from(o.children).forEach(l=>{if(!(l instanceof HTMLLIElement))return;const c=Bo(l,e);n.appendChild(c),i.push(c)}),o.remove();return}if(o instanceof HTMLElement&&No.has(o.tagName)){const l=Dn(e,o);oi(o,l),n.appendChild(l),i.push(l);return}if(o.nodeType===Node.TEXT_NODE&&(o.textContent||"").trim()===""){o.remove();return}const s=Dn(e,r);s.appendChild(o),n.appendChild(s),i.push(s)}),t.insertBefore(n,r),t.removeChild(r),i}function ka(r){const e=window.getSelection();if(!e)return;const t=document.createRange(),n=r instanceof HTMLElement&&r.querySelector("p,li,h1,h2,h3,h4,h5,h6")||r;t.selectNodeContents(n),t.collapse(!0),e.removeAllRanges(),e.addRange(t)}function Ma(r){r.dispatchEvent(new Event("input",{bubbles:!0}))}function La(r,e,t){const n=window.execEditorCommand;if(typeof n=="function"){n("recordDomTransaction",r,e,t);return}const i=window.executeEditorCommand;typeof i=="function"&&i("recordDomTransaction",{editor:r,beforeHTML:e,afterHTML:t})}function Ra(r,e){const t=new Map;return Array.from(r.querySelectorAll("li")).filter(i=>i instanceof HTMLLIElement&&$o(e,i)).forEach(i=>{var s;const o=i.parentElement;(o instanceof HTMLUListElement||o instanceof HTMLOListElement)&&o.parentElement===r&&(t.has(o)||t.set(o,new Set),(s=t.get(o))==null||s.add(i))}),t}function Bt(r,e){const t=r.toLowerCase();if(!ya.has(t))return!1;const n=Ta(e);if(!n)return!1;const i=Ea(n);if(!i)return!1;const o=n.innerHTML,s=[],l=Ra(n,i),c={startContainer:i.startContainer,startOffset:i.startOffset,endContainer:i.endContainer,endOffset:i.endOffset};l.size>0?l.forEach((u,f)=>{s.push(...zo(f,u,t))}):va(n,i).forEach(f=>{if(f instanceof HTMLUListElement||f instanceof HTMLOListElement){const p=new Set(Array.from(f.children).filter(y=>y instanceof HTMLLIElement));s.push(...zo(f,p,t));return}if(No.has(f.tagName)){const p=f.querySelector(":scope > ul, :scope > ol, :scope > blockquote, :scope > table");s.push(...p?Aa(f,t):Ca(f,t))}});const d=n.innerHTML;if(o===d||s.length===0)return!1;if(La(n,o,d),Ma(n),n.contains(c.startContainer)&&n.contains(c.endContainer)){const u=document.createRange();u.setStart(c.startContainer,c.startOffset),u.setEnd(c.endContainer,c.endOffset);const f=window.getSelection();f==null||f.removeAllRanges(),f==null||f.addRange(u)}else ka(s[0]);return!0}const Oa=Object.freeze(Object.defineProperty({__proto__:null,HeadingPlugin:()=>({name:"heading",toolbar:[{label:"P",command:"setBlockType",type:"dropdown",options:[{value:"p",label:"P"},{value:"h1",label:"H1"},{value:"h2",label:"H2"},{value:"h3",label:"H3"},{value:"h4",label:"H4"},{value:"h5",label:"H5"},{value:"h6",label:"H6"}],icon:'<svg width="24" height="24" focusable="false"><path d="M16.1 8.6 14.2 4l-1.4.5 2.8 7.4c.1.4.5.6.9.6h.1c.4-.1.6-.5.6-.9l1.8-4.8-1.4-.5-1.5 2.3ZM4 11.5h6V10H4v1.5ZM18.5 3v1L17 7l.9.9L20.7 3h-2.2ZM5.5 12h1v7h1v-7h1v-.5h-3V12Zm4 0h1v7h1v-7h1v-.5h-3V12Zm10 1.5a2 2 0 0 0-2-2h-1v7.5h1v-2.7h1a2 2 0 0 0 2-2v-.8Zm-2 1.3h-1v-2.3h1a.8.8 0 1 1 0 1.6v.7Z" fill-rule="evenodd"></path></svg>'}],commands:{setBlockType:(r,e)=>r?Bt(r,e):!1,setHeading1:(r,e)=>Bt("h1",e),setHeading2:(r,e)=>Bt("h2",e),setHeading3:(r,e)=>Bt("h3",e),setParagraph:(r,e)=>Bt("p",e)},keymap:{"Mod-Alt-1":"setHeading1","Mod-Alt-2":"setHeading2","Mod-Alt-3":"setHeading3","Mod-Alt-0":"setParagraph"}})},Symbol.toStringTag,{value:"Module"})),zt='.rte-content, .editora-content, [contenteditable="true"]',_a="[data-editora-editor], .rte-editor, .editora-editor, editora-editor",Uo=["p","div","h1","h2","h3","h4","h5","h6","ul","ol","blockquote","pre","table"].join(",");function ri(r){return r?r.nodeType===Node.ELEMENT_NODE?r:r.parentElement:null}function Ia(r){const e=r==null?void 0:r.contentElement;if(e instanceof HTMLElement)return e;const t=r==null?void 0:r.editorElement;if(t instanceof HTMLElement){const s=t.querySelector(zt);if(s instanceof HTMLElement)return s;if(t.getAttribute("contenteditable")==="true")return t}const n=window.getSelection();if(n&&n.rangeCount>0){const s=ri(n.getRangeAt(0).startContainer),l=s==null?void 0:s.closest(zt);if(l instanceof HTMLElement)return l;const c=s==null?void 0:s.closest(_a),d=c==null?void 0:c.querySelector(zt);if(d instanceof HTMLElement)return d}const i=document.activeElement,o=i==null?void 0:i.closest(zt);return o instanceof HTMLElement?o:document.querySelector(zt)}function Da(r){const e=window.getSelection();if(!e||e.rangeCount===0)return null;const t=e.getRangeAt(0);return!r.contains(t.startContainer)||!r.contains(t.endContainer)?null:t}function Wo(r,e){let t=ri(e);if(!t||t===r||!r.contains(t))return null;for(;t.parentElement&&t.parentElement!==r;)t=t.parentElement;if(t.parentElement!==r)return null;if(t.matches(Uo))return t;const n=t.closest(Uo);return n instanceof HTMLElement&&n.parentElement===r?n:t}function jo(r,e){if(typeof r.intersectsNode=="function")try{return r.intersectsNode(e)}catch(n){return!1}const t=document.createRange();return t.selectNode(e),r.compareBoundaryPoints(Range.END_TO_START,t)<0&&r.compareBoundaryPoints(Range.START_TO_END,t)>0}function Na(r,e){const t=Wo(r,e.startContainer),n=Wo(r,e.endContainer);if(!t)return[];if(!n||t===n)return[t];const o=Array.from(r.children).filter(s=>s instanceof HTMLElement).filter(s=>jo(e,s));return o.length>0?o:[t]}function Ko(r,e){const t=ri(e),n=t==null?void 0:t.closest("blockquote");return n instanceof HTMLQuoteElement&&r.contains(n)?n:null}function Ha(r){return r.tagName!=="P"||r.attributes.length>0||(r.textContent||"").trim()!==""?!1:!r.querySelector("img, video, table, iframe, hr, pre, ul, ol")}function Pa(r){Array.from(r.children).forEach(e=>{Ha(e)&&e.remove()})}function si(r){Pa(r);const e=r.parentNode;if(!e)return;Array.from(r.childNodes).forEach(n=>{e.insertBefore(n,r)}),e.removeChild(r)}function Vo(r){return r.nodeType===Node.TEXT_NODE&&(r.textContent||"").trim()===""}function Go(r){const e=Array.from(r.childNodes).filter(n=>!Vo(n));if(e.length!==1)return null;const t=e[0];return t instanceof HTMLQuoteElement?t:null}function Fa(r){const e=document.createElement("blockquote");return Array.from(r.childNodes).filter(n=>!Vo(n)).forEach(n=>{e.appendChild(n)}),e.childNodes.length||(e.innerHTML="<br>"),r.appendChild(e),e}function $a(r,e){const t=Array.from(r.querySelectorAll("li")).filter(i=>i instanceof HTMLLIElement&&jo(e,i)),n=new Set(t);return t.filter(i=>{var s,l;let o=(s=i.parentElement)==null?void 0:s.closest("li");for(;o;){if(n.has(o))return!1;o=(l=o.parentElement)==null?void 0:l.closest("li")}return!0})}function Ut(r){const e=window.getSelection();if(!e)return;const t=document.createRange(),n=r instanceof HTMLElement&&r.querySelector("p,li,h1,h2,h3,h4,h5,h6")||r;t.selectNodeContents(n),t.collapse(!0),e.removeAllRanges(),e.addRange(t)}function Ba(r){r.dispatchEvent(new Event("input",{bubbles:!0}))}function za(r,e,t){const n=window.execEditorCommand;if(typeof n=="function"){n("recordDomTransaction",r,e,t);return}const i=window.executeEditorCommand;typeof i=="function"&&i("recordDomTransaction",{editor:r,beforeHTML:e,afterHTML:t})}function Ua(r){var u,f;const e=Ia(r);if(!e)return!1;const t=Da(e);if(!t)return!1;const n=e.innerHTML,i=Ko(e,t.startContainer),o=Ko(e,t.endContainer),s=$a(e,t),l=Na(e,t),c=l.length>0&&l.every(p=>p.tagName==="BLOCKQUOTE");if(i&&i===o){const p=i.firstChild||i;si(i),Ut(p)}else if(s.length>0){const p=s.map(Go);if(p.every(Boolean)){const m=((u=p[0])==null?void 0:u.firstChild)||s[0];p.forEach(E=>{E&&si(E)}),Ut(m)}else{const m=s[0];s.forEach(E=>{Go(E)||Fa(E)}),Ut(m)}}else if(c){const p=l[0].firstChild||l[0];l.forEach(si),Ut(p)}else{const p=l.filter(E=>E.tagName!=="BLOCKQUOTE");if(p.length===0)return!1;const y=document.createElement("blockquote"),m=p[0];(f=m.parentNode)==null||f.insertBefore(y,m),p.forEach(E=>{y.appendChild(E)}),Ut(y)}const d=e.innerHTML;return n===d?!1:(za(e,n,d),Ba(e),!0)}const Wa=Object.freeze(Object.defineProperty({__proto__:null,BlockquotePlugin:()=>({name:"blockquote",nodes:{blockquote:{content:"block+",group:"block",parseDOM:[{tag:"blockquote"}],toDOM:()=>["blockquote",0]}},toolbar:[{label:"Quote",command:"toggleBlockquote",icon:'<svg fill="#000000" height="24px" width="24px" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 32 32" xml:space="preserve"><g stroke-width="0"></g><g stroke-linecap="round" stroke-linejoin="round"></g><g> <g> <path d="M13,11c0.6,0,1-0.4,1-1s-0.4-1-1-1c-5,0-9,4-9,9c0,2.8,2.2,5,5,5s5-2.2,5-5s-2.2-5-5-5c-0.3,0-0.7,0-1,0.1 C9.3,11.8,11,11,13,11z"></path> <path d="M23,13c-0.3,0-0.7,0-1,0.1c1.3-1.3,3-2.1,5-2.1c0.6,0,1-0.4,1-1s-0.4-1-1-1c-5,0-9,4-9,9c0,2.8,2.2,5,5,5s5-2.2,5-5 S25.8,13,23,13z"></path> </g> </g></svg>',shortcut:"Mod-Shift-9"}],commands:{toggleBlockquote:(r,e)=>Ua(e)},keymap:{"Mod-Shift-9":"toggleBlockquote"}})},Symbol.toStringTag,{value:"Module"}));function ja(r){let e=!1;r.addEventListener("pointerdown",t=>{e=t.target!==r},!0),r.addEventListener("click",t=>{t.target===r&&e&&t.stopImmediatePropagation(),e=!1},!0)}const qo="rte-dialog-base-styles";function Ka(){if(typeof document=="undefined"||document.getElementById(qo))return;const r=document.createElement("style");r.id=qo,r.textContent=`
|
|
11
|
+
`+O),re&&(O=Ye(O)),N&&je?ie(O):O},e.setConfig=function(){let b=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};vt(b),ft=!0,ze=M,Ue=L},e.clearConfig=function(){Ae=null,ft=!1,ze=null,Ue=null,N=ee,U=""},e.isValidAttribute=function(b,a,h){Ae||vt({});const g=_(b),T=_(a);return wn(g,T,h)},e.addHook=function(b,a){typeof a=="function"&&pe(k,b)&&It(k[b],a)},e.removeHook=function(b,a){if(pe(k,b)){if(a!==void 0){const h=ns(k[b],a);return h===-1?void 0:is(k[b],h,1)[0]}return io(k[b])}},e.removeHooks=function(b){pe(k,b)&&(k[b]=[])},e.removeAllHooks=function(){k=bo()},e}var Ln=yo();const Ms=["p","br","strong","em","u","s","strike","del","b","i","h1","h2","h3","h4","h5","h6","ul","ol","li","a","img","video","audio","table","thead","tbody","tr","th","td","blockquote","pre","code","span","div","section","figure","figcaption","sup","sub","hr"],Ls={"*":["class","style","id","data-*","role","aria-*","tabindex","contenteditable","spellcheck","dir","lang"],a:["href","target","rel","title"],img:["src","alt","width","height","loading"],video:["src","controls","width","height","autoplay","loop","muted"],audio:["src","controls","autoplay","loop","muted"],ol:["start","reversed"],table:["border","cellpadding","cellspacing"],td:["colspan","rowspan","align","valign"],th:["colspan","rowspan","align","valign"],iframe:["src","width","height","name","title","frameborder","scrolling","allowfullscreen","longdesc","allow"]},Rs="data-editora-embed";function Os(r){if(!r||/\s/.test(r.trim()))return!1;try{const e=new URL(r.trim());return(e.protocol==="https:"||e.protocol==="http:")&&e.hostname.length>0}catch(e){return!1}}function To(r,e,t,n){if((e==null?void 0:e.sanitize)===!1)return r;const i=e!=null&&e.allowedTags&&e.allowedTags.length>0?e.allowedTags:Ms,o=t!=null&&t.length?Array.from(new Set([...i,...t])):i,l=!!(e!=null&&e.allowedAttributes)&&Object.keys(e.allowedAttributes).length>0?e.allowedAttributes:Ls,c=new Set;for(const f of Object.values(l))for(const p of f)c.add(p);const d={ALLOWED_TAGS:o,ALLOWED_ATTR:Array.from(c)};if(!n)return Ln.sanitize(r,d);const u=o.includes("iframe");Ln.addHook("uponSanitizeElement",(f,p)=>{var m;if(p.tagName!=="iframe")return;const y=f;p.allowedTags.iframe=u||((m=y.getAttribute)==null?void 0:m.call(y,Rs))==="true"&&Os(y.getAttribute("src"))});try{return Ln.sanitize(r,d)}finally{Ln.removeHook("uponSanitizeElement")}}function _s(r,e,t,n){return To(r,e,n,!1)}function Is(r,e,t){return(t==null?void 0:t.sanitizeOnPaste)===!1?r:_s(r,e)}function Eo(r,e,t,n){return(t==null?void 0:t.sanitizeOnInput)===!1?r:To(r,e,n,!0)}const Ds=".resize-handle, .table-resize-handle, [data-rte-media-pending]",Ns=/resize-handle|data-rte-media-pending|rte-media/;function vo(r){if(!r||!Ns.test(r))return r;const e=document.createElement("template");e.innerHTML=r;const t=new Set;return e.content.querySelectorAll(Ds).forEach(n=>{const i=n.parentElement;i&&(i.tagName==="TD"||i.tagName==="TH")&&t.add(i),n.remove()}),t.forEach(n=>{var i;n.style.position==="relative"&&(n.style.removeProperty("position"),(i=n.getAttribute("style"))!=null&&i.trim()||n.removeAttribute("style"))}),e.content.querySelectorAll("figure.rte-media").forEach(n=>{var o;n.removeAttribute("contenteditable");const i=n.querySelector(":scope > figcaption");i&&(i.removeAttribute("contenteditable"),!((o=i.textContent)!=null&&o.trim())&&!i.querySelector("img, video, a")&&i.remove())}),e.innerHTML}function Pt(r){return r?vo(r.innerHTML):""}const Un=class Un{static resolve(e){const t={};if(Object.assign(t,this.EDITOR_DEFAULTS),e.pluginDefaults&&Object.assign(t,e.pluginDefaults),e.attributes){const n=this.parseAttributes(e.attributes);Object.assign(t,n)}return e.jsConfig&&Object.assign(t,e.jsConfig),this.normalizeConfig(t)}static normalizeConfig(e){const t={...e};if(t.toolbarFloating!==void 0||t.toolbarSticky!==void 0){const s=typeof t.toolbar=="object"&&t.toolbar?{...t.toolbar}:typeof t.toolbar=="string"?{items:t.toolbar}:{};t.toolbarFloating!==void 0&&(s.floating=!!t.toolbarFloating),t.toolbarSticky!==void 0&&(s.sticky=!!t.toolbarSticky),t.toolbar=s}if(t.toolbarItems!==void 0&&typeof t.toolbar=="object"&&t.toolbar&&(t.toolbar.items=t.toolbarItems),t.autosaveEnabled!==void 0||t.autosaveIntervalMs!==void 0||t.autosaveStorageKey!==void 0||t.autosaveProvider!==void 0||t.autosaveApiUrl!==void 0){const s=typeof t.autosave=="object"&&t.autosave?{...t.autosave}:{};t.autosaveEnabled!==void 0&&(s.enabled=!!t.autosaveEnabled),t.autosaveIntervalMs!==void 0&&(s.intervalMs=Number(t.autosaveIntervalMs)),t.autosaveStorageKey!==void 0&&(s.storageKey=t.autosaveStorageKey),t.autosaveProvider!==void 0&&(s.provider=t.autosaveProvider),t.autosaveApiUrl!==void 0&&(s.apiUrl=t.autosaveApiUrl),t.autosave=s}const n={enabled:!1,intervalMs:3e4,storageKey:"rte-autosave",provider:"localStorage",apiUrl:""};if(typeof t.autosave=="boolean")t.autosave={...n,enabled:t.autosave};else if(typeof t.autosave=="object"&&t.autosave){const s={...n,...t.autosave};s.intervalMs===void 0&&s.interval!==void 0&&(s.intervalMs=Number(s.interval)),s.enabled===void 0&&(s.enabled=!0),(!Number.isFinite(s.intervalMs)||s.intervalMs<=0)&&(s.intervalMs=n.intervalMs),t.autosave=s}else t.autosave=n;if(t.languageLocale!==void 0||t.languageDirection!==void 0){const s=typeof t.language=="object"&&t.language?{...t.language}:{};t.languageLocale!==void 0&&(s.locale=t.languageLocale),t.languageDirection!==void 0&&(s.direction=t.languageDirection),t.language=s}const i={locale:"en",direction:"ltr"};if(typeof t.language=="string"?t.language={locale:t.language,direction:i.direction}:typeof t.language=="object"&&t.language?t.language={...i,...t.language}:t.language=i,t.spellcheckEnabled!==void 0||t.spellcheckProvider!==void 0||t.spellcheckApiUrl!==void 0){const s=typeof t.spellcheck=="object"&&t.spellcheck?{...t.spellcheck}:{};t.spellcheckEnabled!==void 0&&(s.enabled=!!t.spellcheckEnabled),t.spellcheckProvider!==void 0&&(s.provider=t.spellcheckProvider),t.spellcheckApiUrl!==void 0&&(s.apiUrl=t.spellcheckApiUrl),t.spellcheck=s}const o={enabled:!1,provider:"browser",apiUrl:""};if(typeof t.spellcheck=="boolean")t.spellcheck={...o,enabled:t.spellcheck};else if(typeof t.spellcheck=="object"&&t.spellcheck){const s={...o,...t.spellcheck};!s.provider&&s.mode&&(s.provider=s.mode==="local"?"browser":"api"),s.enabled===void 0&&(s.enabled=!!(s.mode||s.provider||s.apiUrl)),t.spellcheck=s}else t.spellcheck=o;return t.contextMenuEnabled!==void 0&&(t.contextMenu={enabled:!!t.contextMenuEnabled}),typeof t.contextMenu=="boolean"?t.contextMenu={enabled:t.contextMenu}:typeof t.contextMenu=="object"&&t.contextMenu?t.contextMenu={enabled:t.contextMenu.enabled!==!1}:t.contextMenu={enabled:!0},(t.pasteClean!==void 0||t.pasteKeepFormatting!==void 0||t.pasteConvertWord!==void 0)&&(t.paste={...t.paste||{},...t.pasteClean!==void 0?{clean:!!t.pasteClean}:{},...t.pasteKeepFormatting!==void 0?{keepFormatting:!!t.pasteKeepFormatting}:{},...t.pasteConvertWord!==void 0?{convertWord:!!t.pasteConvertWord}:{}}),t.paste={clean:!0,keepFormatting:!1,convertWord:!0,...t.paste||{}},t.contentConfig={allowedTags:[],allowedAttributes:{},sanitize:!0,...t.contentConfig||{}},(t.securitySanitizeOnPaste!==void 0||t.securitySanitizeOnInput!==void 0)&&(t.security={...t.security||{},...t.securitySanitizeOnPaste!==void 0?{sanitizeOnPaste:!!t.securitySanitizeOnPaste}:{},...t.securitySanitizeOnInput!==void 0?{sanitizeOnInput:!!t.securitySanitizeOnInput}:{}}),t.security={sanitizeOnPaste:!0,sanitizeOnInput:!0,...t.security||{}},(t.accessibilityEnableAria!==void 0||t.accessibilityKeyboardNavigation!==void 0||t.accessibilityChecker!==void 0)&&(t.accessibility={...t.accessibility||{},...t.accessibilityEnableAria!==void 0?{enableARIA:!!t.accessibilityEnableAria}:{},...t.accessibilityKeyboardNavigation!==void 0?{keyboardNavigation:!!t.accessibilityKeyboardNavigation}:{},...t.accessibilityChecker!==void 0?{checker:!!t.accessibilityChecker}:{}}),typeof t.accessibility=="boolean"&&(t.accessibility={enableARIA:t.accessibility,keyboardNavigation:t.accessibility,checker:!1}),t.accessibility={enableARIA:!0,keyboardNavigation:!0,checker:!1,...t.accessibility||{}},(t.performanceDebounceInputMs!==void 0||t.performanceViewportOnlyScan!==void 0)&&(t.performance={...t.performance||{},...t.performanceDebounceInputMs!==void 0?{debounceInputMs:Number(t.performanceDebounceInputMs)}:{},...t.performanceViewportOnlyScan!==void 0?{viewportOnlyScan:!!t.performanceViewportOnlyScan}:{}}),typeof t.performance=="boolean"&&(t.performance={debounceInputMs:100,viewportOnlyScan:t.performance}),t.performance={debounceInputMs:100,viewportOnlyScan:!0,...t.performance||{}},(typeof t.performance.debounceInputMs!="number"||!Number.isFinite(t.performance.debounceInputMs)||t.performance.debounceInputMs<0)&&(t.performance.debounceInputMs=100),t}static parseAttributes(e){const t={};for(const[n,i]of Object.entries(e)){const o=this.kebabToCamel(n);t[o]=this.BOOLEAN_ATTRIBUTES.has(n)&&(i===""||i===n)?!0:this.parseAttributeValue(i)}return t}static parseAttributeValue(e){if(e==="true")return!0;if(e==="false")return!1;if(/^\d+$/.test(e))return parseInt(e,10);if(/^\d+\.\d+$/.test(e))return parseFloat(e);if(e.startsWith("{")||e.startsWith("["))try{return JSON.parse(e)}catch(t){return e}return e}static kebabToCamel(e){return e.replace(/-([a-z])/g,(t,n)=>n.toUpperCase())}static validate(e){const t=[];return e.height!==void 0&&typeof e.height=="number"&&e.height<0&&t.push("height must be a positive number"),e.width!==void 0&&typeof e.width=="number"&&e.width<0&&t.push("width must be a positive number"),e.plugins!==void 0&&!Array.isArray(e.plugins)&&typeof e.plugins!="string"&&t.push("plugins must be an array or string"),e.theme!==void 0&&typeof e.theme!="string"&&t.push("theme must be a string"),{valid:t.length===0,errors:t}}static getDefaults(){return{...this.EDITOR_DEFAULTS}}static merge(...e){const t={};for(const n of e)for(const[i,o]of Object.entries(n))o!=null&&(typeof o=="object"&&!Array.isArray(o)&&t[i]?t[i]=this.merge(t[i],o):t[i]=o);return t}};Un.EDITOR_DEFAULTS={height:400,width:"100%",readonly:!1,disabled:!1,menubar:!0,toolbar:!0,plugins:[],theme:"light",content:"",placeholder:"Start typing...",autofocus:!1,autosave:!1,accessibility:{enableARIA:!0,keyboardNavigation:!0,checker:!1},performance:{debounceInputMs:100,viewportOnlyScan:!0},spellcheck:{enabled:!1,provider:"browser",apiUrl:""},language:{locale:"en",direction:"ltr"},contextMenu:{enabled:!0},contentConfig:{allowedTags:[],allowedAttributes:{},sanitize:!0},paste:{clean:!0,keepFormatting:!1,convertWord:!0},security:{sanitizeOnPaste:!0,sanitizeOnInput:!0},statusbar:!1},Un.BOOLEAN_ATTRIBUTES=new Set(["readonly","disabled","autofocus","statusbar","toolbar-floating","toolbar-sticky","autosave-enabled","accessibility-enable-aria","accessibility-keyboard-navigation","accessibility-checker","performance-viewport-only-scan","spellcheck-enabled","context-menu-enabled","paste-clean","paste-keep-formatting","paste-convert-word","security-sanitize-on-paste","security-sanitize-on-input"]);let Zn=Un;const Hs='.editora-editor{display:flex;flex-direction:column;border:1px solid #ddd;border-radius:4px;background:#fff;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,sans-serif;font-size:14px;overflow:hidden}.editora-editor *{box-sizing:border-box}.editora-theme-light{background:#fff;color:#333}.editora-theme-dark{--editora-dark-toolbar-bg-start: #353d48;--editora-dark-toolbar-bg-end: #2d3540;--editora-dark-button-bg-start: #46505f;--editora-dark-button-bg-end: #3b4553;--editora-dark-button-hover-start: #525d6d;--editora-dark-button-hover-end: #465262;--editora-dark-button-active-start: #5eaaf6;--editora-dark-button-active-end: #4a95de;--editora-dark-border: #475263;--editora-dark-border-strong: #566275;--editora-dark-text: #e1e9f5;--editora-dark-text-strong: #f3f7ff;--editora-dark-text-muted: #aeb9cc;--editora-dark-surface: #1d242d;--editora-dark-content: #1f2732;background:linear-gradient(180deg,#1b2330,#1c2430);color:var(--editora-dark-text);border-color:var(--editora-dark-border)}.editora-toolbar{display:flex;align-items:center;gap:4px;padding:8px;background:#f5f5f5;border-bottom:1px solid #ddd;flex-wrap:wrap}.editora-theme-dark .editora-toolbar{background:linear-gradient(180deg,var(--editora-dark-toolbar-bg-start) 0%,var(--editora-dark-toolbar-bg-end) 100%);border-bottom-color:var(--editora-dark-border);box-shadow:inset 0 1px #ffffff0d}.editora-toolbar-sticky{position:sticky;top:0;z-index:100;position:-webkit-sticky}.editora-toolbar-group{display:flex;align-items:center;gap:2px}.editora-toolbar-button{padding:6px 12px;border:1px solid #ccc;background:#fff;cursor:pointer;border-radius:3px;font-weight:600;font-size:14px;height:30px;display:flex;align-items:center;white-space:nowrap}.editora-toolbar-group-button{display:flex;align-items:center}.editora-toolbar-input.font-size{width:40px;padding:.25rem;text-align:center;font-size:14px;background:#fff;border:1px solid var(--rte-color-border-light);border-radius:var(--rte-radius-sm)}.editora-toolbar-group-items{display:flex;align-items:center;border:1px solid #ccc;.editora-toolbar-button{border:none;border-radius:0;&:first-child{border-right:1px solid #ccc;border-top-left-radius:3px;border-bottom-left-radius:3px}&:last-child{border:0px solid #ccc;border-radius:0!important}&:hover{background:#e0e0e0;border-color:#ccc}}}.editora-theme-dark .editora-toolbar-button{background:linear-gradient(180deg,var(--editora-dark-button-bg-start) 0%,var(--editora-dark-button-bg-end) 100%);border-color:var(--editora-dark-border-strong);color:var(--editora-dark-text);box-shadow:inset 0 1px #ffffff14,0 1px 1px #00000059}.editora-theme-dark .editora-toolbar-group-items{border-color:var(--editora-dark-border-strong);background:linear-gradient(180deg,var(--editora-dark-button-bg-start) 0%,var(--editora-dark-button-bg-end) 100%)}.editora-theme-dark .editora-toolbar-group-items .editora-toolbar-button:first-child{border-right-color:#566275}.editora-theme-dark .editora-toolbar-group-items .editora-toolbar-button:last-child{border-left-color:#566275}.editora-theme-dark .editora-toolbar-input.font-size{background-color:#2e3642;color:var(--editora-dark-text-strong);border-color:var(--editora-dark-border-strong);caret-color:var(--editora-dark-text-strong)}.editora-theme-dark .editora-toolbar-input.font-size::placeholder{color:var(--editora-dark-text-strong);opacity:1}.editora-toolbar-button:hover{background:#e0e0e0;border-color:#ccc}.editora-theme-dark .editora-toolbar-button:hover{background:linear-gradient(180deg,var(--editora-dark-button-hover-start) 0%,var(--editora-dark-button-hover-end) 100%);border-color:#66748a;color:var(--editora-dark-text-strong)}.editora-toolbar-button:active,.editora-toolbar-button.active{background:#d0d0d0;border-color:#999}.editora-theme-dark .editora-toolbar-button:active,.editora-theme-dark .editora-toolbar-button.active{background:linear-gradient(180deg,var(--editora-dark-button-active-start) 0%,var(--editora-dark-button-active-end) 100%);border-color:#67adf4;color:#0f1b2a}.editora-theme-dark .editora-toolbar-button:disabled{background:#313946;border-color:#424d5e;color:#7f8ca1}.editora-theme-dark .editora-toolbar-button[data-command=insertTable],.editora-theme-dark .editora-toolbar-button[data-command=print],.editora-theme-dark .editora-toolbar-button[data-command=toggleSpellCheck],.editora-theme-dark .editora-toolbar-button[data-command=toggleA11yChecker],.editora-theme-dark .editora-toolbar-button[data-command=setDirectionLTR],.editora-theme-dark .editora-toolbar-button[data-command=setDirectionRTL]{color:#f1f6ff}.editora-toolbar-button:disabled{opacity:.5;cursor:not-allowed}.editora-toolbar-icon{display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;line-height:1}.editora-toolbar-button svg,.editora-toolbar-icon svg{width:20px;height:20px;display:block;color:currentColor}.editora-theme-dark .editora-toolbar-button svg:not([fill=none i]),.editora-theme-dark .editora-toolbar-icon svg:not([fill=none i]){fill:currentColor}.editora-theme-dark .editora-toolbar-icon,.editora-theme-dark .editora-toolbar-icon *{color:inherit}.editora-theme-dark :is(.editora-toolbar-button,.editora-toolbar-icon) svg :is([stroke="#000" i],[stroke="#000000" i],[stroke=black i],[stroke="#0f0f0f" i],[stroke="#111111" i],[style*="stroke:#000" i],[style*="stroke: #000" i],[style*="stroke:black" i],[style*="stroke: black" i],[style*="stroke:#0f0f0f" i],[style*="stroke: #0f0f0f" i]){stroke:currentColor!important}.editora-theme-dark :is(.editora-toolbar-button,.editora-toolbar-icon) svg :is([fill="#000" i],[fill="#000000" i],[fill=black i],[fill="#0f0f0f" i],[fill="#111111" i],[style*="fill:#000" i],[style*="fill: #000" i],[style*="fill:black" i],[style*="fill: black" i],[style*="fill:#0f0f0f" i],[style*="fill: #0f0f0f" i]){fill:currentColor!important}.editora-toolbar-separator{width:1px;height:24px;background:#ddd;margin:0 4px}.editora-theme-dark .editora-toolbar-separator{background:#4d596b}.editora-toolbar-items-container{display:flex;align-items:center;gap:4px;flex:1;min-width:0;overflow:hidden}.editora-toolbar-more-button{display:flex;align-items:center;justify-content:center;width:30px;height:30px;flex-shrink:0;padding:0;border:1px solid #ccc;background:#fff;cursor:pointer;border-radius:3px;font-size:16px}.editora-toolbar-more-button:hover{background:#e0e0e0}.editora-toolbar-more-button.active{background:#d0d0d0;border-color:#999}.editora-theme-dark .editora-toolbar-more-button{background:var(--editora-dark-content);border-color:var(--editora-dark-border);color:var(--editora-dark-text)}.editora-theme-dark .editora-toolbar-more-button:hover,.editora-theme-dark .editora-toolbar-more-button.active{background:#3a4554;border-color:#607088}.editora-toolbar-expanded-row{display:none;flex-wrap:wrap;align-items:center;gap:4px;width:100%;padding:8px;border-top:1px solid #ddd;background:#f5f5f5}.editora-toolbar-expanded-row.show{display:flex}.editora-theme-dark .editora-toolbar-expanded-row{border-top-color:var(--editora-dark-border);background:linear-gradient(180deg,var(--editora-dark-toolbar-bg-start) 0%,var(--editora-dark-toolbar-bg-end) 100%)}.editora-toolbar-dropdown{position:relative}.editora-toolbar-dropdown-menu{position:absolute;top:100%;left:0;min-width:150px;margin-top:4px;padding:4px 0;background:#fff;border:1px solid #ddd;border-radius:4px;box-shadow:0 2px 8px #00000026;z-index:1000}.editora-theme-dark .editora-toolbar-dropdown-menu{background:#29323d;border-color:#4d596b;box-shadow:0 8px 20px #00000073}.editora-toolbar-dropdown-item{display:block;width:100%;padding:8px 12px;border:none;background:transparent;color:#333;text-align:left;cursor:pointer;font-size:13px;transition:background .15s ease}.editora-theme-dark .editora-toolbar-dropdown-item{color:#d7deea}.editora-toolbar-dropdown-item:hover{background:#f5f5f5}.editora-theme-dark .editora-toolbar-dropdown-item:hover{background:#3a4554;color:#f0f6ff}.editora-content{flex:1;min-height:200px;padding:16px;outline:none;overflow-y:auto;line-height:1.6}.editora-theme-dark .editora-content{color:#ecf3ff;background:linear-gradient(180deg,var(--editora-dark-content) 0%,#1c232e 100%)}.editora-content:empty:before{content:attr(data-placeholder);color:#999;pointer-events:none}.editora-theme-dark .editora-content:empty:before{color:#8f9bb0}.editora-content h1{font-size:2em;margin:.67em 0;font-weight:600}.editora-content h2{font-size:1.5em;margin:.75em 0;font-weight:600}.editora-content h3{font-size:1.17em;margin:.83em 0;font-weight:600}.editora-content p{margin:1em 0}.editora-theme-dark .editora-content,.editora-theme-dark .editora-content :is(p,span,div,li,ul,ol,td,th,h1,h2,h3,h4,h5,h6,strong,em,u,s,small,sub,sup,blockquote,code,pre,a){color:#ecf3ff}.editora-content ul,.editora-content ol{margin:1em 0;padding-left:2em}.editora-content a{color:#06c;text-decoration:underline}.editora-theme-dark .editora-content a{color:#ecf3ff}.editora-content code{padding:2px 4px;background:#f5f5f5;border-radius:3px;font-family:Monaco,Menlo,Consolas,monospace;font-size:.9em}.editora-theme-dark .editora-content code{background:#1e1e1e}.editora-content pre{padding:12px;background:#f5f5f5;border-radius:4px;overflow-x:auto;margin:1em 0}.editora-theme-dark .editora-content pre{background:#1e1e1e}.editora-theme-dark .rte-code-block{background:linear-gradient(180deg,#212a36,#1b2430)!important;border-color:#4f5b70!important;color:#e7effc!important}.editora-theme-dark .rte-code-block code{color:#e7effc!important}.editora-theme-dark .rte-code-block:before{background:#111927!important;color:#dce8ff!important}.editora-theme-dark .rte-code-block .rte-code-copy{background:#2b3441!important;border-color:#5a667b!important;color:#dce8ff!important}.editora-content blockquote{margin:1em 0;padding-left:1em;border-left:4px solid #ddd;color:#666}.editora-theme-dark .editora-content blockquote{border-left-color:#3c3c3c;color:#ecf3ff}.editora-floating-toolbar{position:absolute;padding:4px;background:#fff;border:1px solid #ddd;border-radius:4px;box-shadow:0 2px 8px #00000026;z-index:1000}.editora-theme-dark .editora-floating-toolbar{background:#29323d;border-color:#4d596b;box-shadow:0 8px 20px #00000073}.editora-statusbar-container{display:flex;flex-direction:column}.editora-statusbar-left{display:flex;align-items:center;gap:8px}.editora-statusbar-right{display:flex;align-items:center;gap:8px;margin-left:auto}.editora-statusbar{display:flex;align-items:center;gap:12px;padding:6px 12px;background:#f5f5f5;border-top:1px solid #ddd;font-size:12px;color:#666}.editora-theme-dark .editora-statusbar{background:linear-gradient(180deg,#2c3440,#252d37);border-top-color:#3f4a5b;color:#d7deea}.editora-statusbar-item{white-space:nowrap}.editora-statusbar-separator{color:#ddd}.editora-theme-dark .editora-statusbar-separator{color:#566275}.editora-editor[readonly] .editora-content{background:#fafafa;cursor:not-allowed}.editora-theme-dark.editora-editor[readonly] .editora-content{background:#1a1a1a}.editora-editor:focus-within{border-color:#06c;box-shadow:0 0 0 3px #0066cc1a}.editora-theme-dark.editora-editor:focus-within{border-color:#4db8ff;box-shadow:0 0 0 3px #4db8ff1a}.editora-editor[disabled]{opacity:.6;pointer-events:none}@media(max-width:768px){.editora-toolbar{padding:4px}.editora-toolbar-button{min-width:28px;min-height:28px;padding:4px 8px;font-size:12px}.editora-content{padding:12px}}.editora-content ::selection{background:#06c3}.editora-theme-dark .editora-content ::selection{background:#4db8ff33}.editora-content table{border-collapse:collapse;width:100%;margin:1em 0}.editora-content th,.editora-content td{border:1px solid #ddd;padding:8px 12px;text-align:left}.editora-theme-dark .editora-content th,.editora-theme-dark .editora-content td{border-color:#3c3c3c}.editora-content th{background:#f5f5f5;font-weight:600}.editora-theme-dark .editora-content th{background:#252526}.editora-content img{max-width:100%;height:auto;border-radius:4px;display:block}.editora-content video{max-width:100%;height:auto;border-radius:4px;display:block}.editora-editor.loading{opacity:.7;pointer-events:none}.editora-editor.loading:after{content:"";position:absolute;top:50%;left:50%;width:24px;height:24px;margin:-12px 0 0 -12px;border:3px solid #ddd;border-top-color:#06c;border-radius:50%;animation:editora-spin .8s linear infinite}@keyframes editora-spin{to{transform:rotate(360deg)}}.toolbar-container-wrapper{display:flex;align-items:center;background:#fff;border-bottom:1px solid #e0e0e0;padding:0;margin:0;width:100%;box-sizing:border-box;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,sans-serif;font-size:14px;line-height:1.5;position:relative}.toolbar-container-wrapper[data-toolbar-sticky=true]{position:sticky;top:0;z-index:999;box-shadow:0 2px 4px #0000001a}.toolbar-container-wrapper[data-toolbar-floating=true]{position:fixed;top:0;left:0;right:0;z-index:1000;box-shadow:0 4px 12px #00000026}.toolbar-container-wrapper[data-toolbar-position=bottom]{border-bottom:none;border-top:1px solid #e0e0e0}.toolbar-container-wrapper .toolbar-wrapper{display:flex;width:100%;padding:8px;gap:4px;flex-wrap:wrap;align-items:center}.toolbar-container-wrapper .toolbar{display:flex;width:100%;gap:4px;flex-wrap:wrap;align-items:center}.toolbar-container-wrapper .toolbar-container{display:flex;gap:4px;flex-wrap:wrap;align-items:center;flex:1;position:relative}.toolbar-container-wrapper .toolbar-item{display:flex;align-items:center;gap:2px}.toolbar-container-wrapper .toolbar-button{padding:6px 10px;border:1px solid #d1d5db;background:#fff;border-radius:4px;cursor:pointer;font-size:13px;display:flex;align-items:center;justify-content:center;gap:4px;transition:all .15s ease;min-height:32px;white-space:nowrap}.toolbar-container-wrapper .toolbar-button:hover{background-color:#f3f4f6;border-color:#9ca3af}.toolbar-container-wrapper .toolbar-button:active,.toolbar-container-wrapper .toolbar-button[data-active=true]{background-color:#06c;color:#fff;border-color:#0052a3;box-shadow:inset 0 1px 3px #0000001a}.toolbar-container-wrapper .toolbar-button:disabled{opacity:.5;cursor:not-allowed;background-color:#f9fafb}.toolbar-container-wrapper .toolbar-more-button{padding:6px 8px;font-size:16px;font-weight:500;line-height:1}.toolbar-container-wrapper .toolbar-separator{width:1px;height:24px;background-color:#d1d5db;margin:0 4px}.toolbar-container-wrapper .toolbar-icon{display:inline-flex;align-items:center;justify-content:center;width:18px;height:18px;flex-shrink:0}.toolbar-container-wrapper .toolbar-icon svg{width:100%;height:100%}.toolbar-container-wrapper .toolbar-dropdown{position:relative;display:flex;align-items:center}.toolbar-container-wrapper .toolbar-dropdown-arrow{font-size:10px;margin-left:2px;line-height:1}.toolbar-container-wrapper .toolbar-dropdown-menu{position:absolute;top:100%;left:0;background:#fff;border:1px solid #d1d5db;border-radius:6px;box-shadow:0 4px 12px #00000026;z-index:1000;min-width:160px;padding:4px 0;margin-top:4px;display:none}.toolbar-container-wrapper .toolbar-dropdown-menu.show{display:block}.toolbar-container-wrapper .toolbar-dropdown-item{display:block;width:100%;padding:8px 12px;border:none;background:transparent;text-align:left;cursor:pointer;font-size:13px;color:#1f2937;transition:background-color .15s ease;font-family:inherit}.toolbar-container-wrapper .toolbar-dropdown-item:hover{background-color:#f3f4f6}.toolbar-container-wrapper .toolbar-dropdown-item:active{background-color:#e5e7eb}.toolbar-container-wrapper .toolbar-input{padding:6px 8px;border:1px solid #d1d5db;border-radius:4px;font-size:13px;font-family:inherit;background-color:#fff;color:#1f2937;transition:all .15s ease}.toolbar-container-wrapper .toolbar-input:focus{outline:none;border-color:#06c;box-shadow:0 0 0 3px #0066cc1a;background-color:#fff}.toolbar-container-wrapper .toolbar-input::placeholder{color:#9ca3af}.toolbar-overflow-menu{animation:slideDown .2s ease-out}@keyframes slideDown{0%{opacity:0;transform:translateY(-8px)}to{opacity:1;transform:translateY(0)}}.toolbar-overflow-item{transition:background-color .15s ease}.floating-toolbar{user-select:none;-webkit-user-select:none;font-family:system-ui,-apple-system,sans-serif;font-size:14px;animation:fadeInUp .15s ease-out}@keyframes fadeInUp{0%{opacity:0;transform:translate(-50%) translateY(10px)}to{opacity:1;transform:translate(-50%) translateY(0)}}.floating-toolbar-btn{display:flex;align-items:center;justify-content:center;width:32px;height:32px;border:none;background:transparent;border-radius:4px;color:#495057;cursor:pointer;font-size:14px;font-weight:500;transition:all .15s ease;outline:none}.floating-toolbar-btn:hover{background:#f8f9fa;color:#212529}.floating-toolbar-btn:active{background:#e9ecef;transform:scale(.95)}.floating-toolbar-btn.floating-toolbar-toggle{color:#dc3545;font-weight:700}.floating-toolbar-btn.floating-toolbar-toggle:hover{background:#f8d7da;color:#721c24}.floating-toolbar-separator{width:1px;height:20px;background:#e1e5e9;margin:0 2px}@media(max-width:768px){.toolbar-container-wrapper .toolbar-button{padding:5px 8px;font-size:12px;min-height:28px}.toolbar-container-wrapper .toolbar-icon{width:16px;height:16px}.toolbar-container-wrapper .toolbar-dropdown-menu{min-width:140px}.toolbar-container-wrapper .toolbar-dropdown-item{padding:6px 10px;font-size:12px}.floating-toolbar{padding:4px;gap:2px}.floating-toolbar-btn{width:28px;height:28px;font-size:12px}}@media(max-width:480px){.toolbar-container-wrapper{padding:4px}.toolbar-container-wrapper .toolbar-wrapper{padding:4px;gap:2px}.toolbar-container-wrapper .toolbar-button{padding:4px 6px;font-size:11px;min-height:24px}.toolbar-container-wrapper .toolbar-icon{width:14px;height:14px}}.floating-toolbar{pointer-events:auto}.floating-toolbar{max-width:calc(100vw - 20px);overflow-x:auto}@media(prefers-color-scheme:dark){.floating-toolbar{background:#2d3748;border-color:#4a5568;color:#e2e8f0}.floating-toolbar-btn:hover{background:#4a5568;color:#f7fafc}.floating-toolbar-btn:active{background:#718096}.floating-toolbar-separator{background:#4a5568}}';let Rn;const Ps="__editoraCommandEditorRoot",Fs="__editoraLastCommandButton",So="editora-editor, [data-editora-editor], .rte-editor, .editora-editor",wo=".rte-content, .editora-content",$s="Rich text editor",Qn=new Set;let tt=null,xo=!1,Jn=null,ei=null;function Co(r){if(!(r instanceof HTMLElement))return!1;const e=r;return typeof e.execCommand=="function"&&(e.tagName.toLowerCase()==="editora-editor"||e.classList.contains("editora-editor")||e.hasAttribute("data-editora-editor"))}function Bs(r){return r?r.nodeType===Node.ELEMENT_NODE?r:r.parentElement:null}function Ft(r){if(!r)return null;if(Co(r))return r;const e=r.matches(So)?r:r.closest(So);return!e||!Co(e)?null:e}function zs(){var i;if(typeof window=="undefined")return null;const r=window[Ps];if(r instanceof HTMLElement){const o=Ft(r);if(o)return o;const s=r.matches(wo)?r:r.querySelector(wo);if(s){const l=Ft(s);if(l)return l}}const e=window[Fs];if(e instanceof HTMLElement){const o=Ft(e);if(o)return o}const t=document.activeElement;if(t){const o=Ft(t);if(o)return o}const n=(i=window.getSelection)==null?void 0:i.call(window);if(n&&n.rangeCount>0){const o=Ft(Bs(n.getRangeAt(0).startContainer));if(o)return o}if(tt&&tt.isConnected)return tt;for(const o of Qn)if(o.isConnected)return o;return null}function Us(){if(typeof window=="undefined"||xo)return;Jn=typeof window.executeEditorCommand=="function"?window.executeEditorCommand.bind(window):null,ei=typeof window.execEditorCommand=="function"?window.execEditorCommand.bind(window):null;const r=(e,...t)=>{const n=zs();return n?n.execCommand(e,...t):Jn?Jn(e,...t):ei?ei(e,...t):!1};window.executeEditorCommand=r,window.execEditorCommand=r,xo=!0}function Ws(){const r="editora-webcomponent-styles";if(!document.getElementById(r)){const e=document.createElement("style");e.id=r,e.textContent=Hs,document.head.appendChild(e)}}function js(){if(!Rn){const r=Fe.__globalPluginLoader;r?Rn=r:Rn=new At}return Rn}class Fe extends HTMLElement{constructor(){if(super(),this.pluginLoader=js(),this.config={},this.isInitialized=!1,this.buildGeneration=0,this.keyboardShortcutManager=new Gr,this.lastAutosavedContent="",this.preservedContent=null,this.loadedPlugins=[],this.lastBeforeInputType=null,this.pendingHistorySnapshot=null,Ws(),!this.hasAttribute("data-initial-content")){const e=this.innerHTML.trim();e&&this.setAttribute("data-initial-content",e)}}static get observedAttributes(){return["height","width","menubar","plugins","toolbar","toolbar-items","toolbar-floating","toolbar-sticky","readonly","disabled","theme","placeholder","aria-label","autofocus","autosave","autosave-enabled","autosave-interval-ms","autosave-storage-key","autosave-provider","autosave-api-url","accessibility","accessibility-enable-aria","accessibility-keyboard-navigation","accessibility-checker","performance","performance-debounce-input-ms","performance-viewport-only-scan","language","language-locale","language-direction","spellcheck","spellcheck-enabled","spellcheck-provider","context-menu","context-menu-enabled","paste","paste-clean","paste-keep-formatting","paste-convert-word","security","security-sanitize-on-paste","security-sanitize-on-input","statusbar"]}connectedCallback(){this.config=this.resolveConfig(),this.waitForPluginLoader().then(()=>{setTimeout(async()=>{await this.initialize()},0)})}async waitForPluginLoader(){if(Fe.__globalPluginLoader){this.pluginLoader=Fe.__globalPluginLoader;return}return new Promise(e=>{const t=()=>{Fe.__globalPluginLoader?(this.pluginLoader=Fe.__globalPluginLoader,e()):setTimeout(t,0)};t()})}disconnectedCallback(){this.destroy()}attributeChangedCallback(e,t,n){t!==n&&(this.config=this.resolveConfig(),this.handleAttributeChange(e,n))}async setConfig(e){this.jsConfig=e,this.config=this.resolveConfig(),this.isConnected&&(this.destroy(),await this.waitForPluginLoader(),await this.initialize())}async initialize(){var o;if(this.querySelector(".editora-toolbar")||this.isInitialized)return;const e=++this.buildGeneration;this.setAttribute("data-editora-editor","true"),Qn.add(this),tt||(tt=this),Us(),this.config.height&&(this.style.height=typeof this.config.height=="number"?`${this.config.height}px`:this.config.height),this.config.width&&(this.style.width=typeof this.config.width=="number"?`${this.config.width}px`:this.config.width),this.classList.add("editora-editor"),this.config.theme&&this.classList.add(`editora-theme-${this.config.theme}`);const t=await this.loadPlugins();if(e!==this.buildGeneration||!this.isConnected)return;if(this.loadedPlugins=t,t.forEach(s=>{if(s.init&&typeof s.init=="function")try{s.init({editorElement:this})}catch(l){console.error(`[RichTextEditor] Error initializing plugin ${s.name}:`,l)}}),!this.hasAttribute("data-initial-content")&&!this.contentElement){const s=this.innerHTML.trim();s&&this.setAttribute("data-initial-content",s)}const n=this.preservedContent;this.preservedContent=null;const i=this.sanitizeLoadedContent((o=n!=null?n:this.restoreAutosavedContent())!=null?o:this.getAttribute("data-initial-content")||"");this.engine=new Fr({content:i,plugins:t,readonly:this.config.readonly}),this.createUI(t,i),this.setupEventListeners(),this.startAutosave(),this.isInitialized=!0,this.dispatchEvent(new CustomEvent("editor-ready",{detail:{api:this.getAPI()},bubbles:!0}))}getInitialContent(){if(this.config.content)return this.config.content;const e=this.querySelector("[slot]");return e?e.innerHTML:this.hasChildNodes()?Array.from(this.childNodes).map(n=>n.nodeType===Node.TEXT_NODE?n.textContent:n.nodeType===Node.ELEMENT_NODE?n.outerHTML:"").join("").trim():""}async loadPlugins(){this.pluginLoader||await this.waitForPluginLoader();const e=[],t=this.config.plugins&&(typeof this.config.plugins=="string"&&this.config.plugins.length>0||Array.isArray(this.config.plugins)&&this.config.plugins.length>0),i=this.getAccessibilityConfig().checker===!0;if(t){if(typeof this.config.plugins=="string"){const o=this.config.plugins.split(/\s+/).filter(Boolean);i&&!o.includes("a11yChecker")&&o.push("a11yChecker");for(const s of o){const l=await this.pluginLoader.load(s,this.getPluginLoadConfig(s));l&&e.push(l)}}else if(Array.isArray(this.config.plugins)){for(const o of this.config.plugins)if(typeof o=="string"){const s=await this.pluginLoader.load(o,this.getPluginLoadConfig(o));s&&e.push(s)}else e.push(o);if(i&&!e.some(o=>(o==null?void 0:o.name)==="a11yChecker")){const o=await this.pluginLoader.load("a11yChecker",this.getPluginLoadConfig("a11yChecker"));o&&e.push(o)}}}else{const o=this.pluginLoader.getRegisteredPluginNames();for(const s of o){const l=await this.pluginLoader.load(s,this.getPluginLoadConfig(s));l&&e.push(l)}}return e}resolveToolbarItems(){const e=this.config.toolbarItems;if(typeof e=="string")return e;if(Array.isArray(e))return e.join(" ");const t=this.config.toolbar;if(typeof t=="string")return t;if(!t||typeof t!="object")return;const n=t.items;if(typeof n=="string")return n;if(Array.isArray(n))return n.join(" ")}isToolbarStickyEnabled(){const e=this.config.toolbar;return!e||typeof e!="object"?!1:!!e.sticky}isToolbarFloatingEnabled(){const e=this.config.toolbar;return!e||typeof e!="object"?!1:!!e.floating}isStatusbarEnabled(){const e=this.config.statusbar;return typeof e=="boolean"?e:e&&typeof e=="object"?e.enabled!==!1:!1}getStatusbarPosition(){const e=this.config.statusbar;return e&&typeof e=="object"&&e.position==="top"?"top":"bottom"}getLanguageConfig(){const e=this.config.language;return typeof e=="string"?{locale:e,direction:"ltr"}:e&&typeof e=="object"?{locale:e.locale||"en",direction:e.direction==="rtl"?"rtl":"ltr"}:{locale:"en",direction:"ltr"}}getAccessibilityConfig(){const e=this.config.accessibility;return typeof e=="boolean"?{enableARIA:e,keyboardNavigation:e,checker:!1}:e&&typeof e=="object"?{enableARIA:e.enableARIA!==!1,keyboardNavigation:e.keyboardNavigation!==!1,checker:!!e.checker}:{enableARIA:!0,keyboardNavigation:!0,checker:!1}}getPerformanceConfig(){var t;const e=this.config.performance;if(typeof e=="boolean")return{debounceInputMs:100,viewportOnlyScan:e};if(e&&typeof e=="object"){const n=Number((t=e.debounceInputMs)!=null?t:100);return{debounceInputMs:Number.isFinite(n)&&n>=0?n:100,viewportOnlyScan:e.viewportOnlyScan!==!1}}return{debounceInputMs:100,viewportOnlyScan:!0}}isEditorInViewport(){if(!this.contentElement||typeof window=="undefined")return!0;const e=this.contentElement.getBoundingClientRect();return e.bottom>=0&&e.top<=window.innerHeight}applyAccessibilitySettings(){var t;if(!this.contentElement)return;const e=this.getAccessibilityConfig();if(e.enableARIA){this.contentElement.setAttribute("role","textbox"),this.contentElement.setAttribute("aria-multiline","true"),this.contentElement.setAttribute("aria-disabled",this.config.readonly?"true":"false");const n=(t=this.getAttribute("aria-label"))==null?void 0:t.trim(),i=typeof this.config.placeholder=="string"?this.config.placeholder.trim():"";this.contentElement.setAttribute("aria-label",n||i||$s)}else this.contentElement.removeAttribute("role"),this.contentElement.removeAttribute("aria-multiline"),this.contentElement.removeAttribute("aria-disabled"),this.contentElement.removeAttribute("aria-label");this.contentElement.tabIndex=e.keyboardNavigation?0:-1}applyLanguageSettings(){if(!this.contentElement)return;const e=this.getLanguageConfig();this.contentElement.setAttribute("lang",e.locale),this.contentElement.setAttribute("dir",e.direction)}getSpellcheckConfig(){const e=this.config.spellcheck;if(typeof e=="boolean")return{enabled:e,provider:"browser"};if(e&&typeof e=="object"){const t=e.provider||"browser";return{enabled:!!e.enabled,provider:t,mode:e.mode}}return{enabled:!1,provider:"browser"}}applySpellcheckSettings(){if(!this.contentElement)return;const e=this.getSpellcheckConfig(),t=e.enabled&&e.provider==="browser";this.contentElement.spellcheck=t,this.contentElement.setAttribute("spellcheck",t?"true":"false")}executeCommand(e,...t){var o;typeof window!="undefined"&&(window.__editoraCommandEditorRoot=this);const n={editorElement:this,contentElement:this.contentElement,toolbarElement:this.toolbarElement},i=this.loadedPlugins.find(s=>s.commands&&s.commands[e]);if(i&&i.commands){const s=i.commands[e];if(typeof s=="function")try{return e==="toggleFullscreen"?s(this,n):s(...t,n),!0}catch(l){return console.error(`[RichTextEditor] Error executing native command ${e}:`,l),!1}}return((o=this.engine)==null?void 0:o.execCommand(e,...t))||!1}getPluginLoadConfig(e){const t=this.config.pluginConfig;if(t&&typeof t=="object"){const o=t[e];if(o&&typeof o=="object")return o}const n={spellCheck:["spellcheck","spellCheck"],trackChanges:["trackchanges","track-changes","trackChanges"],versionDiff:["versiondiff","version-diff","versionDiff"],"version-diff":["versiondiff","version-diff","versionDiff"],conditionalContent:["conditionalcontent","conditional-content","conditionalContent"],"conditional-content":["conditionalcontent","conditional-content","conditionalContent"],dataBinding:["databinding","data-binding","dataBinding"],"data-binding":["databinding","data-binding","dataBinding"],contentRules:["contentrules","content-rules","contentRules"],"content-rules":["contentrules","content-rules","contentRules"],mentions:["mention","mentions"],mention:["mention","mentions"],slashCommands:["slashcommands","slash-commands","slashCommands"],"slash-commands":["slashcommands","slash-commands","slashCommands"],formatPainter:["formatpainter","format-painter","formatPainter"],"format-painter":["formatpainter","format-painter","formatPainter"]},i=[e,e.toLowerCase(),...n[e]||[]];for(const o of i){const s=this.config[o];if(s&&typeof s=="object"&&!Array.isArray(s))return s}}getContentSanitizeConfig(){const e=this.config.contentConfig;return e&&typeof e=="object"?e:{sanitize:!0}}getSecurityConfig(){const e=this.config.security;return e&&typeof e=="object"?e:{sanitizeOnPaste:!0,sanitizeOnInput:!0}}sanitizeLoadedContent(e){return Eo(e,this.getContentSanitizeConfig(),this.getSecurityConfig())}getAutosaveConfig(){var t,n;const e=this.config.autosave;if(typeof e=="boolean")return{enabled:e,intervalMs:3e4,storageKey:"rte-autosave",provider:"localStorage"};if(e&&typeof e=="object"){const i=Number((n=(t=e.intervalMs)!=null?t:e.interval)!=null?n:3e4);return{enabled:!!e.enabled,intervalMs:Number.isFinite(i)&&i>0?i:3e4,storageKey:String(e.storageKey||"rte-autosave"),provider:e.provider||"localStorage",apiUrl:e.apiUrl}}return{enabled:!1,intervalMs:3e4,storageKey:"rte-autosave",provider:"localStorage"}}persistAutosave(e){const t=this.getAutosaveConfig();if(t.enabled&&e!==this.lastAutosavedContent){if(this.lastAutosavedContent=e,t.provider==="localStorage"){try{localStorage.setItem(t.storageKey,e),localStorage.setItem(`${t.storageKey}-timestamp`,Date.now().toString())}catch(n){console.error("[RichTextEditor] Failed to save autosave content to localStorage:",n)}return}t.provider==="api"&&t.apiUrl&&fetch(t.apiUrl,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:e,timestamp:Date.now()})}).catch(n=>{console.error("[RichTextEditor] Failed to save autosave content to API:",n)})}}restoreAutosavedContent(){const e=this.getAutosaveConfig();if(!e.enabled||e.provider!=="localStorage")return null;try{const t=localStorage.getItem(e.storageKey);if(t)return this.lastAutosavedContent=t,t}catch(t){console.error("[RichTextEditor] Failed to restore autosaved content:",t)}return null}stopAutosave(){this.autosaveTimer&&(clearInterval(this.autosaveTimer),this.autosaveTimer=void 0)}startAutosave(){this.stopAutosave();const e=this.getAutosaveConfig();!e.enabled||!this.contentElement||(this.autosaveTimer=setInterval(()=>{this.persistAutosave(Pt(this.contentElement))},e.intervalMs))}insertHTMLAtSelection(e){if(!this.contentElement)return;const t=window.getSelection();if(t&&t.rangeCount>0){const n=t.getRangeAt(0);n.deleteContents();const i=document.createElement("div");i.innerHTML=e;const o=document.createDocumentFragment();for(;i.firstChild;)o.appendChild(i.firstChild);n.insertNode(o),n.collapse(!1),t.removeAllRanges(),t.addRange(n)}else this.contentElement.focus(),document.execCommand("insertHTML",!1,e)}createUI(e,t){const n=this.querySelector('[slot="toolbar"]'),i=this.querySelector('[slot="statusbar"]');this.innerHTML="",this.config.toolbar!==!1&&!n?(this.toolbarElement=document.createElement("div"),this.toolbarElement.className="editora-toolbar-container",this.appendChild(this.toolbarElement),this.toolbar=new $r({items:this.resolveToolbarItems(),sticky:this.isToolbarStickyEnabled(),position:"top"},e,this.pluginLoader),this.toolbar.setCommandHandler((o,s)=>{var l;if(this.contentElement){this.contentElement.focus();const c=window.getSelection();if(!c||c.rangeCount===0||!this.contentElement.contains(c.anchorNode)){const d=document.createRange(),u=this.contentElement.lastChild||this.contentElement;u.nodeType===Node.TEXT_NODE?d.setStart(u,((l=u.textContent)==null?void 0:l.length)||0):u.nodeType===Node.ELEMENT_NODE?(d.selectNodeContents(u),d.collapse(!1)):d.setStart(this.contentElement,0),d.collapse(!0),c==null||c.removeAllRanges(),c==null||c.addRange(d)}}return this.executeCommand(o,s)}),this.toolbar.render(this.toolbarElement)):n&&this.appendChild(n),this.contentElement=document.createElement("div"),this.contentElement.className="editora-content rte-content",this.contentElement.contentEditable=this.config.readonly?"false":"true",this.applyLanguageSettings(),this.applyAccessibilitySettings(),this.applySpellcheckSettings(),this.config.placeholder&&this.contentElement.setAttribute("data-placeholder",this.config.placeholder);try{document.execCommand("defaultParagraphSeparator",!1,"p")}catch(o){console.warn("defaultParagraphSeparator not supported:",o)}if(t){const o=document.createElement("div");o.innerHTML=t.trim(),!Array.from(o.childNodes).some(l=>{if(l.nodeType===Node.ELEMENT_NODE){const c=l.tagName;return["P","DIV","H1","H2","H3","H4","H5","H6","UL","OL","BLOCKQUOTE","PRE"].includes(c)}return!1})&&t.trim()?this.contentElement.innerHTML=`<p>${t.trim()}</p>`:this.contentElement.innerHTML=t}else this.config.placeholder?this.contentElement.innerHTML="":this.contentElement.innerHTML="<p><br></p>";this.appendChild(this.contentElement),this.isToolbarFloatingEnabled()&&(this.floatingToolbar=new Br({enabled:!0}),this.floatingToolbar.create(this)),i?this.appendChild(i):this.isStatusbarEnabled()&&(this.statusBarElement=document.createElement("div"),this.statusBarElement.className="editora-statusbar-container",this.appendChild(this.statusBarElement),this.statusBar=new zr({position:this.getStatusbarPosition()}),this.statusBar.create(this.statusBarElement)),this.config.autofocus&&setTimeout(()=>{var o;return(o=this.contentElement)==null?void 0:o.focus()},0)}recordInputHistory(e){const t=this.pendingHistorySnapshot;if(this.pendingHistorySnapshot=null,!t||!this.contentElement||t.beforeHTML===e)return;const n=window.execEditorCommand;typeof n=="function"&&n("recordDomTransaction",this.contentElement,t.beforeHTML,e,{inputType:t.inputType,data:t.data,selectionCollapsed:t.selectionCollapsed})}setupEventListeners(){if(!this.contentElement||!this.engine)return;const e=this.keyboardShortcutManager;this.contentElement.addEventListener("beforeinput",n=>{var i,o;this.lastBeforeInputType=n.inputType||null,n.inputType==="historyUndo"||n.inputType==="historyRedo"?this.pendingHistorySnapshot=null:this.contentElement&&(this.pendingHistorySnapshot={beforeHTML:this.contentElement.innerHTML,inputType:n.inputType||null,data:typeof n.data=="string"?n.data:null,selectionCollapsed:(o=(i=window.getSelection())==null?void 0:i.isCollapsed)!=null?o:!0})}),this.contentElement.addEventListener("input",n=>{var p;if(!this.contentElement)return;let i=this.contentElement.innerHTML;const o=(p=n==null?void 0:n.detail)==null?void 0:p.allowedTags,s=this.getPerformanceConfig(),l=this.getContentSanitizeConfig(),c=this.getSecurityConfig(),d=this.lastBeforeInputType;if(this.lastBeforeInputType=null,c.sanitizeOnInput!==!1&&l.sanitize!==!1&&!d){const y=Eo(i,l,c,o);if(y!==i){const m=window.getSelection(),E=m&&m.rangeCount>0?m.getRangeAt(0):null;if(this.contentElement.innerHTML=y,E&&m)try{m.removeAllRanges(),m.addRange(E)}catch(v){}i=y}}this.recordInputHistory(i),this.contentChangeDebounceTimer&&clearTimeout(this.contentChangeDebounceTimer);const f=()=>{this.dispatchEvent(new CustomEvent("content-change",{detail:{html:vo(i)},bubbles:!0}))};s.debounceInputMs>0?this.contentChangeDebounceTimer=setTimeout(f,s.debounceInputMs):f(),this.updateStatusBar()}),this.contentElement.addEventListener("contextmenu",n=>{const i=this.config.contextMenu;(i===!1||typeof i=="object"&&i!==null&&i.enabled===!1)&&n.preventDefault()}),this.contentElement.addEventListener("paste",n=>{var u,f;if(n.__editoraSmartPasteHandled===!0||n.defaultPrevented)return;n.preventDefault();const i=this.config.paste||{};let o=((u=n.clipboardData)==null?void 0:u.getData("text/html"))||"";const s=((f=n.clipboardData)==null?void 0:f.getData("text/plain"))||"",l=this.getContentSanitizeConfig(),c=this.getSecurityConfig(),d=!!o&&/class=["'][^"']*Mso|xmlns:w=|urn:schemas-microsoft-com:office/i.test(o);if((i.clean||!i.keepFormatting)&&s){document.execCommand("insertText",!1,s);return}if(i.convertWord===!1&&d&&s){document.execCommand("insertText",!1,s);return}if(o){c.sanitizeOnPaste!==!1&&l.sanitize!==!1&&(o=Is(o,l,c)),this.insertHTMLAtSelection(o);return}s&&document.execCommand("insertText",!1,s)}),this.contentElement.addEventListener("focus",()=>{tt=this,this.dispatchEvent(new Event("editor-focus",{bubbles:!0})),this.updateStatusBar()}),this.contentElement.addEventListener("blur",()=>{this.contentChangeDebounceTimer&&(clearTimeout(this.contentChangeDebounceTimer),this.contentChangeDebounceTimer=void 0),this.contentElement&&this.dispatchEvent(new CustomEvent("content-change",{detail:{html:Pt(this.contentElement)},bubbles:!0})),this.dispatchEvent(new Event("editor-blur",{bubbles:!0})),this.updateFloatingToolbar(),this.updateStatusBar()}),this.contentElement.addEventListener("keydown",n=>{this.getAccessibilityConfig().keyboardNavigation&&e.handleKeyDown(n,(o,s)=>{this.executeCommand(o,s)})});const t=()=>{const n=this.getSelectionRangeInEditor(),i=document.activeElement,o=!!i&&!!this.contentElement&&(i===this.contentElement||this.contentElement.contains(i));this.getPerformanceConfig().viewportOnlyScan&&!this.isEditorInViewport()&&!o||!n&&!o||(this.updateFloatingToolbar(),this.updateStatusBar())};this.selectionChangeHandler=t,document.addEventListener("selectionchange",this.selectionChangeHandler)}getSelectionRangeInEditor(){if(!this.contentElement)return null;const e=window.getSelection();if(!e||e.rangeCount===0)return null;const t=e.getRangeAt(0),n=t.commonAncestorContainer;return this.contentElement.contains(n)?t:null}isSelectionBackward(e){if(!e.anchorNode||!e.focusNode)return!1;try{const t=document.createRange();return t.setStart(e.anchorNode,e.anchorOffset),t.setEnd(e.focusNode,e.focusOffset),t.collapsed}catch(t){return!1}}getSelectionAnchorRect(e,t){const n=Array.from(t.getClientRects()).filter(o=>o.width>0||o.height>0);return n.length===0?t.getBoundingClientRect():this.isSelectionBackward(e)?n[0]:n[n.length-1]}updateFloatingToolbar(){if(!this.floatingToolbar||!this.contentElement)return;if(this.config.readonly||this.contentElement.contentEditable==="false"||this.contentElement.getAttribute("data-readonly")==="true"||this.isReadonlyAttribute(this.getAttribute("readonly"))||this.getAttribute("data-readonly")==="true"){this.floatingToolbar.hide();return}const t=this.getPerformanceConfig(),n=document.activeElement===this.contentElement||!!this.contentElement&&this.contentElement.contains(document.activeElement);if(t.viewportOnlyScan&&!this.isEditorInViewport()&&!n){this.floatingToolbar.hide();return}const i=this.getSelectionRangeInEditor();if(!i){this.floatingToolbar.hide();return}if(i.collapsed){this.floatingToolbar.hide();return}const o=window.getSelection();if(!o){this.floatingToolbar.hide();return}const s=this.getSelectionAnchorRect(o,i);if(!s){this.floatingToolbar.hide();return}this.floatingToolbar.show(s.left,s.top-40)}updateStatusBar(){if(!this.statusBar||!this.contentElement)return;const e=this.getPerformanceConfig(),t=document.activeElement===this.contentElement||this.contentElement.contains(document.activeElement);if(e.viewportOnlyScan&&!this.isEditorInViewport()&&!t)return;const n=this.contentElement.textContent||"",{words:i,chars:o}=Kr(n),s=jr(this.contentElement);let l,c;const d=this.getSelectionRangeInEditor();d&&(l=Ur(this.contentElement,d),d.collapsed||(c=Vr(d,l),l=void 0)),this.statusBar.update({wordCount:i,charCount:o,lineCount:s,cursorPosition:l,selectionInfo:c})}isReadonlyAttribute(e){return e!==null&&e!=="false"}handleAttributeChange(e,t){switch(e){case"readonly":this.contentElement&&(this.contentElement.contentEditable=this.isReadonlyAttribute(t)?"false":"true",this.applyAccessibilitySettings()),this.engine&&this.engine.setReadonly(this.isReadonlyAttribute(t));break;case"theme":this.classList.forEach(n=>{n.startsWith("editora-theme-")&&this.classList.remove(n)}),t&&this.classList.add(`editora-theme-${t}`);break;case"placeholder":this.contentElement&&(this.contentElement.setAttribute("data-placeholder",t),this.applyAccessibilitySettings());break;case"aria-label":case"accessibility":case"accessibility-enable-aria":case"accessibility-keyboard-navigation":case"accessibility-checker":this.applyAccessibilitySettings();break;case"performance":case"performance-debounce-input-ms":case"performance-viewport-only-scan":break;case"language":case"language-locale":case"language-direction":this.applyLanguageSettings();break;case"spellcheck":case"spellcheck-enabled":case"spellcheck-provider":this.applySpellcheckSettings();break;case"autosave":case"autosave-enabled":case"autosave-interval-ms":case"autosave-storage-key":case"autosave-provider":case"autosave-api-url":this.startAutosave();break;case"security":case"security-sanitize-on-paste":case"security-sanitize-on-input":case"paste":case"paste-clean":case"paste-keep-formatting":case"paste-convert-word":case"context-menu":case"context-menu-enabled":break;case"toolbar":case"toolbar-items":case"toolbar-floating":case"toolbar-sticky":case"plugins":case"statusbar":this.isConnected&&(this.destroy(),this.waitForPluginLoader().then(()=>{this.initialize().catch(n=>{console.error("[RichTextEditor] Error during attribute change re-initialization:",n)})}));break}}resolveConfig(){const e={};for(let t=0;t<this.attributes.length;t++){const n=this.attributes[t];e[n.name]=n.value}return Zn.resolve({jsConfig:this.jsConfig,attributes:e})}getAPI(){return{getContent:()=>Pt(this.contentElement),setContent:e=>{this.contentElement&&(this.contentElement.innerHTML=this.sanitizeLoadedContent(e))},execCommand:(e,t)=>this.executeCommand(e,t),focus:()=>{var e;(e=this.contentElement)==null||e.focus()},blur:()=>{var e;(e=this.contentElement)==null||e.blur()},destroy:()=>{this.destroy()},on:(e,t)=>(this.addEventListener(e,t),()=>this.removeEventListener(e,t)),getConfig:()=>({...this.config}),setReadonly:e=>{this.setAttribute("readonly",e.toString())}}}destroy(){var e,t,n,i;this.buildGeneration+=1,this.contentChangeDebounceTimer&&(clearTimeout(this.contentChangeDebounceTimer),this.contentChangeDebounceTimer=void 0),this.contentElement&&(this.preservedContent=Pt(this.contentElement),this.persistAutosave(this.preservedContent)),this.stopAutosave(),this.selectionChangeHandler&&(document.removeEventListener("selectionchange",this.selectionChangeHandler),this.selectionChangeHandler=void 0),(e=this.engine)==null||e.destroy(),(t=this.toolbar)==null||t.destroy(),(n=this.floatingToolbar)==null||n.destroy(),(i=this.statusBar)==null||i.destroy(),this.innerHTML="",this.contentElement=void 0,this.toolbarElement=void 0,this.statusBarElement=void 0,this.loadedPlugins=[],this.isInitialized=!1,Qn.delete(this),tt===this&&(tt=null),this.dispatchEvent(new Event("editor-destroy",{bubbles:!0}))}getContent(){return Pt(this.contentElement)}setContent(e){this.contentElement&&(this.contentElement.innerHTML=this.sanitizeLoadedContent(e))}execCommand(e,...t){return this.executeCommand(e,...t)}focus(){var e;(e=this.contentElement)==null||e.focus()}blur(){var e;(e=this.contentElement)==null||e.blur()}}const ti=new At;Fe.__globalPluginLoader=ti;const Ks={bold:()=>Promise.resolve().then(()=>Zs).then(r=>r.BoldPlugin()),italic:()=>Promise.resolve().then(()=>Js).then(r=>r.ItalicPlugin()),underline:()=>Promise.resolve().then(()=>ea).then(r=>r.UnderlinePlugin()),strikethrough:()=>Promise.resolve().then(()=>ia).then(r=>r.StrikethroughPlugin()),clearFormatting:()=>Promise.resolve().then(()=>ma).then(r=>r.ClearFormattingPlugin()),heading:()=>Promise.resolve().then(()=>Oa).then(r=>r.HeadingPlugin()),blockquote:()=>Promise.resolve().then(()=>Wa).then(r=>r.BlockquotePlugin()),code:()=>Promise.resolve().then(()=>rc).then(r=>r.CodePlugin()),list:()=>Promise.resolve().then(()=>mc).then(r=>r.ListPlugin()),history:()=>Promise.resolve().then(()=>kc).then(r=>r.HistoryPlugin())};async function Ao(){return Object.entries(Ks).forEach(([r,e])=>{ti.register(r,e)}),ti}typeof window!="undefined"&&Ao().then(r=>{Fe.__globalPluginLoader=r,customElements.get("editora-editor")||customElements.define("editora-editor",Fe);const e=document.querySelectorAll("editora-editor:not([data-initial-content])"),t=[];e.forEach(n=>{const i=n.innerHTML.trim();i&&(t.push(i),n.setAttribute("data-initial-content",i),n.innerHTML="")}),e.forEach((n,i)=>{n instanceof Fe&&!n.isInitialized&&t[i]&&n.setAttribute("content",t[i])})});const On="data-editora-selection-marker";function Vs(r){return r?r.nodeType===Node.ELEMENT_NODE?r:r.parentElement:null}function ko(r){return r?r.getAttribute("contenteditable")==="true"?r:r.querySelector('[contenteditable="true"]'):null}function Gs(r){var s;if((r==null?void 0:r.contentElement)instanceof HTMLElement)return r.contentElement;const e=ko((s=r==null?void 0:r.editorElement)!=null?s:null);if(e)return e;const t=typeof window!="undefined"?window.__editoraCommandEditorRoot:null,n=t instanceof HTMLElement?ko(t):null;if(n)return n;const i=window.getSelection();if(i&&i.rangeCount>0){const l=Vs(i.getRangeAt(0).startContainer),c=l==null?void 0:l.closest('.rte-content, .editora-content, [contenteditable="true"]');if(c instanceof HTMLElement)return c}const o=document.activeElement;if(o instanceof HTMLElement){const l=o.closest('.rte-content, .editora-content, [contenteditable="true"]');if(l instanceof HTMLElement)return l}return document.querySelector('.rte-content, .editora-content, [contenteditable="true"]')}function qs(r){const e=window.getSelection();if(!e||e.rangeCount===0)return!1;const t=e.getRangeAt(0);return r.contains(t.startContainer)&&r.contains(t.endContainer)}function Mo(r){const e=document.createElement("span");return e.setAttribute(On,r),e.style.display="inline-block",e.style.width="0",e.style.height="0",e.style.overflow="hidden",e.style.lineHeight="0",e.appendChild(document.createTextNode("\uFEFF")),e}function Ys(r){const e=window.getSelection();if(!e||e.rangeCount===0)return null;const t=e.getRangeAt(0);if(!r.contains(t.startContainer)||!r.contains(t.endContainer))return null;const n=t.collapsed,i=Mo("start"),o=n?null:Mo("end"),s=t.cloneRange();if(o){const c=s.cloneRange();c.collapse(!1),c.insertNode(o)}const l=s.cloneRange();return l.collapse(!0),l.insertNode(i),()=>{const c=window.getSelection(),d=document.createRange(),u=r.querySelector(`[${On}="start"]`),f=r.querySelector(`[${On}="end"]`);if(!c||!u){r.querySelectorAll(`[${On}]`).forEach(p=>p.remove());return}n||!f?(d.setStartBefore(u),d.collapse(!0)):(d.setStartAfter(u),d.setEndBefore(f)),c.removeAllRanges(),c.addRange(d),u.remove(),f==null||f.remove()}}function Xs(r,e,t){if(e!==t){if(typeof window.execEditorCommand=="function"){window.execEditorCommand("recordDomTransaction",r,e,t);return}if(typeof window.executeEditorCommand=="function")try{window.executeEditorCommand("recordDomTransaction",{editor:r,beforeHTML:e,afterHTML:t})}catch(n){}}}function _n(r){const e=Gs(r.context);if(!e)return!1;const t=e.innerHTML;qs(e)&&e.focus({preventScroll:!0});let n=!1;try{n=document.execCommand(r.command,!1)}catch(s){n=!1}const i=e.innerHTML;if(r.normalize&&i!==t){const s=Ys(e);r.normalize(e),s==null||s()}const o=e.innerHTML;return t!==o&&(Xs(e,t,o),e.dispatchEvent(new Event("input",{bubbles:!0}))),n!==!1||t!==o}const Zs=Object.freeze(Object.defineProperty({__proto__:null,BoldPlugin:()=>({name:"bold",marks:{bold:{parseDOM:[{tag:"strong"},{tag:"b"},{style:"font-weight",getAttrs:r=>{const e=typeof r=="string"?r:r.style.fontWeight;return/^(bold(er)?|[5-9]\d{2,})$/.test(e)&&null}}],toDOM:()=>["strong",0]}},toolbar:[{label:"Bold",command:"toggleBold",icon:'<svg width="24" height="24" focusable="false"><path d="M7.8 19c-.3 0-.5 0-.6-.2l-.2-.5V5.7c0-.2 0-.4.2-.5l.6-.2h5c1.5 0 2.7.3 3.5 1 .7.6 1.1 1.4 1.1 2.5a3 3 0 0 1-.6 1.9c-.4.6-1 1-1.6 1.2.4.1.9.3 1.3.6s.8.7 1 1.2c.4.4.5 1 .5 1.6 0 1.3-.4 2.3-1.3 3-.8.7-2.1 1-3.8 1H7.8Zm5-8.3c.6 0 1.2-.1 1.6-.5.4-.3.6-.7.6-1.3 0-1.1-.8-1.7-2.3-1.7H9.3v3.5h3.4Zm.5 6c.7 0 1.3-.1 1.7-.4.4-.4.6-.9.6-1.5s-.2-1-.7-1.4c-.4-.3-1-.4-2-.4H9.4v3.8h4Z" fill-rule="evenodd"></path></svg>',shortcut:"Mod-b"}],commands:{toggleBold:(r,e)=>_n({command:"bold",context:e})},keymap:{"Mod-b":"toggleBold","Mod-B":"toggleBold"}})},Symbol.toStringTag,{value:"Module"})),ni=(r,e)=>_n({command:"italic",context:e}),Qs=(r,e)=>{var t;typeof window!="undefined"&&((t=window.registerEditorCommand)==null||t.call(window,r,e))},Lo=()=>{Qs("toggleItalic",ni)};typeof window!="undefined"&&(document.readyState==="loading"?document.addEventListener("DOMContentLoaded",Lo):Lo());const Js=Object.freeze(Object.defineProperty({__proto__:null,ItalicPlugin:()=>({name:"italic",marks:{italic:{parseDOM:[{tag:"i"},{tag:"em"},{style:"font-style=italic"}],toDOM:()=>["em",0]}},toolbar:[{label:"Italic",command:"toggleItalic",type:"button",icon:'<svg width="24" height="24" focusable="false"><path d="M16.7 4.7l-.1.9h-.3c-.6 0-1 0-1.4.3-.3.3-.4.6-.5 1.1l-2.1 9.8v.6c0 .5.4.8 1.4.8h.2l-.2.8H8l.2-.8h.2c1.1 0 1.8-.5 2-1.5l2-9.8.1-.5c0-.6-.4-.8-1.4-.8h-.3l.2-.9h5.8Z" fill-rule="evenodd"></path></svg>',shortcut:"Mod-i"}],commands:{toggleItalic:ni},keymap:{"Mod-i":"toggleItalic","Mod-I":"toggleItalic"}}),toggleItalic:ni},Symbol.toStringTag,{value:"Module"})),ea=Object.freeze(Object.defineProperty({__proto__:null,UnderlinePlugin:()=>({name:"underline",marks:{underline:{parseDOM:[{tag:"u"}],toDOM:()=>["u",{},0]}},toolbar:[{label:"Underline",command:"toggleUnderline",icon:'<svg width="24" height="24" focusable="false"><path d="M16 5c.6 0 1 .4 1 1v7c0 2.8-2.2 5-5 5s-5-2.2-5-5V6c0-.6.4-1 1-1s1 .4 1 1v7c0 1.7 1.3 3 3 3s3-1.3 3-3V6c0-.6.4-1 1-1ZM4 17h16c.6 0 1 .4 1 1s-.4 1-1 1H4a1 1 0 1 1 0-2Z" fill-rule="evenodd"></path></svg>',shortcut:"Mod-u"}],commands:{toggleUnderline:(r,e)=>_n({command:"underline",context:e})},keymap:{"Mod-u":"toggleUnderline","Mod-U":"toggleUnderline"}})},Symbol.toStringTag,{value:"Module"})),ta=()=>({name:"strikethrough",marks:{strikethrough:{parseDOM:[{tag:"s"},{tag:"strike"},{tag:"del"},{style:"text-decoration",getAttrs:r=>(typeof r=="string"?r:r.style.textDecoration)==="line-through"&&null}],toDOM:()=>["s",0]}},toolbar:[{label:"Strikethrough",command:"toggleStrikethrough",icon:'<svg width="24" height="24" focusable="false"><g fill-rule="evenodd"><path d="M15.6 8.5c-.5-.7-1-1.1-1.3-1.3-.6-.4-1.3-.6-2-.6-2.7 0-2.8 1.7-2.8 2.1 0 1.6 1.8 2 3.2 2.3 4.4.9 4.6 2.8 4.6 3.9 0 1.4-.7 4.1-5 4.1A6.2 6.2 0 0 1 7 16.4l1.5-1.1c.4.6 1.6 2 3.7 2 1.6 0 2.5-.4 3-1.2.4-.8.3-2-.8-2.6-.7-.4-1.6-.7-2.9-1-1-.2-3.9-.8-3.9-3.6C7.6 6 10.3 5 12.4 5c2.9 0 4.2 1.6 4.7 2.4l-1.5 1.1Z"></path><path d="M5 11h14a1 1 0 0 1 0 2H5a1 1 0 0 1 0-2Z" fill-rule="nonzero"></path></g></svg>',shortcut:"Mod-Shift-x"}],commands:{toggleStrikethrough:(r,e)=>_n({command:"strikeThrough",context:e,normalize:na})},keymap:{"Mod-Shift-x":"toggleStrikethrough","Mod-Shift-X":"toggleStrikethrough"}});function na(r){r.querySelectorAll("strike, del").forEach(t=>{var i;const n=document.createElement("s");for(const o of Array.from(t.attributes))o.name!=="style"&&n.setAttribute(o.name,o.value);for(;t.firstChild;)n.appendChild(t.firstChild);(i=t.parentNode)==null||i.replaceChild(n,t)})}const ia=Object.freeze(Object.defineProperty({__proto__:null,StrikethroughPlugin:ta},Symbol.toStringTag,{value:"Module"}));function Ro(r,e,t=r==null?void 0:r.innerHTML){if(!r||typeof t!="string"||e===t)return!1;try{if(typeof window.execEditorCommand=="function")return window.execEditorCommand("recordDomTransaction",r,e,t)!==!1;if(typeof window.executeEditorCommand=="function")return window.executeEditorCommand("recordDomTransaction",{editor:r,beforeHTML:e,afterHTML:t})!==!1}catch(n){}return!1}const oa=()=>({name:"clearFormatting",toolbar:[{label:"Clear Formatting",command:"clearFormatting",icon:'<svg width="24" height="24" focusable="false"><path d="M13.2 6a1 1 0 0 1 0 .2l-2.6 10a1 1 0 0 1-1 .8h-.2a.8.8 0 0 1-.8-1l2.6-10H8a1 1 0 1 1 0-2h9a1 1 0 0 1 0 2h-3.8ZM5 18h7a1 1 0 0 1 0 2H5a1 1 0 0 1 0-2Zm13 1.5L16.5 18 15 19.5a.7.7 0 0 1-1-1l1.5-1.5-1.5-1.5a.7.7 0 0 1 1-1l1.5 1.5 1.5-1.5a.7.7 0 0 1 1 1L17.5 17l1.5 1.5a.7.7 0 0 1-1 1Z" fill-rule="evenodd"></path></svg>',shortcut:"Mod-\\"}],commands:{clearFormatting:()=>{const r=la();if(!r)return!1;const e=window.getSelection();if(!e||e.rangeCount===0)return!1;const t=e.getRangeAt(0);if(!r.contains(t.commonAncestorContainer))return!1;const n=t.cloneRange(),i=r.innerHTML;return r.focus({preventScroll:!0}),ga(r,n),pa(r,n),Ro(r,i),r.dispatchEvent(new Event("input",{bubbles:!0})),!0}},keymap:{"Mod-\\":"clearFormatting"}}),ra=new Set(["A","B","STRONG","I","EM","U","S","STRIKE","DEL","FONT","MARK","CODE","SUB","SUP"]),sa=new Set(["H1","H2","H3","H4","H5","H6","BLOCKQUOTE","PRE"]),aa=["color","background-color","font-size","font-family","font-weight","font-style","text-decoration","text-transform","line-height","letter-spacing","word-spacing","vertical-align","text-align","padding-left"];function la(){const r=window.getSelection();if(r&&r.rangeCount>0){const t=r.getRangeAt(0).startContainer,n=t.nodeType===Node.ELEMENT_NODE?t:t.parentElement,i=n==null?void 0:n.closest('[contenteditable="true"], .rte-content, .editora-content');if(i)return i}const e=document.activeElement;return e?e.getAttribute("contenteditable")==="true"?e:e.closest('[contenteditable="true"], .rte-content, .editora-content'):null}function Oo(r,e){try{if(typeof r.intersectsNode=="function")return r.intersectsNode(e)}catch(n){}const t=document.createRange();return e.nodeType===Node.ELEMENT_NODE?t.selectNodeContents(e):t.selectNode(e),r.compareBoundaryPoints(Range.END_TO_START,t)>0&&r.compareBoundaryPoints(Range.START_TO_END,t)<0}function In(r){let e=0,t=r;for(;t&&t.parentNode;)e+=1,t=t.parentNode;return e}function ca(r){aa.forEach(e=>{r.style.removeProperty(e)}),(!r.getAttribute("style")||r.style.length===0)&&r.removeAttribute("style"),r.classList.contains("rte-text-color")&&r.classList.remove("rte-text-color"),r.classList.contains("rte-bg-color")&&r.classList.remove("rte-bg-color"),r.classList.contains("rte-format-painted")&&r.classList.remove("rte-format-painted"),r.classList.length===0&&r.removeAttribute("class")}function ii(r){const e=r.parentNode;if(e){for(;r.firstChild;)e.insertBefore(r.firstChild,r);e.removeChild(r)}}function da(r){return r.tagName!=="P"||r.attributes.length>0||(r.textContent||"").trim()!==""?!1:!r.querySelector("img, video, table, iframe, hr, pre, ul, ol")}function _o(r){Array.from(r.children).forEach(e=>{da(e)&&e.remove()})}function Io(r){_o(r),ii(r)}function Do(r){var t;const e=document.createElement("p");for(Array.from(r.attributes).forEach(n=>{e.setAttribute(n.name,n.value)});r.firstChild;)e.appendChild(r.firstChild);e.innerHTML.trim()||(e.innerHTML="<br>"),(t=r.parentNode)==null||t.replaceChild(e,r)}function ua(r){return!/^(A|B|STRONG|I|EM|U|S|STRIKE|DEL|FONT|MARK|CODE|SUB|SUP|SPAN)$/.test(r.tagName)||(r.textContent||"").trim()!==""?!1:!r.querySelector("img, video, table, iframe, hr, svg, math")}function ha(r){Array.from(r.querySelectorAll("a,b,strong,i,em,u,s,strike,del,font,mark,code,sub,sup,span")).sort((t,n)=>In(n)-In(t)).forEach(t=>{t.isConnected&&ua(t)&&t.remove()})}function fa(r){if(_o(r),r.parentElement instanceof HTMLLIElement){Io(r);return}if(Array.from(r.childNodes).filter(i=>i.nodeType!==Node.TEXT_NODE||(i.textContent||"").trim()!=="").some(i=>i instanceof HTMLElement&&/^(P|DIV|H[1-6]|UL|OL|PRE|TABLE|BLOCKQUOTE)$/.test(i.tagName))){Io(r);return}Do(r)}function pa(r,e){Array.from(r.querySelectorAll("h1,h2,h3,h4,h5,h6,blockquote,pre")).forEach(n=>{if(Oo(e,n)&&sa.has(n.tagName)){if(n.tagName==="BLOCKQUOTE"){fa(n);return}Do(n)}})}function ga(r,e){const t=Array.from(r.querySelectorAll("a,b,strong,i,em,u,s,strike,del,font,mark,code,sub,sup,span,[style],[class]"));t.sort((n,i)=>In(i)-In(n)),t.forEach(n=>{if(n.isConnected&&Oo(e,n)&&!(n.getAttribute("contenteditable")==="false"||n.closest('[contenteditable="false"]'))){if(ca(n),ra.has(n.tagName)){ii(n);return}n.tagName==="SPAN"&&n.attributes.length===0&&ii(n)}}),ha(r)}const ma=Object.freeze(Object.defineProperty({__proto__:null,ClearFormattingPlugin:oa},Symbol.toStringTag,{value:"Module"})),$t='.rte-content, .editora-content, [contenteditable="true"]',ba="[data-editora-editor], .rte-editor, .editora-editor, editora-editor",No=new Set(["P","DIV","H1","H2","H3","H4","H5","H6","PRE"]),Ho="p,div,h1,h2,h3,h4,h5,h6,ul,ol,blockquote,pre,table",ya=new Set(["p","h1","h2","h3","h4","h5","h6"]);function Po(r){return r?r.nodeType===Node.ELEMENT_NODE?r:r.parentElement:null}function Ta(r){const e=r==null?void 0:r.contentElement;if(e instanceof HTMLElement)return e;const t=r==null?void 0:r.editorElement;if(t instanceof HTMLElement){const s=t.querySelector($t);if(s instanceof HTMLElement)return s;if(t.getAttribute("contenteditable")==="true")return t}const n=window.getSelection();if(n&&n.rangeCount>0){const s=Po(n.getRangeAt(0).startContainer),l=s==null?void 0:s.closest($t);if(l instanceof HTMLElement)return l;const c=s==null?void 0:s.closest(ba),d=c==null?void 0:c.querySelector($t);if(d instanceof HTMLElement)return d}const i=document.activeElement,o=i==null?void 0:i.closest($t);return o instanceof HTMLElement?o:document.querySelector($t)}function Ea(r){const e=window.getSelection();if(!e||e.rangeCount===0)return null;const t=e.getRangeAt(0);return!r.contains(t.startContainer)||!r.contains(t.endContainer)?null:t}function Fo(r,e){let t=Po(e);if(!t||t===r||!r.contains(t))return null;for(;t.parentElement&&t.parentElement!==r;)t=t.parentElement;if(t.parentElement!==r)return null;if(t.matches(Ho))return t;const n=t.closest(Ho);return n instanceof HTMLElement&&n.parentElement===r?n:t}function $o(r,e){if(typeof r.intersectsNode=="function")try{return r.intersectsNode(e)}catch(n){return!1}const t=document.createRange();return t.selectNode(e),r.compareBoundaryPoints(Range.END_TO_START,t)<0&&r.compareBoundaryPoints(Range.START_TO_END,t)>0}function va(r,e){const t=Fo(r,e.startContainer),n=Fo(r,e.endContainer);if(!t)return[];if(!n||t===n)return[t];const o=Array.from(r.children).filter(s=>s instanceof HTMLElement).filter(s=>$o(e,s));return o.length>0?o:[t]}function Sa(r,e){Array.from(r.attributes).forEach(t=>{e.setAttribute(t.name,t.value)})}function oi(r,e){for(;r.firstChild;)e.appendChild(r.firstChild)}function wa(r){return r.tagName!=="P"||r.attributes.length>0||(r.textContent||"").trim()!==""?!1:!r.querySelector("img, video, table, iframe, hr, pre, ul, ol")}function Dn(r,e){const t=document.createElement(r);return e&&Sa(e,t),t}function Bo(r,e){const t=Dn(e,r);return oi(r,t),t.innerHTML.trim()||(t.innerHTML="<br>"),t}function xa(r){const e=r.cloneNode(!1);return e instanceof HTMLElement?e:document.createElement(r.tagName.toLowerCase())}function zo(r,e,t){const n=r.parentNode;if(!n)return[];const i=document.createDocumentFragment(),o=[];let s=null;const l=()=>{s&&s.children.length>0&&i.appendChild(s),s=null};return Array.from(r.children).forEach(c=>{if(c instanceof HTMLLIElement){if(e.has(c)){l();const d=Bo(c,t);i.appendChild(d),o.push(d);return}s||(s=xa(r)),s.appendChild(c)}}),l(),n.insertBefore(i,r),n.removeChild(r),o}function Ca(r,e){var n;if(r.tagName.toLowerCase()===e)return[r];const t=Dn(e,r);return oi(r,t),t.innerHTML.trim()||(t.innerHTML="<br>"),(n=r.parentNode)==null||n.replaceChild(t,r),[t]}function Aa(r,e){const t=r.parentNode;if(!t)return[];const n=document.createDocumentFragment(),i=[];return Array.from(r.childNodes).forEach(o=>{if(o instanceof HTMLElement&&wa(o)){o.remove();return}if(o instanceof HTMLUListElement||o instanceof HTMLOListElement){Array.from(o.children).forEach(l=>{if(!(l instanceof HTMLLIElement))return;const c=Bo(l,e);n.appendChild(c),i.push(c)}),o.remove();return}if(o instanceof HTMLElement&&No.has(o.tagName)){const l=Dn(e,o);oi(o,l),n.appendChild(l),i.push(l);return}if(o.nodeType===Node.TEXT_NODE&&(o.textContent||"").trim()===""){o.remove();return}const s=Dn(e,r);s.appendChild(o),n.appendChild(s),i.push(s)}),t.insertBefore(n,r),t.removeChild(r),i}function ka(r){const e=window.getSelection();if(!e)return;const t=document.createRange(),n=r instanceof HTMLElement&&r.querySelector("p,li,h1,h2,h3,h4,h5,h6")||r;t.selectNodeContents(n),t.collapse(!0),e.removeAllRanges(),e.addRange(t)}function Ma(r){r.dispatchEvent(new Event("input",{bubbles:!0}))}function La(r,e,t){const n=window.execEditorCommand;if(typeof n=="function"){n("recordDomTransaction",r,e,t);return}const i=window.executeEditorCommand;typeof i=="function"&&i("recordDomTransaction",{editor:r,beforeHTML:e,afterHTML:t})}function Ra(r,e){const t=new Map;return Array.from(r.querySelectorAll("li")).filter(i=>i instanceof HTMLLIElement&&$o(e,i)).forEach(i=>{var s;const o=i.parentElement;(o instanceof HTMLUListElement||o instanceof HTMLOListElement)&&o.parentElement===r&&(t.has(o)||t.set(o,new Set),(s=t.get(o))==null||s.add(i))}),t}function Bt(r,e){const t=r.toLowerCase();if(!ya.has(t))return!1;const n=Ta(e);if(!n)return!1;const i=Ea(n);if(!i)return!1;const o=n.innerHTML,s=[],l=Ra(n,i),c={startContainer:i.startContainer,startOffset:i.startOffset,endContainer:i.endContainer,endOffset:i.endOffset};l.size>0?l.forEach((u,f)=>{s.push(...zo(f,u,t))}):va(n,i).forEach(f=>{if(f instanceof HTMLUListElement||f instanceof HTMLOListElement){const p=new Set(Array.from(f.children).filter(y=>y instanceof HTMLLIElement));s.push(...zo(f,p,t));return}if(No.has(f.tagName)){const p=f.querySelector(":scope > ul, :scope > ol, :scope > blockquote, :scope > table");s.push(...p?Aa(f,t):Ca(f,t))}});const d=n.innerHTML;if(o===d||s.length===0)return!1;if(La(n,o,d),Ma(n),n.contains(c.startContainer)&&n.contains(c.endContainer)){const u=document.createRange();u.setStart(c.startContainer,c.startOffset),u.setEnd(c.endContainer,c.endOffset);const f=window.getSelection();f==null||f.removeAllRanges(),f==null||f.addRange(u)}else ka(s[0]);return!0}const Oa=Object.freeze(Object.defineProperty({__proto__:null,HeadingPlugin:()=>({name:"heading",toolbar:[{label:"P",command:"setBlockType",type:"dropdown",options:[{value:"p",label:"P"},{value:"h1",label:"H1"},{value:"h2",label:"H2"},{value:"h3",label:"H3"},{value:"h4",label:"H4"},{value:"h5",label:"H5"},{value:"h6",label:"H6"}],icon:'<svg width="24" height="24" focusable="false"><path d="M16.1 8.6 14.2 4l-1.4.5 2.8 7.4c.1.4.5.6.9.6h.1c.4-.1.6-.5.6-.9l1.8-4.8-1.4-.5-1.5 2.3ZM4 11.5h6V10H4v1.5ZM18.5 3v1L17 7l.9.9L20.7 3h-2.2ZM5.5 12h1v7h1v-7h1v-.5h-3V12Zm4 0h1v7h1v-7h1v-.5h-3V12Zm10 1.5a2 2 0 0 0-2-2h-1v7.5h1v-2.7h1a2 2 0 0 0 2-2v-.8Zm-2 1.3h-1v-2.3h1a.8.8 0 1 1 0 1.6v.7Z" fill-rule="evenodd"></path></svg>'}],commands:{setBlockType:(r,e)=>r?Bt(r,e):!1,setHeading1:(r,e)=>Bt("h1",e),setHeading2:(r,e)=>Bt("h2",e),setHeading3:(r,e)=>Bt("h3",e),setParagraph:(r,e)=>Bt("p",e)},keymap:{"Mod-Alt-1":"setHeading1","Mod-Alt-2":"setHeading2","Mod-Alt-3":"setHeading3","Mod-Alt-0":"setParagraph"}})},Symbol.toStringTag,{value:"Module"})),zt='.rte-content, .editora-content, [contenteditable="true"]',_a="[data-editora-editor], .rte-editor, .editora-editor, editora-editor",Uo=["p","div","h1","h2","h3","h4","h5","h6","ul","ol","blockquote","pre","table"].join(",");function ri(r){return r?r.nodeType===Node.ELEMENT_NODE?r:r.parentElement:null}function Ia(r){const e=r==null?void 0:r.contentElement;if(e instanceof HTMLElement)return e;const t=r==null?void 0:r.editorElement;if(t instanceof HTMLElement){const s=t.querySelector(zt);if(s instanceof HTMLElement)return s;if(t.getAttribute("contenteditable")==="true")return t}const n=window.getSelection();if(n&&n.rangeCount>0){const s=ri(n.getRangeAt(0).startContainer),l=s==null?void 0:s.closest(zt);if(l instanceof HTMLElement)return l;const c=s==null?void 0:s.closest(_a),d=c==null?void 0:c.querySelector(zt);if(d instanceof HTMLElement)return d}const i=document.activeElement,o=i==null?void 0:i.closest(zt);return o instanceof HTMLElement?o:document.querySelector(zt)}function Da(r){const e=window.getSelection();if(!e||e.rangeCount===0)return null;const t=e.getRangeAt(0);return!r.contains(t.startContainer)||!r.contains(t.endContainer)?null:t}function Wo(r,e){let t=ri(e);if(!t||t===r||!r.contains(t))return null;for(;t.parentElement&&t.parentElement!==r;)t=t.parentElement;if(t.parentElement!==r)return null;if(t.matches(Uo))return t;const n=t.closest(Uo);return n instanceof HTMLElement&&n.parentElement===r?n:t}function jo(r,e){if(typeof r.intersectsNode=="function")try{return r.intersectsNode(e)}catch(n){return!1}const t=document.createRange();return t.selectNode(e),r.compareBoundaryPoints(Range.END_TO_START,t)<0&&r.compareBoundaryPoints(Range.START_TO_END,t)>0}function Na(r,e){const t=Wo(r,e.startContainer),n=Wo(r,e.endContainer);if(!t)return[];if(!n||t===n)return[t];const o=Array.from(r.children).filter(s=>s instanceof HTMLElement).filter(s=>jo(e,s));return o.length>0?o:[t]}function Ko(r,e){const t=ri(e),n=t==null?void 0:t.closest("blockquote");return n instanceof HTMLQuoteElement&&r.contains(n)?n:null}function Ha(r){return r.tagName!=="P"||r.attributes.length>0||(r.textContent||"").trim()!==""?!1:!r.querySelector("img, video, table, iframe, hr, pre, ul, ol")}function Pa(r){Array.from(r.children).forEach(e=>{Ha(e)&&e.remove()})}function si(r){Pa(r);const e=r.parentNode;if(!e)return;Array.from(r.childNodes).forEach(n=>{e.insertBefore(n,r)}),e.removeChild(r)}function Vo(r){return r.nodeType===Node.TEXT_NODE&&(r.textContent||"").trim()===""}function Go(r){const e=Array.from(r.childNodes).filter(n=>!Vo(n));if(e.length!==1)return null;const t=e[0];return t instanceof HTMLQuoteElement?t:null}function Fa(r){const e=document.createElement("blockquote");return Array.from(r.childNodes).filter(n=>!Vo(n)).forEach(n=>{e.appendChild(n)}),e.childNodes.length||(e.innerHTML="<br>"),r.appendChild(e),e}function $a(r,e){const t=Array.from(r.querySelectorAll("li")).filter(i=>i instanceof HTMLLIElement&&jo(e,i)),n=new Set(t);return t.filter(i=>{var s,l;let o=(s=i.parentElement)==null?void 0:s.closest("li");for(;o;){if(n.has(o))return!1;o=(l=o.parentElement)==null?void 0:l.closest("li")}return!0})}function Ut(r){const e=window.getSelection();if(!e)return;const t=document.createRange(),n=r instanceof HTMLElement&&r.querySelector("p,li,h1,h2,h3,h4,h5,h6")||r;t.selectNodeContents(n),t.collapse(!0),e.removeAllRanges(),e.addRange(t)}function Ba(r){r.dispatchEvent(new Event("input",{bubbles:!0}))}function za(r,e,t){const n=window.execEditorCommand;if(typeof n=="function"){n("recordDomTransaction",r,e,t);return}const i=window.executeEditorCommand;typeof i=="function"&&i("recordDomTransaction",{editor:r,beforeHTML:e,afterHTML:t})}function Ua(r){var u,f;const e=Ia(r);if(!e)return!1;const t=Da(e);if(!t)return!1;const n=e.innerHTML,i=Ko(e,t.startContainer),o=Ko(e,t.endContainer),s=$a(e,t),l=Na(e,t),c=l.length>0&&l.every(p=>p.tagName==="BLOCKQUOTE");if(i&&i===o){const p=i.firstChild||i;si(i),Ut(p)}else if(s.length>0){const p=s.map(Go);if(p.every(Boolean)){const m=((u=p[0])==null?void 0:u.firstChild)||s[0];p.forEach(E=>{E&&si(E)}),Ut(m)}else{const m=s[0];s.forEach(E=>{Go(E)||Fa(E)}),Ut(m)}}else if(c){const p=l[0].firstChild||l[0];l.forEach(si),Ut(p)}else{const p=l.filter(E=>E.tagName!=="BLOCKQUOTE");if(p.length===0)return!1;const y=document.createElement("blockquote"),m=p[0];(f=m.parentNode)==null||f.insertBefore(y,m),p.forEach(E=>{y.appendChild(E)}),Ut(y)}const d=e.innerHTML;return n===d?!1:(za(e,n,d),Ba(e),!0)}const Wa=Object.freeze(Object.defineProperty({__proto__:null,BlockquotePlugin:()=>({name:"blockquote",nodes:{blockquote:{content:"block+",group:"block",parseDOM:[{tag:"blockquote"}],toDOM:()=>["blockquote",0]}},toolbar:[{label:"Quote",command:"toggleBlockquote",icon:'<svg fill="#000000" height="24px" width="24px" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 32 32" xml:space="preserve"><g stroke-width="0"></g><g stroke-linecap="round" stroke-linejoin="round"></g><g> <g> <path d="M13,11c0.6,0,1-0.4,1-1s-0.4-1-1-1c-5,0-9,4-9,9c0,2.8,2.2,5,5,5s5-2.2,5-5s-2.2-5-5-5c-0.3,0-0.7,0-1,0.1 C9.3,11.8,11,11,13,11z"></path> <path d="M23,13c-0.3,0-0.7,0-1,0.1c1.3-1.3,3-2.1,5-2.1c0.6,0,1-0.4,1-1s-0.4-1-1-1c-5,0-9,4-9,9c0,2.8,2.2,5,5,5s5-2.2,5-5 S25.8,13,23,13z"></path> </g> </g></svg>',shortcut:"Mod-Shift-9"}],commands:{toggleBlockquote:(r,e)=>Ua(e)},keymap:{"Mod-Shift-9":"toggleBlockquote"}})},Symbol.toStringTag,{value:"Module"}));function ja(r){let e=!1;r.addEventListener("pointerdown",t=>{e=t.target!==r},!0),r.addEventListener("click",t=>{t.target===r&&e&&t.stopImmediatePropagation(),e=!1},!0)}const qo="rte-dialog-base-styles";function Ka(){if(typeof document=="undefined"||document.getElementById(qo))return;const r=document.createElement("style");r.id=qo,r.textContent=`
|
|
12
12
|
[data-rte-dialog] {
|
|
13
13
|
font-family: var(--rte-font-family-base, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif);
|
|
14
14
|
}
|
package/dist/webcomponent.cjs.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./index-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./index-B-Vt_adn.js");exports.RichTextEditorElement=e.RichTextEditorElement;exports.initWebComponent=e.initWebComponent;
|
|
2
2
|
//# sourceMappingURL=webcomponent.cjs.js.map
|
package/dist/webcomponent.esm.js
CHANGED