관리-도구
편집 파일: Editor.5a453aa4.js
var Po=Object.defineProperty;var $o=(i,t,e)=>t in i?Po(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e;var w=(i,t,e)=>$o(i,typeof t!="symbol"?t+"":t,e);import{g as Kr,u as Uo,r as Xt,x as hr,e as Ho,l as jo}from"./index.20192476.js";import"./translations.12335a6a.js";import{_ as kt,c as Wt,g as Gr}from"./default-i18n.54b5d8cd.js";import{i as zi}from"./isEqual.51bf23f5.js";import{b as Fo}from"./_baseClone.e959332d.js";import{B as zo,S as Vo}from"./index.ee8124c6.js";import{a as Ko}from"./Caret.662da1f3.js";import{_ as Wr}from"./_plugin-vue_export-helper.249dac1d.js";import{o as Vt,c as Kt,a as et,v as Zs,G as Go,b as Xs,m as dr,F as fr,J as Wo,Q as is,t as Ys,C as rs,R as os}from"./runtime-dom.esm-bundler.6789c400.js";var Zo=1,Xo=4;function Ie(i){return Fo(i,Zo|Xo)}const Te="all-in-one-seo-pack",Yo=i=>{const t=Kr();if(!t.tags.length)return[];const e=t.context[i];if(!e)return t.tags.filter(c=>!c.context||c.context.includes("all"));const s=[];let n=[];if(e.forEach(c=>{t.tags.filter(d=>d.id===c).forEach(d=>{if(d.context){if(!d.context.includes("all")&&!d.context.includes(i))return;s.push(d.id)}d&&!d.deprecated&&n.push({...d})})}),s.length){const c=[];n.forEach((h,d)=>{s.includes(h.id)&&!h.context&&c.push(d)});for(let h=c.length-1;0<=h;h--)n.splice(c[h],1)}const r=Uo(),o=r.aioseo.postData.postTypes.find(c=>c.name+"Title"===i||c.name+"Description"===i||"breadcrumbs-post-type-"+c.name===i);if(o&&(n=n.map(c=>(c.name=c.name.replace("Post",o.singular),c.description=c.description.replace("page/post",o.singular.toLowerCase()),c)),o.name==="product")){const c=n.findIndex(h=>h.id==="post_excerpt");c!==-1&&(n[c].name=kt("Product Short Description",Te),n[c].description=kt("A short description for your product.",Te),n[c].value=kt("Sample short description for your product.",Te))}const a=r.aioseo.postData.taxonomies.find(c=>c.name+"Title"===i||c.name+"Description"===i||"breadcrumbs-taxonomy-"+c.name===i);return a&&(n=n.map(c=>(c.name=c.name.replace("Category",a.singular),c))),(i==="dateTitle"||i==="dateDescription")&&(n=n.map(c=>(c.name=c.name.replace("Category",kt("Archive",Te)),c.name=c.name.replace("Post",kt("Archive",Te)),c.description=c.description.replace("page/post",kt("archive",Te)),c))),n.sort((c,h)=>c.name<h.name?-1:c.name>h.name?1:0)},Qo=(i,t,e)=>{switch(e){case"title":switch(i){case"taxonomies":return["taxonomy_title","separator_sa","site_title"];case"archives":switch(t){case"author":return["author_name","separator_sa","site_title"];case"search":return["search_term","separator_sa","site_title"];case"date":default:return["archive_title","separator_sa","site_title"]}default:return["post_title","separator_sa","site_title"]}case"description":switch(i){case"taxonomies":return["taxonomy_title","separator_sa","taxonomy_description"];case"attachment":return["attachment_caption","separator_sa","site_title"];case"archives":switch(t){case"author":return["author_name","separator_sa","site_title"];case"search":return["search_term","separator_sa","site_title"];case"date":default:return["archive_title","separator_sa","site_title"]}default:return t==="attachment"?["attachment_caption","separator_sa","site_title"]:t==="product"?["post_excerpt","post_content"]:["post_excerpt","post_content","separator_sa"]}}},pr={context:Yo,getDefaultTags:Qo},Jo=i=>{const{invalidClosingTags:t,invalidOpeningTags:e,tagNamePattern:s}=Zr(i);let n=i;return t.forEach(r=>{n=`<${r.match(s)[1]}>`+n}),e.forEach(r=>{const o=r.match(s)[1];n=n+`</${o}>`}),n},tl=(i,t)=>{const{invalidClosingTags:e,invalidOpeningTags:s,tagNamePattern:n}=Zr(i);return e.forEach(r=>{const o=r.match(n)[1],a=new RegExp(`^<${o}>`);t=t.replace(a,"")}),s.forEach(r=>{const o=r.match(n)[1],a=new RegExp(`<\\/${o}>$`);t=t.replace(a,"")}),t},Zr=i=>{const t=new RegExp(/(<[^<>]*>)/),e=new RegExp(/<\s?\/[^<>]*>/),s=new RegExp(/<\s?\/?([^<\s>]*).*?>/,"s"),n=i.split(t),r=[];n.forEach(h=>{h.match(t)&&r.push(h)});const o=[];r.forEach((h,d)=>{if(!h)return;if(h.match(e)){o.push(h),r[d]="";return}const g=h.match(s)[1];let p=!1;r.forEach((m,b)=>{if(d===b||!m||p||!m.match(e))return;const E=m.match(s)[1];if(g===E){r[d]="",r[b]="",p=!0;return}o.push(h),r[d]=""})});const a=[],c=[];return o.forEach(h=>{if(h.match(t)){if(h.match(e)){c.push(h);return}a.push(h)}}),{invalidClosingTags:c,invalidOpeningTags:a,tagNamePattern:s}};var q=(i=>(i[i.TYPE=3]="TYPE",i[i.LEVEL=12]="LEVEL",i[i.ATTRIBUTE=13]="ATTRIBUTE",i[i.BLOT=14]="BLOT",i[i.INLINE=7]="INLINE",i[i.BLOCK=11]="BLOCK",i[i.BLOCK_BLOT=10]="BLOCK_BLOT",i[i.INLINE_BLOT=6]="INLINE_BLOT",i[i.BLOCK_ATTRIBUTE=9]="BLOCK_ATTRIBUTE",i[i.INLINE_ATTRIBUTE=5]="INLINE_ATTRIBUTE",i[i.ANY=15]="ANY",i))(q||{});class It{constructor(t,e,s={}){this.attrName=t,this.keyName=e;const n=q.TYPE&q.ATTRIBUTE;this.scope=s.scope!=null?s.scope&q.LEVEL|n:q.ATTRIBUTE,s.whitelist!=null&&(this.whitelist=s.whitelist)}static keys(t){return Array.from(t.attributes).map(e=>e.name)}add(t,e){return this.canAdd(t,e)?(t.setAttribute(this.keyName,e),!0):!1}canAdd(t,e){return this.whitelist==null?!0:typeof e=="string"?this.whitelist.indexOf(e.replace(/["']/g,""))>-1:this.whitelist.indexOf(e)>-1}remove(t){t.removeAttribute(this.keyName)}value(t){const e=t.getAttribute(this.keyName);return this.canAdd(t,e)&&e?e:""}}class Oe extends Error{constructor(t){t="[Parchment] "+t,super(t),this.message=t,this.name=this.constructor.name}}const Xr=class Ci{constructor(){this.attributes={},this.classes={},this.tags={},this.types={}}static find(t,e=!1){if(t==null)return null;if(this.blots.has(t))return this.blots.get(t)||null;if(e){let s=null;try{s=t.parentNode}catch{return null}return this.find(s,e)}return null}create(t,e,s){const n=this.query(e);if(n==null)throw new Oe(`Unable to create ${e} blot`);const r=n,o=e instanceof Node||e.nodeType===Node.TEXT_NODE?e:r.create(s),a=new r(t,o,s);return Ci.blots.set(a.domNode,a),a}find(t,e=!1){return Ci.find(t,e)}query(t,e=q.ANY){let s;return typeof t=="string"?s=this.types[t]||this.attributes[t]:t instanceof Text||t.nodeType===Node.TEXT_NODE?s=this.types.text:typeof t=="number"?t&q.LEVEL&q.BLOCK?s=this.types.block:t&q.LEVEL&q.INLINE&&(s=this.types.inline):t instanceof Element&&((t.getAttribute("class")||"").split(/\s+/).some(n=>(s=this.classes[n],!!s)),s=s||this.tags[t.tagName]),s==null?null:"scope"in s&&e&q.LEVEL&s.scope&&e&q.TYPE&s.scope?s:null}register(...t){return t.map(e=>{const s="blotName"in e,n="attrName"in e;if(!s&&!n)throw new Oe("Invalid definition");if(s&&e.blotName==="abstract")throw new Oe("Cannot register abstract class");const r=s?e.blotName:n?e.attrName:void 0;return this.types[r]=e,n?typeof e.keyName=="string"&&(this.attributes[e.keyName]=e):s&&(e.className&&(this.classes[e.className]=e),e.tagName&&(Array.isArray(e.tagName)?e.tagName=e.tagName.map(o=>o.toUpperCase()):e.tagName=e.tagName.toUpperCase(),(Array.isArray(e.tagName)?e.tagName:[e.tagName]).forEach(o=>{(this.tags[o]==null||e.className==null)&&(this.tags[o]=e)}))),e})}};Xr.blots=new WeakMap;let Me=Xr;function mr(i,t){return(i.getAttribute("class")||"").split(/\s+/).filter(e=>e.indexOf(`${t}-`)===0)}class el extends It{static keys(t){return(t.getAttribute("class")||"").split(/\s+/).map(e=>e.split("-").slice(0,-1).join("-"))}add(t,e){return this.canAdd(t,e)?(this.remove(t),t.classList.add(`${this.keyName}-${e}`),!0):!1}remove(t){mr(t,this.keyName).forEach(e=>{t.classList.remove(e)}),t.classList.length===0&&t.removeAttribute("class")}value(t){const e=(mr(t,this.keyName)[0]||"").slice(this.keyName.length+1);return this.canAdd(t,e)?e:""}}const At=el;function mi(i){const t=i.split("-"),e=t.slice(1).map(s=>s[0].toUpperCase()+s.slice(1)).join("");return t[0]+e}class sl extends It{static keys(t){return(t.getAttribute("style")||"").split(";").map(e=>e.split(":")[0].trim())}add(t,e){return this.canAdd(t,e)?(t.style[mi(this.keyName)]=e,!0):!1}remove(t){t.style[mi(this.keyName)]="",t.getAttribute("style")||t.removeAttribute("style")}value(t){const e=t.style[mi(this.keyName)];return this.canAdd(t,e)?e:""}}const Qt=sl;class nl{constructor(t){this.attributes={},this.domNode=t,this.build()}attribute(t,e){e?t.add(this.domNode,e)&&(t.value(this.domNode)!=null?this.attributes[t.attrName]=t:delete this.attributes[t.attrName]):(t.remove(this.domNode),delete this.attributes[t.attrName])}build(){this.attributes={};const t=Me.find(this.domNode);if(t==null)return;const e=It.keys(this.domNode),s=At.keys(this.domNode),n=Qt.keys(this.domNode);e.concat(s).concat(n).forEach(r=>{const o=t.scroll.query(r,q.ATTRIBUTE);o instanceof It&&(this.attributes[o.attrName]=o)})}copy(t){Object.keys(this.attributes).forEach(e=>{const s=this.attributes[e].value(this.domNode);t.format(e,s)})}move(t){this.copy(t),Object.keys(this.attributes).forEach(e=>{this.attributes[e].remove(this.domNode)}),this.attributes={}}values(){return Object.keys(this.attributes).reduce((t,e)=>(t[e]=this.attributes[e].value(this.domNode),t),{})}}const fn=nl,Yr=class{constructor(t,e){this.scroll=t,this.domNode=e,Me.blots.set(e,this),this.prev=null,this.next=null}static create(t){if(this.tagName==null)throw new Oe("Blot definition missing tagName");let e,s;return Array.isArray(this.tagName)?(typeof t=="string"?(s=t.toUpperCase(),parseInt(s,10).toString()===s&&(s=parseInt(s,10))):typeof t=="number"&&(s=t),typeof s=="number"?e=document.createElement(this.tagName[s-1]):s&&this.tagName.indexOf(s)>-1?e=document.createElement(s):e=document.createElement(this.tagName[0])):e=document.createElement(this.tagName),this.className&&e.classList.add(this.className),e}get statics(){return this.constructor}attach(){}clone(){const t=this.domNode.cloneNode(!1);return this.scroll.create(t)}detach(){this.parent!=null&&this.parent.removeChild(this),Me.blots.delete(this.domNode)}deleteAt(t,e){this.isolate(t,e).remove()}formatAt(t,e,s,n){const r=this.isolate(t,e);if(this.scroll.query(s,q.BLOT)!=null&&n)r.wrap(s,n);else if(this.scroll.query(s,q.ATTRIBUTE)!=null){const o=this.scroll.create(this.statics.scope);r.wrap(o),o.format(s,n)}}insertAt(t,e,s){const n=s==null?this.scroll.create("text",e):this.scroll.create(e,s),r=this.split(t);this.parent.insertBefore(n,r||void 0)}isolate(t,e){const s=this.split(t);if(s==null)throw new Error("Attempt to isolate at end");return s.split(e),s}length(){return 1}offset(t=this.parent){return this.parent==null||this===t?0:this.parent.children.offset(this)+this.parent.offset(t)}optimize(t){this.statics.requiredContainer&&!(this.parent instanceof this.statics.requiredContainer)&&this.wrap(this.statics.requiredContainer.blotName)}remove(){this.domNode.parentNode!=null&&this.domNode.parentNode.removeChild(this.domNode),this.detach()}replaceWith(t,e){const s=typeof t=="string"?this.scroll.create(t,e):t;return this.parent!=null&&(this.parent.insertBefore(s,this.next||void 0),this.remove()),s}split(t,e){return t===0?this:this.next}update(t,e){}wrap(t,e){const s=typeof t=="string"?this.scroll.create(t,e):t;if(this.parent!=null&&this.parent.insertBefore(s,this.next||void 0),typeof s.appendChild!="function")throw new Oe(`Cannot wrap ${t}`);return s.appendChild(this),s}};Yr.blotName="abstract";let Qr=Yr;const Jr=class extends Qr{static value(t){return!0}index(t,e){return this.domNode===t||this.domNode.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_CONTAINED_BY?Math.min(e,1):-1}position(t,e){let s=Array.from(this.parent.domNode.childNodes).indexOf(this.domNode);return t>0&&(s+=1),[this.parent.domNode,s]}value(){return{[this.statics.blotName]:this.statics.value(this.domNode)||!0}}};Jr.scope=q.INLINE_BLOT;let il=Jr;const Q=il;class rl{constructor(){this.head=null,this.tail=null,this.length=0}append(...t){if(this.insertBefore(t[0],null),t.length>1){const e=t.slice(1);this.append(...e)}}at(t){const e=this.iterator();let s=e();for(;s&&t>0;)t-=1,s=e();return s}contains(t){const e=this.iterator();let s=e();for(;s;){if(s===t)return!0;s=e()}return!1}indexOf(t){const e=this.iterator();let s=e(),n=0;for(;s;){if(s===t)return n;n+=1,s=e()}return-1}insertBefore(t,e){t!=null&&(this.remove(t),t.next=e,e!=null?(t.prev=e.prev,e.prev!=null&&(e.prev.next=t),e.prev=t,e===this.head&&(this.head=t)):this.tail!=null?(this.tail.next=t,t.prev=this.tail,this.tail=t):(t.prev=null,this.head=this.tail=t),this.length+=1)}offset(t){let e=0,s=this.head;for(;s!=null;){if(s===t)return e;e+=s.length(),s=s.next}return-1}remove(t){this.contains(t)&&(t.prev!=null&&(t.prev.next=t.next),t.next!=null&&(t.next.prev=t.prev),t===this.head&&(this.head=t.next),t===this.tail&&(this.tail=t.prev),this.length-=1)}iterator(t=this.head){return()=>{const e=t;return t!=null&&(t=t.next),e}}find(t,e=!1){const s=this.iterator();let n=s();for(;n;){const r=n.length();if(t<r||e&&t===r&&(n.next==null||n.next.length()!==0))return[n,t];t-=r,n=s()}return[null,0]}forEach(t){const e=this.iterator();let s=e();for(;s;)t(s),s=e()}forEachAt(t,e,s){if(e<=0)return;const[n,r]=this.find(t);let o=t-r;const a=this.iterator(n);let c=a();for(;c&&o<t+e;){const h=c.length();t>o?s(c,t-o,Math.min(e,o+h-t)):s(c,0,Math.min(h,t+e-o)),o+=h,c=a()}}map(t){return this.reduce((e,s)=>(e.push(t(s)),e),[])}reduce(t,e){const s=this.iterator();let n=s();for(;n;)e=t(e,n),n=s();return e}}function gr(i,t){const e=t.find(i);if(e)return e;try{return t.create(i)}catch{const s=t.create(q.INLINE);return Array.from(i.childNodes).forEach(n=>{s.domNode.appendChild(n)}),i.parentNode&&i.parentNode.replaceChild(s.domNode,i),s.attach(),s}}const to=class Gt extends Qr{constructor(t,e){super(t,e),this.uiNode=null,this.build()}appendChild(t){this.insertBefore(t)}attach(){super.attach(),this.children.forEach(t=>{t.attach()})}attachUI(t){this.uiNode!=null&&this.uiNode.remove(),this.uiNode=t,Gt.uiClass&&this.uiNode.classList.add(Gt.uiClass),this.uiNode.setAttribute("contenteditable","false"),this.domNode.insertBefore(this.uiNode,this.domNode.firstChild)}build(){this.children=new rl,Array.from(this.domNode.childNodes).filter(t=>t!==this.uiNode).reverse().forEach(t=>{try{const e=gr(t,this.scroll);this.insertBefore(e,this.children.head||void 0)}catch(e){if(e instanceof Oe)return;throw e}})}deleteAt(t,e){if(t===0&&e===this.length())return this.remove();this.children.forEachAt(t,e,(s,n,r)=>{s.deleteAt(n,r)})}descendant(t,e=0){const[s,n]=this.children.find(e);return t.blotName==null&&t(s)||t.blotName!=null&&s instanceof t?[s,n]:s instanceof Gt?s.descendant(t,n):[null,-1]}descendants(t,e=0,s=Number.MAX_VALUE){let n=[],r=s;return this.children.forEachAt(e,s,(o,a,c)=>{(t.blotName==null&&t(o)||t.blotName!=null&&o instanceof t)&&n.push(o),o instanceof Gt&&(n=n.concat(o.descendants(t,a,r))),r-=c}),n}detach(){this.children.forEach(t=>{t.detach()}),super.detach()}enforceAllowedChildren(){let t=!1;this.children.forEach(e=>{t||this.statics.allowedChildren.some(s=>e instanceof s)||(e.statics.scope===q.BLOCK_BLOT?(e.next!=null&&this.splitAfter(e),e.prev!=null&&this.splitAfter(e.prev),e.parent.unwrap(),t=!0):e instanceof Gt?e.unwrap():e.remove())})}formatAt(t,e,s,n){this.children.forEachAt(t,e,(r,o,a)=>{r.formatAt(o,a,s,n)})}insertAt(t,e,s){const[n,r]=this.children.find(t);if(n)n.insertAt(r,e,s);else{const o=s==null?this.scroll.create("text",e):this.scroll.create(e,s);this.appendChild(o)}}insertBefore(t,e){t.parent!=null&&t.parent.children.remove(t);let s=null;this.children.insertBefore(t,e||null),t.parent=this,e!=null&&(s=e.domNode),(this.domNode.parentNode!==t.domNode||this.domNode.nextSibling!==s)&&this.domNode.insertBefore(t.domNode,s),t.attach()}length(){return this.children.reduce((t,e)=>t+e.length(),0)}moveChildren(t,e){this.children.forEach(s=>{t.insertBefore(s,e)})}optimize(t){if(super.optimize(t),this.enforceAllowedChildren(),this.uiNode!=null&&this.uiNode!==this.domNode.firstChild&&this.domNode.insertBefore(this.uiNode,this.domNode.firstChild),this.children.length===0)if(this.statics.defaultChild!=null){const e=this.scroll.create(this.statics.defaultChild.blotName);this.appendChild(e)}else this.remove()}path(t,e=!1){const[s,n]=this.children.find(t,e),r=[[this,t]];return s instanceof Gt?r.concat(s.path(n,e)):(s!=null&&r.push([s,n]),r)}removeChild(t){this.children.remove(t)}replaceWith(t,e){const s=typeof t=="string"?this.scroll.create(t,e):t;return s instanceof Gt&&this.moveChildren(s),super.replaceWith(s)}split(t,e=!1){if(!e){if(t===0)return this;if(t===this.length())return this.next}const s=this.clone();return this.parent&&this.parent.insertBefore(s,this.next||void 0),this.children.forEachAt(t,this.length(),(n,r,o)=>{const a=n.split(r,e);a!=null&&s.appendChild(a)}),s}splitAfter(t){const e=this.clone();for(;t.next!=null;)e.appendChild(t.next);return this.parent&&this.parent.insertBefore(e,this.next||void 0),e}unwrap(){this.parent&&this.moveChildren(this.parent,this.next||void 0),this.remove()}update(t,e){const s=[],n=[];t.forEach(r=>{r.target===this.domNode&&r.type==="childList"&&(s.push(...r.addedNodes),n.push(...r.removedNodes))}),n.forEach(r=>{if(r.parentNode!=null&&r.tagName!=="IFRAME"&&document.body.compareDocumentPosition(r)&Node.DOCUMENT_POSITION_CONTAINED_BY)return;const o=this.scroll.find(r);o!=null&&(o.domNode.parentNode==null||o.domNode.parentNode===this.domNode)&&o.detach()}),s.filter(r=>r.parentNode===this.domNode&&r!==this.uiNode).sort((r,o)=>r===o?0:r.compareDocumentPosition(o)&Node.DOCUMENT_POSITION_FOLLOWING?1:-1).forEach(r=>{let o=null;r.nextSibling!=null&&(o=this.scroll.find(r.nextSibling));const a=gr(r,this.scroll);(a.next!==o||a.next==null)&&(a.parent!=null&&a.parent.removeChild(this),this.insertBefore(a,o||void 0))}),this.enforceAllowedChildren()}};to.uiClass="";let ol=to;const Nt=ol;function ll(i,t){if(Object.keys(i).length!==Object.keys(t).length)return!1;for(const e in i)if(i[e]!==t[e])return!1;return!0}const Le=class Ce extends Nt{static create(t){return super.create(t)}static formats(t,e){const s=e.query(Ce.blotName);if(!(s!=null&&t.tagName===s.tagName)){if(typeof this.tagName=="string")return!0;if(Array.isArray(this.tagName))return t.tagName.toLowerCase()}}constructor(t,e){super(t,e),this.attributes=new fn(this.domNode)}format(t,e){if(t===this.statics.blotName&&!e)this.children.forEach(s=>{s instanceof Ce||(s=s.wrap(Ce.blotName,!0)),this.attributes.copy(s)}),this.unwrap();else{const s=this.scroll.query(t,q.INLINE);if(s==null)return;s instanceof It?this.attributes.attribute(s,e):e&&(t!==this.statics.blotName||this.formats()[t]!==e)&&this.replaceWith(t,e)}}formats(){const t=this.attributes.values(),e=this.statics.formats(this.domNode,this.scroll);return e!=null&&(t[this.statics.blotName]=e),t}formatAt(t,e,s,n){this.formats()[s]!=null||this.scroll.query(s,q.ATTRIBUTE)?this.isolate(t,e).format(s,n):super.formatAt(t,e,s,n)}optimize(t){super.optimize(t);const e=this.formats();if(Object.keys(e).length===0)return this.unwrap();const s=this.next;s instanceof Ce&&s.prev===this&&ll(e,s.formats())&&(s.moveChildren(this),s.remove())}replaceWith(t,e){const s=super.replaceWith(t,e);return this.attributes.copy(s),s}update(t,e){super.update(t,e),t.some(s=>s.target===this.domNode&&s.type==="attributes")&&this.attributes.build()}wrap(t,e){const s=super.wrap(t,e);return s instanceof Ce&&this.attributes.move(s),s}};Le.allowedChildren=[Le,Q],Le.blotName="inline",Le.scope=q.INLINE_BLOT,Le.tagName="SPAN";let al=Le;const Vi=al,Se=class Si extends Nt{static create(t){return super.create(t)}static formats(t,e){const s=e.query(Si.blotName);if(!(s!=null&&t.tagName===s.tagName)){if(typeof this.tagName=="string")return!0;if(Array.isArray(this.tagName))return t.tagName.toLowerCase()}}constructor(t,e){super(t,e),this.attributes=new fn(this.domNode)}format(t,e){const s=this.scroll.query(t,q.BLOCK);s!=null&&(s instanceof It?this.attributes.attribute(s,e):t===this.statics.blotName&&!e?this.replaceWith(Si.blotName):e&&(t!==this.statics.blotName||this.formats()[t]!==e)&&this.replaceWith(t,e))}formats(){const t=this.attributes.values(),e=this.statics.formats(this.domNode,this.scroll);return e!=null&&(t[this.statics.blotName]=e),t}formatAt(t,e,s,n){this.scroll.query(s,q.BLOCK)!=null?this.format(s,n):super.formatAt(t,e,s,n)}insertAt(t,e,s){if(s==null||this.scroll.query(e,q.INLINE)!=null)super.insertAt(t,e,s);else{const n=this.split(t);if(n!=null){const r=this.scroll.create(e,s);n.parent.insertBefore(r,n)}else throw new Error("Attempt to insertAt after block boundaries")}}replaceWith(t,e){const s=super.replaceWith(t,e);return this.attributes.copy(s),s}update(t,e){super.update(t,e),t.some(s=>s.target===this.domNode&&s.type==="attributes")&&this.attributes.build()}};Se.blotName="block",Se.scope=q.BLOCK_BLOT,Se.tagName="P",Se.allowedChildren=[Vi,Se,Q];let cl=Se;const ds=cl,qi=class extends Nt{checkMerge(){return this.next!==null&&this.next.statics.blotName===this.statics.blotName}deleteAt(t,e){super.deleteAt(t,e),this.enforceAllowedChildren()}formatAt(t,e,s,n){super.formatAt(t,e,s,n),this.enforceAllowedChildren()}insertAt(t,e,s){super.insertAt(t,e,s),this.enforceAllowedChildren()}optimize(t){super.optimize(t),this.children.length>0&&this.next!=null&&this.checkMerge()&&(this.next.moveChildren(this),this.next.remove())}};qi.blotName="container",qi.scope=q.BLOCK_BLOT;let ul=qi;const pn=ul;class hl extends Q{static formats(t,e){}format(t,e){super.formatAt(0,this.length(),t,e)}formatAt(t,e,s,n){t===0&&e===this.length()?this.format(s,n):super.formatAt(t,e,s,n)}formats(){return this.statics.formats(this.domNode,this.scroll)}}const lt=hl,dl={attributes:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0},fl=100,qe=class extends Nt{constructor(t,e){super(null,e),this.registry=t,this.scroll=this,this.build(),this.observer=new MutationObserver(s=>{this.update(s)}),this.observer.observe(this.domNode,dl),this.attach()}create(t,e){return this.registry.create(this,t,e)}find(t,e=!1){const s=this.registry.find(t,e);return s?s.scroll===this?s:e?this.find(s.scroll.domNode.parentNode,!0):null:null}query(t,e=q.ANY){return this.registry.query(t,e)}register(...t){return this.registry.register(...t)}build(){this.scroll!=null&&super.build()}detach(){super.detach(),this.observer.disconnect()}deleteAt(t,e){this.update(),t===0&&e===this.length()?this.children.forEach(s=>{s.remove()}):super.deleteAt(t,e)}formatAt(t,e,s,n){this.update(),super.formatAt(t,e,s,n)}insertAt(t,e,s){this.update(),super.insertAt(t,e,s)}optimize(t=[],e={}){super.optimize(e);const s=e.mutationsMap||new WeakMap;let n=Array.from(this.observer.takeRecords());for(;n.length>0;)t.push(n.pop());const r=(c,h=!0)=>{c==null||c===this||c.domNode.parentNode!=null&&(s.has(c.domNode)||s.set(c.domNode,[]),h&&r(c.parent))},o=c=>{s.has(c.domNode)&&(c instanceof Nt&&c.children.forEach(o),s.delete(c.domNode),c.optimize(e))};let a=t;for(let c=0;a.length>0;c+=1){if(c>=fl)throw new Error("[Parchment] Maximum optimize iterations reached");for(a.forEach(h=>{const d=this.find(h.target,!0);d!=null&&(d.domNode===h.target&&(h.type==="childList"?(r(this.find(h.previousSibling,!1)),Array.from(h.addedNodes).forEach(g=>{const p=this.find(g,!1);r(p,!1),p instanceof Nt&&p.children.forEach(m=>{r(m,!1)})})):h.type==="attributes"&&r(d.prev)),r(d))}),this.children.forEach(o),a=Array.from(this.observer.takeRecords()),n=a.slice();n.length>0;)t.push(n.pop())}}update(t,e={}){t=t||this.observer.takeRecords();const s=new WeakMap;t.map(n=>{const r=this.find(n.target,!0);return r==null?null:s.has(r.domNode)?(s.get(r.domNode).push(n),null):(s.set(r.domNode,[n]),r)}).forEach(n=>{n!=null&&n!==this&&s.has(n.domNode)&&n.update(s.get(n.domNode)||[],e)}),e.mutationsMap=s,s.has(this.domNode)&&super.update(s.get(this.domNode),e),this.optimize(t,e)}};qe.blotName="scroll",qe.defaultChild=ds,qe.allowedChildren=[ds,pn],qe.scope=q.BLOCK_BLOT,qe.tagName="DIV";let pl=qe;const Ki=pl,ki=class eo extends Q{static create(t){return document.createTextNode(t)}static value(t){return t.data}constructor(t,e){super(t,e),this.text=this.statics.value(this.domNode)}deleteAt(t,e){this.domNode.data=this.text=this.text.slice(0,t)+this.text.slice(t+e)}index(t,e){return this.domNode===t?e:-1}insertAt(t,e,s){s==null?(this.text=this.text.slice(0,t)+e+this.text.slice(t),this.domNode.data=this.text):super.insertAt(t,e,s)}length(){return this.text.length}optimize(t){super.optimize(t),this.text=this.statics.value(this.domNode),this.text.length===0?this.remove():this.next instanceof eo&&this.next.prev===this&&(this.insertAt(this.length(),this.next.value()),this.next.remove())}position(t,e=!1){return[this.domNode,t]}split(t,e=!1){if(!e){if(t===0)return this;if(t===this.length())return this.next}const s=this.scroll.create(this.domNode.splitText(t));return this.parent.insertBefore(s,this.next||void 0),this.text=this.statics.value(this.domNode),s}update(t,e){t.some(s=>s.type==="characterData"&&s.target===this.domNode)&&(this.text=this.statics.value(this.domNode))}value(){return this.text}};ki.blotName="text",ki.scope=q.INLINE_BLOT;let ml=ki;const an=ml,gl=Object.freeze(Object.defineProperty({__proto__:null,Attributor:It,AttributorStore:fn,BlockBlot:ds,ClassAttributor:At,ContainerBlot:pn,EmbedBlot:lt,InlineBlot:Vi,LeafBlot:Q,ParentBlot:Nt,Registry:Me,Scope:q,ScrollBlot:Ki,StyleAttributor:Qt,TextBlot:an},Symbol.toStringTag,{value:"Module"}));var _i={exports:{}},ot=-1,st=1,z=0;function fs(i,t,e,s,n){if(i===t)return i?[[z,i]]:[];if(e!=null){var r=wl(i,t,e);if(r)return r}var o=Gi(i,t),a=i.substring(0,o);i=i.substring(o),t=t.substring(o),o=mn(i,t);var c=i.substring(i.length-o);i=i.substring(0,i.length-o),t=t.substring(0,t.length-o);var h=bl(i,t);return a&&h.unshift([z,a]),c&&h.push([z,c]),Wi(h,n),s&&El(h),h}function bl(i,t){var e;if(!i)return[[st,t]];if(!t)return[[ot,i]];var s=i.length>t.length?i:t,n=i.length>t.length?t:i,r=s.indexOf(n);if(r!==-1)return e=[[st,s.substring(0,r)],[z,n],[st,s.substring(r+n.length)]],i.length>t.length&&(e[0][0]=e[2][0]=ot),e;if(n.length===1)return[[ot,i],[st,t]];var o=vl(i,t);if(o){var a=o[0],c=o[1],h=o[2],d=o[3],g=o[4],p=fs(a,h),m=fs(c,d);return p.concat([[z,g]],m)}return yl(i,t)}function yl(i,t){for(var e=i.length,s=t.length,n=Math.ceil((e+s)/2),r=n,o=2*n,a=new Array(o),c=new Array(o),h=0;h<o;h++)a[h]=-1,c[h]=-1;a[r+1]=0,c[r+1]=0;for(var d=e-s,g=d%2!==0,p=0,m=0,b=0,E=0,N=0;N<n;N++){for(var x=-N+p;x<=N-m;x+=2){var A=r+x,T;x===-N||x!==N&&a[A-1]<a[A+1]?T=a[A+1]:T=a[A-1]+1;for(var k=T-x;T<e&&k<s&&i.charAt(T)===t.charAt(k);)T++,k++;if(a[A]=T,T>e)m+=2;else if(k>s)p+=2;else if(g){var C=r+d-x;if(C>=0&&C<o&&c[C]!==-1){var I=e-c[C];if(T>=I)return br(i,t,T,k)}}}for(var M=-N+b;M<=N-E;M+=2){var C=r+M,I;M===-N||M!==N&&c[C-1]<c[C+1]?I=c[C+1]:I=c[C-1]+1;for(var H=I-M;I<e&&H<s&&i.charAt(e-I-1)===t.charAt(s-H-1);)I++,H++;if(c[C]=I,I>e)E+=2;else if(H>s)b+=2;else if(!g){var A=r+d-M;if(A>=0&&A<o&&a[A]!==-1){var T=a[A],k=r+T-A;if(I=e-I,T>=I)return br(i,t,T,k)}}}}return[[ot,i],[st,t]]}function br(i,t,e,s){var n=i.substring(0,e),r=t.substring(0,s),o=i.substring(e),a=t.substring(s),c=fs(n,r),h=fs(o,a);return c.concat(h)}function Gi(i,t){if(!i||!t||i.charAt(0)!==t.charAt(0))return 0;for(var e=0,s=Math.min(i.length,t.length),n=s,r=0;e<n;)i.substring(r,n)==t.substring(r,n)?(e=n,r=e):s=n,n=Math.floor((s-e)/2+e);return so(i.charCodeAt(n-1))&&n--,n}function yr(i,t){var e=i.length,s=t.length;if(e==0||s==0)return 0;e>s?i=i.substring(e-s):e<s&&(t=t.substring(0,e));var n=Math.min(e,s);if(i==t)return n;for(var r=0,o=1;;){var a=i.substring(n-o),c=t.indexOf(a);if(c==-1)return r;o+=c,(c==0||i.substring(n-o)==t.substring(0,o))&&(r=o,o++)}}function mn(i,t){if(!i||!t||i.slice(-1)!==t.slice(-1))return 0;for(var e=0,s=Math.min(i.length,t.length),n=s,r=0;e<n;)i.substring(i.length-n,i.length-r)==t.substring(t.length-n,t.length-r)?(e=n,r=e):s=n,n=Math.floor((s-e)/2+e);return no(i.charCodeAt(i.length-n))&&n--,n}function vl(i,t){var e=i.length>t.length?i:t,s=i.length>t.length?t:i;if(e.length<4||s.length*2<e.length)return null;function n(m,b,E){for(var N=m.substring(E,E+Math.floor(m.length/4)),x=-1,A="",T,k,C,I;(x=b.indexOf(N,x+1))!==-1;){var M=Gi(m.substring(E),b.substring(x)),H=mn(m.substring(0,E),b.substring(0,x));A.length<H+M&&(A=b.substring(x-H,x)+b.substring(x,x+M),T=m.substring(0,E-H),k=m.substring(E+M),C=b.substring(0,x-H),I=b.substring(x+M))}return A.length*2>=m.length?[T,k,C,I,A]:null}var r=n(e,s,Math.ceil(e.length/4)),o=n(e,s,Math.ceil(e.length/2)),a;if(!r&&!o)return null;o?r?a=r[4].length>o[4].length?r:o:a=o:a=r;var c,h,d,g;i.length>t.length?(c=a[0],h=a[1],d=a[2],g=a[3]):(d=a[0],g=a[1],c=a[2],h=a[3]);var p=a[4];return[c,h,d,g,p]}function El(i){for(var t=!1,e=[],s=0,n=null,r=0,o=0,a=0,c=0,h=0;r<i.length;)i[r][0]==z?(e[s++]=r,o=c,a=h,c=0,h=0,n=i[r][1]):(i[r][0]==st?c+=i[r][1].length:h+=i[r][1].length,n&&n.length<=Math.max(o,a)&&n.length<=Math.max(c,h)&&(i.splice(e[s-1],0,[ot,n]),i[e[s-1]+1][0]=st,s--,s--,r=s>0?e[s-1]:-1,o=0,a=0,c=0,h=0,n=null,t=!0)),r++;for(t&&Wi(i),Al(i),r=1;r<i.length;){if(i[r-1][0]==ot&&i[r][0]==st){var d=i[r-1][1],g=i[r][1],p=yr(d,g),m=yr(g,d);p>=m?(p>=d.length/2||p>=g.length/2)&&(i.splice(r,0,[z,g.substring(0,p)]),i[r-1][1]=d.substring(0,d.length-p),i[r+1][1]=g.substring(p),r++):(m>=d.length/2||m>=g.length/2)&&(i.splice(r,0,[z,d.substring(0,m)]),i[r-1][0]=st,i[r-1][1]=g.substring(0,g.length-m),i[r+1][0]=ot,i[r+1][1]=d.substring(m),r++),r++}r++}}var vr=/[^a-zA-Z0-9]/,Er=/\s/,Nr=/[\r\n]/,Nl=/\n\r?\n$/,xl=/^\r?\n\r?\n/;function Al(i){function t(m,b){if(!m||!b)return 6;var E=m.charAt(m.length-1),N=b.charAt(0),x=E.match(vr),A=N.match(vr),T=x&&E.match(Er),k=A&&N.match(Er),C=T&&E.match(Nr),I=k&&N.match(Nr),M=C&&m.match(Nl),H=I&&b.match(xl);return M||H?5:C||I?4:x&&!T&&k?3:T||k?2:x||A?1:0}for(var e=1;e<i.length-1;){if(i[e-1][0]==z&&i[e+1][0]==z){var s=i[e-1][1],n=i[e][1],r=i[e+1][1],o=mn(s,n);if(o){var a=n.substring(n.length-o);s=s.substring(0,s.length-o),n=a+n.substring(0,n.length-o),r=a+r}for(var c=s,h=n,d=r,g=t(s,n)+t(n,r);n.charAt(0)===r.charAt(0);){s+=n.charAt(0),n=n.substring(1)+r.charAt(0),r=r.substring(1);var p=t(s,n)+t(n,r);p>=g&&(g=p,c=s,h=n,d=r)}i[e-1][1]!=c&&(c?i[e-1][1]=c:(i.splice(e-1,1),e--),i[e][1]=h,d?i[e+1][1]=d:(i.splice(e+1,1),e--))}e++}}function Wi(i,t){i.push([z,""]);for(var e=0,s=0,n=0,r="",o="",a;e<i.length;){if(e<i.length-1&&!i[e][1]){i.splice(e,1);continue}switch(i[e][0]){case st:n++,o+=i[e][1],e++;break;case ot:s++,r+=i[e][1],e++;break;case z:var c=e-n-s-1;if(t){if(c>=0&&ro(i[c][1])){var h=i[c][1].slice(-1);if(i[c][1]=i[c][1].slice(0,-1),r=h+r,o=h+o,!i[c][1]){i.splice(c,1),e--;var d=c-1;i[d]&&i[d][0]===st&&(n++,o=i[d][1]+o,d--),i[d]&&i[d][0]===ot&&(s++,r=i[d][1]+r,d--),c=d}}if(io(i[e][1])){var h=i[e][1].charAt(0);i[e][1]=i[e][1].slice(1),r+=h,o+=h}}if(e<i.length-1&&!i[e][1]){i.splice(e,1);break}if(r.length>0||o.length>0){r.length>0&&o.length>0&&(a=Gi(o,r),a!==0&&(c>=0?i[c][1]+=o.substring(0,a):(i.splice(0,0,[z,o.substring(0,a)]),e++),o=o.substring(a),r=r.substring(a)),a=mn(o,r),a!==0&&(i[e][1]=o.substring(o.length-a)+i[e][1],o=o.substring(0,o.length-a),r=r.substring(0,r.length-a)));var g=n+s;r.length===0&&o.length===0?(i.splice(e-g,g),e=e-g):r.length===0?(i.splice(e-g,g,[st,o]),e=e-g+1):o.length===0?(i.splice(e-g,g,[ot,r]),e=e-g+1):(i.splice(e-g,g,[ot,r],[st,o]),e=e-g+2)}e!==0&&i[e-1][0]===z?(i[e-1][1]+=i[e][1],i.splice(e,1)):e++,n=0,s=0,r="",o="";break}}i[i.length-1][1]===""&&i.pop();var p=!1;for(e=1;e<i.length-1;)i[e-1][0]===z&&i[e+1][0]===z&&(i[e][1].substring(i[e][1].length-i[e-1][1].length)===i[e-1][1]?(i[e][1]=i[e-1][1]+i[e][1].substring(0,i[e][1].length-i[e-1][1].length),i[e+1][1]=i[e-1][1]+i[e+1][1],i.splice(e-1,1),p=!0):i[e][1].substring(0,i[e+1][1].length)==i[e+1][1]&&(i[e-1][1]+=i[e+1][1],i[e][1]=i[e][1].substring(i[e+1][1].length)+i[e+1][1],i.splice(e+1,1),p=!0)),e++;p&&Wi(i,t)}function so(i){return i>=55296&&i<=56319}function no(i){return i>=56320&&i<=57343}function io(i){return no(i.charCodeAt(0))}function ro(i){return so(i.charCodeAt(i.length-1))}function Tl(i){for(var t=[],e=0;e<i.length;e++)i[e][1].length>0&&t.push(i[e]);return t}function gi(i,t,e,s){return ro(i)||io(s)?null:Tl([[z,i],[ot,t],[st,e],[z,s]])}function wl(i,t,e){var s=typeof e=="number"?{index:e,length:0}:e.oldRange,n=typeof e=="number"?null:e.newRange,r=i.length,o=t.length;if(s.length===0&&(n===null||n.length===0)){var a=s.index,c=i.slice(0,a),h=i.slice(a),d=n?n.index:null;t:{var g=a+o-r;if(d!==null&&d!==g||g<0||g>o)break t;var p=t.slice(0,g),m=t.slice(g);if(m!==h)break t;var b=Math.min(a,g),E=c.slice(0,b),N=p.slice(0,b);if(E!==N)break t;var x=c.slice(b),A=p.slice(b);return gi(E,x,A,h)}t:{if(d!==null&&d!==a)break t;var T=a,p=t.slice(0,T),m=t.slice(T);if(p!==c)break t;var k=Math.min(r-T,o-T),C=h.slice(h.length-k),I=m.slice(m.length-k);if(C!==I)break t;var x=h.slice(0,h.length-k),A=m.slice(0,m.length-k);return gi(c,x,A,C)}}if(s.length>0&&n&&n.length===0)t:{var E=i.slice(0,s.index),C=i.slice(s.index+s.length),b=E.length,k=C.length;if(o<b+k)break t;var N=t.slice(0,b),I=t.slice(o-k);if(E!==N||C!==I)break t;var x=i.slice(b,r-k),A=t.slice(b,o-k);return gi(E,x,A,C)}return null}function gn(i,t,e,s){return fs(i,t,e,s,!0)}gn.INSERT=st;gn.DELETE=ot;gn.EQUAL=z;var Ll=gn,cn={exports:{}};cn.exports;(function(i,t){var e=200,s="__lodash_hash_undefined__",n=9007199254740991,r="[object Arguments]",o="[object Array]",a="[object Boolean]",c="[object Date]",h="[object Error]",d="[object Function]",g="[object GeneratorFunction]",p="[object Map]",m="[object Number]",b="[object Object]",E="[object Promise]",N="[object RegExp]",x="[object Set]",A="[object String]",T="[object Symbol]",k="[object WeakMap]",C="[object ArrayBuffer]",I="[object DataView]",M="[object Float32Array]",H="[object Float64Array]",Ot="[object Int8Array]",jt="[object Int16Array]",te="[object Int32Array]",ee="[object Uint8Array]",Ns="[object Uint8ClampedArray]",xs="[object Uint16Array]",As="[object Uint32Array]",Nn=/[\\^$.*+?()[\]{}|]/g,xn=/\w*$/,An=/^\[object .+?Constructor\]$/,Tn=/^(?:0|[1-9]\d*)$/,$={};$[r]=$[o]=$[C]=$[I]=$[a]=$[c]=$[M]=$[H]=$[Ot]=$[jt]=$[te]=$[p]=$[m]=$[b]=$[N]=$[x]=$[A]=$[T]=$[ee]=$[Ns]=$[xs]=$[As]=!0,$[h]=$[d]=$[k]=!1;var wn=typeof Wt=="object"&&Wt&&Wt.Object===Object&&Wt,Ln=typeof self=="object"&&self&&self.Object===Object&&self,pt=wn||Ln||Function("return this")(),Ts=t&&!t.nodeType&&t,U=Ts&&!0&&i&&!i.nodeType&&i,ws=U&&U.exports===Ts;function Cn(l,u){return l.set(u[0],u[1]),l}function mt(l,u){return l.add(u),l}function Ls(l,u){for(var f=-1,v=l?l.length:0;++f<v&&u(l[f],f,l)!==!1;);return l}function Cs(l,u){for(var f=-1,v=u.length,O=l.length;++f<v;)l[O+f]=u[f];return l}function $e(l,u,f,v){for(var O=-1,_=l?l.length:0;++O<_;)f=u(f,l[O],O,l);return f}function Ue(l,u){for(var f=-1,v=Array(l);++f<l;)v[f]=u(f);return v}function Ss(l,u){return l==null?void 0:l[u]}function He(l){var u=!1;if(l!=null&&typeof l.toString!="function")try{u=!!(l+"")}catch{}return u}function qs(l){var u=-1,f=Array(l.size);return l.forEach(function(v,O){f[++u]=[O,v]}),f}function je(l,u){return function(f){return l(u(f))}}function ks(l){var u=-1,f=Array(l.size);return l.forEach(function(v){f[++u]=v}),f}var Sn=Array.prototype,qn=Function.prototype,fe=Object.prototype,Fe=pt["__core-js_shared__"],_s=function(){var l=/[^.]+$/.exec(Fe&&Fe.keys&&Fe.keys.IE_PROTO||"");return l?"Symbol(src)_1."+l:""}(),Is=qn.toString,Lt=fe.hasOwnProperty,pe=fe.toString,kn=RegExp("^"+Is.call(Lt).replace(Nn,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),se=ws?pt.Buffer:void 0,me=pt.Symbol,ze=pt.Uint8Array,at=je(Object.getPrototypeOf,Object),Os=Object.create,Rs=fe.propertyIsEnumerable,_n=Sn.splice,Ve=Object.getOwnPropertySymbols,ge=se?se.isBuffer:void 0,Ms=je(Object.keys,Object),be=bt(pt,"DataView"),ne=bt(pt,"Map"),gt=bt(pt,"Promise"),ye=bt(pt,"Set"),Ke=bt(pt,"WeakMap"),ie=bt(Object,"create"),Ge=tt(be),re=tt(ne),We=tt(gt),Ze=tt(ye),Xe=tt(Ke),Ft=me?me.prototype:void 0,Bs=Ft?Ft.valueOf:void 0;function Rt(l){var u=-1,f=l?l.length:0;for(this.clear();++u<f;){var v=l[u];this.set(v[0],v[1])}}function In(){this.__data__=ie?ie(null):{}}function On(l){return this.has(l)&&delete this.__data__[l]}function Rn(l){var u=this.__data__;if(ie){var f=u[l];return f===s?void 0:f}return Lt.call(u,l)?u[l]:void 0}function Ds(l){var u=this.__data__;return ie?u[l]!==void 0:Lt.call(u,l)}function Ye(l,u){var f=this.__data__;return f[l]=ie&&u===void 0?s:u,this}Rt.prototype.clear=In,Rt.prototype.delete=On,Rt.prototype.get=Rn,Rt.prototype.has=Ds,Rt.prototype.set=Ye;function V(l){var u=-1,f=l?l.length:0;for(this.clear();++u<f;){var v=l[u];this.set(v[0],v[1])}}function Mn(){this.__data__=[]}function Bn(l){var u=this.__data__,f=Ee(u,l);if(f<0)return!1;var v=u.length-1;return f==v?u.pop():_n.call(u,f,1),!0}function Dn(l){var u=this.__data__,f=Ee(u,l);return f<0?void 0:u[f][1]}function Pn(l){return Ee(this.__data__,l)>-1}function $n(l,u){var f=this.__data__,v=Ee(f,l);return v<0?f.push([l,u]):f[v][1]=u,this}V.prototype.clear=Mn,V.prototype.delete=Bn,V.prototype.get=Dn,V.prototype.has=Pn,V.prototype.set=$n;function W(l){var u=-1,f=l?l.length:0;for(this.clear();++u<f;){var v=l[u];this.set(v[0],v[1])}}function Un(){this.__data__={hash:new Rt,map:new(ne||V),string:new Rt}}function Hn(l){return le(this,l).delete(l)}function jn(l){return le(this,l).get(l)}function Fn(l){return le(this,l).has(l)}function zn(l,u){return le(this,l).set(l,u),this}W.prototype.clear=Un,W.prototype.delete=Hn,W.prototype.get=jn,W.prototype.has=Fn,W.prototype.set=zn;function nt(l){this.__data__=new V(l)}function Vn(){this.__data__=new V}function Kn(l){return this.__data__.delete(l)}function Gn(l){return this.__data__.get(l)}function Wn(l){return this.__data__.has(l)}function Zn(l,u){var f=this.__data__;if(f instanceof V){var v=f.__data__;if(!ne||v.length<e-1)return v.push([l,u]),this;f=this.__data__=new W(v)}return f.set(l,u),this}nt.prototype.clear=Vn,nt.prototype.delete=Kn,nt.prototype.get=Gn,nt.prototype.has=Wn,nt.prototype.set=Zn;function ve(l,u){var f=es(l)||xe(l)?Ue(l.length,String):[],v=f.length,O=!!v;for(var _ in l)Lt.call(l,_)&&!(O&&(_=="length"||ci(_,v)))&&f.push(_);return f}function Ps(l,u,f){var v=l[u];(!(Lt.call(l,u)&&Fs(v,f))||f===void 0&&!(u in l))&&(l[u]=f)}function Ee(l,u){for(var f=l.length;f--;)if(Fs(l[f][0],u))return f;return-1}function Ct(l,u){return l&&ts(u,ns(u),l)}function Qe(l,u,f,v,O,_,D){var B;if(v&&(B=_?v(l,O,_,D):v(l)),B!==void 0)return B;if(!qt(l))return l;var j=es(l);if(j){if(B=li(l),!u)return ii(l,B)}else{var P=Bt(l),Z=P==d||P==g;if(zs(l))return Ne(l,u);if(P==b||P==r||Z&&!_){if(He(l))return _?l:{};if(B=St(Z?{}:l),!u)return ri(l,Ct(B,l))}else{if(!$[P])return _?l:{};B=ai(l,P,Qe,u)}}D||(D=new nt);var it=D.get(l);if(it)return it;if(D.set(l,B),!j)var F=f?oi(l):ns(l);return Ls(F||l,function(X,K){F&&(K=X,X=l[K]),Ps(B,K,Qe(X,u,f,v,K,l,D))}),B}function Xn(l){return qt(l)?Os(l):{}}function Yn(l,u,f){var v=u(l);return es(l)?v:Cs(v,f(l))}function Qn(l){return pe.call(l)}function Jn(l){if(!qt(l)||hi(l))return!1;var u=ss(l)||He(l)?kn:An;return u.test(tt(l))}function ti(l){if(!Hs(l))return Ms(l);var u=[];for(var f in Object(l))Lt.call(l,f)&&f!="constructor"&&u.push(f);return u}function Ne(l,u){if(u)return l.slice();var f=new l.constructor(l.length);return l.copy(f),f}function Je(l){var u=new l.constructor(l.byteLength);return new ze(u).set(new ze(l)),u}function oe(l,u){var f=u?Je(l.buffer):l.buffer;return new l.constructor(f,l.byteOffset,l.byteLength)}function $s(l,u,f){var v=u?f(qs(l),!0):qs(l);return $e(v,Cn,new l.constructor)}function Us(l){var u=new l.constructor(l.source,xn.exec(l));return u.lastIndex=l.lastIndex,u}function ei(l,u,f){var v=u?f(ks(l),!0):ks(l);return $e(v,mt,new l.constructor)}function si(l){return Bs?Object(Bs.call(l)):{}}function ni(l,u){var f=u?Je(l.buffer):l.buffer;return new l.constructor(f,l.byteOffset,l.length)}function ii(l,u){var f=-1,v=l.length;for(u||(u=Array(v));++f<v;)u[f]=l[f];return u}function ts(l,u,f,v){f||(f={});for(var O=-1,_=u.length;++O<_;){var D=u[O],B=void 0;Ps(f,D,B===void 0?l[D]:B)}return f}function ri(l,u){return ts(l,Mt(l),u)}function oi(l){return Yn(l,ns,Mt)}function le(l,u){var f=l.__data__;return ui(u)?f[typeof u=="string"?"string":"hash"]:f.map}function bt(l,u){var f=Ss(l,u);return Jn(f)?f:void 0}var Mt=Ve?je(Ve,Object):fi,Bt=Qn;(be&&Bt(new be(new ArrayBuffer(1)))!=I||ne&&Bt(new ne)!=p||gt&&Bt(gt.resolve())!=E||ye&&Bt(new ye)!=x||Ke&&Bt(new Ke)!=k)&&(Bt=function(l){var u=pe.call(l),f=u==b?l.constructor:void 0,v=f?tt(f):void 0;if(v)switch(v){case Ge:return I;case re:return p;case We:return E;case Ze:return x;case Xe:return k}return u});function li(l){var u=l.length,f=l.constructor(u);return u&&typeof l[0]=="string"&&Lt.call(l,"index")&&(f.index=l.index,f.input=l.input),f}function St(l){return typeof l.constructor=="function"&&!Hs(l)?Xn(at(l)):{}}function ai(l,u,f,v){var O=l.constructor;switch(u){case C:return Je(l);case a:case c:return new O(+l);case I:return oe(l,v);case M:case H:case Ot:case jt:case te:case ee:case Ns:case xs:case As:return ni(l,v);case p:return $s(l,v,f);case m:case A:return new O(l);case N:return Us(l);case x:return ei(l,v,f);case T:return si(l)}}function ci(l,u){return u=u??n,!!u&&(typeof l=="number"||Tn.test(l))&&l>-1&&l%1==0&&l<u}function ui(l){var u=typeof l;return u=="string"||u=="number"||u=="symbol"||u=="boolean"?l!=="__proto__":l===null}function hi(l){return!!_s&&_s in l}function Hs(l){var u=l&&l.constructor,f=typeof u=="function"&&u.prototype||fe;return l===f}function tt(l){if(l!=null){try{return Is.call(l)}catch{}try{return l+""}catch{}}return""}function js(l){return Qe(l,!0,!0)}function Fs(l,u){return l===u||l!==l&&u!==u}function xe(l){return di(l)&&Lt.call(l,"callee")&&(!Rs.call(l,"callee")||pe.call(l)==r)}var es=Array.isArray;function Ae(l){return l!=null&&Vs(l.length)&&!ss(l)}function di(l){return Ks(l)&&Ae(l)}var zs=ge||pi;function ss(l){var u=qt(l)?pe.call(l):"";return u==d||u==g}function Vs(l){return typeof l=="number"&&l>-1&&l%1==0&&l<=n}function qt(l){var u=typeof l;return!!l&&(u=="object"||u=="function")}function Ks(l){return!!l&&typeof l=="object"}function ns(l){return Ae(l)?ve(l):ti(l)}function fi(){return[]}function pi(){return!1}i.exports=js})(cn,cn.exports);var oo=cn.exports,un={exports:{}};un.exports;(function(i,t){var e=200,s="__lodash_hash_undefined__",n=1,r=2,o=9007199254740991,a="[object Arguments]",c="[object Array]",h="[object AsyncFunction]",d="[object Boolean]",g="[object Date]",p="[object Error]",m="[object Function]",b="[object GeneratorFunction]",E="[object Map]",N="[object Number]",x="[object Null]",A="[object Object]",T="[object Promise]",k="[object Proxy]",C="[object RegExp]",I="[object Set]",M="[object String]",H="[object Symbol]",Ot="[object Undefined]",jt="[object WeakMap]",te="[object ArrayBuffer]",ee="[object DataView]",Ns="[object Float32Array]",xs="[object Float64Array]",As="[object Int8Array]",Nn="[object Int16Array]",xn="[object Int32Array]",An="[object Uint8Array]",Tn="[object Uint8ClampedArray]",$="[object Uint16Array]",wn="[object Uint32Array]",Ln=/[\\^$.*+?()[\]{}|]/g,pt=/^\[object .+?Constructor\]$/,Ts=/^(?:0|[1-9]\d*)$/,U={};U[Ns]=U[xs]=U[As]=U[Nn]=U[xn]=U[An]=U[Tn]=U[$]=U[wn]=!0,U[a]=U[c]=U[te]=U[d]=U[ee]=U[g]=U[p]=U[m]=U[E]=U[N]=U[A]=U[C]=U[I]=U[M]=U[jt]=!1;var ws=typeof Wt=="object"&&Wt&&Wt.Object===Object&&Wt,Cn=typeof self=="object"&&self&&self.Object===Object&&self,mt=ws||Cn||Function("return this")(),Ls=t&&!t.nodeType&&t,Cs=Ls&&!0&&i&&!i.nodeType&&i,$e=Cs&&Cs.exports===Ls,Ue=$e&&ws.process,Ss=function(){try{return Ue&&Ue.binding&&Ue.binding("util")}catch{}}(),He=Ss&&Ss.isTypedArray;function qs(l,u){for(var f=-1,v=l==null?0:l.length,O=0,_=[];++f<v;){var D=l[f];u(D,f,l)&&(_[O++]=D)}return _}function je(l,u){for(var f=-1,v=u.length,O=l.length;++f<v;)l[O+f]=u[f];return l}function ks(l,u){for(var f=-1,v=l==null?0:l.length;++f<v;)if(u(l[f],f,l))return!0;return!1}function Sn(l,u){for(var f=-1,v=Array(l);++f<l;)v[f]=u(f);return v}function qn(l){return function(u){return l(u)}}function fe(l,u){return l.has(u)}function Fe(l,u){return l==null?void 0:l[u]}function _s(l){var u=-1,f=Array(l.size);return l.forEach(function(v,O){f[++u]=[O,v]}),f}function Is(l,u){return function(f){return l(u(f))}}function Lt(l){var u=-1,f=Array(l.size);return l.forEach(function(v){f[++u]=v}),f}var pe=Array.prototype,kn=Function.prototype,se=Object.prototype,me=mt["__core-js_shared__"],ze=kn.toString,at=se.hasOwnProperty,Os=function(){var l=/[^.]+$/.exec(me&&me.keys&&me.keys.IE_PROTO||"");return l?"Symbol(src)_1."+l:""}(),Rs=se.toString,_n=RegExp("^"+ze.call(at).replace(Ln,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Ve=$e?mt.Buffer:void 0,ge=mt.Symbol,Ms=mt.Uint8Array,be=se.propertyIsEnumerable,ne=pe.splice,gt=ge?ge.toStringTag:void 0,ye=Object.getOwnPropertySymbols,Ke=Ve?Ve.isBuffer:void 0,ie=Is(Object.keys,Object),Ge=Mt(mt,"DataView"),re=Mt(mt,"Map"),We=Mt(mt,"Promise"),Ze=Mt(mt,"Set"),Xe=Mt(mt,"WeakMap"),Ft=Mt(Object,"create"),Bs=tt(Ge),Rt=tt(re),In=tt(We),On=tt(Ze),Rn=tt(Xe),Ds=ge?ge.prototype:void 0,Ye=Ds?Ds.valueOf:void 0;function V(l){var u=-1,f=l==null?0:l.length;for(this.clear();++u<f;){var v=l[u];this.set(v[0],v[1])}}function Mn(){this.__data__=Ft?Ft(null):{},this.size=0}function Bn(l){var u=this.has(l)&&delete this.__data__[l];return this.size-=u?1:0,u}function Dn(l){var u=this.__data__;if(Ft){var f=u[l];return f===s?void 0:f}return at.call(u,l)?u[l]:void 0}function Pn(l){var u=this.__data__;return Ft?u[l]!==void 0:at.call(u,l)}function $n(l,u){var f=this.__data__;return this.size+=this.has(l)?0:1,f[l]=Ft&&u===void 0?s:u,this}V.prototype.clear=Mn,V.prototype.delete=Bn,V.prototype.get=Dn,V.prototype.has=Pn,V.prototype.set=$n;function W(l){var u=-1,f=l==null?0:l.length;for(this.clear();++u<f;){var v=l[u];this.set(v[0],v[1])}}function Un(){this.__data__=[],this.size=0}function Hn(l){var u=this.__data__,f=Ne(u,l);if(f<0)return!1;var v=u.length-1;return f==v?u.pop():ne.call(u,f,1),--this.size,!0}function jn(l){var u=this.__data__,f=Ne(u,l);return f<0?void 0:u[f][1]}function Fn(l){return Ne(this.__data__,l)>-1}function zn(l,u){var f=this.__data__,v=Ne(f,l);return v<0?(++this.size,f.push([l,u])):f[v][1]=u,this}W.prototype.clear=Un,W.prototype.delete=Hn,W.prototype.get=jn,W.prototype.has=Fn,W.prototype.set=zn;function nt(l){var u=-1,f=l==null?0:l.length;for(this.clear();++u<f;){var v=l[u];this.set(v[0],v[1])}}function Vn(){this.size=0,this.__data__={hash:new V,map:new(re||W),string:new V}}function Kn(l){var u=bt(this,l).delete(l);return this.size-=u?1:0,u}function Gn(l){return bt(this,l).get(l)}function Wn(l){return bt(this,l).has(l)}function Zn(l,u){var f=bt(this,l),v=f.size;return f.set(l,u),this.size+=f.size==v?0:1,this}nt.prototype.clear=Vn,nt.prototype.delete=Kn,nt.prototype.get=Gn,nt.prototype.has=Wn,nt.prototype.set=Zn;function ve(l){var u=-1,f=l==null?0:l.length;for(this.__data__=new nt;++u<f;)this.add(l[u])}function Ps(l){return this.__data__.set(l,s),this}function Ee(l){return this.__data__.has(l)}ve.prototype.add=ve.prototype.push=Ps,ve.prototype.has=Ee;function Ct(l){var u=this.__data__=new W(l);this.size=u.size}function Qe(){this.__data__=new W,this.size=0}function Xn(l){var u=this.__data__,f=u.delete(l);return this.size=u.size,f}function Yn(l){return this.__data__.get(l)}function Qn(l){return this.__data__.has(l)}function Jn(l,u){var f=this.__data__;if(f instanceof W){var v=f.__data__;if(!re||v.length<e-1)return v.push([l,u]),this.size=++f.size,this;f=this.__data__=new nt(v)}return f.set(l,u),this.size=f.size,this}Ct.prototype.clear=Qe,Ct.prototype.delete=Xn,Ct.prototype.get=Yn,Ct.prototype.has=Qn,Ct.prototype.set=Jn;function ti(l,u){var f=xe(l),v=!f&&Fs(l),O=!f&&!v&&Ae(l),_=!f&&!v&&!O&&Ks(l),D=f||v||O||_,B=D?Sn(l.length,String):[],j=B.length;for(var P in l)at.call(l,P)&&!(D&&(P=="length"||O&&(P=="offset"||P=="parent")||_&&(P=="buffer"||P=="byteLength"||P=="byteOffset")||ai(P,j)))&&B.push(P);return B}function Ne(l,u){for(var f=l.length;f--;)if(js(l[f][0],u))return f;return-1}function Je(l,u,f){var v=u(l);return xe(l)?v:je(v,f(l))}function oe(l){return l==null?l===void 0?Ot:x:gt&> in Object(l)?Bt(l):Hs(l)}function $s(l){return qt(l)&&oe(l)==a}function Us(l,u,f,v,O){return l===u?!0:l==null||u==null||!qt(l)&&!qt(u)?l!==l&&u!==u:ei(l,u,f,v,Us,O)}function ei(l,u,f,v,O,_){var D=xe(l),B=xe(u),j=D?c:St(l),P=B?c:St(u);j=j==a?A:j,P=P==a?A:P;var Z=j==A,it=P==A,F=j==P;if(F&&Ae(l)){if(!Ae(u))return!1;D=!0,Z=!1}if(F&&!Z)return _||(_=new Ct),D||Ks(l)?ts(l,u,f,v,O,_):ri(l,u,j,f,v,O,_);if(!(f&n)){var X=Z&&at.call(l,"__wrapped__"),K=it&&at.call(u,"__wrapped__");if(X||K){var zt=X?l.value():l,Dt=K?u.value():u;return _||(_=new Ct),O(zt,Dt,f,v,_)}}return F?(_||(_=new Ct),oi(l,u,f,v,O,_)):!1}function si(l){if(!Vs(l)||ui(l))return!1;var u=zs(l)?_n:pt;return u.test(tt(l))}function ni(l){return qt(l)&&ss(l.length)&&!!U[oe(l)]}function ii(l){if(!hi(l))return ie(l);var u=[];for(var f in Object(l))at.call(l,f)&&f!="constructor"&&u.push(f);return u}function ts(l,u,f,v,O,_){var D=f&n,B=l.length,j=u.length;if(B!=j&&!(D&&j>B))return!1;var P=_.get(l);if(P&&_.get(u))return P==u;var Z=-1,it=!0,F=f&r?new ve:void 0;for(_.set(l,u),_.set(u,l);++Z<B;){var X=l[Z],K=u[Z];if(v)var zt=D?v(K,X,Z,u,l,_):v(X,K,Z,l,u,_);if(zt!==void 0){if(zt)continue;it=!1;break}if(F){if(!ks(u,function(Dt,ae){if(!fe(F,ae)&&(X===Dt||O(X,Dt,f,v,_)))return F.push(ae)})){it=!1;break}}else if(!(X===K||O(X,K,f,v,_))){it=!1;break}}return _.delete(l),_.delete(u),it}function ri(l,u,f,v,O,_,D){switch(f){case ee:if(l.byteLength!=u.byteLength||l.byteOffset!=u.byteOffset)return!1;l=l.buffer,u=u.buffer;case te:return!(l.byteLength!=u.byteLength||!_(new Ms(l),new Ms(u)));case d:case g:case N:return js(+l,+u);case p:return l.name==u.name&&l.message==u.message;case C:case M:return l==u+"";case E:var B=_s;case I:var j=v&n;if(B||(B=Lt),l.size!=u.size&&!j)return!1;var P=D.get(l);if(P)return P==u;v|=r,D.set(l,u);var Z=ts(B(l),B(u),v,O,_,D);return D.delete(l),Z;case H:if(Ye)return Ye.call(l)==Ye.call(u)}return!1}function oi(l,u,f,v,O,_){var D=f&n,B=le(l),j=B.length,P=le(u),Z=P.length;if(j!=Z&&!D)return!1;for(var it=j;it--;){var F=B[it];if(!(D?F in u:at.call(u,F)))return!1}var X=_.get(l);if(X&&_.get(u))return X==u;var K=!0;_.set(l,u),_.set(u,l);for(var zt=D;++it<j;){F=B[it];var Dt=l[F],ae=u[F];if(v)var ur=D?v(ae,Dt,F,u,l,_):v(Dt,ae,F,l,u,_);if(!(ur===void 0?Dt===ae||O(Dt,ae,f,v,_):ur)){K=!1;break}zt||(zt=F=="constructor")}if(K&&!zt){var Gs=l.constructor,Ws=u.constructor;Gs!=Ws&&"constructor"in l&&"constructor"in u&&!(typeof Gs=="function"&&Gs instanceof Gs&&typeof Ws=="function"&&Ws instanceof Ws)&&(K=!1)}return _.delete(l),_.delete(u),K}function le(l){return Je(l,ns,li)}function bt(l,u){var f=l.__data__;return ci(u)?f[typeof u=="string"?"string":"hash"]:f.map}function Mt(l,u){var f=Fe(l,u);return si(f)?f:void 0}function Bt(l){var u=at.call(l,gt),f=l[gt];try{l[gt]=void 0;var v=!0}catch{}var O=Rs.call(l);return v&&(u?l[gt]=f:delete l[gt]),O}var li=ye?function(l){return l==null?[]:(l=Object(l),qs(ye(l),function(u){return be.call(l,u)}))}:fi,St=oe;(Ge&&St(new Ge(new ArrayBuffer(1)))!=ee||re&&St(new re)!=E||We&&St(We.resolve())!=T||Ze&&St(new Ze)!=I||Xe&&St(new Xe)!=jt)&&(St=function(l){var u=oe(l),f=u==A?l.constructor:void 0,v=f?tt(f):"";if(v)switch(v){case Bs:return ee;case Rt:return E;case In:return T;case On:return I;case Rn:return jt}return u});function ai(l,u){return u=u??o,!!u&&(typeof l=="number"||Ts.test(l))&&l>-1&&l%1==0&&l<u}function ci(l){var u=typeof l;return u=="string"||u=="number"||u=="symbol"||u=="boolean"?l!=="__proto__":l===null}function ui(l){return!!Os&&Os in l}function hi(l){var u=l&&l.constructor,f=typeof u=="function"&&u.prototype||se;return l===f}function Hs(l){return Rs.call(l)}function tt(l){if(l!=null){try{return ze.call(l)}catch{}try{return l+""}catch{}}return""}function js(l,u){return l===u||l!==l&&u!==u}var Fs=$s(function(){return arguments}())?$s:function(l){return qt(l)&&at.call(l,"callee")&&!be.call(l,"callee")},xe=Array.isArray;function es(l){return l!=null&&ss(l.length)&&!zs(l)}var Ae=Ke||pi;function di(l,u){return Us(l,u)}function zs(l){if(!Vs(l))return!1;var u=oe(l);return u==m||u==b||u==h||u==k}function ss(l){return typeof l=="number"&&l>-1&&l%1==0&&l<=o}function Vs(l){var u=typeof l;return l!=null&&(u=="object"||u=="function")}function qt(l){return l!=null&&typeof l=="object"}var Ks=He?qn(He):ni;function ns(l){return es(l)?ti(l):ii(l)}function fi(){return[]}function pi(){return!1}i.exports=di})(un,un.exports);var lo=un.exports,Zi={};Object.defineProperty(Zi,"__esModule",{value:!0});const Cl=oo,Sl=lo;var Ii;(function(i){function t(r={},o={},a=!1){typeof r!="object"&&(r={}),typeof o!="object"&&(o={});let c=Cl(o);a||(c=Object.keys(c).reduce((h,d)=>(c[d]!=null&&(h[d]=c[d]),h),{}));for(const h in r)r[h]!==void 0&&o[h]===void 0&&(c[h]=r[h]);return Object.keys(c).length>0?c:void 0}i.compose=t;function e(r={},o={}){typeof r!="object"&&(r={}),typeof o!="object"&&(o={});const a=Object.keys(r).concat(Object.keys(o)).reduce((c,h)=>(Sl(r[h],o[h])||(c[h]=o[h]===void 0?null:o[h]),c),{});return Object.keys(a).length>0?a:void 0}i.diff=e;function s(r={},o={}){r=r||{};const a=Object.keys(o).reduce((c,h)=>(o[h]!==r[h]&&r[h]!==void 0&&(c[h]=o[h]),c),{});return Object.keys(r).reduce((c,h)=>(r[h]!==o[h]&&o[h]===void 0&&(c[h]=null),c),a)}i.invert=s;function n(r,o,a=!1){if(typeof r!="object")return o;if(typeof o!="object")return;if(!a)return o;const c=Object.keys(o).reduce((h,d)=>(r[d]===void 0&&(h[d]=o[d]),h),{});return Object.keys(c).length>0?c:void 0}i.transform=n})(Ii||(Ii={}));Zi.default=Ii;var bn={};Object.defineProperty(bn,"__esModule",{value:!0});var Oi;(function(i){function t(e){return typeof e.delete=="number"?e.delete:typeof e.retain=="number"?e.retain:typeof e.retain=="object"&&e.retain!==null?1:typeof e.insert=="string"?e.insert.length:1}i.length=t})(Oi||(Oi={}));bn.default=Oi;var Xi={};Object.defineProperty(Xi,"__esModule",{value:!0});const xr=bn;class ql{constructor(t){this.ops=t,this.index=0,this.offset=0}hasNext(){return this.peekLength()<1/0}next(t){t||(t=1/0);const e=this.ops[this.index];if(e){const s=this.offset,n=xr.default.length(e);if(t>=n-s?(t=n-s,this.index+=1,this.offset=0):this.offset+=t,typeof e.delete=="number")return{delete:t};{const r={};return e.attributes&&(r.attributes=e.attributes),typeof e.retain=="number"?r.retain=t:typeof e.retain=="object"&&e.retain!==null?r.retain=e.retain:typeof e.insert=="string"?r.insert=e.insert.substr(s,t):r.insert=e.insert,r}}else return{retain:1/0}}peek(){return this.ops[this.index]}peekLength(){return this.ops[this.index]?xr.default.length(this.ops[this.index])-this.offset:1/0}peekType(){const t=this.ops[this.index];return t?typeof t.delete=="number"?"delete":typeof t.retain=="number"||typeof t.retain=="object"&&t.retain!==null?"retain":"insert":"retain"}rest(){if(this.hasNext()){if(this.offset===0)return this.ops.slice(this.index);{const t=this.offset,e=this.index,s=this.next(),n=this.ops.slice(this.index);return this.offset=t,this.index=e,[s].concat(n)}}else return[]}}Xi.default=ql;(function(i,t){Object.defineProperty(t,"__esModule",{value:!0}),t.AttributeMap=t.OpIterator=t.Op=void 0;const e=Ll,s=oo,n=lo,r=Zi;t.AttributeMap=r.default;const o=bn;t.Op=o.default;const a=Xi;t.OpIterator=a.default;const c="\0",h=(g,p)=>{if(typeof g!="object"||g===null)throw new Error(`cannot retain a ${typeof g}`);if(typeof p!="object"||p===null)throw new Error(`cannot retain a ${typeof p}`);const m=Object.keys(g)[0];if(!m||m!==Object.keys(p)[0])throw new Error(`embed types not matched: ${m} != ${Object.keys(p)[0]}`);return[m,g[m],p[m]]};class d{constructor(p){Array.isArray(p)?this.ops=p:p!=null&&Array.isArray(p.ops)?this.ops=p.ops:this.ops=[]}static registerEmbed(p,m){this.handlers[p]=m}static unregisterEmbed(p){delete this.handlers[p]}static getHandler(p){const m=this.handlers[p];if(!m)throw new Error(`no handlers for embed type "${p}"`);return m}insert(p,m){const b={};return typeof p=="string"&&p.length===0?this:(b.insert=p,m!=null&&typeof m=="object"&&Object.keys(m).length>0&&(b.attributes=m),this.push(b))}delete(p){return p<=0?this:this.push({delete:p})}retain(p,m){if(typeof p=="number"&&p<=0)return this;const b={retain:p};return m!=null&&typeof m=="object"&&Object.keys(m).length>0&&(b.attributes=m),this.push(b)}push(p){let m=this.ops.length,b=this.ops[m-1];if(p=s(p),typeof b=="object"){if(typeof p.delete=="number"&&typeof b.delete=="number")return this.ops[m-1]={delete:b.delete+p.delete},this;if(typeof b.delete=="number"&&p.insert!=null&&(m-=1,b=this.ops[m-1],typeof b!="object"))return this.ops.unshift(p),this;if(n(p.attributes,b.attributes)){if(typeof p.insert=="string"&&typeof b.insert=="string")return this.ops[m-1]={insert:b.insert+p.insert},typeof p.attributes=="object"&&(this.ops[m-1].attributes=p.attributes),this;if(typeof p.retain=="number"&&typeof b.retain=="number")return this.ops[m-1]={retain:b.retain+p.retain},typeof p.attributes=="object"&&(this.ops[m-1].attributes=p.attributes),this}}return m===this.ops.length?this.ops.push(p):this.ops.splice(m,0,p),this}chop(){const p=this.ops[this.ops.length-1];return p&&typeof p.retain=="number"&&!p.attributes&&this.ops.pop(),this}filter(p){return this.ops.filter(p)}forEach(p){this.ops.forEach(p)}map(p){return this.ops.map(p)}partition(p){const m=[],b=[];return this.forEach(E=>{(p(E)?m:b).push(E)}),[m,b]}reduce(p,m){return this.ops.reduce(p,m)}changeLength(){return this.reduce((p,m)=>m.insert?p+o.default.length(m):m.delete?p-m.delete:p,0)}length(){return this.reduce((p,m)=>p+o.default.length(m),0)}slice(p=0,m=1/0){const b=[],E=new a.default(this.ops);let N=0;for(;N<m&&E.hasNext();){let x;N<p?x=E.next(p-N):(x=E.next(m-N),b.push(x)),N+=o.default.length(x)}return new d(b)}compose(p){const m=new a.default(this.ops),b=new a.default(p.ops),E=[],N=b.peek();if(N!=null&&typeof N.retain=="number"&&N.attributes==null){let A=N.retain;for(;m.peekType()==="insert"&&m.peekLength()<=A;)A-=m.peekLength(),E.push(m.next());N.retain-A>0&&b.next(N.retain-A)}const x=new d(E);for(;m.hasNext()||b.hasNext();)if(b.peekType()==="insert")x.push(b.next());else if(m.peekType()==="delete")x.push(m.next());else{const A=Math.min(m.peekLength(),b.peekLength()),T=m.next(A),k=b.next(A);if(k.retain){const C={};if(typeof T.retain=="number")C.retain=typeof k.retain=="number"?A:k.retain;else if(typeof k.retain=="number")T.retain==null?C.insert=T.insert:C.retain=T.retain;else{const M=T.retain==null?"insert":"retain",[H,Ot,jt]=h(T[M],k.retain),te=d.getHandler(H);C[M]={[H]:te.compose(Ot,jt,M==="retain")}}const I=r.default.compose(T.attributes,k.attributes,typeof T.retain=="number");if(I&&(C.attributes=I),x.push(C),!b.hasNext()&&n(x.ops[x.ops.length-1],C)){const M=new d(m.rest());return x.concat(M).chop()}}else typeof k.delete=="number"&&(typeof T.retain=="number"||typeof T.retain=="object"&&T.retain!==null)&&x.push(k)}return x.chop()}concat(p){const m=new d(this.ops.slice());return p.ops.length>0&&(m.push(p.ops[0]),m.ops=m.ops.concat(p.ops.slice(1))),m}diff(p,m){if(this.ops===p.ops)return new d;const b=[this,p].map(T=>T.map(k=>{if(k.insert!=null)return typeof k.insert=="string"?k.insert:c;const C=T===p?"on":"with";throw new Error("diff() called "+C+" non-document")}).join("")),E=new d,N=e(b[0],b[1],m,!0),x=new a.default(this.ops),A=new a.default(p.ops);return N.forEach(T=>{let k=T[1].length;for(;k>0;){let C=0;switch(T[0]){case e.INSERT:C=Math.min(A.peekLength(),k),E.push(A.next(C));break;case e.DELETE:C=Math.min(k,x.peekLength()),x.next(C),E.delete(C);break;case e.EQUAL:C=Math.min(x.peekLength(),A.peekLength(),k);const I=x.next(C),M=A.next(C);n(I.insert,M.insert)?E.retain(C,r.default.diff(I.attributes,M.attributes)):E.push(M).delete(C);break}k-=C}}),E.chop()}eachLine(p,m=` `){const b=new a.default(this.ops);let E=new d,N=0;for(;b.hasNext();){if(b.peekType()!=="insert")return;const x=b.peek(),A=o.default.length(x)-b.peekLength(),T=typeof x.insert=="string"?x.insert.indexOf(m,A)-A:-1;if(T<0)E.push(b.next());else if(T>0)E.push(b.next(T));else{if(p(E,b.next(1).attributes||{},N)===!1)return;N+=1,E=new d}}E.length()>0&&p(E,{},N)}invert(p){const m=new d;return this.reduce((b,E)=>{if(E.insert)m.delete(o.default.length(E));else{if(typeof E.retain=="number"&&E.attributes==null)return m.retain(E.retain),b+E.retain;if(E.delete||typeof E.retain=="number"){const N=E.delete||E.retain;return p.slice(b,b+N).forEach(A=>{E.delete?m.push(A):E.retain&&E.attributes&&m.retain(o.default.length(A),r.default.invert(E.attributes,A.attributes))}),b+N}else if(typeof E.retain=="object"&&E.retain!==null){const N=p.slice(b,b+1),x=new a.default(N.ops).next(),[A,T,k]=h(E.retain,x.insert),C=d.getHandler(A);return m.retain({[A]:C.invert(T,k)},r.default.invert(E.attributes,x.attributes)),b+1}}return b},0),m.chop()}transform(p,m=!1){if(m=!!m,typeof p=="number")return this.transformPosition(p,m);const b=p,E=new a.default(this.ops),N=new a.default(b.ops),x=new d;for(;E.hasNext()||N.hasNext();)if(E.peekType()==="insert"&&(m||N.peekType()!=="insert"))x.retain(o.default.length(E.next()));else if(N.peekType()==="insert")x.push(N.next());else{const A=Math.min(E.peekLength(),N.peekLength()),T=E.next(A),k=N.next(A);if(T.delete)continue;if(k.delete)x.push(k);else{const C=T.retain,I=k.retain;let M=typeof I=="object"&&I!==null?I:A;if(typeof C=="object"&&C!==null&&typeof I=="object"&&I!==null){const H=Object.keys(C)[0];if(H===Object.keys(I)[0]){const Ot=d.getHandler(H);Ot&&(M={[H]:Ot.transform(C[H],I[H],m)})}}x.retain(M,r.default.transform(T.attributes,k.attributes,m))}}return x.chop()}transformPosition(p,m=!1){m=!!m;const b=new a.default(this.ops);let E=0;for(;b.hasNext()&&E<=p;){const N=b.peekLength(),x=b.peekType();if(b.next(),x==="delete"){p-=Math.min(N,p-E);continue}else x==="insert"&&(E<p||!m)&&(p+=N);E+=N}return p}}d.Op=o.default,d.OpIterator=a.default,d.AttributeMap=r.default,d.handlers={},t.default=d,i.exports=d,i.exports.default=d})(_i,_i.exports);var ft=_i.exports;const S=Gr(ft);class Tt extends lt{static value(){}optimize(){(this.prev||this.next)&&this.remove()}length(){return 0}value(){return""}}Tt.blotName="break";Tt.tagName="BR";let xt=class extends an{};function yn(i){return i.replace(/[&<>"']/g,t=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[t])}var rt;let Jt=(rt=class extends Vi{static compare(t,e){const s=rt.order.indexOf(t),n=rt.order.indexOf(e);return s>=0||n>=0?s-n:t===e?0:t<e?-1:1}formatAt(t,e,s,n){if(rt.compare(this.statics.blotName,s)<0&&this.scroll.query(s,q.BLOT)){const r=this.isolate(t,e);n&&r.wrap(s,n)}else super.formatAt(t,e,s,n)}optimize(t){if(super.optimize(t),this.parent instanceof rt&&rt.compare(this.statics.blotName,this.parent.statics.blotName)>0){const e=this.parent.isolate(this.offset(),this.length());this.moveChildren(e),e.wrap(this)}}},w(rt,"allowedChildren",[rt,Tt,lt,xt]),w(rt,"order",["cursor","inline","link","underline","strike","italic","bold","script","code"]),rt);const Ar=1;class G extends ds{constructor(){super(...arguments);w(this,"cache",{})}delta(){return this.cache.delta==null&&(this.cache.delta=ao(this)),this.cache.delta}deleteAt(e,s){super.deleteAt(e,s),this.cache={}}formatAt(e,s,n,r){s<=0||(this.scroll.query(n,q.BLOCK)?e+s===this.length()&&this.format(n,r):super.formatAt(e,Math.min(s,this.length()-e-1),n,r),this.cache={})}insertAt(e,s,n){if(n!=null){super.insertAt(e,s,n),this.cache={};return}if(s.length===0)return;const r=s.split(` `),o=r.shift();o.length>0&&(e<this.length()-1||this.children.tail==null?super.insertAt(Math.min(e,this.length()-1),o):this.children.tail.insertAt(this.children.tail.length(),o),this.cache={});let a=this;r.reduce((c,h)=>(a=a.split(c,!0),a.insertAt(0,h),h.length),e+o.length)}insertBefore(e,s){const{head:n}=this.children;super.insertBefore(e,s),n instanceof Tt&&n.remove(),this.cache={}}length(){return this.cache.length==null&&(this.cache.length=super.length()+Ar),this.cache.length}moveChildren(e,s){super.moveChildren(e,s),this.cache={}}optimize(e){super.optimize(e),this.cache={}}path(e){return super.path(e,!0)}removeChild(e){super.removeChild(e),this.cache={}}split(e){let s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(s&&(e===0||e>=this.length()-Ar)){const r=this.clone();return e===0?(this.parent.insertBefore(r,this),this):(this.parent.insertBefore(r,this.next),r)}const n=super.split(e,s);return this.cache={},n}}G.blotName="block";G.tagName="P";G.defaultChild=Tt;G.allowedChildren=[Tt,Jt,lt,xt];class dt extends lt{attach(){super.attach(),this.attributes=new fn(this.domNode)}delta(){return new S().insert(this.value(),{...this.formats(),...this.attributes.values()})}format(t,e){const s=this.scroll.query(t,q.BLOCK_ATTRIBUTE);s!=null&&this.attributes.attribute(s,e)}formatAt(t,e,s,n){this.format(s,n)}insertAt(t,e,s){if(s!=null){super.insertAt(t,e,s);return}const n=e.split(` `),r=n.pop(),o=n.map(c=>{const h=this.scroll.create(G.blotName);return h.insertAt(0,c),h}),a=this.split(t);o.forEach(c=>{this.parent.insertBefore(c,a)}),r&&this.parent.insertBefore(this.scroll.create("text",r),a)}}dt.scope=q.BLOCK_BLOT;function ao(i){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return i.descendants(Q).reduce((e,s)=>s.length()===0?e:e.insert(s.value(),ut(s,{},t)),new S).insert(` `,ut(i))}function ut(i){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;return i==null||("formats"in i&&typeof i.formats=="function"&&(t={...t,...i.formats()},e&&delete t["code-token"]),i.parent==null||i.parent.statics.blotName==="scroll"||i.parent.statics.scope!==i.statics.scope)?t:ut(i.parent,t,e)}const ct=class ct extends lt{static value(){}constructor(t,e,s){super(t,e),this.selection=s,this.textNode=document.createTextNode(ct.CONTENTS),this.domNode.appendChild(this.textNode),this.savedLength=0}detach(){this.parent!=null&&this.parent.removeChild(this)}format(t,e){if(this.savedLength!==0){super.format(t,e);return}let s=this,n=0;for(;s!=null&&s.statics.scope!==q.BLOCK_BLOT;)n+=s.offset(s.parent),s=s.parent;s!=null&&(this.savedLength=ct.CONTENTS.length,s.optimize(),s.formatAt(n,ct.CONTENTS.length,t,e),this.savedLength=0)}index(t,e){return t===this.textNode?0:super.index(t,e)}length(){return this.savedLength}position(){return[this.textNode,this.textNode.data.length]}remove(){super.remove(),this.parent=null}restore(){if(this.selection.composing||this.parent==null)return null;const t=this.selection.getNativeRange();for(;this.domNode.lastChild!=null&&this.domNode.lastChild!==this.textNode;)this.domNode.parentNode.insertBefore(this.domNode.lastChild,this.domNode);const e=this.prev instanceof xt?this.prev:null,s=e?e.length():0,n=this.next instanceof xt?this.next:null,r=n?n.text:"",{textNode:o}=this,a=o.data.split(ct.CONTENTS).join("");o.data=ct.CONTENTS;let c;if(e)c=e,(a||n)&&(e.insertAt(e.length(),a+r),n&&n.remove());else if(n)c=n,n.insertAt(0,a);else{const h=document.createTextNode(a);c=this.scroll.create(h),this.parent.insertBefore(c,this)}if(this.remove(),t){const h=(p,m)=>e&&p===e.domNode?m:p===o?s+m-1:n&&p===n.domNode?s+a.length+m:null,d=h(t.start.node,t.start.offset),g=h(t.end.node,t.end.offset);if(d!==null&&g!==null)return{startNode:c.domNode,startOffset:d,endNode:c.domNode,endOffset:g}}return null}update(t,e){if(t.some(s=>s.type==="characterData"&&s.target===this.textNode)){const s=this.restore();s&&(e.range=s)}}optimize(t){super.optimize(t);let{parent:e}=this;for(;e;){if(e.domNode.tagName==="A"){this.savedLength=ct.CONTENTS.length,e.isolate(this.offset(e),this.length()).unwrap(),this.savedLength=0;break}e=e.parent}}value(){return""}};w(ct,"blotName","cursor"),w(ct,"className","ql-cursor"),w(ct,"tagName","span"),w(ct,"CONTENTS","\uFEFF");let Be=ct;var co={exports:{}};(function(i){var t=Object.prototype.hasOwnProperty,e="~";function s(){}Object.create&&(s.prototype=Object.create(null),new s().__proto__||(e=!1));function n(c,h,d){this.fn=c,this.context=h,this.once=d||!1}function r(c,h,d,g,p){if(typeof d!="function")throw new TypeError("The listener must be a function");var m=new n(d,g||c,p),b=e?e+h:h;return c._events[b]?c._events[b].fn?c._events[b]=[c._events[b],m]:c._events[b].push(m):(c._events[b]=m,c._eventsCount++),c}function o(c,h){--c._eventsCount===0?c._events=new s:delete c._events[h]}function a(){this._events=new s,this._eventsCount=0}a.prototype.eventNames=function(){var h=[],d,g;if(this._eventsCount===0)return h;for(g in d=this._events)t.call(d,g)&&h.push(e?g.slice(1):g);return Object.getOwnPropertySymbols?h.concat(Object.getOwnPropertySymbols(d)):h},a.prototype.listeners=function(h){var d=e?e+h:h,g=this._events[d];if(!g)return[];if(g.fn)return[g.fn];for(var p=0,m=g.length,b=new Array(m);p<m;p++)b[p]=g[p].fn;return b},a.prototype.listenerCount=function(h){var d=e?e+h:h,g=this._events[d];return g?g.fn?1:g.length:0},a.prototype.emit=function(h,d,g,p,m,b){var E=e?e+h:h;if(!this._events[E])return!1;var N=this._events[E],x=arguments.length,A,T;if(N.fn){switch(N.once&&this.removeListener(h,N.fn,void 0,!0),x){case 1:return N.fn.call(N.context),!0;case 2:return N.fn.call(N.context,d),!0;case 3:return N.fn.call(N.context,d,g),!0;case 4:return N.fn.call(N.context,d,g,p),!0;case 5:return N.fn.call(N.context,d,g,p,m),!0;case 6:return N.fn.call(N.context,d,g,p,m,b),!0}for(T=1,A=new Array(x-1);T<x;T++)A[T-1]=arguments[T];N.fn.apply(N.context,A)}else{var k=N.length,C;for(T=0;T<k;T++)switch(N[T].once&&this.removeListener(h,N[T].fn,void 0,!0),x){case 1:N[T].fn.call(N[T].context);break;case 2:N[T].fn.call(N[T].context,d);break;case 3:N[T].fn.call(N[T].context,d,g);break;case 4:N[T].fn.call(N[T].context,d,g,p);break;default:if(!A)for(C=1,A=new Array(x-1);C<x;C++)A[C-1]=arguments[C];N[T].fn.apply(N[T].context,A)}}return!0},a.prototype.on=function(h,d,g){return r(this,h,d,g,!1)},a.prototype.once=function(h,d,g){return r(this,h,d,g,!0)},a.prototype.removeListener=function(h,d,g,p){var m=e?e+h:h;if(!this._events[m])return this;if(!d)return o(this,m),this;var b=this._events[m];if(b.fn)b.fn===d&&(!p||b.once)&&(!g||b.context===g)&&o(this,m);else{for(var E=0,N=[],x=b.length;E<x;E++)(b[E].fn!==d||p&&!b[E].once||g&&b[E].context!==g)&&N.push(b[E]);N.length?this._events[m]=N.length===1?N[0]:N:o(this,m)}return this},a.prototype.removeAllListeners=function(h){var d;return h?(d=e?e+h:h,this._events[d]&&o(this,d)):(this._events=new s,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=e,a.EventEmitter=a,i.exports=a})(co);var kl=co.exports;const _l=Gr(kl),Ri=new WeakMap,Mi=["error","warn","log","info"];let Bi="warn";function uo(i){if(Bi&&Mi.indexOf(i)<=Mi.indexOf(Bi)){for(var t=arguments.length,e=new Array(t>1?t-1:0),s=1;s<t;s++)e[s-1]=arguments[s];console[i](...e)}}function Ht(i){return Mi.reduce((t,e)=>(t[e]=uo.bind(console,e,i),t),{})}Ht.level=i=>{Bi=i};uo.level=Ht.level;const bi=Ht("quill:events"),Il=["selectionchange","mousedown","mouseup","click"];Il.forEach(i=>{document.addEventListener(i,function(){for(var t=arguments.length,e=new Array(t),s=0;s<t;s++)e[s]=arguments[s];Array.from(document.querySelectorAll(".ql-container")).forEach(n=>{const r=Ri.get(n);r&&r.emitter&&r.emitter.handleDOM(...e)})})});class L extends _l{constructor(){super(),this.domListeners={},this.on("error",bi.error)}emit(){for(var t=arguments.length,e=new Array(t),s=0;s<t;s++)e[s]=arguments[s];return bi.log.call(bi,...e),super.emit(...e)}handleDOM(t){for(var e=arguments.length,s=new Array(e>1?e-1:0),n=1;n<e;n++)s[n-1]=arguments[n];(this.domListeners[t.type]||[]).forEach(r=>{let{node:o,handler:a}=r;(t.target===o||o.contains(t.target))&&a(t,...s)})}listenDOM(t,e,s){this.domListeners[t]||(this.domListeners[t]=[]),this.domListeners[t].push({node:e,handler:s})}}w(L,"events",{EDITOR_CHANGE:"editor-change",SCROLL_BEFORE_UPDATE:"scroll-before-update",SCROLL_BLOT_MOUNT:"scroll-blot-mount",SCROLL_BLOT_UNMOUNT:"scroll-blot-unmount",SCROLL_OPTIMIZE:"scroll-optimize",SCROLL_UPDATE:"scroll-update",SCROLL_EMBED_UPDATE:"scroll-embed-update",SELECTION_CHANGE:"selection-change",TEXT_CHANGE:"text-change",COMPOSITION_BEFORE_START:"composition-before-start",COMPOSITION_START:"composition-start",COMPOSITION_BEFORE_END:"composition-before-end",COMPOSITION_END:"composition-end"}),w(L,"sources",{API:"api",SILENT:"silent",USER:"user"});const yi=Ht("quill:selection");class ce{constructor(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;this.index=t,this.length=e}}class Ol{constructor(t,e){this.emitter=e,this.scroll=t,this.composing=!1,this.mouseDown=!1,this.root=this.scroll.domNode,this.cursor=this.scroll.create("cursor",this),this.savedRange=new ce(0,0),this.lastRange=this.savedRange,this.lastNative=null,this.handleComposition(),this.handleDragging(),this.emitter.listenDOM("selectionchange",document,()=>{!this.mouseDown&&!this.composing&&setTimeout(this.update.bind(this,L.sources.USER),1)}),this.emitter.on(L.events.SCROLL_BEFORE_UPDATE,()=>{if(!this.hasFocus())return;const s=this.getNativeRange();s!=null&&s.start.node!==this.cursor.textNode&&this.emitter.once(L.events.SCROLL_UPDATE,(n,r)=>{try{this.root.contains(s.start.node)&&this.root.contains(s.end.node)&&this.setNativeRange(s.start.node,s.start.offset,s.end.node,s.end.offset);const o=r.some(a=>a.type==="characterData"||a.type==="childList"||a.type==="attributes"&&a.target===this.root);this.update(o?L.sources.SILENT:n)}catch{}})}),this.emitter.on(L.events.SCROLL_OPTIMIZE,(s,n)=>{if(n.range){const{startNode:r,startOffset:o,endNode:a,endOffset:c}=n.range;this.setNativeRange(r,o,a,c),this.update(L.sources.SILENT)}}),this.update(L.sources.SILENT)}handleComposition(){this.emitter.on(L.events.COMPOSITION_BEFORE_START,()=>{this.composing=!0}),this.emitter.on(L.events.COMPOSITION_END,()=>{if(this.composing=!1,this.cursor.parent){const t=this.cursor.restore();if(!t)return;setTimeout(()=>{this.setNativeRange(t.startNode,t.startOffset,t.endNode,t.endOffset)},1)}})}handleDragging(){this.emitter.listenDOM("mousedown",document.body,()=>{this.mouseDown=!0}),this.emitter.listenDOM("mouseup",document.body,()=>{this.mouseDown=!1,this.update(L.sources.USER)})}focus(){this.hasFocus()||(this.root.focus({preventScroll:!0}),this.setRange(this.savedRange))}format(t,e){this.scroll.update();const s=this.getNativeRange();if(!(s==null||!s.native.collapsed||this.scroll.query(t,q.BLOCK))){if(s.start.node!==this.cursor.textNode){const n=this.scroll.find(s.start.node,!1);if(n==null)return;if(n instanceof Q){const r=n.split(s.start.offset);n.parent.insertBefore(this.cursor,r)}else n.insertBefore(this.cursor,s.start.node);this.cursor.attach()}this.cursor.format(t,e),this.scroll.optimize(),this.setNativeRange(this.cursor.textNode,this.cursor.textNode.data.length),this.update()}}getBounds(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;const s=this.scroll.length();t=Math.min(t,s-1),e=Math.min(t+e,s-1)-t;let n,[r,o]=this.scroll.leaf(t);if(r==null)return null;if(e>0&&o===r.length()){const[d]=this.scroll.leaf(t+1);if(d){const[g]=this.scroll.line(t),[p]=this.scroll.line(t+1);g===p&&(r=d,o=0)}}[n,o]=r.position(o,!0);const a=document.createRange();if(e>0)return a.setStart(n,o),[r,o]=this.scroll.leaf(t+e),r==null?null:([n,o]=r.position(o,!0),a.setEnd(n,o),a.getBoundingClientRect());let c="left",h;if(n instanceof Text){if(!n.data.length)return null;o<n.data.length?(a.setStart(n,o),a.setEnd(n,o+1)):(a.setStart(n,o-1),a.setEnd(n,o),c="right"),h=a.getBoundingClientRect()}else{if(!(r.domNode instanceof Element))return null;h=r.domNode.getBoundingClientRect(),o>0&&(c="right")}return{bottom:h.top+h.height,height:h.height,left:h[c],right:h[c],top:h.top,width:0}}getNativeRange(){const t=document.getSelection();if(t==null||t.rangeCount<=0)return null;const e=t.getRangeAt(0);if(e==null)return null;const s=this.normalizeNative(e);return yi.info("getNativeRange",s),s}getRange(){const t=this.scroll.domNode;if("isConnected"in t&&!t.isConnected)return[null,null];const e=this.getNativeRange();return e==null?[null,null]:[this.normalizedToRange(e),e]}hasFocus(){return document.activeElement===this.root||document.activeElement!=null&&vi(this.root,document.activeElement)}normalizedToRange(t){const e=[[t.start.node,t.start.offset]];t.native.collapsed||e.push([t.end.node,t.end.offset]);const s=e.map(o=>{const[a,c]=o,h=this.scroll.find(a,!0),d=h.offset(this.scroll);return c===0?d:h instanceof Q?d+h.index(a,c):d+h.length()}),n=Math.min(Math.max(...s),this.scroll.length()-1),r=Math.min(n,...s);return new ce(r,n-r)}normalizeNative(t){if(!vi(this.root,t.startContainer)||!t.collapsed&&!vi(this.root,t.endContainer))return null;const e={start:{node:t.startContainer,offset:t.startOffset},end:{node:t.endContainer,offset:t.endOffset},native:t};return[e.start,e.end].forEach(s=>{let{node:n,offset:r}=s;for(;!(n instanceof Text)&&n.childNodes.length>0;)if(n.childNodes.length>r)n=n.childNodes[r],r=0;else if(n.childNodes.length===r)n=n.lastChild,n instanceof Text?r=n.data.length:n.childNodes.length>0?r=n.childNodes.length:r=n.childNodes.length+1;else break;s.node=n,s.offset=r}),e}rangeToNative(t){const e=this.scroll.length(),s=(n,r)=>{n=Math.min(e-1,n);const[o,a]=this.scroll.leaf(n);return o?o.position(a,r):[null,-1]};return[...s(t.index,!1),...s(t.index+t.length,!0)]}setNativeRange(t,e){let s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:t,n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:e,r=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!1;if(yi.info("setNativeRange",t,e,s,n),t!=null&&(this.root.parentNode==null||t.parentNode==null||s.parentNode==null))return;const o=document.getSelection();if(o!=null)if(t!=null){this.hasFocus()||this.root.focus({preventScroll:!0});const{native:a}=this.getNativeRange()||{};if(a==null||r||t!==a.startContainer||e!==a.startOffset||s!==a.endContainer||n!==a.endOffset){t instanceof Element&&t.tagName==="BR"&&(e=Array.from(t.parentNode.childNodes).indexOf(t),t=t.parentNode),s instanceof Element&&s.tagName==="BR"&&(n=Array.from(s.parentNode.childNodes).indexOf(s),s=s.parentNode);const c=document.createRange();c.setStart(t,e),c.setEnd(s,n),o.removeAllRanges(),o.addRange(c)}}else o.removeAllRanges(),this.root.blur()}setRange(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:L.sources.API;if(typeof e=="string"&&(s=e,e=!1),yi.info("setRange",t),t!=null){const n=this.rangeToNative(t);this.setNativeRange(...n,e)}else this.setNativeRange(null);this.update(s)}update(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:L.sources.USER;const e=this.lastRange,[s,n]=this.getRange();if(this.lastRange=s,this.lastNative=n,this.lastRange!=null&&(this.savedRange=this.lastRange),!zi(e,this.lastRange)){if(!this.composing&&n!=null&&n.native.collapsed&&n.start.node!==this.cursor.textNode){const o=this.cursor.restore();o&&this.setNativeRange(o.startNode,o.startOffset,o.endNode,o.endOffset)}const r=[L.events.SELECTION_CHANGE,Ie(this.lastRange),Ie(e),t];this.emitter.emit(L.events.EDITOR_CHANGE,...r),t!==L.sources.SILENT&&this.emitter.emit(...r)}}}function vi(i,t){try{t.parentNode}catch{return!1}return i.contains(t)}const Rl=/^[ -~]*$/;class Ml{constructor(t){this.scroll=t,this.delta=this.getDelta()}applyDelta(t){this.scroll.update();let e=this.scroll.length();this.scroll.batchStart();const s=Tr(t),n=new S;return Dl(s.ops.slice()).reduce((o,a)=>{const c=ft.Op.length(a);let h=a.attributes||{},d=!1,g=!1;if(a.insert!=null){if(n.retain(c),typeof a.insert=="string"){const b=a.insert;g=!b.endsWith(` `)&&(e<=o||!!this.scroll.descendant(dt,o)[0]),this.scroll.insertAt(o,b);const[E,N]=this.scroll.line(o);let x=Xt({},ut(E));if(E instanceof G){const[A]=E.descendant(Q,N);A&&(x=Xt(x,ut(A)))}h=ft.AttributeMap.diff(x,h)||{}}else if(typeof a.insert=="object"){const b=Object.keys(a.insert)[0];if(b==null)return o;const E=this.scroll.query(b,q.INLINE)!=null;if(E)(e<=o||this.scroll.descendant(dt,o)[0])&&(g=!0);else if(o>0){const[N,x]=this.scroll.descendant(Q,o-1);N instanceof xt?N.value()[x]!==` `&&(d=!0):N instanceof lt&&N.statics.scope===q.INLINE_BLOT&&(d=!0)}if(this.scroll.insertAt(o,b,a.insert[b]),E){const[N]=this.scroll.descendant(Q,o);if(N){const x=Xt({},ut(N));h=ft.AttributeMap.diff(x,h)||{}}}}e+=c}else if(n.push(a),a.retain!==null&&typeof a.retain=="object"){const b=Object.keys(a.retain)[0];if(b==null)return o;this.scroll.updateEmbedAt(o,b,a.retain[b])}Object.keys(h).forEach(b=>{this.scroll.formatAt(o,c,b,h[b])});const p=d?1:0,m=g?1:0;return e+=p+m,n.retain(p),n.delete(m),o+c+p+m},0),n.reduce((o,a)=>typeof a.delete=="number"?(this.scroll.deleteAt(o,a.delete),o):o+ft.Op.length(a),0),this.scroll.batchEnd(),this.scroll.optimize(),this.update(s)}deleteText(t,e){return this.scroll.deleteAt(t,e),this.update(new S().retain(t).delete(e))}formatLine(t,e){let s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.scroll.update(),Object.keys(s).forEach(r=>{this.scroll.lines(t,Math.max(e,1)).forEach(o=>{o.format(r,s[r])})}),this.scroll.optimize();const n=new S().retain(t).retain(e,Ie(s));return this.update(n)}formatText(t,e){let s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Object.keys(s).forEach(r=>{this.scroll.formatAt(t,e,r,s[r])});const n=new S().retain(t).retain(e,Ie(s));return this.update(n)}getContents(t,e){return this.delta.slice(t,t+e)}getDelta(){return this.scroll.lines().reduce((t,e)=>t.concat(e.delta()),new S)}getFormat(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,s=[],n=[];e===0?this.scroll.path(t).forEach(a=>{const[c]=a;c instanceof G?s.push(c):c instanceof Q&&n.push(c)}):(s=this.scroll.lines(t,e),n=this.scroll.descendants(Q,t,e));const[r,o]=[s,n].map(a=>{const c=a.shift();if(c==null)return{};let h=ut(c);for(;Object.keys(h).length>0;){const d=a.shift();if(d==null)return h;h=Bl(ut(d),h)}return h});return{...r,...o}}getHTML(t,e){const[s,n]=this.scroll.line(t);if(s){const r=s.length();return s.length()>=n+e&&!(n===0&&e===r)?ps(s,n,e,!0):ps(this.scroll,t,e,!0)}return""}getText(t,e){return this.getContents(t,e).filter(s=>typeof s.insert=="string").map(s=>s.insert).join("")}insertContents(t,e){const s=Tr(e),n=new S().retain(t).concat(s);return this.scroll.insertContents(t,s),this.update(n)}insertEmbed(t,e,s){return this.scroll.insertAt(t,e,s),this.update(new S().retain(t).insert({[e]:s}))}insertText(t,e){let s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return e=e.replace(/\r\n/g,` `).replace(/\r/g,` `),this.scroll.insertAt(t,e),Object.keys(s).forEach(n=>{this.scroll.formatAt(t,e.length,n,s[n])}),this.update(new S().retain(t).insert(e,Ie(s)))}isBlank(){if(this.scroll.children.length===0)return!0;if(this.scroll.children.length>1)return!1;const t=this.scroll.children.head;if((t==null?void 0:t.statics.blotName)!==G.blotName)return!1;const e=t;return e.children.length>1?!1:e.children.head instanceof Tt}removeFormat(t,e){const s=this.getText(t,e),[n,r]=this.scroll.line(t+e);let o=0,a=new S;n!=null&&(o=n.length()-r,a=n.delta().slice(r,r+o-1).insert(` `));const h=this.getContents(t,e+o).diff(new S().insert(s).concat(a)),d=new S().retain(t).concat(h);return this.applyDelta(d)}update(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0;const n=this.delta;if(e.length===1&&e[0].type==="characterData"&&e[0].target.data.match(Rl)&&this.scroll.find(e[0].target)){const r=this.scroll.find(e[0].target),o=ut(r),a=r.offset(this.scroll),c=e[0].oldValue.replace(Be.CONTENTS,""),h=new S().insert(c),d=new S().insert(r.value()),g=s&&{oldRange:wr(s.oldRange,-a),newRange:wr(s.newRange,-a)};t=new S().retain(a).concat(h.diff(d,g)).reduce((m,b)=>b.insert?m.insert(b.insert,o):m.push(b),new S),this.delta=n.compose(t)}else this.delta=this.getDelta(),(!t||!zi(n.compose(t),this.delta))&&(t=n.diff(this.delta,s));return t}}function ke(i,t,e){if(i.length===0){const[m]=Ei(e.pop());return t<=0?`</li></${m}>`:`</li></${m}>${ke([],t-1,e)}`}const[{child:s,offset:n,length:r,indent:o,type:a},...c]=i,[h,d]=Ei(a);if(o>t)return e.push(a),o===t+1?`<${h}><li${d}>${ps(s,n,r)}${ke(c,o,e)}`:`<${h}><li>${ke(i,t+1,e)}`;const g=e[e.length-1];if(o===t&&a===g)return`</li><li${d}>${ps(s,n,r)}${ke(c,o,e)}`;const[p]=Ei(e.pop());return`</li></${p}>${ke(i,t-1,e)}`}function ps(i,t,e){let s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if("html"in i&&typeof i.html=="function")return i.html(t,e);if(i instanceof xt)return yn(i.value().slice(t,t+e));if(i instanceof Nt){if(i.statics.blotName==="list-container"){const h=[];return i.children.forEachAt(t,e,(d,g,p)=>{const m="formats"in d&&typeof d.formats=="function"?d.formats():{};h.push({child:d,offset:g,length:p,indent:m.indent||0,type:m.list})}),ke(h,-1,[])}const n=[];if(i.children.forEachAt(t,e,(h,d,g)=>{n.push(ps(h,d,g))}),s||i.statics.blotName==="list")return n.join("");const{outerHTML:r,innerHTML:o}=i.domNode,[a,c]=r.split(`>${o}<`);return a==="<table"?`<table style="border: 1px solid #000;">${n.join("")}<${c}`:`${a}>${n.join("")}<${c}`}return i.domNode instanceof Element?i.domNode.outerHTML:""}function Bl(i,t){return Object.keys(t).reduce((e,s)=>{if(i[s]==null)return e;const n=t[s];return n===i[s]?e[s]=n:Array.isArray(n)?n.indexOf(i[s])<0?e[s]=n.concat([i[s]]):e[s]=n:e[s]=[n,i[s]],e},{})}function Ei(i){const t=i==="ordered"?"ol":"ul";switch(i){case"checked":return[t,' data-list="checked"'];case"unchecked":return[t,' data-list="unchecked"'];default:return[t,""]}}function Tr(i){return i.reduce((t,e)=>{if(typeof e.insert=="string"){const s=e.insert.replace(/\r\n/g,` `).replace(/\r/g,` `);return t.insert(s,e.attributes)}return t.push(e)},new S)}function wr(i,t){let{index:e,length:s}=i;return new ce(e+t,s)}function Dl(i){const t=[];return i.forEach(e=>{typeof e.insert=="string"?e.insert.split(` `).forEach((n,r)=>{r&&t.push({insert:` `,attributes:e.attributes}),n&&t.push({insert:n,attributes:e.attributes})}):t.push(e)}),t}class wt{constructor(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.quill=t,this.options=e}}w(wt,"DEFAULTS",{});const Qs="\uFEFF";let Yi=class extends lt{constructor(t,e){super(t,e),this.contentNode=document.createElement("span"),this.contentNode.setAttribute("contenteditable","false"),Array.from(this.domNode.childNodes).forEach(s=>{this.contentNode.appendChild(s)}),this.leftGuard=document.createTextNode(Qs),this.rightGuard=document.createTextNode(Qs),this.domNode.appendChild(this.leftGuard),this.domNode.appendChild(this.contentNode),this.domNode.appendChild(this.rightGuard)}index(t,e){return t===this.leftGuard?0:t===this.rightGuard?1:super.index(t,e)}restore(t){let e=null,s;const n=t.data.split(Qs).join("");if(t===this.leftGuard)if(this.prev instanceof xt){const r=this.prev.length();this.prev.insertAt(r,n),e={startNode:this.prev.domNode,startOffset:r+n.length}}else s=document.createTextNode(n),this.parent.insertBefore(this.scroll.create(s),this),e={startNode:s,startOffset:n.length};else t===this.rightGuard&&(this.next instanceof xt?(this.next.insertAt(0,n),e={startNode:this.next.domNode,startOffset:n.length}):(s=document.createTextNode(n),this.parent.insertBefore(this.scroll.create(s),this.next),e={startNode:s,startOffset:n.length}));return t.data=Qs,e}update(t,e){t.forEach(s=>{if(s.type==="characterData"&&(s.target===this.leftGuard||s.target===this.rightGuard)){const n=this.restore(s.target);n&&(e.range=n)}})}};class Pl{constructor(t,e){w(this,"isComposing",!1);this.scroll=t,this.emitter=e,this.setupListeners()}setupListeners(){this.scroll.domNode.addEventListener("compositionstart",t=>{this.isComposing||this.handleCompositionStart(t)}),this.scroll.domNode.addEventListener("compositionend",t=>{this.isComposing&&queueMicrotask(()=>{this.handleCompositionEnd(t)})})}handleCompositionStart(t){const e=t.target instanceof Node?this.scroll.find(t.target,!0):null;e&&!(e instanceof Yi)&&(this.emitter.emit(L.events.COMPOSITION_BEFORE_START,t),this.scroll.batchStart(),this.emitter.emit(L.events.COMPOSITION_START,t),this.isComposing=!0)}handleCompositionEnd(t){this.emitter.emit(L.events.COMPOSITION_BEFORE_END,t),this.scroll.batchEnd(),this.emitter.emit(L.events.COMPOSITION_END,t),this.isComposing=!1}}const us=class us{constructor(t,e){w(this,"modules",{});this.quill=t,this.options=e}init(){Object.keys(this.options.modules).forEach(t=>{this.modules[t]==null&&this.addModule(t)})}addModule(t){const e=this.quill.constructor.import(`modules/${t}`);return this.modules[t]=new e(this.quill,this.options.modules[t]||{}),this.modules[t]}};w(us,"DEFAULTS",{modules:{}}),w(us,"themes",{default:us});let De=us;const $l=i=>i.parentElement||i.getRootNode().host||null,Ul=i=>{const t=i.getBoundingClientRect(),e="offsetWidth"in i&&Math.abs(t.width)/i.offsetWidth||1,s="offsetHeight"in i&&Math.abs(t.height)/i.offsetHeight||1;return{top:t.top,right:t.left+i.clientWidth*e,bottom:t.top+i.clientHeight*s,left:t.left}},Js=i=>{const t=parseInt(i,10);return Number.isNaN(t)?0:t},Lr=(i,t,e,s,n,r)=>i<e&&t>s?0:i<e?-(e-i+n):t>s?t-i>s-e?i+n-e:t-s+r:0,Hl=(i,t)=>{var r,o,a;const e=i.ownerDocument;let s=t,n=i;for(;n;){const c=n===e.body,h=c?{top:0,right:((r=window.visualViewport)==null?void 0:r.width)??e.documentElement.clientWidth,bottom:((o=window.visualViewport)==null?void 0:o.height)??e.documentElement.clientHeight,left:0}:Ul(n),d=getComputedStyle(n),g=Lr(s.left,s.right,h.left,h.right,Js(d.scrollPaddingLeft),Js(d.scrollPaddingRight)),p=Lr(s.top,s.bottom,h.top,h.bottom,Js(d.scrollPaddingTop),Js(d.scrollPaddingBottom));if(g||p)if(c)(a=e.defaultView)==null||a.scrollBy(g,p);else{const{scrollLeft:m,scrollTop:b}=n;p&&(n.scrollTop+=p),g&&(n.scrollLeft+=g);const E=n.scrollLeft-m,N=n.scrollTop-b;s={left:s.left-E,top:s.top-N,right:s.right-E,bottom:s.bottom-N}}n=c||d.position==="fixed"?null:$l(n)}},jl=100,Fl=["block","break","cursor","inline","scroll","text"],zl=(i,t,e)=>{const s=new Me;return Fl.forEach(n=>{const r=t.query(n);r&&s.register(r)}),i.forEach(n=>{let r=t.query(n);r||e.error(`Cannot register "${n}" specified in "formats" config. Are you sure it was registered?`);let o=0;for(;r;)if(s.register(r),r="blotName"in r?r.requiredContainer??null:null,o+=1,o>jl){e.error(`Cycle detected in registering blot requiredContainer: "${n}"`);break}}),s},Re=Ht("quill"),tn=new Me;Nt.uiClass="ql-ui";const vt=class vt{static debug(t){t===!0&&(t="log"),Ht.level(t)}static find(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Ri.get(t)||tn.find(t,e)}static import(t){return this.imports[t]==null&&Re.error(`Cannot import ${t}. Are you sure it was registered?`),this.imports[t]}static register(){if(typeof(arguments.length<=0?void 0:arguments[0])!="string"){const t=arguments.length<=0?void 0:arguments[0],e=!!(!(arguments.length<=1)&&arguments[1]),s="attrName"in t?t.attrName:t.blotName;typeof s=="string"?this.register(`formats/${s}`,t,e):Object.keys(t).forEach(n=>{this.register(n,t[n],e)})}else{const t=arguments.length<=0?void 0:arguments[0],e=arguments.length<=1?void 0:arguments[1],s=!!(!(arguments.length<=2)&&arguments[2]);this.imports[t]!=null&&!s&&Re.warn(`Overwriting ${t} with`,e),this.imports[t]=e,(t.startsWith("blots/")||t.startsWith("formats/"))&&e&&typeof e!="boolean"&&e.blotName!=="abstract"&&tn.register(e),typeof e.register=="function"&&e.register(tn)}}constructor(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this.options=Vl(t,e),this.container=this.options.container,this.container==null){Re.error("Invalid Quill container",t);return}this.options.debug&&vt.debug(this.options.debug);const s=this.container.innerHTML.trim();this.container.classList.add("ql-container"),this.container.innerHTML="",Ri.set(this.container,this),this.root=this.addContainer("ql-editor"),this.root.classList.add("ql-blank"),this.emitter=new L;const n=Ki.blotName,r=this.options.registry.query(n);if(!r||!("blotName"in r))throw new Error(`Cannot initialize Quill without "${n}" blot`);if(this.scroll=new r(this.options.registry,this.root,{emitter:this.emitter}),this.editor=new Ml(this.scroll),this.selection=new Ol(this.scroll,this.emitter),this.composition=new Pl(this.scroll,this.emitter),this.theme=new this.options.theme(this,this.options),this.keyboard=this.theme.addModule("keyboard"),this.clipboard=this.theme.addModule("clipboard"),this.history=this.theme.addModule("history"),this.uploader=this.theme.addModule("uploader"),this.theme.addModule("input"),this.theme.addModule("uiNode"),this.theme.init(),this.emitter.on(L.events.EDITOR_CHANGE,o=>{o===L.events.TEXT_CHANGE&&this.root.classList.toggle("ql-blank",this.editor.isBlank())}),this.emitter.on(L.events.SCROLL_UPDATE,(o,a)=>{const c=this.selection.lastRange,[h]=this.selection.getRange(),d=c&&h?{oldRange:c,newRange:h}:void 0;yt.call(this,()=>this.editor.update(null,a,d),o)}),this.emitter.on(L.events.SCROLL_EMBED_UPDATE,(o,a)=>{const c=this.selection.lastRange,[h]=this.selection.getRange(),d=c&&h?{oldRange:c,newRange:h}:void 0;yt.call(this,()=>{const g=new S().retain(o.offset(this)).retain({[o.statics.blotName]:a});return this.editor.update(g,[],d)},vt.sources.USER)}),s){const o=this.clipboard.convert({html:`${s}<p><br></p>`,text:` `});this.setContents(o)}this.history.clear(),this.options.placeholder&&this.root.setAttribute("data-placeholder",this.options.placeholder),this.options.readOnly&&this.disable(),this.allowReadOnlyEdits=!1}addContainer(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;if(typeof t=="string"){const s=t;t=document.createElement("div"),t.classList.add(s)}return this.container.insertBefore(t,e),t}blur(){this.selection.setRange(null)}deleteText(t,e,s){return[t,e,,s]=Pt(t,e,s),yt.call(this,()=>this.editor.deleteText(t,e),s,t,-1*e)}disable(){this.enable(!1)}editReadOnly(t){this.allowReadOnlyEdits=!0;const e=t();return this.allowReadOnlyEdits=!1,e}enable(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;this.scroll.enable(t),this.container.classList.toggle("ql-disabled",!t)}focus(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.selection.focus(),t.preventScroll||this.scrollSelectionIntoView()}format(t,e){let s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:L.sources.API;return yt.call(this,()=>{const n=this.getSelection(!0);let r=new S;if(n==null)return r;if(this.scroll.query(t,q.BLOCK))r=this.editor.formatLine(n.index,n.length,{[t]:e});else{if(n.length===0)return this.selection.format(t,e),r;r=this.editor.formatText(n.index,n.length,{[t]:e})}return this.setSelection(n,L.sources.SILENT),r},s)}formatLine(t,e,s,n,r){let o;return[t,e,o,r]=Pt(t,e,s,n,r),yt.call(this,()=>this.editor.formatLine(t,e,o),r,t,0)}formatText(t,e,s,n,r){let o;return[t,e,o,r]=Pt(t,e,s,n,r),yt.call(this,()=>this.editor.formatText(t,e,o),r,t,0)}getBounds(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,s=null;if(typeof t=="number"?s=this.selection.getBounds(t,e):s=this.selection.getBounds(t.index,t.length),!s)return null;const n=this.container.getBoundingClientRect();return{bottom:s.bottom-n.top,height:s.height,left:s.left-n.left,right:s.right-n.left,top:s.top-n.top,width:s.width}}getContents(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.getLength()-t;return[t,e]=Pt(t,e),this.editor.getContents(t,e)}getFormat(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.getSelection(!0),e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return typeof t=="number"?this.editor.getFormat(t,e):this.editor.getFormat(t.index,t.length)}getIndex(t){return t.offset(this.scroll)}getLength(){return this.scroll.length()}getLeaf(t){return this.scroll.leaf(t)}getLine(t){return this.scroll.line(t)}getLines(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Number.MAX_VALUE;return typeof t!="number"?this.scroll.lines(t.index,t.length):this.scroll.lines(t,e)}getModule(t){return this.theme.modules[t]}getSelection(){return(arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1)&&this.focus(),this.update(),this.selection.getRange()[0]}getSemanticHTML(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,e=arguments.length>1?arguments[1]:void 0;return typeof t=="number"&&(e=e??this.getLength()-t),[t,e]=Pt(t,e),this.editor.getHTML(t,e)}getText(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,e=arguments.length>1?arguments[1]:void 0;return typeof t=="number"&&(e=e??this.getLength()-t),[t,e]=Pt(t,e),this.editor.getText(t,e)}hasFocus(){return this.selection.hasFocus()}insertEmbed(t,e,s){let n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:vt.sources.API;return yt.call(this,()=>this.editor.insertEmbed(t,e,s),n,t)}insertText(t,e,s,n,r){let o;return[t,,o,r]=Pt(t,0,s,n,r),yt.call(this,()=>this.editor.insertText(t,e,o),r,t,e.length)}isEnabled(){return this.scroll.isEnabled()}off(){return this.emitter.off(...arguments)}on(){return this.emitter.on(...arguments)}once(){return this.emitter.once(...arguments)}removeFormat(t,e,s){return[t,e,,s]=Pt(t,e,s),yt.call(this,()=>this.editor.removeFormat(t,e),s,t)}scrollRectIntoView(t){Hl(this.root,t)}scrollIntoView(){console.warn("Quill#scrollIntoView() has been deprecated and will be removed in the near future. Please use Quill#scrollSelectionIntoView() instead."),this.scrollSelectionIntoView()}scrollSelectionIntoView(){const t=this.selection.lastRange,e=t&&this.selection.getBounds(t.index,t.length);e&&this.scrollRectIntoView(e)}setContents(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:L.sources.API;return yt.call(this,()=>{t=new S(t);const s=this.getLength(),n=this.editor.deleteText(0,s),r=this.editor.insertContents(0,t),o=this.editor.deleteText(this.getLength()-1,1);return n.compose(r).compose(o)},e)}setSelection(t,e,s){t==null?this.selection.setRange(null,e||vt.sources.API):([t,e,,s]=Pt(t,e,s),this.selection.setRange(new ce(Math.max(0,t),e),s),s!==L.sources.SILENT&&this.scrollSelectionIntoView())}setText(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:L.sources.API;const s=new S().insert(t);return this.setContents(s,e)}update(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:L.sources.USER;const e=this.scroll.update(t);return this.selection.update(t),e}updateContents(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:L.sources.API;return yt.call(this,()=>(t=new S(t),this.editor.applyDelta(t)),e,!0)}};w(vt,"DEFAULTS",{bounds:null,modules:{clipboard:!0,keyboard:!0,history:!0,uploader:!0},placeholder:"",readOnly:!1,registry:tn,theme:"default"}),w(vt,"events",L.events),w(vt,"sources",L.sources),w(vt,"version","2.0.2"),w(vt,"imports",{delta:S,parchment:gl,"core/module":wt,"core/theme":De});let y=vt;function Cr(i){return typeof i=="string"?document.querySelector(i):i}function Ni(i){return Object.entries(i??{}).reduce((t,e)=>{let[s,n]=e;return{...t,[s]:n===!0?{}:n}},{})}function Sr(i){return Object.fromEntries(Object.entries(i).filter(t=>t[1]!==void 0))}function Vl(i,t){const e=Cr(i);if(!e)throw new Error("Invalid Quill container");const n=!t.theme||t.theme===y.DEFAULTS.theme?De:y.import(`themes/${t.theme}`);if(!n)throw new Error(`Invalid theme ${t.theme}. Did you register it?`);const{modules:r,...o}=y.DEFAULTS,{modules:a,...c}=n.DEFAULTS;let h=Ni(t.modules);h!=null&&h.toolbar&&h.toolbar.constructor!==Object&&(h={...h,toolbar:{container:h.toolbar}});const d=Xt({},Ni(r),Ni(a),h),g={...o,...Sr(c),...Sr(t)};let p=t.registry;return p?t.formats&&Re.warn('Ignoring "formats" option because "registry" is specified'):p=t.formats?zl(t.formats,g.registry,Re):g.registry,{...g,registry:p,container:e,theme:n,modules:Object.entries(d).reduce((m,b)=>{let[E,N]=b;if(!N)return m;const x=y.import(`modules/${E}`);return x==null?(Re.error(`Cannot load ${E} module. Are you sure you registered it?`),m):{...m,[E]:Xt({},x.DEFAULTS||{},N)}},{}),bounds:Cr(g.bounds)}}function yt(i,t,e,s){if(!this.isEnabled()&&t===L.sources.USER&&!this.allowReadOnlyEdits)return new S;let n=e==null?null:this.getSelection();const r=this.editor.delta,o=i();if(n!=null&&(e===!0&&(e=n.index),s==null?n=qr(n,o,t):s!==0&&(n=qr(n,e,s,t)),this.setSelection(n,L.sources.SILENT)),o.length()>0){const a=[L.events.TEXT_CHANGE,o,r,t];this.emitter.emit(L.events.EDITOR_CHANGE,...a),t!==L.sources.SILENT&&this.emitter.emit(...a)}return o}function Pt(i,t,e,s,n){let r={};return typeof i.index=="number"&&typeof i.length=="number"?typeof t!="number"?(n=s,s=e,e=t,t=i.length,i=i.index):(t=i.length,i=i.index):typeof t!="number"&&(n=s,s=e,e=t,t=0),typeof e=="object"?(r=e,n=s):typeof e=="string"&&(s!=null?r[e]=s:n=e),n=n||L.sources.API,[i,t,r,n]}function qr(i,t,e,s){const n=typeof e=="number"?e:0;if(i==null)return null;let r,o;return t&&typeof t.transformPosition=="function"?[r,o]=[i.index,i.index+i.length].map(a=>t.transformPosition(a,s!==L.sources.USER)):[r,o]=[i.index,i.index+i.length].map(a=>a<t||a===t&&s===L.sources.USER?a:n>=0?a+n:Math.max(t,a+n)),new ce(r,o-r)}class ue extends pn{}function kr(i){return i instanceof G||i instanceof dt}function _r(i){return typeof i.updateContent=="function"}class _e extends Ki{constructor(t,e,s){let{emitter:n}=s;super(t,e),this.emitter=n,this.batch=!1,this.optimize(),this.enable(),this.domNode.addEventListener("dragstart",r=>this.handleDragStart(r))}batchStart(){Array.isArray(this.batch)||(this.batch=[])}batchEnd(){if(!this.batch)return;const t=this.batch;this.batch=!1,this.update(t)}emitMount(t){this.emitter.emit(L.events.SCROLL_BLOT_MOUNT,t)}emitUnmount(t){this.emitter.emit(L.events.SCROLL_BLOT_UNMOUNT,t)}emitEmbedUpdate(t,e){this.emitter.emit(L.events.SCROLL_EMBED_UPDATE,t,e)}deleteAt(t,e){const[s,n]=this.line(t),[r]=this.line(t+e);if(super.deleteAt(t,e),r!=null&&s!==r&&n>0){if(s instanceof dt||r instanceof dt){this.optimize();return}const o=r.children.head instanceof Tt?null:r.children.head;s.moveChildren(r,o),s.remove()}this.optimize()}enable(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;this.domNode.setAttribute("contenteditable",t?"true":"false")}formatAt(t,e,s,n){super.formatAt(t,e,s,n),this.optimize()}insertAt(t,e,s){if(t>=this.length())if(s==null||this.scroll.query(e,q.BLOCK)==null){const n=this.scroll.create(this.statics.defaultChild.blotName);this.appendChild(n),s==null&&e.endsWith(` `)?n.insertAt(0,e.slice(0,-1),s):n.insertAt(0,e,s)}else{const n=this.scroll.create(e,s);this.appendChild(n)}else super.insertAt(t,e,s);this.optimize()}insertBefore(t,e){if(t.statics.scope===q.INLINE_BLOT){const s=this.scroll.create(this.statics.defaultChild.blotName);s.appendChild(t),super.insertBefore(s,e)}else super.insertBefore(t,e)}insertContents(t,e){const s=this.deltaToRenderBlocks(e.concat(new S().insert(` `))),n=s.pop();if(n==null)return;this.batchStart();const r=s.shift();if(r){const c=r.type==="block"&&(r.delta.length()===0||!this.descendant(dt,t)[0]&&t<this.length()),h=r.type==="block"?r.delta:new S().insert({[r.key]:r.value});xi(this,t,h);const d=r.type==="block"?1:0,g=t+h.length()+d;c&&this.insertAt(g-1,` `);const p=ut(this.line(t)[0]),m=ft.AttributeMap.diff(p,r.attributes)||{};Object.keys(m).forEach(b=>{this.formatAt(g-1,1,b,m[b])}),t=g}let[o,a]=this.children.find(t);if(s.length&&(o&&(o=o.split(a),a=0),s.forEach(c=>{if(c.type==="block"){const h=this.createBlock(c.attributes,o||void 0);xi(h,0,c.delta)}else{const h=this.create(c.key,c.value);this.insertBefore(h,o||void 0),Object.keys(c.attributes).forEach(d=>{h.format(d,c.attributes[d])})}})),n.type==="block"&&n.delta.length()){const c=o?o.offset(o.scroll)+a:this.length();xi(this,c,n.delta)}this.batchEnd(),this.optimize()}isEnabled(){return this.domNode.getAttribute("contenteditable")==="true"}leaf(t){const e=this.path(t).pop();if(!e)return[null,-1];const[s,n]=e;return s instanceof Q?[s,n]:[null,-1]}line(t){return t===this.length()?this.line(t-1):this.descendant(kr,t)}lines(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Number.MAX_VALUE;const s=(n,r,o)=>{let a=[],c=o;return n.children.forEachAt(r,o,(h,d,g)=>{kr(h)?a.push(h):h instanceof pn&&(a=a.concat(s(h,d,c))),c-=g}),a};return s(this,t,e)}optimize(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.batch||(super.optimize(t,e),t.length>0&&this.emitter.emit(L.events.SCROLL_OPTIMIZE,t,e))}path(t){return super.path(t).slice(1)}remove(){}update(t){if(this.batch){Array.isArray(t)&&(this.batch=this.batch.concat(t));return}let e=L.sources.USER;typeof t=="string"&&(e=t),Array.isArray(t)||(t=this.observer.takeRecords()),t=t.filter(s=>{let{target:n}=s;const r=this.find(n,!0);return r&&!_r(r)}),t.length>0&&this.emitter.emit(L.events.SCROLL_BEFORE_UPDATE,e,t),super.update(t.concat([])),t.length>0&&this.emitter.emit(L.events.SCROLL_UPDATE,e,t)}updateEmbedAt(t,e,s){const[n]=this.descendant(r=>r instanceof dt,t);n&&n.statics.blotName===e&&_r(n)&&n.updateContent(s)}handleDragStart(t){t.preventDefault()}deltaToRenderBlocks(t){const e=[];let s=new S;return t.forEach(n=>{const r=n==null?void 0:n.insert;if(r)if(typeof r=="string"){const o=r.split(` `);o.slice(0,-1).forEach(c=>{s.insert(c,n.attributes),e.push({type:"block",delta:s,attributes:n.attributes??{}}),s=new S});const a=o[o.length-1];a&&s.insert(a,n.attributes)}else{const o=Object.keys(r)[0];if(!o)return;this.query(o,q.INLINE)?s.push(n):(s.length()&&e.push({type:"block",delta:s,attributes:{}}),s=new S,e.push({type:"blockEmbed",key:o,value:r[o],attributes:n.attributes??{}}))}}),s.length()&&e.push({type:"block",delta:s,attributes:{}}),e}createBlock(t,e){let s;const n={};Object.entries(t).forEach(a=>{let[c,h]=a;this.query(c,q.BLOCK&q.BLOT)!=null?s=c:n[c]=h});const r=this.create(s||this.statics.defaultChild.blotName,s?t[s]:void 0);this.insertBefore(r,e||void 0);const o=r.length();return Object.entries(n).forEach(a=>{let[c,h]=a;r.formatAt(0,o,c,h)}),r}}w(_e,"blotName","scroll"),w(_e,"className","ql-editor"),w(_e,"tagName","DIV"),w(_e,"defaultChild",G),w(_e,"allowedChildren",[G,dt,ue]);function xi(i,t,e){e.reduce((s,n)=>{const r=ft.Op.length(n);let o=n.attributes||{};if(n.insert!=null){if(typeof n.insert=="string"){const a=n.insert;i.insertAt(s,a);const[c]=i.descendant(Q,s),h=ut(c);o=ft.AttributeMap.diff(h,o)||{}}else if(typeof n.insert=="object"){const a=Object.keys(n.insert)[0];if(a==null)return s;if(i.insertAt(s,a,n.insert[a]),i.scroll.query(a,q.INLINE)!=null){const[h]=i.descendant(Q,s),d=ut(h);o=ft.AttributeMap.diff(d,o)||{}}}}return Object.keys(o).forEach(a=>{i.formatAt(s,r,a,o[a])}),s+r},t)}const Qi={scope:q.BLOCK,whitelist:["right","center","justify"]},Kl=new It("align","align",Qi),ho=new At("align","ql-align",Qi),fo=new Qt("align","text-align",Qi);class po extends Qt{value(t){let e=super.value(t);return e.startsWith("rgb(")?(e=e.replace(/^[^\d]+/,"").replace(/[^\d]+$/,""),`#${e.split(",").map(n=>`00${parseInt(n,10).toString(16)}`.slice(-2)).join("")}`):e}}const Gl=new At("color","ql-color",{scope:q.INLINE}),Ji=new po("color","color",{scope:q.INLINE}),Wl=new At("background","ql-bg",{scope:q.INLINE}),tr=new po("background","background-color",{scope:q.INLINE});class he extends ue{static create(t){const e=super.create(t);return e.setAttribute("spellcheck","false"),e}code(t,e){return this.children.map(s=>s.length()<=1?"":s.domNode.innerText).join(` `).slice(t,t+e)}html(t,e){return`<pre> ${yn(this.code(t,e))} </pre>`}}class J extends G{static register(){y.register(he)}}w(J,"TAB"," ");class er extends Jt{}er.blotName="code";er.tagName="CODE";J.blotName="code-block";J.className="ql-code-block";J.tagName="DIV";he.blotName="code-block-container";he.className="ql-code-block-container";he.tagName="DIV";he.allowedChildren=[J];J.allowedChildren=[xt,Tt,Be];J.requiredContainer=he;const sr={scope:q.BLOCK,whitelist:["rtl"]},mo=new It("direction","dir",sr),go=new At("direction","ql-direction",sr),bo=new Qt("direction","direction",sr),yo={scope:q.INLINE,whitelist:["serif","monospace"]},vo=new At("font","ql-font",yo);class Zl extends Qt{value(t){return super.value(t).replace(/["']/g,"")}}const Eo=new Zl("font","font-family",yo),No=new At("size","ql-size",{scope:q.INLINE,whitelist:["small","large","huge"]}),xo=new Qt("size","font-size",{scope:q.INLINE,whitelist:["10px","18px","32px"]}),Xl=Ht("quill:keyboard"),Yl=/Mac/i.test(navigator.platform)?"metaKey":"ctrlKey";class vn extends wt{static match(t,e){return["altKey","ctrlKey","metaKey","shiftKey"].some(s=>!!e[s]!==t[s]&&e[s]!==null)?!1:e.key===t.key||e.key===t.which}constructor(t,e){super(t,e),this.bindings={},Object.keys(this.options.bindings).forEach(s=>{this.options.bindings[s]&&this.addBinding(this.options.bindings[s])}),this.addBinding({key:"Enter",shiftKey:null},this.handleEnter),this.addBinding({key:"Enter",metaKey:null,ctrlKey:null,altKey:null},()=>{}),/Firefox/i.test(navigator.userAgent)?(this.addBinding({key:"Backspace"},{collapsed:!0},this.handleBackspace),this.addBinding({key:"Delete"},{collapsed:!0},this.handleDelete)):(this.addBinding({key:"Backspace"},{collapsed:!0,prefix:/^.?$/},this.handleBackspace),this.addBinding({key:"Delete"},{collapsed:!0,suffix:/^.?$/},this.handleDelete)),this.addBinding({key:"Backspace"},{collapsed:!1},this.handleDeleteRange),this.addBinding({key:"Delete"},{collapsed:!1},this.handleDeleteRange),this.addBinding({key:"Backspace",altKey:null,ctrlKey:null,metaKey:null,shiftKey:null},{collapsed:!0,offset:0},this.handleBackspace),this.listen()}addBinding(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const n=Jl(t);if(n==null){Xl.warn("Attempted to add invalid keyboard binding",n);return}typeof e=="function"&&(e={handler:e}),typeof s=="function"&&(s={handler:s}),(Array.isArray(n.key)?n.key:[n.key]).forEach(o=>{const a={...n,key:o,...e,...s};this.bindings[a.key]=this.bindings[a.key]||[],this.bindings[a.key].push(a)})}listen(){this.quill.root.addEventListener("keydown",t=>{if(t.defaultPrevented||t.isComposing||t.keyCode===229&&(t.key==="Enter"||t.key==="Backspace"))return;const n=(this.bindings[t.key]||[]).concat(this.bindings[t.which]||[]).filter(x=>vn.match(t,x));if(n.length===0)return;const r=y.find(t.target,!0);if(r&&r.scroll!==this.quill.scroll)return;const o=this.quill.getSelection();if(o==null||!this.quill.hasFocus())return;const[a,c]=this.quill.getLine(o.index),[h,d]=this.quill.getLeaf(o.index),[g,p]=o.length===0?[h,d]:this.quill.getLeaf(o.index+o.length),m=h instanceof an?h.value().slice(0,d):"",b=g instanceof an?g.value().slice(p):"",E={collapsed:o.length===0,empty:o.length===0&&a.length()<=1,format:this.quill.getFormat(o),line:a,offset:c,prefix:m,suffix:b,event:t};n.some(x=>{if(x.collapsed!=null&&x.collapsed!==E.collapsed||x.empty!=null&&x.empty!==E.empty||x.offset!=null&&x.offset!==E.offset)return!1;if(Array.isArray(x.format)){if(x.format.every(A=>E.format[A]==null))return!1}else if(typeof x.format=="object"&&!Object.keys(x.format).every(A=>x.format[A]===!0?E.format[A]!=null:x.format[A]===!1?E.format[A]==null:zi(x.format[A],E.format[A])))return!1;return x.prefix!=null&&!x.prefix.test(E.prefix)||x.suffix!=null&&!x.suffix.test(E.suffix)?!1:x.handler.call(this,o,E,x)!==!0})&&t.preventDefault()})}handleBackspace(t,e){const s=/[\uD800-\uDBFF][\uDC00-\uDFFF]$/.test(e.prefix)?2:1;if(t.index===0||this.quill.getLength()<=1)return;let n={};const[r]=this.quill.getLine(t.index);let o=new S().retain(t.index-s).delete(s);if(e.offset===0){const[a]=this.quill.getLine(t.index-1);if(a&&!(a.statics.blotName==="block"&&a.length()<=1)){const h=r.formats(),d=this.quill.getFormat(t.index-1,1);if(n=ft.AttributeMap.diff(h,d)||{},Object.keys(n).length>0){const g=new S().retain(t.index+r.length()-2).retain(1,n);o=o.compose(g)}}}this.quill.updateContents(o,y.sources.USER),this.quill.focus()}handleDelete(t,e){const s=/^[\uD800-\uDBFF][\uDC00-\uDFFF]/.test(e.suffix)?2:1;if(t.index>=this.quill.getLength()-s)return;let n={};const[r]=this.quill.getLine(t.index);let o=new S().retain(t.index).delete(s);if(e.offset>=r.length()-1){const[a]=this.quill.getLine(t.index+1);if(a){const c=r.formats(),h=this.quill.getFormat(t.index,1);n=ft.AttributeMap.diff(c,h)||{},Object.keys(n).length>0&&(o=o.retain(a.length()-1).retain(1,n))}}this.quill.updateContents(o,y.sources.USER),this.quill.focus()}handleDeleteRange(t){nr({range:t,quill:this.quill}),this.quill.focus()}handleEnter(t,e){const s=Object.keys(e.format).reduce((r,o)=>(this.quill.scroll.query(o,q.BLOCK)&&!Array.isArray(e.format[o])&&(r[o]=e.format[o]),r),{}),n=new S().retain(t.index).delete(t.length).insert(` `,s);this.quill.updateContents(n,y.sources.USER),this.quill.setSelection(t.index+1,y.sources.SILENT),this.quill.focus()}}const Ql={bindings:{bold:Ai("bold"),italic:Ai("italic"),underline:Ai("underline"),indent:{key:"Tab",format:["blockquote","indent","list"],handler(i,t){return t.collapsed&&t.offset!==0?!0:(this.quill.format("indent","+1",y.sources.USER),!1)}},outdent:{key:"Tab",shiftKey:!0,format:["blockquote","indent","list"],handler(i,t){return t.collapsed&&t.offset!==0?!0:(this.quill.format("indent","-1",y.sources.USER),!1)}},"outdent backspace":{key:"Backspace",collapsed:!0,shiftKey:null,metaKey:null,ctrlKey:null,altKey:null,format:["indent","list"],offset:0,handler(i,t){t.format.indent!=null?this.quill.format("indent","-1",y.sources.USER):t.format.list!=null&&this.quill.format("list",!1,y.sources.USER)}},"indent code-block":Ir(!0),"outdent code-block":Ir(!1),"remove tab":{key:"Tab",shiftKey:!0,collapsed:!0,prefix:/\t$/,handler(i){this.quill.deleteText(i.index-1,1,y.sources.USER)}},tab:{key:"Tab",handler(i,t){if(t.format.table)return!0;this.quill.history.cutoff();const e=new S().retain(i.index).delete(i.length).insert(" ");return this.quill.updateContents(e,y.sources.USER),this.quill.history.cutoff(),this.quill.setSelection(i.index+1,y.sources.SILENT),!1}},"blockquote empty enter":{key:"Enter",collapsed:!0,format:["blockquote"],empty:!0,handler(){this.quill.format("blockquote",!1,y.sources.USER)}},"list empty enter":{key:"Enter",collapsed:!0,format:["list"],empty:!0,handler(i,t){const e={list:!1};t.format.indent&&(e.indent=!1),this.quill.formatLine(i.index,i.length,e,y.sources.USER)}},"checklist enter":{key:"Enter",collapsed:!0,format:{list:"checked"},handler(i){const[t,e]=this.quill.getLine(i.index),s={...t.formats(),list:"checked"},n=new S().retain(i.index).insert(` `,s).retain(t.length()-e-1).retain(1,{list:"unchecked"});this.quill.updateContents(n,y.sources.USER),this.quill.setSelection(i.index+1,y.sources.SILENT),this.quill.scrollSelectionIntoView()}},"header enter":{key:"Enter",collapsed:!0,format:["header"],suffix:/^$/,handler(i,t){const[e,s]=this.quill.getLine(i.index),n=new S().retain(i.index).insert(` `,t.format).retain(e.length()-s-1).retain(1,{header:null});this.quill.updateContents(n,y.sources.USER),this.quill.setSelection(i.index+1,y.sources.SILENT),this.quill.scrollSelectionIntoView()}},"table backspace":{key:"Backspace",format:["table"],collapsed:!0,offset:0,handler(){}},"table delete":{key:"Delete",format:["table"],collapsed:!0,suffix:/^$/,handler(){}},"table enter":{key:"Enter",shiftKey:null,format:["table"],handler(i){const t=this.quill.getModule("table");if(t){const[e,s,n,r]=t.getTable(i),o=ta(e,s,n,r);if(o==null)return;let a=e.offset();if(o<0){const c=new S().retain(a).insert(` `);this.quill.updateContents(c,y.sources.USER),this.quill.setSelection(i.index+1,i.length,y.sources.SILENT)}else if(o>0){a+=e.length();const c=new S().retain(a).insert(` `);this.quill.updateContents(c,y.sources.USER),this.quill.setSelection(a,y.sources.USER)}}}},"table tab":{key:"Tab",shiftKey:null,format:["table"],handler(i,t){const{event:e,line:s}=t,n=s.offset(this.quill.scroll);e.shiftKey?this.quill.setSelection(n-1,y.sources.USER):this.quill.setSelection(n+s.length(),y.sources.USER)}},"list autofill":{key:" ",shiftKey:null,collapsed:!0,format:{"code-block":!1,blockquote:!1,table:!1},prefix:/^\s*?(\d+\.|-|\*|\[ ?\]|\[x\])$/,handler(i,t){if(this.quill.scroll.query("list")==null)return!0;const{length:e}=t.prefix,[s,n]=this.quill.getLine(i.index);if(n>e)return!0;let r;switch(t.prefix.trim()){case"[]":case"[ ]":r="unchecked";break;case"[x]":r="checked";break;case"-":case"*":r="bullet";break;default:r="ordered"}this.quill.insertText(i.index," ",y.sources.USER),this.quill.history.cutoff();const o=new S().retain(i.index-n).delete(e+1).retain(s.length()-2-n).retain(1,{list:r});return this.quill.updateContents(o,y.sources.USER),this.quill.history.cutoff(),this.quill.setSelection(i.index-e,y.sources.SILENT),!1}},"code exit":{key:"Enter",collapsed:!0,format:["code-block"],prefix:/^$/,suffix:/^\s*$/,handler(i){const[t,e]=this.quill.getLine(i.index);let s=2,n=t;for(;n!=null&&n.length()<=1&&n.formats()["code-block"];)if(n=n.prev,s-=1,s<=0){const r=new S().retain(i.index+t.length()-e-2).retain(1,{"code-block":null}).delete(1);return this.quill.updateContents(r,y.sources.USER),this.quill.setSelection(i.index-1,y.sources.SILENT),!1}return!0}},"embed left":en("ArrowLeft",!1),"embed left shift":en("ArrowLeft",!0),"embed right":en("ArrowRight",!1),"embed right shift":en("ArrowRight",!0),"table down":Or(!1),"table up":Or(!0)}};vn.DEFAULTS=Ql;function Ir(i){return{key:"Tab",shiftKey:!i,format:{"code-block":!0},handler(t,e){let{event:s}=e;const n=this.quill.scroll.query("code-block"),{TAB:r}=n;if(t.length===0&&!s.shiftKey){this.quill.insertText(t.index,r,y.sources.USER),this.quill.setSelection(t.index+r.length,y.sources.SILENT);return}const o=t.length===0?this.quill.getLines(t.index,1):this.quill.getLines(t);let{index:a,length:c}=t;o.forEach((h,d)=>{i?(h.insertAt(0,r),d===0?a+=r.length:c+=r.length):h.domNode.textContent.startsWith(r)&&(h.deleteAt(0,r.length),d===0?a-=r.length:c-=r.length)}),this.quill.update(y.sources.USER),this.quill.setSelection(a,c,y.sources.SILENT)}}}function en(i,t){return{key:i,shiftKey:t,altKey:null,[i==="ArrowLeft"?"prefix":"suffix"]:/^$/,handler(s){let{index:n}=s;i==="ArrowRight"&&(n+=s.length+1);const[r]=this.quill.getLeaf(n);return r instanceof lt?(i==="ArrowLeft"?t?this.quill.setSelection(s.index-1,s.length+1,y.sources.USER):this.quill.setSelection(s.index-1,y.sources.USER):t?this.quill.setSelection(s.index,s.length+1,y.sources.USER):this.quill.setSelection(s.index+s.length+1,y.sources.USER),!1):!0}}}function Ai(i){return{key:i[0],shortKey:!0,handler(t,e){this.quill.format(i,!e.format[i],y.sources.USER)}}}function Or(i){return{key:i?"ArrowUp":"ArrowDown",collapsed:!0,format:["table"],handler(t,e){const s=i?"prev":"next",n=e.line,r=n.parent[s];if(r!=null){if(r.statics.blotName==="table-row"){let o=r.children.head,a=n;for(;a.prev!=null;)a=a.prev,o=o.next;const c=o.offset(this.quill.scroll)+Math.min(e.offset,o.length()-1);this.quill.setSelection(c,0,y.sources.USER)}}else{const o=n.table()[s];o!=null&&(i?this.quill.setSelection(o.offset(this.quill.scroll)+o.length()-1,0,y.sources.USER):this.quill.setSelection(o.offset(this.quill.scroll),0,y.sources.USER))}return!1}}}function Jl(i){if(typeof i=="string"||typeof i=="number")i={key:i};else if(typeof i=="object")i=Ie(i);else return null;return i.shortKey&&(i[Yl]=i.shortKey,delete i.shortKey),i}function nr(i){let{quill:t,range:e}=i;const s=t.getLines(e);let n={};if(s.length>1){const r=s[0].formats(),o=s[s.length-1].formats();n=ft.AttributeMap.diff(o,r)||{}}t.deleteText(e,y.sources.USER),Object.keys(n).length>0&&t.formatLine(e.index,1,n,y.sources.USER),t.setSelection(e.index,y.sources.SILENT)}function ta(i,t,e,s){return t.prev==null&&t.next==null?e.prev==null&&e.next==null?s===0?-1:1:e.prev==null?-1:1:t.prev==null?-1:t.next==null?1:null}const ea=/font-weight:\s*normal/,sa=["P","OL","UL"],Rr=i=>i&&sa.includes(i.tagName),na=i=>{Array.from(i.querySelectorAll("br")).filter(t=>Rr(t.previousElementSibling)&&Rr(t.nextElementSibling)).forEach(t=>{var e;(e=t.parentNode)==null||e.removeChild(t)})},ia=i=>{Array.from(i.querySelectorAll('b[style*="font-weight"]')).filter(t=>{var e;return(e=t.getAttribute("style"))==null?void 0:e.match(ea)}).forEach(t=>{var s;const e=i.createDocumentFragment();e.append(...t.childNodes),(s=t.parentNode)==null||s.replaceChild(e,t)})};function ra(i){i.querySelector('[id^="docs-internal-guid-"]')&&(ia(i),na(i))}const oa=/\bmso-list:[^;]*ignore/i,la=/\bmso-list:[^;]*\bl(\d+)/i,aa=/\bmso-list:[^;]*\blevel(\d+)/i,ca=(i,t)=>{const e=i.getAttribute("style"),s=e==null?void 0:e.match(la);if(!s)return null;const n=Number(s[1]),r=e==null?void 0:e.match(aa),o=r?Number(r[1]):1,a=new RegExp(`@list l${n}:level${o}\\s*\\{[^\\}]*mso-level-number-format:\\s*([\\w-]+)`,"i"),c=t.match(a),h=c&&c[1]==="bullet"?"bullet":"ordered";return{id:n,indent:o,type:h,element:i}},ua=i=>{var o,a;const t=Array.from(i.querySelectorAll("[style*=mso-list]")),e=[],s=[];t.forEach(c=>{(c.getAttribute("style")||"").match(oa)?e.push(c):s.push(c)}),e.forEach(c=>{var h;return(h=c.parentNode)==null?void 0:h.removeChild(c)});const n=i.documentElement.innerHTML,r=s.map(c=>ca(c,n)).filter(c=>c);for(;r.length;){const c=[];let h=r.shift();for(;h;)c.push(h),h=r.length&&((o=r[0])==null?void 0:o.element)===h.element.nextElementSibling&&r[0].id===h.id?r.shift():null;const d=document.createElement("ul");c.forEach(m=>{const b=document.createElement("li");b.setAttribute("data-list",m.type),m.indent>1&&b.setAttribute("class",`ql-indent-${m.indent-1}`),b.innerHTML=m.element.innerHTML,d.appendChild(b)});const g=(a=c[0])==null?void 0:a.element,{parentNode:p}=g??{};g&&(p==null||p.replaceChild(d,g)),c.slice(1).forEach(m=>{let{element:b}=m;p==null||p.removeChild(b)})}};function ha(i){i.documentElement.getAttribute("xmlns:w")==="urn:schemas-microsoft-com:office:word"&&ua(i)}const da=[ha,ra],fa=i=>{i.documentElement&&da.forEach(t=>{t(i)})},pa=Ht("quill:clipboard"),ma=[[Node.TEXT_NODE,Sa],[Node.TEXT_NODE,Br],["br",Na],[Node.ELEMENT_NODE,Br],[Node.ELEMENT_NODE,Ea],[Node.ELEMENT_NODE,va],[Node.ELEMENT_NODE,La],["li",Ta],["ol, ul",wa],["pre",xa],["tr",Ca],["b",Ti("bold")],["i",Ti("italic")],["strike",Ti("strike")],["style",Aa]],ga=[Kl,mo].reduce((i,t)=>(i[t.keyName]=t,i),{}),Mr=[fo,tr,Ji,bo,Eo,xo].reduce((i,t)=>(i[t.keyName]=t,i),{});var Li;let ba=(Li=class extends wt{constructor(t,e){super(t,e),this.quill.root.addEventListener("copy",s=>this.onCaptureCopy(s,!1)),this.quill.root.addEventListener("cut",s=>this.onCaptureCopy(s,!0)),this.quill.root.addEventListener("paste",this.onCapturePaste.bind(this)),this.matchers=[],ma.concat(this.options.matchers??[]).forEach(s=>{let[n,r]=s;this.addMatcher(n,r)})}addMatcher(t,e){this.matchers.push([t,e])}convert(t){let{html:e,text:s}=t,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(n[J.blotName])return new S().insert(s||"",{[J.blotName]:n[J.blotName]});if(!e)return new S().insert(s||"",n);const r=this.convertHTML(e);return bs(r,` `)&&(r.ops[r.ops.length-1].attributes==null||n.table)?r.compose(new S().retain(r.length()-1).delete(1)):r}normalizeHTML(t){fa(t)}convertHTML(t){const e=new DOMParser().parseFromString(t,"text/html");this.normalizeHTML(e);const s=e.body,n=new WeakMap,[r,o]=this.prepareMatching(s,n);return ir(this.quill.scroll,s,r,o,n)}dangerouslyPasteHTML(t,e){let s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:y.sources.API;if(typeof t=="string"){const n=this.convert({html:t,text:""});this.quill.setContents(n,e),this.quill.setSelection(0,y.sources.SILENT)}else{const n=this.convert({html:e,text:""});this.quill.updateContents(new S().retain(t).concat(n),s),this.quill.setSelection(t+n.length(),y.sources.SILENT)}}onCaptureCopy(t){var o,a;let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(t.defaultPrevented)return;t.preventDefault();const[s]=this.quill.selection.getRange();if(s==null)return;const{html:n,text:r}=this.onCopy(s,e);(o=t.clipboardData)==null||o.setData("text/plain",r),(a=t.clipboardData)==null||a.setData("text/html",n),e&&nr({range:s,quill:this.quill})}normalizeURIList(t){return t.split(/\r?\n/).filter(e=>e[0]!=="#").join(` `)}onCapturePaste(t){var o,a,c,h,d;if(t.defaultPrevented||!this.quill.isEnabled())return;t.preventDefault();const e=this.quill.getSelection(!0);if(e==null)return;const s=(o=t.clipboardData)==null?void 0:o.getData("text/html");let n=(a=t.clipboardData)==null?void 0:a.getData("text/plain");if(!s&&!n){const g=(c=t.clipboardData)==null?void 0:c.getData("text/uri-list");g&&(n=this.normalizeURIList(g))}const r=Array.from(((h=t.clipboardData)==null?void 0:h.files)||[]);if(!s&&r.length>0){this.quill.uploader.upload(e,r);return}if(s&&r.length>0){const g=new DOMParser().parseFromString(s,"text/html");if(g.body.childElementCount===1&&((d=g.body.firstElementChild)==null?void 0:d.tagName)==="IMG"){this.quill.uploader.upload(e,r);return}}this.onPaste(e,{html:s,text:n})}onCopy(t){const e=this.quill.getText(t);return{html:this.quill.getSemanticHTML(t),text:e}}onPaste(t,e){let{text:s,html:n}=e;const r=this.quill.getFormat(t.index),o=this.convert({text:s,html:n},r);pa.log("onPaste",o,{text:s,html:n});const a=new S().retain(t.index).delete(t.length).concat(o);this.quill.updateContents(a,y.sources.USER),this.quill.setSelection(a.length()-t.length,y.sources.SILENT),this.quill.scrollSelectionIntoView()}prepareMatching(t,e){const s=[],n=[];return this.matchers.forEach(r=>{const[o,a]=r;switch(o){case Node.TEXT_NODE:n.push(a);break;case Node.ELEMENT_NODE:s.push(a);break;default:Array.from(t.querySelectorAll(o)).forEach(c=>{if(e.has(c)){const h=e.get(c);h==null||h.push(a)}else e.set(c,[a])});break}}),[s,n]}},w(Li,"DEFAULTS",{matchers:[]}),Li);function de(i,t,e,s){return s.query(t)?i.reduce((n,r)=>{if(!r.insert)return n;if(r.attributes&&r.attributes[t])return n.push(r);const o=e?{[t]:e}:{};return n.insert(r.insert,{...o,...r.attributes})},new S):i}function bs(i,t){let e="";for(let s=i.ops.length-1;s>=0&&e.length<t.length;--s){const n=i.ops[s];if(typeof n.insert!="string")break;e=n.insert+e}return e.slice(-1*t.length)===t}function Zt(i,t){if(!(i instanceof Element))return!1;const e=t.query(i);return e&&e.prototype instanceof lt?!1:["address","article","blockquote","canvas","dd","div","dl","dt","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","iframe","li","main","nav","ol","output","p","pre","section","table","td","tr","ul","video"].includes(i.tagName.toLowerCase())}function ya(i,t){return i.previousElementSibling&&i.nextElementSibling&&!Zt(i.previousElementSibling,t)&&!Zt(i.nextElementSibling,t)}const sn=new WeakMap;function Ao(i){return i==null?!1:(sn.has(i)||(i.tagName==="PRE"?sn.set(i,!0):sn.set(i,Ao(i.parentNode))),sn.get(i))}function ir(i,t,e,s,n){return t.nodeType===t.TEXT_NODE?s.reduce((r,o)=>o(t,r,i),new S):t.nodeType===t.ELEMENT_NODE?Array.from(t.childNodes||[]).reduce((r,o)=>{let a=ir(i,o,e,s,n);return o.nodeType===t.ELEMENT_NODE&&(a=e.reduce((c,h)=>h(o,c,i),a),a=(n.get(o)||[]).reduce((c,h)=>h(o,c,i),a)),r.concat(a)},new S):new S}function Ti(i){return(t,e,s)=>de(e,i,!0,s)}function va(i,t,e){const s=It.keys(i),n=At.keys(i),r=Qt.keys(i),o={};return s.concat(n).concat(r).forEach(a=>{let c=e.query(a,q.ATTRIBUTE);c!=null&&(o[c.attrName]=c.value(i),o[c.attrName])||(c=ga[a],c!=null&&(c.attrName===a||c.keyName===a)&&(o[c.attrName]=c.value(i)||void 0),c=Mr[a],c!=null&&(c.attrName===a||c.keyName===a)&&(c=Mr[a],o[c.attrName]=c.value(i)||void 0))}),Object.entries(o).reduce((a,c)=>{let[h,d]=c;return de(a,h,d,e)},t)}function Ea(i,t,e){const s=e.query(i);if(s==null)return t;if(s.prototype instanceof lt){const n={},r=s.value(i);if(r!=null)return n[s.blotName]=r,new S().insert(n,s.formats(i,e))}else if(s.prototype instanceof ds&&!bs(t,` `)&&t.insert(` `),"blotName"in s&&"formats"in s&&typeof s.formats=="function")return de(t,s.blotName,s.formats(i,e),e);return t}function Na(i,t){return bs(t,` `)||t.insert(` `),t}function xa(i,t,e){const s=e.query("code-block"),n=s&&"formats"in s&&typeof s.formats=="function"?s.formats(i,e):!0;return de(t,"code-block",n,e)}function Aa(){return new S}function Ta(i,t,e){const s=e.query(i);if(s==null||s.blotName!=="list"||!bs(t,` `))return t;let n=-1,r=i.parentNode;for(;r!=null;)["OL","UL"].includes(r.tagName)&&(n+=1),r=r.parentNode;return n<=0?t:t.reduce((o,a)=>a.insert?a.attributes&&typeof a.attributes.indent=="number"?o.push(a):o.insert(a.insert,{indent:n,...a.attributes||{}}):o,new S)}function wa(i,t,e){const s=i;let n=s.tagName==="OL"?"ordered":"bullet";const r=s.getAttribute("data-checked");return r&&(n=r==="true"?"checked":"unchecked"),de(t,"list",n,e)}function Br(i,t,e){if(!bs(t,` `)){if(Zt(i,e)&&(i.childNodes.length>0||i instanceof HTMLParagraphElement))return t.insert(` `);if(t.length()>0&&i.nextSibling){let s=i.nextSibling;for(;s!=null;){if(Zt(s,e))return t.insert(` `);const n=e.query(s);if(n&&n.prototype instanceof dt)return t.insert(` `);s=s.firstChild}}}return t}function La(i,t,e){var r;const s={},n=i.style||{};return n.fontStyle==="italic"&&(s.italic=!0),n.textDecoration==="underline"&&(s.underline=!0),n.textDecoration==="line-through"&&(s.strike=!0),((r=n.fontWeight)!=null&&r.startsWith("bold")||parseInt(n.fontWeight,10)>=700)&&(s.bold=!0),t=Object.entries(s).reduce((o,a)=>{let[c,h]=a;return de(o,c,h,e)},t),parseFloat(n.textIndent||0)>0?new S().insert(" ").concat(t):t}function Ca(i,t,e){var n,r;const s=((n=i.parentElement)==null?void 0:n.tagName)==="TABLE"?i.parentElement:(r=i.parentElement)==null?void 0:r.parentElement;if(s!=null){const a=Array.from(s.querySelectorAll("tr")).indexOf(i)+1;return de(t,"table",a,e)}return t}function Sa(i,t,e){var n;let s=i.data;if(((n=i.parentElement)==null?void 0:n.tagName)==="O:P")return t.insert(s.trim());if(!Ao(i)){if(s.trim().length===0&&s.includes(` `)&&!ya(i,e))return t;const r=(o,a)=>{const c=a.replace(/[^\u00a0]/g,"");return c.length<1&&o?" ":c};s=s.replace(/\r\n/g," ").replace(/\n/g," "),s=s.replace(/\s\s+/g,r.bind(r,!0)),(i.previousSibling==null&&i.parentElement!=null&&Zt(i.parentElement,e)||i.previousSibling instanceof Element&&Zt(i.previousSibling,e))&&(s=s.replace(/^\s+/,r.bind(r,!1))),(i.nextSibling==null&&i.parentElement!=null&&Zt(i.parentElement,e)||i.nextSibling instanceof Element&&Zt(i.nextSibling,e))&&(s=s.replace(/\s+$/,r.bind(r,!1)))}return t.insert(s)}class To extends wt{constructor(e,s){super(e,s);w(this,"lastRecorded",0);w(this,"ignoreChange",!1);w(this,"stack",{undo:[],redo:[]});w(this,"currentRange",null);this.quill.on(y.events.EDITOR_CHANGE,(n,r,o,a)=>{n===y.events.SELECTION_CHANGE?r&&a!==y.sources.SILENT&&(this.currentRange=r):n===y.events.TEXT_CHANGE&&(this.ignoreChange||(!this.options.userOnly||a===y.sources.USER?this.record(r,o):this.transform(r)),this.currentRange=Di(this.currentRange,r))}),this.quill.keyboard.addBinding({key:"z",shortKey:!0},this.undo.bind(this)),this.quill.keyboard.addBinding({key:["z","Z"],shortKey:!0,shiftKey:!0},this.redo.bind(this)),/Win/i.test(navigator.platform)&&this.quill.keyboard.addBinding({key:"y",shortKey:!0},this.redo.bind(this)),this.quill.root.addEventListener("beforeinput",n=>{n.inputType==="historyUndo"?(this.undo(),n.preventDefault()):n.inputType==="historyRedo"&&(this.redo(),n.preventDefault())})}change(e,s){if(this.stack[e].length===0)return;const n=this.stack[e].pop();if(!n)return;const r=this.quill.getContents(),o=n.delta.invert(r);this.stack[s].push({delta:o,range:Di(n.range,o)}),this.lastRecorded=0,this.ignoreChange=!0,this.quill.updateContents(n.delta,y.sources.USER),this.ignoreChange=!1,this.restoreSelection(n)}clear(){this.stack={undo:[],redo:[]}}cutoff(){this.lastRecorded=0}record(e,s){if(e.ops.length===0)return;this.stack.redo=[];let n=e.invert(s),r=this.currentRange;const o=Date.now();if(this.lastRecorded+this.options.delay>o&&this.stack.undo.length>0){const a=this.stack.undo.pop();a&&(n=n.compose(a.delta),r=a.range)}else this.lastRecorded=o;n.length()!==0&&(this.stack.undo.push({delta:n,range:r}),this.stack.undo.length>this.options.maxStack&&this.stack.undo.shift())}redo(){this.change("redo","undo")}transform(e){Dr(this.stack.undo,e),Dr(this.stack.redo,e)}undo(){this.change("undo","redo")}restoreSelection(e){if(e.range)this.quill.setSelection(e.range,y.sources.USER);else{const s=ka(this.quill.scroll,e.delta);this.quill.setSelection(s,y.sources.USER)}}}w(To,"DEFAULTS",{delay:1e3,maxStack:100,userOnly:!1});function Dr(i,t){let e=t;for(let s=i.length-1;s>=0;s-=1){const n=i[s];i[s]={delta:e.transform(n.delta,!0),range:n.range&&Di(n.range,e)},e=n.delta.transform(e),i[s].delta.length()===0&&i.splice(s,1)}}function qa(i,t){const e=t.ops[t.ops.length-1];return e==null?!1:e.insert!=null?typeof e.insert=="string"&&e.insert.endsWith(` `):e.attributes!=null?Object.keys(e.attributes).some(s=>i.query(s,q.BLOCK)!=null):!1}function ka(i,t){const e=t.reduce((n,r)=>n+(r.delete||0),0);let s=t.length()-e;return qa(i,t)&&(s-=1),s}function Di(i,t){if(!i)return i;const e=t.transformPosition(i.index),s=t.transformPosition(i.index+i.length);return{index:e,length:s-e}}class wo extends wt{constructor(t,e){super(t,e),t.root.addEventListener("drop",s=>{var o;s.preventDefault();let n=null;if(document.caretRangeFromPoint)n=document.caretRangeFromPoint(s.clientX,s.clientY);else if(document.caretPositionFromPoint){const a=document.caretPositionFromPoint(s.clientX,s.clientY);n=document.createRange(),n.setStart(a.offsetNode,a.offset),n.setEnd(a.offsetNode,a.offset)}const r=n&&t.selection.normalizeNative(n);if(r){const a=t.selection.normalizedToRange(r);(o=s.dataTransfer)!=null&&o.files&&this.upload(a,s.dataTransfer.files)}})}upload(t,e){const s=[];Array.from(e).forEach(n=>{var r;n&&((r=this.options.mimetypes)!=null&&r.includes(n.type))&&s.push(n)}),s.length>0&&this.options.handler.call(this,t,s)}}wo.DEFAULTS={mimetypes:["image/png","image/jpeg"],handler(i,t){if(!this.quill.scroll.query("image"))return;const e=t.map(s=>new Promise(n=>{const r=new FileReader;r.onload=()=>{n(r.result)},r.readAsDataURL(s)}));Promise.all(e).then(s=>{const n=s.reduce((r,o)=>r.insert({image:o}),new S().retain(i.index).delete(i.length));this.quill.updateContents(n,L.sources.USER),this.quill.setSelection(i.index+s.length,L.sources.SILENT)})}};const _a=["insertText","insertReplacementText"];class Ia extends wt{constructor(t,e){super(t,e),t.root.addEventListener("beforeinput",s=>{this.handleBeforeInput(s)}),/Android/i.test(navigator.userAgent)||t.on(y.events.COMPOSITION_BEFORE_START,()=>{this.handleCompositionStart()})}deleteRange(t){nr({range:t,quill:this.quill})}replaceText(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";if(t.length===0)return!1;if(e){const s=this.quill.getFormat(t.index,1);this.deleteRange(t),this.quill.updateContents(new S().retain(t.index).insert(e,s),y.sources.USER)}else this.deleteRange(t);return this.quill.setSelection(t.index+e.length,0,y.sources.SILENT),!0}handleBeforeInput(t){if(this.quill.composition.isComposing||t.defaultPrevented||!_a.includes(t.inputType))return;const e=t.getTargetRanges?t.getTargetRanges()[0]:null;if(!e||e.collapsed===!0)return;const s=Oa(t);if(s==null)return;const n=this.quill.selection.normalizeNative(e),r=n?this.quill.selection.normalizedToRange(n):null;r&&this.replaceText(r,s)&&t.preventDefault()}handleCompositionStart(){const t=this.quill.getSelection();t&&this.replaceText(t)}}function Oa(i){var t;return typeof i.data=="string"?i.data:(t=i.dataTransfer)!=null&&t.types.includes("text/plain")?i.dataTransfer.getData("text/plain"):null}const Ra=/Mac/i.test(navigator.platform),Ma=100,Ba=i=>!!(i.key==="ArrowLeft"||i.key==="ArrowRight"||i.key==="ArrowUp"||i.key==="ArrowDown"||i.key==="Home"||Ra&&i.key==="a"&&i.ctrlKey===!0);class Da extends wt{constructor(e,s){super(e,s);w(this,"isListening",!1);w(this,"selectionChangeDeadline",0);this.handleArrowKeys(),this.handleNavigationShortcuts()}handleArrowKeys(){this.quill.keyboard.addBinding({key:["ArrowLeft","ArrowRight"],offset:0,shiftKey:null,handler(e,s){let{line:n,event:r}=s;if(!(n instanceof Nt)||!n.uiNode)return!0;const o=getComputedStyle(n.domNode).direction==="rtl";return o&&r.key!=="ArrowRight"||!o&&r.key!=="ArrowLeft"?!0:(this.quill.setSelection(e.index-1,e.length+(r.shiftKey?1:0),y.sources.USER),!1)}})}handleNavigationShortcuts(){this.quill.root.addEventListener("keydown",e=>{!e.defaultPrevented&&Ba(e)&&this.ensureListeningToSelectionChange()})}ensureListeningToSelectionChange(){if(this.selectionChangeDeadline=Date.now()+Ma,this.isListening)return;this.isListening=!0;const e=()=>{this.isListening=!1,Date.now()<=this.selectionChangeDeadline&&this.handleSelectionChange()};document.addEventListener("selectionchange",e,{once:!0})}handleSelectionChange(){const e=document.getSelection();if(!e)return;const s=e.getRangeAt(0);if(s.collapsed!==!0||s.startOffset!==0)return;const n=this.quill.scroll.find(s.startContainer);if(!(n instanceof Nt)||!n.uiNode)return;const r=document.createRange();r.setStartAfter(n.uiNode),r.setEndAfter(n.uiNode),e.removeAllRanges(),e.addRange(r)}}y.register({"blots/block":G,"blots/block/embed":dt,"blots/break":Tt,"blots/container":ue,"blots/cursor":Be,"blots/embed":Yi,"blots/inline":Jt,"blots/scroll":_e,"blots/text":xt,"modules/clipboard":ba,"modules/history":To,"modules/keyboard":vn,"modules/uploader":wo,"modules/input":Ia,"modules/uiNode":Da});class Pa extends At{add(t,e){let s=0;if(e==="+1"||e==="-1"){const n=this.value(t)||0;s=e==="+1"?n+1:n-1}else typeof e=="number"&&(s=e);return s===0?(this.remove(t),!0):super.add(t,s.toString())}canAdd(t,e){return super.canAdd(t,e)||super.canAdd(t,parseInt(e,10))}value(t){return parseInt(super.value(t),10)||void 0}}const $a=new Pa("indent","ql-indent",{scope:q.BLOCK,whitelist:[1,2,3,4,5,6,7,8]});class Pi extends G{}w(Pi,"blotName","blockquote"),w(Pi,"tagName","blockquote");class $i extends G{static formats(t){return this.tagName.indexOf(t.tagName)+1}}w($i,"blotName","header"),w($i,"tagName",["H1","H2","H3","H4","H5","H6"]);class ys extends ue{}ys.blotName="list-container";ys.tagName="OL";class vs extends G{static create(t){const e=super.create();return e.setAttribute("data-list",t),e}static formats(t){return t.getAttribute("data-list")||void 0}static register(){y.register(ys)}constructor(t,e){super(t,e);const s=e.ownerDocument.createElement("span"),n=r=>{if(!t.isEnabled())return;const o=this.statics.formats(e,t);o==="checked"?(this.format("list","unchecked"),r.preventDefault()):o==="unchecked"&&(this.format("list","checked"),r.preventDefault())};s.addEventListener("mousedown",n),s.addEventListener("touchstart",n),this.attachUI(s)}format(t,e){t===this.statics.blotName&&e?this.domNode.setAttribute("data-list",e):super.format(t,e)}}vs.blotName="list";vs.tagName="LI";ys.allowedChildren=[vs];vs.requiredContainer=ys;class ms extends Jt{static create(){return super.create()}static formats(){return!0}optimize(t){super.optimize(t),this.domNode.tagName!==this.statics.tagName[0]&&this.replaceWith(this.statics.blotName)}}w(ms,"blotName","bold"),w(ms,"tagName",["STRONG","B"]);var rn;let Ua=(rn=class extends ms{},w(rn,"blotName","italic"),w(rn,"tagName",["EM","I"]),rn);var we;let hn=(we=class extends Jt{static create(t){const e=super.create(t);return e.setAttribute("href",this.sanitize(t)),e.setAttribute("rel","noopener noreferrer"),e.setAttribute("target","_blank"),e}static formats(t){return t.getAttribute("href")}static sanitize(t){return Lo(t,this.PROTOCOL_WHITELIST)?t:this.SANITIZED_URL}format(t,e){t!==this.statics.blotName||!e?super.format(t,e):this.domNode.setAttribute("href",this.constructor.sanitize(e))}},w(we,"blotName","link"),w(we,"tagName","A"),w(we,"SANITIZED_URL","about:blank"),w(we,"PROTOCOL_WHITELIST",["http","https","mailto","tel","sms"]),we);function Lo(i,t){const e=document.createElement("a");e.href=i;const s=e.href.slice(0,e.href.indexOf(":"));return t.indexOf(s)>-1}class Ui extends Jt{static create(t){return t==="super"?document.createElement("sup"):t==="sub"?document.createElement("sub"):super.create(t)}static formats(t){if(t.tagName==="SUB")return"sub";if(t.tagName==="SUP")return"super"}}w(Ui,"blotName","script"),w(Ui,"tagName",["SUB","SUP"]);class Hi extends ms{}w(Hi,"blotName","strike"),w(Hi,"tagName",["S","STRIKE"]);class ji extends Jt{}w(ji,"blotName","underline"),w(ji,"tagName","U");class on extends Yi{static create(t){if(window.katex==null)throw new Error("Formula module requires KaTeX.");const e=super.create(t);return typeof t=="string"&&(window.katex.render(t,e,{throwOnError:!1,errorColor:"#f00"}),e.setAttribute("data-value",t)),e}static value(t){return t.getAttribute("data-value")}html(){const{formula:t}=this.value();return`<span>${t}</span>`}}w(on,"blotName","formula"),w(on,"className","ql-formula"),w(on,"tagName","SPAN");const Pr=["alt","height","width"];class Fi extends lt{static create(t){const e=super.create(t);return typeof t=="string"&&e.setAttribute("src",this.sanitize(t)),e}static formats(t){return Pr.reduce((e,s)=>(t.hasAttribute(s)&&(e[s]=t.getAttribute(s)),e),{})}static match(t){return/\.(jpe?g|gif|png)$/.test(t)||/^data:image\/.+;base64/.test(t)}static sanitize(t){return Lo(t,["http","https","data"])?t:"//:0"}static value(t){return t.getAttribute("src")}format(t,e){Pr.indexOf(t)>-1?e?this.domNode.setAttribute(t,e):this.domNode.removeAttribute(t):super.format(t,e)}}w(Fi,"blotName","image"),w(Fi,"tagName","IMG");const $r=["height","width"];class ln extends dt{static create(t){const e=super.create(t);return e.setAttribute("frameborder","0"),e.setAttribute("allowfullscreen","true"),e.setAttribute("src",this.sanitize(t)),e}static formats(t){return $r.reduce((e,s)=>(t.hasAttribute(s)&&(e[s]=t.getAttribute(s)),e),{})}static sanitize(t){return hn.sanitize(t)}static value(t){return t.getAttribute("src")}format(t,e){$r.indexOf(t)>-1?e?this.domNode.setAttribute(t,e):this.domNode.removeAttribute(t):super.format(t,e)}html(){const{video:t}=this.value();return`<a href="${t}">${t}</a>`}}w(ln,"blotName","video"),w(ln,"className","ql-video"),w(ln,"tagName","IFRAME");const as=new At("code-token","hljs",{scope:q.INLINE});class $t extends Jt{static formats(t,e){for(;t!=null&&t!==e.domNode;){if(t.classList&&t.classList.contains(J.className))return super.formats(t,e);t=t.parentNode}}constructor(t,e,s){super(t,e,s),as.add(this.domNode,s)}format(t,e){t!==$t.blotName?super.format(t,e):e?as.add(this.domNode,e):(as.remove(this.domNode),this.domNode.classList.remove(this.statics.className))}optimize(){super.optimize(...arguments),as.value(this.domNode)||this.unwrap()}}$t.blotName="code-token";$t.className="ql-token";class ht extends J{static create(t){const e=super.create(t);return typeof t=="string"&&e.setAttribute("data-language",t),e}static formats(t){return t.getAttribute("data-language")||"plain"}static register(){}format(t,e){t===this.statics.blotName&&e?this.domNode.setAttribute("data-language",e):super.format(t,e)}replaceWith(t,e){return this.formatAt(0,this.length(),$t.blotName,!1),super.replaceWith(t,e)}}class cs extends he{attach(){super.attach(),this.forceNext=!1,this.scroll.emitMount(this)}format(t,e){t===ht.blotName&&(this.forceNext=!0,this.children.forEach(s=>{s.format(t,e)}))}formatAt(t,e,s,n){s===ht.blotName&&(this.forceNext=!0),super.formatAt(t,e,s,n)}highlight(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(this.children.head==null)return;const n=`${Array.from(this.domNode.childNodes).filter(o=>o!==this.uiNode).map(o=>o.textContent).join(` `)} `,r=ht.formats(this.children.head.domNode);if(e||this.forceNext||this.cachedText!==n){if(n.trim().length>0||this.cachedText==null){const o=this.children.reduce((c,h)=>c.concat(ao(h,!1)),new S),a=t(n,r);o.diff(a).reduce((c,h)=>{let{retain:d,attributes:g}=h;return d?(g&&Object.keys(g).forEach(p=>{[ht.blotName,$t.blotName].includes(p)&&this.formatAt(c,d,p,g[p])}),c+d):c},0)}this.cachedText=n,this.forceNext=!1}}html(t,e){const[s]=this.children.find(t);return`<pre data-language="${s?ht.formats(s.domNode):"plain"}"> ${yn(this.code(t,e))} </pre>`}optimize(t){if(super.optimize(t),this.parent!=null&&this.children.head!=null&&this.uiNode!=null){const e=ht.formats(this.children.head.domNode);e!==this.uiNode.value&&(this.uiNode.value=e)}}}cs.allowedChildren=[ht];ht.requiredContainer=cs;ht.allowedChildren=[$t,Be,xt,Tt];const Ha=(i,t,e)=>{if(typeof i.versionString=="string"){const s=i.versionString.split(".")[0];if(parseInt(s,10)>=11)return i.highlight(e,{language:t}).value}return i.highlight(t,e).value};class Co extends wt{static register(){y.register($t,!0),y.register(ht,!0),y.register(cs,!0)}constructor(t,e){if(super(t,e),this.options.hljs==null)throw new Error("Syntax module requires highlight.js. Please include the library on the page before Quill.");this.languages=this.options.languages.reduce((s,n)=>{let{key:r}=n;return s[r]=!0,s},{}),this.highlightBlot=this.highlightBlot.bind(this),this.initListener(),this.initTimer()}initListener(){this.quill.on(y.events.SCROLL_BLOT_MOUNT,t=>{if(!(t instanceof cs))return;const e=this.quill.root.ownerDocument.createElement("select");this.options.languages.forEach(s=>{let{key:n,label:r}=s;const o=e.ownerDocument.createElement("option");o.textContent=r,o.setAttribute("value",n),e.appendChild(o)}),e.addEventListener("change",()=>{t.format(ht.blotName,e.value),this.quill.root.focus(),this.highlight(t,!0)}),t.uiNode==null&&(t.attachUI(e),t.children.head&&(e.value=ht.formats(t.children.head.domNode)))})}initTimer(){let t=null;this.quill.on(y.events.SCROLL_OPTIMIZE,()=>{t&&clearTimeout(t),t=setTimeout(()=>{this.highlight(),t=null},this.options.interval)})}highlight(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(this.quill.selection.composing)return;this.quill.update(y.sources.USER);const s=this.quill.getSelection();(t==null?this.quill.scroll.descendants(cs):[t]).forEach(r=>{r.highlight(this.highlightBlot,e)}),this.quill.update(y.sources.SILENT),s!=null&&this.quill.setSelection(s,y.sources.SILENT)}highlightBlot(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"plain";if(e=this.languages[e]?e:"plain",e==="plain")return yn(t).split(` `).reduce((n,r,o)=>(o!==0&&n.insert(` `,{[J.blotName]:e}),n.insert(r)),new S);const s=this.quill.root.ownerDocument.createElement("div");return s.classList.add(J.className),s.innerHTML=Ha(this.options.hljs,e,t),ir(this.quill.scroll,s,[(n,r)=>{const o=as.value(n);return o?r.compose(new S().retain(r.length(),{[$t.blotName]:o})):r}],[(n,r)=>n.data.split(` `).reduce((o,a,c)=>(c!==0&&o.insert(` `,{[J.blotName]:e}),o.insert(a)),r)],new WeakMap)}}Co.DEFAULTS={hljs:window.hljs,interval:1e3,languages:[{key:"plain",label:"Plain"},{key:"bash",label:"Bash"},{key:"cpp",label:"C++"},{key:"cs",label:"C#"},{key:"css",label:"CSS"},{key:"diff",label:"Diff"},{key:"xml",label:"HTML/XML"},{key:"java",label:"Java"},{key:"javascript",label:"JavaScript"},{key:"markdown",label:"Markdown"},{key:"php",label:"PHP"},{key:"python",label:"Python"},{key:"ruby",label:"Ruby"},{key:"sql",label:"SQL"}]};const hs=class hs extends G{static create(t){const e=super.create();return t?e.setAttribute("data-row",t):e.setAttribute("data-row",rr()),e}static formats(t){if(t.hasAttribute("data-row"))return t.getAttribute("data-row")}cellOffset(){return this.parent?this.parent.children.indexOf(this):-1}format(t,e){t===hs.blotName&&e?this.domNode.setAttribute("data-row",e):super.format(t,e)}row(){return this.parent}rowOffset(){return this.row()?this.row().rowOffset():-1}table(){return this.row()&&this.row().table()}};w(hs,"blotName","table"),w(hs,"tagName","TD");let Et=hs;class Ut extends ue{checkMerge(){if(super.checkMerge()&&this.next.children.head!=null){const t=this.children.head.formats(),e=this.children.tail.formats(),s=this.next.children.head.formats(),n=this.next.children.tail.formats();return t.table===e.table&&t.table===s.table&&t.table===n.table}return!1}optimize(t){super.optimize(t),this.children.forEach(e=>{if(e.next==null)return;const s=e.formats(),n=e.next.formats();if(s.table!==n.table){const r=this.splitAfter(e);r&&r.optimize(),this.prev&&this.prev.optimize()}})}rowOffset(){return this.parent?this.parent.children.indexOf(this):-1}table(){return this.parent&&this.parent.parent}}w(Ut,"blotName","table-row"),w(Ut,"tagName","TR");class _t extends ue{}w(_t,"blotName","table-body"),w(_t,"tagName","TBODY");class Pe extends ue{balanceCells(){const t=this.descendants(Ut),e=t.reduce((s,n)=>Math.max(n.children.length,s),0);t.forEach(s=>{new Array(e-s.children.length).fill(0).forEach(()=>{let n;s.children.head!=null&&(n=Et.formats(s.children.head.domNode));const r=this.scroll.create(Et.blotName,n);s.appendChild(r),r.optimize()})})}cells(t){return this.rows().map(e=>e.children.at(t))}deleteColumn(t){const[e]=this.descendant(_t);e==null||e.children.head==null||e.children.forEach(s=>{const n=s.children.at(t);n!=null&&n.remove()})}insertColumn(t){const[e]=this.descendant(_t);e==null||e.children.head==null||e.children.forEach(s=>{const n=s.children.at(t),r=Et.formats(s.children.head.domNode),o=this.scroll.create(Et.blotName,r);s.insertBefore(o,n)})}insertRow(t){const[e]=this.descendant(_t);if(e==null||e.children.head==null)return;const s=rr(),n=this.scroll.create(Ut.blotName);e.children.head.children.forEach(()=>{const o=this.scroll.create(Et.blotName,s);n.appendChild(o)});const r=e.children.at(t);e.insertBefore(n,r)}rows(){const t=this.children.head;return t==null?[]:t.children.map(e=>e)}}w(Pe,"blotName","table-container"),w(Pe,"tagName","TABLE");Pe.allowedChildren=[_t];_t.requiredContainer=Pe;_t.allowedChildren=[Ut];Ut.requiredContainer=_t;Ut.allowedChildren=[Et];Et.requiredContainer=Ut;function rr(){return`row-${Math.random().toString(36).slice(2,6)}`}class ja extends wt{static register(){y.register(Et),y.register(Ut),y.register(_t),y.register(Pe)}constructor(){super(...arguments),this.listenBalanceCells()}balanceTables(){this.quill.scroll.descendants(Pe).forEach(t=>{t.balanceCells()})}deleteColumn(){const[t,,e]=this.getTable();e!=null&&(t.deleteColumn(e.cellOffset()),this.quill.update(y.sources.USER))}deleteRow(){const[,t]=this.getTable();t!=null&&(t.remove(),this.quill.update(y.sources.USER))}deleteTable(){const[t]=this.getTable();if(t==null)return;const e=t.offset();t.remove(),this.quill.update(y.sources.USER),this.quill.setSelection(e,y.sources.SILENT)}getTable(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.quill.getSelection();if(t==null)return[null,null,null,-1];const[e,s]=this.quill.getLine(t.index);if(e==null||e.statics.blotName!==Et.blotName)return[null,null,null,-1];const n=e.parent;return[n.parent.parent,n,e,s]}insertColumn(t){const e=this.quill.getSelection();if(!e)return;const[s,n,r]=this.getTable(e);if(r==null)return;const o=r.cellOffset();s.insertColumn(o+t),this.quill.update(y.sources.USER);let a=n.rowOffset();t===0&&(a+=1),this.quill.setSelection(e.index+a,e.length,y.sources.SILENT)}insertColumnLeft(){this.insertColumn(0)}insertColumnRight(){this.insertColumn(1)}insertRow(t){const e=this.quill.getSelection();if(!e)return;const[s,n,r]=this.getTable(e);if(r==null)return;const o=n.rowOffset();s.insertRow(o+t),this.quill.update(y.sources.USER),t>0?this.quill.setSelection(e,y.sources.SILENT):this.quill.setSelection(e.index+n.children.length,e.length,y.sources.SILENT)}insertRowAbove(){this.insertRow(0)}insertRowBelow(){this.insertRow(1)}insertTable(t,e){const s=this.quill.getSelection();if(s==null)return;const n=new Array(t).fill(0).reduce(r=>{const o=new Array(e).fill(` `).join("");return r.insert(o,{table:rr()})},new S().retain(s.index));this.quill.updateContents(n,y.sources.USER),this.quill.setSelection(s.index,y.sources.SILENT),this.balanceTables()}listenBalanceCells(){this.quill.on(y.events.SCROLL_OPTIMIZE,t=>{t.some(e=>["TD","TR","TBODY","TABLE"].includes(e.target.tagName)?(this.quill.once(y.events.TEXT_CHANGE,(s,n,r)=>{r===y.sources.USER&&this.balanceTables()}),!0):!1)})}}const Ur=Ht("quill:toolbar");let or=class extends wt{constructor(t,e){var s,n;if(super(t,e),Array.isArray(this.options.container)){const r=document.createElement("div");r.setAttribute("role","toolbar"),Fa(r,this.options.container),(n=(s=t.container)==null?void 0:s.parentNode)==null||n.insertBefore(r,t.container),this.container=r}else typeof this.options.container=="string"?this.container=document.querySelector(this.options.container):this.container=this.options.container;if(!(this.container instanceof HTMLElement)){Ur.error("Container required for toolbar",this.options);return}this.container.classList.add("ql-toolbar"),this.controls=[],this.handlers={},this.options.handlers&&Object.keys(this.options.handlers).forEach(r=>{var a;const o=(a=this.options.handlers)==null?void 0:a[r];o&&this.addHandler(r,o)}),Array.from(this.container.querySelectorAll("button, select")).forEach(r=>{this.attach(r)}),this.quill.on(y.events.EDITOR_CHANGE,()=>{const[r]=this.quill.selection.getRange();this.update(r)})}addHandler(t,e){this.handlers[t]=e}attach(t){let e=Array.from(t.classList).find(n=>n.indexOf("ql-")===0);if(!e)return;if(e=e.slice(3),t.tagName==="BUTTON"&&t.setAttribute("type","button"),this.handlers[e]==null&&this.quill.scroll.query(e)==null){Ur.warn("ignoring attaching to nonexistent format",e,t);return}const s=t.tagName==="SELECT"?"change":"click";t.addEventListener(s,n=>{let r;if(t.tagName==="SELECT"){if(t.selectedIndex<0)return;const a=t.options[t.selectedIndex];a.hasAttribute("selected")?r=!1:r=a.value||!1}else t.classList.contains("ql-active")?r=!1:r=t.value||!t.hasAttribute("value"),n.preventDefault();this.quill.focus();const[o]=this.quill.selection.getRange();if(this.handlers[e]!=null)this.handlers[e].call(this,r);else if(this.quill.scroll.query(e).prototype instanceof lt){if(r=prompt(`Enter ${e}`),!r)return;this.quill.updateContents(new S().retain(o.index).delete(o.length).insert({[e]:r}),y.sources.USER)}else this.quill.format(e,r,y.sources.USER);this.update(o)}),this.controls.push([e,t])}update(t){const e=t==null?{}:this.quill.getFormat(t);this.controls.forEach(s=>{const[n,r]=s;if(r.tagName==="SELECT"){let o=null;if(t==null)o=null;else if(e[n]==null)o=r.querySelector("option[selected]");else if(!Array.isArray(e[n])){let a=e[n];typeof a=="string"&&(a=a.replace(/"/g,'\\"')),o=r.querySelector(`option[value="${a}"]`)}o==null?(r.value="",r.selectedIndex=-1):o.selected=!0}else if(t==null)r.classList.remove("ql-active"),r.setAttribute("aria-pressed","false");else if(r.hasAttribute("value")){const o=e[n],a=o===r.getAttribute("value")||o!=null&&o.toString()===r.getAttribute("value")||o==null&&!r.getAttribute("value");r.classList.toggle("ql-active",a),r.setAttribute("aria-pressed",a.toString())}else{const o=e[n]!=null;r.classList.toggle("ql-active",o),r.setAttribute("aria-pressed",o.toString())}})}};or.DEFAULTS={};function Hr(i,t,e){const s=document.createElement("button");s.setAttribute("type","button"),s.classList.add(`ql-${t}`),s.setAttribute("aria-pressed","false"),e!=null?(s.value=e,s.setAttribute("aria-label",`${t}: ${e}`)):s.setAttribute("aria-label",t),i.appendChild(s)}function Fa(i,t){Array.isArray(t[0])||(t=[t]),t.forEach(e=>{const s=document.createElement("span");s.classList.add("ql-formats"),e.forEach(n=>{if(typeof n=="string")Hr(s,n);else{const r=Object.keys(n)[0],o=n[r];Array.isArray(o)?za(s,r,o):Hr(s,r,o)}}),i.appendChild(s)})}function za(i,t,e){const s=document.createElement("select");s.classList.add(`ql-${t}`),e.forEach(n=>{const r=document.createElement("option");n!==!1?r.setAttribute("value",String(n)):r.setAttribute("selected","selected"),s.appendChild(r)}),i.appendChild(s)}or.DEFAULTS={container:null,handlers:{clean(){const i=this.quill.getSelection();if(i!=null)if(i.length===0){const t=this.quill.getFormat();Object.keys(t).forEach(e=>{this.quill.scroll.query(e,q.INLINE)!=null&&this.quill.format(e,!1,y.sources.USER)})}else this.quill.removeFormat(i.index,i.length,y.sources.USER)},direction(i){const{align:t}=this.quill.getFormat();i==="rtl"&&t==null?this.quill.format("align","right",y.sources.USER):!i&&t==="right"&&this.quill.format("align",!1,y.sources.USER),this.quill.format("direction",i,y.sources.USER)},indent(i){const t=this.quill.getSelection(),e=this.quill.getFormat(t),s=parseInt(e.indent||0,10);if(i==="+1"||i==="-1"){let n=i==="+1"?1:-1;e.direction==="rtl"&&(n*=-1),this.quill.format("indent",s+n,y.sources.USER)}},link(i){i===!0&&(i=prompt("Enter link URL:")),this.quill.format("link",i,y.sources.USER)},list(i){const t=this.quill.getSelection(),e=this.quill.getFormat(t);i==="check"?e.list==="checked"||e.list==="unchecked"?this.quill.format("list",!1,y.sources.USER):this.quill.format("list","unchecked",y.sources.USER):this.quill.format("list",i,y.sources.USER)}}};const Va='<svg viewbox="0 0 18 18"><line class="ql-stroke" x1="3" x2="15" y1="9" y2="9"/><line class="ql-stroke" x1="3" x2="13" y1="14" y2="14"/><line class="ql-stroke" x1="3" x2="9" y1="4" y2="4"/></svg>',Ka='<svg viewbox="0 0 18 18"><line class="ql-stroke" x1="15" x2="3" y1="9" y2="9"/><line class="ql-stroke" x1="14" x2="4" y1="14" y2="14"/><line class="ql-stroke" x1="12" x2="6" y1="4" y2="4"/></svg>',Ga='<svg viewbox="0 0 18 18"><line class="ql-stroke" x1="15" x2="3" y1="9" y2="9"/><line class="ql-stroke" x1="15" x2="5" y1="14" y2="14"/><line class="ql-stroke" x1="15" x2="9" y1="4" y2="4"/></svg>',Wa='<svg viewbox="0 0 18 18"><line class="ql-stroke" x1="15" x2="3" y1="9" y2="9"/><line class="ql-stroke" x1="15" x2="3" y1="14" y2="14"/><line class="ql-stroke" x1="15" x2="3" y1="4" y2="4"/></svg>',Za='<svg viewbox="0 0 18 18"><g class="ql-fill ql-color-label"><polygon points="6 6.868 6 6 5 6 5 7 5.942 7 6 6.868"/><rect height="1" width="1" x="4" y="4"/><polygon points="6.817 5 6 5 6 6 6.38 6 6.817 5"/><rect height="1" width="1" x="2" y="6"/><rect height="1" width="1" x="3" y="5"/><rect height="1" width="1" x="4" y="7"/><polygon points="4 11.439 4 11 3 11 3 12 3.755 12 4 11.439"/><rect height="1" width="1" x="2" y="12"/><rect height="1" width="1" x="2" y="9"/><rect height="1" width="1" x="2" y="15"/><polygon points="4.63 10 4 10 4 11 4.192 11 4.63 10"/><rect height="1" width="1" x="3" y="8"/><path d="M10.832,4.2L11,4.582V4H10.708A1.948,1.948,0,0,1,10.832,4.2Z"/><path d="M7,4.582L7.168,4.2A1.929,1.929,0,0,1,7.292,4H7V4.582Z"/><path d="M8,13H7.683l-0.351.8a1.933,1.933,0,0,1-.124.2H8V13Z"/><rect height="1" width="1" x="12" y="2"/><rect height="1" width="1" x="11" y="3"/><path d="M9,3H8V3.282A1.985,1.985,0,0,1,9,3Z"/><rect height="1" width="1" x="2" y="3"/><rect height="1" width="1" x="6" y="2"/><rect height="1" width="1" x="3" y="2"/><rect height="1" width="1" x="5" y="3"/><rect height="1" width="1" x="9" y="2"/><rect height="1" width="1" x="15" y="14"/><polygon points="13.447 10.174 13.469 10.225 13.472 10.232 13.808 11 14 11 14 10 13.37 10 13.447 10.174"/><rect height="1" width="1" x="13" y="7"/><rect height="1" width="1" x="15" y="5"/><rect height="1" width="1" x="14" y="6"/><rect height="1" width="1" x="15" y="8"/><rect height="1" width="1" x="14" y="9"/><path d="M3.775,14H3v1H4V14.314A1.97,1.97,0,0,1,3.775,14Z"/><rect height="1" width="1" x="14" y="3"/><polygon points="12 6.868 12 6 11.62 6 12 6.868"/><rect height="1" width="1" x="15" y="2"/><rect height="1" width="1" x="12" y="5"/><rect height="1" width="1" x="13" y="4"/><polygon points="12.933 9 13 9 13 8 12.495 8 12.933 9"/><rect height="1" width="1" x="9" y="14"/><rect height="1" width="1" x="8" y="15"/><path d="M6,14.926V15H7V14.316A1.993,1.993,0,0,1,6,14.926Z"/><rect height="1" width="1" x="5" y="15"/><path d="M10.668,13.8L10.317,13H10v1h0.792A1.947,1.947,0,0,1,10.668,13.8Z"/><rect height="1" width="1" x="11" y="15"/><path d="M14.332,12.2a1.99,1.99,0,0,1,.166.8H15V12H14.245Z"/><rect height="1" width="1" x="14" y="15"/><rect height="1" width="1" x="15" y="11"/></g><polyline class="ql-stroke" points="5.5 13 9 5 12.5 13"/><line class="ql-stroke" x1="11.63" x2="6.38" y1="11" y2="11"/></svg>',Xa='<svg viewbox="0 0 18 18"><rect class="ql-fill ql-stroke" height="3" width="3" x="4" y="5"/><rect class="ql-fill ql-stroke" height="3" width="3" x="11" y="5"/><path class="ql-even ql-fill ql-stroke" d="M7,8c0,4.031-3,5-3,5"/><path class="ql-even ql-fill ql-stroke" d="M14,8c0,4.031-3,5-3,5"/></svg>',Ya='<svg viewbox="0 0 18 18"><path class="ql-stroke" d="M5,4H9.5A2.5,2.5,0,0,1,12,6.5v0A2.5,2.5,0,0,1,9.5,9H5A0,0,0,0,1,5,9V4A0,0,0,0,1,5,4Z"/><path class="ql-stroke" d="M5,9h5.5A2.5,2.5,0,0,1,13,11.5v0A2.5,2.5,0,0,1,10.5,14H5a0,0,0,0,1,0,0V9A0,0,0,0,1,5,9Z"/></svg>',Qa='<svg class="" viewbox="0 0 18 18"><line class="ql-stroke" x1="5" x2="13" y1="3" y2="3"/><line class="ql-stroke" x1="6" x2="9.35" y1="12" y2="3"/><line class="ql-stroke" x1="11" x2="15" y1="11" y2="15"/><line class="ql-stroke" x1="15" x2="11" y1="11" y2="15"/><rect class="ql-fill" height="1" rx="0.5" ry="0.5" width="7" x="2" y="14"/></svg>',jr='<svg viewbox="0 0 18 18"><polyline class="ql-even ql-stroke" points="5 7 3 9 5 11"/><polyline class="ql-even ql-stroke" points="13 7 15 9 13 11"/><line class="ql-stroke" x1="10" x2="8" y1="5" y2="13"/></svg>',Ja='<svg viewbox="0 0 18 18"><line class="ql-color-label ql-stroke ql-transparent" x1="3" x2="15" y1="15" y2="15"/><polyline class="ql-stroke" points="5.5 11 9 3 12.5 11"/><line class="ql-stroke" x1="11.63" x2="6.38" y1="9" y2="9"/></svg>',tc='<svg viewbox="0 0 18 18"><polygon class="ql-stroke ql-fill" points="3 11 5 9 3 7 3 11"/><line class="ql-stroke ql-fill" x1="15" x2="11" y1="4" y2="4"/><path class="ql-fill" d="M11,3a3,3,0,0,0,0,6h1V3H11Z"/><rect class="ql-fill" height="11" width="1" x="11" y="4"/><rect class="ql-fill" height="11" width="1" x="13" y="4"/></svg>',ec='<svg viewbox="0 0 18 18"><polygon class="ql-stroke ql-fill" points="15 12 13 10 15 8 15 12"/><line class="ql-stroke ql-fill" x1="9" x2="5" y1="4" y2="4"/><path class="ql-fill" d="M5,3A3,3,0,0,0,5,9H6V3H5Z"/><rect class="ql-fill" height="11" width="1" x="5" y="4"/><rect class="ql-fill" height="11" width="1" x="7" y="4"/></svg>',sc='<svg viewbox="0 0 18 18"><path class="ql-fill" d="M11.759,2.482a2.561,2.561,0,0,0-3.53.607A7.656,7.656,0,0,0,6.8,6.2C6.109,9.188,5.275,14.677,4.15,14.927a1.545,1.545,0,0,0-1.3-.933A0.922,0.922,0,0,0,2,15.036S1.954,16,4.119,16s3.091-2.691,3.7-5.553c0.177-.826.36-1.726,0.554-2.6L8.775,6.2c0.381-1.421.807-2.521,1.306-2.676a1.014,1.014,0,0,0,1.02.56A0.966,0.966,0,0,0,11.759,2.482Z"/><rect class="ql-fill" height="1.6" rx="0.8" ry="0.8" width="5" x="5.15" y="6.2"/><path class="ql-fill" d="M13.663,12.027a1.662,1.662,0,0,1,.266-0.276q0.193,0.069.456,0.138a2.1,2.1,0,0,0,.535.069,1.075,1.075,0,0,0,.767-0.3,1.044,1.044,0,0,0,.314-0.8,0.84,0.84,0,0,0-.238-0.619,0.8,0.8,0,0,0-.594-0.239,1.154,1.154,0,0,0-.781.3,4.607,4.607,0,0,0-.781,1q-0.091.15-.218,0.346l-0.246.38c-0.068-.288-0.137-0.582-0.212-0.885-0.459-1.847-2.494-.984-2.941-0.8-0.482.2-.353,0.647-0.094,0.529a0.869,0.869,0,0,1,1.281.585c0.217,0.751.377,1.436,0.527,2.038a5.688,5.688,0,0,1-.362.467,2.69,2.69,0,0,1-.264.271q-0.221-.08-0.471-0.147a2.029,2.029,0,0,0-.522-0.066,1.079,1.079,0,0,0-.768.3A1.058,1.058,0,0,0,9,15.131a0.82,0.82,0,0,0,.832.852,1.134,1.134,0,0,0,.787-0.3,5.11,5.11,0,0,0,.776-0.993q0.141-.219.215-0.34c0.046-.076.122-0.194,0.223-0.346a2.786,2.786,0,0,0,.918,1.726,2.582,2.582,0,0,0,2.376-.185c0.317-.181.212-0.565,0-0.494A0.807,0.807,0,0,1,14.176,15a5.159,5.159,0,0,1-.913-2.446l0,0Q13.487,12.24,13.663,12.027Z"/></svg>',nc='<svg viewBox="0 0 18 18"><path class="ql-fill" d="M10,4V14a1,1,0,0,1-2,0V10H3v4a1,1,0,0,1-2,0V4A1,1,0,0,1,3,4V8H8V4a1,1,0,0,1,2,0Zm6.06787,9.209H14.98975V7.59863a.54085.54085,0,0,0-.605-.60547h-.62744a1.01119,1.01119,0,0,0-.748.29688L11.645,8.56641a.5435.5435,0,0,0-.022.8584l.28613.30762a.53861.53861,0,0,0,.84717.0332l.09912-.08789a1.2137,1.2137,0,0,0,.2417-.35254h.02246s-.01123.30859-.01123.60547V13.209H12.041a.54085.54085,0,0,0-.605.60547v.43945a.54085.54085,0,0,0,.605.60547h4.02686a.54085.54085,0,0,0,.605-.60547v-.43945A.54085.54085,0,0,0,16.06787,13.209Z"/></svg>',ic='<svg viewBox="0 0 18 18"><path class="ql-fill" d="M16.73975,13.81445v.43945a.54085.54085,0,0,1-.605.60547H11.855a.58392.58392,0,0,1-.64893-.60547V14.0127c0-2.90527,3.39941-3.42187,3.39941-4.55469a.77675.77675,0,0,0-.84717-.78125,1.17684,1.17684,0,0,0-.83594.38477c-.2749.26367-.561.374-.85791.13184l-.4292-.34082c-.30811-.24219-.38525-.51758-.1543-.81445a2.97155,2.97155,0,0,1,2.45361-1.17676,2.45393,2.45393,0,0,1,2.68408,2.40918c0,2.45312-3.1792,2.92676-3.27832,3.93848h2.79443A.54085.54085,0,0,1,16.73975,13.81445ZM9,3A.99974.99974,0,0,0,8,4V8H3V4A1,1,0,0,0,1,4V14a1,1,0,0,0,2,0V10H8v4a1,1,0,0,0,2,0V4A.99974.99974,0,0,0,9,3Z"/></svg>',rc='<svg viewBox="0 0 18 18"><path class="ql-fill" d="M16.65186,12.30664a2.6742,2.6742,0,0,1-2.915,2.68457,3.96592,3.96592,0,0,1-2.25537-.6709.56007.56007,0,0,1-.13232-.83594L11.64648,13c.209-.34082.48389-.36328.82471-.1543a2.32654,2.32654,0,0,0,1.12256.33008c.71484,0,1.12207-.35156,1.12207-.78125,0-.61523-.61621-.86816-1.46338-.86816H13.2085a.65159.65159,0,0,1-.68213-.41895l-.05518-.10937a.67114.67114,0,0,1,.14307-.78125l.71533-.86914a8.55289,8.55289,0,0,1,.68213-.7373V8.58887a3.93913,3.93913,0,0,1-.748.05469H11.9873a.54085.54085,0,0,1-.605-.60547V7.59863a.54085.54085,0,0,1,.605-.60547h3.75146a.53773.53773,0,0,1,.60547.59375v.17676a1.03723,1.03723,0,0,1-.27539.748L14.74854,10.0293A2.31132,2.31132,0,0,1,16.65186,12.30664ZM9,3A.99974.99974,0,0,0,8,4V8H3V4A1,1,0,0,0,1,4V14a1,1,0,0,0,2,0V10H8v4a1,1,0,0,0,2,0V4A.99974.99974,0,0,0,9,3Z"/></svg>',oc='<svg viewBox="0 0 18 18"><path class="ql-fill" d="M10,4V14a1,1,0,0,1-2,0V10H3v4a1,1,0,0,1-2,0V4A1,1,0,0,1,3,4V8H8V4a1,1,0,0,1,2,0Zm7.05371,7.96582v.38477c0,.39648-.165.60547-.46191.60547h-.47314v1.29785a.54085.54085,0,0,1-.605.60547h-.69336a.54085.54085,0,0,1-.605-.60547V12.95605H11.333a.5412.5412,0,0,1-.60547-.60547v-.15332a1.199,1.199,0,0,1,.22021-.748l2.56348-4.05957a.7819.7819,0,0,1,.72607-.39648h1.27637a.54085.54085,0,0,1,.605.60547v3.7627h.33008A.54055.54055,0,0,1,17.05371,11.96582ZM14.28125,8.7207h-.022a4.18969,4.18969,0,0,1-.38525.81348l-1.188,1.80469v.02246h1.5293V9.60059A7.04058,7.04058,0,0,1,14.28125,8.7207Z"/></svg>',lc='<svg viewBox="0 0 18 18"><path class="ql-fill" d="M16.74023,12.18555a2.75131,2.75131,0,0,1-2.91553,2.80566,3.908,3.908,0,0,1-2.25537-.68164.54809.54809,0,0,1-.13184-.8252L11.73438,13c.209-.34082.48389-.36328.8252-.1543a2.23757,2.23757,0,0,0,1.1001.33008,1.01827,1.01827,0,0,0,1.1001-.96777c0-.61621-.53906-.97949-1.25439-.97949a2.15554,2.15554,0,0,0-.64893.09961,1.15209,1.15209,0,0,1-.814.01074l-.12109-.04395a.64116.64116,0,0,1-.45117-.71484l.231-3.00391a.56666.56666,0,0,1,.62744-.583H15.541a.54085.54085,0,0,1,.605.60547v.43945a.54085.54085,0,0,1-.605.60547H13.41748l-.04395.72559a1.29306,1.29306,0,0,1-.04395.30859h.022a2.39776,2.39776,0,0,1,.57227-.07715A2.53266,2.53266,0,0,1,16.74023,12.18555ZM9,3A.99974.99974,0,0,0,8,4V8H3V4A1,1,0,0,0,1,4V14a1,1,0,0,0,2,0V10H8v4a1,1,0,0,0,2,0V4A.99974.99974,0,0,0,9,3Z"/></svg>',ac='<svg viewBox="0 0 18 18"><path class="ql-fill" d="M14.51758,9.64453a1.85627,1.85627,0,0,0-1.24316.38477H13.252a1.73532,1.73532,0,0,1,1.72754-1.4082,2.66491,2.66491,0,0,1,.5498.06641c.35254.05469.57227.01074.70508-.40723l.16406-.5166a.53393.53393,0,0,0-.373-.75977,4.83723,4.83723,0,0,0-1.17773-.14258c-2.43164,0-3.7627,2.17773-3.7627,4.43359,0,2.47559,1.60645,3.69629,3.19043,3.69629A2.70585,2.70585,0,0,0,16.96,12.19727,2.43861,2.43861,0,0,0,14.51758,9.64453Zm-.23047,3.58691c-.67187,0-1.22168-.81445-1.22168-1.45215,0-.47363.30762-.583.72559-.583.96875,0,1.27734.59375,1.27734,1.12207A.82182.82182,0,0,1,14.28711,13.23145ZM10,4V14a1,1,0,0,1-2,0V10H3v4a1,1,0,0,1-2,0V4A1,1,0,0,1,3,4V8H8V4a1,1,0,0,1,2,0Z"/></svg>',cc='<svg viewbox="0 0 18 18"><line class="ql-stroke" x1="7" x2="13" y1="4" y2="4"/><line class="ql-stroke" x1="5" x2="11" y1="14" y2="14"/><line class="ql-stroke" x1="8" x2="10" y1="14" y2="4"/></svg>',uc='<svg viewbox="0 0 18 18"><rect class="ql-stroke" height="10" width="12" x="3" y="4"/><circle class="ql-fill" cx="6" cy="7" r="1"/><polyline class="ql-even ql-fill" points="5 12 5 11 7 9 8 10 11 7 13 9 13 12 5 12"/></svg>',hc='<svg viewbox="0 0 18 18"><line class="ql-stroke" x1="3" x2="15" y1="14" y2="14"/><line class="ql-stroke" x1="3" x2="15" y1="4" y2="4"/><line class="ql-stroke" x1="9" x2="15" y1="9" y2="9"/><polyline class="ql-fill ql-stroke" points="3 7 3 11 5 9 3 7"/></svg>',dc='<svg viewbox="0 0 18 18"><line class="ql-stroke" x1="3" x2="15" y1="14" y2="14"/><line class="ql-stroke" x1="3" x2="15" y1="4" y2="4"/><line class="ql-stroke" x1="9" x2="15" y1="9" y2="9"/><polyline class="ql-stroke" points="5 7 5 11 3 9 5 7"/></svg>',fc='<svg viewbox="0 0 18 18"><line class="ql-stroke" x1="7" x2="11" y1="7" y2="11"/><path class="ql-even ql-stroke" d="M8.9,4.577a3.476,3.476,0,0,1,.36,4.679A3.476,3.476,0,0,1,4.577,8.9C3.185,7.5,2.035,6.4,4.217,4.217S7.5,3.185,8.9,4.577Z"/><path class="ql-even ql-stroke" d="M13.423,9.1a3.476,3.476,0,0,0-4.679-.36,3.476,3.476,0,0,0,.36,4.679c1.392,1.392,2.5,2.542,4.679.36S14.815,10.5,13.423,9.1Z"/></svg>',pc='<svg viewbox="0 0 18 18"><line class="ql-stroke" x1="6" x2="15" y1="4" y2="4"/><line class="ql-stroke" x1="6" x2="15" y1="9" y2="9"/><line class="ql-stroke" x1="6" x2="15" y1="14" y2="14"/><line class="ql-stroke" x1="3" x2="3" y1="4" y2="4"/><line class="ql-stroke" x1="3" x2="3" y1="9" y2="9"/><line class="ql-stroke" x1="3" x2="3" y1="14" y2="14"/></svg>',mc='<svg class="" viewbox="0 0 18 18"><line class="ql-stroke" x1="9" x2="15" y1="4" y2="4"/><polyline class="ql-stroke" points="3 4 4 5 6 3"/><line class="ql-stroke" x1="9" x2="15" y1="14" y2="14"/><polyline class="ql-stroke" points="3 14 4 15 6 13"/><line class="ql-stroke" x1="9" x2="15" y1="9" y2="9"/><polyline class="ql-stroke" points="3 9 4 10 6 8"/></svg>',gc='<svg viewbox="0 0 18 18"><line class="ql-stroke" x1="7" x2="15" y1="4" y2="4"/><line class="ql-stroke" x1="7" x2="15" y1="9" y2="9"/><line class="ql-stroke" x1="7" x2="15" y1="14" y2="14"/><line class="ql-stroke ql-thin" x1="2.5" x2="4.5" y1="5.5" y2="5.5"/><path class="ql-fill" d="M3.5,6A0.5,0.5,0,0,1,3,5.5V3.085l-0.276.138A0.5,0.5,0,0,1,2.053,3c-0.124-.247-0.023-0.324.224-0.447l1-.5A0.5,0.5,0,0,1,4,2.5v3A0.5,0.5,0,0,1,3.5,6Z"/><path class="ql-stroke ql-thin" d="M4.5,10.5h-2c0-.234,1.85-1.076,1.85-2.234A0.959,0.959,0,0,0,2.5,8.156"/><path class="ql-stroke ql-thin" d="M2.5,14.846a0.959,0.959,0,0,0,1.85-.109A0.7,0.7,0,0,0,3.75,14a0.688,0.688,0,0,0,.6-0.736,0.959,0.959,0,0,0-1.85-.109"/></svg>',bc='<svg viewbox="0 0 18 18"><path class="ql-fill" d="M15.5,15H13.861a3.858,3.858,0,0,0,1.914-2.975,1.8,1.8,0,0,0-1.6-1.751A1.921,1.921,0,0,0,12.021,11.7a0.50013,0.50013,0,1,0,.957.291h0a0.914,0.914,0,0,1,1.053-.725,0.81,0.81,0,0,1,.744.762c0,1.076-1.16971,1.86982-1.93971,2.43082A1.45639,1.45639,0,0,0,12,15.5a0.5,0.5,0,0,0,.5.5h3A0.5,0.5,0,0,0,15.5,15Z"/><path class="ql-fill" d="M9.65,5.241a1,1,0,0,0-1.409.108L6,7.964,3.759,5.349A1,1,0,0,0,2.192,6.59178Q2.21541,6.6213,2.241,6.649L4.684,9.5,2.241,12.35A1,1,0,0,0,3.71,13.70722q0.02557-.02768.049-0.05722L6,11.036,8.241,13.65a1,1,0,1,0,1.567-1.24277Q9.78459,12.3777,9.759,12.35L7.316,9.5,9.759,6.651A1,1,0,0,0,9.65,5.241Z"/></svg>',yc='<svg viewbox="0 0 18 18"><path class="ql-fill" d="M15.5,7H13.861a4.015,4.015,0,0,0,1.914-2.975,1.8,1.8,0,0,0-1.6-1.751A1.922,1.922,0,0,0,12.021,3.7a0.5,0.5,0,1,0,.957.291,0.917,0.917,0,0,1,1.053-.725,0.81,0.81,0,0,1,.744.762c0,1.077-1.164,1.925-1.934,2.486A1.423,1.423,0,0,0,12,7.5a0.5,0.5,0,0,0,.5.5h3A0.5,0.5,0,0,0,15.5,7Z"/><path class="ql-fill" d="M9.651,5.241a1,1,0,0,0-1.41.108L6,7.964,3.759,5.349a1,1,0,1,0-1.519,1.3L4.683,9.5,2.241,12.35a1,1,0,1,0,1.519,1.3L6,11.036,8.241,13.65a1,1,0,0,0,1.519-1.3L7.317,9.5,9.759,6.651A1,1,0,0,0,9.651,5.241Z"/></svg>',vc='<svg viewbox="0 0 18 18"><line class="ql-stroke ql-thin" x1="15.5" x2="2.5" y1="8.5" y2="9.5"/><path class="ql-fill" d="M9.007,8C6.542,7.791,6,7.519,6,6.5,6,5.792,7.283,5,9,5c1.571,0,2.765.679,2.969,1.309a1,1,0,0,0,1.9-.617C13.356,4.106,11.354,3,9,3,6.2,3,4,4.538,4,6.5a3.2,3.2,0,0,0,.5,1.843Z"/><path class="ql-fill" d="M8.984,10C11.457,10.208,12,10.479,12,11.5c0,0.708-1.283,1.5-3,1.5-1.571,0-2.765-.679-2.969-1.309a1,1,0,1,0-1.9.617C4.644,13.894,6.646,15,9,15c2.8,0,5-1.538,5-3.5a3.2,3.2,0,0,0-.5-1.843Z"/></svg>',Ec='<svg viewbox="0 0 18 18"><rect class="ql-stroke" height="12" width="12" x="3" y="3"/><rect class="ql-fill" height="2" width="3" x="5" y="5"/><rect class="ql-fill" height="2" width="4" x="9" y="5"/><g class="ql-fill ql-transparent"><rect height="2" width="3" x="5" y="8"/><rect height="2" width="4" x="9" y="8"/><rect height="2" width="3" x="5" y="11"/><rect height="2" width="4" x="9" y="11"/></g></svg>',Nc='<svg viewbox="0 0 18 18"><path class="ql-stroke" d="M5,3V9a4.012,4.012,0,0,0,4,4H9a4.012,4.012,0,0,0,4-4V3"/><rect class="ql-fill" height="1" rx="0.5" ry="0.5" width="12" x="3" y="15"/></svg>',xc='<svg viewbox="0 0 18 18"><rect class="ql-stroke" height="12" width="12" x="3" y="3"/><rect class="ql-fill" height="12" width="1" x="5" y="3"/><rect class="ql-fill" height="12" width="1" x="12" y="3"/><rect class="ql-fill" height="2" width="8" x="5" y="8"/><rect class="ql-fill" height="1" width="3" x="3" y="5"/><rect class="ql-fill" height="1" width="3" x="3" y="7"/><rect class="ql-fill" height="1" width="3" x="3" y="10"/><rect class="ql-fill" height="1" width="3" x="3" y="12"/><rect class="ql-fill" height="1" width="3" x="12" y="5"/><rect class="ql-fill" height="1" width="3" x="12" y="7"/><rect class="ql-fill" height="1" width="3" x="12" y="10"/><rect class="ql-fill" height="1" width="3" x="12" y="12"/></svg>',gs={align:{"":Va,center:Ka,right:Ga,justify:Wa},background:Za,blockquote:Xa,bold:Ya,clean:Qa,code:jr,"code-block":jr,color:Ja,direction:{"":tc,rtl:ec},formula:sc,header:{1:nc,2:ic,3:rc,4:oc,5:lc,6:ac},italic:cc,image:uc,indent:{"+1":hc,"-1":dc},link:fc,list:{bullet:pc,check:mc,ordered:gc},script:{sub:bc,super:yc},strike:vc,table:Ec,underline:Nc,video:xc},Ac='<svg viewbox="0 0 18 18"><polygon class="ql-stroke" points="7 11 9 13 11 11 7 11"/><polygon class="ql-stroke" points="7 7 9 5 11 7 7 7"/></svg>';let Fr=0;function zr(i,t){i.setAttribute(t,`${i.getAttribute(t)!=="true"}`)}class En{constructor(t){this.select=t,this.container=document.createElement("span"),this.buildPicker(),this.select.style.display="none",this.select.parentNode.insertBefore(this.container,this.select),this.label.addEventListener("mousedown",()=>{this.togglePicker()}),this.label.addEventListener("keydown",e=>{switch(e.key){case"Enter":this.togglePicker();break;case"Escape":this.escape(),e.preventDefault();break}}),this.select.addEventListener("change",this.update.bind(this))}togglePicker(){this.container.classList.toggle("ql-expanded"),zr(this.label,"aria-expanded"),zr(this.options,"aria-hidden")}buildItem(t){const e=document.createElement("span");e.tabIndex="0",e.setAttribute("role","button"),e.classList.add("ql-picker-item");const s=t.getAttribute("value");return s&&e.setAttribute("data-value",s),t.textContent&&e.setAttribute("data-label",t.textContent),e.addEventListener("click",()=>{this.selectItem(e,!0)}),e.addEventListener("keydown",n=>{switch(n.key){case"Enter":this.selectItem(e,!0),n.preventDefault();break;case"Escape":this.escape(),n.preventDefault();break}}),e}buildLabel(){const t=document.createElement("span");return t.classList.add("ql-picker-label"),t.innerHTML=Ac,t.tabIndex="0",t.setAttribute("role","button"),t.setAttribute("aria-expanded","false"),this.container.appendChild(t),t}buildOptions(){const t=document.createElement("span");t.classList.add("ql-picker-options"),t.setAttribute("aria-hidden","true"),t.tabIndex="-1",t.id=`ql-picker-options-${Fr}`,Fr+=1,this.label.setAttribute("aria-controls",t.id),this.options=t,Array.from(this.select.options).forEach(e=>{const s=this.buildItem(e);t.appendChild(s),e.selected===!0&&this.selectItem(s)}),this.container.appendChild(t)}buildPicker(){Array.from(this.select.attributes).forEach(t=>{this.container.setAttribute(t.name,t.value)}),this.container.classList.add("ql-picker"),this.label=this.buildLabel(),this.buildOptions()}escape(){this.close(),setTimeout(()=>this.label.focus(),1)}close(){this.container.classList.remove("ql-expanded"),this.label.setAttribute("aria-expanded","false"),this.options.setAttribute("aria-hidden","true")}selectItem(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;const s=this.container.querySelector(".ql-selected");t!==s&&(s!=null&&s.classList.remove("ql-selected"),t!=null&&(t.classList.add("ql-selected"),this.select.selectedIndex=Array.from(t.parentNode.children).indexOf(t),t.hasAttribute("data-value")?this.label.setAttribute("data-value",t.getAttribute("data-value")):this.label.removeAttribute("data-value"),t.hasAttribute("data-label")?this.label.setAttribute("data-label",t.getAttribute("data-label")):this.label.removeAttribute("data-label"),e&&(this.select.dispatchEvent(new Event("change")),this.close())))}update(){let t;if(this.select.selectedIndex>-1){const s=this.container.querySelector(".ql-picker-options").children[this.select.selectedIndex];t=this.select.options[this.select.selectedIndex],this.selectItem(s)}else this.selectItem(null);const e=t!=null&&t!==this.select.querySelector("option[selected]");this.label.classList.toggle("ql-active",e)}}class So extends En{constructor(t,e){super(t),this.label.innerHTML=e,this.container.classList.add("ql-color-picker"),Array.from(this.container.querySelectorAll(".ql-picker-item")).slice(0,7).forEach(s=>{s.classList.add("ql-primary")})}buildItem(t){const e=super.buildItem(t);return e.style.backgroundColor=t.getAttribute("value")||"",e}selectItem(t,e){super.selectItem(t,e);const s=this.label.querySelector(".ql-color-label"),n=t&&t.getAttribute("data-value")||"";s&&(s.tagName==="line"?s.style.stroke=n:s.style.fill=n)}}class qo extends En{constructor(t,e){super(t),this.container.classList.add("ql-icon-picker"),Array.from(this.container.querySelectorAll(".ql-picker-item")).forEach(s=>{s.innerHTML=e[s.getAttribute("data-value")||""]}),this.defaultItem=this.container.querySelector(".ql-selected"),this.selectItem(this.defaultItem)}selectItem(t,e){super.selectItem(t,e);const s=t||this.defaultItem;if(s!=null){if(this.label.innerHTML===s.innerHTML)return;this.label.innerHTML=s.innerHTML}}}const Tc=i=>{const{overflowY:t}=getComputedStyle(i,null);return t!=="visible"&&t!=="clip"};class ko{constructor(t,e){this.quill=t,this.boundsContainer=e||document.body,this.root=t.addContainer("ql-tooltip"),this.root.innerHTML=this.constructor.TEMPLATE,Tc(this.quill.root)&&this.quill.root.addEventListener("scroll",()=>{this.root.style.marginTop=`${-1*this.quill.root.scrollTop}px`}),this.hide()}hide(){this.root.classList.add("ql-hidden")}position(t){const e=t.left+t.width/2-this.root.offsetWidth/2,s=t.bottom+this.quill.root.scrollTop;this.root.style.left=`${e}px`,this.root.style.top=`${s}px`,this.root.classList.remove("ql-flip");const n=this.boundsContainer.getBoundingClientRect(),r=this.root.getBoundingClientRect();let o=0;if(r.right>n.right&&(o=n.right-r.right,this.root.style.left=`${e+o}px`),r.left<n.left&&(o=n.left-r.left,this.root.style.left=`${e+o}px`),r.bottom>n.bottom){const a=r.bottom-r.top,c=t.bottom-t.top+a;this.root.style.top=`${s-c}px`,this.root.classList.add("ql-flip")}return o}show(){this.root.classList.remove("ql-editing"),this.root.classList.remove("ql-hidden")}}const wc=[!1,"center","right","justify"],Lc=["#000000","#e60000","#ff9900","#ffff00","#008a00","#0066cc","#9933ff","#ffffff","#facccc","#ffebcc","#ffffcc","#cce8cc","#cce0f5","#ebd6ff","#bbbbbb","#f06666","#ffc266","#ffff66","#66b966","#66a3e0","#c285ff","#888888","#a10000","#b26b00","#b2b200","#006100","#0047b2","#6b24b2","#444444","#5c0000","#663d00","#666600","#003700","#002966","#3d1466"],Cc=[!1,"serif","monospace"],Sc=["1","2","3",!1],qc=["small",!1,"large","huge"];class Es extends De{constructor(t,e){super(t,e);const s=n=>{if(!document.body.contains(t.root)){document.body.removeEventListener("click",s);return}this.tooltip!=null&&!this.tooltip.root.contains(n.target)&&document.activeElement!==this.tooltip.textbox&&!this.quill.hasFocus()&&this.tooltip.hide(),this.pickers!=null&&this.pickers.forEach(r=>{r.container.contains(n.target)||r.close()})};t.emitter.listenDOM("click",document.body,s)}addModule(t){const e=super.addModule(t);return t==="toolbar"&&this.extendToolbar(e),e}buildButtons(t,e){Array.from(t).forEach(s=>{(s.getAttribute("class")||"").split(/\s+/).forEach(r=>{if(r.startsWith("ql-")&&(r=r.slice(3),e[r]!=null))if(r==="direction")s.innerHTML=e[r][""]+e[r].rtl;else if(typeof e[r]=="string")s.innerHTML=e[r];else{const o=s.value||"";o!=null&&e[r][o]&&(s.innerHTML=e[r][o])}})})}buildPickers(t,e){this.pickers=Array.from(t).map(n=>{if(n.classList.contains("ql-align")&&(n.querySelector("option")==null&&ls(n,wc),typeof e.align=="object"))return new qo(n,e.align);if(n.classList.contains("ql-background")||n.classList.contains("ql-color")){const r=n.classList.contains("ql-background")?"background":"color";return n.querySelector("option")==null&&ls(n,Lc,r==="background"?"#ffffff":"#000000"),new So(n,e[r])}return n.querySelector("option")==null&&(n.classList.contains("ql-font")?ls(n,Cc):n.classList.contains("ql-header")?ls(n,Sc):n.classList.contains("ql-size")&&ls(n,qc)),new En(n)});const s=()=>{this.pickers.forEach(n=>{n.update()})};this.quill.on(L.events.EDITOR_CHANGE,s)}}Es.DEFAULTS=Xt({},De.DEFAULTS,{modules:{toolbar:{handlers:{formula(){this.quill.theme.tooltip.edit("formula")},image(){let i=this.container.querySelector("input.ql-image[type=file]");i==null&&(i=document.createElement("input"),i.setAttribute("type","file"),i.setAttribute("accept",this.quill.uploader.options.mimetypes.join(", ")),i.classList.add("ql-image"),i.addEventListener("change",()=>{const t=this.quill.getSelection(!0);this.quill.uploader.upload(t,i.files),i.value=""}),this.container.appendChild(i)),i.click()},video(){this.quill.theme.tooltip.edit("video")}}}}});class _o extends ko{constructor(t,e){super(t,e),this.textbox=this.root.querySelector('input[type="text"]'),this.listen()}listen(){this.textbox.addEventListener("keydown",t=>{t.key==="Enter"?(this.save(),t.preventDefault()):t.key==="Escape"&&(this.cancel(),t.preventDefault())})}cancel(){this.hide(),this.restoreFocus()}edit(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"link",e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;if(this.root.classList.remove("ql-hidden"),this.root.classList.add("ql-editing"),this.textbox==null)return;e!=null?this.textbox.value=e:t!==this.root.getAttribute("data-mode")&&(this.textbox.value="");const s=this.quill.getBounds(this.quill.selection.savedRange);s!=null&&this.position(s),this.textbox.select(),this.textbox.setAttribute("placeholder",this.textbox.getAttribute(`data-${t}`)||""),this.root.setAttribute("data-mode",t)}restoreFocus(){this.quill.focus({preventScroll:!0})}save(){let{value:t}=this.textbox;switch(this.root.getAttribute("data-mode")){case"link":{const{scrollTop:e}=this.quill.root;this.linkRange?(this.quill.formatText(this.linkRange,"link",t,L.sources.USER),delete this.linkRange):(this.restoreFocus(),this.quill.format("link",t,L.sources.USER)),this.quill.root.scrollTop=e;break}case"video":t=kc(t);case"formula":{if(!t)break;const e=this.quill.getSelection(!0);if(e!=null){const s=e.index+e.length;this.quill.insertEmbed(s,this.root.getAttribute("data-mode"),t,L.sources.USER),this.root.getAttribute("data-mode")==="formula"&&this.quill.insertText(s+1," ",L.sources.USER),this.quill.setSelection(s+2,L.sources.USER)}break}}this.textbox.value="",this.hide()}}function kc(i){let t=i.match(/^(?:(https?):\/\/)?(?:(?:www|m)\.)?youtube\.com\/watch.*v=([a-zA-Z0-9_-]+)/)||i.match(/^(?:(https?):\/\/)?(?:(?:www|m)\.)?youtu\.be\/([a-zA-Z0-9_-]+)/);return t?`${t[1]||"https"}://www.youtube.com/embed/${t[2]}?showinfo=0`:(t=i.match(/^(?:(https?):\/\/)?(?:www\.)?vimeo\.com\/(\d+)/))?`${t[1]||"https"}://player.vimeo.com/video/${t[2]}/`:i}function ls(i,t){let e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;t.forEach(s=>{const n=document.createElement("option");s===e?n.setAttribute("selected","selected"):n.setAttribute("value",String(s)),i.appendChild(n)})}const _c=[["bold","italic","link"],[{header:1},{header:2},"blockquote"]];class Io extends _o{constructor(t,e){super(t,e),this.quill.on(L.events.EDITOR_CHANGE,(s,n,r,o)=>{if(s===L.events.SELECTION_CHANGE)if(n!=null&&n.length>0&&o===L.sources.USER){this.show(),this.root.style.left="0px",this.root.style.width="",this.root.style.width=`${this.root.offsetWidth}px`;const a=this.quill.getLines(n.index,n.length);if(a.length===1){const c=this.quill.getBounds(n);c!=null&&this.position(c)}else{const c=a[a.length-1],h=this.quill.getIndex(c),d=Math.min(c.length()-1,n.index+n.length-h),g=this.quill.getBounds(new ce(h,d));g!=null&&this.position(g)}}else document.activeElement!==this.textbox&&this.quill.hasFocus()&&this.hide()})}listen(){super.listen(),this.root.querySelector(".ql-close").addEventListener("click",()=>{this.root.classList.remove("ql-editing")}),this.quill.on(L.events.SCROLL_OPTIMIZE,()=>{setTimeout(()=>{if(this.root.classList.contains("ql-hidden"))return;const t=this.quill.getSelection();if(t!=null){const e=this.quill.getBounds(t);e!=null&&this.position(e)}},1)})}cancel(){this.show()}position(t){const e=super.position(t),s=this.root.querySelector(".ql-tooltip-arrow");return s.style.marginLeft="",e!==0&&(s.style.marginLeft=`${-1*e-s.offsetWidth/2}px`),e}}w(Io,"TEMPLATE",['<span class="ql-tooltip-arrow"></span>','<div class="ql-tooltip-editor">','<input type="text" data-formula="e=mc^2" data-link="https://quilljs.com" data-video="Embed URL">','<a class="ql-close"></a>',"</div>"].join(""));class Oo extends Es{constructor(t,e){e.modules.toolbar!=null&&e.modules.toolbar.container==null&&(e.modules.toolbar.container=_c),super(t,e),this.quill.container.classList.add("ql-bubble")}extendToolbar(t){this.tooltip=new Io(this.quill,this.options.bounds),t.container!=null&&(this.tooltip.root.appendChild(t.container),this.buildButtons(t.container.querySelectorAll("button"),gs),this.buildPickers(t.container.querySelectorAll("select"),gs))}}Oo.DEFAULTS=Xt({},Es.DEFAULTS,{modules:{toolbar:{handlers:{link(i){i?this.quill.theme.tooltip.edit():this.quill.format("link",!1,y.sources.USER)}}}}});const Ic=[[{header:["1","2","3",!1]}],["bold","italic","underline","link"],[{list:"ordered"},{list:"bullet"}],["clean"]];class Ro extends _o{constructor(){super(...arguments);w(this,"preview",this.root.querySelector("a.ql-preview"))}listen(){super.listen(),this.root.querySelector("a.ql-action").addEventListener("click",e=>{this.root.classList.contains("ql-editing")?this.save():this.edit("link",this.preview.textContent),e.preventDefault()}),this.root.querySelector("a.ql-remove").addEventListener("click",e=>{if(this.linkRange!=null){const s=this.linkRange;this.restoreFocus(),this.quill.formatText(s,"link",!1,L.sources.USER),delete this.linkRange}e.preventDefault(),this.hide()}),this.quill.on(L.events.SELECTION_CHANGE,(e,s,n)=>{if(e!=null){if(e.length===0&&n===L.sources.USER){const[r,o]=this.quill.scroll.descendant(hn,e.index);if(r!=null){this.linkRange=new ce(e.index-o,r.length());const a=hn.formats(r.domNode);this.preview.textContent=a,this.preview.setAttribute("href",a),this.show();const c=this.quill.getBounds(this.linkRange);c!=null&&this.position(c);return}}else delete this.linkRange;this.hide()}})}show(){super.show(),this.root.removeAttribute("data-mode")}}w(Ro,"TEMPLATE",['<a class="ql-preview" rel="noopener noreferrer" target="_blank" href="about:blank"></a>','<input type="text" data-formula="e=mc^2" data-link="https://quilljs.com" data-video="Embed URL">','<a class="ql-action"></a>','<a class="ql-remove"></a>'].join(""));class Mo extends Es{constructor(t,e){e.modules.toolbar!=null&&e.modules.toolbar.container==null&&(e.modules.toolbar.container=Ic),super(t,e),this.quill.container.classList.add("ql-snow")}extendToolbar(t){t.container!=null&&(t.container.classList.add("ql-snow"),this.buildButtons(t.container.querySelectorAll("button"),gs),this.buildPickers(t.container.querySelectorAll("select"),gs),this.tooltip=new Ro(this.quill,this.options.bounds),t.container.querySelector(".ql-link")&&this.quill.keyboard.addBinding({key:"k",shortKey:!0},(e,s)=>{t.handlers.link.call(t,!s.format.link)}))}}Mo.DEFAULTS=Xt({},Es.DEFAULTS,{modules:{toolbar:{handlers:{link(i){if(i){const t=this.quill.getSelection();if(t==null||t.length===0)return;let e=this.quill.getText(t);/^\S+@\S+\.\S+$/.test(e)&&e.indexOf("mailto:")!==0&&(e=`mailto:${e}`);const{tooltip:s}=this.quill.theme;s.edit("link",e)}else this.quill.format("link",!1,y.sources.USER)}}}}});y.register({"attributors/attribute/direction":mo,"attributors/class/align":ho,"attributors/class/background":Wl,"attributors/class/color":Gl,"attributors/class/direction":go,"attributors/class/font":vo,"attributors/class/size":No,"attributors/style/align":fo,"attributors/style/background":tr,"attributors/style/color":Ji,"attributors/style/direction":bo,"attributors/style/font":Eo,"attributors/style/size":xo},!0);y.register({"formats/align":ho,"formats/direction":go,"formats/indent":$a,"formats/background":tr,"formats/color":Ji,"formats/font":vo,"formats/size":No,"formats/blockquote":Pi,"formats/code-block":J,"formats/header":$i,"formats/list":vs,"formats/bold":ms,"formats/code":er,"formats/italic":Ua,"formats/link":hn,"formats/script":Ui,"formats/strike":Hi,"formats/underline":ji,"formats/formula":on,"formats/image":Fi,"formats/video":ln,"modules/syntax":Co,"modules/table":ja,"modules/toolbar":or,"themes/bubble":Oo,"themes/snow":Mo,"ui/icons":gs,"ui/picker":En,"ui/icon-picker":qo,"ui/color-picker":So,"ui/tooltip":ko},!0);const Oc=(i,t,e)=>{const s=i;return Object.keys(t).forEach(n=>{-1<e.indexOf(n)?s.dataset[n]=t[n]:delete s.dataset[n]}),s},Vr=(i,t)=>t.reduce((e,s)=>{const n=i.lastIndexOf(s);return n>e.mentionCharIndex?{mentionChar:s,mentionCharIndex:n}:{mentionChar:e.mentionChar,mentionCharIndex:e.mentionCharIndex}},{mentionChar:null,mentionCharIndex:-1}),Rc=(i,t)=>t.test(i),Mc=(i,t,e)=>-1<i?!(e&&!(i===0||t[i-1].match(/\s/g))):!1,Bc=y.import("blots/embed");class Yt extends Bc{constructor(t,e){super(t,e),this.clickHandler=this.clickHandler.bind(this),e.addEventListener("click",this.clickHandler)}static getQuillInstance(t){let e=y.find(t);if(e){for(;e.parent;)e=e.parent;return e.domNode.parentNode?y.find(e.domNode.parentNode):null}}clickHandler(){const t=Yt.getQuillInstance(this.domNode),e=t.getModule("mention");if(e.currentBlot=this,e.currentNode=this.domNode,e.isOpen)return this.domNode.querySelector(".aioseo-tag .tag-toggle svg").classList.remove("rotated"),e.hideMentionList();this.domNode.querySelector(".aioseo-tag .tag-toggle svg").classList.add("rotated"),e.mentionCharPos=this.offset(t.scroll),e.options.source("",e.renderList.bind(e,this.domNode.dataset.denotationChar),this.domNode.dataset.denotationChar)}static create(t){const e=super.create(),s=document.createElement("span");if(s.className="ql-mention-denotation-char",s.innerHTML=t.denotationChar,e.appendChild(s),e.innerHTML+=t.value,t.custom&&t.customValue){let n=e.querySelector(".tag-custom");if(!n){n=document.createElement("span"),n.classList.add("tag-custom");const r=e.querySelector(".tag-name");r.parentNode.insertBefore(n,r.nextSibling)}n.innerHTML=" - "+(t.customValue||"")}return setTimeout(()=>{const n=Yt.getQuillInstance(e);if(n){const r=n.getModule("mention");r.currentNode=e}},0),Yt.setDataValues(e,t)}static setDataValues(t,e){const s=t;return Object.keys(e).forEach(n=>{s.dataset[n]=e[n]}),s}static value(t){return t.dataset}format(t,e){t==="customValue"&&e?this.domNode.dataset.customValue=e:super.format(t,e)}}Yt.blotName="mention";Yt.tagName="span";Yt.className="mention";y.register(Yt);const Y={TAB:"Tab",ENTER:"Enter",ESCAPE:"Escape",UP:"ArrowUp",DOWN:"ArrowDown",SPACE:" "};class Dc{constructor(t,e){this.isOpen=!1,this.itemIndex=0,this.mentionCharPos=null,this.cursorPos=null,this.values=[],this.suspendMouseEnter=!1,this.activeElement=null,this.currentBlot=null,this.currentNode=null,this.quill=t,this.silentInsert=!1,this.insertingCustomItem=!1,this.options={source:null,renderItem(a){return`${a.value}`},onSelect(a,c){c(a)},mentionDenotationChars:["@"],showDenotationChar:!0,allowedChars:/^[a-zA-Z0-9_]*$/,minChars:0,maxChars:1e3,offsetTop:2,offsetLeft:0,isolateCharacter:!1,fixMentionsToQuill:!1,defaultMenuOrientation:"bottom",dataAttributes:["id","value","denotationChar","link","target"],linkTarget:"_blank",onOpen(){return!0},onClose(){return!0},listItemClass:"ql-mention-list-item",mentionContainerClass:"ql-mention-list-container",mentionListClass:"ql-mention-list",spaceAfterInsert:!0,selectKeys:[Y.ENTER]},Object.assign(this.options,e,{dataAttributes:Array.isArray(e.dataAttributes)?this.options.dataAttributes.concat(e.dataAttributes):this.options.dataAttributes}),this.mentionContainer=document.createElement("div"),this.mentionContainer.className=this.options.mentionContainerClass?this.options.mentionContainerClass:"",this.mentionContainer.style.cssText="display: none; position: absolute;",this.mentionContainer.onmousemove=this.onContainerMouseMove.bind(this),this.options.fixMentionsToQuill&&(this.mentionContainer.style.width="auto"),this.customFieldInput=document.createElement("div"),this.customFieldInput.className=this.options.mentionPrependClassCustom?this.options.mentionPrependClassCustom:"",this.customFieldInput.innerHTML=this.options.customFieldInput||"",this.mentionContainer.appendChild(this.customFieldInput),this.mentionSearch=document.createElement("div"),this.mentionSearch.className=this.options.mentionPrependClass?this.options.mentionPrependClass:"",this.mentionSearch.innerHTML=this.options.prependMentionList||"",this.mentionContainer.appendChild(this.mentionSearch);const s=this.mentionSearch.querySelector(".aioseo-trash");s&&s.addEventListener("click",()=>{this.currentBlot.remove(),this.hideMentionList(),this.removeOrphanedMentionChar()}),this.customFieldInput.addEventListener("click",a=>{this.activeElement=a.target;const c=a.target.querySelector("input");c&&setTimeout(()=>{c.focus()},0)});const n=this.customFieldInput.querySelector("input");n&&n.addEventListener("input",a=>{if(this.currentNode){let c=this.currentNode.querySelector(".tag-custom");if(!c){c=document.createElement("span"),c.classList.add("tag-custom");const h=this.currentNode.querySelector(".tag-name");h.parentNode.insertBefore(c,h.nextSibling)}c.innerHTML=a.target.value?" - "+a.target.value:"",this.currentBlot=y.find(this.currentNode),this.currentBlot.format("customValue",a.target.value)}}),this.customFieldInput.addEventListener("keydown",a=>{Y.ENTER===a.key&&(this.hideMentionList(),this.removeOrphanedMentionChar(),a.preventDefault()),Y.ESCAPE===a.key&&(this.hideMentionList(),this.removeOrphanedMentionChar()),Y.SPACE===a.key&&a.preventDefault()}),this.mentionSearch.addEventListener("click",a=>{this.activeElement=a.target}),this.mentionSearch.addEventListener("keydown",a=>{Y.DOWN===a.key&&this.nextItem(),Y.UP===a.key&&this.prevItem(),Y.ENTER===a.key&&(this.selectItem(),a.preventDefault()),Y.ESCAPE===a.key&&this.hideMentionList()});const r=this.mentionSearch.querySelector("input");r&&r.addEventListener("input",a=>{const c=this.getTextBeforeCursor(),{mentionChar:h}=Vr(c,this.options.mentionDenotationChars);if(!h&&!this.currentBlot)return;const d=h||this.currentBlot.domNode.dataset.denotationChar;this.options.source(a.target.value,this.renderList.bind(this,d),d)}),this.mentionList=document.createElement("ul"),this.mentionList.id="quill-mention-list",t.root.setAttribute("aria-owns","quill-mention-list"),this.mentionList.className=this.options.mentionListClass?this.options.mentionListClass:"",this.mentionContainer.appendChild(this.mentionList);const o=document.createElement("div");o.className="aioseo-documentation-link",o.innerHTML=this.options.documentationDiv||"",o.addEventListener("click",a=>{this.activeElement=a.target}),this.mentionContainer.appendChild(o),this.quill.container.appendChild(this.mentionContainer),t.on("text-change",this.onTextChange.bind(this)),t.on("selection-change",this.onSelectionChange.bind(this)),t.container.addEventListener("paste",()=>{setTimeout(()=>{const a=t.getSelection();this.onSelectionChange(a)})}),t.keyboard.addBinding({key:Y.TAB},this.selectHandler.bind(this)),t.keyboard.bindings[Y.TAB].unshift(t.keyboard.bindings[Y.TAB].pop());for(const a of this.options.selectKeys??[])t.keyboard.addBinding({key:a},this.selectHandler.bind(this));t.keyboard.bindings[Y.ENTER].unshift(t.keyboard.bindings[Y.ENTER].pop()),t.keyboard.addBinding({key:Y.ESCAPE},this.escapeHandler.bind(this)),t.keyboard.addBinding({key:Y.UP},this.upHandler.bind(this)),t.keyboard.addBinding({key:Y.DOWN},this.downHandler.bind(this)),t.clipboard.addMatcher(Node.TEXT_NODE,this.clipboardHandler.bind(this))}selectHandler(){return this.isOpen?(this.selectItem(),!1):!0}escapeHandler(){return this.isOpen?(this.hideMentionList(),this.removeOrphanedMentionChar(),!1):!0}removeOrphanedMentionChar(t=!1){let e=!1;!t&&!this.quill.hasFocus()&&(this.quill.focus(),e=!0);const s=this.getTextBeforeCursor();s.charAt(s.length-1)==="#"&&this.quill.deleteText(this.quill.getSelection().index-1,1,y.sources.USER),e&&this.quill.blur()}upHandler(){return this.isOpen?(this.prevItem(),!1):!0}downHandler(){return this.isOpen?(this.nextItem(),!1):!0}clipboardHandler(t,e){if(typeof t.data!="string")return;const s=new RegExp(`${this.options.mentionDenotationChars.join("|")}[A-Za-z_-]+`,"g"),n=t.data.match(s);if(n&&0<n.length){const r=[];let o=t.data;this.mentionCharPos=0,n.forEach(a=>{const c=a.charAt(0),h=a.substr(1).split("-"),d=h[0];delete h[0];const g=h.filter(N=>N).join("-"),p=this.options.source(d,this.renderList.bind(this,c),c,!0,g||null);if(!p)return;const m={denotationChar:this.options.showDenotationChar?c:"",...p};g!==void 0&&(m.customValue=g);const b=o.split(a),E=b.shift();r.push({insert:E}),r.push({insert:{mention:m}}),o=b.join(a)}),r.push({insert:o}),e.ops=r}return e}showMentionList(){if(this.mentionContainer.style.visibility="hidden",this.mentionContainer.style.display="",this.setMentionContainerPosition(),this.customFieldInput.style.display="none",this.currentNode&&this.currentNode.dataset.custom){this.customFieldInput.style.display="block";const e=this.customFieldInput&&this.customFieldInput.querySelector("input"),s=this.currentNode.querySelector(".tag-custom");e&&s&&(e.value=s.innerHTML.replace(" - ","").trim())}const t=this.mentionSearch.querySelector(".aioseo-trash");t&&(t.style.display="block",this.currentBlot||(t.style.display="none")),this.setIsOpen(!0)}hideMentionList(){document.querySelectorAll(".aioseo-tag .tag-toggle svg").forEach(n=>{n.classList.remove("rotated")});const e=this.mentionSearch&&this.mentionSearch.querySelector("input");e&&(e.value="");const s=this.customFieldInput&&this.customFieldInput.querySelector("input");s&&(s.value=""),this.currentBlot=null,this.currentNode=null,this.mentionContainer.style.display="none",this.setIsOpen(!1)}highlightItem(t=!0){if(!this.mentionList.childNodes[this.itemIndex])return;for(let s=0;s<this.mentionList.childNodes.length;s+=1){const n=this.mentionList.childNodes[s];n instanceof HTMLElement&&n.classList.remove("selected")}const e=this.mentionList.childNodes[this.itemIndex];if(!(this.itemIndex===-1||e.dataset.disabled==="true")&&(e.classList.add("selected"),this.quill.root.setAttribute("aria-activedescendant",e.id),t)){const s=e.offsetHeight,n=e.offsetTop-this.mentionSearch.offsetHeight,r=this.mentionList.scrollTop,o=r+this.mentionList.offsetHeight;n<r?this.mentionList.scrollTop=n:n>o-s&&(this.mentionList.scrollTop+=n-o+s)}}getItemData(){const{link:t}=this.mentionList.childNodes[this.itemIndex].dataset,e=typeof t<"u",s=this.mentionList.childNodes[this.itemIndex].dataset.target;return e&&(this.mentionList.childNodes[this.itemIndex].dataset.value=`<a href="${t}" target=${s||this.options.linkTarget}>${this.mentionList.childNodes[this.itemIndex].dataset.value}`),this.mentionList.childNodes[this.itemIndex].dataset}onContainerMouseMove(){this.suspendMouseEnter=!1}selectItem(){const t=this.getItemData();if(!t.id)return this.hideMentionList();this.options.onSelect(t,e=>{this.insertItem(e)}),t.custom||this.hideMentionList()}insertItem(t){const e=t;if(e===null)return;this.options.showDenotationChar||(e.denotationChar=""),t.custom&&(this.insertingCustomItem=!0,setTimeout(()=>{this.insertingCustomItem=!1},50),this.customFieldInput.style.display="block",this.customFieldInput.click());const s=this.mentionCharPos;this.quill.deleteText(this.mentionCharPos,this.cursorPos-this.mentionCharPos,y.sources.USER),this.quill.insertEmbed(s,"mention",e,y.sources.USER),this.options.spaceAfterInsert?(this.quill.insertText(s+1," ",y.sources.USER),this.quill.setSelection(s+2,y.sources.USER)):this.quill.setSelection(s+1,y.sources.USER),t.custom||this.hideMentionList()}onItemMouseEnter(t){if(this.suspendMouseEnter)return;const e=Number(t.target.dataset.index);!Number.isNaN(e)&&e!==this.itemIndex&&(this.itemIndex=e,this.highlightItem(!1))}onItemClick(t){t.preventDefault(),t.stopImmediatePropagation(),this.itemIndex=t.currentTarget.dataset.index,this.highlightItem(),this.selectItem()}renderList(t,e,s,n=!1,r=!1){if(this.mentionList.innerHTML="",e&&0<e.length){if(this.values=e,this.values.length===1&&(this.values[0].name===s||this.values[0].id===s)){if(n)return this.values[0];this.insertItem(this.values[0]);return}else if(n){const o=this.values.find(a=>a.name===s||a.id===s);if(o)return o}else if(r){const o=this.values.find(a=>a.name===s||a.id===s);o&&this.insertItem(o)}for(let o=0;o<e.length;o+=1){const a=document.createElement("li");a.className=this.options.listItemClass?this.options.listItemClass:"",a.dataset.index=o,a.innerHTML=this.options.renderItem(e[o],s),a.onmouseenter=this.onItemMouseEnter.bind(this),a.dataset.denotationChar=t,a.onclick=this.onItemClick.bind(this),this.mentionList.appendChild(Oc(a,e[o],this.options.dataAttributes))}this.itemIndex=0,this.highlightItem()}else{const o=document.createElement("li");o.className=this.options.listItemClassNoMatch?this.options.listItemClassNoMatch:"",o.innerHTML=this.options.renderItemNoMatch(),this.mentionList.appendChild(o)}this.showMentionList()}nextItem(){this.itemIndex=(this.itemIndex+1)%this.values.length,this.suspendMouseEnter=!0,this.highlightItem()}prevItem(){this.itemIndex=(this.itemIndex+this.values.length-1)%this.values.length,this.suspendMouseEnter=!0,this.highlightItem()}containerBottomIsNotVisible(){return this.mentionContainer.getBoundingClientRect().bottom>window.innerHeight}containerRightIsNotVisible(t,e){return this.options.fixMentionsToQuill?!1:e.width<t+this.mentionContainer.offsetWidth}setIsOpen(t){this.isOpen!==t&&(t?this.options.onOpen():this.options.onClose(),this.isOpen=t)}setMentionContainerPosition(){const t=this.quill.container.getBoundingClientRect(),e=this.quill.getBounds(this.mentionCharPos),s=this.mentionContainer.offsetHeight;let n=this.options.offsetTop,r=this.options.offsetLeft;if(this.options.fixMentionsToQuill?this.mentionContainer.style.right="0px":r+=e.left,this.containerRightIsNotVisible(r,t)){const o=this.mentionContainer.offsetWidth+this.options.offsetLeft;r=t.width-o}if(this.options.defaultMenuOrientation==="top"){if(this.options.fixMentionsToQuill?n=-1*(s+this.options.offsetTop):n=e.top-(s+this.options.offsetTop),0>=n+t.top){let o=this.options.offsetTop;this.options.fixMentionsToQuill?o+=t.height:o+=e.bottom,n=o}}else if(this.options.fixMentionsToQuill?n+=t.height:n+=e.bottom,this.containerBottomIsNotVisible(n,t)){let o=this.options.offsetTop*-1;this.options.fixMentionsToQuill||(o+=e.top),n=o-s}0<=n?this.options.mentionContainerClass.split(" ").forEach(o=>{this.mentionContainer.classList.add(`${o}-bottom`),this.mentionContainer.classList.remove(`${o}-top`)}):this.options.mentionContainerClass.split(" ").forEach(o=>{this.mentionContainer.classList.add(`${o}-top`),this.mentionContainer.classList.remove(`${o}-bottom`)}),this.mentionContainer.style.top=`${n}px`,this.mentionContainer.style.left=`${r}px`,this.mentionContainer.style.visibility="visible"}getTextBeforeCursor(){const t=Math.max(0,(this.cursorPos??0)-this.options.maxChars);return this.quill.getText(t,(this.cursorPos??0)-t)}onSomethingChange(){const t=this.quill.getSelection();if(t===null||this.insertingCustomItem)return;this.cursorPos=t.index;const e=this.getTextBeforeCursor(),{mentionChar:s,mentionCharIndex:n}=Vr(e,this.options.mentionDenotationChars);if(Mc(n,e,this.options.isolateCharacter)){const r=this.cursorPos-(e.length-n);this.mentionCharPos=r;const o=e.substring(n+s.length);o.length>=this.options.minChars&&Rc(o,this.options.allowedChars)?this.options.source(o,this.renderList.bind(this,s),s):this.hideMentionList()}else this.hideMentionList()}onTextChange(t,e,s){s==="user"&&setTimeout(this.onSomethingChange.bind(this),0)}onSelectionChange(t){t&&t.length===0?this.onSomethingChange():setTimeout(()=>{this.activeElement?this.activeElement.classList.contains("aioseo-tag-custom")||(this.activeElement=null):this.hideMentionList.bind(this)},0)}}y.register("modules/mention",Dc);const Pc=y.import("modules/toolbar");class Bo extends Pc{}Bo.DEFAULTS.handlers.autoLink=function(){const i=this.quill.getSelection(),t=this.quill.getModule("autoLink"),e=this.quill.getContents();e.ops.forEach(s=>{var n;(n=s==null?void 0:s.attributes)!=null&&n.link&&delete s.attributes.link}),this.quill.setContents(e,y.sources.SILENT),this.quill.setSelection(i,y.sources.SILENT),this.quill.format("link",t.options.url,y.sources.USER)};y.register("modules/toolbar",Bo,!0);class $c{constructor(t,e){this.quill=t,this.options=e,this.container=document.querySelector(e.container)}}y.register("modules/autoLink",$c,!0);class Uc{constructor(t,e){this.quill=t,this.options=e,this.container=document.querySelector(e.container),t.on("text-change",this.update.bind(this)),this.update()}calculate(){let t=this.quill.getText()?this.quill.root.innerHTML:"";const e=document.createRange().createContextualFragment(t),s=document.createRange().createContextualFragment("");e.childNodes.forEach(r=>{if(r.tagName!=="P")return;r.childNodes.forEach(a=>{if(a.nodeType===3){s.appendChild(a.cloneNode(!0));return}if(a.tagName==="SPAN"){const c=a.querySelector(".aioseo-tag .tag-name");if(c){const h=this.options.tags.find(p=>p.name===c.textContent),d=typeof h.valueText=="string"?hr.decode(h.valueText):h.valueText,g=document.createTextNode(d);s.appendChild(g)}}});const o=document.createElement("br");s.appendChild(o)}),s.normalize();const n=document.createElement("div");return n.appendChild(s.cloneNode(!0)),t=n.innerHTML.replace(/ /gi," ").replace(/<br\s*[/]?>/gi,this.single?"":` `).trim(),{length:hr.decode(t).length,text:t}}update(){const{length:t}=this.calculate();let e=this.options.unit;t!==1&&(e+="s"),this.container&&(this.container.innerText=t+" "+e)}}y.register("modules/counter",Uc);const Hc=y.import("modules/clipboard"),jc=y.import("delta");class Fc extends Hc{onPaste(t,{html:e,text:s}){const n=this.options,r=this.quill.getFormat(t.index),o=this.convert({text:s,html:e},r),a=new jc().retain(t.index).delete(t.length).concat(o);n.newLines===!1&&a.ops.map(function(c){return typeof c.insert=="string"&&(c.insert=c.insert.replace(/(\r\n|\n|\r)/gm," ")),c}),this.quill.updateContents(a,y.sources.USER),this.quill.setSelection(a.length()-t.length,y.sources.SILENT),this.quill.scrollSelectionIntoView()}convert({html:t,text:e}){return typeof t=="string"&&(t=t.replace(/>\r?\n +</g,"><")),super.convert({html:t,text:e})}}y.register("modules/clipboard",Fc,!0);class zc{constructor(t,e){this.quill=t,this.options={defaultLength:1,...e},this.container=e.container,t.on("text-change",this.update.bind(this)),this.update()}update(){for(;this.container.firstChild;)this.container.removeChild(this.container.firstChild);const t=this.quill.getLines();if(this.options.defaultLength>t.length)for(let n=t.length;this.options.defaultLength>n;n++)t.push({});let e=0;for(let n=0;n<t.length;n++){const r=t[n].domNode?t[n].domNode.offsetHeight:25,o=document.createElement("div");o.style.minHeight=`${r}px`,o.innerHTML=n+1,this.container.appendChild(o),e+=r}const s=this.quill.container.querySelector(".ql-editor");if(s){const n=window.getComputedStyle(s);s.style.minHeight=`${e+parseInt(n.getPropertyValue("padding-top"))+parseInt(n.getPropertyValue("padding-bottom"))}px`}}}y.register("modules/lineNumbers",zc,!0);const lr=(i,t,e)=>(i.forEach(s=>{e[s]&&t.setAttribute(s,e[s]),s==="data-*"&&Object.keys(e).forEach(n=>{n.indexOf("data-")===0&&t.setAttribute(n,e[n])})}),t),ar=(i,t)=>i.reduce((e,s)=>(t.hasAttribute(s)&&(e[s]=t.getAttribute(s)),s==="data-*"&&Object.keys(t.dataset).forEach(n=>{n="data-"+n.replace(/[A-Z]/g,r=>`-${r.toLowerCase()}`),e[n]=t.getAttribute(n)}),e),{}),Vc=y.import("formats/link"),wi=["href","rel","target","class","data-*","style"];class Do extends Vc{static create(t){typeof t=="string"&&(t=this.linkAttributesCache);const e=lr(wi,super.create(t),t);return wi.forEach(s=>{s==="href"&&(t[s]=this.sanitize(t[s]),e.setAttribute(s,t[s]))}),this.linkAttributesCache=t,e}static formats(t){return ar(wi,t)}}w(Do,"linkAttributesCache",{});y.register("formats/link",Do,!0);const dn=["style","class","data-*"],Kc=y.import("blots/inline");class cr extends Kc{static create(t){return lr(dn,super.create(t),t)}static formats(t){return ar(dn,t)}}cr.blotName="aioseoInline";cr.tagName="aioseo-inline";y.register("formats/aioseoInline",cr,!0);const Gc=y.import("formats/italic");class Wc extends Gc{static create(t){return lr(dn,super.create(t),t)}static formats(t){return ar(dn,t)}}y.register("formats/italic",Wc,!0);class Zc{constructor(t,e){this.quill=t,this.options=e,this.preserveWhitespace=e.preserveWhitespace||!1,t.clipboard.addMatcher(Node.TEXT_NODE,this.clipboardHandler.bind(this)),t.container.style.whiteSpace="pre-line"}clipboardHandler(t,e){if(t.data.match(/^\t/)&&this.preserveWhitespace){const s=y.import("delta");return new s().insert(t.data)}return e}}y.register("modules/preserveWhiteSpace",Zc);const Xc={},Yc={viewBox:"0 0 10 11",fill:"none",xmlns:"http://www.w3.org/2000/svg",class:"aioseo-plus"},Qc=et("path",{d:"M6 0.00115967H4V4.00116H0V6.00116H4V10.0012H6V6.00116H10V4.00116H6V0.00115967Z",fill:"currentColor"},null,-1),Jc=[Qc];function tu(i,t){return Vt(),Kt("svg",Yc,Jc)}const eu=Wr(Xc,[["render",tu]]),nn="all-in-one-seo-pack",R=[],su={emits:["counter","selection-change","updateEditor","focus","blur","update:modelValue","paste"],setup(){return{postEditorStore:Ho(),tagsStore:Kr(),links:jo}},components:{BaseInput:zo,SvgCaret:Ko,SvgPlus:eu,SvgTrash:Vo},props:{modelValue:{type:String,default:""},minimumLineNumbers:{type:Number,default(){return 5}},single:Boolean,lineNumbers:Boolean,allowTags:Boolean,disabled:Boolean,tagsContext:String,forceUpdates:Boolean,monospace:Boolean,defaultMenuOrientation:String,description:Boolean,showToolbar:Boolean,preserveWhitespace:Boolean,autoLink:{type:[Object,Boolean],default(){return!1}}},data(){return{tags:pr,localTags:[],quill:null,html:"",insertExact:!1,cachedPhrase:"",strings:{searchPlaceholder:kt("Search for an item...",nn),enterCustomFieldName:kt("Enter a custom field/taxonomy name...",nn),learnMoreSmartTags:kt("Learn more about Smart Tags",nn),removeSmartTag:kt("Remove Smart Tag",nn)}}},watch:{disabled(){this.disabled?R[this.$.uid].disable():R[this.$.uid].enable()},modelValue(){this.forceUpdates&&this.startup(!0)},"tagsStore.liveTags":{deep:!0,handler(){this.localTags=this.getTags();const i=R[this.$.uid].getModule("counter");i&&(i.options.tags=this.localTags,this.$emit("counter",i.calculate()))}},tags:{deep:!0,handler(){const i=this.getTags();JSON.stringify(this.localTags)!==JSON.stringify(i)&&(this.localTags=i,this.startup(!0))}}},methods:{emitPasteEvent(i){this.$emit("paste",i)},getTags(){return(this.tagsContext?[...pr.context(this.tagsContext)]:[...this.tagsStore.tags].filter(t=>!t.deprecated)).map((t,e)=>{const s=this.postEditorStore.currentPost&&this.tagsStore.liveTags[t.id]||t.value;return{...t,valueText:s,value:this.$refs["select-template"][e]?this.$refs["select-template"][e].innerHTML:"",menuHtml:this.$refs["menu-template"][e]?this.$refs["menu-template"][e].innerHTML:""}})},update(){if(this.allowTags){const n=R[this.$.uid].getModule("counter");this.$emit("counter",n.calculate())}let i=R[this.$.uid].getText()?R[this.$.uid].root.innerHTML:"";const t=document.createRange().createContextualFragment(i),e=document.createRange().createContextualFragment("");t.childNodes.forEach(n=>{if(n.tagName!=="P")return;n.childNodes.forEach(o=>{if(o.nodeType===3){e.appendChild(o.cloneNode(!0));return}if(o.tagName==="SPAN"&&this.allowTags){const a=o.querySelector(".aioseo-tag");if(a){const c=a.querySelector(".tag-name");if(c){const h=this.localTags.find(g=>g.name===c.textContent);if(h.custom){const g=a.querySelector(".tag-custom");if(g){const p=document.createTextNode(`#${h.id}-${g.innerHTML.replace(" - ","")}`);e.appendChild(p);return}}const d=document.createTextNode(`#${h.id}`);e.appendChild(d)}}}});const r=document.createElement("br");e.appendChild(r)}),e.normalize();const s=document.createElement("div");s.appendChild(e.cloneNode(!0)),i=s.innerHTML.replace(/<br\s*[/]?>/gi,this.single?"":` `).trim(),i=i.replace(/ /gi," ").trim(),this.$emit("update:modelValue",i)},insertToCursor(i){R[this.$.uid].focus(),R[this.$.uid].insertText(R[this.$.uid].getSelection().index,i,y.sources.USER),R[this.$.uid].setSelection(R[this.$.uid].getSelection().index+i.length,y.sources.USER)},insertTag(i){const t=R[this.$.uid].getModule("mention");t.removeOrphanedMentionChar();const e=t.getTextBeforeCursor();this.insertExact=!0;const s=i?this.localTags.find(o=>o.id===i):null;let n=s?`#${s.id}`:e.charAt(e.length-1)==="#"?"":"#";const r=R[this.$.uid].getContents(0,t.cursorPos);r.ops.length&&(typeof r.ops.pop().insert!="string"||!e.match(/\s$/))&&(n=" "+n),R[this.$.uid].focus(),i&&t.removeOrphanedMentionChar(),R[this.$.uid].insertText(R[this.$.uid].getSelection().index,n,y.sources.USER),R[this.$.uid].setSelection(R[this.$.uid].getSelection().index+n.length,y.sources.USER),this.insertExact=!1,i?t.hideMentionList():setTimeout(()=>{t.mentionCharPos=R[this.$.uid].getSelection().index-1,t.silentInsert=!0,t.showMentionList()},0)},maybeCloseMenu(i){const t=i.target;if(t.classList.contains("aioseo-tag")||t.closest(".aioseo-tag")||t.closest(".add-tags"))return;if(t.classList.contains("ql-mention-list-container")||t.closest(".ql-mention-list-container")){const s=t.classList.contains("prepend-icon")?t:t.closest(".prepend-icon");s&&s.nextSibling.focus();return}const e=R[this.$.uid].getModule("mention");e.isOpen&&(e.hideMentionList(),e.removeOrphanedMentionChar())},async startup(i=!1){if(this.allowTags&&!this.$refs["tag-search"])return;R[this.$.uid]=this.startQuill(),i&&R[this.$.uid].setText("");let t=this.modelValue;t&&t.length&&t.match(/#[^\s]*$/)&&(t=t.trim()+" "),t=t&&(this.single?t.replace(` `," "):"<p>"+t.split(` `).map(n=>n===""?"<br>":n).join("</p><p>")+"</p>");const e=R[this.$.uid].clipboard.convert({html:t,text:""});R[this.$.uid].setContents(e);const s=R[this.$.uid].getModule("mention");if(s&&s.removeOrphanedMentionChar(!0),this.allowTags){const n=R[this.$.uid].getModule("counter");this.$emit("counter",n.calculate())}this.removeTrailingNewLine(),await this.$nextTick(),R[this.$.uid].on("text-change",()=>this.update()),R[this.$.uid].on("selection-change",(n,r,o)=>{o==="api"&&this.update(),n?this.$emit("focus",R[this.$.uid]):this.$emit("blur",R[this.$.uid]),this.$emit("selection-change",{range:n,oldRange:r,source:o})}),document.addEventListener("click",this.maybeCloseMenu),this.disabled&&R[this.$.uid].disable(),i||R[this.$.uid].history.clear()},startQuill(){return new y(this.$refs.quill,{modules:{toolbar:this.showToolbar?["bold","italic","underline","autoLink"]:[],lineNumbers:this.lineNumbers?{container:this.$refs["line-numbers"],defaultLength:this.minimumLineNumbers}:null,mention:this.allowTags?{defaultMenuOrientation:this.defaultMenuOrientation||"bottom",dataAttributes:["id","value","denotationChar","link","target","custom","customValue"],allowedChars:/^[A-Za-z\s_]*$/,mentionDenotationChars:["#"],spaceAfterInsert:!0,mentionPrependClass:"aioseo-tag-search",mentionPrependClassCustom:"aioseo-tag-custom",prependMentionList:this.$refs["tag-search"].innerHTML,customFieldInput:this.$refs["tag-custom"].innerHTML,documentationDiv:this.$refs["documentation-div"].innerHTML,listItemClassNoMatch:"aioseo-tag-no-match",renderItemNoMatch(){return"No matches found"},renderItem(i){return`${i.menuHtml}`},source:(i,t,e,s=!1,n="")=>{const r=[...this.localTags];if(r[0].custom&&(r[0].customValue=n),i.length===0)return t(r,i,s,this.insertExact);const o=[];for(let a=0;a<r.length;a++)(~r[a].name.toLowerCase().indexOf(i.toLowerCase())||~r[a].id.toLowerCase().indexOf(i.toLowerCase()))&&o.push(r[a]);return t(o,i,s,this.insertExact)}}:{},counter:this.allowTags?{tags:this.localTags}:null,clipboard:{newLines:!this.single},autoLink:{enabled:!!this.autoLink,...this.autoLink},keyboard:{bindings:{enter:{key:13,handler:()=>!this.single}}},preserveWhiteSpace:this.preserveWhitespace},theme:"snow",formats:this.showToolbar?["bold","underline","italic","link","list","aioseoInline"]:["mention"]})},setPhrase(i){this.cachedPhrase=i,i=Jo(i),i=i.replace(/<span([^>]*)>/g,"<aioseo-inline$1>").replace(/<\/span>/g,"</aioseo-inline>");const t=R[this.$.uid].clipboard.convert({html:i,text:""});R[this.$.uid].setContents(t)},getPhrase(){return R[this.$.uid].getText()},getPhraseWithFormats(){return R[this.$.uid].getContents()},getPhraseHtml(){let i=R[this.$.uid].root.childNodes[0].innerHTML;return i=i.replace(/<aioseo-inline([^>]*)>/g,"<span$1>").replace(/<\/aioseo-inline>/g,"</span>"),i=tl(this.cachedPhrase,i),i},removeTrailingNewLine(){const i=document.querySelector(".aioseo-editor-description .ql-editor");this.description&&i&&(i.innerHTML=i.innerHTML.replace(/<p><br><\/p>$/i,""))}},mounted(){this.localTags=this.getTags(),this.startup(!0),this.tagsContext&&window.aioseoBus.$on("updateEditor"+this.tagsContext,i=>{i!==this.$.uid&&this.startup(!0)})},beforeUnmount(){document.removeEventListener("click",this.maybeCloseMenu)},unmounted(){this.tagsContext&&window.aioseoBus.$emit("updateEditor"+this.tagsContext,this.$.uid)}},nu={class:"aioseo-editor"},iu={key:0,ref:"line-numbers",class:"aioseo-line-numbers"},ru={key:1,class:"aioseo-append-icon"},ou={key:2,class:"aioseo-append-button"},lu={class:"aioseo-tag"},au={class:"tag-name"},cu={key:0,class:"tag-custom"},uu={class:"tag-toggle"},hu={class:"aioseo-tag-item"},du={class:"aioseo-tag-title"},fu={class:"aioseo-tag-description"},pu={ref:"tag-search"},mu={ref:"tag-custom"},gu=["innerHTML"];function bu(i,t,e,s,n,r){const o=Zs("svg-caret"),a=Zs("svg-plus"),c=Zs("base-input"),h=Zs("svg-trash");return Vt(),Kt("div",nu,[et("div",{class:Go([{"aioseo-editor-line-numbers":e.lineNumbers},{"aioseo-editor-single":e.single},{"aioseo-editor-monospace":e.monospace},{"aioseo-editor-description":e.description}]),ref:"quill",onPaste:t[0]||(t[0]=(...d)=>r.emitPasteEvent&&r.emitPasteEvent(...d))},null,34),e.lineNumbers?(Vt(),Kt("div",iu,null,512)):Xs("",!0),i.$slots["append-icon"]?(Vt(),Kt("div",ru,[dr(i.$slots,"append-icon")])):Xs("",!0),i.$slots["append-button"]?(Vt(),Kt("div",ou,[dr(i.$slots,"append-button")])):Xs("",!0),(Vt(!0),Kt(fr,null,Wo(n.tags.context(e.tagsContext),(d,g)=>(Vt(),Kt(fr,{key:g},[is(et("div",{ref_for:!0,ref:"select-template"},[et("span",lu,[et("span",au,Ys(d.name),1),d.custom&&d.customValue?(Vt(),Kt("span",cu," - "+Ys(d.customValue),1)):Xs("",!0),et("span",uu,[rs(o)])])],512),[[os,!1]]),is(et("div",{ref_for:!0,ref:"menu-template"},[et("div",hu,[et("div",null,[rs(a)]),et("div",null,[et("div",du,Ys(d.name),1),et("div",fu,Ys(d.description),1)])])],512),[[os,!1]])],64))),128)),is(et("div",pu,[rs(c,{size:"medium",placeholder:n.strings.searchPlaceholder,prependIcon:"search"},null,8,["placeholder"]),rs(h)],512),[[os,!1]]),is(et("div",mu,[rs(c,{size:"small",placeholder:n.strings.enterCustomFieldName},null,8,["placeholder"])],512),[[os,!1]]),is(et("div",{ref:"documentation-div",innerHTML:s.links.getDocLink(n.strings.learnMoreSmartTags,"smartTags",!0)},null,8,gu),[[os,!1]])])}const Pu=Wr(su,[["render",bu]]);export{Pu as B,eu as S,pr as t};