HEX
Server: nginx/1.28.3
System: Linux VM-0-7-opencloudos 6.6.117-45.oc9.x86_64 #1 SMP Thu Dec 4 10:26:39 CST 2025 x86_64
User: www (1000)
PHP: 8.2.28
Disabled: passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv
Upload Files
File: /www/wwwroot/www.213n.cn/wp-content/plugins/smart-seo-tool/assets/wbp/Step-AffLm5_e.js
import{O as e,Q as t,aO as n,aQ as o,L as r,a1 as i,V as s,c as l,o as a,m as c,bB as d,a6 as h,Z as u,R as p,S as f,e as m,f as g,g as y,k as v,Y as b,s as w,a8 as k,bC as x,bq as M,ad as S,bs as C,aY as O,b1 as T,F as A,h as E,T as N,aU as D,bt as R,bi as V,bD as I,bu as z,bE as L,D as P,x as $,l as B,w as H,bF as _,p as F,n as j,i as U,a3 as W,bb as q,q as K,a7 as J,am as G,al as Y,I as X,j as Q,t as Z,a$ as ee,C as te,ah as ne,aa as oe,X as re,aP as ie,b4 as se,bG as le,b0 as ae,bH as ce,bI as de,bJ as he,u as ue,a as pe,b9 as fe,bK as me,bL as ge,y as ye,bM as ve,K as be,bN as we,A as ke,E as xe,bz as Me,aj as Se,b as Ce,bO as Oe,d as Te,v as Ae}from"./wbs-CW01onor.js";import{u as Ee,e as Ne,C as De,d as Re,h as Ve,a as Ie,E as ze}from"./el-select-DkDLIfi4.js";/* empty css                          */import{E as Le,a as Pe}from"./el-checkbox-COftrXd0.js";import{a as $e,E as Be,b as He}from"./el-radio-CKsC97W8.js";/* empty css                       */import{E as _e}from"./el-input-number-CgmlJCrz.js";import{E as Fe}from"./el-switch-C2P8O7HE.js";const je=e({color:{type:t(Object),required:!0},vertical:{type:Boolean,default:!1}});let Ue=!1;function We(e,t){if(!n)return;const o=function(e){var n;null==(n=t.drag)||n.call(t,e)},r=function(e){var n;document.removeEventListener("mousemove",o),document.removeEventListener("mouseup",r),document.removeEventListener("touchmove",o),document.removeEventListener("touchend",r),document.onselectstart=null,document.ondragstart=null,Ue=!1,null==(n=t.end)||n.call(t,e)},i=function(e){var n;Ue||(e.preventDefault(),document.onselectstart=()=>!1,document.ondragstart=()=>!1,document.addEventListener("mousemove",o),document.addEventListener("mouseup",r),document.addEventListener("touchmove",o),document.addEventListener("touchend",r),Ue=!0,null==(n=t.start)||n.call(t,e))};e.addEventListener("mousedown",i),e.addEventListener("touchstart",i,{passive:!1})}const qe=e=>{let t,n;return"touchend"===e.type?(n=e.changedTouches[0].clientY,t=e.changedTouches[0].clientX):e.type.startsWith("touch")?(n=e.touches[0].clientY,t=e.touches[0].clientX):(n=e.clientY,t=e.clientX),{clientX:t,clientY:n}},Ke=(e,{bar:t,thumb:n,handleDrag:o})=>{const r=u(),h=s("color-alpha-slider"),p=l(0),f=l(0),m=l();function g(){p.value=function(){if(!n.value)return 0;if(e.vertical)return 0;const t=r.vnode.el,o=e.color.get("alpha");return t?Math.round(o*(t.offsetWidth-n.value.offsetWidth/2)/100):0}(),f.value=function(){if(!n.value)return 0;const t=r.vnode.el;if(!e.vertical)return 0;const o=e.color.get("alpha");return t?Math.round(o*(t.offsetHeight-n.value.offsetHeight/2)/100):0}(),m.value=function(){if(e.color&&e.color.value){const{r:t,g:n,b:o}=e.color.toRgb();return`linear-gradient(to right, rgba(${t}, ${n}, ${o}, 0) 0%, rgba(${t}, ${n}, ${o}, 1) 100%)`}return""}()}a((()=>{if(!t.value||!n.value)return;const e={drag:e=>{o(e)},end:e=>{o(e)}};We(t.value,e),We(n.value,e),g()})),c((()=>e.color.get("alpha")),(()=>g())),c((()=>e.color.value),(()=>g()));const y=i((()=>[h.b(),h.is("vertical",e.vertical)])),v=i((()=>h.e("bar"))),b=i((()=>h.e("thumb")));return{rootKls:y,barKls:v,barStyle:i((()=>({background:m.value}))),thumbKls:b,thumbStyle:i((()=>({left:d(p.value),top:d(f.value)}))),update:g}},Je=f({name:"ElColorAlphaSlider"}),Ge=f({...Je,props:je,setup(e,{expose:t}){const n=e,{alpha:s,alphaLabel:l,bar:a,thumb:c,handleDrag:d,handleClick:p,handleKeydown:f}=(e=>{const t=u(),{t:n}=o(),s=r(),l=r(),a=i((()=>e.color.get("alpha"))),c=i((()=>n("el.colorpicker.alphaLabel")));function d(n){if(!l.value||!s.value)return;const o=t.vnode.el.getBoundingClientRect(),{clientX:r,clientY:i}=qe(n);if(e.vertical){let t=i-o.top;t=Math.max(s.value.offsetHeight/2,t),t=Math.min(t,o.height-s.value.offsetHeight/2),e.color.set("alpha",Math.round((t-s.value.offsetHeight/2)/(o.height-s.value.offsetHeight)*100))}else{let t=r-o.left;t=Math.max(s.value.offsetWidth/2,t),t=Math.min(t,o.width-s.value.offsetWidth/2),e.color.set("alpha",Math.round((t-s.value.offsetWidth/2)/(o.width-s.value.offsetWidth)*100))}}function p(t){let n=a.value+t;n=n<0?0:n>100?100:n,e.color.set("alpha",n)}return{thumb:s,bar:l,alpha:a,alphaLabel:c,handleDrag:d,handleClick:function(e){var t;e.target!==s.value&&d(e),null==(t=s.value)||t.focus()},handleKeydown:function(e){const{code:t,shiftKey:n}=e,o=n?10:1;switch(t){case h.left:case h.down:e.preventDefault(),e.stopPropagation(),p(-o);break;case h.right:case h.up:e.preventDefault(),e.stopPropagation(),p(o)}}}})(n),{rootKls:k,barKls:x,barStyle:M,thumbKls:S,thumbStyle:C,update:O}=Ke(n,{bar:a,thumb:c,handleDrag:d});return t({update:O,bar:a,thumb:c}),(e,t)=>(g(),m("div",{class:w(v(k))},[y("div",{ref_key:"bar",ref:a,class:w(v(x)),style:b(v(M)),onClick:v(p)},null,14,["onClick"]),y("div",{ref_key:"thumb",ref:c,class:w(v(S)),style:b(v(C)),"aria-label":v(l),"aria-valuenow":v(s),"aria-orientation":e.vertical?"vertical":"horizontal","aria-valuemin":"0","aria-valuemax":"100",role:"slider",tabindex:"0",onKeydown:v(f)},null,46,["aria-label","aria-valuenow","aria-orientation","onKeydown"])],2))}});var Ye=p(Ge,[["__file","alpha-slider.vue"]]);var Xe=p(f({name:"ElColorHueSlider",props:{color:{type:Object,required:!0},vertical:Boolean},setup(e){const t=s("color-hue-slider"),n=u(),o=l(),r=l(),d=l(0),h=l(0),p=i((()=>e.color.get("hue")));function f(t){if(!r.value||!o.value)return;const i=n.vnode.el.getBoundingClientRect(),{clientX:s,clientY:l}=qe(t);let a;if(e.vertical){let e=l-i.top;e=Math.min(e,i.height-o.value.offsetHeight/2),e=Math.max(o.value.offsetHeight/2,e),a=Math.round((e-o.value.offsetHeight/2)/(i.height-o.value.offsetHeight)*360)}else{let e=s-i.left;e=Math.min(e,i.width-o.value.offsetWidth/2),e=Math.max(o.value.offsetWidth/2,e),a=Math.round((e-o.value.offsetWidth/2)/(i.width-o.value.offsetWidth)*360)}e.color.set("hue",a)}function m(){d.value=function(){if(!o.value)return 0;const t=n.vnode.el;if(e.vertical)return 0;const r=e.color.get("hue");return t?Math.round(r*(t.offsetWidth-o.value.offsetWidth/2)/360):0}(),h.value=function(){if(!o.value)return 0;const t=n.vnode.el;if(!e.vertical)return 0;const r=e.color.get("hue");return t?Math.round(r*(t.offsetHeight-o.value.offsetHeight/2)/360):0}()}return c((()=>p.value),(()=>{m()})),a((()=>{if(!r.value||!o.value)return;const e={drag:e=>{f(e)},end:e=>{f(e)}};We(r.value,e),We(o.value,e),m()})),{bar:r,thumb:o,thumbLeft:d,thumbTop:h,hueValue:p,handleClick:function(e){e.target!==o.value&&f(e)},update:m,ns:t}}}),[["render",function(e,t,n,o,r,i){return g(),m("div",{class:w([e.ns.b(),e.ns.is("vertical",e.vertical)])},[y("div",{ref:"bar",class:w(e.ns.e("bar")),onClick:e.handleClick},null,10,["onClick"]),y("div",{ref:"thumb",class:w(e.ns.e("thumb")),style:b({left:e.thumbLeft+"px",top:e.thumbTop+"px"})},null,6)],2)}],["__file","hue-slider.vue"]]);const Qe=e({modelValue:String,id:String,showAlpha:Boolean,colorFormat:String,disabled:Boolean,size:O,popperClass:{type:String,default:""},tabindex:{type:[String,Number],default:0},teleported:Ee.teleported,predefine:{type:t(Array)},validateEvent:{type:Boolean,default:!0},...C(["ariaLabel"])}),Ze={[S]:e=>k(e)||x(e),[M]:e=>k(e)||x(e),activeChange:e=>k(e)||x(e),focus:e=>e instanceof FocusEvent,blur:e=>e instanceof FocusEvent},et=Symbol("colorPickerContextKey"),tt=function(e,t,n){return[e,t*n/((e=(2-t)*n)<1?e:2-e)||0,e/2]},nt=function(e,t){var n;k(n=e)&&n.includes(".")&&1===Number.parseFloat(n)&&(e="100%");const o=function(e){return k(e)&&e.includes("%")}(e);return e=Math.min(t,Math.max(0,Number.parseFloat(`${e}`))),o&&(e=Number.parseInt(""+e*t,10)/100),Math.abs(e-t)<1e-6?1:e%t/Number.parseFloat(t)},ot={10:"A",11:"B",12:"C",13:"D",14:"E",15:"F"},rt=e=>{e=Math.min(Math.round(e),255);const t=Math.floor(e/16),n=e%16;return`${ot[t]||t}${ot[n]||n}`},it=function({r:e,g:t,b:n}){return Number.isNaN(+e)||Number.isNaN(+t)||Number.isNaN(+n)?"":`#${rt(e)}${rt(t)}${rt(n)}`},st={A:10,B:11,C:12,D:13,E:14,F:15},lt=function(e){return 2===e.length?16*(st[e[0].toUpperCase()]||+e[0])+(st[e[1].toUpperCase()]||+e[1]):st[e[1].toUpperCase()]||+e[1]},at=(e,t,n)=>{e=nt(e,255),t=nt(t,255),n=nt(n,255);const o=Math.max(e,t,n),r=Math.min(e,t,n);let i;const s=o,l=o-r,a=0===o?0:l/o;if(o===r)i=0;else{switch(o){case e:i=(t-n)/l+(t<n?6:0);break;case t:i=(n-e)/l+2;break;case n:i=(e-t)/l+4}i/=6}return{h:360*i,s:100*a,v:100*s}},ct=function(e,t,n){e=6*nt(e,360),t=nt(t,100),n=nt(n,100);const o=Math.floor(e),r=e-o,i=n*(1-t),s=n*(1-r*t),l=n*(1-(1-r)*t),a=o%6,c=[n,s,i,i,l,n][a],d=[l,n,n,s,i,i][a],h=[i,i,l,n,n,s][a];return{r:Math.round(255*c),g:Math.round(255*d),b:Math.round(255*h)}};class dt{constructor(e={}){this._hue=0,this._saturation=100,this._value=100,this._alpha=100,this.enableAlpha=!1,this.format="hex",this.value="";for(const t in e)T(e,t)&&(this[t]=e[t]);e.value?this.fromString(e.value):this.doOnChange()}set(e,t){if(1!==arguments.length||"object"!=typeof e)this[`_${e}`]=t,this.doOnChange();else for(const n in e)T(e,n)&&this.set(n,e[n])}get(e){return"alpha"===e?Math.floor(this[`_${e}`]):this[`_${e}`]}toRgb(){return ct(this._hue,this._saturation,this._value)}fromString(e){if(!e)return this._hue=0,this._saturation=100,this._value=100,void this.doOnChange();const t=(e,t,n)=>{this._hue=Math.max(0,Math.min(360,e)),this._saturation=Math.max(0,Math.min(100,t)),this._value=Math.max(0,Math.min(100,n)),this.doOnChange()};if(e.includes("hsl")){const n=e.replace(/hsla|hsl|\(|\)/gm,"").split(/\s|,/g).filter((e=>""!==e)).map(((e,t)=>t>2?Number.parseFloat(e):Number.parseInt(e,10)));if(4===n.length?this._alpha=100*Number.parseFloat(n[3]):3===n.length&&(this._alpha=100),n.length>=3){const{h:e,s:o,v:r}=function(e,t,n){n/=100;let o=t/=100;const r=Math.max(n,.01);return t*=(n*=2)<=1?n:2-n,o*=r<=1?r:2-r,{h:e,s:100*(0===n?2*o/(r+o):2*t/(n+t)),v:(n+t)/2*100}}(n[0],n[1],n[2]);t(e,o,r)}}else if(e.includes("hsv")){const n=e.replace(/hsva|hsv|\(|\)/gm,"").split(/\s|,/g).filter((e=>""!==e)).map(((e,t)=>t>2?Number.parseFloat(e):Number.parseInt(e,10)));4===n.length?this._alpha=100*Number.parseFloat(n[3]):3===n.length&&(this._alpha=100),n.length>=3&&t(n[0],n[1],n[2])}else if(e.includes("rgb")){const n=e.replace(/rgba|rgb|\(|\)/gm,"").split(/\s|,/g).filter((e=>""!==e)).map(((e,t)=>t>2?Number.parseFloat(e):Number.parseInt(e,10)));if(4===n.length?this._alpha=100*Number.parseFloat(n[3]):3===n.length&&(this._alpha=100),n.length>=3){const{h:e,s:o,v:r}=at(n[0],n[1],n[2]);t(e,o,r)}}else if(e.includes("#")){const n=e.replace("#","").trim();if(!/^[0-9a-fA-F]{3}$|^[0-9a-fA-F]{6}$|^[0-9a-fA-F]{8}$/.test(n))return;let o,r,i;3===n.length?(o=lt(n[0]+n[0]),r=lt(n[1]+n[1]),i=lt(n[2]+n[2])):6!==n.length&&8!==n.length||(o=lt(n.slice(0,2)),r=lt(n.slice(2,4)),i=lt(n.slice(4,6))),8===n.length?this._alpha=lt(n.slice(6))/255*100:3!==n.length&&6!==n.length||(this._alpha=100);const{h:s,s:l,v:a}=at(o,r,i);t(s,l,a)}}compare(e){return Math.abs(e._hue-this._hue)<2&&Math.abs(e._saturation-this._saturation)<1&&Math.abs(e._value-this._value)<1&&Math.abs(e._alpha-this._alpha)<1}doOnChange(){const{_hue:e,_saturation:t,_value:n,_alpha:o,format:r}=this;if(this.enableAlpha)switch(r){case"hsl":{const o=tt(e,t/100,n/100);this.value=`hsla(${e}, ${Math.round(100*o[1])}%, ${Math.round(100*o[2])}%, ${this.get("alpha")/100})`;break}case"hsv":this.value=`hsva(${e}, ${Math.round(t)}%, ${Math.round(n)}%, ${this.get("alpha")/100})`;break;case"hex":this.value=`${it(ct(e,t,n))}${rt(255*o/100)}`;break;default:{const{r:o,g:r,b:i}=ct(e,t,n);this.value=`rgba(${o}, ${r}, ${i}, ${this.get("alpha")/100})`}}else switch(r){case"hsl":{const o=tt(e,t/100,n/100);this.value=`hsl(${e}, ${Math.round(100*o[1])}%, ${Math.round(100*o[2])}%)`;break}case"hsv":this.value=`hsv(${e}, ${Math.round(t)}%, ${Math.round(n)}%)`;break;case"rgb":{const{r:o,g:r,b:i}=ct(e,t,n);this.value=`rgb(${o}, ${r}, ${i})`;break}default:this.value=it(ct(e,t,n))}}}var ht=p(f({props:{colors:{type:Array,required:!0},color:{type:Object,required:!0},enableAlpha:{type:Boolean,required:!0}},setup(e){const t=s("color-predefine"),{currentColor:n}=N(et),o=l(r(e.colors,e.color));function r(t,n){return t.map((t=>{const o=new dt;return o.enableAlpha=e.enableAlpha,o.format="rgba",o.fromString(t),o.selected=o.value===n.value,o}))}return c((()=>n.value),(e=>{const t=new dt;t.fromString(e),o.value.forEach((e=>{e.selected=t.compare(e)}))})),D((()=>{o.value=r(e.colors,e.color)})),{rgbaColors:o,handleSelect:function(t){e.color.fromString(e.colors[t])},ns:t}}}),[["render",function(e,t,n,o,r,i){return g(),m("div",{class:w(e.ns.b())},[y("div",{class:w(e.ns.e("colors"))},[(g(!0),m(A,null,E(e.rgbaColors,((t,n)=>(g(),m("div",{key:e.colors[n],class:w([e.ns.e("color-selector"),e.ns.is("alpha",t._alpha<100),{selected:t.selected}]),onClick:t=>e.handleSelect(n)},[y("div",{style:b({backgroundColor:t.value})},null,4)],10,["onClick"])))),128))],2)],2)}],["__file","predefine.vue"]]);var ut=p(f({name:"ElSlPanel",props:{color:{type:Object,required:!0}},setup(e){const t=s("color-svpanel"),n=u(),o=l(0),r=l(0),d=l("hsl(0, 100%, 50%)"),h=i((()=>({hue:e.color.get("hue"),value:e.color.get("value")})));function p(){const t=e.color.get("saturation"),i=e.color.get("value"),s=n.vnode.el,{clientWidth:l,clientHeight:a}=s;r.value=t*l/100,o.value=(100-i)*a/100,d.value=`hsl(${e.color.get("hue")}, 100%, 50%)`}function f(t){const i=n.vnode.el.getBoundingClientRect(),{clientX:s,clientY:l}=qe(t);let a=s-i.left,c=l-i.top;a=Math.max(0,a),a=Math.min(a,i.width),c=Math.max(0,c),c=Math.min(c,i.height),r.value=a,o.value=c,e.color.set({saturation:a/i.width*100,value:100-c/i.height*100})}return c((()=>h.value),(()=>{p()})),a((()=>{We(n.vnode.el,{drag:e=>{f(e)},end:e=>{f(e)}}),p()})),{cursorTop:o,cursorLeft:r,background:d,colorValue:h,handleDrag:f,update:p,ns:t}}}),[["render",function(e,t,n,o,r,i){return g(),m("div",{class:w(e.ns.b()),style:b({backgroundColor:e.background})},[y("div",{class:w(e.ns.e("white"))},null,2),y("div",{class:w(e.ns.e("black"))},null,2),y("div",{class:w(e.ns.e("cursor")),style:b({top:e.cursorTop+"px",left:e.cursorLeft+"px"})},[y("div")],6)],6)}],["__file","sv-panel.vue"]]);const pt=f({name:"ElColorPicker"});const ft=ne(p(f({...pt,props:Qe,emits:Ze,setup(e,{expose:t,emit:n}){const r=e,{t:d}=o(),u=s("color"),{formItem:p}=R(),f=V(),k=I(),{inputId:x,isLabeledByFormItem:M}=z(r,{formItemContext:p}),C=l(),O=l(),T=l(),A=l(),E=l(),N=l(),{isFocused:D,handleFocus:ne,handleBlur:oe}=L(E,{beforeFocus:()=>k.value,beforeBlur(e){var t;return null==(t=A.value)?void 0:t.isFocusInsideContent(e)},afterBlur(){fe(!1),ve()}});let re=!0;const ie=P(new dt({enableAlpha:r.showAlpha,format:r.colorFormat||"",value:r.modelValue})),se=l(!1),le=l(!1),ae=l(""),ce=i((()=>r.modelValue||le.value?function(e,t){if(!(e instanceof dt))throw new TypeError("color should be instance of _color Class");const{r:n,g:o,b:r}=e.toRgb();return t?`rgba(${n}, ${o}, ${r}, ${e.get("alpha")/100})`:`rgb(${n}, ${o}, ${r})`}(ie,r.showAlpha):"transparent")),de=i((()=>r.modelValue||le.value?ie.value:"")),he=i((()=>M.value?void 0:r.ariaLabel||d("el.colorpicker.defaultLabel"))),ue=i((()=>M.value?null==p?void 0:p.labelId:void 0)),pe=i((()=>[u.b("picker"),u.is("disabled",k.value),u.bm("picker",f.value),u.is("focused",D.value)]));function fe(e){se.value=e}const me=Ne(fe,100,{leading:!0});function ge(){k.value||fe(!0)}function ye(){me(!1),ve()}function ve(){$((()=>{r.modelValue?ie.fromString(r.modelValue):(ie.value="",$((()=>{le.value=!1})))}))}function be(){k.value||me(!se.value)}function we(){ie.fromString(ae.value)}function ke(){const e=ie.value;n(S,e),n("change",e),r.validateEvent&&(null==p||p.validate("change").catch((e=>ee()))),me(!1),$((()=>{const e=new dt({enableAlpha:r.showAlpha,format:r.colorFormat||"",value:r.modelValue});ie.compare(e)||ve()}))}function xe(){me(!1),n(S,null),n("change",null),null!==r.modelValue&&r.validateEvent&&(null==p||p.validate("change").catch((e=>ee()))),ve()}function Me(){se.value&&(ye(),D.value&&Oe())}function Se(e){e.preventDefault(),e.stopPropagation(),fe(!1),ve()}function Ce(e){switch(e.code){case h.enter:case h.numpadEnter:case h.space:e.preventDefault(),e.stopPropagation(),ge(),N.value.focus();break;case h.esc:Se(e)}}function Oe(){E.value.focus()}return a((()=>{r.modelValue&&(ae.value=de.value)})),c((()=>r.modelValue),(e=>{e?e&&e!==ie.value&&(re=!1,ie.fromString(e)):le.value=!1})),c((()=>[r.colorFormat,r.showAlpha]),(()=>{ie.enableAlpha=r.showAlpha,ie.format=r.colorFormat||ie.format,ie.doOnChange(),n(S,ie.value)})),c((()=>de.value),(e=>{ae.value=e,re&&n("activeChange",e),re=!0})),c((()=>ie.value),(()=>{r.modelValue||le.value||(le.value=!0)})),c((()=>se.value),(()=>{$((()=>{var e,t,n;null==(e=C.value)||e.update(),null==(t=O.value)||t.update(),null==(n=T.value)||n.update()}))})),te(et,{currentColor:de}),t({color:ie,show:ge,hide:ye,focus:Oe,blur:function(){E.value.blur()}}),(e,t)=>(g(),B(v(Re),{ref_key:"popper",ref:A,visible:se.value,"show-arrow":!1,"fallback-placements":["bottom","top","right","left"],offset:0,"gpu-acceleration":!1,"popper-class":[v(u).be("picker","panel"),v(u).b("dropdown"),e.popperClass],"stop-popper-mouse-event":!1,effect:"light",trigger:"click",teleported:e.teleported,transition:`${v(u).namespace.value}-zoom-in-top`,persistent:"",onHide:e=>fe(!1)},{content:H((()=>[j((g(),m("div",{onKeydown:G(Se,["esc"])},[y("div",{class:w(v(u).be("dropdown","main-wrapper"))},[U(Xe,{ref_key:"hue",ref:C,class:"hue-slider",color:v(ie),vertical:""},null,8,["color"]),U(ut,{ref_key:"sv",ref:O,color:v(ie)},null,8,["color"])],2),e.showAlpha?(g(),B(Ye,{key:0,ref_key:"alpha",ref:T,color:v(ie)},null,8,["color"])):F("v-if",!0),e.predefine?(g(),B(ht,{key:1,ref:"predefine","enable-alpha":e.showAlpha,color:v(ie),colors:e.predefine},null,8,["enable-alpha","color","colors"])):F("v-if",!0),y("div",{class:w(v(u).be("dropdown","btns"))},[y("span",{class:w(v(u).be("dropdown","value"))},[U(v(Y),{ref_key:"inputRef",ref:N,modelValue:ae.value,"onUpdate:modelValue":e=>ae.value=e,"validate-event":!1,size:"small",onKeyup:G(we,["enter"]),onBlur:we},null,8,["modelValue","onUpdate:modelValue","onKeyup"])],2),U(v(X),{class:w(v(u).be("dropdown","link-btn")),text:"",size:"small",onClick:xe},{default:H((()=>[Q(Z(v(d)("el.colorpicker.clear")),1)])),_:1},8,["class"]),U(v(X),{plain:"",size:"small",class:w(v(u).be("dropdown","btn")),onClick:ke},{default:H((()=>[Q(Z(v(d)("el.colorpicker.confirm")),1)])),_:1},8,["class"])],2)],40,["onKeydown"])),[[v(De),Me]])])),default:H((()=>[y("div",_({id:v(x),ref_key:"triggerRef",ref:E},e.$attrs,{class:v(pe),role:"button","aria-label":v(he),"aria-labelledby":v(ue),"aria-description":v(d)("el.colorpicker.description",{color:e.modelValue||""}),"aria-disabled":v(k),tabindex:v(k)?-1:e.tabindex,onKeydown:Ce,onFocus:v(ne),onBlur:v(oe)}),[v(k)?(g(),m("div",{key:0,class:w(v(u).be("picker","mask"))},null,2)):F("v-if",!0),y("div",{class:w(v(u).be("picker","trigger")),onClick:be},[y("span",{class:w([v(u).be("picker","color"),v(u).is("alpha",e.showAlpha)])},[y("span",{class:w(v(u).be("picker","color-inner")),style:b({backgroundColor:v(ce)})},[j(U(v(W),{class:w([v(u).be("picker","icon"),v(u).is("icon-arrow-down")])},{default:H((()=>[U(v(q))])),_:1},8,["class"]),[[K,e.modelValue||le.value]]),j(U(v(W),{class:w([v(u).be("picker","empty"),v(u).is("icon-close")])},{default:H((()=>[U(v(J))])),_:1},8,["class"]),[[K,!e.modelValue&&!le.value]])],6)],2)],2)],16,["id","aria-label","aria-labelledby","aria-description","aria-disabled","tabindex","onFocus","onBlur"])])),_:1},8,["visible","popper-class","teleported","transition","onHide"]))}}),[["__file","color-picker.vue"]])),mt=e({direction:{type:String,values:["horizontal","vertical"],default:"horizontal"},contentPosition:{type:String,values:["left","center","right"],default:"center"},borderStyle:{type:t(String),default:"solid"}}),gt=f({name:"ElDivider"});const yt=ne(p(f({...gt,props:mt,setup(e){const t=e,n=s("divider"),o=i((()=>n.cssVar({"border-style":t.borderStyle})));return(e,t)=>(g(),m("div",{class:w([v(n).b(),v(n).m(e.direction)]),style:b(v(o)),role:"separator"},[e.$slots.default&&"vertical"!==e.direction?(g(),m("div",{key:0,class:w([v(n).e("text"),v(n).is(e.contentPosition)])},[oe(e.$slots,"default")],2)):F("v-if",!0)],6))}}),[["__file","divider.vue"]]));var vt=p(f({inheritAttrs:!1}),[["render",function(e,t,n,o,r,i){return oe(e.$slots,"default")}],["__file","collection.vue"]]);var bt=p(f({name:"ElCollectionItem",inheritAttrs:!1}),[["render",function(e,t,n,o,r,i){return oe(e.$slots,"default")}],["__file","collection-item.vue"]]);const wt=e({trigger:Ve.trigger,triggerKeys:{type:t(Array),default:()=>[h.enter,h.numpadEnter,h.space,h.down]},effect:{...Ee.effect,default:"light"},type:{type:t(String)},placement:{type:t(String),default:"bottom"},popperOptions:{type:t(Object),default:()=>({})},id:String,size:{type:String,default:""},splitButton:Boolean,hideOnClick:{type:Boolean,default:!0},loop:{type:Boolean,default:!0},showTimeout:{type:Number,default:150},hideTimeout:{type:Number,default:150},tabindex:{type:t([Number,String]),default:0},maxHeight:{type:t([Number,String]),default:""},popperClass:{type:String,default:""},disabled:Boolean,role:{type:String,default:"menu"},buttonProps:{type:t(Object)},teleported:Ee.teleported});e({command:{type:[Object,String,Number],default:()=>({})},disabled:Boolean,divided:Boolean,textValue:String,icon:{type:ie}}),e({onKeydown:{type:t(Function)}}),(e=>{const t=`El${e}Collection`,n=`${t}Item`,o=Symbol(t),r=Symbol(n),i={...vt,name:t,setup(){const e=l(null),t=new Map;te(o,{itemMap:t,getItems:()=>{const n=v(e);if(!n)return[];const o=Array.from(n.querySelectorAll("[data-el-collection-item]"));return[...t.values()].sort(((e,t)=>o.indexOf(e.ref)-o.indexOf(t.ref)))},collectionRef:e})}},s={...bt,name:n,setup(e,{attrs:t}){const n=l(null),i=N(o,void 0);te(r,{collectionItemRef:n}),a((()=>{const e=v(n);e&&i.itemMap.set(e,{ref:e,...t})})),re((()=>{const e=v(n);i.itemMap.delete(e)}))}}})("Dropdown");const kt=e({trigger:Ve.trigger,placement:wt.placement,disabled:Ve.disabled,visible:Ee.visible,transition:Ee.transition,popperOptions:wt.popperOptions,tabindex:wt.tabindex,content:Ee.content,popperStyle:Ee.popperStyle,popperClass:Ee.popperClass,enterable:{...Ee.enterable,default:!0},effect:{...Ee.effect,default:"light"},teleported:Ee.teleported,title:String,width:{type:[String,Number],default:150},offset:{type:Number,default:void 0},showAfter:{type:Number,default:0},hideAfter:{type:Number,default:200},autoClose:{type:Number,default:0},showArrow:{type:Boolean,default:!0},persistent:{type:Boolean,default:!0},"onUpdate:visible":{type:Function}}),xt={"update:visible":e=>se(e),"before-enter":()=>!0,"before-leave":()=>!0,"after-enter":()=>!0,"after-leave":()=>!0},Mt=f({name:"ElPopover"}),St=f({...Mt,props:kt,emits:xt,setup(e,{expose:t,emit:n}){const o=e,r=i((()=>o["onUpdate:visible"])),a=s("popover"),c=l(),h=i((()=>{var e;return null==(e=v(c))?void 0:e.popperRef})),u=i((()=>[{width:d(o.width)},o.popperStyle])),p=i((()=>[a.b(),o.popperClass,{[a.m("plain")]:!!o.content}])),f=i((()=>o.transition===`${a.namespace.value}-fade-in-linear`)),y=()=>{n("before-enter")},b=()=>{n("before-leave")},k=()=>{n("after-enter")},x=()=>{n("update:visible",!1),n("after-leave")};return t({popperRef:h,hide:()=>{var e;null==(e=c.value)||e.hide()}}),(e,t)=>(g(),B(v(Re),_({ref_key:"tooltipRef",ref:c},e.$attrs,{trigger:e.trigger,placement:e.placement,disabled:e.disabled,visible:e.visible,transition:e.transition,"popper-options":e.popperOptions,tabindex:e.tabindex,content:e.content,offset:e.offset,"show-after":e.showAfter,"hide-after":e.hideAfter,"auto-close":e.autoClose,"show-arrow":e.showArrow,"aria-label":e.title,effect:e.effect,enterable:e.enterable,"popper-class":v(p),"popper-style":v(u),teleported:e.teleported,persistent:e.persistent,"gpu-acceleration":v(f),"onUpdate:visible":v(r),onBeforeShow:y,onBeforeHide:b,onShow:k,onHide:x}),{content:H((()=>[e.title?(g(),m("div",{key:0,class:w(v(a).e("title")),role:"title"},Z(e.title),3)):F("v-if",!0),oe(e.$slots,"default",{},(()=>[Q(Z(e.content),1)]))])),default:H((()=>[e.$slots.reference?oe(e.$slots,"reference",{key:0}):F("v-if",!0)])),_:3},16,["trigger","placement","disabled","visible","transition","popper-options","tabindex","content","offset","show-after","hide-after","auto-close","show-arrow","aria-label","effect","enterable","popper-class","popper-style","teleported","persistent","gpu-acceleration","onUpdate:visible"]))}});const Ct=(e,t)=>{const n=t.arg||t.value,o=null==n?void 0:n.popperRef;o&&(o.triggerRef=e)};const Ot=ne(p(St,[["__file","popover.vue"]]),{directive:le({mounted(e,t){Ct(e,t)},updated(e,t){Ct(e,t)}},"popover")});function Tt(e){this.content=e}function At(e,t,n){for(let o=0;;o++){if(o==e.childCount||o==t.childCount)return e.childCount==t.childCount?null:n;let r=e.child(o),i=t.child(o);if(r!=i){if(!r.sameMarkup(i))return n;if(r.isText&&r.text!=i.text){for(let e=0;r.text[e]==i.text[e];e++)n++;return n}if(r.content.size||i.content.size){let e=At(r.content,i.content,n+1);if(null!=e)return e}n+=r.nodeSize}else n+=r.nodeSize}}function Et(e,t,n,o){for(let r=e.childCount,i=t.childCount;;){if(0==r||0==i)return r==i?null:{a:n,b:o};let s=e.child(--r),l=t.child(--i),a=s.nodeSize;if(s!=l){if(!s.sameMarkup(l))return{a:n,b:o};if(s.isText&&s.text!=l.text){let e=0,t=Math.min(s.text.length,l.text.length);for(;e<t&&s.text[s.text.length-e-1]==l.text[l.text.length-e-1];)e++,n--,o--;return{a:n,b:o}}if(s.content.size||l.content.size){let e=Et(s.content,l.content,n-1,o-1);if(e)return e}n-=a,o-=a}else n-=a,o-=a}}Tt.prototype={constructor:Tt,find:function(e){for(var t=0;t<this.content.length;t+=2)if(this.content[t]===e)return t;return-1},get:function(e){var t=this.find(e);return-1==t?void 0:this.content[t+1]},update:function(e,t,n){var o=n&&n!=e?this.remove(n):this,r=o.find(e),i=o.content.slice();return-1==r?i.push(n||e,t):(i[r+1]=t,n&&(i[r]=n)),new Tt(i)},remove:function(e){var t=this.find(e);if(-1==t)return this;var n=this.content.slice();return n.splice(t,2),new Tt(n)},addToStart:function(e,t){return new Tt([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var n=this.remove(e).content.slice();return n.push(e,t),new Tt(n)},addBefore:function(e,t,n){var o=this.remove(t),r=o.content.slice(),i=o.find(e);return r.splice(-1==i?r.length:i,0,t,n),new Tt(r)},forEach:function(e){for(var t=0;t<this.content.length;t+=2)e(this.content[t],this.content[t+1])},prepend:function(e){return(e=Tt.from(e)).size?new Tt(e.content.concat(this.subtract(e).content)):this},append:function(e){return(e=Tt.from(e)).size?new Tt(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=Tt.from(e);for(var n=0;n<e.content.length;n+=2)t=t.remove(e.content[n]);return t},toObject:function(){var e={};return this.forEach((function(t,n){e[t]=n})),e},get size(){return this.content.length>>1}},Tt.from=function(e){if(e instanceof Tt)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new Tt(t)};class Nt{constructor(e,t){if(this.content=e,this.size=t||0,null==t)for(let n=0;n<e.length;n++)this.size+=e[n].nodeSize}nodesBetween(e,t,n,o=0,r){for(let i=0,s=0;s<t;i++){let l=this.content[i],a=s+l.nodeSize;if(a>e&&!1!==n(l,o+s,r||null,i)&&l.content.size){let r=s+1;l.nodesBetween(Math.max(0,e-r),Math.min(l.content.size,t-r),n,o+r)}s=a}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,o){let r="",i=!0;return this.nodesBetween(e,t,((s,l)=>{let a=s.isText?s.text.slice(Math.max(e,l)-l,t-l):s.isLeaf?o?"function"==typeof o?o(s):o:s.type.spec.leafText?s.type.spec.leafText(s):"":"";s.isBlock&&(s.isLeaf&&a||s.isTextblock)&&n&&(i?i=!1:r+=n),r+=a}),0),r}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,n=e.firstChild,o=this.content.slice(),r=0;for(t.isText&&t.sameMarkup(n)&&(o[o.length-1]=t.withText(t.text+n.text),r=1);r<e.content.length;r++)o.push(e.content[r]);return new Nt(o,this.size+e.size)}cut(e,t=this.size){if(0==e&&t==this.size)return this;let n=[],o=0;if(t>e)for(let r=0,i=0;i<t;r++){let s=this.content[r],l=i+s.nodeSize;l>e&&((i<e||l>t)&&(s=s.isText?s.cut(Math.max(0,e-i),Math.min(s.text.length,t-i)):s.cut(Math.max(0,e-i-1),Math.min(s.content.size,t-i-1))),n.push(s),o+=s.nodeSize),i=l}return new Nt(n,o)}cutByIndex(e,t){return e==t?Nt.empty:0==e&&t==this.content.length?this:new Nt(this.content.slice(e,t))}replaceChild(e,t){let n=this.content[e];if(n==t)return this;let o=this.content.slice(),r=this.size+t.nodeSize-n.nodeSize;return o[e]=t,new Nt(o,r)}addToStart(e){return new Nt([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new Nt(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,n=0;t<this.content.length;t++){let o=this.content[t];e(o,n,t),n+=o.nodeSize}}findDiffStart(e,t=0){return At(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return Et(this,e,t,n)}findIndex(e,t=-1){if(0==e)return Rt(0,e);if(e==this.size)return Rt(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,o=0;;n++){let r=o+this.child(n).nodeSize;if(r>=e)return r==e||t>0?Rt(n+1,r):Rt(n,o);o=r}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map((e=>e.toJSON())):null}static fromJSON(e,t){if(!t)return Nt.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new Nt(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return Nt.empty;let t,n=0;for(let o=0;o<e.length;o++){let r=e[o];n+=r.nodeSize,o&&r.isText&&e[o-1].sameMarkup(r)?(t||(t=e.slice(0,o)),t[t.length-1]=r.withText(t[t.length-1].text+r.text)):t&&t.push(r)}return new Nt(t||e,n)}static from(e){if(!e)return Nt.empty;if(e instanceof Nt)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new Nt([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}Nt.empty=new Nt([],0);const Dt={index:0,offset:0};function Rt(e,t){return Dt.index=e,Dt.offset=t,Dt}function Vt(e,t){if(e===t)return!0;if(!e||"object"!=typeof e||!t||"object"!=typeof t)return!1;let n=Array.isArray(e);if(Array.isArray(t)!=n)return!1;if(n){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!Vt(e[n],t[n]))return!1}else{for(let n in e)if(!(n in t)||!Vt(e[n],t[n]))return!1;for(let n in t)if(!(n in e))return!1}return!0}let It=class e{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,n=!1;for(let o=0;o<e.length;o++){let r=e[o];if(this.eq(r))return e;if(this.type.excludes(r.type))t||(t=e.slice(0,o));else{if(r.type.excludes(this.type))return e;!n&&r.type.rank>this.type.rank&&(t||(t=e.slice(0,o)),t.push(this),n=!0),t&&t.push(r)}}return t||(t=e.slice()),n||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&Vt(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let n=e.marks[t.type];if(!n)throw new RangeError(`There is no mark type ${t.type} in this schema`);let o=n.create(t.attrs);return n.checkAttrs(o.attrs),o}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].eq(t[n]))return!1;return!0}static setFrom(t){if(!t||Array.isArray(t)&&0==t.length)return e.none;if(t instanceof e)return[t];let n=t.slice();return n.sort(((e,t)=>e.type.rank-t.type.rank)),n}};It.none=[];class zt extends Error{}class Lt{constructor(e,t,n){this.content=e,this.openStart=t,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let n=$t(this.content,e+this.openStart,t);return n&&new Lt(n,this.openStart,this.openEnd)}removeBetween(e,t){return new Lt(Pt(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return Lt.empty;let n=t.openStart||0,o=t.openEnd||0;if("number"!=typeof n||"number"!=typeof o)throw new RangeError("Invalid input for Slice.fromJSON");return new Lt(Nt.fromJSON(e,t.content),n,o)}static maxOpen(e,t=!0){let n=0,o=0;for(let r=e.firstChild;r&&!r.isLeaf&&(t||!r.type.spec.isolating);r=r.firstChild)n++;for(let r=e.lastChild;r&&!r.isLeaf&&(t||!r.type.spec.isolating);r=r.lastChild)o++;return new Lt(e,n,o)}}function Pt(e,t,n){let{index:o,offset:r}=e.findIndex(t),i=e.maybeChild(o),{index:s,offset:l}=e.findIndex(n);if(r==t||i.isText){if(l!=n&&!e.child(s).isText)throw new RangeError("Removing non-flat range");return e.cut(0,t).append(e.cut(n))}if(o!=s)throw new RangeError("Removing non-flat range");return e.replaceChild(o,i.copy(Pt(i.content,t-r-1,n-r-1)))}function $t(e,t,n,o){let{index:r,offset:i}=e.findIndex(t),s=e.maybeChild(r);if(i==t||s.isText)return e.cut(0,t).append(n).append(e.cut(t));let l=$t(s.content,t-i-1,n);return l&&e.replaceChild(r,s.copy(l))}function Bt(e,t,n){if(n.openStart>e.depth)throw new zt("Inserted content deeper than insertion position");if(e.depth-n.openStart!=t.depth-n.openEnd)throw new zt("Inconsistent open depths");return Ht(e,t,n,0)}function Ht(e,t,n,o){let r=e.index(o),i=e.node(o);if(r==t.index(o)&&o<e.depth-n.openStart){let s=Ht(e,t,n,o+1);return i.copy(i.content.replaceChild(r,s))}if(n.content.size){if(n.openStart||n.openEnd||e.depth!=o||t.depth!=o){let{start:r,end:s}=function(e,t){let n=t.depth-e.openStart,o=t.node(n).copy(e.content);for(let r=n-1;r>=0;r--)o=t.node(r).copy(Nt.from(o));return{start:o.resolveNoCache(e.openStart+n),end:o.resolveNoCache(o.content.size-e.openEnd-n)}}(n,e);return Wt(i,qt(e,r,s,t,o))}{let o=e.parent,r=o.content;return Wt(o,r.cut(0,e.parentOffset).append(n.content).append(r.cut(t.parentOffset)))}}return Wt(i,Kt(e,t,o))}function _t(e,t){if(!t.type.compatibleContent(e.type))throw new zt("Cannot join "+t.type.name+" onto "+e.type.name)}function Ft(e,t,n){let o=e.node(n);return _t(o,t.node(n)),o}function jt(e,t){let n=t.length-1;n>=0&&e.isText&&e.sameMarkup(t[n])?t[n]=e.withText(t[n].text+e.text):t.push(e)}function Ut(e,t,n,o){let r=(t||e).node(n),i=0,s=t?t.index(n):r.childCount;e&&(i=e.index(n),e.depth>n?i++:e.textOffset&&(jt(e.nodeAfter,o),i++));for(let l=i;l<s;l++)jt(r.child(l),o);t&&t.depth==n&&t.textOffset&&jt(t.nodeBefore,o)}function Wt(e,t){return e.type.checkContent(t),e.copy(t)}function qt(e,t,n,o,r){let i=e.depth>r&&Ft(e,t,r+1),s=o.depth>r&&Ft(n,o,r+1),l=[];return Ut(null,e,r,l),i&&s&&t.index(r)==n.index(r)?(_t(i,s),jt(Wt(i,qt(e,t,n,o,r+1)),l)):(i&&jt(Wt(i,Kt(e,t,r+1)),l),Ut(t,n,r,l),s&&jt(Wt(s,Kt(n,o,r+1)),l)),Ut(o,null,r,l),new Nt(l)}function Kt(e,t,n){let o=[];if(Ut(null,e,n,o),e.depth>n){jt(Wt(Ft(e,t,n+1),Kt(e,t,n+1)),o)}return Ut(t,null,n,o),new Nt(o)}Lt.empty=new Lt(Nt.empty,0,0);class Jt{constructor(e,t,n){this.pos=e,this.path=t,this.parentOffset=n,this.depth=t.length/3-1}resolveDepth(e){return null==e?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[3*this.resolveDepth(e)]}index(e){return this.path[3*this.resolveDepth(e)+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e!=this.depth||this.textOffset?1:0)}start(e){return 0==(e=this.resolveDepth(e))?0:this.path[3*e-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(!(e=this.resolveDepth(e)))throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[3*e-1]}after(e){if(!(e=this.resolveDepth(e)))throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[3*e-1]+this.path[3*e].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let n=this.pos-this.path[this.path.length-1],o=e.child(t);return n?e.child(t).cut(n):o}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):0==e?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let n=this.path[3*t],o=0==t?0:this.path[3*t-1]+1;for(let r=0;r<e;r++)o+=n.child(r).nodeSize;return o}marks(){let e=this.parent,t=this.index();if(0==e.content.size)return It.none;if(this.textOffset)return e.child(t).marks;let n=e.maybeChild(t-1),o=e.maybeChild(t);if(!n){let e=n;n=o,o=e}let r=n.marks;for(var i=0;i<r.length;i++)!1!==r[i].type.spec.inclusive||o&&r[i].isInSet(o.marks)||(r=r[i--].removeFromSet(r));return r}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let n=t.marks,o=e.parent.maybeChild(e.index());for(var r=0;r<n.length;r++)!1!==n[r].type.spec.inclusive||o&&n[r].isInSet(o.marks)||(n=n[r--].removeFromSet(n));return n}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let n=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);n>=0;n--)if(e.pos<=this.end(n)&&(!t||t(this.node(n))))return new Qt(this,e,n);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let n=[],o=0,r=t;for(let i=e;;){let{index:e,offset:t}=i.content.findIndex(r),s=r-t;if(n.push(i,e,o+t),!s)break;if(i=i.child(e),i.isText)break;r=s-1,o+=t+1}return new Jt(t,n,r)}static resolveCached(e,t){let n=Xt.get(e);if(n)for(let r=0;r<n.elts.length;r++){let e=n.elts[r];if(e.pos==t)return e}else Xt.set(e,n=new Gt);let o=n.elts[n.i]=Jt.resolve(e,t);return n.i=(n.i+1)%Yt,o}}class Gt{constructor(){this.elts=[],this.i=0}}const Yt=12,Xt=new WeakMap;class Qt{constructor(e,t,n){this.$from=e,this.$to=t,this.depth=n}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const Zt=Object.create(null);let en=class e{constructor(e,t,n,o=It.none){this.type=e,this.attrs=t,this.marks=o,this.content=n||Nt.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,n,o=0){this.content.nodesBetween(e,t,n,o,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,t,n,o){return this.content.textBetween(e,t,n,o)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,n){return this.type==e&&Vt(this.attrs,t||e.defaultAttrs||Zt)&&It.sameSet(this.marks,n||It.none)}copy(t=null){return t==this.content?this:new e(this.type,this.attrs,t,this.marks)}mark(t){return t==this.marks?this:new e(this.type,this.attrs,this.content,t)}cut(e,t=this.content.size){return 0==e&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,n=!1){if(e==t)return Lt.empty;let o=this.resolve(e),r=this.resolve(t),i=n?0:o.sharedDepth(t),s=o.start(i),l=o.node(i).content.cut(o.pos-s,r.pos-s);return new Lt(l,o.depth-i,r.depth-i)}replace(e,t,n){return Bt(this.resolve(e),this.resolve(t),n)}nodeAt(e){for(let t=this;;){let{index:n,offset:o}=t.content.findIndex(e);if(t=t.maybeChild(n),!t)return null;if(o==e||t.isText)return t;e-=o+1}}childAfter(e){let{index:t,offset:n}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:n}}childBefore(e){if(0==e)return{node:null,index:0,offset:0};let{index:t,offset:n}=this.content.findIndex(e);if(n<e)return{node:this.content.child(t),index:t,offset:n};let o=this.content.child(t-1);return{node:o,index:t-1,offset:n-o.nodeSize}}resolve(e){return Jt.resolveCached(this,e)}resolveNoCache(e){return Jt.resolve(this,e)}rangeHasMark(e,t,n){let o=!1;return t>e&&this.nodesBetween(e,t,(e=>(n.isInSet(e.marks)&&(o=!0),!o))),o}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),nn(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,n=Nt.empty,o=0,r=n.childCount){let i=this.contentMatchAt(e).matchFragment(n,o,r),s=i&&i.matchFragment(this.content,t);if(!s||!s.validEnd)return!1;for(let l=o;l<r;l++)if(!this.type.allowsMarks(n.child(l).marks))return!1;return!0}canReplaceWith(e,t,n,o){if(o&&!this.type.allowsMarks(o))return!1;let r=this.contentMatchAt(e).matchType(n),i=r&&r.matchFragment(this.content,t);return!!i&&i.validEnd}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=It.none;for(let t=0;t<this.marks.length;t++){let n=this.marks[t];n.type.checkAttrs(n.attrs),e=n.addToSet(e)}if(!It.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map((e=>e.type.name))}`);this.content.forEach((e=>e.check()))}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map((e=>e.toJSON()))),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let n;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");n=t.marks.map(e.markFromJSON)}if("text"==t.type){if("string"!=typeof t.text)throw new RangeError("Invalid text node in JSON");return e.text(t.text,n)}let o=Nt.fromJSON(e,t.content),r=e.nodeType(t.type).create(t.attrs,o,n);return r.type.checkAttrs(r.attrs),r}};en.prototype.text=void 0;class tn extends en{constructor(e,t,n,o){if(super(e,t,null,o),!n)throw new RangeError("Empty text nodes are not allowed");this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):nn(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new tn(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new tn(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return 0==e&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function nn(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+"("+t+")";return t}class on{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let n=new rn(e,t);if(null==n.next)return on.empty;let o=sn(n);n.next&&n.err("Unexpected trailing text");let r=function(e){let t=Object.create(null);return n(un(e,0));function n(o){let r=[];o.forEach((t=>{e[t].forEach((({term:t,to:n})=>{if(!t)return;let o;for(let e=0;e<r.length;e++)r[e][0]==t&&(o=r[e][1]);un(e,n).forEach((e=>{o||r.push([t,o=[]]),-1==o.indexOf(e)&&o.push(e)}))}))}));let i=t[o.join(",")]=new on(o.indexOf(e.length-1)>-1);for(let e=0;e<r.length;e++){let o=r[e][1].sort(hn);i.next.push({type:r[e][0],next:t[o.join(",")]||n(o)})}return i}}(function(e){let t=[[]];return r(i(e,0),n()),t;function n(){return t.push([])-1}function o(e,n,o){let r={term:o,to:n};return t[e].push(r),r}function r(e,t){e.forEach((e=>e.to=t))}function i(e,t){if("choice"==e.type)return e.exprs.reduce(((e,n)=>e.concat(i(n,t))),[]);if("seq"!=e.type){if("star"==e.type){let s=n();return o(t,s),r(i(e.expr,s),s),[o(s)]}if("plus"==e.type){let s=n();return r(i(e.expr,t),s),r(i(e.expr,s),s),[o(s)]}if("opt"==e.type)return[o(t)].concat(i(e.expr,t));if("range"==e.type){let s=t;for(let t=0;t<e.min;t++){let t=n();r(i(e.expr,s),t),s=t}if(-1==e.max)r(i(e.expr,s),s);else for(let t=e.min;t<e.max;t++){let t=n();o(s,t),r(i(e.expr,s),t),s=t}return[o(s)]}if("name"==e.type)return[o(t,void 0,e.value)];throw new Error("Unknown expr type")}for(let o=0;;o++){let s=i(e.exprs[o],t);if(o==e.exprs.length-1)return s;r(s,t=n())}}}(o));return function(e,t){for(let n=0,o=[e];n<o.length;n++){let e=o[n],r=!e.validEnd,i=[];for(let t=0;t<e.next.length;t++){let{type:n,next:s}=e.next[t];i.push(n.name),!r||n.isText||n.hasRequiredAttrs()||(r=!1),-1==o.indexOf(s)&&o.push(s)}r&&t.err("Only non-generatable nodes ("+i.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}(r,n),r}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,n=e.childCount){let o=this;for(let r=t;o&&r<n;r++)o=o.matchType(e.child(r).type);return o}get inlineContent(){return 0!=this.next.length&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!t.isText&&!t.hasRequiredAttrs())return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let n=0;n<e.next.length;n++)if(this.next[t].type==e.next[n].type)return!0;return!1}fillBefore(e,t=!1,n=0){let o=[this];return function r(i,s){let l=i.matchFragment(e,n);if(l&&(!t||l.validEnd))return Nt.from(s.map((e=>e.createAndFill())));for(let e=0;e<i.next.length;e++){let{type:t,next:n}=i.next[e];if(!t.isText&&!t.hasRequiredAttrs()&&-1==o.indexOf(n)){o.push(n);let e=r(n,s.concat(t));if(e)return e}}return null}(this,[])}findWrapping(e){for(let n=0;n<this.wrapCache.length;n+=2)if(this.wrapCache[n]==e)return this.wrapCache[n+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),n=[{match:this,type:null,via:null}];for(;n.length;){let o=n.shift(),r=o.match;if(r.matchType(e)){let e=[];for(let t=o;t.type;t=t.via)e.push(t.type);return e.reverse()}for(let e=0;e<r.next.length;e++){let{type:i,next:s}=r.next[e];i.isLeaf||i.hasRequiredAttrs()||i.name in t||o.type&&!s.validEnd||(n.push({match:i.contentMatch,type:i,via:o}),t[i.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];return function t(n){e.push(n);for(let o=0;o<n.next.length;o++)-1==e.indexOf(n.next[o].next)&&t(n.next[o].next)}(this),e.map(((t,n)=>{let o=n+(t.validEnd?"*":" ")+" ";for(let r=0;r<t.next.length;r++)o+=(r?", ":"")+t.next[r].type.name+"->"+e.indexOf(t.next[r].next);return o})).join("\n")}}on.empty=new on(!0);class rn{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),""==this.tokens[this.tokens.length-1]&&this.tokens.pop(),""==this.tokens[0]&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function sn(e){let t=[];do{t.push(ln(e))}while(e.eat("|"));return 1==t.length?t[0]:{type:"choice",exprs:t}}function ln(e){let t=[];do{t.push(an(e))}while(e.next&&")"!=e.next&&"|"!=e.next);return 1==t.length?t[0]:{type:"seq",exprs:t}}function an(e){let t=function(e){if(e.eat("(")){let t=sn(e);return e.eat(")")||e.err("Missing closing paren"),t}if(!/\W/.test(e.next)){let t=function(e,t){let n=e.nodeTypes,o=n[t];if(o)return[o];let r=[];for(let i in n){let e=n[i];e.isInGroup(t)&&r.push(e)}0==r.length&&e.err("No node type or group '"+t+"' found");return r}(e,e.next).map((t=>(null==e.inline?e.inline=t.isInline:e.inline!=t.isInline&&e.err("Mixing inline and block content"),{type:"name",value:t})));return e.pos++,1==t.length?t[0]:{type:"choice",exprs:t}}e.err("Unexpected token '"+e.next+"'")}(e);for(;;)if(e.eat("+"))t={type:"plus",expr:t};else if(e.eat("*"))t={type:"star",expr:t};else if(e.eat("?"))t={type:"opt",expr:t};else{if(!e.eat("{"))break;t=dn(e,t)}return t}function cn(e){/\D/.test(e.next)&&e.err("Expected number, got '"+e.next+"'");let t=Number(e.next);return e.pos++,t}function dn(e,t){let n=cn(e),o=n;return e.eat(",")&&(o="}"!=e.next?cn(e):-1),e.eat("}")||e.err("Unclosed braced range"),{type:"range",min:n,max:o,expr:t}}function hn(e,t){return t-e}function un(e,t){let n=[];return function t(o){let r=e[o];if(1==r.length&&!r[0].term)return t(r[0].to);n.push(o);for(let e=0;e<r.length;e++){let{term:o,to:i}=r[e];o||-1!=n.indexOf(i)||t(i)}}(t),n.sort(hn)}function pn(e){let t=Object.create(null);for(let n in e){let o=e[n];if(!o.hasDefault)return null;t[n]=o.default}return t}function fn(e,t){let n=Object.create(null);for(let o in e){let r=t&&t[o];if(void 0===r){let t=e[o];if(!t.hasDefault)throw new RangeError("No value supplied for attribute "+o);r=t.default}n[o]=r}return n}function mn(e,t,n,o){for(let r in t)if(!(r in e))throw new RangeError(`Unsupported attribute ${r} for ${n} of type ${r}`);for(let r in e){let n=e[r];n.validate&&n.validate(t[r])}}function gn(e,t){let n=Object.create(null);if(t)for(let o in t)n[o]=new vn(e,o,t[o]);return n}let yn=class e{constructor(e,t,n){this.name=e,this.schema=t,this.spec=n,this.markSet=null,this.groups=n.group?n.group.split(" "):[],this.attrs=gn(e,n.attrs),this.defaultAttrs=pn(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(n.inline||"text"==e),this.isText="text"==e}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==on.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:fn(this.attrs,e)}create(e=null,t,n){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new en(this,this.computeAttrs(e),Nt.from(t),It.setFrom(n))}createChecked(e=null,t,n){return t=Nt.from(t),this.checkContent(t),new en(this,this.computeAttrs(e),t,It.setFrom(n))}createAndFill(e=null,t,n){if(e=this.computeAttrs(e),(t=Nt.from(t)).size){let e=this.contentMatch.fillBefore(t);if(!e)return null;t=e.append(t)}let o=this.contentMatch.matchFragment(t),r=o&&o.fillBefore(Nt.empty,!0);return r?new en(this,e,t.append(r),It.setFrom(n)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let n=0;n<e.childCount;n++)if(!this.allowsMarks(e.child(n).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){mn(this.attrs,e,"node",this.name)}allowsMarkType(e){return null==this.markSet||this.markSet.indexOf(e)>-1}allowsMarks(e){if(null==this.markSet)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(null==this.markSet)return e;let t;for(let n=0;n<e.length;n++)this.allowsMarkType(e[n].type)?t&&t.push(e[n]):t||(t=e.slice(0,n));return t?t.length?t:It.none:e}static compile(t,n){let o=Object.create(null);t.forEach(((t,r)=>o[t]=new e(t,n,r)));let r=n.spec.topNode||"doc";if(!o[r])throw new RangeError("Schema is missing its top node type ('"+r+"')");if(!o.text)throw new RangeError("Every schema needs a 'text' type");for(let e in o.text.attrs)throw new RangeError("The text node type should not have attributes");return o}};class vn{constructor(e,t,n){this.hasDefault=Object.prototype.hasOwnProperty.call(n,"default"),this.default=n.default,this.validate="string"==typeof n.validate?function(e,t,n){let o=n.split("|");return n=>{let r=null===n?"null":typeof n;if(o.indexOf(r)<0)throw new RangeError(`Expected value of type ${o} for attribute ${t} on type ${e}, got ${r}`)}}(e,t,n.validate):n.validate}get isRequired(){return!this.hasDefault}}class bn{constructor(e,t,n,o){this.name=e,this.rank=t,this.schema=n,this.spec=o,this.attrs=gn(e,o.attrs),this.excluded=null;let r=pn(this.attrs);this.instance=r?new It(this,r):null}create(e=null){return!e&&this.instance?this.instance:new It(this,fn(this.attrs,e))}static compile(e,t){let n=Object.create(null),o=0;return e.forEach(((e,r)=>n[e]=new bn(e,o++,t,r))),n}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}checkAttrs(e){mn(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class wn{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let o in e)t[o]=e[o];t.nodes=Tt.from(e.nodes),t.marks=Tt.from(e.marks||{}),this.nodes=yn.compile(this.spec.nodes,this),this.marks=bn.compile(this.spec.marks,this);let n=Object.create(null);for(let o in this.nodes){if(o in this.marks)throw new RangeError(o+" can not be both a node and a mark");let e=this.nodes[o],t=e.spec.content||"",r=e.spec.marks;if(e.contentMatch=n[t]||(n[t]=on.parse(t,this.nodes)),e.inlineContent=e.contentMatch.inlineContent,e.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!e.isInline||!e.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=e}e.markSet="_"==r?null:r?kn(this,r.split(" ")):""!=r&&e.inlineContent?null:[]}for(let o in this.marks){let e=this.marks[o],t=e.spec.excludes;e.excluded=null==t?[e]:""==t?[]:kn(this,t.split(" "))}this.nodeFromJSON=this.nodeFromJSON.bind(this),this.markFromJSON=this.markFromJSON.bind(this),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,n,o){if("string"==typeof e)e=this.nodeType(e);else{if(!(e instanceof yn))throw new RangeError("Invalid node type: "+e);if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}return e.createChecked(t,n,o)}text(e,t){let n=this.nodes.text;return new tn(n,n.defaultAttrs,e,It.setFrom(t))}mark(e,t){return"string"==typeof e&&(e=this.marks[e]),e.create(t)}nodeFromJSON(e){return en.fromJSON(this,e)}markFromJSON(e){return It.fromJSON(this,e)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}}function kn(e,t){let n=[];for(let o=0;o<t.length;o++){let r=t[o],i=e.marks[r],s=i;if(i)n.push(i);else for(let t in e.marks){let o=e.marks[t];("_"==r||o.spec.group&&o.spec.group.split(" ").indexOf(r)>-1)&&n.push(s=o)}if(!s)throw new SyntaxError("Unknown mark type: '"+t[o]+"'")}return n}class xn{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let n=this.matchedStyles=[];t.forEach((e=>{if(function(e){return null!=e.tag}(e))this.tags.push(e);else if(function(e){return null!=e.style}(e)){let t=/[^=]*/.exec(e.style)[0];n.indexOf(t)<0&&n.push(t),this.styles.push(e)}})),this.normalizeLists=!this.tags.some((t=>{if(!/^(ul|ol)\b/.test(t.tag)||!t.node)return!1;let n=e.nodes[t.node];return n.contentMatch.matchType(n)}))}parse(e,t={}){let n=new An(this,t,!1);return n.addAll(e,It.none,t.from,t.to),n.finish()}parseSlice(e,t={}){let n=new An(this,t,!0);return n.addAll(e,It.none,t.from,t.to),Lt.maxOpen(n.finish())}matchTag(e,t,n){for(let o=n?this.tags.indexOf(n)+1:0;o<this.tags.length;o++){let n=this.tags[o];if(En(e,n.tag)&&(void 0===n.namespace||e.namespaceURI==n.namespace)&&(!n.context||t.matchesContext(n.context))){if(n.getAttrs){let t=n.getAttrs(e);if(!1===t)continue;n.attrs=t||void 0}return n}}}matchStyle(e,t,n,o){for(let r=o?this.styles.indexOf(o)+1:0;r<this.styles.length;r++){let o=this.styles[r],i=o.style;if(!(0!=i.indexOf(e)||o.context&&!n.matchesContext(o.context)||i.length>e.length&&(61!=i.charCodeAt(e.length)||i.slice(e.length+1)!=t))){if(o.getAttrs){let e=o.getAttrs(t);if(!1===e)continue;o.attrs=e||void 0}return o}}}static schemaRules(e){let t=[];function n(e){let n=null==e.priority?50:e.priority,o=0;for(;o<t.length;o++){let e=t[o];if((null==e.priority?50:e.priority)<n)break}t.splice(o,0,e)}for(let o in e.marks){let t=e.marks[o].spec.parseDOM;t&&t.forEach((e=>{n(e=Nn(e)),e.mark||e.ignore||e.clearMark||(e.mark=o)}))}for(let o in e.nodes){let t=e.nodes[o].spec.parseDOM;t&&t.forEach((e=>{n(e=Nn(e)),e.node||e.ignore||e.mark||(e.node=o)}))}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new xn(e,xn.schemaRules(e)))}}const Mn={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},Sn={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Cn={ol:!0,ul:!0};function On(e,t,n){return null!=t?(t?1:0)|("full"===t?2:0):e&&"pre"==e.whitespace?3:-5&n}class Tn{constructor(e,t,n,o,r,i){this.type=e,this.attrs=t,this.marks=n,this.solid=o,this.options=i,this.content=[],this.activeMarks=It.none,this.match=r||(4&i?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(Nt.from(e));if(!t){let t,n=this.type.contentMatch;return(t=n.findWrapping(e.type))?(this.match=n,t):null}this.match=this.type.contentMatch.matchFragment(t)}return this.match.findWrapping(e.type)}finish(e){if(!(1&this.options)){let e,t=this.content[this.content.length-1];if(t&&t.isText&&(e=/[ \t\r\n\u000c]+$/.exec(t.text))){let n=t;t.text.length==e[0].length?this.content.pop():this.content[this.content.length-1]=n.withText(n.text.slice(0,n.text.length-e[0].length))}}let t=Nt.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(Nt.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!Mn.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class An{constructor(e,t,n){this.parser=e,this.options=t,this.isOpen=n,this.open=0,this.localPreserveWS=!1;let o,r=t.topNode,i=On(null,t.preserveWhitespace,0)|(n?4:0);o=r?new Tn(r.type,r.attrs,It.none,!0,t.topMatch||r.type.contentMatch,i):new Tn(n?null:e.schema.topNodeType,null,It.none,!0,null,i),this.nodes=[o],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){3==e.nodeType?this.addTextNode(e,t):1==e.nodeType&&this.addElement(e,t)}addTextNode(e,t){let n=e.nodeValue,o=this.top,r=2&o.options?"full":this.localPreserveWS||(1&o.options)>0;if("full"===r||o.inlineContext(e)||/[^ \t\r\n\u000c]/.test(n)){if(r)n="full"!==r?n.replace(/\r?\n|\r/g," "):n.replace(/\r\n?/g,"\n");else if(n=n.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(n)&&this.open==this.nodes.length-1){let t=o.content[o.content.length-1],r=e.previousSibling;(!t||r&&"BR"==r.nodeName||t.isText&&/[ \t\r\n\u000c]$/.test(t.text))&&(n=n.slice(1))}n&&this.insertNode(this.parser.schema.text(n),t),this.findInText(e)}else this.findInside(e)}addElement(e,t,n){let o=this.localPreserveWS,r=this.top;("PRE"==e.tagName||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let i,s=e.nodeName.toLowerCase();Cn.hasOwnProperty(s)&&this.parser.normalizeLists&&function(e){for(let t=e.firstChild,n=null;t;t=t.nextSibling){let e=1==t.nodeType?t.nodeName.toLowerCase():null;e&&Cn.hasOwnProperty(e)&&n?(n.appendChild(t),t=n):"li"==e?n=t:e&&(n=null)}}(e);let l=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(i=this.parser.matchTag(e,this,n));e:if(l?l.ignore:Sn.hasOwnProperty(s))this.findInside(e),this.ignoreFallback(e,t);else if(!l||l.skip||l.closeParent){l&&l.closeParent?this.open=Math.max(0,this.open-1):l&&l.skip.nodeType&&(e=l.skip);let n,o=this.needsBlock;if(Mn.hasOwnProperty(s))r.content.length&&r.content[0].isInline&&this.open&&(this.open--,r=this.top),n=!0,r.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break e}let i=l&&l.skip?t:this.readStyles(e,t);i&&this.addAll(e,i),n&&this.sync(r),this.needsBlock=o}else{let n=this.readStyles(e,t);n&&this.addElementByRule(e,l,n,!1===l.consuming?i:void 0)}this.localPreserveWS=o}leafFallback(e,t){"BR"==e.nodeName&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode("\n"),t)}ignoreFallback(e,t){"BR"!=e.nodeName||this.top.type&&this.top.type.inlineContent||this.findPlace(this.parser.schema.text("-"),t)}readStyles(e,t){let n=e.style;if(n&&n.length)for(let o=0;o<this.parser.matchedStyles.length;o++){let e=this.parser.matchedStyles[o],r=n.getPropertyValue(e);if(r)for(let n;;){let o=this.parser.matchStyle(e,r,this,n);if(!o)break;if(o.ignore)return null;if(t=o.clearMark?t.filter((e=>!o.clearMark(e))):t.concat(this.parser.schema.marks[o.mark].create(o.attrs)),!1!==o.consuming)break;n=o}}return t}addElementByRule(e,t,n,o){let r,i;if(t.node)if(i=this.parser.schema.nodes[t.node],i.isLeaf)this.insertNode(i.create(t.attrs),n)||this.leafFallback(e,n);else{let e=this.enter(i,t.attrs||null,n,t.preserveWhitespace);e&&(r=!0,n=e)}else{let e=this.parser.schema.marks[t.mark];n=n.concat(e.create(t.attrs))}let s=this.top;if(i&&i.isLeaf)this.findInside(e);else if(o)this.addElement(e,n,o);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach((e=>this.insertNode(e,n)));else{let o=e;"string"==typeof t.contentElement?o=e.querySelector(t.contentElement):"function"==typeof t.contentElement?o=t.contentElement(e):t.contentElement&&(o=t.contentElement),this.findAround(e,o,!0),this.addAll(o,n),this.findAround(e,o,!1)}r&&this.sync(s)&&this.open--}addAll(e,t,n,o){let r=n||0;for(let i=n?e.childNodes[n]:e.firstChild,s=null==o?null:e.childNodes[o];i!=s;i=i.nextSibling,++r)this.findAtPoint(e,r),this.addDOM(i,t);this.findAtPoint(e,r)}findPlace(e,t){let n,o;for(let r=this.open;r>=0;r--){let t=this.nodes[r],i=t.findWrapping(e);if(i&&(!n||n.length>i.length)&&(n=i,o=t,!i.length))break;if(t.solid)break}if(!n)return null;this.sync(o);for(let r=0;r<n.length;r++)t=this.enterInner(n[r],null,t,!1);return t}insertNode(e,t){if(e.isInline&&this.needsBlock&&!this.top.type){let e=this.textblockFromContext();e&&(t=this.enterInner(e,null,t))}let n=this.findPlace(e,t);if(n){this.closeExtra();let t=this.top;t.match&&(t.match=t.match.matchType(e.type));let o=It.none;for(let r of n.concat(e.marks))(t.type?t.type.allowsMarkType(r.type):Dn(r.type,e.type))&&(o=r.addToSet(o));return t.content.push(e.mark(o)),!0}return!1}enter(e,t,n,o){let r=this.findPlace(e.create(t),n);return r&&(r=this.enterInner(e,t,n,!0,o)),r}enterInner(e,t,n,o=!1,r){this.closeExtra();let i=this.top;i.match=i.match&&i.match.matchType(e);let s=On(e,r,i.options);4&i.options&&0==i.content.length&&(s|=4);let l=It.none;return n=n.filter((t=>!(i.type?i.type.allowsMarkType(t.type):Dn(t.type,e))||(l=t.addToSet(l),!1))),this.nodes.push(new Tn(e,t,l,o,null,s)),this.open++,n}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!(!this.isOpen&&!this.options.topOpen))}sync(e){for(let t=this.open;t>=0;t--){if(this.nodes[t]==e)return this.open=t,!0;this.localPreserveWS&&(this.nodes[t].options|=1)}return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let n=this.nodes[t].content;for(let t=n.length-1;t>=0;t--)e+=n[t].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&this.find[n].offset==t&&(this.find[n].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)null==this.find[t].pos&&1==e.nodeType&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,n){if(e!=t&&this.find)for(let o=0;o<this.find.length;o++)if(null==this.find[o].pos&&1==e.nodeType&&e.contains(this.find[o].node)){t.compareDocumentPosition(this.find[o].node)&(n?2:4)&&(this.find[o].pos=this.currentPos)}}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),n=this.options.context,o=!(this.isOpen||n&&n.parent.type!=this.nodes[0].type),r=-(n?n.depth+1:0)+(o?0:1),i=(e,s)=>{for(;e>=0;e--){let l=t[e];if(""==l){if(e==t.length-1||0==e)continue;for(;s>=r;s--)if(i(e-1,s))return!0;return!1}{let e=s>0||0==s&&o?this.nodes[s].type:n&&s>=r?n.node(s-r).type:null;if(!e||e.name!=l&&!e.isInGroup(l))return!1;s--}}return!0};return i(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let n=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(n&&n.isTextblock&&n.defaultAttrs)return n}for(let t in this.parser.schema.nodes){let e=this.parser.schema.nodes[t];if(e.isTextblock&&e.defaultAttrs)return e}}}function En(e,t){return(e.matches||e.msMatchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector).call(e,t)}function Nn(e){let t={};for(let n in e)t[n]=e[n];return t}function Dn(e,t){let n=t.schema.nodes;for(let o in n){let r=n[o];if(!r.allowsMarkType(e))continue;let i=[],s=e=>{i.push(e);for(let n=0;n<e.edgeCount;n++){let{type:o,next:r}=e.edge(n);if(o==t)return!0;if(i.indexOf(r)<0&&s(r))return!0}};if(s(r.contentMatch))return!0}}class Rn{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},n){n||(n=In(t).createDocumentFragment());let o=n,r=[];return e.forEach((e=>{if(r.length||e.marks.length){let n=0,i=0;for(;n<r.length&&i<e.marks.length;){let t=e.marks[i];if(this.marks[t.type.name]){if(!t.eq(r[n][0])||!1===t.type.spec.spanning)break;n++,i++}else i++}for(;n<r.length;)o=r.pop()[1];for(;i<e.marks.length;){let n=e.marks[i++],s=this.serializeMark(n,e.isInline,t);s&&(r.push([n,o]),o.appendChild(s.dom),o=s.contentDOM||s.dom)}}o.appendChild(this.serializeNodeInner(e,t))})),n}serializeNodeInner(e,t){let{dom:n,contentDOM:o}=Pn(In(t),this.nodes[e.type.name](e),null,e.attrs);if(o){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,o)}return n}serializeNode(e,t={}){let n=this.serializeNodeInner(e,t);for(let o=e.marks.length-1;o>=0;o--){let r=this.serializeMark(e.marks[o],e.isInline,t);r&&((r.contentDOM||r.dom).appendChild(n),n=r.dom)}return n}serializeMark(e,t,n={}){let o=this.marks[e.type.name];return o&&Pn(In(n),o(e,t),null,e.attrs)}static renderSpec(e,t,n=null,o){return Pn(e,t,n,o)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Rn(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=Vn(e.nodes);return t.text||(t.text=e=>e.text),t}static marksFromSchema(e){return Vn(e.marks)}}function Vn(e){let t={};for(let n in e){let o=e[n].spec.toDOM;o&&(t[n]=o)}return t}function In(e){return e.document||window.document}const zn=new WeakMap;function Ln(e){let t=zn.get(e);return void 0===t&&zn.set(e,t=function(e){let t=null;function n(e){if(e&&"object"==typeof e)if(Array.isArray(e))if("string"==typeof e[0])t||(t=[]),t.push(e);else for(let t=0;t<e.length;t++)n(e[t]);else for(let t in e)n(e[t])}return n(e),t}(e)),t}function Pn(e,t,n,o){if("string"==typeof t)return{dom:e.createTextNode(t)};if(null!=t.nodeType)return{dom:t};if(t.dom&&null!=t.dom.nodeType)return t;let r,i=t[0];if("string"!=typeof i)throw new RangeError("Invalid array passed to renderSpec");if(o&&(r=Ln(o))&&r.indexOf(t)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let s,l=i.indexOf(" ");l>0&&(n=i.slice(0,l),i=i.slice(l+1));let a=n?e.createElementNS(n,i):e.createElement(i),c=t[1],d=1;if(c&&"object"==typeof c&&null==c.nodeType&&!Array.isArray(c)){d=2;for(let e in c)if(null!=c[e]){let t=e.indexOf(" ");t>0?a.setAttributeNS(e.slice(0,t),e.slice(t+1),c[e]):a.setAttribute(e,c[e])}}for(let h=d;h<t.length;h++){let r=t[h];if(0===r){if(h<t.length-1||h>d)throw new RangeError("Content hole must be the only child of its parent node");return{dom:a,contentDOM:a}}{let{dom:t,contentDOM:i}=Pn(e,r,n,o);if(a.appendChild(t),i){if(s)throw new RangeError("Multiple content holes");s=i}}}return{dom:a,contentDOM:s}}const $n=Math.pow(2,16);function Bn(e){return 65535&e}class Hn{constructor(e,t,n){this.pos=e,this.delInfo=t,this.recover=n}get deleted(){return(8&this.delInfo)>0}get deletedBefore(){return(5&this.delInfo)>0}get deletedAfter(){return(6&this.delInfo)>0}get deletedAcross(){return(4&this.delInfo)>0}}class _n{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&_n.empty)return _n.empty}recover(e){let t=0,n=Bn(e);if(!this.inverted)for(let o=0;o<n;o++)t+=this.ranges[3*o+2]-this.ranges[3*o+1];return this.ranges[3*n]+t+function(e){return(e-(65535&e))/$n}(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,n){let o=0,r=this.inverted?2:1,i=this.inverted?1:2;for(let s=0;s<this.ranges.length;s+=3){let l=this.ranges[s]-(this.inverted?o:0);if(l>e)break;let a=this.ranges[s+r],c=this.ranges[s+i],d=l+a;if(e<=d){let r=l+o+((a?e==l?-1:e==d?1:t:t)<0?0:c);if(n)return r;let i=e==(t<0?l:d)?null:s/3+(e-l)*$n,h=e==l?2:e==d?1:4;return(t<0?e!=l:e!=d)&&(h|=8),new Hn(r,h,i)}o+=c-a}return n?e+o:new Hn(e+o,0,null)}touches(e,t){let n=0,o=Bn(t),r=this.inverted?2:1,i=this.inverted?1:2;for(let s=0;s<this.ranges.length;s+=3){let t=this.ranges[s]-(this.inverted?n:0);if(t>e)break;let l=this.ranges[s+r];if(e<=t+l&&s==3*o)return!0;n+=this.ranges[s+i]-l}return!1}forEach(e){let t=this.inverted?2:1,n=this.inverted?1:2;for(let o=0,r=0;o<this.ranges.length;o+=3){let i=this.ranges[o],s=i-(this.inverted?r:0),l=i+(this.inverted?0:r),a=this.ranges[o+t],c=this.ranges[o+n];e(s,s+a,l,l+c),r+=c-a}}invert(){return new _n(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return 0==e?_n.empty:new _n(e<0?[0,-e,0]:[0,0,e])}}_n.empty=new _n([]);class Fn{constructor(e,t,n=0,o=(e?e.length:0)){this.mirror=t,this.from=n,this.to=o,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(e=0,t=this.maps.length){return new Fn(this._maps,this.mirror,e,t)}appendMap(e,t){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),null!=t&&this.setMirror(this._maps.length-1,t)}appendMapping(e){for(let t=0,n=this._maps.length;t<e._maps.length;t++){let o=e.getMirror(t);this.appendMap(e._maps[t],null!=o&&o<t?n+o:void 0)}}getMirror(e){if(this.mirror)for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}setMirror(e,t){this.mirror||(this.mirror=[]),this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,n=this._maps.length+e._maps.length;t>=0;t--){let o=e.getMirror(t);this.appendMap(e._maps[t].invert(),null!=o&&o>t?n-o-1:void 0)}}invert(){let e=new Fn;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let n=this.from;n<this.to;n++)e=this._maps[n].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,n){let o=0;for(let r=this.from;r<this.to;r++){let n=this._maps[r].mapResult(e,t);if(null!=n.recover){let t=this.getMirror(r);if(null!=t&&t>r&&t<this.to){r=t,e=this._maps[t].recover(n.recover);continue}}o|=n.delInfo,e=n.pos}return n?e:new Hn(e,o,null)}}const jn=Object.create(null);class Un{getMap(){return _n.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let n=jn[t.stepType];if(!n)throw new RangeError(`No step type ${t.stepType} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in jn)throw new RangeError("Duplicate use of step JSON ID "+e);return jn[e]=t,t.prototype.jsonID=e,t}}class Wn{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new Wn(e,null)}static fail(e){return new Wn(null,e)}static fromReplace(e,t,n,o){try{return Wn.ok(e.replace(t,n,o))}catch(r){if(r instanceof zt)return Wn.fail(r.message);throw r}}}function qn(e,t,n){let o=[];for(let r=0;r<e.childCount;r++){let i=e.child(r);i.content.size&&(i=i.copy(qn(i.content,t,i))),i.isInline&&(i=t(i,n,r)),o.push(i)}return Nt.fromArray(o)}class Kn extends Un{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=e.resolve(this.from),o=n.node(n.sharedDepth(this.to)),r=new Lt(qn(t.content,((e,t)=>e.isAtom&&t.type.allowsMarkType(this.mark.type)?e.mark(this.mark.addToSet(e.marks)):e),o),t.openStart,t.openEnd);return Wn.fromReplace(e,this.from,this.to,r)}invert(){return new Jn(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deleted&&n.deleted||t.pos>=n.pos?null:new Kn(t.pos,n.pos,this.mark)}merge(e){return e instanceof Kn&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Kn(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to)throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Kn(t.from,t.to,e.markFromJSON(t.mark))}}Un.jsonID("addMark",Kn);class Jn extends Un{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=new Lt(qn(t.content,(e=>e.mark(this.mark.removeFromSet(e.marks))),e),t.openStart,t.openEnd);return Wn.fromReplace(e,this.from,this.to,n)}invert(){return new Kn(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deleted&&n.deleted||t.pos>=n.pos?null:new Jn(t.pos,n.pos,this.mark)}merge(e){return e instanceof Jn&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Jn(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to)throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new Jn(t.from,t.to,e.markFromJSON(t.mark))}}Un.jsonID("removeMark",Jn);class Gn extends Un{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return Wn.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return Wn.fromReplace(e,this.pos,this.pos+1,new Lt(Nt.from(n),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let e=this.mark.addToSet(t.marks);if(e.length==t.marks.length){for(let n=0;n<t.marks.length;n++)if(!t.marks[n].isInSet(e))return new Gn(this.pos,t.marks[n]);return new Gn(this.pos,this.mark)}}return new Yn(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Gn(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if("number"!=typeof t.pos)throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new Gn(t.pos,e.markFromJSON(t.mark))}}Un.jsonID("addNodeMark",Gn);class Yn extends Un{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return Wn.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return Wn.fromReplace(e,this.pos,this.pos+1,new Lt(Nt.from(n),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return t&&this.mark.isInSet(t.marks)?new Gn(this.pos,this.mark):this}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Yn(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if("number"!=typeof t.pos)throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new Yn(t.pos,e.markFromJSON(t.mark))}}Un.jsonID("removeNodeMark",Yn);class Xn extends Un{constructor(e,t,n,o=!1){super(),this.from=e,this.to=t,this.slice=n,this.structure=o}apply(e){return this.structure&&Zn(e,this.from,this.to)?Wn.fail("Structure replace would overwrite content"):Wn.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new _n([this.from,this.to-this.from,this.slice.size])}invert(e){return new Xn(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deletedAcross&&n.deletedAcross?null:new Xn(t.pos,Math.max(t.pos,n.pos),this.slice)}merge(e){if(!(e instanceof Xn)||e.structure||this.structure)return null;if(this.from+this.slice.size!=e.from||this.slice.openEnd||e.slice.openStart){if(e.to!=this.from||this.slice.openStart||e.slice.openEnd)return null;{let t=this.slice.size+e.slice.size==0?Lt.empty:new Lt(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new Xn(e.from,this.to,t,this.structure)}}{let t=this.slice.size+e.slice.size==0?Lt.empty:new Lt(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new Xn(this.from,this.to+(e.to-e.from),t,this.structure)}}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to)throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new Xn(t.from,t.to,Lt.fromJSON(e,t.slice),!!t.structure)}}Un.jsonID("replace",Xn);class Qn extends Un{constructor(e,t,n,o,r,i,s=!1){super(),this.from=e,this.to=t,this.gapFrom=n,this.gapTo=o,this.slice=r,this.insert=i,this.structure=s}apply(e){if(this.structure&&(Zn(e,this.from,this.gapFrom)||Zn(e,this.gapTo,this.to)))return Wn.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return Wn.fail("Gap is not a flat range");let n=this.slice.insertAt(this.insert,t.content);return n?Wn.fromReplace(e,this.from,this.to,n):Wn.fail("Content does not fit in gap")}getMap(){return new _n([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let t=this.gapTo-this.gapFrom;return new Qn(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1),o=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),r=this.to==this.gapTo?n.pos:e.map(this.gapTo,1);return t.deletedAcross&&n.deletedAcross||o<t.pos||r>n.pos?null:new Qn(t.pos,n.pos,o,r,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to||"number"!=typeof t.gapFrom||"number"!=typeof t.gapTo||"number"!=typeof t.insert)throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Qn(t.from,t.to,t.gapFrom,t.gapTo,Lt.fromJSON(e,t.slice),t.insert,!!t.structure)}}function Zn(e,t,n){let o=e.resolve(t),r=n-t,i=o.depth;for(;r>0&&i>0&&o.indexAfter(i)==o.node(i).childCount;)i--,r--;if(r>0){let e=o.node(i).maybeChild(o.indexAfter(i));for(;r>0;){if(!e||e.isLeaf)return!0;e=e.firstChild,r--}}return!1}function eo(e,t,n,o=n.contentMatch,r=!0){let i=e.doc.nodeAt(t),s=[],l=t+1;for(let a=0;a<i.childCount;a++){let t=i.child(a),c=l+t.nodeSize,d=o.matchType(t.type);if(d){o=d;for(let o=0;o<t.marks.length;o++)n.allowsMarkType(t.marks[o].type)||e.step(new Jn(l,c,t.marks[o]));if(r&&t.isText&&"pre"!=n.whitespace){let e,o,r=/\r?\n|\r/g;for(;e=r.exec(t.text);)o||(o=new Lt(Nt.from(n.schema.text(" ",n.allowedMarks(t.marks))),0,0)),s.push(new Xn(l+e.index,l+e.index+e[0].length,o))}}else s.push(new Xn(l,c,Lt.empty));l=c}if(!o.validEnd){let t=o.fillBefore(Nt.empty,!0);e.replace(l,l,new Lt(t,0,0))}for(let a=s.length-1;a>=0;a--)e.step(s[a])}function to(e,t,n){return(0==t||e.canReplace(t,e.childCount))&&(n==e.childCount||e.canReplace(0,n))}function no(e){let t=e.parent.content.cutByIndex(e.startIndex,e.endIndex);for(let n=e.depth;;--n){let o=e.$from.node(n),r=e.$from.index(n),i=e.$to.indexAfter(n);if(n<e.depth&&o.canReplace(r,i,t))return n;if(0==n||o.type.spec.isolating||!to(o,r,i))break}return null}function oo(e,t,n=null,o=e){let r=function(e,t){let{parent:n,startIndex:o,endIndex:r}=e,i=n.contentMatchAt(o).findWrapping(t);if(!i)return null;let s=i.length?i[0]:t;return n.canReplaceWith(o,r,s)?i:null}(e,t),i=r&&function(e,t){let{parent:n,startIndex:o,endIndex:r}=e,i=n.child(o),s=t.contentMatch.findWrapping(i.type);if(!s)return null;let l=(s.length?s[s.length-1]:t).contentMatch;for(let a=o;l&&a<r;a++)l=l.matchType(n.child(a).type);return l&&l.validEnd?s:null}(o,t);return i?r.map(ro).concat({type:t,attrs:n}).concat(i.map(ro)):null}function ro(e){return{type:e,attrs:null}}function io(e,t,n,o){t.forEach(((r,i)=>{if(r.isText){let s,l=/\r?\n|\r/g;for(;s=l.exec(r.text);){let r=e.mapping.slice(o).map(n+1+i+s.index);e.replaceWith(r,r+1,t.type.schema.linebreakReplacement.create())}}}))}function so(e,t,n,o){t.forEach(((r,i)=>{if(r.type==r.type.schema.linebreakReplacement){let r=e.mapping.slice(o).map(n+1+i);e.replaceWith(r,r+1,t.type.schema.text("\n"))}}))}function lo(e,t,n=1,o){let r=e.resolve(t),i=r.depth-n,s=o&&o[o.length-1]||r.parent;if(i<0||r.parent.type.spec.isolating||!r.parent.canReplace(r.index(),r.parent.childCount)||!s.type.validContent(r.parent.content.cutByIndex(r.index(),r.parent.childCount)))return!1;for(let c=r.depth-1,d=n-2;c>i;c--,d--){let e=r.node(c),t=r.index(c);if(e.type.spec.isolating)return!1;let n=e.content.cutByIndex(t,e.childCount),i=o&&o[d+1];i&&(n=n.replaceChild(0,i.type.create(i.attrs)));let s=o&&o[d]||e;if(!e.canReplace(t+1,e.childCount)||!s.type.validContent(n))return!1}let l=r.indexAfter(i),a=o&&o[0];return r.node(i).canReplaceWith(l,l,a?a.type:r.node(i+1).type)}function ao(e,t){let n=e.resolve(t),o=n.index();return co(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(o,o+1)}function co(e,t){return!(!e||!t||e.isLeaf||!function(e,t){t.content.size||e.type.compatibleContent(t.type);let n=e.contentMatchAt(e.childCount),{linebreakReplacement:o}=e.type.schema;for(let r=0;r<t.childCount;r++){let i=t.child(r),s=i.type==o?e.type.schema.nodes.text:i.type;if(n=n.matchType(s),!n)return!1;if(!e.type.allowsMarks(i.marks))return!1}return n.validEnd}(e,t))}function ho(e,t,n=-1){let o=e.resolve(t);for(let r=o.depth;;r--){let e,i,s=o.index(r);if(r==o.depth?(e=o.nodeBefore,i=o.nodeAfter):n>0?(e=o.node(r+1),s++,i=o.node(r).maybeChild(s)):(e=o.node(r).maybeChild(s-1),i=o.node(r+1)),e&&!e.isTextblock&&co(e,i)&&o.node(r).canReplace(s,s+1))return t;if(0==r)break;t=n<0?o.before(r):o.after(r)}}function uo(e,t,n){let o=e.resolve(t);if(!n.content.size)return t;let r=n.content;for(let i=0;i<n.openStart;i++)r=r.firstChild.content;for(let i=1;i<=(0==n.openStart&&n.size?2:1);i++)for(let e=o.depth;e>=0;e--){let t=e==o.depth?0:o.pos<=(o.start(e+1)+o.end(e+1))/2?-1:1,n=o.index(e)+(t>0?1:0),s=o.node(e),l=!1;if(1==i)l=s.canReplace(n,n,r);else{let e=s.contentMatchAt(n).findWrapping(r.firstChild.type);l=e&&s.canReplaceWith(n,n,e[0])}if(l)return 0==t?o.pos:t<0?o.before(e+1):o.after(e+1)}return null}function po(e,t,n=t,o=Lt.empty){if(t==n&&!o.size)return null;let r=e.resolve(t),i=e.resolve(n);return fo(r,i,o)?new Xn(t,n,o):new mo(r,i,o).fit()}function fo(e,t,n){return!n.openStart&&!n.openEnd&&e.start()==t.start()&&e.parent.canReplace(e.index(),t.index(),n.content)}Un.jsonID("replaceAround",Qn);class mo{constructor(e,t,n){this.$from=e,this.$to=t,this.unplaced=n,this.frontier=[],this.placed=Nt.empty;for(let o=0;o<=e.depth;o++){let t=e.node(o);this.frontier.push({type:t.type,match:t.contentMatchAt(e.indexAfter(o))})}for(let o=e.depth;o>0;o--)this.placed=Nt.from(e.node(o).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let e=this.findFittable();e?this.placeNodes(e):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,n=this.$from,o=this.close(e<0?this.$to:n.doc.resolve(e));if(!o)return null;let r=this.placed,i=n.depth,s=o.depth;for(;i&&s&&1==r.childCount;)r=r.firstChild.content,i--,s--;let l=new Lt(r,i,s);return e>-1?new Qn(n.pos,e,this.$to.pos,this.$to.end(),l,t):l.size||n.pos!=this.$to.pos?new Xn(n.pos,o.pos,l):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,n=0,o=this.unplaced.openEnd;n<e;n++){let r=t.firstChild;if(t.childCount>1&&(o=0),r.type.spec.isolating&&o<=n){e=n;break}t=r.content}for(let t=1;t<=2;t++)for(let n=1==t?e:this.unplaced.openStart;n>=0;n--){let e,o=null;n?(o=vo(this.unplaced.content,n-1).firstChild,e=o.content):e=this.unplaced.content;let r=e.firstChild;for(let i=this.depth;i>=0;i--){let e,{type:s,match:l}=this.frontier[i],a=null;if(1==t&&(r?l.matchType(r.type)||(a=l.fillBefore(Nt.from(r),!1)):o&&s.compatibleContent(o.type)))return{sliceDepth:n,frontierDepth:i,parent:o,inject:a};if(2==t&&r&&(e=l.findWrapping(r.type)))return{sliceDepth:n,frontierDepth:i,parent:o,wrap:e};if(o&&l.matchType(o.type))break}}}openMore(){let{content:e,openStart:t,openEnd:n}=this.unplaced,o=vo(e,t);return!(!o.childCount||o.firstChild.isLeaf)&&(this.unplaced=new Lt(e,t+1,Math.max(n,o.size+t>=e.size-n?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:n}=this.unplaced,o=vo(e,t);if(o.childCount<=1&&t>0){let r=e.size-t<=t+o.size;this.unplaced=new Lt(go(e,t-1,1),t-1,r?t-1:n)}else this.unplaced=new Lt(go(e,t,1),t,n)}placeNodes({sliceDepth:e,frontierDepth:t,parent:n,inject:o,wrap:r}){for(;this.depth>t;)this.closeFrontierNode();if(r)for(let f=0;f<r.length;f++)this.openFrontierNode(r[f]);let i=this.unplaced,s=n?n.content:i.content,l=i.openStart-e,a=0,c=[],{match:d,type:h}=this.frontier[t];if(o){for(let e=0;e<o.childCount;e++)c.push(o.child(e));d=d.matchFragment(o)}let u=s.size+e-(i.content.size-i.openEnd);for(;a<s.childCount;){let e=s.child(a),t=d.matchType(e.type);if(!t)break;a++,(a>1||0==l||e.content.size)&&(d=t,c.push(bo(e.mark(h.allowedMarks(e.marks)),1==a?l:0,a==s.childCount?u:-1)))}let p=a==s.childCount;p||(u=-1),this.placed=yo(this.placed,t,Nt.from(c)),this.frontier[t].match=d,p&&u<0&&n&&n.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let f=0,m=s;f<u;f++){let e=m.lastChild;this.frontier.push({type:e.type,match:e.contentMatchAt(e.childCount)}),m=e.content}this.unplaced=p?0==e?Lt.empty:new Lt(go(i.content,e-1,1),e-1,u<0?i.openEnd:e-1):new Lt(go(i.content,e,a),i.openStart,i.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e,t=this.frontier[this.depth];if(!t.type.isTextblock||!wo(this.$to,this.$to.depth,t.type,t.match,!1)||this.$to.depth==this.depth&&(e=this.findCloseLevel(this.$to))&&e.depth==this.depth)return-1;let{depth:n}=this.$to,o=this.$to.after(n);for(;n>1&&o==this.$to.end(--n);)++o;return o}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:n,type:o}=this.frontier[t],r=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),i=wo(e,t,o,n,r);if(i){for(let n=t-1;n>=0;n--){let{match:t,type:o}=this.frontier[n],r=wo(e,n,o,t,!0);if(!r||r.childCount)continue e}return{depth:t,fit:i,move:r?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=yo(this.placed,t.depth,t.fit)),e=t.move;for(let n=t.depth+1;n<=e.depth;n++){let t=e.node(n),o=t.type.contentMatch.fillBefore(t.content,!0,e.index(n));this.openFrontierNode(t.type,t.attrs,o)}return e}openFrontierNode(e,t=null,n){let o=this.frontier[this.depth];o.match=o.match.matchType(e),this.placed=yo(this.placed,this.depth,Nt.from(e.create(t,n))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let e=this.frontier.pop().match.fillBefore(Nt.empty,!0);e.childCount&&(this.placed=yo(this.placed,this.frontier.length,e))}}function go(e,t,n){return 0==t?e.cutByIndex(n,e.childCount):e.replaceChild(0,e.firstChild.copy(go(e.firstChild.content,t-1,n)))}function yo(e,t,n){return 0==t?e.append(n):e.replaceChild(e.childCount-1,e.lastChild.copy(yo(e.lastChild.content,t-1,n)))}function vo(e,t){for(let n=0;n<t;n++)e=e.firstChild.content;return e}function bo(e,t,n){if(t<=0)return e;let o=e.content;return t>1&&(o=o.replaceChild(0,bo(o.firstChild,t-1,1==o.childCount?n-1:0))),t>0&&(o=e.type.contentMatch.fillBefore(o).append(o),n<=0&&(o=o.append(e.type.contentMatch.matchFragment(o).fillBefore(Nt.empty,!0)))),e.copy(o)}function wo(e,t,n,o,r){let i=e.node(t),s=r?e.indexAfter(t):e.index(t);if(s==i.childCount&&!n.compatibleContent(i.type))return null;let l=o.fillBefore(i.content,!0,s);return l&&!function(e,t,n){for(let o=n;o<t.childCount;o++)if(!e.allowsMarks(t.child(o).marks))return!0;return!1}(n,i.content,s)?l:null}function ko(e,t,n,o,r){if(t<n){let r=e.firstChild;e=e.replaceChild(0,r.copy(ko(r.content,t+1,n,o,r)))}if(t>o){let t=r.contentMatchAt(0),n=t.fillBefore(e).append(e);e=n.append(t.matchFragment(n).fillBefore(Nt.empty,!0))}return e}function xo(e,t){let n=[];for(let o=Math.min(e.depth,t.depth);o>=0;o--){let r=e.start(o);if(r<e.pos-(e.depth-o)||t.end(o)>t.pos+(t.depth-o)||e.node(o).type.spec.isolating||t.node(o).type.spec.isolating)break;(r==t.start(o)||o==e.depth&&o==t.depth&&e.parent.inlineContent&&t.parent.inlineContent&&o&&t.start(o-1)==r-1)&&n.push(o)}return n}class Mo extends Un{constructor(e,t,n){super(),this.pos=e,this.attr=t,this.value=n}apply(e){let t=e.nodeAt(this.pos);if(!t)return Wn.fail("No node at attribute step's position");let n=Object.create(null);for(let r in t.attrs)n[r]=t.attrs[r];n[this.attr]=this.value;let o=t.type.create(n,null,t.marks);return Wn.fromReplace(e,this.pos,this.pos+1,new Lt(Nt.from(o),0,t.isLeaf?0:1))}getMap(){return _n.empty}invert(e){return new Mo(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Mo(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if("number"!=typeof t.pos||"string"!=typeof t.attr)throw new RangeError("Invalid input for AttrStep.fromJSON");return new Mo(t.pos,t.attr,t.value)}}Un.jsonID("attr",Mo);class So extends Un{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let o in e.attrs)t[o]=e.attrs[o];t[this.attr]=this.value;let n=e.type.create(t,e.content,e.marks);return Wn.ok(n)}getMap(){return _n.empty}invert(e){return new So(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,t){if("string"!=typeof t.attr)throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new So(t.attr,t.value)}}Un.jsonID("docAttr",So);let Co=class extends Error{};Co=function e(t){let n=Error.call(this,t);return n.__proto__=e.prototype,n},(Co.prototype=Object.create(Error.prototype)).constructor=Co,Co.prototype.name="TransformError";class Oo{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Fn}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new Co(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,n=Lt.empty){let o=po(this.doc,e,t,n);return o&&this.step(o),this}replaceWith(e,t,n){return this.replace(e,t,new Lt(Nt.from(n),0,0))}delete(e,t){return this.replace(e,t,Lt.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,n){return function(e,t,n,o){if(!o.size)return e.deleteRange(t,n);let r=e.doc.resolve(t),i=e.doc.resolve(n);if(fo(r,i,o))return e.step(new Xn(t,n,o));let s=xo(r,e.doc.resolve(n));0==s[s.length-1]&&s.pop();let l=-(r.depth+1);s.unshift(l);for(let p=r.depth,f=r.pos-1;p>0;p--,f--){let e=r.node(p).type.spec;if(e.defining||e.definingAsContext||e.isolating)break;s.indexOf(p)>-1?l=p:r.before(p)==f&&s.splice(1,0,-p)}let a=s.indexOf(l),c=[],d=o.openStart;for(let p=o.content,f=0;;f++){let e=p.firstChild;if(c.push(e),f==o.openStart)break;p=e.content}for(let p=d-1;p>=0;p--){let e=c[p],t=(h=e.type).spec.defining||h.spec.definingForContent;if(t&&!e.sameMarkup(r.node(Math.abs(l)-1)))d=p;else if(t||!e.type.isTextblock)break}var h;for(let p=o.openStart;p>=0;p--){let t=(p+d+1)%(o.openStart+1),l=c[t];if(l)for(let c=0;c<s.length;c++){let d=s[(c+a)%s.length],h=!0;d<0&&(h=!1,d=-d);let u=r.node(d-1),p=r.index(d-1);if(u.canReplaceWith(p,p,l.type,l.marks))return e.replace(r.before(d),h?i.after(d):n,new Lt(ko(o.content,0,o.openStart,t),t,o.openEnd))}}let u=e.steps.length;for(let p=s.length-1;p>=0&&(e.replace(t,n,o),!(e.steps.length>u));p--){let e=s[p];e<0||(t=r.before(e),n=i.after(e))}}(this,e,t,n),this}replaceRangeWith(e,t,n){return function(e,t,n,o){if(!o.isInline&&t==n&&e.doc.resolve(t).parent.content.size){let r=function(e,t,n){let o=e.resolve(t);if(o.parent.canReplaceWith(o.index(),o.index(),n))return t;if(0==o.parentOffset)for(let r=o.depth-1;r>=0;r--){let e=o.index(r);if(o.node(r).canReplaceWith(e,e,n))return o.before(r+1);if(e>0)return null}if(o.parentOffset==o.parent.content.size)for(let r=o.depth-1;r>=0;r--){let e=o.indexAfter(r);if(o.node(r).canReplaceWith(e,e,n))return o.after(r+1);if(e<o.node(r).childCount)return null}return null}(e.doc,t,o.type);null!=r&&(t=n=r)}e.replaceRange(t,n,new Lt(Nt.from(o),0,0))}(this,e,t,n),this}deleteRange(e,t){return function(e,t,n){let o=e.doc.resolve(t),r=e.doc.resolve(n),i=xo(o,r);for(let s=0;s<i.length;s++){let t=i[s],n=s==i.length-1;if(n&&0==t||o.node(t).type.contentMatch.validEnd)return e.delete(o.start(t),r.end(t));if(t>0&&(n||o.node(t-1).canReplace(o.index(t-1),r.indexAfter(t-1))))return e.delete(o.before(t),r.after(t))}for(let s=1;s<=o.depth&&s<=r.depth;s++)if(t-o.start(s)==o.depth-s&&n>o.end(s)&&r.end(s)-n!=r.depth-s&&o.start(s-1)==r.start(s-1)&&o.node(s-1).canReplace(o.index(s-1),r.index(s-1)))return e.delete(o.before(s),n);e.delete(t,n)}(this,e,t),this}lift(e,t){return function(e,t,n){let{$from:o,$to:r,depth:i}=t,s=o.before(i+1),l=r.after(i+1),a=s,c=l,d=Nt.empty,h=0;for(let f=i,m=!1;f>n;f--)m||o.index(f)>0?(m=!0,d=Nt.from(o.node(f).copy(d)),h++):a--;let u=Nt.empty,p=0;for(let f=i,m=!1;f>n;f--)m||r.after(f+1)<r.end(f)?(m=!0,u=Nt.from(r.node(f).copy(u)),p++):c++;e.step(new Qn(a,c,s,l,new Lt(d.append(u),h,p),d.size-h,!0))}(this,e,t),this}join(e,t=1){return function(e,t,n){let o=null,{linebreakReplacement:r}=e.doc.type.schema,i=e.doc.resolve(t-n),s=i.node().type;if(r&&s.inlineContent){let e="pre"==s.whitespace,t=!!s.contentMatch.matchType(r);e&&!t?o=!1:!e&&t&&(o=!0)}let l=e.steps.length;if(!1===o){let o=e.doc.resolve(t+n);so(e,o.node(),o.before(),l)}s.inlineContent&&eo(e,t+n-1,s,i.node().contentMatchAt(i.index()),null==o);let a=e.mapping.slice(l),c=a.map(t-n);if(e.step(new Xn(c,a.map(t+n,-1),Lt.empty,!0)),!0===o){let t=e.doc.resolve(c);io(e,t.node(),t.before(),e.steps.length)}}(this,e,t),this}wrap(e,t){return function(e,t,n){let o=Nt.empty;for(let s=n.length-1;s>=0;s--){if(o.size){let e=n[s].type.contentMatch.matchFragment(o);if(!e||!e.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}o=Nt.from(n[s].type.create(n[s].attrs,o))}let r=t.start,i=t.end;e.step(new Qn(r,i,r,i,new Lt(o,0,0),n.length,!0))}(this,e,t),this}setBlockType(e,t=e,n,o=null){return function(e,t,n,o,r){if(!o.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let i=e.steps.length;e.doc.nodesBetween(t,n,((t,n)=>{let s="function"==typeof r?r(t):r;if(t.isTextblock&&!t.hasMarkup(o,s)&&function(e,t,n){let o=e.resolve(t),r=o.index();return o.parent.canReplaceWith(r,r+1,n)}(e.doc,e.mapping.slice(i).map(n),o)){let r=null;if(o.schema.linebreakReplacement){let e="pre"==o.whitespace,t=!!o.contentMatch.matchType(o.schema.linebreakReplacement);e&&!t?r=!1:!e&&t&&(r=!0)}!1===r&&so(e,t,n,i),eo(e,e.mapping.slice(i).map(n,1),o,void 0,null===r);let l=e.mapping.slice(i),a=l.map(n,1),c=l.map(n+t.nodeSize,1);return e.step(new Qn(a,c,a+1,c-1,new Lt(Nt.from(o.create(s,null,t.marks)),0,0),1,!0)),!0===r&&io(e,t,n,i),!1}}))}(this,e,t,n,o),this}setNodeMarkup(e,t,n=null,o){return function(e,t,n,o,r){let i=e.doc.nodeAt(t);if(!i)throw new RangeError("No node at given position");n||(n=i.type);let s=n.create(o,null,r||i.marks);if(i.isLeaf)return e.replaceWith(t,t+i.nodeSize,s);if(!n.validContent(i.content))throw new RangeError("Invalid content for node type "+n.name);e.step(new Qn(t,t+i.nodeSize,t+1,t+i.nodeSize-1,new Lt(Nt.from(s),0,0),1,!0))}(this,e,t,n,o),this}setNodeAttribute(e,t,n){return this.step(new Mo(e,t,n)),this}setDocAttribute(e,t){return this.step(new So(e,t)),this}addNodeMark(e,t){return this.step(new Gn(e,t)),this}removeNodeMark(e,t){if(!(t instanceof It)){let n=this.doc.nodeAt(e);if(!n)throw new RangeError("No node at position "+e);if(!(t=t.isInSet(n.marks)))return this}return this.step(new Yn(e,t)),this}split(e,t=1,n){return function(e,t,n=1,o){let r=e.doc.resolve(t),i=Nt.empty,s=Nt.empty;for(let l=r.depth,a=r.depth-n,c=n-1;l>a;l--,c--){i=Nt.from(r.node(l).copy(i));let e=o&&o[c];s=Nt.from(e?e.type.create(e.attrs,s):r.node(l).copy(s))}e.step(new Xn(t,t,new Lt(i.append(s),n,n),!0))}(this,e,t,n),this}addMark(e,t,n){return function(e,t,n,o){let r,i,s=[],l=[];e.doc.nodesBetween(t,n,((e,a,c)=>{if(!e.isInline)return;let d=e.marks;if(!o.isInSet(d)&&c.type.allowsMarkType(o.type)){let c=Math.max(a,t),h=Math.min(a+e.nodeSize,n),u=o.addToSet(d);for(let e=0;e<d.length;e++)d[e].isInSet(u)||(r&&r.to==c&&r.mark.eq(d[e])?r.to=h:s.push(r=new Jn(c,h,d[e])));i&&i.to==c?i.to=h:l.push(i=new Kn(c,h,o))}})),s.forEach((t=>e.step(t))),l.forEach((t=>e.step(t)))}(this,e,t,n),this}removeMark(e,t,n){return function(e,t,n,o){let r=[],i=0;e.doc.nodesBetween(t,n,((e,s)=>{if(!e.isInline)return;i++;let l=null;if(o instanceof bn){let t,n=e.marks;for(;t=o.isInSet(n);)(l||(l=[])).push(t),n=t.removeFromSet(n)}else o?o.isInSet(e.marks)&&(l=[o]):l=e.marks;if(l&&l.length){let o=Math.min(s+e.nodeSize,n);for(let e=0;e<l.length;e++){let n,a=l[e];for(let e=0;e<r.length;e++){let t=r[e];t.step==i-1&&a.eq(r[e].style)&&(n=t)}n?(n.to=o,n.step=i):r.push({style:a,from:Math.max(s,t),to:o,step:i})}}})),r.forEach((t=>e.step(new Jn(t.from,t.to,t.style))))}(this,e,t,n),this}clearIncompatible(e,t,n){return eo(this,e,t,n),this}}const To=Object.create(null);class Ao{constructor(e,t,n){this.$anchor=e,this.$head=t,this.ranges=n||[new Eo(e.min(t),e.max(t))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let t=0;t<e.length;t++)if(e[t].$from.pos!=e[t].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,t=Lt.empty){let n=t.content.lastChild,o=null;for(let s=0;s<t.openEnd;s++)o=n,n=n.lastChild;let r=e.steps.length,i=this.ranges;for(let s=0;s<i.length;s++){let{$from:l,$to:a}=i[s],c=e.mapping.slice(r);e.replaceRange(c.map(l.pos),c.map(a.pos),s?Lt.empty:t),0==s&&Bo(e,r,(n?n.isInline:o&&o.isTextblock)?-1:1)}}replaceWith(e,t){let n=e.steps.length,o=this.ranges;for(let r=0;r<o.length;r++){let{$from:i,$to:s}=o[r],l=e.mapping.slice(n),a=l.map(i.pos),c=l.map(s.pos);r?e.deleteRange(a,c):(e.replaceRangeWith(a,c,t),Bo(e,n,t.isInline?-1:1))}}static findFrom(e,t,n=!1){let o=e.parent.inlineContent?new Ro(e):$o(e.node(0),e.parent,e.pos,e.index(),t,n);if(o)return o;for(let r=e.depth-1;r>=0;r--){let o=t<0?$o(e.node(0),e.node(r),e.before(r+1),e.index(r),t,n):$o(e.node(0),e.node(r),e.after(r+1),e.index(r)+1,t,n);if(o)return o}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new Lo(e.node(0))}static atStart(e){return $o(e,e,0,0,1)||new Lo(e)}static atEnd(e){return $o(e,e,e.content.size,e.childCount,-1)||new Lo(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let n=To[t.type];if(!n)throw new RangeError(`No selection type ${t.type} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in To)throw new RangeError("Duplicate use of selection JSON ID "+e);return To[e]=t,t.prototype.jsonID=e,t}getBookmark(){return Ro.between(this.$anchor,this.$head).getBookmark()}}Ao.prototype.visible=!0;class Eo{constructor(e,t){this.$from=e,this.$to=t}}let No=!1;function Do(e){No||e.parent.inlineContent||(No=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+e.parent.type.name+")"))}class Ro extends Ao{constructor(e,t=e){Do(e),Do(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let n=e.resolve(t.map(this.head));if(!n.parent.inlineContent)return Ao.near(n);let o=e.resolve(t.map(this.anchor));return new Ro(o.parent.inlineContent?o:n,n)}replace(e,t=Lt.empty){if(super.replace(e,t),t==Lt.empty){let t=this.$from.marksAcross(this.$to);t&&e.ensureMarks(t)}}eq(e){return e instanceof Ro&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Vo(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if("number"!=typeof t.anchor||"number"!=typeof t.head)throw new RangeError("Invalid input for TextSelection.fromJSON");return new Ro(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,n=t){let o=e.resolve(t);return new this(o,n==t?o:e.resolve(n))}static between(e,t,n){let o=e.pos-t.pos;if(n&&!o||(n=o>=0?1:-1),!t.parent.inlineContent){let e=Ao.findFrom(t,n,!0)||Ao.findFrom(t,-n,!0);if(!e)return Ao.near(t,n);t=e.$head}return e.parent.inlineContent||(0==o||(e=(Ao.findFrom(e,-n,!0)||Ao.findFrom(e,n,!0)).$anchor).pos<t.pos!=o<0)&&(e=t),new Ro(e,t)}}Ao.jsonID("text",Ro);class Vo{constructor(e,t){this.anchor=e,this.head=t}map(e){return new Vo(e.map(this.anchor),e.map(this.head))}resolve(e){return Ro.between(e.resolve(this.anchor),e.resolve(this.head))}}class Io extends Ao{constructor(e){let t=e.nodeAfter,n=e.node(0).resolve(e.pos+t.nodeSize);super(e,n),this.node=t}map(e,t){let{deleted:n,pos:o}=t.mapResult(this.anchor),r=e.resolve(o);return n?Ao.near(r):new Io(r)}content(){return new Lt(Nt.from(this.node),0,0)}eq(e){return e instanceof Io&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new zo(this.anchor)}static fromJSON(e,t){if("number"!=typeof t.anchor)throw new RangeError("Invalid input for NodeSelection.fromJSON");return new Io(e.resolve(t.anchor))}static create(e,t){return new Io(e.resolve(t))}static isSelectable(e){return!e.isText&&!1!==e.type.spec.selectable}}Io.prototype.visible=!1,Ao.jsonID("node",Io);class zo{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:n}=e.mapResult(this.anchor);return t?new Vo(n,n):new zo(n)}resolve(e){let t=e.resolve(this.anchor),n=t.nodeAfter;return n&&Io.isSelectable(n)?new Io(t):Ao.near(t)}}class Lo extends Ao{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=Lt.empty){if(t==Lt.empty){e.delete(0,e.doc.content.size);let t=Ao.atStart(e.doc);t.eq(e.selection)||e.setSelection(t)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new Lo(e)}map(e){return new Lo(e)}eq(e){return e instanceof Lo}getBookmark(){return Po}}Ao.jsonID("all",Lo);const Po={map(){return this},resolve:e=>new Lo(e)};function $o(e,t,n,o,r,i=!1){if(t.inlineContent)return Ro.create(e,n);for(let s=o-(r>0?0:1);r>0?s<t.childCount:s>=0;s+=r){let o=t.child(s);if(o.isAtom){if(!i&&Io.isSelectable(o))return Io.create(e,n-(r<0?o.nodeSize:0))}else{let t=$o(e,o,n+r,r<0?o.childCount:0,r,i);if(t)return t}n+=o.nodeSize*r}return null}function Bo(e,t,n){let o=e.steps.length-1;if(o<t)return;let r,i=e.steps[o];(i instanceof Xn||i instanceof Qn)&&(e.mapping.maps[o].forEach(((e,t,n,o)=>{null==r&&(r=o)})),e.setSelection(Ao.near(e.doc.resolve(r),n)))}class Ho extends Oo{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=-3&this.updated|1,this.storedMarks=null,this}get selectionSet(){return(1&this.updated)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=2,this}ensureMarks(e){return It.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(2&this.updated)>0}addStep(e,t){super.addStep(e,t),this.updated=-3&this.updated,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,t=!0){let n=this.selection;return t&&(e=e.mark(this.storedMarks||(n.empty?n.$from.marks():n.$from.marksAcross(n.$to)||It.none))),n.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,n){let o=this.doc.type.schema;if(null==t)return e?this.replaceSelectionWith(o.text(e),!0):this.deleteSelection();{if(null==n&&(n=t),n=null==n?t:n,!e)return this.deleteRange(t,n);let r=this.storedMarks;if(!r){let e=this.doc.resolve(t);r=n==t?e.marks():e.marksAcross(this.doc.resolve(n))}return this.replaceRangeWith(t,n,o.text(e,r)),this.selection.empty||this.setSelection(Ao.near(this.selection.$to)),this}}setMeta(e,t){return this.meta["string"==typeof e?e:e.key]=t,this}getMeta(e){return this.meta["string"==typeof e?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=4,this}get scrolledIntoView(){return(4&this.updated)>0}}function _o(e,t){return t&&e?e.bind(t):e}class Fo{constructor(e,t,n){this.name=e,this.init=_o(t.init,n),this.apply=_o(t.apply,n)}}const jo=[new Fo("doc",{init:e=>e.doc||e.schema.topNodeType.createAndFill(),apply:e=>e.doc}),new Fo("selection",{init:(e,t)=>e.selection||Ao.atStart(t.doc),apply:e=>e.selection}),new Fo("storedMarks",{init:e=>e.storedMarks||null,apply:(e,t,n,o)=>o.selection.$cursor?e.storedMarks:null}),new Fo("scrollToSelection",{init:()=>0,apply:(e,t)=>e.scrolledIntoView?t+1:t})];class Uo{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=jo.slice(),t&&t.forEach((e=>{if(this.pluginsByKey[e.key])throw new RangeError("Adding different instances of a keyed plugin ("+e.key+")");this.plugins.push(e),this.pluginsByKey[e.key]=e,e.spec.state&&this.fields.push(new Fo(e.key,e.spec.state,e))}))}}class Wo{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,t=-1){for(let n=0;n<this.config.plugins.length;n++)if(n!=t){let t=this.config.plugins[n];if(t.spec.filterTransaction&&!t.spec.filterTransaction.call(t,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let t=[e],n=this.applyInner(e),o=null;for(;;){let r=!1;for(let i=0;i<this.config.plugins.length;i++){let s=this.config.plugins[i];if(s.spec.appendTransaction){let l=o?o[i].n:0,a=o?o[i].state:this,c=l<t.length&&s.spec.appendTransaction.call(s,l?t.slice(l):t,a,n);if(c&&n.filterTransaction(c,i)){if(c.setMeta("appendedTransaction",e),!o){o=[];for(let e=0;e<this.config.plugins.length;e++)o.push(e<i?{state:n,n:t.length}:{state:this,n:0})}t.push(c),n=n.applyInner(c),r=!0}o&&(o[i]={state:n,n:t.length})}}if(!r)return{state:n,transactions:t}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let t=new Wo(this.config),n=this.config.fields;for(let o=0;o<n.length;o++){let r=n[o];t[r.name]=r.apply(e,this[r.name],this,t)}return t}get tr(){return new Ho(this)}static create(e){let t=new Uo(e.doc?e.doc.type.schema:e.schema,e.plugins),n=new Wo(t);for(let o=0;o<t.fields.length;o++)n[t.fields[o].name]=t.fields[o].init(e,n);return n}reconfigure(e){let t=new Uo(this.schema,e.plugins),n=t.fields,o=new Wo(t);for(let r=0;r<n.length;r++){let t=n[r].name;o[t]=this.hasOwnProperty(t)?this[t]:n[r].init(e,o)}return o}toJSON(e){let t={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(t.storedMarks=this.storedMarks.map((e=>e.toJSON()))),e&&"object"==typeof e)for(let n in e){if("doc"==n||"selection"==n)throw new RangeError("The JSON fields `doc` and `selection` are reserved");let o=e[n],r=o.spec.state;r&&r.toJSON&&(t[n]=r.toJSON.call(o,this[o.key]))}return t}static fromJSON(e,t,n){if(!t)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let o=new Uo(e.schema,e.plugins),r=new Wo(o);return o.fields.forEach((o=>{if("doc"==o.name)r.doc=en.fromJSON(e.schema,t.doc);else if("selection"==o.name)r.selection=Ao.fromJSON(r.doc,t.selection);else if("storedMarks"==o.name)t.storedMarks&&(r.storedMarks=t.storedMarks.map(e.schema.markFromJSON));else{if(n)for(let i in n){let s=n[i],l=s.spec.state;if(s.key==o.name&&l&&l.fromJSON&&Object.prototype.hasOwnProperty.call(t,i))return void(r[o.name]=l.fromJSON.call(s,e,t[i],r))}r[o.name]=o.init(e,r)}})),r}}function qo(e,t,n){for(let o in e){let r=e[o];r instanceof Function?r=r.bind(t):"handleDOMEvents"==o&&(r=qo(r,t,{})),n[o]=r}return n}class Ko{constructor(e){this.spec=e,this.props={},e.props&&qo(e.props,this,this.props),this.key=e.key?e.key.key:Go("plugin")}getState(e){return e[this.key]}}const Jo=Object.create(null);function Go(e){return e in Jo?e+"$"+ ++Jo[e]:(Jo[e]=0,e+"$")}class Yo{constructor(e="key"){this.key=Go(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const Xo=function(e){for(var t=0;;t++)if(!(e=e.previousSibling))return t},Qo=function(e){let t=e.assignedSlot||e.parentNode;return t&&11==t.nodeType?t.host:t};let Zo=null;const er=function(e,t,n){let o=Zo||(Zo=document.createRange());return o.setEnd(e,null==n?e.nodeValue.length:n),o.setStart(e,t||0),o},tr=function(e,t,n,o){return n&&(or(e,t,n,o,-1)||or(e,t,n,o,1))},nr=/^(img|br|input|textarea|hr)$/i;function or(e,t,n,o,r){for(;;){if(e==n&&t==o)return!0;if(t==(r<0?0:rr(e))){let n=e.parentNode;if(!n||1!=n.nodeType||ir(e)||nr.test(e.nodeName)||"false"==e.contentEditable)return!1;t=Xo(e)+(r<0?0:1),e=n}else{if(1!=e.nodeType)return!1;if("false"==(e=e.childNodes[t+(r<0?-1:0)]).contentEditable)return!1;t=r<0?rr(e):0}}}function rr(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function ir(e){let t;for(let n=e;n&&!(t=n.pmViewDesc);n=n.parentNode);return t&&t.node&&t.node.isBlock&&(t.dom==e||t.contentDOM==e)}const sr=function(e){return e.focusNode&&tr(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)};function lr(e,t){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=e,n.key=n.code=t,n}const ar="undefined"!=typeof navigator?navigator:null,cr="undefined"!=typeof document?document:null,dr=ar&&ar.userAgent||"",hr=/Edge\/(\d+)/.exec(dr),ur=/MSIE \d/.exec(dr),pr=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(dr),fr=!!(ur||pr||hr),mr=ur?document.documentMode:pr?+pr[1]:hr?+hr[1]:0,gr=!fr&&/gecko\/(\d+)/i.test(dr);gr&&(/Firefox\/(\d+)/.exec(dr)||[0,0])[1];const yr=!fr&&/Chrome\/(\d+)/.exec(dr),vr=!!yr,br=yr?+yr[1]:0,wr=!fr&&!!ar&&/Apple Computer/.test(ar.vendor),kr=wr&&(/Mobile\/\w+/.test(dr)||!!ar&&ar.maxTouchPoints>2),xr=kr||!!ar&&/Mac/.test(ar.platform),Mr=!!ar&&/Win/.test(ar.platform),Sr=/Android \d/.test(dr),Cr=!!cr&&"webkitFontSmoothing"in cr.documentElement.style,Or=Cr?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function Tr(e){let t=e.defaultView&&e.defaultView.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:e.documentElement.clientWidth,top:0,bottom:e.documentElement.clientHeight}}function Ar(e,t){return"number"==typeof e?e:e[t]}function Er(e){let t=e.getBoundingClientRect(),n=t.width/e.offsetWidth||1,o=t.height/e.offsetHeight||1;return{left:t.left,right:t.left+e.clientWidth*n,top:t.top,bottom:t.top+e.clientHeight*o}}function Nr(e,t,n){let o=e.someProp("scrollThreshold")||0,r=e.someProp("scrollMargin")||5,i=e.dom.ownerDocument;for(let s=n||e.dom;s;){if(1!=s.nodeType){s=Qo(s);continue}let e=s,n=e==i.body,l=n?Tr(i):Er(e),a=0,c=0;if(t.top<l.top+Ar(o,"top")?c=-(l.top-t.top+Ar(r,"top")):t.bottom>l.bottom-Ar(o,"bottom")&&(c=t.bottom-t.top>l.bottom-l.top?t.top+Ar(r,"top")-l.top:t.bottom-l.bottom+Ar(r,"bottom")),t.left<l.left+Ar(o,"left")?a=-(l.left-t.left+Ar(r,"left")):t.right>l.right-Ar(o,"right")&&(a=t.right-l.right+Ar(r,"right")),a||c)if(n)i.defaultView.scrollBy(a,c);else{let n=e.scrollLeft,o=e.scrollTop;c&&(e.scrollTop+=c),a&&(e.scrollLeft+=a);let r=e.scrollLeft-n,i=e.scrollTop-o;t={left:t.left-r,top:t.top-i,right:t.right-r,bottom:t.bottom-i}}let d=n?"fixed":getComputedStyle(s).position;if(/^(fixed|sticky)$/.test(d))break;s="absolute"==d?s.offsetParent:Qo(s)}}function Dr(e){let t=[],n=e.ownerDocument;for(let o=e;o&&(t.push({dom:o,top:o.scrollTop,left:o.scrollLeft}),e!=n);o=Qo(o));return t}function Rr(e,t){for(let n=0;n<e.length;n++){let{dom:o,top:r,left:i}=e[n];o.scrollTop!=r+t&&(o.scrollTop=r+t),o.scrollLeft!=i&&(o.scrollLeft=i)}}let Vr=null;function Ir(e,t){let n,o,r,i,s=2e8,l=0,a=t.top,c=t.top;for(let d=e.firstChild,h=0;d;d=d.nextSibling,h++){let e;if(1==d.nodeType)e=d.getClientRects();else{if(3!=d.nodeType)continue;e=er(d).getClientRects()}for(let u=0;u<e.length;u++){let p=e[u];if(p.top<=a&&p.bottom>=c){a=Math.max(p.bottom,a),c=Math.min(p.top,c);let e=p.left>t.left?p.left-t.left:p.right<t.left?t.left-p.right:0;if(e<s){n=d,s=e,o=e&&3==n.nodeType?{left:p.right<t.left?p.right:p.left,top:t.top}:t,1==d.nodeType&&e&&(l=h+(t.left>=(p.left+p.right)/2?1:0));continue}}else p.top>t.top&&!r&&p.left<=t.left&&p.right>=t.left&&(r=d,i={left:Math.max(p.left,Math.min(p.right,t.left)),top:p.top});!n&&(t.left>=p.right&&t.top>=p.top||t.left>=p.left&&t.top>=p.bottom)&&(l=h+1)}}return!n&&r&&(n=r,o=i,s=0),n&&3==n.nodeType?function(e,t){let n=e.nodeValue.length,o=document.createRange();for(let r=0;r<n;r++){o.setEnd(e,r+1),o.setStart(e,r);let n=Br(o,1);if(n.top!=n.bottom&&zr(t,n))return{node:e,offset:r+(t.left>=(n.left+n.right)/2?1:0)}}return{node:e,offset:0}}(n,o):!n||s&&1==n.nodeType?{node:e,offset:l}:Ir(n,o)}function zr(e,t){return e.left>=t.left-1&&e.left<=t.right+1&&e.top>=t.top-1&&e.top<=t.bottom+1}function Lr(e,t,n){let o=e.childNodes.length;if(o&&n.top<n.bottom)for(let r=Math.max(0,Math.min(o-1,Math.floor(o*(t.top-n.top)/(n.bottom-n.top))-2)),i=r;;){let n=e.childNodes[i];if(1==n.nodeType){let e=n.getClientRects();for(let o=0;o<e.length;o++){let r=e[o];if(zr(t,r))return Lr(n,t,r)}}if((i=(i+1)%o)==r)break}return e}function Pr(e,t){let n,o=e.dom.ownerDocument,r=0,i=function(e,t,n){if(e.caretPositionFromPoint)try{let o=e.caretPositionFromPoint(t,n);if(o)return{node:o.offsetNode,offset:Math.min(rr(o.offsetNode),o.offset)}}catch(o){}if(e.caretRangeFromPoint){let o=e.caretRangeFromPoint(t,n);if(o)return{node:o.startContainer,offset:Math.min(rr(o.startContainer),o.startOffset)}}}(o,t.left,t.top);i&&({node:n,offset:r}=i);let s,l=(e.root.elementFromPoint?e.root:o).elementFromPoint(t.left,t.top);if(!l||!e.dom.contains(1!=l.nodeType?l.parentNode:l)){let n=e.dom.getBoundingClientRect();if(!zr(t,n))return null;if(l=Lr(e.dom,t,n),!l)return null}if(wr)for(let c=l;n&&c;c=Qo(c))c.draggable&&(n=void 0);if(l=function(e,t){let n=e.parentNode;return n&&/^li$/i.test(n.nodeName)&&t.left<e.getBoundingClientRect().left?n:e}(l,t),n){if(gr&&1==n.nodeType&&(r=Math.min(r,n.childNodes.length),r<n.childNodes.length)){let e,o=n.childNodes[r];"IMG"==o.nodeName&&(e=o.getBoundingClientRect()).right<=t.left&&e.bottom>t.top&&r++}let o;Cr&&r&&1==n.nodeType&&1==(o=n.childNodes[r-1]).nodeType&&"false"==o.contentEditable&&o.getBoundingClientRect().top>=t.top&&r--,n==e.dom&&r==n.childNodes.length-1&&1==n.lastChild.nodeType&&t.top>n.lastChild.getBoundingClientRect().bottom?s=e.state.doc.content.size:0!=r&&1==n.nodeType&&"BR"==n.childNodes[r-1].nodeName||(s=function(e,t,n,o){let r=-1;for(let i=t,s=!1;i!=e.dom;){let t,n=e.docView.nearestDesc(i,!0);if(!n)return null;if(1==n.dom.nodeType&&(n.node.isBlock&&n.parent||!n.contentDOM)&&((t=n.dom.getBoundingClientRect()).width||t.height)&&(n.node.isBlock&&n.parent&&(!s&&t.left>o.left||t.top>o.top?r=n.posBefore:(!s&&t.right<o.left||t.bottom<o.top)&&(r=n.posAfter),s=!0),!n.contentDOM&&r<0&&!n.node.isText))return(n.node.isBlock?o.top<(t.top+t.bottom)/2:o.left<(t.left+t.right)/2)?n.posBefore:n.posAfter;i=n.dom.parentNode}return r>-1?r:e.docView.posFromDOM(t,n,-1)}(e,n,r,t))}null==s&&(s=function(e,t,n){let{node:o,offset:r}=Ir(t,n),i=-1;if(1==o.nodeType&&!o.firstChild){let e=o.getBoundingClientRect();i=e.left!=e.right&&n.left>(e.left+e.right)/2?1:-1}return e.docView.posFromDOM(o,r,i)}(e,l,t));let a=e.docView.nearestDesc(l,!0);return{pos:s,inside:a?a.posAtStart-a.border:-1}}function $r(e){return e.top<e.bottom||e.left<e.right}function Br(e,t){let n=e.getClientRects();if(n.length){let e=n[t<0?0:n.length-1];if($r(e))return e}return Array.prototype.find.call(n,$r)||e.getBoundingClientRect()}const Hr=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function _r(e,t,n){let{node:o,offset:r,atom:i}=e.docView.domFromPos(t,n<0?-1:1),s=Cr||gr;if(3==o.nodeType){if(!s||!Hr.test(o.nodeValue)&&(n<0?r:r!=o.nodeValue.length)){let e=r,t=r,i=n<0?1:-1;return n<0&&!r?(t++,i=-1):n>=0&&r==o.nodeValue.length?(e--,i=1):n<0?e--:t++,Fr(Br(er(o,e,t),i),i<0)}{let e=Br(er(o,r,r),n);if(gr&&r&&/\s/.test(o.nodeValue[r-1])&&r<o.nodeValue.length){let t=Br(er(o,r-1,r-1),-1);if(t.top==e.top){let n=Br(er(o,r,r+1),-1);if(n.top!=e.top)return Fr(n,n.left<t.left)}}return e}}if(!e.state.doc.resolve(t-(i||0)).parent.inlineContent){if(null==i&&r&&(n<0||r==rr(o))){let e=o.childNodes[r-1];if(1==e.nodeType)return jr(e.getBoundingClientRect(),!1)}if(null==i&&r<rr(o)){let e=o.childNodes[r];if(1==e.nodeType)return jr(e.getBoundingClientRect(),!0)}return jr(o.getBoundingClientRect(),n>=0)}if(null==i&&r&&(n<0||r==rr(o))){let e=o.childNodes[r-1],t=3==e.nodeType?er(e,rr(e)-(s?0:1)):1!=e.nodeType||"BR"==e.nodeName&&e.nextSibling?null:e;if(t)return Fr(Br(t,1),!1)}if(null==i&&r<rr(o)){let e=o.childNodes[r];for(;e.pmViewDesc&&e.pmViewDesc.ignoreForCoords;)e=e.nextSibling;let t=e?3==e.nodeType?er(e,0,s?0:1):1==e.nodeType?e:null:null;if(t)return Fr(Br(t,-1),!0)}return Fr(Br(3==o.nodeType?er(o):o,-n),n>=0)}function Fr(e,t){if(0==e.width)return e;let n=t?e.left:e.right;return{top:e.top,bottom:e.bottom,left:n,right:n}}function jr(e,t){if(0==e.height)return e;let n=t?e.top:e.bottom;return{top:n,bottom:n,left:e.left,right:e.right}}function Ur(e,t,n){let o=e.state,r=e.root.activeElement;o!=t&&e.updateState(t),r!=e.dom&&e.focus();try{return n()}finally{o!=t&&e.updateState(o),r!=e.dom&&r&&r.focus()}}const Wr=/[\u0590-\u08ac]/;let qr=null,Kr=null,Jr=!1;function Gr(e,t,n){return qr==t&&Kr==n?Jr:(qr=t,Kr=n,Jr="up"==n||"down"==n?function(e,t,n){let o=t.selection,r="up"==n?o.$from:o.$to;return Ur(e,t,(()=>{let{node:t}=e.docView.domFromPos(r.pos,"up"==n?-1:1);for(;;){let n=e.docView.nearestDesc(t,!0);if(!n)break;if(n.node.isBlock){t=n.contentDOM||n.dom;break}t=n.dom.parentNode}let o=_r(e,r.pos,1);for(let e=t.firstChild;e;e=e.nextSibling){let t;if(1==e.nodeType)t=e.getClientRects();else{if(3!=e.nodeType)continue;t=er(e,0,e.nodeValue.length).getClientRects()}for(let e=0;e<t.length;e++){let r=t[e];if(r.bottom>r.top+1&&("up"==n?o.top-r.top>2*(r.bottom-o.top):r.bottom-o.bottom>2*(o.bottom-r.top)))return!1}}return!0}))}(e,t,n):function(e,t,n){let{$head:o}=t.selection;if(!o.parent.isTextblock)return!1;let r=o.parentOffset,i=!r,s=r==o.parent.content.size,l=e.domSelection();return l?Wr.test(o.parent.textContent)&&l.modify?Ur(e,t,(()=>{let{focusNode:t,focusOffset:r,anchorNode:i,anchorOffset:s}=e.domSelectionRange(),a=l.caretBidiLevel;l.modify("move",n,"character");let c=o.depth?e.docView.domAfterPos(o.before()):e.dom,{focusNode:d,focusOffset:h}=e.domSelectionRange(),u=d&&!c.contains(1==d.nodeType?d:d.parentNode)||t==d&&r==h;try{l.collapse(i,s),t&&(t!=i||r!=s)&&l.extend&&l.extend(t,r)}catch(p){}return null!=a&&(l.caretBidiLevel=a),u})):"left"==n||"backward"==n?i:s:o.pos==o.start()||o.pos==o.end()}(e,t,n))}class Yr{constructor(e,t,n,o){this.parent=e,this.children=t,this.dom=n,this.contentDOM=o,this.dirty=0,n.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,n){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let t=0;t<this.children.length;t++)e+=this.children[t].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let t=0,n=this.posAtStart;;t++){let o=this.children[t];if(o==e)return n;n+=o.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,t,n){if(this.contentDOM&&this.contentDOM.contains(1==e.nodeType?e:e.parentNode)){if(n<0){let n,o;if(e==this.contentDOM)n=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;n=e.previousSibling}for(;n&&(!(o=n.pmViewDesc)||o.parent!=this);)n=n.previousSibling;return n?this.posBeforeChild(o)+o.size:this.posAtStart}{let n,o;if(e==this.contentDOM)n=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;n=e.nextSibling}for(;n&&(!(o=n.pmViewDesc)||o.parent!=this);)n=n.nextSibling;return n?this.posBeforeChild(o):this.posAtEnd}}let o;if(e==this.dom&&this.contentDOM)o=t>Xo(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))o=2&e.compareDocumentPosition(this.contentDOM);else if(this.dom.firstChild){if(0==t)for(let t=e;;t=t.parentNode){if(t==this.dom){o=!1;break}if(t.previousSibling)break}if(null==o&&t==e.childNodes.length)for(let t=e;;t=t.parentNode){if(t==this.dom){o=!0;break}if(t.nextSibling)break}}return(null==o?n>0:o)?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let n=!0,o=e;o;o=o.parentNode){let r,i=this.getDesc(o);if(i&&(!t||i.node)){if(!n||!(r=i.nodeDOM)||(1==r.nodeType?r.contains(1==e.nodeType?e:e.parentNode):r==e))return i;n=!1}}}getDesc(e){let t=e.pmViewDesc;for(let n=t;n;n=n.parent)if(n==this)return t}posFromDOM(e,t,n){for(let o=e;o;o=o.parentNode){let r=this.getDesc(o);if(r)return r.localPosFromDOM(e,t,n)}return-1}descAt(e){for(let t=0,n=0;t<this.children.length;t++){let o=this.children[t],r=n+o.size;if(n==e&&r!=n){for(;!o.border&&o.children.length;)for(let e=0;e<o.children.length;e++){let t=o.children[e];if(t.size){o=t;break}}return o}if(e<r)return o.descAt(e-n-o.border);n=r}}domFromPos(e,t){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let n=0,o=0;for(let r=0;n<this.children.length;n++){let t=this.children[n],i=r+t.size;if(i>e||t instanceof oi){o=e-r;break}r=i}if(o)return this.children[n].domFromPos(o-this.children[n].border,t);for(let r;n&&!(r=this.children[n-1]).size&&r instanceof Xr&&r.side>=0;n--);if(t<=0){let e,o=!0;for(;e=n?this.children[n-1]:null,e&&e.dom.parentNode!=this.contentDOM;n--,o=!1);return e&&t&&o&&!e.border&&!e.domAtom?e.domFromPos(e.size,t):{node:this.contentDOM,offset:e?Xo(e.dom)+1:0}}{let e,o=!0;for(;e=n<this.children.length?this.children[n]:null,e&&e.dom.parentNode!=this.contentDOM;n++,o=!1);return e&&o&&!e.border&&!e.domAtom?e.domFromPos(0,t):{node:this.contentDOM,offset:e?Xo(e.dom):this.contentDOM.childNodes.length}}}parseRange(e,t,n=0){if(0==this.children.length)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let o=-1,r=-1;for(let i=n,s=0;;s++){let n=this.children[s],l=i+n.size;if(-1==o&&e<=l){let r=i+n.border;if(e>=r&&t<=l-n.border&&n.node&&n.contentDOM&&this.contentDOM.contains(n.contentDOM))return n.parseRange(e,t,r);e=i;for(let t=s;t>0;t--){let n=this.children[t-1];if(n.size&&n.dom.parentNode==this.contentDOM&&!n.emptyChildAt(1)){o=Xo(n.dom)+1;break}e-=n.size}-1==o&&(o=0)}if(o>-1&&(l>t||s==this.children.length-1)){t=l;for(let e=s+1;e<this.children.length;e++){let n=this.children[e];if(n.size&&n.dom.parentNode==this.contentDOM&&!n.emptyChildAt(-1)){r=Xo(n.dom);break}t+=n.size}-1==r&&(r=this.contentDOM.childNodes.length);break}i=l}return{node:this.contentDOM,from:e,to:t,fromOffset:o,toOffset:r}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let t=this.children[e<0?0:this.children.length-1];return 0==t.size||t.emptyChildAt(e)}domAfterPos(e){let{node:t,offset:n}=this.domFromPos(e,0);if(1!=t.nodeType||n==t.childNodes.length)throw new RangeError("No node after pos "+e);return t.childNodes[n]}setSelection(e,t,n,o=!1){let r=Math.min(e,t),i=Math.max(e,t);for(let p=0,f=0;p<this.children.length;p++){let s=this.children[p],l=f+s.size;if(r>f&&i<l)return s.setSelection(e-f-s.border,t-f-s.border,n,o);f=l}let s=this.domFromPos(e,e?-1:1),l=t==e?s:this.domFromPos(t,t?-1:1),a=n.root.getSelection(),c=n.domSelectionRange(),d=!1;if((gr||wr)&&e==t){let{node:e,offset:t}=s;if(3==e.nodeType){if(d=!(!t||"\n"!=e.nodeValue[t-1]),d&&t==e.nodeValue.length)for(let n,o=e;o;o=o.parentNode){if(n=o.nextSibling){"BR"==n.nodeName&&(s=l={node:n.parentNode,offset:Xo(n)+1});break}let e=o.pmViewDesc;if(e&&e.node&&e.node.isBlock)break}}else{let n=e.childNodes[t-1];d=n&&("BR"==n.nodeName||"false"==n.contentEditable)}}if(gr&&c.focusNode&&c.focusNode!=l.node&&1==c.focusNode.nodeType){let e=c.focusNode.childNodes[c.focusOffset];e&&"false"==e.contentEditable&&(o=!0)}if(!(o||d&&wr)&&tr(s.node,s.offset,c.anchorNode,c.anchorOffset)&&tr(l.node,l.offset,c.focusNode,c.focusOffset))return;let h=!1;if((a.extend||e==t)&&!d){a.collapse(s.node,s.offset);try{e!=t&&a.extend(l.node,l.offset),h=!0}catch(u){}}if(!h){if(e>t){let e=s;s=l,l=e}let n=document.createRange();n.setEnd(l.node,l.offset),n.setStart(s.node,s.offset),a.removeAllRanges(),a.addRange(n)}}ignoreMutation(e){return!this.contentDOM&&"selection"!=e.type}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,t){for(let n=0,o=0;o<this.children.length;o++){let r=this.children[o],i=n+r.size;if(n==i?e<=i&&t>=n:e<i&&t>n){let o=n+r.border,s=i-r.border;if(e>=o&&t<=s)return this.dirty=e==n||t==i?2:1,void(e!=o||t!=s||!r.contentLost&&r.dom.parentNode==this.contentDOM?r.markDirty(e-o,t-o):r.dirty=3);r.dirty=r.dom!=r.contentDOM||r.dom.parentNode!=this.contentDOM||r.children.length?3:2}n=i}this.dirty=2}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let n=1==e?2:1;t.dirty<n&&(t.dirty=n)}}get domAtom(){return!1}get ignoreForCoords(){return!1}isText(e){return!1}}class Xr extends Yr{constructor(e,t,n,o){let r,i=t.type.toDOM;if("function"==typeof i&&(i=i(n,(()=>r?r.parent?r.parent.posBeforeChild(r):void 0:o))),!t.type.spec.raw){if(1!=i.nodeType){let e=document.createElement("span");e.appendChild(i),i=e}i.contentEditable="false",i.classList.add("ProseMirror-widget")}super(e,[],i,null),this.widget=t,this.widget=t,r=this}matchesWidget(e){return 0==this.dirty&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let t=this.widget.spec.stopEvent;return!!t&&t(e)}ignoreMutation(e){return"selection"!=e.type||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get side(){return this.widget.type.side}}class Qr extends Yr{constructor(e,t,n,o){super(e,[],t,null),this.textDOM=n,this.text=o}get size(){return this.text.length}localPosFromDOM(e,t){return e!=this.textDOM?this.posAtStart+(t?this.size:0):this.posAtStart+t}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return"characterData"===e.type&&e.target.nodeValue==e.oldValue}}class Zr extends Yr{constructor(e,t,n,o,r){super(e,[],n,o),this.mark=t,this.spec=r}static create(e,t,n,o){let r=o.nodeViews[t.type.name],i=r&&r(t,o,n);return i&&i.dom||(i=Rn.renderSpec(document,t.type.spec.toDOM(t,n),null,t.attrs)),new Zr(e,t,i.dom,i.contentDOM||i.dom,i)}parseRule(){return 3&this.dirty||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return 3!=this.dirty&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),0!=this.dirty){let e=this.parent;for(;!e.node;)e=e.parent;e.dirty<this.dirty&&(e.dirty=this.dirty),this.dirty=0}}slice(e,t,n){let o=Zr.create(this.parent,this.mark,!0,n),r=this.children,i=this.size;t<i&&(r=gi(r,t,i,n)),e>0&&(r=gi(r,0,e,n));for(let s=0;s<r.length;s++)r[s].parent=o;return o.children=r,o}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class ei extends Yr{constructor(e,t,n,o,r,i,s,l,a){super(e,[],r,i),this.node=t,this.outerDeco=n,this.innerDeco=o,this.nodeDOM=s}static create(e,t,n,o,r,i){let s,l=r.nodeViews[t.type.name],a=l&&l(t,r,(()=>s?s.parent?s.parent.posBeforeChild(s):void 0:i),n,o),c=a&&a.dom,d=a&&a.contentDOM;if(t.isText)if(c){if(3!=c.nodeType)throw new RangeError("Text must be rendered as a DOM text node")}else c=document.createTextNode(t.text);else if(!c){let e=Rn.renderSpec(document,t.type.spec.toDOM(t),null,t.attrs);({dom:c,contentDOM:d}=e)}d||t.isText||"BR"==c.nodeName||(c.hasAttribute("contenteditable")||(c.contentEditable="false"),t.type.spec.draggable&&(c.draggable=!0));let h=c;return c=hi(c,n,t),a?s=new ri(e,t,n,o,c,d||null,h,a,r,i+1):t.isText?new ni(e,t,n,o,c,h,r):new ei(e,t,n,o,c,d||null,h,r,i+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if("pre"==this.node.type.whitespace&&(e.preserveWhitespace="full"),this.contentDOM)if(this.contentLost){for(let t=this.children.length-1;t>=0;t--){let n=this.children[t];if(this.dom.contains(n.dom.parentNode)){e.contentElement=n.dom.parentNode;break}}e.contentElement||(e.getContent=()=>Nt.empty)}else e.contentElement=this.contentDOM;else e.getContent=()=>this.node.content;return e}matchesNode(e,t,n){return 0==this.dirty&&e.eq(this.node)&&ui(t,this.outerDeco)&&n.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,t){let n=this.node.inlineContent,o=t,r=e.composing?this.localCompositionInfo(e,t):null,i=r&&r.pos>-1?r:null,s=r&&r.pos<0,l=new fi(this,i&&i.node,e);!function(e,t,n,o){let r=t.locals(e),i=0;if(0==r.length){for(let n=0;n<e.childCount;n++){let s=e.child(n);o(s,r,t.forChild(i,s),n),i+=s.nodeSize}return}let s=0,l=[],a=null;for(let c=0;;){let d,h,u,p;for(;s<r.length&&r[s].to==i;){let e=r[s++];e.widget&&(d?(h||(h=[d])).push(e):d=e)}if(d)if(h){h.sort(mi);for(let e=0;e<h.length;e++)n(h[e],c,!!a)}else n(d,c,!!a);if(a)p=-1,u=a,a=null;else{if(!(c<e.childCount))break;p=c,u=e.child(c++)}for(let e=0;e<l.length;e++)l[e].to<=i&&l.splice(e--,1);for(;s<r.length&&r[s].from<=i&&r[s].to>i;)l.push(r[s++]);let f=i+u.nodeSize;if(u.isText){let e=f;s<r.length&&r[s].from<e&&(e=r[s].from);for(let t=0;t<l.length;t++)l[t].to<e&&(e=l[t].to);e<f&&(a=u.cut(e-i),u=u.cut(0,e-i),f=e,p=-1)}else for(;s<r.length&&r[s].to<f;)s++;o(u,u.isInline&&!u.isLeaf?l.filter((e=>!e.inline)):l.slice(),t.forChild(i,u),p),i=f}}(this.node,this.innerDeco,((t,r,i)=>{t.spec.marks?l.syncToMarks(t.spec.marks,n,e):t.type.side>=0&&!i&&l.syncToMarks(r==this.node.childCount?It.none:this.node.child(r).marks,n,e),l.placeWidget(t,e,o)}),((t,i,a,c)=>{let d;l.syncToMarks(t.marks,n,e),l.findNodeMatch(t,i,a,c)||s&&e.state.selection.from>o&&e.state.selection.to<o+t.nodeSize&&(d=l.findIndexWithChild(r.node))>-1&&l.updateNodeAt(t,i,a,d,e)||l.updateNextNode(t,i,a,e,c,o)||l.addNode(t,i,a,e,o),o+=t.nodeSize})),l.syncToMarks([],n,e),this.node.isTextblock&&l.addTextblockHacks(),l.destroyRest(),(l.changed||2==this.dirty)&&(i&&this.protectLocalComposition(e,i),ii(this.contentDOM,this.children,e),kr&&function(e){if("UL"==e.nodeName||"OL"==e.nodeName){let t=e.style.cssText;e.style.cssText=t+"; list-style: square !important",window.getComputedStyle(e).listStyle,e.style.cssText=t}}(this.dom))}localCompositionInfo(e,t){let{from:n,to:o}=e.state.selection;if(!(e.state.selection instanceof Ro)||n<t||o>t+this.node.content.size)return null;let r=e.input.compositionNode;if(!r||!this.dom.contains(r.parentNode))return null;if(this.node.inlineContent){let e=r.nodeValue,i=function(e,t,n,o){for(let r=0,i=0;r<e.childCount&&i<=o;){let s=e.child(r++),l=i;if(i+=s.nodeSize,!s.isText)continue;let a=s.text;for(;r<e.childCount;){let t=e.child(r++);if(i+=t.nodeSize,!t.isText)break;a+=t.text}if(i>=n){if(i>=o&&a.slice(o-t.length-l,o-l)==t)return o-t.length;let e=l<o?a.lastIndexOf(t,o-l-1):-1;if(e>=0&&e+t.length+l>=n)return l+e;if(n==o&&a.length>=o+t.length-l&&a.slice(o-l,o-l+t.length)==t)return o}}return-1}(this.node.content,e,n-t,o-t);return i<0?null:{node:r,pos:i,text:e}}return{node:r,pos:-1,text:""}}protectLocalComposition(e,{node:t,pos:n,text:o}){if(this.getDesc(t))return;let r=t;for(;r.parentNode!=this.contentDOM;r=r.parentNode){for(;r.previousSibling;)r.parentNode.removeChild(r.previousSibling);for(;r.nextSibling;)r.parentNode.removeChild(r.nextSibling);r.pmViewDesc&&(r.pmViewDesc=void 0)}let i=new Qr(this,r,t,o);e.input.compositionNodes.push(i),this.children=gi(this.children,n,n+o.length,e,i)}update(e,t,n,o){return!(3==this.dirty||!e.sameMarkup(this.node))&&(this.updateInner(e,t,n,o),!0)}updateInner(e,t,n,o){this.updateOuterDeco(t),this.node=e,this.innerDeco=n,this.contentDOM&&this.updateChildren(o,this.posAtStart),this.dirty=0}updateOuterDeco(e){if(ui(e,this.outerDeco))return;let t=1!=this.nodeDOM.nodeType,n=this.dom;this.dom=ci(this.dom,this.nodeDOM,ai(this.outerDeco,this.node,t),ai(e,this.node,t)),this.dom!=n&&(n.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){1==this.nodeDOM.nodeType&&this.nodeDOM.classList.add("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||(this.dom.draggable=!0)}deselectNode(){1==this.nodeDOM.nodeType&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||this.dom.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function ti(e,t,n,o,r){hi(o,t,e);let i=new ei(void 0,e,t,n,o,o,o,r,0);return i.contentDOM&&i.updateChildren(r,0),i}class ni extends ei{constructor(e,t,n,o,r,i,s){super(e,t,n,o,r,null,i,s,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,t,n,o){return!(3==this.dirty||0!=this.dirty&&!this.inParent()||!e.sameMarkup(this.node))&&(this.updateOuterDeco(t),0==this.dirty&&e.text==this.node.text||e.text==this.nodeDOM.nodeValue||(this.nodeDOM.nodeValue=e.text,o.trackWrites==this.nodeDOM&&(o.trackWrites=null)),this.node=e,this.dirty=0,!0)}inParent(){let e=this.parent.contentDOM;for(let t=this.nodeDOM;t;t=t.parentNode)if(t==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,t,n){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):super.localPosFromDOM(e,t,n)}ignoreMutation(e){return"characterData"!=e.type&&"selection"!=e.type}slice(e,t,n){let o=this.node.cut(e,t),r=document.createTextNode(o.text);return new ni(this.parent,o,this.outerDeco,this.innerDeco,r,r,n)}markDirty(e,t){super.markDirty(e,t),this.dom==this.nodeDOM||0!=e&&t!=this.nodeDOM.nodeValue.length||(this.dirty=3)}get domAtom(){return!1}isText(e){return this.node.text==e}}class oi extends Yr{parseRule(){return{ignore:!0}}matchesHack(e){return 0==this.dirty&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return"IMG"==this.dom.nodeName}}class ri extends ei{constructor(e,t,n,o,r,i,s,l,a,c){super(e,t,n,o,r,i,s,a,c),this.spec=l}update(e,t,n,o){if(3==this.dirty)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let r=this.spec.update(e,t,n);return r&&this.updateInner(e,t,n,o),r}return!(!this.contentDOM&&!e.isLeaf)&&super.update(e,t,n,o)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,n,o){this.spec.setSelection?this.spec.setSelection(e,t,n.root):super.setSelection(e,t,n,o)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return!!this.spec.stopEvent&&this.spec.stopEvent(e)}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function ii(e,t,n){let o=e.firstChild,r=!1;for(let i=0;i<t.length;i++){let s=t[i],l=s.dom;if(l.parentNode==e){for(;l!=o;)o=pi(o),r=!0;o=o.nextSibling}else r=!0,e.insertBefore(l,o);if(s instanceof Zr){let t=o?o.previousSibling:e.lastChild;ii(s.contentDOM,s.children,n),o=t?t.nextSibling:e.firstChild}}for(;o;)o=pi(o),r=!0;r&&n.trackWrites==e&&(n.trackWrites=null)}const si=function(e){e&&(this.nodeName=e)};si.prototype=Object.create(null);const li=[new si];function ai(e,t,n){if(0==e.length)return li;let o=n?li[0]:new si,r=[o];for(let i=0;i<e.length;i++){let s=e[i].type.attrs;if(s){s.nodeName&&r.push(o=new si(s.nodeName));for(let e in s){let i=s[e];null!=i&&(n&&1==r.length&&r.push(o=new si(t.isInline?"span":"div")),"class"==e?o.class=(o.class?o.class+" ":"")+i:"style"==e?o.style=(o.style?o.style+";":"")+i:"nodeName"!=e&&(o[e]=i))}}}return r}function ci(e,t,n,o){if(n==li&&o==li)return t;let r=t;for(let i=0;i<o.length;i++){let t=o[i],s=n[i];if(i){let n;s&&s.nodeName==t.nodeName&&r!=e&&(n=r.parentNode)&&n.nodeName.toLowerCase()==t.nodeName||(n=document.createElement(t.nodeName),n.pmIsDeco=!0,n.appendChild(r),s=li[0]),r=n}di(r,s||li[0],t)}return r}function di(e,t,n){for(let o in t)"class"==o||"style"==o||"nodeName"==o||o in n||e.removeAttribute(o);for(let o in n)"class"!=o&&"style"!=o&&"nodeName"!=o&&n[o]!=t[o]&&e.setAttribute(o,n[o]);if(t.class!=n.class){let o=t.class?t.class.split(" ").filter(Boolean):[],r=n.class?n.class.split(" ").filter(Boolean):[];for(let t=0;t<o.length;t++)-1==r.indexOf(o[t])&&e.classList.remove(o[t]);for(let t=0;t<r.length;t++)-1==o.indexOf(r[t])&&e.classList.add(r[t]);0==e.classList.length&&e.removeAttribute("class")}if(t.style!=n.style){if(t.style){let n,o=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g;for(;n=o.exec(t.style);)e.style.removeProperty(n[1])}n.style&&(e.style.cssText+=n.style)}}function hi(e,t,n){return ci(e,e,li,ai(t,n,1!=e.nodeType))}function ui(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].type.eq(t[n].type))return!1;return!0}function pi(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}class fi{constructor(e,t,n){this.lock=t,this.view=n,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=function(e,t){let n=t,o=n.children.length,r=e.childCount,i=new Map,s=[];e:for(;r>0;){let l;for(;;)if(o){let e=n.children[o-1];if(!(e instanceof Zr)){l=e,o--;break}n=e,o=e.children.length}else{if(n==t)break e;o=n.parent.children.indexOf(n),n=n.parent}let a=l.node;if(a){if(a!=e.child(r-1))break;--r,i.set(l,r),s.push(l)}}return{index:r,matched:i,matches:s.reverse()}}(e.node.content,e)}destroyBetween(e,t){if(e!=t){for(let n=e;n<t;n++)this.top.children[n].destroy();this.top.children.splice(e,t-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,t,n){let o=0,r=this.stack.length>>1,i=Math.min(r,e.length);for(;o<i&&(o==r-1?this.top:this.stack[o+1<<1]).matchesMark(e[o])&&!1!==e[o].type.spec.spanning;)o++;for(;o<r;)this.destroyRest(),this.top.dirty=0,this.index=this.stack.pop(),this.top=this.stack.pop(),r--;for(;r<e.length;){this.stack.push(this.top,this.index+1);let o=-1;for(let t=this.index;t<Math.min(this.index+3,this.top.children.length);t++){let n=this.top.children[t];if(n.matchesMark(e[r])&&!this.isLocked(n.dom)){o=t;break}}if(o>-1)o>this.index&&(this.changed=!0,this.destroyBetween(this.index,o)),this.top=this.top.children[this.index];else{let o=Zr.create(this.top,e[r],t,n);this.top.children.splice(this.index,0,o),this.top=o,this.changed=!0}this.index=0,r++}}findNodeMatch(e,t,n,o){let r,i=-1;if(o>=this.preMatch.index&&(r=this.preMatch.matches[o-this.preMatch.index]).parent==this.top&&r.matchesNode(e,t,n))i=this.top.children.indexOf(r,this.index);else for(let s=this.index,l=Math.min(this.top.children.length,s+5);s<l;s++){let o=this.top.children[s];if(o.matchesNode(e,t,n)&&!this.preMatch.matched.has(o)){i=s;break}}return!(i<0)&&(this.destroyBetween(this.index,i),this.index++,!0)}updateNodeAt(e,t,n,o,r){let i=this.top.children[o];return 3==i.dirty&&i.dom==i.contentDOM&&(i.dirty=2),!!i.update(e,t,n,r)&&(this.destroyBetween(this.index,o),this.index++,!0)}findIndexWithChild(e){for(;;){let t=e.parentNode;if(!t)return-1;if(t==this.top.contentDOM){let t=e.pmViewDesc;if(t)for(let e=this.index;e<this.top.children.length;e++)if(this.top.children[e]==t)return e;return-1}e=t}}updateNextNode(e,t,n,o,r,i){for(let s=this.index;s<this.top.children.length;s++){let l=this.top.children[s];if(l instanceof ei){let a=this.preMatch.matched.get(l);if(null!=a&&a!=r)return!1;let c,d=l.dom,h=this.isLocked(d)&&!(e.isText&&l.node&&l.node.isText&&l.nodeDOM.nodeValue==e.text&&3!=l.dirty&&ui(t,l.outerDeco));if(!h&&l.update(e,t,n,o))return this.destroyBetween(this.index,s),l.dom!=d&&(this.changed=!0),this.index++,!0;if(!h&&(c=this.recreateWrapper(l,e,t,n,o,i)))return this.destroyBetween(this.index,s),this.top.children[this.index]=c,c.contentDOM&&(c.dirty=2,c.updateChildren(o,i+1),c.dirty=0),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,t,n,o,r,i){if(e.dirty||t.isAtom||!e.children.length||!e.node.content.eq(t.content)||!ui(n,e.outerDeco)||!o.eq(e.innerDeco))return null;let s=ei.create(this.top,t,n,o,r,i);if(s.contentDOM){s.children=e.children,e.children=[];for(let e of s.children)e.parent=s}return e.destroy(),s}addNode(e,t,n,o,r){let i=ei.create(this.top,e,t,n,o,r);i.contentDOM&&i.updateChildren(o,r+1),this.top.children.splice(this.index++,0,i),this.changed=!0}placeWidget(e,t,n){let o=this.index<this.top.children.length?this.top.children[this.index]:null;if(!o||!o.matchesWidget(e)||e!=o.widget&&o.widget.type.toDOM.parentNode){let o=new Xr(this.top,e,t,n);this.top.children.splice(this.index++,0,o),this.changed=!0}else this.index++}addTextblockHacks(){let e=this.top.children[this.index-1],t=this.top;for(;e instanceof Zr;)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof ni)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((wr||vr)&&e&&"false"==e.dom.contentEditable&&this.addHackNode("IMG",t),this.addHackNode("BR",this.top))}addHackNode(e,t){if(t==this.top&&this.index<t.children.length&&t.children[this.index].matchesHack(e))this.index++;else{let n=document.createElement(e);"IMG"==e&&(n.className="ProseMirror-separator",n.alt=""),"BR"==e&&(n.className="ProseMirror-trailingBreak");let o=new oi(this.top,[],n,null);t!=this.top?t.children.push(o):t.children.splice(this.index++,0,o),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||1==e.nodeType&&e.contains(this.lock.parentNode))}}function mi(e,t){return e.type.side-t.type.side}function gi(e,t,n,o,r){let i=[];for(let s=0,l=0;s<e.length;s++){let a=e[s],c=l,d=l+=a.size;c>=n||d<=t?i.push(a):(c<t&&i.push(a.slice(0,t-c,o)),r&&(i.push(r),r=void 0),d>n&&i.push(a.slice(n-c,a.size,o)))}return i}function yi(e,t=null){let n=e.domSelectionRange(),o=e.state.doc;if(!n.focusNode)return null;let r=e.docView.nearestDesc(n.focusNode),i=r&&0==r.size,s=e.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(s<0)return null;let l,a,c=o.resolve(s);if(sr(n)){for(l=s;r&&!r.node;)r=r.parent;let e=r.node;if(r&&e.isAtom&&Io.isSelectable(e)&&r.parent&&(!e.isInline||!function(e,t,n){for(let o=0==t,r=t==rr(e);o||r;){if(e==n)return!0;let t=Xo(e);if(!(e=e.parentNode))return!1;o=o&&0==t,r=r&&t==rr(e)}}(n.focusNode,n.focusOffset,r.dom))){let e=r.posBefore;a=new Io(s==e?c:o.resolve(e))}}else{if(n instanceof e.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let t=s,r=s;for(let o=0;o<n.rangeCount;o++){let i=n.getRangeAt(o);t=Math.min(t,e.docView.posFromDOM(i.startContainer,i.startOffset,1)),r=Math.max(r,e.docView.posFromDOM(i.endContainer,i.endOffset,-1))}if(t<0)return null;[l,s]=r==e.state.selection.anchor?[r,t]:[t,r],c=o.resolve(s)}else l=e.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(l<0)return null}let d=o.resolve(l);if(!a){a=Oi(e,d,c,"pointer"==t||e.state.selection.head<c.pos&&!i?1:-1)}return a}function vi(e){return e.editable?e.hasFocus():Ai(e)&&document.activeElement&&document.activeElement.contains(e.dom)}function bi(e,t=!1){let n=e.state.selection;if(Si(e,n),vi(e)){if(!t&&e.input.mouseDown&&e.input.mouseDown.allowDefault&&vr){let t=e.domSelectionRange(),n=e.domObserver.currentSelection;if(t.anchorNode&&n.anchorNode&&tr(t.anchorNode,t.anchorOffset,n.anchorNode,n.anchorOffset))return e.input.mouseDown.delayedSelectionSync=!0,void e.domObserver.setCurSelection()}if(e.domObserver.disconnectSelection(),e.cursorWrapper)!function(e){let t=e.domSelection(),n=document.createRange();if(!t)return;let o=e.cursorWrapper.dom,r="IMG"==o.nodeName;r?n.setStart(o.parentNode,Xo(o)+1):n.setStart(o,0);n.collapse(!0),t.removeAllRanges(),t.addRange(n),!r&&!e.state.selection.visible&&fr&&mr<=11&&(o.disabled=!0,o.disabled=!1)}(e);else{let o,r,{anchor:i,head:s}=n;!wi||n instanceof Ro||(n.$from.parent.inlineContent||(o=ki(e,n.from)),n.empty||n.$from.parent.inlineContent||(r=ki(e,n.to))),e.docView.setSelection(i,s,e,t),wi&&(o&&Mi(o),r&&Mi(r)),n.visible?e.dom.classList.remove("ProseMirror-hideselection"):(e.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&function(e){let t=e.dom.ownerDocument;t.removeEventListener("selectionchange",e.input.hideSelectionGuard);let n=e.domSelectionRange(),o=n.anchorNode,r=n.anchorOffset;t.addEventListener("selectionchange",e.input.hideSelectionGuard=()=>{n.anchorNode==o&&n.anchorOffset==r||(t.removeEventListener("selectionchange",e.input.hideSelectionGuard),setTimeout((()=>{vi(e)&&!e.state.selection.visible||e.dom.classList.remove("ProseMirror-hideselection")}),20))})}(e))}e.domObserver.setCurSelection(),e.domObserver.connectSelection()}}const wi=wr||vr&&br<63;function ki(e,t){let{node:n,offset:o}=e.docView.domFromPos(t,0),r=o<n.childNodes.length?n.childNodes[o]:null,i=o?n.childNodes[o-1]:null;if(wr&&r&&"false"==r.contentEditable)return xi(r);if(!(r&&"false"!=r.contentEditable||i&&"false"!=i.contentEditable)){if(r)return xi(r);if(i)return xi(i)}}function xi(e){return e.contentEditable="true",wr&&e.draggable&&(e.draggable=!1,e.wasDraggable=!0),e}function Mi(e){e.contentEditable="false",e.wasDraggable&&(e.draggable=!0,e.wasDraggable=null)}function Si(e,t){if(t instanceof Io){let n=e.docView.descAt(t.from);n!=e.lastSelectedViewDesc&&(Ci(e),n&&n.selectNode(),e.lastSelectedViewDesc=n)}else Ci(e)}function Ci(e){e.lastSelectedViewDesc&&(e.lastSelectedViewDesc.parent&&e.lastSelectedViewDesc.deselectNode(),e.lastSelectedViewDesc=void 0)}function Oi(e,t,n,o){return e.someProp("createSelectionBetween",(o=>o(e,t,n)))||Ro.between(t,n,o)}function Ti(e){return!(e.editable&&!e.hasFocus())&&Ai(e)}function Ai(e){let t=e.domSelectionRange();if(!t.anchorNode)return!1;try{return e.dom.contains(3==t.anchorNode.nodeType?t.anchorNode.parentNode:t.anchorNode)&&(e.editable||e.dom.contains(3==t.focusNode.nodeType?t.focusNode.parentNode:t.focusNode))}catch(n){return!1}}function Ei(e,t){let{$anchor:n,$head:o}=e.selection,r=t>0?n.max(o):n.min(o),i=r.parent.inlineContent?r.depth?e.doc.resolve(t>0?r.after():r.before()):null:r;return i&&Ao.findFrom(i,t)}function Ni(e,t){return e.dispatch(e.state.tr.setSelection(t).scrollIntoView()),!0}function Di(e,t,n){let o=e.state.selection;if(!(o instanceof Ro)){if(o instanceof Io&&o.node.isInline)return Ni(e,new Ro(t>0?o.$to:o.$from));{let n=Ei(e.state,t);return!!n&&Ni(e,n)}}if(n.indexOf("s")>-1){let{$head:n}=o,r=n.textOffset?null:t<0?n.nodeBefore:n.nodeAfter;if(!r||r.isText||!r.isLeaf)return!1;let i=e.state.doc.resolve(n.pos+r.nodeSize*(t<0?-1:1));return Ni(e,new Ro(o.$anchor,i))}if(!o.empty)return!1;if(e.endOfTextblock(t>0?"forward":"backward")){let n=Ei(e.state,t);return!!(n&&n instanceof Io)&&Ni(e,n)}if(!(xr&&n.indexOf("m")>-1)){let n,r=o.$head,i=r.textOffset?null:t<0?r.nodeBefore:r.nodeAfter;if(!i||i.isText)return!1;let s=t<0?r.pos-i.nodeSize:r.pos;return!!(i.isAtom||(n=e.docView.descAt(s))&&!n.contentDOM)&&(Io.isSelectable(i)?Ni(e,new Io(t<0?e.state.doc.resolve(r.pos-i.nodeSize):r)):!!Cr&&Ni(e,new Ro(e.state.doc.resolve(t<0?s:s+i.nodeSize))))}}function Ri(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function Vi(e,t){let n=e.pmViewDesc;return n&&0==n.size&&(t<0||e.nextSibling||"BR"!=e.nodeName)}function Ii(e,t){return t<0?function(e){let t=e.domSelectionRange(),n=t.focusNode,o=t.focusOffset;if(!n)return;let r,i,s=!1;gr&&1==n.nodeType&&o<Ri(n)&&Vi(n.childNodes[o],-1)&&(s=!0);for(;;)if(o>0){if(1!=n.nodeType)break;{let e=n.childNodes[o-1];if(Vi(e,-1))r=n,i=--o;else{if(3!=e.nodeType)break;n=e,o=n.nodeValue.length}}}else{if(zi(n))break;{let t=n.previousSibling;for(;t&&Vi(t,-1);)r=n.parentNode,i=Xo(t),t=t.previousSibling;if(t)n=t,o=Ri(n);else{if(n=n.parentNode,n==e.dom)break;o=0}}}s?Li(e,n,o):r&&Li(e,r,i)}(e):function(e){let t=e.domSelectionRange(),n=t.focusNode,o=t.focusOffset;if(!n)return;let r,i,s=Ri(n);for(;;)if(o<s){if(1!=n.nodeType)break;if(!Vi(n.childNodes[o],1))break;r=n,i=++o}else{if(zi(n))break;{let t=n.nextSibling;for(;t&&Vi(t,1);)r=t.parentNode,i=Xo(t)+1,t=t.nextSibling;if(t)n=t,o=0,s=Ri(n);else{if(n=n.parentNode,n==e.dom)break;o=s=0}}}r&&Li(e,r,i)}(e)}function zi(e){let t=e.pmViewDesc;return t&&t.node&&t.node.isBlock}function Li(e,t,n){if(3!=t.nodeType){let e,o;(o=function(e,t){for(;e&&t==e.childNodes.length&&!ir(e);)t=Xo(e)+1,e=e.parentNode;for(;e&&t<e.childNodes.length;){let n=e.childNodes[t];if(3==n.nodeType)return n;if(1==n.nodeType&&"false"==n.contentEditable)break;e=n,t=0}}(t,n))?(t=o,n=0):(e=function(e,t){for(;e&&!t&&!ir(e);)t=Xo(e),e=e.parentNode;for(;e&&t;){let n=e.childNodes[t-1];if(3==n.nodeType)return n;if(1==n.nodeType&&"false"==n.contentEditable)break;t=(e=n).childNodes.length}}(t,n))&&(t=e,n=e.nodeValue.length)}let o=e.domSelection();if(!o)return;if(sr(o)){let e=document.createRange();e.setEnd(t,n),e.setStart(t,n),o.removeAllRanges(),o.addRange(e)}else o.extend&&o.extend(t,n);e.domObserver.setCurSelection();let{state:r}=e;setTimeout((()=>{e.state==r&&bi(e)}),50)}function Pi(e,t){let n=e.state.doc.resolve(t);if(!vr&&!Mr&&n.parent.inlineContent){let o=e.coordsAtPos(t);if(t>n.start()){let n=e.coordsAtPos(t-1),r=(n.top+n.bottom)/2;if(r>o.top&&r<o.bottom&&Math.abs(n.left-o.left)>1)return n.left<o.left?"ltr":"rtl"}if(t<n.end()){let n=e.coordsAtPos(t+1),r=(n.top+n.bottom)/2;if(r>o.top&&r<o.bottom&&Math.abs(n.left-o.left)>1)return n.left>o.left?"ltr":"rtl"}}return"rtl"==getComputedStyle(e.dom).direction?"rtl":"ltr"}function $i(e,t,n){let o=e.state.selection;if(o instanceof Ro&&!o.empty||n.indexOf("s")>-1)return!1;if(xr&&n.indexOf("m")>-1)return!1;let{$from:r,$to:i}=o;if(!r.parent.inlineContent||e.endOfTextblock(t<0?"up":"down")){let n=Ei(e.state,t);if(n&&n instanceof Io)return Ni(e,n)}if(!r.parent.inlineContent){let n=t<0?r:i,s=o instanceof Lo?Ao.near(n,t):Ao.findFrom(n,t);return!!s&&Ni(e,s)}return!1}function Bi(e,t){if(!(e.state.selection instanceof Ro))return!0;let{$head:n,$anchor:o,empty:r}=e.state.selection;if(!n.sameParent(o))return!0;if(!r)return!1;if(e.endOfTextblock(t>0?"forward":"backward"))return!0;let i=!n.textOffset&&(t<0?n.nodeBefore:n.nodeAfter);if(i&&!i.isText){let o=e.state.tr;return t<0?o.delete(n.pos-i.nodeSize,n.pos):o.delete(n.pos,n.pos+i.nodeSize),e.dispatch(o),!0}return!1}function Hi(e,t,n){e.domObserver.stop(),t.contentEditable=n,e.domObserver.start()}function _i(e,t){let n=t.keyCode,o=function(e){let t="";return e.ctrlKey&&(t+="c"),e.metaKey&&(t+="m"),e.altKey&&(t+="a"),e.shiftKey&&(t+="s"),t}(t);if(8==n||xr&&72==n&&"c"==o)return Bi(e,-1)||Ii(e,-1);if(46==n&&!t.shiftKey||xr&&68==n&&"c"==o)return Bi(e,1)||Ii(e,1);if(13==n||27==n)return!0;if(37==n||xr&&66==n&&"c"==o){let t=37==n?"ltr"==Pi(e,e.state.selection.from)?-1:1:-1;return Di(e,t,o)||Ii(e,t)}if(39==n||xr&&70==n&&"c"==o){let t=39==n?"ltr"==Pi(e,e.state.selection.from)?1:-1:1;return Di(e,t,o)||Ii(e,t)}return 38==n||xr&&80==n&&"c"==o?$i(e,-1,o)||Ii(e,-1):40==n||xr&&78==n&&"c"==o?function(e){if(!wr||e.state.selection.$head.parentOffset>0)return!1;let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(t&&1==t.nodeType&&0==n&&t.firstChild&&"false"==t.firstChild.contentEditable){let n=t.firstChild;Hi(e,n,"true"),setTimeout((()=>Hi(e,n,"false")),20)}return!1}(e)||$i(e,1,o)||Ii(e,1):o==(xr?"m":"c")&&(66==n||73==n||89==n||90==n)}function Fi(e,t){e.someProp("transformCopied",(n=>{t=n(t,e)}));let n=[],{content:o,openStart:r,openEnd:i}=t;for(;r>1&&i>1&&1==o.childCount&&1==o.firstChild.childCount;){r--,i--;let e=o.firstChild;n.push(e.type.name,e.attrs!=e.type.defaultAttrs?e.attrs:null),o=e.content}let s=e.someProp("clipboardSerializer")||Rn.fromSchema(e.state.schema),l=Qi(),a=l.createElement("div");a.appendChild(s.serializeFragment(o,{document:l}));let c,d=a.firstChild,h=0;for(;d&&1==d.nodeType&&(c=Yi[d.nodeName.toLowerCase()]);){for(let e=c.length-1;e>=0;e--){let t=l.createElement(c[e]);for(;a.firstChild;)t.appendChild(a.firstChild);a.appendChild(t),h++}d=a.firstChild}return d&&1==d.nodeType&&d.setAttribute("data-pm-slice",`${r} ${i}${h?` -${h}`:""} ${JSON.stringify(n)}`),{dom:a,text:e.someProp("clipboardTextSerializer",(n=>n(t,e)))||t.content.textBetween(0,t.content.size,"\n\n"),slice:t}}function ji(e,t,n,o,r){let i,s,l=r.parent.type.spec.code;if(!n&&!t)return null;let a=t&&(o||l||!n);if(a){if(e.someProp("transformPastedText",(n=>{t=n(t,l||o,e)})),l)return t?new Lt(Nt.from(e.state.schema.text(t.replace(/\r\n?/g,"\n"))),0,0):Lt.empty;let n=e.someProp("clipboardTextParser",(n=>n(t,r,o,e)));if(n)s=n;else{let n=r.marks(),{schema:o}=e.state,s=Rn.fromSchema(o);i=document.createElement("div"),t.split(/(?:\r\n?|\n)+/).forEach((e=>{let t=i.appendChild(document.createElement("p"));e&&t.appendChild(s.serializeNode(o.text(e,n)))}))}}else e.someProp("transformPastedHTML",(t=>{n=t(n,e)})),i=function(e){let t=/^(\s*<meta [^>]*>)*/.exec(e);t&&(e=e.slice(t[0].length));let n,o=Qi().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(e);(n=r&&Yi[r[1].toLowerCase()])&&(e=n.map((e=>"<"+e+">")).join("")+e+n.map((e=>"</"+e+">")).reverse().join(""));if(o.innerHTML=function(e){let t=window.trustedTypes;if(!t)return e;Zi||(Zi=t.createPolicy("ProseMirrorClipboard",{createHTML:e=>e}));return Zi.createHTML(e)}(e),n)for(let i=0;i<n.length;i++)o=o.querySelector(n[i])||o;return o}(n),Cr&&function(e){let t=e.querySelectorAll(vr?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<t.length;n++){let o=t[n];1==o.childNodes.length&&" "==o.textContent&&o.parentNode&&o.parentNode.replaceChild(e.ownerDocument.createTextNode(" "),o)}}(i);let c=i&&i.querySelector("[data-pm-slice]"),d=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(d&&d[3])for(let h=+d[3];h>0;h--){let e=i.firstChild;for(;e&&1!=e.nodeType;)e=e.nextSibling;if(!e)break;i=e}if(!s){let t=e.someProp("clipboardParser")||e.someProp("domParser")||xn.fromSchema(e.state.schema);s=t.parseSlice(i,{preserveWhitespace:!(!a&&!d),context:r,ruleFromNode:e=>"BR"!=e.nodeName||e.nextSibling||!e.parentNode||Ui.test(e.parentNode.nodeName)?null:{ignore:!0}})}if(d)s=function(e,t){if(!e.size)return e;let n,o=e.content.firstChild.type.schema;try{n=JSON.parse(t)}catch(l){return e}let{content:r,openStart:i,openEnd:s}=e;for(let a=n.length-2;a>=0;a-=2){let e=o.nodes[n[a]];if(!e||e.hasRequiredAttrs())break;r=Nt.from(e.create(n[a+1],r)),i++,s++}return new Lt(r,i,s)}(Gi(s,+d[1],+d[2]),d[4]);else if(s=Lt.maxOpen(function(e,t){if(e.childCount<2)return e;for(let n=t.depth;n>=0;n--){let o,r=t.node(n).contentMatchAt(t.index(n)),i=[];if(e.forEach((e=>{if(!i)return;let t,n=r.findWrapping(e.type);if(!n)return i=null;if(t=i.length&&o.length&&qi(n,o,e,i[i.length-1],0))i[i.length-1]=t;else{i.length&&(i[i.length-1]=Ki(i[i.length-1],o.length));let t=Wi(e,n);i.push(t),r=r.matchType(t.type),o=n}})),i)return Nt.from(i)}return e}(s.content,r),!0),s.openStart||s.openEnd){let e=0,t=0;for(let n=s.content.firstChild;e<s.openStart&&!n.type.spec.isolating;e++,n=n.firstChild);for(let n=s.content.lastChild;t<s.openEnd&&!n.type.spec.isolating;t++,n=n.lastChild);s=Gi(s,e,t)}return e.someProp("transformPasted",(t=>{s=t(s,e)})),s}const Ui=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function Wi(e,t,n=0){for(let o=t.length-1;o>=n;o--)e=t[o].create(null,Nt.from(e));return e}function qi(e,t,n,o,r){if(r<e.length&&r<t.length&&e[r]==t[r]){let i=qi(e,t,n,o.lastChild,r+1);if(i)return o.copy(o.content.replaceChild(o.childCount-1,i));if(o.contentMatchAt(o.childCount).matchType(r==e.length-1?n.type:e[r+1]))return o.copy(o.content.append(Nt.from(Wi(n,e,r+1))))}}function Ki(e,t){if(0==t)return e;let n=e.content.replaceChild(e.childCount-1,Ki(e.lastChild,t-1)),o=e.contentMatchAt(e.childCount).fillBefore(Nt.empty,!0);return e.copy(n.append(o))}function Ji(e,t,n,o,r,i){let s=t<0?e.firstChild:e.lastChild,l=s.content;return e.childCount>1&&(i=0),r<o-1&&(l=Ji(l,t,n,o,r+1,i)),r>=n&&(l=t<0?s.contentMatchAt(0).fillBefore(l,i<=r).append(l):l.append(s.contentMatchAt(s.childCount).fillBefore(Nt.empty,!0))),e.replaceChild(t<0?0:e.childCount-1,s.copy(l))}function Gi(e,t,n){return t<e.openStart&&(e=new Lt(Ji(e.content,-1,t,e.openStart,0,e.openEnd),t,e.openEnd)),n<e.openEnd&&(e=new Lt(Ji(e.content,1,n,e.openEnd,0,0),e.openStart,n)),e}const Yi={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let Xi=null;function Qi(){return Xi||(Xi=document.implementation.createHTMLDocument("title"))}let Zi=null;const es={},ts={},ns={touchstart:!0,touchmove:!0};class rs{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:""},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function is(e,t){e.input.lastSelectionOrigin=t,e.input.lastSelectionTime=Date.now()}function ss(e){e.someProp("handleDOMEvents",(t=>{for(let n in t)e.input.eventHandlers[n]||e.dom.addEventListener(n,e.input.eventHandlers[n]=t=>ls(e,t))}))}function ls(e,t){return e.someProp("handleDOMEvents",(n=>{let o=n[t.type];return!!o&&(o(e,t)||t.defaultPrevented)}))}function as(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let n=t.target;n!=e.dom;n=n.parentNode)if(!n||11==n.nodeType||n.pmViewDesc&&n.pmViewDesc.stopEvent(t))return!1;return!0}function cs(e){return{left:e.clientX,top:e.clientY}}function ds(e,t,n,o,r){if(-1==o)return!1;let i=e.state.doc.resolve(o);for(let s=i.depth+1;s>0;s--)if(e.someProp(t,(t=>s>i.depth?t(e,n,i.nodeAfter,i.before(s),r,!0):t(e,n,i.node(s),i.before(s),r,!1))))return!0;return!1}function hs(e,t,n){if(e.focused||e.focus(),e.state.selection.eq(t))return;let o=e.state.tr.setSelection(t);o.setMeta("pointer",!0),e.dispatch(o)}function us(e,t,n,o,r){return ds(e,"handleClickOn",t,n,o)||e.someProp("handleClick",(n=>n(e,t,o)))||(r?function(e,t){if(-1==t)return!1;let n,o,r=e.state.selection;r instanceof Io&&(n=r.node);let i=e.state.doc.resolve(t);for(let s=i.depth+1;s>0;s--){let e=s>i.depth?i.nodeAfter:i.node(s);if(Io.isSelectable(e)){o=n&&r.$from.depth>0&&s>=r.$from.depth&&i.before(r.$from.depth+1)==r.$from.pos?i.before(r.$from.depth):i.before(s);break}}return null!=o&&(hs(e,Io.create(e.state.doc,o)),!0)}(e,n):function(e,t){if(-1==t)return!1;let n=e.state.doc.resolve(t),o=n.nodeAfter;return!!(o&&o.isAtom&&Io.isSelectable(o))&&(hs(e,new Io(n)),!0)}(e,n))}function ps(e,t,n,o){return ds(e,"handleDoubleClickOn",t,n,o)||e.someProp("handleDoubleClick",(n=>n(e,t,o)))}function fs(e,t,n,o){return ds(e,"handleTripleClickOn",t,n,o)||e.someProp("handleTripleClick",(n=>n(e,t,o)))||function(e,t,n){if(0!=n.button)return!1;let o=e.state.doc;if(-1==t)return!!o.inlineContent&&(hs(e,Ro.create(o,0,o.content.size)),!0);let r=o.resolve(t);for(let i=r.depth+1;i>0;i--){let t=i>r.depth?r.nodeAfter:r.node(i),n=r.before(i);if(t.inlineContent)hs(e,Ro.create(o,n+1,n+1+t.content.size));else{if(!Io.isSelectable(t))continue;hs(e,Io.create(o,n))}return!0}}(e,n,o)}function ms(e){return Ms(e)}ts.keydown=(e,t)=>{let n=t;if(e.input.shiftKey=16==n.keyCode||n.shiftKey,!vs(e,n)&&(e.input.lastKeyCode=n.keyCode,e.input.lastKeyCodeTime=Date.now(),!Sr||!vr||13!=n.keyCode))if(229!=n.keyCode&&e.domObserver.forceFlush(),!kr||13!=n.keyCode||n.ctrlKey||n.altKey||n.metaKey)e.someProp("handleKeyDown",(t=>t(e,n)))||_i(e,n)?n.preventDefault():is(e,"key");else{let t=Date.now();e.input.lastIOSEnter=t,e.input.lastIOSEnterFallbackTimeout=setTimeout((()=>{e.input.lastIOSEnter==t&&(e.someProp("handleKeyDown",(t=>t(e,lr(13,"Enter")))),e.input.lastIOSEnter=0)}),200)}},ts.keyup=(e,t)=>{16==t.keyCode&&(e.input.shiftKey=!1)},ts.keypress=(e,t)=>{let n=t;if(vs(e,n)||!n.charCode||n.ctrlKey&&!n.altKey||xr&&n.metaKey)return;if(e.someProp("handleKeyPress",(t=>t(e,n))))return void n.preventDefault();let o=e.state.selection;if(!(o instanceof Ro&&o.$from.sameParent(o.$to))){let t=String.fromCharCode(n.charCode);/[\r\n]/.test(t)||e.someProp("handleTextInput",(n=>n(e,o.$from.pos,o.$to.pos,t)))||e.dispatch(e.state.tr.insertText(t).scrollIntoView()),n.preventDefault()}};const gs=xr?"metaKey":"ctrlKey";es.mousedown=(e,t)=>{let n=t;e.input.shiftKey=n.shiftKey;let o=ms(e),r=Date.now(),i="singleClick";r-e.input.lastClick.time<500&&function(e,t){let n=t.x-e.clientX,o=t.y-e.clientY;return n*n+o*o<100}(n,e.input.lastClick)&&!n[gs]&&("singleClick"==e.input.lastClick.type?i="doubleClick":"doubleClick"==e.input.lastClick.type&&(i="tripleClick")),e.input.lastClick={time:r,x:n.clientX,y:n.clientY,type:i};let s=e.posAtCoords(cs(n));s&&("singleClick"==i?(e.input.mouseDown&&e.input.mouseDown.done(),e.input.mouseDown=new ys(e,s,n,!!o)):("doubleClick"==i?ps:fs)(e,s.pos,s.inside,n)?n.preventDefault():is(e,"pointer"))};class ys{constructor(e,t,n,o){let r,i;if(this.view=e,this.pos=t,this.event=n,this.flushed=o,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!n[gs],this.allowDefault=n.shiftKey,t.inside>-1)r=e.state.doc.nodeAt(t.inside),i=t.inside;else{let n=e.state.doc.resolve(t.pos);r=n.parent,i=n.depth?n.before():0}const s=o?null:n.target,l=s?e.docView.nearestDesc(s,!0):null;this.target=l&&1==l.dom.nodeType?l.dom:null;let{selection:a}=e.state;(0==n.button&&r.type.spec.draggable&&!1!==r.type.spec.selectable||a instanceof Io&&a.from<=i&&a.to>i)&&(this.mightDrag={node:r,pos:i,addAttr:!(!this.target||this.target.draggable),setUneditable:!(!this.target||!gr||this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout((()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")}),20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),is(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout((()=>bi(this.view))),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let t=this.pos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(cs(e))),this.updateAllowDefault(e),this.allowDefault||!t?is(this.view,"pointer"):us(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():0==e.button&&(this.flushed||wr&&this.mightDrag&&!this.mightDrag.node.isAtom||vr&&!this.view.state.selection.visible&&Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to))<=2)?(hs(this.view,Ao.near(this.view.state.doc.resolve(t.pos))),e.preventDefault()):is(this.view,"pointer")}move(e){this.updateAllowDefault(e),is(this.view,"pointer"),0==e.buttons&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}function vs(e,t){return!!e.composing||!!(wr&&Math.abs(t.timeStamp-e.input.compositionEndedAt)<500)&&(e.input.compositionEndedAt=-2e8,!0)}es.touchstart=e=>{e.input.lastTouch=Date.now(),ms(e),is(e,"pointer")},es.touchmove=e=>{e.input.lastTouch=Date.now(),is(e,"pointer")},es.contextmenu=e=>ms(e);const bs=Sr?5e3:-1;function ws(e,t){clearTimeout(e.input.composingTimeout),t>-1&&(e.input.composingTimeout=setTimeout((()=>Ms(e)),t))}function ks(e){for(e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=function(){let e=document.createEvent("Event");return e.initEvent("event",!0,!0),e.timeStamp}());e.input.compositionNodes.length>0;)e.input.compositionNodes.pop().markParentsDirty()}function xs(e){let t=e.domSelectionRange();if(!t.focusNode)return null;let n=function(e,t){for(;;){if(3==e.nodeType&&t)return e;if(1==e.nodeType&&t>0){if("false"==e.contentEditable)return null;t=rr(e=e.childNodes[t-1])}else{if(!e.parentNode||ir(e))return null;t=Xo(e),e=e.parentNode}}}(t.focusNode,t.focusOffset),o=function(e,t){for(;;){if(3==e.nodeType&&t<e.nodeValue.length)return e;if(1==e.nodeType&&t<e.childNodes.length){if("false"==e.contentEditable)return null;e=e.childNodes[t],t=0}else{if(!e.parentNode||ir(e))return null;t=Xo(e)+1,e=e.parentNode}}}(t.focusNode,t.focusOffset);if(n&&o&&n!=o){let t=o.pmViewDesc,r=e.domObserver.lastChangedTextNode;if(n==r||o==r)return r;if(!t||!t.isText(o.nodeValue))return o;if(e.input.compositionNode==o){let e=n.pmViewDesc;if(e&&e.isText(n.nodeValue))return o}}return n||o}function Ms(e,t=!1){if(!(Sr&&e.domObserver.flushingSoon>=0)){if(e.domObserver.forceFlush(),ks(e),t||e.docView&&e.docView.dirty){let n=yi(e);return n&&!n.eq(e.state.selection)?e.dispatch(e.state.tr.setSelection(n)):!e.markCursor&&!t||e.state.selection.empty?e.updateState(e.state):e.dispatch(e.state.tr.deleteSelection()),!0}return!1}}ts.compositionstart=ts.compositionupdate=e=>{if(!e.composing){e.domObserver.flush();let{state:t}=e,n=t.selection.$to;if(t.selection instanceof Ro&&(t.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some((e=>!1===e.type.spec.inclusive))))e.markCursor=e.state.storedMarks||n.marks(),Ms(e,!0),e.markCursor=null;else if(Ms(e,!t.selection.empty),gr&&t.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let t=e.domSelectionRange();for(let n=t.focusNode,o=t.focusOffset;n&&1==n.nodeType&&0!=o;){let t=o<0?n.lastChild:n.childNodes[o-1];if(!t)break;if(3==t.nodeType){let n=e.domSelection();n&&n.collapse(t,t.nodeValue.length);break}n=t,o=-1}}e.input.composing=!0}ws(e,bs)},ts.compositionend=(e,t)=>{e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=t.timeStamp,e.input.compositionPendingChanges=e.domObserver.pendingRecords().length?e.input.compositionID:0,e.input.compositionNode=null,e.input.compositionPendingChanges&&Promise.resolve().then((()=>e.domObserver.flush())),e.input.compositionID++,ws(e,20))};const Ss=fr&&mr<15||kr&&Or<604;function Cs(e,t,n,o,r){let i=ji(e,t,n,o,e.state.selection.$from);if(e.someProp("handlePaste",(t=>t(e,r,i||Lt.empty))))return!0;if(!i)return!1;let s=function(e){return 0==e.openStart&&0==e.openEnd&&1==e.content.childCount?e.content.firstChild:null}(i),l=s?e.state.tr.replaceSelectionWith(s,o):e.state.tr.replaceSelection(i);return e.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function Os(e){let t=e.getData("text/plain")||e.getData("Text");if(t)return t;let n=e.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}es.copy=ts.cut=(e,t)=>{let n=t,o=e.state.selection,r="cut"==n.type;if(o.empty)return;let i=Ss?null:n.clipboardData,s=o.content(),{dom:l,text:a}=Fi(e,s);i?(n.preventDefault(),i.clearData(),i.setData("text/html",l.innerHTML),i.setData("text/plain",a)):function(e,t){if(!e.dom.parentNode)return;let n=e.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(t),n.style.cssText="position: fixed; left: -10000px; top: 10px";let o=getSelection(),r=document.createRange();r.selectNodeContents(t),e.dom.blur(),o.removeAllRanges(),o.addRange(r),setTimeout((()=>{n.parentNode&&n.parentNode.removeChild(n),e.focus()}),50)}(e,l),r&&e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))},ts.paste=(e,t)=>{let n=t;if(e.composing&&!Sr)return;let o=Ss?null:n.clipboardData,r=e.input.shiftKey&&45!=e.input.lastKeyCode;o&&Cs(e,Os(o),o.getData("text/html"),r,n)?n.preventDefault():function(e,t){if(!e.dom.parentNode)return;let n=e.input.shiftKey||e.state.selection.$from.parent.type.spec.code,o=e.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(o.contentEditable="true"),o.style.cssText="position: fixed; left: -10000px; top: 10px",o.focus();let r=e.input.shiftKey&&45!=e.input.lastKeyCode;setTimeout((()=>{e.focus(),o.parentNode&&o.parentNode.removeChild(o),n?Cs(e,o.value,null,r,t):Cs(e,o.textContent,o.innerHTML,r,t)}),50)}(e,n)};class Ts{constructor(e,t,n){this.slice=e,this.move=t,this.node=n}}const As=xr?"altKey":"ctrlKey";function Es(e,t){let n=e.someProp("dragCopies",(e=>!e(t)));return null!=n?n:!t[As]}es.dragstart=(e,t)=>{let n=t,o=e.input.mouseDown;if(o&&o.done(),!n.dataTransfer)return;let r,i=e.state.selection,s=i.empty?null:e.posAtCoords(cs(n));if(s&&s.pos>=i.from&&s.pos<=(i instanceof Io?i.to-1:i.to));else if(o&&o.mightDrag)r=Io.create(e.state.doc,o.mightDrag.pos);else if(n.target&&1==n.target.nodeType){let t=e.docView.nearestDesc(n.target,!0);t&&t.node.type.spec.draggable&&t!=e.docView&&(r=Io.create(e.state.doc,t.posBefore))}let l=(r||e.state.selection).content(),{dom:a,text:c,slice:d}=Fi(e,l);(!n.dataTransfer.files.length||!vr||br>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(Ss?"Text":"text/html",a.innerHTML),n.dataTransfer.effectAllowed="copyMove",Ss||n.dataTransfer.setData("text/plain",c),e.dragging=new Ts(d,Es(e,n),r)},es.dragend=e=>{let t=e.dragging;window.setTimeout((()=>{e.dragging==t&&(e.dragging=null)}),50)},ts.dragover=ts.dragenter=(e,t)=>t.preventDefault(),ts.drop=(e,t)=>{let n=t,o=e.dragging;if(e.dragging=null,!n.dataTransfer)return;let r=e.posAtCoords(cs(n));if(!r)return;let i=e.state.doc.resolve(r.pos),s=o&&o.slice;s?e.someProp("transformPasted",(t=>{s=t(s,e)})):s=ji(e,Os(n.dataTransfer),Ss?null:n.dataTransfer.getData("text/html"),!1,i);let l=!(!o||!Es(e,n));if(e.someProp("handleDrop",(t=>t(e,n,s||Lt.empty,l))))return void n.preventDefault();if(!s)return;n.preventDefault();let a=s?uo(e.state.doc,i.pos,s):i.pos;null==a&&(a=i.pos);let c=e.state.tr;if(l){let{node:e}=o;e?e.replace(c):c.deleteSelection()}let d=c.mapping.map(a),h=0==s.openStart&&0==s.openEnd&&1==s.content.childCount,u=c.doc;if(h?c.replaceRangeWith(d,d,s.content.firstChild):c.replaceRange(d,d,s),c.doc.eq(u))return;let p=c.doc.resolve(d);if(h&&Io.isSelectable(s.content.firstChild)&&p.nodeAfter&&p.nodeAfter.sameMarkup(s.content.firstChild))c.setSelection(new Io(p));else{let t=c.mapping.map(a);c.mapping.maps[c.mapping.maps.length-1].forEach(((e,n,o,r)=>t=r)),c.setSelection(Oi(e,p,c.doc.resolve(t)))}e.focus(),e.dispatch(c.setMeta("uiEvent","drop"))},es.focus=e=>{e.input.lastFocus=Date.now(),e.focused||(e.domObserver.stop(),e.dom.classList.add("ProseMirror-focused"),e.domObserver.start(),e.focused=!0,setTimeout((()=>{e.docView&&e.hasFocus()&&!e.domObserver.currentSelection.eq(e.domSelectionRange())&&bi(e)}),20))},es.blur=(e,t)=>{let n=t;e.focused&&(e.domObserver.stop(),e.dom.classList.remove("ProseMirror-focused"),e.domObserver.start(),n.relatedTarget&&e.dom.contains(n.relatedTarget)&&e.domObserver.currentSelection.clear(),e.focused=!1)},es.beforeinput=(e,t)=>{if(vr&&Sr&&"deleteContentBackward"==t.inputType){e.domObserver.flushSoon();let{domChangeCount:t}=e.input;setTimeout((()=>{if(e.input.domChangeCount!=t)return;if(e.dom.blur(),e.focus(),e.someProp("handleKeyDown",(t=>t(e,lr(8,"Backspace")))))return;let{$cursor:n}=e.state.selection;n&&n.pos>0&&e.dispatch(e.state.tr.delete(n.pos-1,n.pos).scrollIntoView())}),50)}};for(let os in ts)es[os]=ts[os];function Ns(e,t){if(e==t)return!0;for(let n in e)if(e[n]!==t[n])return!1;for(let n in t)if(!(n in e))return!1;return!0}class Ds{constructor(e,t){this.toDOM=e,this.spec=t||Ls,this.side=this.spec.side||0}map(e,t,n,o){let{pos:r,deleted:i}=e.mapResult(t.from+o,this.side<0?-1:1);return i?null:new Is(r-n,r-n,this)}valid(){return!0}eq(e){return this==e||e instanceof Ds&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Ns(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class Rs{constructor(e,t){this.attrs=e,this.spec=t||Ls}map(e,t,n,o){let r=e.map(t.from+o,this.spec.inclusiveStart?-1:1)-n,i=e.map(t.to+o,this.spec.inclusiveEnd?1:-1)-n;return r>=i?null:new Is(r,i,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof Rs&&Ns(this.attrs,e.attrs)&&Ns(this.spec,e.spec)}static is(e){return e.type instanceof Rs}destroy(){}}class Vs{constructor(e,t){this.attrs=e,this.spec=t||Ls}map(e,t,n,o){let r=e.mapResult(t.from+o,1);if(r.deleted)return null;let i=e.mapResult(t.to+o,-1);return i.deleted||i.pos<=r.pos?null:new Is(r.pos-n,i.pos-n,this)}valid(e,t){let n,{index:o,offset:r}=e.content.findIndex(t.from);return r==t.from&&!(n=e.child(o)).isText&&r+n.nodeSize==t.to}eq(e){return this==e||e instanceof Vs&&Ns(this.attrs,e.attrs)&&Ns(this.spec,e.spec)}destroy(){}}class Is{constructor(e,t,n){this.from=e,this.to=t,this.type=n}copy(e,t){return new Is(e,t,this.type)}eq(e,t=0){return this.type.eq(e.type)&&this.from+t==e.from&&this.to+t==e.to}map(e,t,n){return this.type.map(e,this,t,n)}static widget(e,t,n){return new Is(e,e,new Ds(t,n))}static inline(e,t,n,o){return new Is(e,t,new Rs(n,o))}static node(e,t,n,o){return new Is(e,t,new Vs(n,o))}get spec(){return this.type.spec}get inline(){return this.type instanceof Rs}get widget(){return this.type instanceof Ds}}const zs=[],Ls={};class Ps{constructor(e,t){this.local=e.length?e:zs,this.children=t.length?t:zs}static create(e,t){return t.length?js(t,e,0,Ls):$s}find(e,t,n){let o=[];return this.findInner(null==e?0:e,null==t?1e9:t,o,0,n),o}findInner(e,t,n,o,r){for(let i=0;i<this.local.length;i++){let s=this.local[i];s.from<=t&&s.to>=e&&(!r||r(s.spec))&&n.push(s.copy(s.from+o,s.to+o))}for(let i=0;i<this.children.length;i+=3)if(this.children[i]<t&&this.children[i+1]>e){let s=this.children[i]+1;this.children[i+2].findInner(e-s,t-s,n,o+s,r)}}map(e,t,n){return this==$s||0==e.maps.length?this:this.mapInner(e,t,0,0,n||Ls)}mapInner(e,t,n,o,r){let i;for(let s=0;s<this.local.length;s++){let l=this.local[s].map(e,n,o);l&&l.type.valid(t,l)?(i||(i=[])).push(l):r.onRemove&&r.onRemove(this.local[s].spec)}return this.children.length?function(e,t,n,o,r,i,s){let l=e.slice();for(let c=0,d=i;c<n.maps.length;c++){let e=0;n.maps[c].forEach(((t,n,o,r)=>{let i=r-o-(n-t);for(let s=0;s<l.length;s+=3){let o=l[s+1];if(o<0||t>o+d-e)continue;let r=l[s]+d-e;n>=r?l[s+1]=t<=r?-2:-1:t>=d&&i&&(l[s]+=i,l[s+1]+=i)}e+=i})),d=n.maps[c].map(d,-1)}let a=!1;for(let c=0;c<l.length;c+=3)if(l[c+1]<0){if(-2==l[c+1]){a=!0,l[c+1]=-1;continue}let t=n.map(e[c]+i),d=t-r;if(d<0||d>=o.content.size){a=!0;continue}let h=n.map(e[c+1]+i,-1)-r,{index:u,offset:p}=o.content.findIndex(d),f=o.maybeChild(u);if(f&&p==d&&p+f.nodeSize==h){let o=l[c+2].mapInner(n,f,t+1,e[c]+i+1,s);o!=$s?(l[c]=d,l[c+1]=h,l[c+2]=o):(l[c+1]=-2,a=!0)}else a=!0}if(a){let a=function(e,t,n,o,r,i,s){function l(e,t){for(let i=0;i<e.local.length;i++){let l=e.local[i].map(o,r,t);l?n.push(l):s.onRemove&&s.onRemove(e.local[i].spec)}for(let n=0;n<e.children.length;n+=3)l(e.children[n+2],e.children[n]+t+1)}for(let a=0;a<e.length;a+=3)-1==e[a+1]&&l(e[a+2],t[a]+i+1);return n}(l,e,t,n,r,i,s),c=js(a,o,0,s);t=c.local;for(let e=0;e<l.length;e+=3)l[e+1]<0&&(l.splice(e,3),e-=3);for(let e=0,t=0;e<c.children.length;e+=3){let n=c.children[e];for(;t<l.length&&l[t]<n;)t+=3;l.splice(t,0,c.children[e],c.children[e+1],c.children[e+2])}}return new Ps(t.sort(Us),l)}(this.children,i||[],e,t,n,o,r):i?new Ps(i.sort(Us),zs):$s}add(e,t){return t.length?this==$s?Ps.create(e,t):this.addInner(e,t,0):this}addInner(e,t,n){let o,r=0;e.forEach(((e,i)=>{let s,l=i+n;if(s=_s(t,e,l)){for(o||(o=this.children.slice());r<o.length&&o[r]<i;)r+=3;o[r]==i?o[r+2]=o[r+2].addInner(e,s,l+1):o.splice(r,0,i,i+e.nodeSize,js(s,e,l+1,Ls)),r+=3}}));let i=Hs(r?Fs(t):t,-n);for(let s=0;s<i.length;s++)i[s].type.valid(e,i[s])||i.splice(s--,1);return new Ps(i.length?this.local.concat(i).sort(Us):this.local,o||this.children)}remove(e){return 0==e.length||this==$s?this:this.removeInner(e,0)}removeInner(e,t){let n=this.children,o=this.local;for(let r=0;r<n.length;r+=3){let o,i=n[r]+t,s=n[r+1]+t;for(let t,n=0;n<e.length;n++)(t=e[n])&&t.from>i&&t.to<s&&(e[n]=null,(o||(o=[])).push(t));if(!o)continue;n==this.children&&(n=this.children.slice());let l=n[r+2].removeInner(o,i+1);l!=$s?n[r+2]=l:(n.splice(r,3),r-=3)}if(o.length)for(let r,i=0;i<e.length;i++)if(r=e[i])for(let e=0;e<o.length;e++)o[e].eq(r,t)&&(o==this.local&&(o=this.local.slice()),o.splice(e--,1));return n==this.children&&o==this.local?this:o.length||n.length?new Ps(o,n):$s}forChild(e,t){if(this==$s)return this;if(t.isLeaf)return Ps.empty;let n,o;for(let s=0;s<this.children.length;s+=3)if(this.children[s]>=e){this.children[s]==e&&(n=this.children[s+2]);break}let r=e+1,i=r+t.content.size;for(let s=0;s<this.local.length;s++){let e=this.local[s];if(e.from<i&&e.to>r&&e.type instanceof Rs){let t=Math.max(r,e.from)-r,n=Math.min(i,e.to)-r;t<n&&(o||(o=[])).push(e.copy(t,n))}}if(o){let e=new Ps(o.sort(Us),zs);return n?new Bs([e,n]):e}return n||$s}eq(e){if(this==e)return!0;if(!(e instanceof Ps)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let t=0;t<this.local.length;t++)if(!this.local[t].eq(e.local[t]))return!1;for(let t=0;t<this.children.length;t+=3)if(this.children[t]!=e.children[t]||this.children[t+1]!=e.children[t+1]||!this.children[t+2].eq(e.children[t+2]))return!1;return!0}locals(e){return Ws(this.localsInner(e))}localsInner(e){if(this==$s)return zs;if(e.inlineContent||!this.local.some(Rs.is))return this.local;let t=[];for(let n=0;n<this.local.length;n++)this.local[n].type instanceof Rs||t.push(this.local[n]);return t}forEachSet(e){e(this)}}Ps.empty=new Ps([],[]),Ps.removeOverlap=Ws;const $s=Ps.empty;class Bs{constructor(e){this.members=e}map(e,t){const n=this.members.map((n=>n.map(e,t,Ls)));return Bs.from(n)}forChild(e,t){if(t.isLeaf)return Ps.empty;let n=[];for(let o=0;o<this.members.length;o++){let r=this.members[o].forChild(e,t);r!=$s&&(r instanceof Bs?n=n.concat(r.members):n.push(r))}return Bs.from(n)}eq(e){if(!(e instanceof Bs)||e.members.length!=this.members.length)return!1;for(let t=0;t<this.members.length;t++)if(!this.members[t].eq(e.members[t]))return!1;return!0}locals(e){let t,n=!0;for(let o=0;o<this.members.length;o++){let r=this.members[o].localsInner(e);if(r.length)if(t){n&&(t=t.slice(),n=!1);for(let e=0;e<r.length;e++)t.push(r[e])}else t=r}return t?Ws(n?t:t.sort(Us)):zs}static from(e){switch(e.length){case 0:return $s;case 1:return e[0];default:return new Bs(e.every((e=>e instanceof Ps))?e:e.reduce(((e,t)=>e.concat(t instanceof Ps?t:t.members)),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}}function Hs(e,t){if(!t||!e.length)return e;let n=[];for(let o=0;o<e.length;o++){let r=e[o];n.push(new Is(r.from+t,r.to+t,r.type))}return n}function _s(e,t,n){if(t.isLeaf)return null;let o=n+t.nodeSize,r=null;for(let i,s=0;s<e.length;s++)(i=e[s])&&i.from>n&&i.to<o&&((r||(r=[])).push(i),e[s]=null);return r}function Fs(e){let t=[];for(let n=0;n<e.length;n++)null!=e[n]&&t.push(e[n]);return t}function js(e,t,n,o){let r=[],i=!1;t.forEach(((t,s)=>{let l=_s(e,t,s+n);if(l){i=!0;let e=js(l,t,n+s+1,o);e!=$s&&r.push(s,s+t.nodeSize,e)}}));let s=Hs(i?Fs(e):e,-n).sort(Us);for(let l=0;l<s.length;l++)s[l].type.valid(t,s[l])||(o.onRemove&&o.onRemove(s[l].spec),s.splice(l--,1));return s.length||r.length?new Ps(s,r):$s}function Us(e,t){return e.from-t.from||e.to-t.to}function Ws(e){let t=e;for(let n=0;n<t.length-1;n++){let o=t[n];if(o.from!=o.to)for(let r=n+1;r<t.length;r++){let i=t[r];if(i.from!=o.from){i.from<o.to&&(t==e&&(t=e.slice()),t[n]=o.copy(o.from,i.from),qs(t,r,o.copy(i.from,o.to)));break}i.to!=o.to&&(t==e&&(t=e.slice()),t[r]=i.copy(i.from,o.to),qs(t,r+1,i.copy(o.to,i.to)))}}return t}function qs(e,t,n){for(;t<e.length&&Us(n,e[t])>0;)t++;e.splice(t,0,n)}function Ks(e){let t=[];return e.someProp("decorations",(n=>{let o=n(e.state);o&&o!=$s&&t.push(o)})),e.cursorWrapper&&t.push(Ps.create(e.state.doc,[e.cursorWrapper.deco])),Bs.from(t)}const Js={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},Gs=fr&&mr<=11;class Ys{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class Xs{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new Ys,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver((e=>{for(let t=0;t<e.length;t++)this.queue.push(e[t]);fr&&mr<=11&&e.some((e=>"childList"==e.type&&e.removedNodes.length||"characterData"==e.type&&e.oldValue.length>e.target.nodeValue.length))?this.flushSoon():this.flush()})),Gs&&(this.onCharData=e=>{this.queue.push({target:e.target,type:"characterData",oldValue:e.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout((()=>{this.flushingSoon=-1,this.flush()}),20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,Js)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let t=0;t<e.length;t++)this.queue.push(e[t]);window.setTimeout((()=>this.flush()),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout((()=>this.suppressingSelectionUpdates=!1),50)}onSelectionChange(){if(Ti(this.view)){if(this.suppressingSelectionUpdates)return bi(this.view);if(fr&&mr<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&tr(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let t,n=new Set;for(let r=e.focusNode;r;r=Qo(r))n.add(r);for(let r=e.anchorNode;r;r=Qo(r))if(n.has(r)){t=r;break}let o=t&&this.view.docView.nearestDesc(t);return o&&o.ignoreMutation({type:"selection",target:3==t.nodeType?t.parentNode:t})?(this.setCurSelection(),!0):void 0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let t=this.pendingRecords();t.length&&(this.queue=[]);let n=e.domSelectionRange(),o=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(n)&&Ti(e)&&!this.ignoreSelectionChange(n),r=-1,i=-1,s=!1,l=[];if(e.editable)for(let c=0;c<t.length;c++){let e=this.registerMutation(t[c],l);e&&(r=r<0?e.from:Math.min(e.from,r),i=i<0?e.to:Math.max(e.to,i),e.typeOver&&(s=!0))}if(gr&&l.length){let t=l.filter((e=>"BR"==e.nodeName));if(2==t.length){let[e,n]=t;e.parentNode&&e.parentNode.parentNode==n.parentNode?n.remove():e.remove()}else{let{focusNode:n}=this.currentSelection;for(let o of t){let t=o.parentNode;!t||"LI"!=t.nodeName||n&&tl(e,n)==t||o.remove()}}}let a=null;r<0&&o&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&sr(n)&&(a=yi(e))&&a.eq(Ao.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,bi(e),this.currentSelection.set(n),e.scrollToSelection()):(r>-1||o)&&(r>-1&&(e.docView.markDirty(r,i),function(e){if(Qs.has(e))return;if(Qs.set(e,null),-1!==["normal","nowrap","pre-line"].indexOf(getComputedStyle(e.dom).whiteSpace)){if(e.requiresGeckoHackNode=gr,Zs)return;console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),Zs=!0}}(e)),this.handleDOMChange(r,i,s,l),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(n)||bi(e),this.currentSelection.set(n))}registerMutation(e,t){if(t.indexOf(e.target)>-1)return null;let n=this.view.docView.nearestDesc(e.target);if("attributes"==e.type&&(n==this.view.docView||"contenteditable"==e.attributeName||"style"==e.attributeName&&!e.oldValue&&!e.target.getAttribute("style")))return null;if(!n||n.ignoreMutation(e))return null;if("childList"==e.type){for(let n=0;n<e.addedNodes.length;n++){let o=e.addedNodes[n];t.push(o),3==o.nodeType&&(this.lastChangedTextNode=o)}if(n.contentDOM&&n.contentDOM!=n.dom&&!n.contentDOM.contains(e.target))return{from:n.posBefore,to:n.posAfter};let o=e.previousSibling,r=e.nextSibling;if(fr&&mr<=11&&e.addedNodes.length)for(let t=0;t<e.addedNodes.length;t++){let{previousSibling:n,nextSibling:i}=e.addedNodes[t];(!n||Array.prototype.indexOf.call(e.addedNodes,n)<0)&&(o=n),(!i||Array.prototype.indexOf.call(e.addedNodes,i)<0)&&(r=i)}let i=o&&o.parentNode==e.target?Xo(o)+1:0,s=n.localPosFromDOM(e.target,i,-1),l=r&&r.parentNode==e.target?Xo(r):e.target.childNodes.length;return{from:s,to:n.localPosFromDOM(e.target,l,1)}}return"attributes"==e.type?{from:n.posAtStart-n.border,to:n.posAtEnd+n.border}:(this.lastChangedTextNode=e.target,{from:n.posAtStart,to:n.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let Qs=new WeakMap,Zs=!1;function el(e,t){let n=t.startContainer,o=t.startOffset,r=t.endContainer,i=t.endOffset,s=e.domAtPos(e.state.selection.anchor);return tr(s.node,s.offset,r,i)&&([n,o,r,i]=[r,i,n,o]),{anchorNode:n,anchorOffset:o,focusNode:r,focusOffset:i}}function tl(e,t){for(let n=t.parentNode;n&&n!=e.dom;n=n.parentNode){let t=e.docView.nearestDesc(n,!0);if(t&&t.node.isBlock)return n}return null}function nl(e){let t=e.pmViewDesc;if(t)return t.parseRule();if("BR"==e.nodeName&&e.parentNode){if(wr&&/^(ul|ol)$/i.test(e.parentNode.nodeName)){let e=document.createElement("div");return e.appendChild(document.createElement("li")),{skip:e}}if(e.parentNode.lastChild==e||wr&&/^(tr|table)$/i.test(e.parentNode.nodeName))return{ignore:!0}}else if("IMG"==e.nodeName&&e.getAttribute("mark-placeholder"))return{ignore:!0};return null}const ol=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function rl(e,t,n,o,r){let i=e.input.compositionPendingChanges||(e.composing?e.input.compositionID:0);if(e.input.compositionPendingChanges=0,t<0){let t=e.input.lastSelectionTime>Date.now()-50?e.input.lastSelectionOrigin:null,n=yi(e,t);if(n&&!e.state.selection.eq(n)){if(vr&&Sr&&13===e.input.lastKeyCode&&Date.now()-100<e.input.lastKeyCodeTime&&e.someProp("handleKeyDown",(t=>t(e,lr(13,"Enter")))))return;let o=e.state.tr.setSelection(n);"pointer"==t?o.setMeta("pointer",!0):"key"==t&&o.scrollIntoView(),i&&o.setMeta("composition",i),e.dispatch(o)}return}let s=e.state.doc.resolve(t),l=s.sharedDepth(n);t=s.before(l+1),n=e.state.doc.resolve(n).after(l+1);let a,c,d=e.state.selection,h=function(e,t,n){let o,{node:r,fromOffset:i,toOffset:s,from:l,to:a}=e.docView.parseRange(t,n),c=e.domSelectionRange(),d=c.anchorNode;if(d&&e.dom.contains(1==d.nodeType?d:d.parentNode)&&(o=[{node:d,offset:c.anchorOffset}],sr(c)||o.push({node:c.focusNode,offset:c.focusOffset})),vr&&8===e.input.lastKeyCode)for(let g=s;g>i;g--){let e=r.childNodes[g-1],t=e.pmViewDesc;if("BR"==e.nodeName&&!t){s=g;break}if(!t||t.size)break}let h=e.state.doc,u=e.someProp("domParser")||xn.fromSchema(e.state.schema),p=h.resolve(l),f=null,m=u.parse(r,{topNode:p.parent,topMatch:p.parent.contentMatchAt(p.index()),topOpen:!0,from:i,to:s,preserveWhitespace:"pre"!=p.parent.type.whitespace||"full",findPositions:o,ruleFromNode:nl,context:p});if(o&&null!=o[0].pos){let e=o[0].pos,t=o[1]&&o[1].pos;null==t&&(t=e),f={anchor:e+l,head:t+l}}return{doc:m,sel:f,from:l,to:a}}(e,t,n),u=e.state.doc,p=u.slice(h.from,h.to);8===e.input.lastKeyCode&&Date.now()-100<e.input.lastKeyCodeTime?(a=e.state.selection.to,c="end"):(a=e.state.selection.from,c="start"),e.input.lastKeyCode=null;let f=function(e,t,n,o,r){let i=e.findDiffStart(t,n);if(null==i)return null;let{a:s,b:l}=e.findDiffEnd(t,n+e.size,n+t.size);if("end"==r){o-=s+Math.max(0,i-Math.min(s,l))-i}if(s<i&&e.size<t.size){let e=o<=i&&o>=s?i-o:0;i-=e,i&&i<t.size&&ll(t.textBetween(i-1,i+1))&&(i+=e?1:-1),l=i+(l-s),s=i}else if(l<i){let t=o<=i&&o>=l?i-o:0;i-=t,i&&i<e.size&&ll(e.textBetween(i-1,i+1))&&(i+=t?1:-1),s=i+(s-l),l=i}return{start:i,endA:s,endB:l}}(p.content,h.doc.content,h.from,a,c);if(f&&e.input.domChangeCount++,(kr&&e.input.lastIOSEnter>Date.now()-225||Sr)&&r.some((e=>1==e.nodeType&&!ol.test(e.nodeName)))&&(!f||f.endA>=f.endB)&&e.someProp("handleKeyDown",(t=>t(e,lr(13,"Enter")))))return void(e.input.lastIOSEnter=0);if(!f){if(!(o&&d instanceof Ro&&!d.empty&&d.$head.sameParent(d.$anchor))||e.composing||h.sel&&h.sel.anchor!=h.sel.head){if(h.sel){let t=il(e,e.state.doc,h.sel);if(t&&!t.eq(e.state.selection)){let n=e.state.tr.setSelection(t);i&&n.setMeta("composition",i),e.dispatch(n)}}return}f={start:d.from,endA:d.to,endB:d.to}}e.state.selection.from<e.state.selection.to&&f.start==f.endB&&e.state.selection instanceof Ro&&(f.start>e.state.selection.from&&f.start<=e.state.selection.from+2&&e.state.selection.from>=h.from?f.start=e.state.selection.from:f.endA<e.state.selection.to&&f.endA>=e.state.selection.to-2&&e.state.selection.to<=h.to&&(f.endB+=e.state.selection.to-f.endA,f.endA=e.state.selection.to)),fr&&mr<=11&&f.endB==f.start+1&&f.endA==f.start&&f.start>h.from&&"  "==h.doc.textBetween(f.start-h.from-1,f.start-h.from+1)&&(f.start--,f.endA--,f.endB--);let m,g=h.doc.resolveNoCache(f.start-h.from),y=h.doc.resolveNoCache(f.endB-h.from),v=u.resolve(f.start),b=g.sameParent(y)&&g.parent.inlineContent&&v.end()>=f.endA;if((kr&&e.input.lastIOSEnter>Date.now()-225&&(!b||r.some((e=>"DIV"==e.nodeName||"P"==e.nodeName)))||!b&&g.pos<h.doc.content.size&&(!g.sameParent(y)||!g.parent.inlineContent)&&(m=Ao.findFrom(h.doc.resolve(g.pos+1),1,!0))&&m.head>g.pos)&&e.someProp("handleKeyDown",(t=>t(e,lr(13,"Enter")))))return void(e.input.lastIOSEnter=0);if(e.state.selection.anchor>f.start&&function(e,t,n,o,r){if(n-t<=r.pos-o.pos||sl(o,!0,!1)<r.pos)return!1;let i=e.resolve(t);if(!o.parent.isTextblock){let e=i.nodeAfter;return null!=e&&n==t+e.nodeSize}if(i.parentOffset<i.parent.content.size||!i.parent.isTextblock)return!1;let s=e.resolve(sl(i,!0,!0));return!(!s.parent.isTextblock||s.pos>n||sl(s,!0,!1)<n)&&o.parent.content.cut(o.parentOffset).eq(s.parent.content)}(u,f.start,f.endA,g,y)&&e.someProp("handleKeyDown",(t=>t(e,lr(8,"Backspace")))))return void(Sr&&vr&&e.domObserver.suppressSelectionUpdates());vr&&f.endB==f.start&&(e.input.lastChromeDelete=Date.now()),Sr&&!b&&g.start()!=y.start()&&0==y.parentOffset&&g.depth==y.depth&&h.sel&&h.sel.anchor==h.sel.head&&h.sel.head==f.endA&&(f.endB-=2,y=h.doc.resolveNoCache(f.endB-h.from),setTimeout((()=>{e.someProp("handleKeyDown",(function(t){return t(e,lr(13,"Enter"))}))}),20));let w,k,x,M=f.start,S=f.endA;if(b)if(g.pos==y.pos)fr&&mr<=11&&0==g.parentOffset&&(e.domObserver.suppressSelectionUpdates(),setTimeout((()=>bi(e)),20)),w=e.state.tr.delete(M,S),k=u.resolve(f.start).marksAcross(u.resolve(f.endA));else if(f.endA==f.endB&&(x=function(e,t){let n,o,r,i=e.firstChild.marks,s=t.firstChild.marks,l=i,a=s;for(let d=0;d<s.length;d++)l=s[d].removeFromSet(l);for(let d=0;d<i.length;d++)a=i[d].removeFromSet(a);if(1==l.length&&0==a.length)o=l[0],n="add",r=e=>e.mark(o.addToSet(e.marks));else{if(0!=l.length||1!=a.length)return null;o=a[0],n="remove",r=e=>e.mark(o.removeFromSet(e.marks))}let c=[];for(let d=0;d<t.childCount;d++)c.push(r(t.child(d)));if(Nt.from(c).eq(e))return{mark:o,type:n}}(g.parent.content.cut(g.parentOffset,y.parentOffset),v.parent.content.cut(v.parentOffset,f.endA-v.start()))))w=e.state.tr,"add"==x.type?w.addMark(M,S,x.mark):w.removeMark(M,S,x.mark);else if(g.parent.child(g.index()).isText&&g.index()==y.index()-(y.textOffset?0:1)){let t=g.parent.textBetween(g.parentOffset,y.parentOffset);if(e.someProp("handleTextInput",(n=>n(e,M,S,t))))return;w=e.state.tr.insertText(t,M,S)}if(w||(w=e.state.tr.replace(M,S,h.doc.slice(f.start-h.from,f.endB-h.from))),h.sel){let t=il(e,w.doc,h.sel);t&&!(vr&&e.composing&&t.empty&&(f.start!=f.endB||e.input.lastChromeDelete<Date.now()-100)&&(t.head==M||t.head==w.mapping.map(S)-1)||fr&&t.empty&&t.head==M)&&w.setSelection(t)}k&&w.ensureMarks(k),i&&w.setMeta("composition",i),e.dispatch(w.scrollIntoView())}function il(e,t,n){return Math.max(n.anchor,n.head)>t.content.size?null:Oi(e,t.resolve(n.anchor),t.resolve(n.head))}function sl(e,t,n){let o=e.depth,r=t?e.end():e.pos;for(;o>0&&(t||e.indexAfter(o)==e.node(o).childCount);)o--,r++,t=!1;if(n){let t=e.node(o).maybeChild(e.indexAfter(o));for(;t&&!t.isLeaf;)t=t.firstChild,r++}return r}function ll(e){if(2!=e.length)return!1;let t=e.charCodeAt(0),n=e.charCodeAt(1);return t>=56320&&t<=57343&&n>=55296&&n<=56319}class al{constructor(e,t){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new rs,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(pl),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):"function"==typeof e?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=hl(this),dl(this),this.nodeViews=ul(this),this.docView=ti(this.state.doc,cl(this),Ks(this),this.dom,this),this.domObserver=new Xs(this,((e,t,n,o)=>rl(this,e,t,n,o))),this.domObserver.start(),function(e){for(let t in es){let n=es[t];e.dom.addEventListener(t,e.input.eventHandlers[t]=t=>{!as(e,t)||ls(e,t)||!e.editable&&t.type in ts||n(e,t)},ns[t]?{passive:!0}:void 0)}wr&&e.dom.addEventListener("input",(()=>null)),ss(e)}(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let t in e)this._props[t]=e[t];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&ss(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(pl),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let n in this._props)t[n]=this._props[n];t.state=this.state;for(let n in e)t[n]=e[n];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){var n;let o=this.state,r=!1,i=!1;e.storedMarks&&this.composing&&(ks(this),i=!0),this.state=e;let s=o.plugins!=e.plugins||this._props.plugins!=t.plugins;if(s||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let e=ul(this);(function(e,t){let n=0,o=0;for(let r in e){if(e[r]!=t[r])return!0;n++}for(let r in t)o++;return n!=o})(e,this.nodeViews)&&(this.nodeViews=e,r=!0)}(s||t.handleDOMEvents!=this._props.handleDOMEvents)&&ss(this),this.editable=hl(this),dl(this);let l=Ks(this),a=cl(this),c=o.plugins==e.plugins||o.doc.eq(e.doc)?e.scrollToSelection>o.scrollToSelection?"to selection":"preserve":"reset",d=r||!this.docView.matchesNode(e.doc,a,l);!d&&e.selection.eq(o.selection)||(i=!0);let h="preserve"==c&&i&&null==this.dom.style.overflowAnchor&&function(e){let t,n,o=e.dom.getBoundingClientRect(),r=Math.max(0,o.top);for(let i=(o.left+o.right)/2,s=r+1;s<Math.min(innerHeight,o.bottom);s+=5){let o=e.root.elementFromPoint(i,s);if(!o||o==e.dom||!e.dom.contains(o))continue;let l=o.getBoundingClientRect();if(l.top>=r-20){t=o,n=l.top;break}}return{refDOM:t,refTop:n,stack:Dr(e.dom)}}(this);if(i){this.domObserver.stop();let t=d&&(fr||vr)&&!this.composing&&!o.selection.empty&&!e.selection.empty&&function(e,t){let n=Math.min(e.$anchor.sharedDepth(e.head),t.$anchor.sharedDepth(t.head));return e.$anchor.start(n)!=t.$anchor.start(n)}(o.selection,e.selection);if(d){let n=vr?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=xs(this)),!r&&this.docView.update(e.doc,a,l,this)||(this.docView.updateOuterDeco(a),this.docView.destroy(),this.docView=ti(e.doc,a,l,this.dom,this)),n&&!this.trackWrites&&(t=!0)}t||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&function(e){let t=e.docView.domFromPos(e.state.selection.anchor,0),n=e.domSelectionRange();return tr(t.node,t.offset,n.anchorNode,n.anchorOffset)}(this))?bi(this,t):(Si(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(o),(null===(n=this.dragging)||void 0===n?void 0:n.node)&&!o.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,o),"reset"==c?this.dom.scrollTop=0:"to selection"==c?this.scrollToSelection():h&&function({refDOM:e,refTop:t,stack:n}){let o=e?e.getBoundingClientRect().top:0;Rr(n,0==o?0:o-t)}(h)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(e&&this.dom.contains(1==e.nodeType?e:e.parentNode))if(this.someProp("handleScrollToSelection",(e=>e(this))));else if(this.state.selection instanceof Io){let t=this.docView.domAfterPos(this.state.selection.from);1==t.nodeType&&Nr(this,t.getBoundingClientRect(),e)}else Nr(this,this.coordsAtPos(this.state.selection.head,1),e);else;}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(e&&e.plugins==this.state.plugins&&this.directPlugins==this.prevDirectPlugins)for(let t=0;t<this.pluginViews.length;t++){let n=this.pluginViews[t];n.update&&n.update(this,e)}else{this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let e=0;e<this.directPlugins.length;e++){let t=this.directPlugins[e];t.spec.view&&this.pluginViews.push(t.spec.view(this))}for(let e=0;e<this.state.plugins.length;e++){let t=this.state.plugins[e];t.spec.view&&this.pluginViews.push(t.spec.view(this))}}}updateDraggedNode(e,t){let n=e.node,o=-1;if(this.state.doc.nodeAt(n.from)==n.node)o=n.from;else{let e=n.from+(this.state.doc.content.size-t.doc.content.size);(e>0&&this.state.doc.nodeAt(e))==n.node&&(o=e)}this.dragging=new Ts(e.slice,e.move,o<0?void 0:Io.create(this.state.doc,o))}someProp(e,t){let n,o=this._props&&this._props[e];if(null!=o&&(n=t?t(o):o))return n;for(let i=0;i<this.directPlugins.length;i++){let o=this.directPlugins[i].props[e];if(null!=o&&(n=t?t(o):o))return n}let r=this.state.plugins;if(r)for(let i=0;i<r.length;i++){let o=r[i].props[e];if(null!=o&&(n=t?t(o):o))return n}}hasFocus(){if(fr){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if("false"==e.contentEditable)return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&function(e){if(e.setActive)return e.setActive();if(Vr)return e.focus(Vr);let t=Dr(e);e.focus(null==Vr?{get preventScroll(){return Vr={preventScroll:!0},!0}}:void 0),Vr||(Vr=!1,Rr(t,0))}(this.dom),bi(this),this.domObserver.start()}get root(){let e=this._root;if(null==e)for(let t=this.dom.parentNode;t;t=t.parentNode)if(9==t.nodeType||11==t.nodeType&&t.host)return t.getSelection||(Object.getPrototypeOf(t).getSelection=()=>t.ownerDocument.getSelection()),this._root=t;return e||document}updateRoot(){this._root=null}posAtCoords(e){return Pr(this,e)}coordsAtPos(e,t=1){return _r(this,e,t)}domAtPos(e,t=0){return this.docView.domFromPos(e,t)}nodeDOM(e){let t=this.docView.descAt(e);return t?t.nodeDOM:null}posAtDOM(e,t,n=-1){let o=this.docView.posFromDOM(e,t,n);if(null==o)throw new RangeError("DOM position not inside the editor");return o}endOfTextblock(e,t){return Gr(this,t||this.state,e)}pasteHTML(e,t){return Cs(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return Cs(this,e,null,!0,t||new ClipboardEvent("paste"))}serializeForClipboard(e){return Fi(this,e)}destroy(){this.docView&&(!function(e){e.domObserver.stop();for(let t in e.input.eventHandlers)e.dom.removeEventListener(t,e.input.eventHandlers[t]);clearTimeout(e.input.composingTimeout),clearTimeout(e.input.lastIOSEnterFallbackTimeout)}(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Ks(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,Zo=null)}get isDestroyed(){return null==this.docView}dispatchEvent(e){return function(e,t){ls(e,t)||!es[t.type]||!e.editable&&t.type in ts||es[t.type](e,t)}(this,e)}dispatch(e){let t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))}domSelectionRange(){let e=this.domSelection();return e?wr&&11===this.root.nodeType&&function(e){let t=e.activeElement;for(;t&&t.shadowRoot;)t=t.shadowRoot.activeElement;return t}(this.dom.ownerDocument)==this.dom&&function(e,t){if(t.getComposedRanges){let n=t.getComposedRanges(e.root)[0];if(n)return el(e,n)}let n;function o(e){e.preventDefault(),e.stopImmediatePropagation(),n=e.getTargetRanges()[0]}return e.dom.addEventListener("beforeinput",o,!0),document.execCommand("indent"),e.dom.removeEventListener("beforeinput",o,!0),n?el(e,n):null}(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}function cl(e){let t=Object.create(null);return t.class="ProseMirror",t.contenteditable=String(e.editable),e.someProp("attributes",(n=>{if("function"==typeof n&&(n=n(e.state)),n)for(let e in n)"class"==e?t.class+=" "+n[e]:"style"==e?t.style=(t.style?t.style+";":"")+n[e]:t[e]||"contenteditable"==e||"nodeName"==e||(t[e]=String(n[e]))})),t.translate||(t.translate="no"),[Is.node(0,e.state.doc.content.size,t)]}function dl(e){if(e.markCursor){let t=document.createElement("img");t.className="ProseMirror-separator",t.setAttribute("mark-placeholder","true"),t.setAttribute("alt",""),e.cursorWrapper={dom:t,deco:Is.widget(e.state.selection.from,t,{raw:!0,marks:e.markCursor})}}else e.cursorWrapper=null}function hl(e){return!e.someProp("editable",(t=>!1===t(e.state)))}function ul(e){let t=Object.create(null);function n(e){for(let n in e)Object.prototype.hasOwnProperty.call(t,n)||(t[n]=e[n])}return e.someProp("nodeViews",n),e.someProp("markViews",n),t}function pl(e){if(e.spec.state||e.spec.filterTransaction||e.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}for(var fl={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},ml={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},gl="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),yl="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),vl=0;vl<10;vl++)fl[48+vl]=fl[96+vl]=String(vl);for(vl=1;vl<=24;vl++)fl[vl+111]="F"+vl;for(vl=65;vl<=90;vl++)fl[vl]=String.fromCharCode(vl+32),ml[vl]=String.fromCharCode(vl);for(var bl in fl)ml.hasOwnProperty(bl)||(ml[bl]=fl[bl]);const wl="undefined"!=typeof navigator&&/Mac|iP(hone|[oa]d)/.test(navigator.platform);function kl(e){let t,n,o,r,i=e.split(/-(?!$)/),s=i[i.length-1];"Space"==s&&(s=" ");for(let l=0;l<i.length-1;l++){let e=i[l];if(/^(cmd|meta|m)$/i.test(e))r=!0;else if(/^a(lt)?$/i.test(e))t=!0;else if(/^(c|ctrl|control)$/i.test(e))n=!0;else if(/^s(hift)?$/i.test(e))o=!0;else{if(!/^mod$/i.test(e))throw new Error("Unrecognized modifier name: "+e);wl?r=!0:n=!0}}return t&&(s="Alt-"+s),n&&(s="Ctrl-"+s),r&&(s="Meta-"+s),o&&(s="Shift-"+s),s}function xl(e,t,n=!0){return t.altKey&&(e="Alt-"+e),t.ctrlKey&&(e="Ctrl-"+e),t.metaKey&&(e="Meta-"+e),n&&t.shiftKey&&(e="Shift-"+e),e}function Ml(e){let t=function(e){let t=Object.create(null);for(let n in e)t[kl(n)]=e[n];return t}(e);return function(e,n){let o,r=function(e){var t=!(gl&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||yl&&e.shiftKey&&e.key&&1==e.key.length||"Unidentified"==e.key)&&e.key||(e.shiftKey?ml:fl)[e.keyCode]||e.key||"Unidentified";return"Esc"==t&&(t="Escape"),"Del"==t&&(t="Delete"),"Left"==t&&(t="ArrowLeft"),"Up"==t&&(t="ArrowUp"),"Right"==t&&(t="ArrowRight"),"Down"==t&&(t="ArrowDown"),t}(n),i=t[xl(r,n)];if(i&&i(e.state,e.dispatch,e))return!0;if(1==r.length&&" "!=r){if(n.shiftKey){let o=t[xl(r,n,!1)];if(o&&o(e.state,e.dispatch,e))return!0}if((n.shiftKey||n.altKey||n.metaKey||r.charCodeAt(0)>127)&&(o=fl[n.keyCode])&&o!=r){let r=t[xl(o,n)];if(r&&r(e.state,e.dispatch,e))return!0}}return!1}}const Sl=(e,t)=>!e.selection.empty&&(t&&t(e.tr.deleteSelection().scrollIntoView()),!0);function Cl(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock("backward",e):n.parentOffset>0)?null:n}const Ol=(e,t,n)=>{let o=Cl(e,n);if(!o)return!1;let r=Nl(o);if(!r){let n=o.blockRange(),r=n&&no(n);return null!=r&&(t&&t(e.tr.lift(n,r).scrollIntoView()),!0)}let i=r.nodeBefore;if(Hl(e,r,t,-1))return!0;if(0==o.parent.content.size&&(Al(i,"end")||Io.isSelectable(i)))for(let s=o.depth;;s--){let n=po(e.doc,o.before(s),o.after(s),Lt.empty);if(n&&n.slice.size<n.to-n.from){if(t){let o=e.tr.step(n);o.setSelection(Al(i,"end")?Ao.findFrom(o.doc.resolve(o.mapping.map(r.pos,-1)),-1):Io.create(o.doc,r.pos-i.nodeSize)),t(o.scrollIntoView())}return!0}if(1==s||o.node(s-1).childCount>1)break}return!(!i.isAtom||r.depth!=o.depth-1)&&(t&&t(e.tr.delete(r.pos-i.nodeSize,r.pos).scrollIntoView()),!0)};function Tl(e,t,n){let o=t.nodeBefore,r=t.pos-1;for(;!o.isTextblock;r--){if(o.type.spec.isolating)return!1;let e=o.lastChild;if(!e)return!1;o=e}let i=t.nodeAfter,s=t.pos+1;for(;!i.isTextblock;s++){if(i.type.spec.isolating)return!1;let e=i.firstChild;if(!e)return!1;i=e}let l=po(e.doc,r,s,Lt.empty);if(!l||l.from!=r||l instanceof Xn&&l.slice.size>=s-r)return!1;if(n){let t=e.tr.step(l);t.setSelection(Ro.create(t.doc,r)),n(t.scrollIntoView())}return!0}function Al(e,t,n=!1){for(let o=e;o;o="start"==t?o.firstChild:o.lastChild){if(o.isTextblock)return!0;if(n&&1!=o.childCount)return!1}return!1}const El=(e,t,n)=>{let{$head:o,empty:r}=e.selection,i=o;if(!r)return!1;if(o.parent.isTextblock){if(n?!n.endOfTextblock("backward",e):o.parentOffset>0)return!1;i=Nl(o)}let s=i&&i.nodeBefore;return!(!s||!Io.isSelectable(s))&&(t&&t(e.tr.setSelection(Io.create(e.doc,i.pos-s.nodeSize)).scrollIntoView()),!0)};function Nl(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){if(e.index(t)>0)return e.doc.resolve(e.before(t+1));if(e.node(t).type.spec.isolating)break}return null}function Dl(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock("forward",e):n.parentOffset<n.parent.content.size)?null:n}const Rl=(e,t,n)=>{let o=Dl(e,n);if(!o)return!1;let r=Il(o);if(!r)return!1;let i=r.nodeAfter;if(Hl(e,r,t,1))return!0;if(0==o.parent.content.size&&(Al(i,"start")||Io.isSelectable(i))){let n=po(e.doc,o.before(),o.after(),Lt.empty);if(n&&n.slice.size<n.to-n.from){if(t){let o=e.tr.step(n);o.setSelection(Al(i,"start")?Ao.findFrom(o.doc.resolve(o.mapping.map(r.pos)),1):Io.create(o.doc,o.mapping.map(r.pos))),t(o.scrollIntoView())}return!0}}return!(!i.isAtom||r.depth!=o.depth-1)&&(t&&t(e.tr.delete(r.pos,r.pos+i.nodeSize).scrollIntoView()),!0)},Vl=(e,t,n)=>{let{$head:o,empty:r}=e.selection,i=o;if(!r)return!1;if(o.parent.isTextblock){if(n?!n.endOfTextblock("forward",e):o.parentOffset<o.parent.content.size)return!1;i=Il(o)}let s=i&&i.nodeAfter;return!(!s||!Io.isSelectable(s))&&(t&&t(e.tr.setSelection(Io.create(e.doc,i.pos)).scrollIntoView()),!0)};function Il(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){let n=e.node(t);if(e.index(t)+1<n.childCount)return e.doc.resolve(e.after(t+1));if(n.type.spec.isolating)break}return null}const zl=(e,t)=>{let{$head:n,$anchor:o}=e.selection;return!(!n.parent.type.spec.code||!n.sameParent(o))&&(t&&t(e.tr.insertText("\n").scrollIntoView()),!0)};function Ll(e){for(let t=0;t<e.edgeCount;t++){let{type:n}=e.edge(t);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}const Pl=(e,t)=>{let n=e.selection,{$from:o,$to:r}=n;if(n instanceof Lo||o.parent.inlineContent||r.parent.inlineContent)return!1;let i=Ll(r.parent.contentMatchAt(r.indexAfter()));if(!i||!i.isTextblock)return!1;if(t){let n=(!o.parentOffset&&r.index()<r.parent.childCount?o:r).pos,s=e.tr.insert(n,i.createAndFill());s.setSelection(Ro.create(s.doc,n+1)),t(s.scrollIntoView())}return!0},$l=(e,t)=>{let{$cursor:n}=e.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let o=n.before();if(lo(e.doc,o))return t&&t(e.tr.split(o).scrollIntoView()),!0}let o=n.blockRange(),r=o&&no(o);return null!=r&&(t&&t(e.tr.lift(o,r).scrollIntoView()),!0)};const Bl=(e,t)=>{let{$from:n,$to:o}=e.selection;if(e.selection instanceof Io&&e.selection.node.isBlock)return!(!n.parentOffset||!lo(e.doc,n.pos)||(t&&t(e.tr.split(n.pos).scrollIntoView()),0));if(!n.depth)return!1;let r,i,s=[],l=!1,a=!1;for(let u=n.depth;;u--){if(n.node(u).isBlock){l=n.end(u)==n.pos+(n.depth-u),a=n.start(u)==n.pos-(n.depth-u),i=Ll(n.node(u-1).contentMatchAt(n.indexAfter(u-1))),s.unshift(l&&i?{type:i}:null),r=u;break}if(1==u)return!1;s.unshift(null)}let c=e.tr;(e.selection instanceof Ro||e.selection instanceof Lo)&&c.deleteSelection();let d=c.mapping.map(n.pos),h=lo(c.doc,d,s.length,s);if(h||(s[0]=i?{type:i}:null,h=lo(c.doc,d,s.length,s)),!h)return!1;if(c.split(d,s.length,s),!l&&a&&n.node(r).type!=i){let e=c.mapping.map(n.before(r)),t=c.doc.resolve(e);i&&n.node(r-1).canReplaceWith(t.index(),t.index()+1,i)&&c.setNodeMarkup(c.mapping.map(n.before(r)),i)}return t&&t(c.scrollIntoView()),!0};function Hl(e,t,n,o){let r,i,s=t.nodeBefore,l=t.nodeAfter,a=s.type.spec.isolating||l.type.spec.isolating;if(!a&&function(e,t,n){let o=t.nodeBefore,r=t.nodeAfter,i=t.index();return!(!(o&&r&&o.type.compatibleContent(r.type))||(!o.content.size&&t.parent.canReplace(i-1,i)?(n&&n(e.tr.delete(t.pos-o.nodeSize,t.pos).scrollIntoView()),0):!t.parent.canReplace(i,i+1)||!r.isTextblock&&!ao(e.doc,t.pos)||(n&&n(e.tr.join(t.pos).scrollIntoView()),0)))}(e,t,n))return!0;let c=!a&&t.parent.canReplace(t.index(),t.index()+1);if(c&&(r=(i=s.contentMatchAt(s.childCount)).findWrapping(l.type))&&i.matchType(r[0]||l.type).validEnd){if(n){let o=t.pos+l.nodeSize,i=Nt.empty;for(let e=r.length-1;e>=0;e--)i=Nt.from(r[e].create(null,i));i=Nt.from(s.copy(i));let a=e.tr.step(new Qn(t.pos-1,o,t.pos,o,new Lt(i,1,0),r.length,!0)),c=a.doc.resolve(o+2*r.length);c.nodeAfter&&c.nodeAfter.type==s.type&&ao(a.doc,c.pos)&&a.join(c.pos),n(a.scrollIntoView())}return!0}let d=l.type.spec.isolating||o>0&&a?null:Ao.findFrom(t,1),h=d&&d.$from.blockRange(d.$to),u=h&&no(h);if(null!=u&&u>=t.depth)return n&&n(e.tr.lift(h,u).scrollIntoView()),!0;if(c&&Al(l,"start",!0)&&Al(s,"end")){let o=s,r=[];for(;r.push(o),!o.isTextblock;)o=o.lastChild;let i=l,a=1;for(;!i.isTextblock;i=i.firstChild)a++;if(o.canReplace(o.childCount,o.childCount,i.content)){if(n){let o=Nt.empty;for(let e=r.length-1;e>=0;e--)o=Nt.from(r[e].copy(o));n(e.tr.step(new Qn(t.pos-r.length,t.pos+l.nodeSize,t.pos+a,t.pos+l.nodeSize-a,new Lt(o,r.length,0),0,!0)).scrollIntoView())}return!0}}return!1}function _l(e){return function(t,n){let o=t.selection,r=e<0?o.$from:o.$to,i=r.depth;for(;r.node(i).isInline;){if(!i)return!1;i--}return!!r.node(i).isTextblock&&(n&&n(t.tr.setSelection(Ro.create(t.doc,e<0?r.start(i):r.end(i)))),!0)}}const Fl=_l(-1),jl=_l(1);function Ul(e,t=null){return function(n,o){let r=!1;for(let i=0;i<n.selection.ranges.length&&!r;i++){let{$from:{pos:o},$to:{pos:s}}=n.selection.ranges[i];n.doc.nodesBetween(o,s,((o,i)=>{if(r)return!1;if(o.isTextblock&&!o.hasMarkup(e,t))if(o.type==e)r=!0;else{let t=n.doc.resolve(i),o=t.index();r=t.parent.canReplaceWith(o,o+1,e)}}))}if(!r)return!1;if(o){let r=n.tr;for(let o=0;o<n.selection.ranges.length;o++){let{$from:{pos:i},$to:{pos:s}}=n.selection.ranges[o];r.setBlockType(i,s,e,t)}o(r.scrollIntoView())}return!0}}function Wl(...e){return function(t,n,o){for(let r=0;r<e.length;r++)if(e[r](t,n,o))return!0;return!1}}function ql(e,t=null){return function(n,o){let{$from:r,$to:i}=n.selection,s=r.blockRange(i);if(!s)return!1;let l=o?n.tr:null;return!!function(e,t,n,o=null){let r=!1,i=t,s=t.$from.doc;if(t.depth>=2&&t.$from.node(t.depth-1).type.compatibleContent(n)&&0==t.startIndex){if(0==t.$from.index(t.depth-1))return!1;let e=s.resolve(t.start-2);i=new Qt(e,e,t.depth),t.endIndex<t.parent.childCount&&(t=new Qt(t.$from,s.resolve(t.$to.end(t.depth)),t.depth)),r=!0}let l=oo(i,n,o,t);if(!l)return!1;e&&function(e,t,n,o,r){let i=Nt.empty;for(let d=n.length-1;d>=0;d--)i=Nt.from(n[d].type.create(n[d].attrs,i));e.step(new Qn(t.start-(o?2:0),t.end,t.start,t.end,new Lt(i,0,0),n.length,!0));let s=0;for(let d=0;d<n.length;d++)n[d].type==r&&(s=d+1);let l=n.length-s,a=t.start+n.length-(o?2:0),c=t.parent;for(let d=t.startIndex,h=t.endIndex,u=!0;d<h;d++,u=!1)!u&&lo(e.doc,a,l)&&(e.split(a,l),a+=2*l),a+=c.child(d).nodeSize}(e,t,l,r,n);return!0}(l,s,e,t)&&(o&&o(l.scrollIntoView()),!0)}}function Kl(e){return function(t,n){let{$from:o,$to:r}=t.selection,i=o.blockRange(r,(t=>t.childCount>0&&t.firstChild.type==e));return!!i&&(!n||(o.node(i.depth-1).type==e?function(e,t,n,o){let r=e.tr,i=o.end,s=o.$to.end(o.depth);i<s&&(r.step(new Qn(i-1,s,i,s,new Lt(Nt.from(n.create(null,o.parent.copy())),1,0),1,!0)),o=new Qt(r.doc.resolve(o.$from.pos),r.doc.resolve(s),o.depth));const l=no(o);if(null==l)return!1;r.lift(o,l);let a=r.doc.resolve(r.mapping.map(i,-1)-1);ao(r.doc,a.pos)&&a.nodeBefore.type==a.nodeAfter.type&&r.join(a.pos);return t(r.scrollIntoView()),!0}(t,n,e,i):function(e,t,n){let o=e.tr,r=n.parent;for(let p=n.end,f=n.endIndex-1,m=n.startIndex;f>m;f--)p-=r.child(f).nodeSize,o.delete(p-1,p+1);let i=o.doc.resolve(n.start),s=i.nodeAfter;if(o.mapping.map(n.end)!=n.start+i.nodeAfter.nodeSize)return!1;let l=0==n.startIndex,a=n.endIndex==r.childCount,c=i.node(-1),d=i.index(-1);if(!c.canReplace(d+(l?0:1),d+1,s.content.append(a?Nt.empty:Nt.from(r))))return!1;let h=i.pos,u=h+s.nodeSize;return o.step(new Qn(h-(l?1:0),u+(a?1:0),h+1,u-1,new Lt((l?Nt.empty:Nt.from(r.copy(Nt.empty))).append(a?Nt.empty:Nt.from(r.copy(Nt.empty))),l?0:1,a?0:1),l?0:1)),t(o.scrollIntoView()),!0}(t,n,i)))}}function Jl(e){const{state:t,transaction:n}=e;let{selection:o}=n,{doc:r}=n,{storedMarks:i}=n;return{...t,apply:t.apply.bind(t),applyTransaction:t.applyTransaction.bind(t),plugins:t.plugins,schema:t.schema,reconfigure:t.reconfigure.bind(t),toJSON:t.toJSON.bind(t),get storedMarks(){return i},get selection(){return o},get doc(){return r},get tr(){return o=n.selection,r=n.doc,i=n.storedMarks,n}}}Wl(Sl,Ol,El),Wl(Sl,Rl,Vl),Wl(zl,Pl,$l,Bl),"undefined"!=typeof navigator?/Mac|iP(hone|[oa]d)/.test(navigator.platform):"undefined"!=typeof os&&os.platform&&os.platform();class Gl{constructor(e){this.editor=e.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=e.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:e,editor:t,state:n}=this,{view:o}=t,{tr:r}=n,i=this.buildProps(r);return Object.fromEntries(Object.entries(e).map((([e,t])=>[e,(...e)=>{const n=t(...e)(i);return r.getMeta("preventDispatch")||this.hasCustomState||o.dispatch(r),n}])))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,t=!0){const{rawCommands:n,editor:o,state:r}=this,{view:i}=o,s=[],l=!!e,a=e||r.tr,c={...Object.fromEntries(Object.entries(n).map((([e,n])=>[e,(...e)=>{const o=this.buildProps(a,t),r=n(...e)(o);return s.push(r),c}]))),run:()=>(l||!t||a.getMeta("preventDispatch")||this.hasCustomState||i.dispatch(a),s.every((e=>!0===e)))};return c}createCan(e){const{rawCommands:t,state:n}=this,o=!1,r=e||n.tr,i=this.buildProps(r,o);return{...Object.fromEntries(Object.entries(t).map((([e,t])=>[e,(...e)=>t(...e)({...i,dispatch:void 0})]))),chain:()=>this.createChain(r,o)}}buildProps(e,t=!0){const{rawCommands:n,editor:o,state:r}=this,{view:i}=o,s={tr:e,editor:o,view:i,state:Jl({state:r,transaction:e}),dispatch:t?()=>{}:void 0,chain:()=>this.createChain(e,t),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(n).map((([e,t])=>[e,(...e)=>t(...e)(s)])))}};return s}}class Yl{constructor(){this.callbacks={}}on(e,t){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(t),this}emit(e,...t){const n=this.callbacks[e];return n&&n.forEach((e=>e.apply(this,t))),this}off(e,t){const n=this.callbacks[e];return n&&(t?this.callbacks[e]=n.filter((e=>e!==t)):delete this.callbacks[e]),this}once(e,t){const n=(...o)=>{this.off(e,n),t.apply(this,o)};return this.on(e,n)}removeAllListeners(){this.callbacks={}}}function Xl(e,t,n){if(void 0===e.config[t]&&e.parent)return Xl(e.parent,t,n);if("function"==typeof e.config[t]){return e.config[t].bind({...n,parent:e.parent?Xl(e.parent,t,n):null})}return e.config[t]}function Ql(e){return{baseExtensions:e.filter((e=>"extension"===e.type)),nodeExtensions:e.filter((e=>"node"===e.type)),markExtensions:e.filter((e=>"mark"===e.type))}}function Zl(e){const t=[],{nodeExtensions:n,markExtensions:o}=Ql(e),r=[...n,...o],i={default:null,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return e.forEach((e=>{const n=Xl(e,"addGlobalAttributes",{name:e.name,options:e.options,storage:e.storage,extensions:r});if(!n)return;n().forEach((e=>{e.types.forEach((n=>{Object.entries(e.attributes).forEach((([e,o])=>{t.push({type:n,name:e,attribute:{...i,...o}})}))}))}))})),r.forEach((e=>{const n={name:e.name,options:e.options,storage:e.storage},o=Xl(e,"addAttributes",n);if(!o)return;const r=o();Object.entries(r).forEach((([n,o])=>{const r={...i,...o};"function"==typeof(null==r?void 0:r.default)&&(r.default=r.default()),(null==r?void 0:r.isRequired)&&void 0===(null==r?void 0:r.default)&&delete r.default,t.push({type:e.name,name:n,attribute:r})}))})),t}function ea(e,t){if("string"==typeof e){if(!t.nodes[e])throw Error(`There is no node type named '${e}'. Maybe you forgot to add the extension?`);return t.nodes[e]}return e}function ta(...e){return e.filter((e=>!!e)).reduce(((e,t)=>{const n={...e};return Object.entries(t).forEach((([e,t])=>{if(n[e])if("class"===e){const o=t?String(t).split(" "):[],r=n[e]?n[e].split(" "):[],i=o.filter((e=>!r.includes(e)));n[e]=[...r,...i].join(" ")}else if("style"===e){const o=t?t.split(";").map((e=>e.trim())).filter(Boolean):[],r=n[e]?n[e].split(";").map((e=>e.trim())).filter(Boolean):[],i=new Map;r.forEach((e=>{const[t,n]=e.split(":").map((e=>e.trim()));i.set(t,n)})),o.forEach((e=>{const[t,n]=e.split(":").map((e=>e.trim()));i.set(t,n)})),n[e]=Array.from(i.entries()).map((([e,t])=>`${e}: ${t}`)).join("; ")}else n[e]=t;else n[e]=t})),n}),{})}function na(e,t){return t.filter((t=>t.type===e.type.name)).filter((e=>e.attribute.rendered)).map((t=>t.attribute.renderHTML?t.attribute.renderHTML(e.attrs)||{}:{[t.name]:e.attrs[t.name]})).reduce(((e,t)=>ta(e,t)),{})}function oa(e){return"function"==typeof e}function ra(e,t=void 0,...n){return oa(e)?t?e.bind(t)(...n):e(...n):e}function ia(e,t){return"style"in e?e:{...e,getAttrs:n=>{const o=e.getAttrs?e.getAttrs(n):e.attrs;if(!1===o)return!1;const r=t.reduce(((e,t)=>{const o=t.attribute.parseHTML?t.attribute.parseHTML(n):function(e){return"string"!=typeof e?e:e.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(e):"true"===e||"false"!==e&&e}(n.getAttribute(t.name));return null==o?e:{...e,[t.name]:o}}),{});return{...o,...r}}}}function sa(e){return Object.fromEntries(Object.entries(e).filter((([e,t])=>("attrs"!==e||!function(e={}){return 0===Object.keys(e).length&&e.constructor===Object}(t))&&null!=t)))}function la(e,t){return t.nodes[e]||t.marks[e]||null}function aa(e,t){return Array.isArray(t)?t.some((t=>("string"==typeof t?t:t.name)===e.name)):t}function ca(e,t){const n=Rn.fromSchema(t).serializeFragment(e),o=document.implementation.createHTMLDocument().createElement("div");return o.appendChild(n),o.innerHTML}function da(e){return"[object RegExp]"===Object.prototype.toString.call(e)}class ha{constructor(e){this.find=e.find,this.handler=e.handler}}function ua(e){var t;const{editor:n,from:o,to:r,text:i,rules:s,plugin:l}=e,{view:a}=n;if(a.composing)return!1;const c=a.state.doc.resolve(o);if(c.parent.type.spec.code||(null===(t=c.nodeBefore||c.nodeAfter)||void 0===t?void 0:t.marks.find((e=>e.type.spec.code))))return!1;let d=!1;const h=((e,t=500)=>{let n="";const o=e.parentOffset;return e.parent.nodesBetween(Math.max(0,o-t),o,((e,t,r,i)=>{var s,l;const a=(null===(l=(s=e.type.spec).toText)||void 0===l?void 0:l.call(s,{node:e,pos:t,parent:r,index:i}))||e.textContent||"%leaf%";n+=e.isAtom&&!e.isText?a:a.slice(0,Math.max(0,o-t))})),n})(c)+i;return s.forEach((e=>{if(d)return;const t=((e,t)=>{if(da(t))return t.exec(e);const n=t(e);if(!n)return null;const o=[n.text];return o.index=n.index,o.input=e,o.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),o.push(n.replaceWith)),o})(h,e.find);if(!t)return;const s=a.state.tr,c=Jl({state:a.state,transaction:s}),u={from:o-(t[0].length-i.length),to:r},{commands:p,chain:f,can:m}=new Gl({editor:n,state:c});null!==e.handler({state:c,range:u,match:t,commands:p,chain:f,can:m})&&s.steps.length&&(s.setMeta(l,{transform:s,from:o,to:r,text:i}),a.dispatch(s),d=!0)})),d}function pa(e){const{editor:t,rules:n}=e,o=new Ko({state:{init:()=>null,apply(e,r,i){const s=e.getMeta(o);if(s)return s;const l=e.getMeta("applyInputRules");return!!l&&setTimeout((()=>{let{text:e}=l;"string"==typeof e||(e=ca(Nt.from(e),i.schema));const{from:r}=l,s=r+e.length;ua({editor:t,from:r,to:s,text:e,rules:n,plugin:o})})),e.selectionSet||e.docChanged?null:r}},props:{handleTextInput:(e,r,i,s)=>ua({editor:t,from:r,to:i,text:s,rules:n,plugin:o}),handleDOMEvents:{compositionend:e=>(setTimeout((()=>{const{$cursor:r}=e.state.selection;r&&ua({editor:t,from:r.pos,to:r.pos,text:"",rules:n,plugin:o})})),!1)},handleKeyDown(e,r){if("Enter"!==r.key)return!1;const{$cursor:i}=e.state.selection;return!!i&&ua({editor:t,from:i.pos,to:i.pos,text:"\n",rules:n,plugin:o})}},isInputRules:!0});return o}function fa(e){return"Object"===function(e){return Object.prototype.toString.call(e).slice(8,-1)}(e)&&(e.constructor===Object&&Object.getPrototypeOf(e)===Object.prototype)}function ma(e,t){const n={...e};return fa(e)&&fa(t)&&Object.keys(t).forEach((o=>{fa(t[o])&&fa(e[o])?n[o]=ma(e[o],t[o]):n[o]=t[o]})),n}class ga{constructor(e={}){this.type="mark",this.name="mark",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=ra(Xl(this,"addOptions",{name:this.name}))),this.storage=ra(Xl(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new ga(e)}configure(e={}){const t=this.extend({...this.config,addOptions:()=>ma(this.options,e)});return t.name=this.name,t.parent=this.parent,t}extend(e={}){const t=new ga(e);return t.parent=this,this.child=t,t.name=e.name?e.name:t.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${t.name}".`),t.options=ra(Xl(t,"addOptions",{name:t.name})),t.storage=ra(Xl(t,"addStorage",{name:t.name,options:t.options})),t}static handleExit({editor:e,mark:t}){const{tr:n}=e.state,o=e.state.selection.$from;if(o.pos===o.end()){const r=o.marks();if(!!!r.find((e=>(null==e?void 0:e.type.name)===t.name)))return!1;const i=r.find((e=>(null==e?void 0:e.type.name)===t.name));return i&&n.removeStoredMark(i),n.insertText(" ",o.pos),e.view.dispatch(n),!0}return!1}}class ya{constructor(e){this.find=e.find,this.handler=e.handler}}function va(e){const{editor:t,state:n,from:o,to:r,rule:i,pasteEvent:s,dropEvent:l}=e,{commands:a,chain:c,can:d}=new Gl({editor:t,state:n}),h=[];n.doc.nodesBetween(o,r,((e,t)=>{if(!e.isTextblock||e.type.spec.code)return;const u=Math.max(o,t),p=Math.min(r,t+e.content.size);((e,t,n)=>{if(da(t))return[...e.matchAll(t)];const o=t(e,n);return o?o.map((t=>{const n=[t.text];return n.index=t.index,n.input=e,n.data=t.data,t.replaceWith&&(t.text.includes(t.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),n.push(t.replaceWith)),n})):[]})(e.textBetween(u-t,p-t,void 0,""),i.find,s).forEach((e=>{if(void 0===e.index)return;const t=u+e.index+1,o=t+e[0].length,r={from:n.tr.mapping.map(t),to:n.tr.mapping.map(o)},p=i.handler({state:n,range:r,match:e,commands:a,chain:c,can:d,pasteEvent:s,dropEvent:l});h.push(p)}))}));return h.every((e=>null!==e))}let ba=null;function wa(e){const{editor:t,rules:n}=e;let o,r=null,i=!1,s=!1,l="undefined"!=typeof ClipboardEvent?new ClipboardEvent("paste"):null;try{o="undefined"!=typeof DragEvent?new DragEvent("drop"):null}catch{o=null}const a=({state:e,from:n,to:r,rule:i,pasteEvt:s})=>{const a=e.tr,c=Jl({state:e,transaction:a});if(va({editor:t,state:c,from:Math.max(n-1,0),to:r.b-1,rule:i,pasteEvent:s,dropEvent:o})&&a.steps.length){try{o="undefined"!=typeof DragEvent?new DragEvent("drop"):null}catch{o=null}return l="undefined"!=typeof ClipboardEvent?new ClipboardEvent("paste"):null,a}};return n.map((e=>new Ko({view(e){const n=n=>{var o;r=(null===(o=e.dom.parentElement)||void 0===o?void 0:o.contains(n.target))?e.dom.parentElement:null,r&&(ba=t)},o=()=>{ba&&(ba=null)};return window.addEventListener("dragstart",n),window.addEventListener("dragend",o),{destroy(){window.removeEventListener("dragstart",n),window.removeEventListener("dragend",o)}}},props:{handleDOMEvents:{drop:(e,t)=>{if(s=r===e.dom.parentElement,o=t,!s){const e=ba;e&&setTimeout((()=>{const t=e.state.selection;t&&e.commands.deleteRange({from:t.from,to:t.to})}),10)}return!1},paste:(e,t)=>{var n;const o=null===(n=t.clipboardData)||void 0===n?void 0:n.getData("text/html");return l=t,i=!!(null==o?void 0:o.includes("data-pm-slice")),!1}}},appendTransaction:(t,n,o)=>{const r=t[0],c="paste"===r.getMeta("uiEvent")&&!i,d="drop"===r.getMeta("uiEvent")&&!s,h=r.getMeta("applyPasteRules"),u=!!h;if(!c&&!d&&!u)return;if(u){let{text:t}=h;"string"==typeof t||(t=ca(Nt.from(t),o.schema));const{from:n}=h,r=n+t.length,i=(e=>{var t;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return null===(t=n.clipboardData)||void 0===t||t.setData("text/html",e),n})(t);return a({rule:e,state:o,from:n,to:{b:r},pasteEvt:i})}const p=n.doc.content.findDiffStart(o.doc.content),f=n.doc.content.findDiffEnd(o.doc.content);return"number"==typeof p&&f&&p!==f.b?a({rule:e,state:o,from:p,to:f,pasteEvt:l}):void 0}})))}class ka{constructor(e,t){this.splittableMarks=[],this.editor=t,this.extensions=ka.resolve(e),this.schema=function(e,t){var n;const o=Zl(e),{nodeExtensions:r,markExtensions:i}=Ql(e),s=null===(n=r.find((e=>Xl(e,"topNode"))))||void 0===n?void 0:n.name,l=Object.fromEntries(r.map((n=>{const r=o.filter((e=>e.type===n.name)),i={name:n.name,options:n.options,storage:n.storage,editor:t},s=sa({...e.reduce(((e,t)=>{const o=Xl(t,"extendNodeSchema",i);return{...e,...o?o(n):{}}}),{}),content:ra(Xl(n,"content",i)),marks:ra(Xl(n,"marks",i)),group:ra(Xl(n,"group",i)),inline:ra(Xl(n,"inline",i)),atom:ra(Xl(n,"atom",i)),selectable:ra(Xl(n,"selectable",i)),draggable:ra(Xl(n,"draggable",i)),code:ra(Xl(n,"code",i)),whitespace:ra(Xl(n,"whitespace",i)),linebreakReplacement:ra(Xl(n,"linebreakReplacement",i)),defining:ra(Xl(n,"defining",i)),isolating:ra(Xl(n,"isolating",i)),attrs:Object.fromEntries(r.map((e=>{var t;return[e.name,{default:null===(t=null==e?void 0:e.attribute)||void 0===t?void 0:t.default}]})))}),l=ra(Xl(n,"parseHTML",i));l&&(s.parseDOM=l.map((e=>ia(e,r))));const a=Xl(n,"renderHTML",i);a&&(s.toDOM=e=>a({node:e,HTMLAttributes:na(e,r)}));const c=Xl(n,"renderText",i);return c&&(s.toText=c),[n.name,s]}))),a=Object.fromEntries(i.map((n=>{const r=o.filter((e=>e.type===n.name)),i={name:n.name,options:n.options,storage:n.storage,editor:t},s=sa({...e.reduce(((e,t)=>{const o=Xl(t,"extendMarkSchema",i);return{...e,...o?o(n):{}}}),{}),inclusive:ra(Xl(n,"inclusive",i)),excludes:ra(Xl(n,"excludes",i)),group:ra(Xl(n,"group",i)),spanning:ra(Xl(n,"spanning",i)),code:ra(Xl(n,"code",i)),attrs:Object.fromEntries(r.map((e=>{var t;return[e.name,{default:null===(t=null==e?void 0:e.attribute)||void 0===t?void 0:t.default}]})))}),l=ra(Xl(n,"parseHTML",i));l&&(s.parseDOM=l.map((e=>ia(e,r))));const a=Xl(n,"renderHTML",i);return a&&(s.toDOM=e=>a({mark:e,HTMLAttributes:na(e,r)})),[n.name,s]})));return new wn({topNode:s,nodes:l,marks:a})}(this.extensions,t),this.setupExtensions()}static resolve(e){const t=ka.sort(ka.flatten(e)),n=function(e){const t=e.filter(((t,n)=>e.indexOf(t)!==n));return Array.from(new Set(t))}(t.map((e=>e.name)));return n.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map((e=>`'${e}'`)).join(", ")}]. This can lead to issues.`),t}static flatten(e){return e.map((e=>{const t=Xl(e,"addExtensions",{name:e.name,options:e.options,storage:e.storage});return t?[e,...this.flatten(t())]:e})).flat(10)}static sort(e){return e.sort(((e,t)=>{const n=Xl(e,"priority")||100,o=Xl(t,"priority")||100;return n>o?-1:n<o?1:0}))}get commands(){return this.extensions.reduce(((e,t)=>{const n=Xl(t,"addCommands",{name:t.name,options:t.options,storage:t.storage,editor:this.editor,type:la(t.name,this.schema)});return n?{...e,...n()}:e}),{})}get plugins(){const{editor:e}=this,t=ka.sort([...this.extensions].reverse()),n=[],o=[],r=t.map((t=>{const r={name:t.name,options:t.options,storage:t.storage,editor:e,type:la(t.name,this.schema)},i=[],s=Xl(t,"addKeyboardShortcuts",r);let l={};if("mark"===t.type&&Xl(t,"exitable",r)&&(l.ArrowRight=()=>ga.handleExit({editor:e,mark:t})),s){const t=Object.fromEntries(Object.entries(s()).map((([t,n])=>[t,()=>n({editor:e})])));l={...l,...t}}const a=new Ko({props:{handleKeyDown:Ml(l)}});i.push(a);const c=Xl(t,"addInputRules",r);aa(t,e.options.enableInputRules)&&c&&n.push(...c());const d=Xl(t,"addPasteRules",r);aa(t,e.options.enablePasteRules)&&d&&o.push(...d());const h=Xl(t,"addProseMirrorPlugins",r);if(h){const e=h();i.push(...e)}return i})).flat();return[pa({editor:e,rules:n}),...wa({editor:e,rules:o}),...r]}get attributes(){return Zl(this.extensions)}get nodeViews(){const{editor:e}=this,{nodeExtensions:t}=Ql(this.extensions);return Object.fromEntries(t.filter((e=>!!Xl(e,"addNodeView"))).map((t=>{const n=this.attributes.filter((e=>e.type===t.name)),o={name:t.name,options:t.options,storage:t.storage,editor:e,type:ea(t.name,this.schema)},r=Xl(t,"addNodeView",o);if(!r)return[];return[t.name,(o,i,s,l,a)=>{const c=na(o,n);return r()({node:o,view:i,getPos:s,decorations:l,innerDecorations:a,editor:e,extension:t,HTMLAttributes:c})}]})))}setupExtensions(){this.extensions.forEach((e=>{var t;this.editor.extensionStorage[e.name]=e.storage;const n={name:e.name,options:e.options,storage:e.storage,editor:this.editor,type:la(e.name,this.schema)};if("mark"===e.type){(null===(t=ra(Xl(e,"keepOnSplit",n)))||void 0===t||t)&&this.splittableMarks.push(e.name)}const o=Xl(e,"onBeforeCreate",n),r=Xl(e,"onCreate",n),i=Xl(e,"onUpdate",n),s=Xl(e,"onSelectionUpdate",n),l=Xl(e,"onTransaction",n),a=Xl(e,"onFocus",n),c=Xl(e,"onBlur",n),d=Xl(e,"onDestroy",n);o&&this.editor.on("beforeCreate",o),r&&this.editor.on("create",r),i&&this.editor.on("update",i),s&&this.editor.on("selectionUpdate",s),l&&this.editor.on("transaction",l),a&&this.editor.on("focus",a),c&&this.editor.on("blur",c),d&&this.editor.on("destroy",d)}))}}class xa{constructor(e={}){this.type="extension",this.name="extension",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=ra(Xl(this,"addOptions",{name:this.name}))),this.storage=ra(Xl(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new xa(e)}configure(e={}){const t=this.extend({...this.config,addOptions:()=>ma(this.options,e)});return t.name=this.name,t.parent=this.parent,t}extend(e={}){const t=new xa({...this.config,...e});return t.parent=this,this.child=t,t.name=e.name?e.name:t.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${t.name}".`),t.options=ra(Xl(t,"addOptions",{name:t.name})),t.storage=ra(Xl(t,"addStorage",{name:t.name,options:t.options})),t}}function Ma(e,t,n){const{from:o,to:r}=t,{blockSeparator:i="\n\n",textSerializers:s={}}=n||{};let l="";return e.nodesBetween(o,r,((e,n,a,c)=>{var d;e.isBlock&&n>o&&(l+=i);const h=null==s?void 0:s[e.type.name];if(h)return a&&(l+=h({node:e,pos:n,parent:a,index:c,range:t})),!1;e.isText&&(l+=null===(d=null==e?void 0:e.text)||void 0===d?void 0:d.slice(Math.max(o,n)-n,r-n))})),l}function Sa(e){return Object.fromEntries(Object.entries(e.nodes).filter((([,e])=>e.spec.toText)).map((([e,t])=>[e,t.spec.toText])))}const Ca=xa.create({name:"clipboardTextSerializer",addOptions:()=>({blockSeparator:void 0}),addProseMirrorPlugins(){return[new Ko({key:new Yo("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:e}=this,{state:t,schema:n}=e,{doc:o,selection:r}=t,{ranges:i}=r,s=Math.min(...i.map((e=>e.$from.pos))),l=Math.max(...i.map((e=>e.$to.pos))),a=Sa(n);return Ma(o,{from:s,to:l},{...void 0!==this.options.blockSeparator?{blockSeparator:this.options.blockSeparator}:{},textSerializers:a})}}})]}});function Oa(e,t,n={strict:!0}){const o=Object.keys(t);return!o.length||o.every((o=>n.strict?t[o]===e[o]:da(t[o])?t[o].test(e[o]):t[o]===e[o]))}function Ta(e,t,n={}){return e.find((e=>e.type===t&&Oa(Object.fromEntries(Object.keys(n).map((t=>[t,e.attrs[t]]))),n)))}function Aa(e,t,n={}){return!!Ta(e,t,n)}function Ea(e,t,n){var o;if(!e||!t)return;let r=e.parent.childAfter(e.parentOffset);if(r.node&&r.node.marks.some((e=>e.type===t))||(r=e.parent.childBefore(e.parentOffset)),!r.node||!r.node.marks.some((e=>e.type===t)))return;n=n||(null===(o=r.node.marks[0])||void 0===o?void 0:o.attrs);if(!Ta([...r.node.marks],t,n))return;let i=r.index,s=e.start()+r.offset,l=i+1,a=s+r.node.nodeSize;for(;i>0&&Aa([...e.parent.child(i-1).marks],t,n);)i-=1,s-=e.parent.child(i).nodeSize;for(;l<e.parent.childCount&&Aa([...e.parent.child(l).marks],t,n);)a+=e.parent.child(l).nodeSize,l+=1;return{from:s,to:a}}function Na(e,t){if("string"==typeof e){if(!t.marks[e])throw Error(`There is no mark type named '${e}'. Maybe you forgot to add the extension?`);return t.marks[e]}return e}function Da(e){return e instanceof Ro}function Ra(e=0,t=0,n=0){return Math.min(Math.max(e,t),n)}function Va(e,t=null){if(!t)return null;const n=Ao.atStart(e),o=Ao.atEnd(e);if("start"===t||!0===t)return n;if("end"===t)return o;const r=n.from,i=o.to;return"all"===t?Ro.create(e,Ra(0,r,i),Ra(e.content.size,r,i)):Ro.create(e,Ra(t,r,i),Ra(t,r,i))}function Ia(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}const za=e=>{const t=e.childNodes;for(let n=t.length-1;n>=0;n-=1){const o=t[n];3===o.nodeType&&o.nodeValue&&/^(\n\s\s|\n)$/.test(o.nodeValue)?e.removeChild(o):1===o.nodeType&&za(o)}return e};function La(e){const t=`<body>${e}</body>`,n=(new window.DOMParser).parseFromString(t,"text/html").body;return za(n)}function Pa(e,t,n){if(e instanceof en||e instanceof Nt)return e;n={slice:!0,parseOptions:{},...n};const o="string"==typeof e;if("object"==typeof e&&null!==e)try{if(Array.isArray(e)&&e.length>0)return Nt.fromArray(e.map((e=>t.nodeFromJSON(e))));const o=t.nodeFromJSON(e);return n.errorOnInvalidContent&&o.check(),o}catch(r){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:r});return console.warn("[tiptap warn]: Invalid content.","Passed value:",e,"Error:",r),Pa("",t,n)}if(o){if(n.errorOnInvalidContent){let o=!1,r="";const i=new wn({topNode:t.spec.topNode,marks:t.spec.marks,nodes:t.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:e=>(o=!0,r="string"==typeof e?e:e.outerHTML,null)}]}})});if(n.slice?xn.fromSchema(i).parseSlice(La(e),n.parseOptions):xn.fromSchema(i).parse(La(e),n.parseOptions),n.errorOnInvalidContent&&o)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${r}`)})}const o=xn.fromSchema(t);return n.slice?o.parseSlice(La(e),n.parseOptions).content:o.parse(La(e),n.parseOptions)}return Pa("",t,n)}function $a(){return"undefined"!=typeof navigator&&/Mac/.test(navigator.platform)}function Ba(e,t,n={}){const{from:o,to:r,empty:i}=e.selection,s=t?ea(t,e.schema):null,l=[];e.doc.nodesBetween(o,r,((e,t)=>{if(e.isText)return;const n=Math.max(o,t),i=Math.min(r,t+e.nodeSize);l.push({node:e,from:n,to:i})}));const a=r-o,c=l.filter((e=>!s||s.name===e.node.type.name)).filter((e=>Oa(e.node.attrs,n,{strict:!1})));if(i)return!!c.length;return c.reduce(((e,t)=>e+t.to-t.from),0)>=a}function Ha(e,t){return t.nodes[e]?"node":t.marks[e]?"mark":null}function _a(e,t){const n="string"==typeof t?[t]:t;return Object.keys(e).reduce(((t,o)=>(n.includes(o)||(t[o]=e[o]),t)),{})}function Fa(e,t,n={},o={}){return Pa(e,t,{slice:!1,parseOptions:n,errorOnInvalidContent:o.errorOnInvalidContent})}function ja(e,t){const n=Na(t,e.schema),{from:o,to:r,empty:i}=e.selection,s=[];i?(e.storedMarks&&s.push(...e.storedMarks),s.push(...e.selection.$head.marks())):e.doc.nodesBetween(o,r,(e=>{s.push(...e.marks)}));const l=s.find((e=>e.type.name===n.name));return l?{...l.attrs}:{}}function Ua(e){return t=>function(e,t){for(let n=e.depth;n>0;n-=1){const o=e.node(n);if(t(o))return{pos:n>0?e.before(n):0,start:e.start(n),depth:n,node:o}}}(t.$from,e)}function Wa(e,t){const n=Ha("string"==typeof t?t:t.name,e.schema);return"node"===n?function(e,t){const n=ea(t,e.schema),{from:o,to:r}=e.selection,i=[];e.doc.nodesBetween(o,r,(e=>{i.push(e)}));const s=i.reverse().find((e=>e.type.name===n.name));return s?{...s.attrs}:{}}(e,t):"mark"===n?ja(e,t):{}}function qa(e){const t=function(e,t=JSON.stringify){const n={};return e.filter((e=>{const o=t(e);return!Object.prototype.hasOwnProperty.call(n,o)&&(n[o]=!0)}))}(e);return 1===t.length?t:t.filter(((e,n)=>{const o=t.filter(((e,t)=>t!==n));return!o.some((t=>e.oldRange.from>=t.oldRange.from&&e.oldRange.to<=t.oldRange.to&&e.newRange.from>=t.newRange.from&&e.newRange.to<=t.newRange.to))}))}function Ka(e,t,n){const o=[];return e===t?n.resolve(e).marks().forEach((t=>{const r=Ea(n.resolve(e),t.type);r&&o.push({mark:t,...r})})):n.nodesBetween(e,t,((e,t)=>{e&&void 0!==(null==e?void 0:e.nodeSize)&&o.push(...e.marks.map((n=>({from:t,to:t+e.nodeSize,mark:n}))))})),o}function Ja(e,t,n){return Object.fromEntries(Object.entries(n).filter((([n])=>{const o=e.find((e=>e.type===t&&e.name===n));return!!o&&o.attribute.keepOnSplit})))}function Ga(e,t,n={}){const{empty:o,ranges:r}=e.selection,i=t?Na(t,e.schema):null;if(o)return!!(e.storedMarks||e.selection.$from.marks()).filter((e=>!i||i.name===e.type.name)).find((e=>Oa(e.attrs,n,{strict:!1})));let s=0;const l=[];if(r.forEach((({$from:t,$to:n})=>{const o=t.pos,r=n.pos;e.doc.nodesBetween(o,r,((e,t)=>{if(!e.isText&&!e.marks.length)return;const n=Math.max(o,t),i=Math.min(r,t+e.nodeSize);s+=i-n,l.push(...e.marks.map((e=>({mark:e,from:n,to:i}))))}))})),0===s)return!1;const a=l.filter((e=>!i||i.name===e.mark.type.name)).filter((e=>Oa(e.mark.attrs,n,{strict:!1}))).reduce(((e,t)=>e+t.to-t.from),0),c=l.filter((e=>!i||e.mark.type!==i&&e.mark.type.excludes(i))).reduce(((e,t)=>e+t.to-t.from),0);return(a>0?a+c:a)>=s}function Ya(e,t){const{nodeExtensions:n}=Ql(t),o=n.find((t=>t.name===e));if(!o)return!1;const r=ra(Xl(o,"group",{name:o.name,options:o.options,storage:o.storage}));return"string"==typeof r&&r.split(" ").includes("list")}function Xa(e,{checkChildren:t=!0,ignoreWhitespace:n=!1}={}){var o;if(n){if("hardBreak"===e.type.name)return!0;if(e.isText)return/^\s*$/m.test(null!==(o=e.text)&&void 0!==o?o:"")}if(e.isText)return!e.text;if(e.isAtom||e.isLeaf)return!1;if(0===e.content.childCount)return!0;if(t){let o=!0;return e.content.forEach((e=>{!1!==o&&(Xa(e,{ignoreWhitespace:n,checkChildren:t})||(o=!1))})),o}return!1}function Qa(e,t){const n=e.storedMarks||e.selection.$to.parentOffset&&e.selection.$from.marks();if(n){const o=n.filter((e=>null==t?void 0:t.includes(e.type.name)));e.tr.ensureMarks(o)}}const Za=(e,t)=>{const n=Ua((e=>e.type===t))(e.selection);if(!n)return!0;const o=e.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(void 0===o)return!0;const r=e.doc.nodeAt(o);return n.node.type!==(null==r?void 0:r.type)||!ao(e.doc,n.pos)||(e.join(n.pos),!0)},ec=(e,t)=>{const n=Ua((e=>e.type===t))(e.selection);if(!n)return!0;const o=e.doc.resolve(n.start).after(n.depth);if(void 0===o)return!0;const r=e.doc.nodeAt(o);return n.node.type!==(null==r?void 0:r.type)||!ao(e.doc,o)||(e.join(o),!0)};var tc=Object.freeze({__proto__:null,blur:()=>({editor:e,view:t})=>(requestAnimationFrame((()=>{var n;e.isDestroyed||(t.dom.blur(),null===(n=null===window||void 0===window?void 0:window.getSelection())||void 0===n||n.removeAllRanges())})),!0),clearContent:(e=!1)=>({commands:t})=>t.setContent("",e),clearNodes:()=>({state:e,tr:t,dispatch:n})=>{const{selection:o}=t,{ranges:r}=o;return!n||(r.forEach((({$from:n,$to:o})=>{e.doc.nodesBetween(n.pos,o.pos,((e,n)=>{if(e.type.isText)return;const{doc:o,mapping:r}=t,i=o.resolve(r.map(n)),s=o.resolve(r.map(n+e.nodeSize)),l=i.blockRange(s);if(!l)return;const a=no(l);if(e.type.isTextblock){const{defaultType:e}=i.parent.contentMatchAt(i.index());t.setNodeMarkup(l.start,e)}(a||0===a)&&t.lift(l,a)}))})),!0)},command:e=>t=>e(t),createParagraphNear:()=>({state:e,dispatch:t})=>Pl(e,t),cut:(e,t)=>({editor:n,tr:o})=>{const{state:r}=n,i=r.doc.slice(e.from,e.to);o.deleteRange(e.from,e.to);const s=o.mapping.map(t);return o.insert(s,i.content),o.setSelection(new Ro(o.doc.resolve(s-1))),!0},deleteCurrentNode:()=>({tr:e,dispatch:t})=>{const{selection:n}=e,o=n.$anchor.node();if(o.content.size>0)return!1;const r=e.selection.$anchor;for(let i=r.depth;i>0;i-=1){if(r.node(i).type===o.type){if(t){const t=r.before(i),n=r.after(i);e.delete(t,n).scrollIntoView()}return!0}}return!1},deleteNode:e=>({tr:t,state:n,dispatch:o})=>{const r=ea(e,n.schema),i=t.selection.$anchor;for(let e=i.depth;e>0;e-=1){if(i.node(e).type===r){if(o){const n=i.before(e),o=i.after(e);t.delete(n,o).scrollIntoView()}return!0}}return!1},deleteRange:e=>({tr:t,dispatch:n})=>{const{from:o,to:r}=e;return n&&t.delete(o,r),!0},deleteSelection:()=>({state:e,dispatch:t})=>Sl(e,t),enter:()=>({commands:e})=>e.keyboardShortcut("Enter"),exitCode:()=>({state:e,dispatch:t})=>((e,t)=>{let{$head:n,$anchor:o}=e.selection;if(!n.parent.type.spec.code||!n.sameParent(o))return!1;let r=n.node(-1),i=n.indexAfter(-1),s=Ll(r.contentMatchAt(i));if(!s||!r.canReplaceWith(i,i,s))return!1;if(t){let o=n.after(),r=e.tr.replaceWith(o,o,s.createAndFill());r.setSelection(Ao.near(r.doc.resolve(o),1)),t(r.scrollIntoView())}return!0})(e,t),extendMarkRange:(e,t={})=>({tr:n,state:o,dispatch:r})=>{const i=Na(e,o.schema),{doc:s,selection:l}=n,{$from:a,from:c,to:d}=l;if(r){const e=Ea(a,i,t);if(e&&e.from<=c&&e.to>=d){const t=Ro.create(s,e.from,e.to);n.setSelection(t)}}return!0},first:e=>t=>{const n="function"==typeof e?e(t):e;for(let e=0;e<n.length;e+=1)if(n[e](t))return!0;return!1},focus:(e=null,t={})=>({editor:n,view:o,tr:r,dispatch:i})=>{t={scrollIntoView:!0,...t};const s=()=>{(Ia()||"Android"===navigator.platform||/android/i.test(navigator.userAgent))&&o.dom.focus(),requestAnimationFrame((()=>{n.isDestroyed||(o.focus(),(null==t?void 0:t.scrollIntoView)&&n.commands.scrollIntoView())}))};if(o.hasFocus()&&null===e||!1===e)return!0;if(i&&null===e&&!Da(n.state.selection))return s(),!0;const l=Va(r.doc,e)||n.state.selection,a=n.state.selection.eq(l);return i&&(a||r.setSelection(l),a&&r.storedMarks&&r.setStoredMarks(r.storedMarks),s()),!0},forEach:(e,t)=>n=>e.every(((e,o)=>t(e,{...n,index:o}))),insertContent:(e,t)=>({tr:n,commands:o})=>o.insertContentAt({from:n.selection.from,to:n.selection.to},e,t),insertContentAt:(e,t,n)=>({tr:o,dispatch:r,editor:i})=>{var s;if(r){let r;n={parseOptions:i.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};try{r=Pa(t,i.schema,{parseOptions:{preserveWhitespace:"full",...n.parseOptions},errorOnInvalidContent:null!==(s=n.errorOnInvalidContent)&&void 0!==s?s:i.options.enableContentCheck})}catch(l){return i.emit("contentError",{editor:i,error:l,disableCollaboration:()=>{i.storage.collaboration&&(i.storage.collaboration.isDisabled=!0)}}),!1}let{from:a,to:c}="number"==typeof e?{from:e,to:e}:{from:e.from,to:e.to},d=!0,h=!0;if(("type"in r?[r]:r).forEach((e=>{e.check(),d=!!d&&(e.isText&&0===e.marks.length),h=!!h&&e.isBlock})),a===c&&h){const{parent:e}=o.doc.resolve(a);e.isTextblock&&!e.type.spec.code&&!e.childCount&&(a-=1,c+=1)}let u;if(d){if(Array.isArray(t))u=t.map((e=>e.text||"")).join("");else if(t instanceof Nt){let e="";t.forEach((t=>{t.text&&(e+=t.text)})),u=e}else u="object"==typeof t&&t&&t.text?t.text:t;o.insertText(u,a,c)}else u=r,o.replaceWith(a,c,u);n.updateSelection&&function(e,t,n){const o=e.steps.length-1;if(o<t)return;const r=e.steps[o];if(!(r instanceof Xn||r instanceof Qn))return;const i=e.mapping.maps[o];let s=0;i.forEach(((e,t,n,o)=>{0===s&&(s=o)})),e.setSelection(Ao.near(e.doc.resolve(s),n))}(o,o.steps.length-1,-1),n.applyInputRules&&o.setMeta("applyInputRules",{from:a,text:u}),n.applyPasteRules&&o.setMeta("applyPasteRules",{from:a,text:u})}return!0},joinBackward:()=>({state:e,dispatch:t})=>Ol(e,t),joinDown:()=>({state:e,dispatch:t})=>((e,t)=>{let n,o=e.selection;if(o instanceof Io){if(o.node.isTextblock||!ao(e.doc,o.to))return!1;n=o.to}else if(n=ho(e.doc,o.to,1),null==n)return!1;return t&&t(e.tr.join(n).scrollIntoView()),!0})(e,t),joinForward:()=>({state:e,dispatch:t})=>Rl(e,t),joinItemBackward:()=>({state:e,dispatch:t,tr:n})=>{try{const o=ho(e.doc,e.selection.$from.pos,-1);return null!=o&&(n.join(o,2),t&&t(n),!0)}catch{return!1}},joinItemForward:()=>({state:e,dispatch:t,tr:n})=>{try{const o=ho(e.doc,e.selection.$from.pos,1);return null!=o&&(n.join(o,2),t&&t(n),!0)}catch{return!1}},joinTextblockBackward:()=>({state:e,dispatch:t})=>((e,t,n)=>{let o=Cl(e,n);if(!o)return!1;let r=Nl(o);return!!r&&Tl(e,r,t)})(e,t),joinTextblockForward:()=>({state:e,dispatch:t})=>((e,t,n)=>{let o=Dl(e,n);if(!o)return!1;let r=Il(o);return!!r&&Tl(e,r,t)})(e,t),joinUp:()=>({state:e,dispatch:t})=>((e,t)=>{let n,o=e.selection,r=o instanceof Io;if(r){if(o.node.isTextblock||!ao(e.doc,o.from))return!1;n=o.from}else if(n=ho(e.doc,o.from,-1),null==n)return!1;if(t){let o=e.tr.join(n);r&&o.setSelection(Io.create(o.doc,n-e.doc.resolve(n).nodeBefore.nodeSize)),t(o.scrollIntoView())}return!0})(e,t),keyboardShortcut:e=>({editor:t,view:n,tr:o,dispatch:r})=>{const i=function(e){const t=e.split(/-(?!$)/);let n,o,r,i,s=t[t.length-1];"Space"===s&&(s=" ");for(let l=0;l<t.length-1;l+=1){const e=t[l];if(/^(cmd|meta|m)$/i.test(e))i=!0;else if(/^a(lt)?$/i.test(e))n=!0;else if(/^(c|ctrl|control)$/i.test(e))o=!0;else if(/^s(hift)?$/i.test(e))r=!0;else{if(!/^mod$/i.test(e))throw new Error(`Unrecognized modifier name: ${e}`);Ia()||$a()?i=!0:o=!0}}return n&&(s=`Alt-${s}`),o&&(s=`Ctrl-${s}`),i&&(s=`Meta-${s}`),r&&(s=`Shift-${s}`),s}(e).split(/-(?!$)/),s=i.find((e=>!["Alt","Ctrl","Meta","Shift"].includes(e))),l=new KeyboardEvent("keydown",{key:"Space"===s?" ":s,altKey:i.includes("Alt"),ctrlKey:i.includes("Ctrl"),metaKey:i.includes("Meta"),shiftKey:i.includes("Shift"),bubbles:!0,cancelable:!0}),a=t.captureTransaction((()=>{n.someProp("handleKeyDown",(e=>e(n,l)))}));return null==a||a.steps.forEach((e=>{const t=e.map(o.mapping);t&&r&&o.maybeStep(t)})),!0},lift:(e,t={})=>({state:n,dispatch:o})=>!!Ba(n,ea(e,n.schema),t)&&((e,t)=>{let{$from:n,$to:o}=e.selection,r=n.blockRange(o),i=r&&no(r);return null!=i&&(t&&t(e.tr.lift(r,i).scrollIntoView()),!0)})(n,o),liftEmptyBlock:()=>({state:e,dispatch:t})=>$l(e,t),liftListItem:e=>({state:t,dispatch:n})=>Kl(ea(e,t.schema))(t,n),newlineInCode:()=>({state:e,dispatch:t})=>zl(e,t),resetAttributes:(e,t)=>({tr:n,state:o,dispatch:r})=>{let i=null,s=null;const l=Ha("string"==typeof e?e:e.name,o.schema);return!!l&&("node"===l&&(i=ea(e,o.schema)),"mark"===l&&(s=Na(e,o.schema)),r&&n.selection.ranges.forEach((e=>{o.doc.nodesBetween(e.$from.pos,e.$to.pos,((e,o)=>{i&&i===e.type&&n.setNodeMarkup(o,void 0,_a(e.attrs,t)),s&&e.marks.length&&e.marks.forEach((r=>{s===r.type&&n.addMark(o,o+e.nodeSize,s.create(_a(r.attrs,t)))}))}))})),!0)},scrollIntoView:()=>({tr:e,dispatch:t})=>(t&&e.scrollIntoView(),!0),selectAll:()=>({tr:e,dispatch:t})=>{if(t){const t=new Lo(e.doc);e.setSelection(t)}return!0},selectNodeBackward:()=>({state:e,dispatch:t})=>El(e,t),selectNodeForward:()=>({state:e,dispatch:t})=>Vl(e,t),selectParentNode:()=>({state:e,dispatch:t})=>((e,t)=>{let n,{$from:o,to:r}=e.selection,i=o.sharedDepth(r);return 0!=i&&(n=o.before(i),t&&t(e.tr.setSelection(Io.create(e.doc,n))),!0)})(e,t),selectTextblockEnd:()=>({state:e,dispatch:t})=>jl(e,t),selectTextblockStart:()=>({state:e,dispatch:t})=>Fl(e,t),setContent:(e,t=!1,n={},o={})=>({editor:r,tr:i,dispatch:s,commands:l})=>{var a,c;const{doc:d}=i;if("full"!==n.preserveWhitespace){const l=Fa(e,r.schema,n,{errorOnInvalidContent:null!==(a=o.errorOnInvalidContent)&&void 0!==a?a:r.options.enableContentCheck});return s&&i.replaceWith(0,d.content.size,l).setMeta("preventUpdate",!t),!0}return s&&i.setMeta("preventUpdate",!t),l.insertContentAt({from:0,to:d.content.size},e,{parseOptions:n,errorOnInvalidContent:null!==(c=o.errorOnInvalidContent)&&void 0!==c?c:r.options.enableContentCheck})},setMark:(e,t={})=>({tr:n,state:o,dispatch:r})=>{const{selection:i}=n,{empty:s,ranges:l}=i,a=Na(e,o.schema);if(r)if(s){const e=ja(o,a);n.addStoredMark(a.create({...e,...t}))}else l.forEach((e=>{const r=e.$from.pos,i=e.$to.pos;o.doc.nodesBetween(r,i,((e,o)=>{const s=Math.max(o,r),l=Math.min(o+e.nodeSize,i);e.marks.find((e=>e.type===a))?e.marks.forEach((e=>{a===e.type&&n.addMark(s,l,a.create({...e.attrs,...t}))})):n.addMark(s,l,a.create(t))}))}));return function(e,t,n){var o;const{selection:r}=t;let i=null;if(Da(r)&&(i=r.$cursor),i){const t=null!==(o=e.storedMarks)&&void 0!==o?o:i.marks();return!!n.isInSet(t)||!t.some((e=>e.type.excludes(n)))}const{ranges:s}=r;return s.some((({$from:t,$to:o})=>{let r=0===t.depth&&e.doc.inlineContent&&e.doc.type.allowsMarkType(n);return e.doc.nodesBetween(t.pos,o.pos,((e,t,o)=>{if(r)return!1;if(e.isInline){const t=!o||o.type.allowsMarkType(n),i=!!n.isInSet(e.marks)||!e.marks.some((e=>e.type.excludes(n)));r=t&&i}return!r})),r}))}(o,n,a)},setMeta:(e,t)=>({tr:n})=>(n.setMeta(e,t),!0),setNode:(e,t={})=>({state:n,dispatch:o,chain:r})=>{const i=ea(e,n.schema);let s;return n.selection.$anchor.sameParent(n.selection.$head)&&(s=n.selection.$anchor.parent.attrs),i.isTextblock?r().command((({commands:e})=>!!Ul(i,{...s,...t})(n)||e.clearNodes())).command((({state:e})=>Ul(i,{...s,...t})(e,o))).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},setNodeSelection:e=>({tr:t,dispatch:n})=>{if(n){const{doc:n}=t,o=Ra(e,0,n.content.size),r=Io.create(n,o);t.setSelection(r)}return!0},setTextSelection:e=>({tr:t,dispatch:n})=>{if(n){const{doc:n}=t,{from:o,to:r}="number"==typeof e?{from:e,to:e}:e,i=Ro.atStart(n).from,s=Ro.atEnd(n).to,l=Ra(o,i,s),a=Ra(r,i,s),c=Ro.create(n,l,a);t.setSelection(c)}return!0},sinkListItem:e=>({state:t,dispatch:n})=>{const o=ea(e,t.schema);return(r=o,function(e,t){let{$from:n,$to:o}=e.selection,i=n.blockRange(o,(e=>e.childCount>0&&e.firstChild.type==r));if(!i)return!1;let s=i.startIndex;if(0==s)return!1;let l=i.parent,a=l.child(s-1);if(a.type!=r)return!1;if(t){let n=a.lastChild&&a.lastChild.type==l.type,o=Nt.from(n?r.create():null),s=new Lt(Nt.from(r.create(null,Nt.from(l.type.create(null,o)))),n?3:1,0),c=i.start,d=i.end;t(e.tr.step(new Qn(c-(n?3:1),d,c,d,s,1,!0)).scrollIntoView())}return!0})(t,n);var r},splitBlock:({keepMarks:e=!0}={})=>({tr:t,state:n,dispatch:o,editor:r})=>{const{selection:i,doc:s}=t,{$from:l,$to:a}=i,c=Ja(r.extensionManager.attributes,l.node().type.name,l.node().attrs);if(i instanceof Io&&i.node.isBlock)return!(!l.parentOffset||!lo(s,l.pos))&&(o&&(e&&Qa(n,r.extensionManager.splittableMarks),t.split(l.pos).scrollIntoView()),!0);if(!l.parent.isBlock)return!1;const d=a.parentOffset===a.parent.content.size,h=0===l.depth?void 0:function(e){for(let t=0;t<e.edgeCount;t+=1){const{type:n}=e.edge(t);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}(l.node(-1).contentMatchAt(l.indexAfter(-1)));let u=d&&h?[{type:h,attrs:c}]:void 0,p=lo(t.doc,t.mapping.map(l.pos),1,u);if(u||p||!lo(t.doc,t.mapping.map(l.pos),1,h?[{type:h}]:void 0)||(p=!0,u=h?[{type:h,attrs:c}]:void 0),o){if(p&&(i instanceof Ro&&t.deleteSelection(),t.split(t.mapping.map(l.pos),1,u),h&&!d&&!l.parentOffset&&l.parent.type!==h)){const e=t.mapping.map(l.before()),n=t.doc.resolve(e);l.node(-1).canReplaceWith(n.index(),n.index()+1,h)&&t.setNodeMarkup(t.mapping.map(l.before()),h)}e&&Qa(n,r.extensionManager.splittableMarks),t.scrollIntoView()}return p},splitListItem:(e,t={})=>({tr:n,state:o,dispatch:r,editor:i})=>{var s;const l=ea(e,o.schema),{$from:a,$to:c}=o.selection,d=o.selection.node;if(d&&d.isBlock||a.depth<2||!a.sameParent(c))return!1;const h=a.node(-1);if(h.type!==l)return!1;const u=i.extensionManager.attributes;if(0===a.parent.content.size&&a.node(-1).childCount===a.indexAfter(-1)){if(2===a.depth||a.node(-3).type!==l||a.index(-2)!==a.node(-2).childCount-1)return!1;if(r){let e=Nt.empty;const o=a.index(-1)?1:a.index(-2)?2:3;for(let t=a.depth-o;t>=a.depth-3;t-=1)e=Nt.from(a.node(t).copy(e));const r=a.indexAfter(-1)<a.node(-2).childCount?1:a.indexAfter(-2)<a.node(-3).childCount?2:3,i={...Ja(u,a.node().type.name,a.node().attrs),...t},c=(null===(s=l.contentMatch.defaultType)||void 0===s?void 0:s.createAndFill(i))||void 0;e=e.append(Nt.from(l.createAndFill(null,c)||void 0));const d=a.before(a.depth-(o-1));n.replace(d,a.after(-r),new Lt(e,4-o,0));let h=-1;n.doc.nodesBetween(d,n.doc.content.size,((e,t)=>{if(h>-1)return!1;e.isTextblock&&0===e.content.size&&(h=t+1)})),h>-1&&n.setSelection(Ro.near(n.doc.resolve(h))),n.scrollIntoView()}return!0}const p=c.pos===a.end()?h.contentMatchAt(0).defaultType:null,f={...Ja(u,h.type.name,h.attrs),...t},m={...Ja(u,a.node().type.name,a.node().attrs),...t};n.delete(a.pos,c.pos);const g=p?[{type:l,attrs:f},{type:p,attrs:m}]:[{type:l,attrs:f}];if(!lo(n.doc,a.pos,2))return!1;if(r){const{selection:e,storedMarks:t}=o,{splittableMarks:s}=i.extensionManager,l=t||e.$to.parentOffset&&e.$from.marks();if(n.split(a.pos,2,g).scrollIntoView(),!l||!r)return!0;const c=l.filter((e=>s.includes(e.type.name)));n.ensureMarks(c)}return!0},toggleList:(e,t,n,o={})=>({editor:r,tr:i,state:s,dispatch:l,chain:a,commands:c,can:d})=>{const{extensions:h,splittableMarks:u}=r.extensionManager,p=ea(e,s.schema),f=ea(t,s.schema),{selection:m,storedMarks:g}=s,{$from:y,$to:v}=m,b=y.blockRange(v),w=g||m.$to.parentOffset&&m.$from.marks();if(!b)return!1;const k=Ua((e=>Ya(e.type.name,h)))(m);if(b.depth>=1&&k&&b.depth-k.depth<=1){if(k.node.type===p)return c.liftListItem(f);if(Ya(k.node.type.name,h)&&p.validContent(k.node.content)&&l)return a().command((()=>(i.setNodeMarkup(k.pos,p),!0))).command((()=>Za(i,p))).command((()=>ec(i,p))).run()}return n&&w&&l?a().command((()=>{const e=d().wrapInList(p,o),t=w.filter((e=>u.includes(e.type.name)));return i.ensureMarks(t),!!e||c.clearNodes()})).wrapInList(p,o).command((()=>Za(i,p))).command((()=>ec(i,p))).run():a().command((()=>!!d().wrapInList(p,o)||c.clearNodes())).wrapInList(p,o).command((()=>Za(i,p))).command((()=>ec(i,p))).run()},toggleMark:(e,t={},n={})=>({state:o,commands:r})=>{const{extendEmptyMarkRange:i=!1}=n,s=Na(e,o.schema);return Ga(o,s,t)?r.unsetMark(s,{extendEmptyMarkRange:i}):r.setMark(s,t)},toggleNode:(e,t,n={})=>({state:o,commands:r})=>{const i=ea(e,o.schema),s=ea(t,o.schema),l=Ba(o,i,n);let a;return o.selection.$anchor.sameParent(o.selection.$head)&&(a=o.selection.$anchor.parent.attrs),l?r.setNode(s,a):r.setNode(i,{...a,...n})},toggleWrap:(e,t={})=>({state:n,commands:o})=>{const r=ea(e,n.schema);return Ba(n,r,t)?o.lift(r):o.wrapIn(r,t)},undoInputRule:()=>({state:e,dispatch:t})=>{const n=e.plugins;for(let o=0;o<n.length;o+=1){const r=n[o];let i;if(r.spec.isInputRules&&(i=r.getState(e))){if(t){const t=e.tr,n=i.transform;for(let e=n.steps.length-1;e>=0;e-=1)t.step(n.steps[e].invert(n.docs[e]));if(i.text){const n=t.doc.resolve(i.from).marks();t.replaceWith(i.from,i.to,e.schema.text(i.text,n))}else t.delete(i.from,i.to)}return!0}}return!1},unsetAllMarks:()=>({tr:e,dispatch:t})=>{const{selection:n}=e,{empty:o,ranges:r}=n;return o||t&&r.forEach((t=>{e.removeMark(t.$from.pos,t.$to.pos)})),!0},unsetMark:(e,t={})=>({tr:n,state:o,dispatch:r})=>{var i;const{extendEmptyMarkRange:s=!1}=t,{selection:l}=n,a=Na(e,o.schema),{$from:c,empty:d,ranges:h}=l;if(!r)return!0;if(d&&s){let{from:e,to:t}=l;const o=null===(i=c.marks().find((e=>e.type===a)))||void 0===i?void 0:i.attrs,r=Ea(c,a,o);r&&(e=r.from,t=r.to),n.removeMark(e,t,a)}else h.forEach((e=>{n.removeMark(e.$from.pos,e.$to.pos,a)}));return n.removeStoredMark(a),!0},updateAttributes:(e,t={})=>({tr:n,state:o,dispatch:r})=>{let i=null,s=null;const l=Ha("string"==typeof e?e:e.name,o.schema);return!!l&&("node"===l&&(i=ea(e,o.schema)),"mark"===l&&(s=Na(e,o.schema)),r&&n.selection.ranges.forEach((e=>{const r=e.$from.pos,l=e.$to.pos;let a,c,d,h;n.selection.empty?o.doc.nodesBetween(r,l,((e,t)=>{i&&i===e.type&&(d=Math.max(t,r),h=Math.min(t+e.nodeSize,l),a=t,c=e)})):o.doc.nodesBetween(r,l,((e,o)=>{o<r&&i&&i===e.type&&(d=Math.max(o,r),h=Math.min(o+e.nodeSize,l),a=o,c=e),o>=r&&o<=l&&(i&&i===e.type&&n.setNodeMarkup(o,void 0,{...e.attrs,...t}),s&&e.marks.length&&e.marks.forEach((i=>{if(s===i.type){const a=Math.max(o,r),c=Math.min(o+e.nodeSize,l);n.addMark(a,c,s.create({...i.attrs,...t}))}})))})),c&&(void 0!==a&&n.setNodeMarkup(a,void 0,{...c.attrs,...t}),s&&c.marks.length&&c.marks.forEach((e=>{s===e.type&&n.addMark(d,h,s.create({...e.attrs,...t}))})))})),!0)},wrapIn:(e,t={})=>({state:n,dispatch:o})=>function(e,t=null){return function(n,o){let{$from:r,$to:i}=n.selection,s=r.blockRange(i),l=s&&oo(s,e,t);return!!l&&(o&&o(n.tr.wrap(s,l).scrollIntoView()),!0)}}(ea(e,n.schema),t)(n,o),wrapInList:(e,t={})=>({state:n,dispatch:o})=>ql(ea(e,n.schema),t)(n,o)});const nc=xa.create({name:"commands",addCommands:()=>({...tc})}),oc=xa.create({name:"drop",addProseMirrorPlugins(){return[new Ko({key:new Yo("tiptapDrop"),props:{handleDrop:(e,t,n,o)=>{this.editor.emit("drop",{editor:this.editor,event:t,slice:n,moved:o})}}})]}}),rc=xa.create({name:"editable",addProseMirrorPlugins(){return[new Ko({key:new Yo("editable"),props:{editable:()=>this.editor.options.editable}})]}}),ic=new Yo("focusEvents"),sc=xa.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:e}=this;return[new Ko({key:ic,props:{handleDOMEvents:{focus:(t,n)=>{e.isFocused=!0;const o=e.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return t.dispatch(o),!1},blur:(t,n)=>{e.isFocused=!1;const o=e.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return t.dispatch(o),!1}}}})]}}),lc=xa.create({name:"keymap",addKeyboardShortcuts(){const e=()=>this.editor.commands.first((({commands:e})=>[()=>e.undoInputRule(),()=>e.command((({tr:t})=>{const{selection:n,doc:o}=t,{empty:r,$anchor:i}=n,{pos:s,parent:l}=i,a=i.parent.isTextblock&&s>0?t.doc.resolve(s-1):i,c=a.parent.type.spec.isolating,d=i.pos-i.parentOffset,h=c&&1===a.parent.childCount?d===i.pos:Ao.atStart(o).from===s;return!(!r||!l.type.isTextblock||l.textContent.length||!h||h&&"paragraph"===i.parent.type.name)&&e.clearNodes()})),()=>e.deleteSelection(),()=>e.joinBackward(),()=>e.selectNodeBackward()])),t=()=>this.editor.commands.first((({commands:e})=>[()=>e.deleteSelection(),()=>e.deleteCurrentNode(),()=>e.joinForward(),()=>e.selectNodeForward()])),n={Enter:()=>this.editor.commands.first((({commands:e})=>[()=>e.newlineInCode(),()=>e.createParagraphNear(),()=>e.liftEmptyBlock(),()=>e.splitBlock()])),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:e,"Mod-Backspace":e,"Shift-Backspace":e,Delete:t,"Mod-Delete":t,"Mod-a":()=>this.editor.commands.selectAll()},o={...n},r={...n,"Ctrl-h":e,"Alt-Backspace":e,"Ctrl-d":t,"Ctrl-Alt-Backspace":t,"Alt-Delete":t,"Alt-d":t,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return Ia()||$a()?r:o},addProseMirrorPlugins(){return[new Ko({key:new Yo("clearDocument"),appendTransaction:(e,t,n)=>{if(e.some((e=>e.getMeta("composition"))))return;const o=e.some((e=>e.docChanged))&&!t.doc.eq(n.doc),r=e.some((e=>e.getMeta("preventClearDocument")));if(!o||r)return;const{empty:i,from:s,to:l}=t.selection,a=Ao.atStart(t.doc).from,c=Ao.atEnd(t.doc).to;if(i||!(s===a&&l===c))return;if(!Xa(n.doc))return;const d=n.tr,h=Jl({state:n,transaction:d}),{commands:u}=new Gl({editor:this.editor,state:h});return u.clearNodes(),d.steps.length?d:void 0}})]}}),ac=xa.create({name:"paste",addProseMirrorPlugins(){return[new Ko({key:new Yo("tiptapPaste"),props:{handlePaste:(e,t,n)=>{this.editor.emit("paste",{editor:this.editor,event:t,slice:n})}}})]}}),cc=xa.create({name:"tabindex",addProseMirrorPlugins(){return[new Ko({key:new Yo("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}});class dc{get name(){return this.node.type.name}constructor(e,t,n=!1,o=null){this.currentNode=null,this.actualDepth=null,this.isBlock=n,this.resolvedPos=e,this.editor=t,this.currentNode=o}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return null!==(e=this.actualDepth)&&void 0!==e?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let t=this.from,n=this.to;if(this.isBlock){if(0===this.content.size)return void console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);t=this.from+1,n=this.to-1}this.editor.commands.insertContentAt({from:t,to:n},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(0===this.depth)return null;const e=this.resolvedPos.start(this.resolvedPos.depth-1),t=this.resolvedPos.doc.resolve(e);return new dc(t,this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new dc(e,this.editor)}get after(){let e=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.to+3)),new dc(e,this.editor)}get children(){const e=[];return this.node.content.forEach(((t,n)=>{const o=t.isBlock&&!t.isTextblock,r=t.isAtom&&!t.isText,i=this.pos+n+(r?0:1),s=this.resolvedPos.doc.resolve(i);if(!o&&s.depth<=this.depth)return;const l=new dc(s,this.editor,o,o?t:null);o&&(l.actualDepth=this.depth+1),e.push(new dc(s,this.editor,o,o?t:null))})),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,t={}){let n=null,o=this.parent;for(;o&&!n;){if(o.node.type.name===e)if(Object.keys(t).length>0){const e=o.node.attrs,n=Object.keys(t);for(let o=0;o<n.length;o+=1){const r=n[o];if(e[r]!==t[r])break}}else n=o;o=o.parent}return n}querySelector(e,t={}){return this.querySelectorAll(e,t,!0)[0]||null}querySelectorAll(e,t={},n=!1){let o=[];if(!this.children||0===this.children.length)return o;const r=Object.keys(t);return this.children.forEach((i=>{if(!(n&&o.length>0)){if(i.node.type.name===e){r.every((e=>t[e]===i.node.attrs[e]))&&o.push(i)}n&&o.length>0||(o=o.concat(i.querySelectorAll(e,t,n)))}})),o}setAttribute(e){const{tr:t}=this.editor.state;t.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(t)}}let hc=class extends Yl{constructor(e={}){super(),this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.options={element:document.createElement("div"),content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,onBeforeCreate:()=>null,onCreate:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:e})=>{throw e},onPaste:()=>null,onDrop:()=>null},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.setOptions(e),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("contentError",this.options.onContentError),this.createView(),this.injectCSS(),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("drop",(({event:e,slice:t,moved:n})=>this.options.onDrop(e,t,n))),this.on("paste",(({event:e,slice:t})=>this.options.onPaste(e,t))),window.setTimeout((()=>{this.isDestroyed||(this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)}),0)}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&document&&(this.css=function(e,t){const n=document.querySelector("style[data-tiptap-style]");if(null!==n)return n;const o=document.createElement("style");return t&&o.setAttribute("nonce",t),o.setAttribute("data-tiptap-style",""),o.innerHTML=e,document.getElementsByTagName("head")[0].appendChild(o),o}('.ProseMirror {\n  position: relative;\n}\n\n.ProseMirror {\n  word-wrap: break-word;\n  white-space: pre-wrap;\n  white-space: break-spaces;\n  -webkit-font-variant-ligatures: none;\n  font-variant-ligatures: none;\n  font-feature-settings: "liga" 0; /* the above doesn\'t seem to work in Edge */\n}\n\n.ProseMirror [contenteditable="false"] {\n  white-space: normal;\n}\n\n.ProseMirror [contenteditable="false"] [contenteditable="true"] {\n  white-space: pre-wrap;\n}\n\n.ProseMirror pre {\n  white-space: pre-wrap;\n}\n\nimg.ProseMirror-separator {\n  display: inline !important;\n  border: none !important;\n  margin: 0 !important;\n  width: 0 !important;\n  height: 0 !important;\n}\n\n.ProseMirror-gapcursor {\n  display: none;\n  pointer-events: none;\n  position: absolute;\n  margin: 0;\n}\n\n.ProseMirror-gapcursor:after {\n  content: "";\n  display: block;\n  position: absolute;\n  top: -2px;\n  width: 20px;\n  border-top: 1px solid black;\n  animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;\n}\n\n@keyframes ProseMirror-cursor-blink {\n  to {\n    visibility: hidden;\n  }\n}\n\n.ProseMirror-hideselection *::selection {\n  background: transparent;\n}\n\n.ProseMirror-hideselection *::-moz-selection {\n  background: transparent;\n}\n\n.ProseMirror-hideselection * {\n  caret-color: transparent;\n}\n\n.ProseMirror-focused .ProseMirror-gapcursor {\n  display: block;\n}\n\n.tippy-box[data-animation=fade][data-state=hidden] {\n  opacity: 0\n}',this.options.injectNonce))}setOptions(e={}){this.options={...this.options,...e},this.view&&this.state&&!this.isDestroyed&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(e,t=!0){this.setOptions({editable:e}),t&&this.emit("update",{editor:this,transaction:this.state.tr})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get state(){return this.view.state}registerPlugin(e,t){const n=oa(t)?t(e,[...this.state.plugins]):[...this.state.plugins,e],o=this.state.reconfigure({plugins:n});return this.view.updateState(o),o}unregisterPlugin(e){if(this.isDestroyed)return;const t=this.state.plugins;let n=t;if([].concat(e).forEach((e=>{const o="string"==typeof e?`${e}$`:e.key;n=t.filter((e=>!e.key.startsWith(o)))})),t.length===n.length)return;const o=this.state.reconfigure({plugins:n});return this.view.updateState(o),o}createExtensionManager(){var e,t;const n=[...this.options.enableCoreExtensions?[rc,Ca.configure({blockSeparator:null===(t=null===(e=this.options.coreExtensionOptions)||void 0===e?void 0:e.clipboardTextSerializer)||void 0===t?void 0:t.blockSeparator}),nc,sc,lc,cc,oc,ac].filter((e=>"object"!=typeof this.options.enableCoreExtensions||!1!==this.options.enableCoreExtensions[e.name])):[],...this.options.extensions].filter((e=>["extension","node","mark"].includes(null==e?void 0:e.type)));this.extensionManager=new ka(n,this)}createCommandManager(){this.commandManager=new Gl({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createView(){var e;let t;try{t=Fa(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(r){if(!(r instanceof Error&&["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(r.message)))throw r;this.emit("contentError",{editor:this,error:r,disableCollaboration:()=>{this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter((e=>"collaboration"!==e.name)),this.createExtensionManager()}}),t=Fa(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}const n=Va(t,this.options.autofocus);this.view=new al(this.options.element,{...this.options.editorProps,attributes:{role:"textbox",...null===(e=this.options.editorProps)||void 0===e?void 0:e.attributes},dispatchTransaction:this.dispatchTransaction.bind(this),state:Wo.create({doc:t,selection:n||void 0})});const o=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(o),this.createNodeViews(),this.prependClass();this.view.dom.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`tiptap ${this.view.dom.className}`}captureTransaction(e){this.isCapturingTransaction=!0,e(),this.isCapturingTransaction=!1;const t=this.capturedTransaction;return this.capturedTransaction=null,t}dispatchTransaction(e){if(this.view.isDestroyed)return;if(this.isCapturingTransaction)return this.capturedTransaction?void e.steps.forEach((e=>{var t;return null===(t=this.capturedTransaction)||void 0===t?void 0:t.step(e)})):void(this.capturedTransaction=e);const t=this.state.apply(e),n=!this.state.selection.eq(t.selection);this.emit("beforeTransaction",{editor:this,transaction:e,nextState:t}),this.view.updateState(t),this.emit("transaction",{editor:this,transaction:e}),n&&this.emit("selectionUpdate",{editor:this,transaction:e});const o=e.getMeta("focus"),r=e.getMeta("blur");o&&this.emit("focus",{editor:this,event:o.event,transaction:e}),r&&this.emit("blur",{editor:this,event:r.event,transaction:e}),e.docChanged&&!e.getMeta("preventUpdate")&&this.emit("update",{editor:this,transaction:e})}getAttributes(e){return Wa(this.state,e)}isActive(e,t){const n="string"==typeof e?e:null,o="string"==typeof e?t:e;return function(e,t,n={}){if(!t)return Ba(e,null,n)||Ga(e,null,n);const o=Ha(t,e.schema);return"node"===o?Ba(e,t,n):"mark"===o&&Ga(e,t,n)}(this.state,n,o)}getJSON(){return this.state.doc.toJSON()}getHTML(){return ca(this.state.doc.content,this.schema)}getText(e){const{blockSeparator:t="\n\n",textSerializers:n={}}=e||{};return function(e,t){return Ma(e,{from:0,to:e.content.size},t)}(this.state.doc,{blockSeparator:t,textSerializers:{...Sa(this.schema),...n}})}get isEmpty(){return Xa(this.state.doc)}getCharacterCount(){return console.warn('[tiptap warn]: "editor.getCharacterCount()" is deprecated. Please use "editor.storage.characterCount.characters()" instead.'),this.state.doc.content.size-2}destroy(){if(this.emit("destroy"),this.view){const e=this.view.dom;e&&e.editor&&delete e.editor,this.view.destroy()}this.removeAllListeners()}get isDestroyed(){var e;return!(null===(e=this.view)||void 0===e?void 0:e.docView)}$node(e,t){var n;return(null===(n=this.$doc)||void 0===n?void 0:n.querySelector(e,t))||null}$nodes(e,t){var n;return(null===(n=this.$doc)||void 0===n?void 0:n.querySelectorAll(e,t))||null}$pos(e){const t=this.state.doc.resolve(e);return new dc(t,this)}get $doc(){return this.$pos(0)}};function uc(e){return new ha({find:e.find,handler:({state:t,range:n,match:o})=>{const r=ra(e.getAttributes,void 0,o);if(!1===r||null===r)return null;const{tr:i}=t,s=o[o.length-1],l=o[0];if(s){const o=l.search(/\S/),a=n.from+l.indexOf(s),c=a+s.length;if(Ka(n.from,n.to,t.doc).filter((t=>t.mark.type.excluded.find((n=>n===e.type&&n!==t.mark.type)))).filter((e=>e.to>a)).length)return null;c<n.to&&i.delete(c,n.to),a>n.from&&i.delete(n.from+o,a);const d=n.from+o+s.length;i.addMark(n.from+o,d,e.type.create(r||{})),i.removeStoredMark(e.type)}}})}function pc(e){return new ha({find:e.find,handler:({state:t,range:n,match:o})=>{const r=t.doc.resolve(n.from),i=ra(e.getAttributes,void 0,o)||{};if(!r.node(-1).canReplaceWith(r.index(-1),r.indexAfter(-1),e.type))return null;t.tr.delete(n.from,n.to).setBlockType(n.from,n.from,e.type,i)}})}function fc(e){return new ha({find:e.find,handler:({state:t,range:n,match:o,chain:r})=>{const i=ra(e.getAttributes,void 0,o)||{},s=t.tr.delete(n.from,n.to),l=s.doc.resolve(n.from).blockRange(),a=l&&oo(l,e.type,i);if(!a)return null;if(s.wrap(l,a),e.keepMarks&&e.editor){const{selection:n,storedMarks:o}=t,{splittableMarks:r}=e.editor.extensionManager,i=o||n.$to.parentOffset&&n.$from.marks();if(i){const e=i.filter((e=>r.includes(e.type.name)));s.ensureMarks(e)}}if(e.keepAttributes){const t="bulletList"===e.type.name||"orderedList"===e.type.name?"listItem":"taskList";r().updateAttributes(t,i).run()}const c=s.doc.resolve(n.from-1).nodeBefore;c&&c.type===e.type&&ao(s.doc,n.from-1)&&(!e.joinPredicate||e.joinPredicate(o,c))&&s.join(n.from-1)}})}class mc{constructor(e={}){this.type="node",this.name="node",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=ra(Xl(this,"addOptions",{name:this.name}))),this.storage=ra(Xl(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new mc(e)}configure(e={}){const t=this.extend({...this.config,addOptions:()=>ma(this.options,e)});return t.name=this.name,t.parent=this.parent,t}extend(e={}){const t=new mc(e);return t.parent=this,this.child=t,t.name=e.name?e.name:t.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${t.name}".`),t.options=ra(Xl(t,"addOptions",{name:t.name})),t.storage=ra(Xl(t,"addStorage",{name:t.name,options:t.options})),t}}function gc(e){return new ya({find:e.find,handler:({state:t,range:n,match:o,pasteEvent:r})=>{const i=ra(e.getAttributes,void 0,o,r);if(!1===i||null===i)return null;const{tr:s}=t,l=o[o.length-1],a=o[0];let c=n.to;if(l){const o=a.search(/\S/),r=n.from+a.indexOf(l),d=r+l.length;if(Ka(n.from,n.to,t.doc).filter((t=>t.mark.type.excluded.find((n=>n===e.type&&n!==t.mark.type)))).filter((e=>e.to>r)).length)return null;d<n.to&&s.delete(d,n.to),r>n.from&&s.delete(n.from+o,r),c=n.from+o+l.length,s.addMark(n.from+o,c,e.type.create(i||{})),s.removeStoredMark(e.type)}}})}function yc(e){return de(((t,n)=>({get:()=>(t(),e),set(t){e=t,requestAnimationFrame((()=>{requestAnimationFrame((()=>{n()}))}))}})))}class vc extends hc{constructor(e={}){return super(e),this.contentComponent=null,this.appContext=null,this.reactiveState=yc(this.view.state),this.reactiveExtensionStorage=yc(this.extensionStorage),this.on("beforeTransaction",(({nextState:e})=>{this.reactiveState.value=e,this.reactiveExtensionStorage.value=this.extensionStorage})),ce(this)}get state(){return this.reactiveState?this.reactiveState.value:this.view.state}get storage(){return this.reactiveExtensionStorage?this.reactiveExtensionStorage.value:super.storage}registerPlugin(e,t){const n=super.registerPlugin(e,t);return this.reactiveState&&(this.reactiveState.value=n),n}unregisterPlugin(e){const t=super.unregisterPlugin(e);return this.reactiveState&&t&&(this.reactiveState.value=t),t}}const bc=f({name:"EditorContent",props:{editor:{default:null,type:Object}},setup(e){const t=l(),n=u();return D((()=>{const o=e.editor;o&&o.options.element&&t.value&&$((()=>{if(!t.value||!o.options.element.firstChild)return;const e=v(t.value);t.value.append(...o.options.element.childNodes),o.contentComponent=n.ctx._,n&&(o.appContext={...n.appContext,provides:n.provides}),o.setOptions({element:e}),o.createNodeViews()}))})),re((()=>{const t=e.editor;t&&(t.contentComponent=null,t.appContext=null)})),{rootEl:t}},render(){return ae("div",{ref:e=>{this.rootEl=e}})}}),wc=ga.create({name:"underline",addOptions:()=>({HTMLAttributes:{}}),parseHTML:()=>[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:e=>!!e.includes("underline")&&{}}],renderHTML({HTMLAttributes:e}){return["u",ta(this.options.HTMLAttributes,e),0]},addCommands(){return{setUnderline:()=>({commands:e})=>e.setMark(this.name),toggleUnderline:()=>({commands:e})=>e.toggleMark(this.name),unsetUnderline:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}}),kc=/^\s*>\s$/,xc=mc.create({name:"blockquote",addOptions:()=>({HTMLAttributes:{}}),content:"block+",group:"block",defining:!0,parseHTML:()=>[{tag:"blockquote"}],renderHTML({HTMLAttributes:e}){return["blockquote",ta(this.options.HTMLAttributes,e),0]},addCommands(){return{setBlockquote:()=>({commands:e})=>e.wrapIn(this.name),toggleBlockquote:()=>({commands:e})=>e.toggleWrap(this.name),unsetBlockquote:()=>({commands:e})=>e.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[fc({find:kc,type:this.type})]}}),Mc=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,Sc=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,Cc=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,Oc=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,Tc=ga.create({name:"bold",addOptions:()=>({HTMLAttributes:{}}),parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:e=>"normal"!==e.style.fontWeight&&null},{style:"font-weight=400",clearMark:e=>e.type.name===this.name},{style:"font-weight",getAttrs:e=>/^(bold(er)?|[5-9]\d{2,})$/.test(e)&&null}]},renderHTML({HTMLAttributes:e}){return["strong",ta(this.options.HTMLAttributes,e),0]},addCommands(){return{setBold:()=>({commands:e})=>e.setMark(this.name),toggleBold:()=>({commands:e})=>e.toggleMark(this.name),unsetBold:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[uc({find:Mc,type:this.type}),uc({find:Cc,type:this.type})]},addPasteRules(){return[gc({find:Sc,type:this.type}),gc({find:Oc,type:this.type})]}}),Ac="textStyle",Ec=/^\s*([-+*])\s$/,Nc=mc.create({name:"bulletList",addOptions:()=>({itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}),group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML:()=>[{tag:"ul"}],renderHTML({HTMLAttributes:e}){return["ul",ta(this.options.HTMLAttributes,e),0]},addCommands(){return{toggleBulletList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes("listItem",this.editor.getAttributes(Ac)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let e=fc({find:Ec,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(e=fc({find:Ec,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(Ac),editor:this.editor})),[e]}}),Dc=/(^|[^`])`([^`]+)`(?!`)/,Rc=/(^|[^`])`([^`]+)`(?!`)/g,Vc=ga.create({name:"code",addOptions:()=>({HTMLAttributes:{}}),excludes:"_",code:!0,exitable:!0,parseHTML:()=>[{tag:"code"}],renderHTML({HTMLAttributes:e}){return["code",ta(this.options.HTMLAttributes,e),0]},addCommands(){return{setCode:()=>({commands:e})=>e.setMark(this.name),toggleCode:()=>({commands:e})=>e.toggleMark(this.name),unsetCode:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[uc({find:Dc,type:this.type})]},addPasteRules(){return[gc({find:Rc,type:this.type})]}}),Ic=/^```([a-z]+)?[\s\n]$/,zc=/^~~~([a-z]+)?[\s\n]$/,Lc=mc.create({name:"codeBlock",addOptions:()=>({languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,HTMLAttributes:{}}),content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:e=>{var t;const{languageClassPrefix:n}=this.options,o=[...(null===(t=e.firstElementChild)||void 0===t?void 0:t.classList)||[]].filter((e=>e.startsWith(n))).map((e=>e.replace(n,"")))[0];return o||null},rendered:!1}}},parseHTML:()=>[{tag:"pre",preserveWhitespace:"full"}],renderHTML({node:e,HTMLAttributes:t}){return["pre",ta(this.options.HTMLAttributes,t),["code",{class:e.attrs.language?this.options.languageClassPrefix+e.attrs.language:null},0]]},addCommands(){return{setCodeBlock:e=>({commands:t})=>t.setNode(this.name,e),toggleCodeBlock:e=>({commands:t})=>t.toggleNode(this.name,"paragraph",e)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:e,$anchor:t}=this.editor.state.selection,n=1===t.pos;return!(!e||t.parent.type.name!==this.name)&&(!(!n&&t.parent.textContent.length)&&this.editor.commands.clearNodes())},Enter:({editor:e})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:t}=e,{selection:n}=t,{$from:o,empty:r}=n;if(!r||o.parent.type!==this.type)return!1;const i=o.parentOffset===o.parent.nodeSize-2,s=o.parent.textContent.endsWith("\n\n");return!(!i||!s)&&e.chain().command((({tr:e})=>(e.delete(o.pos-2,o.pos),!0))).exitCode().run()},ArrowDown:({editor:e})=>{if(!this.options.exitOnArrowDown)return!1;const{state:t}=e,{selection:n,doc:o}=t,{$from:r,empty:i}=n;if(!i||r.parent.type!==this.type)return!1;if(!(r.parentOffset===r.parent.nodeSize-2))return!1;const s=r.after();if(void 0===s)return!1;return o.nodeAt(s)?e.commands.command((({tr:e})=>(e.setSelection(Ao.near(o.resolve(s))),!0))):e.commands.exitCode()}}},addInputRules(){return[pc({find:Ic,type:this.type,getAttributes:e=>({language:e[1]})}),pc({find:zc,type:this.type,getAttributes:e=>({language:e[1]})})]},addProseMirrorPlugins(){return[new Ko({key:new Yo("codeBlockVSCodeHandler"),props:{handlePaste:(e,t)=>{if(!t.clipboardData)return!1;if(this.editor.isActive(this.type.name))return!1;const n=t.clipboardData.getData("text/plain"),o=t.clipboardData.getData("vscode-editor-data"),r=o?JSON.parse(o):void 0,i=null==r?void 0:r.mode;if(!n||!i)return!1;const{tr:s,schema:l}=e.state,a=l.text(n.replace(/\r\n?/g,"\n"));return s.replaceSelectionWith(this.type.create({language:i},a)),s.selection.$from.parent.type!==this.type&&s.setSelection(Ro.near(s.doc.resolve(Math.max(0,s.selection.from-2)))),s.setMeta("paste",!0),e.dispatch(s),!0}}})]}}),Pc=mc.create({name:"doc",topNode:!0,content:"block+"});function $c(e={}){return new Ko({view:t=>new Bc(t,e)})}class Bc{constructor(e,t){var n;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=null!==(n=t.width)&&void 0!==n?n:1,this.color=!1===t.color?void 0:t.color||"black",this.class=t.class,this.handlers=["dragover","dragend","drop","dragleave"].map((t=>{let n=e=>{this[t](e)};return e.dom.addEventListener(t,n),{name:t,handler:n}}))}destroy(){this.handlers.forEach((({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t)))}update(e,t){null!=this.cursorPos&&t.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,null==e?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e,t=this.editorView.state.doc.resolve(this.cursorPos),n=!t.parent.inlineContent;if(n){let n=t.nodeBefore,o=t.nodeAfter;if(n||o){let t=this.editorView.nodeDOM(this.cursorPos-(n?n.nodeSize:0));if(t){let r=t.getBoundingClientRect(),i=n?r.bottom:r.top;n&&o&&(i=(i+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2),e={left:r.left,right:r.right,top:i-this.width/2,bottom:i+this.width/2}}}}if(!e){let t=this.editorView.coordsAtPos(this.cursorPos);e={left:t.left-this.width/2,right:t.left+this.width/2,top:t.top,bottom:t.bottom}}let o,r,i=this.editorView.dom.offsetParent;if(this.element||(this.element=i.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n),!i||i==document.body&&"static"==getComputedStyle(i).position)o=-pageXOffset,r=-pageYOffset;else{let e=i.getBoundingClientRect();o=e.left-i.scrollLeft,r=e.top-i.scrollTop}this.element.style.left=e.left-o+"px",this.element.style.top=e.top-r+"px",this.element.style.width=e.right-e.left+"px",this.element.style.height=e.bottom-e.top+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout((()=>this.setCursor(null)),e)}dragover(e){if(!this.editorView.editable)return;let t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),n=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),o=n&&n.type.spec.disableDropCursor,r="function"==typeof o?o(this.editorView,t,e):o;if(t&&!r){let e=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let t=uo(this.editorView.state.doc,e,this.editorView.dragging.slice);null!=t&&(e=t)}this.setCursor(e),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){e.target!=this.editorView.dom&&this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}const Hc=xa.create({name:"dropCursor",addOptions:()=>({color:"currentColor",width:1,class:void 0}),addProseMirrorPlugins(){return[$c(this.options)]}});class _c extends Ao{constructor(e){super(e,e)}map(e,t){let n=e.resolve(t.map(this.head));return _c.valid(n)?new _c(n):Ao.near(n)}content(){return Lt.empty}eq(e){return e instanceof _c&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,t){if("number"!=typeof t.pos)throw new RangeError("Invalid input for GapCursor.fromJSON");return new _c(e.resolve(t.pos))}getBookmark(){return new Fc(this.anchor)}static valid(e){let t=e.parent;if(t.isTextblock||!function(e){for(let t=e.depth;t>=0;t--){let n=e.index(t),o=e.node(t);if(0!=n)for(let e=o.child(n-1);;e=e.lastChild){if(0==e.childCount&&!e.inlineContent||e.isAtom||e.type.spec.isolating)return!0;if(e.inlineContent)return!1}else if(o.type.spec.isolating)return!0}return!0}(e)||!function(e){for(let t=e.depth;t>=0;t--){let n=e.indexAfter(t),o=e.node(t);if(n!=o.childCount)for(let e=o.child(n);;e=e.firstChild){if(0==e.childCount&&!e.inlineContent||e.isAtom||e.type.spec.isolating)return!0;if(e.inlineContent)return!1}else if(o.type.spec.isolating)return!0}return!0}(e))return!1;let n=t.type.spec.allowGapCursor;if(null!=n)return n;let o=t.contentMatchAt(e.index()).defaultType;return o&&o.isTextblock}static findGapCursorFrom(e,t,n=!1){e:for(;;){if(!n&&_c.valid(e))return e;let o=e.pos,r=null;for(let n=e.depth;;n--){let i=e.node(n);if(t>0?e.indexAfter(n)<i.childCount:e.index(n)>0){r=i.child(t>0?e.indexAfter(n):e.index(n)-1);break}if(0==n)return null;o+=t;let s=e.doc.resolve(o);if(_c.valid(s))return s}for(;;){let i=t>0?r.firstChild:r.lastChild;if(!i){if(r.isAtom&&!r.isText&&!Io.isSelectable(r)){e=e.doc.resolve(o+r.nodeSize*t),n=!1;continue e}break}r=i,o+=t;let s=e.doc.resolve(o);if(_c.valid(s))return s}return null}}}_c.prototype.visible=!1,_c.findFrom=_c.findGapCursorFrom,Ao.jsonID("gapcursor",_c);class Fc{constructor(e){this.pos=e}map(e){return new Fc(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return _c.valid(t)?new _c(t):Ao.near(t)}}const jc=Ml({ArrowLeft:Uc("horiz",-1),ArrowRight:Uc("horiz",1),ArrowUp:Uc("vert",-1),ArrowDown:Uc("vert",1)});function Uc(e,t){const n="vert"==e?t>0?"down":"up":t>0?"right":"left";return function(e,o,r){let i=e.selection,s=t>0?i.$to:i.$from,l=i.empty;if(i instanceof Ro){if(!r.endOfTextblock(n)||0==s.depth)return!1;l=!1,s=e.doc.resolve(t>0?s.after():s.before())}let a=_c.findGapCursorFrom(s,t,l);return!!a&&(o&&o(e.tr.setSelection(new _c(a))),!0)}}function Wc(e,t,n){if(!e||!e.editable)return!1;let o=e.state.doc.resolve(t);if(!_c.valid(o))return!1;let r=e.posAtCoords({left:n.clientX,top:n.clientY});return!(r&&r.inside>-1&&Io.isSelectable(e.state.doc.nodeAt(r.inside)))&&(e.dispatch(e.state.tr.setSelection(new _c(o))),!0)}function qc(e,t){if("insertCompositionText"!=t.inputType||!(e.state.selection instanceof _c))return!1;let{$from:n}=e.state.selection,o=n.parent.contentMatchAt(n.index()).findWrapping(e.state.schema.nodes.text);if(!o)return!1;let r=Nt.empty;for(let s=o.length-1;s>=0;s--)r=Nt.from(o[s].createAndFill(null,r));let i=e.state.tr.replace(n.pos,n.pos,new Lt(r,0,0));return i.setSelection(Ro.near(i.doc.resolve(n.pos+1))),e.dispatch(i),!1}function Kc(e){if(!(e.selection instanceof _c))return null;let t=document.createElement("div");return t.className="ProseMirror-gapcursor",Ps.create(e.doc,[Is.widget(e.selection.head,t,{key:"gapcursor"})])}const Jc=xa.create({name:"gapCursor",addProseMirrorPlugins:()=>[new Ko({props:{decorations:Kc,createSelectionBetween:(e,t,n)=>t.pos==n.pos&&_c.valid(n)?new _c(n):null,handleClick:Wc,handleKeyDown:jc,handleDOMEvents:{beforeinput:qc}}})],extendNodeSchema(e){var t;return{allowGapCursor:null!==(t=ra(Xl(e,"allowGapCursor",{name:e.name,options:e.options,storage:e.storage})))&&void 0!==t?t:null}}}),Gc=mc.create({name:"hardBreak",addOptions:()=>({keepMarks:!0,HTMLAttributes:{}}),inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML:()=>[{tag:"br"}],renderHTML({HTMLAttributes:e}){return["br",ta(this.options.HTMLAttributes,e)]},renderText:()=>"\n",addCommands(){return{setHardBreak:()=>({commands:e,chain:t,state:n,editor:o})=>e.first([()=>e.exitCode(),()=>e.command((()=>{const{selection:e,storedMarks:r}=n;if(e.$from.parent.type.spec.isolating)return!1;const{keepMarks:i}=this.options,{splittableMarks:s}=o.extensionManager,l=r||e.$to.parentOffset&&e.$from.marks();return t().insertContent({type:this.name}).command((({tr:e,dispatch:t})=>{if(t&&l&&i){const t=l.filter((e=>s.includes(e.type.name)));e.ensureMarks(t)}return!0})).run()}))])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),Yc=mc.create({name:"heading",addOptions:()=>({levels:[1,2,3,4,5,6],HTMLAttributes:{}}),content:"inline*",group:"block",defining:!0,addAttributes:()=>({level:{default:1,rendered:!1}}),parseHTML(){return this.options.levels.map((e=>({tag:`h${e}`,attrs:{level:e}})))},renderHTML({node:e,HTMLAttributes:t}){return[`h${this.options.levels.includes(e.attrs.level)?e.attrs.level:this.options.levels[0]}`,ta(this.options.HTMLAttributes,t),0]},addCommands(){return{setHeading:e=>({commands:t})=>!!this.options.levels.includes(e.level)&&t.setNode(this.name,e),toggleHeading:e=>({commands:t})=>!!this.options.levels.includes(e.level)&&t.toggleNode(this.name,"paragraph",e)}},addKeyboardShortcuts(){return this.options.levels.reduce(((e,t)=>({...e,[`Mod-Alt-${t}`]:()=>this.editor.commands.toggleHeading({level:t})})),{})},addInputRules(){return this.options.levels.map((e=>pc({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${e}})\\s$`),type:this.type,getAttributes:{level:e}})))}});var Xc=200,Qc=function(){};Qc.prototype.append=function(e){return e.length?(e=Qc.from(e),!this.length&&e||e.length<Xc&&this.leafAppend(e)||this.length<Xc&&e.leafPrepend(this)||this.appendInner(e)):this},Qc.prototype.prepend=function(e){return e.length?Qc.from(e).append(this):this},Qc.prototype.appendInner=function(e){return new ed(this,e)},Qc.prototype.slice=function(e,t){return void 0===e&&(e=0),void 0===t&&(t=this.length),e>=t?Qc.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))},Qc.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},Qc.prototype.forEach=function(e,t,n){void 0===t&&(t=0),void 0===n&&(n=this.length),t<=n?this.forEachInner(e,t,n,0):this.forEachInvertedInner(e,t,n,0)},Qc.prototype.map=function(e,t,n){void 0===t&&(t=0),void 0===n&&(n=this.length);var o=[];return this.forEach((function(t,n){return o.push(e(t,n))}),t,n),o},Qc.from=function(e){return e instanceof Qc?e:e&&e.length?new Zc(e):Qc.empty};var Zc=function(e){function t(t){e.call(this),this.values=t}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={length:{configurable:!0},depth:{configurable:!0}};return t.prototype.flatten=function(){return this.values},t.prototype.sliceInner=function(e,n){return 0==e&&n==this.length?this:new t(this.values.slice(e,n))},t.prototype.getInner=function(e){return this.values[e]},t.prototype.forEachInner=function(e,t,n,o){for(var r=t;r<n;r++)if(!1===e(this.values[r],o+r))return!1},t.prototype.forEachInvertedInner=function(e,t,n,o){for(var r=t-1;r>=n;r--)if(!1===e(this.values[r],o+r))return!1},t.prototype.leafAppend=function(e){if(this.length+e.length<=Xc)return new t(this.values.concat(e.flatten()))},t.prototype.leafPrepend=function(e){if(this.length+e.length<=Xc)return new t(e.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(t.prototype,n),t}(Qc);Qc.empty=new Zc([]);var ed=function(e){function t(t,n){e.call(this),this.left=t,this.right=n,this.length=t.length+n.length,this.depth=Math.max(t.depth,n.depth)+1}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},t.prototype.getInner=function(e){return e<this.left.length?this.left.get(e):this.right.get(e-this.left.length)},t.prototype.forEachInner=function(e,t,n,o){var r=this.left.length;return!(t<r&&!1===this.left.forEachInner(e,t,Math.min(n,r),o))&&(!(n>r&&!1===this.right.forEachInner(e,Math.max(t-r,0),Math.min(this.length,n)-r,o+r))&&void 0)},t.prototype.forEachInvertedInner=function(e,t,n,o){var r=this.left.length;return!(t>r&&!1===this.right.forEachInvertedInner(e,t-r,Math.max(n,r)-r,o+r))&&(!(n<r&&!1===this.left.forEachInvertedInner(e,Math.min(t,r),n,o))&&void 0)},t.prototype.sliceInner=function(e,t){if(0==e&&t==this.length)return this;var n=this.left.length;return t<=n?this.left.slice(e,t):e>=n?this.right.slice(e-n,t-n):this.left.slice(e,n).append(this.right.slice(0,t-n))},t.prototype.leafAppend=function(e){var n=this.right.leafAppend(e);if(n)return new t(this.left,n)},t.prototype.leafPrepend=function(e){var n=this.left.leafPrepend(e);if(n)return new t(n,this.right)},t.prototype.appendInner=function(e){return this.left.depth>=Math.max(this.right.depth,e.depth)+1?new t(this.left,new t(this.right,e)):new t(this,e)},t}(Qc);class td{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){if(0==this.eventCount)return null;let n,o,r=this.items.length;for(;;r--){if(this.items.get(r-1).selection){--r;break}}t&&(n=this.remapping(r,this.items.length),o=n.maps.length);let i,s,l=e.tr,a=[],c=[];return this.items.forEach(((e,t)=>{if(!e.step)return n||(n=this.remapping(r,t+1),o=n.maps.length),o--,void c.push(e);if(n){c.push(new nd(e.map));let t,r=e.step.map(n.slice(o));r&&l.maybeStep(r).doc&&(t=l.mapping.maps[l.mapping.maps.length-1],a.push(new nd(t,void 0,void 0,a.length+c.length))),o--,t&&n.appendMap(t,o)}else l.maybeStep(e.step);return e.selection?(i=n?e.selection.map(n.slice(o)):e.selection,s=new td(this.items.slice(0,r).append(c.reverse().concat(a)),this.eventCount-1),!1):void 0}),this.items.length,0),{remaining:s,transform:l,selection:i}}addTransform(e,t,n,o){let r=[],i=this.eventCount,s=this.items,l=!o&&s.length?s.get(s.length-1):null;for(let c=0;c<e.steps.length;c++){let n,a=e.steps[c].invert(e.docs[c]),d=new nd(e.mapping.maps[c],a,t);(n=l&&l.merge(d))&&(d=n,c?r.pop():s=s.slice(0,s.length-1)),r.push(d),t&&(i++,t=void 0),o||(l=d)}let a=i-n.depth;return a>rd&&(s=function(e,t){let n;return e.forEach(((e,o)=>{if(e.selection&&0==t--)return n=o,!1})),e.slice(n)}(s,a),i-=a),new td(s.append(r),i)}remapping(e,t){let n=new Fn;return this.items.forEach(((t,o)=>{let r=null!=t.mirrorOffset&&o-t.mirrorOffset>=e?n.maps.length-t.mirrorOffset:void 0;n.appendMap(t.map,r)}),e,t),n}addMaps(e){return 0==this.eventCount?this:new td(this.items.append(e.map((e=>new nd(e)))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let n=[],o=Math.max(0,this.items.length-t),r=e.mapping,i=e.steps.length,s=this.eventCount;this.items.forEach((e=>{e.selection&&s--}),o);let l=t;this.items.forEach((t=>{let o=r.getMirror(--l);if(null==o)return;i=Math.min(i,o);let a=r.maps[o];if(t.step){let i=e.steps[o].invert(e.docs[o]),c=t.selection&&t.selection.map(r.slice(l+1,o));c&&s++,n.push(new nd(a,i,c))}else n.push(new nd(a))}),o);let a=[];for(let h=t;h<i;h++)a.push(new nd(r.maps[h]));let c=this.items.slice(0,o).append(a).append(n),d=new td(c,s);return d.emptyItemCount()>500&&(d=d.compress(this.items.length-n.length)),d}emptyItemCount(){let e=0;return this.items.forEach((t=>{t.step||e++})),e}compress(e=this.items.length){let t=this.remapping(0,e),n=t.maps.length,o=[],r=0;return this.items.forEach(((i,s)=>{if(s>=e)o.push(i),i.selection&&r++;else if(i.step){let e=i.step.map(t.slice(n)),s=e&&e.getMap();if(n--,s&&t.appendMap(s,n),e){let l=i.selection&&i.selection.map(t.slice(n));l&&r++;let a,c=new nd(s.invert(),e,l),d=o.length-1;(a=o.length&&o[d].merge(c))?o[d]=a:o.push(c)}}else i.map&&n--}),this.items.length,0),new td(Qc.from(o.reverse()),r)}}td.empty=new td(Qc.empty,0);class nd{constructor(e,t,n,o){this.map=e,this.step=t,this.selection=n,this.mirrorOffset=o}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new nd(t.getMap().invert(),t,this.selection)}}}class od{constructor(e,t,n,o,r){this.done=e,this.undone=t,this.prevRanges=n,this.prevTime=o,this.prevComposition=r}}const rd=20;function id(e){let t=[];for(let n=e.length-1;n>=0&&0==t.length;n--)e[n].forEach(((e,n,o,r)=>t.push(o,r)));return t}function sd(e,t){if(!e)return null;let n=[];for(let o=0;o<e.length;o+=2){let r=t.map(e[o],1),i=t.map(e[o+1],-1);r<=i&&n.push(r,i)}return n}let ld=!1,ad=null;function cd(e){let t=e.plugins;if(ad!=t){ld=!1,ad=t;for(let e=0;e<t.length;e++)if(t[e].spec.historyPreserveItems){ld=!0;break}}return ld}const dd=new Yo("history"),hd=new Yo("closeHistory");function ud(e={}){return e={depth:e.depth||100,newGroupDelay:e.newGroupDelay||500},new Ko({key:dd,state:{init:()=>new od(td.empty,td.empty,null,0,-1),apply:(t,n,o)=>function(e,t,n,o){let r,i=n.getMeta(dd);if(i)return i.historyState;n.getMeta(hd)&&(e=new od(e.done,e.undone,null,0,-1));let s=n.getMeta("appendedTransaction");if(0==n.steps.length)return e;if(s&&s.getMeta(dd))return s.getMeta(dd).redo?new od(e.done.addTransform(n,void 0,o,cd(t)),e.undone,id(n.mapping.maps),e.prevTime,e.prevComposition):new od(e.done,e.undone.addTransform(n,void 0,o,cd(t)),null,e.prevTime,e.prevComposition);if(!1===n.getMeta("addToHistory")||s&&!1===s.getMeta("addToHistory"))return(r=n.getMeta("rebased"))?new od(e.done.rebased(n,r),e.undone.rebased(n,r),sd(e.prevRanges,n.mapping),e.prevTime,e.prevComposition):new od(e.done.addMaps(n.mapping.maps),e.undone.addMaps(n.mapping.maps),sd(e.prevRanges,n.mapping),e.prevTime,e.prevComposition);{let r=n.getMeta("composition"),i=0==e.prevTime||!s&&e.prevComposition!=r&&(e.prevTime<(n.time||0)-o.newGroupDelay||!function(e,t){if(!t)return!1;if(!e.docChanged)return!0;let n=!1;return e.mapping.maps[0].forEach(((e,o)=>{for(let r=0;r<t.length;r+=2)e<=t[r+1]&&o>=t[r]&&(n=!0)})),n}(n,e.prevRanges)),l=s?sd(e.prevRanges,n.mapping):id(n.mapping.maps);return new od(e.done.addTransform(n,i?t.selection.getBookmark():void 0,o,cd(t)),td.empty,l,n.time,null==r?e.prevComposition:r)}}(n,o,t,e)},config:e,props:{handleDOMEvents:{beforeinput(e,t){let n=t.inputType,o="historyUndo"==n?fd:"historyRedo"==n?md:null;return!!o&&(t.preventDefault(),o(e.state,e.dispatch))}}}})}function pd(e,t){return(n,o)=>{let r=dd.getState(n);if(!r||0==(e?r.undone:r.done).eventCount)return!1;if(o){let i=function(e,t,n){let o=cd(t),r=dd.get(t).spec.config,i=(n?e.undone:e.done).popEvent(t,o);if(!i)return null;let s=i.selection.resolve(i.transform.doc),l=(n?e.done:e.undone).addTransform(i.transform,t.selection.getBookmark(),r,o),a=new od(n?l:i.remaining,n?i.remaining:l,null,0,-1);return i.transform.setSelection(s).setMeta(dd,{redo:n,historyState:a})}(r,n,e);i&&o(t?i.scrollIntoView():i)}return!0}}const fd=pd(!1,!0),md=pd(!0,!0),gd=xa.create({name:"history",addOptions:()=>({depth:100,newGroupDelay:500}),addCommands:()=>({undo:()=>({state:e,dispatch:t})=>fd(e,t),redo:()=>({state:e,dispatch:t})=>md(e,t)}),addProseMirrorPlugins(){return[ud(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),yd=mc.create({name:"horizontalRule",addOptions:()=>({HTMLAttributes:{}}),group:"block",parseHTML:()=>[{tag:"hr"}],renderHTML({HTMLAttributes:e}){return["hr",ta(this.options.HTMLAttributes,e)]},addCommands(){return{setHorizontalRule:()=>({chain:e,state:t})=>{const{selection:n}=t,{$from:o,$to:r}=n,i=e();return 0===o.parentOffset?i.insertContentAt({from:Math.max(o.pos-1,0),to:r.pos},{type:this.name}):n instanceof Io?i.insertContentAt(r.pos,{type:this.name}):i.insertContent({type:this.name}),i.command((({tr:e,dispatch:t})=>{var n;if(t){const{$to:t}=e.selection,o=t.end();if(t.nodeAfter)t.nodeAfter.isTextblock?e.setSelection(Ro.create(e.doc,t.pos+1)):t.nodeAfter.isBlock?e.setSelection(Io.create(e.doc,t.pos)):e.setSelection(Ro.create(e.doc,t.pos));else{const r=null===(n=t.parent.type.contentMatch.defaultType)||void 0===n?void 0:n.create();r&&(e.insert(o,r),e.setSelection(Ro.create(e.doc,o+1)))}e.scrollIntoView()}return!0})).run()}}},addInputRules(){return[(e={find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type},new ha({find:e.find,handler:({state:t,range:n,match:o})=>{const r=ra(e.getAttributes,void 0,o)||{},{tr:i}=t,s=n.from;let l=n.to;const a=e.type.create(r);if(o[1]){let e=s+o[0].lastIndexOf(o[1]);e>l?e=l:l=e+o[1].length;const t=o[0][o[0].length-1];i.insertText(t,s+o[0].length-1),i.replaceWith(e,l,a)}else if(o[0]){const t=e.type.isInline?s:s-1;i.insert(t,e.type.create(r)).delete(i.mapping.map(s),i.mapping.map(l))}i.scrollIntoView()}}))];var e}}),vd=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,bd=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,wd=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,kd=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,xd=ga.create({name:"italic",addOptions:()=>({HTMLAttributes:{}}),parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:e=>"normal"!==e.style.fontStyle&&null},{style:"font-style=normal",clearMark:e=>e.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:e}){return["em",ta(this.options.HTMLAttributes,e),0]},addCommands(){return{setItalic:()=>({commands:e})=>e.setMark(this.name),toggleItalic:()=>({commands:e})=>e.toggleMark(this.name),unsetItalic:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[uc({find:vd,type:this.type}),uc({find:wd,type:this.type})]},addPasteRules(){return[gc({find:bd,type:this.type}),gc({find:kd,type:this.type})]}}),Md=mc.create({name:"listItem",addOptions:()=>({HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}),content:"paragraph block*",defining:!0,parseHTML:()=>[{tag:"li"}],renderHTML({HTMLAttributes:e}){return["li",ta(this.options.HTMLAttributes,e),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),Sd="textStyle",Cd=/^(\d+)\.\s$/,Od=mc.create({name:"orderedList",addOptions:()=>({itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}),group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes:()=>({start:{default:1,parseHTML:e=>e.hasAttribute("start")?parseInt(e.getAttribute("start")||"",10):1},type:{default:null,parseHTML:e=>e.getAttribute("type")}}),parseHTML:()=>[{tag:"ol"}],renderHTML({HTMLAttributes:e}){const{start:t,...n}=e;return 1===t?["ol",ta(this.options.HTMLAttributes,n),0]:["ol",ta(this.options.HTMLAttributes,e),0]},addCommands(){return{toggleOrderedList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes("listItem",this.editor.getAttributes(Sd)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let e=fc({find:Cd,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(e=fc({find:Cd,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(Sd)}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1],editor:this.editor})),[e]}}),Td=mc.create({name:"paragraph",priority:1e3,addOptions:()=>({HTMLAttributes:{}}),group:"block",content:"inline*",parseHTML:()=>[{tag:"p"}],renderHTML({HTMLAttributes:e}){return["p",ta(this.options.HTMLAttributes,e),0]},addCommands(){return{setParagraph:()=>({commands:e})=>e.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),Ad=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,Ed=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,Nd=ga.create({name:"strike",addOptions:()=>({HTMLAttributes:{}}),parseHTML:()=>[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:e=>!!e.includes("line-through")&&{}}],renderHTML({HTMLAttributes:e}){return["s",ta(this.options.HTMLAttributes,e),0]},addCommands(){return{setStrike:()=>({commands:e})=>e.setMark(this.name),toggleStrike:()=>({commands:e})=>e.toggleMark(this.name),unsetStrike:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[uc({find:Ad,type:this.type})]},addPasteRules(){return[gc({find:Ed,type:this.type})]}}),Dd=mc.create({name:"text",group:"inline"}),Rd=xa.create({name:"starterKit",addExtensions(){const e=[];return!1!==this.options.bold&&e.push(Tc.configure(this.options.bold)),!1!==this.options.blockquote&&e.push(xc.configure(this.options.blockquote)),!1!==this.options.bulletList&&e.push(Nc.configure(this.options.bulletList)),!1!==this.options.code&&e.push(Vc.configure(this.options.code)),!1!==this.options.codeBlock&&e.push(Lc.configure(this.options.codeBlock)),!1!==this.options.document&&e.push(Pc.configure(this.options.document)),!1!==this.options.dropcursor&&e.push(Hc.configure(this.options.dropcursor)),!1!==this.options.gapcursor&&e.push(Jc.configure(this.options.gapcursor)),!1!==this.options.hardBreak&&e.push(Gc.configure(this.options.hardBreak)),!1!==this.options.heading&&e.push(Yc.configure(this.options.heading)),!1!==this.options.history&&e.push(gd.configure(this.options.history)),!1!==this.options.horizontalRule&&e.push(yd.configure(this.options.horizontalRule)),!1!==this.options.italic&&e.push(xd.configure(this.options.italic)),!1!==this.options.listItem&&e.push(Md.configure(this.options.listItem)),!1!==this.options.orderedList&&e.push(Od.configure(this.options.orderedList)),!1!==this.options.paragraph&&e.push(Td.configure(this.options.paragraph)),!1!==this.options.strike&&e.push(Nd.configure(this.options.strike)),!1!==this.options.text&&e.push(Dd.configure(this.options.text)),e}}),Vd=(e,t)=>{for(const n in t)e[n]=t[n];return e},Id="numeric",zd="ascii",Ld="alpha",Pd="asciinumeric",$d="alphanumeric",Bd="domain",Hd="emoji",_d="scheme",Fd="slashscheme",jd="whitespace";function Ud(e,t){return e in t||(t[e]=[]),t[e]}function Wd(e,t,n){t[Id]&&(t[Pd]=!0,t[$d]=!0),t[zd]&&(t[Pd]=!0,t[Ld]=!0),t[Pd]&&(t[$d]=!0),t[Ld]&&(t[$d]=!0),t[$d]&&(t[Bd]=!0),t[Hd]&&(t[Bd]=!0);for(const o in t){const t=Ud(o,n);t.indexOf(e)<0&&t.push(e)}}function qd(e=null){this.j={},this.jr=[],this.jd=null,this.t=e}qd.groups={},qd.prototype={accepts(){return!!this.t},go(e){const t=this,n=t.j[e];if(n)return n;for(let o=0;o<t.jr.length;o++){const n=t.jr[o][0],r=t.jr[o][1];if(r&&n.test(e))return r}return t.jd},has(e,t=!1){return t?e in this.j:!!this.go(e)},ta(e,t,n,o){for(let r=0;r<e.length;r++)this.tt(e[r],t,n,o)},tr(e,t,n,o){let r;return o=o||qd.groups,t&&t.j?r=t:(r=new qd(t),n&&o&&Wd(t,n,o)),this.jr.push([e,r]),r},ts(e,t,n,o){let r=this;const i=e.length;if(!i)return r;for(let s=0;s<i-1;s++)r=r.tt(e[s]);return r.tt(e[i-1],t,n,o)},tt(e,t,n,o){o=o||qd.groups;const r=this;if(t&&t.j)return r.j[e]=t,t;const i=t;let s,l=r.go(e);if(l?(s=new qd,Vd(s.j,l.j),s.jr.push.apply(s.jr,l.jr),s.jd=l.jd,s.t=l.t):s=new qd,i){if(o)if(s.t&&"string"==typeof s.t){const e=Vd(function(e,t){const n={};for(const o in t)t[o].indexOf(e)>=0&&(n[o]=!0);return n}(s.t,o),n);Wd(i,e,o)}else n&&Wd(i,n,o);s.t=i}return r.j[e]=s,s}};const Kd=(e,t,n,o,r)=>e.ta(t,n,o,r),Jd=(e,t,n,o,r)=>e.tr(t,n,o,r),Gd=(e,t,n,o,r)=>e.ts(t,n,o,r),Yd=(e,t,n,o,r)=>e.tt(t,n,o,r),Xd="WORD",Qd="UWORD",Zd="ASCIINUMERICAL",eh="ALPHANUMERICAL",th="LOCALHOST",nh="TLD",oh="UTLD",rh="SCHEME",ih="SLASH_SCHEME",sh="NUM",lh="WS",ah="NL",ch="OPENBRACE",dh="CLOSEBRACE",hh="OPENBRACKET",uh="CLOSEBRACKET",ph="OPENPAREN",fh="CLOSEPAREN",mh="OPENANGLEBRACKET",gh="CLOSEANGLEBRACKET",yh="FULLWIDTHLEFTPAREN",vh="FULLWIDTHRIGHTPAREN",bh="LEFTCORNERBRACKET",wh="RIGHTCORNERBRACKET",kh="LEFTWHITECORNERBRACKET",xh="RIGHTWHITECORNERBRACKET",Mh="FULLWIDTHLESSTHAN",Sh="FULLWIDTHGREATERTHAN",Ch="AMPERSAND",Oh="APOSTROPHE",Th="ASTERISK",Ah="AT",Eh="BACKSLASH",Nh="BACKTICK",Dh="CARET",Rh="COLON",Vh="COMMA",Ih="DOLLAR",zh="DOT",Lh="EQUALS",Ph="EXCLAMATION",$h="HYPHEN",Bh="PERCENT",Hh="PIPE",_h="PLUS",Fh="POUND",jh="QUERY",Uh="QUOTE",Wh="FULLWIDTHMIDDLEDOT",qh="SEMI",Kh="SLASH",Jh="TILDE",Gh="UNDERSCORE",Yh="EMOJI",Xh="SYM";var Qh=Object.freeze({__proto__:null,WORD:Xd,UWORD:Qd,ASCIINUMERICAL:Zd,ALPHANUMERICAL:eh,LOCALHOST:th,TLD:nh,UTLD:oh,SCHEME:rh,SLASH_SCHEME:ih,NUM:sh,WS:lh,NL:ah,OPENBRACE:ch,CLOSEBRACE:dh,OPENBRACKET:hh,CLOSEBRACKET:uh,OPENPAREN:ph,CLOSEPAREN:fh,OPENANGLEBRACKET:mh,CLOSEANGLEBRACKET:gh,FULLWIDTHLEFTPAREN:yh,FULLWIDTHRIGHTPAREN:vh,LEFTCORNERBRACKET:bh,RIGHTCORNERBRACKET:wh,LEFTWHITECORNERBRACKET:kh,RIGHTWHITECORNERBRACKET:xh,FULLWIDTHLESSTHAN:Mh,FULLWIDTHGREATERTHAN:Sh,AMPERSAND:Ch,APOSTROPHE:Oh,ASTERISK:Th,AT:Ah,BACKSLASH:Eh,BACKTICK:Nh,CARET:Dh,COLON:Rh,COMMA:Vh,DOLLAR:Ih,DOT:zh,EQUALS:Lh,EXCLAMATION:Ph,HYPHEN:$h,PERCENT:Bh,PIPE:Hh,PLUS:_h,POUND:Fh,QUERY:jh,QUOTE:Uh,FULLWIDTHMIDDLEDOT:Wh,SEMI:qh,SLASH:Kh,TILDE:Jh,UNDERSCORE:Gh,EMOJI:Yh,SYM:Xh});const Zh=/[a-z]/,eu=new RegExp("\\p{L}","u"),tu=new RegExp("\\p{Emoji}","u"),nu=/\d/,ou=/\s/;let ru=null,iu=null;function su(e,t){const n=function(e){const t=[],n=e.length;let o=0;for(;o<n;){let r,i=e.charCodeAt(o),s=i<55296||i>56319||o+1===n||(r=e.charCodeAt(o+1))<56320||r>57343?e[o]:e.slice(o,o+2);t.push(s),o+=s.length}return t}(t.replace(/[A-Z]/g,(e=>e.toLowerCase()))),o=n.length,r=[];let i=0,s=0;for(;s<o;){let l=e,a=null,c=0,d=null,h=-1,u=-1;for(;s<o&&(a=l.go(n[s]));)l=a,l.accepts()?(h=0,u=0,d=l):h>=0&&(h+=n[s].length,u++),c+=n[s].length,i+=n[s].length,s++;i-=h,s-=u,c-=h,r.push({t:d.t,v:t.slice(i-c,i),s:i-c,e:i})}return r}function lu(e,t,n,o,r){let i;const s=t.length;for(let l=0;l<s-1;l++){const n=t[l];e.j[n]?i=e.j[n]:(i=new qd(o),i.jr=r.slice(),e.j[n]=i),e=i}return i=new qd(n),i.jr=r.slice(),e.j[t[s-1]]=i,i}function au(e){const t=[],n=[];let o=0;for(;o<e.length;){let r=0;for(;"0123456789".indexOf(e[o+r])>=0;)r++;if(r>0){t.push(n.join(""));for(let t=parseInt(e.substring(o,o+r),10);t>0;t--)n.pop();o+=r}else n.push(e[o]),o++}return t}const cu={defaultProtocol:"http",events:null,format:hu,formatHref:hu,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function du(e,t=null){let n=Vd({},cu);e&&(n=Vd(n,e instanceof du?e.o:e));const o=n.ignoreTags,r=[];for(let i=0;i<o.length;i++)r.push(o[i].toUpperCase());this.o=n,t&&(this.defaultRender=t),this.ignoreTags=r}function hu(e){return e}function uu(e,t){this.t="token",this.v=e,this.tk=t}function pu(e,t){class n extends uu{constructor(t,n){super(t,n),this.t=e}}for(const o in t)n.prototype[o]=t[o];return n.t=e,n}du.prototype={o:cu,ignoreTags:[],defaultRender:e=>e,check(e){return this.get("validate",e.toString(),e)},get(e,t,n){const o=null!=t;let r=this.o[e];return r?("object"==typeof r?(r=n.t in r?r[n.t]:cu[e],"function"==typeof r&&o&&(r=r(t,n))):"function"==typeof r&&o&&(r=r(t,n.t,n)),r):r},getObj(e,t,n){let o=this.o[e];return"function"==typeof o&&null!=t&&(o=o(t,n.t,n)),o},render(e){const t=e.render(this);return(this.get("render",null,e)||this.defaultRender)(t,e.t,e)}},uu.prototype={isLink:!1,toString(){return this.v},toHref(e){return this.toString()},toFormattedString(e){const t=this.toString(),n=e.get("truncate",t,this),o=e.get("format",t,this);return n&&o.length>n?o.substring(0,n)+"…":o},toFormattedHref(e){return e.get("formatHref",this.toHref(e.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(e=cu.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(e),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(e){return{type:this.t,value:this.toFormattedString(e),isLink:this.isLink,href:this.toFormattedHref(e),start:this.startIndex(),end:this.endIndex()}},validate(e){return e.get("validate",this.toString(),this)},render(e){const t=this,n=this.toHref(e.get("defaultProtocol")),o=e.get("formatHref",n,this),r=e.get("tagName",n,t),i=this.toFormattedString(e),s={},l=e.get("className",n,t),a=e.get("target",n,t),c=e.get("rel",n,t),d=e.getObj("attributes",n,t),h=e.getObj("events",n,t);return s.href=o,l&&(s.class=l),a&&(s.target=a),c&&(s.rel=c),d&&Vd(s,d),{tagName:r,attributes:s,content:i,eventListeners:h}}};const fu=pu("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),mu=pu("text"),gu=pu("nl"),yu=pu("url",{isLink:!0,toHref(e=cu.defaultProtocol){return this.hasProtocol()?this.v:`${e}://${this.v}`},hasProtocol(){const e=this.tk;return e.length>=2&&e[0].t!==th&&e[1].t===Rh}}),vu=e=>new qd(e);function bu(e,t,n){const o=n[0].s,r=n[n.length-1].e;return new e(t.slice(o,r),n)}const wu="undefined"!=typeof console&&console&&console.warn||(()=>{}),ku={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function xu(e,t=!1){if(ku.initialized&&wu(`linkifyjs: already initialized - will not register custom scheme "${e}" until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(e))throw new Error('linkifyjs: incorrect scheme format.\n1. Must only contain digits, lowercase ASCII letters or "-"\n2. Cannot start or end with "-"\n3. "-" cannot repeat');ku.customSchemes.push([e,t])}function Mu(){ku.scanner=function(e=[]){const t={};qd.groups=t;const n=new qd;null==ru&&(ru=au("aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2ntley5rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6logistics9properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3ncaster6d0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2psy3ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0america6xi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2")),null==iu&&(iu=au("ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2")),Yd(n,"'",Oh),Yd(n,"{",ch),Yd(n,"}",dh),Yd(n,"[",hh),Yd(n,"]",uh),Yd(n,"(",ph),Yd(n,")",fh),Yd(n,"<",mh),Yd(n,">",gh),Yd(n,"(",yh),Yd(n,")",vh),Yd(n,"「",bh),Yd(n,"」",wh),Yd(n,"『",kh),Yd(n,"』",xh),Yd(n,"<",Mh),Yd(n,">",Sh),Yd(n,"&",Ch),Yd(n,"*",Th),Yd(n,"@",Ah),Yd(n,"`",Nh),Yd(n,"^",Dh),Yd(n,":",Rh),Yd(n,",",Vh),Yd(n,"$",Ih),Yd(n,".",zh),Yd(n,"=",Lh),Yd(n,"!",Ph),Yd(n,"-",$h),Yd(n,"%",Bh),Yd(n,"|",Hh),Yd(n,"+",_h),Yd(n,"#",Fh),Yd(n,"?",jh),Yd(n,'"',Uh),Yd(n,"/",Kh),Yd(n,";",qh),Yd(n,"~",Jh),Yd(n,"_",Gh),Yd(n,"\\",Eh),Yd(n,"・",Wh);const o=Jd(n,nu,sh,{[Id]:!0});Jd(o,nu,o);const r=Jd(o,Zh,Zd,{[Pd]:!0}),i=Jd(o,eu,eh,{[$d]:!0}),s=Jd(n,Zh,Xd,{[zd]:!0});Jd(s,nu,r),Jd(s,Zh,s),Jd(r,nu,r),Jd(r,Zh,r);const l=Jd(n,eu,Qd,{[Ld]:!0});Jd(l,Zh),Jd(l,nu,i),Jd(l,eu,l),Jd(i,nu,i),Jd(i,Zh),Jd(i,eu,i);const a=Yd(n,"\n",ah,{[jd]:!0}),c=Yd(n,"\r",lh,{[jd]:!0}),d=Jd(n,ou,lh,{[jd]:!0});Yd(n,"",d),Yd(c,"\n",a),Yd(c,"",d),Jd(c,ou,d),Yd(d,"\r"),Yd(d,"\n"),Jd(d,ou,d),Yd(d,"",d);const h=Jd(n,tu,Yh,{[Hd]:!0});Yd(h,"#"),Jd(h,tu,h),Yd(h,"️",h);const u=Yd(h,"‍");Yd(u,"#"),Jd(u,tu,h);const p=[[Zh,s],[nu,r]],f=[[Zh,null],[eu,l],[nu,i]];for(let m=0;m<ru.length;m++)lu(n,ru[m],nh,Xd,p);for(let m=0;m<iu.length;m++)lu(n,iu[m],oh,Qd,f);Wd(nh,{tld:!0,ascii:!0},t),Wd(oh,{utld:!0,alpha:!0},t),lu(n,"file",rh,Xd,p),lu(n,"mailto",rh,Xd,p),lu(n,"http",ih,Xd,p),lu(n,"https",ih,Xd,p),lu(n,"ftp",ih,Xd,p),lu(n,"ftps",ih,Xd,p),Wd(rh,{scheme:!0,ascii:!0},t),Wd(ih,{slashscheme:!0,ascii:!0},t),e=e.sort(((e,t)=>e[0]>t[0]?1:-1));for(let m=0;m<e.length;m++){const t=e[m][0],o=e[m][1]?{[_d]:!0}:{[Fd]:!0};t.indexOf("-")>=0?o[Bd]=!0:Zh.test(t)?nu.test(t)?o[Pd]=!0:o[zd]=!0:o[Id]=!0,Gd(n,t,t,o)}return Gd(n,"localhost",th,{ascii:!0}),n.jd=new qd(Xh),{start:n,tokens:Vd({groups:t},Qh)}}(ku.customSchemes);for(let e=0;e<ku.tokenQueue.length;e++)ku.tokenQueue[e][1]({scanner:ku.scanner});ku.parser=function({groups:e}){const t=e.domain.concat([Ch,Th,Ah,Eh,Nh,Dh,Ih,Lh,$h,sh,Bh,Hh,_h,Fh,Kh,Xh,Jh,Gh]),n=[Rh,Vh,zh,Ph,Bh,jh,Uh,qh,mh,gh,ch,dh,uh,hh,ph,fh,yh,vh,bh,wh,kh,xh,Mh,Sh],o=[Ch,Oh,Th,Eh,Nh,Dh,Ih,Lh,$h,ch,dh,Bh,Hh,_h,Fh,jh,Kh,Xh,Jh,Gh],r=vu(),i=Yd(r,Jh);Kd(i,o,i),Kd(i,e.domain,i);const s=vu(),l=vu(),a=vu();Kd(r,e.domain,s),Kd(r,e.scheme,l),Kd(r,e.slashscheme,a),Kd(s,o,i),Kd(s,e.domain,s);const c=Yd(s,Ah);Yd(i,Ah,c),Yd(l,Ah,c),Yd(a,Ah,c);const d=Yd(i,zh);Kd(d,o,i),Kd(d,e.domain,i);const h=vu();Kd(c,e.domain,h),Kd(h,e.domain,h);const u=Yd(h,zh);Kd(u,e.domain,h);const p=vu(fu);Kd(u,e.tld,p),Kd(u,e.utld,p),Yd(c,th,p);const f=Yd(h,$h);Yd(f,$h,f),Kd(f,e.domain,h),Kd(p,e.domain,h),Yd(p,zh,u),Yd(p,$h,f);const m=Yd(p,Rh);Kd(m,e.numeric,fu);const g=Yd(s,$h),y=Yd(s,zh);Yd(g,$h,g),Kd(g,e.domain,s),Kd(y,o,i),Kd(y,e.domain,s);const v=vu(yu);Kd(y,e.tld,v),Kd(y,e.utld,v),Kd(v,e.domain,s),Kd(v,o,i),Yd(v,zh,y),Yd(v,$h,g),Yd(v,Ah,c);const b=Yd(v,Rh),w=vu(yu);Kd(b,e.numeric,w);const k=vu(yu),x=vu();Kd(k,t,k),Kd(k,n,x),Kd(x,t,k),Kd(x,n,x),Yd(v,Kh,k),Yd(w,Kh,k);const M=Yd(l,Rh),S=Yd(a,Rh),C=Yd(S,Kh),O=Yd(C,Kh);Kd(l,e.domain,s),Yd(l,zh,y),Yd(l,$h,g),Kd(a,e.domain,s),Yd(a,zh,y),Yd(a,$h,g),Kd(M,e.domain,k),Yd(M,Kh,k),Yd(M,jh,k),Kd(O,e.domain,k),Kd(O,t,k),Yd(O,Kh,k);const T=[[ch,dh],[hh,uh],[ph,fh],[mh,gh],[yh,vh],[bh,wh],[kh,xh],[Mh,Sh]];for(let A=0;A<T.length;A++){const[e,o]=T[A],r=Yd(k,e);Yd(x,e,r),Yd(r,o,k);const i=vu(yu);Kd(r,t,i);const s=vu();Kd(r,n),Kd(i,t,i),Kd(i,n,s),Kd(s,t,i),Kd(s,n,s),Yd(i,o,k),Yd(s,o,k)}return Yd(r,th,v),Yd(r,ah,gu),{start:r,tokens:Qh}}(ku.scanner.tokens);for(let e=0;e<ku.pluginQueue.length;e++)ku.pluginQueue[e][1]({scanner:ku.scanner,parser:ku.parser});return ku.initialized=!0,ku}function Su(e){return ku.initialized||Mu(),function(e,t,n){let o=n.length,r=0,i=[],s=[];for(;r<o;){let l=e,a=null,c=null,d=0,h=null,u=-1;for(;r<o&&!(a=l.go(n[r].t));)s.push(n[r++]);for(;r<o&&(c=a||l.go(n[r].t));)a=null,l=c,l.accepts()?(u=0,h=l):u>=0&&u++,r++,d++;if(u<0)r-=d,r<o&&(s.push(n[r]),r++);else{s.length>0&&(i.push(bu(mu,t,s)),s=[]),r-=u,d-=u;const e=h.t,o=n.slice(r-d,r);i.push(bu(e,t,o))}}return s.length>0&&i.push(bu(mu,t,s)),i}(ku.parser.start,e,su(ku.scanner.start,e))}function Cu(e,t=null,n=null){if(t&&"object"==typeof t){if(n)throw Error(`linkifyjs: Invalid link type ${t}; must be a string`);n=t,t=null}const o=new du(n),r=Su(e),i=[];for(let s=0;s<r.length;s++){const e=r[s];!e.isLink||t&&e.t!==t||!o.check(e)||i.push(e.toFormattedObject(o))}return i}function Ou(e){return new Ko({key:new Yo("autolink"),appendTransaction:(t,n,o)=>{const r=t.some((e=>e.docChanged))&&!n.doc.eq(o.doc),i=t.some((e=>e.getMeta("preventAutolink")));if(!r||i)return;const{tr:s}=o,l=function(e,t){const n=new Oo(e);return t.forEach((e=>{e.steps.forEach((e=>{n.step(e)}))})),n}(n.doc,[...t]),a=function(e){const{mapping:t,steps:n}=e,o=[];return t.maps.forEach(((e,r)=>{const i=[];if(e.ranges.length)e.forEach(((e,t)=>{i.push({from:e,to:t})}));else{const{from:e,to:t}=n[r];if(void 0===e||void 0===t)return;i.push({from:e,to:t})}i.forEach((({from:e,to:n})=>{const i=t.slice(r).map(e,-1),s=t.slice(r).map(n),l=t.invert().map(i,-1),a=t.invert().map(s);o.push({oldRange:{from:l,to:a},newRange:{from:i,to:s}})}))})),qa(o)}(l);return a.forEach((({newRange:t})=>{const n=function(e,t,n){const o=[];return e.nodesBetween(t.from,t.to,((e,t)=>{n(e)&&o.push({node:e,pos:t})})),o}(o.doc,t,(e=>e.isTextblock));let r,i;if(n.length>1?(r=n[0],i=o.doc.textBetween(r.pos,r.pos+r.node.nodeSize,void 0," ")):n.length&&o.doc.textBetween(t.from,t.to," "," ").endsWith(" ")&&(r=n[0],i=o.doc.textBetween(r.pos,t.to,void 0," ")),r&&i){const t=i.split(" ").filter((e=>""!==e));if(t.length<=0)return!1;const n=t[t.length-1],a=r.pos+i.lastIndexOf(n);if(!n)return!1;const c=Su(n).map((t=>t.toObject(e.defaultProtocol)));if(!(1===(l=c).length?l[0].isLink:3===l.length&&l[1].isLink&&["()","[]"].includes(l[0].value+l[2].value)))return!1;c.filter((e=>e.isLink)).map((e=>({...e,from:a+e.start+1,to:a+e.end+1}))).filter((e=>!o.schema.marks.code||!o.doc.rangeHasMark(e.from,e.to,o.schema.marks.code))).filter((t=>e.validate(t.value))).filter((t=>e.shouldAutoLink(t.value))).forEach((t=>{Ka(t.from,t.to,o.doc).some((t=>t.mark.type===e.type))||s.addMark(t.from,t.to,e.type.create({href:t.href}))}))}var l})),s.steps.length?s:void 0}})}Su.scan=su;const Tu=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g;function Au(e,t){const n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return t&&t.forEach((e=>{const t="string"==typeof e?e:e.scheme;t&&n.push(t)})),!e||e.replace(Tu,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}const Eu=ga.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach((e=>{"string"!=typeof e?xu(e.scheme,e.optionalSlashes):xu(e)}))},onDestroy(){qd.groups={},ku.scanner=null,ku.parser=null,ku.tokenQueue=[],ku.pluginQueue=[],ku.customSchemes=[],ku.initialized=!1},inclusive(){return this.options.autolink},addOptions:()=>({openOnClick:!0,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(e,t)=>!!Au(e,t.protocols),validate:e=>!!e,shouldAutoLink:e=>!!e}),addAttributes(){return{href:{default:null,parseHTML:e=>e.getAttribute("href")},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class}}},parseHTML(){return[{tag:"a[href]",getAttrs:e=>{const t=e.getAttribute("href");return!(!t||!this.options.isAllowedUri(t,{defaultValidate:e=>!!Au(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol}))&&null}}]},renderHTML({HTMLAttributes:e}){return this.options.isAllowedUri(e.href,{defaultValidate:e=>!!Au(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",ta(this.options.HTMLAttributes,e),0]:["a",ta(this.options.HTMLAttributes,{...e,href:""}),0]},addCommands(){return{setLink:e=>({chain:t})=>{const{href:n}=e;return!!this.options.isAllowedUri(n,{defaultValidate:e=>!!Au(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})&&t().setMark(this.name,e).setMeta("preventAutolink",!0).run()},toggleLink:e=>({chain:t})=>{const{href:n}=e;return!!this.options.isAllowedUri(n,{defaultValidate:e=>!!Au(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})&&t().toggleMark(this.name,e,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:e})=>e().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[gc({find:e=>{const t=[];if(e){const{protocols:n,defaultProtocol:o}=this.options,r=Cu(e).filter((e=>e.isLink&&this.options.isAllowedUri(e.value,{defaultValidate:e=>!!Au(e,n),protocols:n,defaultProtocol:o})));r.length&&r.forEach((e=>t.push({text:e.value,data:{href:e.href},index:e.start})))}return t},type:this.type,getAttributes:e=>{var t;return{href:null===(t=e.data)||void 0===t?void 0:t.href}}})]},addProseMirrorPlugins(){const e=[],{protocols:t,defaultProtocol:n}=this.options;var o;return this.options.autolink&&e.push(Ou({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:e=>this.options.isAllowedUri(e,{defaultValidate:e=>!!Au(e,t),protocols:t,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),!0===this.options.openOnClick&&e.push((o={type:this.type},new Ko({key:new Yo("handleClickLink"),props:{handleClick:(e,t,n)=>{var r,i;if(0!==n.button)return!1;if(!e.editable)return!1;let s=n.target;const l=[];for(;"DIV"!==s.nodeName;)l.push(s),s=s.parentNode;if(!l.find((e=>"A"===e.nodeName)))return!1;const a=Wa(e.state,o.type.name),c=n.target,d=null!==(r=null==c?void 0:c.href)&&void 0!==r?r:a.href,h=null!==(i=null==c?void 0:c.target)&&void 0!==i?i:a.target;return!(!c||!d||(window.open(d,h),0))}}}))),this.options.linkOnPaste&&e.push(function(e){return new Ko({key:new Yo("handlePasteLink"),props:{handlePaste:(t,n,o)=>{const{state:r}=t,{selection:i}=r,{empty:s}=i;if(s)return!1;let l="";o.content.forEach((e=>{l+=e.textContent}));const a=Cu(l,{defaultProtocol:e.defaultProtocol}).find((e=>e.isLink&&e.value===l));return!(!l||!a)&&e.editor.commands.setMark(e.type,{href:a.href})}}})}({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),e}}),Nu=["title"],Du={class:"remix"},Ru=["xlink:href"];const Vu=he({name:"TiptapMenuItem",props:{icon:{type:String,required:!0},title:{type:String,required:!0},action:{type:Function,required:!0},isActive:{type:Function,default:null}}},[["render",function(e,t,n,o,r,i){return g(),m("button",{type:"button",class:w(["menu-item",{"is-active":n.isActive?n.isActive():null}]),onClick:t[0]||(t[0]=(...e)=>n.action&&n.action(...e)),title:n.title},[(g(),m("svg",Du,[y("use",{"xlink:href":`#ri-${n.icon}`},null,8,Ru)]))],10,Nu)}]]),Iu=["title"],zu={class:"remix"},Lu=["xlink:href"],Pu={class:"align-right wbb-mt"};const $u=he({name:"TiptapMenuItemLink",props:{editor:{type:Object,required:!0},icon:{type:String,required:!0},title:{type:String,required:!0},action:{type:Function,required:!0},isActive:{type:Function,default:null},type:{type:String,default:""}},directives:{clickOutside:De},setup(e,t){const n=l(!1),o=l(),r=l(),i=l(""),s=()=>{i.value="",n.value=!1},{wbsCnf:a}=ue(),{wb_e:c}=pe(a);return{linkInput:i,setLinkHandler:()=>{null!==i.value?(i.value?e.editor.chain().focus().extendMarkRange("link").setLink({href:i.value}).run():e.editor.chain().focus().extendMarkRange("link").unsetLink().run(),s()):s()},linkButtonRef:o,linkPopoverRef:r,acivePopover:()=>{const t=e.editor.getAttributes("link").href;i.value=t,n.value=!0},closePopover:s,onClickOutside:()=>{r.value&&r.value.delayHide&&r.value.delayHide(),s()},visiblePopover:n,wb_e:c}}},[["render",function(e,t,n,o,r,i){const s=Y,l=X,a=Ot,c=fe("click-outside");return g(),m(A,null,[j((g(),m("button",{class:w(["menu-item",{"is-active":n.isActive?n.isActive():null}]),type:"button",onClick:t[0]||(t[0]=(...e)=>o.acivePopover&&o.acivePopover(...e)),title:n.title,ref:"linkButtonRef"},[(g(),m("svg",zu,[y("use",{"xlink:href":`#ri-${n.icon}`},null,8,Lu)]))],10,Iu)),[[c,o.onClickOutside]]),U(a,{ref:"linkPopoverRef","virtual-ref":o.linkButtonRef,visible:o.visiblePopover,trigger:"click","wb-lang":"",title:o.wb_e("设置链接"),"virtual-triggering":"",width:"250"},{default:H((()=>[U(s,{size:"small",modelValue:o.linkInput,"onUpdate:modelValue":t[1]||(t[1]=e=>o.linkInput=e),clearable:""},null,8,["modelValue"]),y("div",Pu,[U(l,{size:"small",text:"",onClick:o.closePopover},{default:H((()=>[Q(Z(o.wb_e("取消")),1)])),_:1},8,["onClick"]),U(l,{size:"small",type:"primary",onClick:o.setLinkHandler},{default:H((()=>[Q(Z(o.wb_e("确认")),1)])),_:1},8,["onClick"])])])),_:1},8,["virtual-ref","visible","title"])],64)}]]);const Bu=he({name:"TiptapMenuBar",components:{MenuItem:Vu,MenuItemLink:$u},props:{editor:{type:Object,required:!0}},setup(e,t){const n=l([{icon:"bold",title:"Bold",action:()=>e.editor.chain().focus().toggleBold().run(),isActive:()=>e.editor.isActive("bold")},{icon:"italic",title:"Italic",action:()=>e.editor.chain().focus().toggleItalic().run(),isActive:()=>e.editor.isActive("italic")},{icon:"strikethrough",title:"Strike",action:()=>e.editor.chain().focus().toggleStrike().run(),isActive:()=>e.editor.isActive("strike")},{icon:"underline",title:"Underline",action:()=>e.editor.chain().focus().toggleUnderline().run(),isActive:()=>e.editor.isActive("underline")},{type:"divider"},{icon:"h-2",title:"Heading 2",action:()=>e.editor.chain().focus().toggleHeading({level:2}).run(),isActive:()=>e.editor.isActive("heading",{level:2})},{icon:"h-3",title:"Heading 3",action:()=>e.editor.chain().focus().toggleHeading({level:3}).run(),isActive:()=>e.editor.isActive("heading",{level:3})},{icon:"paragraph",title:"Paragraph",action:()=>e.editor.chain().focus().setParagraph().run(),isActive:()=>e.editor.isActive("paragraph")},{icon:"list-unordered",title:"Bullet List",action:()=>e.editor.chain().focus().toggleBulletList().run(),isActive:()=>e.editor.isActive("bulletList")},{icon:"list-ordered",title:"Ordered List",action:()=>e.editor.chain().focus().toggleOrderedList().run(),isActive:()=>e.editor.isActive("orderedList")},{type:"divider"},{icon:"double-quotes-l",title:"Blockquote",action:()=>e.editor.chain().focus().toggleBlockquote().run(),isActive:()=>e.editor.isActive("blockquote")},{type:"link",icon:"link",title:"Set Link",editor:e.editor,action:()=>{},isActive:()=>e.editor.isActive("link")},{icon:"link-unlink",title:"Unset Link",action:()=>e.editor.chain().focus().unsetLink().run()},{type:"divider"},{icon:"text-wrap",title:"Hard Break",action:()=>e.editor.chain().focus().setHardBreak().run()},{icon:"format-clear",title:"Clear Format",action:()=>e.editor.chain().focus().clearNodes().unsetAllMarks().run()},{type:"divider"},{icon:"arrow-go-back-line",title:"Undo",action:()=>e.editor.chain().focus().undo().run()},{icon:"arrow-go-forward-line",title:"Redo",action:()=>e.editor.chain().focus().redo().run()}]),o=l(),r=l();return{items:n,buttonRef:o,popoverRef:r,onClickOutside:()=>{v(r).popoverRef.delayHide()}}}},[["render",function(e,t,n,o,r,i){const s=$u,l=Vu;return g(),m("div",null,[(g(!0),m(A,null,E(o.items,((e,t)=>(g(),m(A,null,["divider"===e.type?(g(),m("div",{class:"divider",key:`divider${t}`})):"link"===e.type?(g(),B(s,_({key:"link",ref_for:!0},e),null,16)):(g(),B(l,_({key:t,ref_for:!0},e),null,16))],64)))),256))])}]]),Hu={"aria-hidden":"true",style:{position:"absolute",width:"0",height:"0",overflow:"hidden"},version:"1.1",xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink"};const _u=he({name:"MenuItemSvg"},[["render",function(e,t,n,o,r,i){return g(),m("svg",Hu,t[0]||(t[0]=[me('<defs><symbol viewBox="0 0 24 24" id="ri-bold"><g><path fill="none" d="M0 0h24v24H0z"></path><path d="M8 11h4.5a2.5 2.5 0 1 0 0-5H8v5zm10 4.5a4.5 4.5 0 0 1-4.5 4.5H6V4h6.5a4.5 4.5 0 0 1 3.256 7.606A4.498 4.498 0 0 1 18 15.5zM8 13v5h5.5a2.5 2.5 0 1 0 0-5H8z"></path></g></symbol><symbol viewBox="0 0 24 24" id="ri-italic"><g><path fill="none" d="M0 0h24v24H0z"></path><path d="M15 20H7v-2h2.927l2.116-12H9V4h8v2h-2.927l-2.116 12H15z"></path></g></symbol><symbol viewBox="0 0 24 24" id="ri-strikethrough"><g><path fill="none" d="M0 0h24v24H0z"></path><path d="M17.154 14c.23.516.346 1.09.346 1.72 0 1.342-.524 2.392-1.571 3.147C14.88 19.622 13.433 20 11.586 20c-1.64 0-3.263-.381-4.87-1.144V16.6c1.52.877 3.075 1.316 4.666 1.316 2.551 0 3.83-.732 3.839-2.197a2.21 2.21 0 0 0-.648-1.603l-.12-.117H3v-2h18v2h-3.846zm-4.078-3H7.629a4.086 4.086 0 0 1-.481-.522C6.716 9.92 6.5 9.246 6.5 8.452c0-1.236.466-2.287 1.397-3.153C8.83 4.433 10.271 4 12.222 4c1.471 0 2.879.328 4.222.984v2.152c-1.2-.687-2.515-1.03-3.946-1.03-2.48 0-3.719.782-3.719 2.346 0 .42.218.786.654 1.099.436.313.974.562 1.613.75.62.18 1.297.414 2.03.699z"></path></g></symbol><symbol viewBox="0 0 24 24" id="ri-code-view"><g><path fill="none" d="M0 0h24v24H0z"></path><path d="M16.95 8.464l1.414-1.414 4.95 4.95-4.95 4.95-1.414-1.414L20.485 12 16.95 8.464zm-9.9 0L3.515 12l3.535 3.536-1.414 1.414L.686 12l4.95-4.95L7.05 8.464z"></path></g></symbol><symbol viewBox="0 0 24 24" id="ri-h-1"><g><path fill="none" d="M0 0H24V24H0z"></path><path d="M13 20h-2v-7H4v7H2V4h2v7h7V4h2v16zm8-12v12h-2v-9.796l-2 .536V8.67L19.5 8H21z"></path></g></symbol><symbol viewBox="0 0 24 24" id="ri-h-2"><g><path fill="none" d="M0 0H24V24H0z"></path><path d="M4 4v7h7V4h2v16h-2v-7H4v7H2V4h2zm14.5 4c2.071 0 3.75 1.679 3.75 3.75 0 .857-.288 1.648-.772 2.28l-.148.18L18.034 18H22v2h-7v-1.556l4.82-5.546c.268-.307.43-.709.43-1.148 0-.966-.784-1.75-1.75-1.75-.918 0-1.671.707-1.744 1.606l-.006.144h-2C14.75 9.679 16.429 8 18.5 8z"></path></g></symbol><symbol viewBox="0 0 24 24" id="ri-h-3"><g><path fill="none" d="M0 0H24V24H0z"></path><path d="M22 8l-.002 2-2.505 2.883c1.59.435 2.757 1.89 2.757 3.617 0 2.071-1.679 3.75-3.75 3.75-1.826 0-3.347-1.305-3.682-3.033l1.964-.382c.156.806.866 1.415 1.718 1.415.966 0 1.75-.784 1.75-1.75s-.784-1.75-1.75-1.75c-.286 0-.556.069-.794.19l-1.307-1.547L19.35 10H15V8h7zM4 4v7h7V4h2v16h-2v-7H4v7H2V4h2z"></path></g></symbol><symbol viewBox="0 0 24 24" id="ri-h-4"><g><path fill="none" d="M0 0H24V24H0z"></path><path d="M13 20h-2v-7H4v7H2V4h2v7h7V4h2v16zm9-12v8h1.5v2H22v2h-2v-2h-5.5v-1.34l5-8.66H22zm-2 3.133L17.19 16H20v-4.867z"></path></g></symbol><symbol viewBox="0 0 24 24" id="ri-h-5"><g><path fill="none" d="M0 0H24V24H0z"></path><path d="M22 8v2h-4.323l-.464 2.636c.33-.089.678-.136 1.037-.136 2.21 0 4 1.79 4 4s-1.79 4-4 4c-1.827 0-3.367-1.224-3.846-2.897l1.923-.551c.24.836 1.01 1.448 1.923 1.448 1.105 0 2-.895 2-2s-.895-2-2-2c-.63 0-1.193.292-1.56.748l-1.81-.904L16 8h6zM4 4v7h7V4h2v16h-2v-7H4v7H2V4h2z"></path></g></symbol><symbol viewBox="0 0 24 24" id="ri-h-6"><g><path fill="none" d="M0 0H24V24H0z"></path><path d="M21.097 8l-2.598 4.5c2.21 0 4.001 1.79 4.001 4s-1.79 4-4 4-4-1.79-4-4c0-.736.199-1.426.546-2.019L18.788 8h2.309zM4 4v7h7V4h2v16h-2v-7H4v7H2V4h2zm14.5 10.5c-1.105 0-2 .895-2 2s.895 2 2 2 2-.895 2-2-.895-2-2-2z"></path></g></symbol><symbol viewBox="0 0 24 24" id="ri-paragraph"><g><path fill="none" d="M0 0h24v24H0z"></path><path d="M12 6v15h-2v-5a6 6 0 1 1 0-12h10v2h-3v15h-2V6h-3zm-2 0a4 4 0 1 0 0 8V6z"></path></g></symbol><symbol viewBox="0 0 24 24" id="ri-list-unordered"><g><path fill="none" d="M0 0h24v24H0z"></path><path d="M8 4h13v2H8V4zM4.5 6.5a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3zm0 7a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3zm0 6.9a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3zM8 11h13v2H8v-2zm0 7h13v2H8v-2z"></path></g></symbol><symbol viewBox="0 0 24 24" id="ri-list-ordered"><g><path fill="none" d="M0 0h24v24H0z"></path><path d="M8 4h13v2H8V4zM5 3v3h1v1H3V6h1V4H3V3h2zM3 14v-2.5h2V11H3v-1h3v2.5H4v.5h2v1H3zm2 5.5H3v-1h2V18H3v-1h3v4H3v-1h2v-.5zM8 11h13v2H8v-2zm0 7h13v2H8v-2z"></path></g></symbol><symbol viewBox="0 0 24 24" id="ri-double-quotes-l"><g><path fill="none" d="M0 0h24v24H0z"></path><path d="M4.583 17.321C3.553 16.227 3 15 3 13.011c0-3.5 2.457-6.637 6.03-8.188l.893 1.378c-3.335 1.804-3.987 4.145-4.247 5.621.537-.278 1.24-.375 1.929-.311 1.804.167 3.226 1.648 3.226 3.489a3.5 3.5 0 0 1-3.5 3.5c-1.073 0-2.099-.49-2.748-1.179zm10 0C13.553 16.227 13 15 13 13.011c0-3.5 2.457-6.637 6.03-8.188l.893 1.378c-3.335 1.804-3.987 4.145-4.247 5.621.537-.278 1.24-.375 1.929-.311 1.804.167 3.226 1.648 3.226 3.489a3.5 3.5 0 0 1-3.5 3.5c-1.073 0-2.099-.49-2.748-1.179z"></path></g></symbol><symbol viewBox="0 0 24 24" id="ri-text-wrap"><g><path fill="none" d="M0 0h24v24H0z"></path><path d="M15 18h1.5a2.5 2.5 0 1 0 0-5H3v-2h13.5a4.5 4.5 0 1 1 0 9H15v2l-4-3 4-3v2zM3 4h18v2H3V4zm6 14v2H3v-2h6z"></path></g></symbol><symbol viewBox="0 0 24 24" id="ri-format-clear"><g><path fill="none" d="M0 0h24v24H0z"></path><path d="M12.651 14.065L11.605 20H9.574l1.35-7.661-7.41-7.41L4.93 3.515 20.485 19.07l-1.414 1.414-6.42-6.42zm-.878-6.535l.27-1.53h-1.8l-2-2H20v2h-5.927L13.5 9.257 11.773 7.53z"></path></g></symbol><symbol viewBox="0 0 24 24" id="ri-arrow-go-back-line"><g><path fill="none" d="M0 0h24v24H0z"></path><path d="M5.828 7l2.536 2.536L6.95 10.95 2 6l4.95-4.95 1.414 1.414L5.828 5H13a8 8 0 1 1 0 16H4v-2h9a6 6 0 1 0 0-12H5.828z"></path></g></symbol><symbol viewBox="0 0 24 24" id="ri-arrow-go-forward-line"><g><path fill="none" d="M0 0h24v24H0z"></path><path d="M18.172 7H11a6 6 0 1 0 0 12h9v2h-9a8 8 0 1 1 0-16h7.172l-2.536-2.536L17.05 1.05 22 6l-4.95 4.95-1.414-1.414L18.172 7z"></path></g></symbol><symbol viewBox="0 0 24 24" id="ri-link"><g><path fill="none" d="M0 0h24v24H0z"></path><path d="M18.4 15.5 17 14.1l1.4-1.4a5 5 0 1 0-7.1-7L9.9 7 8.5 5.7l1.4-1.4a7 7 0 0 1 9.9 10l-1.4 1.3zm-2.9 2.9-1.4 1.4a7 7 0 0 1-9.9-10l1.4-1.3 1.5 1.4-1.5 1.4a5 5 0 1 0 7.1 7l1.4-1.3 1.4 1.4zm-.7-10.6 1.4 1.4-7 7-1.4-1.4 7-7z"></path></g></symbol><symbol viewBox="0 0 24 24" id="ri-link-unlink"><g><path fill="none" d="M0 0h24v24H0z"></path><path d="M17 17h5v2h-3v3h-2v-5zM7 7H2V5h3V2h2v5zm11.4 8.5L17 14.1l1.4-1.4a5 5 0 1 0-7.1-7L9.9 7 8.5 5.7l1.4-1.4a7 7 0 0 1 9.9 10l-1.4 1.3zm-2.9 2.9-1.4 1.4a7 7 0 0 1-9.9-10l1.4-1.3 1.5 1.4-1.5 1.4a5 5 0 1 0 7.1 7l1.4-1.3 1.4 1.4zm-.7-10.6 1.4 1.4-7 7-1.4-1.4 7-7z"></path></g></symbol><symbol viewBox="0 0 24 24" id="ri-underline"><path fill="currentColor" d="M8 3v9a4 4 0 0 0 8 0V3h2v9a6 6 0 0 1-12 0V3h2ZM4 20h16v2H4v-2Z"></path></symbol></defs>',1)]))}]]),Fu={key:0,class:"tiptap-editor"},ju={__name:"Tiptap",props:["modelValue"],emits:["update:modelValue"],setup(e,{emit:t}){const n=e,o=t,s=l(!1),c=i({get:()=>n.modelValue,set:e=>{o("update:modelValue",e)}}),d=((e={})=>{const t=r();return a((()=>{t.value=new vc(e)})),re((()=>{var e,n,o;const r=null===(e=t.value)||void 0===e?void 0:e.options.element,i=null==r?void 0:r.cloneNode(!0);null===(n=null==r?void 0:r.parentNode)||void 0===n||n.replaceChild(i,r),null===(o=t.value)||void 0===o||o.destroy()})),t})({extensions:[Rd,wc,Eu.configure({openOnClick:!1})],content:n.modelValue,onUpdate:()=>{const e=d.value.getHTML();o("update:modelValue",e)}});return re((()=>{d.value.destroy()})),(e,t)=>{const n=Y;return v(d)?(g(),m("div",Fu,[U(Bu,{class:"editor__header",editor:v(d),mode:s.value,onChangemode:t[0]||(t[0]=e=>s.value=!s.value)},null,8,["editor","mode"]),s.value?(g(),B(n,{key:1,type:"textarea",modelValue:c.value,"onUpdate:modelValue":t[1]||(t[1]=e=>c.value=e)},null,8,["modelValue"])):(g(),B(v(bc),{key:0,editor:v(d)},null,8,["editor"])),U(_u)])):F("",!0)}}},Uu={__name:"HtmlEditor",props:{modelValue:{default:()=>({})},cnf:{}},emits:["update:modelValue"],setup(e,{emit:t}){const n=e,o=t,r=i({get:()=>n.modelValue,set:e=>o("update:modelValue",e)});return(e,t)=>(g(),B(ju,{modelValue:r.value,"onUpdate:modelValue":t[0]||(t[0]=e=>r.value=e)},null,8,["modelValue"]))}},Wu={key:0,class:"wbb-input-unit"};const qu=he({name:"AttrInputNumber",components:{},props:["modelValue","attrs","size","unit"],emits:["update:modelValue"],setup:(e,{emit:t})=>({val:i({get:()=>e.modelValue,set:e=>{t("update:modelValue",e)}})})},[["render",function(e,t,n,o,r,i){const s=_e;return g(),m(A,null,[U(s,_({modelValue:o.val,"onUpdate:modelValue":t[0]||(t[0]=e=>o.val=e)},n.attrs,{size:n.size}),null,16,["modelValue","size"]),n.unit?(g(),m("span",Wu,Z(n.unit),1)):F("",!0)],64)}]]),Ku=["innerHTML"],Ju={__name:"AttrSwitch",props:["modelValue","attrs","size"],emits:["update:modelValue"],setup(e,{emit:t}){const n=e,o=t,r=i({get:()=>n.modelValue,set:e=>{o("update:modelValue",e)}}),s=i((()=>n.attrs&&n.attrs.remark?"string"==typeof n.attrs.remark?n.attrs.remark:n.attrs.remark[r.value]:""));return(t,n)=>{const o=Fe;return g(),m(A,null,[U(o,_({modelValue:r.value,"onUpdate:modelValue":n[0]||(n[0]=e=>r.value=e)},e.attrs,{size:e.size}),null,16,["modelValue","size"]),s.value?(g(),m("span",{key:0,class:"wbb-option-remark inline",innerHTML:s.value},null,8,Ku)):F("",!0)],64)}}},Gu={__name:"AttrSelect",props:["modelValue","attrs","size"],emits:["update:modelValue"],setup(e,{emit:t}){const n=e,o=t,r=i({get:()=>n.modelValue,set:e=>{o("update:modelValue",e)}});return(t,n)=>{const o=Ie,i=ze;return g(),B(i,_({modelValue:r.value,"onUpdate:modelValue":n[0]||(n[0]=e=>r.value=e)},e.attrs,{size:e.size,placeholder:t.placeholder}),{default:H((()=>[(g(!0),m(A,null,E(e.attrs.items,((e,t)=>(g(),B(o,{value:e.value,label:e.label,key:t},null,8,["value","label"])))),128))])),_:1},16,["modelValue","size","placeholder"])}}},Yu=["innerHTML"],Xu={__name:"AttrRemark",props:{attrs:{}},setup(e){const t=e,{wbsCnf:n}=ue(),o=n.assets_uri,r=l(""),i=t.attrs.style?t.attrs.style:"inline";return a((()=>{let e;"string"==typeof t.attrs?e=t.attrs:t.attrs.content&&(e=t.attrs.content),r.value=e.replace(/\$\{wbsAssetsUri\}/g,o)})),(e,t)=>(g(),m("div",{class:w(v(i)),innerHTML:r.value},null,10,Yu))}},Qu={class:"wbs-social-setter"},Zu=["innerHTML"],ep={class:"mt w100"},tp={class:"scb-hd"},np=["innerHTML"],op={__name:"AttrSocialItems",props:["modelValue","attrs","size"],emits:["update:modelValue"],setup(e,{emit:t}){const n=e,o=t,r=n.attrs.max||4,s=i({get:()=>n.modelValue,set:e=>{o("update:modelValue",e)}}),l=i((()=>Object.values(s.value).filter((e=>1==e.status))));return(t,n)=>{const o=Le,i=ge,a=Y;return g(),m(A,null,[y("div",Qu,[(g(!0),m(A,null,E(s.value,((t,n)=>(g(),B(o,{key:n,"true-value":"1","false-value":"0",label:e.attrs.items[t.code].name,modelValue:t.status,"onUpdate:modelValue":e=>t.status=e,disabled:l.value.length>=v(r)&&0==t.status},null,8,["label","modelValue","onUpdate:modelValue","disabled"])))),128)),e.attrs.remark?(g(),m("div",{key:0,class:"description mt",innerHTML:e.attrs.remark},null,8,Zu)):F("",!0)]),y("div",ep,[(g(!0),m(A,null,E(s.value,((t,n)=>j((g(),m("div",{class:"social-item sc-block",key:n},[y("span",tp,Z(e.attrs.items[t.code].name),1),1==t.type?(g(),B(i,{key:0,modelValue:t.img,"onUpdate:modelValue":e=>t.img=e},null,8,["modelValue","onUpdate:modelValue"])):F("",!0),0==t.type?(g(),B(a,{key:1,type:"text",modelValue:t.url,"onUpdate:modelValue":e=>t.url=e},null,8,["modelValue","onUpdate:modelValue"])):F("",!0),y("div",{class:"description",innerHTML:e.attrs.items[t.code].desc},null,8,np)])),[[K,1==t.status]]))),128))])],64)}}},rp={class:"poster-themes"},ip={class:"theme-name"},sp=["value"],lp={class:"theme-demo"},ap=["src"],cp={__name:"AttrPosterSetter",props:["modelValue","attrs","size"],emits:["update:modelValue"],setup(e,{emit:t}){const n=e,o=t,{wbsCnf:r}=ue(),s=r.dir_url,l=i({get:()=>n.modelValue,set:e=>{o("update:modelValue",e)}});return(t,n)=>(g(),m("div",rp,[(g(!0),m(A,null,E(e.attrs.items,((e,t)=>(g(),m("label",{key:"theme"+t},[y("div",ip,[j(y("input",{type:"radio",value:e.value,"onUpdate:modelValue":n[0]||(n[0]=e=>l.value=e)},null,8,sp),[[ye,l.value]]),y("span",null,Z(e.label),1)]),y("div",lp,[y("img",{src:v(s)+"/images/share/preview/dwq_theme_"+(t+1)+".png"},null,8,ap)])])))),128))]))}},dp={class:"wbs-thumb-rate-setter"},hp={class:"ml"},up={key:0,class:"block wbb-option-remark mt"},pp={class:"mt"},fp={key:0,class:"img-rate-demo"},mp={__name:"AttrThumbnailRateSetter",props:["modelValue","attrs","size"],emits:["update:modelValue"],setup(e,{emit:t}){const n=e,o=t,r=l(!1);let s=[];const c=l(""),d=l(""),h=i({get:()=>n.modelValue,set:e=>{o("update:modelValue",e)}}),u=e=>{h.value="custom"===e?c.value:s[e].value},p=e=>{if(e.match(/[^0-9:\.]/g))return be.alert("请按正确格式设置。"),void(c.value="");h.value=c.value},f=i((()=>{const e=h.value.split(":");return Math.round(e[1]/e[0]*100)+"%"}));return a((()=>{s=n.attrs.items,d.value=n.modelValue?"custom":0,c.value=n.modelValue,s.forEach(((e,t)=>{e.value==n.modelValue&&(d.value=t)}))})),(t,n)=>{const o=$e,i=Y,s=ve,l=Be;return g(),m("div",dp,[U(l,{modelValue:d.value,"onUpdate:modelValue":n[1]||(n[1]=e=>d.value=e),onChange:u},{default:H((()=>[(g(!0),m(A,null,E(e.attrs.items,((e,t)=>(g(),B(o,{key:"tr"+t,value:t},{default:H((()=>[y("span",null,Z(e.label),1)])),_:2},1032,["value"])))),128)),U(o,{value:"custom"},{default:H((()=>[n[3]||(n[3]=y("span",null,"自定义",-1)),j(y("span",hp,[U(i,{size:e.size,class:"w8em",modelValue:c.value,"onUpdate:modelValue":n[0]||(n[0]=e=>c.value=e),onChange:p},null,8,["size","modelValue"]),U(s,{style:{"margin-left":"5px"},"data-msg":"格式为宽:高,如4:3"})],512),[[K,"custom"==d.value]])])),_:1})])),_:1},8,["modelValue"]),e.attrs.remark?(g(),m("div",up,Z(e.attrs.remark),1)):F("",!0),y("div",pp,[y("a",{class:"link",onClick:n[2]||(n[2]=e=>r.value=!r.value)},"预览 >"),r.value?(g(),m("div",fp,[y("ul",null,[(g(),m(A,null,E([1,2,3,4,5,6,7,8],(e=>y("li",{key:e},[y("div",{class:"cover",style:b("padding-top:"+f.value)},[y("i",null,Z(h.value),1)],4),n[4]||(n[4]=y("span",null,null,-1))]))),64))])])):F("",!0)])])}}},gp={class:"wbs-fav-icon-setter"},yp={class:"wbb-attr-media wbb-file-uploader"},vp={class:"wbb-preview"},bp=["src"],kp={class:"wbb-ctrl-bar"},xp={class:"wbb-ctrl-items"},Mp={key:0,class:"wbs-site-icon-preview"},Sp=["src"],Cp={class:"favicon"},Op=["src"],Tp={class:"browser-title","aria-hidden":"true"},Ap=512,Ep={__name:"FavIcoUploader",props:{modelValue:{default:()=>({})},attrs:{default:()=>({btn:"选择",placeholder:"",library:{type:"image, mp4"},multiple:!1})},mediaType:"image, mp4"},emits:["update:modelValue"],setup(e,{emit:t}){const n=t,{wbsCnf:o}=ue(),r=l(o.fav_icon),i=()=>{var e=wp.media({button:{text:"选择图片",close:!1},states:[new wp.media.controller.Library({title:"选择图片",library:wp.media.query({type:"image"}),date:!1,suggestedWidth:Ap,suggestedHeight:Ap}),new wp.media.controller.SiteIconCropper({control:{params:{width:Ap,height:Ap}},imgSelectOptions:s})]});function t(e){ke.saveData({action:o.base.action.act,do:"set_site_icon",id:e.id}).then((e=>{e&&"0"==e.code&&xe({message:"保存成功",type:"success"})}))}const i=l("");e.on("cropped",(function(o){i.value=o.id,r.value=o.url,n("update:modelValue",o.id),t(o),e.close(),e=null})),e.on("select",(function(){var o=e.state().get("selection").first();if(o.attributes.height===Ap&&Ap===o.attributes.width){const{attributes:i}=o;t(i),r.value=i.url,n("update:modelValue",i.id),e.close(),e=null}else e.setState("cropper")})),e.open()};function s(e){let t,n,o,r=e.get("width"),i=e.get("height"),s=512,l=512,a=s/l,c=s,d=l;return r/i>a?(l=i,s=l*a):(s=r,l=s/a),t=(r-s)/2,n=(i-l)/2,o={aspectRatio:s+":"+l,handles:!0,keys:!0,instance:!0,persistent:!0,imageWidth:r,imageHeight:i,minWidth:c>s?s:c,minHeight:d>l?l:d,x1:t,y1:n,x2:s+t,y2:l+n},o}const a=()=>{be.confirm("确认删除?").then((()=>{ke.saveData({action:o.base.action.act,do:"set_site_icon",remove:1}).then((e=>{r.value=null,n("update:modelValue",null)}))}))};return(e,t)=>(g(),m("div",gp,[y("div",yp,[y("div",vp,[r.value?(g(),m(A,{key:0},[y("img",{class:"wbb-img",src:r.value,alt:""},null,8,bp),y("div",{class:"wbb-mask",onClick:i}),y("div",{class:"wbb-ctrl-del",onClick:a,"wb-lang":"",title:"删除"},[U(we,{name:"delete"})])],64)):(g(),m(A,{key:1},[U(we,{class:"wbb-svg-icon wbb-icon-add",name:"add"}),y("div",{class:"wbb-mask",onClick:i})],64)),y("div",kp,[y("div",xp,[y("div",{class:"wbb-ctrl-item",onClick:i,"wb-lang":""},Z(r.value?"更换":"选择"),1)])])])]),r.value?(g(),m("div",Mp,[y("img",{src:v(o).admin_home+"/images/browser.png",class:"browser-preview",width:"182",alt:""},null,8,Sp),y("div",Cp,[y("img",{src:r.value,alt:""},null,8,Op)]),y("span",Tp,Z(v(o).blog_name),1)])):F("",!0)]))}},Np=["attrs"],Dp=["innerHTML"],Rp={key:18,class:"wbb-type-selectors"},Vp=["src","alt"],Ip={__name:"OptionTypes",props:{modelValue:{},field:{type:Object,default:{type:"",attrs:null}},wb_e:{type:Function,default:()=>{}},elSize:"small"},emits:["update:modelValue"],setup(e,{emit:t}){const n=e,o=t,{wbsCnf:r}=ue(),s=r.wbb_assets_dir,l=i({get:()=>n.modelValue,set:e=>o("update:modelValue",e)});return(t,n)=>{const o=yt,r=Y,i=He,a=Be,c=$e,d=Le,h=Pe,u=ft,p=ge,f=Uu;return g(),m(A,null,["divider"===e.field.type?(g(),B(o,{key:0,attrs:e.field.attrs},null,8,["attrs"])):"wb-divider"===e.field.type?(g(),m("h3",{key:1,class:"sc-title-sub",attrs:e.field.attrs},[y("span",null,Z(e.field.label),1)],8,Np)):"input"===e.field.type?(g(),B(r,_({key:2,modelValue:l.value,"onUpdate:modelValue":n[0]||(n[0]=e=>l.value=e)},e.field.attrs,{size:e.elSize}),null,16,["modelValue","size"])):"link"===e.field.type?(g(),B(r,_({key:3,modelValue:l.value,"onUpdate:modelValue":n[1]||(n[1]=e=>l.value=e)},e.field.attrs,{size:e.elSize}),null,16,["modelValue","size"])):"select"===e.field.type?(g(),B(Gu,{key:4,modelValue:l.value,"onUpdate:modelValue":n[2]||(n[2]=e=>l.value=e),attrs:e.field.attrs,size:e.elSize},null,8,["modelValue","attrs","size"])):"input-number"===e.field.type?(g(),B(qu,{key:5,modelValue:l.value,"onUpdate:modelValue":n[3]||(n[3]=e=>l.value=e),attrs:e.field.attrs,size:e.elSize,unit:e.field.unit},null,8,["modelValue","attrs","size","unit"])):"textarea"===e.field.type?(g(),B(r,_({key:6,type:"textarea",modelValue:l.value,"onUpdate:modelValue":n[4]||(n[4]=e=>l.value=e)},e.field.attrs,{size:e.elSize}),null,16,["modelValue","size"])):"switch"===e.field.type?(g(),B(Ju,{key:7,modelValue:l.value,"onUpdate:modelValue":n[5]||(n[5]=e=>l.value=e),attrs:e.field.attrs,size:e.elSize},null,8,["modelValue","attrs","size"])):"radio-button"===e.field.type?(g(),B(a,{key:8,modelValue:l.value,"onUpdate:modelValue":n[6]||(n[6]=e=>l.value=e),size:e.elSize},{default:H((()=>[(g(!0),m(A,null,E(e.field.attrs.items,(e=>(g(),B(i,{key:e.label,value:e.value},{default:H((()=>[Q(Z(e.label),1)])),_:2},1032,["value"])))),128))])),_:1},8,["modelValue","size"])):"radio"===e.field.type?(g(),B(a,{key:9,modelValue:l.value,"onUpdate:modelValue":n[7]||(n[7]=e=>l.value=e),size:e.elSize},{default:H((()=>[(g(!0),m(A,null,E(e.field.attrs.items,(e=>(g(),B(c,{key:e.label,value:e.value},{default:H((()=>[Q(Z(e.label),1)])),_:2},1032,["value"])))),128))])),_:1},8,["modelValue","size"])):"checkbox"===e.field.type?(g(),B(h,{key:10,modelValue:l.value,"onUpdate:modelValue":n[8]||(n[8]=e=>l.value=e),size:e.elSize},{default:H((()=>[(g(!0),m(A,null,E(e.field.attrs.items,(e=>(g(),B(d,{value:e.value},{default:H((()=>[Q(Z(e.label),1)])),_:2},1032,["value"])))),256))])),_:1},8,["modelValue","size"])):"color"===e.field.type?(g(),B(u,_({key:11,"show-alpha":"",modelValue:l.value,"onUpdate:modelValue":n[9]||(n[9]=e=>l.value=e)},e.field.attrs),null,16,["modelValue"])):"remark"===e.field.type?(g(),m("div",{key:12,class:"wbb-remark-info",innerHTML:l.value},null,8,Dp)):"fav-icon"===e.field.type?(g(),B(Ep,_({key:13,modelValue:l.value,"onUpdate:modelValue":n[10]||(n[10]=e=>l.value=e),wb_e:e.wb_e},e.field.attrs),null,16,["modelValue","wb_e"])):"upload"===e.field.type?(g(),B(p,_({key:14,modelValue:l.value,"onUpdate:modelValue":n[11]||(n[11]=e=>l.value=e),wb_e:e.wb_e},e.field.attrs),null,16,["modelValue","wb_e"])):"img"===e.field.type?(g(),B(p,_({key:15,modelValue:l.value,"onUpdate:modelValue":n[12]||(n[12]=e=>l.value=e)},e.field.attrs,{wb_e:e.wb_e,type:"img"}),null,16,["modelValue","wb_e"])):"video"===e.field.type?(g(),B(p,_({key:16,modelValue:l.value,"onUpdate:modelValue":n[13]||(n[13]=e=>l.value=e)},e.field.attrs,{type:"video",wb_e:e.wb_e}),null,16,["modelValue","wb_e"])):"hidden"===e.field.type?j((g(),m("input",{key:17,"onUpdate:modelValue":n[14]||(n[14]=e=>l.value=e),type:"hidden"},null,512)),[[Me,l.value]]):"custom-layout"===e.field.type?(g(),m("div",Rp,[U(a,{modelValue:l.value,"onUpdate:modelValue":n[15]||(n[15]=e=>l.value=e)},{default:H((()=>[(g(!0),m(A,null,E(e.field.attrs.items,((t,n)=>(g(),B(c,{key:e.field.slug+n,label:t.value,size:e.elSize},{default:H((()=>[t.thumbUrl?(g(),m("img",{key:0,class:"layout-img",src:v(s)+t.thumbUrl,alt:t.label},null,8,Vp)):F("",!0)])),_:2},1032,["label","size"])))),128))])),_:1},8,["modelValue"])])):"html-editor"===e.field.type?(g(),B(f,{key:19,modelValue:l.value,"onUpdate:modelValue":n[16]||(n[16]=e=>l.value=e),wb_e:e.wb_e,attrs:e.field.attrs,size:e.elSize},null,8,["modelValue","wb_e","attrs","size"])):"social-setter"===e.field.type?(g(),B(op,{key:20,modelValue:l.value,"onUpdate:modelValue":n[17]||(n[17]=e=>l.value=e),wb_e:e.wb_e,attrs:e.field.attrs,size:e.elSize},null,8,["modelValue","wb_e","attrs","size"])):"poster-setter"===e.field.type?(g(),B(cp,{key:21,modelValue:l.value,"onUpdate:modelValue":n[18]||(n[18]=e=>l.value=e),wb_e:e.wb_e,attrs:e.field.attrs},null,8,["modelValue","wb_e","attrs"])):"thumb-rate-setter"===e.field.type?(g(),B(mp,{key:22,modelValue:l.value,"onUpdate:modelValue":n[19]||(n[19]=e=>l.value=e),attrs:e.field.attrs},null,8,["modelValue","attrs"])):F("",!0),e.field.remark?(g(),B(Xu,{key:23,class:"wbb-option-remark",wb_e:e.wb_e,attrs:e.field.remark},null,8,["wb_e","attrs"])):F("",!0)],64)}}},zp={class:"box-main"},Lp={class:"box-name"},Pp={class:"box-desc"},$p={class:"box-ctrl"},Bp={class:"ctrl-items"},Hp={key:0,class:"box-ft"},_p=["href"],Fp={__name:"OptBox",props:{name:String,desc:String,docLink:String,docLabel:"Help",modelValue:[String,Number,Boolean]},emits:["update:modelValue"],setup(e,{emit:t}){const n=e,o=t,r=i({get:()=>n.modelValue,set:e=>{o("update:modelValue",e)}});return(t,n)=>{const o=Fe;return g(),m("div",{class:w(["wbs-opt-box",{"with-ft":e.docLink}])},[y("div",zp,[y("div",Lp,Z(e.name),1),y("div",Pp,[oe(t.$slots,"desc",{},(()=>[Q(Z(e.desc),1)]))])]),y("div",$p,[y("div",Bp,[oe(t.$slots,"ctrlItems",{},(()=>[U(o,{"active-value":"1","inactive-value":"0",modelValue:r.value,"onUpdate:modelValue":n[0]||(n[0]=e=>r.value=e)},null,8,["modelValue"])]))])]),e.docLink?(g(),m("div",Hp,[oe(t.$slots,"footer",{},(()=>[y("a",{class:"doc-link",href:e.docLink,target:"_blank"},[Q(Z(e.docLabel),1),n[1]||(n[1]=y("i",{class:"el-icon-caret-right el-icon--right"},null,-1))],8,_p)]))])):F("",!0)],2)}}},jp={class:"wbs-content-inner pw-max"},Up={class:"guide-page-name"},Wp={class:"wbs-steps"},qp={class:"cur-step-name"},Kp={class:"step-items-wp"},Jp={class:"step-items"},Gp=["title"],Yp={key:0,class:"steps-card-wp"},Xp={class:"steps-card-box"},Qp={key:0,class:"wbs-main complete-box"},Zp={class:"complete-box-inner"},ef=["innerHTML"],tf={key:1,class:"wbs-main"},nf=["innerHTML"],of={key:0},rf={class:"wbs-form-table"},sf={class:"row w8em"},lf={class:"wbs-selector-separators"},af=["value"],cf={class:"select-item"},df={key:3,class:"option-items-selector"},hf={class:"select-item"},uf={class:"label"},pf=["onUpdate:modelValue"],ff={key:4,class:"wbs-form-table-steps",style:{width:"100%"}},mf={class:"row w6em"},gf={key:0},yf=["innerHTML"],vf={class:"wbs-sf-label"},bf={class:"wbs-sf-main"},wf={class:"steps-card-ft"},kf={class:"scft-item primary"},xf={class:"scft-item"},Mf={class:"scft-item"},Sf={key:1,class:"skip-bar"},Cf={__name:"Step",props:{step:{type:Number,default:1}},emits:["next","prev"],setup(e,{emit:t}){const n=Se(),o=Ce(),{wbsCnf:r}=ue(),{wb_e:s}=pe(r),d=l(!1),h=l(!1),u=P({}),p=P({}),f=l(1),k=l([]),x=P({}),M=P({post:!1,page:!1,category:!1,tag:!1,search:!1,author:!1}),S=l([]),C=l(1),O=i((()=>C.value==S.value.length)),T=()=>{u.step=C.value,u.seo_index=Object.keys(M).filter((e=>M[e])),7==C.value&&(u.finnish=1),h.value=!0,ke.saveData({op:"set_guide",opt:u}).then((()=>{h.value=!1,f.value=0,C.value=1*C.value+1,n.push({path:"/step/"+C.value})}))},N=()=>{C.value=C.value>1?1*C.value-1:1,n.push({path:"/step/"+C.value})},D=e=>{ke.saveData({op:"set_guide",skip:1,step:C.value}).then((t=>{f.value=1,"function"==typeof e&&e(),r.show_guide=0,n.push({path:"/tdk-base"})}))},R=()=>{h.value=!0,ke.getData({op:"robots_txt"}).then((e=>{u.robots_txt=e.data,h.value=!1}))},V=()=>{n.push({path:"/setting"})};return a((()=>{const e=Number(o.params.step)?Number(o.params.step):1;C.value=e>0?e:1,h.value=!0,ke.getData({op:"get_guide",step:C.value}).then((e=>{Object.assign(u,e.data),Object.assign(p,e.cnf.step_fields);for(const[t,n]of Object.entries(e.cnf.step_fields))S.value.push(n.label);if(C.value>S.value.length)return C.value=1,void n.push({path:"/step/1"});k.value=e.cnf.separator,Object.assign(x,e.cnf.title_variables),(e.data.seo_index||[]).forEach((e=>{M[e]=!0})),e.data.robots_txt||R(),d.value=!0,h.value=!1,$((()=>{f.value=0}))}))})),c(u,(()=>f.value++),{deep:!0}),Oe(((e,t,n)=>{if(f.value>1){window.confirm(s("您修改的设置尚未保存,确定离开此页面吗?"))?(f.value=0,n()):n(!1),V()}else n()})),(e,t)=>{const n=Te("wbs-tdk-setter"),o=Fe,r=X,i=Ip,l=Ae;return g(),m("div",jp,[j((g(),m("div",{class:w(["wbs-main",{"wb-page-loaded":d.value}])},[y("div",Up,[t[2]||(t[2]=y("svg",{xmlns:"http://www.w3.org/2000/svg",width:"6",height:"12",fill:"none"},[y("path",{fill:"#C4C4C4","fill-rule":"evenodd",d:"M2.3 5.6l3.5-4.4L4.2 0l-4 5-.2.6.2.6 4 5L5.8 10 2.3 5.6z","clip-rule":"evenodd"})],-1)),y("span",null,Z(v(s)("安装向导")),1),t[3]||(t[3]=y("svg",{xmlns:"http://www.w3.org/2000/svg",width:"6",height:"12",fill:"none"},[y("path",{fill:"#C4C4C4","fill-rule":"evenodd",d:"M3.5 5.6L0 10l1.6 1.2 4-5 .2-.6-.2-.6-4-5L0 1.2l3.5 4.4z","clip-rule":"evenodd"})],-1))]),y("div",Wp,[y("div",qp,Z(C.value)+"."+Z(S.value[C.value-1]),1),y("div",Kp,[y("ul",Jp,[(g(!0),m(A,null,E(S.value,((e,t)=>(g(),m("li",{class:w(["step-item",{active:C.value>t}]),key:t},[y("label",{title:e},Z(t+1),9,Gp)],2)))),128))])])]),d.value?(g(),m("div",Yp,[y("div",Xp,[O.value?(g(),m("div",Qp,[y("div",Zp,[t[4]||(t[4]=y("svg",{xmlns:"http://www.w3.org/2000/svg",width:"140",height:"131",fill:"none"},[y("path",{fill:"#34BA9C","fill-rule":"evenodd",d:"M118 46.4a55.7 55.7 0 01-52.7 75A56 56 0 1198.3 20l7.2-6.2A65.4 65.4 0 10125 39l-7 7.5z","clip-rule":"evenodd"}),y("path",{fill:"#34BA9C","fill-rule":"evenodd",d:"M130.7 4.7l-65.4 56-28-23.4-9.3 9.4 37.3 42L140 9.3l-9.3-4.6z","clip-rule":"evenodd"})],-1)),y("div",{class:"step-desc desc-finnish",innerHTML:p[C.value].description},null,8,ef)])])):j((g(),m("div",tf,[p[C.value].description?(g(),m("div",{key:0,class:"step-desc",innerHTML:p[C.value].description},null,8,nf)):F("",!0),(g(!0),m(A,null,E(p[C.value].fields,((e,l)=>(g(),m(A,{key:"field"+l},["wbs-selector-separators"==e.type?(g(),m("div",of,[y("table",rf,[y("tbody",null,[y("tr",null,[y("th",sf,Z(e.label),1),y("td",null,[y("div",lf,[(g(!0),m(A,null,E(k.value,(e=>(g(),m("label",{class:w(["selector-item",{selected:e==u.separator}]),key:e},[j(y("input",{type:"radio",value:e,"onUpdate:modelValue":t[0]||(t[0]=e=>u.separator=e)},null,8,af),[[ye,u.separator]]),Q(Z(e),1)],2)))),128))])])])])])])):"wbs-tdk-setter"==e.type?(g(),B(n,{key:1,cnf:{separator:u.separator,titleVariables:x},wb_e:v(s),modelValue:u.index_tdk,"onUpdate:modelValue":t[1]||(t[1]=e=>u.index_tdk=e)},null,8,["cnf","wb_e","modelValue"])):"checkbox-switch"==e.type?(g(!0),m(A,{key:2},E(e.attrs.items,(e=>(g(),m("div",cf,[y("span",null,Z(e.label),1),U(o,{class:"ml",modelValue:M[e.value],"onUpdate:modelValue":t=>M[e.value]=t,"active-value":!0,"inactive-value":!1},null,8,["modelValue","onUpdate:modelValue"])])))),256)):"robots-setter"==e.type?(g(),m("div",df,[y("div",hf,[y("div",uf,Z(e.label),1),j(y("textarea",{class:"wbs-input",rows:"8","onUpdate:modelValue":t=>u[e.slug]=t},null,8,pf),[[Me,u[e.slug]]]),U(r,{type:"primary",plain:"",size:"small",onClick:R},{default:H((()=>[Q(Z(e.attrs.btn_label),1)])),_:2},1024)])])):"group"==e.type?(g(),m("table",ff,[y("tbody",null,[(g(!0),m(A,null,E(e.group.fields,((t,n)=>(g(),m("tr",{key:n},[y("th",mf,[0==n?(g(),m("span",gf,Z(e.label),1)):F("",!0)]),y("td",{class:"w50",innerHTML:t.label},null,8,yf),y("td",null,[U(o,{modelValue:u.url_seo[t.slug],"onUpdate:modelValue":e=>u.url_seo[t.slug]=e,"active-value":"1","inactive-value":"0"},null,8,["modelValue","onUpdate:modelValue"])])])))),128))])])):"wbs-opt-box"==e.type?(g(),B(Fp,{key:5,name:e.label,desc:e.attrs.desc,"doc-link":e.attrs.doc},{ctrlItems:H((()=>[(g(!0),m(A,null,E(e.group.fields,((t,n)=>(g(),B(i,{modelValue:u[e.slug][t.slug],"onUpdate:modelValue":n=>u[e.slug][t.slug]=n,field:t,wb_e:v(s)},null,8,["modelValue","onUpdate:modelValue","field","wb_e"])))),256))])),_:2},1032,["name","desc","doc-link"])):(g(),m(A,{key:6},[U(i,{modelValue:u[e.slug],"onUpdate:modelValue":t=>u[e.slug]=t,field:e,wb_e:v(s)},null,8,["modelValue","onUpdate:modelValue","field","wb_e"]),e.group?(g(),m("div",{key:0,class:w(["wbs-sub-fields",e.group.class]),style:b(e.group.style)},[(g(!0),m(A,null,E(e.group.fields,((t,n)=>j((g(),m("div",{class:w(["wbs-sub-field",t.class]),key:e.slug+n,style:b(t.style)},[y("div",vf,Z(t.label),1),y("div",bf,[U(i,{modelValue:u[t.slug],"onUpdate:modelValue":e=>u[t.slug]=e,field:t,wb_e:v(s)},null,8,["modelValue","onUpdate:modelValue","field","wb_e"])])],6)),[[K,void 0===t.show||u[e.slug]==t.show]]))),128))],6)):F("",!0)],64))],64)))),128))])),[[l,h.value]]),y("div",wf,[y("div",kf,[j(y("div",xf,[U(r,{onClick:N},{default:H((()=>[t[5]||(t[5]=y("i",{class:"el-icon-arrow-left"},null,-1)),Q(" "+Z(v(s)("上一步")),1)])),_:1})],512),[[K,C.value>1]])]),y("div",Mf,[O.value?(g(),B(r,{key:0,type:"primary",onClick:V},{default:H((()=>[Q(Z(v(s)("关闭"))+" ",1),t[6]||(t[6]=y("i",{class:"el-icon-arrow-right"},null,-1))])),_:1})):(g(),B(r,{key:1,type:"primary",onClick:T},{default:H((()=>[Q(Z(v(s)("下一步"))+" ",1),t[7]||(t[7]=y("i",{class:"el-icon-arrow-right"},null,-1))])),_:1}))])])])])):F("",!0),O.value?F("",!0):(g(),m("div",Sf,[y("a",{class:"skip-link",onClick:D},Z(v(s)("暂不配置")),1)]))],2)),[[l,!d.value]])])}}};export{Cf as default};