文档归位:雪猫 README 门面 + 公告/制作文档/发布工具并入仓库根
Release Tag / validate-version (push) Waiting to run

This commit is contained in:
天天的鸟蛋蛋 committed 2026-11-12 06:29:38 +08:00
1 parent b9655a5ab1
commit e292824161
122 files changed
+90002 -69

No files matched your search

@@ -0,0 +1,55 @@
var mo=Object.defineProperty;var bo=(s,t,e)=>t in s?mo(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e;var q=(s,t,e)=>bo(s,typeof t!="symbol"?t+"":t,e);import{j as b,r as H}from"./react-vendor-jWT2yUdV.js";import{t as yo,V as dt,v as il,x as vo,y as xo,z as wo,B as al,X as Xi,Y as No,D as Ao,E as Eo,b as lt,c as To,U as Co,O as Lo,Q as So,R as _o,S as Oo,T as qo}from"./index-DiaaLdUu.js";import{z as Er}from"./react-hot-toast-cGcFZPSt.js";import{c as Te,g as ll,l as Yi}from"./qface-BZLvZXJ8.js";import{t as xt}from"./chunk-6LIX6LVT-B246pOuK.js";import{u as Io}from"./use-dialog-CRIMuzeE.js";import{i as Kt}from"./chunk-2QAN2V2R-B2qCPZrG.js";import{p as $t,a as Ut,b as Ft}from"./chunk-2QQAR2RD-YG5LNmAk.js";import{d as Ro,e as jo}from"./index-_HIxriDC.js";import{t as Qi,u as ko,v as Mo}from"./index-FvTxWQTZ.js";import{n as Gs,o as Vs,p as Bo,q as Po,r as Do,s as $o}from"./index-DE7yoXMZ.js";import{g as Uo,h as Fo}from"./index-DPx4wqle.js";import{i as Ho}from"./chunk-MLPFQTYO-DSnBqIsb.js";import{p as zo}from"./index-BBhZPeTB.js";import{F as Go}from"./chunk-SLABUSGS-Cmz8sGrU.js";import{s as Vo,l as Ko}from"./chunk-KVDW62ZT-CGYYmJoP.js";import{t as Zo,a as Ji}from"./chunk-ML27DD5T-ZFWrMOn-.js";import{u as Wo,C as Ur}from"./react-hook-form-DTbqnRcd.js";import{e as ta,f as Xo}from"./code_editor-TFSnOENo.js";import{G as Yo}from"./iconBase-B7bT1FlI.js";var Hn=yo({slots:{base:"inline-flex items-center justify-between h-fit rounded-large gap-2",pre:"bg-transparent text-inherit font-mono font-normal inline-block whitespace-nowrap",content:"flex flex-col",symbol:"select-none",copyButton:["group","relative","z-10","text-large","text-inherit","data-[hover=true]:bg-transparent"],copyIcon:["absolute text-inherit opacity-100 scale-100 group-data-[copied=true]:opacity-0 group-data-[copied=true]:scale-50"],checkIcon:["absolute text-inherit opacity-0 scale-50 group-data-[copied=true]:opacity-100 group-data-[copied=true]:scale-100"]},variants:{variant:{flat:"",solid:"",bordered:"border-medium bg-transparent",shadow:""},color:{default:{},primary:{},secondary:{},success:{},warning:{},danger:{}},size:{sm:{base:"px-1.5 py-0.5 text-tiny rounded-small"},md:{base:"px-3 py-1.5 text-small rounded-medium"},lg:{base:"px-4 py-2 text-medium rounded-large"}},radius:{none:{base:"rounded-none"},sm:{base:"rounded-small"},md:{base:"rounded-medium"},lg:{base:"rounded-large"}},fullWidth:{true:{base:"w-full"}},disableAnimation:{true:{},false:{copyIcon:"transition-transform-opacity",checkIcon:"transition-transform-opacity"}}},defaultVariants:{color:"default",variant:"flat",size:"md",fullWidth:!1},compoundVariants:[{variant:["solid","shadow"],color:"default",class:{copyButton:"data-[focus-visible]:outline-default-foreground"}},{variant:["solid","shadow"],color:"primary",class:{copyButton:"data-[focus-visible]:outline-primary-foreground"}},{variant:["solid","shadow"],color:"secondary",class:{copyButton:"data-[focus-visible]:outline-secondary-foreground"}},{variant:["solid","shadow"],color:"success",class:{copyButton:"data-[focus-visible]:outline-success-foreground"}},{variant:["solid","shadow"],color:"warning",class:{copyButton:"data-[focus-visible]:outline-warning-foreground"}},{variant:["solid","shadow"],color:"danger",class:{copyButton:"data-[focus-visible]:outline-danger-foreground"}},{variant:"flat",color:"default",class:{base:dt.flat.default}},{variant:"flat",color:"primary",class:{base:dt.flat.primary}},{variant:"flat",color:"secondary",class:{base:dt.flat.secondary}},{variant:"flat",color:"success",class:{base:dt.flat.success}},{variant:"flat",color:"warning",class:{base:dt.flat.warning}},{variant:"flat",color:"danger",class:{base:dt.flat.danger}},{variant:"solid",color:"default",class:{base:dt.solid.default}},{variant:"solid",color:"primary",class:{base:dt.solid.primary}},{variant:"solid",color:"secondary",class:{base:dt.solid.secondary}},{variant:"solid",color:"success",class:{base:dt.solid.success}},{variant:"solid",color:"warning",class:{base:dt.solid.warning}},{variant:"solid",color:"danger",class:{base:dt.solid.danger}},{variant:"shadow",color:"default",class:{base:dt.shadow.default}},{variant:"shadow",color:"primary",class:{base:dt.shadow.primary}},{variant:"shadow",color:"secondary",class:{base:dt.shadow.secondary}},{variant:"shadow",color:"success",class:{base:dt.shadow.success}},{variant:"shadow",color:"warning",class:{base:dt.shadow.warning}},{variant:"shadow",color:"danger",class:{base:dt.shadow.danger}},{variant:"bordered",color:"default",class:{base:dt.bordered.default}},{variant:"bordered",color:"primary",class:{base:dt.bordered.primary}},{variant:"bordered",color:"secondary",class:{base:dt.bordered.secondary}},{variant:"bordered",color:"success",class:{base:dt.bordered.success}},{variant:"bordered",color:"warning",class:{base:dt.bordered.warning}},{variant:"bordered",color:"danger",class:{base:dt.bordered.danger}}]}),Qo=s=>b.jsxs("svg",{"aria-hidden":"true",fill:"none",focusable:"false",height:"1em",role:"presentatiLine truncated
`){const v=new o.default(this.ops);let w=new m,N=0;for(;v.hasNext();){if(v.peekType()!=="insert")return;const T=v.peek(),O=l.default.length(T)-v.peekLength(),k=typeof T.insert=="string"?T.insert.indexOf(d,O)-O:-1;if(k<0)w.push(v.next());else if(k>0)w.push(v.next(k));else{if(f(w,v.next(1).attributes||{},N)===!1)return;N+=1,w=new m}}w.length()>0&&f(w,{},N)}invert(f){const d=new m;return this.reduce((v,w)=>{if(w.insert)d.delete(l.default.length(w));else{if(typeof w.retain=="number"&&w.attributes==null)return d.retain(w.retain),v+w.retain;if(w.delete||typeof w.retain=="number"){const N=w.delete||w.retain;return f.slice(v,v+N).forEach(O=>{w.delete?d.push(O):w.retain&&w.attributes&&d.retain(l.default.length(O),i.default.invert(w.attributes,O.attributes))}),v+N}else if(typeof w.retain=="object"&&w.retain!==null){const N=f.slice(v,v+1),T=new o.default(N.ops).next(),[O,k,z]=h(w.retain,T.insert),j=m.getHandler(O);return d.retain({[O]:j.invert(k,z)},i.default.invert(w.attributes,T.attributes)),v+1}}return v},0),d.chop()}transform(f,d=!1){if(d=!!d,typeof f=="number")return this.transformPosition(f,d);const v=f,w=new o.default(this.ops),N=new o.default(v.ops),T=new m;for(;w.hasNext()||N.hasNext();)if(w.peekType()==="insert"&&(d||N.peekType()!=="insert"))T.retain(l.default.length(w.next()));else if(N.peekType()==="insert")T.push(N.next());else{const O=Math.min(w.peekLength(),N.peekLength()),k=w.next(O),z=N.next(O);if(k.delete)continue;if(z.delete)T.push(z);else{const j=k.retain,V=z.retain;let tt=typeof V=="object"&&V!==null?V:O;if(typeof j=="object"&&j!==null&&typeof V=="object"&&V!==null){const J=Object.keys(j)[0];if(J===Object.keys(V)[0]){const pt=m.getHandler(J);pt&&(tt={[J]:pt.transform(j[J],V[J],d)})}}T.retain(tt,i.default.transform(k.attributes,z.attributes,d))}}return T.chop()}transformPosition(f,d=!1){d=!!d;const v=new o.default(this.ops);let w=0;for(;v.hasNext()&&w<=f;){const N=v.peekLength(),T=v.peekType();if(v.next(),T==="delete"){f-=Math.min(N,f-w);continue}else T==="insert"&&(w<f||!d)&&(f+=N);w+=N}return f}}m.Op=l.default,m.OpIterator=o.default,m.AttributeMap=i.default,m.handlers={},t.default=m,s.exports=m,s.exports.default=m})(_s,_s.exports)),_s.exports}var Dt=$d();const P=ll(Dt);class Jt extends Rt{static value(){}optimize(){(this.prev||this.next)&&this.remove()}length(){return 0}value(){return""}}Jt.blotName="break";Jt.tagName="BR";let Yt=class extends zs{};const Ud={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function Qs(s){return s.replace(/[&<>"']/g,t=>Ud[t])}const ie=class ie extends Bi{static compare(t,e){const r=ie.order.indexOf(t),n=ie.order.indexOf(e);return r>=0||n>=0?r-n:t===e?0:t<e?-1:1}formatAt(t,e,r,n){if(ie.compare(this.statics.blotName,r)<0&&this.scroll.query(r,D.BLOT)){const i=this.isolate(t,e);n&&i.wrap(r,n)}else super.formatAt(t,e,r,n)}optimize(t){if(super.optimize(t),this.parent instanceof ie&&ie.compare(this.statics.blotName,this.parent.statics.blotName)>0){const e=this.parent.isolate(this.offset(),this.length());this.moveChildren(e),e.wrap(this)}}};q(ie,"allowedChildren",[ie,Jt,Rt,Yt]),q(ie,"order",["cursor","inline","link","underline","strike","italic","bold","script","code"]);let ce=ie;const ka=1;class At extends ts{constructor(){super(...arguments);q(this,"cache",{})}delta(){return this.cache.delta==null&&(this.cache.delta=Ul(this)),this.cache.delta}deleteAt(e,r){super.deleteAt(e,r),this.cache={}}formatAt(e,r,n,i){r<=0||(this.scroll.query(n,D.BLOCK)?e+r===this.length()&&this.format(n,i):super.formatAt(e,Math.min(r,this.length()-e-1),n,i),this.cache={})}insertAt(e,r,n){if(n!=null){super.insertAt(e,r,n),this.cache={};return}if(r.length===0)return;const i=r.split(`
`),l=i.shift();l.length>0&&(e<this.length()-1||this.children.tail==null?super.insertAt(Math.min(e,this.length()-1),l):this.children.tail.insertAt(this.children.tail.length(),l),this.cache={});let o=this;i.reduce((c,h)=>(o=o.split(c,!0),o.insertAt(0,h),h.length),e+l.length)}insertBefore(e,r){const{head:n}=this.children;super.insertBefore(e,r),n instanceof Jt&&n.remove(),this.cache={}}length(){return this.cache.length==null&&(this.cache.length=super.length()+ka),this.cache.length}moveChildren(e,r){super.moveChildren(e,r),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 r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(r&&(e===0||e>=this.length()-ka)){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,r);return this.cache={},n}}At.blotName="block";At.tagName="P";At.defaultChild=Jt;At.allowedChildren=[Jt,ce,Rt,Yt];let Pt=class extends Rt{attach(){super.attach(),this.attributes=new Xs(this.domNode)}delta(){return new P().insert(this.value(),{...this.formats(),...this.attributes.values()})}format(t,e){const r=this.scroll.query(t,D.BLOCK_ATTRIBUTE);r!=null&&this.attributes.attribute(r,e)}formatAt(t,e,r,n){this.format(r,n)}insertAt(t,e,r){if(r!=null){super.insertAt(t,e,r);return}const n=e.split(`
`),i=n.pop(),l=n.map(c=>{const h=this.scroll.create(At.blotName);return h.insertAt(0,c),h}),o=this.split(t);l.forEach(c=>{this.parent.insertBefore(c,o)}),i&&this.parent.insertBefore(this.scroll.create("text",i),o)}};Pt.scope=D.BLOCK_BLOT;function Ul(s){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return s.descendants(Lt).reduce((e,r)=>r.length()===0?e:e.insert(r.value(),Mt(r,{},t)),new P).insert(`
`,Mt(s))}function Mt(s){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;return s==null||("formats"in s&&typeof s.formats=="function"&&(t={...t,...s.formats()},e&&delete t["code-token"]),s.parent==null||s.parent.statics.blotName==="scroll"||s.parent.statics.scope!==s.statics.scope)?t:Mt(s.parent,t,e)}const kt=class kt extends Rt{static value(){}constructor(t,e,r){super(t,e),this.selection=r,this.textNode=document.createTextNode(kt.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 r=this,n=0;for(;r!=null&&r.statics.scope!==D.BLOCK_BLOT;)n+=r.offset(r.parent),r=r.parent;r!=null&&(this.savedLength=kt.CONTENTS.length,r.optimize(),r.formatAt(n,kt.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 Yt?this.prev:null,r=e?e.length():0,n=this.next instanceof Yt?this.next:null,i=n?n.text:"",{textNode:l}=this,o=l.data.split(kt.CONTENTS).join("");l.data=kt.CONTENTS;let c;if(e)c=e,(o||n)&&(e.insertAt(e.length(),o+i),n&&n.remove());else if(n)c=n,n.insertAt(0,o);else{const h=document.createTextNode(o);c=this.scroll.create(h),this.parent.insertBefore(c,this)}if(this.remove(),t){const h=(f,d)=>e&&f===e.domNode?d:f===l?r+d-1:n&&f===n.domNode?r+o.length+d:null,m=h(t.start.node,t.start.offset),y=h(t.end.node,t.end.offset);if(m!==null&&y!==null)return{startNode:c.domNode,startOffset:m,endNode:c.domNode,endOffset:y}}return null}update(t,e){if(t.some(r=>r.type==="characterData"&&r.target===this.textNode)){const r=this.restore();r&&(e.range=r)}}optimize(t){super.optimize(t);let{parent:e}=this;for(;e;){if(e.domNode.tagName==="A"){this.savedLength=kt.CONTENTS.length,e.isolate(this.offset(e),this.length()).unwrap(),this.savedLength=0;break}e=e.parent}}value(){return""}};q(kt,"blotName","cursor"),q(kt,"className","ql-cursor"),q(kt,"tagName","span"),q(kt,"CONTENTS","\uFEFF");let xr=kt;var Wn={exports:{}},Ma;function Fd(){return Ma||(Ma=1,(function(s){var t=Object.prototype.hasOwnProperty,e="~";function r(){}Object.create&&(r.prototype=Object.create(null),new r().__proto__||(e=!1));function n(c,h,m){this.fn=c,this.context=h,this.once=m||!1}function i(c,h,m,y,f){if(typeof m!="function")throw new TypeError("The listener must be a function");var d=new n(m,y||c,f),v=e?e+h:h;return c._events[v]?c._events[v].fn?c._events[v]=[c._events[v],d]:c._events[v].push(d):(c._events[v]=d,c._eventsCount++),c}function l(c,h){--c._eventsCount===0?c._events=new r:delete c._events[h]}function o(){this._events=new r,this._eventsCount=0}o.prototype.eventNames=function(){var h=[],m,y;if(this._eventsCount===0)return h;for(y in m=this._events)t.call(m,y)&&h.push(e?y.slice(1):y);return Object.getOwnPropertySymbols?h.concat(Object.getOwnPropertySymbols(m)):h},o.prototype.listeners=function(h){var m=e?e+h:h,y=this._events[m];if(!y)return[];if(y.fn)return[y.fn];for(var f=0,d=y.length,v=new Array(d);f<d;f++)v[f]=y[f].fn;return v},o.prototype.listenerCount=function(h){var m=e?e+h:h,y=this._events[m];return y?y.fn?1:y.length:0},o.prototype.emit=function(h,m,y,f,d,v){var w=e?e+h:h;if(!this._events[w])return!1;var N=this._events[w],T=arguments.length,O,k;if(N.fn){switch(N.once&&this.removeListener(h,N.fn,void 0,!0),T){case 1:return N.fn.call(N.context),!0;case 2:return N.fn.call(N.context,m),!0;case 3:return N.fn.call(N.context,m,y),!0;case 4:return N.fn.call(N.context,m,y,f),!0;case 5:return N.fn.call(N.context,m,y,f,d),!0;case 6:return N.fn.call(N.context,m,y,f,d,v),!0}for(k=1,O=new Array(T-1);k<T;k++)O[k-1]=arguments[k];N.fn.apply(N.context,O)}else{var z=N.length,j;for(k=0;k<z;k++)switch(N[k].once&&this.removeListener(h,N[k].fn,void 0,!0),T){case 1:N[k].fn.call(N[k].context);break;case 2:N[k].fn.call(N[k].context,m);break;case 3:N[k].fn.call(N[k].context,m,y);break;case 4:N[k].fn.call(N[k].context,m,y,f);break;default:if(!O)for(j=1,O=new Array(T-1);j<T;j++)O[j-1]=arguments[j];N[k].fn.apply(N[k].context,O)}}return!0},o.prototype.on=function(h,m,y){return i(this,h,m,y,!1)},o.prototype.once=function(h,m,y){return i(this,h,m,y,!0)},o.prototype.removeListener=function(h,m,y,f){var d=e?e+h:h;if(!this._events[d])return this;if(!m)return l(this,d),this;var v=this._events[d];if(v.fn)v.fn===m&&(!f||v.once)&&(!y||v.context===y)&&l(this,d);else{for(var w=0,N=[],T=v.length;w<T;w++)(v[w].fn!==m||f&&!v[w].once||y&&v[w].context!==y)&&N.push(v[w]);N.length?this._events[d]=N.length===1?N[0]:N:l(this,d)}return this},o Line truncated
`)&&(e<=l||!!this.scroll.descendant(Pt,l)[0]),this.scroll.insertAt(l,v);const[w,N]=this.scroll.line(l);let T=Se({},Mt(w));if(w instanceof At){const[O]=w.descendant(Lt,N);O&&(T=Se(T,Mt(O)))}h=Dt.AttributeMap.diff(T,h)||{}}else if(typeof o.insert=="object"){const v=Object.keys(o.insert)[0];if(v==null)return l;const w=this.scroll.query(v,D.INLINE)!=null;if(w)(e<=l||this.scroll.descendant(Pt,l)[0])&&(y=!0);else if(l>0){const[N,T]=this.scroll.descendant(Lt,l-1);N instanceof Yt?N.value()[T]!==`
`&&(m=!0):N instanceof Rt&&N.statics.scope===D.INLINE_BLOT&&(m=!0)}if(this.scroll.insertAt(l,v,o.insert[v]),w){const[N]=this.scroll.descendant(Lt,l);if(N){const T=Se({},Mt(N));h=Dt.AttributeMap.diff(T,h)||{}}}}e+=c}else if(n.push(o),o.retain!==null&&typeof o.retain=="object"){const v=Object.keys(o.retain)[0];if(v==null)return l;this.scroll.updateEmbedAt(l,v,o.retain[v])}Object.keys(h).forEach(v=>{this.scroll.formatAt(l,c,v,h[v])});const f=m?1:0,d=y?1:0;return e+=f+d,n.retain(f),n.delete(d),l+c+f+d},0),n.reduce((l,o)=>typeof o.delete=="number"?(this.scroll.deleteAt(l,o.delete),l):l+Dt.Op.length(o),0),this.scroll.batchEnd(),this.scroll.optimize(),this.update(r)}deleteText(t,e){return this.scroll.deleteAt(t,e),this.update(new P().retain(t).delete(e))}formatLine(t,e){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.scroll.update(),Object.keys(r).forEach(i=>{this.scroll.lines(t,Math.max(e,1)).forEach(l=>{l.format(i,r[i])})}),this.scroll.optimize();const n=new P().retain(t).retain(e,gr(r));return this.update(n)}formatText(t,e){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};Object.keys(r).forEach(i=>{this.scroll.formatAt(t,e,i,r[i])});const n=new P().retain(t).retain(e,gr(r));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 P)}getFormat(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=[],n=[];e===0?this.scroll.path(t).forEach(o=>{const[c]=o;c instanceof At?r.push(c):c instanceof Lt&&n.push(c)}):(r=this.scroll.lines(t,e),n=this.scroll.descendants(Lt,t,e));const[i,l]=[r,n].map(o=>{const c=o.shift();if(c==null)return{};let h=Mt(c);for(;Object.keys(h).length>0;){const m=o.shift();if(m==null)return h;h=Wd(Mt(m),h)}return h});return{...i,...l}}getHTML(t,e){const[r,n]=this.scroll.line(t);if(r){const i=r.length();return r.length()>=n+e&&!(n===0&&e===i)?es(r,n,e,!0):es(this.scroll,t,e,!0)}return""}getText(t,e){return this.getContents(t,e).filter(r=>typeof r.insert=="string").map(r=>r.insert).join("")}insertContents(t,e){const r=Ba(e),n=new P().retain(t).concat(r);return this.scroll.insertContents(t,r),this.update(n)}insertEmbed(t,e,r){return this.scroll.insertAt(t,e,r),this.update(new P().retain(t).insert({[e]:r}))}insertText(t,e){let r=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(r).forEach(n=>{this.scroll.formatAt(t,e.length,n,r[n])}),this.update(new P().retain(t).insert(e,gr(r)))}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)!==At.blotName)return!1;const e=t;return e.children.length>1?!1:e.children.head instanceof Jt}removeFormat(t,e){const r=this.getText(t,e),[n,i]=this.scroll.line(t+e);let l=0,o=new P;n!=null&&(l=n.length()-i,o=n.delta().slice(i,i+l-1).insert(`
`));const h=this.getContents(t,e+l).diff(new P().insert(r).concat(o)),m=new P().retain(t).concat(h);return this.applyDelta(m)}update(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],r=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(Kd)&&this.scroll.find(e[0].target)){const i=this.scroll.find(e[0].target),l=Mt(i),o=i.offset(this.scroll),c=e[0].oldValue.replace(xr.CONTENTS,""),h=new P().insert(c),m=new P().insert(i.value()),y=r&&{oldRange:Pa(r.oldRange,-o),newRange:Pa(r.newRange,-o)};t=new P().retain(o).concat(h.diff(m,y)).reduce((d,v)=>v.insert?d.insert(v.insert,l):d.push(v),new P),this.delta=n.compose(t)}else this.delta=this.getDelta(),(!t||!Mi(n.compose(t),this.delta))&&(t=n.diff(this.delta,r));return t}}function ur(s,t,e){if(s.length===0){const[d]=Jn(e.pop());return t<=0?`</li></${d}>`:`</li></${d}>${ur([],t-1,e)}`}const[{child:r,offset:n,length:i,indent:l,type:o},...c]=s,[h,m]=Jn(o);if(l>t)return e.push(o),l===t+1?`<${h}><li${m}>${es(r,n,i)}${ur(c,l,e)}`:`<${h}><li>${ur(s,t+1,e)}`;const y=e[e.length-1];if(l===t&&o===y)return`</li><li${m}>${es(r,n,i)}${ur(c,l,e)}`;const[f]=Jn(e.pop());return`</li></${f}>${ur(s,t-1,e)}`}function es(s,t,e){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if("html"in s&&typeof s.html=="function")return s.html(t,e);if(s instanceof Yt)return Qs(s.value().slice(t,t+e)).replaceAll(" ","&nbsp;");if(s instanceof Xt){if(s.statics.blotName==="list-container"){const h=[];return s.children.forEachAt(t,e,(m,y,f)=>{const d="formats"in m&&typeof m.formats=="function"?m.formats():{};h.push({child:m,offset:y,length:f,indent:d.indent||0,type:d.list})}),ur(h,-1,[])}const n=[];if(s.children.forEachAt(t,e,(h,m,y)=>{n.push(es(h,m,y))}),r||s.statics.blotName==="list")return n.join("");const{outerHTML:i,innerHTML:l}=s.domNode,[o,c]=i.split(`>${l}<`);return o==="<table"?`<table style="border: 1px solid #000;">${n.join("")}<${c}`:`${o}>${n.join("")}<${c}`}return s.domNode instanceof Element?s.domNode.outerHTML:""}function Wd(s,t){return Object.keys(t).reduce((e,r)=>{if(s[r]==null)return e;const n=t[r];return n===s[r]?e[r]=n:Array.isArray(n)?n.indexOf(s[r])<0?e[r]=n.concat([s[r]]):e[r]=n:e[r]=[n,s[r]],e},{})}function Jn(s){const t=s==="ordered"?"ol":"ul";switch(s){case"checked":return[t,' data-list="checked"'];case"unchecked":return[t,' data-list="unchecked"'];default:return[t,""]}}function Ba(s){return s.reduce((t,e)=>{if(typeof e.insert=="string"){const r=e.insert.replace(/\r\n/g,`
`).replace(/\r/g,`
`);return t.insert(r,e.attributes)}return t.push(e)},new P)}function Pa(s,t){let{index:e,length:r}=s;return new Ue(e+t,r)}function Xd(s){const t=[];return s.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 te{constructor(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.quill=t,this.options=e}}q(te,"DEFAULTS",{});const Rs="\uFEFF";let Di=class extends Rt{constructor(t,e){super(t,e),this.contentNode=document.createElement("span"),this.contentNode.setAttribute("contenteditable","false"),Array.from(this.domNode.childNodes).forEach(r=>{this.contentNode.appendChild(r)}),this.leftGuard=document.createTextNode(Rs),this.rightGuard=document.createTextNode(Rs),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,r;const n=t.data.split(Rs).join("");if(t===this.leftGuard)if(this.prev instanceof Yt){const i=this.prev.length();this.prev.insertAt(i,n),e={startNode:this.prev.domNode,startOffset:i+n.length}}else r=document.createTextNode(n),this.parent.insertBefore(this.scroll.create(r),this),e={startNode:r,startOffset:n.length};else t===this.rightGuard&&(this.next instanceof Yt?(this.next.insertAt(0,n),e={startNode:this.next.domNode,startOffset:n.length}):(r=document.createTextNode(n),this.parent.insertBefore(this.scroll.create(r),this.next),e={startNode:r,startOffset:n.length}));return t.data=Rs,e}update(t,e){t.forEach(r=>{if(r.type==="characterData"&&(r.target===this.leftGuard||r.target===this.rightGuard)){const n=this.restore(r.target);n&&(e.range=n)}})}};class Yd{constructor(t,e){q(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 Di)&&(this.emitter.emit(M.events.COMPOSITION_BEFORE_START,t),this.scroll.batchStart(),this.emitter.emit(M.events.COMPOSITION_START,t),this.isComposing=!0)}handleCompositionEnd(t){this.emitter.emit(M.events.COMPOSITION_BEFORE_END,t),this.scroll.batchEnd(),this.emitter.emit(M.events.COMPOSITION_END,t),this.isComposing=!1}}const Wr=class Wr{constructor(t,e){q(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]}};q(Wr,"DEFAULTS",{modules:{}}),q(Wr,"themes",{default:Wr});let wr=Wr;const Qd=s=>s.parentElement||s.getRootNode().host||null,Jd=s=>{const t=s.getBoundingClientRect(),e="offsetWidth"in s&&Math.abs(t.width)/s.offsetWidth||1,r="offsetHeight"in s&&Math.abs(t.height)/s.offsetHeight||1;return{top:t.top,right:t.left+s.clientWidth*e,bottom:t.top+s.clientHeight*r,left:t.left}},js=s=>{const t=parseInt(s,10);return Number.isNaN(t)?0:t},Da=(s,t,e,r,n,i)=>s<e&&t>r?0:s<e?-(e-s+n):t>r?t-s>r-e?s+n-e:t-r+i:0,tp=(s,t)=>{var i,l,o;const e=s.ownerDocument;let r=t,n=s;for(;n;){const c=n===e.body,h=c?{top:0,right:((i=window.visualViewport)==null?void 0:i.width)??e.documentElement.clientWidth,bottom:((l=window.visualViewport)==null?void 0:l.height)??e.documentElement.clientHeight,left:0}:Jd(n),m=getComputedStyle(n),y=Da(r.left,r.right,h.left,h.right,js(m.scrollPaddingLeft),js(m.scrollPaddingRight)),f=Da(r.top,r.bottom,h.top,h.bottom,js(m.scrollPaddingTop),js(m.scrollPaddingBottom));if(y||f)if(c)(o=e.defaultView)==null||o.scrollBy(y,f);else{const{scrollLeft:d,scrollTop:v}=n;f&&(n.scrollTop+=f),y&&(n.scrollLeft+=y);const w=n.scrollLeft-d,N=n.scrollTop-v;r={left:r.left-w,top:r.top-N,right:r.right-w,bottom:r.bottom-N}}n=c||m.position==="fixed"?null:Qd(n)}},ep=100,rp=["block","break","cursor","inline","scroll","text"],sp=(s,t,e)=>{const r=new vr;return rp.forEach(n=>{const i=t.query(n);i&&r.register(i)}),s.forEach(n=>{let i=t.query(n);i||e.error(`Cannot register "${n}" specified in "formats" config. Are you sure it was registered?`);let l=0;for(;i;)if(r.register(i),i="blotName"in i?i.requiredContainer??null:null,l+=1,l>ep){e.error(`Cycle detected in registering blot requiredContainer: "${n}"`);break}}),r},br=xe("quill"),ks=new vr;Xt.uiClass="ql-ui";const Vt=class Vt{static debug(t){t===!0&&(t="log"),xe.level(t)}static find(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return mi.get(t)||ks.find(t,e)}static import(t){return this.imports[t]==null&&br.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]),r="attrName"in t?t.attrName:t.blotName;typeof r=="string"?this.register(`formats/${r}`,t,e):Object Line truncated
`});this.setContents(l)}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 r=t;t=document.createElement("div"),t.classList.add(r)}return this.container.insertBefore(t,e),t}blur(){this.selection.setRange(null)}deleteText(t,e,r){return[t,e,,r]=ge(t,e,r),Gt.call(this,()=>this.editor.deleteText(t,e),r,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 r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:M.sources.API;return Gt.call(this,()=>{const n=this.getSelection(!0);let i=new P;if(n==null)return i;if(this.scroll.query(t,D.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,M.sources.SILENT),i},r)}formatLine(t,e,r,n,i){let l;return[t,e,l,i]=ge(t,e,r,n,i),Gt.call(this,()=>this.editor.formatLine(t,e,l),i,t,0)}formatText(t,e,r,n,i){let l;return[t,e,l,i]=ge(t,e,r,n,i),Gt.call(this,()=>this.editor.formatText(t,e,l),i,t,0)}getBounds(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=null;if(typeof t=="number"?r=this.selection.getBounds(t,e):r=this.selection.getBounds(t.index,t.length),!r)return null;const n=this.container.getBoundingClientRect();return{bottom:r.bottom-n.top,height:r.height,left:r.left-n.left,right:r.right-n.left,top:r.top-n.top,width:r.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]=ge(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]=ge(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]=ge(t,e),this.editor.getText(t,e)}hasFocus(){return this.selection.hasFocus()}insertEmbed(t,e,r){let n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:Vt.sources.API;return Gt.call(this,()=>this.editor.insertEmbed(t,e,r),n,t)}insertText(t,e,r,n,i){let l;return[t,,l,i]=ge(t,0,r,n,i),Gt.call(this,()=>this.editor.insertText(t,e,l),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,r){return[t,e,,r]=ge(t,e,r),Gt.call(this,()=>this.editor.removeFormat(t,e),r,t)}scrollRectIntoView(t){tp(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]:M.sources.API;return Gt.call(this,()=>{t=new P(t);const r=this.getLength(),n=this.editor.deleteText(0,r),i=this.editor.insertContents(0,t),l=this.editor.deleteText(this.getLength()-1,1);return n.compose(i).compose(l)},e)}setSelection(t,e,r){t==null?this.selection.setRange(null,e||Vt.sources.API):([t,e,,r]=ge(t,e,r),this.selection.setRange(new Ue(Math.max(0,t),e),r),r!==M.sources.SILENT&&this.scrollSelectionIntoView())}setText(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:M.sources.API;const r=new P().insert(t);return this.setContents(r,e)}update Line truncated
`)?n.insertAt(0,e.slice(0,-1),r):n.insertAt(0,e,r)}else{const n=this.scroll.create(e,r);this.appendChild(n)}else super.insertAt(t,e,r);this.optimize()}insertBefore(t,e){if(t.statics.scope===D.INLINE_BLOT){const r=this.scroll.create(this.statics.defaultChild.blotName);r.appendChild(t),super.insertBefore(r,e)}else super.insertBefore(t,e)}insertContents(t,e){const r=this.deltaToRenderBlocks(e.concat(new P().insert(`
`))),n=r.pop();if(n==null)return;this.batchStart();const i=r.shift();if(i){const c=i.type==="block"&&(i.delta.length()===0||!this.descendant(Pt,t)[0]&&t<this.length()),h=i.type==="block"?i.delta:new P().insert({[i.key]:i.value});ei(this,t,h);const m=i.type==="block"?1:0,y=t+h.length()+m;c&&this.insertAt(y-1,`
`);const f=Mt(this.line(t)[0]),d=Dt.AttributeMap.diff(f,i.attributes)||{};Object.keys(d).forEach(v=>{this.formatAt(y-1,1,v,d[v])}),t=y}let[l,o]=this.children.find(t);if(r.length&&(l&&(l=l.split(o),o=0),r.forEach(c=>{if(c.type==="block"){const h=this.createBlock(c.attributes,l||void 0);ei(h,0,c.delta)}else{const h=this.create(c.key,c.value);this.insertBefore(h,l||void 0),Object.keys(c.attributes).forEach(m=>{h.format(m,c.attributes[m])})}})),n.type==="block"&&n.delta.length()){const c=l?l.offset(l.scroll)+o:this.length();ei(this,c,n.delta)}this.batchEnd(),this.optimize()}isEnabled(){return this.domNode.getAttribute("contenteditable")==="true"}leaf(t){const e=this.path(t).pop();if(!e)return[null,-1];const[r,n]=e;return r instanceof Lt?[r,n]:[null,-1]}line(t){return t===this.length()?this.line(t-1):this.descendant(Ha,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 r=(n,i,l)=>{let o=[],c=l;return n.children.forEachAt(i,l,(h,m,y)=>{Ha(h)?o.push(h):h instanceof Ys&&(o=o.concat(r(h,m,c))),c-=y}),o};return r(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(M.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=M.sources.USER;typeof t=="string"&&(e=t),Array.isArray(t)||(t=this.observer.takeRecords()),t=t.filter(r=>{let{target:n}=r;const i=this.find(n,!0);return i&&!za(i)}),t.length>0&&this.emitter.emit(M.events.SCROLL_BEFORE_UPDATE,e,t),super.update(t.concat([])),t.length>0&&this.emitter.emit(M.events.SCROLL_UPDATE,e,t)}updateEmbedAt(t,e,r){const[n]=this.descendant(i=>i instanceof Pt,t);n&&n.statics.blotName===e&&za(n)&&n.updateContent(r)}handleDragStart(t){t.preventDefault()}deltaToRenderBlocks(t){const e=[];let r=new P;return t.forEach(n=>{const i=n==null?void 0:n.insert;if(i)if(typeof i=="string"){const l=i.split(`
`);l.slice(0,-1).forEach(c=>{r.insert(c,n.attributes),e.push({type:"block",delta:r,attributes:n.attributes??{}}),r=new P});const o=l[l.length-1];o&&r.insert(o,n.attributes)}else{const l=Object.keys(i)[0];if(!l)return;this.query(l,D.INLINE)?r.push(n):(r.length()&&e.push({type:"block",delta:r,attributes:{}}),r=new P,e.push({type:"blockEmbed",key:l,value:i[l],attributes:n.attributes??{}}))}}),r.length()&&e.push({type:"block",delta:r,attributes:{}}),e}createBlock(t,e){let r;const n={};Object.entries(t).forEach(o=>{let[c,h]=o;this.query(c,D.BLOCK&D.BLOT)!=null?r=c:n[c]=h});const i=this.create(r||this.statics.defaultChild.blotName,r?t[r]:void 0);this.insertBefore(i,e||void 0);const l=i.length();return Object.entries(n).forEach(o=>{let[c,h]=o;i.formatAt(0,l,c,h)}),i}}q(hr,"blotName","scroll"),q(hr,"className","ql-editor"),q(hr,"tagName","DIV"),q(hr,"defaultChild",At),q(hr,"allowedChildren",[At,Pt,Ge]);function ei(s,t,e){e.reduce((r,n)=>{const i=Dt.Op.length(n);let l=n.attributes||{};if(n.insert!=null){if(typeof n.insert=="string"){const o=n.insert;s.insertAt(r,o);const[c]=s.descendant(Lt,r),h=Mt(c);l=Dt.AttributeMap.diff(h,l)||{}}else if(typeof n.insert=="object"){const o=Object.keys(n.insert)[0];if(o==null)return r;if(s.insertAt(r,o,n.insert[o]),s.scroll.query(o,D.INLINE)!=null){const[h]=s.descendant(Lt,r),m=Mt(h);l=Dt.AttributeMap.diff(m,l)||{}}}}return Object.keys(l).forEach(o=>{s.formatAt(r,i,o,l[o])}),r+i},t)}const $i={scope:D.BLOCK,whitelist:["right","center","justify"]},ip=new oe("align","align",$i),Hl=new Qt("align","ql-align",$i),zl=new qe("align","text-align",$i);class Gl extends qe{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 ap=new Qt("color","ql-color",{scope:D.INLINE}),Ui=new Gl("color","color",{scope:D.INLINE}),lp=new Qt("background","ql-bg",{scope:D.INLINE}),Fi=new Gl("background","background-color",{scope:D.INLINE});class Ve extends Ge{static create(t){const e=super.create(t);return e.setAttribute("spellcheck","false"),e}code(t,e){return this.children.map(r=>r.length()<=1?"":r.domNode.innerText).join(`
`).slice(t,t+e)}html(t,e){return`<pre>
${Qs(this.code(t,e))}
</pre>`}}class St extends At{static register(){E.register(Ve)}}q(St,"TAB"," ");class Hi extends ce{}Hi.blotName="code";Hi.tagName="CODE";St.blotName="code-block";St.className="ql-code-block";St.tagName="DIV";Ve.blotName="code-block-container";Ve.className="ql-code-block-container";Ve.tagName="DIV";Ve.allowedChildren=[St];St.allowedChildren=[Yt,Jt,xr];St.requiredContainer=Ve;const zi={scope:D.BLOCK,whitelist:["rtl"]},Vl=new oe("direction","dir",zi),Kl=new Qt("direction","ql-direction",zi),Zl=new qe("direction","direction",zi),Wl={scope:D.INLINE,whitelist:["serif","monospace"]},Xl=new Qt("font","ql-font",Wl);class op extends qe{value(t){return super.value(t).replace(/["']/g,"")}}const Yl=new op("font","font-family",Wl),Ql=new Qt("size","ql-size",{scope:D.INLINE,whitelist:["small","large","huge"]}),Jl=new qe("size","font-size",{scope:D.INLINE,whitelist:["10px","18px","32px"]}),cp=xe("quill:keyboard"),up=/Mac/i.test(navigator.platform)?"metaKey":"ctrlKey";class Js extends te{static match(t,e){return["altKey","ctrlKey","metaKey","shiftKey"].some(r=>!!e[r]!==t[r]&&e[r]!==null)?!1:e.key===t.key||e.key===t.which}constructor(t,e){super(t,e),this.bindings={},Object.keys(this.options.bindings).forEach(r=>{this.options.bindings[r]&&this.addBinding(this.options.bindings[r])}),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]:{},r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const n=fp(t);if(n==null){cp.warn("Attempted to add invalid keyboard binding",n);return}typeof e=="function"&&(e={handler:e}),typeof r=="function"&&(r={handler:r}),(Array.isArray(n.key)?n.key:[n.key]).forEach(l=>{const o={...n,key:l,...e,...r};this.bindings[o.key]=this.bindings[o.key]||[],this.bindings[o.key].push(o)})}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(T=>Js.match(t,T));if(n.length===0)return;const i=E.find(t.target,!0);if(i&&i.scroll!==this.quill.scroll)return;const l=this.quill.getSelection();if(l==null||!this.quill.hasFocus())return;const[o,c]=this.quill.getLine(l.index),[h,m]=this.quill.getLeaf(l.index),[y,f]=l.length===0?[h,m]:this.quill.getLeaf(l.index+l.length),d=h instanceof zs?h.value().slice(0,m):"",v=y instanceof zs?y.value().slice(f):"",w={collapsed:l.length===0,empty:l.length===0&&o.length()<=1,format:this.quill.getFormat(l),line:o,offset:c,prefix:d,suffix:v,event:t};n.some(T=>{if(T.collapsed!=null&&T.collapsed!==w.collapsed||T.empty!=null&&T.empty!==w.empty||T.offset!=null&&T.offset!==w.offset)return!1;if(Array.isArray(T.format)){if(T.format.every(O=>w.format[O]==null))return!1}else if(typeof T.format=="object"&&!Object.keys(T.format).every(O=>T.format[O]===!0?w.format[O]!=null:T.format[O]===!1?w.format[O]==null:Mi(T.format[O],w.format[O])))return!1;return T.prefix!=null&&!T.prefix.test(w.prefix)||T.suffix!=null&&!T.suffix.test(w.suffix)?!1:T.handler.call(this,l,w,T)!==!0})&&t.preventDefault()})}handleBackspace(t,e){const r=/[\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 l=new P().retain(t.index-r).delete(r);if(e.offset===0){const[o]=this.quill.getLine(t.index-1);if(o&&!(o.statics.blotName==="block"&&o.length()<=1)){const h=i.formats(),m=this.quill.getFormat(t.index-1,1);if(n=Dt.AttributeMap.diff(h,m)||{},Object.keys(n).length>0){const y=new P().retain(t.index+i.length()-2).retain(1,n);l=l.compose(y)}}}this.quill.updateContents(l,E.sources.USER),this.quill.focus()}handleDelete(t,e){const r=/^[\uD800-\uDBFF][\uDC00-\uDFFF]/.test(e.suffix)?2:1;if(t.index>=this.quill.getLength()-r)return;let n={};const[i]=this.quill.getLine(t.index);let l=new P().retain(t.index).delete(r);if(e.offset>=i.length()-1){const[o]=this.quill.getLine(t.index+1);if(o){const c=i.formats(),h=this.quill.getFormat(t.index,1);n=Dt.AttributeMap.diff(c,h)||{},Object.keys(n).length>0&&(l=l.retain(o.length()-1).retain(1,n))}}this.quill.updateContents(l,E.sources.USER),this.quill.focus()}handleDeleteRange(t){Gi({range:t,quill:this.quill}),this.quill.focus()}handleEnter(t,e){const r=ObLine truncated
`,r);this.quill.updateContents(n,E.sources.USER),this.quill.setSelection(t.index+1,E.sources.SILENT),this.quill.focus()}}const hp={bindings:{bold:ri("bold"),italic:ri("italic"),underline:ri("underline"),indent:{key:"Tab",format:["blockquote","indent","list"],handler(s,t){return t.collapsed&&t.offset!==0?!0:(this.quill.format("indent","+1",E.sources.USER),!1)}},outdent:{key:"Tab",shiftKey:!0,format:["blockquote","indent","list"],handler(s,t){return t.collapsed&&t.offset!==0?!0:(this.quill.format("indent","-1",E.sources.USER),!1)}},"outdent backspace":{key:"Backspace",collapsed:!0,shiftKey:null,metaKey:null,ctrlKey:null,altKey:null,format:["indent","list"],offset:0,handler(s,t){t.format.indent!=null?this.quill.format("indent","-1",E.sources.USER):t.format.list!=null&&this.quill.format("list",!1,E.sources.USER)}},"indent code-block":Ga(!0),"outdent code-block":Ga(!1),"remove tab":{key:"Tab",shiftKey:!0,collapsed:!0,prefix:/\t$/,handler(s){this.quill.deleteText(s.index-1,1,E.sources.USER)}},tab:{key:"Tab",handler(s,t){if(t.format.table)return!0;this.quill.history.cutoff();const e=new P().retain(s.index).delete(s.length).insert(" ");return this.quill.updateContents(e,E.sources.USER),this.quill.history.cutoff(),this.quill.setSelection(s.index+1,E.sources.SILENT),!1}},"blockquote empty enter":{key:"Enter",collapsed:!0,format:["blockquote"],empty:!0,handler(){this.quill.format("blockquote",!1,E.sources.USER)}},"list empty enter":{key:"Enter",collapsed:!0,format:["list"],empty:!0,handler(s,t){const e={list:!1};t.format.indent&&(e.indent=!1),this.quill.formatLine(s.index,s.length,e,E.sources.USER)}},"checklist enter":{key:"Enter",collapsed:!0,format:{list:"checked"},handler(s){const[t,e]=this.quill.getLine(s.index),r={...t.formats(),list:"checked"},n=new P().retain(s.index).insert(`
`,r).retain(t.length()-e-1).retain(1,{list:"unchecked"});this.quill.updateContents(n,E.sources.USER),this.quill.setSelection(s.index+1,E.sources.SILENT),this.quill.scrollSelectionIntoView()}},"header enter":{key:"Enter",collapsed:!0,format:["header"],suffix:/^$/,handler(s,t){const[e,r]=this.quill.getLine(s.index),n=new P().retain(s.index).insert(`
`,t.format).retain(e.length()-r-1).retain(1,{header:null});this.quill.updateContents(n,E.sources.USER),this.quill.setSelection(s.index+1,E.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(s){const t=this.quill.getModule("table");if(t){const[e,r,n,i]=t.getTable(s),l=dp(e,r,n,i);if(l==null)return;let o=e.offset();if(l<0){const c=new P().retain(o).insert(`
`);this.quill.updateContents(c,E.sources.USER),this.quill.setSelection(s.index+1,s.length,E.sources.SILENT)}else if(l>0){o+=e.length();const c=new P().retain(o).insert(`
`);this.quill.updateContents(c,E.sources.USER),this.quill.setSelection(o,E.sources.USER)}}}},"table tab":{key:"Tab",shiftKey:null,format:["table"],handler(s,t){const{event:e,line:r}=t,n=r.offset(this.quill.scroll);e.shiftKey?this.quill.setSelection(n-1,E.sources.USER):this.quill.setSelection(n+r.length(),E.sources.USER)}},"list autofill":{key:" ",shiftKey:null,collapsed:!0,format:{"code-block":!1,blockquote:!1,table:!1},prefix:/^\s*?(\d+\.|-|\*|\[ ?\]|\[x\])$/,handler(s,t){if(this.quill.scroll.query("list")==null)return!0;const{length:e}=t.prefix,[r,n]=this.quill.getLine(s.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(s.index," ",E.sources.USER),this.quill.history.cutoff();const l=new P().retain(s.index-n).delete(e+1).retain(r.length()-2-n).retain(1,{list:i});return this.quill.updateContents(l,E.sources.USER),this.quill.history.cutoff(),this.quill.setSelection(s.index-e,E.sources.SILENT),!1}},"code exit":{key:"Enter",collapsed:!0,format:["code-block"],prefix:/^$/,suffix:/^\s*$/,handler(s){const[t,e]=this.quill.getLine(s.index);let r=2,n=t;for(;n!=null&&n.length()<=1&&n.formats()["code-block"];)if(n=n.prev,r-=1,r<=0){const i=new P().retain(s.index+t.length()-e-2).retain(1,{"code-block":null}).delete(1);return this.quill.updateContents(i,E.sources.USER),this.quill.setSelection(s.index-1,E.sources.SILENT),!1}return!0}},"embed left":Ms("ArrowLeft",!1),"embed left shift":Ms("ArrowLeft",!0),"embed right":Ms("ArrowRight",!1),"embed right shift":Ms("ArrowRight",!0),"table down":Va(!1),"table up":Va(!0)}};Js.DEFAULTS=hp;function Ga(s){return{key:"Tab",shiftKey:!s,format:{"code-block":!0},handler(t,e){let{event:r}=e;const n=this.quill.scroll.query("code-block"),{TAB:i}=n;if(t.length===0&&!r.shiftKey){this.quill.insertText(t.index,i,E.sources.USER),this.quill.setSelection(t.index+i.length,E.sources.SILENT);return}const l=t.length===0?this.quill.getLines(t.index,1):this.quill.getLines(t);let{index:o,length:c}=t;l.forEach((h,m)=>{s?(h.insertAt(0,i),m===0?o+=i.length:c+=i.length):h.domNode.textContent.startsWith(i)&&(h.deleteAt(0,i.length),m===0?o-=i.length:c-=i.length)}),this.quill.update(E.sources.USER),this.quill.setSelection(o,c,E.sources.SILENT)}}}function Ms(s,t){return{key:s,shiftKey:t,altKey:null,[s==="ArrowLeft"?"prefix":"suffix"]:/^$/,handler(r){let{index:n}=r;s==="ArrowRight"&&(n+=r.length+1);const[i]=this.quill.getLeaf(n);return i instanceof Rt?(s==="ArrowLeft"?t?this.quill.setSelection(r.index-1,r.length+1,E.sources.USER):this.quill.setSelection(r.index-1,E.sources.USER):t?this.quill.setSelection(r.index,r.length+1,E.sources.USER):this.quill.setSelection(r.index+r.length+1,E.sources.USER),!1):!0}}}function ri(s){return{key:s[0],shortKey:!0,handler(t,e){this.quill.format(s,!e.format[s],E.sources.USER)}}}function Va(s){return{key:s?"ArrowUp":"ArrowDown",collapsed:!0,format:["table"],handler(t,e){const r=s?"prev":"next",n=e.line,i=n.parent[r];if(i!=null){if(i.statics.blotName==="table-row"){let l=i.children.head,o=n;for(;o.prev!=null;)o=o.prev,l=l.next;const c=l.offset(this.quill.scroll)+Math.min(e.offset,l.length()-1);this.quill.setSelection(c,0,E.sources.USER)}}else{const l=n.table()[r];l!=null&&(s?this.quill.setSelection(l.offset(this.quill.scroll)+l.length()-1,0,E.sources.USER):this.quill.setSelection(l.offset(this.quill.scroll),0,E.sources.USER))}return!1}}}function fp(s){if(typeof s=="string"||typeof s=="number")s={key:s};else if(typeof s=="object")s=gr(s);else return null;return s.shortKey&&(s[up]=s.shortKey,delete s.shortKey),s}function Gi(s){let{quill:t,range:e}=s;const r=t.getLines(e);let n={};if(r.length>1){const i=r[0].formats(),l=r[r.length-1].formats();n=Dt.AttributeMap.diff(l,i)||{}}t.deleteText(e,E.sources.USER),Object.keys(n).length>0&&t.formatLine(e.index,1,n,E.sources.USER),t.setSelection(e.index,E.sources.SILENT)}function dp(s,t,e,r){return t.prev==null&&t.next==null?e.prev==null&&e.next==null?r===0?-1:1:e.prev==null?-1:1:t.prev==null?-1:t.next==null?1:null}const pp=/font-weight:\s*normal/,gp=["P","OL","UL"],Ka=s=>s&&gp.includes(s.tagName),mp=s=>{Array.from(s.querySelectorAll("br")).filter(t=>Ka(t.previousElementSibling)&&Ka(t.nextElementSibling)).forEach(t=>{var e;(e=t.parentNode)==null||e.removeChild(t)})},bp=s=>{Array.from(s.querySelectorAll('b[style*="font-weight"]')).filter(t=>{var e;return(e=t.getAttribute("style"))==null?void 0:e.match(pp)}).forEach(t=>{var r;const e=s.createDocumentFragment();e.append(...t.childNodes),(r=t.parentNode)==null||r.replaceChild(e,t)})};function yp(s){s.querySelector('[id^="docs-internal-guid-"]')&&(bp(s),mp(s))}const vp=/\bmso-list:[^;]*ignore/i,xp=/\bmso-list:[^;]*\bl(\d+)/i,wp=/\bmso-list:[^;]*\blevel(\d+)/i,Np=(s,t)=>{const e=s.getAttribute("style"),r=e==null?void 0:e.match(xp);if(!r)return null;const n=Number(r[1]),i=e==null?void 0:e.match(wp),l=i?Number(i[1]):1,o=new RegExp(`@list l${n}:level${l}\\s*\\{Line truncated
`)&&(i.ops[i.ops.length-1].attributes==null||n.table)?i.compose(new P().retain(i.length()-1).delete(1)):i}normalizeHTML(t){Cp(t)}convertHTML(t){const e=new DOMParser().parseFromString(t,"text/html");this.normalizeHTML(e);const r=e.body,n=new WeakMap,[i,l]=this.prepareMatching(r,n);return Vi(this.quill.scroll,r,i,l,n)}dangerouslyPasteHTML(t,e){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:E.sources.API;if(typeof t=="string"){const n=this.convert({html:t,text:""});this.quill.setContents(n,e),this.quill.setSelection(0,E.sources.SILENT)}else{const n=this.convert({html:e,text:""});this.quill.updateContents(new P().retain(t).concat(n),r),this.quill.setSelection(t+n.length(),E.sources.SILENT)}}onCaptureCopy(t){var l,o;let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(t.defaultPrevented)return;t.preventDefault();const[r]=this.quill.selection.getRange();if(r==null)return;const{html:n,text:i}=this.onCopy(r,e);(l=t.clipboardData)==null||l.setData("text/plain",i),(o=t.clipboardData)==null||o.setData("text/html",n),e&&Gi({range:r,quill:this.quill})}normalizeURIList(t){return t.split(/\r?\n/).filter(e=>e[0]!=="#").join(`
`)}onCapturePaste(t){var l,o,c,h,m;if(t.defaultPrevented||!this.quill.isEnabled())return;t.preventDefault();const e=this.quill.getSelection(!0);if(e==null)return;const r=(l=t.clipboardData)==null?void 0:l.getData("text/html");let n=(o=t.clipboardData)==null?void 0:o.getData("text/plain");if(!r&&!n){const y=(c=t.clipboardData)==null?void 0:c.getData("text/uri-list");y&&(n=this.normalizeURIList(y))}const i=Array.from(((h=t.clipboardData)==null?void 0:h.files)||[]);if(!r&&i.length>0){this.quill.uploader.upload(e,i);return}if(r&&i.length>0){const y=new DOMParser().parseFromString(r,"text/html");if(y.body.childElementCount===1&&((m=y.body.firstElementChild)==null?void 0:m.tagName)==="IMG"){this.quill.uploader.upload(e,i);return}}this.onPaste(e,{html:r,text:n})}onCopy(t){const e=this.quill.getText(t);return{html:this.quill.getSemanticHTML(t),text:e}}onPaste(t,e){let{text:r,html:n}=e;const i=this.quill.getFormat(t.index),l=this.convert({text:r,html:n},i);Lp.log("onPaste",l,{text:r,html:n});const o=new P().retain(t.index).delete(t.length).concat(l);this.quill.updateContents(o,E.sources.USER),this.quill.setSelection(o.length()-t.length,E.sources.SILENT),this.quill.scrollSelectionIntoView()}prepareMatching(t,e){const r=[],n=[];return this.matchers.forEach(i=>{const[l,o]=i;switch(l){case Node.TEXT_NODE:n.push(o);break;case Node.ELEMENT_NODE:r.push(o);break;default:Array.from(t.querySelectorAll(l)).forEach(c=>{if(e.has(c)){const h=e.get(c);h==null||h.push(o)}else e.set(c,[o])});break}}),[r,n]}}q(to,"DEFAULTS",{matchers:[]});function Ke(s,t,e,r){return r.query(t)?s.reduce((n,i)=>{if(!i.insert)return n;if(i.attributes&&i.attributes[t])return n.push(i);const l=e?{[t]:e}:{};return n.insert(i.insert,{...l,...i.attributes})},new P):s}function is(s,t){let e="";for(let r=s.ops.length-1;r>=0&&e.length<t.length;--r){const n=s.ops[r];if(typeof n.insert!="string")break;e=n.insert+e}return e.slice(-1*t.length)===t}function Ce(s,t){if(!(s instanceof Element))return!1;const e=t.query(s);return e&&e.prototype instanceof Rt?!1:["address","article","blockquote","canvas","dd","div","dl","dt","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","iframe","li","main","nav","ol","output","p","pre","section","table","td","tr","ul","video"].includes(s.tagName.toLowerCase())}function Op(s,t){return s.previousElementSibling&&s.nextElementSibling&&!Ce(s.previousElementSibling,t)&&!Ce(s.nextElementSibling,t)}const Bs=new WeakMap;function eo(s){return s==null?!1:(Bs.has(s)||(s.tagName==="PRE"?Bs.set(s,!0):Bs.set(s,eo(s.parentNode))),Bs.get(s))}function Vi(s,t,e,r,n){return t.nodeType===t.TEXT_NODE?r.reduce((i,l)=>l(t,i,s),new P):t.nodeType===t.ELEMENT_NODE?Array.from(t.childNodes||[]).reduce((i,l)=>{let o=Vi(s,l,e,r,n);return l.nodeType===t.ELEMENT_NODE&&(o=e.reduce((c,h)=>h(l,c,s),o),o=(n.get(l)||[]).reduce((c,h)=>h(l,c,s),o)),i.concat(o)},new P):new P}function si(s){return(t,e,r)=>Ke(e,s,!0,r)}function qp(s,t,e){const r=oe.keys(s),n=Qt.keys(s),i=qe.keys(s),l={};return r.concat(n).concat(i).forEach(o=>{let c=e.query(o,D.ATTRIBUTE);c!=null&&(l[c.attrName]=c.value(s),l[c.attrName])||(c=_p[o],c!=null&&(c.attrName===o||c.keyName===o)&&(l[c.attrName]=c.value(s)||void 0),c=Za[o],c!=null&&(c.attrName===o||c.keyName===o)&&(c=Za[o],l[c.attrName]=c.value(s)||void 0))}),Object.entries(l).reduce((o,c)=>{let[h,m]=c;return Ke(o,h,m,e)},t)}function Ip(s,t,e){const r=e.query(s);if(r==null)return t;if(r.prototype instanceof Rt){const n={},i=r.value(s);if(i!=null)return n[r.blotName]=i,new P().insert(n,r.formats(s,e))}else if(r.prototype instanceof ts&&!is(t,`
`)&&t.insert(`
`),"blotName"in r&&"formats"in r&&typeof r.formats=="function")return Ke(t,r.blotName,r.formats(s,e),e);return t}function Rp(s,t){return is(t,`
`)||t.insert(`
`),t}function jp(s,t,e){const r=e.query("code-block"),n=r&&"formats"in r&&typeof r.formats=="function"?r.formats(s,e):!0;return Ke(t,"code-block",n,e)}function kp(){return new P}function Mp(s,t,e){const r=e.query(s);if(r==null||r.blotName!=="list"||!is(t,`
`))return t;let n=-1,i=s.parentNode;for(;i!=null;)["OL","UL"].includes(i.tagName)&&(n+=1),i=i.parentNode;return n<=0?t:t.reduce((l,o)=>o.insert?o.attributes&&typeof o.attributes.indent=="number"?l.push(o):l.insert(o.insert,{indent:n,...o.attributes||{}}):l,new P)}function Bp(s,t,e){const r=s;let n=r.tagName==="OL"?"ordered":"bullet";const i=r.getAttribute("data-checked");return i&&(n=i==="true"?"checked":"unchecked"),Ke(t,"list",n,e)}function Wa(s,t,e){if(!is(t,`
`)){if(Ce(s,e)&&(s.childNodes.length>0||s instanceof HTMLParagraphElement))return t.insert(`
`);if(t.length()>0&&s.nextSibling){let r=s.nextSibling;for(;r!=null;){if(Ce(r,e))return t.insert(`
`);const n=e.query(r);if(n&&n.prototype instanceof Pt)return t.insert(`
`);r=r.firstChild}}}return t}function Pp(s,t,e){var i;const r={},n=s.style||{};return n.fontStyle==="italic"&&(r.italic=!0),n.textDecoration==="underline"&&(r.underline=!0),n.textDecoration==="line-through"&&(r.strike=!0),((i=n.fontWeight)!=null&&i.startsWith("bold")||parseInt(n.fontWeight,10)>=700)&&(r.bold=!0),t=Object.entries(r).reduce((l,o)=>{let[c,h]=o;return Ke(l,c,h,e)},t),parseFloat(n.textIndent||0)>0?new P().insert(" ").concat(t):t}function Dp(s,t,e){var n,i;const r=((n=s.parentElement)==null?void 0:n.tagName)==="TABLE"?s.parentElement:(i=s.parentElement)==null?void 0:i.parentElement;if(r!=null){const o=Array.from(r.querySelectorAll("tr")).indexOf(s)+1;return Ke(t,"table",o,e)}return t}function $p(s,t,e){var n;let r=s.data;if(((n=s.parentElement)==null?void 0:n.tagName)==="O:P")return t.insert(r.trim());if(!eo(s)){if(r.trim().length===0&&r.includes(`
`)&&!Op(s,e))return t;r=r.replace(/[^\S\u00a0]/g," "),r=r.replace(/ {2,}/g," "),(s.previousSibling==null&&s.parentElement!=null&&Ce(s.parentElement,e)||s.previousSibling instanceof Element&&Ce(s.previousSibling,e))&&(r=r.replace(/^ /,"")),(s.nextSibling==null&&s.parentElement!=null&&Ce(s.parentElement,e)||s.nextSibling instanceof Element&&Ce(s.nextSibling,e))&&(r=r.replace(/ $/,"")),r=r.replaceAll(" "," ")}return t.insert(r)}class ro extends te{constructor(e,r){super(e,r);q(this,"lastRecorded",0);q(this,"ignoreChange",!1);q(this,"stack",{undo:[],redo:[]});q(this,"currentRange",null);this.quill.on(E.events.EDITOR_CHANGE,(n,i,l,o)=>{n===E.events.SELECTION_CHANGE?i&&o!==E.sources.SILENT&&(this.currentRange=i):n===E.events.TEXT_CHANGE&&(this.ignoreChange||(!this.options.userOnly||o===E.sources.USER?this.record(i,l):this.transform(i)),this.currentRange=vi(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,r){if(this.stack[e].length===0)return;const n=this.stack[e].pop();if(!n)return;const i=this.quill.getContents(),l=n.delta.invert(i);this.stack[r].push({delta:l,range:vi(n.range,l)}),this.lastRecorded=0,this.ignoreChange=!0,this.quill.updateContents(n.delta,E.sources.USER),this.ignoreChange=!1,this.restoreSelection(n)}clear(){this.stack={undo:[],redo:[]}}cutoff(){this.lastRecorded=0}record(e,r){if(e.ops.length===0)return;this.stack.redo=[];let n=e.invert(r),i=this.currentRange;const l=Date.now();if(this.lastRecorded+this.options.delay>l&&this.stack.undo.length>0){const o=this.stack.undo.pop();o&&(n=n.compose(o.delta),i=o.range)}else this.lastRecorded=l;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){Xa(this.stack.undo,e),Xa(this.stack.redo,e)}undo(){this.change("undo","redo")}restoreSelection(e){if(e.range)this.quill.setSelection(e.range,E.sources.USER);else{const r=Fp(this.quill.scroll,e.delta);this.quill.setSelection(r,E.sources.USER)}}}q(ro,"DEFAULTS",{delay:1e3,maxStack:100,userOnly:!1});function Xa(s,t){let e=t;for(let r=s.length-1;r>=0;r-=1){const n=s[r];s[r]={delta:e.transform(n.delta,!0),range:n.range&&vi(n.range,e)},e=n.delta.transform(e),s[r].delta.length()===0&&s.splice(r,1)}}function Up(s,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(r=>s.query(r,D.BLOCK)!=null):!1}function Fp(s,t){const e=t.reduce((n,i)=>n+(i.delete||0),0);let r=t.length()-e;return Up(s,t)&&(r-=1),r}function vi(s,t){if(!s)return s;const e=t.transformPosition(s.index),r=t.transformPosition(s.index+s.length);return{index:e,length:r-e}}class so extends te{constructor(t,e){super(t,e),t.root.addEventListener("drop",r=>{var l;r.preventDefault();let n=null;if(document.caretRangeFromPoint)n=document.caretRangeFromPoint(r.clientX,r.clientY);else if(document.caretPositionFromPoint){const o=document.caretPositionFromPoint(r.clientX,r.clientY);n=document.createRange(),n.setStart(o.offsetNode,o.offset),n.setEnd(o.offsetNode,o.offset)}const i=n&&t.selection.normalizeNative(n);if(i){const o=t.selection.normalizedToRange(i);(l=r.dataTransfer)!=null&&l.files&&this.upload(o,r.dataTransfer.files)}})}upload(t,e){const r=[];Array.from(e).forEach(n=>{var i;n&&((i=this.options.mimetypes)!=null&&i.includes(n.type))&&r.push(n)}),r.length>0&&this.options.handler.call(this,t,r)}}so.DEFAULTS={mimetypes:["image/png","image/jpeg"],handler(s,t){if(!this.quill.scroll.query("image"))return;const e=t.map(r=>new Promise(n=>{const i=new FileReader;i.onload=()=>{n(i.result)},i.readAsDataURL(r)}));Promise.all(e).then(r=>{const n=r.reduce((i,l)=>i.insert({image:l}),new P().retain(s.index).delete(s.length));this.quill.updateContents(n,M.sources.USER),this.quill.setSelection(s.index+r.length,M.sources.SILENT)})}};const Hp=["insertText","insertReplacementText"];class zp extends te{constructor(t,e){super(t,e),t.root.addEventListener("beforeinput",r=>{this.handleBeforeInput(r)}),/Android/i.test(navigator.userAgent)||t.on(E.events.COMPOSITION_BEFORE_START,()=>{this.handleCompositionStart()})}deleteRange(t){Gi({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 r=this.quill.getFormat(t.index,1);this.deleteRange(t),this.quill.updateContents(new P().retain(t.index).insert(e,r),E.sources.USER)}else this.deleteRange(t);return this.quill.setSelection(t.index+e.length,0,E.sources.SILENT),!0}handleBeforeInput(t){if(this.quill.composition.isComposing||t.defaultPrevented||!Hp.includes(t.inputType))return;const e=t.getTargetRanges?t.getTargetRanges()[0]:null;if(!e||e.collapsed===!0)return;const r=Gp(t);if(r==null)return;const n=this.quill.selection.normalizeNative(e),i=n?this.quill.selection.normalizedToRange(n):null;i&&this.replaceText(i,r)&&t.preventDefault()}handleCompositionStart(){const t=this.quill.getSelection();t&&this.replaceText(t)}}function Gp(s){var t;return typeof s.data=="string"?s.data:(t=s.dataTransfer)!=null&&t.types.includes("text/plain")?s.dataTransfer.getData("text/plain"):null}const Vp=/Mac/i.test(navigator.platform),Kp=100,Zp=s=>!!(s.key==="ArrowLeft"||s.key==="ArrowRight"||s.key==="ArrowUp"||s.key==="ArrowDown"||s.key==="Home"||Vp&&s.key==="a"&&s.ctrlKey===!0);class Wp extends te{constructor(e,r){super(e,r);q(this,"isListening",!1);q(this,"selectionChangeDeadline",0);this.handleArrowKeys(),this.handleNavigationShortcuts()}handleArrowKeys(){this.quill.keyboard.addBinding({key:["ArrowLeft","ArrowRight"],offset:0,shiftKey:null,handler(e,r){let{line:n,event:i}=r;if(!(n instanceof Xt)||!n.uiNode)return!0;const l=getComputedStyle(n.domNode).direction==="rtl";return l&&i.key!=="ArrowRight"||!l&&i.key!=="ArrowLeft"?!0:(this.quill.setSelection(e.index-1,e.length+(i.shiftKey?1:0),E.sources.USER),!1)}})}handleNavigationShortcuts(){this.quill.root.addEventListener("keydown",e=>{!e.defaultPrevented&&Zp(e)&&this.ensureListeningToSelectionChange()})}ensureListeningToSelectionChange(){if(this.selectionChangeDeadline=Date.now()+Kp,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 r=e.getRangeAt(0);if(r.collapsed!==!0||r.startOffset!==0)return;const n=this.quill.scroll.find(r.startContainer);if(!(n instanceof Xt)||!n.uiNode)return;const i=document.createRange();i.setStartAfter(n.uiNode),i.setEndAfter(n.uiNode),e.removeAllRanges(),e.addRange(i)}}E.register({"blots/block":At,"blots/block/embed":Pt,"blots/break":Jt,"blots/container":Ge,"blots/cursor":xr,"blots/embed":Di,"blots/inline":ce,"blots/scroll":hr,"blots/text":Yt,"modules/clipboard":to,"modules/history":ro,"modules/keyboard":Js,"modules/uploader":so,"modules/input":zp,"modules/uiNode":Wp});class Xp extends Qt{add(t,e){let r=0;if(e==="+1"||e==="-1"){const n=this.value(t)||0;r=e==="+1"?n+1:n-1}else typeof e=="number"&&(r=e);return r===0?(this.remove(t),!0):super.add(t,r.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 Yp=new Xp("indent","ql-indent",{scope:D.BLOCK,whitelist:[1,2,3,4,5,6,7,8]});class xi exten Line truncated
`)}
`,i=Bt.formats(this.children.head.domNode);if(e||this.forceNext||this.cachedText!==n){if(n.trim().length>0||this.cachedText==null){const l=this.children.reduce((c,h)=>c.concat(Ul(h,!1)),new P),o=t(n,i);l.diff(o).reduce((c,h)=>{let{retain:m,attributes:y}=h;return m?(y&&Object.keys(y).forEach(f=>{[Bt.blotName,be.blotName].includes(f)&&this.formatAt(c,m,f,y[f])}),c+m):c},0)}this.cachedText=n,this.forceNext=!1}}html(t,e){const[r]=this.children.find(t);return`<pre data-language="${r?Bt.formats(r.domNode):"plain"}">
${Qs(this.code(t,e))}
</pre>`}optimize(t){if(super.optimize(t),this.parent!=null&&this.children.head!=null&&this.uiNode!=null){const e=Bt.formats(this.children.head.domNode);e!==this.uiNode.value&&(this.uiNode.value=e)}}}Zr.allowedChildren=[Bt];Bt.requiredContainer=Zr;Bt.allowedChildren=[be,xr,Yt,Jt];const Qp=(s,t,e)=>{if(typeof s.versionString=="string"){const r=s.versionString.split(".")[0];if(parseInt(r,10)>=11)return s.highlight(e,{language:t}).value}return s.highlight(t,e).value};class io extends te{static register(){E.register(be,!0),E.register(Bt,!0),E.register(Zr,!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((r,n)=>{let{key:i}=n;return r[i]=!0,r},{}),this.highlightBlot=this.highlightBlot.bind(this),this.initListener(),this.initTimer()}initListener(){this.quill.on(E.events.SCROLL_BLOT_MOUNT,t=>{if(!(t instanceof Zr))return;const e=this.quill.root.ownerDocument.createElement("select");this.options.languages.forEach(r=>{let{key:n,label:i}=r;const l=e.ownerDocument.createElement("option");l.textContent=i,l.setAttribute("value",n),e.appendChild(l)}),e.addEventListener("change",()=>{t.format(Bt.blotName,e.value),this.quill.root.focus(),this.highlight(t,!0)}),t.uiNode==null&&(t.attachUI(e),t.children.head&&(e.value=Bt.formats(t.children.head.domNode)))})}initTimer(){let t=null;this.quill.on(E.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(E.sources.USER);const r=this.quill.getSelection();(t==null?this.quill.scroll.descendants(Zr):[t]).forEach(i=>{i.highlight(this.highlightBlot,e)}),this.quill.update(E.sources.SILENT),r!=null&&this.quill.setSelection(r,E.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 Qs(t).split(`
`).reduce((n,i,l)=>(l!==0&&n.insert(`
`,{[St.blotName]:e}),n.insert(i)),new P);const r=this.quill.root.ownerDocument.createElement("div");return r.classList.add(St.className),r.innerHTML=Qp(this.options.hljs,e,t),Vi(this.quill.scroll,r,[(n,i)=>{const l=Vr.value(n);return l?i.compose(new P().retain(i.length(),{[be.blotName]:l})):i}],[(n,i)=>n.data.split(`
`).reduce((l,o,c)=>(c!==0&&l.insert(`
`,{[St.blotName]:e}),l.insert(o)),i)],new WeakMap)}}io.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 Xr=class Xr extends At{static create(t){const e=super.create();return t?e.setAttribute("data-row",t):e.setAttribute("data-row",Ki()),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===Xr.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()}};q(Xr,"blotName","table"),q(Xr,"tagName","TD");let Wt=Xr;class ye extends Ge{checkMerge(){if(super.checkMerge()&&this.next.children.head!=null){const t=this.children.head.formats(),e=this.children.tail.formats(),r=this.next.children.head.formats(),n=this.next.children.tail.formats();return t.table===e.table&&t.table===r.table&&t.table===n.table}return!1}optimize(t){super.optimize(t),this.children.forEach(e=>{if(e.next==null)return;const r=e.formats(),n=e.next.formats();if(r.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}}q(ye,"blotName","table-row"),q(ye,"tagName","TR");class le extends Ge{}q(le,"blotName","table-body"),q(le,"tagName","TBODY");class Nr extends Ge{balanceCells(){const t=this.descendants(ye),e=t.reduce((r,n)=>Math.max(n.children.length,r),0);t.forEach(r=>{new Array(e-r.children.length).fill(0).forEach(()=>{let n;r.children.head!=null&&(n=Wt.formats(r.children.head.domNode));const i=this.scroll.create(Wt.blotName,n);r.appendChild(i),i.optimize()})})}cells(t){return this.rows().map(e=>e.children.at(t))}deleteColumn(t){const[e]=this.descendant(le);e==null||e.children.head==null||e.children.forEach(r=>{const n=r.children.at(t);n!=null&&n.remove()})}insertColumn(t){const[e]=this.descendant(le);e==null||e.children.head==null||e.children.forEach(r=>{const n=r.children.at(t),i=Wt.formats(r.children.head.domNode),l=this.scroll.create(Wt.blotName,i);r.insertBefore(l,n)})}insertRow(t){const[e]=this.descendant(le);if(e==null||e.children.head==null)return;const r=Ki(),n=this.scroll.create(ye.blotName);e.children.head.children.forEach(()=>{const l=this.scroll.create(Wt.blotName,r);n.appendChild(l)});const i=e.children.at(t);e.insertBefore(n,i)}rows(){const t=this.children.head;return t==null?[]:t.children.map(e=>e)}}q(Nr,"blotName","table-container"),q(Nr,"tagName","TABLE");Nr.allowedChildren=[le];le.requiredContainer=Nr;le.allowedChildren=[ye];ye.requiredContainer=le;ye.allowedChildren=[Wt];Wt.requiredContainer=ye;function Ki(){return`row-${Math.random().toString(36).slice(2,6)}`}class Jp extends te{static register(){E.register(Wt),E.register(ye),E.register(le),E.register(Nr)}constructor(){super(...arguments),this.listenBalanceCells()}balanceTables(){this.quill.scroll.descendants(Nr).forEach(t=>{t.balanceCells()})}deleteColumn(){const[t,,e]=this.getTable();e!=null&&(t.deleteColumn(e.cellOffset()),this.quill.update(E.sources.USER))}deleteRow(){const[,t]=this.getTable();t!=null&&(t.remove(),this.quill.update(E.sources.USER))}deleteTable(){const[t]=this.getTable();if(t==null)return;const e=t.offset();t.remove(),this.quill.update(E.sources.USER),this.quill.setSelection(e,E.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,r]=this.quill.getLine(t.index);if(e==null||e.statics.blotName!==Wt.blotName)return[null,null,null,-1];const n=e.parent;return[n.parent.parent,n,e,r]}insertColumn(t){const e=this.quill.getSelection();if(!e)return;const[r,n,i]=this.getTable(e);if(i==null)return;const l=i.cellOffset();r.insertColumn(l+t),this.quill.update(E.sources.USER);let o=n.rowOffset();t===0&&(o+=1),this.quill.setSelection(e.index+o,e.length,E.sources.SILENT)}insertColumnLeft(){this.insertColumn(0)}insertColumnRight(){this.insertColumn(1)}insertRow(t){const e=this.quill.getSelection();if(!e)return;const[r,n,i]=this.getTable(e);if(i==null)return;const l=n.rowOffset();r.insertRow(l+t),this.quill.update(E.sources.USER),t>0?this.quill.setSelection(e,E.sources.SILENT):this.quill.setSelection(e.index+n.children.length,e.length,E.sources.SILENT)}insertRowAbove(){this.insertRow(0)}insertRowBelow(){this.insertRow(1)}insertTable(t,e){const r=this.quill.getSelection();if(r==null)return;const n=new Array(t).fill(0).reduce(i=>{const l=new Array(e).fill(`
`).join("");return i.insert(l,{table:Ki()})},new P().retain(r.index));this.quill.updateContents(n,E.sources.USER),this.quill.setSelection(r.index,E.sources.SILENT),this.balanceTables()}listenBalanceCells(){this.quill.on(E.events.SCROLL_OPTIMIZE,t=>{t.some(e=>["TD","TR","TBODY","TABLE"].includes(e.target.tagName)?(this.quill.once(E.events.TEXT_CHANGE,(r,n,i)=>{i===E.sources.USER&&this.balanceTables()}),!0):!1)})}}const Ja=xe("quill:toolbar");class Zi extends te{constructor(t,e){var r,n;if(super(t,e),Array.isArray(this.options.container)){const i=document.createElement("div");i.setAttribute("role","toolbar"),t1(i,this.options.container),(n=(r=t.container)==null?void 0:r.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)){Ja.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 o;const l=(o=this.options.handlers)==null?void 0:o[i];l&&this.addHandler(i,l)}),Array.from(this.container.querySelectorAll("button, select")).forEach(i=>{this.attach(i)}),this.quill.on(E.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){Ja.warn("ignoring attaching to nonexistent format",e,t);return}const r=t.tagName==="SELECT"?"change":"click";t.addEventListener(r,n=>{let i;if(t.tagName==="SELECT"){if(t.selectedIndex<0)return;const o=t.options[t.selectedIndex];o.hasAttribute("selected")?i=!1:i=o.value||!1}else t.classList.contains("ql-active")?i=!1:i=t.value||!t.hasAttribute("value"),n.preventDefault();this.quill.focus();const[l]=this.quill.selection.getRange();if(this.handlers[e]!=null)this.handlers[e].call(this,i);else if(this.quill.scroll.query(e).prototype instanceof Rt){if(i=prompt(`Enter ${e}`),!i)return;this.quill.updateContents(new P().retain(l.index).delete(l.length).insert({[e]:i}),E.sources.USER)}else this.quill.format(e,i,E.sources.USER);this.update(l)}),this.controls.push([e,t])}update(t){const e=t==null?{}:this.quill.getFormat(t);this.controls.forEach(r=>{const[n,i]=r;if(i.tagName==="SELECT"){let l=null;if(t==null)l=null;else if(e[n]==null)l=i.querySelector("option[selected]");else if(!Array.isArray(e[n])){let o=e[n];typeof o=="string"&&(o=o.replace(/"/g,'\\"')),l=i.querySelector(`option[value="${o}"]`)}l==null?(i.value="",i.selectedIndex=-1):l.selected=!0}else if(t==null)i.classList.remove("ql-active"),i.setAttribute("aria-pressed","false");else if(i.hasAttribute("value")){const l=e[n],o=l===i.getAttribute("value")||l!=null&&l.toString()===i.getAttribute("value")||l==null&&!i.getAttribute("value");i.classList.toggle("ql-active",o),i.setAttribute("aria-pressed",o.toString())}else{const l=e[n]!=null;i.classList.toggle("ql-active",l),i.setAttribute("aria-pressed",l.toString())}})}}Zi.DEFAULTS={};function tl(s,t,e){const r=document.createElement("button");r.setAttribute("type","button"),r.classList.add(`ql-${t}`),r.setAttribute("aria-pressed","false"),e!=null?(r.value=e,r.setAttribute("aria-label",`${t}: ${e}`)):r.setAttribute("aria-label",t),s.appendChild(r)}function t1(s,t){Array.isArray(t[0])||(t=[t]),t.forEach(e=>{const r=document.createElement("span");r.classList.add("ql-formats"),e.forEach(n=>{if(typeof n=="string")tl(r,n);else{const i=Object.keys(n)[0],l=n[i];Array.isArray(l)?e1(r,i,l):tl(r,i,l)}}),s.appendChild(r)})}function e1(s,t,e){const r=document.createElement("select");r.classList.add(`ql-${t}`),e.forEach(n=>{const i=document.createElement("option");n!==!1?i.setAttribute("value",String(n)):i.setAttribute("selected","selected"),r.appendChild(i)}),s.appendChild(r)}Zi.DEFAULTS={container:null,handlers:{clean(){const s=this.quill.getSelection();if(s!=null)if(s.length===0){const t=this.quill.getFormat();Object.keys(t).forEach(e=>{this.quill.scroll.query(e,D.INLINE)!=null&&this.quill.format(e,!1,E.sources.USER)})}else this.quill.removeFormat(s.index,s.length,E.sources.USER)},direction(s){const{align:t}=this.quill.getFormat();s==="rtl"&&t==null?this.quill.format("align","right",E.sources.USER):!s&&t==="right"&&this.quill.format("align",!1,E.sources.USER),this.quill.format("direction",s,E.sources.USER)},indent(s){const t=this.quill.getSelection(),e=this.quill.getFormat(t),r=parseInt(e.indent||0,10);if(s==="+1"||s==="-1"){let n=s==="+1"?1:-1;e.direction==="rtl"&&(n*=-1),this.quill.format("indent",r+n,E.sources.USER)}},link(s){s===!0&&(s=prompt("Enter link URL:")),this.quill.format("link",s,E.sources.USER)},list(s){const t=this.quill.getSelection(),e=this.quill.getFormat(t);s==="check"?e.list Line truncated
`)});const it=N||et||((Q=C.current)==null?void 0:Q.textContent)||"";_(it),V==null||V(it)},[_,N,T,V,m]),W={"aria-label":typeof I.content=="string"?I.content:"Copy to clipboard",size:"sm",variant:"light",isDisabled:T,onPress:ut,isIconOnly:!0,...J},nt=H.useCallback(()=>({...W,"data-copied":Ao(B),className:Z.copyButton({class:Xi(f==null?void 0:f.copyButton)})}),[Z,R,K,T,f==null?void 0:f.copyButton,W,G]);return{Component:g,as:h,domRef:S,preRef:C,children:m,slots:Z,classNames:f,copied:B,onCopy:ut,copyIcon:v,checkIcon:w,symbolBefore:Y,isMultiLine:$,isFocusVisible:R,hideCopyButton:k,disableCopy:T,disableTooltip:O,hideSymbol:j,tooltipProps:I,getSnippetProps:ct,getCopyButtonProps:nt}}var go=Eo((s,t)=>{const{Component:e,domRef:r,preRef:n,children:i,slots:l,classNames:o,copied:c,copyIcon:h=b.jsx(Qo,{}),checkIcon:m=b.jsx(Jo,{}),symbolBefore:y,disableCopy:f,disableTooltip:d,hideSymbol:v,hideCopyButton:w,tooltipProps:N,isMultiLine:T,onCopy:O,getSnippetProps:k,getCopyButtonProps:z}=K1({...s,ref:t}),j=H.useCallback(({children:J})=>b.jsx(xt,{...N,isDisabled:c||N.isDisabled,children:J}),[al(N)]),V=H.useMemo(()=>{if(w)return null;const J=m&&H.cloneElement(m,{className:l.checkIcon()}),pt=h&&H.cloneElement(h,{className:l.copyIcon()}),gt=b.jsxs(lt,{...z(),children:[J,pt]});return d?gt:b.jsx(j,{children:gt})},[l,o==null?void 0:o.copyButton,c,m,h,O,j,f,d,w]),tt=H.useMemo(()=>T&&i&&Array.isArray(i)?b.jsx("div",{className:l.content({class:o==null?void 0:o.content}),children:i.map((J,pt)=>b.jsxs("pre",{className:l.pre({class:o==null?void 0:o.pre}),children:[!v&&b.jsx("span",{className:l.symbol({class:o==null?void 0:o.symbol}),children:y}),J]},`${pt}-${J}`))}):b.jsxs("pre",{ref:n,className:l.pre({class:o==null?void 0:o.pre}),children:[!v&&b.jsx("span",{className:l.symbol({class:o==null?void 0:o.symbol}),children:y}),i]}),[i,v,T,y,o==null?void 0:o.pre,l]);return b.jsxs(e,{ref:r,...k(),children:[tt,V]})});go.displayName="HeroUI.Snippet";var Z1=go;const W1=({messages:s})=>b.jsx(Z1,{hideSymbol:!0,codeString:JSON.stringify(s,null,2),tooltipProps:{content:"点击复制"},classNames:{copyButton:"self-start sticky top-0 right-0"},className:"bg-content1 h-96 overflow-y-scroll items-start",children:JSON.stringify(s,null,2).split(`
`).map((t,e)=>b.jsx("span",{className:"whitespace-pre-wrap break-all",children:t},e))}),Ze=()=>{const s=Io();return e=>{s.alert({title:"消息内容",size:"3xl",content:H.createElement(W1,{messages:e})})}};var It=(s=>(s.GroupUpload="group_upload",s.GroupAdmin="group_admin",s.GroupDecrease="group_decrease",s.GroupIncrease="group_increase",s.GroupBan="group_ban",s.FriendAdd="friend_add",s.GroupRecall="group_recall",s.FriendRecall="friend_recall",s.Notify="notify",s.GroupMsgEmojiLike="group_msg_emoji_like",s.GroupMsgEmojiLikeLagrange="reaction",s.GroupEssence="essence",s.GroupCard="group_card",s))(It||{});const Dg=s=>{switch(s){case"message":return"消息";case"notice":return"通知";case"request":return"请求";case"meta_event":return"元事件";case"message_sent":return"消息上报";default:return"未知"}},$g=s=>{switch(s){case"enable":return"启用";case"disable":return"停用";case"connect":return"连接";default:return"未知"}},Ug=s=>{switch(s){case"enable":return"success";case"disable":return"danger";case"connect":return"success";default:return"default"}},Fg=s=>"post_type"in s,Hg=s=>"status"in s&&"retcode"in s,zg=s=>{switch(s){case"ok":return"成功";case"failed":return"失败";case"async":return"异步";default:return"未知"}},Gg=s=>{switch(s){case"ok":return"success";case"failed":return"danger";case"async":return"warning";default:return"default"}},Vg=s=>{switch(s){case It.GroupUpload:return"群文件上传";case It.GroupAdmin:return"群管理员变动";case It.GroupDecrease:return"群成员减少";case It.GroupIncrease:return"群成员增加";case It.GroupBan:return"群禁言";case It.FriendAdd:return"好友添加";case It.GroupRecall:return"群消息撤回";case It.FriendRecall:return"好友消息撤回";case It.Notify:return"通知";case It.GroupMsgEmojiLike:return"群消息表情回应";case It.GroupEssence:return"群消息精华";case It.GroupCard:return"群名片更新";default:return"未知"}},Kg=s=>s.message_type==="group",X1=s=>{var e,r,n;let t={type:"text",data:{text:s.insert}};return typeof s.insert!="string"&&((e=s.insert)!=null&&e.image?t={type:"image",data:{file:s.insert.image.src}}:(r=s.insert)!=null&&r.emoji?t={type:"face",data:{id:s.insert.emoji.id}}:(n=s.insert)!=null&&n.reply&&(t={type:"reply",data:{id:s.insert.reply.messageId}})),t},Ar=s=>/^(http|https|file):\/\/.*/.test(s),Y1=()=>{const[s,t]=H.useState(""),e=H.useRef(null),r=Ze(),n=j=>{r([{type:"record",data:{file:j}}])},[i,l]=H.useState(!1),o=H.useRef(null),c=H.useRef([]),[h,m]=H.useState(null),[y,f]=H.useState(!1),d=H.useRef(null),[v,w]=H.useState(0),N=H.useRef(null);H.useEffect(()=>{var j;i?(navigator.mediaDevices.getUserMedia({audio:!0}).then(V=>{d.current=V;const tt=new MediaRecorder(V);o.current=tt,tt.start(),tt.ondataavailable=J=>{J.data.size>0&&c.current.push(J.data)},tt.onstop=()=>{if(c.current.length>0){const J=new Blob(c.current,{type:"audio/wav"}),pt=new FileReader;pt.readAsDataURL(J),pt.onloadend=()=>{const gt=pt.result;m(gt),f(!0)},c.current=[]}V.getTracks().forEach(J=>J.stop())}}),N.current=setInterval(()=>{w(V=>V+1)},1e3)):((j=o.current)==null||j.stop(),N.current&&(clearInterval(N.current),N.current=null))},[i]);const T=()=>{m(null),f(!1),w(0),l(!0)},O=()=>{l(!1)},k=()=>{h&&n(h)},z=j=>{const V=Math.floor(j/60),tt=j%60;return`${V}:${tt.toString().padStart(2,"0")}`};return b.jsxs(b.Fragment,{children:[b.jsxs($t,{children:[b.jsx(xt,{content:"发送音频",children:b.jsx("div",{className:"max-w-fit",children:b.jsx(Ut,{children:b.jsx(lt,{color:"primary",variant:"flat",isIconOnly:!0,radius:"full",children:b.jsx(Qi,{className:"text-xl"})})})})}),b.jsxs(Ft,{className:"flex-row gap-2 p-4",children:[b.jsx(xt,{content:"上传音频",children:b.jsx(lt,{className:"text-lg",color:"primary",isIconOnly:!0,variant:"flat",radius:"full",onPress:()=>{var j;(j=e==null?void 0:e.current)==null||j.click()},children:b.jsx(Gs,{})})}),b.jsxs($t,{children:[b.jsx(xt,{content:"输入音频地址",children:b.jsx("div",{className:"max-w-fit",children:b.jsx(Ut,{tooltip:"输入音频地址",children:b.jsx(lt,{className:"text-lg",color:"primary",isIconOnly:!0,variant:"flat",radius:"full",children:b.jsx(Vs,{})})})})}),b.jsxs(Ft,{className:"flex-row gap-1 p-2",children:[b.jsx(Kt,{value:s,onChange:j=>t(j.target.value),placeholder:"请输入音频地址"}),b.jsx(lt,{color:"primary",variant:"flat",isIconOnly:!0,radius:"full",onPress:()=>{if(!Ar(s)){Er.error("请输入正确的音频地址");return}n(s),t("")},children:b.jsx(Ro,{})})]})]}),b.jsxs($t,{children:[b.jsx(xt,{content:"录制音频",children:b.jsx("div",{className:"max-w-fit",children:b.jsx(Ut,{children:b.jsx(lt,{className:"text-lg",color:"primary",isIconOnly:!0,variant:"flat",radius:"full",children:b.jsx(Qi,{})})})})}),b.jsxs(Ft,{className:"flex-col gap-2 p-4",children:[b.jsxs("div",{className:"flex gap-2",children:[b.jsx(lt,{color:"primary",variant:"flat",onPress:i?O:T,children:i?"停止录制":"开始录制"}),y&&h&&b.jsx(lt,{color:"primary",variant:"flat",onPress:k,children:"查看消息" Line truncated
`,l.sources.SILENT)}),i.on("editor-change",f=>{var d;if(f==="text-change"){const w=i.getContents().ops[0];w&&typeof w.insert!="string"&&((d=w.insert)!=null&&d.reply)&&i.getLength()===1&&i.insertText(1,`
`,l.sources.SILENT)}}),i.root.addEventListener("compositionstart",()=>{var v;const d=i.getContents().ops[0];d&&typeof d.insert!="string"&&((v=d.insert)!=null&&v.reply)&&i.getLength()===1&&i.insertText(1,`
`,l.sources.SILENT)}));const o=f=>{if(f){const d=i==null?void 0:i.getSelection();d&&(s.current=d)}},c=f=>{const d=s.current||(i==null?void 0:i.getSelection());i==null||i.deleteText((d==null?void 0:d.index)||0,(d==null?void 0:d.length)||0),i==null||i.insertEmbed((d==null?void 0:d.index)||0,"image",{src:f,alt:"图片"}),i==null||i.setSelection(((d==null?void 0:d.index)||0)+1,0)};function h(f){var T;if(!/^(?:0|(?:-?[1-9]\d*))$/.test(f)){Er.error("请输入正确的消息ID");return}const v=i==null?void 0:i.getContents(),w=v==null?void 0:v.ops[0],N=i==null?void 0:i.getSelection();if(w&&typeof w.insert!="string"&&((T=w.insert)!=null&&T.reply)){const O=i==null?void 0:i.getContents();O&&(O.ops[0]={insert:{reply:{messageId:f}}},i==null||i.setContents(O,l.sources.USER))}else i==null||i.insertEmbed(0,"reply",{messageId:f},l.sources.USER);i==null||i.setSelection(((N==null?void 0:N.index)||0)+1,0),i==null||i.blur()}const m=f=>{const d=s.current||(i==null?void 0:i.getSelection());i==null||i.deleteText((d==null?void 0:d.index)||0,(d==null?void 0:d.length)||0),i==null||i.insertEmbed((d==null?void 0:d.index)||0,"emoji",{alt:f.alt,src:f.src,id:f.id}),i==null||i.setSelection(((d==null?void 0:d.index)||0)+1,0)},y=()=>{var w;const f=i==null?void 0:i.getContents();return(((w=f==null?void 0:f.ops)==null?void 0:w.filter(N=>N.insert!==`
`))??[]).map(N=>X1(N))};return b.jsxs("div",{children:[b.jsx("div",{ref:n,className:"border border-default-200 rounded-md !mb-2 !text-base !h-64"}),b.jsxs("div",{id:"toolbar",className:"!border-none flex gap-2",children:[b.jsx(eg,{insertImage:c,onOpenChange:o}),b.jsx(J1,{onInsertEmoji:m,onOpenChange:o}),b.jsx(sg,{insertReply:h}),b.jsx(tg,{}),b.jsx(Y1,{}),b.jsx(ag,{}),b.jsx(rg,{}),b.jsx(Q1,{}),b.jsx(ig,{}),b.jsx(lt,{color:"primary",onPress:()=>{const f=y();t(f)},className:"ml-auto",children:"获取JSON格式"})]})]})};function Zg({children:s}){const{isOpen:t,onOpen:e,onOpenChange:r}=Co();return b.jsxs(b.Fragment,{children:[s?s(e):b.jsx(lt,{onPress:e,color:"primary",radius:"full",variant:"flat",size:"sm",className:"bg-primary/10 text-primary",children:"构造消息"}),b.jsx(Lo,{size:"4xl",scrollBehavior:"inside",isOpen:t,onOpenChange:r,children:b.jsx(So,{children:n=>b.jsxs(b.Fragment,{children:[b.jsx(_o,{className:"flex flex-col gap-1",children:"构造消息"}),b.jsx(Oo,{className:"overflow-y-auto",children:b.jsx("div",{className:"overflow-y-auto",children:b.jsx(ug,{})})}),b.jsx(qo,{children:b.jsx(lt,{color:"primary",onPress:n,variant:"flat",children:"关闭"})})]})})})]})}export{Zg as C,It as O,Ug as a,Vg as b,zg as c,Gg as d,Dg as e,Fg as f,$g as g,Hg as h,Kg as i,Z1 as s};