var pl=Object.defineProperty;var gl=(r,t,e)=>t in r?pl(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;var _=(r,t,e)=>gl(r,typeof t!="symbol"?t+"":t,e);import{a as ml,aH as bl,r as as,_ as yl,w as vl,q as El,t as Wr,Z as Nl,aj as At,c as Al,o as wl,b as wt,S as q,K as z,u as xl,P as Yr}from"./vue.D1BjjNmv.js";import{G as Tl,A as ql,a as Ll}from"./api.BPoYYshf.js";import{c as Xt,g as Li,a8 as Cr,a9 as Ie,aa as te,E as ue,S as _l}from"./index.DCbCfEtC.js";import{g as Sl}from"./pcaData.5HEg6BqW.js";import{_ as kl}from"./_plugin-vue_export-helper.DlAUqK2U.js";var R=(r=>(r[r.TYPE=3]="TYPE",r[r.LEVEL=12]="LEVEL",r[r.ATTRIBUTE=13]="ATTRIBUTE",r[r.BLOT=14]="BLOT",r[r.INLINE=7]="INLINE",r[r.BLOCK=11]="BLOCK",r[r.BLOCK_BLOT=10]="BLOCK_BLOT",r[r.INLINE_BLOT=6]="INLINE_BLOT",r[r.BLOCK_ATTRIBUTE=9]="BLOCK_ATTRIBUTE",r[r.INLINE_ATTRIBUTE=5]="INLINE_ATTRIBUTE",r[r.ANY=15]="ANY",r))(R||{});class Ut{constructor(t,e,s={}){this.attrName=t,this.keyName=e;const n=R.TYPE&R.ATTRIBUTE;this.scope=s.scope!=null?s.scope&R.LEVEL|n:R.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 Re extends Error{constructor(t){t="[Parchment] "+t,super(t),this.message=t,this.name=this.constructor.name}}const _i=class fr{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 Re(`Unable to create ${e} blot`);const i=n,o=e instanceof Node||e.nodeType===Node.TEXT_NODE?e:i.create(s),a=new i(t,o,s);return fr.blots.set(a.domNode,a),a}find(t,e=!1){return fr.find(t,e)}query(t,e=R.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&R.LEVEL&R.BLOCK?s=this.types.block:t&R.LEVEL&R.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&R.LEVEL&s.scope&&e&R.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 Re("Invalid definition");if(s&&e.blotName==="abstract")throw new Re("Cannot register abstract class");const i=s?e.blotName:n?e.attrName:void 0;return this.types[i]=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})}};_i.blots=new WeakMap;let Me=_i;function Xr(r,t){return(r.getAttribute("class")||"").split(/\s+/).filter(e=>e.indexOf(`${t}-`)===0)}class Cl extends Ut{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){Xr(t,this.keyName).forEach(e=>{t.classList.remove(e)}),t.classList.length===0&&t.removeAttribute("class")}value(t){const e=(Xr(t,this.keyName)[0]||"").slice(this.keyName.length+1);return this.canAdd(t,e)?e:""}}const St=Cl;function nr(r){const t=r.split("-"),e=t.slice(1).map(s=>s[0].toUpperCase()+s.slice(1)).join("");return t[0]+e}class Ol extends Ut{static keys(t){return(t.getAttribute("style")||"").split(";").map(e=>e.split(":")[0].trim())}add(t,e){return this.canAdd(t,e)?(t.style[nr(this.keyName)]=e,!0):!1}remove(t){t.style[nr(this.keyName)]="",t.getAttribute("style")||t.removeAttribute("style")}value(t){const e=t.style[nr(this.keyName)];return this.canAdd(t,e)?e:""}}const ee=Ol;class Il{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=Ut.keys(this.domNode),s=St.keys(this.domNode),n=ee.keys(this.domNode);e.concat(s).concat(n).forEach(i=>{const o=t.scroll.query(i,R.ATTRIBUTE);o instanceof Ut&&(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 rn=Il,Si=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 Re("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 i=this.isolate(t,e);if(this.scroll.query(s,R.BLOT)!=null&&n)i.wrap(s,n);else if(this.scroll.query(s,R.ATTRIBUTE)!=null){const o=this.scroll.create(this.statics.scope);i.wrap(o),o.format(s,n)}}insertAt(t,e,s){const n=s==null?this.scroll.create("text",e):this.scroll.create(e,s),i=this.split(t);this.parent.insertBefore(n,i||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 Re(`Cannot wrap ${t}`);return s.appendChild(this),s}};Si.blotName="abstract";let ki=Si;const Ci=class extends ki{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}}};Ci.scope=R.INLINE_BLOT;let Rl=Ci;const nt=Rl;class Bl{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 i=n.length();if(to?s(u,t-o,Math.min(e,o+h-t)):s(u,0,Math.min(h,t+e-o)),o+=h,u=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 Qr(r,t){const e=t.find(r);if(e)return e;try{return t.create(r)}catch{const s=t.create(R.INLINE);return Array.from(r.childNodes).forEach(n=>{s.domNode.appendChild(n)}),r.parentNode&&r.parentNode.replaceChild(s.domNode,r),s.attach(),s}}const Oi=class Yt extends ki{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,Yt.uiClass&&this.uiNode.classList.add(Yt.uiClass),this.uiNode.setAttribute("contenteditable","false"),this.domNode.insertBefore(this.uiNode,this.domNode.firstChild)}build(){this.children=new Bl,Array.from(this.domNode.childNodes).filter(t=>t!==this.uiNode).reverse().forEach(t=>{try{const e=Qr(t,this.scroll);this.insertBefore(e,this.children.head||void 0)}catch(e){if(e instanceof Re)return;throw e}})}deleteAt(t,e){if(t===0&&e===this.length())return this.remove();this.children.forEachAt(t,e,(s,n,i)=>{s.deleteAt(n,i)})}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 Yt?s.descendant(t,n):[null,-1]}descendants(t,e=0,s=Number.MAX_VALUE){let n=[],i=s;return this.children.forEachAt(e,s,(o,a,u)=>{(t.blotName==null&&t(o)||t.blotName!=null&&o instanceof t)&&n.push(o),o instanceof Yt&&(n=n.concat(o.descendants(t,a,i))),i-=u}),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===R.BLOCK_BLOT?(e.next!=null&&this.splitAfter(e),e.prev!=null&&this.splitAfter(e.prev),e.parent.unwrap(),t=!0):e instanceof Yt?e.unwrap():e.remove())})}formatAt(t,e,s,n){this.children.forEachAt(t,e,(i,o,a)=>{i.formatAt(o,a,s,n)})}insertAt(t,e,s){const[n,i]=this.children.find(t);if(n)n.insertAt(i,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),i=[[this,t]];return s instanceof Yt?i.concat(s.path(n,e)):(s!=null&&i.push([s,n]),i)}removeChild(t){this.children.remove(t)}replaceWith(t,e){const s=typeof t=="string"?this.scroll.create(t,e):t;return s instanceof Yt&&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,i,o)=>{const a=n.split(i,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(i=>{i.target===this.domNode&&i.type==="childList"&&(s.push(...i.addedNodes),n.push(...i.removedNodes))}),n.forEach(i=>{if(i.parentNode!=null&&i.tagName!=="IFRAME"&&document.body.compareDocumentPosition(i)&Node.DOCUMENT_POSITION_CONTAINED_BY)return;const o=this.scroll.find(i);o!=null&&(o.domNode.parentNode==null||o.domNode.parentNode===this.domNode)&&o.detach()}),s.filter(i=>i.parentNode===this.domNode&&i!==this.uiNode).sort((i,o)=>i===o?0:i.compareDocumentPosition(o)&Node.DOCUMENT_POSITION_FOLLOWING?1:-1).forEach(i=>{let o=null;i.nextSibling!=null&&(o=this.scroll.find(i.nextSibling));const a=Qr(i,this.scroll);(a.next!==o||a.next==null)&&(a.parent!=null&&a.parent.removeChild(this),this.insertBefore(a,o||void 0))}),this.enforceAllowedChildren()}};Oi.uiClass="";let Ml=Oi;const Lt=Ml;function Dl(r,t){if(Object.keys(r).length!==Object.keys(t).length)return!1;for(const e in r)if(r[e]!==t[e])return!1;return!0}const Le=class _e extends Lt{static create(t){return super.create(t)}static formats(t,e){const s=e.query(_e.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 rn(this.domNode)}format(t,e){if(t===this.statics.blotName&&!e)this.children.forEach(s=>{s instanceof _e||(s=s.wrap(_e.blotName,!0)),this.attributes.copy(s)}),this.unwrap();else{const s=this.scroll.query(t,R.INLINE);if(s==null)return;s instanceof Ut?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,R.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 _e&&s.prev===this&&Dl(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 _e&&this.attributes.move(s),s}};Le.allowedChildren=[Le,nt],Le.blotName="inline",Le.scope=R.INLINE_BLOT,Le.tagName="SPAN";let Ul=Le;const Or=Ul,Se=class pr extends Lt{static create(t){return super.create(t)}static formats(t,e){const s=e.query(pr.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 rn(this.domNode)}format(t,e){const s=this.scroll.query(t,R.BLOCK);s!=null&&(s instanceof Ut?this.attributes.attribute(s,e):t===this.statics.blotName&&!e?this.replaceWith(pr.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,R.BLOCK)!=null?this.format(s,n):super.formatAt(t,e,s,n)}insertAt(t,e,s){if(s==null||this.scroll.query(e,R.INLINE)!=null)super.insertAt(t,e,s);else{const n=this.split(t);if(n!=null){const i=this.scroll.create(e,s);n.parent.insertBefore(i,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=R.BLOCK_BLOT,Se.tagName="P",Se.allowedChildren=[Or,Se,nt];let jl=Se;const ps=jl,gr=class extends Lt{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())}};gr.blotName="container",gr.scope=R.BLOCK_BLOT;let Pl=gr;const ln=Pl;class Hl extends nt{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 ut=Hl,$l={attributes:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0},Fl=100,ke=class extends Lt{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,$l),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=R.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 i=(u,h=!0)=>{u==null||u===this||u.domNode.parentNode!=null&&(s.has(u.domNode)||s.set(u.domNode,[]),h&&i(u.parent))},o=u=>{s.has(u.domNode)&&(u instanceof Lt&&u.children.forEach(o),s.delete(u.domNode),u.optimize(e))};let a=t;for(let u=0;a.length>0;u+=1){if(u>=Fl)throw new Error("[Parchment] Maximum optimize iterations reached");for(a.forEach(h=>{const f=this.find(h.target,!0);f!=null&&(f.domNode===h.target&&(h.type==="childList"?(i(this.find(h.previousSibling,!1)),Array.from(h.addedNodes).forEach(m=>{const p=this.find(m,!1);i(p,!1),p instanceof Lt&&p.children.forEach(g=>{i(g,!1)})})):h.type==="attributes"&&i(f.prev)),i(f))}),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 i=this.find(n.target,!0);return i==null?null:s.has(i.domNode)?(s.get(i.domNode).push(n),null):(s.set(i.domNode,[n]),i)}).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)}};ke.blotName="scroll",ke.defaultChild=ps,ke.allowedChildren=[ps,ln],ke.scope=R.BLOCK_BLOT,ke.tagName="DIV";let Vl=ke;const Ir=Vl,mr=class Ii extends nt{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 Ii&&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}};mr.blotName="text",mr.scope=R.INLINE_BLOT;let zl=mr;const en=zl,Kl=Object.freeze(Object.defineProperty({__proto__:null,Attributor:Ut,AttributorStore:rn,BlockBlot:ps,ClassAttributor:St,ContainerBlot:ln,EmbedBlot:ut,InlineBlot:Or,LeafBlot:nt,ParentBlot:Lt,Registry:Me,Scope:R,ScrollBlot:Ir,StyleAttributor:ee,TextBlot:en},Symbol.toStringTag,{value:"Module"}));var br={exports:{}},ct=-1,lt=1,Y=0;function gs(r,t,e,s,n){if(r===t)return r?[[Y,r]]:[];if(e!=null){var i=eo(r,t,e);if(i)return i}var o=Rr(r,t),a=r.substring(0,o);r=r.substring(o),t=t.substring(o),o=on(r,t);var u=r.substring(r.length-o);r=r.substring(0,r.length-o),t=t.substring(0,t.length-o);var h=Gl(r,t);return a&&h.unshift([Y,a]),u&&h.push([Y,u]),Br(h,n),s&&Yl(h),h}function Gl(r,t){var e;if(!r)return[[lt,t]];if(!t)return[[ct,r]];var s=r.length>t.length?r:t,n=r.length>t.length?t:r,i=s.indexOf(n);if(i!==-1)return e=[[lt,s.substring(0,i)],[Y,n],[lt,s.substring(i+n.length)]],r.length>t.length&&(e[0][0]=e[2][0]=ct),e;if(n.length===1)return[[ct,r],[lt,t]];var o=Wl(r,t);if(o){var a=o[0],u=o[1],h=o[2],f=o[3],m=o[4],p=gs(a,h),g=gs(u,f);return p.concat([[Y,m]],g)}return Zl(r,t)}function Zl(r,t){for(var e=r.length,s=t.length,n=Math.ceil((e+s)/2),i=n,o=2*n,a=new Array(o),u=new Array(o),h=0;he)g+=2;else if(I>s)p+=2;else if(m){var S=i+f-A;if(S>=0&&S=U)return Jr(r,t,x,I)}}}for(var L=-v+b;L<=v-E;L+=2){var S=i+L,U;L===-v||L!==v&&u[S-1]e)E+=2;else if(T>s)b+=2;else if(!m){var w=i+f-L;if(w>=0&&w=U)return Jr(r,t,x,I)}}}}return[[ct,r],[lt,t]]}function Jr(r,t,e,s){var n=r.substring(0,e),i=t.substring(0,s),o=r.substring(e),a=t.substring(s),u=gs(n,i),h=gs(o,a);return u.concat(h)}function Rr(r,t){if(!r||!t||r.charAt(0)!==t.charAt(0))return 0;for(var e=0,s=Math.min(r.length,t.length),n=s,i=0;es?r=r.substring(e-s):et.length?r:t,s=r.length>t.length?t:r;if(e.length<4||s.length*2=g.length?[x,I,S,U,w]:null}var i=n(e,s,Math.ceil(e.length/4)),o=n(e,s,Math.ceil(e.length/2)),a;if(!i&&!o)return null;o?i?a=i[4].length>o[4].length?i:o:a=o:a=i;var u,h,f,m;r.length>t.length?(u=a[0],h=a[1],f=a[2],m=a[3]):(f=a[0],m=a[1],u=a[2],h=a[3]);var p=a[4];return[u,h,f,m,p]}function Yl(r){for(var t=!1,e=[],s=0,n=null,i=0,o=0,a=0,u=0,h=0;i0?e[s-1]:-1,o=0,a=0,u=0,h=0,n=null,t=!0)),i++;for(t&&Br(r),Jl(r),i=1;i=g?(p>=f.length/2||p>=m.length/2)&&(r.splice(i,0,[Y,m.substring(0,p)]),r[i-1][1]=f.substring(0,f.length-p),r[i+1][1]=m.substring(p),i++):(g>=f.length/2||g>=m.length/2)&&(r.splice(i,0,[Y,f.substring(0,g)]),r[i-1][0]=lt,r[i-1][1]=m.substring(0,m.length-g),r[i+1][0]=ct,r[i+1][1]=f.substring(g),i++),i++}i++}}var ei=/[^a-zA-Z0-9]/,si=/\s/,ni=/[\r\n]/,Xl=/\n\r?\n$/,Ql=/^\r?\n\r?\n/;function Jl(r){function t(g,b){if(!g||!b)return 6;var E=g.charAt(g.length-1),v=b.charAt(0),A=E.match(ei),w=v.match(ei),x=A&&E.match(si),I=w&&v.match(si),S=x&&E.match(ni),U=I&&v.match(ni),L=S&&g.match(Xl),T=U&&b.match(Ql);return L||T?5:S||U?4:A&&!x&&I?3:x||I?2:A||w?1:0}for(var e=1;e=m&&(m=p,u=s,h=n,f=i)}r[e-1][1]!=u&&(u?r[e-1][1]=u:(r.splice(e-1,1),e--),r[e][1]=h,f?r[e+1][1]=f:(r.splice(e+1,1),e--))}e++}}function Br(r,t){r.push([Y,""]);for(var e=0,s=0,n=0,i="",o="",a;e=0&&Di(r[u][1])){var h=r[u][1].slice(-1);if(r[u][1]=r[u][1].slice(0,-1),i=h+i,o=h+o,!r[u][1]){r.splice(u,1),e--;var f=u-1;r[f]&&r[f][0]===lt&&(n++,o=r[f][1]+o,f--),r[f]&&r[f][0]===ct&&(s++,i=r[f][1]+i,f--),u=f}}if(Mi(r[e][1])){var h=r[e][1].charAt(0);r[e][1]=r[e][1].slice(1),i+=h,o+=h}}if(e0||o.length>0){i.length>0&&o.length>0&&(a=Rr(o,i),a!==0&&(u>=0?r[u][1]+=o.substring(0,a):(r.splice(0,0,[Y,o.substring(0,a)]),e++),o=o.substring(a),i=i.substring(a)),a=on(o,i),a!==0&&(r[e][1]=o.substring(o.length-a)+r[e][1],o=o.substring(0,o.length-a),i=i.substring(0,i.length-a)));var m=n+s;i.length===0&&o.length===0?(r.splice(e-m,m),e=e-m):i.length===0?(r.splice(e-m,m,[lt,o]),e=e-m+1):o.length===0?(r.splice(e-m,m,[ct,i]),e=e-m+1):(r.splice(e-m,m,[ct,i],[lt,o]),e=e-m+2)}e!==0&&r[e-1][0]===Y?(r[e-1][1]+=r[e][1],r.splice(e,1)):e++,n=0,s=0,i="",o="";break}}r[r.length-1][1]===""&&r.pop();var p=!1;for(e=1;e=55296&&r<=56319}function Bi(r){return r>=56320&&r<=57343}function Mi(r){return Bi(r.charCodeAt(0))}function Di(r){return Ri(r.charCodeAt(r.length-1))}function to(r){for(var t=[],e=0;e0&&t.push(r[e]);return t}function rr(r,t,e,s){return Di(r)||Mi(s)?null:to([[Y,r],[ct,t],[lt,e],[Y,s]])}function eo(r,t,e){var s=typeof e=="number"?{index:e,length:0}:e.oldRange,n=typeof e=="number"?null:e.newRange,i=r.length,o=t.length;if(s.length===0&&(n===null||n.length===0)){var a=s.index,u=r.slice(0,a),h=r.slice(a),f=n?n.index:null;t:{var m=a+o-i;if(f!==null&&f!==m||m<0||m>o)break t;var p=t.slice(0,m),g=t.slice(m);if(g!==h)break t;var b=Math.min(a,m),E=u.slice(0,b),v=p.slice(0,b);if(E!==v)break t;var A=u.slice(b),w=p.slice(b);return rr(E,A,w,h)}t:{if(f!==null&&f!==a)break t;var x=a,p=t.slice(0,x),g=t.slice(x);if(p!==u)break t;var I=Math.min(i-x,o-x),S=h.slice(h.length-I),U=g.slice(g.length-I);if(S!==U)break t;var A=h.slice(0,h.length-I),w=g.slice(0,g.length-I);return rr(u,A,w,S)}}if(s.length>0&&n&&n.length===0)t:{var E=r.slice(0,s.index),S=r.slice(s.index+s.length),b=E.length,I=S.length;if(o-1}function Ln(l,c){var d=this.__data__,y=we(d,l);return y<0?d.push([l,c]):d[y][1]=c,this}X.prototype.clear=wn,X.prototype.delete=xn,X.prototype.get=Tn,X.prototype.has=qn,X.prototype.set=Ln;function tt(l){var c=-1,d=l?l.length:0;for(this.clear();++c-1&&l%1==0&&l-1&&l%1==0&&l<=n}function Bt(l){var c=typeof l;return!!l&&(c=="object"||c=="function")}function zs(l){return!!l&&typeof l=="object"}function os(l){return qe(l)?Ae(l):$n(l)}function er(){return[]}function sr(){return!1}r.exports=Hs})(sn,sn.exports);var Ui=sn.exports,nn={exports:{}};nn.exports;(function(r,t){var e=200,s="__lodash_hash_undefined__",n=1,i=2,o=9007199254740991,a="[object Arguments]",u="[object Array]",h="[object AsyncFunction]",f="[object Boolean]",m="[object Date]",p="[object Error]",g="[object Function]",b="[object GeneratorFunction]",E="[object Map]",v="[object Number]",A="[object Null]",w="[object Object]",x="[object Promise]",I="[object Proxy]",S="[object RegExp]",U="[object Set]",L="[object String]",T="[object Symbol]",D="[object Undefined]",K="[object WeakMap]",P="[object ArrayBuffer]",k="[object DataView]",G="[object Float32Array]",ht="[object Float64Array]",se="[object Int8Array]",Pe="[object Int16Array]",ge="[object Int32Array]",He="[object Uint8Array]",$e="[object Uint8ClampedArray]",M="[object Uint16Array]",fn="[object Uint32Array]",pn=/[\\^$.*+?()[\]{}|]/g,yt=/^\[object .+?Constructor\]$/,ws=/^(?:0|[1-9]\d*)$/,V={};V[G]=V[ht]=V[se]=V[Pe]=V[ge]=V[He]=V[$e]=V[M]=V[fn]=!0,V[a]=V[u]=V[P]=V[f]=V[k]=V[m]=V[p]=V[g]=V[E]=V[v]=V[w]=V[S]=V[U]=V[L]=V[K]=!1;var xs=typeof Xt=="object"&&Xt&&Xt.Object===Object&&Xt,gn=typeof self=="object"&&self&&self.Object===Object&&self,vt=xs||gn||Function("return this")(),Ts=t&&!t.nodeType&&t,qs=Ts&&!0&&r&&!r.nodeType&&r,Fe=qs&&qs.exports===Ts,Ve=Fe&&xs.process,Ls=function(){try{return Ve&&Ve.binding&&Ve.binding("util")}catch{}}(),ze=Ls&&Ls.isTypedArray;function _s(l,c){for(var d=-1,y=l==null?0:l.length,j=0,B=[];++d-1}function On(l,c){var d=this.__data__,y=xe(d,l);return y<0?(++this.size,d.push([l,c])):d[y][1]=c,this}tt.prototype.clear=_n,tt.prototype.delete=Sn,tt.prototype.get=kn,tt.prototype.has=Cn,tt.prototype.set=On;function ot(l){var c=-1,d=l==null?0:l.length;for(this.clear();++cH))return!1;var F=B.get(l);if(F&&B.get(c))return F==c;var et=-1,at=!0,W=d&i?new Ae:void 0;for(B.set(l,c),B.set(c,l);++et-1&&l%1==0&&l-1&&l%1==0&&l<=o}function Vs(l){var c=typeof l;return l!=null&&(c=="object"||c=="function")}function Bt(l){return l!=null&&typeof l=="object"}var zs=ze?bn(ze):zn;function os(l){return is(l)?$n(l):Kn(l)}function er(){return[]}function sr(){return!1}r.exports=tr})(nn,nn.exports);var ji=nn.exports,Mr={};Object.defineProperty(Mr,"__esModule",{value:!0});const no=Ui,ro=ji;var yr;(function(r){function t(i={},o={},a=!1){typeof i!="object"&&(i={}),typeof o!="object"&&(o={});let u=no(o);a||(u=Object.keys(u).reduce((h,f)=>(u[f]!=null&&(h[f]=u[f]),h),{}));for(const h in i)i[h]!==void 0&&o[h]===void 0&&(u[h]=i[h]);return Object.keys(u).length>0?u:void 0}r.compose=t;function e(i={},o={}){typeof i!="object"&&(i={}),typeof o!="object"&&(o={});const a=Object.keys(i).concat(Object.keys(o)).reduce((u,h)=>(ro(i[h],o[h])||(u[h]=o[h]===void 0?null:o[h]),u),{});return Object.keys(a).length>0?a:void 0}r.diff=e;function s(i={},o={}){i=i||{};const a=Object.keys(o).reduce((u,h)=>(o[h]!==i[h]&&i[h]!==void 0&&(u[h]=o[h]),u),{});return Object.keys(i).reduce((u,h)=>(i[h]!==o[h]&&o[h]===void 0&&(u[h]=null),u),a)}r.invert=s;function n(i,o,a=!1){if(typeof i!="object")return o;if(typeof o!="object")return;if(!a)return o;const u=Object.keys(o).reduce((h,f)=>(i[f]===void 0&&(h[f]=o[f]),h),{});return Object.keys(u).length>0?u:void 0}r.transform=n})(yr||(yr={}));Mr.default=yr;var cn={};Object.defineProperty(cn,"__esModule",{value:!0});var vr;(function(r){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}r.length=t})(vr||(vr={}));cn.default=vr;var Dr={};Object.defineProperty(Dr,"__esModule",{value:!0});const ri=cn;class io{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=ri.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 i={};return e.attributes&&(i.attributes=e.attributes),typeof e.retain=="number"?i.retain=t:typeof e.retain=="object"&&e.retain!==null?i.retain=e.retain:typeof e.insert=="string"?i.insert=e.insert.substr(s,t):i.insert=e.insert,i}}else return{retain:1/0}}peek(){return this.ops[this.index]}peekLength(){return this.ops[this.index]?ri.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[]}}Dr.default=io;(function(r,t){Object.defineProperty(t,"__esModule",{value:!0}),t.AttributeMap=t.OpIterator=t.Op=void 0;const e=so,s=Ui,n=ji,i=Mr;t.AttributeMap=i.default;const o=cn;t.Op=o.default;const a=Dr;t.OpIterator=a.default;const u="\0",h=(m,p)=>{if(typeof m!="object"||m===null)throw new Error(`cannot retain a ${typeof m}`);if(typeof p!="object"||p===null)throw new Error(`cannot retain a ${typeof p}`);const g=Object.keys(m)[0];if(!g||g!==Object.keys(p)[0])throw new Error(`embed types not matched: ${g} != ${Object.keys(p)[0]}`);return[g,m[g],p[g]]};class f{constructor(p){Array.isArray(p)?this.ops=p:p!=null&&Array.isArray(p.ops)?this.ops=p.ops:this.ops=[]}static registerEmbed(p,g){this.handlers[p]=g}static unregisterEmbed(p){delete this.handlers[p]}static getHandler(p){const g=this.handlers[p];if(!g)throw new Error(`no handlers for embed type "${p}"`);return g}insert(p,g){const b={};return typeof p=="string"&&p.length===0?this:(b.insert=p,g!=null&&typeof g=="object"&&Object.keys(g).length>0&&(b.attributes=g),this.push(b))}delete(p){return p<=0?this:this.push({delete:p})}retain(p,g){if(typeof p=="number"&&p<=0)return this;const b={retain:p};return g!=null&&typeof g=="object"&&Object.keys(g).length>0&&(b.attributes=g),this.push(b)}push(p){let g=this.ops.length,b=this.ops[g-1];if(p=s(p),typeof b=="object"){if(typeof p.delete=="number"&&typeof b.delete=="number")return this.ops[g-1]={delete:b.delete+p.delete},this;if(typeof b.delete=="number"&&p.insert!=null&&(g-=1,b=this.ops[g-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[g-1]={insert:b.insert+p.insert},typeof p.attributes=="object"&&(this.ops[g-1].attributes=p.attributes),this;if(typeof p.retain=="number"&&typeof b.retain=="number")return this.ops[g-1]={retain:b.retain+p.retain},typeof p.attributes=="object"&&(this.ops[g-1].attributes=p.attributes),this}}return g===this.ops.length?this.ops.push(p):this.ops.splice(g,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 g=[],b=[];return this.forEach(E=>{(p(E)?g:b).push(E)}),[g,b]}reduce(p,g){return this.ops.reduce(p,g)}changeLength(){return this.reduce((p,g)=>g.insert?p+o.default.length(g):g.delete?p-g.delete:p,0)}length(){return this.reduce((p,g)=>p+o.default.length(g),0)}slice(p=0,g=1/0){const b=[],E=new a.default(this.ops);let v=0;for(;v0&&b.next(v.retain-w)}const A=new f(E);for(;g.hasNext()||b.hasNext();)if(b.peekType()==="insert")A.push(b.next());else if(g.peekType()==="delete")A.push(g.next());else{const w=Math.min(g.peekLength(),b.peekLength()),x=g.next(w),I=b.next(w);if(I.retain){const S={};if(typeof x.retain=="number")S.retain=typeof I.retain=="number"?w:I.retain;else if(typeof I.retain=="number")x.retain==null?S.insert=x.insert:S.retain=x.retain;else{const L=x.retain==null?"insert":"retain",[T,D,K]=h(x[L],I.retain),P=f.getHandler(T);S[L]={[T]:P.compose(D,K,L==="retain")}}const U=i.default.compose(x.attributes,I.attributes,typeof x.retain=="number");if(U&&(S.attributes=U),A.push(S),!b.hasNext()&&n(A.ops[A.ops.length-1],S)){const L=new f(g.rest());return A.concat(L).chop()}}else typeof I.delete=="number"&&(typeof x.retain=="number"||typeof x.retain=="object"&&x.retain!==null)&&A.push(I)}return A.chop()}concat(p){const g=new f(this.ops.slice());return p.ops.length>0&&(g.push(p.ops[0]),g.ops=g.ops.concat(p.ops.slice(1))),g}diff(p,g){if(this.ops===p.ops)return new f;const b=[this,p].map(x=>x.map(I=>{if(I.insert!=null)return typeof I.insert=="string"?I.insert:u;const S=x===p?"on":"with";throw new Error("diff() called "+S+" non-document")}).join("")),E=new f,v=e(b[0],b[1],g,!0),A=new a.default(this.ops),w=new a.default(p.ops);return v.forEach(x=>{let I=x[1].length;for(;I>0;){let S=0;switch(x[0]){case e.INSERT:S=Math.min(w.peekLength(),I),E.push(w.next(S));break;case e.DELETE:S=Math.min(I,A.peekLength()),A.next(S),E.delete(S);break;case e.EQUAL:S=Math.min(A.peekLength(),w.peekLength(),I);const U=A.next(S),L=w.next(S);n(U.insert,L.insert)?E.retain(S,i.default.diff(U.attributes,L.attributes)):E.push(L).delete(S);break}I-=S}}),E.chop()}eachLine(p,g=` `){const b=new a.default(this.ops);let E=new f,v=0;for(;b.hasNext();){if(b.peekType()!=="insert")return;const A=b.peek(),w=o.default.length(A)-b.peekLength(),x=typeof A.insert=="string"?A.insert.indexOf(g,w)-w:-1;if(x<0)E.push(b.next());else if(x>0)E.push(b.next(x));else{if(p(E,b.next(1).attributes||{},v)===!1)return;v+=1,E=new f}}E.length()>0&&p(E,{},v)}invert(p){const g=new f;return this.reduce((b,E)=>{if(E.insert)g.delete(o.default.length(E));else{if(typeof E.retain=="number"&&E.attributes==null)return g.retain(E.retain),b+E.retain;if(E.delete||typeof E.retain=="number"){const v=E.delete||E.retain;return p.slice(b,b+v).forEach(w=>{E.delete?g.push(w):E.retain&&E.attributes&&g.retain(o.default.length(w),i.default.invert(E.attributes,w.attributes))}),b+v}else if(typeof E.retain=="object"&&E.retain!==null){const v=p.slice(b,b+1),A=new a.default(v.ops).next(),[w,x,I]=h(E.retain,A.insert),S=f.getHandler(w);return g.retain({[w]:S.invert(x,I)},i.default.invert(E.attributes,A.attributes)),b+1}}return b},0),g.chop()}transform(p,g=!1){if(g=!!g,typeof p=="number")return this.transformPosition(p,g);const b=p,E=new a.default(this.ops),v=new a.default(b.ops),A=new f;for(;E.hasNext()||v.hasNext();)if(E.peekType()==="insert"&&(g||v.peekType()!=="insert"))A.retain(o.default.length(E.next()));else if(v.peekType()==="insert")A.push(v.next());else{const w=Math.min(E.peekLength(),v.peekLength()),x=E.next(w),I=v.next(w);if(x.delete)continue;if(I.delete)A.push(I);else{const S=x.retain,U=I.retain;let L=typeof U=="object"&&U!==null?U:w;if(typeof S=="object"&&S!==null&&typeof U=="object"&&U!==null){const T=Object.keys(S)[0];if(T===Object.keys(U)[0]){const D=f.getHandler(T);D&&(L={[T]:D.transform(S[T],U[T],g)})}}A.retain(L,i.default.transform(x.attributes,I.attributes,g))}}return A.chop()}transformPosition(p,g=!1){g=!!g;const b=new a.default(this.ops);let E=0;for(;b.hasNext()&&E<=p;){const v=b.peekLength(),A=b.peekType();if(b.next(),A==="delete"){p-=Math.min(v,p-E);continue}else A==="insert"&&(E":">",'"':""","'":"'"};function un(r){return r.replace(/[&<>"']/g,t=>lo[t])}const Mt=class Mt extends Or{static compare(t,e){const s=Mt.order.indexOf(t),n=Mt.order.indexOf(e);return s>=0||n>=0?s-n:t===e?0:t0){const e=this.parent.isolate(this.offset(),this.length());this.moveChildren(e),e.wrap(this)}}};_(Mt,"allowedChildren",[Mt,kt,ut,_t]),_(Mt,"order",["cursor","inline","link","underline","strike","italic","bold","script","code"]);let jt=Mt;const ii=1;class J extends ps{constructor(){super(...arguments);_(this,"cache",{})}delta(){return this.cache.delta==null&&(this.cache.delta=Pi(this)),this.cache.delta}deleteAt(e,s){super.deleteAt(e,s),this.cache={}}formatAt(e,s,n,i){s<=0||(this.scroll.query(n,R.BLOCK)?e+s===this.length()&&this.format(n,i):super.formatAt(e,Math.min(s,this.length()-e-1),n,i),this.cache={})}insertAt(e,s,n){if(n!=null){super.insertAt(e,s,n),this.cache={};return}if(s.length===0)return;const i=s.split(` `),o=i.shift();o.length>0&&(e(a=a.split(u,!0),a.insertAt(0,h),h.length),e+o.length)}insertBefore(e,s){const{head:n}=this.children;super.insertBefore(e,s),n instanceof kt&&n.remove(),this.cache={}}length(){return this.cache.length==null&&(this.cache.length=super.length()+ii),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()-ii)){const i=this.clone();return e===0?(this.parent.insertBefore(i,this),this):(this.parent.insertBefore(i,this.next),i)}const n=super.split(e,s);return this.cache={},n}}J.blotName="block";J.tagName="P";J.defaultChild=kt;J.allowedChildren=[kt,jt,ut,_t];class mt extends ut{attach(){super.attach(),this.attributes=new rn(this.domNode)}delta(){return new O().insert(this.value(),{...this.formats(),...this.attributes.values()})}format(t,e){const s=this.scroll.query(t,R.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(` `),i=n.pop(),o=n.map(u=>{const h=this.scroll.create(J.blotName);return h.insertAt(0,u),h}),a=this.split(t);o.forEach(u=>{this.parent.insertBefore(u,a)}),i&&this.parent.insertBefore(this.scroll.create("text",i),a)}}mt.scope=R.BLOCK_BLOT;function Pi(r){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return r.descendants(nt).reduce((e,s)=>s.length()===0?e:e.insert(s.value(),pt(s,{},t)),new O).insert(` `,pt(r))}function pt(r){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;return r==null||("formats"in r&&typeof r.formats=="function"&&(t={...t,...r.formats()},e&&delete t["code-token"]),r.parent==null||r.parent.statics.blotName==="scroll"||r.parent.statics.scope!==r.statics.scope)?t:pt(r.parent,t,e)}const ft=class ft extends ut{static value(){}constructor(t,e,s){super(t,e),this.selection=s,this.textNode=document.createTextNode(ft.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!==R.BLOCK_BLOT;)n+=s.offset(s.parent),s=s.parent;s!=null&&(this.savedLength=ft.CONTENTS.length,s.optimize(),s.formatAt(n,ft.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 _t?this.prev:null,s=e?e.length():0,n=this.next instanceof _t?this.next:null,i=n?n.text:"",{textNode:o}=this,a=o.data.split(ft.CONTENTS).join("");o.data=ft.CONTENTS;let u;if(e)u=e,(a||n)&&(e.insertAt(e.length(),a+i),n&&n.remove());else if(n)u=n,n.insertAt(0,a);else{const h=document.createTextNode(a);u=this.scroll.create(h),this.parent.insertBefore(u,this)}if(this.remove(),t){const h=(p,g)=>e&&p===e.domNode?g:p===o?s+g-1:n&&p===n.domNode?s+a.length+g:null,f=h(t.start.node,t.start.offset),m=h(t.end.node,t.end.offset);if(f!==null&&m!==null)return{startNode:u.domNode,startOffset:f,endNode:u.domNode,endOffset:m}}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=ft.CONTENTS.length,e.isolate(this.offset(e),this.length()).unwrap(),this.savedLength=0;break}e=e.parent}}value(){return""}};_(ft,"blotName","cursor"),_(ft,"className","ql-cursor"),_(ft,"tagName","span"),_(ft,"CONTENTS","\uFEFF");let De=ft;var Hi={exports:{}};(function(r){var t=Object.prototype.hasOwnProperty,e="~";function s(){}Object.create&&(s.prototype=Object.create(null),new s().__proto__||(e=!1));function n(u,h,f){this.fn=u,this.context=h,this.once=f||!1}function i(u,h,f,m,p){if(typeof f!="function")throw new TypeError("The listener must be a function");var g=new n(f,m||u,p),b=e?e+h:h;return u._events[b]?u._events[b].fn?u._events[b]=[u._events[b],g]:u._events[b].push(g):(u._events[b]=g,u._eventsCount++),u}function o(u,h){--u._eventsCount===0?u._events=new s:delete u._events[h]}function a(){this._events=new s,this._eventsCount=0}a.prototype.eventNames=function(){var h=[],f,m;if(this._eventsCount===0)return h;for(m in f=this._events)t.call(f,m)&&h.push(e?m.slice(1):m);return Object.getOwnPropertySymbols?h.concat(Object.getOwnPropertySymbols(f)):h},a.prototype.listeners=function(h){var f=e?e+h:h,m=this._events[f];if(!m)return[];if(m.fn)return[m.fn];for(var p=0,g=m.length,b=new Array(g);p1?t-1:0),s=1;s(t[e]=$i.bind(console,e,r),t),{})}Gt.level=r=>{Ar=r};$i.level=Gt.level;const ir=Gt("quill:events"),co=["selectionchange","mousedown","mouseup","click"];co.forEach(r=>{document.addEventListener(r,function(){for(var t=arguments.length,e=new Array(t),s=0;s{const i=Er.get(n);i&&i.emitter&&i.emitter.handleDOM(...e)})})});class C extends ao{constructor(){super(),this.domListeners={},this.on("error",ir.error)}emit(){for(var t=arguments.length,e=new Array(t),s=0;s1?e-1:0),n=1;n{let{node:o,handler:a}=i;(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})}}_(C,"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"}),_(C,"sources",{API:"api",SILENT:"silent",USER:"user"});const lr=Gt("quill:selection");class he{constructor(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;this.index=t,this.length=e}}class uo{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 he(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,C.sources.USER),1)}),this.emitter.on(C.events.SCROLL_BEFORE_UPDATE,()=>{if(!this.hasFocus())return;const s=this.getNativeRange();s!=null&&s.start.node!==this.cursor.textNode&&this.emitter.once(C.events.SCROLL_UPDATE,(n,i)=>{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=i.some(a=>a.type==="characterData"||a.type==="childList"||a.type==="attributes"&&a.target===this.root);this.update(o?C.sources.SILENT:n)}catch{}})}),this.emitter.on(C.events.SCROLL_OPTIMIZE,(s,n)=>{if(n.range){const{startNode:i,startOffset:o,endNode:a,endOffset:u}=n.range;this.setNativeRange(i,o,a,u),this.update(C.sources.SILENT)}}),this.update(C.sources.SILENT)}handleComposition(){this.emitter.on(C.events.COMPOSITION_BEFORE_START,()=>{this.composing=!0}),this.emitter.on(C.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(C.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,R.BLOCK))){if(s.start.node!==this.cursor.textNode){const n=this.scroll.find(s.start.node,!1);if(n==null)return;if(n instanceof nt){const i=n.split(s.start.offset);n.parent.insertBefore(this.cursor,i)}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,[i,o]=this.scroll.leaf(t);if(i==null)return null;if(e>0&&o===i.length()){const[f]=this.scroll.leaf(t+1);if(f){const[m]=this.scroll.line(t),[p]=this.scroll.line(t+1);m===p&&(i=f,o=0)}}[n,o]=i.position(o,!0);const a=document.createRange();if(e>0)return a.setStart(n,o),[i,o]=this.scroll.leaf(t+e),i==null?null:([n,o]=i.position(o,!0),a.setEnd(n,o),a.getBoundingClientRect());let u="left",h;if(n instanceof Text){if(!n.data.length)return null;o0&&(u="right")}return{bottom:h.top+h.height,height:h.height,left:h[u],right:h[u],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 lr.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&&or(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,u]=o,h=this.scroll.find(a,!0),f=h.offset(this.scroll);return u===0?f:h instanceof nt?f+h.index(a,u):f+h.length()}),n=Math.min(Math.max(...s),this.scroll.length()-1),i=Math.min(n,...s);return new he(i,n-i)}normalizeNative(t){if(!or(this.root,t.startContainer)||!t.collapsed&&!or(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:i}=s;for(;!(n instanceof Text)&&n.childNodes.length>0;)if(n.childNodes.length>i)n=n.childNodes[i],i=0;else if(n.childNodes.length===i)n=n.lastChild,n instanceof Text?i=n.data.length:n.childNodes.length>0?i=n.childNodes.length:i=n.childNodes.length+1;else break;s.node=n,s.offset=i}),e}rangeToNative(t){const e=this.scroll.length(),s=(n,i)=>{n=Math.min(e-1,n);const[o,a]=this.scroll.leaf(n);return o?o.position(a,i):[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,i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!1;if(lr.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||i||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 u=document.createRange();u.setStart(t,e),u.setEnd(s,n),o.removeAllRanges(),o.addRange(u)}}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]:C.sources.API;if(typeof e=="string"&&(s=e,e=!1),lr.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]:C.sources.USER;const e=this.lastRange,[s,n]=this.getRange();if(this.lastRange=s,this.lastNative=n,this.lastRange!=null&&(this.savedRange=this.lastRange),!Cr(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 i=[C.events.SELECTION_CHANGE,Ie(this.lastRange),Ie(e),t];this.emitter.emit(C.events.EDITOR_CHANGE,...i),t!==C.sources.SILENT&&this.emitter.emit(...i)}}}function or(r,t){try{t.parentNode}catch{return!1}return r.contains(t)}const ho=/^[ -~]*$/;class fo{constructor(t){this.scroll=t,this.delta=this.getDelta()}applyDelta(t){this.scroll.update();let e=this.scroll.length();this.scroll.batchStart();const s=li(t),n=new O;return go(s.ops.slice()).reduce((o,a)=>{const u=bt.Op.length(a);let h=a.attributes||{},f=!1,m=!1;if(a.insert!=null){if(n.retain(u),typeof a.insert=="string"){const b=a.insert;m=!b.endsWith(` `)&&(e<=o||!!this.scroll.descendant(mt,o)[0]),this.scroll.insertAt(o,b);const[E,v]=this.scroll.line(o);let A=te({},pt(E));if(E instanceof J){const[w]=E.descendant(nt,v);w&&(A=te(A,pt(w)))}h=bt.AttributeMap.diff(A,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,R.INLINE)!=null;if(E)(e<=o||this.scroll.descendant(mt,o)[0])&&(m=!0);else if(o>0){const[v,A]=this.scroll.descendant(nt,o-1);v instanceof _t?v.value()[A]!==` `&&(f=!0):v instanceof ut&&v.statics.scope===R.INLINE_BLOT&&(f=!0)}if(this.scroll.insertAt(o,b,a.insert[b]),E){const[v]=this.scroll.descendant(nt,o);if(v){const A=te({},pt(v));h=bt.AttributeMap.diff(A,h)||{}}}}e+=u}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,u,b,h[b])});const p=f?1:0,g=m?1:0;return e+=p+g,n.retain(p),n.delete(g),o+u+p+g},0),n.reduce((o,a)=>typeof a.delete=="number"?(this.scroll.deleteAt(o,a.delete),o):o+bt.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 O().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(i=>{this.scroll.lines(t,Math.max(e,1)).forEach(o=>{o.format(i,s[i])})}),this.scroll.optimize();const n=new O().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(i=>{this.scroll.formatAt(t,e,i,s[i])});const n=new O().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 O)}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[u]=a;u instanceof J?s.push(u):u instanceof nt&&n.push(u)}):(s=this.scroll.lines(t,e),n=this.scroll.descendants(nt,t,e));const[i,o]=[s,n].map(a=>{const u=a.shift();if(u==null)return{};let h=pt(u);for(;Object.keys(h).length>0;){const f=a.shift();if(f==null)return h;h=po(pt(f),h)}return h});return{...i,...o}}getHTML(t,e){const[s,n]=this.scroll.line(t);if(s){const i=s.length();return s.length()>=n+e&&!(n===0&&e===i)?ms(s,n,e,!0):ms(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=li(e),n=new O().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 O().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 O().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)!==J.blotName)return!1;const e=t;return e.children.length>1?!1:e.children.head instanceof kt}removeFormat(t,e){const s=this.getText(t,e),[n,i]=this.scroll.line(t+e);let o=0,a=new O;n!=null&&(o=n.length()-i,a=n.delta().slice(i,i+o-1).insert(` `));const h=this.getContents(t,e+o).diff(new O().insert(s).concat(a)),f=new O().retain(t).concat(h);return this.applyDelta(f)}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(ho)&&this.scroll.find(e[0].target)){const i=this.scroll.find(e[0].target),o=pt(i),a=i.offset(this.scroll),u=e[0].oldValue.replace(De.CONTENTS,""),h=new O().insert(u),f=new O().insert(i.value()),m=s&&{oldRange:oi(s.oldRange,-a),newRange:oi(s.newRange,-a)};t=new O().retain(a).concat(h.diff(f,m)).reduce((g,b)=>b.insert?g.insert(b.insert,o):g.push(b),new O),this.delta=n.compose(t)}else this.delta=this.getDelta(),(!t||!Cr(n.compose(t),this.delta))&&(t=n.diff(this.delta,s));return t}}function Ce(r,t,e){if(r.length===0){const[g]=ar(e.pop());return t<=0?``:`${Ce([],t-1,e)}`}const[{child:s,offset:n,length:i,indent:o,type:a},...u]=r,[h,f]=ar(a);if(o>t)return e.push(a),o===t+1?`<${h}>${ms(s,n,i)}${Ce(u,o,e)}`:`<${h}>
  • ${Ce(r,t+1,e)}`;const m=e[e.length-1];if(o===t&&a===m)return`
  • ${ms(s,n,i)}${Ce(u,o,e)}`;const[p]=ar(e.pop());return`${Ce(r,t-1,e)}`}function ms(r,t,e){let s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if("html"in r&&typeof r.html=="function")return r.html(t,e);if(r instanceof _t)return un(r.value().slice(t,t+e)).replaceAll(" "," ");if(r instanceof Lt){if(r.statics.blotName==="list-container"){const h=[];return r.children.forEachAt(t,e,(f,m,p)=>{const g="formats"in f&&typeof f.formats=="function"?f.formats():{};h.push({child:f,offset:m,length:p,indent:g.indent||0,type:g.list})}),Ce(h,-1,[])}const n=[];if(r.children.forEachAt(t,e,(h,f,m)=>{n.push(ms(h,f,m))}),s||r.statics.blotName==="list")return n.join("");const{outerHTML:i,innerHTML:o}=r.domNode,[a,u]=i.split(`>${o}<`);return a==="${n.join("")}<${u}`:`${a}>${n.join("")}<${u}`}return r.domNode instanceof Element?r.domNode.outerHTML:""}function po(r,t){return Object.keys(t).reduce((e,s)=>{if(r[s]==null)return e;const n=t[s];return n===r[s]?e[s]=n:Array.isArray(n)?n.indexOf(r[s])<0?e[s]=n.concat([r[s]]):e[s]=n:e[s]=[n,r[s]],e},{})}function ar(r){const t=r==="ordered"?"ol":"ul";switch(r){case"checked":return[t,' data-list="checked"'];case"unchecked":return[t,' data-list="unchecked"'];default:return[t,""]}}function li(r){return r.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 O)}function oi(r,t){let{index:e,length:s}=r;return new he(e+t,s)}function go(r){const t=[];return r.forEach(e=>{typeof e.insert=="string"?e.insert.split(` `).forEach((n,i)=>{i&&t.push({insert:` `,attributes:e.attributes}),n&&t.push({insert:n,attributes:e.attributes})}):t.push(e)}),t}class Ct{constructor(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.quill=t,this.options=e}}_(Ct,"DEFAULTS",{});const Zs="\uFEFF";class Ur extends ut{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(Zs),this.rightGuard=document.createTextNode(Zs),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(Zs).join("");if(t===this.leftGuard)if(this.prev instanceof _t){const i=this.prev.length();this.prev.insertAt(i,n),e={startNode:this.prev.domNode,startOffset:i+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 _t?(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=Zs,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 mo{constructor(t,e){_(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 Ur)&&(this.emitter.emit(C.events.COMPOSITION_BEFORE_START,t),this.scroll.batchStart(),this.emitter.emit(C.events.COMPOSITION_START,t),this.isComposing=!0)}handleCompositionEnd(t){this.emitter.emit(C.events.COMPOSITION_BEFORE_END,t),this.scroll.batchEnd(),this.emitter.emit(C.events.COMPOSITION_END,t),this.isComposing=!1}}const ds=class ds{constructor(t,e){_(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]}};_(ds,"DEFAULTS",{modules:{}}),_(ds,"themes",{default:ds});let Ue=ds;const bo=r=>r.parentElement||r.getRootNode().host||null,yo=r=>{const t=r.getBoundingClientRect(),e="offsetWidth"in r&&Math.abs(t.width)/r.offsetWidth||1,s="offsetHeight"in r&&Math.abs(t.height)/r.offsetHeight||1;return{top:t.top,right:t.left+r.clientWidth*e,bottom:t.top+r.clientHeight*s,left:t.left}},Ws=r=>{const t=parseInt(r,10);return Number.isNaN(t)?0:t},ai=(r,t,e,s,n,i)=>rs?0:rs?t-r>s-e?r+n-e:t-s+i:0,vo=(r,t)=>{var i,o,a;const e=r.ownerDocument;let s=t,n=r;for(;n;){const u=n===e.body,h=u?{top:0,right:((i=window.visualViewport)==null?void 0:i.width)??e.documentElement.clientWidth,bottom:((o=window.visualViewport)==null?void 0:o.height)??e.documentElement.clientHeight,left:0}:yo(n),f=getComputedStyle(n),m=ai(s.left,s.right,h.left,h.right,Ws(f.scrollPaddingLeft),Ws(f.scrollPaddingRight)),p=ai(s.top,s.bottom,h.top,h.bottom,Ws(f.scrollPaddingTop),Ws(f.scrollPaddingBottom));if(m||p)if(u)(a=e.defaultView)==null||a.scrollBy(m,p);else{const{scrollLeft:g,scrollTop:b}=n;p&&(n.scrollTop+=p),m&&(n.scrollLeft+=m);const E=n.scrollLeft-g,v=n.scrollTop-b;s={left:s.left-E,top:s.top-v,right:s.right-E,bottom:s.bottom-v}}n=u||f.position==="fixed"?null:bo(n)}},Eo=100,No=["block","break","cursor","inline","scroll","text"],Ao=(r,t,e)=>{const s=new Me;return No.forEach(n=>{const i=t.query(n);i&&s.register(i)}),r.forEach(n=>{let i=t.query(n);i||e.error(`Cannot register "${n}" specified in "formats" config. Are you sure it was registered?`);let o=0;for(;i;)if(s.register(i),i="blotName"in i?i.requiredContainer??null:null,o+=1,o>Eo){e.error(`Cycle detected in registering blot requiredContainer: "${n}"`);break}}),s},Be=Gt("quill"),Ys=new Me;Lt.uiClass="ql-ui";const Tt=class Tt{static debug(t){t===!0&&(t="log"),Gt.level(t)}static find(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return Er.get(t)||Ys.find(t,e)}static import(t){return this.imports[t]==null&&Be.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&&Be.warn(`Overwriting ${t} with`,e),this.imports[t]=e,(t.startsWith("blots/")||t.startsWith("formats/"))&&e&&typeof e!="boolean"&&e.blotName!=="abstract"&&Ys.register(e),typeof e.register=="function"&&e.register(Ys)}}constructor(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this.options=wo(t,e),this.container=this.options.container,this.container==null){Be.error("Invalid Quill container",t);return}this.options.debug&&Tt.debug(this.options.debug);const s=this.container.innerHTML.trim();this.container.classList.add("ql-container"),this.container.innerHTML="",Er.set(this.container,this),this.root=this.addContainer("ql-editor"),this.root.classList.add("ql-blank"),this.emitter=new C;const n=Ir.blotName,i=this.options.registry.query(n);if(!i||!("blotName"in i))throw new Error(`Cannot initialize Quill without "${n}" blot`);if(this.scroll=new i(this.options.registry,this.root,{emitter:this.emitter}),this.editor=new fo(this.scroll),this.selection=new uo(this.scroll,this.emitter),this.composition=new mo(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(C.events.EDITOR_CHANGE,o=>{o===C.events.TEXT_CHANGE&&this.root.classList.toggle("ql-blank",this.editor.isBlank())}),this.emitter.on(C.events.SCROLL_UPDATE,(o,a)=>{const u=this.selection.lastRange,[h]=this.selection.getRange(),f=u&&h?{oldRange:u,newRange:h}:void 0;xt.call(this,()=>this.editor.update(null,a,f),o)}),this.emitter.on(C.events.SCROLL_EMBED_UPDATE,(o,a)=>{const u=this.selection.lastRange,[h]=this.selection.getRange(),f=u&&h?{oldRange:u,newRange:h}:void 0;xt.call(this,()=>{const m=new O().retain(o.offset(this)).retain({[o.statics.blotName]:a});return this.editor.update(m,[],f)},Tt.sources.USER)}),s){const o=this.clipboard.convert({html:`${s}


    `,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]=Vt(t,e,s),xt.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]:C.sources.API;return xt.call(this,()=>{const n=this.getSelection(!0);let i=new O;if(n==null)return i;if(this.scroll.query(t,R.BLOCK))i=this.editor.formatLine(n.index,n.length,{[t]:e});else{if(n.length===0)return this.selection.format(t,e),i;i=this.editor.formatText(n.index,n.length,{[t]:e})}return this.setSelection(n,C.sources.SILENT),i},s)}formatLine(t,e,s,n,i){let o;return[t,e,o,i]=Vt(t,e,s,n,i),xt.call(this,()=>this.editor.formatLine(t,e,o),i,t,0)}formatText(t,e,s,n,i){let o;return[t,e,o,i]=Vt(t,e,s,n,i),xt.call(this,()=>this.editor.formatText(t,e,o),i,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]=Vt(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]=Vt(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]=Vt(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]:Tt.sources.API;return xt.call(this,()=>this.editor.insertEmbed(t,e,s),n,t)}insertText(t,e,s,n,i){let o;return[t,,o,i]=Vt(t,0,s,n,i),xt.call(this,()=>this.editor.insertText(t,e,o),i,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]=Vt(t,e,s),xt.call(this,()=>this.editor.removeFormat(t,e),s,t)}scrollRectIntoView(t){vo(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]:C.sources.API;return xt.call(this,()=>{t=new O(t);const s=this.getLength(),n=this.editor.deleteText(0,s),i=this.editor.insertContents(0,t),o=this.editor.deleteText(this.getLength()-1,1);return n.compose(i).compose(o)},e)}setSelection(t,e,s){t==null?this.selection.setRange(null,e||Tt.sources.API):([t,e,,s]=Vt(t,e,s),this.selection.setRange(new he(Math.max(0,t),e),s),s!==C.sources.SILENT&&this.scrollSelectionIntoView())}setText(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:C.sources.API;const s=new O().insert(t);return this.setContents(s,e)}update(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:C.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]:C.sources.API;return xt.call(this,()=>(t=new O(t),this.editor.applyDelta(t)),e,!0)}};_(Tt,"DEFAULTS",{bounds:null,modules:{clipboard:!0,keyboard:!0,history:!0,uploader:!0},placeholder:"",readOnly:!1,registry:Ys,theme:"default"}),_(Tt,"events",C.events),_(Tt,"sources",C.sources),_(Tt,"version","2.0.3"),_(Tt,"imports",{delta:O,parchment:Kl,"core/module":Ct,"core/theme":Ue});let N=Tt;function ci(r){return typeof r=="string"?document.querySelector(r):r}function cr(r){return Object.entries(r??{}).reduce((t,e)=>{let[s,n]=e;return{...t,[s]:n===!0?{}:n}},{})}function ui(r){return Object.fromEntries(Object.entries(r).filter(t=>t[1]!==void 0))}function wo(r,t){const e=ci(r);if(!e)throw new Error("Invalid Quill container");const n=!t.theme||t.theme===N.DEFAULTS.theme?Ue:N.import(`themes/${t.theme}`);if(!n)throw new Error(`Invalid theme ${t.theme}. Did you register it?`);const{modules:i,...o}=N.DEFAULTS,{modules:a,...u}=n.DEFAULTS;let h=cr(t.modules);h!=null&&h.toolbar&&h.toolbar.constructor!==Object&&(h={...h,toolbar:{container:h.toolbar}});const f=te({},cr(i),cr(a),h),m={...o,...ui(u),...ui(t)};let p=t.registry;return p?t.formats&&Be.warn('Ignoring "formats" option because "registry" is specified'):p=t.formats?Ao(t.formats,m.registry,Be):m.registry,{...m,registry:p,container:e,theme:n,modules:Object.entries(f).reduce((g,b)=>{let[E,v]=b;if(!v)return g;const A=N.import(`modules/${E}`);return A==null?(Be.error(`Cannot load ${E} module. Are you sure you registered it?`),g):{...g,[E]:te({},A.DEFAULTS||{},v)}},{}),bounds:ci(m.bounds)}}function xt(r,t,e,s){if(!this.isEnabled()&&t===C.sources.USER&&!this.allowReadOnlyEdits)return new O;let n=e==null?null:this.getSelection();const i=this.editor.delta,o=r();if(n!=null&&(e===!0&&(e=n.index),s==null?n=hi(n,o,t):s!==0&&(n=hi(n,e,s,t)),this.setSelection(n,C.sources.SILENT)),o.length()>0){const a=[C.events.TEXT_CHANGE,o,i,t];this.emitter.emit(C.events.EDITOR_CHANGE,...a),t!==C.sources.SILENT&&this.emitter.emit(...a)}return o}function Vt(r,t,e,s,n){let i={};return typeof r.index=="number"&&typeof r.length=="number"?typeof t!="number"?(n=s,s=e,e=t,t=r.length,r=r.index):(t=r.length,r=r.index):typeof t!="number"&&(n=s,s=e,e=t,t=0),typeof e=="object"?(i=e,n=s):typeof e=="string"&&(s!=null?i[e]=s:n=e),n=n||C.sources.API,[r,t,i,n]}function hi(r,t,e,s){const n=typeof e=="number"?e:0;if(r==null)return null;let i,o;return t&&typeof t.transformPosition=="function"?[i,o]=[r.index,r.index+r.length].map(a=>t.transformPosition(a,s!==C.sources.USER)):[i,o]=[r.index,r.index+r.length].map(a=>a=0?a+n:Math.max(t,a+n)),new he(i,o-i)}class de extends ln{}function di(r){return r instanceof J||r instanceof mt}function fi(r){return typeof r.updateContent=="function"}class Oe extends Ir{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",i=>this.handleDragStart(i))}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(C.events.SCROLL_BLOT_MOUNT,t)}emitUnmount(t){this.emitter.emit(C.events.SCROLL_BLOT_UNMOUNT,t)}emitEmbedUpdate(t,e){this.emitter.emit(C.events.SCROLL_EMBED_UPDATE,t,e)}deleteAt(t,e){const[s,n]=this.line(t),[i]=this.line(t+e);if(super.deleteAt(t,e),i!=null&&s!==i&&n>0){if(s instanceof mt||i instanceof mt){this.optimize();return}const o=i.children.head instanceof kt?null:i.children.head;s.moveChildren(i,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,R.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===R.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 O().insert(` `))),n=s.pop();if(n==null)return;this.batchStart();const i=s.shift();if(i){const u=i.type==="block"&&(i.delta.length()===0||!this.descendant(mt,t)[0]&&t{this.formatAt(m-1,1,b,g[b])}),t=m}let[o,a]=this.children.find(t);if(s.length&&(o&&(o=o.split(a),a=0),s.forEach(u=>{if(u.type==="block"){const h=this.createBlock(u.attributes,o||void 0);ur(h,0,u.delta)}else{const h=this.create(u.key,u.value);this.insertBefore(h,o||void 0),Object.keys(u.attributes).forEach(f=>{h.format(f,u.attributes[f])})}})),n.type==="block"&&n.delta.length()){const u=o?o.offset(o.scroll)+a:this.length();ur(this,u,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 nt?[s,n]:[null,-1]}line(t){return t===this.length()?this.line(t-1):this.descendant(di,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,i,o)=>{let a=[],u=o;return n.children.forEachAt(i,o,(h,f,m)=>{di(h)?a.push(h):h instanceof ln&&(a=a.concat(s(h,f,u))),u-=m}),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(C.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=C.sources.USER;typeof t=="string"&&(e=t),Array.isArray(t)||(t=this.observer.takeRecords()),t=t.filter(s=>{let{target:n}=s;const i=this.find(n,!0);return i&&!fi(i)}),t.length>0&&this.emitter.emit(C.events.SCROLL_BEFORE_UPDATE,e,t),super.update(t.concat([])),t.length>0&&this.emitter.emit(C.events.SCROLL_UPDATE,e,t)}updateEmbedAt(t,e,s){const[n]=this.descendant(i=>i instanceof mt,t);n&&n.statics.blotName===e&&fi(n)&&n.updateContent(s)}handleDragStart(t){t.preventDefault()}deltaToRenderBlocks(t){const e=[];let s=new O;return t.forEach(n=>{const i=n==null?void 0:n.insert;if(i)if(typeof i=="string"){const o=i.split(` `);o.slice(0,-1).forEach(u=>{s.insert(u,n.attributes),e.push({type:"block",delta:s,attributes:n.attributes??{}}),s=new O});const a=o[o.length-1];a&&s.insert(a,n.attributes)}else{const o=Object.keys(i)[0];if(!o)return;this.query(o,R.INLINE)?s.push(n):(s.length()&&e.push({type:"block",delta:s,attributes:{}}),s=new O,e.push({type:"blockEmbed",key:o,value:i[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[u,h]=a;this.query(u,R.BLOCK&R.BLOT)!=null?s=u:n[u]=h});const i=this.create(s||this.statics.defaultChild.blotName,s?t[s]:void 0);this.insertBefore(i,e||void 0);const o=i.length();return Object.entries(n).forEach(a=>{let[u,h]=a;i.formatAt(0,o,u,h)}),i}}_(Oe,"blotName","scroll"),_(Oe,"className","ql-editor"),_(Oe,"tagName","DIV"),_(Oe,"defaultChild",J),_(Oe,"allowedChildren",[J,mt,de]);function ur(r,t,e){e.reduce((s,n)=>{const i=bt.Op.length(n);let o=n.attributes||{};if(n.insert!=null){if(typeof n.insert=="string"){const a=n.insert;r.insertAt(s,a);const[u]=r.descendant(nt,s),h=pt(u);o=bt.AttributeMap.diff(h,o)||{}}else if(typeof n.insert=="object"){const a=Object.keys(n.insert)[0];if(a==null)return s;if(r.insertAt(s,a,n.insert[a]),r.scroll.query(a,R.INLINE)!=null){const[h]=r.descendant(nt,s),f=pt(h);o=bt.AttributeMap.diff(f,o)||{}}}}return Object.keys(o).forEach(a=>{r.formatAt(s,i,a,o[a])}),s+i},t)}const jr={scope:R.BLOCK,whitelist:["right","center","justify"]},xo=new Ut("align","align",jr),Fi=new St("align","ql-align",jr),Vi=new ee("align","text-align",jr);class zi extends ee{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 To=new St("color","ql-color",{scope:R.INLINE}),Pr=new zi("color","color",{scope:R.INLINE}),qo=new St("background","ql-bg",{scope:R.INLINE}),Hr=new zi("background","background-color",{scope:R.INLINE});class fe extends de{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`
    ${un(this.code(t,e))}
    
    `}}class rt extends J{static register(){N.register(fe)}}_(rt,"TAB"," ");class $r extends jt{}$r.blotName="code";$r.tagName="CODE";rt.blotName="code-block";rt.className="ql-code-block";rt.tagName="DIV";fe.blotName="code-block-container";fe.className="ql-code-block-container";fe.tagName="DIV";fe.allowedChildren=[rt];rt.allowedChildren=[_t,kt,De];rt.requiredContainer=fe;const Fr={scope:R.BLOCK,whitelist:["rtl"]},Ki=new Ut("direction","dir",Fr),Gi=new St("direction","ql-direction",Fr),Zi=new ee("direction","direction",Fr),Wi={scope:R.INLINE,whitelist:["serif","monospace"]},Yi=new St("font","ql-font",Wi);class Lo extends ee{value(t){return super.value(t).replace(/["']/g,"")}}const Xi=new Lo("font","font-family",Wi),Qi=new St("size","ql-size",{scope:R.INLINE,whitelist:["small","large","huge"]}),Ji=new ee("size","font-size",{scope:R.INLINE,whitelist:["10px","18px","32px"]}),_o=Gt("quill:keyboard"),So=/Mac/i.test(navigator.platform)?"metaKey":"ctrlKey";class hn extends Ct{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=Co(t);if(n==null){_o.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(A=>hn.match(t,A));if(n.length===0)return;const i=N.find(t.target,!0);if(i&&i.scroll!==this.quill.scroll)return;const o=this.quill.getSelection();if(o==null||!this.quill.hasFocus())return;const[a,u]=this.quill.getLine(o.index),[h,f]=this.quill.getLeaf(o.index),[m,p]=o.length===0?[h,f]:this.quill.getLeaf(o.index+o.length),g=h instanceof en?h.value().slice(0,f):"",b=m instanceof en?m.value().slice(p):"",E={collapsed:o.length===0,empty:o.length===0&&a.length()<=1,format:this.quill.getFormat(o),line:a,offset:u,prefix:g,suffix:b,event:t};n.some(A=>{if(A.collapsed!=null&&A.collapsed!==E.collapsed||A.empty!=null&&A.empty!==E.empty||A.offset!=null&&A.offset!==E.offset)return!1;if(Array.isArray(A.format)){if(A.format.every(w=>E.format[w]==null))return!1}else if(typeof A.format=="object"&&!Object.keys(A.format).every(w=>A.format[w]===!0?E.format[w]!=null:A.format[w]===!1?E.format[w]==null:Cr(A.format[w],E.format[w])))return!1;return A.prefix!=null&&!A.prefix.test(E.prefix)||A.suffix!=null&&!A.suffix.test(E.suffix)?!1:A.handler.call(this,o,E,A)!==!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[i]=this.quill.getLine(t.index);let o=new O().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=i.formats(),f=this.quill.getFormat(t.index-1,1);if(n=bt.AttributeMap.diff(h,f)||{},Object.keys(n).length>0){const m=new O().retain(t.index+i.length()-2).retain(1,n);o=o.compose(m)}}}this.quill.updateContents(o,N.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[i]=this.quill.getLine(t.index);let o=new O().retain(t.index).delete(s);if(e.offset>=i.length()-1){const[a]=this.quill.getLine(t.index+1);if(a){const u=i.formats(),h=this.quill.getFormat(t.index,1);n=bt.AttributeMap.diff(u,h)||{},Object.keys(n).length>0&&(o=o.retain(a.length()-1).retain(1,n))}}this.quill.updateContents(o,N.sources.USER),this.quill.focus()}handleDeleteRange(t){Vr({range:t,quill:this.quill}),this.quill.focus()}handleEnter(t,e){const s=Object.keys(e.format).reduce((i,o)=>(this.quill.scroll.query(o,R.BLOCK)&&!Array.isArray(e.format[o])&&(i[o]=e.format[o]),i),{}),n=new O().retain(t.index).delete(t.length).insert(` `,s);this.quill.updateContents(n,N.sources.USER),this.quill.setSelection(t.index+1,N.sources.SILENT),this.quill.focus()}}const ko={bindings:{bold:hr("bold"),italic:hr("italic"),underline:hr("underline"),indent:{key:"Tab",format:["blockquote","indent","list"],handler(r,t){return t.collapsed&&t.offset!==0?!0:(this.quill.format("indent","+1",N.sources.USER),!1)}},outdent:{key:"Tab",shiftKey:!0,format:["blockquote","indent","list"],handler(r,t){return t.collapsed&&t.offset!==0?!0:(this.quill.format("indent","-1",N.sources.USER),!1)}},"outdent backspace":{key:"Backspace",collapsed:!0,shiftKey:null,metaKey:null,ctrlKey:null,altKey:null,format:["indent","list"],offset:0,handler(r,t){t.format.indent!=null?this.quill.format("indent","-1",N.sources.USER):t.format.list!=null&&this.quill.format("list",!1,N.sources.USER)}},"indent code-block":pi(!0),"outdent code-block":pi(!1),"remove tab":{key:"Tab",shiftKey:!0,collapsed:!0,prefix:/\t$/,handler(r){this.quill.deleteText(r.index-1,1,N.sources.USER)}},tab:{key:"Tab",handler(r,t){if(t.format.table)return!0;this.quill.history.cutoff();const e=new O().retain(r.index).delete(r.length).insert(" ");return this.quill.updateContents(e,N.sources.USER),this.quill.history.cutoff(),this.quill.setSelection(r.index+1,N.sources.SILENT),!1}},"blockquote empty enter":{key:"Enter",collapsed:!0,format:["blockquote"],empty:!0,handler(){this.quill.format("blockquote",!1,N.sources.USER)}},"list empty enter":{key:"Enter",collapsed:!0,format:["list"],empty:!0,handler(r,t){const e={list:!1};t.format.indent&&(e.indent=!1),this.quill.formatLine(r.index,r.length,e,N.sources.USER)}},"checklist enter":{key:"Enter",collapsed:!0,format:{list:"checked"},handler(r){const[t,e]=this.quill.getLine(r.index),s={...t.formats(),list:"checked"},n=new O().retain(r.index).insert(` `,s).retain(t.length()-e-1).retain(1,{list:"unchecked"});this.quill.updateContents(n,N.sources.USER),this.quill.setSelection(r.index+1,N.sources.SILENT),this.quill.scrollSelectionIntoView()}},"header enter":{key:"Enter",collapsed:!0,format:["header"],suffix:/^$/,handler(r,t){const[e,s]=this.quill.getLine(r.index),n=new O().retain(r.index).insert(` `,t.format).retain(e.length()-s-1).retain(1,{header:null});this.quill.updateContents(n,N.sources.USER),this.quill.setSelection(r.index+1,N.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(r){const t=this.quill.getModule("table");if(t){const[e,s,n,i]=t.getTable(r),o=Oo(e,s,n,i);if(o==null)return;let a=e.offset();if(o<0){const u=new O().retain(a).insert(` `);this.quill.updateContents(u,N.sources.USER),this.quill.setSelection(r.index+1,r.length,N.sources.SILENT)}else if(o>0){a+=e.length();const u=new O().retain(a).insert(` `);this.quill.updateContents(u,N.sources.USER),this.quill.setSelection(a,N.sources.USER)}}}},"table tab":{key:"Tab",shiftKey:null,format:["table"],handler(r,t){const{event:e,line:s}=t,n=s.offset(this.quill.scroll);e.shiftKey?this.quill.setSelection(n-1,N.sources.USER):this.quill.setSelection(n+s.length(),N.sources.USER)}},"list autofill":{key:" ",shiftKey:null,collapsed:!0,format:{"code-block":!1,blockquote:!1,table:!1},prefix:/^\s*?(\d+\.|-|\*|\[ ?\]|\[x\])$/,handler(r,t){if(this.quill.scroll.query("list")==null)return!0;const{length:e}=t.prefix,[s,n]=this.quill.getLine(r.index);if(n>e)return!0;let i;switch(t.prefix.trim()){case"[]":case"[ ]":i="unchecked";break;case"[x]":i="checked";break;case"-":case"*":i="bullet";break;default:i="ordered"}this.quill.insertText(r.index," ",N.sources.USER),this.quill.history.cutoff();const o=new O().retain(r.index-n).delete(e+1).retain(s.length()-2-n).retain(1,{list:i});return this.quill.updateContents(o,N.sources.USER),this.quill.history.cutoff(),this.quill.setSelection(r.index-e,N.sources.SILENT),!1}},"code exit":{key:"Enter",collapsed:!0,format:["code-block"],prefix:/^$/,suffix:/^\s*$/,handler(r){const[t,e]=this.quill.getLine(r.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 i=new O().retain(r.index+t.length()-e-2).retain(1,{"code-block":null}).delete(1);return this.quill.updateContents(i,N.sources.USER),this.quill.setSelection(r.index-1,N.sources.SILENT),!1}return!0}},"embed left":Xs("ArrowLeft",!1),"embed left shift":Xs("ArrowLeft",!0),"embed right":Xs("ArrowRight",!1),"embed right shift":Xs("ArrowRight",!0),"table down":gi(!1),"table up":gi(!0)}};hn.DEFAULTS=ko;function pi(r){return{key:"Tab",shiftKey:!r,format:{"code-block":!0},handler(t,e){let{event:s}=e;const n=this.quill.scroll.query("code-block"),{TAB:i}=n;if(t.length===0&&!s.shiftKey){this.quill.insertText(t.index,i,N.sources.USER),this.quill.setSelection(t.index+i.length,N.sources.SILENT);return}const o=t.length===0?this.quill.getLines(t.index,1):this.quill.getLines(t);let{index:a,length:u}=t;o.forEach((h,f)=>{r?(h.insertAt(0,i),f===0?a+=i.length:u+=i.length):h.domNode.textContent.startsWith(i)&&(h.deleteAt(0,i.length),f===0?a-=i.length:u-=i.length)}),this.quill.update(N.sources.USER),this.quill.setSelection(a,u,N.sources.SILENT)}}}function Xs(r,t){return{key:r,shiftKey:t,altKey:null,[r==="ArrowLeft"?"prefix":"suffix"]:/^$/,handler(s){let{index:n}=s;r==="ArrowRight"&&(n+=s.length+1);const[i]=this.quill.getLeaf(n);return i instanceof ut?(r==="ArrowLeft"?t?this.quill.setSelection(s.index-1,s.length+1,N.sources.USER):this.quill.setSelection(s.index-1,N.sources.USER):t?this.quill.setSelection(s.index,s.length+1,N.sources.USER):this.quill.setSelection(s.index+s.length+1,N.sources.USER),!1):!0}}}function hr(r){return{key:r[0],shortKey:!0,handler(t,e){this.quill.format(r,!e.format[r],N.sources.USER)}}}function gi(r){return{key:r?"ArrowUp":"ArrowDown",collapsed:!0,format:["table"],handler(t,e){const s=r?"prev":"next",n=e.line,i=n.parent[s];if(i!=null){if(i.statics.blotName==="table-row"){let o=i.children.head,a=n;for(;a.prev!=null;)a=a.prev,o=o.next;const u=o.offset(this.quill.scroll)+Math.min(e.offset,o.length()-1);this.quill.setSelection(u,0,N.sources.USER)}}else{const o=n.table()[s];o!=null&&(r?this.quill.setSelection(o.offset(this.quill.scroll)+o.length()-1,0,N.sources.USER):this.quill.setSelection(o.offset(this.quill.scroll),0,N.sources.USER))}return!1}}}function Co(r){if(typeof r=="string"||typeof r=="number")r={key:r};else if(typeof r=="object")r=Ie(r);else return null;return r.shortKey&&(r[So]=r.shortKey,delete r.shortKey),r}function Vr(r){let{quill:t,range:e}=r;const s=t.getLines(e);let n={};if(s.length>1){const i=s[0].formats(),o=s[s.length-1].formats();n=bt.AttributeMap.diff(o,i)||{}}t.deleteText(e,N.sources.USER),Object.keys(n).length>0&&t.formatLine(e.index,1,n,N.sources.USER),t.setSelection(e.index,N.sources.SILENT)}function Oo(r,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 Io=/font-weight:\s*normal/,Ro=["P","OL","UL"],mi=r=>r&&Ro.includes(r.tagName),Bo=r=>{Array.from(r.querySelectorAll("br")).filter(t=>mi(t.previousElementSibling)&&mi(t.nextElementSibling)).forEach(t=>{var e;(e=t.parentNode)==null||e.removeChild(t)})},Mo=r=>{Array.from(r.querySelectorAll('b[style*="font-weight"]')).filter(t=>{var e;return(e=t.getAttribute("style"))==null?void 0:e.match(Io)}).forEach(t=>{var s;const e=r.createDocumentFragment();e.append(...t.childNodes),(s=t.parentNode)==null||s.replaceChild(e,t)})};function Do(r){r.querySelector('[id^="docs-internal-guid-"]')&&(Mo(r),Bo(r))}const Uo=/\bmso-list:[^;]*ignore/i,jo=/\bmso-list:[^;]*\bl(\d+)/i,Po=/\bmso-list:[^;]*\blevel(\d+)/i,Ho=(r,t)=>{const e=r.getAttribute("style"),s=e==null?void 0:e.match(jo);if(!s)return null;const n=Number(s[1]),i=e==null?void 0:e.match(Po),o=i?Number(i[1]):1,a=new RegExp(`@list l${n}:level${o}\\s*\\{[^\\}]*mso-level-number-format:\\s*([\\w-]+)`,"i"),u=t.match(a),h=u&&u[1]==="bullet"?"bullet":"ordered";return{id:n,indent:o,type:h,element:r}},$o=r=>{var o,a;const t=Array.from(r.querySelectorAll("[style*=mso-list]")),e=[],s=[];t.forEach(u=>{(u.getAttribute("style")||"").match(Uo)?e.push(u):s.push(u)}),e.forEach(u=>{var h;return(h=u.parentNode)==null?void 0:h.removeChild(u)});const n=r.documentElement.innerHTML,i=s.map(u=>Ho(u,n)).filter(u=>u);for(;i.length;){const u=[];let h=i.shift();for(;h;)u.push(h),h=i.length&&((o=i[0])==null?void 0:o.element)===h.element.nextElementSibling&&i[0].id===h.id?i.shift():null;const f=document.createElement("ul");u.forEach(g=>{const b=document.createElement("li");b.setAttribute("data-list",g.type),g.indent>1&&b.setAttribute("class",`ql-indent-${g.indent-1}`),b.innerHTML=g.element.innerHTML,f.appendChild(b)});const m=(a=u[0])==null?void 0:a.element,{parentNode:p}=m??{};m&&(p==null||p.replaceChild(f,m)),u.slice(1).forEach(g=>{let{element:b}=g;p==null||p.removeChild(b)})}};function Fo(r){r.documentElement.getAttribute("xmlns:w")==="urn:schemas-microsoft-com:office:word"&&$o(r)}const Vo=[Fo,Do],zo=r=>{r.documentElement&&Vo.forEach(t=>{t(r)})},Ko=Gt("quill:clipboard"),Go=[[Node.TEXT_NODE,ia],[Node.TEXT_NODE,yi],["br",Qo],[Node.ELEMENT_NODE,yi],[Node.ELEMENT_NODE,Xo],[Node.ELEMENT_NODE,Yo],[Node.ELEMENT_NODE,na],["li",ea],["ol, ul",sa],["pre",Jo],["tr",ra],["b",dr("bold")],["i",dr("italic")],["strike",dr("strike")],["style",ta]],Zo=[xo,Ki].reduce((r,t)=>(r[t.keyName]=t,r),{}),bi=[Vi,Hr,Pr,Zi,Xi,Ji].reduce((r,t)=>(r[t.keyName]=t,r),{});class tl extends Ct{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=[],Go.concat(this.options.matchers??[]).forEach(s=>{let[n,i]=s;this.addMatcher(n,i)})}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[rt.blotName])return new O().insert(s||"",{[rt.blotName]:n[rt.blotName]});if(!e)return new O().insert(s||"",n);const i=this.convertHTML(e);return vs(i,` `)&&(i.ops[i.ops.length-1].attributes==null||n.table)?i.compose(new O().retain(i.length()-1).delete(1)):i}normalizeHTML(t){zo(t)}convertHTML(t){const e=new DOMParser().parseFromString(t,"text/html");this.normalizeHTML(e);const s=e.body,n=new WeakMap,[i,o]=this.prepareMatching(s,n);return zr(this.quill.scroll,s,i,o,n)}dangerouslyPasteHTML(t,e){let s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:N.sources.API;if(typeof t=="string"){const n=this.convert({html:t,text:""});this.quill.setContents(n,e),this.quill.setSelection(0,N.sources.SILENT)}else{const n=this.convert({html:e,text:""});this.quill.updateContents(new O().retain(t).concat(n),s),this.quill.setSelection(t+n.length(),N.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:i}=this.onCopy(s,e);(o=t.clipboardData)==null||o.setData("text/plain",i),(a=t.clipboardData)==null||a.setData("text/html",n),e&&Vr({range:s,quill:this.quill})}normalizeURIList(t){return t.split(/\r?\n/).filter(e=>e[0]!=="#").join(` `)}onCapturePaste(t){var o,a,u,h,f;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 m=(u=t.clipboardData)==null?void 0:u.getData("text/uri-list");m&&(n=this.normalizeURIList(m))}const i=Array.from(((h=t.clipboardData)==null?void 0:h.files)||[]);if(!s&&i.length>0){this.quill.uploader.upload(e,i);return}if(s&&i.length>0){const m=new DOMParser().parseFromString(s,"text/html");if(m.body.childElementCount===1&&((f=m.body.firstElementChild)==null?void 0:f.tagName)==="IMG"){this.quill.uploader.upload(e,i);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 i=this.quill.getFormat(t.index),o=this.convert({text:s,html:n},i);Ko.log("onPaste",o,{text:s,html:n});const a=new O().retain(t.index).delete(t.length).concat(o);this.quill.updateContents(a,N.sources.USER),this.quill.setSelection(a.length()-t.length,N.sources.SILENT),this.quill.scrollSelectionIntoView()}prepareMatching(t,e){const s=[],n=[];return this.matchers.forEach(i=>{const[o,a]=i;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(u=>{if(e.has(u)){const h=e.get(u);h==null||h.push(a)}else e.set(u,[a])});break}}),[s,n]}}_(tl,"DEFAULTS",{matchers:[]});function pe(r,t,e,s){return s.query(t)?r.reduce((n,i)=>{if(!i.insert)return n;if(i.attributes&&i.attributes[t])return n.push(i);const o=e?{[t]:e}:{};return n.insert(i.insert,{...o,...i.attributes})},new O):r}function vs(r,t){let e="";for(let s=r.ops.length-1;s>=0&&e.lengtho(t,i,r),new O):t.nodeType===t.ELEMENT_NODE?Array.from(t.childNodes||[]).reduce((i,o)=>{let a=zr(r,o,e,s,n);return o.nodeType===t.ELEMENT_NODE&&(a=e.reduce((u,h)=>h(o,u,r),a),a=(n.get(o)||[]).reduce((u,h)=>h(o,u,r),a)),i.concat(a)},new O):new O}function dr(r){return(t,e,s)=>pe(e,r,!0,s)}function Yo(r,t,e){const s=Ut.keys(r),n=St.keys(r),i=ee.keys(r),o={};return s.concat(n).concat(i).forEach(a=>{let u=e.query(a,R.ATTRIBUTE);u!=null&&(o[u.attrName]=u.value(r),o[u.attrName])||(u=Zo[a],u!=null&&(u.attrName===a||u.keyName===a)&&(o[u.attrName]=u.value(r)||void 0),u=bi[a],u!=null&&(u.attrName===a||u.keyName===a)&&(u=bi[a],o[u.attrName]=u.value(r)||void 0))}),Object.entries(o).reduce((a,u)=>{let[h,f]=u;return pe(a,h,f,e)},t)}function Xo(r,t,e){const s=e.query(r);if(s==null)return t;if(s.prototype instanceof ut){const n={},i=s.value(r);if(i!=null)return n[s.blotName]=i,new O().insert(n,s.formats(r,e))}else if(s.prototype instanceof ps&&!vs(t,` `)&&t.insert(` `),"blotName"in s&&"formats"in s&&typeof s.formats=="function")return pe(t,s.blotName,s.formats(r,e),e);return t}function Qo(r,t){return vs(t,` `)||t.insert(` `),t}function Jo(r,t,e){const s=e.query("code-block"),n=s&&"formats"in s&&typeof s.formats=="function"?s.formats(r,e):!0;return pe(t,"code-block",n,e)}function ta(){return new O}function ea(r,t,e){const s=e.query(r);if(s==null||s.blotName!=="list"||!vs(t,` `))return t;let n=-1,i=r.parentNode;for(;i!=null;)["OL","UL"].includes(i.tagName)&&(n+=1),i=i.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 O)}function sa(r,t,e){const s=r;let n=s.tagName==="OL"?"ordered":"bullet";const i=s.getAttribute("data-checked");return i&&(n=i==="true"?"checked":"unchecked"),pe(t,"list",n,e)}function yi(r,t,e){if(!vs(t,` `)){if(Qt(r,e)&&(r.childNodes.length>0||r instanceof HTMLParagraphElement))return t.insert(` `);if(t.length()>0&&r.nextSibling){let s=r.nextSibling;for(;s!=null;){if(Qt(s,e))return t.insert(` `);const n=e.query(s);if(n&&n.prototype instanceof mt)return t.insert(` `);s=s.firstChild}}}return t}function na(r,t,e){var i;const s={},n=r.style||{};return n.fontStyle==="italic"&&(s.italic=!0),n.textDecoration==="underline"&&(s.underline=!0),n.textDecoration==="line-through"&&(s.strike=!0),((i=n.fontWeight)!=null&&i.startsWith("bold")||parseInt(n.fontWeight,10)>=700)&&(s.bold=!0),t=Object.entries(s).reduce((o,a)=>{let[u,h]=a;return pe(o,u,h,e)},t),parseFloat(n.textIndent||0)>0?new O().insert(" ").concat(t):t}function ra(r,t,e){var n,i;const s=((n=r.parentElement)==null?void 0:n.tagName)==="TABLE"?r.parentElement:(i=r.parentElement)==null?void 0:i.parentElement;if(s!=null){const a=Array.from(s.querySelectorAll("tr")).indexOf(r)+1;return pe(t,"table",a,e)}return t}function ia(r,t,e){var n;let s=r.data;if(((n=r.parentElement)==null?void 0:n.tagName)==="O:P")return t.insert(s.trim());if(!el(r)){if(s.trim().length===0&&s.includes(` `)&&!Wo(r,e))return t;s=s.replace(/[^\S\u00a0]/g," "),s=s.replace(/ {2,}/g," "),(r.previousSibling==null&&r.parentElement!=null&&Qt(r.parentElement,e)||r.previousSibling instanceof Element&&Qt(r.previousSibling,e))&&(s=s.replace(/^ /,"")),(r.nextSibling==null&&r.parentElement!=null&&Qt(r.parentElement,e)||r.nextSibling instanceof Element&&Qt(r.nextSibling,e))&&(s=s.replace(/ $/,"")),s=s.replaceAll(" "," ")}return t.insert(s)}class sl extends Ct{constructor(e,s){super(e,s);_(this,"lastRecorded",0);_(this,"ignoreChange",!1);_(this,"stack",{undo:[],redo:[]});_(this,"currentRange",null);this.quill.on(N.events.EDITOR_CHANGE,(n,i,o,a)=>{n===N.events.SELECTION_CHANGE?i&&a!==N.sources.SILENT&&(this.currentRange=i):n===N.events.TEXT_CHANGE&&(this.ignoreChange||(!this.options.userOnly||a===N.sources.USER?this.record(i,o):this.transform(i)),this.currentRange=wr(this.currentRange,i))}),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 i=this.quill.getContents(),o=n.delta.invert(i);this.stack[s].push({delta:o,range:wr(n.range,o)}),this.lastRecorded=0,this.ignoreChange=!0,this.quill.updateContents(n.delta,N.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),i=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),i=a.range)}else this.lastRecorded=o;n.length()!==0&&(this.stack.undo.push({delta:n,range:i}),this.stack.undo.length>this.options.maxStack&&this.stack.undo.shift())}redo(){this.change("redo","undo")}transform(e){vi(this.stack.undo,e),vi(this.stack.redo,e)}undo(){this.change("undo","redo")}restoreSelection(e){if(e.range)this.quill.setSelection(e.range,N.sources.USER);else{const s=oa(this.quill.scroll,e.delta);this.quill.setSelection(s,N.sources.USER)}}}_(sl,"DEFAULTS",{delay:1e3,maxStack:100,userOnly:!1});function vi(r,t){let e=t;for(let s=r.length-1;s>=0;s-=1){const n=r[s];r[s]={delta:e.transform(n.delta,!0),range:n.range&&wr(n.range,e)},e=n.delta.transform(e),r[s].delta.length()===0&&r.splice(s,1)}}function la(r,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=>r.query(s,R.BLOCK)!=null):!1}function oa(r,t){const e=t.reduce((n,i)=>n+(i.delete||0),0);let s=t.length()-e;return la(r,t)&&(s-=1),s}function wr(r,t){if(!r)return r;const e=t.transformPosition(r.index),s=t.transformPosition(r.index+r.length);return{index:e,length:s-e}}class nl extends Ct{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 i=n&&t.selection.normalizeNative(n);if(i){const a=t.selection.normalizedToRange(i);(o=s.dataTransfer)!=null&&o.files&&this.upload(a,s.dataTransfer.files)}})}upload(t,e){const s=[];Array.from(e).forEach(n=>{var i;n&&((i=this.options.mimetypes)!=null&&i.includes(n.type))&&s.push(n)}),s.length>0&&this.options.handler.call(this,t,s)}}nl.DEFAULTS={mimetypes:["image/png","image/jpeg"],handler(r,t){if(!this.quill.scroll.query("image"))return;const e=t.map(s=>new Promise(n=>{const i=new FileReader;i.onload=()=>{n(i.result)},i.readAsDataURL(s)}));Promise.all(e).then(s=>{const n=s.reduce((i,o)=>i.insert({image:o}),new O().retain(r.index).delete(r.length));this.quill.updateContents(n,C.sources.USER),this.quill.setSelection(r.index+s.length,C.sources.SILENT)})}};const aa=["insertText","insertReplacementText"];class ca extends Ct{constructor(t,e){super(t,e),t.root.addEventListener("beforeinput",s=>{this.handleBeforeInput(s)}),/Android/i.test(navigator.userAgent)||t.on(N.events.COMPOSITION_BEFORE_START,()=>{this.handleCompositionStart()})}deleteRange(t){Vr({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 O().retain(t.index).insert(e,s),N.sources.USER)}else this.deleteRange(t);return this.quill.setSelection(t.index+e.length,0,N.sources.SILENT),!0}handleBeforeInput(t){if(this.quill.composition.isComposing||t.defaultPrevented||!aa.includes(t.inputType))return;const e=t.getTargetRanges?t.getTargetRanges()[0]:null;if(!e||e.collapsed===!0)return;const s=ua(t);if(s==null)return;const n=this.quill.selection.normalizeNative(e),i=n?this.quill.selection.normalizedToRange(n):null;i&&this.replaceText(i,s)&&t.preventDefault()}handleCompositionStart(){const t=this.quill.getSelection();t&&this.replaceText(t)}}function ua(r){var t;return typeof r.data=="string"?r.data:(t=r.dataTransfer)!=null&&t.types.includes("text/plain")?r.dataTransfer.getData("text/plain"):null}const ha=/Mac/i.test(navigator.platform),da=100,fa=r=>!!(r.key==="ArrowLeft"||r.key==="ArrowRight"||r.key==="ArrowUp"||r.key==="ArrowDown"||r.key==="Home"||ha&&r.key==="a"&&r.ctrlKey===!0);class pa extends Ct{constructor(e,s){super(e,s);_(this,"isListening",!1);_(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:i}=s;if(!(n instanceof Lt)||!n.uiNode)return!0;const o=getComputedStyle(n.domNode).direction==="rtl";return o&&i.key!=="ArrowRight"||!o&&i.key!=="ArrowLeft"?!0:(this.quill.setSelection(e.index-1,e.length+(i.shiftKey?1:0),N.sources.USER),!1)}})}handleNavigationShortcuts(){this.quill.root.addEventListener("keydown",e=>{!e.defaultPrevented&&fa(e)&&this.ensureListeningToSelectionChange()})}ensureListeningToSelectionChange(){if(this.selectionChangeDeadline=Date.now()+da,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 Lt)||!n.uiNode)return;const i=document.createRange();i.setStartAfter(n.uiNode),i.setEndAfter(n.uiNode),e.removeAllRanges(),e.addRange(i)}}N.register({"blots/block":J,"blots/block/embed":mt,"blots/break":kt,"blots/container":de,"blots/cursor":De,"blots/embed":Ur,"blots/inline":jt,"blots/scroll":Oe,"blots/text":_t,"modules/clipboard":tl,"modules/history":sl,"modules/keyboard":hn,"modules/uploader":nl,"modules/input":ca,"modules/uiNode":pa});class ga extends St{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 ma=new ga("indent","ql-indent",{scope:R.BLOCK,whitelist:[1,2,3,4,5,6,7,8]});class xr extends J{}_(xr,"blotName","blockquote"),_(xr,"tagName","blockquote");class Tr extends J{static formats(t){return this.tagName.indexOf(t.tagName)+1}}_(Tr,"blotName","header"),_(Tr,"tagName",["H1","H2","H3","H4","H5","H6"]);class Es extends de{}Es.blotName="list-container";Es.tagName="OL";class Ns extends J{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(){N.register(Es)}constructor(t,e){super(t,e);const s=e.ownerDocument.createElement("span"),n=i=>{if(!t.isEnabled())return;const o=this.statics.formats(e,t);o==="checked"?(this.format("list","unchecked"),i.preventDefault()):o==="unchecked"&&(this.format("list","checked"),i.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)}}Ns.blotName="list";Ns.tagName="LI";Es.allowedChildren=[Ns];Ns.requiredContainer=Es;class bs 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)}}_(bs,"blotName","bold"),_(bs,"tagName",["STRONG","B"]);class qr extends bs{}_(qr,"blotName","italic"),_(qr,"tagName",["EM","I"]);class Jt 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 rl(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))}}_(Jt,"blotName","link"),_(Jt,"tagName","A"),_(Jt,"SANITIZED_URL","about:blank"),_(Jt,"PROTOCOL_WHITELIST",["http","https","mailto","tel","sms"]);function rl(r,t){const e=document.createElement("a");e.href=r;const s=e.href.slice(0,e.href.indexOf(":"));return t.indexOf(s)>-1}class Lr 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"}}_(Lr,"blotName","script"),_(Lr,"tagName",["SUB","SUP"]);class _r extends bs{}_(_r,"blotName","strike"),_(_r,"tagName",["S","STRIKE"]);class Sr extends jt{}_(Sr,"blotName","underline"),_(Sr,"tagName","U");class Js extends Ur{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`${t}`}}_(Js,"blotName","formula"),_(Js,"className","ql-formula"),_(Js,"tagName","SPAN");const Ei=["alt","height","width"];class kr extends ut{static create(t){const e=super.create(t);return typeof t=="string"&&e.setAttribute("src",this.sanitize(t)),e}static formats(t){return Ei.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 rl(t,["http","https","data"])?t:"//:0"}static value(t){return t.getAttribute("src")}format(t,e){Ei.indexOf(t)>-1?e?this.domNode.setAttribute(t,e):this.domNode.removeAttribute(t):super.format(t,e)}}_(kr,"blotName","image"),_(kr,"tagName","IMG");const Ni=["height","width"];class tn extends mt{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 Ni.reduce((e,s)=>(t.hasAttribute(s)&&(e[s]=t.getAttribute(s)),e),{})}static sanitize(t){return Jt.sanitize(t)}static value(t){return t.getAttribute("src")}format(t,e){Ni.indexOf(t)>-1?e?this.domNode.setAttribute(t,e):this.domNode.removeAttribute(t):super.format(t,e)}html(){const{video:t}=this.value();return`${t}`}}_(tn,"blotName","video"),_(tn,"className","ql-video"),_(tn,"tagName","IFRAME");const us=new St("code-token","hljs",{scope:R.INLINE});class zt extends jt{static formats(t,e){for(;t!=null&&t!==e.domNode;){if(t.classList&&t.classList.contains(rt.className))return super.formats(t,e);t=t.parentNode}}constructor(t,e,s){super(t,e,s),us.add(this.domNode,s)}format(t,e){t!==zt.blotName?super.format(t,e):e?us.add(this.domNode,e):(us.remove(this.domNode),this.domNode.classList.remove(this.statics.className))}optimize(){super.optimize(...arguments),us.value(this.domNode)||this.unwrap()}}zt.blotName="code-token";zt.className="ql-token";class gt extends rt{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(),zt.blotName,!1),super.replaceWith(t,e)}}class hs extends fe{attach(){super.attach(),this.forceNext=!1,this.scroll.emitMount(this)}format(t,e){t===gt.blotName&&(this.forceNext=!0,this.children.forEach(s=>{s.format(t,e)}))}formatAt(t,e,s,n){s===gt.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(` `)} `,i=gt.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((u,h)=>u.concat(Pi(h,!1)),new O),a=t(n,i);o.diff(a).reduce((u,h)=>{let{retain:f,attributes:m}=h;return f?(m&&Object.keys(m).forEach(p=>{[gt.blotName,zt.blotName].includes(p)&&this.formatAt(u,f,p,m[p])}),u+f):u},0)}this.cachedText=n,this.forceNext=!1}}html(t,e){const[s]=this.children.find(t);return`
    ${un(this.code(t,e))}
    
    `}optimize(t){if(super.optimize(t),this.parent!=null&&this.children.head!=null&&this.uiNode!=null){const e=gt.formats(this.children.head.domNode);e!==this.uiNode.value&&(this.uiNode.value=e)}}}hs.allowedChildren=[gt];gt.requiredContainer=hs;gt.allowedChildren=[zt,De,_t,kt];const ba=(r,t,e)=>{if(typeof r.versionString=="string"){const s=r.versionString.split(".")[0];if(parseInt(s,10)>=11)return r.highlight(e,{language:t}).value}return r.highlight(t,e).value};class il extends Ct{static register(){N.register(zt,!0),N.register(gt,!0),N.register(hs,!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:i}=n;return s[i]=!0,s},{}),this.highlightBlot=this.highlightBlot.bind(this),this.initListener(),this.initTimer()}initListener(){this.quill.on(N.events.SCROLL_BLOT_MOUNT,t=>{if(!(t instanceof hs))return;const e=this.quill.root.ownerDocument.createElement("select");this.options.languages.forEach(s=>{let{key:n,label:i}=s;const o=e.ownerDocument.createElement("option");o.textContent=i,o.setAttribute("value",n),e.appendChild(o)}),e.addEventListener("change",()=>{t.format(gt.blotName,e.value),this.quill.root.focus(),this.highlight(t,!0)}),t.uiNode==null&&(t.attachUI(e),t.children.head&&(e.value=gt.formats(t.children.head.domNode)))})}initTimer(){let t=null;this.quill.on(N.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(N.sources.USER);const s=this.quill.getSelection();(t==null?this.quill.scroll.descendants(hs):[t]).forEach(i=>{i.highlight(this.highlightBlot,e)}),this.quill.update(N.sources.SILENT),s!=null&&this.quill.setSelection(s,N.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 un(t).split(` `).reduce((n,i,o)=>(o!==0&&n.insert(` `,{[rt.blotName]:e}),n.insert(i)),new O);const s=this.quill.root.ownerDocument.createElement("div");return s.classList.add(rt.className),s.innerHTML=ba(this.options.hljs,e,t),zr(this.quill.scroll,s,[(n,i)=>{const o=us.value(n);return o?i.compose(new O().retain(i.length(),{[zt.blotName]:o})):i}],[(n,i)=>n.data.split(` `).reduce((o,a,u)=>(u!==0&&o.insert(` `,{[rt.blotName]:e}),o.insert(a)),i)],new WeakMap)}}il.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 fs=class fs extends J{static create(t){const e=super.create();return t?e.setAttribute("data-row",t):e.setAttribute("data-row",Kr()),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===fs.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()}};_(fs,"blotName","table"),_(fs,"tagName","TD");let qt=fs;class Kt extends de{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 i=this.splitAfter(e);i&&i.optimize(),this.prev&&this.prev.optimize()}})}rowOffset(){return this.parent?this.parent.children.indexOf(this):-1}table(){return this.parent&&this.parent.parent}}_(Kt,"blotName","table-row"),_(Kt,"tagName","TR");class Dt extends de{}_(Dt,"blotName","table-body"),_(Dt,"tagName","TBODY");class je extends de{balanceCells(){const t=this.descendants(Kt),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=qt.formats(s.children.head.domNode));const i=this.scroll.create(qt.blotName,n);s.appendChild(i),i.optimize()})})}cells(t){return this.rows().map(e=>e.children.at(t))}deleteColumn(t){const[e]=this.descendant(Dt);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(Dt);e==null||e.children.head==null||e.children.forEach(s=>{const n=s.children.at(t),i=qt.formats(s.children.head.domNode),o=this.scroll.create(qt.blotName,i);s.insertBefore(o,n)})}insertRow(t){const[e]=this.descendant(Dt);if(e==null||e.children.head==null)return;const s=Kr(),n=this.scroll.create(Kt.blotName);e.children.head.children.forEach(()=>{const o=this.scroll.create(qt.blotName,s);n.appendChild(o)});const i=e.children.at(t);e.insertBefore(n,i)}rows(){const t=this.children.head;return t==null?[]:t.children.map(e=>e)}}_(je,"blotName","table-container"),_(je,"tagName","TABLE");je.allowedChildren=[Dt];Dt.requiredContainer=je;Dt.allowedChildren=[Kt];Kt.requiredContainer=Dt;Kt.allowedChildren=[qt];qt.requiredContainer=Kt;function Kr(){return`row-${Math.random().toString(36).slice(2,6)}`}class ya extends Ct{static register(){N.register(qt),N.register(Kt),N.register(Dt),N.register(je)}constructor(){super(...arguments),this.listenBalanceCells()}balanceTables(){this.quill.scroll.descendants(je).forEach(t=>{t.balanceCells()})}deleteColumn(){const[t,,e]=this.getTable();e!=null&&(t.deleteColumn(e.cellOffset()),this.quill.update(N.sources.USER))}deleteRow(){const[,t]=this.getTable();t!=null&&(t.remove(),this.quill.update(N.sources.USER))}deleteTable(){const[t]=this.getTable();if(t==null)return;const e=t.offset();t.remove(),this.quill.update(N.sources.USER),this.quill.setSelection(e,N.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!==qt.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,i]=this.getTable(e);if(i==null)return;const o=i.cellOffset();s.insertColumn(o+t),this.quill.update(N.sources.USER);let a=n.rowOffset();t===0&&(a+=1),this.quill.setSelection(e.index+a,e.length,N.sources.SILENT)}insertColumnLeft(){this.insertColumn(0)}insertColumnRight(){this.insertColumn(1)}insertRow(t){const e=this.quill.getSelection();if(!e)return;const[s,n,i]=this.getTable(e);if(i==null)return;const o=n.rowOffset();s.insertRow(o+t),this.quill.update(N.sources.USER),t>0?this.quill.setSelection(e,N.sources.SILENT):this.quill.setSelection(e.index+n.children.length,e.length,N.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(i=>{const o=new Array(e).fill(` `).join("");return i.insert(o,{table:Kr()})},new O().retain(s.index));this.quill.updateContents(n,N.sources.USER),this.quill.setSelection(s.index,N.sources.SILENT),this.balanceTables()}listenBalanceCells(){this.quill.on(N.events.SCROLL_OPTIMIZE,t=>{t.some(e=>["TD","TR","TBODY","TABLE"].includes(e.target.tagName)?(this.quill.once(N.events.TEXT_CHANGE,(s,n,i)=>{i===N.sources.USER&&this.balanceTables()}),!0):!1)})}}const Ai=Gt("quill:toolbar");class Gr extends Ct{constructor(t,e){var s,n;if(super(t,e),Array.isArray(this.options.container)){const i=document.createElement("div");i.setAttribute("role","toolbar"),va(i,this.options.container),(n=(s=t.container)==null?void 0:s.parentNode)==null||n.insertBefore(i,t.container),this.container=i}else typeof this.options.container=="string"?this.container=document.querySelector(this.options.container):this.container=this.options.container;if(!(this.container instanceof HTMLElement)){Ai.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(i=>{var a;const o=(a=this.options.handlers)==null?void 0:a[i];o&&this.addHandler(i,o)}),Array.from(this.container.querySelectorAll("button, select")).forEach(i=>{this.attach(i)}),this.quill.on(N.events.EDITOR_CHANGE,()=>{const[i]=this.quill.selection.getRange();this.update(i)})}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){Ai.warn("ignoring attaching to nonexistent format",e,t);return}const s=t.tagName==="SELECT"?"change":"click";t.addEventListener(s,n=>{let i;if(t.tagName==="SELECT"){if(t.selectedIndex<0)return;const a=t.options[t.selectedIndex];a.hasAttribute("selected")?i=!1:i=a.value||!1}else t.classList.contains("ql-active")?i=!1:i=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,i);else if(this.quill.scroll.query(e).prototype instanceof ut){if(i=prompt(`Enter ${e}`),!i)return;this.quill.updateContents(new O().retain(o.index).delete(o.length).insert({[e]:i}),N.sources.USER)}else this.quill.format(e,i,N.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,i]=s;if(i.tagName==="SELECT"){let o=null;if(t==null)o=null;else if(e[n]==null)o=i.querySelector("option[selected]");else if(!Array.isArray(e[n])){let a=e[n];typeof a=="string"&&(a=a.replace(/"/g,'\\"')),o=i.querySelector(`option[value="${a}"]`)}o==null?(i.value="",i.selectedIndex=-1):o.selected=!0}else if(t==null)i.classList.remove("ql-active"),i.setAttribute("aria-pressed","false");else if(i.hasAttribute("value")){const o=e[n],a=o===i.getAttribute("value")||o!=null&&o.toString()===i.getAttribute("value")||o==null&&!i.getAttribute("value");i.classList.toggle("ql-active",a),i.setAttribute("aria-pressed",a.toString())}else{const o=e[n]!=null;i.classList.toggle("ql-active",o),i.setAttribute("aria-pressed",o.toString())}})}}Gr.DEFAULTS={};function wi(r,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),r.appendChild(s)}function va(r,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")wi(s,n);else{const i=Object.keys(n)[0],o=n[i];Array.isArray(o)?Ea(s,i,o):wi(s,i,o)}}),r.appendChild(s)})}function Ea(r,t,e){const s=document.createElement("select");s.classList.add(`ql-${t}`),e.forEach(n=>{const i=document.createElement("option");n!==!1?i.setAttribute("value",String(n)):i.setAttribute("selected","selected"),s.appendChild(i)}),r.appendChild(s)}Gr.DEFAULTS={container:null,handlers:{clean(){const r=this.quill.getSelection();if(r!=null)if(r.length===0){const t=this.quill.getFormat();Object.keys(t).forEach(e=>{this.quill.scroll.query(e,R.INLINE)!=null&&this.quill.format(e,!1,N.sources.USER)})}else this.quill.removeFormat(r.index,r.length,N.sources.USER)},direction(r){const{align:t}=this.quill.getFormat();r==="rtl"&&t==null?this.quill.format("align","right",N.sources.USER):!r&&t==="right"&&this.quill.format("align",!1,N.sources.USER),this.quill.format("direction",r,N.sources.USER)},indent(r){const t=this.quill.getSelection(),e=this.quill.getFormat(t),s=parseInt(e.indent||0,10);if(r==="+1"||r==="-1"){let n=r==="+1"?1:-1;e.direction==="rtl"&&(n*=-1),this.quill.format("indent",s+n,N.sources.USER)}},link(r){r===!0&&(r=prompt("Enter link URL:")),this.quill.format("link",r,N.sources.USER)},list(r){const t=this.quill.getSelection(),e=this.quill.getFormat(t);r==="check"?e.list==="checked"||e.list==="unchecked"?this.quill.format("list",!1,N.sources.USER):this.quill.format("list","unchecked",N.sources.USER):this.quill.format("list",r,N.sources.USER)}}};const Na='',Aa='',wa='',xa='',Ta='',qa='',La='',_a='',xi='',Sa='',ka='',Ca='',Oa='',Ia='',Ra='',Ba='',Ma='',Da='',Ua='',ja='',Pa='',Ha='',$a='',Fa='',Va='',za='',Ka='',Ga='',Za='',Wa='',Ya='',Xa='',Qa='',ys={align:{"":Na,center:Aa,right:wa,justify:xa},background:Ta,blockquote:qa,bold:La,clean:_a,code:xi,"code-block":xi,color:Sa,direction:{"":ka,rtl:Ca},formula:Oa,header:{1:Ia,2:Ra,3:Ba,4:Ma,5:Da,6:Ua},italic:ja,image:Pa,indent:{"+1":Ha,"-1":$a},link:Fa,list:{bullet:Va,check:za,ordered:Ka},script:{sub:Ga,super:Za},strike:Wa,table:Ya,underline:Xa,video:Qa},Ja='';let Ti=0;function qi(r,t){r.setAttribute(t,`${r.getAttribute(t)!=="true"}`)}class dn{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"),qi(this.label,"aria-expanded"),qi(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=Ja,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-${Ti}`,Ti+=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 ll extends dn{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 ol extends dn{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=r=>{const{overflowY:t}=getComputedStyle(r,null);return t!=="visible"&&t!=="clip"};class al{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(),i=this.root.getBoundingClientRect();let o=0;if(i.right>n.right&&(o=n.right-i.right,this.root.style.left=`${e+o}px`),i.leftn.bottom){const a=i.bottom-i.top,u=t.bottom-t.top+a;this.root.style.top=`${s-u}px`,this.root.classList.add("ql-flip")}return o}show(){this.root.classList.remove("ql-editing"),this.root.classList.remove("ql-hidden")}}const ec=[!1,"center","right","justify"],sc=["#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"],nc=[!1,"serif","monospace"],rc=["1","2","3",!1],ic=["small",!1,"large","huge"];class As extends Ue{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(i=>{i.container.contains(n.target)||i.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(i=>{if(i.startsWith("ql-")&&(i=i.slice(3),e[i]!=null))if(i==="direction")s.innerHTML=e[i][""]+e[i].rtl;else if(typeof e[i]=="string")s.innerHTML=e[i];else{const o=s.value||"";o!=null&&e[i][o]&&(s.innerHTML=e[i][o])}})})}buildPickers(t,e){this.pickers=Array.from(t).map(n=>{if(n.classList.contains("ql-align")&&(n.querySelector("option")==null&&cs(n,ec),typeof e.align=="object"))return new ol(n,e.align);if(n.classList.contains("ql-background")||n.classList.contains("ql-color")){const i=n.classList.contains("ql-background")?"background":"color";return n.querySelector("option")==null&&cs(n,sc,i==="background"?"#ffffff":"#000000"),new ll(n,e[i])}return n.querySelector("option")==null&&(n.classList.contains("ql-font")?cs(n,nc):n.classList.contains("ql-header")?cs(n,rc):n.classList.contains("ql-size")&&cs(n,ic)),new dn(n)});const s=()=>{this.pickers.forEach(n=>{n.update()})};this.quill.on(C.events.EDITOR_CHANGE,s)}}As.DEFAULTS=te({},Ue.DEFAULTS,{modules:{toolbar:{handlers:{formula(){this.quill.theme.tooltip.edit("formula")},image(){let r=this.container.querySelector("input.ql-image[type=file]");r==null&&(r=document.createElement("input"),r.setAttribute("type","file"),r.setAttribute("accept",this.quill.uploader.options.mimetypes.join(", ")),r.classList.add("ql-image"),r.addEventListener("change",()=>{const t=this.quill.getSelection(!0);this.quill.uploader.upload(t,r.files),r.value=""}),this.container.appendChild(r)),r.click()},video(){this.quill.theme.tooltip.edit("video")}}}}});class cl extends al{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,C.sources.USER),delete this.linkRange):(this.restoreFocus(),this.quill.format("link",t,C.sources.USER)),this.quill.root.scrollTop=e;break}case"video":t=lc(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,C.sources.USER),this.root.getAttribute("data-mode")==="formula"&&this.quill.insertText(s+1," ",C.sources.USER),this.quill.setSelection(s+2,C.sources.USER)}break}}this.textbox.value="",this.hide()}}function lc(r){let t=r.match(/^(?:(https?):\/\/)?(?:(?:www|m)\.)?youtube\.com\/watch.*v=([a-zA-Z0-9_-]+)/)||r.match(/^(?:(https?):\/\/)?(?:(?:www|m)\.)?youtu\.be\/([a-zA-Z0-9_-]+)/);return t?`${t[1]||"https"}://www.youtube.com/embed/${t[2]}?showinfo=0`:(t=r.match(/^(?:(https?):\/\/)?(?:www\.)?vimeo\.com\/(\d+)/))?`${t[1]||"https"}://player.vimeo.com/video/${t[2]}/`:r}function cs(r,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)),r.appendChild(n)})}const oc=[["bold","italic","link"],[{header:1},{header:2},"blockquote"]];class ul extends cl{constructor(t,e){super(t,e),this.quill.on(C.events.EDITOR_CHANGE,(s,n,i,o)=>{if(s===C.events.SELECTION_CHANGE)if(n!=null&&n.length>0&&o===C.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 u=this.quill.getBounds(n);u!=null&&this.position(u)}else{const u=a[a.length-1],h=this.quill.getIndex(u),f=Math.min(u.length()-1,n.index+n.length-h),m=this.quill.getBounds(new he(h,f));m!=null&&this.position(m)}}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(C.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}}_(ul,"TEMPLATE",['','
    ','','',"
    "].join(""));class hl extends As{constructor(t,e){e.modules.toolbar!=null&&e.modules.toolbar.container==null&&(e.modules.toolbar.container=oc),super(t,e),this.quill.container.classList.add("ql-bubble")}extendToolbar(t){this.tooltip=new ul(this.quill,this.options.bounds),t.container!=null&&(this.tooltip.root.appendChild(t.container),this.buildButtons(t.container.querySelectorAll("button"),ys),this.buildPickers(t.container.querySelectorAll("select"),ys))}}hl.DEFAULTS=te({},As.DEFAULTS,{modules:{toolbar:{handlers:{link(r){r?this.quill.theme.tooltip.edit():this.quill.format("link",!1,N.sources.USER)}}}}});const ac=[[{header:["1","2","3",!1]}],["bold","italic","underline","link"],[{list:"ordered"},{list:"bullet"}],["clean"]];class dl extends cl{constructor(){super(...arguments);_(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,C.sources.USER),delete this.linkRange}e.preventDefault(),this.hide()}),this.quill.on(C.events.SELECTION_CHANGE,(e,s,n)=>{if(e!=null){if(e.length===0&&n===C.sources.USER){const[i,o]=this.quill.scroll.descendant(Jt,e.index);if(i!=null){this.linkRange=new he(e.index-o,i.length());const a=Jt.formats(i.domNode);this.preview.textContent=a,this.preview.setAttribute("href",a),this.show();const u=this.quill.getBounds(this.linkRange);u!=null&&this.position(u);return}}else delete this.linkRange;this.hide()}})}show(){super.show(),this.root.removeAttribute("data-mode")}}_(dl,"TEMPLATE",['','','',''].join(""));class fl extends As{constructor(t,e){e.modules.toolbar!=null&&e.modules.toolbar.container==null&&(e.modules.toolbar.container=ac),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"),ys),this.buildPickers(t.container.querySelectorAll("select"),ys),this.tooltip=new dl(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)}))}}fl.DEFAULTS=te({},As.DEFAULTS,{modules:{toolbar:{handlers:{link(r){if(r){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,N.sources.USER)}}}}});N.register({"attributors/attribute/direction":Ki,"attributors/class/align":Fi,"attributors/class/background":qo,"attributors/class/color":To,"attributors/class/direction":Gi,"attributors/class/font":Yi,"attributors/class/size":Qi,"attributors/style/align":Vi,"attributors/style/background":Hr,"attributors/style/color":Pr,"attributors/style/direction":Zi,"attributors/style/font":Xi,"attributors/style/size":Ji},!0);N.register({"formats/align":Fi,"formats/direction":Gi,"formats/indent":ma,"formats/background":Hr,"formats/color":Pr,"formats/font":Yi,"formats/size":Qi,"formats/blockquote":xr,"formats/code-block":rt,"formats/header":Tr,"formats/list":Ns,"formats/bold":bs,"formats/code":$r,"formats/italic":qr,"formats/link":Jt,"formats/script":Lr,"formats/strike":_r,"formats/underline":Sr,"formats/formula":Js,"formats/image":kr,"formats/video":tn,"modules/syntax":il,"modules/table":ya,"modules/toolbar":Gr,"themes/bubble":hl,"themes/snow":fl,"ui/icons":ys,"ui/picker":dn,"ui/icon-picker":ol,"ui/color-picker":ll,"ui/tooltip":al},!0);const cc={class:"position-create-container"},uc={class:"header-container"},hc={class:"salary-range-container"},dc={class:"job-conditions-container"},fc={class:"editor-container"},pc={class:"editor-container"},gc=ml({__name:"index",setup(r){const t=(L,T)=>{let D=null;return(...K)=>{D&&clearTimeout(D),D=setTimeout(()=>{L(...K)},T)}},e=bl(),s=as(),n=yl({title:"",job_category:"",job_type:"",city:"",location:[],location_names:[],detailed_address:"",benefits:[],requirements:"",salary_type:"月薪",start_salary:"",end_salary:"",work_experience_required:"",education_required:"",salary_range:"",department:"",end_date:"",description:"",province:"",district:"",location_str:"",status:0,competency_tags:[]}),i=(L,T,D)=>{if(!T){D(new Error(L.message));return}if(!T.replace(/<[^>]*>/g,"").trim()){D(new Error(L.message));return}D()},a={title:[{required:!0,message:"职位名称必填",trigger:"blur"}],job_category:[{required:!0,message:"职位类别必填",trigger:"change"}],job_type:[{required:!0,message:"职位性质必填",trigger:"change"}],location:[{required:!0,message:"工作地点必填",trigger:"change"}],detailed_address:[{required:!0,message:"详细地址必填",trigger:"blur"}],department:[{required:!0,message:"所属部门必填",trigger:"blur"}],status:[{required:!0,message:"职位状态必填",trigger:"change"}],end_date:[{required:!0,message:"截止日期必填",trigger:"change"}],requirements:[{required:!0,message:"职位要求必填",validator:i,trigger:"blur"}],description:[{required:!0,message:"职位描述必填",validator:i,trigger:"blur"}],salary_range:[{required:!0,validator:(L,T,D)=>{if(!n.start_salary||!n.end_salary){D(new Error("请完整填写起始薪资和最高薪资"));return}const K=Number(n.start_salary),P=Number(n.end_salary);if(isNaN(K)||isNaN(P)){D(new Error("薪资必须为有效数字"));return}if(K<0||P<0){D(new Error("薪资不能为负数"));return}if(K>P){D(new Error("起始薪资不能高于最高薪资"));return}D()},trigger:"blur"}]},u=as(null),h=as(null);let f=null,m=null;const p=Sl(),g=L=>{if(console.log("地址选择变化:",L),L&&Array.isArray(L)&&L.length>0){const[T,D,K]=L,P=p.find(ht=>ht.code===T);let k,G;P&&P.children&&(k=P.children.find(ht=>ht.code===D),k&&k.children&&(G=k.children.find(ht=>ht.code===K))),n.location_names=[(P==null?void 0:P.name)||"",(k==null?void 0:k.name)||"",(G==null?void 0:G.name)||""].filter(Boolean),n.province=(P==null?void 0:P.name)||"",n.city=(k==null?void 0:k.name)||"",n.district=(G==null?void 0:G.name)||"",n.location_str=n.location_names.join("/")}else n.location_names=[],n.province="",n.city="",n.district="",n.location_str=""},b=(L=!1)=>{if(n.start_salary&&n.end_salary){const T=Number(n.start_salary),D=Number(n.end_salary);T>D&&(n.end_salary=n.start_salary,L?ue.warning("起始薪资不能高于最高薪资,已自动调整为相同值"):ue.warning("起始薪资不能高于最高薪资,已自动调整"))}n.salary_type&&n.start_salary&&n.end_salary?n.salary_range=`${n.salary_type} ${n.start_salary}-${n.end_salary}`:n.salary_range=""},E=()=>{if(n.start_salary&&n.end_salary){const L=Number(n.start_salary),T=Number(n.end_salary);L>T&&(n.end_salary=n.start_salary,ue.warning("起始薪资不能高于最高薪资,已自动调整为相同值"))}b(),s.value&&s.value.validateField("salary_range")},v=()=>{E()},w=t(async()=>{if(!(!n.title||!n.work_experience_required||!n.education_required||!n.salary_range))try{const L=await Ll({position_title:n.title,experience_req:n.work_experience_required,education_req:n.education_required,salary_range:n.salary_range,tenant_id:_l.get("tenant_id")});if(L.code===2e3&&L.data){const T=`
      ${L.data.responsibilities.map(D=>`
    • ${D}
    • `).join(` `)}

    经验要求:${L.data.experience}

    学历要求:${L.data.education}

      ${L.data.skills.map(D=>`
    • ${D}
    • `).join(` `)}
      ${L.data.qualities.map(D=>`
    • ${D}
    • `).join(` `)}
      ${L.data.bonus.map(D=>`
    • ${D}
    • `).join(` `)}
    `;m&&(m.clipboard.dangerouslyPasteHTML(T),n.description=T)}}catch(L){console.error("生成职位描述失败:",L),ue.error("生成职位描述失败,请稍后重试")}},1e3);vl(()=>[n.title,n.work_experience_required,n.education_required,n.salary_range],()=>{w()},{deep:!0});const x=as([]);as({});const I=async()=>{try{const L=await Tl({page:1,pageSize:1e3});console.log("response",L),x.value=L.data.items}catch(L){console.error("获取胜任力标签失败:",L),ue.error("获取胜任力标签失败")}};El(()=>{u.value&&(f=new N(u.value,{theme:"snow",modules:{toolbar:[["bold","italic","underline","strike"],["blockquote","code-block"],[{header:1},{header:2}],[{list:"ordered"},{list:"bullet"}],[{script:"sub"},{script:"super"}],[{indent:"-1"},{indent:"+1"}],[{direction:"rtl"}],[{size:["small",!1,"large","huge"]}],[{header:[1,2,3,4,5,6,!1]}],[{color:[]},{background:[]}],[{font:[]}],[{align:[]}],["clean"]]},placeholder:"请输入职位要求"}),n.requirements&&f.clipboard.dangerouslyPasteHTML(n.requirements),f.on("text-change",()=>{n.requirements=f.root.innerHTML,Wr(()=>{var L;(L=s.value)==null||L.validateField("requirements")})})),h.value&&(m=new N(h.value,{theme:"snow",modules:{toolbar:[["bold","italic","underline","strike"],["blockquote","code-block"],[{header:1},{header:2}],[{list:"ordered"},{list:"bullet"}],[{script:"sub"},{script:"super"}],[{indent:"-1"},{indent:"+1"}],[{direction:"rtl"}],[{size:["small",!1,"large","huge"]}],[{header:[1,2,3,4,5,6,!1]}],[{color:[]},{background:[]}],[{font:[]}],[{align:[]}],["clean"]]},placeholder:"请输入职位描述"}),n.description&&m.clipboard.dangerouslyPasteHTML(n.description),m.on("text-change",()=>{n.description=m.root.innerHTML,Wr(()=>{var L;(L=s.value)==null||L.validateField("description")})})),I()}),Nl(()=>{f=null,m=null});const S=()=>{e.push("/position/list")},U=async()=>{s.value&&(f&&(n.requirements=f.root.innerHTML),m&&(n.description=m.root.innerHTML),b(),await s.value.validate(async(L,T)=>{if(L)try{const D={...n};D.location_names&&D.location_names.length>0&&(D.province=D.location_names[0],D.city=D.location_names[1]||"",D.district=D.location_names[2]||"",D.location=D.location_names,D.location_str=D.location_names.join("/"));const{location_names:K,...P}=D,k=await ql(P);ue.success("职位添加成功"),e.push(`/position/detail?id=${k.data.id}`)}catch(D){console.error("保存失败:",D),ue.error("保存失败,请重试")}else console.log("验证失败:",T)}))};return(L,T)=>{const D=At("page-header"),K=At("el-input"),P=At("el-form-item"),k=At("el-option"),G=At("el-select"),ht=At("el-cascader"),se=At("el-input-number"),Pe=At("el-date-picker"),ge=At("el-button"),He=At("el-form"),$e=At("el-card");return wl(),Al("div",cc,[wt("div",uc,[q(D,{title:"新增职位",onBack:S})]),q($e,{class:"form-card"},{default:z(()=>[T[16]||(T[16]=wt("div",{class:"section-title"},[wt("div",{class:"section-line"}),wt("span",null,"职位详情")],-1)),q(He,{ref_key:"formRef",ref:s,model:n,rules:a,"label-width":"120px","label-position":"right"},{default:z(()=>[q(P,{label:"职位名称",prop:"title"},{default:z(()=>[q(K,{modelValue:n.title,"onUpdate:modelValue":T[0]||(T[0]=M=>n.title=M),placeholder:"请输入职位名称",maxlength:"20","show-word-limit":""},null,8,["modelValue"])]),_:1}),q(P,{label:"职位类别",prop:"job_category"},{default:z(()=>[q(G,{modelValue:n.job_category,"onUpdate:modelValue":T[1]||(T[1]=M=>n.job_category=M),placeholder:"请选择职位类别"},{default:z(()=>[q(k,{label:"技术",value:"技术"}),q(k,{label:"产品",value:"产品"}),q(k,{label:"设计",value:"设计"}),q(k,{label:"运营",value:"运营"}),q(k,{label:"市场",value:"市场"}),q(k,{label:"销售",value:"销售"}),q(k,{label:"行政",value:"行政"}),q(k,{label:"财务",value:"财务"}),q(k,{label:"人力资源",value:"人力资源"}),q(k,{label:"法务",value:"法务"}),q(k,{label:"其他",value:"其他"})]),_:1},8,["modelValue"])]),_:1}),q(P,{label:"职位性质",prop:"job_type"},{default:z(()=>[q(G,{modelValue:n.job_type,"onUpdate:modelValue":T[2]||(T[2]=M=>n.job_type=M),placeholder:"请选择职位性质"},{default:z(()=>[q(k,{label:"全职",value:"0"}),q(k,{label:"兼职",value:"1"}),q(k,{label:"实习",value:"2"}),q(k,{label:"其他",value:"3"})]),_:1},8,["modelValue"])]),_:1}),q(P,{label:"工作地点",prop:"location"},{default:z(()=>[q(ht,{modelValue:n.location,"onUpdate:modelValue":T[3]||(T[3]=M=>n.location=M),options:xl(p),props:{expandTrigger:"hover",checkStrictly:!1,value:"code",label:"name"},style:{width:"100%"},placeholder:"请选择工作地点",clearable:"",onChange:g},null,8,["modelValue","options"])]),_:1}),q(P,{label:"详细地址",prop:"detailed_address"},{default:z(()=>[q(K,{modelValue:n.detailed_address,"onUpdate:modelValue":T[4]||(T[4]=M=>n.detailed_address=M),placeholder:"请输入详细地址"},null,8,["modelValue"])]),_:1}),q(P,{label:"福利待遇",prop:"benefits"},{default:z(()=>[q(G,{modelValue:n.benefits,"onUpdate:modelValue":T[5]||(T[5]=M=>n.benefits=M),placeholder:"请选择福利待遇",multiple:""},{default:z(()=>[q(k,{label:"五险一金",value:"五险一金"}),q(k,{label:"年终奖",value:"年终奖"}),q(k,{label:"带薪年假",value:"带薪年假"}),q(k,{label:"定期体检",value:"定期体检"}),q(k,{label:"节日福利",value:"节日福利"}),q(k,{label:"员工旅游",value:"员工旅游"}),q(k,{label:"弹性工作",value:"弹性工作"}),q(k,{label:"免费班车",value:"免费班车"}),q(k,{label:"餐补",value:"餐补"}),q(k,{label:"交通补贴",value:"交通补贴"})]),_:1},8,["modelValue"])]),_:1}),q(P,{label:"职位薪资",prop:"salary_range"},{default:z(()=>[wt("div",hc,[q(G,{modelValue:n.salary_type,"onUpdate:modelValue":T[6]||(T[6]=M=>n.salary_type=M),placeholder:"薪资类型",class:"salary-type-select",onChange:b},{default:z(()=>[q(k,{label:"月薪",value:"月薪"}),q(k,{label:"年薪",value:"年薪"}),q(k,{label:"日薪",value:"日薪"}),q(k,{label:"时薪",value:"时薪"})]),_:1},8,["modelValue"]),q(se,{modelValue:n.start_salary,"onUpdate:modelValue":T[7]||(T[7]=M=>n.start_salary=M),placeholder:"起始薪资",class:"salary-input",type:"number","controls-position":"right",min:"0",onInput:b,onBlur:v},null,8,["modelValue"]),T[13]||(T[13]=wt("span",{class:"salary-separator"},"-",-1)),q(se,{modelValue:n.end_salary,"onUpdate:modelValue":T[8]||(T[8]=M=>n.end_salary=M),placeholder:"最高薪资",class:"salary-input","controls-position":"right",type:"number",min:"0",onInput:b,onBlur:v},null,8,["modelValue"])])]),_:1}),q(P,{label:"职位条件"},{default:z(()=>[wt("div",dc,[q(G,{modelValue:n.work_experience_required,"onUpdate:modelValue":T[9]||(T[9]=M=>n.work_experience_required=M),placeholder:"工作经验",class:"condition-select"},{default:z(()=>[q(k,{label:"不限",value:"不限"}),q(k,{label:"应届毕业生",value:"应届毕业生"}),q(k,{label:"1年以下",value:"1年以下"}),q(k,{label:"1-3年",value:"1-3年"}),q(k,{label:"3-5年",value:"3-5年"}),q(k,{label:"5-10年",value:"5-10年"}),q(k,{label:"10年以上",value:"10年以上"})]),_:1},8,["modelValue"]),q(G,{modelValue:n.education_required,"onUpdate:modelValue":T[10]||(T[10]=M=>n.education_required=M),placeholder:"学历要求",class:"condition-select"},{default:z(()=>[q(k,{label:"不限",value:"不限"}),q(k,{label:"高中",value:"高中"}),q(k,{label:"大专",value:"大专"}),q(k,{label:"本科",value:"本科"}),q(k,{label:"硕士",value:"硕士"}),q(k,{label:"博士",value:"博士"})]),_:1},8,["modelValue"])])]),_:1}),q(P,{label:"职位状态",prop:"status"},{default:z(()=>[q(G,{modelValue:n.status,"onUpdate:modelValue":T[11]||(T[11]=M=>n.status=M),disabled:"",placeholder:"请选择职位状态"},{default:z(()=>[q(k,{label:"未发布",value:0}),q(k,{label:"已发布",value:1})]),_:1},8,["modelValue"])]),_:1}),q(P,{label:"截止日期",prop:"end_date"},{default:z(()=>[q(Pe,{modelValue:n.end_date,"onUpdate:modelValue":T[12]||(T[12]=M=>n.end_date=M),type:"datetime",placeholder:"请选择截止日期","value-format":"YYYY-MM-DD HH:mm:ss"},null,8,["modelValue"])]),_:1}),q(P,{label:"职位要求",prop:"requirements"},{default:z(()=>[wt("div",fc,[wt("div",{ref_key:"quillEditor",ref:u,class:"quill-editor"},null,512)])]),_:1}),q(P,{label:"职位描述",prop:"description"},{default:z(()=>[wt("div",pc,[wt("div",{ref_key:"descriptionEditor",ref:h,class:"quill-editor"},null,512)])]),_:1}),q(P,null,{default:z(()=>[q(ge,{type:"primary",onClick:U},{default:z(()=>T[14]||(T[14]=[Yr("保存")])),_:1}),q(ge,{onClick:S},{default:z(()=>T[15]||(T[15]=[Yr("取消")])),_:1})]),_:1})]),_:1},8,["model"])]),_:1})])}}}),Lc=kl(gc,[["__scopeId","data-v-48571d34"]]);export{Lc as default};