You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
ygdc/kirby/panel/dist/js/vendor.min.js

16 lines
253 KiB

var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function e(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var n={},r={},i={},o={},s={};function l(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function a(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?l(Object(n),!0).forEach((function(e){c(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):l(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function c(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function h(t){return(h="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}Object.defineProperty(s,"__esModule",{value:!0}),s._setTarget=void 0,s.popParams=p,s.pushParams=f,s.target=void 0,s.withParams=function(t,e){if("object"===h(t)&&void 0!==e)return n=t,r=e,g((function(t){return function(){t(n);for(var e=arguments.length,i=new Array(e),o=0;o<e;o++)i[o]=arguments[o];return r.apply(this,i)}}));var n,r;return g(t)};var u=[],d=null;s.target=d;function f(){null!==d&&u.push(d),s.target=d={}}function p(){var t=d,e=s.target=d=u.pop()||null;return e&&(Array.isArray(e.$sub)||(e.$sub=[]),e.$sub.push(t)),t}function m(t){if("object"!==h(t)||Array.isArray(t))throw new Error("params must be an object");s.target=d=a(a({},d),t)}function g(t){var e=t(m);return function(){f();try{for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return e.apply(this,n)}finally{p()}}}s._setTarget=function(t){s.target=d=t},Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var y=s.withParams;o.default=y,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.req=t.regex=t.ref=t.len=void 0,Object.defineProperty(t,"withParams",{enumerable:!0,get:function(){return n.default}});var e,n=(e=o)&&e.__esModule?e:{default:e};function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var i=function(t){if(Array.isArray(t))return!!t.length;if(null==t)return!1;if(!1===t)return!0;if(t instanceof Date)return!isNaN(t.getTime());if("object"===r(t)){for(var e in t)return!0;return!1}return!!String(t).length};t.req=i;t.len=function(t){return Array.isArray(t)?t.length:"object"===r(t)?Object.keys(t).length:String(t).length};t.ref=function(t,e,n){return"function"==typeof t?t.call(e,n):n[t]};t.regex=function(t,e){return(0,n.default)({type:t},(function(t){return!i(t)||e.test(t)}))}}(i),Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var v=(0,i.regex)("alpha",/^[a-zA-Z]*$/);r.default=v;var w={};Object.defineProperty(w,"__esModule",{value:!0}),w.default=void 0;var b=(0,i.regex)("alphaNum",/^[a-zA-Z0-9]*$/);w.default=b;var x={};Object.defineProperty(x,"__esModule",{value:!0}),x.default=void 0;var S=(0,i.regex)("numeric",/^[0-9]*$/);x.default=S;var k={};Object.defineProperty(k,"__esModule",{value:!0}),k.default=void 0;var M=i;k.default=function(t,e){return(0,M.withParams)({type:"between",min:t,max:e},(function(n){return!(0,M.req)(n)||(!/\s/.test(n)||n instanceof Date)&&+t<=+n&&+e>=+n}))};var O={};Object.defineProperty(O,"__esModule",{value:!0}),O.default=void 0;var C=(0,i.regex)("email",/^(?:[A-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[A-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9]{2,}(?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])$/i);O.default=C;var D={};Object.defineProperty(D,"__esModule",{value:!0}),D.default=void 0;var N=i,T=(0,N.withParams)({type:"ipAddress"},(function(t){if(!(0,N.req)(t))return!0;if("string"!=typeof t)return!1;var e=t.split(".");return 4===e.length&&e.every(A)}));D.default=T;var A=function(t){if(t.length>3||0===t.length)return!1;if("0"===t[0]&&"0"!==t)return!1;if(!t.match(/^\d+$/))return!1;var e=0|+t;return e>=0&&e<=255},E={};Object.defineProperty(E,"__esModule",{value:!0}),E.default=void 0;var $=i;E.default=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:":";return(0,$.withParams)({type:"macAddress"},(function(e){if(!(0,$.req)(e))return!0;if("string"!=typeof e)return!1;var n="string"==typeof t&&""!==t?e.split(t):12===e.length||16===e.length?e.match(/.{2}/g):null;return null!==n&&(6===n.length||8===n.length)&&n.every(P)}))};var P=function(t){return t.toLowerCase().match(/^[0-9a-f]{2}$/)},I={};Object.defineProperty(I,"__esModule",{value:!0}),I.default=void 0;var R=i;I.default=function(t){return(0,R.withParams)({type:"maxLength",max:t},(function(e){return!(0,R.req)(e)||(0,R.len)(e)<=t}))};var z={};Object.defineProperty(z,"__esModule",{value:!0}),z.default=void 0;var _=i;z.default=function(t){return(0,_.withParams)({type:"minLength",min:t},(function(e){return!(0,_.req)(e)||(0,_.len)(e)>=t}))};var B={};Object.defineProperty(B,"__esModule",{value:!0}),B.default=void 0;var j=i,V=(0,j.withParams)({type:"required"},(function(t){return(0,j.req)("string"==typeof t?t.trim():t)}));B.default=V;var F={};Object.defineProperty(F,"__esModule",{value:!0}),F.default=void 0;var L=i;F.default=function(t){return(0,L.withParams)({type:"requiredIf",prop:t},(function(e,n){return!(0,L.ref)(t,this,n)||(0,L.req)(e)}))};var W={};Object.defineProperty(W,"__esModule",{value:!0}),W.default=void 0;var q=i;W.default=function(t){return(0,q.withParams)({type:"requiredUnless",prop:t},(function(e,n){return!!(0,q.ref)(t,this,n)||(0,q.req)(e)}))};var J={};Object.defineProperty(J,"__esModule",{value:!0}),J.default=void 0;var K=i;J.default=function(t){return(0,K.withParams)({type:"sameAs",eq:t},(function(e,n){return e===(0,K.ref)(t,this,n)}))};var H={};Object.defineProperty(H,"__esModule",{value:!0}),H.default=void 0;var Y=(0,i.regex)("url",/^(?:(?:(?:https?|ftp):)?\/\/)(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u00a1-\uffff][a-z0-9\u00a1-\uffff_-]{0,62})?[a-z0-9\u00a1-\uffff]\.)+(?:[a-z\u00a1-\uffff]{2,}\.?))(?::\d{2,5})?(?:[/?#]\S*)?$/i);H.default=Y;var U={};Object.defineProperty(U,"__esModule",{value:!0}),U.default=void 0;var G=i;U.default=function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return(0,G.withParams)({type:"or"},(function(){for(var t=this,n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return e.length>0&&e.reduce((function(e,n){return e||n.apply(t,r)}),!1)}))};var Z={};Object.defineProperty(Z,"__esModule",{value:!0}),Z.default=void 0;var X=i;Z.default=function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return(0,X.withParams)({type:"and"},(function(){for(var t=this,n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return e.length>0&&e.reduce((function(e,n){return e&&n.apply(t,r)}),!0)}))};var Q={};Object.defineProperty(Q,"__esModule",{value:!0}),Q.default=void 0;var tt=i;Q.default=function(t){return(0,tt.withParams)({type:"not"},(function(e,n){return!(0,tt.req)(e)||!t.call(this,e,n)}))};var et={};Object.defineProperty(et,"__esModule",{value:!0}),et.default=void 0;var nt=i;et.default=function(t){return(0,nt.withParams)({type:"minValue",min:t},(function(e){return!(0,nt.req)(e)||(!/\s/.test(e)||e instanceof Date)&&+e>=+t}))};var rt={};Object.defineProperty(rt,"__esModule",{value:!0}),rt.default=void 0;var it=i;rt.default=function(t){return(0,it.withParams)({type:"maxValue",max:t},(function(e){return!(0,it.req)(e)||(!/\s/.test(e)||e instanceof Date)&&+e<=+t}))};var ot={};Object.defineProperty(ot,"__esModule",{value:!0}),ot.default=void 0;var st=(0,i.regex)("integer",/(^[0-9]*$)|(^-[0-9]+$)/);ot.default=st;var lt={};Object.defineProperty(lt,"__esModule",{value:!0}),lt.default=void 0;var at=(0,i.regex)("decimal",/^[-]?\d*(\.\d+)?$/);function ct(t){this.content=t}function ht(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let i=t.child(r),o=e.child(r);if(i!=o){if(!i.sameMarkup(o))return n;if(i.isText&&i.text!=o.text){for(let t=0;i.text[t]==o.text[t];t++)n++;return n}if(i.content.size||o.content.size){let t=ht(i.content,o.content,n+1);if(null!=t)return t}n+=i.nodeSize}else n+=i.nodeSize}}function ut(t,e,n,r){for(let i=t.childCount,o=e.childCount;;){if(0==i||0==o)return i==o?null:{a:n,b:r};let s=t.child(--i),l=e.child(--o),a=s.nodeSize;if(s!=l){if(!s.sameMarkup(l))return{a:n,b:r};if(s.isText&&s.text!=l.text){let t=0,e=Math.min(s.text.length,l.text.length);for(;t<e&&s.text[s.text.length-t-1]==l.text[l.text.length-t-1];)t++,n--,r--;return{a:n,b:r}}if(s.content.size||l.content.size){let t=ut(s.content,l.content,n-1,r-1);if(t)return t}n-=a,r-=a}else n-=a,r-=a}}lt.default=at,function(t){function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"alpha",{enumerable:!0,get:function(){return n.default}}),Object.defineProperty(t,"alphaNum",{enumerable:!0,get:function(){return o.default}}),Object.defineProperty(t,"and",{enumerable:!0,get:function(){return b.default}}),Object.defineProperty(t,"between",{enumerable:!0,get:function(){return l.default}}),Object.defineProperty(t,"decimal",{enumerable:!0,get:function(){return T.default}}),Object.defineProperty(t,"email",{enumerable:!0,get:function(){return a.default}}),t.helpers=void 0,Object.defineProperty(t,"integer",{enumerable:!0,get:function(){return N.default}}),Object.defineProperty(t,"ipAddress",{enumerable:!0,get:function(){return c.default}}),Object.defineProperty(t,"macAddress",{enumerable:!0,get:function(){return h.default}}),Object.defineProperty(t,"maxLength",{enumerable:!0,get:function(){return u.default}}),Object.defineProperty(t,"maxValue",{enumerable:!0,get:function(){return C.default}}),Object.defineProperty(t,"minLength",{enumerable:!0,get:function(){return d.default}}),Object.defineProperty(t,"minValue",{enumerable:!0,get:function(){return M.default}}),Object.defineProperty(t,"not",{enumerable:!0,get:function(){return S.default}}),Object.defineProperty(t,"numeric",{enumerable:!0,get:function(){return s.default}}),Object.defineProperty(t,"or",{enumerable:!0,get:function(){return v.default}}),Object.defineProperty(t,"required",{enumerable:!0,get:function(){return f.default}}),Object.defineProperty(t,"requiredIf",{enumerable:!0,get:function(){return p.default}}),Object.defineProperty(t,"requiredUnless",{enumerable:!0,get:function(){return m.default}}),Object.defineProperty(t,"sameAs",{enumerable:!0,get:function(){return g.default}}),Object.defineProperty(t,"url",{enumerable:!0,get:function(){return y.default}});var n=P(r),o=P(w),s=P(x),l=P(k),a=P(O),c=P(D),h=P(E),u=P(I),d=P(z),f=P(B),p=P(F),m=P(W),g=P(J),y=P(H),v=P(U),b=P(Z),S=P(Q),M=P(et),C=P(rt),N=P(ot),T=P(lt),A=function(t,n){if(!n&&t&&t.__esModule)return t;if(null===t||"object"!==e(t)&&"function"!=typeof t)return{default:t};var r=$(n);if(r&&r.has(t))return r.get(t);var i={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in t)if("default"!==s&&Object.prototype.hasOwnProperty.call(t,s)){var l=o?Object.getOwnPropertyDescriptor(t,s):null;l&&(l.get||l.set)?Object.defineProperty(i,s,l):i[s]=t[s]}i.default=t,r&&r.set(t,i);return i}(i);function $(t){if("function"!=typeof WeakMap)return null;var e=new WeakMap,n=new WeakMap;return($=function(t){return t?n:e})(t)}function P(t){return t&&t.__esModule?t:{default:t}}t.helpers=A}(n),ct.prototype={constructor:ct,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return-1},get:function(t){var e=this.find(t);return-1==e?void 0:this.content[e+1]},update:function(t,e,n){var r=n&&n!=t?this.remove(n):this,i=r.find(t),o=r.content.slice();return-1==i?o.push(n||t,e):(o[i+1]=e,n&&(o[i]=n)),new ct(o)},remove:function(t){var e=this.find(t);if(-1==e)return this;var n=this.content.slice();return n.splice(e,2),new ct(n)},addToStart:function(t,e){return new ct([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new ct(n)},addBefore:function(t,e,n){var r=this.remove(e),i=r.content.slice(),o=r.find(t);return i.splice(-1==o?i.length:o,0,e,n),new ct(i)},forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1])},prepend:function(t){return(t=ct.from(t)).size?new ct(t.content.concat(this.subtract(t).content)):this},append:function(t){return(t=ct.from(t)).size?new ct(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=ct.from(t);for(var n=0;n<t.content.length;n+=2)e=e.remove(t.content[n]);return e},toObject:function(){var t={};return this.forEach((function(e,n){t[e]=n})),t},get size(){return this.content.length>>1}},ct.from=function(t){if(t instanceof ct)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new ct(e)};class dt{constructor(t,e){if(this.content=t,this.size=e||0,null==e)for(let n=0;n<t.length;n++)this.size+=t[n].nodeSize}nodesBetween(t,e,n,r=0,i){for(let o=0,s=0;s<e;o++){let l=this.content[o],a=s+l.nodeSize;if(a>t&&!1!==n(l,r+s,i||null,o)&&l.content.size){let i=s+1;l.nodesBetween(Math.max(0,t-i),Math.min(l.content.size,e-i),n,r+i)}s=a}}descendants(t){this.nodesBetween(0,this.size,t)}textBetween(t,e,n,r){let i="",o=!0;return this.nodesBetween(t,e,((s,l)=>{s.isText?(i+=s.text.slice(Math.max(t,l)-l,e-l),o=!n):s.isLeaf?(r?i+="function"==typeof r?r(s):r:s.type.spec.leafText&&(i+=s.type.spec.leafText(s)),o=!n):!o&&s.isBlock&&(i+=n,o=!0)}),0),i}append(t){if(!t.size)return this;if(!this.size)return t;let e=this.lastChild,n=t.firstChild,r=this.content.slice(),i=0;for(e.isText&&e.sameMarkup(n)&&(r[r.length-1]=e.withText(e.text+n.text),i=1);i<t.content.length;i++)r.push(t.content[i]);return new dt(r,this.size+t.size)}cut(t,e=this.size){if(0==t&&e==this.size)return this;let n=[],r=0;if(e>t)for(let i=0,o=0;o<e;i++){let s=this.content[i],l=o+s.nodeSize;l>t&&((o<t||l>e)&&(s=s.isText?s.cut(Math.max(0,t-o),Math.min(s.text.length,e-o)):s.cut(Math.max(0,t-o-1),Math.min(s.content.size,e-o-1))),n.push(s),r+=s.nodeSize),o=l}return new dt(n,r)}cutByIndex(t,e){return t==e?dt.empty:0==t&&e==this.content.length?this:new dt(this.content.slice(t,e))}replaceChild(t,e){let n=this.content[t];if(n==e)return this;let r=this.content.slice(),i=this.size+e.nodeSize-n.nodeSize;return r[t]=e,new dt(r,i)}addToStart(t){return new dt([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new dt(this.content.concat(t),this.size+t.nodeSize)}eq(t){if(this.content.length!=t.content.length)return!1;for(let e=0;e<this.content.length;e++)if(!this.content[e].eq(t.content[e]))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(t){let e=this.content[t];if(!e)throw new RangeError("Index "+t+" out of range for "+this);return e}maybeChild(t){return this.content[t]||null}forEach(t){for(let e=0,n=0;e<this.content.length;e++){let r=this.content[e];t(r,n,e),n+=r.nodeSize}}findDiffStart(t,e=0){return ht(this,t,e)}findDiffEnd(t,e=this.size,n=t.size){return ut(this,t,e,n)}findIndex(t,e=-1){if(0==t)return pt(0,t);if(t==this.size)return pt(this.content.length,t);if(t>this.size||t<0)throw new RangeError(`Position ${t} outside of fragment (${this})`);for(let n=0,r=0;;n++){let i=r+this.child(n).nodeSize;if(i>=t)return i==t||e>0?pt(n+1,i):pt(n,r);r=i}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map((t=>t.toJSON())):null}static fromJSON(t,e){if(!e)return dt.empty;if(!Array.isArray(e))throw new RangeError("Invalid input for Fragment.fromJSON");return new dt(e.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return dt.empty;let e,n=0;for(let r=0;r<t.length;r++){let i=t[r];n+=i.nodeSize,r&&i.isText&&t[r-1].sameMarkup(i)?(e||(e=t.slice(0,r)),e[e.length-1]=i.withText(e[e.length-1].text+i.text)):e&&e.push(i)}return new dt(e||t,n)}static from(t){if(!t)return dt.empty;if(t instanceof dt)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new dt([t],t.nodeSize);throw new RangeError("Can not convert "+t+" to a Fragment"+(t.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}dt.empty=new dt([],0);const ft={index:0,offset:0};function pt(t,e){return ft.index=t,ft.offset=e,ft}function mt(t,e){if(t===e)return!0;if(!t||"object"!=typeof t||!e||"object"!=typeof e)return!1;let n=Array.isArray(t);if(Array.isArray(e)!=n)return!1;if(n){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(!mt(t[n],e[n]))return!1}else{for(let n in t)if(!(n in e)||!mt(t[n],e[n]))return!1;for(let n in e)if(!(n in t))return!1}return!0}class gt{constructor(t,e){this.type=t,this.attrs=e}addToSet(t){let e,n=!1;for(let r=0;r<t.length;r++){let i=t[r];if(this.eq(i))return t;if(this.type.excludes(i.type))e||(e=t.slice(0,r));else{if(i.type.excludes(this.type))return t;!n&&i.type.rank>this.type.rank&&(e||(e=t.slice(0,r)),e.push(this),n=!0),e&&e.push(i)}}return e||(e=t.slice()),n||e.push(this),e}removeFromSet(t){for(let e=0;e<t.length;e++)if(this.eq(t[e]))return t.slice(0,e).concat(t.slice(e+1));return t}isInSet(t){for(let e=0;e<t.length;e++)if(this.eq(t[e]))return!0;return!1}eq(t){return this==t||this.type==t.type&&mt(this.attrs,t.attrs)}toJSON(){let t={type:this.type.name};for(let e in this.attrs){t.attrs=this.attrs;break}return t}static fromJSON(t,e){if(!e)throw new RangeError("Invalid input for Mark.fromJSON");let n=t.marks[e.type];if(!n)throw new RangeError(`There is no mark type ${e.type} in this schema`);return n.create(e.attrs)}static sameSet(t,e){if(t==e)return!0;if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(!t[n].eq(e[n]))return!1;return!0}static setFrom(t){if(!t||Array.isArray(t)&&0==t.length)return gt.none;if(t instanceof gt)return[t];let e=t.slice();return e.sort(((t,e)=>t.type.rank-e.type.rank)),e}}gt.none=[];class yt extends Error{}class vt{constructor(t,e,n){this.content=t,this.openStart=e,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(t,e){let n=bt(this.content,t+this.openStart,e);return n&&new vt(n,this.openStart,this.openEnd)}removeBetween(t,e){return new vt(wt(this.content,t+this.openStart,e+this.openStart),this.openStart,this.openEnd)}eq(t){return this.content.eq(t.content)&&this.openStart==t.openStart&&this.openEnd==t.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let t={content:this.content.toJSON()};return this.openStart>0&&(t.openStart=this.openStart),this.openEnd>0&&(t.openEnd=this.openEnd),t}static fromJSON(t,e){if(!e)return vt.empty;let n=e.openStart||0,r=e.openEnd||0;if("number"!=typeof n||"number"!=typeof r)throw new RangeError("Invalid input for Slice.fromJSON");return new vt(dt.fromJSON(t,e.content),n,r)}static maxOpen(t,e=!0){let n=0,r=0;for(let i=t.firstChild;i&&!i.isLeaf&&(e||!i.type.spec.isolating);i=i.firstChild)n++;for(let i=t.lastChild;i&&!i.isLeaf&&(e||!i.type.spec.isolating);i=i.lastChild)r++;return new vt(t,n,r)}}function wt(t,e,n){let{index:r,offset:i}=t.findIndex(e),o=t.maybeChild(r),{index:s,offset:l}=t.findIndex(n);if(i==e||o.isText){if(l!=n&&!t.child(s).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=s)throw new RangeError("Removing non-flat range");return t.replaceChild(r,o.copy(wt(o.content,e-i-1,n-i-1)))}function bt(t,e,n,r){let{index:i,offset:o}=t.findIndex(e),s=t.maybeChild(i);if(o==e||s.isText)return r&&!r.canReplace(i,i,n)?null:t.cut(0,e).append(n).append(t.cut(e));let l=bt(s.content,e-o-1,n);return l&&t.replaceChild(i,s.copy(l))}function xt(t,e,n){if(n.openStart>t.depth)throw new yt("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new yt("Inconsistent open depths");return St(t,e,n,0)}function St(t,e,n,r){let i=t.index(r),o=t.node(r);if(i==e.index(r)&&r<t.depth-n.openStart){let s=St(t,e,n,r+1);return o.copy(o.content.replaceChild(i,s))}if(n.content.size){if(n.openStart||n.openEnd||t.depth!=r||e.depth!=r){let{start:i,end:s}=function(t,e){let n=e.depth-t.openStart,r=e.node(n).copy(t.content);for(let i=n-1;i>=0;i--)r=e.node(i).copy(dt.from(r));return{start:r.resolveNoCache(t.openStart+n),end:r.resolveNoCache(r.content.size-t.openEnd-n)}}(n,t);return Dt(o,Nt(t,i,s,e,r))}{let r=t.parent,i=r.content;return Dt(r,i.cut(0,t.parentOffset).append(n.content).append(i.cut(e.parentOffset)))}}return Dt(o,Tt(t,e,r))}function kt(t,e){if(!e.type.compatibleContent(t.type))throw new yt("Cannot join "+e.type.name+" onto "+t.type.name)}function Mt(t,e,n){let r=t.node(n);return kt(r,e.node(n)),r}function Ot(t,e){let n=e.length-1;n>=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function Ct(t,e,n,r){let i=(e||t).node(n),o=0,s=e?e.index(n):i.childCount;t&&(o=t.index(n),t.depth>n?o++:t.textOffset&&(Ot(t.nodeAfter,r),o++));for(let l=o;l<s;l++)Ot(i.child(l),r);e&&e.depth==n&&e.textOffset&&Ot(e.nodeBefore,r)}function Dt(t,e){return t.type.checkContent(e),t.copy(e)}function Nt(t,e,n,r,i){let o=t.depth>i&&Mt(t,e,i+1),s=r.depth>i&&Mt(n,r,i+1),l=[];return Ct(null,t,i,l),o&&s&&e.index(i)==n.index(i)?(kt(o,s),Ot(Dt(o,Nt(t,e,n,r,i+1)),l)):(o&&Ot(Dt(o,Tt(t,e,i+1)),l),Ct(e,n,i,l),s&&Ot(Dt(s,Tt(n,r,i+1)),l)),Ct(r,null,i,l),new dt(l)}function Tt(t,e,n){let r=[];if(Ct(null,t,n,r),t.depth>n){Ot(Dt(Mt(t,e,n+1),Tt(t,e,n+1)),r)}return Ct(e,null,n,r),new dt(r)}vt.empty=new vt(dt.empty,0,0);class At{constructor(t,e,n){this.pos=t,this.path=e,this.parentOffset=n,this.depth=e.length/3-1}resolveDepth(t){return null==t?this.depth:t<0?this.depth+t:t}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(t){return this.path[3*this.resolveDepth(t)]}index(t){return this.path[3*this.resolveDepth(t)+1]}indexAfter(t){return t=this.resolveDepth(t),this.index(t)+(t!=this.depth||this.textOffset?1:0)}start(t){return 0==(t=this.resolveDepth(t))?0:this.path[3*t-1]+1}end(t){return t=this.resolveDepth(t),this.start(t)+this.node(t).content.size}before(t){if(!(t=this.resolveDepth(t)))throw new RangeError("There is no position before the top-level node");return t==this.depth+1?this.pos:this.path[3*t-1]}after(t){if(!(t=this.resolveDepth(t)))throw new RangeError("There is no position after the top-level node");return t==this.depth+1?this.pos:this.path[3*t-1]+this.path[3*t].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let t=this.parent,e=this.index(this.depth);if(e==t.childCount)return null;let n=this.pos-this.path[this.path.length-1],r=t.child(e);return n?t.child(e).cut(n):r}get nodeBefore(){let t=this.index(this.depth),e=this.pos-this.path[this.path.length-1];return e?this.parent.child(t).cut(0,e):0==t?null:this.parent.child(t-1)}posAtIndex(t,e){e=this.resolveDepth(e);let n=this.path[3*e],r=0==e?0:this.path[3*e-1]+1;for(let i=0;i<t;i++)r+=n.child(i).nodeSize;return r}marks(){let t=this.parent,e=this.index();if(0==t.content.size)return gt.none;if(this.textOffset)return t.child(e).marks;let n=t.maybeChild(e-1),r=t.maybeChild(e);if(!n){let t=n;n=r,r=t}let i=n.marks;for(var o=0;o<i.length;o++)!1!==i[o].type.spec.inclusive||r&&i[o].isInSet(r.marks)||(i=i[o--].removeFromSet(i));return i}marksAcross(t){let e=this.parent.maybeChild(this.index());if(!e||!e.isInline)return null;let n=e.marks,r=t.parent.maybeChild(t.index());for(var i=0;i<n.length;i++)!1!==n[i].type.spec.inclusive||r&&n[i].isInSet(r.marks)||(n=n[i--].removeFromSet(n));return n}sharedDepth(t){for(let e=this.depth;e>0;e--)if(this.start(e)<=t&&this.end(e)>=t)return e;return 0}blockRange(t=this,e){if(t.pos<this.pos)return t.blockRange(this);for(let n=this.depth-(this.parent.inlineContent||this.pos==t.pos?1:0);n>=0;n--)if(t.pos<=this.end(n)&&(!e||e(this.node(n))))return new It(this,t,n);return null}sameParent(t){return this.pos-this.parentOffset==t.pos-t.parentOffset}max(t){return t.pos>this.pos?t:this}min(t){return t.pos<this.pos?t:this}toString(){let t="";for(let e=1;e<=this.depth;e++)t+=(t?"/":"")+this.node(e).type.name+"_"+this.index(e-1);return t+":"+this.parentOffset}static resolve(t,e){if(!(e>=0&&e<=t.content.size))throw new RangeError("Position "+e+" out of range");let n=[],r=0,i=e;for(let o=t;;){let{index:t,offset:e}=o.content.findIndex(i),s=i-e;if(n.push(o,t,r+e),!s)break;if(o=o.child(t),o.isText)break;i=s-1,r+=e+1}return new At(e,n,i)}static resolveCached(t,e){for(let r=0;r<Et.length;r++){let n=Et[r];if(n.pos==e&&n.doc==t)return n}let n=Et[$t]=At.resolve(t,e);return $t=($t+1)%Pt,n}}let Et=[],$t=0,Pt=12;class It{constructor(t,e,n){this.$from=t,this.$to=e,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 Rt=Object.create(null);class zt{constructor(t,e,n,r=gt.none){this.type=t,this.attrs=e,this.marks=r,this.content=n||dt.empty}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(t){return this.content.child(t)}maybeChild(t){return this.content.maybeChild(t)}forEach(t){this.content.forEach(t)}nodesBetween(t,e,n,r=0){this.content.nodesBetween(t,e,n,r,this)}descendants(t){this.nodesBetween(0,this.content.size,t)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(t,e,n,r){return this.content.textBetween(t,e,n,r)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(t){return this==t||this.sameMarkup(t)&&this.content.eq(t.content)}sameMarkup(t){return this.hasMarkup(t.type,t.attrs,t.marks)}hasMarkup(t,e,n){return this.type==t&&mt(this.attrs,e||t.defaultAttrs||Rt)&&gt.sameSet(this.marks,n||gt.none)}copy(t=null){return t==this.content?this:new zt(this.type,this.attrs,t,this.marks)}mark(t){return t==this.marks?this:new zt(this.type,this.attrs,this.content,t)}cut(t,e=this.content.size){return 0==t&&e==this.content.size?this:this.copy(this.content.cut(t,e))}slice(t,e=this.content.size,n=!1){if(t==e)return vt.empty;let r=this.resolve(t),i=this.resolve(e),o=n?0:r.sharedDepth(e),s=r.start(o),l=r.node(o).content.cut(r.pos-s,i.pos-s);return new vt(l,r.depth-o,i.depth-o)}replace(t,e,n){return xt(this.resolve(t),this.resolve(e),n)}nodeAt(t){for(let e=this;;){let{index:n,offset:r}=e.content.findIndex(t);if(e=e.maybeChild(n),!e)return null;if(r==t||e.isText)return e;t-=r+1}}childAfter(t){let{index:e,offset:n}=this.content.findIndex(t);return{node:this.content.maybeChild(e),index:e,offset:n}}childBefore(t){if(0==t)return{node:null,index:0,offset:0};let{index:e,offset:n}=this.content.findIndex(t);if(n<t)return{node:this.content.child(e),index:e,offset:n};let r=this.content.child(e-1);return{node:r,index:e-1,offset:n-r.nodeSize}}resolve(t){return At.resolveCached(this,t)}resolveNoCache(t){return At.resolve(this,t)}rangeHasMark(t,e,n){let r=!1;return e>t&&this.nodesBetween(t,e,(t=>(n.isInSet(t.marks)&&(r=!0),!r))),r}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 t=this.type.name;return this.content.size&&(t+="("+this.content.toStringInner()+")"),Bt(this.marks,t)}contentMatchAt(t){let e=this.type.contentMatch.matchFragment(this.content,0,t);if(!e)throw new Error("Called contentMatchAt on a node with invalid content");return e}canReplace(t,e,n=dt.empty,r=0,i=n.childCount){let o=this.contentMatchAt(t).matchFragment(n,r,i),s=o&&o.matchFragment(this.content,e);if(!s||!s.validEnd)return!1;for(let l=r;l<i;l++)if(!this.type.allowsMarks(n.child(l).marks))return!1;return!0}canReplaceWith(t,e,n,r){if(r&&!this.type.allowsMarks(r))return!1;let i=this.contentMatchAt(t).matchType(n),o=i&&i.matchFragment(this.content,e);return!!o&&o.validEnd}canAppend(t){return t.content.size?this.canReplace(this.childCount,this.childCount,t.content):this.type.compatibleContent(t.type)}check(){this.type.checkContent(this.content);let t=gt.none;for(let e=0;e<this.marks.length;e++)t=this.marks[e].addToSet(t);if(!gt.sameSet(t,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map((t=>t.type.name))}`);this.content.forEach((t=>t.check()))}toJSON(){let t={type:this.type.name};for(let e in this.attrs){t.attrs=this.attrs;break}return this.content.size&&(t.content=this.content.toJSON()),this.marks.length&&(t.marks=this.marks.map((t=>t.toJSON()))),t}static fromJSON(t,e){if(!e)throw new RangeError("Invalid input for Node.fromJSON");let n=null;if(e.marks){if(!Array.isArray(e.marks))throw new RangeError("Invalid mark data for Node.fromJSON");n=e.marks.map(t.markFromJSON)}if("text"==e.type){if("string"!=typeof e.text)throw new RangeError("Invalid text node in JSON");return t.text(e.text,n)}let r=dt.fromJSON(t,e.content);return t.nodeType(e.type).create(e.attrs,r,n)}}zt.prototype.text=void 0;class _t extends zt{constructor(t,e,n,r){if(super(t,e,null,r),!n)throw new RangeError("Empty text nodes are not allowed");this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Bt(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(t,e){return this.text.slice(t,e)}get nodeSize(){return this.text.length}mark(t){return t==this.marks?this:new _t(this.type,this.attrs,this.text,t)}withText(t){return t==this.text?this:new _t(this.type,this.attrs,t,this.marks)}cut(t=0,e=this.text.length){return 0==t&&e==this.text.length?this:this.withText(this.text.slice(t,e))}eq(t){return this.sameMarkup(t)&&this.text==t.text}toJSON(){let t=super.toJSON();return t.text=this.text,t}}function Bt(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class jt{constructor(t){this.validEnd=t,this.next=[],this.wrapCache=[]}static parse(t,e){let n=new Vt(t,e);if(null==n.next)return jt.empty;let r=Ft(n);n.next&&n.err("Unexpected trailing text");let i=function(t){let e=Object.create(null);return n(Ht(t,0));function n(r){let i=[];r.forEach((e=>{t[e].forEach((({term:e,to:n})=>{if(!e)return;let r;for(let t=0;t<i.length;t++)i[t][0]==e&&(r=i[t][1]);Ht(t,n).forEach((t=>{r||i.push([e,r=[]]),-1==r.indexOf(t)&&r.push(t)}))}))}));let o=e[r.join(",")]=new jt(r.indexOf(t.length-1)>-1);for(let t=0;t<i.length;t++){let r=i[t][1].sort(Kt);o.next.push({type:i[t][0],next:e[r.join(",")]||n(r)})}return o}}(function(t){let e=[[]];return i(o(t,0),n()),e;function n(){return e.push([])-1}function r(t,n,r){let i={term:r,to:n};return e[t].push(i),i}function i(t,e){t.forEach((t=>t.to=e))}function o(t,e){if("choice"==t.type)return t.exprs.reduce(((t,n)=>t.concat(o(n,e))),[]);if("seq"!=t.type){if("star"==t.type){let s=n();return r(e,s),i(o(t.expr,s),s),[r(s)]}if("plus"==t.type){let s=n();return i(o(t.expr,e),s),i(o(t.expr,s),s),[r(s)]}if("opt"==t.type)return[r(e)].concat(o(t.expr,e));if("range"==t.type){let s=e;for(let e=0;e<t.min;e++){let e=n();i(o(t.expr,s),e),s=e}if(-1==t.max)i(o(t.expr,s),s);else for(let e=t.min;e<t.max;e++){let e=n();r(s,e),i(o(t.expr,s),e),s=e}return[r(s)]}if("name"==t.type)return[r(e,void 0,t.value)];throw new Error("Unknown expr type")}for(let r=0;;r++){let s=o(t.exprs[r],e);if(r==t.exprs.length-1)return s;i(s,e=n())}}}(r));return function(t,e){for(let n=0,r=[t];n<r.length;n++){let t=r[n],i=!t.validEnd,o=[];for(let e=0;e<t.next.length;e++){let{type:n,next:s}=t.next[e];o.push(n.name),!i||n.isText||n.hasRequiredAttrs()||(i=!1),-1==r.indexOf(s)&&r.push(s)}i&&e.err("Only non-generatable nodes ("+o.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}(i,n),i}matchType(t){for(let e=0;e<this.next.length;e++)if(this.next[e].type==t)return this.next[e].next;return null}matchFragment(t,e=0,n=t.childCount){let r=this;for(let i=e;r&&i<n;i++)r=r.matchType(t.child(i).type);return r}get inlineContent(){return 0!=this.next.length&&this.next[0].type.isInline}get defaultType(){for(let t=0;t<this.next.length;t++){let{type:e}=this.next[t];if(!e.isText&&!e.hasRequiredAttrs())return e}return null}compatible(t){for(let e=0;e<this.next.length;e++)for(let n=0;n<t.next.length;n++)if(this.next[e].type==t.next[n].type)return!0;return!1}fillBefore(t,e=!1,n=0){let r=[this];return function i(o,s){let l=o.matchFragment(t,n);if(l&&(!e||l.validEnd))return dt.from(s.map((t=>t.createAndFill())));for(let t=0;t<o.next.length;t++){let{type:e,next:n}=o.next[t];if(!e.isText&&!e.hasRequiredAttrs()&&-1==r.indexOf(n)){r.push(n);let t=i(n,s.concat(e));if(t)return t}}return null}(this,[])}findWrapping(t){for(let n=0;n<this.wrapCache.length;n+=2)if(this.wrapCache[n]==t)return this.wrapCache[n+1];let e=this.computeWrapping(t);return this.wrapCache.push(t,e),e}computeWrapping(t){let e=Object.create(null),n=[{match:this,type:null,via:null}];for(;n.length;){let r=n.shift(),i=r.match;if(i.matchType(t)){let t=[];for(let e=r;e.type;e=e.via)t.push(e.type);return t.reverse()}for(let t=0;t<i.next.length;t++){let{type:o,next:s}=i.next[t];o.isLeaf||o.hasRequiredAttrs()||o.name in e||r.type&&!s.validEnd||(n.push({match:o.contentMatch,type:o,via:r}),e[o.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(t){if(t>=this.next.length)throw new RangeError(`There's no ${t}th edge in this content match`);return this.next[t]}toString(){let t=[];return function e(n){t.push(n);for(let r=0;r<n.next.length;r++)-1==t.indexOf(n.next[r].next)&&e(n.next[r].next)}(this),t.map(((e,n)=>{let r=n+(e.validEnd?"*":" ")+" ";for(let i=0;i<e.next.length;i++)r+=(i?", ":"")+e.next[i].type.name+"->"+t.indexOf(e.next[i].next);return r})).join("\n")}}jt.empty=new jt(!0);class Vt{constructor(t,e){this.string=t,this.nodeTypes=e,this.inline=null,this.pos=0,this.tokens=t.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(t){return this.next==t&&(this.pos++||!0)}err(t){throw new SyntaxError(t+" (in content expression '"+this.string+"')")}}function Ft(t){let e=[];do{e.push(Lt(t))}while(t.eat("|"));return 1==e.length?e[0]:{type:"choice",exprs:e}}function Lt(t){let e=[];do{e.push(Wt(t))}while(t.next&&")"!=t.next&&"|"!=t.next);return 1==e.length?e[0]:{type:"seq",exprs:e}}function Wt(t){let e=function(t){if(t.eat("(")){let e=Ft(t);return t.eat(")")||t.err("Missing closing paren"),e}if(!/\W/.test(t.next)){let e=function(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let i=[];for(let o in n){let t=n[o];t.groups.indexOf(e)>-1&&i.push(t)}0==i.length&&t.err("No node type or group '"+e+"' found");return i}(t,t.next).map((e=>(null==t.inline?t.inline=e.isInline:t.inline!=e.isInline&&t.err("Mixing inline and block content"),{type:"name",value:e})));return t.pos++,1==e.length?e[0]:{type:"choice",exprs:e}}t.err("Unexpected token '"+t.next+"'")}(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else{if(!t.eat("{"))break;e=Jt(t,e)}return e}function qt(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function Jt(t,e){let n=qt(t),r=n;return t.eat(",")&&(r="}"!=t.next?qt(t):-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function Kt(t,e){return e-t}function Ht(t,e){let n=[];return function e(r){let i=t[r];if(1==i.length&&!i[0].term)return e(i[0].to);n.push(r);for(let t=0;t<i.length;t++){let{term:r,to:o}=i[t];r||-1!=n.indexOf(o)||e(o)}}(e),n.sort(Kt)}function Yt(t){let e=Object.create(null);for(let n in t){let r=t[n];if(!r.hasDefault)return null;e[n]=r.default}return e}function Ut(t,e){let n=Object.create(null);for(let r in t){let i=e&&e[r];if(void 0===i){let e=t[r];if(!e.hasDefault)throw new RangeError("No value supplied for attribute "+r);i=e.default}n[r]=i}return n}function Gt(t){let e=Object.create(null);if(t)for(let n in t)e[n]=new Xt(t[n]);return e}let Zt=class t{constructor(t,e,n){this.name=t,this.schema=e,this.spec=n,this.markSet=null,this.groups=n.group?n.group.split(" "):[],this.attrs=Gt(n.attrs),this.defaultAttrs=Yt(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(n.inline||"text"==t),this.isText="text"==t}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==jt.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let t in this.attrs)if(this.attrs[t].isRequired)return!0;return!1}compatibleContent(t){return this==t||this.contentMatch.compatible(t.contentMatch)}computeAttrs(t){return!t&&this.defaultAttrs?this.defaultAttrs:Ut(this.attrs,t)}create(t=null,e,n){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new zt(this,this.computeAttrs(t),dt.from(e),gt.setFrom(n))}createChecked(t=null,e,n){return e=dt.from(e),this.checkContent(e),new zt(this,this.computeAttrs(t),e,gt.setFrom(n))}createAndFill(t=null,e,n){if(t=this.computeAttrs(t),(e=dt.from(e)).size){let t=this.contentMatch.fillBefore(e);if(!t)return null;e=t.append(e)}let r=this.contentMatch.matchFragment(e),i=r&&r.fillBefore(dt.empty,!0);return i?new zt(this,t,e.append(i),gt.setFrom(n)):null}validContent(t){let e=this.contentMatch.matchFragment(t);if(!e||!e.validEnd)return!1;for(let n=0;n<t.childCount;n++)if(!this.allowsMarks(t.child(n).marks))return!1;return!0}checkContent(t){if(!this.validContent(t))throw new RangeError(`Invalid content for node ${this.name}: ${t.toString().slice(0,50)}`)}allowsMarkType(t){return null==this.markSet||this.markSet.indexOf(t)>-1}allowsMarks(t){if(null==this.markSet)return!0;for(let e=0;e<t.length;e++)if(!this.allowsMarkType(t[e].type))return!1;return!0}allowedMarks(t){if(null==this.markSet)return t;let e;for(let n=0;n<t.length;n++)this.allowsMarkType(t[n].type)?e&&e.push(t[n]):e||(e=t.slice(0,n));return e?e.length?e:gt.none:t}static compile(e,n){let r=Object.create(null);e.forEach(((e,i)=>r[e]=new t(e,n,i)));let i=n.spec.topNode||"doc";if(!r[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let t in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};class Xt{constructor(t){this.hasDefault=Object.prototype.hasOwnProperty.call(t,"default"),this.default=t.default}get isRequired(){return!this.hasDefault}}class Qt{constructor(t,e,n,r){this.name=t,this.rank=e,this.schema=n,this.spec=r,this.attrs=Gt(r.attrs),this.excluded=null;let i=Yt(this.attrs);this.instance=i?new gt(this,i):null}create(t=null){return!t&&this.instance?this.instance:new gt(this,Ut(this.attrs,t))}static compile(t,e){let n=Object.create(null),r=0;return t.forEach(((t,i)=>n[t]=new Qt(t,r++,e,i))),n}removeFromSet(t){for(var e=0;e<t.length;e++)t[e].type==this&&(t=t.slice(0,e).concat(t.slice(e+1)),e--);return t}isInSet(t){for(let e=0;e<t.length;e++)if(t[e].type==this)return t[e]}excludes(t){return this.excluded.indexOf(t)>-1}}class te{constructor(t){this.cached=Object.create(null);let e=this.spec={};for(let r in t)e[r]=t[r];e.nodes=ct.from(t.nodes),e.marks=ct.from(t.marks||{}),this.nodes=Zt.compile(this.spec.nodes,this),this.marks=Qt.compile(this.spec.marks,this);let n=Object.create(null);for(let r in this.nodes){if(r in this.marks)throw new RangeError(r+" can not be both a node and a mark");let t=this.nodes[r],e=t.spec.content||"",i=t.spec.marks;t.contentMatch=n[e]||(n[e]=jt.parse(e,this.nodes)),t.inlineContent=t.contentMatch.inlineContent,t.markSet="_"==i?null:i?ee(this,i.split(" ")):""!=i&&t.inlineContent?null:[]}for(let r in this.marks){let t=this.marks[r],e=t.spec.excludes;t.excluded=null==e?[t]:""==e?[]:ee(this,e.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(t,e=null,n,r){if("string"==typeof t)t=this.nodeType(t);else{if(!(t instanceof Zt))throw new RangeError("Invalid node type: "+t);if(t.schema!=this)throw new RangeError("Node type from different schema used ("+t.name+")")}return t.createChecked(e,n,r)}text(t,e){let n=this.nodes.text;return new _t(n,n.defaultAttrs,t,gt.setFrom(e))}mark(t,e){return"string"==typeof t&&(t=this.marks[t]),t.create(e)}nodeFromJSON(t){return zt.fromJSON(this,t)}markFromJSON(t){return gt.fromJSON(this,t)}nodeType(t){let e=this.nodes[t];if(!e)throw new RangeError("Unknown node type: "+t);return e}}function ee(t,e){let n=[];for(let r=0;r<e.length;r++){let i=e[r],o=t.marks[i],s=o;if(o)n.push(o);else for(let e in t.marks){let r=t.marks[e];("_"==i||r.spec.group&&r.spec.group.split(" ").indexOf(i)>-1)&&n.push(s=r)}if(!s)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}class ne{constructor(t,e){this.schema=t,this.rules=e,this.tags=[],this.styles=[],e.forEach((t=>{t.tag?this.tags.push(t):t.style&&this.styles.push(t)})),this.normalizeLists=!this.tags.some((e=>{if(!/^(ul|ol)\b/.test(e.tag)||!e.node)return!1;let n=t.nodes[e.node];return n.contentMatch.matchType(n)}))}parse(t,e={}){let n=new ae(this,e,!1);return n.addAll(t,e.from,e.to),n.finish()}parseSlice(t,e={}){let n=new ae(this,e,!0);return n.addAll(t,e.from,e.to),vt.maxOpen(n.finish())}matchTag(t,e,n){for(let r=n?this.tags.indexOf(n)+1:0;r<this.tags.length;r++){let n=this.tags[r];if(ce(t,n.tag)&&(void 0===n.namespace||t.namespaceURI==n.namespace)&&(!n.context||e.matchesContext(n.context))){if(n.getAttrs){let e=n.getAttrs(t);if(!1===e)continue;n.attrs=e||void 0}return n}}}matchStyle(t,e,n,r){for(let i=r?this.styles.indexOf(r)+1:0;i<this.styles.length;i++){let r=this.styles[i],o=r.style;if(!(0!=o.indexOf(t)||r.context&&!n.matchesContext(r.context)||o.length>t.length&&(61!=o.charCodeAt(t.length)||o.slice(t.length+1)!=e))){if(r.getAttrs){let t=r.getAttrs(e);if(!1===t)continue;r.attrs=t||void 0}return r}}}static schemaRules(t){let e=[];function n(t){let n=null==t.priority?50:t.priority,r=0;for(;r<e.length;r++){let t=e[r];if((null==t.priority?50:t.priority)<n)break}e.splice(r,0,t)}for(let r in t.marks){let e=t.marks[r].spec.parseDOM;e&&e.forEach((t=>{n(t=he(t)),t.mark||t.ignore||t.clearMark||(t.mark=r)}))}for(let r in t.nodes){let e=t.nodes[r].spec.parseDOM;e&&e.forEach((t=>{n(t=he(t)),t.node||t.ignore||t.mark||(t.node=r)}))}return e}static fromSchema(t){return t.cached.domParser||(t.cached.domParser=new ne(t,ne.schemaRules(t)))}}const re={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},ie={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},oe={ol:!0,ul:!0};function se(t,e,n){return null!=e?(e?1:0)|("full"===e?2:0):t&&"pre"==t.whitespace?3:-5&n}class le{constructor(t,e,n,r,i,o,s){this.type=t,this.attrs=e,this.marks=n,this.pendingMarks=r,this.solid=i,this.options=s,this.content=[],this.activeMarks=gt.none,this.stashMarks=[],this.match=o||(4&s?null:t.contentMatch)}findWrapping(t){if(!this.match){if(!this.type)return[];let e=this.type.contentMatch.fillBefore(dt.from(t));if(!e){let e,n=this.type.contentMatch;return(e=n.findWrapping(t.type))?(this.match=n,e):null}this.match=this.type.contentMatch.matchFragment(e)}return this.match.findWrapping(t.type)}finish(t){if(!(1&this.options)){let t,e=this.content[this.content.length-1];if(e&&e.isText&&(t=/[ \t\r\n\u000c]+$/.exec(e.text))){let n=e;e.text.length==t[0].length?this.content.pop():this.content[this.content.length-1]=n.withText(n.text.slice(0,n.text.length-t[0].length))}}let e=dt.from(this.content);return!t&&this.match&&(e=e.append(this.match.fillBefore(dt.empty,!0))),this.type?this.type.create(this.attrs,e,this.marks):e}popFromStashMark(t){for(let e=this.stashMarks.length-1;e>=0;e--)if(t.eq(this.stashMarks[e]))return this.stashMarks.splice(e,1)[0]}applyPending(t){for(let e=0,n=this.pendingMarks;e<n.length;e++){let r=n[e];(this.type?this.type.allowsMarkType(r.type):ue(r.type,t))&&!r.isInSet(this.activeMarks)&&(this.activeMarks=r.addToSet(this.activeMarks),this.pendingMarks=r.removeFromSet(this.pendingMarks))}}inlineContext(t){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:t.parentNode&&!re.hasOwnProperty(t.parentNode.nodeName.toLowerCase())}}class ae{constructor(t,e,n){this.parser=t,this.options=e,this.isOpen=n,this.open=0;let r,i=e.topNode,o=se(null,e.preserveWhitespace,0)|(n?4:0);r=i?new le(i.type,i.attrs,gt.none,gt.none,!0,e.topMatch||i.type.contentMatch,o):new le(n?null:t.schema.topNodeType,null,gt.none,gt.none,!0,null,o),this.nodes=[r],this.find=e.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(t){3==t.nodeType?this.addTextNode(t):1==t.nodeType&&this.addElement(t)}withStyleRules(t,e){let n=t.getAttribute("style");if(!n)return e();let r=this.readStyles(function(t){let e,n=/\s*([\w-]+)\s*:\s*([^;]+)/g,r=[];for(;e=n.exec(t);)r.push(e[1],e[2].trim());return r}(n));if(!r)return;let[i,o]=r,s=this.top;for(let l=0;l<o.length;l++)this.removePendingMark(o[l],s);for(let l=0;l<i.length;l++)this.addPendingMark(i[l]);e();for(let l=0;l<i.length;l++)this.removePendingMark(i[l],s);for(let l=0;l<o.length;l++)this.addPendingMark(o[l])}addTextNode(t){let e=t.nodeValue,n=this.top;if(2&n.options||n.inlineContext(t)||/[^ \t\r\n\u000c]/.test(e)){if(1&n.options)e=2&n.options?e.replace(/\r\n?/g,"\n"):e.replace(/\r?\n|\r/g," ");else if(e=e.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(e)&&this.open==this.nodes.length-1){let r=n.content[n.content.length-1],i=t.previousSibling;(!r||i&&"BR"==i.nodeName||r.isText&&/[ \t\r\n\u000c]$/.test(r.text))&&(e=e.slice(1))}e&&this.insertNode(this.parser.schema.text(e)),this.findInText(t)}else this.findInside(t)}addElement(t,e){let n,r=t.nodeName.toLowerCase();oe.hasOwnProperty(r)&&this.parser.normalizeLists&&function(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let t=1==e.nodeType?e.nodeName.toLowerCase():null;t&&oe.hasOwnProperty(t)&&n?(n.appendChild(e),e=n):"li"==t?n=e:t&&(n=null)}}(t);let i=this.options.ruleFromNode&&this.options.ruleFromNode(t)||(n=this.parser.matchTag(t,this,e));if(i?i.ignore:ie.hasOwnProperty(r))this.findInside(t),this.ignoreFallback(t);else if(!i||i.skip||i.closeParent){i&&i.closeParent?this.open=Math.max(0,this.open-1):i&&i.skip.nodeType&&(t=i.skip);let e,n=this.top,o=this.needsBlock;if(re.hasOwnProperty(r))n.content.length&&n.content[0].isInline&&this.open&&(this.open--,n=this.top),e=!0,n.type||(this.needsBlock=!0);else if(!t.firstChild)return void this.leafFallback(t);i&&i.skip?this.addAll(t):this.withStyleRules(t,(()=>this.addAll(t))),e&&this.sync(n),this.needsBlock=o}else this.withStyleRules(t,(()=>{this.addElementByRule(t,i,!1===i.consuming?n:void 0)}))}leafFallback(t){"BR"==t.nodeName&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(t.ownerDocument.createTextNode("\n"))}ignoreFallback(t){"BR"!=t.nodeName||this.top.type&&this.top.type.inlineContent||this.findPlace(this.parser.schema.text("-"))}readStyles(t){let e=gt.none,n=gt.none;for(let r=0;r<t.length;r+=2)for(let i;;){let o=this.parser.matchStyle(t[r],t[r+1],this,i);if(!o)break;if(o.ignore)return null;if(o.clearMark?this.top.pendingMarks.concat(this.top.activeMarks).forEach((t=>{o.clearMark(t)&&(n=t.addToSet(n))})):e=this.parser.schema.marks[o.mark].create(o.attrs).addToSet(e),!1!==o.consuming)break;i=o}return[e,n]}addElementByRule(t,e,n){let r,i,o;if(e.node)i=this.parser.schema.nodes[e.node],i.isLeaf?this.insertNode(i.create(e.attrs))||this.leafFallback(t):r=this.enter(i,e.attrs||null,e.preserveWhitespace);else{o=this.parser.schema.marks[e.mark].create(e.attrs),this.addPendingMark(o)}let s=this.top;if(i&&i.isLeaf)this.findInside(t);else if(n)this.addElement(t,n);else if(e.getContent)this.findInside(t),e.getContent(t,this.parser.schema).forEach((t=>this.insertNode(t)));else{let n=t;"string"==typeof e.contentElement?n=t.querySelector(e.contentElement):"function"==typeof e.contentElement?n=e.contentElement(t):e.contentElement&&(n=e.contentElement),this.findAround(t,n,!0),this.addAll(n)}r&&this.sync(s)&&this.open--,o&&this.removePendingMark(o,s)}addAll(t,e,n){let r=e||0;for(let i=e?t.childNodes[e]:t.firstChild,o=null==n?null:t.childNodes[n];i!=o;i=i.nextSibling,++r)this.findAtPoint(t,r),this.addDOM(i);this.findAtPoint(t,r)}findPlace(t){let e,n;for(let r=this.open;r>=0;r--){let i=this.nodes[r],o=i.findWrapping(t);if(o&&(!e||e.length>o.length)&&(e=o,n=i,!o.length))break;if(i.solid)break}if(!e)return!1;this.sync(n);for(let r=0;r<e.length;r++)this.enterInner(e[r],null,!1);return!0}insertNode(t){if(t.isInline&&this.needsBlock&&!this.top.type){let t=this.textblockFromContext();t&&this.enterInner(t)}if(this.findPlace(t)){this.closeExtra();let e=this.top;e.applyPending(t.type),e.match&&(e.match=e.match.matchType(t.type));let n=e.activeMarks;for(let r=0;r<t.marks.length;r++)e.type&&!e.type.allowsMarkType(t.marks[r].type)||(n=t.marks[r].addToSet(n));return e.content.push(t.mark(n)),!0}return!1}enter(t,e,n){let r=this.findPlace(t.create(e));return r&&this.enterInner(t,e,!0,n),r}enterInner(t,e=null,n=!1,r){this.closeExtra();let i=this.top;i.applyPending(t),i.match=i.match&&i.match.matchType(t);let o=se(t,r,i.options);4&i.options&&0==i.content.length&&(o|=4),this.nodes.push(new le(t,e,i.activeMarks,i.pendingMarks,n,null,o)),this.open++}closeExtra(t=!1){let e=this.nodes.length-1;if(e>this.open){for(;e>this.open;e--)this.nodes[e-1].content.push(this.nodes[e].finish(t));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(t){for(let e=this.open;e>=0;e--)if(this.nodes[e]==t)return this.open=e,!0;return!1}get currentPos(){this.closeExtra();let t=0;for(let e=this.open;e>=0;e--){let n=this.nodes[e].content;for(let e=n.length-1;e>=0;e--)t+=n[e].nodeSize;e&&t++}return t}findAtPoint(t,e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==t&&this.find[n].offset==e&&(this.find[n].pos=this.currentPos)}findInside(t){if(this.find)for(let e=0;e<this.find.length;e++)null==this.find[e].pos&&1==t.nodeType&&t.contains(this.find[e].node)&&(this.find[e].pos=this.currentPos)}findAround(t,e,n){if(t!=e&&this.find)for(let r=0;r<this.find.length;r++)if(null==this.find[r].pos&&1==t.nodeType&&t.contains(this.find[r].node)){e.compareDocumentPosition(this.find[r].node)&(n?2:4)&&(this.find[r].pos=this.currentPos)}}findInText(t){if(this.find)for(let e=0;e<this.find.length;e++)this.find[e].node==t&&(this.find[e].pos=this.currentPos-(t.nodeValue.length-this.find[e].offset))}matchesContext(t){if(t.indexOf("|")>-1)return t.split(/\s*\|\s*/).some(this.matchesContext,this);let e=t.split("/"),n=this.options.context,r=!(this.isOpen||n&&n.parent.type!=this.nodes[0].type),i=-(n?n.depth+1:0)+(r?0:1),o=(t,s)=>{for(;t>=0;t--){let l=e[t];if(""==l){if(t==e.length-1||0==t)continue;for(;s>=i;s--)if(o(t-1,s))return!0;return!1}{let t=s>0||0==s&&r?this.nodes[s].type:n&&s>=i?n.node(s-i).type:null;if(!t||t.name!=l&&-1==t.groups.indexOf(l))return!1;s--}}return!0};return o(e.length-1,this.open)}textblockFromContext(){let t=this.options.context;if(t)for(let e=t.depth;e>=0;e--){let n=t.node(e).contentMatchAt(t.indexAfter(e)).defaultType;if(n&&n.isTextblock&&n.defaultAttrs)return n}for(let e in this.parser.schema.nodes){let t=this.parser.schema.nodes[e];if(t.isTextblock&&t.defaultAttrs)return t}}addPendingMark(t){let e=function(t,e){for(let n=0;n<e.length;n++)if(t.eq(e[n]))return e[n]}(t,this.top.pendingMarks);e&&this.top.stashMarks.push(e),this.top.pendingMarks=t.addToSet(this.top.pendingMarks)}removePendingMark(t,e){for(let n=this.open;n>=0;n--){let r=this.nodes[n];if(r.pendingMarks.lastIndexOf(t)>-1)r.pendingMarks=t.removeFromSet(r.pendingMarks);else{r.activeMarks=t.removeFromSet(r.activeMarks);let e=r.popFromStashMark(t);e&&r.type&&r.type.allowsMarkType(e.type)&&(r.activeMarks=e.addToSet(r.activeMarks))}if(r==e)break}}}function ce(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function he(t){let e={};for(let n in t)e[n]=t[n];return e}function ue(t,e){let n=e.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(t))continue;let o=[],s=t=>{o.push(t);for(let n=0;n<t.edgeCount;n++){let{type:r,next:i}=t.edge(n);if(r==e)return!0;if(o.indexOf(i)<0&&s(i))return!0}};if(s(i.contentMatch))return!0}}class de{constructor(t,e){this.nodes=t,this.marks=e}serializeFragment(t,e={},n){n||(n=pe(e).createDocumentFragment());let r=n,i=[];return t.forEach((t=>{if(i.length||t.marks.length){let n=0,o=0;for(;n<i.length&&o<t.marks.length;){let e=t.marks[o];if(this.marks[e.type.name]){if(!e.eq(i[n][0])||!1===e.type.spec.spanning)break;n++,o++}else o++}for(;n<i.length;)r=i.pop()[1];for(;o<t.marks.length;){let n=t.marks[o++],s=this.serializeMark(n,t.isInline,e);s&&(i.push([n,r]),r.appendChild(s.dom),r=s.contentDOM||s.dom)}}r.appendChild(this.serializeNodeInner(t,e))})),n}serializeNodeInner(t,e){let{dom:n,contentDOM:r}=de.renderSpec(pe(e),this.nodes[t.type.name](t));if(r){if(t.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(t.content,e,r)}return n}serializeNode(t,e={}){let n=this.serializeNodeInner(t,e);for(let r=t.marks.length-1;r>=0;r--){let i=this.serializeMark(t.marks[r],t.isInline,e);i&&((i.contentDOM||i.dom).appendChild(n),n=i.dom)}return n}serializeMark(t,e,n={}){let r=this.marks[t.type.name];return r&&de.renderSpec(pe(n),r(t,e))}static renderSpec(t,e,n=null){if("string"==typeof e)return{dom:t.createTextNode(e)};if(null!=e.nodeType)return{dom:e};if(e.dom&&null!=e.dom.nodeType)return e;let r,i=e[0],o=i.indexOf(" ");o>0&&(n=i.slice(0,o),i=i.slice(o+1));let s=n?t.createElementNS(n,i):t.createElement(i),l=e[1],a=1;if(l&&"object"==typeof l&&null==l.nodeType&&!Array.isArray(l)){a=2;for(let t in l)if(null!=l[t]){let e=t.indexOf(" ");e>0?s.setAttributeNS(t.slice(0,e),t.slice(e+1),l[t]):s.setAttribute(t,l[t])}}for(let c=a;c<e.length;c++){let i=e[c];if(0===i){if(c<e.length-1||c>a)throw new RangeError("Content hole must be the only child of its parent node");return{dom:s,contentDOM:s}}{let{dom:e,contentDOM:o}=de.renderSpec(t,i,n);if(s.appendChild(e),o){if(r)throw new RangeError("Multiple content holes");r=o}}}return{dom:s,contentDOM:r}}static fromSchema(t){return t.cached.domSerializer||(t.cached.domSerializer=new de(this.nodesFromSchema(t),this.marksFromSchema(t)))}static nodesFromSchema(t){let e=fe(t.nodes);return e.text||(e.text=t=>t.text),e}static marksFromSchema(t){return fe(t.marks)}}function fe(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function pe(t){return t.document||window.document}const me=Math.pow(2,16);function ge(t){return 65535&t}class ye{constructor(t,e,n){this.pos=t,this.delInfo=e,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 ve{constructor(t,e=!1){if(this.ranges=t,this.inverted=e,!t.length&&ve.empty)return ve.empty}recover(t){let e=0,n=ge(t);if(!this.inverted)for(let r=0;r<n;r++)e+=this.ranges[3*r+2]-this.ranges[3*r+1];return this.ranges[3*n]+e+function(t){return(t-(65535&t))/me}(t)}mapResult(t,e=1){return this._map(t,e,!1)}map(t,e=1){return this._map(t,e,!0)}_map(t,e,n){let r=0,i=this.inverted?2:1,o=this.inverted?1:2;for(let s=0;s<this.ranges.length;s+=3){let l=this.ranges[s]-(this.inverted?r:0);if(l>t)break;let a=this.ranges[s+i],c=this.ranges[s+o],h=l+a;if(t<=h){let i=l+r+((a?t==l?-1:t==h?1:e:e)<0?0:c);if(n)return i;let o=t==(e<0?l:h)?null:s/3+(t-l)*me,u=t==l?2:t==h?1:4;return(e<0?t!=l:t!=h)&&(u|=8),new ye(i,u,o)}r+=c-a}return n?t+r:new ye(t+r,0,null)}touches(t,e){let n=0,r=ge(e),i=this.inverted?2:1,o=this.inverted?1:2;for(let s=0;s<this.ranges.length;s+=3){let e=this.ranges[s]-(this.inverted?n:0);if(e>t)break;let l=this.ranges[s+i];if(t<=e+l&&s==3*r)return!0;n+=this.ranges[s+o]-l}return!1}forEach(t){let e=this.inverted?2:1,n=this.inverted?1:2;for(let r=0,i=0;r<this.ranges.length;r+=3){let o=this.ranges[r],s=o-(this.inverted?i:0),l=o+(this.inverted?0:i),a=this.ranges[r+e],c=this.ranges[r+n];t(s,s+a,l,l+c),i+=c-a}}invert(){return new ve(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(t){return 0==t?ve.empty:new ve(t<0?[0,-t,0]:[0,0,t])}}ve.empty=new ve([]);class we{constructor(t=[],e,n=0,r=t.length){this.maps=t,this.mirror=e,this.from=n,this.to=r}slice(t=0,e=this.maps.length){return new we(this.maps,this.mirror,t,e)}copy(){return new we(this.maps.slice(),this.mirror&&this.mirror.slice(),this.from,this.to)}appendMap(t,e){this.to=this.maps.push(t),null!=e&&this.setMirror(this.maps.length-1,e)}appendMapping(t){for(let e=0,n=this.maps.length;e<t.maps.length;e++){let r=t.getMirror(e);this.appendMap(t.maps[e],null!=r&&r<e?n+r:void 0)}}getMirror(t){if(this.mirror)for(let e=0;e<this.mirror.length;e++)if(this.mirror[e]==t)return this.mirror[e+(e%2?-1:1)]}setMirror(t,e){this.mirror||(this.mirror=[]),this.mirror.push(t,e)}appendMappingInverted(t){for(let e=t.maps.length-1,n=this.maps.length+t.maps.length;e>=0;e--){let r=t.getMirror(e);this.appendMap(t.maps[e].invert(),null!=r&&r>e?n-r-1:void 0)}}invert(){let t=new we;return t.appendMappingInverted(this),t}map(t,e=1){if(this.mirror)return this._map(t,e,!0);for(let n=this.from;n<this.to;n++)t=this.maps[n].map(t,e);return t}mapResult(t,e=1){return this._map(t,e,!1)}_map(t,e,n){let r=0;for(let i=this.from;i<this.to;i++){let n=this.maps[i].mapResult(t,e);if(null!=n.recover){let e=this.getMirror(i);if(null!=e&&e>i&&e<this.to){i=e,t=this.maps[e].recover(n.recover);continue}}r|=n.delInfo,t=n.pos}return n?t:new ye(t,r,null)}}const be=Object.create(null);class xe{getMap(){return ve.empty}merge(t){return null}static fromJSON(t,e){if(!e||!e.stepType)throw new RangeError("Invalid input for Step.fromJSON");let n=be[e.stepType];if(!n)throw new RangeError(`No step type ${e.stepType} defined`);return n.fromJSON(t,e)}static jsonID(t,e){if(t in be)throw new RangeError("Duplicate use of step JSON ID "+t);return be[t]=e,e.prototype.jsonID=t,e}}class Se{constructor(t,e){this.doc=t,this.failed=e}static ok(t){return new Se(t,null)}static fail(t){return new Se(null,t)}static fromReplace(t,e,n,r){try{return Se.ok(t.replace(e,n,r))}catch(i){if(i instanceof yt)return Se.fail(i.message);throw i}}}function ke(t,e,n){let r=[];for(let i=0;i<t.childCount;i++){let o=t.child(i);o.content.size&&(o=o.copy(ke(o.content,e,o))),o.isInline&&(o=e(o,n,i)),r.push(o)}return dt.fromArray(r)}class Me extends xe{constructor(t,e,n){super(),this.from=t,this.to=e,this.mark=n}apply(t){let e=t.slice(this.from,this.to),n=t.resolve(this.from),r=n.node(n.sharedDepth(this.to)),i=new vt(ke(e.content,((t,e)=>t.isAtom&&e.type.allowsMarkType(this.mark.type)?t.mark(this.mark.addToSet(t.marks)):t),r),e.openStart,e.openEnd);return Se.fromReplace(t,this.from,this.to,i)}invert(){return new Oe(this.from,this.to,this.mark)}map(t){let e=t.mapResult(this.from,1),n=t.mapResult(this.to,-1);return e.deleted&&n.deleted||e.pos>=n.pos?null:new Me(e.pos,n.pos,this.mark)}merge(t){return t instanceof Me&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new Me(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,e){if("number"!=typeof e.from||"number"!=typeof e.to)throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Me(e.from,e.to,t.markFromJSON(e.mark))}}xe.jsonID("addMark",Me);class Oe extends xe{constructor(t,e,n){super(),this.from=t,this.to=e,this.mark=n}apply(t){let e=t.slice(this.from,this.to),n=new vt(ke(e.content,(t=>t.mark(this.mark.removeFromSet(t.marks))),t),e.openStart,e.openEnd);return Se.fromReplace(t,this.from,this.to,n)}invert(){return new Me(this.from,this.to,this.mark)}map(t){let e=t.mapResult(this.from,1),n=t.mapResult(this.to,-1);return e.deleted&&n.deleted||e.pos>=n.pos?null:new Oe(e.pos,n.pos,this.mark)}merge(t){return t instanceof Oe&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new Oe(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,e){if("number"!=typeof e.from||"number"!=typeof e.to)throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new Oe(e.from,e.to,t.markFromJSON(e.mark))}}xe.jsonID("removeMark",Oe);class Ce extends xe{constructor(t,e){super(),this.pos=t,this.mark=e}apply(t){let e=t.nodeAt(this.pos);if(!e)return Se.fail("No node at mark step's position");let n=e.type.create(e.attrs,null,this.mark.addToSet(e.marks));return Se.fromReplace(t,this.pos,this.pos+1,new vt(dt.from(n),0,e.isLeaf?0:1))}invert(t){let e=t.nodeAt(this.pos);if(e){let t=this.mark.addToSet(e.marks);if(t.length==e.marks.length){for(let n=0;n<e.marks.length;n++)if(!e.marks[n].isInSet(t))return new Ce(this.pos,e.marks[n]);return new Ce(this.pos,this.mark)}}return new De(this.pos,this.mark)}map(t){let e=t.mapResult(this.pos,1);return e.deletedAfter?null:new Ce(e.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,e){if("number"!=typeof e.pos)throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new Ce(e.pos,t.markFromJSON(e.mark))}}xe.jsonID("addNodeMark",Ce);class De extends xe{constructor(t,e){super(),this.pos=t,this.mark=e}apply(t){let e=t.nodeAt(this.pos);if(!e)return Se.fail("No node at mark step's position");let n=e.type.create(e.attrs,null,this.mark.removeFromSet(e.marks));return Se.fromReplace(t,this.pos,this.pos+1,new vt(dt.from(n),0,e.isLeaf?0:1))}invert(t){let e=t.nodeAt(this.pos);return e&&this.mark.isInSet(e.marks)?new Ce(this.pos,this.mark):this}map(t){let e=t.mapResult(this.pos,1);return e.deletedAfter?null:new De(e.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,e){if("number"!=typeof e.pos)throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new De(e.pos,t.markFromJSON(e.mark))}}xe.jsonID("removeNodeMark",De);class Ne extends xe{constructor(t,e,n,r=!1){super(),this.from=t,this.to=e,this.slice=n,this.structure=r}apply(t){return this.structure&&Ae(t,this.from,this.to)?Se.fail("Structure replace would overwrite content"):Se.fromReplace(t,this.from,this.to,this.slice)}getMap(){return new ve([this.from,this.to-this.from,this.slice.size])}invert(t){return new Ne(this.from,this.from+this.slice.size,t.slice(this.from,this.to))}map(t){let e=t.mapResult(this.from,1),n=t.mapResult(this.to,-1);return e.deletedAcross&&n.deletedAcross?null:new Ne(e.pos,Math.max(e.pos,n.pos),this.slice)}merge(t){if(!(t instanceof Ne)||t.structure||this.structure)return null;if(this.from+this.slice.size!=t.from||this.slice.openEnd||t.slice.openStart){if(t.to!=this.from||this.slice.openStart||t.slice.openEnd)return null;{let e=this.slice.size+t.slice.size==0?vt.empty:new vt(t.slice.content.append(this.slice.content),t.slice.openStart,this.slice.openEnd);return new Ne(t.from,this.to,e,this.structure)}}{let e=this.slice.size+t.slice.size==0?vt.empty:new vt(this.slice.content.append(t.slice.content),this.slice.openStart,t.slice.openEnd);return new Ne(this.from,this.to+(t.to-t.from),e,this.structure)}}toJSON(){let t={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t}static fromJSON(t,e){if("number"!=typeof e.from||"number"!=typeof e.to)throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new Ne(e.from,e.to,vt.fromJSON(t,e.slice),!!e.structure)}}xe.jsonID("replace",Ne);class Te extends xe{constructor(t,e,n,r,i,o,s=!1){super(),this.from=t,this.to=e,this.gapFrom=n,this.gapTo=r,this.slice=i,this.insert=o,this.structure=s}apply(t){if(this.structure&&(Ae(t,this.from,this.gapFrom)||Ae(t,this.gapTo,this.to)))return Se.fail("Structure gap-replace would overwrite content");let e=t.slice(this.gapFrom,this.gapTo);if(e.openStart||e.openEnd)return Se.fail("Gap is not a flat range");let n=this.slice.insertAt(this.insert,e.content);return n?Se.fromReplace(t,this.from,this.to,n):Se.fail("Content does not fit in gap")}getMap(){return new ve([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(t){let e=this.gapTo-this.gapFrom;return new Te(this.from,this.from+this.slice.size+e,this.from+this.insert,this.from+this.insert+e,t.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(t){let e=t.mapResult(this.from,1),n=t.mapResult(this.to,-1),r=t.map(this.gapFrom,-1),i=t.map(this.gapTo,1);return e.deletedAcross&&n.deletedAcross||r<e.pos||i>n.pos?null:new Te(e.pos,n.pos,r,i,this.slice,this.insert,this.structure)}toJSON(){let t={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t}static fromJSON(t,e){if("number"!=typeof e.from||"number"!=typeof e.to||"number"!=typeof e.gapFrom||"number"!=typeof e.gapTo||"number"!=typeof e.insert)throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Te(e.from,e.to,e.gapFrom,e.gapTo,vt.fromJSON(t,e.slice),e.insert,!!e.structure)}}function Ae(t,e,n){let r=t.resolve(e),i=n-e,o=r.depth;for(;i>0&&o>0&&r.indexAfter(o)==r.node(o).childCount;)o--,i--;if(i>0){let t=r.node(o).maybeChild(r.indexAfter(o));for(;i>0;){if(!t||t.isLeaf)return!0;t=t.firstChild,i--}}return!1}function Ee(t,e,n){return(0==e||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function $e(t){let e=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let n=t.depth;;--n){let r=t.$from.node(n),i=t.$from.index(n),o=t.$to.indexAfter(n);if(n<t.depth&&r.canReplace(i,o,e))return n;if(0==n||r.type.spec.isolating||!Ee(r,i,o))break}return null}function Pe(t,e,n=null,r=t){let i=function(t,e){let{parent:n,startIndex:r,endIndex:i}=t,o=n.contentMatchAt(r).findWrapping(e);if(!o)return null;let s=o.length?o[0]:e;return n.canReplaceWith(r,i,s)?o:null}(t,e),o=i&&function(t,e){let{parent:n,startIndex:r,endIndex:i}=t,o=n.child(r),s=e.contentMatch.findWrapping(o.type);if(!s)return null;let l=(s.length?s[s.length-1]:e).contentMatch;for(let a=r;l&&a<i;a++)l=l.matchType(n.child(a).type);return l&&l.validEnd?s:null}(r,e);return o?i.map(Ie).concat({type:e,attrs:n}).concat(o.map(Ie)):null}function Ie(t){return{type:t,attrs:null}}function Re(t,e,n=1,r){let i=t.resolve(e),o=i.depth-n,s=r&&r[r.length-1]||i.parent;if(o<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!s.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let c=i.depth-1,h=n-2;c>o;c--,h--){let t=i.node(c),e=i.index(c);if(t.type.spec.isolating)return!1;let n=t.content.cutByIndex(e,t.childCount),o=r&&r[h+1];o&&(n=n.replaceChild(0,o.type.create(o.attrs)));let s=r&&r[h]||t;if(!t.canReplace(e+1,t.childCount)||!s.type.validContent(n))return!1}let l=i.indexAfter(o),a=r&&r[0];return i.node(o).canReplaceWith(l,l,a?a.type:i.node(o+1).type)}function ze(t,e){let n=t.resolve(e),r=n.index();return i=n.nodeBefore,o=n.nodeAfter,!(!i||!o||i.isLeaf||!i.canAppend(o))&&n.parent.canReplace(r,r+1);var i,o}function _e(t,e,n=e,r=vt.empty){if(e==n&&!r.size)return null;let i=t.resolve(e),o=t.resolve(n);return Be(i,o,r)?new Ne(e,n,r):new je(i,o,r).fit()}function Be(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}xe.jsonID("replaceAround",Te);class je{constructor(t,e,n){this.$from=t,this.$to=e,this.unplaced=n,this.frontier=[],this.placed=dt.empty;for(let r=0;r<=t.depth;r++){let e=t.node(r);this.frontier.push({type:e.type,match:e.contentMatchAt(t.indexAfter(r))})}for(let r=t.depth;r>0;r--)this.placed=dt.from(t.node(r).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let t=this.findFittable();t?this.placeNodes(t):this.openMore()||this.dropNode()}let t=this.mustMoveInline(),e=this.placed.size-this.depth-this.$from.depth,n=this.$from,r=this.close(t<0?this.$to:n.doc.resolve(t));if(!r)return null;let i=this.placed,o=n.depth,s=r.depth;for(;o&&s&&1==i.childCount;)i=i.firstChild.content,o--,s--;let l=new vt(i,o,s);return t>-1?new Te(n.pos,t,this.$to.pos,this.$to.end(),l,e):l.size||n.pos!=this.$to.pos?new Ne(n.pos,r.pos,l):null}findFittable(){let t=this.unplaced.openStart;for(let e=this.unplaced.content,n=0,r=this.unplaced.openEnd;n<t;n++){let i=e.firstChild;if(e.childCount>1&&(r=0),i.type.spec.isolating&&r<=n){t=n;break}e=i.content}for(let e=1;e<=2;e++)for(let n=1==e?t:this.unplaced.openStart;n>=0;n--){let t,r=null;n?(r=Le(this.unplaced.content,n-1).firstChild,t=r.content):t=this.unplaced.content;let i=t.firstChild;for(let o=this.depth;o>=0;o--){let t,{type:s,match:l}=this.frontier[o],a=null;if(1==e&&(i?l.matchType(i.type)||(a=l.fillBefore(dt.from(i),!1)):r&&s.compatibleContent(r.type)))return{sliceDepth:n,frontierDepth:o,parent:r,inject:a};if(2==e&&i&&(t=l.findWrapping(i.type)))return{sliceDepth:n,frontierDepth:o,parent:r,wrap:t};if(r&&l.matchType(r.type))break}}}openMore(){let{content:t,openStart:e,openEnd:n}=this.unplaced,r=Le(t,e);return!(!r.childCount||r.firstChild.isLeaf)&&(this.unplaced=new vt(t,e+1,Math.max(n,r.size+e>=t.size-n?e+1:0)),!0)}dropNode(){let{content:t,openStart:e,openEnd:n}=this.unplaced,r=Le(t,e);if(r.childCount<=1&&e>0){let i=t.size-e<=e+r.size;this.unplaced=new vt(Ve(t,e-1,1),e-1,i?e-1:n)}else this.unplaced=new vt(Ve(t,e,1),e,n)}placeNodes({sliceDepth:t,frontierDepth:e,parent:n,inject:r,wrap:i}){for(;this.depth>e;)this.closeFrontierNode();if(i)for(let p=0;p<i.length;p++)this.openFrontierNode(i[p]);let o=this.unplaced,s=n?n.content:o.content,l=o.openStart-t,a=0,c=[],{match:h,type:u}=this.frontier[e];if(r){for(let t=0;t<r.childCount;t++)c.push(r.child(t));h=h.matchFragment(r)}let d=s.size+t-(o.content.size-o.openEnd);for(;a<s.childCount;){let t=s.child(a),e=h.matchType(t.type);if(!e)break;a++,(a>1||0==l||t.content.size)&&(h=e,c.push(We(t.mark(u.allowedMarks(t.marks)),1==a?l:0,a==s.childCount?d:-1)))}let f=a==s.childCount;f||(d=-1),this.placed=Fe(this.placed,e,dt.from(c)),this.frontier[e].match=h,f&&d<0&&n&&n.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let p=0,m=s;p<d;p++){let t=m.lastChild;this.frontier.push({type:t.type,match:t.contentMatchAt(t.childCount)}),m=t.content}this.unplaced=f?0==t?vt.empty:new vt(Ve(o.content,t-1,1),t-1,d<0?o.openEnd:t-1):new vt(Ve(o.content,t,a),o.openStart,o.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let t,e=this.frontier[this.depth];if(!e.type.isTextblock||!qe(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(t=this.findCloseLevel(this.$to))&&t.depth==this.depth)return-1;let{depth:n}=this.$to,r=this.$to.after(n);for(;n>1&&r==this.$to.end(--n);)++r;return r}findCloseLevel(t){t:for(let e=Math.min(this.depth,t.depth);e>=0;e--){let{match:n,type:r}=this.frontier[e],i=e<t.depth&&t.end(e+1)==t.pos+(t.depth-(e+1)),o=qe(t,e,r,n,i);if(o){for(let n=e-1;n>=0;n--){let{match:e,type:r}=this.frontier[n],i=qe(t,n,r,e,!0);if(!i||i.childCount)continue t}return{depth:e,fit:o,move:i?t.doc.resolve(t.after(e+1)):t}}}}close(t){let e=this.findCloseLevel(t);if(!e)return null;for(;this.depth>e.depth;)this.closeFrontierNode();e.fit.childCount&&(this.placed=Fe(this.placed,e.depth,e.fit)),t=e.move;for(let n=e.depth+1;n<=t.depth;n++){let e=t.node(n),r=e.type.contentMatch.fillBefore(e.content,!0,t.index(n));this.openFrontierNode(e.type,e.attrs,r)}return t}openFrontierNode(t,e=null,n){let r=this.frontier[this.depth];r.match=r.match.matchType(t),this.placed=Fe(this.placed,this.depth,dt.from(t.create(e,n))),this.frontier.push({type:t,match:t.contentMatch})}closeFrontierNode(){let t=this.frontier.pop().match.fillBefore(dt.empty,!0);t.childCount&&(this.placed=Fe(this.placed,this.frontier.length,t))}}function Ve(t,e,n){return 0==e?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(Ve(t.firstChild.content,e-1,n)))}function Fe(t,e,n){return 0==e?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(Fe(t.lastChild.content,e-1,n)))}function Le(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function We(t,e,n){if(e<=0)return t;let r=t.content;return e>1&&(r=r.replaceChild(0,We(r.firstChild,e-1,1==r.childCount?n-1:0))),e>0&&(r=t.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(t.type.contentMatch.matchFragment(r).fillBefore(dt.empty,!0)))),t.copy(r)}function qe(t,e,n,r,i){let o=t.node(e),s=i?t.indexAfter(e):t.index(e);if(s==o.childCount&&!n.compatibleContent(o.type))return null;let l=r.fillBefore(o.content,!0,s);return l&&!function(t,e,n){for(let r=n;r<e.childCount;r++)if(!t.allowsMarks(e.child(r).marks))return!0;return!1}(n,o.content,s)?l:null}function Je(t){return t.spec.defining||t.spec.definingForContent}function Ke(t,e,n,r,i){if(e<n){let i=t.firstChild;t=t.replaceChild(0,i.copy(Ke(i.content,e+1,n,r,i)))}if(e>r){let e=i.contentMatchAt(0),n=e.fillBefore(t).append(t);t=n.append(e.matchFragment(n).fillBefore(dt.empty,!0))}return t}function He(t,e){let n=[];for(let r=Math.min(t.depth,e.depth);r>=0;r--){let i=t.start(r);if(i<t.pos-(t.depth-r)||e.end(r)>e.pos+(e.depth-r)||t.node(r).type.spec.isolating||e.node(r).type.spec.isolating)break;(i==e.start(r)||r==t.depth&&r==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&r&&e.start(r-1)==i-1)&&n.push(r)}return n}class Ye extends xe{constructor(t,e,n){super(),this.pos=t,this.attr=e,this.value=n}apply(t){let e=t.nodeAt(this.pos);if(!e)return Se.fail("No node at attribute step's position");let n=Object.create(null);for(let i in e.attrs)n[i]=e.attrs[i];n[this.attr]=this.value;let r=e.type.create(n,null,e.marks);return Se.fromReplace(t,this.pos,this.pos+1,new vt(dt.from(r),0,e.isLeaf?0:1))}getMap(){return ve.empty}invert(t){return new Ye(this.pos,this.attr,t.nodeAt(this.pos).attrs[this.attr])}map(t){let e=t.mapResult(this.pos,1);return e.deletedAfter?null:new Ye(e.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(t,e){if("number"!=typeof e.pos||"string"!=typeof e.attr)throw new RangeError("Invalid input for AttrStep.fromJSON");return new Ye(e.pos,e.attr,e.value)}}xe.jsonID("attr",Ye);let Ue=class extends Error{};Ue=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n},(Ue.prototype=Object.create(Error.prototype)).constructor=Ue,Ue.prototype.name="TransformError";class Ge{constructor(t){this.doc=t,this.steps=[],this.docs=[],this.mapping=new we}get before(){return this.docs.length?this.docs[0]:this.doc}step(t){let e=this.maybeStep(t);if(e.failed)throw new Ue(e.failed);return this}maybeStep(t){let e=t.apply(this.doc);return e.failed||this.addStep(t,e.doc),e}get docChanged(){return this.steps.length>0}addStep(t,e){this.docs.push(this.doc),this.steps.push(t),this.mapping.appendMap(t.getMap()),this.doc=e}replace(t,e=t,n=vt.empty){let r=_e(this.doc,t,e,n);return r&&this.step(r),this}replaceWith(t,e,n){return this.replace(t,e,new vt(dt.from(n),0,0))}delete(t,e){return this.replace(t,e,vt.empty)}insert(t,e){return this.replaceWith(t,t,e)}replaceRange(t,e,n){return function(t,e,n,r){if(!r.size)return t.deleteRange(e,n);let i=t.doc.resolve(e),o=t.doc.resolve(n);if(Be(i,o,r))return t.step(new Ne(e,n,r));let s=He(i,t.doc.resolve(n));0==s[s.length-1]&&s.pop();let l=-(i.depth+1);s.unshift(l);for(let d=i.depth,f=i.pos-1;d>0;d--,f--){let t=i.node(d).type.spec;if(t.defining||t.definingAsContext||t.isolating)break;s.indexOf(d)>-1?l=d:i.before(d)==f&&s.splice(1,0,-d)}let a=s.indexOf(l),c=[],h=r.openStart;for(let d=r.content,f=0;;f++){let t=d.firstChild;if(c.push(t),f==r.openStart)break;d=t.content}for(let d=h-1;d>=0;d--){let t=c[d].type,e=Je(t);if(e&&i.node(a).type!=t)h=d;else if(e||!t.isTextblock)break}for(let d=r.openStart;d>=0;d--){let e=(d+h+1)%(r.openStart+1),l=c[e];if(l)for(let c=0;c<s.length;c++){let h=s[(c+a)%s.length],u=!0;h<0&&(u=!1,h=-h);let d=i.node(h-1),f=i.index(h-1);if(d.canReplaceWith(f,f,l.type,l.marks))return t.replace(i.before(h),u?o.after(h):n,new vt(Ke(r.content,0,r.openStart,e),e,r.openEnd))}}let u=t.steps.length;for(let d=s.length-1;d>=0&&(t.replace(e,n,r),!(t.steps.length>u));d--){let t=s[d];t<0||(e=i.before(t),n=o.after(t))}}(this,t,e,n),this}replaceRangeWith(t,e,n){return function(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let i=function(t,e,n){let r=t.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),n))return e;if(0==r.parentOffset)for(let i=r.depth-1;i>=0;i--){let t=r.index(i);if(r.node(i).canReplaceWith(t,t,n))return r.before(i+1);if(t>0)return null}if(r.parentOffset==r.parent.content.size)for(let i=r.depth-1;i>=0;i--){let t=r.indexAfter(i);if(r.node(i).canReplaceWith(t,t,n))return r.after(i+1);if(t<r.node(i).childCount)return null}return null}(t.doc,e,r.type);null!=i&&(e=n=i)}t.replaceRange(e,n,new vt(dt.from(r),0,0))}(this,t,e,n),this}deleteRange(t,e){return function(t,e,n){let r=t.doc.resolve(e),i=t.doc.resolve(n),o=He(r,i);for(let s=0;s<o.length;s++){let e=o[s],n=s==o.length-1;if(n&&0==e||r.node(e).type.contentMatch.validEnd)return t.delete(r.start(e),i.end(e));if(e>0&&(n||r.node(e-1).canReplace(r.index(e-1),i.indexAfter(e-1))))return t.delete(r.before(e),i.after(e))}for(let s=1;s<=r.depth&&s<=i.depth;s++)if(e-r.start(s)==r.depth-s&&n>r.end(s)&&i.end(s)-n!=i.depth-s)return t.delete(r.before(s),n);t.delete(e,n)}(this,t,e),this}lift(t,e){return function(t,e,n){let{$from:r,$to:i,depth:o}=e,s=r.before(o+1),l=i.after(o+1),a=s,c=l,h=dt.empty,u=0;for(let p=o,m=!1;p>n;p--)m||r.index(p)>0?(m=!0,h=dt.from(r.node(p).copy(h)),u++):a--;let d=dt.empty,f=0;for(let p=o,m=!1;p>n;p--)m||i.after(p+1)<i.end(p)?(m=!0,d=dt.from(i.node(p).copy(d)),f++):c++;t.step(new Te(a,c,s,l,new vt(h.append(d),u,f),h.size-u,!0))}(this,t,e),this}join(t,e=1){return function(t,e,n){let r=new Ne(e-n,e+n,vt.empty,!0);t.step(r)}(this,t,e),this}wrap(t,e){return function(t,e,n){let r=dt.empty;for(let s=n.length-1;s>=0;s--){if(r.size){let t=n[s].type.contentMatch.matchFragment(r);if(!t||!t.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=dt.from(n[s].type.create(n[s].attrs,r))}let i=e.start,o=e.end;t.step(new Te(i,o,i,o,new vt(r,0,0),n.length,!0))}(this,t,e),this}setBlockType(t,e=t,n,r=null){return function(t,e,n,r,i){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let o=t.steps.length;t.doc.nodesBetween(e,n,((e,n)=>{if(e.isTextblock&&!e.hasMarkup(r,i)&&function(t,e,n){let r=t.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,n)}(t.doc,t.mapping.slice(o).map(n),r)){t.clearIncompatible(t.mapping.slice(o).map(n,1),r);let s=t.mapping.slice(o),l=s.map(n,1),a=s.map(n+e.nodeSize,1);return t.step(new Te(l,a,l+1,a-1,new vt(dt.from(r.create(i,null,e.marks)),0,0),1,!0)),!1}}))}(this,t,e,n,r),this}setNodeMarkup(t,e,n=null,r){return function(t,e,n,r,i){let o=t.doc.nodeAt(e);if(!o)throw new RangeError("No node at given position");n||(n=o.type);let s=n.create(r,null,i||o.marks);if(o.isLeaf)return t.replaceWith(e,e+o.nodeSize,s);if(!n.validContent(o.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new Te(e,e+o.nodeSize,e+1,e+o.nodeSize-1,new vt(dt.from(s),0,0),1,!0))}(this,t,e,n,r),this}setNodeAttribute(t,e,n){return this.step(new Ye(t,e,n)),this}addNodeMark(t,e){return this.step(new Ce(t,e)),this}removeNodeMark(t,e){if(!(e instanceof gt)){let n=this.doc.nodeAt(t);if(!n)throw new RangeError("No node at position "+t);if(!(e=e.isInSet(n.marks)))return this}return this.step(new De(t,e)),this}split(t,e=1,n){return function(t,e,n=1,r){let i=t.doc.resolve(e),o=dt.empty,s=dt.empty;for(let l=i.depth,a=i.depth-n,c=n-1;l>a;l--,c--){o=dt.from(i.node(l).copy(o));let t=r&&r[c];s=dt.from(t?t.type.create(t.attrs,s):i.node(l).copy(s))}t.step(new Ne(e,e,new vt(o.append(s),n,n),!0))}(this,t,e,n),this}addMark(t,e,n){return function(t,e,n,r){let i,o,s=[],l=[];t.doc.nodesBetween(e,n,((t,a,c)=>{if(!t.isInline)return;let h=t.marks;if(!r.isInSet(h)&&c.type.allowsMarkType(r.type)){let c=Math.max(a,e),u=Math.min(a+t.nodeSize,n),d=r.addToSet(h);for(let t=0;t<h.length;t++)h[t].isInSet(d)||(i&&i.to==c&&i.mark.eq(h[t])?i.to=u:s.push(i=new Oe(c,u,h[t])));o&&o.to==c?o.to=u:l.push(o=new Me(c,u,r))}})),s.forEach((e=>t.step(e))),l.forEach((e=>t.step(e)))}(this,t,e,n),this}removeMark(t,e,n){return function(t,e,n,r){let i=[],o=0;t.doc.nodesBetween(e,n,((t,s)=>{if(!t.isInline)return;o++;let l=null;if(r instanceof Qt){let e,n=t.marks;for(;e=r.isInSet(n);)(l||(l=[])).push(e),n=e.removeFromSet(n)}else r?r.isInSet(t.marks)&&(l=[r]):l=t.marks;if(l&&l.length){let r=Math.min(s+t.nodeSize,n);for(let t=0;t<l.length;t++){let n,a=l[t];for(let t=0;t<i.length;t++){let e=i[t];e.step==o-1&&a.eq(i[t].style)&&(n=e)}n?(n.to=r,n.step=o):i.push({style:a,from:Math.max(s,e),to:r,step:o})}}})),i.forEach((e=>t.step(new Oe(e.from,e.to,e.style))))}(this,t,e,n),this}clearIncompatible(t,e,n){return function(t,e,n,r=n.contentMatch){let i=t.doc.nodeAt(e),o=[],s=e+1;for(let l=0;l<i.childCount;l++){let e=i.child(l),a=s+e.nodeSize,c=r.matchType(e.type);if(c){r=c;for(let r=0;r<e.marks.length;r++)n.allowsMarkType(e.marks[r].type)||t.step(new Oe(s,a,e.marks[r]))}else o.push(new Ne(s,a,vt.empty));s=a}if(!r.validEnd){let e=r.fillBefore(dt.empty,!0);t.replace(s,s,new vt(e,0,0))}for(let l=o.length-1;l>=0;l--)t.step(o[l])}(this,t,e,n),this}}const Ze=Object.create(null);class Xe{constructor(t,e,n){this.$anchor=t,this.$head=e,this.ranges=n||[new Qe(t.min(e),t.max(e))]}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 t=this.ranges;for(let e=0;e<t.length;e++)if(t[e].$from.pos!=t[e].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(t,e=vt.empty){let n=e.content.lastChild,r=null;for(let s=0;s<e.openEnd;s++)r=n,n=n.lastChild;let i=t.steps.length,o=this.ranges;for(let s=0;s<o.length;s++){let{$from:l,$to:a}=o[s],c=t.mapping.slice(i);t.replaceRange(c.map(l.pos),c.map(a.pos),s?vt.empty:e),0==s&&hn(t,i,(n?n.isInline:r&&r.isTextblock)?-1:1)}}replaceWith(t,e){let n=t.steps.length,r=this.ranges;for(let i=0;i<r.length;i++){let{$from:o,$to:s}=r[i],l=t.mapping.slice(n),a=l.map(o.pos),c=l.map(s.pos);i?t.deleteRange(a,c):(t.replaceRangeWith(a,c,e),hn(t,n,e.isInline?-1:1))}}static findFrom(t,e,n=!1){let r=t.parent.inlineContent?new nn(t):cn(t.node(0),t.parent,t.pos,t.index(),e,n);if(r)return r;for(let i=t.depth-1;i>=0;i--){let r=e<0?cn(t.node(0),t.node(i),t.before(i+1),t.index(i),e,n):cn(t.node(0),t.node(i),t.after(i+1),t.index(i)+1,e,n);if(r)return r}return null}static near(t,e=1){return this.findFrom(t,e)||this.findFrom(t,-e)||new ln(t.node(0))}static atStart(t){return cn(t,t,0,0,1)||new ln(t)}static atEnd(t){return cn(t,t,t.content.size,t.childCount,-1)||new ln(t)}static fromJSON(t,e){if(!e||!e.type)throw new RangeError("Invalid input for Selection.fromJSON");let n=Ze[e.type];if(!n)throw new RangeError(`No selection type ${e.type} defined`);return n.fromJSON(t,e)}static jsonID(t,e){if(t in Ze)throw new RangeError("Duplicate use of selection JSON ID "+t);return Ze[t]=e,e.prototype.jsonID=t,e}getBookmark(){return nn.between(this.$anchor,this.$head).getBookmark()}}Xe.prototype.visible=!0;class Qe{constructor(t,e){this.$from=t,this.$to=e}}let tn=!1;function en(t){tn||t.parent.inlineContent||(tn=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class nn extends Xe{constructor(t,e=t){en(t),en(e),super(t,e)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(t,e){let n=t.resolve(e.map(this.head));if(!n.parent.inlineContent)return Xe.near(n);let r=t.resolve(e.map(this.anchor));return new nn(r.parent.inlineContent?r:n,n)}replace(t,e=vt.empty){if(super.replace(t,e),e==vt.empty){let e=this.$from.marksAcross(this.$to);e&&t.ensureMarks(e)}}eq(t){return t instanceof nn&&t.anchor==this.anchor&&t.head==this.head}getBookmark(){return new rn(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(t,e){if("number"!=typeof e.anchor||"number"!=typeof e.head)throw new RangeError("Invalid input for TextSelection.fromJSON");return new nn(t.resolve(e.anchor),t.resolve(e.head))}static create(t,e,n=e){let r=t.resolve(e);return new this(r,n==e?r:t.resolve(n))}static between(t,e,n){let r=t.pos-e.pos;if(n&&!r||(n=r>=0?1:-1),!e.parent.inlineContent){let t=Xe.findFrom(e,n,!0)||Xe.findFrom(e,-n,!0);if(!t)return Xe.near(e,n);e=t.$head}return t.parent.inlineContent||(0==r||(t=(Xe.findFrom(t,-n,!0)||Xe.findFrom(t,n,!0)).$anchor).pos<e.pos!=r<0)&&(t=e),new nn(t,e)}}Xe.jsonID("text",nn);class rn{constructor(t,e){this.anchor=t,this.head=e}map(t){return new rn(t.map(this.anchor),t.map(this.head))}resolve(t){return nn.between(t.resolve(this.anchor),t.resolve(this.head))}}class on extends Xe{constructor(t){let e=t.nodeAfter,n=t.node(0).resolve(t.pos+e.nodeSize);super(t,n),this.node=e}map(t,e){let{deleted:n,pos:r}=e.mapResult(this.anchor),i=t.resolve(r);return n?Xe.near(i):new on(i)}content(){return new vt(dt.from(this.node),0,0)}eq(t){return t instanceof on&&t.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new sn(this.anchor)}static fromJSON(t,e){if("number"!=typeof e.anchor)throw new RangeError("Invalid input for NodeSelection.fromJSON");return new on(t.resolve(e.anchor))}static create(t,e){return new on(t.resolve(e))}static isSelectable(t){return!t.isText&&!1!==t.type.spec.selectable}}on.prototype.visible=!1,Xe.jsonID("node",on);class sn{constructor(t){this.anchor=t}map(t){let{deleted:e,pos:n}=t.mapResult(this.anchor);return e?new rn(n,n):new sn(n)}resolve(t){let e=t.resolve(this.anchor),n=e.nodeAfter;return n&&on.isSelectable(n)?new on(e):Xe.near(e)}}class ln extends Xe{constructor(t){super(t.resolve(0),t.resolve(t.content.size))}replace(t,e=vt.empty){if(e==vt.empty){t.delete(0,t.doc.content.size);let e=Xe.atStart(t.doc);e.eq(t.selection)||t.setSelection(e)}else super.replace(t,e)}toJSON(){return{type:"all"}}static fromJSON(t){return new ln(t)}map(t){return new ln(t)}eq(t){return t instanceof ln}getBookmark(){return an}}Xe.jsonID("all",ln);const an={map(){return this},resolve:t=>new ln(t)};function cn(t,e,n,r,i,o=!1){if(e.inlineContent)return nn.create(t,n);for(let s=r-(i>0?0:1);i>0?s<e.childCount:s>=0;s+=i){let r=e.child(s);if(r.isAtom){if(!o&&on.isSelectable(r))return on.create(t,n-(i<0?r.nodeSize:0))}else{let e=cn(t,r,n+i,i<0?r.childCount:0,i,o);if(e)return e}n+=r.nodeSize*i}return null}function hn(t,e,n){let r=t.steps.length-1;if(r<e)return;let i,o=t.steps[r];(o instanceof Ne||o instanceof Te)&&(t.mapping.maps[r].forEach(((t,e,n,r)=>{null==i&&(i=r)})),t.setSelection(Xe.near(t.doc.resolve(i),n)))}class un extends Ge{constructor(t){super(t.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=t.selection,this.storedMarks=t.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(t){if(t.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=t,this.curSelectionFor=this.steps.length,this.updated=-3&(1|this.updated),this.storedMarks=null,this}get selectionSet(){return(1&this.updated)>0}setStoredMarks(t){return this.storedMarks=t,this.updated|=2,this}ensureMarks(t){return gt.sameSet(this.storedMarks||this.selection.$from.marks(),t)||this.setStoredMarks(t),this}addStoredMark(t){return this.ensureMarks(t.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(t){return this.ensureMarks(t.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(2&this.updated)>0}addStep(t,e){super.addStep(t,e),this.updated=-3&this.updated,this.storedMarks=null}setTime(t){return this.time=t,this}replaceSelection(t){return this.selection.replace(this,t),this}replaceSelectionWith(t,e=!0){let n=this.selection;return e&&(t=t.mark(this.storedMarks||(n.empty?n.$from.marks():n.$from.marksAcross(n.$to)||gt.none))),n.replaceWith(this,t),this}deleteSelection(){return this.selection.replace(this),this}insertText(t,e,n){let r=this.doc.type.schema;if(null==e)return t?this.replaceSelectionWith(r.text(t),!0):this.deleteSelection();{if(null==n&&(n=e),n=null==n?e:n,!t)return this.deleteRange(e,n);let i=this.storedMarks;if(!i){let t=this.doc.resolve(e);i=n==e?t.marks():t.marksAcross(this.doc.resolve(n))}return this.replaceRangeWith(e,n,r.text(t,i)),this.selection.empty||this.setSelection(Xe.near(this.selection.$to)),this}}setMeta(t,e){return this.meta["string"==typeof t?t:t.key]=e,this}getMeta(t){return this.meta["string"==typeof t?t:t.key]}get isGeneric(){for(let t in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=4,this}get scrolledIntoView(){return(4&this.updated)>0}}function dn(t,e){return e&&t?t.bind(e):t}class fn{constructor(t,e,n){this.name=t,this.init=dn(e.init,n),this.apply=dn(e.apply,n)}}const pn=[new fn("doc",{init:t=>t.doc||t.schema.topNodeType.createAndFill(),apply:t=>t.doc}),new fn("selection",{init:(t,e)=>t.selection||Xe.atStart(e.doc),apply:t=>t.selection}),new fn("storedMarks",{init:t=>t.storedMarks||null,apply:(t,e,n,r)=>r.selection.$cursor?t.storedMarks:null}),new fn("scrollToSelection",{init:()=>0,apply:(t,e)=>t.scrolledIntoView?e+1:e})];class mn{constructor(t,e){this.schema=t,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=pn.slice(),e&&e.forEach((t=>{if(this.pluginsByKey[t.key])throw new RangeError("Adding different instances of a keyed plugin ("+t.key+")");this.plugins.push(t),this.pluginsByKey[t.key]=t,t.spec.state&&this.fields.push(new fn(t.key,t.spec.state,t))}))}}class gn{constructor(t){this.config=t}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(t){return this.applyTransaction(t).state}filterTransaction(t,e=-1){for(let n=0;n<this.config.plugins.length;n++)if(n!=e){let e=this.config.plugins[n];if(e.spec.filterTransaction&&!e.spec.filterTransaction.call(e,t,this))return!1}return!0}applyTransaction(t){if(!this.filterTransaction(t))return{state:this,transactions:[]};let e=[t],n=this.applyInner(t),r=null;for(;;){let i=!1;for(let o=0;o<this.config.plugins.length;o++){let s=this.config.plugins[o];if(s.spec.appendTransaction){let l=r?r[o].n:0,a=r?r[o].state:this,c=l<e.length&&s.spec.appendTransaction.call(s,l?e.slice(l):e,a,n);if(c&&n.filterTransaction(c,o)){if(c.setMeta("appendedTransaction",t),!r){r=[];for(let t=0;t<this.config.plugins.length;t++)r.push(t<o?{state:n,n:e.length}:{state:this,n:0})}e.push(c),n=n.applyInner(c),i=!0}r&&(r[o]={state:n,n:e.length})}}if(!i)return{state:n,transactions:e}}}applyInner(t){if(!t.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let e=new gn(this.config),n=this.config.fields;for(let r=0;r<n.length;r++){let i=n[r];e[i.name]=i.apply(t,this[i.name],this,e)}return e}get tr(){return new un(this)}static create(t){let e=new mn(t.doc?t.doc.type.schema:t.schema,t.plugins),n=new gn(e);for(let r=0;r<e.fields.length;r++)n[e.fields[r].name]=e.fields[r].init(t,n);return n}reconfigure(t){let e=new mn(this.schema,t.plugins),n=e.fields,r=new gn(e);for(let i=0;i<n.length;i++){let e=n[i].name;r[e]=this.hasOwnProperty(e)?this[e]:n[i].init(t,r)}return r}toJSON(t){let e={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(e.storedMarks=this.storedMarks.map((t=>t.toJSON()))),t&&"object"==typeof t)for(let n in t){if("doc"==n||"selection"==n)throw new RangeError("The JSON fields `doc` and `selection` are reserved");let r=t[n],i=r.spec.state;i&&i.toJSON&&(e[n]=i.toJSON.call(r,this[r.key]))}return e}static fromJSON(t,e,n){if(!e)throw new RangeError("Invalid input for EditorState.fromJSON");if(!t.schema)throw new RangeError("Required config field 'schema' missing");let r=new mn(t.schema,t.plugins),i=new gn(r);return r.fields.forEach((r=>{if("doc"==r.name)i.doc=zt.fromJSON(t.schema,e.doc);else if("selection"==r.name)i.selection=Xe.fromJSON(i.doc,e.selection);else if("storedMarks"==r.name)e.storedMarks&&(i.storedMarks=e.storedMarks.map(t.schema.markFromJSON));else{if(n)for(let o in n){let s=n[o],l=s.spec.state;if(s.key==r.name&&l&&l.fromJSON&&Object.prototype.hasOwnProperty.call(e,o))return void(i[r.name]=l.fromJSON.call(s,t,e[o],i))}i[r.name]=r.init(t,i)}})),i}}function yn(t,e,n){for(let r in t){let i=t[r];i instanceof Function?i=i.bind(e):"handleDOMEvents"==r&&(i=yn(i,e,{})),n[r]=i}return n}class vn{constructor(t){this.spec=t,this.props={},t.props&&yn(t.props,this,this.props),this.key=t.key?t.key.key:bn("plugin")}getState(t){return t[this.key]}}const wn=Object.create(null);function bn(t){return t in wn?t+"$"+ ++wn[t]:(wn[t]=0,t+"$")}class xn{constructor(t="key"){this.key=bn(t)}get(t){return t.config.pluginsByKey[this.key]}getState(t){return t[this.key]}}const Sn=function(t){for(var e=0;;e++)if(!(t=t.previousSibling))return e},kn=function(t){let e=t.assignedSlot||t.parentNode;return e&&11==e.nodeType?e.host:e};let Mn=null;const On=function(t,e,n){let r=Mn||(Mn=document.createRange());return r.setEnd(t,null==n?t.nodeValue.length:n),r.setStart(t,e||0),r},Cn=function(t,e,n,r){return n&&(Nn(t,e,n,r,-1)||Nn(t,e,n,r,1))},Dn=/^(img|br|input|textarea|hr)$/i;function Nn(t,e,n,r,i){for(;;){if(t==n&&e==r)return!0;if(e==(i<0?0:Tn(t))){let n=t.parentNode;if(!n||1!=n.nodeType||An(t)||Dn.test(t.nodeName)||"false"==t.contentEditable)return!1;e=Sn(t)+(i<0?0:1),t=n}else{if(1!=t.nodeType)return!1;if("false"==(t=t.childNodes[e+(i<0?-1:0)]).contentEditable)return!1;e=i<0?Tn(t):0}}}function Tn(t){return 3==t.nodeType?t.nodeValue.length:t.childNodes.length}function An(t){let e;for(let n=t;n&&!(e=n.pmViewDesc);n=n.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==t||e.contentDOM==t)}const En=function(t){return t.focusNode&&Cn(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function $n(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}const Pn="undefined"!=typeof navigator?navigator:null,In="undefined"!=typeof document?document:null,Rn=Pn&&Pn.userAgent||"",zn=/Edge\/(\d+)/.exec(Rn),_n=/MSIE \d/.exec(Rn),Bn=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Rn),jn=!!(_n||Bn||zn),Vn=_n?document.documentMode:Bn?+Bn[1]:zn?+zn[1]:0,Fn=!jn&&/gecko\/(\d+)/i.test(Rn);Fn&&(/Firefox\/(\d+)/.exec(Rn)||[0,0])[1];const Ln=!jn&&/Chrome\/(\d+)/.exec(Rn),Wn=!!Ln,qn=Ln?+Ln[1]:0,Jn=!jn&&!!Pn&&/Apple Computer/.test(Pn.vendor),Kn=Jn&&(/Mobile\/\w+/.test(Rn)||!!Pn&&Pn.maxTouchPoints>2),Hn=Kn||!!Pn&&/Mac/.test(Pn.platform),Yn=!!Pn&&/Win/.test(Pn.platform),Un=/Android \d/.test(Rn),Gn=!!In&&"webkitFontSmoothing"in In.documentElement.style,Zn=Gn?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function Xn(t){return{left:0,right:t.documentElement.clientWidth,top:0,bottom:t.documentElement.clientHeight}}function Qn(t,e){return"number"==typeof t?t:t[e]}function tr(t){let e=t.getBoundingClientRect(),n=e.width/t.offsetWidth||1,r=e.height/t.offsetHeight||1;return{left:e.left,right:e.left+t.clientWidth*n,top:e.top,bottom:e.top+t.clientHeight*r}}function er(t,e,n){let r=t.someProp("scrollThreshold")||0,i=t.someProp("scrollMargin")||5,o=t.dom.ownerDocument;for(let s=n||t.dom;s;s=kn(s)){if(1!=s.nodeType)continue;let t=s,n=t==o.body,l=n?Xn(o):tr(t),a=0,c=0;if(e.top<l.top+Qn(r,"top")?c=-(l.top-e.top+Qn(i,"top")):e.bottom>l.bottom-Qn(r,"bottom")&&(c=e.bottom-e.top>l.bottom-l.top?e.top+Qn(i,"top")-l.top:e.bottom-l.bottom+Qn(i,"bottom")),e.left<l.left+Qn(r,"left")?a=-(l.left-e.left+Qn(i,"left")):e.right>l.right-Qn(r,"right")&&(a=e.right-l.right+Qn(i,"right")),a||c)if(n)o.defaultView.scrollBy(a,c);else{let n=t.scrollLeft,r=t.scrollTop;c&&(t.scrollTop+=c),a&&(t.scrollLeft+=a);let i=t.scrollLeft-n,o=t.scrollTop-r;e={left:e.left-i,top:e.top-o,right:e.right-i,bottom:e.bottom-o}}if(n||/^(fixed|sticky)$/.test(getComputedStyle(s).position))break}}function nr(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=kn(r));return e}function rr(t,e){for(let n=0;n<t.length;n++){let{dom:r,top:i,left:o}=t[n];r.scrollTop!=i+e&&(r.scrollTop=i+e),r.scrollLeft!=o&&(r.scrollLeft=o)}}let ir=null;function or(t,e){let n,r,i,o,s=2e8,l=0,a=e.top,c=e.top;for(let h=t.firstChild,u=0;h;h=h.nextSibling,u++){let t;if(1==h.nodeType)t=h.getClientRects();else{if(3!=h.nodeType)continue;t=On(h).getClientRects()}for(let d=0;d<t.length;d++){let f=t[d];if(f.top<=a&&f.bottom>=c){a=Math.max(f.bottom,a),c=Math.min(f.top,c);let t=f.left>e.left?f.left-e.left:f.right<e.left?e.left-f.right:0;if(t<s){n=h,s=t,r=t&&3==n.nodeType?{left:f.right<e.left?f.right:f.left,top:e.top}:e,1==h.nodeType&&t&&(l=u+(e.left>=(f.left+f.right)/2?1:0));continue}}else f.top>e.top&&!i&&f.left<=e.left&&f.right>=e.left&&(i=h,o={left:Math.max(f.left,Math.min(f.right,e.left)),top:f.top});!n&&(e.left>=f.right&&e.top>=f.top||e.left>=f.left&&e.top>=f.bottom)&&(l=u+1)}}return!n&&i&&(n=i,r=o,s=0),n&&3==n.nodeType?function(t,e){let n=t.nodeValue.length,r=document.createRange();for(let i=0;i<n;i++){r.setEnd(t,i+1),r.setStart(t,i);let n=hr(r,1);if(n.top!=n.bottom&&sr(e,n))return{node:t,offset:i+(e.left>=(n.left+n.right)/2?1:0)}}return{node:t,offset:0}}(n,r):!n||s&&1==n.nodeType?{node:t,offset:l}:or(n,r)}function sr(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function lr(t,e,n){let r=t.childNodes.length;if(r&&n.top<n.bottom)for(let i=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-n.top)/(n.bottom-n.top))-2)),o=i;;){let n=t.childNodes[o];if(1==n.nodeType){let t=n.getClientRects();for(let r=0;r<t.length;r++){let i=t[r];if(sr(e,i))return lr(n,e,i)}}if((o=(o+1)%r)==i)break}return t}function ar(t,e){let n,r=t.dom.ownerDocument,i=0,o=function(t,e,n){if(t.caretPositionFromPoint)try{let r=t.caretPositionFromPoint(e,n);if(r)return{node:r.offsetNode,offset:r.offset}}catch(r){}if(t.caretRangeFromPoint){let r=t.caretRangeFromPoint(e,n);if(r)return{node:r.startContainer,offset:r.startOffset}}}(r,e.left,e.top);o&&({node:n,offset:i}=o);let s,l=(t.root.elementFromPoint?t.root:r).elementFromPoint(e.left,e.top);if(!l||!t.dom.contains(1!=l.nodeType?l.parentNode:l)){let n=t.dom.getBoundingClientRect();if(!sr(e,n))return null;if(l=lr(t.dom,e,n),!l)return null}if(Jn)for(let c=l;n&&c;c=kn(c))c.draggable&&(n=void 0);if(l=function(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}(l,e),n){if(Fn&&1==n.nodeType&&(i=Math.min(i,n.childNodes.length),i<n.childNodes.length)){let t,r=n.childNodes[i];"IMG"==r.nodeName&&(t=r.getBoundingClientRect()).right<=e.left&&t.bottom>e.top&&i++}let r;Gn&&i&&1==n.nodeType&&1==(r=n.childNodes[i-1]).nodeType&&"false"==r.contentEditable&&r.getBoundingClientRect().top>=e.top&&i--,n==t.dom&&i==n.childNodes.length-1&&1==n.lastChild.nodeType&&e.top>n.lastChild.getBoundingClientRect().bottom?s=t.state.doc.content.size:0!=i&&1==n.nodeType&&"BR"==n.childNodes[i-1].nodeName||(s=function(t,e,n,r){let i=-1;for(let o=e,s=!1;o!=t.dom;){let e=t.docView.nearestDesc(o,!0);if(!e)return null;if(1==e.dom.nodeType&&(e.node.isBlock&&e.parent&&!s||!e.contentDOM)){let t=e.dom.getBoundingClientRect();if(e.node.isBlock&&e.parent&&!s&&(s=!0,t.left>r.left||t.top>r.top?i=e.posBefore:(t.right<r.left||t.bottom<r.top)&&(i=e.posAfter)),!e.contentDOM&&i<0&&!e.node.isText)return(e.node.isBlock?r.top<(t.top+t.bottom)/2:r.left<(t.left+t.right)/2)?e.posBefore:e.posAfter}o=e.dom.parentNode}return i>-1?i:t.docView.posFromDOM(e,n,-1)}(t,n,i,e))}null==s&&(s=function(t,e,n){let{node:r,offset:i}=or(e,n),o=-1;if(1==r.nodeType&&!r.firstChild){let t=r.getBoundingClientRect();o=t.left!=t.right&&n.left>(t.left+t.right)/2?1:-1}return t.docView.posFromDOM(r,i,o)}(t,l,e));let a=t.docView.nearestDesc(l,!0);return{pos:s,inside:a?a.posAtStart-a.border:-1}}function cr(t){return t.top<t.bottom||t.left<t.right}function hr(t,e){let n=t.getClientRects();if(n.length){let t=n[e<0?0:n.length-1];if(cr(t))return t}return Array.prototype.find.call(n,cr)||t.getBoundingClientRect()}const ur=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function dr(t,e,n){let{node:r,offset:i,atom:o}=t.docView.domFromPos(e,n<0?-1:1),s=Gn||Fn;if(3==r.nodeType){if(!s||!ur.test(r.nodeValue)&&(n<0?i:i!=r.nodeValue.length)){let t=i,e=i,o=n<0?1:-1;return n<0&&!i?(e++,o=-1):n>=0&&i==r.nodeValue.length?(t--,o=1):n<0?t--:e++,fr(hr(On(r,t,e),o),o<0)}{let t=hr(On(r,i,i),n);if(Fn&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let e=hr(On(r,i-1,i-1),-1);if(e.top==t.top){let n=hr(On(r,i,i+1),-1);if(n.top!=t.top)return fr(n,n.left<e.left)}}return t}}if(!t.state.doc.resolve(e-(o||0)).parent.inlineContent){if(null==o&&i&&(n<0||i==Tn(r))){let t=r.childNodes[i-1];if(1==t.nodeType)return pr(t.getBoundingClientRect(),!1)}if(null==o&&i<Tn(r)){let t=r.childNodes[i];if(1==t.nodeType)return pr(t.getBoundingClientRect(),!0)}return pr(r.getBoundingClientRect(),n>=0)}if(null==o&&i&&(n<0||i==Tn(r))){let t=r.childNodes[i-1],e=3==t.nodeType?On(t,Tn(t)-(s?0:1)):1!=t.nodeType||"BR"==t.nodeName&&t.nextSibling?null:t;if(e)return fr(hr(e,1),!1)}if(null==o&&i<Tn(r)){let t=r.childNodes[i];for(;t.pmViewDesc&&t.pmViewDesc.ignoreForCoords;)t=t.nextSibling;let e=t?3==t.nodeType?On(t,0,s?0:1):1==t.nodeType?t:null:null;if(e)return fr(hr(e,-1),!0)}return fr(hr(3==r.nodeType?On(r):r,-n),n>=0)}function fr(t,e){if(0==t.width)return t;let n=e?t.left:t.right;return{top:t.top,bottom:t.bottom,left:n,right:n}}function pr(t,e){if(0==t.height)return t;let n=e?t.top:t.bottom;return{top:n,bottom:n,left:t.left,right:t.right}}function mr(t,e,n){let r=t.state,i=t.root.activeElement;r!=e&&t.updateState(e),i!=t.dom&&t.focus();try{return n()}finally{r!=e&&t.updateState(r),i!=t.dom&&i&&i.focus()}}const gr=/[\u0590-\u08ac]/;let yr=null,vr=null,wr=!1;function br(t,e,n){return yr==e&&vr==n?wr:(yr=e,vr=n,wr="up"==n||"down"==n?function(t,e,n){let r=e.selection,i="up"==n?r.$from:r.$to;return mr(t,e,(()=>{let{node:e}=t.docView.domFromPos(i.pos,"up"==n?-1:1);for(;;){let n=t.docView.nearestDesc(e,!0);if(!n)break;if(n.node.isBlock){e=n.contentDOM||n.dom;break}e=n.dom.parentNode}let r=dr(t,i.pos,1);for(let t=e.firstChild;t;t=t.nextSibling){let e;if(1==t.nodeType)e=t.getClientRects();else{if(3!=t.nodeType)continue;e=On(t,0,t.nodeValue.length).getClientRects()}for(let t=0;t<e.length;t++){let i=e[t];if(i.bottom>i.top+1&&("up"==n?r.top-i.top>2*(i.bottom-r.top):i.bottom-r.bottom>2*(r.bottom-i.top)))return!1}}return!0}))}(t,e,n):function(t,e,n){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,o=!i,s=i==r.parent.content.size,l=t.domSelection();return gr.test(r.parent.textContent)&&l.modify?mr(t,e,(()=>{let{focusNode:e,focusOffset:i,anchorNode:o,anchorOffset:s}=t.domSelectionRange(),a=l.caretBidiLevel;l.modify("move",n,"character");let c=r.depth?t.docView.domAfterPos(r.before()):t.dom,{focusNode:h,focusOffset:u}=t.domSelectionRange(),d=h&&!c.contains(1==h.nodeType?h:h.parentNode)||e==h&&i==u;try{l.collapse(o,s),e&&(e!=o||i!=s)&&l.extend&&l.extend(e,i)}catch(f){}return null!=a&&(l.caretBidiLevel=a),d})):"left"==n||"backward"==n?o:s}(t,e,n))}class xr{constructor(t,e,n,r){this.parent=t,this.children=e,this.dom=n,this.contentDOM=r,this.dirty=0,n.pmViewDesc=this}matchesWidget(t){return!1}matchesMark(t){return!1}matchesNode(t,e,n){return!1}matchesHack(t){return!1}parseRule(){return null}stopEvent(t){return!1}get size(){let t=0;for(let e=0;e<this.children.length;e++)t+=this.children[e].size;return t}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let t=0;t<this.children.length;t++)this.children[t].destroy()}posBeforeChild(t){for(let e=0,n=this.posAtStart;;e++){let r=this.children[e];if(r==t)return n;n+=r.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(t,e,n){if(this.contentDOM&&this.contentDOM.contains(1==t.nodeType?t:t.parentNode)){if(n<0){let n,r;if(t==this.contentDOM)n=t.childNodes[e-1];else{for(;t.parentNode!=this.contentDOM;)t=t.parentNode;n=t.previousSibling}for(;n&&(!(r=n.pmViewDesc)||r.parent!=this);)n=n.previousSibling;return n?this.posBeforeChild(r)+r.size:this.posAtStart}{let n,r;if(t==this.contentDOM)n=t.childNodes[e];else{for(;t.parentNode!=this.contentDOM;)t=t.parentNode;n=t.nextSibling}for(;n&&(!(r=n.pmViewDesc)||r.parent!=this);)n=n.nextSibling;return n?this.posBeforeChild(r):this.posAtEnd}}let r;if(t==this.dom&&this.contentDOM)r=e>Sn(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))r=2&t.compareDocumentPosition(this.contentDOM);else if(this.dom.firstChild){if(0==e)for(let e=t;;e=e.parentNode){if(e==this.dom){r=!1;break}if(e.previousSibling)break}if(null==r&&e==t.childNodes.length)for(let e=t;;e=e.parentNode){if(e==this.dom){r=!0;break}if(e.nextSibling)break}}return(null==r?n>0:r)?this.posAtEnd:this.posAtStart}nearestDesc(t,e=!1){for(let n=!0,r=t;r;r=r.parentNode){let i,o=this.getDesc(r);if(o&&(!e||o.node)){if(!n||!(i=o.nodeDOM)||(1==i.nodeType?i.contains(1==t.nodeType?t:t.parentNode):i==t))return o;n=!1}}}getDesc(t){let e=t.pmViewDesc;for(let n=e;n;n=n.parent)if(n==this)return e}posFromDOM(t,e,n){for(let r=t;r;r=r.parentNode){let i=this.getDesc(r);if(i)return i.localPosFromDOM(t,e,n)}return-1}descAt(t){for(let e=0,n=0;e<this.children.length;e++){let r=this.children[e],i=n+r.size;if(n==t&&i!=n){for(;!r.border&&r.children.length;)r=r.children[0];return r}if(t<i)return r.descAt(t-n-r.border);n=i}}domFromPos(t,e){if(!this.contentDOM)return{node:this.dom,offset:0,atom:t+1};let n=0,r=0;for(let i=0;n<this.children.length;n++){let e=this.children[n],o=i+e.size;if(o>t||e instanceof Nr){r=t-i;break}i=o}if(r)return this.children[n].domFromPos(r-this.children[n].border,e);for(let i;n&&!(i=this.children[n-1]).size&&i instanceof Sr&&i.side>=0;n--);if(e<=0){let t,r=!0;for(;t=n?this.children[n-1]:null,t&&t.dom.parentNode!=this.contentDOM;n--,r=!1);return t&&e&&r&&!t.border&&!t.domAtom?t.domFromPos(t.size,e):{node:this.contentDOM,offset:t?Sn(t.dom)+1:0}}{let t,r=!0;for(;t=n<this.children.length?this.children[n]:null,t&&t.dom.parentNode!=this.contentDOM;n++,r=!1);return t&&r&&!t.border&&!t.domAtom?t.domFromPos(0,e):{node:this.contentDOM,offset:t?Sn(t.dom):this.contentDOM.childNodes.length}}}parseRange(t,e,n=0){if(0==this.children.length)return{node:this.contentDOM,from:t,to:e,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let r=-1,i=-1;for(let o=n,s=0;;s++){let n=this.children[s],l=o+n.size;if(-1==r&&t<=l){let i=o+n.border;if(t>=i&&e<=l-n.border&&n.node&&n.contentDOM&&this.contentDOM.contains(n.contentDOM))return n.parseRange(t,e,i);t=o;for(let e=s;e>0;e--){let n=this.children[e-1];if(n.size&&n.dom.parentNode==this.contentDOM&&!n.emptyChildAt(1)){r=Sn(n.dom)+1;break}t-=n.size}-1==r&&(r=0)}if(r>-1&&(l>e||s==this.children.length-1)){e=l;for(let t=s+1;t<this.children.length;t++){let n=this.children[t];if(n.size&&n.dom.parentNode==this.contentDOM&&!n.emptyChildAt(-1)){i=Sn(n.dom);break}e+=n.size}-1==i&&(i=this.contentDOM.childNodes.length);break}o=l}return{node:this.contentDOM,from:t,to:e,fromOffset:r,toOffset:i}}emptyChildAt(t){if(this.border||!this.contentDOM||!this.children.length)return!1;let e=this.children[t<0?0:this.children.length-1];return 0==e.size||e.emptyChildAt(t)}domAfterPos(t){let{node:e,offset:n}=this.domFromPos(t,0);if(1!=e.nodeType||n==e.childNodes.length)throw new RangeError("No node after pos "+t);return e.childNodes[n]}setSelection(t,e,n,r=!1){let i=Math.min(t,e),o=Math.max(t,e);for(let d=0,f=0;d<this.children.length;d++){let s=this.children[d],l=f+s.size;if(i>f&&o<l)return s.setSelection(t-f-s.border,e-f-s.border,n,r);f=l}let s=this.domFromPos(t,t?-1:1),l=e==t?s:this.domFromPos(e,e?-1:1),a=n.getSelection(),c=!1;if((Fn||Jn)&&t==e){let{node:t,offset:e}=s;if(3==t.nodeType){if(c=!(!e||"\n"!=t.nodeValue[e-1]),c&&e==t.nodeValue.length)for(let n,r=t;r;r=r.parentNode){if(n=r.nextSibling){"BR"==n.nodeName&&(s=l={node:n.parentNode,offset:Sn(n)+1});break}let t=r.pmViewDesc;if(t&&t.node&&t.node.isBlock)break}}else{let n=t.childNodes[e-1];c=n&&("BR"==n.nodeName||"false"==n.contentEditable)}}if(Fn&&a.focusNode&&a.focusNode!=l.node&&1==a.focusNode.nodeType){let t=a.focusNode.childNodes[a.focusOffset];t&&"false"==t.contentEditable&&(r=!0)}if(!(r||c&&Jn)&&Cn(s.node,s.offset,a.anchorNode,a.anchorOffset)&&Cn(l.node,l.offset,a.focusNode,a.focusOffset))return;let h=!1;if((a.extend||t==e)&&!c){a.collapse(s.node,s.offset);try{t!=e&&a.extend(l.node,l.offset),h=!0}catch(u){}}if(!h){if(t>e){let t=s;s=l,l=t}let n=document.createRange();n.setEnd(l.node,l.offset),n.setStart(s.node,s.offset),a.removeAllRanges(),a.addRange(n)}}ignoreMutation(t){return!this.contentDOM&&"selection"!=t.type}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(t,e){for(let n=0,r=0;r<this.children.length;r++){let i=this.children[r],o=n+i.size;if(n==o?t<=o&&e>=n:t<o&&e>n){let r=n+i.border,s=o-i.border;if(t>=r&&e<=s)return this.dirty=t==n||e==o?2:1,void(t!=r||e!=s||!i.contentLost&&i.dom.parentNode==this.contentDOM?i.markDirty(t-r,e-r):i.dirty=3);i.dirty=i.dom!=i.contentDOM||i.dom.parentNode!=this.contentDOM||i.children.length?3:2}n=o}this.dirty=2}markParentsDirty(){let t=1;for(let e=this.parent;e;e=e.parent,t++){let n=1==t?2:1;e.dirty<n&&(e.dirty=n)}}get domAtom(){return!1}get ignoreForCoords(){return!1}}class Sr extends xr{constructor(t,e,n,r){let i,o=e.type.toDOM;if("function"==typeof o&&(o=o(n,(()=>i?i.parent?i.parent.posBeforeChild(i):void 0:r))),!e.type.spec.raw){if(1!=o.nodeType){let t=document.createElement("span");t.appendChild(o),o=t}o.contentEditable="false",o.classList.add("ProseMirror-widget")}super(t,[],o,null),this.widget=e,this.widget=e,i=this}matchesWidget(t){return 0==this.dirty&&t.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(t){let e=this.widget.spec.stopEvent;return!!e&&e(t)}ignoreMutation(t){return"selection"!=t.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 kr extends xr{constructor(t,e,n,r){super(t,[],e,null),this.textDOM=n,this.text=r}get size(){return this.text.length}localPosFromDOM(t,e){return t!=this.textDOM?this.posAtStart+(e?this.size:0):this.posAtStart+e}domFromPos(t){return{node:this.textDOM,offset:t}}ignoreMutation(t){return"characterData"===t.type&&t.target.nodeValue==t.oldValue}}class Mr extends xr{constructor(t,e,n,r){super(t,[],n,r),this.mark=e}static create(t,e,n,r){let i=r.nodeViews[e.type.name],o=i&&i(e,r,n);return o&&o.dom||(o=de.renderSpec(document,e.type.spec.toDOM(e,n))),new Mr(t,e,o.dom,o.contentDOM||o.dom)}parseRule(){return 3&this.dirty||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(t){return 3!=this.dirty&&this.mark.eq(t)}markDirty(t,e){if(super.markDirty(t,e),0!=this.dirty){let t=this.parent;for(;!t.node;)t=t.parent;t.dirty<this.dirty&&(t.dirty=this.dirty),this.dirty=0}}slice(t,e,n){let r=Mr.create(this.parent,this.mark,!0,n),i=this.children,o=this.size;e<o&&(i=Fr(i,e,o,n)),t>0&&(i=Fr(i,0,t,n));for(let s=0;s<i.length;s++)i[s].parent=r;return r.children=i,r}}class Or extends xr{constructor(t,e,n,r,i,o,s,l,a){super(t,[],i,o),this.node=e,this.outerDeco=n,this.innerDeco=r,this.nodeDOM=s}static create(t,e,n,r,i,o){let s,l=i.nodeViews[e.type.name],a=l&&l(e,i,(()=>s?s.parent?s.parent.posBeforeChild(s):void 0:o),n,r),c=a&&a.dom,h=a&&a.contentDOM;if(e.isText)if(c){if(3!=c.nodeType)throw new RangeError("Text must be rendered as a DOM text node")}else c=document.createTextNode(e.text);else c||({dom:c,contentDOM:h}=de.renderSpec(document,e.type.spec.toDOM(e)));h||e.isText||"BR"==c.nodeName||(c.hasAttribute("contenteditable")||(c.contentEditable="false"),e.type.spec.draggable&&(c.draggable=!0));let u=c;return c=zr(c,n,e),a?s=new Tr(t,e,n,r,c,h||null,u,a,i,o+1):e.isText?new Dr(t,e,n,r,c,u,i):new Or(t,e,n,r,c,h||null,u,i,o+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let t={node:this.node.type.name,attrs:this.node.attrs};if("pre"==this.node.type.whitespace&&(t.preserveWhitespace="full"),this.contentDOM)if(this.contentLost){for(let e=this.children.length-1;e>=0;e--){let n=this.children[e];if(this.dom.contains(n.dom.parentNode)){t.contentElement=n.dom.parentNode;break}}t.contentElement||(t.getContent=()=>dt.empty)}else t.contentElement=this.contentDOM;else t.getContent=()=>this.node.content;return t}matchesNode(t,e,n){return 0==this.dirty&&t.eq(this.node)&&_r(e,this.outerDeco)&&n.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(t,e){let n=this.node.inlineContent,r=e,i=t.composing?this.localCompositionInfo(t,e):null,o=i&&i.pos>-1?i:null,s=i&&i.pos<0,l=new jr(this,o&&o.node,t);!function(t,e,n,r){let i=e.locals(t),o=0;if(0==i.length){for(let n=0;n<t.childCount;n++){let s=t.child(n);r(s,i,e.forChild(o,s),n),o+=s.nodeSize}return}let s=0,l=[],a=null;for(let c=0;;){let h,u,d,f;for(;s<i.length&&i[s].to==o;){let t=i[s++];t.widget&&(h?(u||(u=[h])).push(t):h=t)}if(h)if(u){u.sort(Vr);for(let t=0;t<u.length;t++)n(u[t],c,!!a)}else n(h,c,!!a);if(a)f=-1,d=a,a=null;else{if(!(c<t.childCount))break;f=c,d=t.child(c++)}for(let t=0;t<l.length;t++)l[t].to<=o&&l.splice(t--,1);for(;s<i.length&&i[s].from<=o&&i[s].to>o;)l.push(i[s++]);let p=o+d.nodeSize;if(d.isText){let t=p;s<i.length&&i[s].from<t&&(t=i[s].from);for(let e=0;e<l.length;e++)l[e].to<t&&(t=l[e].to);t<p&&(a=d.cut(t-o),d=d.cut(0,t-o),p=t,f=-1)}r(d,d.isInline&&!d.isLeaf?l.filter((t=>!t.inline)):l.slice(),e.forChild(o,d),f),o=p}}(this.node,this.innerDeco,((e,i,o)=>{e.spec.marks?l.syncToMarks(e.spec.marks,n,t):e.type.side>=0&&!o&&l.syncToMarks(i==this.node.childCount?gt.none:this.node.child(i).marks,n,t),l.placeWidget(e,t,r)}),((e,o,a,c)=>{let h;l.syncToMarks(e.marks,n,t),l.findNodeMatch(e,o,a,c)||s&&t.state.selection.from>r&&t.state.selection.to<r+e.nodeSize&&(h=l.findIndexWithChild(i.node))>-1&&l.updateNodeAt(e,o,a,h,t)||l.updateNextNode(e,o,a,t,c,r)||l.addNode(e,o,a,t,r),r+=e.nodeSize})),l.syncToMarks([],n,t),this.node.isTextblock&&l.addTextblockHacks(),l.destroyRest(),(l.changed||2==this.dirty)&&(o&&this.protectLocalComposition(t,o),Ar(this.contentDOM,this.children,t),Kn&&function(t){if("UL"==t.nodeName||"OL"==t.nodeName){let e=t.style.cssText;t.style.cssText=e+"; list-style: square !important",window.getComputedStyle(t).listStyle,t.style.cssText=e}}(this.dom))}localCompositionInfo(t,e){let{from:n,to:r}=t.state.selection;if(!(t.state.selection instanceof nn)||n<e||r>e+this.node.content.size)return null;let i=t.domSelectionRange(),o=function(t,e){for(;;){if(3==t.nodeType)return t;if(1==t.nodeType&&e>0){if(t.childNodes.length>e&&3==t.childNodes[e].nodeType)return t.childNodes[e];e=Tn(t=t.childNodes[e-1])}else{if(!(1==t.nodeType&&e<t.childNodes.length))return null;t=t.childNodes[e],e=0}}}(i.focusNode,i.focusOffset);if(!o||!this.dom.contains(o.parentNode))return null;if(this.node.inlineContent){let t=o.nodeValue,i=function(t,e,n,r){for(let i=0,o=0;i<t.childCount&&o<=r;){let s=t.child(i++),l=o;if(o+=s.nodeSize,!s.isText)continue;let a=s.text;for(;i<t.childCount;){let e=t.child(i++);if(o+=e.nodeSize,!e.isText)break;a+=e.text}if(o>=n){if(o>=r&&a.slice(r-e.length-l,r-l)==e)return r-e.length;let t=l<r?a.lastIndexOf(e,r-l-1):-1;if(t>=0&&t+e.length+l>=n)return l+t;if(n==r&&a.length>=r+e.length-l&&a.slice(r-l,r-l+e.length)==e)return r}}return-1}(this.node.content,t,n-e,r-e);return i<0?null:{node:o,pos:i,text:t}}return{node:o,pos:-1,text:""}}protectLocalComposition(t,{node:e,pos:n,text:r}){if(this.getDesc(e))return;let i=e;for(;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&(i.pmViewDesc=void 0)}let o=new kr(this,i,e,r);t.input.compositionNodes.push(o),this.children=Fr(this.children,n,n+r.length,t,o)}update(t,e,n,r){return!(3==this.dirty||!t.sameMarkup(this.node))&&(this.updateInner(t,e,n,r),!0)}updateInner(t,e,n,r){this.updateOuterDeco(e),this.node=t,this.innerDeco=n,this.contentDOM&&this.updateChildren(r,this.posAtStart),this.dirty=0}updateOuterDeco(t){if(_r(t,this.outerDeco))return;let e=1!=this.nodeDOM.nodeType,n=this.dom;this.dom=Ir(this.dom,this.nodeDOM,Pr(this.outerDeco,this.node,e),Pr(t,this.node,e)),this.dom!=n&&(n.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=t}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 Cr(t,e,n,r,i){zr(r,e,t);let o=new Or(void 0,t,e,n,r,r,r,i,0);return o.contentDOM&&o.updateChildren(i,0),o}class Dr extends Or{constructor(t,e,n,r,i,o,s){super(t,e,n,r,i,null,o,s,0)}parseRule(){let t=this.nodeDOM.parentNode;for(;t&&t!=this.dom&&!t.pmIsDeco;)t=t.parentNode;return{skip:t||!0}}update(t,e,n,r){return!(3==this.dirty||0!=this.dirty&&!this.inParent()||!t.sameMarkup(this.node))&&(this.updateOuterDeco(e),0==this.dirty&&t.text==this.node.text||t.text==this.nodeDOM.nodeValue||(this.nodeDOM.nodeValue=t.text,r.trackWrites==this.nodeDOM&&(r.trackWrites=null)),this.node=t,this.dirty=0,!0)}inParent(){let t=this.parent.contentDOM;for(let e=this.nodeDOM;e;e=e.parentNode)if(e==t)return!0;return!1}domFromPos(t){return{node:this.nodeDOM,offset:t}}localPosFromDOM(t,e,n){return t==this.nodeDOM?this.posAtStart+Math.min(e,this.node.text.length):super.localPosFromDOM(t,e,n)}ignoreMutation(t){return"characterData"!=t.type&&"selection"!=t.type}slice(t,e,n){let r=this.node.cut(t,e),i=document.createTextNode(r.text);return new Dr(this.parent,r,this.outerDeco,this.innerDeco,i,i,n)}markDirty(t,e){super.markDirty(t,e),this.dom==this.nodeDOM||0!=t&&e!=this.nodeDOM.nodeValue.length||(this.dirty=3)}get domAtom(){return!1}}class Nr extends xr{parseRule(){return{ignore:!0}}matchesHack(t){return 0==this.dirty&&this.dom.nodeName==t}get domAtom(){return!0}get ignoreForCoords(){return"IMG"==this.dom.nodeName}}class Tr extends Or{constructor(t,e,n,r,i,o,s,l,a,c){super(t,e,n,r,i,o,s,a,c),this.spec=l}update(t,e,n,r){if(3==this.dirty)return!1;if(this.spec.update){let i=this.spec.update(t,e,n);return i&&this.updateInner(t,e,n,r),i}return!(!this.contentDOM&&!t.isLeaf)&&super.update(t,e,n,r)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(t,e,n,r){this.spec.setSelection?this.spec.setSelection(t,e,n):super.setSelection(t,e,n,r)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(t){return!!this.spec.stopEvent&&this.spec.stopEvent(t)}ignoreMutation(t){return this.spec.ignoreMutation?this.spec.ignoreMutation(t):super.ignoreMutation(t)}}function Ar(t,e,n){let r=t.firstChild,i=!1;for(let o=0;o<e.length;o++){let s=e[o],l=s.dom;if(l.parentNode==t){for(;l!=r;)r=Br(r),i=!0;r=r.nextSibling}else i=!0,t.insertBefore(l,r);if(s instanceof Mr){let e=r?r.previousSibling:t.lastChild;Ar(s.contentDOM,s.children,n),r=e?e.nextSibling:t.firstChild}}for(;r;)r=Br(r),i=!0;i&&n.trackWrites==t&&(n.trackWrites=null)}const Er=function(t){t&&(this.nodeName=t)};Er.prototype=Object.create(null);const $r=[new Er];function Pr(t,e,n){if(0==t.length)return $r;let r=n?$r[0]:new Er,i=[r];for(let o=0;o<t.length;o++){let s=t[o].type.attrs;if(s){s.nodeName&&i.push(r=new Er(s.nodeName));for(let t in s){let o=s[t];null!=o&&(n&&1==i.length&&i.push(r=new Er(e.isInline?"span":"div")),"class"==t?r.class=(r.class?r.class+" ":"")+o:"style"==t?r.style=(r.style?r.style+";":"")+o:"nodeName"!=t&&(r[t]=o))}}}return i}function Ir(t,e,n,r){if(n==$r&&r==$r)return e;let i=e;for(let o=0;o<r.length;o++){let e=r[o],s=n[o];if(o){let n;s&&s.nodeName==e.nodeName&&i!=t&&(n=i.parentNode)&&n.nodeName.toLowerCase()==e.nodeName||(n=document.createElement(e.nodeName),n.pmIsDeco=!0,n.appendChild(i),s=$r[0]),i=n}Rr(i,s||$r[0],e)}return i}function Rr(t,e,n){for(let r in e)"class"==r||"style"==r||"nodeName"==r||r in n||t.removeAttribute(r);for(let r in n)"class"!=r&&"style"!=r&&"nodeName"!=r&&n[r]!=e[r]&&t.setAttribute(r,n[r]);if(e.class!=n.class){let r=e.class?e.class.split(" ").filter(Boolean):[],i=n.class?n.class.split(" ").filter(Boolean):[];for(let e=0;e<r.length;e++)-1==i.indexOf(r[e])&&t.classList.remove(r[e]);for(let e=0;e<i.length;e++)-1==r.indexOf(i[e])&&t.classList.add(i[e]);0==t.classList.length&&t.removeAttribute("class")}if(e.style!=n.style){if(e.style){let n,r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g;for(;n=r.exec(e.style);)t.style.removeProperty(n[1])}n.style&&(t.style.cssText+=n.style)}}function zr(t,e,n){return Ir(t,t,$r,Pr(e,n,1!=t.nodeType))}function _r(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(!t[n].type.eq(e[n].type))return!1;return!0}function Br(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class jr{constructor(t,e,n){this.lock=e,this.view=n,this.index=0,this.stack=[],this.changed=!1,this.top=t,this.preMatch=function(t,e){let n=e,r=n.children.length,i=t.childCount,o=new Map,s=[];t:for(;i>0;){let l;for(;;)if(r){let t=n.children[r-1];if(!(t instanceof Mr)){l=t,r--;break}n=t,r=t.children.length}else{if(n==e)break t;r=n.parent.children.indexOf(n),n=n.parent}let a=l.node;if(a){if(a!=t.child(i-1))break;--i,o.set(l,i),s.push(l)}}return{index:i,matched:o,matches:s.reverse()}}(t.node.content,t)}destroyBetween(t,e){if(t!=e){for(let n=t;n<e;n++)this.top.children[n].destroy();this.top.children.splice(t,e-t),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(t,e,n){let r=0,i=this.stack.length>>1,o=Math.min(i,t.length);for(;r<o&&(r==i-1?this.top:this.stack[r+1<<1]).matchesMark(t[r])&&!1!==t[r].type.spec.spanning;)r++;for(;r<i;)this.destroyRest(),this.top.dirty=0,this.index=this.stack.pop(),this.top=this.stack.pop(),i--;for(;i<t.length;){this.stack.push(this.top,this.index+1);let r=-1;for(let e=this.index;e<Math.min(this.index+3,this.top.children.length);e++){let n=this.top.children[e];if(n.matchesMark(t[i])&&!this.isLocked(n.dom)){r=e;break}}if(r>-1)r>this.index&&(this.changed=!0,this.destroyBetween(this.index,r)),this.top=this.top.children[this.index];else{let r=Mr.create(this.top,t[i],e,n);this.top.children.splice(this.index,0,r),this.top=r,this.changed=!0}this.index=0,i++}}findNodeMatch(t,e,n,r){let i,o=-1;if(r>=this.preMatch.index&&(i=this.preMatch.matches[r-this.preMatch.index]).parent==this.top&&i.matchesNode(t,e,n))o=this.top.children.indexOf(i,this.index);else for(let s=this.index,l=Math.min(this.top.children.length,s+5);s<l;s++){let r=this.top.children[s];if(r.matchesNode(t,e,n)&&!this.preMatch.matched.has(r)){o=s;break}}return!(o<0)&&(this.destroyBetween(this.index,o),this.index++,!0)}updateNodeAt(t,e,n,r,i){let o=this.top.children[r];return 3==o.dirty&&o.dom==o.contentDOM&&(o.dirty=2),!!o.update(t,e,n,i)&&(this.destroyBetween(this.index,r),this.index++,!0)}findIndexWithChild(t){for(;;){let e=t.parentNode;if(!e)return-1;if(e==this.top.contentDOM){let e=t.pmViewDesc;if(e)for(let t=this.index;t<this.top.children.length;t++)if(this.top.children[t]==e)return t;return-1}t=e}}updateNextNode(t,e,n,r,i,o){for(let s=this.index;s<this.top.children.length;s++){let l=this.top.children[s];if(l instanceof Or){let a=this.preMatch.matched.get(l);if(null!=a&&a!=i)return!1;let c,h=l.dom,u=this.isLocked(h)&&!(t.isText&&l.node&&l.node.isText&&l.nodeDOM.nodeValue==t.text&&3!=l.dirty&&_r(e,l.outerDeco));if(!u&&l.update(t,e,n,r))return this.destroyBetween(this.index,s),l.dom!=h&&(this.changed=!0),this.index++,!0;if(!u&&(c=this.recreateWrapper(l,t,e,n,r,o)))return this.top.children[this.index]=c,c.contentDOM&&(c.dirty=2,c.updateChildren(r,o+1),c.dirty=0),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(t,e,n,r,i,o){if(t.dirty||e.isAtom||!t.children.length||!t.node.content.eq(e.content))return null;let s=Or.create(this.top,e,n,r,i,o);if(s.contentDOM){s.children=t.children,t.children=[];for(let t of s.children)t.parent=s}return t.destroy(),s}addNode(t,e,n,r,i){let o=Or.create(this.top,t,e,n,r,i);o.contentDOM&&o.updateChildren(r,i+1),this.top.children.splice(this.index++,0,o),this.changed=!0}placeWidget(t,e,n){let r=this.index<this.top.children.length?this.top.children[this.index]:null;if(!r||!r.matchesWidget(t)||t!=r.widget&&r.widget.type.toDOM.parentNode){let r=new Sr(this.top,t,e,n);this.top.children.splice(this.index++,0,r),this.changed=!0}else this.index++}addTextblockHacks(){let t=this.top.children[this.index-1],e=this.top;for(;t instanceof Mr;)e=t,t=e.children[e.children.length-1];(!t||!(t instanceof Dr)||/\n$/.test(t.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(t.node.text))&&((Jn||Wn)&&t&&"false"==t.dom.contentEditable&&this.addHackNode("IMG",e),this.addHackNode("BR",this.top))}addHackNode(t,e){if(e==this.top&&this.index<e.children.length&&e.children[this.index].matchesHack(t))this.index++;else{let n=document.createElement(t);"IMG"==t&&(n.className="ProseMirror-separator",n.alt=""),"BR"==t&&(n.className="ProseMirror-trailingBreak");let r=new Nr(this.top,[],n,null);e!=this.top?e.children.push(r):e.children.splice(this.index++,0,r),this.changed=!0}}isLocked(t){return this.lock&&(t==this.lock||1==t.nodeType&&t.contains(this.lock.parentNode))}}function Vr(t,e){return t.type.side-e.type.side}function Fr(t,e,n,r,i){let o=[];for(let s=0,l=0;s<t.length;s++){let a=t[s],c=l,h=l+=a.size;c>=n||h<=e?o.push(a):(c<e&&o.push(a.slice(0,e-c,r)),i&&(o.push(i),i=void 0),h>n&&o.push(a.slice(n-c,a.size,r)))}return o}function Lr(t,e=null){let n=t.domSelectionRange(),r=t.state.doc;if(!n.focusNode)return null;let i=t.docView.nearestDesc(n.focusNode),o=i&&0==i.size,s=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(s<0)return null;let l,a,c=r.resolve(s);if(En(n)){for(l=c;i&&!i.node;)i=i.parent;let t=i.node;if(i&&t.isAtom&&on.isSelectable(t)&&i.parent&&(!t.isInline||!function(t,e,n){for(let r=0==e,i=e==Tn(t);r||i;){if(t==n)return!0;let e=Sn(t);if(!(t=t.parentNode))return!1;r=r&&0==e,i=i&&e==Tn(t)}}(n.focusNode,n.focusOffset,i.dom))){let t=i.posBefore;a=new on(s==t?c:r.resolve(t))}}else{let e=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(e<0)return null;l=r.resolve(e)}if(!a){a=Zr(t,l,c,"pointer"==e||t.state.selection.head<c.pos&&!o?1:-1)}return a}function Wr(t){return t.editable?t.hasFocus():Qr(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function qr(t,e=!1){let n=t.state.selection;if(Ur(t,n),Wr(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&Wn){let e=t.domSelectionRange(),n=t.domObserver.currentSelection;if(e.anchorNode&&n.anchorNode&&Cn(e.anchorNode,e.anchorOffset,n.anchorNode,n.anchorOffset))return t.input.mouseDown.delayedSelectionSync=!0,void t.domObserver.setCurSelection()}if(t.domObserver.disconnectSelection(),t.cursorWrapper)!function(t){let e=t.domSelection(),n=document.createRange(),r=t.cursorWrapper.dom,i="IMG"==r.nodeName;i?n.setEnd(r.parentNode,Sn(r)+1):n.setEnd(r,0);n.collapse(!1),e.removeAllRanges(),e.addRange(n),!i&&!t.state.selection.visible&&jn&&Vn<=11&&(r.disabled=!0,r.disabled=!1)}(t);else{let r,i,{anchor:o,head:s}=n;!Jr||n instanceof nn||(n.$from.parent.inlineContent||(r=Kr(t,n.from)),n.empty||n.$from.parent.inlineContent||(i=Kr(t,n.to))),t.docView.setSelection(o,s,t.root,e),Jr&&(r&&Yr(r),i&&Yr(i)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&function(t){let e=t.dom.ownerDocument;e.removeEventListener("selectionchange",t.input.hideSelectionGuard);let n=t.domSelectionRange(),r=n.anchorNode,i=n.anchorOffset;e.addEventListener("selectionchange",t.input.hideSelectionGuard=()=>{n.anchorNode==r&&n.anchorOffset==i||(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout((()=>{Wr(t)&&!t.state.selection.visible||t.dom.classList.remove("ProseMirror-hideselection")}),20))})}(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const Jr=Jn||Wn&&qn<63;function Kr(t,e){let{node:n,offset:r}=t.docView.domFromPos(e,0),i=r<n.childNodes.length?n.childNodes[r]:null,o=r?n.childNodes[r-1]:null;if(Jn&&i&&"false"==i.contentEditable)return Hr(i);if(!(i&&"false"!=i.contentEditable||o&&"false"!=o.contentEditable)){if(i)return Hr(i);if(o)return Hr(o)}}function Hr(t){return t.contentEditable="true",Jn&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function Yr(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function Ur(t,e){if(e instanceof on){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(Gr(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else Gr(t)}function Gr(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function Zr(t,e,n,r){return t.someProp("createSelectionBetween",(r=>r(t,e,n)))||nn.between(e,n,r)}function Xr(t){return!(t.editable&&!t.hasFocus())&&Qr(t)}function Qr(t){let e=t.domSelectionRange();if(!e.anchorNode)return!1;try{return t.dom.contains(3==e.anchorNode.nodeType?e.anchorNode.parentNode:e.anchorNode)&&(t.editable||t.dom.contains(3==e.focusNode.nodeType?e.focusNode.parentNode:e.focusNode))}catch(n){return!1}}function ti(t,e){let{$anchor:n,$head:r}=t.selection,i=e>0?n.max(r):n.min(r),o=i.parent.inlineContent?i.depth?t.doc.resolve(e>0?i.after():i.before()):null:i;return o&&Xe.findFrom(o,e)}function ei(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function ni(t,e,n){let r=t.state.selection;if(!(r instanceof nn)){if(r instanceof on&&r.node.isInline)return ei(t,new nn(e>0?r.$to:r.$from));{let n=ti(t.state,e);return!!n&&ei(t,n)}}if(n.indexOf("s")>-1){let{$head:n}=r,i=n.textOffset?null:e<0?n.nodeBefore:n.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let o=t.state.doc.resolve(n.pos+i.nodeSize*(e<0?-1:1));return ei(t,new nn(r.$anchor,o))}if(!r.empty)return!1;if(t.endOfTextblock(e>0?"forward":"backward")){let n=ti(t.state,e);return!!(n&&n instanceof on)&&ei(t,n)}if(!(Hn&&n.indexOf("m")>-1)){let n,i=r.$head,o=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter;if(!o||o.isText)return!1;let s=e<0?i.pos-o.nodeSize:i.pos;return!!(o.isAtom||(n=t.docView.descAt(s))&&!n.contentDOM)&&(on.isSelectable(o)?ei(t,new on(e<0?t.state.doc.resolve(i.pos-o.nodeSize):i)):!!Gn&&ei(t,new nn(t.state.doc.resolve(e<0?s:s+o.nodeSize))))}}function ri(t){return 3==t.nodeType?t.nodeValue.length:t.childNodes.length}function ii(t,e){let n=t.pmViewDesc;return n&&0==n.size&&(e<0||t.nextSibling||"BR"!=t.nodeName)}function oi(t,e){return e<0?function(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i,o,s=!1;Fn&&1==n.nodeType&&r<ri(n)&&ii(n.childNodes[r],-1)&&(s=!0);for(;;)if(r>0){if(1!=n.nodeType)break;{let t=n.childNodes[r-1];if(ii(t,-1))i=n,o=--r;else{if(3!=t.nodeType)break;n=t,r=n.nodeValue.length}}}else{if(si(n))break;{let e=n.previousSibling;for(;e&&ii(e,-1);)i=n.parentNode,o=Sn(e),e=e.previousSibling;if(e)n=e,r=ri(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}s?li(t,n,r):i&&li(t,i,o)}(t):function(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i,o,s=ri(n);for(;;)if(r<s){if(1!=n.nodeType)break;if(!ii(n.childNodes[r],1))break;i=n,o=++r}else{if(si(n))break;{let e=n.nextSibling;for(;e&&ii(e,1);)i=e.parentNode,o=Sn(e)+1,e=e.nextSibling;if(e)n=e,r=0,s=ri(n);else{if(n=n.parentNode,n==t.dom)break;r=s=0}}}i&&li(t,i,o)}(t)}function si(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function li(t,e,n){if(3!=e.nodeType){let t,r;(r=function(t,e){for(;t&&e==t.childNodes.length&&!An(t);)e=Sn(t)+1,t=t.parentNode;for(;t&&e<t.childNodes.length;){let n=t.childNodes[e];if(3==n.nodeType)return n;if(1==n.nodeType&&"false"==n.contentEditable)break;t=n,e=0}}(e,n))?(e=r,n=0):(t=function(t,e){for(;t&&!e&&!An(t);)e=Sn(t),t=t.parentNode;for(;t&&e;){let n=t.childNodes[e-1];if(3==n.nodeType)return n;if(1==n.nodeType&&"false"==n.contentEditable)break;e=(t=n).childNodes.length}}(e,n))&&(e=t,n=t.nodeValue.length)}let r=t.domSelection();if(En(r)){let t=document.createRange();t.setEnd(e,n),t.setStart(e,n),r.removeAllRanges(),r.addRange(t)}else r.extend&&r.extend(e,n);t.domObserver.setCurSelection();let{state:i}=t;setTimeout((()=>{t.state==i&&qr(t)}),50)}function ai(t,e){let n=t.state.doc.resolve(e);if(!Wn&&!Yn&&n.parent.inlineContent){let r=t.coordsAtPos(e);if(e>n.start()){let n=t.coordsAtPos(e-1),i=(n.top+n.bottom)/2;if(i>r.top&&i<r.bottom&&Math.abs(n.left-r.left)>1)return n.left<r.left?"ltr":"rtl"}if(e<n.end()){let n=t.coordsAtPos(e+1),i=(n.top+n.bottom)/2;if(i>r.top&&i<r.bottom&&Math.abs(n.left-r.left)>1)return n.left>r.left?"ltr":"rtl"}}return"rtl"==getComputedStyle(t.dom).direction?"rtl":"ltr"}function ci(t,e,n){let r=t.state.selection;if(r instanceof nn&&!r.empty||n.indexOf("s")>-1)return!1;if(Hn&&n.indexOf("m")>-1)return!1;let{$from:i,$to:o}=r;if(!i.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let n=ti(t.state,e);if(n&&n instanceof on)return ei(t,n)}if(!i.parent.inlineContent){let n=e<0?i:o,s=r instanceof ln?Xe.near(n,e):Xe.findFrom(n,e);return!!s&&ei(t,s)}return!1}function hi(t,e){if(!(t.state.selection instanceof nn))return!0;let{$head:n,$anchor:r,empty:i}=t.state.selection;if(!n.sameParent(r))return!0;if(!i)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let o=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(o&&!o.isText){let r=t.state.tr;return e<0?r.delete(n.pos-o.nodeSize,n.pos):r.delete(n.pos,n.pos+o.nodeSize),t.dispatch(r),!0}return!1}function ui(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function di(t,e){let n=e.keyCode,r=function(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}(e);if(8==n||Hn&&72==n&&"c"==r)return hi(t,-1)||oi(t,-1);if(46==n&&!e.shiftKey||Hn&&68==n&&"c"==r)return hi(t,1)||oi(t,1);if(13==n||27==n)return!0;if(37==n||Hn&&66==n&&"c"==r){let e=37==n?"ltr"==ai(t,t.state.selection.from)?-1:1:-1;return ni(t,e,r)||oi(t,e)}if(39==n||Hn&&70==n&&"c"==r){let e=39==n?"ltr"==ai(t,t.state.selection.from)?1:-1:1;return ni(t,e,r)||oi(t,e)}return 38==n||Hn&&80==n&&"c"==r?ci(t,-1,r)||oi(t,-1):40==n||Hn&&78==n&&"c"==r?function(t){if(!Jn||t.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(e&&1==e.nodeType&&0==n&&e.firstChild&&"false"==e.firstChild.contentEditable){let n=e.firstChild;ui(t,n,"true"),setTimeout((()=>ui(t,n,"false")),20)}return!1}(t)||ci(t,1,r)||oi(t,1):r==(Hn?"m":"c")&&(66==n||73==n||89==n||90==n)}function fi(t,e){t.someProp("transformCopied",(n=>{e=n(e,t)}));let n=[],{content:r,openStart:i,openEnd:o}=e;for(;i>1&&o>1&&1==r.childCount&&1==r.firstChild.childCount;){i--,o--;let t=r.firstChild;n.push(t.type.name,t.attrs!=t.type.defaultAttrs?t.attrs:null),r=t.content}let s=t.someProp("clipboardSerializer")||de.fromSchema(t.state.schema),l=ki(),a=l.createElement("div");a.appendChild(s.serializeFragment(r,{document:l}));let c,h=a.firstChild,u=0;for(;h&&1==h.nodeType&&(c=xi[h.nodeName.toLowerCase()]);){for(let t=c.length-1;t>=0;t--){let e=l.createElement(c[t]);for(;a.firstChild;)e.appendChild(a.firstChild);a.appendChild(e),u++}h=a.firstChild}return h&&1==h.nodeType&&h.setAttribute("data-pm-slice",`${i} ${o}${u?` -${u}`:""} ${JSON.stringify(n)}`),{dom:a,text:t.someProp("clipboardTextSerializer",(n=>n(e,t)))||e.content.textBetween(0,e.content.size,"\n\n")}}function pi(t,e,n,r,i){let o,s,l=i.parent.type.spec.code;if(!n&&!e)return null;let a=e&&(r||l||!n);if(a){if(t.someProp("transformPastedText",(n=>{e=n(e,l||r,t)})),l)return e?new vt(dt.from(t.state.schema.text(e.replace(/\r\n?/g,"\n"))),0,0):vt.empty;let n=t.someProp("clipboardTextParser",(n=>n(e,i,r,t)));if(n)s=n;else{let n=i.marks(),{schema:r}=t.state,s=de.fromSchema(r);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach((t=>{let e=o.appendChild(document.createElement("p"));t&&e.appendChild(s.serializeNode(r.text(t,n)))}))}}else t.someProp("transformPastedHTML",(e=>{n=e(n,t)})),o=function(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n,r=ki().createElement("div"),i=/<([a-z][^>\s]+)/i.exec(t);(n=i&&xi[i[1].toLowerCase()])&&(t=n.map((t=>"<"+t+">")).join("")+t+n.map((t=>"</"+t+">")).reverse().join(""));if(r.innerHTML=t,n)for(let o=0;o<n.length;o++)r=r.querySelector(n[o])||r;return r}(n),Gn&&function(t){let e=t.querySelectorAll(Wn?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<e.length;n++){let r=e[n];1==r.childNodes.length&&" "==r.textContent&&r.parentNode&&r.parentNode.replaceChild(t.ownerDocument.createTextNode(" "),r)}}(o);let c=o&&o.querySelector("[data-pm-slice]"),h=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(h&&h[3])for(let u=+h[3];u>0;u--){let t=o.firstChild;for(;t&&1!=t.nodeType;)t=t.nextSibling;if(!t)break;o=t}if(!s){let e=t.someProp("clipboardParser")||t.someProp("domParser")||ne.fromSchema(t.state.schema);s=e.parseSlice(o,{preserveWhitespace:!(!a&&!h),context:i,ruleFromNode:t=>"BR"!=t.nodeName||t.nextSibling||!t.parentNode||mi.test(t.parentNode.nodeName)?null:{ignore:!0}})}if(h)s=function(t,e){if(!t.size)return t;let n,r=t.content.firstChild.type.schema;try{n=JSON.parse(e)}catch(l){return t}let{content:i,openStart:o,openEnd:s}=t;for(let a=n.length-2;a>=0;a-=2){let t=r.nodes[n[a]];if(!t||t.hasRequiredAttrs())break;i=dt.from(t.create(n[a+1],i)),o++,s++}return new vt(i,o,s)}(bi(s,+h[1],+h[2]),h[4]);else if(s=vt.maxOpen(function(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let r,i=e.node(n).contentMatchAt(e.index(n)),o=[];if(t.forEach((t=>{if(!o)return;let e,n=i.findWrapping(t.type);if(!n)return o=null;if(e=o.length&&r.length&&yi(n,r,t,o[o.length-1],0))o[o.length-1]=e;else{o.length&&(o[o.length-1]=vi(o[o.length-1],r.length));let e=gi(t,n);o.push(e),i=i.matchType(e.type),r=n}})),o)return dt.from(o)}return t}(s.content,i),!0),s.openStart||s.openEnd){let t=0,e=0;for(let n=s.content.firstChild;t<s.openStart&&!n.type.spec.isolating;t++,n=n.firstChild);for(let n=s.content.lastChild;e<s.openEnd&&!n.type.spec.isolating;e++,n=n.lastChild);s=bi(s,t,e)}return t.someProp("transformPasted",(e=>{s=e(s,t)})),s}const mi=/^(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 gi(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,dt.from(t));return t}function yi(t,e,n,r,i){if(i<t.length&&i<e.length&&t[i]==e[i]){let o=yi(t,e,n,r.lastChild,i+1);if(o)return r.copy(r.content.replaceChild(r.childCount-1,o));if(r.contentMatchAt(r.childCount).matchType(i==t.length-1?n.type:t[i+1]))return r.copy(r.content.append(dt.from(gi(n,t,i+1))))}}function vi(t,e){if(0==e)return t;let n=t.content.replaceChild(t.childCount-1,vi(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(dt.empty,!0);return t.copy(n.append(r))}function wi(t,e,n,r,i,o){let s=e<0?t.firstChild:t.lastChild,l=s.content;return t.childCount>1&&(o=0),i<r-1&&(l=wi(l,e,n,r,i+1,o)),i>=n&&(l=e<0?s.contentMatchAt(0).fillBefore(l,o<=i).append(l):l.append(s.contentMatchAt(s.childCount).fillBefore(dt.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,s.copy(l))}function bi(t,e,n){return e<t.openStart&&(t=new vt(wi(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new vt(wi(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const xi={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 Si=null;function ki(){return Si||(Si=document.implementation.createHTMLDocument("title"))}const Mi={},Oi={},Ci={touchstart:!0,touchmove:!0};class Di{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.lastAndroidDelete=0,this.composing=!1,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 Ni(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function Ti(t){t.someProp("handleDOMEvents",(e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=e=>Ai(t,e))}))}function Ai(t,e){return t.someProp("handleDOMEvents",(n=>{let r=n[e.type];return!!r&&(r(t,e)||e.defaultPrevented)}))}function Ei(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target;n!=t.dom;n=n.parentNode)if(!n||11==n.nodeType||n.pmViewDesc&&n.pmViewDesc.stopEvent(e))return!1;return!0}function $i(t){return{left:t.clientX,top:t.clientY}}function Pi(t,e,n,r,i){if(-1==r)return!1;let o=t.state.doc.resolve(r);for(let s=o.depth+1;s>0;s--)if(t.someProp(e,(e=>s>o.depth?e(t,n,o.nodeAfter,o.before(s),i,!0):e(t,n,o.node(s),o.before(s),i,!1))))return!0;return!1}function Ii(t,e,n){t.focused||t.focus();let r=t.state.tr.setSelection(e);"pointer"==n&&r.setMeta("pointer",!0),t.dispatch(r)}function Ri(t,e,n,r,i){return Pi(t,"handleClickOn",e,n,r)||t.someProp("handleClick",(n=>n(t,e,r)))||(i?function(t,e){if(-1==e)return!1;let n,r,i=t.state.selection;i instanceof on&&(n=i.node);let o=t.state.doc.resolve(e);for(let s=o.depth+1;s>0;s--){let t=s>o.depth?o.nodeAfter:o.node(s);if(on.isSelectable(t)){r=n&&i.$from.depth>0&&s>=i.$from.depth&&o.before(i.$from.depth+1)==i.$from.pos?o.before(i.$from.depth):o.before(s);break}}return null!=r&&(Ii(t,on.create(t.state.doc,r),"pointer"),!0)}(t,n):function(t,e){if(-1==e)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return!!(r&&r.isAtom&&on.isSelectable(r))&&(Ii(t,new on(n),"pointer"),!0)}(t,n))}function zi(t,e,n,r){return Pi(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",(n=>n(t,e,r)))}function _i(t,e,n,r){return Pi(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",(n=>n(t,e,r)))||function(t,e,n){if(0!=n.button)return!1;let r=t.state.doc;if(-1==e)return!!r.inlineContent&&(Ii(t,nn.create(r,0,r.content.size),"pointer"),!0);let i=r.resolve(e);for(let o=i.depth+1;o>0;o--){let e=o>i.depth?i.nodeAfter:i.node(o),n=i.before(o);if(e.inlineContent)Ii(t,nn.create(r,n+1,n+1+e.content.size),"pointer");else{if(!on.isSelectable(e))continue;Ii(t,on.create(r,n),"pointer")}return!0}}(t,n,r)}function Bi(t){return Ji(t)}Oi.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=16==n.keyCode||n.shiftKey,!Fi(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!Un||!Wn||13!=n.keyCode))if(229!=n.keyCode&&t.domObserver.forceFlush(),!Kn||13!=n.keyCode||n.ctrlKey||n.altKey||n.metaKey)t.someProp("handleKeyDown",(e=>e(t,n)))||di(t,n)?n.preventDefault():Ni(t,"key");else{let e=Date.now();t.input.lastIOSEnter=e,t.input.lastIOSEnterFallbackTimeout=setTimeout((()=>{t.input.lastIOSEnter==e&&(t.someProp("handleKeyDown",(e=>e(t,$n(13,"Enter")))),t.input.lastIOSEnter=0)}),200)}},Oi.keyup=(t,e)=>{16==e.keyCode&&(t.input.shiftKey=!1)},Oi.keypress=(t,e)=>{let n=e;if(Fi(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||Hn&&n.metaKey)return;if(t.someProp("handleKeyPress",(e=>e(t,n))))return void n.preventDefault();let r=t.state.selection;if(!(r instanceof nn&&r.$from.sameParent(r.$to))){let e=String.fromCharCode(n.charCode);/[\r\n]/.test(e)||t.someProp("handleTextInput",(n=>n(t,r.$from.pos,r.$to.pos,e)))||t.dispatch(t.state.tr.insertText(e).scrollIntoView()),n.preventDefault()}};const ji=Hn?"metaKey":"ctrlKey";Mi.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=Bi(t),i=Date.now(),o="singleClick";i-t.input.lastClick.time<500&&function(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}(n,t.input.lastClick)&&!n[ji]&&("singleClick"==t.input.lastClick.type?o="doubleClick":"doubleClick"==t.input.lastClick.type&&(o="tripleClick")),t.input.lastClick={time:i,x:n.clientX,y:n.clientY,type:o};let s=t.posAtCoords($i(n));s&&("singleClick"==o?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new Vi(t,s,n,!!r)):("doubleClick"==o?zi:_i)(t,s.pos,s.inside,n)?n.preventDefault():Ni(t,"pointer"))};class Vi{constructor(t,e,n,r){let i,o;if(this.view=t,this.pos=e,this.event=n,this.flushed=r,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=t.state.doc,this.selectNode=!!n[ji],this.allowDefault=n.shiftKey,e.inside>-1)i=t.state.doc.nodeAt(e.inside),o=e.inside;else{let n=t.state.doc.resolve(e.pos);i=n.parent,o=n.depth?n.before():0}const s=r?null:n.target,l=s?t.docView.nearestDesc(s,!0):null;this.target=l?l.dom:null;let{selection:a}=t.state;(0==n.button&&i.type.spec.draggable&&!1!==i.type.spec.selectable||a instanceof on&&a.from<=o&&a.to>o)&&(this.mightDrag={node:i,pos:o,addAttr:!(!this.target||this.target.draggable),setUneditable:!(!this.target||!Fn||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()),t.root.addEventListener("mouseup",this.up=this.up.bind(this)),t.root.addEventListener("mousemove",this.move=this.move.bind(this)),Ni(t,"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((()=>qr(this.view))),this.view.input.mouseDown=null}up(t){if(this.done(),!this.view.dom.contains(t.target))return;let e=this.pos;this.view.state.doc!=this.startDoc&&(e=this.view.posAtCoords($i(t))),this.updateAllowDefault(t),this.allowDefault||!e?Ni(this.view,"pointer"):Ri(this.view,e.pos,e.inside,t,this.selectNode)?t.preventDefault():0==t.button&&(this.flushed||Jn&&this.mightDrag&&!this.mightDrag.node.isAtom||Wn&&!this.view.state.selection.visible&&Math.min(Math.abs(e.pos-this.view.state.selection.from),Math.abs(e.pos-this.view.state.selection.to))<=2)?(Ii(this.view,Xe.near(this.view.state.doc.resolve(e.pos)),"pointer"),t.preventDefault()):Ni(this.view,"pointer")}move(t){this.updateAllowDefault(t),Ni(this.view,"pointer"),0==t.buttons&&this.done()}updateAllowDefault(t){!this.allowDefault&&(Math.abs(this.event.x-t.clientX)>4||Math.abs(this.event.y-t.clientY)>4)&&(this.allowDefault=!0)}}function Fi(t,e){return!!t.composing||!!(Jn&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500)&&(t.input.compositionEndedAt=-2e8,!0)}Mi.touchstart=t=>{t.input.lastTouch=Date.now(),Bi(t),Ni(t,"pointer")},Mi.touchmove=t=>{t.input.lastTouch=Date.now(),Ni(t,"pointer")},Mi.contextmenu=t=>Bi(t);const Li=Un?5e3:-1;function Wi(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout((()=>Ji(t)),e))}function qi(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=function(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function Ji(t,e=!1){if(!(Un&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),qi(t),e||t.docView&&t.docView.dirty){let e=Lr(t);return e&&!e.eq(t.state.selection)?t.dispatch(t.state.tr.setSelection(e)):t.updateState(t.state),!0}return!1}}Oi.compositionstart=Oi.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$from;if(e.selection.empty&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some((t=>!1===t.type.spec.inclusive))))t.markCursor=t.state.storedMarks||n.marks(),Ji(t,!0),t.markCursor=null;else if(Ji(t),Fn&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let e=t.domSelectionRange();for(let n=e.focusNode,r=e.focusOffset;n&&1==n.nodeType&&0!=r;){let e=r<0?n.lastChild:n.childNodes[r-1];if(!e)break;if(3==e.nodeType){t.domSelection().collapse(e,e.nodeValue.length);break}n=e,r=-1}}t.input.composing=!0}Wi(t,Li)},Oi.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=e.timeStamp,t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0,t.input.compositionPendingChanges&&Promise.resolve().then((()=>t.domObserver.flush())),t.input.compositionID++,Wi(t,20))};const Ki=jn&&Vn<15||Kn&&Zn<604;function Hi(t,e,n,r,i){let o=pi(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",(e=>e(t,i,o||vt.empty))))return!0;if(!o)return!1;let s=function(t){return 0==t.openStart&&0==t.openEnd&&1==t.content.childCount?t.content.firstChild:null}(o),l=s?t.state.tr.replaceSelectionWith(s,r):t.state.tr.replaceSelection(o);return t.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function Yi(t){let e=t.getData("text/plain")||t.getData("Text");if(e)return e;let n=t.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}Mi.copy=Oi.cut=(t,e)=>{let n=e,r=t.state.selection,i="cut"==n.type;if(r.empty)return;let o=Ki?null:n.clipboardData,s=r.content(),{dom:l,text:a}=fi(t,s);o?(n.preventDefault(),o.clearData(),o.setData("text/html",l.innerHTML),o.setData("text/plain",a)):function(t,e){if(!t.dom.parentNode)return;let n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),i=document.createRange();i.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout((()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()}),50)}(t,l),i&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))},Oi.paste=(t,e)=>{let n=e;if(t.composing&&!Un)return;let r=Ki?null:n.clipboardData,i=t.input.shiftKey&&45!=t.input.lastKeyCode;r&&Hi(t,Yi(r),r.getData("text/html"),i,n)?n.preventDefault():function(t,e){if(!t.dom.parentNode)return;let n=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,r=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let i=t.input.shiftKey&&45!=t.input.lastKeyCode;setTimeout((()=>{t.focus(),r.parentNode&&r.parentNode.removeChild(r),n?Hi(t,r.value,null,i,e):Hi(t,r.textContent,r.innerHTML,i,e)}),50)}(t,n)};class Ui{constructor(t,e,n){this.slice=t,this.move=e,this.node=n}}const Gi=Hn?"altKey":"ctrlKey";Mi.dragstart=(t,e)=>{let n=e,r=t.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let i,o=t.state.selection,s=o.empty?null:t.posAtCoords($i(n));if(s&&s.pos>=o.from&&s.pos<=(o instanceof on?o.to-1:o.to));else if(r&&r.mightDrag)i=on.create(t.state.doc,r.mightDrag.pos);else if(n.target&&1==n.target.nodeType){let e=t.docView.nearestDesc(n.target,!0);e&&e.node.type.spec.draggable&&e!=t.docView&&(i=on.create(t.state.doc,e.posBefore))}let l=(i||t.state.selection).content(),{dom:a,text:c}=fi(t,l);n.dataTransfer.clearData(),n.dataTransfer.setData(Ki?"Text":"text/html",a.innerHTML),n.dataTransfer.effectAllowed="copyMove",Ki||n.dataTransfer.setData("text/plain",c),t.dragging=new Ui(l,!n[Gi],i)},Mi.dragend=t=>{let e=t.dragging;window.setTimeout((()=>{t.dragging==e&&(t.dragging=null)}),50)},Oi.dragover=Oi.dragenter=(t,e)=>e.preventDefault(),Oi.drop=(t,e)=>{let n=e,r=t.dragging;if(t.dragging=null,!n.dataTransfer)return;let i=t.posAtCoords($i(n));if(!i)return;let o=t.state.doc.resolve(i.pos),s=r&&r.slice;s?t.someProp("transformPasted",(e=>{s=e(s,t)})):s=pi(t,Yi(n.dataTransfer),Ki?null:n.dataTransfer.getData("text/html"),!1,o);let l=!(!r||n[Gi]);if(t.someProp("handleDrop",(e=>e(t,n,s||vt.empty,l))))return void n.preventDefault();if(!s)return;n.preventDefault();let a=s?function(t,e,n){let r=t.resolve(e);if(!n.content.size)return e;let i=n.content;for(let o=0;o<n.openStart;o++)i=i.firstChild.content;for(let o=1;o<=(0==n.openStart&&n.size?2:1);o++)for(let t=r.depth;t>=0;t--){let e=t==r.depth?0:r.pos<=(r.start(t+1)+r.end(t+1))/2?-1:1,n=r.index(t)+(e>0?1:0),s=r.node(t),l=!1;if(1==o)l=s.canReplace(n,n,i);else{let t=s.contentMatchAt(n).findWrapping(i.firstChild.type);l=t&&s.canReplaceWith(n,n,t[0])}if(l)return 0==e?r.pos:e<0?r.before(t+1):r.after(t+1)}return null}(t.state.doc,o.pos,s):o.pos;null==a&&(a=o.pos);let c=t.state.tr;if(l){let{node:t}=r;t?t.replace(c):c.deleteSelection()}let h=c.mapping.map(a),u=0==s.openStart&&0==s.openEnd&&1==s.content.childCount,d=c.doc;if(u?c.replaceRangeWith(h,h,s.content.firstChild):c.replaceRange(h,h,s),c.doc.eq(d))return;let f=c.doc.resolve(h);if(u&&on.isSelectable(s.content.firstChild)&&f.nodeAfter&&f.nodeAfter.sameMarkup(s.content.firstChild))c.setSelection(new on(f));else{let e=c.mapping.map(a);c.mapping.maps[c.mapping.maps.length-1].forEach(((t,n,r,i)=>e=i)),c.setSelection(Zr(t,f,c.doc.resolve(e)))}t.focus(),t.dispatch(c.setMeta("uiEvent","drop"))},Mi.focus=t=>{t.input.lastFocus=Date.now(),t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout((()=>{t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.domSelectionRange())&&qr(t)}),20))},Mi.blur=(t,e)=>{let n=e;t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),n.relatedTarget&&t.dom.contains(n.relatedTarget)&&t.domObserver.currentSelection.clear(),t.focused=!1)},Mi.beforeinput=(t,e)=>{if(Wn&&Un&&"deleteContentBackward"==e.inputType){t.domObserver.flushSoon();let{domChangeCount:e}=t.input;setTimeout((()=>{if(t.input.domChangeCount!=e)return;if(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",(e=>e(t,$n(8,"Backspace")))))return;let{$cursor:n}=t.state.selection;n&&n.pos>0&&t.dispatch(t.state.tr.delete(n.pos-1,n.pos).scrollIntoView())}),50)}};for(let os in Oi)Mi[os]=Oi[os];function Zi(t,e){if(t==e)return!0;for(let n in t)if(t[n]!==e[n])return!1;for(let n in e)if(!(n in t))return!1;return!0}class Xi{constructor(t,e){this.toDOM=t,this.spec=e||ro,this.side=this.spec.side||0}map(t,e,n,r){let{pos:i,deleted:o}=t.mapResult(e.from+r,this.side<0?-1:1);return o?null:new eo(i-n,i-n,this)}valid(){return!0}eq(t){return this==t||t instanceof Xi&&(this.spec.key&&this.spec.key==t.spec.key||this.toDOM==t.toDOM&&Zi(this.spec,t.spec))}destroy(t){this.spec.destroy&&this.spec.destroy(t)}}class Qi{constructor(t,e){this.attrs=t,this.spec=e||ro}map(t,e,n,r){let i=t.map(e.from+r,this.spec.inclusiveStart?-1:1)-n,o=t.map(e.to+r,this.spec.inclusiveEnd?1:-1)-n;return i>=o?null:new eo(i,o,this)}valid(t,e){return e.from<e.to}eq(t){return this==t||t instanceof Qi&&Zi(this.attrs,t.attrs)&&Zi(this.spec,t.spec)}static is(t){return t.type instanceof Qi}destroy(){}}class to{constructor(t,e){this.attrs=t,this.spec=e||ro}map(t,e,n,r){let i=t.mapResult(e.from+r,1);if(i.deleted)return null;let o=t.mapResult(e.to+r,-1);return o.deleted||o.pos<=i.pos?null:new eo(i.pos-n,o.pos-n,this)}valid(t,e){let n,{index:r,offset:i}=t.content.findIndex(e.from);return i==e.from&&!(n=t.child(r)).isText&&i+n.nodeSize==e.to}eq(t){return this==t||t instanceof to&&Zi(this.attrs,t.attrs)&&Zi(this.spec,t.spec)}destroy(){}}class eo{constructor(t,e,n){this.from=t,this.to=e,this.type=n}copy(t,e){return new eo(t,e,this.type)}eq(t,e=0){return this.type.eq(t.type)&&this.from+e==t.from&&this.to+e==t.to}map(t,e,n){return this.type.map(t,this,e,n)}static widget(t,e,n){return new eo(t,t,new Xi(e,n))}static inline(t,e,n,r){return new eo(t,e,new Qi(n,r))}static node(t,e,n,r){return new eo(t,e,new to(n,r))}get spec(){return this.type.spec}get inline(){return this.type instanceof Qi}get widget(){return this.type instanceof Xi}}const no=[],ro={};class io{constructor(t,e){this.local=t.length?t:no,this.children=e.length?e:no}static create(t,e){return e.length?ho(e,t,0,ro):oo}find(t,e,n){let r=[];return this.findInner(null==t?0:t,null==e?1e9:e,r,0,n),r}findInner(t,e,n,r,i){for(let o=0;o<this.local.length;o++){let s=this.local[o];s.from<=e&&s.to>=t&&(!i||i(s.spec))&&n.push(s.copy(s.from+r,s.to+r))}for(let o=0;o<this.children.length;o+=3)if(this.children[o]<e&&this.children[o+1]>t){let s=this.children[o]+1;this.children[o+2].findInner(t-s,e-s,n,r+s,i)}}map(t,e,n){return this==oo||0==t.maps.length?this:this.mapInner(t,e,0,0,n||ro)}mapInner(t,e,n,r,i){let o;for(let s=0;s<this.local.length;s++){let l=this.local[s].map(t,n,r);l&&l.type.valid(e,l)?(o||(o=[])).push(l):i.onRemove&&i.onRemove(this.local[s].spec)}return this.children.length?function(t,e,n,r,i,o,s){let l=t.slice();for(let c=0,h=o;c<n.maps.length;c++){let t=0;n.maps[c].forEach(((e,n,r,o)=>{let s=o-r-(n-e);for(let a=0;a<l.length;a+=3){let o=l[a+1];if(o<0||e>o+h-t)continue;let c=l[a]+h-t;n>=c?l[a+1]=e<=c?-2:-1:r>=i&&s&&(l[a]+=s,l[a+1]+=s)}t+=s})),h=n.maps[c].map(h,-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 e=n.map(t[c]+o),h=e-i;if(h<0||h>=r.content.size){a=!0;continue}let u=n.map(t[c+1]+o,-1)-i,{index:d,offset:f}=r.content.findIndex(h),p=r.maybeChild(d);if(p&&f==h&&f+p.nodeSize==u){let r=l[c+2].mapInner(n,p,e+1,t[c]+o+1,s);r!=oo?(l[c]=h,l[c+1]=u,l[c+2]=r):(l[c+1]=-2,a=!0)}else a=!0}if(a){let a=function(t,e,n,r,i,o,s){function l(t,e){for(let o=0;o<t.local.length;o++){let l=t.local[o].map(r,i,e);l?n.push(l):s.onRemove&&s.onRemove(t.local[o].spec)}for(let n=0;n<t.children.length;n+=3)l(t.children[n+2],t.children[n]+e+1)}for(let a=0;a<t.length;a+=3)-1==t[a+1]&&l(t[a+2],e[a]+o+1);return n}(l,t,e,n,i,o,s),c=ho(a,r,0,s);e=c.local;for(let t=0;t<l.length;t+=3)l[t+1]<0&&(l.splice(t,3),t-=3);for(let t=0,e=0;t<c.children.length;t+=3){let n=c.children[t];for(;e<l.length&&l[e]<n;)e+=3;l.splice(e,0,c.children[t],c.children[t+1],c.children[t+2])}}return new io(e.sort(uo),l)}(this.children,o||[],t,e,n,r,i):o?new io(o.sort(uo),no):oo}add(t,e){return e.length?this==oo?io.create(t,e):this.addInner(t,e,0):this}addInner(t,e,n){let r,i=0;t.forEach(((t,o)=>{let s,l=o+n;if(s=ao(e,t,l)){for(r||(r=this.children.slice());i<r.length&&r[i]<o;)i+=3;r[i]==o?r[i+2]=r[i+2].addInner(t,s,l+1):r.splice(i,0,o,o+t.nodeSize,ho(s,t,l+1,ro)),i+=3}}));let o=lo(i?co(e):e,-n);for(let s=0;s<o.length;s++)o[s].type.valid(t,o[s])||o.splice(s--,1);return new io(o.length?this.local.concat(o).sort(uo):this.local,r||this.children)}remove(t){return 0==t.length||this==oo?this:this.removeInner(t,0)}removeInner(t,e){let n=this.children,r=this.local;for(let i=0;i<n.length;i+=3){let r,o=n[i]+e,s=n[i+1]+e;for(let e,n=0;n<t.length;n++)(e=t[n])&&e.from>o&&e.to<s&&(t[n]=null,(r||(r=[])).push(e));if(!r)continue;n==this.children&&(n=this.children.slice());let l=n[i+2].removeInner(r,o+1);l!=oo?n[i+2]=l:(n.splice(i,3),i-=3)}if(r.length)for(let i,o=0;o<t.length;o++)if(i=t[o])for(let t=0;t<r.length;t++)r[t].eq(i,e)&&(r==this.local&&(r=this.local.slice()),r.splice(t--,1));return n==this.children&&r==this.local?this:r.length||n.length?new io(r,n):oo}forChild(t,e){if(this==oo)return this;if(e.isLeaf)return io.empty;let n,r;for(let s=0;s<this.children.length;s+=3)if(this.children[s]>=t){this.children[s]==t&&(n=this.children[s+2]);break}let i=t+1,o=i+e.content.size;for(let s=0;s<this.local.length;s++){let t=this.local[s];if(t.from<o&&t.to>i&&t.type instanceof Qi){let e=Math.max(i,t.from)-i,n=Math.min(o,t.to)-i;e<n&&(r||(r=[])).push(t.copy(e,n))}}if(r){let t=new io(r.sort(uo),no);return n?new so([t,n]):t}return n||oo}eq(t){if(this==t)return!0;if(!(t instanceof io)||this.local.length!=t.local.length||this.children.length!=t.children.length)return!1;for(let e=0;e<this.local.length;e++)if(!this.local[e].eq(t.local[e]))return!1;for(let e=0;e<this.children.length;e+=3)if(this.children[e]!=t.children[e]||this.children[e+1]!=t.children[e+1]||!this.children[e+2].eq(t.children[e+2]))return!1;return!0}locals(t){return fo(this.localsInner(t))}localsInner(t){if(this==oo)return no;if(t.inlineContent||!this.local.some(Qi.is))return this.local;let e=[];for(let n=0;n<this.local.length;n++)this.local[n].type instanceof Qi||e.push(this.local[n]);return e}}io.empty=new io([],[]),io.removeOverlap=fo;const oo=io.empty;class so{constructor(t){this.members=t}map(t,e){const n=this.members.map((n=>n.map(t,e,ro)));return so.from(n)}forChild(t,e){if(e.isLeaf)return io.empty;let n=[];for(let r=0;r<this.members.length;r++){let i=this.members[r].forChild(t,e);i!=oo&&(i instanceof so?n=n.concat(i.members):n.push(i))}return so.from(n)}eq(t){if(!(t instanceof so)||t.members.length!=this.members.length)return!1;for(let e=0;e<this.members.length;e++)if(!this.members[e].eq(t.members[e]))return!1;return!0}locals(t){let e,n=!0;for(let r=0;r<this.members.length;r++){let i=this.members[r].localsInner(t);if(i.length)if(e){n&&(e=e.slice(),n=!1);for(let t=0;t<i.length;t++)e.push(i[t])}else e=i}return e?fo(n?e:e.sort(uo)):no}static from(t){switch(t.length){case 0:return oo;case 1:return t[0];default:return new so(t.every((t=>t instanceof io))?t:t.reduce(((t,e)=>t.concat(e instanceof io?e:e.members)),[]))}}}function lo(t,e){if(!e||!t.length)return t;let n=[];for(let r=0;r<t.length;r++){let i=t[r];n.push(new eo(i.from+e,i.to+e,i.type))}return n}function ao(t,e,n){if(e.isLeaf)return null;let r=n+e.nodeSize,i=null;for(let o,s=0;s<t.length;s++)(o=t[s])&&o.from>n&&o.to<r&&((i||(i=[])).push(o),t[s]=null);return i}function co(t){let e=[];for(let n=0;n<t.length;n++)null!=t[n]&&e.push(t[n]);return e}function ho(t,e,n,r){let i=[],o=!1;e.forEach(((e,s)=>{let l=ao(t,e,s+n);if(l){o=!0;let t=ho(l,e,n+s+1,r);t!=oo&&i.push(s,s+e.nodeSize,t)}}));let s=lo(o?co(t):t,-n).sort(uo);for(let l=0;l<s.length;l++)s[l].type.valid(e,s[l])||(r.onRemove&&r.onRemove(s[l].spec),s.splice(l--,1));return s.length||i.length?new io(s,i):oo}function uo(t,e){return t.from-e.from||t.to-e.to}function fo(t){let e=t;for(let n=0;n<e.length-1;n++){let r=e[n];if(r.from!=r.to)for(let i=n+1;i<e.length;i++){let o=e[i];if(o.from!=r.from){o.from<r.to&&(e==t&&(e=t.slice()),e[n]=r.copy(r.from,o.from),po(e,i,r.copy(o.from,r.to)));break}o.to!=r.to&&(e==t&&(e=t.slice()),e[i]=o.copy(o.from,r.to),po(e,i+1,o.copy(r.to,o.to)))}}return e}function po(t,e,n){for(;e<t.length&&uo(n,t[e])>0;)e++;t.splice(e,0,n)}function mo(t){let e=[];return t.someProp("decorations",(n=>{let r=n(t.state);r&&r!=oo&&e.push(r)})),t.cursorWrapper&&e.push(io.create(t.state.doc,[t.cursorWrapper.deco])),so.from(e)}const go={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},yo=jn&&Vn<=11;class vo{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(t){this.anchorNode=t.anchorNode,this.anchorOffset=t.anchorOffset,this.focusNode=t.focusNode,this.focusOffset=t.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(t){return t.anchorNode==this.anchorNode&&t.anchorOffset==this.anchorOffset&&t.focusNode==this.focusNode&&t.focusOffset==this.focusOffset}}class wo{constructor(t,e){this.view=t,this.handleDOMChange=e,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new vo,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.observer=window.MutationObserver&&new window.MutationObserver((t=>{for(let e=0;e<t.length;e++)this.queue.push(t[e]);jn&&Vn<=11&&t.some((t=>"childList"==t.type&&t.removedNodes.length||"characterData"==t.type&&t.oldValue.length>t.target.nodeValue.length))?this.flushSoon():this.flush()})),yo&&(this.onCharData=t=>{this.queue.push({target:t.target,type:"characterData",oldValue:t.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,go)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let t=this.observer.takeRecords();if(t.length){for(let e=0;e<t.length;e++)this.queue.push(t[e]);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(Xr(this.view)){if(this.suppressingSelectionUpdates)return qr(this.view);if(jn&&Vn<=11&&!this.view.state.selection.empty){let t=this.view.domSelectionRange();if(t.focusNode&&Cn(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(t){if(!t.focusNode)return!0;let e,n=new Set;for(let i=t.focusNode;i;i=kn(i))n.add(i);for(let i=t.anchorNode;i;i=kn(i))if(n.has(i)){e=i;break}let r=e&&this.view.docView.nearestDesc(e);return r&&r.ignoreMutation({type:"selection",target:3==e.nodeType?e.parentNode:e})?(this.setCurSelection(),!0):void 0}pendingRecords(){if(this.observer)for(let t of this.observer.takeRecords())this.queue.push(t);return this.queue}flush(){let{view:t}=this;if(!t.docView||this.flushingSoon>-1)return;let e=this.pendingRecords();e.length&&(this.queue=[]);let n=t.domSelectionRange(),r=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(n)&&Xr(t)&&!this.ignoreSelectionChange(n),i=-1,o=-1,s=!1,l=[];if(t.editable)for(let c=0;c<e.length;c++){let t=this.registerMutation(e[c],l);t&&(i=i<0?t.from:Math.min(t.from,i),o=o<0?t.to:Math.max(t.to,o),t.typeOver&&(s=!0))}if(Fn&&l.length>1){let t=l.filter((t=>"BR"==t.nodeName));if(2==t.length){let e=t[0],n=t[1];e.parentNode&&e.parentNode.parentNode==n.parentNode?n.remove():e.remove()}}let a=null;i<0&&r&&t.input.lastFocus>Date.now()-200&&Math.max(t.input.lastTouch,t.input.lastClick.time)<Date.now()-300&&En(n)&&(a=Lr(t))&&a.eq(Xe.near(t.state.doc.resolve(0),1))?(t.input.lastFocus=0,qr(t),this.currentSelection.set(n),t.scrollToSelection()):(i>-1||r)&&(i>-1&&(t.docView.markDirty(i,o),function(t){if(bo.has(t))return;if(bo.set(t,null),-1!==["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)){if(t.requiresGeckoHackNode=Fn,xo)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."),xo=!0}}(t)),this.handleDOMChange(i,o,s,l),t.docView&&t.docView.dirty?t.updateState(t.state):this.currentSelection.eq(n)||qr(t),this.currentSelection.set(n))}registerMutation(t,e){if(e.indexOf(t.target)>-1)return null;let n=this.view.docView.nearestDesc(t.target);if("attributes"==t.type&&(n==this.view.docView||"contenteditable"==t.attributeName||"style"==t.attributeName&&!t.oldValue&&!t.target.getAttribute("style")))return null;if(!n||n.ignoreMutation(t))return null;if("childList"==t.type){for(let n=0;n<t.addedNodes.length;n++)e.push(t.addedNodes[n]);if(n.contentDOM&&n.contentDOM!=n.dom&&!n.contentDOM.contains(t.target))return{from:n.posBefore,to:n.posAfter};let r=t.previousSibling,i=t.nextSibling;if(jn&&Vn<=11&&t.addedNodes.length)for(let e=0;e<t.addedNodes.length;e++){let{previousSibling:n,nextSibling:o}=t.addedNodes[e];(!n||Array.prototype.indexOf.call(t.addedNodes,n)<0)&&(r=n),(!o||Array.prototype.indexOf.call(t.addedNodes,o)<0)&&(i=o)}let o=r&&r.parentNode==t.target?Sn(r)+1:0,s=n.localPosFromDOM(t.target,o,-1),l=i&&i.parentNode==t.target?Sn(i):t.target.childNodes.length;return{from:s,to:n.localPosFromDOM(t.target,l,1)}}return"attributes"==t.type?{from:n.posAtStart-n.border,to:n.posAtEnd+n.border}:{from:n.posAtStart,to:n.posAtEnd,typeOver:t.target.nodeValue==t.oldValue}}}let bo=new WeakMap,xo=!1;function So(t){let e=t.pmViewDesc;if(e)return e.parseRule();if("BR"==t.nodeName&&t.parentNode){if(Jn&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){let t=document.createElement("div");return t.appendChild(document.createElement("li")),{skip:t}}if(t.parentNode.lastChild==t||Jn&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if("IMG"==t.nodeName&&t.getAttribute("mark-placeholder"))return{ignore:!0};return null}const ko=/^(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 Mo(t,e,n,r,i){let o=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let e=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,n=Lr(t,e);if(n&&!t.state.selection.eq(n)){if(Wn&&Un&&13===t.input.lastKeyCode&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",(e=>e(t,$n(13,"Enter")))))return;let r=t.state.tr.setSelection(n);"pointer"==e?r.setMeta("pointer",!0):"key"==e&&r.scrollIntoView(),o&&r.setMeta("composition",o),t.dispatch(r)}return}let s=t.state.doc.resolve(e),l=s.sharedDepth(n);e=s.before(l+1),n=t.state.doc.resolve(n).after(l+1);let a,c,h=t.state.selection,u=function(t,e,n){let r,{node:i,fromOffset:o,toOffset:s,from:l,to:a}=t.docView.parseRange(e,n),c=t.domSelectionRange(),h=c.anchorNode;if(h&&t.dom.contains(1==h.nodeType?h:h.parentNode)&&(r=[{node:h,offset:c.anchorOffset}],En(c)||r.push({node:c.focusNode,offset:c.focusOffset})),Wn&&8===t.input.lastKeyCode)for(let g=s;g>o;g--){let t=i.childNodes[g-1],e=t.pmViewDesc;if("BR"==t.nodeName&&!e){s=g;break}if(!e||e.size)break}let u=t.state.doc,d=t.someProp("domParser")||ne.fromSchema(t.state.schema),f=u.resolve(l),p=null,m=d.parse(i,{topNode:f.parent,topMatch:f.parent.contentMatchAt(f.index()),topOpen:!0,from:o,to:s,preserveWhitespace:"pre"!=f.parent.type.whitespace||"full",findPositions:r,ruleFromNode:So,context:f});if(r&&null!=r[0].pos){let t=r[0].pos,e=r[1]&&r[1].pos;null==e&&(e=t),p={anchor:t+l,head:e+l}}return{doc:m,sel:p,from:l,to:a}}(t,e,n),d=t.state.doc,f=d.slice(u.from,u.to);8===t.input.lastKeyCode&&Date.now()-100<t.input.lastKeyCodeTime?(a=t.state.selection.to,c="end"):(a=t.state.selection.from,c="start"),t.input.lastKeyCode=null;let p=function(t,e,n,r,i){let o=t.findDiffStart(e,n);if(null==o)return null;let{a:s,b:l}=t.findDiffEnd(e,n+t.size,n+e.size);if("end"==i){r-=s+Math.max(0,o-Math.min(s,l))-o}if(s<o&&t.size<e.size){let t=r<=o&&r>=s?o-r:0;o-=t,o&&o<e.size&&Do(e.textBetween(o-1,o+1))&&(o+=t?1:-1),l=o+(l-s),s=o}else if(l<o){let e=r<=o&&r>=l?o-r:0;o-=e,o&&o<t.size&&Do(t.textBetween(o-1,o+1))&&(o+=e?1:-1),s=o+(s-l),l=o}return{start:o,endA:s,endB:l}}(f.content,u.doc.content,u.from,a,c);if((Kn&&t.input.lastIOSEnter>Date.now()-225||Un)&&i.some((t=>1==t.nodeType&&!ko.test(t.nodeName)))&&(!p||p.endA>=p.endB)&&t.someProp("handleKeyDown",(e=>e(t,$n(13,"Enter")))))return void(t.input.lastIOSEnter=0);if(!p){if(!(r&&h instanceof nn&&!h.empty&&h.$head.sameParent(h.$anchor))||t.composing||u.sel&&u.sel.anchor!=u.sel.head){if(u.sel){let e=Oo(t,t.state.doc,u.sel);if(e&&!e.eq(t.state.selection)){let n=t.state.tr.setSelection(e);o&&n.setMeta("composition",o),t.dispatch(n)}}return}p={start:h.from,endA:h.to,endB:h.to}}if(Wn&&t.cursorWrapper&&u.sel&&u.sel.anchor==t.cursorWrapper.deco.from&&u.sel.head==u.sel.anchor){let t=p.endB-p.start;u.sel={anchor:u.sel.anchor+t,head:u.sel.anchor+t}}t.input.domChangeCount++,t.state.selection.from<t.state.selection.to&&p.start==p.endB&&t.state.selection instanceof nn&&(p.start>t.state.selection.from&&p.start<=t.state.selection.from+2&&t.state.selection.from>=u.from?p.start=t.state.selection.from:p.endA<t.state.selection.to&&p.endA>=t.state.selection.to-2&&t.state.selection.to<=u.to&&(p.endB+=t.state.selection.to-p.endA,p.endA=t.state.selection.to)),jn&&Vn<=11&&p.endB==p.start+1&&p.endA==p.start&&p.start>u.from&&"  "==u.doc.textBetween(p.start-u.from-1,p.start-u.from+1)&&(p.start--,p.endA--,p.endB--);let m,g=u.doc.resolveNoCache(p.start-u.from),y=u.doc.resolveNoCache(p.endB-u.from),v=d.resolve(p.start),w=g.sameParent(y)&&g.parent.inlineContent&&v.end()>=p.endA;if((Kn&&t.input.lastIOSEnter>Date.now()-225&&(!w||i.some((t=>"DIV"==t.nodeName||"P"==t.nodeName)))||!w&&g.pos<u.doc.content.size&&!g.sameParent(y)&&(m=Xe.findFrom(u.doc.resolve(g.pos+1),1,!0))&&m.head==y.pos)&&t.someProp("handleKeyDown",(e=>e(t,$n(13,"Enter")))))return void(t.input.lastIOSEnter=0);if(t.state.selection.anchor>p.start&&function(t,e,n,r,i){if(!r.parent.isTextblock||n-e<=i.pos-r.pos||Co(r,!0,!1)<i.pos)return!1;let o=t.resolve(e);if(o.parentOffset<o.parent.content.size||!o.parent.isTextblock)return!1;let s=t.resolve(Co(o,!0,!0));return!(!s.parent.isTextblock||s.pos>n||Co(s,!0,!1)<n)&&r.parent.content.cut(r.parentOffset).eq(s.parent.content)}(d,p.start,p.endA,g,y)&&t.someProp("handleKeyDown",(e=>e(t,$n(8,"Backspace")))))return void(Un&&Wn&&t.domObserver.suppressSelectionUpdates());Wn&&Un&&p.endB==p.start&&(t.input.lastAndroidDelete=Date.now()),Un&&!w&&g.start()!=y.start()&&0==y.parentOffset&&g.depth==y.depth&&u.sel&&u.sel.anchor==u.sel.head&&u.sel.head==p.endA&&(p.endB-=2,y=u.doc.resolveNoCache(p.endB-u.from),setTimeout((()=>{t.someProp("handleKeyDown",(function(e){return e(t,$n(13,"Enter"))}))}),20));let b,x,S,k=p.start,M=p.endA;if(w)if(g.pos==y.pos)jn&&Vn<=11&&0==g.parentOffset&&(t.domObserver.suppressSelectionUpdates(),setTimeout((()=>qr(t)),20)),b=t.state.tr.delete(k,M),x=d.resolve(p.start).marksAcross(d.resolve(p.endA));else if(p.endA==p.endB&&(S=function(t,e){let n,r,i,o=t.firstChild.marks,s=e.firstChild.marks,l=o,a=s;for(let h=0;h<s.length;h++)l=s[h].removeFromSet(l);for(let h=0;h<o.length;h++)a=o[h].removeFromSet(a);if(1==l.length&&0==a.length)r=l[0],n="add",i=t=>t.mark(r.addToSet(t.marks));else{if(0!=l.length||1!=a.length)return null;r=a[0],n="remove",i=t=>t.mark(r.removeFromSet(t.marks))}let c=[];for(let h=0;h<e.childCount;h++)c.push(i(e.child(h)));if(dt.from(c).eq(t))return{mark:r,type:n}}(g.parent.content.cut(g.parentOffset,y.parentOffset),v.parent.content.cut(v.parentOffset,p.endA-v.start()))))b=t.state.tr,"add"==S.type?b.addMark(k,M,S.mark):b.removeMark(k,M,S.mark);else if(g.parent.child(g.index()).isText&&g.index()==y.index()-(y.textOffset?0:1)){let e=g.parent.textBetween(g.parentOffset,y.parentOffset);if(t.someProp("handleTextInput",(n=>n(t,k,M,e))))return;b=t.state.tr.insertText(e,k,M)}if(b||(b=t.state.tr.replace(k,M,u.doc.slice(p.start-u.from,p.endB-u.from))),u.sel){let e=Oo(t,b.doc,u.sel);e&&!(Wn&&Un&&t.composing&&e.empty&&(p.start!=p.endB||t.input.lastAndroidDelete<Date.now()-100)&&(e.head==k||e.head==b.mapping.map(M)-1)||jn&&e.empty&&e.head==k)&&b.setSelection(e)}x&&b.ensureMarks(x),o&&b.setMeta("composition",o),t.dispatch(b.scrollIntoView())}function Oo(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:Zr(t,e.resolve(n.anchor),e.resolve(n.head))}function Co(t,e,n){let r=t.depth,i=e?t.end():t.pos;for(;r>0&&(e||t.indexAfter(r)==t.node(r).childCount);)r--,i++,e=!1;if(n){let e=t.node(r).maybeChild(t.indexAfter(r));for(;e&&!e.isLeaf;)e=e.firstChild,i++}return i}function Do(t){if(2!=t.length)return!1;let e=t.charCodeAt(0),n=t.charCodeAt(1);return e>=56320&&e<=57343&&n>=55296&&n<=56319}class No{constructor(t,e){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 Di,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=e,this.state=e.state,this.directPlugins=e.plugins||[],this.directPlugins.forEach(Po),this.dispatch=this.dispatch.bind(this),this.dom=t&&t.mount||document.createElement("div"),t&&(t.appendChild?t.appendChild(this.dom):"function"==typeof t?t(this.dom):t.mount&&(this.mounted=!0)),this.editable=Eo(this),Ao(this),this.nodeViews=$o(this),this.docView=Cr(this.state.doc,To(this),mo(this),this.dom,this),this.domObserver=new wo(this,((t,e,n,r)=>Mo(this,t,e,n,r))),this.domObserver.start(),function(t){for(let e in Mi){let n=Mi[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=e=>{!Ei(t,e)||Ai(t,e)||!t.editable&&e.type in Oi||n(t,e)},Ci[e]?{passive:!0}:void 0)}Jn&&t.dom.addEventListener("input",(()=>null)),Ti(t)}(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let t=this._props;this._props={};for(let e in t)this._props[e]=t[e];this._props.state=this.state}return this._props}update(t){t.handleDOMEvents!=this._props.handleDOMEvents&&Ti(this);let e=this._props;this._props=t,t.plugins&&(t.plugins.forEach(Po),this.directPlugins=t.plugins),this.updateStateInner(t.state,e)}setProps(t){let e={};for(let n in this._props)e[n]=this._props[n];e.state=this.state;for(let n in t)e[n]=t[n];this.update(e)}updateState(t){this.updateStateInner(t,this._props)}updateStateInner(t,e){var n;let r=this.state,i=!1,o=!1;t.storedMarks&&this.composing&&(qi(this),o=!0),this.state=t;let s=r.plugins!=t.plugins||this._props.plugins!=e.plugins;if(s||this._props.plugins!=e.plugins||this._props.nodeViews!=e.nodeViews){let t=$o(this);(function(t,e){let n=0,r=0;for(let i in t){if(t[i]!=e[i])return!0;n++}for(let i in e)r++;return n!=r})(t,this.nodeViews)&&(this.nodeViews=t,i=!0)}(s||e.handleDOMEvents!=this._props.handleDOMEvents)&&Ti(this),this.editable=Eo(this),Ao(this);let l=mo(this),a=To(this),c=r.plugins==t.plugins||r.doc.eq(t.doc)?t.scrollToSelection>r.scrollToSelection?"to selection":"preserve":"reset",h=i||!this.docView.matchesNode(t.doc,a,l);!h&&t.selection.eq(r.selection)||(o=!0);let u="preserve"==c&&o&&null==this.dom.style.overflowAnchor&&function(t){let e,n,r=t.dom.getBoundingClientRect(),i=Math.max(0,r.top);for(let o=(r.left+r.right)/2,s=i+1;s<Math.min(innerHeight,r.bottom);s+=5){let r=t.root.elementFromPoint(o,s);if(!r||r==t.dom||!t.dom.contains(r))continue;let l=r.getBoundingClientRect();if(l.top>=i-20){e=r,n=l.top;break}}return{refDOM:e,refTop:n,stack:nr(t.dom)}}(this);if(o){this.domObserver.stop();let e=h&&(jn||Wn)&&!this.composing&&!r.selection.empty&&!t.selection.empty&&function(t,e){let n=Math.min(t.$anchor.sharedDepth(t.head),e.$anchor.sharedDepth(e.head));return t.$anchor.start(n)!=e.$anchor.start(n)}(r.selection,t.selection);if(h){let n=Wn?this.trackWrites=this.domSelectionRange().focusNode:null;!i&&this.docView.update(t.doc,a,l,this)||(this.docView.updateOuterDeco([]),this.docView.destroy(),this.docView=Cr(t.doc,a,l,this.dom,this)),n&&!this.trackWrites&&(e=!0)}e||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&function(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return Cn(e.node,e.offset,n.anchorNode,n.anchorOffset)}(this))?qr(this,e):(Ur(this,t.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(r),(null===(n=this.dragging)||void 0===n?void 0:n.node)&&!r.doc.eq(t.doc)&&this.updateDraggedNode(this.dragging,r),"reset"==c?this.dom.scrollTop=0:"to selection"==c?this.scrollToSelection():u&&function({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;rr(n,0==r?0:r-e)}(u)}scrollToSelection(){let t=this.domSelectionRange().focusNode;if(this.someProp("handleScrollToSelection",(t=>t(this))));else if(this.state.selection instanceof on){let e=this.docView.domAfterPos(this.state.selection.from);1==e.nodeType&&er(this,e.getBoundingClientRect(),t)}else er(this,this.coordsAtPos(this.state.selection.head,1),t)}destroyPluginViews(){let t;for(;t=this.pluginViews.pop();)t.destroy&&t.destroy()}updatePluginViews(t){if(t&&t.plugins==this.state.plugins&&this.directPlugins==this.prevDirectPlugins)for(let e=0;e<this.pluginViews.length;e++){let n=this.pluginViews[e];n.update&&n.update(this,t)}else{this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let t=0;t<this.directPlugins.length;t++){let e=this.directPlugins[t];e.spec.view&&this.pluginViews.push(e.spec.view(this))}for(let t=0;t<this.state.plugins.length;t++){let e=this.state.plugins[t];e.spec.view&&this.pluginViews.push(e.spec.view(this))}}}updateDraggedNode(t,e){let n=t.node,r=-1;if(this.state.doc.nodeAt(n.from)==n.node)r=n.from;else{let t=n.from+(this.state.doc.content.size-e.doc.content.size);(t>0&&this.state.doc.nodeAt(t))==n.node&&(r=t)}this.dragging=new Ui(t.slice,t.move,r<0?void 0:on.create(this.state.doc,r))}someProp(t,e){let n,r=this._props&&this._props[t];if(null!=r&&(n=e?e(r):r))return n;for(let o=0;o<this.directPlugins.length;o++){let r=this.directPlugins[o].props[t];if(null!=r&&(n=e?e(r):r))return n}let i=this.state.plugins;if(i)for(let o=0;o<i.length;o++){let r=i[o].props[t];if(null!=r&&(n=e?e(r):r))return n}}hasFocus(){if(jn){let t=this.root.activeElement;if(t==this.dom)return!0;if(!t||!this.dom.contains(t))return!1;for(;t&&this.dom!=t&&this.dom.contains(t);){if("false"==t.contentEditable)return!1;t=t.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&function(t){if(t.setActive)return t.setActive();if(ir)return t.focus(ir);let e=nr(t);t.focus(null==ir?{get preventScroll(){return ir={preventScroll:!0},!0}}:void 0),ir||(ir=!1,rr(e,0))}(this.dom),qr(this),this.domObserver.start()}get root(){let t=this._root;if(null==t)for(let e=this.dom.parentNode;e;e=e.parentNode)if(9==e.nodeType||11==e.nodeType&&e.host)return e.getSelection||(Object.getPrototypeOf(e).getSelection=()=>e.ownerDocument.getSelection()),this._root=e;return t||document}updateRoot(){this._root=null}posAtCoords(t){return ar(this,t)}coordsAtPos(t,e=1){return dr(this,t,e)}domAtPos(t,e=0){return this.docView.domFromPos(t,e)}nodeDOM(t){let e=this.docView.descAt(t);return e?e.nodeDOM:null}posAtDOM(t,e,n=-1){let r=this.docView.posFromDOM(t,e,n);if(null==r)throw new RangeError("DOM position not inside the editor");return r}endOfTextblock(t,e){return br(this,e||this.state,t)}pasteHTML(t,e){return Hi(this,"",t,!1,e||new ClipboardEvent("paste"))}pasteText(t,e){return Hi(this,t,null,!0,e||new ClipboardEvent("paste"))}destroy(){this.docView&&(!function(t){t.domObserver.stop();for(let e in t.input.eventHandlers)t.dom.removeEventListener(e,t.input.eventHandlers[e]);clearTimeout(t.input.composingTimeout),clearTimeout(t.input.lastIOSEnterFallbackTimeout)}(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],mo(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null)}get isDestroyed(){return null==this.docView}dispatchEvent(t){return function(t,e){Ai(t,e)||!Mi[e.type]||!t.editable&&e.type in Oi||Mi[e.type](t,e)}(this,t)}dispatch(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))}domSelectionRange(){return Jn&&11===this.root.nodeType&&function(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}(this.dom.ownerDocument)==this.dom?function(t){let e;function n(t){t.preventDefault(),t.stopImmediatePropagation(),e=t.getTargetRanges()[0]}t.dom.addEventListener("beforeinput",n,!0),document.execCommand("indent"),t.dom.removeEventListener("beforeinput",n,!0);let r=e.startContainer,i=e.startOffset,o=e.endContainer,s=e.endOffset,l=t.domAtPos(t.state.selection.anchor);return Cn(l.node,l.offset,o,s)&&([r,i,o,s]=[o,s,r,i]),{anchorNode:r,anchorOffset:i,focusNode:o,focusOffset:s}}(this):this.domSelection()}domSelection(){return this.root.getSelection()}}function To(t){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(t.editable),t.someProp("attributes",(n=>{if("function"==typeof n&&(n=n(t.state)),n)for(let t in n)"class"==t?e.class+=" "+n[t]:"style"==t?e.style=(e.style?e.style+";":"")+n[t]:e[t]||"contenteditable"==t||"nodeName"==t||(e[t]=String(n[t]))})),e.translate||(e.translate="no"),[eo.node(0,t.state.doc.content.size,e)]}function Ao(t){if(t.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),t.cursorWrapper={dom:e,deco:eo.widget(t.state.selection.head,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function Eo(t){return!t.someProp("editable",(e=>!1===e(t.state)))}function $o(t){let e=Object.create(null);function n(t){for(let n in t)Object.prototype.hasOwnProperty.call(e,n)||(e[n]=t[n])}return t.someProp("nodeViews",n),t.someProp("markViews",n),e}function Po(t){if(t.spec.state||t.spec.filterTransaction||t.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}for(var Io={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:"'"},Ro={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},zo="undefined"!=typeof navigator&&/Chrome\/(\d+)/.exec(navigator.userAgent),_o="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),Bo="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),jo=_o||zo&&+zo[1]<57,Vo=0;Vo<10;Vo++)Io[48+Vo]=Io[96+Vo]=String(Vo);for(Vo=1;Vo<=24;Vo++)Io[Vo+111]="F"+Vo;for(Vo=65;Vo<=90;Vo++)Io[Vo]=String.fromCharCode(Vo+32),Ro[Vo]=String.fromCharCode(Vo);for(var Fo in Io)Ro.hasOwnProperty(Fo)||(Ro[Fo]=Io[Fo]);const Lo="undefined"!=typeof navigator&&/Mac|iP(hone|[oa]d)/.test(navigator.platform);function Wo(t){let e,n,r,i,o=t.split(/-(?!$)/),s=o[o.length-1];"Space"==s&&(s=" ");for(let l=0;l<o.length-1;l++){let t=o[l];if(/^(cmd|meta|m)$/i.test(t))i=!0;else if(/^a(lt)?$/i.test(t))e=!0;else if(/^(c|ctrl|control)$/i.test(t))n=!0;else if(/^s(hift)?$/i.test(t))r=!0;else{if(!/^mod$/i.test(t))throw new Error("Unrecognized modifier name: "+t);Lo?i=!0:n=!0}}return e&&(s="Alt-"+s),n&&(s="Ctrl-"+s),i&&(s="Meta-"+s),r&&(s="Shift-"+s),s}function qo(t,e,n=!0){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),n&&e.shiftKey&&(t="Shift-"+t),t}function Jo(t){return new vn({props:{handleKeyDown:Ko(t)}})}function Ko(t){let e=function(t){let e=Object.create(null);for(let n in t)e[Wo(n)]=t[n];return e}(t);return function(t,n){let r,i=function(t){var e=!(jo&&(t.ctrlKey||t.altKey||t.metaKey)||Bo&&t.shiftKey&&t.key&&1==t.key.length||"Unidentified"==t.key)&&t.key||(t.shiftKey?Ro:Io)[t.keyCode]||t.key||"Unidentified";return"Esc"==e&&(e="Escape"),"Del"==e&&(e="Delete"),"Left"==e&&(e="ArrowLeft"),"Up"==e&&(e="ArrowUp"),"Right"==e&&(e="ArrowRight"),"Down"==e&&(e="ArrowDown"),e}(n),o=e[qo(i,n)];if(o&&o(t.state,t.dispatch,t))return!0;if(1==i.length&&" "!=i){if(n.shiftKey){let r=e[qo(i,n,!1)];if(r&&r(t.state,t.dispatch,t))return!0}if((n.shiftKey||n.altKey||n.metaKey||i.charCodeAt(0)>127)&&(r=Io[n.keyCode])&&r!=i){let i=e[qo(r,n)];if(i&&i(t.state,t.dispatch,t))return!0}}return!1}}const Ho=(t,e)=>!t.selection.empty&&(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function Yo(t,e,n=!1){for(let r=t;r;r="start"==e?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&1!=r.childCount)return!1}return!1}function Uo(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){if(t.index(e)>0)return t.doc.resolve(t.before(e+1));if(t.node(e).type.spec.isolating)break}return null}function Go(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){let n=t.node(e);if(t.index(e)+1<n.childCount)return t.doc.resolve(t.after(e+1));if(n.type.spec.isolating)break}return null}const Zo=(t,e)=>{let{$from:n,$to:r}=t.selection,i=n.blockRange(r),o=i&&$e(i);return null!=o&&(e&&e(t.tr.lift(i,o).scrollIntoView()),!0)};function Xo(t){for(let e=0;e<t.edgeCount;e++){let{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}const Qo=(t,e)=>{let{$head:n,$anchor:r}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let i=n.node(-1),o=n.indexAfter(-1),s=Xo(i.contentMatchAt(o));if(!s||!i.canReplaceWith(o,o,s))return!1;if(e){let r=n.after(),i=t.tr.replaceWith(r,r,s.createAndFill());i.setSelection(Xe.near(i.doc.resolve(r),1)),e(i.scrollIntoView())}return!0};const ts=(t,e)=>{let{$from:n,$to:r}=t.selection;if(t.selection instanceof on&&t.selection.node.isBlock)return!(!n.parentOffset||!Re(t.doc,n.pos)||(e&&e(t.tr.split(n.pos).scrollIntoView()),0));if(!n.parent.isBlock)return!1;if(e){let i=r.parentOffset==r.parent.content.size,o=t.tr;(t.selection instanceof nn||t.selection instanceof ln)&&o.deleteSelection();let s=0==n.depth?null:Xo(n.node(-1).contentMatchAt(n.indexAfter(-1))),l=es&&es(r.parent,i),a=l?[l]:i&&s?[{type:s}]:void 0,c=Re(o.doc,o.mapping.map(n.pos),1,a);if(a||c||!Re(o.doc,o.mapping.map(n.pos),1,s?[{type:s}]:void 0)||(s&&(a=[{type:s}]),c=!0),c&&(o.split(o.mapping.map(n.pos),1,a),!i&&!n.parentOffset&&n.parent.type!=s)){let t=o.mapping.map(n.before()),e=o.doc.resolve(t);s&&n.node(-1).canReplaceWith(e.index(),e.index()+1,s)&&o.setNodeMarkup(o.mapping.map(n.before()),s)}e(o.scrollIntoView())}return!0};var es;function ns(t,e,n){let r,i,o=e.nodeBefore,s=e.nodeAfter;if(o.type.spec.isolating||s.type.spec.isolating)return!1;if(function(t,e,n){let r=e.nodeBefore,i=e.nodeAfter,o=e.index();return!(!(r&&i&&r.type.compatibleContent(i.type))||(!r.content.size&&e.parent.canReplace(o-1,o)?(n&&n(t.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),0):!e.parent.canReplace(o,o+1)||!i.isTextblock&&!ze(t.doc,e.pos)||(n&&n(t.tr.clearIncompatible(e.pos,r.type,r.contentMatchAt(r.childCount)).join(e.pos).scrollIntoView()),0)))}(t,e,n))return!0;let l=e.parent.canReplace(e.index(),e.index()+1);if(l&&(r=(i=o.contentMatchAt(o.childCount)).findWrapping(s.type))&&i.matchType(r[0]||s.type).validEnd){if(n){let i=e.pos+s.nodeSize,l=dt.empty;for(let t=r.length-1;t>=0;t--)l=dt.from(r[t].create(null,l));l=dt.from(o.copy(l));let a=t.tr.step(new Te(e.pos-1,i,e.pos,i,new vt(l,1,0),r.length,!0)),c=i+2*r.length;ze(a.doc,c)&&a.join(c),n(a.scrollIntoView())}return!0}let a=Xe.findFrom(e,1),c=a&&a.$from.blockRange(a.$to),h=c&&$e(c);if(null!=h&&h>=e.depth)return n&&n(t.tr.lift(c,h).scrollIntoView()),!0;if(l&&Yo(s,"start",!0)&&Yo(o,"end")){let r=o,i=[];for(;i.push(r),!r.isTextblock;)r=r.lastChild;let l=s,a=1;for(;!l.isTextblock;l=l.firstChild)a++;if(r.canReplace(r.childCount,r.childCount,l.content)){if(n){let r=dt.empty;for(let t=i.length-1;t>=0;t--)r=dt.from(i[t].copy(r));n(t.tr.step(new Te(e.pos-i.length,e.pos+s.nodeSize,e.pos+a,e.pos+s.nodeSize-a,new vt(r,i.length,0),0,!0)).scrollIntoView())}return!0}}return!1}function rs(t){return function(e,n){let r=e.selection,i=t<0?r.$from:r.$to,o=i.depth;for(;i.node(o).isInline;){if(!o)return!1;o--}return!!i.node(o).isTextblock&&(n&&n(e.tr.setSelection(nn.create(e.doc,t<0?i.start(o):i.end(o)))),!0)}}const is=rs(-1),ss=rs(1);function ls(t,e=null){return function(n,r){let{$from:i,$to:o}=n.selection,s=i.blockRange(o),l=s&&Pe(s,t,e);return!!l&&(r&&r(n.tr.wrap(s,l).scrollIntoView()),!0)}}function as(t,e=null){return function(n,r){let i=!1;for(let o=0;o<n.selection.ranges.length&&!i;o++){let{$from:{pos:r},$to:{pos:s}}=n.selection.ranges[o];n.doc.nodesBetween(r,s,((r,o)=>{if(i)return!1;if(r.isTextblock&&!r.hasMarkup(t,e))if(r.type==t)i=!0;else{let e=n.doc.resolve(o),r=e.index();i=e.parent.canReplaceWith(r,r+1,t)}}))}if(!i)return!1;if(r){let i=n.tr;for(let r=0;r<n.selection.ranges.length;r++){let{$from:{pos:o},$to:{pos:s}}=n.selection.ranges[r];i.setBlockType(o,s,t,e)}r(i.scrollIntoView())}return!0}}function cs(t,e=null){return function(n,r){let{empty:i,$cursor:o,ranges:s}=n.selection;if(i&&!o||!function(t,e,n){for(let r=0;r<e.length;r++){let{$from:i,$to:o}=e[r],s=0==i.depth&&t.inlineContent&&t.type.allowsMarkType(n);if(t.nodesBetween(i.pos,o.pos,(t=>{if(s)return!1;s=t.inlineContent&&t.type.allowsMarkType(n)})),s)return!0}return!1}(n.doc,s,t))return!1;if(r)if(o)t.isInSet(n.storedMarks||o.marks())?r(n.tr.removeStoredMark(t)):r(n.tr.addStoredMark(t.create(e)));else{let i=!1,o=n.tr;for(let e=0;!i&&e<s.length;e++){let{$from:r,$to:o}=s[e];i=n.doc.rangeHasMark(r.pos,o.pos,t)}for(let n=0;n<s.length;n++){let{$from:r,$to:l}=s[n];if(i)o.removeMark(r.pos,l.pos,t);else{let n=r.pos,i=l.pos,s=r.nodeAfter,a=l.nodeBefore,c=s&&s.isText?/^\s*/.exec(s.text)[0].length:0,h=a&&a.isText?/\s*$/.exec(a.text)[0].length:0;n+c<i&&(n+=c,i-=h),o.addMark(n,i,t.create(e))}}r(o.scrollIntoView())}return!0}}function hs(...t){return function(e,n,r){for(let i=0;i<t.length;i++)if(t[i](e,n,r))return!0;return!1}}let us=hs(Ho,((t,e,n)=>{let r=function(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}(t,n);if(!r)return!1;let i=Uo(r);if(!i){let n=r.blockRange(),i=n&&$e(n);return null!=i&&(e&&e(t.tr.lift(n,i).scrollIntoView()),!0)}let o=i.nodeBefore;if(!o.type.spec.isolating&&ns(t,i,e))return!0;if(0==r.parent.content.size&&(Yo(o,"end")||on.isSelectable(o))){let n=_e(t.doc,r.before(),r.after(),vt.empty);if(n&&n.slice.size<n.to-n.from){if(e){let r=t.tr.step(n);r.setSelection(Yo(o,"end")?Xe.findFrom(r.doc.resolve(r.mapping.map(i.pos,-1)),-1):on.create(r.doc,i.pos-o.nodeSize)),e(r.scrollIntoView())}return!0}}return!(!o.isAtom||i.depth!=r.depth-1)&&(e&&e(t.tr.delete(i.pos-o.nodeSize,i.pos).scrollIntoView()),!0)}),((t,e,n)=>{let{$head:r,empty:i}=t.selection,o=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):r.parentOffset>0)return!1;o=Uo(r)}let s=o&&o.nodeBefore;return!(!s||!on.isSelectable(s))&&(e&&e(t.tr.setSelection(on.create(t.doc,o.pos-s.nodeSize)).scrollIntoView()),!0)})),ds=hs(Ho,((t,e,n)=>{let r=function(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset<n.parent.content.size)?null:n}(t,n);if(!r)return!1;let i=Go(r);if(!i)return!1;let o=i.nodeAfter;if(ns(t,i,e))return!0;if(0==r.parent.content.size&&(Yo(o,"start")||on.isSelectable(o))){let n=_e(t.doc,r.before(),r.after(),vt.empty);if(n&&n.slice.size<n.to-n.from){if(e){let r=t.tr.step(n);r.setSelection(Yo(o,"start")?Xe.findFrom(r.doc.resolve(r.mapping.map(i.pos)),1):on.create(r.doc,r.mapping.map(i.pos))),e(r.scrollIntoView())}return!0}}return!(!o.isAtom||i.depth!=r.depth-1)&&(e&&e(t.tr.delete(i.pos,i.pos+o.nodeSize).scrollIntoView()),!0)}),((t,e,n)=>{let{$head:r,empty:i}=t.selection,o=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):r.parentOffset<r.parent.content.size)return!1;o=Go(r)}let s=o&&o.nodeAfter;return!(!s||!on.isSelectable(s))&&(e&&e(t.tr.setSelection(on.create(t.doc,o.pos)).scrollIntoView()),!0)}));const fs={Enter:hs(((t,e)=>{let{$head:n,$anchor:r}=t.selection;return!(!n.parent.type.spec.code||!n.sameParent(r))&&(e&&e(t.tr.insertText("\n").scrollIntoView()),!0)}),((t,e)=>{let n=t.selection,{$from:r,$to:i}=n;if(n instanceof ln||r.parent.inlineContent||i.parent.inlineContent)return!1;let o=Xo(i.parent.contentMatchAt(i.indexAfter()));if(!o||!o.isTextblock)return!1;if(e){let n=(!r.parentOffset&&i.index()<i.parent.childCount?r:i).pos,s=t.tr.insert(n,o.createAndFill());s.setSelection(nn.create(s.doc,n+1)),e(s.scrollIntoView())}return!0}),((t,e)=>{let{$cursor:n}=t.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let r=n.before();if(Re(t.doc,r))return e&&e(t.tr.split(r).scrollIntoView()),!0}let r=n.blockRange(),i=r&&$e(r);return null!=i&&(e&&e(t.tr.lift(r,i).scrollIntoView()),!0)}),ts),"Mod-Enter":Qo,Backspace:us,"Mod-Backspace":us,"Shift-Backspace":us,Delete:ds,"Mod-Delete":ds,"Mod-a":(t,e)=>(e&&e(t.tr.setSelection(new ln(t.doc))),!0)},ps={"Ctrl-h":fs.Backspace,"Alt-Backspace":fs["Mod-Backspace"],"Ctrl-d":fs.Delete,"Ctrl-Alt-Backspace":fs["Mod-Delete"],"Alt-Delete":fs["Mod-Delete"],"Alt-d":fs["Mod-Delete"],"Ctrl-a":is,"Ctrl-e":ss};for(let os in fs)ps[os]=fs[os];const ms=("undefined"!=typeof navigator?/Mac|iP(hone|[oa]d)/.test(navigator.platform):!("undefined"==typeof os||!os.platform)&&"darwin"==os.platform())?ps:fs;class gs{constructor(t,e,n={}){var r;this.match=t,this.match=t,this.handler="string"==typeof e?(r=e,function(t,e,n,i){let o=r;if(e[1]){let t=e[0].lastIndexOf(e[1]);o+=e[0].slice(t+e[1].length);let r=(n+=t)-i;r>0&&(o=e[0].slice(t-r,t)+o,n=i)}return t.tr.insertText(o,n,i)}):e,this.undoable=!1!==n.undoable}}const ys=500;function vs({rules:t}){let e=new vn({state:{init:()=>null,apply(t,e){let n=t.getMeta(this);return n||(t.selectionSet||t.docChanged?null:e)}},props:{handleTextInput:(n,r,i,o)=>ws(n,r,i,o,t,e),handleDOMEvents:{compositionend:n=>{setTimeout((()=>{let{$cursor:r}=n.state.selection;r&&ws(n,r.pos,r.pos,"",t,e)}))}}},isInputRules:!0});return e}function ws(t,e,n,r,i,o){if(t.composing)return!1;let s=t.state,l=s.doc.resolve(e);if(l.parent.type.spec.code)return!1;let a=l.parent.textBetween(Math.max(0,l.parentOffset-ys),l.parentOffset,null,"")+r;for(let c=0;c<i.length;c++){let l=i[c],h=l.match.exec(a),u=h&&l.handler(s,h,e-(h[0].length-r.length),n);if(u)return l.undoable&&u.setMeta(o,{transform:u,from:e,to:n,text:r}),t.dispatch(u),!0}return!1}const bs=(t,e)=>{let n=t.plugins;for(let r=0;r<n.length;r++){let i,o=n[r];if(o.spec.isInputRules&&(i=o.getState(t))){if(e){let n=t.tr,r=i.transform;for(let t=r.steps.length-1;t>=0;t--)n.step(r.steps[t].invert(r.docs[t]));if(i.text){let e=n.doc.resolve(i.from).marks();n.replaceWith(i.from,i.to,t.schema.text(i.text,e))}else n.delete(i.from,i.to);e(n)}return!0}}return!1};function xs(t,e,n=null,r){return new gs(t,((t,i,o,s)=>{let l=n instanceof Function?n(i):n,a=t.tr.delete(o,s),c=a.doc.resolve(o).blockRange(),h=c&&Pe(c,e,l);if(!h)return null;a.wrap(c,h);let u=a.doc.resolve(o-1).nodeBefore;return u&&u.type==e&&ze(a.doc,o-1)&&(!r||r(i,u))&&a.join(o-1),a}))}function Ss(t,e,n=null){return new gs(t,((t,r,i,o)=>{let s=t.doc.resolve(i),l=n instanceof Function?n(r):n;return s.node(-1).canReplaceWith(s.index(-1),s.indexAfter(-1),e)?t.tr.delete(i,o).setBlockType(i,i,e,l):null}))}new gs(/--$/,"—"),new gs(/\.\.\.$/,"…"),new gs(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(")$/,"“"),new gs(/"$/,"”"),new gs(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(')$/,"‘"),new gs(/'$/,"’");const ks=["ol",0],Ms=["ul",0],Os=["li",0],Cs={attrs:{order:{default:1}},parseDOM:[{tag:"ol",getAttrs:t=>({order:t.hasAttribute("start")?+t.getAttribute("start"):1})}],toDOM:t=>1==t.attrs.order?ks:["ol",{start:t.attrs.order},0]},Ds={parseDOM:[{tag:"ul"}],toDOM:()=>Ms},Ns={parseDOM:[{tag:"li"}],toDOM:()=>Os,defining:!0};function Ts(t,e){let n={};for(let r in t)n[r]=t[r];for(let r in e)n[r]=e[r];return n}function As(t,e,n){return t.append({ordered_list:Ts(Cs,{content:"list_item+",group:n}),bullet_list:Ts(Ds,{content:"list_item+",group:n}),list_item:Ts(Ns,{content:e})})}function Es(t,e=null){return function(n,r){let{$from:i,$to:o}=n.selection,s=i.blockRange(o),l=!1,a=s;if(!s)return!1;if(s.depth>=2&&i.node(s.depth-1).type.compatibleContent(t)&&0==s.startIndex){if(0==i.index(s.depth-1))return!1;let t=n.doc.resolve(s.start-2);a=new It(t,t,s.depth),s.endIndex<s.parent.childCount&&(s=new It(i,n.doc.resolve(o.end(s.depth)),s.depth)),l=!0}let c=Pe(a,t,e,s);return!!c&&(r&&r(function(t,e,n,r,i){let o=dt.empty;for(let h=n.length-1;h>=0;h--)o=dt.from(n[h].type.create(n[h].attrs,o));t.step(new Te(e.start-(r?2:0),e.end,e.start,e.end,new vt(o,0,0),n.length,!0));let s=0;for(let h=0;h<n.length;h++)n[h].type==i&&(s=h+1);let l=n.length-s,a=e.start+n.length-(r?2:0),c=e.parent;for(let h=e.startIndex,u=e.endIndex,d=!0;h<u;h++,d=!1)!d&&Re(t.doc,a,l)&&(t.split(a,l),a+=2*l),a+=c.child(h).nodeSize;return t}(n.tr,s,c,l,t).scrollIntoView()),!0)}}function $s(t,e){return function(n,r){let{$from:i,$to:o,node:s}=n.selection;if(s&&s.isBlock||i.depth<2||!i.sameParent(o))return!1;let l=i.node(-1);if(l.type!=t)return!1;if(0==i.parent.content.size&&i.node(-1).childCount==i.indexAfter(-1)){if(3==i.depth||i.node(-3).type!=t||i.index(-2)!=i.node(-2).childCount-1)return!1;if(r){let e=dt.empty,o=i.index(-1)?1:i.index(-2)?2:3;for(let t=i.depth-o;t>=i.depth-3;t--)e=dt.from(i.node(t).copy(e));let s=i.indexAfter(-1)<i.node(-2).childCount?1:i.indexAfter(-2)<i.node(-3).childCount?2:3;e=e.append(dt.from(t.createAndFill()));let l=i.before(i.depth-(o-1)),a=n.tr.replace(l,i.after(-s),new vt(e,4-o,0)),c=-1;a.doc.nodesBetween(l,a.doc.content.size,((t,e)=>{if(c>-1)return!1;t.isTextblock&&0==t.content.size&&(c=e+1)})),c>-1&&a.setSelection(Xe.near(a.doc.resolve(c))),r(a.scrollIntoView())}return!0}let a=o.pos==i.end()?l.contentMatchAt(0).defaultType:null,c=n.tr.delete(i.pos,o.pos),h=a?[e?{type:t,attrs:e}:null,{type:a}]:void 0;return!!Re(c.doc,i.pos,2,h)&&(r&&r(c.split(i.pos,2,h).scrollIntoView()),!0)}}function Ps(t){return function(e,n){let{$from:r,$to:i}=e.selection,o=r.blockRange(i,(e=>e.childCount>0&&e.firstChild.type==t));return!!o&&(!n||(r.node(o.depth-1).type==t?function(t,e,n,r){let i=t.tr,o=r.end,s=r.$to.end(r.depth);o<s&&(i.step(new Te(o-1,s,o,s,new vt(dt.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new It(i.doc.resolve(r.$from.pos),i.doc.resolve(s),r.depth));const l=$e(r);if(null==l)return!1;i.lift(r,l);let a=i.mapping.map(o,-1)-1;ze(i.doc,a)&&i.join(a);return e(i.scrollIntoView()),!0}(e,n,t,o):function(t,e,n){let r=t.tr,i=n.parent;for(let f=n.end,p=n.endIndex-1,m=n.startIndex;p>m;p--)f-=i.child(p).nodeSize,r.delete(f-1,f+1);let o=r.doc.resolve(n.start),s=o.nodeAfter;if(r.mapping.map(n.end)!=n.start+o.nodeAfter.nodeSize)return!1;let l=0==n.startIndex,a=n.endIndex==i.childCount,c=o.node(-1),h=o.index(-1);if(!c.canReplace(h+(l?0:1),h+1,s.content.append(a?dt.empty:dt.from(i))))return!1;let u=o.pos,d=u+s.nodeSize;return r.step(new Te(u-(l?1:0),d+(a?1:0),u+1,d-1,new vt((l?dt.empty:dt.from(i.copy(dt.empty))).append(a?dt.empty:dt.from(i.copy(dt.empty))),l?0:1,a?0:1),l?0:1)),e(r.scrollIntoView()),!0}(e,n,o)))}}function Is(t){return function(e,n){let{$from:r,$to:i}=e.selection,o=r.blockRange(i,(e=>e.childCount>0&&e.firstChild.type==t));if(!o)return!1;let s=o.startIndex;if(0==s)return!1;let l=o.parent,a=l.child(s-1);if(a.type!=t)return!1;if(n){let r=a.lastChild&&a.lastChild.type==l.type,i=dt.from(r?t.create():null),s=new vt(dt.from(t.create(null,dt.from(l.type.create(null,i)))),r?3:1,0),c=o.start,h=o.end;n(e.tr.step(new Te(c-(r?3:1),h,c,h,s,1,!0)).scrollIntoView())}return!0}}var Rs=200,zs=function(){};zs.prototype.append=function(t){return t.length?(t=zs.from(t),!this.length&&t||t.length<Rs&&this.leafAppend(t)||this.length<Rs&&t.leafPrepend(this)||this.appendInner(t)):this},zs.prototype.prepend=function(t){return t.length?zs.from(t).append(this):this},zs.prototype.appendInner=function(t){return new Bs(this,t)},zs.prototype.slice=function(t,e){return void 0===t&&(t=0),void 0===e&&(e=this.length),t>=e?zs.empty:this.sliceInner(Math.max(0,t),Math.min(this.length,e))},zs.prototype.get=function(t){if(!(t<0||t>=this.length))return this.getInner(t)},zs.prototype.forEach=function(t,e,n){void 0===e&&(e=0),void 0===n&&(n=this.length),e<=n?this.forEachInner(t,e,n,0):this.forEachInvertedInner(t,e,n,0)},zs.prototype.map=function(t,e,n){void 0===e&&(e=0),void 0===n&&(n=this.length);var r=[];return this.forEach((function(e,n){return r.push(t(e,n))}),e,n),r},zs.from=function(t){return t instanceof zs?t:t&&t.length?new _s(t):zs.empty};var _s=function(t){function e(e){t.call(this),this.values=e}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(t,n){return 0==t&&n==this.length?this:new e(this.values.slice(t,n))},e.prototype.getInner=function(t){return this.values[t]},e.prototype.forEachInner=function(t,e,n,r){for(var i=e;i<n;i++)if(!1===t(this.values[i],r+i))return!1},e.prototype.forEachInvertedInner=function(t,e,n,r){for(var i=e-1;i>=n;i--)if(!1===t(this.values[i],r+i))return!1},e.prototype.leafAppend=function(t){if(this.length+t.length<=Rs)return new e(this.values.concat(t.flatten()))},e.prototype.leafPrepend=function(t){if(this.length+t.length<=Rs)return new e(t.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e}(zs);zs.empty=new _s([]);var Bs=function(t){function e(e,n){t.call(this),this.left=e,this.right=n,this.length=e.length+n.length,this.depth=Math.max(e.depth,n.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(t){return t<this.left.length?this.left.get(t):this.right.get(t-this.left.length)},e.prototype.forEachInner=function(t,e,n,r){var i=this.left.length;return!(e<i&&!1===this.left.forEachInner(t,e,Math.min(n,i),r))&&(!(n>i&&!1===this.right.forEachInner(t,Math.max(e-i,0),Math.min(this.length,n)-i,r+i))&&void 0)},e.prototype.forEachInvertedInner=function(t,e,n,r){var i=this.left.length;return!(e>i&&!1===this.right.forEachInvertedInner(t,e-i,Math.max(n,i)-i,r+i))&&(!(n<i&&!1===this.left.forEachInvertedInner(t,Math.min(e,i),n,r))&&void 0)},e.prototype.sliceInner=function(t,e){if(0==t&&e==this.length)return this;var n=this.left.length;return e<=n?this.left.slice(t,e):t>=n?this.right.slice(t-n,e-n):this.left.slice(t,n).append(this.right.slice(0,e-n))},e.prototype.leafAppend=function(t){var n=this.right.leafAppend(t);if(n)return new e(this.left,n)},e.prototype.leafPrepend=function(t){var n=this.left.leafPrepend(t);if(n)return new e(n,this.right)},e.prototype.appendInner=function(t){return this.left.depth>=Math.max(this.right.depth,t.depth)+1?new e(this.left,new e(this.right,t)):new e(this,t)},e}(zs),js=zs;class Vs{constructor(t,e){this.items=t,this.eventCount=e}popEvent(t,e){if(0==this.eventCount)return null;let n,r,i=this.items.length;for(;;i--){if(this.items.get(i-1).selection){--i;break}}e&&(n=this.remapping(i,this.items.length),r=n.maps.length);let o,s,l=t.tr,a=[],c=[];return this.items.forEach(((t,e)=>{if(!t.step)return n||(n=this.remapping(i,e+1),r=n.maps.length),r--,void c.push(t);if(n){c.push(new Fs(t.map));let e,i=t.step.map(n.slice(r));i&&l.maybeStep(i).doc&&(e=l.mapping.maps[l.mapping.maps.length-1],a.push(new Fs(e,void 0,void 0,a.length+c.length))),r--,e&&n.appendMap(e,r)}else l.maybeStep(t.step);return t.selection?(o=n?t.selection.map(n.slice(r)):t.selection,s=new Vs(this.items.slice(0,i).append(c.reverse().concat(a)),this.eventCount-1),!1):void 0}),this.items.length,0),{remaining:s,transform:l,selection:o}}addTransform(t,e,n,r){let i=[],o=this.eventCount,s=this.items,l=!r&&s.length?s.get(s.length-1):null;for(let c=0;c<t.steps.length;c++){let n,a=t.steps[c].invert(t.docs[c]),h=new Fs(t.mapping.maps[c],a,e);(n=l&&l.merge(h))&&(h=n,c?i.pop():s=s.slice(0,s.length-1)),i.push(h),e&&(o++,e=void 0),r||(l=h)}let a=o-n.depth;return a>Ws&&(s=function(t,e){let n;return t.forEach(((t,r)=>{if(t.selection&&0==e--)return n=r,!1})),t.slice(n)}(s,a),o-=a),new Vs(s.append(i),o)}remapping(t,e){let n=new we;return this.items.forEach(((e,r)=>{let i=null!=e.mirrorOffset&&r-e.mirrorOffset>=t?n.maps.length-e.mirrorOffset:void 0;n.appendMap(e.map,i)}),t,e),n}addMaps(t){return 0==this.eventCount?this:new Vs(this.items.append(t.map((t=>new Fs(t)))),this.eventCount)}rebased(t,e){if(!this.eventCount)return this;let n=[],r=Math.max(0,this.items.length-e),i=t.mapping,o=t.steps.length,s=this.eventCount;this.items.forEach((t=>{t.selection&&s--}),r);let l=e;this.items.forEach((e=>{let r=i.getMirror(--l);if(null==r)return;o=Math.min(o,r);let a=i.maps[r];if(e.step){let o=t.steps[r].invert(t.docs[r]),c=e.selection&&e.selection.map(i.slice(l+1,r));c&&s++,n.push(new Fs(a,o,c))}else n.push(new Fs(a))}),r);let a=[];for(let u=e;u<o;u++)a.push(new Fs(i.maps[u]));let c=this.items.slice(0,r).append(a).append(n),h=new Vs(c,s);return h.emptyItemCount()>500&&(h=h.compress(this.items.length-n.length)),h}emptyItemCount(){let t=0;return this.items.forEach((e=>{e.step||t++})),t}compress(t=this.items.length){let e=this.remapping(0,t),n=e.maps.length,r=[],i=0;return this.items.forEach(((o,s)=>{if(s>=t)r.push(o),o.selection&&i++;else if(o.step){let t=o.step.map(e.slice(n)),s=t&&t.getMap();if(n--,s&&e.appendMap(s,n),t){let l=o.selection&&o.selection.map(e.slice(n));l&&i++;let a,c=new Fs(s.invert(),t,l),h=r.length-1;(a=r.length&&r[h].merge(c))?r[h]=a:r.push(c)}}else o.map&&n--}),this.items.length,0),new Vs(js.from(r.reverse()),i)}}Vs.empty=new Vs(js.empty,0);class Fs{constructor(t,e,n,r){this.map=t,this.step=e,this.selection=n,this.mirrorOffset=r}merge(t){if(this.step&&t.step&&!t.selection){let e=t.step.merge(this.step);if(e)return new Fs(e.getMap().invert(),e,this.selection)}}}class Ls{constructor(t,e,n,r,i){this.done=t,this.undone=e,this.prevRanges=n,this.prevTime=r,this.prevComposition=i}}const Ws=20;function qs(t){let e=[];return t.forEach(((t,n,r,i)=>e.push(r,i))),e}function Js(t,e){if(!t)return null;let n=[];for(let r=0;r<t.length;r+=2){let i=e.map(t[r],1),o=e.map(t[r+1],-1);i<=o&&n.push(i,o)}return n}function Ks(t,e,n,r){let i=Us(e),o=Gs.get(e).spec.config,s=(r?t.undone:t.done).popEvent(e,i);if(!s)return;let l=s.selection.resolve(s.transform.doc),a=(r?t.done:t.undone).addTransform(s.transform,e.selection.getBookmark(),o,i),c=new Ls(r?a:s.remaining,r?s.remaining:a,null,0,-1);n(s.transform.setSelection(l).setMeta(Gs,{redo:r,historyState:c}).scrollIntoView())}let Hs=!1,Ys=null;function Us(t){let e=t.plugins;if(Ys!=e){Hs=!1,Ys=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){Hs=!0;break}}return Hs}const Gs=new xn("history"),Zs=new xn("closeHistory");function Xs(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new vn({key:Gs,state:{init:()=>new Ls(Vs.empty,Vs.empty,null,0,-1),apply:(e,n,r)=>function(t,e,n,r){let i,o=n.getMeta(Gs);if(o)return o.historyState;n.getMeta(Zs)&&(t=new Ls(t.done,t.undone,null,0,-1));let s=n.getMeta("appendedTransaction");if(0==n.steps.length)return t;if(s&&s.getMeta(Gs))return s.getMeta(Gs).redo?new Ls(t.done.addTransform(n,void 0,r,Us(e)),t.undone,qs(n.mapping.maps[n.steps.length-1]),t.prevTime,t.prevComposition):new Ls(t.done,t.undone.addTransform(n,void 0,r,Us(e)),null,t.prevTime,t.prevComposition);if(!1===n.getMeta("addToHistory")||s&&!1===s.getMeta("addToHistory"))return(i=n.getMeta("rebased"))?new Ls(t.done.rebased(n,i),t.undone.rebased(n,i),Js(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new Ls(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),Js(t.prevRanges,n.mapping),t.prevTime,t.prevComposition);{let i=n.getMeta("composition"),o=0==t.prevTime||!s&&t.prevComposition!=i&&(t.prevTime<(n.time||0)-r.newGroupDelay||!function(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach(((t,r)=>{for(let i=0;i<e.length;i+=2)t<=e[i+1]&&r>=e[i]&&(n=!0)})),n}(n,t.prevRanges)),l=s?Js(t.prevRanges,n.mapping):qs(n.mapping.maps[n.steps.length-1]);return new Ls(t.done.addTransform(n,o?e.selection.getBookmark():void 0,r,Us(e)),Vs.empty,l,n.time,null==i?t.prevComposition:i)}}(n,r,e,t)},config:t,props:{handleDOMEvents:{beforeinput(t,e){let n=e.inputType,r="historyUndo"==n?Qs:"historyRedo"==n?tl:null;return!!r&&(e.preventDefault(),r(t.state,t.dispatch))}}}})}const Qs=(t,e)=>{let n=Gs.getState(t);return!(!n||0==n.done.eventCount)&&(e&&Ks(n,t,e,!1),!0)},tl=(t,e)=>{let n=Gs.getState(t);return!(!n||0==n.undone.eventCount)&&(e&&Ks(n,t,e,!0),!0)};function el(t){let e=Gs.getState(t);return e?e.done.eventCount:0}function nl(t){let e=Gs.getState(t);return e?e.undone.eventCount:0}
/*!
* portal-vue © Thorsten Lünborg, 2019
*
* Version: 2.1.7
*
* LICENCE: MIT
*
* https://github.com/linusborg/portal-vue
*
*/function rl(t){return(rl="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function il(t){return function(t){if(Array.isArray(t)){for(var e=0,n=new Array(t.length);e<t.length;e++)n[e]=t[e];return n}}(t)||function(t){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t))return Array.from(t)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}var ol="undefined"!=typeof window;function sl(t,e){return e.reduce((function(e,n){return t.hasOwnProperty(n)&&(e[n]=t[n]),e}),{})}var ll={},al={},cl={},hl=Vue.extend({data:function(){return{transports:ll,targets:al,sources:cl,trackInstances:ol}},methods:{open:function(t){if(ol){var e=t.to,n=t.from,r=t.passengers,i=t.order,o=void 0===i?1/0:i;if(e&&n&&r){var s,l={to:e,from:n,passengers:(s=r,Array.isArray(s)||"object"===rl(s)?Object.freeze(s):s),order:o};-1===Object.keys(this.transports).indexOf(e)&&Vue.set(this.transports,e,[]);var a,c=this.$_getTransportIndex(l),h=this.transports[e].slice(0);-1===c?h.push(l):h[c]=l,this.transports[e]=(a=function(t,e){return t.order-e.order},h.map((function(t,e){return[e,t]})).sort((function(t,e){return a(t[1],e[1])||t[0]-e[0]})).map((function(t){return t[1]})))}}},close:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=t.to,r=t.from;if(n&&(r||!1!==e)&&this.transports[n])if(e)this.transports[n]=[];else{var i=this.$_getTransportIndex(t);if(i>=0){var o=this.transports[n].slice(0);o.splice(i,1),this.transports[n]=o}}},registerTarget:function(t,e,n){ol&&(this.trackInstances&&!n&&this.targets[t]&&console.warn("[portal-vue]: Target ".concat(t," already exists")),this.$set(this.targets,t,Object.freeze([e])))},unregisterTarget:function(t){this.$delete(this.targets,t)},registerSource:function(t,e,n){ol&&(this.trackInstances&&!n&&this.sources[t]&&console.warn("[portal-vue]: source ".concat(t," already exists")),this.$set(this.sources,t,Object.freeze([e])))},unregisterSource:function(t){this.$delete(this.sources,t)},hasTarget:function(t){return!(!this.targets[t]||!this.targets[t][0])},hasSource:function(t){return!(!this.sources[t]||!this.sources[t][0])},hasContentFor:function(t){return!!this.transports[t]&&!!this.transports[t].length},$_getTransportIndex:function(t){var e=t.to,n=t.from;for(var r in this.transports[e])if(this.transports[e][r].from===n)return+r;return-1}}}),ul=new hl(ll),dl=1,fl=Vue.extend({name:"portal",props:{disabled:{type:Boolean},name:{type:String,default:function(){return String(dl++)}},order:{type:Number,default:0},slim:{type:Boolean},slotProps:{type:Object,default:function(){return{}}},tag:{type:String,default:"DIV"},to:{type:String,default:function(){return String(Math.round(1e7*Math.random()))}}},created:function(){var t=this;this.$nextTick((function(){ul.registerSource(t.name,t)}))},mounted:function(){this.disabled||this.sendUpdate()},updated:function(){this.disabled?this.clear():this.sendUpdate()},beforeDestroy:function(){ul.unregisterSource(this.name),this.clear()},watch:{to:function(t,e){e&&e!==t&&this.clear(e),this.sendUpdate()}},methods:{clear:function(t){var e={from:this.name,to:t||this.to};ul.close(e)},normalizeSlots:function(){return this.$scopedSlots.default?[this.$scopedSlots.default]:this.$slots.default},normalizeOwnChildren:function(t){return"function"==typeof t?t(this.slotProps):t},sendUpdate:function(){var t=this.normalizeSlots();if(t){var e={from:this.name,to:this.to,passengers:il(t),order:this.order};ul.open(e)}else this.clear()}},render:function(t){var e=this.$slots.default||this.$scopedSlots.default||[],n=this.tag;return e&&this.disabled?e.length<=1&&this.slim?this.normalizeOwnChildren(e)[0]:t(n,[this.normalizeOwnChildren(e)]):this.slim?t():t(n,{class:{"v-portal":!0},style:{display:"none"},key:"v-portal-placeholder"})}}),pl=Vue.extend({name:"portalTarget",props:{multiple:{type:Boolean,default:!1},name:{type:String,required:!0},slim:{type:Boolean,default:!1},slotProps:{type:Object,default:function(){return{}}},tag:{type:String,default:"div"},transition:{type:[String,Object,Function]}},data:function(){return{transports:ul.transports,firstRender:!0}},created:function(){var t=this;this.$nextTick((function(){ul.registerTarget(t.name,t)}))},watch:{ownTransports:function(){this.$emit("change",this.children().length>0)},name:function(t,e){ul.unregisterTarget(e),ul.registerTarget(t,this)}},mounted:function(){var t=this;this.transition&&this.$nextTick((function(){t.firstRender=!1}))},beforeDestroy:function(){ul.unregisterTarget(this.name)},computed:{ownTransports:function(){var t=this.transports[this.name]||[];return this.multiple?t:0===t.length?[]:[t[t.length-1]]},passengers:function(){return function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t.reduce((function(t,n){var r=n.passengers[0],i="function"==typeof r?r(e):n.passengers;return t.concat(i)}),[])}(this.ownTransports,this.slotProps)}},methods:{children:function(){return 0!==this.passengers.length?this.passengers:this.$scopedSlots.default?this.$scopedSlots.default(this.slotProps):this.$slots.default||[]},noWrapper:function(){var t=this.slim&&!this.transition;return t&&this.children().length>1&&console.warn("[portal-vue]: PortalTarget with `slim` option received more than one child element."),t}},render:function(t){var e=this.noWrapper(),n=this.children(),r=this.transition||this.tag;return e?n[0]:this.slim&&!r?t():t(r,{props:{tag:this.transition&&this.tag?this.tag:void 0},class:{"vue-portal-target":!0}},n)}}),ml=0,gl=["disabled","name","order","slim","slotProps","tag","to"],yl=["multiple","transition"],vl=Vue.extend({name:"MountingPortal",inheritAttrs:!1,props:{append:{type:[Boolean,String]},bail:{type:Boolean},mountTo:{type:String,required:!0},disabled:{type:Boolean},name:{type:String,default:function(){return"mounted_"+String(ml++)}},order:{type:Number,default:0},slim:{type:Boolean},slotProps:{type:Object,default:function(){return{}}},tag:{type:String,default:"DIV"},to:{type:String,default:function(){return String(Math.round(1e7*Math.random()))}},multiple:{type:Boolean,default:!1},targetSlim:{type:Boolean},targetSlotProps:{type:Object,default:function(){return{}}},targetTag:{type:String,default:"div"},transition:{type:[String,Object,Function]}},created:function(){if("undefined"!=typeof document){var t=document.querySelector(this.mountTo);if(t){var e=this.$props;if(ul.targets[e.name])e.bail?console.warn("[portal-vue]: Target ".concat(e.name," is already mounted.\n Aborting because 'bail: true' is set")):this.portalTarget=ul.targets[e.name];else{var n=e.append;if(n){var r="string"==typeof n?n:"DIV",i=document.createElement(r);t.appendChild(i),t=i}var o=sl(this.$props,yl);o.slim=this.targetSlim,o.tag=this.targetTag,o.slotProps=this.targetSlotProps,o.name=this.to,this.portalTarget=new pl({el:t,parent:this.$parent||this,propsData:o})}}else console.error("[portal-vue]: Mount Point '".concat(this.mountTo,"' not found in document"))}},beforeDestroy:function(){var t=this.portalTarget;if(this.append){var e=t.$el;e.parentNode.removeChild(e)}t.$destroy()},render:function(t){if(!this.portalTarget)return console.warn("[portal-vue] Target wasn't mounted"),t();if(!this.$scopedSlots.manual){var e=sl(this.$props,gl);return t(fl,{props:e,attrs:this.$attrs,on:this.$listeners,scopedSlots:this.$scopedSlots},this.$slots.default)}var n=this.$scopedSlots.manual({to:this.to});return Array.isArray(n)&&(n=n[0]),n||t()}});var wl={install:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};t.component(e.portalName||"Portal",fl),t.component(e.portalTargetName||"PortalTarget",pl),t.component(e.MountingPortalName||"MountingPortal",vl)}},bl=new Map;function xl(t){var e=bl.get(t);e&&e.destroy()}function Sl(t){var e=bl.get(t);e&&e.update()}var kl=null;"undefined"==typeof window?((kl=function(t){return t}).destroy=function(t){return t},kl.update=function(t){return t}):((kl=function(t,e){return t&&Array.prototype.forEach.call(t.length?t:[t],(function(t){return function(t){if(t&&t.nodeName&&"TEXTAREA"===t.nodeName&&!bl.has(t)){var e,n=null,r=window.getComputedStyle(t),i=(e=t.value,function(){s({testForHeightReduction:""===e||!t.value.startsWith(e),restoreTextAlign:null}),e=t.value}),o=function(e){t.removeEventListener("autosize:destroy",o),t.removeEventListener("autosize:update",l),t.removeEventListener("input",i),window.removeEventListener("resize",l),Object.keys(e).forEach((function(n){return t.style[n]=e[n]})),bl.delete(t)}.bind(t,{height:t.style.height,resize:t.style.resize,textAlign:t.style.textAlign,overflowY:t.style.overflowY,overflowX:t.style.overflowX,wordWrap:t.style.wordWrap});t.addEventListener("autosize:destroy",o),t.addEventListener("autosize:update",l),t.addEventListener("input",i),window.addEventListener("resize",l),t.style.overflowX="hidden",t.style.wordWrap="break-word",bl.set(t,{destroy:o,update:l}),l()}function s(e){var i,o,l=e.restoreTextAlign,a=void 0===l?null:l,c=e.testForHeightReduction,h=void 0===c||c,u=r.overflowY;if(0!==t.scrollHeight&&("vertical"===r.resize?t.style.resize="none":"both"===r.resize&&(t.style.resize="horizontal"),h&&(i=function(t){for(var e=[];t&&t.parentNode&&t.parentNode instanceof Element;)t.parentNode.scrollTop&&e.push([t.parentNode,t.parentNode.scrollTop]),t=t.parentNode;return function(){return e.forEach((function(t){var e=t[0],n=t[1];e.style.scrollBehavior="auto",e.scrollTop=n,e.style.scrollBehavior=null}))}}(t),t.style.height=""),o="content-box"===r.boxSizing?t.scrollHeight-(parseFloat(r.paddingTop)+parseFloat(r.paddingBottom)):t.scrollHeight+parseFloat(r.borderTopWidth)+parseFloat(r.borderBottomWidth),"none"!==r.maxHeight&&o>parseFloat(r.maxHeight)?("hidden"===r.overflowY&&(t.style.overflow="scroll"),o=parseFloat(r.maxHeight)):"hidden"!==r.overflowY&&(t.style.overflow="hidden"),t.style.height=o+"px",a&&(t.style.textAlign=a),i&&i(),n!==o&&(t.dispatchEvent(new Event("autosize:resized",{bubbles:!0})),n=o),u!==r.overflow&&!a)){var d=r.textAlign;"hidden"===r.overflow&&(t.style.textAlign="start"===d?"end":"start"),s({restoreTextAlign:d,testForHeightReduction:!0})}}function l(){s({testForHeightReduction:!0,restoreTextAlign:null})}}(t)})),t}).destroy=function(t){return t&&Array.prototype.forEach.call(t.length?t:[t],xl),t},kl.update=function(t){return t&&Array.prototype.forEach.call(t.length?t:[t],Sl),t});var Ml=kl,Ol={exports:{}};Ol.exports=function(){var t=1e3,e=6e4,n=36e5,r="millisecond",i="second",o="minute",s="hour",l="day",a="week",c="month",h="quarter",u="year",d="date",f="Invalid Date",p=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,m=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,g={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(t){var e=["th","st","nd","rd"],n=t%100;return"["+t+(e[(n-20)%10]||e[n]||e[0])+"]"}},y=function(t,e,n){var r=String(t);return!r||r.length>=e?t:""+Array(e+1-r.length).join(n)+t},v={s:y,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),r=Math.floor(n/60),i=n%60;return(e<=0?"+":"-")+y(r,2,"0")+":"+y(i,2,"0")},m:function t(e,n){if(e.date()<n.date())return-t(n,e);var r=12*(n.year()-e.year())+(n.month()-e.month()),i=e.clone().add(r,c),o=n-i<0,s=e.clone().add(r+(o?-1:1),c);return+(-(r+(n-i)/(o?i-s:s-i))||0)},a:function(t){return t<0?Math.ceil(t)||0:Math.floor(t)},p:function(t){return{M:c,y:u,w:a,d:l,D:d,h:s,m:o,s:i,ms:r,Q:h}[t]||String(t||"").toLowerCase().replace(/s$/,"")},u:function(t){return void 0===t}},w="en",b={};b[w]=g;var x="$isDayjsObject",S=function(t){return t instanceof C||!(!t||!t[x])},k=function t(e,n,r){var i;if(!e)return w;if("string"==typeof e){var o=e.toLowerCase();b[o]&&(i=o),n&&(b[o]=n,i=o);var s=e.split("-");if(!i&&s.length>1)return t(s[0])}else{var l=e.name;b[l]=e,i=l}return!r&&i&&(w=i),i||!r&&w},M=function(t,e){if(S(t))return t.clone();var n="object"==typeof e?e:{};return n.date=t,n.args=arguments,new C(n)},O=v;O.l=k,O.i=S,O.w=function(t,e){return M(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var C=function(){function g(t){this.$L=k(t.locale,null,!0),this.parse(t),this.$x=this.$x||t.x||{},this[x]=!0}var y=g.prototype;return y.parse=function(t){this.$d=function(t){var e=t.date,n=t.utc;if(null===e)return new Date(NaN);if(O.u(e))return new Date;if(e instanceof Date)return new Date(e);if("string"==typeof e&&!/Z$/i.test(e)){var r=e.match(p);if(r){var i=r[2]-1||0,o=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,o)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,o)}}return new Date(e)}(t),this.init()},y.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds()},y.$utils=function(){return O},y.isValid=function(){return!(this.$d.toString()===f)},y.isSame=function(t,e){var n=M(t);return this.startOf(e)<=n&&n<=this.endOf(e)},y.isAfter=function(t,e){return M(t)<this.startOf(e)},y.isBefore=function(t,e){return this.endOf(e)<M(t)},y.$g=function(t,e,n){return O.u(t)?this[e]:this.set(n,t)},y.unix=function(){return Math.floor(this.valueOf()/1e3)},y.valueOf=function(){return this.$d.getTime()},y.startOf=function(t,e){var n=this,r=!!O.u(e)||e,h=O.p(t),f=function(t,e){var i=O.w(n.$u?Date.UTC(n.$y,e,t):new Date(n.$y,e,t),n);return r?i:i.endOf(l)},p=function(t,e){return O.w(n.toDate()[t].apply(n.toDate("s"),(r?[0,0,0,0]:[23,59,59,999]).slice(e)),n)},m=this.$W,g=this.$M,y=this.$D,v="set"+(this.$u?"UTC":"");switch(h){case u:return r?f(1,0):f(31,11);case c:return r?f(1,g):f(0,g+1);case a:var w=this.$locale().weekStart||0,b=(m<w?m+7:m)-w;return f(r?y-b:y+(6-b),g);case l:case d:return p(v+"Hours",0);case s:return p(v+"Minutes",1);case o:return p(v+"Seconds",2);case i:return p(v+"Milliseconds",3);default:return this.clone()}},y.endOf=function(t){return this.startOf(t,!1)},y.$set=function(t,e){var n,a=O.p(t),h="set"+(this.$u?"UTC":""),f=(n={},n[l]=h+"Date",n[d]=h+"Date",n[c]=h+"Month",n[u]=h+"FullYear",n[s]=h+"Hours",n[o]=h+"Minutes",n[i]=h+"Seconds",n[r]=h+"Milliseconds",n)[a],p=a===l?this.$D+(e-this.$W):e;if(a===c||a===u){var m=this.clone().set(d,1);m.$d[f](p),m.init(),this.$d=m.set(d,Math.min(this.$D,m.daysInMonth())).$d}else f&&this.$d[f](p);return this.init(),this},y.set=function(t,e){return this.clone().$set(t,e)},y.get=function(t){return this[O.p(t)]()},y.add=function(r,h){var d,f=this;r=Number(r);var p=O.p(h),m=function(t){var e=M(f);return O.w(e.date(e.date()+Math.round(t*r)),f)};if(p===c)return this.set(c,this.$M+r);if(p===u)return this.set(u,this.$y+r);if(p===l)return m(1);if(p===a)return m(7);var g=(d={},d[o]=e,d[s]=n,d[i]=t,d)[p]||1,y=this.$d.getTime()+r*g;return O.w(y,this)},y.subtract=function(t,e){return this.add(-1*t,e)},y.format=function(t){var e=this,n=this.$locale();if(!this.isValid())return n.invalidDate||f;var r=t||"YYYY-MM-DDTHH:mm:ssZ",i=O.z(this),o=this.$H,s=this.$m,l=this.$M,a=n.weekdays,c=n.months,h=n.meridiem,u=function(t,n,i,o){return t&&(t[n]||t(e,r))||i[n].slice(0,o)},d=function(t){return O.s(o%12||12,t,"0")},p=h||function(t,e,n){var r=t<12?"AM":"PM";return n?r.toLowerCase():r};return r.replace(m,(function(t,r){return r||function(t){switch(t){case"YY":return String(e.$y).slice(-2);case"YYYY":return O.s(e.$y,4,"0");case"M":return l+1;case"MM":return O.s(l+1,2,"0");case"MMM":return u(n.monthsShort,l,c,3);case"MMMM":return u(c,l);case"D":return e.$D;case"DD":return O.s(e.$D,2,"0");case"d":return String(e.$W);case"dd":return u(n.weekdaysMin,e.$W,a,2);case"ddd":return u(n.weekdaysShort,e.$W,a,3);case"dddd":return a[e.$W];case"H":return String(o);case"HH":return O.s(o,2,"0");case"h":return d(1);case"hh":return d(2);case"a":return p(o,s,!0);case"A":return p(o,s,!1);case"m":return String(s);case"mm":return O.s(s,2,"0");case"s":return String(e.$s);case"ss":return O.s(e.$s,2,"0");case"SSS":return O.s(e.$ms,3,"0");case"Z":return i}return null}(t)||i.replace(":","")}))},y.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},y.diff=function(r,d,f){var p,m=this,g=O.p(d),y=M(r),v=(y.utcOffset()-this.utcOffset())*e,w=this-y,b=function(){return O.m(m,y)};switch(g){case u:p=b()/12;break;case c:p=b();break;case h:p=b()/3;break;case a:p=(w-v)/6048e5;break;case l:p=(w-v)/864e5;break;case s:p=w/n;break;case o:p=w/e;break;case i:p=w/t;break;default:p=w}return f?p:O.a(p)},y.daysInMonth=function(){return this.endOf(c).$D},y.$locale=function(){return b[this.$L]},y.locale=function(t,e){if(!t)return this.$L;var n=this.clone(),r=k(t,e,!0);return r&&(n.$L=r),n},y.clone=function(){return O.w(this.$d,this)},y.toDate=function(){return new Date(this.valueOf())},y.toJSON=function(){return this.isValid()?this.toISOString():null},y.toISOString=function(){return this.$d.toISOString()},y.toString=function(){return this.$d.toUTCString()},g}(),D=C.prototype;return M.prototype=D,[["$ms",r],["$s",i],["$m",o],["$H",s],["$W",l],["$M",c],["$y",u],["$D",d]].forEach((function(t){D[t[1]]=function(e){return this.$g(e,t[0],t[1])}})),M.extend=function(t,e){return t.$i||(t(e,C,M),t.$i=!0),M},M.locale=k,M.isDayjs=S,M.unix=function(t){return M(1e3*t)},M.en=b[w],M.Ls=b,M.p={},M}();const Cl=e(Ol.exports);var Dl={exports:{}};Dl.exports=function(){var t={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},e=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|YYYY|YY?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,n=/\d\d/,r=/\d\d?/,i=/\d*[^-_:/,()\s\d]+/,o={},s=function(t){return(t=+t)+(t>68?1900:2e3)},l=function(t){return function(e){this[t]=+e}},a=[/[+-]\d\d:?(\d\d)?|Z/,function(t){(this.zone||(this.zone={})).offset=function(t){if(!t)return 0;if("Z"===t)return 0;var e=t.match(/([+-]|\d\d)/g),n=60*e[1]+(+e[2]||0);return 0===n?0:"+"===e[0]?-n:n}(t)}],c=function(t){var e=o[t];return e&&(e.indexOf?e:e.s.concat(e.f))},h=function(t,e){var n,r=o.meridiem;if(r){for(var i=1;i<=24;i+=1)if(t.indexOf(r(i,0,e))>-1){n=i>12;break}}else n=t===(e?"pm":"PM");return n},u={A:[i,function(t){this.afternoon=h(t,!1)}],a:[i,function(t){this.afternoon=h(t,!0)}],S:[/\d/,function(t){this.milliseconds=100*+t}],SS:[n,function(t){this.milliseconds=10*+t}],SSS:[/\d{3}/,function(t){this.milliseconds=+t}],s:[r,l("seconds")],ss:[r,l("seconds")],m:[r,l("minutes")],mm:[r,l("minutes")],H:[r,l("hours")],h:[r,l("hours")],HH:[r,l("hours")],hh:[r,l("hours")],D:[r,l("day")],DD:[n,l("day")],Do:[i,function(t){var e=o.ordinal,n=t.match(/\d+/);if(this.day=n[0],e)for(var r=1;r<=31;r+=1)e(r).replace(/\[|\]/g,"")===t&&(this.day=r)}],M:[r,l("month")],MM:[n,l("month")],MMM:[i,function(t){var e=c("months"),n=(c("monthsShort")||e.map((function(t){return t.slice(0,3)}))).indexOf(t)+1;if(n<1)throw new Error;this.month=n%12||n}],MMMM:[i,function(t){var e=c("months").indexOf(t)+1;if(e<1)throw new Error;this.month=e%12||e}],Y:[/[+-]?\d+/,l("year")],YY:[n,function(t){this.year=s(t)}],YYYY:[/\d{4}/,l("year")],Z:a,ZZ:a};function d(n){var r,i;r=n,i=o&&o.formats;for(var s=(n=r.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(e,n,r){var o=r&&r.toUpperCase();return n||i[r]||t[r]||i[o].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(t,e,n){return e||n.slice(1)}))}))).match(e),l=s.length,a=0;a<l;a+=1){var c=s[a],h=u[c],d=h&&h[0],f=h&&h[1];s[a]=f?{regex:d,parser:f}:c.replace(/^\[|\]$/g,"")}return function(t){for(var e={},n=0,r=0;n<l;n+=1){var i=s[n];if("string"==typeof i)r+=i.length;else{var o=i.regex,a=i.parser,c=t.slice(r),h=o.exec(c)[0];a.call(e,h),t=t.replace(h,"")}}return function(t){var e=t.afternoon;if(void 0!==e){var n=t.hours;e?n<12&&(t.hours+=12):12===n&&(t.hours=0),delete t.afternoon}}(e),e}}return function(t,e,n){n.p.customParseFormat=!0,t&&t.parseTwoDigitYear&&(s=t.parseTwoDigitYear);var r=e.prototype,i=r.parse;r.parse=function(t){var e=t.date,r=t.utc,s=t.args;this.$u=r;var l=s[1];if("string"==typeof l){var a=!0===s[2],c=!0===s[3],h=a||c,u=s[2];c&&(u=s[2]),o=this.$locale(),!a&&u&&(o=n.Ls[u]),this.$d=function(t,e,n){try{if(["x","X"].indexOf(e)>-1)return new Date(("X"===e?1e3:1)*t);var r=d(e)(t),i=r.year,o=r.month,s=r.day,l=r.hours,a=r.minutes,c=r.seconds,h=r.milliseconds,u=r.zone,f=new Date,p=s||(i||o?1:f.getDate()),m=i||f.getFullYear(),g=0;i&&!o||(g=o>0?o-1:f.getMonth());var y=l||0,v=a||0,w=c||0,b=h||0;return u?new Date(Date.UTC(m,g,p,y,v,w,b+60*u.offset*1e3)):n?new Date(Date.UTC(m,g,p,y,v,w,b)):new Date(m,g,p,y,v,w,b)}catch(x){return new Date("")}}(e,l,r),this.init(),u&&!0!==u&&(this.$L=this.locale(u).$L),h&&e!=this.format(l)&&(this.$d=new Date("")),o={}}else if(l instanceof Array)for(var f=l.length,p=1;p<=f;p+=1){s[1]=l[p-1];var m=n.apply(this,s);if(m.isValid()){this.$d=m.$d,this.$L=m.$L,this.init();break}p===f&&(this.$d=new Date(""))}else i.call(this,t)}}}();const Nl=e(Dl.exports);function Tl(t){return{all:t=t||new Map,on:function(e,n){var r=t.get(e);r?r.push(n):t.set(e,[n])},off:function(e,n){var r=t.get(e);r&&(n?r.splice(r.indexOf(n)>>>0,1):t.set(e,[]))},emit:function(e,n){var r=t.get(e);r&&r.slice().map((function(t){t(n)})),(r=t.get("*"))&&r.slice().map((function(t){t(e,n)}))}}}
/*!
* vuex v3.6.2
* (c) 2021 Evan You
* @license MIT
*/var Al=("undefined"!=typeof window?window:"undefined"!=typeof global?global:{}).__VUE_DEVTOOLS_GLOBAL_HOOK__;function El(t,e){if(void 0===e&&(e=[]),null===t||"object"!=typeof t)return t;var n,r=(n=function(e){return e.original===t},e.filter(n)[0]);if(r)return r.copy;var i=Array.isArray(t)?[]:{};return e.push({original:t,copy:i}),Object.keys(t).forEach((function(n){i[n]=El(t[n],e)})),i}function $l(t,e){Object.keys(t).forEach((function(n){return e(t[n],n)}))}function Pl(t){return null!==t&&"object"==typeof t}var Il=function(t,e){this.runtime=e,this._children=Object.create(null),this._rawModule=t;var n=t.state;this.state=("function"==typeof n?n():n)||{}},Rl={namespaced:{configurable:!0}};Rl.namespaced.get=function(){return!!this._rawModule.namespaced},Il.prototype.addChild=function(t,e){this._children[t]=e},Il.prototype.removeChild=function(t){delete this._children[t]},Il.prototype.getChild=function(t){return this._children[t]},Il.prototype.hasChild=function(t){return t in this._children},Il.prototype.update=function(t){this._rawModule.namespaced=t.namespaced,t.actions&&(this._rawModule.actions=t.actions),t.mutations&&(this._rawModule.mutations=t.mutations),t.getters&&(this._rawModule.getters=t.getters)},Il.prototype.forEachChild=function(t){$l(this._children,t)},Il.prototype.forEachGetter=function(t){this._rawModule.getters&&$l(this._rawModule.getters,t)},Il.prototype.forEachAction=function(t){this._rawModule.actions&&$l(this._rawModule.actions,t)},Il.prototype.forEachMutation=function(t){this._rawModule.mutations&&$l(this._rawModule.mutations,t)},Object.defineProperties(Il.prototype,Rl);var zl,_l=function(t){this.register([],t,!1)};function Bl(t,e,n){if(e.update(n),n.modules)for(var r in n.modules){if(!e.getChild(r))return;Bl(t.concat(r),e.getChild(r),n.modules[r])}}_l.prototype.get=function(t){return t.reduce((function(t,e){return t.getChild(e)}),this.root)},_l.prototype.getNamespace=function(t){var e=this.root;return t.reduce((function(t,n){return t+((e=e.getChild(n)).namespaced?n+"/":"")}),"")},_l.prototype.update=function(t){Bl([],this.root,t)},_l.prototype.register=function(t,e,n){var r=this;void 0===n&&(n=!0);var i=new Il(e,n);0===t.length?this.root=i:this.get(t.slice(0,-1)).addChild(t[t.length-1],i);e.modules&&$l(e.modules,(function(e,i){r.register(t.concat(i),e,n)}))},_l.prototype.unregister=function(t){var e=this.get(t.slice(0,-1)),n=t[t.length-1],r=e.getChild(n);r&&r.runtime&&e.removeChild(n)},_l.prototype.isRegistered=function(t){var e=this.get(t.slice(0,-1)),n=t[t.length-1];return!!e&&e.hasChild(n)};var jl=function(t){var e=this;void 0===t&&(t={}),!zl&&"undefined"!=typeof window&&window.Vue&&Hl(window.Vue);var n=t.plugins;void 0===n&&(n=[]);var r=t.strict;void 0===r&&(r=!1),this._committing=!1,this._actions=Object.create(null),this._actionSubscribers=[],this._mutations=Object.create(null),this._wrappedGetters=Object.create(null),this._modules=new _l(t),this._modulesNamespaceMap=Object.create(null),this._subscribers=[],this._watcherVM=new zl,this._makeLocalGettersCache=Object.create(null);var i=this,o=this.dispatch,s=this.commit;this.dispatch=function(t,e){return o.call(i,t,e)},this.commit=function(t,e,n){return s.call(i,t,e,n)},this.strict=r;var l=this._modules.root.state;ql(this,l,[],this._modules.root),Wl(this,l),n.forEach((function(t){return t(e)})),(void 0!==t.devtools?t.devtools:zl.config.devtools)&&function(t){Al&&(t._devtoolHook=Al,Al.emit("vuex:init",t),Al.on("vuex:travel-to-state",(function(e){t.replaceState(e)})),t.subscribe((function(t,e){Al.emit("vuex:mutation",t,e)}),{prepend:!0}),t.subscribeAction((function(t,e){Al.emit("vuex:action",t,e)}),{prepend:!0}))}(this)},Vl={state:{configurable:!0}};function Fl(t,e,n){return e.indexOf(t)<0&&(n&&n.prepend?e.unshift(t):e.push(t)),function(){var n=e.indexOf(t);n>-1&&e.splice(n,1)}}function Ll(t,e){t._actions=Object.create(null),t._mutations=Object.create(null),t._wrappedGetters=Object.create(null),t._modulesNamespaceMap=Object.create(null);var n=t.state;ql(t,n,[],t._modules.root,!0),Wl(t,n,e)}function Wl(t,e,n){var r=t._vm;t.getters={},t._makeLocalGettersCache=Object.create(null);var i=t._wrappedGetters,o={};$l(i,(function(e,n){o[n]=function(t,e){return function(){return t(e)}}(e,t),Object.defineProperty(t.getters,n,{get:function(){return t._vm[n]},enumerable:!0})}));var s=zl.config.silent;zl.config.silent=!0,t._vm=new zl({data:{$$state:e},computed:o}),zl.config.silent=s,t.strict&&function(t){t._vm.$watch((function(){return this._data.$$state}),(function(){}),{deep:!0,sync:!0})}(t),r&&(n&&t._withCommit((function(){r._data.$$state=null})),zl.nextTick((function(){return r.$destroy()})))}function ql(t,e,n,r,i){var o=!n.length,s=t._modules.getNamespace(n);if(r.namespaced&&(t._modulesNamespaceMap[s],t._modulesNamespaceMap[s]=r),!o&&!i){var l=Jl(e,n.slice(0,-1)),a=n[n.length-1];t._withCommit((function(){zl.set(l,a,r.state)}))}var c=r.context=function(t,e,n){var r=""===e,i={dispatch:r?t.dispatch:function(n,r,i){var o=Kl(n,r,i),s=o.payload,l=o.options,a=o.type;return l&&l.root||(a=e+a),t.dispatch(a,s)},commit:r?t.commit:function(n,r,i){var o=Kl(n,r,i),s=o.payload,l=o.options,a=o.type;l&&l.root||(a=e+a),t.commit(a,s,l)}};return Object.defineProperties(i,{getters:{get:r?function(){return t.getters}:function(){return function(t,e){if(!t._makeLocalGettersCache[e]){var n={},r=e.length;Object.keys(t.getters).forEach((function(i){if(i.slice(0,r)===e){var o=i.slice(r);Object.defineProperty(n,o,{get:function(){return t.getters[i]},enumerable:!0})}})),t._makeLocalGettersCache[e]=n}return t._makeLocalGettersCache[e]}(t,e)}},state:{get:function(){return Jl(t.state,n)}}}),i}(t,s,n);r.forEachMutation((function(e,n){!function(t,e,n,r){var i=t._mutations[e]||(t._mutations[e]=[]);i.push((function(e){n.call(t,r.state,e)}))}(t,s+n,e,c)})),r.forEachAction((function(e,n){var r=e.root?n:s+n,i=e.handler||e;!function(t,e,n,r){var i=t._actions[e]||(t._actions[e]=[]);i.push((function(e){var i,o=n.call(t,{dispatch:r.dispatch,commit:r.commit,getters:r.getters,state:r.state,rootGetters:t.getters,rootState:t.state},e);return(i=o)&&"function"==typeof i.then||(o=Promise.resolve(o)),t._devtoolHook?o.catch((function(e){throw t._devtoolHook.emit("vuex:error",e),e})):o}))}(t,r,i,c)})),r.forEachGetter((function(e,n){!function(t,e,n,r){if(t._wrappedGetters[e])return;t._wrappedGetters[e]=function(t){return n(r.state,r.getters,t.state,t.getters)}}(t,s+n,e,c)})),r.forEachChild((function(r,o){ql(t,e,n.concat(o),r,i)}))}function Jl(t,e){return e.reduce((function(t,e){return t[e]}),t)}function Kl(t,e,n){return Pl(t)&&t.type&&(n=e,e=t,t=t.type),{type:t,payload:e,options:n}}function Hl(t){zl&&t===zl||function(t){if(Number(t.version.split(".")[0])>=2)t.mixin({beforeCreate:n});else{var e=t.prototype._init;t.prototype._init=function(t){void 0===t&&(t={}),t.init=t.init?[n].concat(t.init):n,e.call(this,t)}}function n(){var t=this.$options;t.store?this.$store="function"==typeof t.store?t.store():t.store:t.parent&&t.parent.$store&&(this.$store=t.parent.$store)}}(zl=t)}Vl.state.get=function(){return this._vm._data.$$state},Vl.state.set=function(t){},jl.prototype.commit=function(t,e,n){var r=this,i=Kl(t,e,n),o=i.type,s=i.payload,l={type:o,payload:s},a=this._mutations[o];a&&(this._withCommit((function(){a.forEach((function(t){t(s)}))})),this._subscribers.slice().forEach((function(t){return t(l,r.state)})))},jl.prototype.dispatch=function(t,e){var n=this,r=Kl(t,e),i=r.type,o=r.payload,s={type:i,payload:o},l=this._actions[i];if(l){try{this._actionSubscribers.slice().filter((function(t){return t.before})).forEach((function(t){return t.before(s,n.state)}))}catch(c){}var a=l.length>1?Promise.all(l.map((function(t){return t(o)}))):l[0](o);return new Promise((function(t,e){a.then((function(e){try{n._actionSubscribers.filter((function(t){return t.after})).forEach((function(t){return t.after(s,n.state)}))}catch(c){}t(e)}),(function(t){try{n._actionSubscribers.filter((function(t){return t.error})).forEach((function(e){return e.error(s,n.state,t)}))}catch(c){}e(t)}))}))}},jl.prototype.subscribe=function(t,e){return Fl(t,this._subscribers,e)},jl.prototype.subscribeAction=function(t,e){return Fl("function"==typeof t?{before:t}:t,this._actionSubscribers,e)},jl.prototype.watch=function(t,e,n){var r=this;return this._watcherVM.$watch((function(){return t(r.state,r.getters)}),e,n)},jl.prototype.replaceState=function(t){var e=this;this._withCommit((function(){e._vm._data.$$state=t}))},jl.prototype.registerModule=function(t,e,n){void 0===n&&(n={}),"string"==typeof t&&(t=[t]),this._modules.register(t,e),ql(this,this.state,t,this._modules.get(t),n.preserveState),Wl(this,this.state)},jl.prototype.unregisterModule=function(t){var e=this;"string"==typeof t&&(t=[t]),this._modules.unregister(t),this._withCommit((function(){var n=Jl(e.state,t.slice(0,-1));zl.delete(n,t[t.length-1])})),Ll(this)},jl.prototype.hasModule=function(t){return"string"==typeof t&&(t=[t]),this._modules.isRegistered(t)},jl.prototype.hotUpdate=function(t){this._modules.update(t),Ll(this,!0)},jl.prototype._withCommit=function(t){var e=this._committing;this._committing=!0,t(),this._committing=e},Object.defineProperties(jl.prototype,Vl);var Yl=Ql((function(t,e){var n={};return Xl(e).forEach((function(e){var r=e.key,i=e.val;n[r]=function(){var e=this.$store.state,n=this.$store.getters;if(t){var r=ta(this.$store,"mapState",t);if(!r)return;e=r.context.state,n=r.context.getters}return"function"==typeof i?i.call(this,e,n):e[i]},n[r].vuex=!0})),n})),Ul=Ql((function(t,e){var n={};return Xl(e).forEach((function(e){var r=e.key,i=e.val;n[r]=function(){for(var e=[],n=arguments.length;n--;)e[n]=arguments[n];var r=this.$store.commit;if(t){var o=ta(this.$store,"mapMutations",t);if(!o)return;r=o.context.commit}return"function"==typeof i?i.apply(this,[r].concat(e)):r.apply(this.$store,[i].concat(e))}})),n})),Gl=Ql((function(t,e){var n={};return Xl(e).forEach((function(e){var r=e.key,i=e.val;i=t+i,n[r]=function(){if(!t||ta(this.$store,"mapGetters",t))return this.$store.getters[i]},n[r].vuex=!0})),n})),Zl=Ql((function(t,e){var n={};return Xl(e).forEach((function(e){var r=e.key,i=e.val;n[r]=function(){for(var e=[],n=arguments.length;n--;)e[n]=arguments[n];var r=this.$store.dispatch;if(t){var o=ta(this.$store,"mapActions",t);if(!o)return;r=o.context.dispatch}return"function"==typeof i?i.apply(this,[r].concat(e)):r.apply(this.$store,[i].concat(e))}})),n}));function Xl(t){return function(t){return Array.isArray(t)||Pl(t)}(t)?Array.isArray(t)?t.map((function(t){return{key:t,val:t}})):Object.keys(t).map((function(e){return{key:e,val:t[e]}})):[]}function Ql(t){return function(e,n){return"string"!=typeof e?(n=e,e=""):"/"!==e.charAt(e.length-1)&&(e+="/"),t(e,n)}}function ta(t,e,n){return t._modulesNamespaceMap[n]}function ea(t,e,n){var r=n?t.groupCollapsed:t.group;try{r.call(t,e)}catch(i){t.log(e)}}function na(t){try{t.groupEnd()}catch(e){t.log("—— log end ——")}}function ra(){var t=new Date;return" @ "+ia(t.getHours(),2)+":"+ia(t.getMinutes(),2)+":"+ia(t.getSeconds(),2)+"."+ia(t.getMilliseconds(),3)}function ia(t,e){return n="0",r=e-t.toString().length,new Array(r+1).join(n)+t;var n,r}const oa={Store:jl,install:Hl,version:"3.6.2",mapState:Yl,mapMutations:Ul,mapGetters:Gl,mapActions:Zl,createNamespacedHelpers:function(t){return{mapState:Yl.bind(null,t),mapGetters:Gl.bind(null,t),mapMutations:Ul.bind(null,t),mapActions:Zl.bind(null,t)}},createLogger:function(t){void 0===t&&(t={});var e=t.collapsed;void 0===e&&(e=!0);var n=t.filter;void 0===n&&(n=function(t,e,n){return!0});var r=t.transformer;void 0===r&&(r=function(t){return t});var i=t.mutationTransformer;void 0===i&&(i=function(t){return t});var o=t.actionFilter;void 0===o&&(o=function(t,e){return!0});var s=t.actionTransformer;void 0===s&&(s=function(t){return t});var l=t.logMutations;void 0===l&&(l=!0);var a=t.logActions;void 0===a&&(a=!0);var c=t.logger;return void 0===c&&(c=console),function(t){var h=El(t.state);void 0!==c&&(l&&t.subscribe((function(t,o){var s=El(o);if(n(t,h,s)){var l=ra(),a=i(t),u="mutation "+t.type+l;ea(c,u,e),c.log("%c prev state","color: #9E9E9E; font-weight: bold",r(h)),c.log("%c mutation","color: #03A9F4; font-weight: bold",a),c.log("%c next state","color: #4CAF50; font-weight: bold",r(s)),na(c)}h=s})),a&&t.subscribeAction((function(t,n){if(o(t,n)){var r=ra(),i=s(t),l="action "+t.type+r;ea(c,l,e),c.log("%c action","color: #03A9F4; font-weight: bold",i),na(c)}})))}}};var sa={},la={};function aa(t){return null==t}function ca(t){return null!=t}function ha(t,e){return e.tag===t.tag&&e.key===t.key}function ua(t){var e=t.tag;t.vm=new e({data:t.args})}function da(t,e,n){var r,i,o={};for(r=e;r<=n;++r)ca(i=t[r].key)&&(o[i]=r);return o}function fa(t,e,n){for(;e<=n;++e)ua(t[e])}function pa(t,e,n){for(;e<=n;++e){var r=t[e];ca(r)&&(r.vm.$destroy(),r.vm=null)}}function ma(t,e){t!==e&&(e.vm=t.vm,function(t){for(var e=Object.keys(t.args),n=0;n<e.length;n++)e.forEach((function(e){t.vm[e]=t.args[e]}))}(e))}Object.defineProperty(la,"__esModule",{value:!0}),la.h=function(t,e,n){return{tag:t,key:e,args:n}},la.patchChildren=function(t,e){ca(t)&&ca(e)?t!==e&&function(t,e){var n,r,i,o=0,s=0,l=t.length-1,a=t[0],c=t[l],h=e.length-1,u=e[0],d=e[h];for(;o<=l&&s<=h;)aa(a)?a=t[++o]:aa(c)?c=t[--l]:ha(a,u)?(ma(a,u),a=t[++o],u=e[++s]):ha(c,d)?(ma(c,d),c=t[--l],d=e[--h]):ha(a,d)?(ma(a,d),a=t[++o],d=e[--h]):ha(c,u)?(ma(c,u),c=t[--l],u=e[++s]):(aa(n)&&(n=da(t,o,l)),aa(r=ca(u.key)?n[u.key]:null)?(ua(u),u=e[++s]):ha(i=t[r],u)?(ma(i,u),t[r]=void 0,u=e[++s]):(ua(u),u=e[++s]));o>l?fa(e,s,h):s>h&&pa(t,o,l)}(t,e):ca(e)?fa(e,0,e.length-1):ca(t)&&pa(t,0,t.length-1)},function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.Vuelidate=C,t.validationMixin=t.default=void 0,Object.defineProperty(t,"withParams",{enumerable:!0,get:function(){return n.withParams}});var e=la,n=s;function r(t){return function(t){if(Array.isArray(t))return i(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return i(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return i(t,e)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function o(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function l(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?o(Object(n),!0).forEach((function(e){a(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function a(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function c(t){return(c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var h=function(){return null},u=function(t,e,n){return t.reduce((function(t,r){return t[n?n(r):r]=e(r),t}),{})};function d(t){return"function"==typeof t}function f(t){return null!==t&&("object"===c(t)||d(t))}var p=function(t,e,n,r){if("function"==typeof n)return n.call(t,e,r);n=Array.isArray(n)?n:n.split(".");for(var i=0;i<n.length;i++){if(!e||"object"!==c(e))return r;e=e[n[i]]}return void 0===e?r:e},m="__isVuelidateAsyncVm";var g={$invalid:function(){var t=this,e=this.proxy;return this.nestedKeys.some((function(e){return t.refProxy(e).$invalid}))||this.ruleKeys.some((function(t){return!e[t]}))},$dirty:function(){var t=this;return!!this.dirty||0!==this.nestedKeys.length&&this.nestedKeys.every((function(e){return t.refProxy(e).$dirty}))},$anyDirty:function(){var t=this;return!!this.dirty||0!==this.nestedKeys.length&&this.nestedKeys.some((function(e){return t.refProxy(e).$anyDirty}))},$error:function(){return this.$dirty&&!this.$pending&&this.$invalid},$anyError:function(){var t=this;return!!this.$error||this.nestedKeys.some((function(e){return t.refProxy(e).$anyError}))},$pending:function(){var t=this;return this.ruleKeys.some((function(e){return t.getRef(e).$pending}))||this.nestedKeys.some((function(e){return t.refProxy(e).$pending}))},$params:function(){var t=this,e=this.validations;return l(l({},u(this.nestedKeys,(function(t){return e[t]&&e[t].$params||null}))),u(this.ruleKeys,(function(e){return t.getRef(e).$params})))}};function y(t){this.dirty=t;var e=this.proxy,n=t?"$touch":"$reset";this.nestedKeys.forEach((function(t){e[t][n]()}))}var v={$touch:function(){y.call(this,!0)},$reset:function(){y.call(this,!1)},$flattenParams:function(){var t=this.proxy,e=[];for(var n in this.$params)if(this.isNested(n)){for(var r=t[n].$flattenParams(),i=0;i<r.length;i++)r[i].path.unshift(n);e=e.concat(r)}else e.push({path:[],name:n,params:this.$params[n]});return e}},w=Object.keys(g),b=Object.keys(v),x=null,S=function(t){if(x)return x;var i=t.extend({computed:{refs:function(){var t=this._vval;this._vval=this.children,(0,e.patchChildren)(t,this._vval);var n={};return this._vval.forEach((function(t){n[t.key]=t.vm})),n}},beforeCreate:function(){this._vval=null},beforeDestroy:function(){this._vval&&((0,e.patchChildren)(this._vval),this._vval=null)},methods:{getModel:function(){return this.lazyModel?this.lazyModel(this.prop):this.model},getModelKey:function(t){var e=this.getModel();if(e)return e[t]},hasIter:function(){return!1}}}),o=i.extend({data:function(){return{rule:null,lazyModel:null,model:null,lazyParentModel:null,rootModel:null}},methods:{runRule:function(e){var r=this.getModel();(0,n.pushParams)();var i,o=this.rule.call(this.rootModel,r,e),s=f(i=o)&&d(i.then)?function(t,e){var n=new t({data:{p:!0,v:!1}});return e.then((function(t){n.p=!1,n.v=t}),(function(t){throw n.p=!1,n.v=!1,t})),n[m]=!0,n}(t,o):o,l=(0,n.popParams)();return{output:s,params:l&&l.$sub?l.$sub.length>1?l:l.$sub[0]:null}}},computed:{run:function(){var t=this,e=this.lazyParentModel();if(Array.isArray(e)&&e.__ob__){var n=e.__ob__.dep;n.depend();var r=n.constructor.target;if(!this._indirectWatcher){var i=r.constructor;this._indirectWatcher=new i(this,(function(){return t.runRule(e)}),null,{lazy:!0})}var o=this.getModel();if(!this._indirectWatcher.dirty&&this._lastModel===o)return this._indirectWatcher.depend(),r.value;this._lastModel=o,this._indirectWatcher.evaluate(),this._indirectWatcher.depend()}else this._indirectWatcher&&(this._indirectWatcher.teardown(),this._indirectWatcher=null);return this._indirectWatcher?this._indirectWatcher.value:this.runRule(e)},$params:function(){return this.run.params},proxy:function(){var t=this.run.output;return t[m]?!!t.v:!!t},$pending:function(){var t=this.run.output;return!!t[m]&&t.p}},destroyed:function(){this._indirectWatcher&&(this._indirectWatcher.teardown(),this._indirectWatcher=null)}}),s=i.extend({data:function(){return{dirty:!1,validations:null,lazyModel:null,model:null,prop:null,lazyParentModel:null,rootModel:null}},methods:l(l({},v),{},{refProxy:function(t){return this.getRef(t).proxy},getRef:function(t){return this.refs[t]},isNested:function(t){return"function"!=typeof this.validations[t]}}),computed:l(l({},g),{},{nestedKeys:function(){return this.keys.filter(this.isNested)},ruleKeys:function(){var t=this;return this.keys.filter((function(e){return!t.isNested(e)}))},keys:function(){return Object.keys(this.validations).filter((function(t){return"$params"!==t}))},proxy:function(){var t=this,e=u(this.keys,(function(e){return{enumerable:!0,configurable:!0,get:function(){return t.refProxy(e)}}})),n=u(w,(function(e){return{enumerable:!0,configurable:!0,get:function(){return t[e]}}})),r=u(b,(function(e){return{enumerable:!1,configurable:!0,get:function(){return t[e]}}})),i=this.hasIter()?{$iter:{enumerable:!0,value:Object.defineProperties({},l({},e))}}:{};return Object.defineProperties({},l(l(l(l({},e),i),{},{$model:{enumerable:!0,get:function(){var e=t.lazyParentModel();return null!=e?e[t.prop]:null},set:function(e){var n=t.lazyParentModel();null!=n&&(n[t.prop]=e,t.$touch())}}},n),r))},children:function(){var t=this;return[].concat(r(this.nestedKeys.map((function(e){return y(t,e)}))),r(this.ruleKeys.map((function(e){return S(t,e)})))).filter(Boolean)}})}),a=s.extend({methods:{isNested:function(t){return void 0!==this.validations[t]()},getRef:function(t){var e=this;return{get proxy(){return e.validations[t]()||!1}}}}}),c=s.extend({computed:{keys:function(){var t=this.getModel();return f(t)?Object.keys(t):[]},tracker:function(){var t=this,e=this.validations.$trackBy;return e?function(n){return"".concat(p(t.rootModel,t.getModelKey(n),e))}:function(t){return"".concat(t)}},getModelLazy:function(){var t=this;return function(){return t.getModel()}},children:function(){var t=this,n=this.validations,r=this.getModel(),i=l({},n);delete i.$trackBy;var o={};return this.keys.map((function(n){var l=t.tracker(n);return o.hasOwnProperty(l)?null:(o[l]=!0,(0,e.h)(s,l,{validations:i,prop:n,lazyParentModel:t.getModelLazy,model:r[n],rootModel:t.rootModel}))})).filter(Boolean)}},methods:{isNested:function(){return!0},getRef:function(t){return this.refs[this.tracker(t)]},hasIter:function(){return!0}}}),y=function(t,n){if("$each"===n)return(0,e.h)(c,n,{validations:t.validations[n],lazyParentModel:t.lazyParentModel,prop:n,lazyModel:t.getModel,rootModel:t.rootModel});var r=t.validations[n];if(Array.isArray(r)){var i=t.rootModel,o=u(r,(function(t){return function(){return p(i,i.$v,t)}}),(function(t){return Array.isArray(t)?t.join("."):t}));return(0,e.h)(a,n,{validations:o,lazyParentModel:h,prop:n,lazyModel:h,rootModel:i})}return(0,e.h)(s,n,{validations:r,lazyParentModel:t.getModel,prop:n,lazyModel:t.getModelKey,rootModel:t.rootModel})},S=function(t,n){return(0,e.h)(o,n,{rule:t.validations[n],lazyParentModel:t.lazyParentModel,lazyModel:t.getModel,rootModel:t.rootModel})};return x={VBase:i,Validation:s}},k=null;var M=function(t,n){var r=function(t){if(k)return k;for(var e=t.constructor;e.super;)e=e.super;return k=e,e}(t),i=S(r),o=i.Validation;return new(0,i.VBase)({computed:{children:function(){var r="function"==typeof n?n.call(t):n;return[(0,e.h)(o,"$v",{validations:r,lazyParentModel:h,prop:"$v",model:t,rootModel:t})]}}})},O={data:function(){var t=this.$options.validations;return t&&(this._vuelidate=M(this,t)),{}},beforeCreate:function(){var t=this.$options;t.validations&&(t.computed||(t.computed={}),t.computed.$v||(t.computed.$v=function(){return this._vuelidate?this._vuelidate.refs.$v.proxy:null}))},beforeDestroy:function(){this._vuelidate&&(this._vuelidate.$destroy(),this._vuelidate=null)}};function C(t){t.mixin(O)}t.validationMixin=O;var D=C;t.default=D}(sa);const ga=e(sa);export{wl as A,Cl as B,Nl as C,ne as D,gn as E,dt as F,Ml as G,Tl as H,gs as I,ga as J,t as K,e as L,on as N,vn as P,vt as S,nn as T,oa as V,Zo as a,ls as b,hs as c,xs as d,Qo as e,Ss as f,As as g,$s as h,Is as i,te as j,Jo as k,Ps as l,vs as m,No as n,de as o,ms as p,Qs as q,tl as r,as as s,cs as t,bs as u,n as v,Es as w,el as x,nl as y,Xs as z};