1||0==l||g.content.size)&&(d=m,u.push(Lk(g.mark(h.allowedMarks(g.marks)),1==c?l:0,c==a.childCount?p:-1)))}let f=c==a.childCount;f||(p=-1),this.placed=Zd(this.placed,e,L.from(u)),this.frontier[e].match=d,f&&p<0&&i&&i.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let g=0,m=a;g1&&r==this.$to.end(--i);)++r;return r}findCloseLevel(t){e:for(let e=Math.min(this.depth,t.depth);e>=0;e--){let{match:i,type:r}=this.frontier[e],o=e=0;a--){let{match:l,type:c}=this.frontier[a],u=BC(t,a,c,l,!0);if(!u||u.childCount)continue e}return{depth:e,fit:s,move:o?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=Zd(this.placed,e.depth,e.fit)),t=e.move;for(let i=e.depth+1;i<=t.depth;i++){let r=t.node(i),o=r.type.contentMatch.fillBefore(r.content,!0,t.index(i));this.openFrontierNode(r.type,r.attrs,o)}return t}openFrontierNode(t,e=null,i){let r=this.frontier[this.depth];r.match=r.match.matchType(t),this.placed=Zd(this.placed,this.depth,L.from(t.create(e,i))),this.frontier.push({type:t,match:t.contentMatch})}closeFrontierNode(){let e=this.frontier.pop().match.fillBefore(L.empty,!0);e.childCount&&(this.placed=Zd(this.placed,this.frontier.length,e))}}function Xd(n,t,e){return 0==t?n.cutByIndex(e,n.childCount):n.replaceChild(0,n.firstChild.copy(Xd(n.firstChild.content,t-1,e)))}function Zd(n,t,e){return 0==t?n.append(e):n.replaceChild(n.childCount-1,n.lastChild.copy(Zd(n.lastChild.content,t-1,e)))}function TC(n,t){for(let e=0;e1&&(i=i.replaceChild(0,Lk(i.firstChild,t-1,1==i.childCount?e-1:0))),t>0&&(i=n.type.contentMatch.fillBefore(i).append(i),e<=0&&(i=i.append(n.type.contentMatch.matchFragment(i).fillBefore(L.empty,!0)))),n.copy(i)}function BC(n,t,e,i,r){let o=n.node(t),s=r?n.indexAfter(t):n.index(t);if(s==o.childCount&&!e.compatibleContent(o.type))return null;let a=i.fillBefore(o.content,!0,s);return a&&!function x6(n,t,e){for(let i=e;ii){let o=r.contentMatchAt(0),s=o.fillBefore(n).append(n);n=s.append(o.matchFragment(s).fillBefore(L.empty,!0))}return n}function Uk(n,t){let e=[];for(let r=Math.min(n.depth,t.depth);r>=0;r--){let o=n.start(r);if(ot.pos+(t.depth-r)||n.node(r).type.spec.isolating||t.node(r).type.spec.isolating)break;(o==t.start(r)||r==n.depth&&r==t.depth&&n.parent.inlineContent&&t.parent.inlineContent&&r&&t.start(r-1)==o-1)&&e.push(r)}return e}class Bc extends Gn{constructor(t,e,i){super(),this.pos=t,this.attr=e,this.value=i}apply(t){let e=t.nodeAt(this.pos);if(!e)return ln.fail("No node at attribute step's position");let i=Object.create(null);for(let o in e.attrs)i[o]=e.attrs[o];i[this.attr]=this.value;let r=e.type.create(i,null,e.marks);return ln.fromReplace(t,this.pos,this.pos+1,new G(L.from(r),0,e.isLeaf?0:1))}getMap(){return or.empty}invert(t){return new Bc(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 Bc(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 Bc(e.pos,e.attr,e.value)}}Gn.jsonID("attr",Bc);let Oc=class extends Error{};Oc=function n(t){let e=Error.call(this,t);return e.__proto__=n.prototype,e},(Oc.prototype=Object.create(Error.prototype)).constructor=Oc,Oc.prototype.name="TransformError";class OC{constructor(t){this.doc=t,this.steps=[],this.docs=[],this.mapping=new Sc}get before(){return this.docs.length?this.docs[0]:this.doc}step(t){let e=this.maybeStep(t);if(e.failed)throw new Oc(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,i=G.empty){let r=xC(this.doc,t,e,i);return r&&this.step(r),this}replaceWith(t,e,i){return this.replace(t,e,new G(L.from(i),0,0))}delete(t,e){return this.replace(t,e,G.empty)}insert(t,e){return this.replaceWith(t,t,e)}replaceRange(t,e,i){return function B6(n,t,e,i){if(!i.size)return n.deleteRange(t,e);let r=n.doc.resolve(t),o=n.doc.resolve(e);if(Nk(r,o,i))return n.step(new Yn(t,e,i));let s=Uk(r,n.doc.resolve(e));0==s[s.length-1]&&s.pop();let a=-(r.depth+1);s.unshift(a);for(let h=r.depth,p=r.pos-1;h>0;h--,p--){let f=r.node(h).type.spec;if(f.defining||f.definingAsContext||f.isolating)break;s.indexOf(h)>-1?a=h:r.before(h)==p&&s.splice(1,0,-h)}let l=s.indexOf(a),c=[],u=i.openStart;for(let h=i.content,p=0;;p++){let f=h.firstChild;if(c.push(f),p==i.openStart)break;h=f.content}for(let h=u-1;h>=0;h--){let p=c[h].type,f=T6(p);if(f&&r.node(l).type!=p)u=h;else if(f||!p.isTextblock)break}for(let h=i.openStart;h>=0;h--){let p=(h+u+1)%(i.openStart+1),f=c[p];if(f)for(let g=0;g=0&&(n.replace(t,e,i),!(n.steps.length>d));h--){let p=s[h];p<0||(t=r.before(p),e=o.after(p))}}(this,t,e,i),this}replaceRangeWith(t,e,i){return function O6(n,t,e,i){if(!i.isInline&&t==e&&n.doc.resolve(t).parent.content.size){let r=function I6(n,t,e){let i=n.resolve(t);if(i.parent.canReplaceWith(i.index(),i.index(),e))return t;if(0==i.parentOffset)for(let r=i.depth-1;r>=0;r--){let o=i.index(r);if(i.node(r).canReplaceWith(o,o,e))return i.before(r+1);if(o>0)return null}if(i.parentOffset==i.parent.content.size)for(let r=i.depth-1;r>=0;r--){let o=i.indexAfter(r);if(i.node(r).canReplaceWith(o,o,e))return i.after(r+1);if(o0&&(l||i.node(a-1).canReplace(i.index(a-1),r.indexAfter(a-1))))return n.delete(i.before(a),r.after(a))}for(let s=1;s<=i.depth&&s<=r.depth;s++)if(t-i.start(s)==i.depth-s&&e>i.end(s)&&r.end(s)-e!=r.depth-s)return n.delete(i.before(s),e);n.delete(t,e)}(this,t,e),this}lift(t,e){return function b6(n,t,e){let{$from:i,$to:r,depth:o}=t,s=i.before(o+1),a=r.after(o+1),l=s,c=a,u=L.empty,d=0;for(let f=o,g=!1;f>e;f--)g||i.index(f)>0?(g=!0,u=L.from(i.node(f).copy(u)),d++):l--;let h=L.empty,p=0;for(let f=o,g=!1;f>e;f--)g||r.after(f+1)=0;s--){if(i.size){let a=e[s].type.contentMatch.matchFragment(i);if(!a||!a.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}i=L.from(e[s].type.create(e[s].attrs,i))}let r=t.start,o=t.end;n.step(new Cn(r,o,r,o,new G(i,0,0),e.length,!0))}(this,t,e),this}setBlockType(t,e=t,i,r=null){return function C6(n,t,e,i,r){if(!i.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let o=n.steps.length;n.doc.nodesBetween(t,e,(s,a)=>{if(s.isTextblock&&!s.hasMarkup(i,r)&&function v6(n,t,e){let i=n.resolve(t),r=i.index();return i.parent.canReplaceWith(r,r+1,e)}(n.doc,n.mapping.slice(o).map(a),i)){n.clearIncompatible(n.mapping.slice(o).map(a,1),i);let l=n.mapping.slice(o),c=l.map(a,1),u=l.map(a+s.nodeSize,1);return n.step(new Cn(c,u,c+1,u-1,new G(L.from(i.create(r,null,s.marks)),0,0),1,!0)),!1}})}(this,t,e,i,r),this}setNodeMarkup(t,e,i=null,r=[]){return function M6(n,t,e,i,r){let o=n.doc.nodeAt(t);if(!o)throw new RangeError("No node at given position");e||(e=o.type);let s=e.create(i,null,r||o.marks);if(o.isLeaf)return n.replaceWith(t,t+o.nodeSize,s);if(!e.validContent(o.content))throw new RangeError("Invalid content for node type "+e.name);n.step(new Cn(t,t+o.nodeSize,t+1,t+o.nodeSize-1,new G(L.from(s),0,0),1,!0))}(this,t,e,i,r),this}setNodeAttribute(t,e,i){return this.step(new Bc(t,e,i)),this}addNodeMark(t,e){return this.step(new Fs(t,e)),this}removeNodeMark(t,e){if(!(e instanceof Tt)){let i=this.doc.nodeAt(t);if(!i)throw new RangeError("No node at position "+t);if(!(e=e.isInSet(i.marks)))return this}return this.step(new xc(t,e)),this}split(t,e=1,i){return function w6(n,t,e=1,i){let r=n.doc.resolve(t),o=L.empty,s=L.empty;for(let a=r.depth,l=r.depth-e,c=e-1;a>l;a--,c--){o=L.from(r.node(a).copy(o));let u=i&&i[c];s=L.from(u?u.type.create(u.attrs,s):r.node(a).copy(s))}n.step(new Yn(t,t,new G(o.append(s),e,e),!0))}(this,t,e,i),this}addMark(t,e,i){return function f6(n,t,e,i){let s,a,r=[],o=[];n.doc.nodesBetween(t,e,(l,c,u)=>{if(!l.isInline)return;let d=l.marks;if(!i.isInSet(d)&&u.type.allowsMarkType(i.type)){let h=Math.max(c,t),p=Math.min(c+l.nodeSize,e),f=i.addToSet(d);for(let g=0;gn.step(l)),o.forEach(l=>n.step(l))}(this,t,e,i),this}removeMark(t,e,i){return function g6(n,t,e,i){let r=[],o=0;n.doc.nodesBetween(t,e,(s,a)=>{if(!s.isInline)return;o++;let l=null;if(i instanceof Yg){let u,c=s.marks;for(;u=i.isInSet(c);)(l||(l=[])).push(u),c=u.removeFromSet(c)}else i?i.isInSet(s.marks)&&(l=[i]):l=s.marks;if(l&&l.length){let c=Math.min(a+s.nodeSize,e);for(let u=0;un.step(new so(s.from,s.to,s.style)))}(this,t,e,i),this}clearIncompatible(t,e,i){return function m6(n,t,e,i=e.contentMatch){let r=n.doc.nodeAt(t),o=[],s=t+1;for(let a=0;a=0;a--)n.step(o[a])}(this,t,e,i),this}}const kC=Object.create(null);class _e{constructor(t,e,i){this.$anchor=t,this.$head=e,this.ranges=i||[new jk(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=0;o--){let s=e<0?kc(t.node(0),t.node(o),t.before(o+1),t.index(o),e,i):kc(t.node(0),t.node(o),t.after(o+1),t.index(o)+1,e,i);if(s)return s}return null}static near(t,e=1){return this.findFrom(t,e)||this.findFrom(t,-e)||new Qi(t.node(0))}static atStart(t){return kc(t,t,0,0,1)||new Qi(t)}static atEnd(t){return kc(t,t,t.content.size,t.childCount,-1)||new Qi(t)}static fromJSON(t,e){if(!e||!e.type)throw new RangeError("Invalid input for Selection.fromJSON");let i=kC[e.type];if(!i)throw new RangeError(`No selection type ${e.type} defined`);return i.fromJSON(t,e)}static jsonID(t,e){if(t in kC)throw new RangeError("Duplicate use of selection JSON ID "+t);return kC[t]=e,e.prototype.jsonID=t,e}getBookmark(){return Ee.between(this.$anchor,this.$head).getBookmark()}}_e.prototype.visible=!0;class jk{constructor(t,e){this.$from=t,this.$to=e}}let zk=!1;function Hk(n){!zk&&!n.parent.inlineContent&&(zk=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+n.parent.type.name+")"))}class Ee extends _e{constructor(t,e=t){Hk(t),Hk(e),super(t,e)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(t,e){let i=t.resolve(e.map(this.head));if(!i.parent.inlineContent)return _e.near(i);let r=t.resolve(e.map(this.anchor));return new Ee(r.parent.inlineContent?r:i,i)}replace(t,e=G.empty){if(super.replace(t,e),e==G.empty){let i=this.$from.marksAcross(this.$to);i&&t.ensureMarks(i)}}eq(t){return t instanceof Ee&&t.anchor==this.anchor&&t.head==this.head}getBookmark(){return new qg(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 Ee(t.resolve(e.anchor),t.resolve(e.head))}static create(t,e,i=e){let r=t.resolve(e);return new this(r,i==e?r:t.resolve(i))}static between(t,e,i){let r=t.pos-e.pos;if((!i||r)&&(i=r>=0?1:-1),!e.parent.inlineContent){let o=_e.findFrom(e,i,!0)||_e.findFrom(e,-i,!0);if(!o)return _e.near(e,i);e=o.$head}return t.parent.inlineContent||(0==r||(t=(_e.findFrom(t,-i,!0)||_e.findFrom(t,i,!0)).$anchor).posnew Qi(n)};function kc(n,t,e,i,r,o=!1){if(t.inlineContent)return Ee.create(n,e);for(let s=i-(r>0?0:1);r>0?s=0;s+=r){let a=t.child(s);if(a.isAtom){if(!o&&ce.isSelectable(a))return ce.create(n,e-(r<0?a.nodeSize:0))}else{let l=kc(n,a,e+r,r<0?a.childCount:0,r,o);if(l)return l}e+=a.nodeSize*r}return null}function Vk(n,t,e){let i=n.steps.length-1;if(i{null==s&&(s=u)}),n.setSelection(_e.near(n.doc.resolve(s),e)))}class F6 extends OC{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.curSelectionFor0}setStoredMarks(t){return this.storedMarks=t,this.updated|=2,this}ensureMarks(t){return Tt.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 i=this.selection;return e&&(t=t.mark(this.storedMarks||(i.empty?i.$from.marks():i.$from.marksAcross(i.$to)||Tt.none))),i.replaceWith(this,t),this}deleteSelection(){return this.selection.replace(this),this}insertText(t,e,i){let r=this.doc.type.schema;if(null==e)return t?this.replaceSelectionWith(r.text(t),!0):this.deleteSelection();{if(null==i&&(i=e),i=i??e,!t)return this.deleteRange(e,i);let o=this.storedMarks;if(!o){let s=this.doc.resolve(e);o=i==e?s.marks():s.marksAcross(this.doc.resolve(i))}return this.replaceRangeWith(e,i,r.text(t,o)),this.selection.empty||this.setSelection(_e.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 Wk(n,t){return t&&n?n.bind(t):n}class eh{constructor(t,e,i){this.name=t,this.init=Wk(e.init,i),this.apply=Wk(e.apply,i)}}const R6=[new eh("doc",{init:n=>n.doc||n.schema.topNodeType.createAndFill(),apply:n=>n.doc}),new eh("selection",{init:(n,t)=>n.selection||_e.atStart(t.doc),apply:n=>n.selection}),new eh("storedMarks",{init:n=>n.storedMarks||null,apply:(n,t,e,i)=>i.selection.$cursor?n.storedMarks:null}),new eh("scrollToSelection",{init:()=>0,apply:(n,t)=>n.scrolledIntoView?t+1:t})];class FC{constructor(t,e){this.schema=t,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=R6.slice(),e&&e.forEach(i=>{if(this.pluginsByKey[i.key])throw new RangeError("Adding different instances of a keyed plugin ("+i.key+")");this.plugins.push(i),this.pluginsByKey[i.key]=i,i.spec.state&&this.fields.push(new eh(i.key,i.spec.state,i))})}}class Pc{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 i=0;ii.toJSON())),t&&"object"==typeof t)for(let i in t){if("doc"==i||"selection"==i)throw new RangeError("The JSON fields `doc` and `selection` are reserved");let r=t[i],o=r.spec.state;o&&o.toJSON&&(e[i]=o.toJSON.call(r,this[r.key]))}return e}static fromJSON(t,e,i){if(!e)throw new RangeError("Invalid input for EditorState.fromJSON");if(!t.schema)throw new RangeError("Required config field 'schema' missing");let r=new FC(t.schema,t.plugins),o=new Pc(r);return r.fields.forEach(s=>{if("doc"==s.name)o.doc=ro.fromJSON(t.schema,e.doc);else if("selection"==s.name)o.selection=_e.fromJSON(o.doc,e.selection);else if("storedMarks"==s.name)e.storedMarks&&(o.storedMarks=e.storedMarks.map(t.schema.markFromJSON));else{if(i)for(let a in i){let l=i[a],c=l.spec.state;if(l.key==s.name&&c&&c.fromJSON&&Object.prototype.hasOwnProperty.call(e,a))return void(o[s.name]=c.fromJSON.call(l,t,e[a],o))}o[s.name]=s.init(t,o)}}),o}}function Jk(n,t,e){for(let i in n){let r=n[i];r instanceof Function?r=r.bind(t):"handleDOMEvents"==i&&(r=Jk(r,t,{})),e[i]=r}return e}class ut{constructor(t){this.spec=t,this.props={},t.props&&Jk(t.props,this,this.props),this.key=t.key?t.key.key:Kk("plugin")}getState(t){return t[this.key]}}const RC=Object.create(null);function Kk(n){return n in RC?n+"$"+ ++RC[n]:(RC[n]=0,n+"$")}class wt{constructor(t="key"){this.key=Kk(t)}get(t){return t.config.pluginsByKey[this.key]}getState(t){return t[this.key]}}function sr(n){if(null==n)return window;if("[object Window]"!==n.toString()){var t=n.ownerDocument;return t&&t.defaultView||window}return n}function Ka(n){return n instanceof sr(n).Element||n instanceof Element}function ar(n){return n instanceof sr(n).HTMLElement||n instanceof HTMLElement}function NC(n){return!(typeof ShadowRoot>"u")&&(n instanceof sr(n).ShadowRoot||n instanceof ShadowRoot)}var $a=Math.max,Zg=Math.min,Fc=Math.round;function LC(){var n=navigator.userAgentData;return null!=n&&n.brands?n.brands.map(function(t){return t.brand+"/"+t.version}).join(" "):navigator.userAgent}function $k(){return!/^((?!chrome|android).)*safari/i.test(LC())}function Rc(n,t,e){void 0===t&&(t=!1),void 0===e&&(e=!1);var i=n.getBoundingClientRect(),r=1,o=1;t&&ar(n)&&(r=n.offsetWidth>0&&Fc(i.width)/n.offsetWidth||1,o=n.offsetHeight>0&&Fc(i.height)/n.offsetHeight||1);var a=(Ka(n)?sr(n):window).visualViewport,l=!$k()&&e,c=(i.left+(l&&a?a.offsetLeft:0))/r,u=(i.top+(l&&a?a.offsetTop:0))/o,d=i.width/r,h=i.height/o;return{width:d,height:h,top:u,right:c+d,bottom:u+h,left:c,x:c,y:u}}function QC(n){var t=sr(n);return{scrollLeft:t.pageXOffset,scrollTop:t.pageYOffset}}function ao(n){return n?(n.nodeName||"").toLowerCase():null}function Ns(n){return((Ka(n)?n.ownerDocument:n.document)||window.document).documentElement}function UC(n){return Rc(Ns(n)).left+QC(n).scrollLeft}function Wo(n){return sr(n).getComputedStyle(n)}function jC(n){var t=Wo(n);return/auto|scroll|overlay|hidden/.test(t.overflow+t.overflowY+t.overflowX)}function U6(n,t,e){void 0===e&&(e=!1);var i=ar(t),r=ar(t)&&function Q6(n){var t=n.getBoundingClientRect(),e=Fc(t.width)/n.offsetWidth||1,i=Fc(t.height)/n.offsetHeight||1;return 1!==e||1!==i}(t),o=Ns(t),s=Rc(n,r,e),a={scrollLeft:0,scrollTop:0},l={x:0,y:0};return(i||!i&&!e)&&(("body"!==ao(t)||jC(o))&&(a=function L6(n){return n!==sr(n)&&ar(n)?function N6(n){return{scrollLeft:n.scrollLeft,scrollTop:n.scrollTop}}(n):QC(n)}(t)),ar(t)?((l=Rc(t,!0)).x+=t.clientLeft,l.y+=t.clientTop):o&&(l.x=UC(o))),{x:s.left+a.scrollLeft-l.x,y:s.top+a.scrollTop-l.y,width:s.width,height:s.height}}function zC(n){var t=Rc(n),e=n.offsetWidth,i=n.offsetHeight;return Math.abs(t.width-e)<=1&&(e=t.width),Math.abs(t.height-i)<=1&&(i=t.height),{x:n.offsetLeft,y:n.offsetTop,width:e,height:i}}function em(n){return"html"===ao(n)?n:n.assignedSlot||n.parentNode||(NC(n)?n.host:null)||Ns(n)}function qk(n){return["html","body","#document"].indexOf(ao(n))>=0?n.ownerDocument.body:ar(n)&&jC(n)?n:qk(em(n))}function th(n,t){var e;void 0===t&&(t=[]);var i=qk(n),r=i===(null==(e=n.ownerDocument)?void 0:e.body),o=sr(i),s=r?[o].concat(o.visualViewport||[],jC(i)?i:[]):i,a=t.concat(s);return r?a:a.concat(th(em(s)))}function j6(n){return["table","td","th"].indexOf(ao(n))>=0}function Xk(n){return ar(n)&&"fixed"!==Wo(n).position?n.offsetParent:null}function nh(n){for(var t=sr(n),e=Xk(n);e&&j6(e)&&"static"===Wo(e).position;)e=Xk(e);return e&&("html"===ao(e)||"body"===ao(e)&&"static"===Wo(e).position)?t:e||function z6(n){var t=/firefox/i.test(LC());if(/Trident/i.test(LC())&&ar(n)&&"fixed"===Wo(n).position)return null;var r=em(n);for(NC(r)&&(r=r.host);ar(r)&&["html","body"].indexOf(ao(r))<0;){var o=Wo(r);if("none"!==o.transform||"none"!==o.perspective||"paint"===o.contain||-1!==["transform","perspective"].indexOf(o.willChange)||t&&"filter"===o.willChange||t&&o.filter&&"none"!==o.filter)return r;r=r.parentNode}return null}(n)||t}var _i="top",lr="bottom",cr="right",Ei="left",HC="auto",ih=[_i,lr,cr,Ei],Nc="start",rh="end",Zk="viewport",oh="popper",eP=ih.reduce(function(n,t){return n.concat([t+"-"+Nc,t+"-"+rh])},[]),tP=[].concat(ih,[HC]).reduce(function(n,t){return n.concat([t,t+"-"+Nc,t+"-"+rh])},[]),eq=["beforeRead","read","afterRead","beforeMain","main","afterMain","beforeWrite","write","afterWrite"];function tq(n){var t=new Map,e=new Set,i=[];function r(o){e.add(o.name),[].concat(o.requires||[],o.requiresIfExists||[]).forEach(function(a){if(!e.has(a)){var l=t.get(a);l&&r(l)}}),i.push(o)}return n.forEach(function(o){t.set(o.name,o)}),n.forEach(function(o){e.has(o.name)||r(o)}),i}function iq(n){var t;return function(){return t||(t=new Promise(function(e){Promise.resolve().then(function(){t=void 0,e(n())})})),t}}var nP={placement:"bottom",modifiers:[],strategy:"absolute"};function iP(){for(var n=arguments.length,t=new Array(n),e=0;e=0?"x":"y"}function rP(n){var l,t=n.reference,e=n.element,i=n.placement,r=i?lo(i):null,o=i?Lc(i):null,s=t.x+t.width/2-e.width/2,a=t.y+t.height/2-e.height/2;switch(r){case _i:l={x:s,y:t.y-e.height};break;case lr:l={x:s,y:t.y+t.height};break;case cr:l={x:t.x+t.width,y:a};break;case Ei:l={x:t.x-e.width,y:a};break;default:l={x:t.x,y:t.y}}var c=r?VC(r):null;if(null!=c){var u="y"===c?"height":"width";switch(o){case Nc:l[c]=l[c]-(t[u]/2-e[u]/2);break;case rh:l[c]=l[c]+(t[u]/2-e[u]/2)}}return l}const cq={name:"popperOffsets",enabled:!0,phase:"read",fn:function lq(n){var t=n.state;t.modifiersData[n.name]=rP({reference:t.rects.reference,element:t.rects.popper,strategy:"absolute",placement:t.placement})},data:{}};var uq={top:"auto",right:"auto",bottom:"auto",left:"auto"};function oP(n){var t,e=n.popper,i=n.popperRect,r=n.placement,o=n.variation,s=n.offsets,a=n.position,l=n.gpuAcceleration,c=n.adaptive,u=n.roundOffsets,d=n.isFixed,h=s.x,p=void 0===h?0:h,f=s.y,g=void 0===f?0:f,m="function"==typeof u?u({x:p,y:g}):{x:p,y:g};p=m.x,g=m.y;var A=s.hasOwnProperty("x"),y=s.hasOwnProperty("y"),E=Ei,b=_i,D=window;if(c){var I=nh(e),Q="clientHeight",O="clientWidth";I===sr(e)&&"static"!==Wo(I=Ns(e)).position&&"absolute"===a&&(Q="scrollHeight",O="scrollWidth"),(r===_i||(r===Ei||r===cr)&&o===rh)&&(b=lr,g-=(d&&I===D&&D.visualViewport?D.visualViewport.height:I[Q])-i.height,g*=l?1:-1),r!==Ei&&(r!==_i&&r!==lr||o!==rh)||(E=cr,p-=(d&&I===D&&D.visualViewport?D.visualViewport.width:I[O])-i.width,p*=l?1:-1)}var Ae,xe=Object.assign({position:a},c&&uq),ke=!0===u?function dq(n){var e=n.y,r=window.devicePixelRatio||1;return{x:Fc(n.x*r)/r||0,y:Fc(e*r)/r||0}}({x:p,y:g}):{x:p,y:g};return p=ke.x,g=ke.y,Object.assign({},xe,l?((Ae={})[b]=y?"0":"",Ae[E]=A?"0":"",Ae.transform=(D.devicePixelRatio||1)<=1?"translate("+p+"px, "+g+"px)":"translate3d("+p+"px, "+g+"px, 0)",Ae):((t={})[b]=y?g+"px":"",t[E]=A?p+"px":"",t.transform="",t))}const pq={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:function hq(n){var t=n.state,e=n.options,i=e.gpuAcceleration,r=void 0===i||i,o=e.adaptive,s=void 0===o||o,a=e.roundOffsets,l=void 0===a||a,u={placement:lo(t.placement),variation:Lc(t.placement),popper:t.elements.popper,popperRect:t.rects.popper,gpuAcceleration:r,isFixed:"fixed"===t.options.strategy};null!=t.modifiersData.popperOffsets&&(t.styles.popper=Object.assign({},t.styles.popper,oP(Object.assign({},u,{offsets:t.modifiersData.popperOffsets,position:t.options.strategy,adaptive:s,roundOffsets:l})))),null!=t.modifiersData.arrow&&(t.styles.arrow=Object.assign({},t.styles.arrow,oP(Object.assign({},u,{offsets:t.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:l})))),t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-placement":t.placement})},data:{}},sP={name:"applyStyles",enabled:!0,phase:"write",fn:function fq(n){var t=n.state;Object.keys(t.elements).forEach(function(e){var i=t.styles[e]||{},r=t.attributes[e]||{},o=t.elements[e];!ar(o)||!ao(o)||(Object.assign(o.style,i),Object.keys(r).forEach(function(s){var a=r[s];!1===a?o.removeAttribute(s):o.setAttribute(s,!0===a?"":a)}))})},effect:function gq(n){var t=n.state,e={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(t.elements.popper.style,e.popper),t.styles=e,t.elements.arrow&&Object.assign(t.elements.arrow.style,e.arrow),function(){Object.keys(t.elements).forEach(function(i){var r=t.elements[i],o=t.attributes[i]||{},a=Object.keys(t.styles.hasOwnProperty(i)?t.styles[i]:e[i]).reduce(function(l,c){return l[c]="",l},{});!ar(r)||!ao(r)||(Object.assign(r.style,a),Object.keys(o).forEach(function(l){r.removeAttribute(l)}))})}},requires:["computeStyles"]},bq={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:function Aq(n){var t=n.state,i=n.name,r=n.options.offset,o=void 0===r?[0,0]:r,s=tP.reduce(function(u,d){return u[d]=function mq(n,t,e){var i=lo(n),r=[Ei,_i].indexOf(i)>=0?-1:1,o="function"==typeof e?e(Object.assign({},t,{placement:n})):e,s=o[0],a=o[1];return s=s||0,a=(a||0)*r,[Ei,cr].indexOf(i)>=0?{x:a,y:s}:{x:s,y:a}}(d,t.rects,o),u},{}),a=s[t.placement],c=a.y;null!=t.modifiersData.popperOffsets&&(t.modifiersData.popperOffsets.x+=a.x,t.modifiersData.popperOffsets.y+=c),t.modifiersData[i]=s}};var yq={left:"right",right:"left",bottom:"top",top:"bottom"};function nm(n){return n.replace(/left|right|bottom|top/g,function(t){return yq[t]})}var _q={start:"end",end:"start"};function aP(n){return n.replace(/start|end/g,function(t){return _q[t]})}function lP(n,t){var e=t.getRootNode&&t.getRootNode();if(n.contains(t))return!0;if(e&&NC(e)){var i=t;do{if(i&&n.isSameNode(i))return!0;i=i.parentNode||i.host}while(i)}return!1}function GC(n){return Object.assign({},n,{left:n.x,top:n.y,right:n.x+n.width,bottom:n.y+n.height})}function cP(n,t,e){return t===Zk?GC(function Eq(n,t){var e=sr(n),i=Ns(n),r=e.visualViewport,o=i.clientWidth,s=i.clientHeight,a=0,l=0;if(r){o=r.width,s=r.height;var c=$k();(c||!c&&"fixed"===t)&&(a=r.offsetLeft,l=r.offsetTop)}return{width:o,height:s,x:a+UC(n),y:l}}(n,e)):Ka(t)?function vq(n,t){var e=Rc(n,!1,"fixed"===t);return e.top=e.top+n.clientTop,e.left=e.left+n.clientLeft,e.bottom=e.top+n.clientHeight,e.right=e.left+n.clientWidth,e.width=n.clientWidth,e.height=n.clientHeight,e.x=e.left,e.y=e.top,e}(t,e):GC(function Cq(n){var t,e=Ns(n),i=QC(n),r=null==(t=n.ownerDocument)?void 0:t.body,o=$a(e.scrollWidth,e.clientWidth,r?r.scrollWidth:0,r?r.clientWidth:0),s=$a(e.scrollHeight,e.clientHeight,r?r.scrollHeight:0,r?r.clientHeight:0),a=-i.scrollLeft+UC(n),l=-i.scrollTop;return"rtl"===Wo(r||e).direction&&(a+=$a(e.clientWidth,r?r.clientWidth:0)-o),{width:o,height:s,x:a,y:l}}(Ns(n)))}function dP(n){return Object.assign({},{top:0,right:0,bottom:0,left:0},n)}function hP(n,t){return t.reduce(function(e,i){return e[i]=n,e},{})}function sh(n,t){void 0===t&&(t={});var i=t.placement,r=void 0===i?n.placement:i,o=t.strategy,s=void 0===o?n.strategy:o,a=t.boundary,l=void 0===a?"clippingParents":a,c=t.rootBoundary,u=void 0===c?Zk:c,d=t.elementContext,h=void 0===d?oh:d,p=t.altBoundary,f=void 0!==p&&p,g=t.padding,m=void 0===g?0:g,A=dP("number"!=typeof m?m:hP(m,ih)),E=n.rects.popper,b=n.elements[f?h===oh?"reference":oh:h],D=function wq(n,t,e,i){var r="clippingParents"===t?function Mq(n){var t=th(em(n)),i=["absolute","fixed"].indexOf(Wo(n).position)>=0&&ar(n)?nh(n):n;return Ka(i)?t.filter(function(r){return Ka(r)&&lP(r,i)&&"body"!==ao(r)}):[]}(n):[].concat(t),o=[].concat(r,[e]),a=o.reduce(function(l,c){var u=cP(n,c,i);return l.top=$a(u.top,l.top),l.right=Zg(u.right,l.right),l.bottom=Zg(u.bottom,l.bottom),l.left=$a(u.left,l.left),l},cP(n,o[0],i));return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}(Ka(b)?b:b.contextElement||Ns(n.elements.popper),l,u,s),I=Rc(n.elements.reference),Q=rP({reference:I,element:E,strategy:"absolute",placement:r}),O=GC(Object.assign({},E,Q)),q=h===oh?O:I,le={top:D.top-q.top+A.top,bottom:q.bottom-D.bottom+A.bottom,left:D.left-q.left+A.left,right:q.right-D.right+A.right},xe=n.modifiersData.offset;if(h===oh&&xe){var ke=xe[r];Object.keys(le).forEach(function(Ae){var dt=[cr,lr].indexOf(Ae)>=0?1:-1,ht=[_i,lr].indexOf(Ae)>=0?"y":"x";le[Ae]+=ke[ht]*dt})}return le}const xq={name:"flip",enabled:!0,phase:"main",fn:function Sq(n){var t=n.state,e=n.options,i=n.name;if(!t.modifiersData[i]._skip){for(var r=e.mainAxis,o=void 0===r||r,s=e.altAxis,a=void 0===s||s,l=e.fallbackPlacements,c=e.padding,u=e.boundary,d=e.rootBoundary,h=e.altBoundary,p=e.flipVariations,f=void 0===p||p,g=e.allowedAutoPlacements,m=t.options.placement,A=lo(m),E=l||(A!==m&&f?function Iq(n){if(lo(n)===HC)return[];var t=nm(n);return[aP(n),t,aP(t)]}(m):[nm(m)]),b=[m].concat(E).reduce(function(Xe,wi){return Xe.concat(lo(wi)===HC?function Dq(n,t){void 0===t&&(t={});var r=t.boundary,o=t.rootBoundary,s=t.padding,a=t.flipVariations,l=t.allowedAutoPlacements,c=void 0===l?tP:l,u=Lc(t.placement),d=u?a?eP:eP.filter(function(f){return Lc(f)===u}):ih,h=d.filter(function(f){return c.indexOf(f)>=0});0===h.length&&(h=d);var p=h.reduce(function(f,g){return f[g]=sh(n,{placement:g,boundary:r,rootBoundary:o,padding:s})[lo(g)],f},{});return Object.keys(p).sort(function(f,g){return p[f]-p[g]})}(t,{placement:wi,boundary:u,rootBoundary:d,padding:c,flipVariations:f,allowedAutoPlacements:g}):wi)},[]),D=t.rects.reference,I=t.rects.popper,Q=new Map,O=!0,q=b[0],le=0;le=0,ht=dt?"width":"height",U=sh(t,{placement:xe,boundary:u,rootBoundary:d,altBoundary:h,padding:c}),V=dt?Ae?cr:Ei:Ae?lr:_i;D[ht]>I[ht]&&(V=nm(V));var W=nm(V),X=[];if(o&&X.push(U[ke]<=0),a&&X.push(U[V]<=0,U[W]<=0),X.every(function(Xe){return Xe})){q=xe,O=!1;break}Q.set(xe,X)}if(O)for(var ft=function(wi){var Qr=b.find(function(Ht){var Pn=Q.get(Ht);if(Pn)return Pn.slice(0,wi).every(function(yn){return yn})});if(Qr)return q=Qr,"break"},Bt=f?3:1;Bt>0&&"break"!==ft(Bt);Bt--);t.placement!==q&&(t.modifiersData[i]._skip=!0,t.placement=q,t.reset=!0)}},requiresIfExists:["offset"],data:{_skip:!1}};function ah(n,t,e){return $a(n,Zg(t,e))}const kq={name:"preventOverflow",enabled:!0,phase:"main",fn:function Oq(n){var t=n.state,e=n.options,i=n.name,r=e.mainAxis,o=void 0===r||r,s=e.altAxis,a=void 0!==s&&s,h=e.tether,p=void 0===h||h,f=e.tetherOffset,g=void 0===f?0:f,m=sh(t,{boundary:e.boundary,rootBoundary:e.rootBoundary,padding:e.padding,altBoundary:e.altBoundary}),A=lo(t.placement),y=Lc(t.placement),E=!y,b=VC(A),D=function Tq(n){return"x"===n?"y":"x"}(b),I=t.modifiersData.popperOffsets,Q=t.rects.reference,O=t.rects.popper,q="function"==typeof g?g(Object.assign({},t.rects,{placement:t.placement})):g,le="number"==typeof q?{mainAxis:q,altAxis:q}:Object.assign({mainAxis:0,altAxis:0},q),xe=t.modifiersData.offset?t.modifiersData.offset[t.placement]:null,ke={x:0,y:0};if(I){if(o){var Ae,dt="y"===b?_i:Ei,ht="y"===b?lr:cr,U="y"===b?"height":"width",V=I[b],W=V+m[dt],X=V-m[ht],Ce=p?-O[U]/2:0,ft=y===Nc?Q[U]:O[U],Bt=y===Nc?-O[U]:-Q[U],cn=t.elements.arrow,Xe=p&&cn?zC(cn):{width:0,height:0},wi=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:{top:0,right:0,bottom:0,left:0},Qr=wi[dt],Ht=wi[ht],Pn=ah(0,Q[U],Xe[U]),yn=E?Q[U]/2-Ce-Pn-Qr-le.mainAxis:ft-Pn-Qr-le.mainAxis,zi=E?-Q[U]/2+Ce+Pn+Ht+le.mainAxis:Bt+Pn+Ht+le.mainAxis,_o=t.elements.arrow&&nh(t.elements.arrow),Wh=null!=(Ae=xe?.[b])?Ae:0,RA=V+zi-Wh,Jh=ah(p?Zg(W,V+yn-Wh-(_o?"y"===b?_o.clientTop||0:_o.clientLeft||0:0)):W,V,p?$a(X,RA):X);I[b]=Jh,ke[b]=Jh-V}if(a){var Kh,is=I[D],la="y"===D?"height":"width",$h=is+m["x"===b?_i:Ei],yl=is-m["x"===b?lr:cr],qh=-1!==[_i,Ei].indexOf(A),QA=null!=(Kh=xe?.[D])?Kh:0,UA=qh?$h:is-Q[la]-O[la]-QA+le.altAxis,jA=qh?is+Q[la]+O[la]-QA-le.altAxis:yl,zA=p&&qh?function Bq(n,t,e){var i=ah(n,t,e);return i>e?e:i}(UA,is,jA):ah(p?UA:$h,is,p?jA:yl);I[D]=zA,ke[D]=zA-is}t.modifiersData[i]=ke}},requiresIfExists:["offset"]},Nq={name:"arrow",enabled:!0,phase:"main",fn:function Fq(n){var t,e=n.state,i=n.name,r=n.options,o=e.elements.arrow,s=e.modifiersData.popperOffsets,a=lo(e.placement),l=VC(a),u=[Ei,cr].indexOf(a)>=0?"height":"width";if(o&&s){var d=function(t,e){return dP("number"!=typeof(t="function"==typeof t?t(Object.assign({},e.rects,{placement:e.placement})):t)?t:hP(t,ih))}(r.padding,e),h=zC(o),p="y"===l?_i:Ei,f="y"===l?lr:cr,g=e.rects.reference[u]+e.rects.reference[l]-s[l]-e.rects.popper[u],m=s[l]-e.rects.reference[l],A=nh(o),y=A?"y"===l?A.clientHeight||0:A.clientWidth||0:0,I=y/2-h[u]/2+(g/2-m/2),Q=ah(d[p],I,y-h[u]-d[f]);e.modifiersData[i]=((t={})[l]=Q,t.centerOffset=Q-I,t)}},effect:function Rq(n){var t=n.state,i=n.options.element,r=void 0===i?"[data-popper-arrow]":i;null!=r&&("string"==typeof r&&!(r=t.elements.popper.querySelector(r))||!lP(t.elements.popper,r)||(t.elements.arrow=r))},requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function pP(n,t,e){return void 0===e&&(e={x:0,y:0}),{top:n.top-t.height-e.y,right:n.right-t.width+e.x,bottom:n.bottom-t.height+e.y,left:n.left-t.width-e.x}}function fP(n){return[_i,cr,lr,Ei].some(function(t){return n[t]>=0})}var Qq=[aq,cq,pq,sP,bq,xq,kq,Nq,{name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:function Lq(n){var t=n.state,e=n.name,i=t.rects.reference,r=t.rects.popper,o=t.modifiersData.preventOverflow,s=sh(t,{elementContext:"reference"}),a=sh(t,{altBoundary:!0}),l=pP(s,i),c=pP(a,r,o),u=fP(l),d=fP(c);t.modifiersData[e]={referenceClippingOffsets:l,popperEscapeOffsets:c,isReferenceHidden:u,hasPopperEscaped:d},t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-reference-hidden":u,"data-popper-escaped":d})}}],Uq=oq({defaultModifiers:Qq}),gP="tippy-content",AP="tippy-arrow",bP="tippy-svg-arrow",Ls={passive:!0,capture:!0},yP=function(){return document.body};function YC(n,t,e){return Array.isArray(n)?n[t]??(Array.isArray(e)?e[t]:e):n}function WC(n,t){var e={}.toString.call(n);return 0===e.indexOf("[object")&&e.indexOf(t+"]")>-1}function _P(n,t){return"function"==typeof n?n.apply(void 0,t):n}function EP(n,t){return 0===t?n:function(i){clearTimeout(e),e=setTimeout(function(){n(i)},t)};var e}function Qs(n){return[].concat(n)}function CP(n,t){-1===n.indexOf(t)&&n.push(t)}function Qc(n){return[].slice.call(n)}function MP(n){return Object.keys(n).reduce(function(t,e){return void 0!==n[e]&&(t[e]=n[e]),t},{})}function qa(){return document.createElement("div")}function im(n){return["Element","Fragment"].some(function(t){return WC(n,t)})}function $C(n,t){n.forEach(function(e){e&&(e.style.transitionDuration=t+"ms")})}function lh(n,t){n.forEach(function(e){e&&e.setAttribute("data-state",t)})}function qC(n,t,e){var i=t+"EventListener";["transitionend","webkitTransitionEnd"].forEach(function(r){n[i](r,e)})}function IP(n,t){for(var e=t;e;){var i;if(n.contains(e))return!0;e=null==e.getRootNode||null==(i=e.getRootNode())?void 0:i.host}return!1}var co={isTouch:!1},SP=0;function Jq(){co.isTouch||(co.isTouch=!0,window.performance&&document.addEventListener("mousemove",xP))}function xP(){var n=performance.now();n-SP<20&&(co.isTouch=!1,document.removeEventListener("mousemove",xP)),SP=n}function Kq(){var n=document.activeElement;(function wP(n){return!(!n||!n._tippy||n._tippy.reference!==n)})(n)&&n.blur&&!n._tippy.state.isVisible&&n.blur()}var Xq=!!(typeof window<"u"&&typeof document<"u")&&!!window.msCrypto,Ci=Object.assign({appendTo:yP,aria:{content:"auto",expanded:"auto"},delay:0,duration:[300,250],getReferenceClientRect:null,hideOnClick:!0,ignoreAttributes:!1,interactive:!1,interactiveBorder:2,interactiveDebounce:0,moveTransition:"",offset:[0,10],onAfterUpdate:function(){},onBeforeUpdate:function(){},onCreate:function(){},onDestroy:function(){},onHidden:function(){},onHide:function(){},onMount:function(){},onShow:function(){},onShown:function(){},onTrigger:function(){},onUntrigger:function(){},onClickOutside:function(){},placement:"top",plugins:[],popperOptions:{},render:null,showOnCreate:!1,touch:!0,trigger:"mouseenter focus",triggerTarget:null},{animateFill:!1,followCursor:!1,inlinePositioning:!1,sticky:!1},{allowHTML:!1,animation:"fade",arrow:!0,content:"",inertia:!1,maxWidth:350,role:"tooltip",theme:"",zIndex:9999}),n7=Object.keys(Ci);function PP(n){var e=(n.plugins||[]).reduce(function(i,r){var a,o=r.name;return o&&(i[o]=void 0!==n[o]?n[o]:null!=(a=Ci[o])?a:r.defaultValue),i},{});return Object.assign({},n,e)}function FP(n,t){var e=Object.assign({},t,{content:_P(t.content,[n])},t.ignoreAttributes?{}:function r7(n,t){return(t?Object.keys(PP(Object.assign({},Ci,{plugins:t}))):n7).reduce(function(r,o){var s=(n.getAttribute("data-tippy-"+o)||"").trim();if(!s)return r;if("content"===o)r[o]=s;else try{r[o]=JSON.parse(s)}catch{r[o]=s}return r},{})}(n,t.plugins));return e.aria=Object.assign({},Ci.aria,e.aria),e.aria={expanded:"auto"===e.aria.expanded?t.interactive:e.aria.expanded,content:"auto"===e.aria.content?t.interactive?null:"describedby":e.aria.content},e}function XC(n,t){n.innerHTML=t}function RP(n){var t=qa();return!0===n?t.className=AP:(t.className=bP,im(n)?t.appendChild(n):XC(t,n)),t}function NP(n,t){im(t.content)?(XC(n,""),n.appendChild(t.content)):"function"!=typeof t.content&&(t.allowHTML?XC(n,t.content):n.textContent=t.content)}function rm(n){var t=n.firstElementChild,e=Qc(t.children);return{box:t,content:e.find(function(i){return i.classList.contains(gP)}),arrow:e.find(function(i){return i.classList.contains(AP)||i.classList.contains(bP)}),backdrop:e.find(function(i){return i.classList.contains("tippy-backdrop")})}}function LP(n){var t=qa(),e=qa();e.className="tippy-box",e.setAttribute("data-state","hidden"),e.setAttribute("tabindex","-1");var i=qa();function r(o,s){var a=rm(t),l=a.box,c=a.content,u=a.arrow;s.theme?l.setAttribute("data-theme",s.theme):l.removeAttribute("data-theme"),"string"==typeof s.animation?l.setAttribute("data-animation",s.animation):l.removeAttribute("data-animation"),s.inertia?l.setAttribute("data-inertia",""):l.removeAttribute("data-inertia"),l.style.maxWidth="number"==typeof s.maxWidth?s.maxWidth+"px":s.maxWidth,s.role?l.setAttribute("role",s.role):l.removeAttribute("role"),(o.content!==s.content||o.allowHTML!==s.allowHTML)&&NP(c,n.props),s.arrow?u?o.arrow!==s.arrow&&(l.removeChild(u),l.appendChild(RP(s.arrow))):l.appendChild(RP(s.arrow)):u&&l.removeChild(u)}return i.className=gP,i.setAttribute("data-state","hidden"),NP(i,n.props),t.appendChild(e),e.appendChild(i),r(n.props,n.props),{popper:t,onUpdate:r}}LP.$$tippy=!0;var s7=1,om=[],sm=[];function a7(n,t){var i,r,o,u,d,h,g,e=FP(n,Object.assign({},Ci,PP(MP(t)))),s=!1,a=!1,l=!1,c=!1,p=[],f=EP(FA,e.interactiveDebounce),m=s7++,y=function Vq(n){return n.filter(function(t,e){return n.indexOf(t)===e})}(e.plugins),b={id:m,reference:n,popper:qa(),popperInstance:null,props:e,state:{isEnabled:!0,isVisible:!1,isDestroyed:!1,isMounted:!1,isShown:!1},plugins:y,clearDelayTimeouts:function UA(){clearTimeout(i),clearTimeout(r),cancelAnimationFrame(o)},setProps:function jA(k){if(!b.state.isDestroyed){W("onBeforeUpdate",[b,k]),PA();var se=b.props,De=FP(n,Object.assign({},se,MP(k),{ignoreAttributes:!0}));b.props=De,_o(),se.interactiveDebounce!==De.interactiveDebounce&&(ft(),f=EP(FA,De.interactiveDebounce)),se.triggerTarget&&!De.triggerTarget?Qs(se.triggerTarget).forEach(function(bt){bt.removeAttribute("aria-expanded")}):De.triggerTarget&&n.removeAttribute("aria-expanded"),Ce(),V(),Q&&Q(se,De),b.popperInstance&&(NA(),la().forEach(function(bt){requestAnimationFrame(bt._tippy.popperInstance.forceUpdate)})),W("onAfterUpdate",[b,k])}},setContent:function zA(k){b.setProps({content:k})},show:function Fpe(){var k=b.state.isVisible,se=b.state.isDestroyed,De=!b.state.isEnabled,bt=co.isTouch&&!b.props.touch,Ze=YC(b.props.duration,0,Ci.duration);if(!(k||se||De||bt||Ae().hasAttribute("disabled")||(W("onShow",[b],!1),!1===b.props.onShow(b)))){if(b.state.isVisible=!0,ke()&&(I.style.visibility="visible"),V(),wi(),b.state.isMounted||(I.style.transition="none"),ke()){var di=ht();$C([di.box,di.content],0)}h=function(){var _l;if(b.state.isVisible&&!c){if(c=!0,I.style.transition=b.props.moveTransition,ke()&&b.props.animation){var gw=ht(),HA=gw.box,hu=gw.content;$C([HA,hu],Ze),lh([HA,hu],"visible")}X(),Ce(),CP(sm,b),null==(_l=b.popperInstance)||_l.forceUpdate(),W("onMount",[b]),b.props.animation&&ke()&&function Pn(k,se){yn(k,se)}(Ze,function(){b.state.isShown=!0,W("onShown",[b])})}},function is(){var se,k=b.props.appendTo,De=Ae();(se=b.props.interactive&&k===yP||"parent"===k?De.parentNode:_P(k,[De])).contains(I)||se.appendChild(I),b.state.isMounted=!0,NA()}()}},hide:function Rpe(){var k=!b.state.isVisible,se=b.state.isDestroyed,De=!b.state.isEnabled,bt=YC(b.props.duration,1,Ci.duration);if(!(k||se||De)&&(W("onHide",[b],!1),!1!==b.props.onHide(b))){if(b.state.isVisible=!1,b.state.isShown=!1,c=!1,s=!1,ke()&&(I.style.visibility="hidden"),ft(),Qr(),V(!0),ke()){var Ze=ht(),di=Ze.box,mr=Ze.content;b.props.animation&&($C([di,mr],bt),lh([di,mr],"hidden"))}X(),Ce(),b.props.animation?ke()&&function Ht(k,se){yn(k,function(){!b.state.isVisible&&I.parentNode&&I.parentNode.contains(I)&&se()})}(bt,b.unmount):b.unmount()}},hideWithInteractivity:function Npe(k){dt().addEventListener("mousemove",f),CP(om,f),f(k)},enable:function qh(){b.state.isEnabled=!0},disable:function QA(){b.hide(),b.state.isEnabled=!1},unmount:function Lpe(){b.state.isVisible&&b.hide(),b.state.isMounted&&(LA(),la().forEach(function(k){k._tippy.unmount()}),I.parentNode&&I.parentNode.removeChild(I),sm=sm.filter(function(k){return k!==b}),b.state.isMounted=!1,W("onHidden",[b]))},destroy:function Qpe(){b.state.isDestroyed||(b.clearDelayTimeouts(),b.unmount(),PA(),delete n._tippy,b.state.isDestroyed=!0,W("onDestroy",[b]))}};if(!e.render)return b;var D=e.render(b),I=D.popper,Q=D.onUpdate;I.setAttribute("data-tippy-root",""),I.id="tippy-"+b.id,b.popper=I,n._tippy=b,I._tippy=b;var O=y.map(function(k){return k.fn(b)}),q=n.hasAttribute("aria-expanded");return _o(),Ce(),V(),W("onCreate",[b]),e.showOnCreate&&$h(),I.addEventListener("mouseenter",function(){b.props.interactive&&b.state.isVisible&&b.clearDelayTimeouts()}),I.addEventListener("mouseleave",function(){b.props.interactive&&b.props.trigger.indexOf("mouseenter")>=0&&dt().addEventListener("mousemove",f)}),b;function le(){var k=b.props.touch;return Array.isArray(k)?k:[k,0]}function xe(){return"hold"===le()[0]}function ke(){var k;return!(null==(k=b.props.render)||!k.$$tippy)}function Ae(){return g||n}function dt(){var k=Ae().parentNode;return k?function DP(n){var t,i=Qs(n)[0];return null!=i&&null!=(t=i.ownerDocument)&&t.body?i.ownerDocument:document}(k):document}function ht(){return rm(I)}function U(k){return b.state.isMounted&&!b.state.isVisible||co.isTouch||u&&"focus"===u.type?0:YC(b.props.delay,k?0:1,Ci.delay)}function V(k){void 0===k&&(k=!1),I.style.pointerEvents=b.props.interactive&&!k?"":"none",I.style.zIndex=""+b.props.zIndex}function W(k,se,De){var bt;void 0===De&&(De=!0),O.forEach(function(Ze){Ze[k]&&Ze[k].apply(Ze,se)}),De&&(bt=b.props)[k].apply(bt,se)}function X(){var k=b.props.aria;if(k.content){var se="aria-"+k.content,De=I.id;Qs(b.props.triggerTarget||n).forEach(function(Ze){var di=Ze.getAttribute(se);if(b.state.isVisible)Ze.setAttribute(se,di?di+" "+De:De);else{var mr=di&&di.replace(De,"").trim();mr?Ze.setAttribute(se,mr):Ze.removeAttribute(se)}})}}function Ce(){!q&&b.props.aria.expanded&&Qs(b.props.triggerTarget||n).forEach(function(se){b.props.interactive?se.setAttribute("aria-expanded",b.state.isVisible&&se===Ae()?"true":"false"):se.removeAttribute("aria-expanded")})}function ft(){dt().removeEventListener("mousemove",f),om=om.filter(function(k){return k!==f})}function Bt(k){if(!co.isTouch||!l&&"mousedown"!==k.type){var se=k.composedPath&&k.composedPath()[0]||k.target;if(!b.props.interactive||!IP(I,se)){if(Qs(b.props.triggerTarget||n).some(function(De){return IP(De,se)})){if(co.isTouch||b.state.isVisible&&b.props.trigger.indexOf("click")>=0)return}else W("onClickOutside",[b,k]);!0===b.props.hideOnClick&&(b.clearDelayTimeouts(),b.hide(),a=!0,setTimeout(function(){a=!1}),b.state.isMounted||Qr())}}}function cn(){l=!0}function Xe(){l=!1}function wi(){var k=dt();k.addEventListener("mousedown",Bt,!0),k.addEventListener("touchend",Bt,Ls),k.addEventListener("touchstart",Xe,Ls),k.addEventListener("touchmove",cn,Ls)}function Qr(){var k=dt();k.removeEventListener("mousedown",Bt,!0),k.removeEventListener("touchend",Bt,Ls),k.removeEventListener("touchstart",Xe,Ls),k.removeEventListener("touchmove",cn,Ls)}function yn(k,se){var De=ht().box;function bt(Ze){Ze.target===De&&(qC(De,"remove",bt),se())}if(0===k)return se();qC(De,"remove",d),qC(De,"add",bt),d=bt}function zi(k,se,De){void 0===De&&(De=!1),Qs(b.props.triggerTarget||n).forEach(function(Ze){Ze.addEventListener(k,se,De),p.push({node:Ze,eventType:k,handler:se,options:De})})}function _o(){xe()&&(zi("touchstart",Wh,{passive:!0}),zi("touchend",RA,{passive:!0})),function Hq(n){return n.split(/\s+/).filter(Boolean)}(b.props.trigger).forEach(function(k){if("manual"!==k)switch(zi(k,Wh),k){case"mouseenter":zi("mouseleave",RA);break;case"focus":zi(Xq?"focusout":"blur",Jh);break;case"focusin":zi("focusout",Jh)}})}function PA(){p.forEach(function(k){k.node.removeEventListener(k.eventType,k.handler,k.options)}),p=[]}function Wh(k){var se,De=!1;if(b.state.isEnabled&&!Kh(k)&&!a){var bt="focus"===(null==(se=u)?void 0:se.type);u=k,g=k.currentTarget,Ce(),!b.state.isVisible&&function KC(n){return WC(n,"MouseEvent")}(k)&&om.forEach(function(Ze){return Ze(k)}),"click"===k.type&&(b.props.trigger.indexOf("mouseenter")<0||s)&&!1!==b.props.hideOnClick&&b.state.isVisible?De=!0:$h(k),"click"===k.type&&(s=!De),De&&!bt&&yl(k)}}function FA(k){var se=k.target,De=Ae().contains(se)||I.contains(se);"mousemove"===k.type&&De||function Wq(n,t){var e=t.clientX,i=t.clientY;return n.every(function(r){var o=r.popperRect,s=r.popperState,l=r.props.interactiveBorder,c=function vP(n){return n.split("-")[0]}(s.placement),u=s.modifiersData.offset;return!u||o.top-i+("bottom"===c?u.top.y:0)>l||i-o.bottom-("top"===c?u.bottom.y:0)>l||o.left-e+("right"===c?u.left.x:0)>l||e-o.right-("left"===c?u.right.x:0)>l})}(la().concat(I).map(function(Ze){var di,du=null==(di=Ze._tippy.popperInstance)?void 0:di.state;return du?{popperRect:Ze.getBoundingClientRect(),popperState:du,props:e}:null}).filter(Boolean),k)&&(ft(),yl(k))}function RA(k){if(!(Kh(k)||b.props.trigger.indexOf("click")>=0&&s)){if(b.props.interactive)return void b.hideWithInteractivity(k);yl(k)}}function Jh(k){b.props.trigger.indexOf("focusin")<0&&k.target!==Ae()||b.props.interactive&&k.relatedTarget&&I.contains(k.relatedTarget)||yl(k)}function Kh(k){return!!co.isTouch&&xe()!==k.type.indexOf("touch")>=0}function NA(){LA();var k=b.props,se=k.popperOptions,De=k.placement,bt=k.offset,Ze=k.getReferenceClientRect,di=k.moveTransition,mr=ke()?rm(I).arrow:null,du=Ze?{getBoundingClientRect:Ze,contextElement:Ze.contextElement||Ae()}:n,_l=[{name:"offset",options:{offset:bt}},{name:"preventOverflow",options:{padding:{top:2,bottom:2,left:5,right:5}}},{name:"flip",options:{padding:5}},{name:"computeStyles",options:{adaptive:!di}},{name:"$$tippy",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:function(HA){var hu=HA.state;if(ke()){var mw=ht().box;["placement","reference-hidden","escaped"].forEach(function(VA){"placement"===VA?mw.setAttribute("data-placement",hu.placement):hu.attributes.popper["data-popper-"+VA]?mw.setAttribute("data-"+VA,""):mw.removeAttribute("data-"+VA)}),hu.attributes.popper={}}}}];ke()&&mr&&_l.push({name:"arrow",options:{element:mr,padding:3}}),_l.push.apply(_l,se?.modifiers||[]),b.popperInstance=Uq(du,I,Object.assign({},se,{placement:De,onFirstUpdate:h,modifiers:_l}))}function LA(){b.popperInstance&&(b.popperInstance.destroy(),b.popperInstance=null)}function la(){return Qc(I.querySelectorAll("[data-tippy-root]"))}function $h(k){b.clearDelayTimeouts(),k&&W("onTrigger",[b,k]),wi();var se=U(!0),De=le(),Ze=De[1];co.isTouch&&"hold"===De[0]&&Ze&&(se=Ze),se?i=setTimeout(function(){b.show()},se):b.show()}function yl(k){if(b.clearDelayTimeouts(),W("onUntrigger",[b,k]),b.state.isVisible){if(!(b.props.trigger.indexOf("mouseenter")>=0&&b.props.trigger.indexOf("click")>=0&&["mouseleave","mousemove"].indexOf(k.type)>=0&&s)){var se=U(!1);se?r=setTimeout(function(){b.state.isVisible&&b.hide()},se):o=requestAnimationFrame(function(){b.hide()})}}else Qr()}}function Us(n,t){void 0===t&&(t={});var e=Ci.plugins.concat(t.plugins||[]);!function $q(){document.addEventListener("touchstart",Jq,Ls),window.addEventListener("blur",Kq)}();var i=Object.assign({},t,{plugins:e}),a=function Yq(n){return im(n)?[n]:function Gq(n){return WC(n,"NodeList")}(n)?Qc(n):Array.isArray(n)?n:Qc(document.querySelectorAll(n))}(n).reduce(function(l,c){var u=c&&a7(c,i);return u&&l.push(u),l},[]);return im(n)?a[0]:a}Us.defaultProps=Ci,Us.setDefaultProps=function(t){Object.keys(t).forEach(function(i){Ci[i]=t[i]})},Us.currentInput=co,Object.assign({},sP,{effect:function(t){var e=t.state,i={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};Object.assign(e.elements.popper.style,i.popper),e.styles=i,e.elements.arrow&&Object.assign(e.elements.arrow.style,i.arrow)}}),Us.setDefaultProps({render:LP});const Jo=Us,jP=(()=>{function n(){return Error.call(this),this.message="argument out of range",this.name="ArgumentOutOfRangeError",this}return n.prototype=Object.create(Error.prototype),n})();function Wn(n){return t=>0===n?Gf():t.lift(new g7(n))}class g7{constructor(t){if(this.total=t,this.total<0)throw new jP}call(t,e){return e.subscribe(new m7(t,this.total))}}class m7 extends Ge{constructor(t,e){super(t),this.total=e,this.count=0}_next(t){const e=this.total,i=++this.count;i<=e&&(this.destination.next(t),i===e&&(this.destination.complete(),this.unsubscribe()))}}const Ui=function(n){for(var t=0;;t++)if(!(n=n.previousSibling))return t},uh=function(n){let t=n.assignedSlot||n.parentNode;return t&&11==t.nodeType?t.host:t};let zP=null;const Ko=function(n,t,e){let i=zP||(zP=document.createRange());return i.setEnd(n,e??n.nodeValue.length),i.setStart(n,t||0),i},Xa=function(n,t,e,i){return e&&(HP(n,t,e,i,-1)||HP(n,t,e,i,1))},A7=/^(img|br|input|textarea|hr)$/i;function HP(n,t,e,i,r){for(;;){if(n==e&&t==i)return!0;if(t==(r<0?0:uo(n))){let o=n.parentNode;if(!o||1!=o.nodeType||y7(n)||A7.test(n.nodeName)||"false"==n.contentEditable)return!1;t=Ui(n)+(r<0?0:1),n=o}else{if(1!=n.nodeType)return!1;if("false"==(n=n.childNodes[t+(r<0?-1:0)]).contentEditable)return!1;t=r<0?uo(n):0}}}function uo(n){return 3==n.nodeType?n.nodeValue.length:n.childNodes.length}function y7(n){let t;for(let e=n;e&&!(t=e.pmViewDesc);e=e.parentNode);return t&&t.node&&t.node.isBlock&&(t.dom==n||t.contentDOM==n)}const lm=function(n){return n.focusNode&&Xa(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)};function Uc(n,t){let e=document.createEvent("Event");return e.initEvent("keydown",!0,!0),e.keyCode=n,e.key=e.code=t,e}const js=typeof navigator<"u"?navigator:null,VP=typeof document<"u"?document:null,zs=js&&js.userAgent||"",ev=/Edge\/(\d+)/.exec(zs),GP=/MSIE \d/.exec(zs),tv=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(zs),vi=!!(GP||tv||ev),Hs=GP?document.documentMode:tv?+tv[1]:ev?+ev[1]:0,kr=!vi&&/gecko\/(\d+)/i.test(zs);kr&&/Firefox\/(\d+)/.exec(zs);const nv=!vi&&/Chrome\/(\d+)/.exec(zs),Mi=!!nv,E7=nv?+nv[1]:0,ai=!vi&&!!js&&/Apple Computer/.test(js.vendor),jc=ai&&(/Mobile\/\w+/.test(zs)||!!js&&js.maxTouchPoints>2),ur=jc||!!js&&/Mac/.test(js.platform),ho=/Android \d/.test(zs),cm=!!VP&&"webkitFontSmoothing"in VP.documentElement.style,C7=cm?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function v7(n){return{left:0,right:n.documentElement.clientWidth,top:0,bottom:n.documentElement.clientHeight}}function Vs(n,t){return"number"==typeof n?n:n[t]}function M7(n){let t=n.getBoundingClientRect();return{left:t.left,right:t.left+n.clientWidth*(t.width/n.offsetWidth||1),top:t.top,bottom:t.top+n.clientHeight*(t.height/n.offsetHeight||1)}}function YP(n,t,e){let i=n.someProp("scrollThreshold")||0,r=n.someProp("scrollMargin")||5,o=n.dom.ownerDocument;for(let s=e||n.dom;s;s=uh(s)){if(1!=s.nodeType)continue;let a=s,l=a==o.body,c=l?v7(o):M7(a),u=0,d=0;if(t.topc.bottom-Vs(i,"bottom")&&(d=t.bottom-c.bottom+Vs(r,"bottom")),t.leftc.right-Vs(i,"right")&&(u=t.right-c.right+Vs(r,"right")),u||d)if(l)o.defaultView.scrollBy(u,d);else{let h=a.scrollLeft,p=a.scrollTop;d&&(a.scrollTop+=d),u&&(a.scrollLeft+=u);let f=a.scrollLeft-h,g=a.scrollTop-p;t={left:t.left-f,top:t.top-g,right:t.right-f,bottom:t.bottom-g}}if(l)break}}function WP(n){let t=[],e=n.ownerDocument;for(let i=n;i&&(t.push({dom:i,top:i.scrollTop,left:i.scrollLeft}),n!=e);i=uh(i));return t}function JP(n,t){for(let e=0;e=a){s=Math.max(h.bottom,s),a=Math.min(h.top,a);let p=h.left>t.left?h.left-t.left:h.right=(h.left+h.right)/2?1:0));continue}}!e&&(t.left>=h.right&&t.top>=h.top||t.left>=h.left&&t.top>=h.bottom)&&(o=c+1)}}return e&&3==e.nodeType?function S7(n,t){let e=n.nodeValue.length,i=document.createRange();for(let r=0;r=(o.left+o.right)/2?1:0)}}return{node:n,offset:0}}(e,r):!e||i&&1==e.nodeType?{node:n,offset:o}:KP(e,r)}function iv(n,t){return n.left>=t.left-1&&n.left<=t.right+1&&n.top>=t.top-1&&n.top<=t.bottom+1}function $P(n,t,e){let i=n.childNodes.length;if(i&&e.topt.top&&r++}i==n.dom&&r==i.childNodes.length-1&&1==i.lastChild.nodeType&&t.top>i.lastChild.getBoundingClientRect().bottom?s=n.state.doc.content.size:(0==r||1!=i.nodeType||"BR"!=i.childNodes[r-1].nodeName)&&(s=function B7(n,t,e,i){let r=-1;for(let o=t;o!=n.dom;){let s=n.docView.nearestDesc(o,!0);if(!s)return null;if(s.node.isBlock&&s.parent){let a=s.dom.getBoundingClientRect();if(a.left>i.left||a.top>i.top)r=s.posBefore;else{if(!(a.right-1?r:n.docView.posFromDOM(t,e,1)}(n,i,r,t))}null==s&&(s=function T7(n,t,e){let{node:i,offset:r}=KP(t,e),o=-1;if(1==i.nodeType&&!i.firstChild){let s=i.getBoundingClientRect();o=s.left!=s.right&&e.left>(s.left+s.right)/2?1:-1}return n.docView.posFromDOM(i,r,o)}(n,o,t));let a=n.docView.nearestDesc(o,!0);return{pos:s,inside:a?a.posAtStart-a.border:-1}}function Gs(n,t){let e=n.getClientRects();return e.length?e[t<0?0:e.length-1]:n.getBoundingClientRect()}const k7=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function qP(n,t,e){let{node:i,offset:r,atom:o}=n.docView.domFromPos(t,e<0?-1:1),s=cm||kr;if(3==i.nodeType){if(!s||!k7.test(i.nodeValue)&&(e<0?r:r!=i.nodeValue.length)){let l=r,c=r,u=e<0?1:-1;return e<0&&!r?(c++,u=-1):e>=0&&r==i.nodeValue.length?(l--,u=1):e<0?l--:c++,dh(Gs(Ko(i,l,c),1),u<0)}{let l=Gs(Ko(i,r,r),e);if(kr&&r&&/\s/.test(i.nodeValue[r-1])&&r=0)}if(null==o&&r&&(e<0||r==uo(i))){let l=i.childNodes[r-1],c=3==l.nodeType?Ko(l,uo(l)-(s?0:1)):1!=l.nodeType||"BR"==l.nodeName&&l.nextSibling?null:l;if(c)return dh(Gs(c,1),!1)}if(null==o&&r=0)}function dh(n,t){if(0==n.width)return n;let e=t?n.left:n.right;return{top:n.top,bottom:n.bottom,left:e,right:e}}function rv(n,t){if(0==n.height)return n;let e=t?n.top:n.bottom;return{top:e,bottom:e,left:n.left,right:n.right}}function XP(n,t,e){let i=n.state,r=n.root.activeElement;i!=t&&n.updateState(t),r!=n.dom&&n.focus();try{return e()}finally{i!=t&&n.updateState(i),r!=n.dom&&r&&r.focus()}}const F7=/[\u0590-\u08ac]/;let ZP=null,eF=null,tF=!1;class hh{constructor(t,e,i,r){this.parent=t,this.children=e,this.dom=i,this.contentDOM=r,this.dirty=0,i.pmViewDesc=this}matchesWidget(t){return!1}matchesMark(t){return!1}matchesNode(t,e,i){return!1}matchesHack(t){return!1}parseRule(){return null}stopEvent(t){return!1}get size(){let t=0;for(let e=0;eUi(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 o=t;;o=o.parentNode){if(o==this.dom){r=!1;break}if(o.previousSibling)break}if(null==r&&e==t.childNodes.length)for(let o=t;;o=o.parentNode){if(o==this.dom){r=!0;break}if(o.nextSibling)break}}return r??i>0?this.posAtEnd:this.posAtStart}nearestDesc(t,e=!1){for(let i=!0,r=t;r;r=r.parentNode){let s,o=this.getDesc(r);if(o&&(!e||o.node)){if(!i||!(s=o.nodeDOM)||(1==s.nodeType?s.contains(1==t.nodeType?t:t.parentNode):s==t))return o;i=!1}}}getDesc(t){let e=t.pmViewDesc;for(let i=e;i;i=i.parent)if(i==this)return e}posFromDOM(t,e,i){for(let r=t;r;r=r.parentNode){let o=this.getDesc(r);if(o)return o.localPosFromDOM(t,e,i)}return-1}descAt(t){for(let e=0,i=0;et||s instanceof oF){r=t-o;break}o=a}if(r)return this.children[i].domFromPos(r-this.children[i].border,e);for(;i&&!(o=this.children[i-1]).size&&o instanceof iF&&o.side>=0;i--);if(e<=0){let o,s=!0;for(;o=i?this.children[i-1]:null,o&&o.dom.parentNode!=this.contentDOM;i--,s=!1);return o&&e&&s&&!o.border&&!o.domAtom?o.domFromPos(o.size,e):{node:this.contentDOM,offset:o?Ui(o.dom)+1:0}}{let o,s=!0;for(;o=i=u&&e<=c-l.border&&l.node&&l.contentDOM&&this.contentDOM.contains(l.contentDOM))return l.parseRange(t,e,u);t=s;for(let d=a;d>0;d--){let h=this.children[d-1];if(h.size&&h.dom.parentNode==this.contentDOM&&!h.emptyChildAt(1)){r=Ui(h.dom)+1;break}t-=h.size}-1==r&&(r=0)}if(r>-1&&(c>e||a==this.children.length-1)){e=c;for(let u=a+1;up&&se){let p=a;a=l,l=p}let h=document.createRange();h.setEnd(l.node,l.offset),h.setStart(a.node,a.offset),c.removeAllRanges(),c.addRange(h)}}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 i=0,r=0;r=i:ti){let a=i+o.border,l=s-o.border;if(t>=a&&e<=l)return this.dirty=t==i||e==s?2:1,void(t!=a||e!=l||!o.contentLost&&o.dom.parentNode==this.contentDOM?o.markDirty(t-a,e-a):o.dirty=3);o.dirty=o.dom!=o.contentDOM||o.dom.parentNode!=this.contentDOM||o.children.length?3:2}i=s}this.dirty=2}markParentsDirty(){let t=1;for(let e=this.parent;e;e=e.parent,t++){let i=1==t?2:1;e.dirtyo?o.parent?o.parent.posBeforeChild(o):void 0:r)),!e.type.spec.raw){if(1!=s.nodeType){let a=document.createElement("span");a.appendChild(s),s=a}s.contentEditable="false",s.classList.add("ProseMirror-widget")}super(t,[],s,null),this.widget=e,this.widget=e,o=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 L7 extends hh{constructor(t,e,i,r){super(t,[],e,null),this.textDOM=i,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 Za extends hh{constructor(t,e,i,r){super(t,[],i,r),this.mark=e}static create(t,e,i,r){let o=r.nodeViews[e.type.name],s=o&&o(e,r,i);return(!s||!s.dom)&&(s=oo.renderSpec(document,e.type.spec.toDOM(e,i))),new Za(t,e,s.dom,s.contentDOM||s.dom)}parseRule(){return 3&this.dirty||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM||void 0}}matchesMark(t){return 3!=this.dirty&&this.mark.eq(t)}markDirty(t,e){if(super.markDirty(t,e),0!=this.dirty){let i=this.parent;for(;!i.node;)i=i.parent;i.dirty0&&(o=av(o,0,t,i));for(let a=0;al?l.parent?l.parent.posBeforeChild(l):void 0:s,i,r),u=c&&c.dom,d=c&&c.contentDOM;if(e.isText)if(u){if(3!=u.nodeType)throw new RangeError("Text must be rendered as a DOM text node")}else u=document.createTextNode(e.text);else u||({dom:u,contentDOM:d}=oo.renderSpec(document,e.type.spec.toDOM(e)));!d&&!e.isText&&"BR"!=u.nodeName&&(u.hasAttribute("contenteditable")||(u.contentEditable="false"),e.type.spec.draggable&&(u.draggable=!0));let h=u;return u=lF(u,i,e),c?l=new Q7(t,e,i,r,u,d||null,h,c,o,s+1):e.isText?new um(t,e,i,r,u,h,o):new el(t,e,i,r,u,d||null,h,o,s+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 i=this.children[e];if(this.dom.contains(i.dom.parentNode)){t.contentElement=i.dom.parentNode;break}}t.contentElement||(t.getContent=()=>L.empty)}else t.contentElement=this.contentDOM;else t.getContent=()=>this.node.content;return t}matchesNode(t,e,i){return 0==this.dirty&&t.eq(this.node)&&sv(e,this.outerDeco)&&i.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(t,e){let i=this.node.inlineContent,r=e,o=t.composing?this.localCompositionInfo(t,e):null,s=o&&o.pos>-1?o:null,a=o&&o.pos<0,l=new j7(this,s&&s.node,t);(function V7(n,t,e,i){let r=t.locals(n),o=0;if(0==r.length){for(let c=0;co;)a.push(r[s++]);let h=o+u.nodeSize;if(u.isText){let f=h;s!f.inline):a.slice(),t.forChild(o,u),d),o=h}})(this.node,this.innerDeco,(c,u,d)=>{c.spec.marks?l.syncToMarks(c.spec.marks,i,t):c.type.side>=0&&!d&&l.syncToMarks(u==this.node.childCount?Tt.none:this.node.child(u).marks,i,t),l.placeWidget(c,t,r)},(c,u,d,h)=>{let p;l.syncToMarks(c.marks,i,t),l.findNodeMatch(c,u,d,h)||a&&t.state.selection.from>r&&t.state.selection.to-1&&l.updateNodeAt(c,u,d,p,t)||l.updateNextNode(c,u,d,t,h)||l.addNode(c,u,d,t,r),r+=c.nodeSize}),l.syncToMarks([],i,t),this.node.isTextblock&&l.addTextblockHacks(),l.destroyRest(),(l.changed||2==this.dirty)&&(s&&this.protectLocalComposition(t,s),sF(this.contentDOM,this.children,t),jc&&function G7(n){if("UL"==n.nodeName||"OL"==n.nodeName){let t=n.style.cssText;n.style.cssText=t+"; list-style: square !important",window.getComputedStyle(n),n.style.cssText=t}}(this.dom))}localCompositionInfo(t,e){let{from:i,to:r}=t.state.selection;if(!(t.state.selection instanceof Ee)||ie+this.node.content.size)return null;let o=t.domSelectionRange(),s=function Y7(n,t){for(;;){if(3==n.nodeType)return n;if(1==n.nodeType&&t>0){if(n.childNodes.length>t&&3==n.childNodes[t].nodeType)return n.childNodes[t];t=uo(n=n.childNodes[t-1])}else{if(!(1==n.nodeType&&t=e){let c=a=0&&c+t.length+a>=e)return a+c;if(e==i&&l.length>=i+t.length-a&&l.slice(i-a,i-a+t.length)==t)return i}}return-1}(this.node.content,a,i-e,r-e);return l<0?null:{node:s,pos:l,text:a}}return{node:s,pos:-1,text:""}}protectLocalComposition(t,{node:e,pos:i,text:r}){if(this.getDesc(e))return;let o=e;for(;o.parentNode!=this.contentDOM;o=o.parentNode){for(;o.previousSibling;)o.parentNode.removeChild(o.previousSibling);for(;o.nextSibling;)o.parentNode.removeChild(o.nextSibling);o.pmViewDesc&&(o.pmViewDesc=void 0)}let s=new L7(this,o,e,r);t.input.compositionNodes.push(s),this.children=av(this.children,i,i+r.length,t,s)}update(t,e,i,r){return!(3==this.dirty||!t.sameMarkup(this.node)||(this.updateInner(t,e,i,r),0))}updateInner(t,e,i,r){this.updateOuterDeco(e),this.node=t,this.innerDeco=i,this.contentDOM&&this.updateChildren(r,this.posAtStart),this.dirty=0}updateOuterDeco(t){if(sv(t,this.outerDeco))return;let e=1!=this.nodeDOM.nodeType,i=this.dom;this.dom=aF(this.dom,this.nodeDOM,ov(this.outerDeco,this.node,e),ov(t,this.node,e)),this.dom!=i&&(i.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 rF(n,t,e,i,r){return lF(i,t,n),new el(void 0,n,t,e,i,i,i,r,0)}class um extends el{constructor(t,e,i,r,o,s,a){super(t,e,i,r,o,null,s,a,0)}parseRule(){let t=this.nodeDOM.parentNode;for(;t&&t!=this.dom&&!t.pmIsDeco;)t=t.parentNode;return{skip:t||!0}}update(t,e,i,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,i){return t==this.nodeDOM?this.posAtStart+Math.min(e,this.node.text.length):super.localPosFromDOM(t,e,i)}ignoreMutation(t){return"characterData"!=t.type&&"selection"!=t.type}slice(t,e,i){let r=this.node.cut(t,e),o=document.createTextNode(r.text);return new um(this.parent,r,this.outerDeco,this.innerDeco,o,o,i)}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 oF extends hh{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 Q7 extends el{constructor(t,e,i,r,o,s,a,l,c,u){super(t,e,i,r,o,s,a,c,u),this.spec=l}update(t,e,i,r){if(3==this.dirty)return!1;if(this.spec.update){let o=this.spec.update(t,e,i);return o&&this.updateInner(t,e,i,r),o}return!(!this.contentDOM&&!t.isLeaf)&&super.update(t,e,i,r)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(t,e,i,r){this.spec.setSelection?this.spec.setSelection(t,e,i):super.setSelection(t,e,i,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 sF(n,t,e){let i=n.firstChild,r=!1;for(let o=0;o0;){let a;for(;;)if(i){let c=e.children[i-1];if(!(c instanceof Za)){a=c,i--;break}e=c,i=c.children.length}else{if(e==t)break e;i=e.parent.children.indexOf(e),e=e.parent}let l=a.node;if(l){if(l!=n.child(r-1))break;--r,o.set(a,r),s.push(a)}}return{index:r,matched:o,matches:s.reverse()}}(t.node.content,t)}destroyBetween(t,e){if(t!=e){for(let i=t;i>1,s=Math.min(o,t.length);for(;r-1)a>this.index&&(this.changed=!0,this.destroyBetween(this.index,a)),this.top=this.top.children[this.index];else{let l=Za.create(this.top,t[o],e,i);this.top.children.splice(this.index,0,l),this.top=l,this.changed=!0}this.index=0,o++}}findNodeMatch(t,e,i,r){let s,o=-1;if(r>=this.preMatch.index&&(s=this.preMatch.matches[r-this.preMatch.index]).parent==this.top&&s.matchesNode(t,e,i))o=this.top.children.indexOf(s,this.index);else for(let a=this.index,l=Math.min(this.top.children.length,a+5);a=e||u<=t?o.push(l):(ce&&o.push(l.slice(e-c,l.size,i)))}return o}function lv(n,t=null){let e=n.domSelectionRange(),i=n.state.doc;if(!e.focusNode)return null;let r=n.docView.nearestDesc(e.focusNode),o=r&&0==r.size,s=n.docView.posFromDOM(e.focusNode,e.focusOffset,1);if(s<0)return null;let l,c,a=i.resolve(s);if(lm(e)){for(l=a;r&&!r.node;)r=r.parent;let u=r.node;if(r&&u.isAtom&&ce.isSelectable(u)&&r.parent&&(!u.isInline||!function b7(n,t,e){for(let i=0==t,r=t==uo(n);i||r;){if(n==e)return!0;let o=Ui(n);if(!(n=n.parentNode))return!1;i=i&&0==o,r=r&&o==uo(n)}}(e.focusNode,e.focusOffset,r.dom))){let d=r.posBefore;c=new ce(s==d?a:i.resolve(d))}}else{let u=n.docView.posFromDOM(e.anchorNode,e.anchorOffset,1);if(u<0)return null;l=i.resolve(u)}return c||(c=uv(n,l,a,"pointer"==t||n.state.selection.head{(e.anchorNode!=i||e.anchorOffset!=r)&&(t.removeEventListener("selectionchange",n.input.hideSelectionGuard),setTimeout(()=>{(!uF(n)||n.state.selection.visible)&&n.dom.classList.remove("ProseMirror-hideselection")},20))})}(n))}n.domObserver.setCurSelection(),n.domObserver.connectSelection()}}const dF=ai||Mi&&E7<63;function hF(n,t){let{node:e,offset:i}=n.docView.domFromPos(t,0),r=ir(n,t,e))||Ee.between(t,e,i)}function mF(n){return!(n.editable&&!n.hasFocus())&&AF(n)}function AF(n){let t=n.domSelectionRange();if(!t.anchorNode)return!1;try{return n.dom.contains(3==t.anchorNode.nodeType?t.anchorNode.parentNode:t.anchorNode)&&(n.editable||n.dom.contains(3==t.focusNode.nodeType?t.focusNode.parentNode:t.focusNode))}catch{return!1}}function dv(n,t){let{$anchor:e,$head:i}=n.selection,r=t>0?e.max(i):e.min(i),o=r.parent.inlineContent?r.depth?n.doc.resolve(t>0?r.after():r.before()):null:r;return o&&_e.findFrom(o,t)}function nl(n,t){return n.dispatch(n.state.tr.setSelection(t).scrollIntoView()),!0}function bF(n,t,e){let i=n.state.selection;if(!(i instanceof Ee)){if(i instanceof ce&&i.node.isInline)return nl(n,new Ee(t>0?i.$to:i.$from));{let r=dv(n.state,t);return!!r&&nl(n,r)}}if(!i.empty||e.indexOf("s")>-1)return!1;if(n.endOfTextblock(t>0?"right":"left")){let r=dv(n.state,t);return!!(r&&r instanceof ce)&&nl(n,r)}if(!(ur&&e.indexOf("m")>-1)){let s,r=i.$head,o=r.textOffset?null:t<0?r.nodeBefore:r.nodeAfter;if(!o||o.isText)return!1;let a=t<0?r.pos-o.nodeSize:r.pos;return!!(o.isAtom||(s=n.docView.descAt(a))&&!s.contentDOM)&&(ce.isSelectable(o)?nl(n,new ce(t<0?n.state.doc.resolve(r.pos-o.nodeSize):r)):!!cm&&nl(n,new Ee(n.state.doc.resolve(t<0?a:a+o.nodeSize))))}}function dm(n){return 3==n.nodeType?n.nodeValue.length:n.childNodes.length}function fh(n){let t=n.pmViewDesc;return t&&0==t.size&&(n.nextSibling||"BR"!=n.nodeName)}function hv(n){let t=n.domSelectionRange(),e=t.focusNode,i=t.focusOffset;if(!e)return;let r,o,s=!1;for(kr&&1==e.nodeType&&i0){if(1!=e.nodeType)break;{let a=e.childNodes[i-1];if(fh(a))r=e,o=--i;else{if(3!=a.nodeType)break;e=a,i=e.nodeValue.length}}}else{if(yF(e))break;{let a=e.previousSibling;for(;a&&fh(a);)r=e.parentNode,o=Ui(a),a=a.previousSibling;if(a)e=a,i=dm(e);else{if(e=e.parentNode,e==n.dom)break;i=0}}}s?fv(n,e,i):r&&fv(n,r,o)}function pv(n){let t=n.domSelectionRange(),e=t.focusNode,i=t.focusOffset;if(!e)return;let o,s,r=dm(e);for(;;)if(i{n.state==r&&$o(n)},50)}function _F(n,t,e){let i=n.state.selection;if(i instanceof Ee&&!i.empty||e.indexOf("s")>-1||ur&&e.indexOf("m")>-1)return!1;let{$from:r,$to:o}=i;if(!r.parent.inlineContent||n.endOfTextblock(t<0?"up":"down")){let s=dv(n.state,t);if(s&&s instanceof ce)return nl(n,s)}if(!r.parent.inlineContent){let s=t<0?r:o,a=i instanceof Qi?_e.near(s,t):_e.findFrom(s,t);return!!a&&nl(n,a)}return!1}function EF(n,t){if(!(n.state.selection instanceof Ee))return!0;let{$head:e,$anchor:i,empty:r}=n.state.selection;if(!e.sameParent(i))return!0;if(!r)return!1;if(n.endOfTextblock(t>0?"forward":"backward"))return!0;let o=!e.textOffset&&(t<0?e.nodeBefore:e.nodeAfter);if(o&&!o.isText){let s=n.state.tr;return t<0?s.delete(e.pos-o.nodeSize,e.pos):s.delete(e.pos,e.pos+o.nodeSize),n.dispatch(s),!0}return!1}function CF(n,t,e){n.domObserver.stop(),t.contentEditable=e,n.domObserver.start()}function vF(n,t){n.someProp("transformCopied",p=>{t=p(t,n)});let e=[],{content:i,openStart:r,openEnd:o}=t;for(;r>1&&o>1&&1==i.childCount&&1==i.firstChild.childCount;){r--,o--;let p=i.firstChild;e.push(p.type.name,p.attrs!=p.type.defaultAttrs?p.attrs:null),i=p.content}let s=n.someProp("clipboardSerializer")||oo.fromSchema(n.state.schema),a=BF(),l=a.createElement("div");l.appendChild(s.serializeFragment(i,{document:a}));let u,c=l.firstChild,d=0;for(;c&&1==c.nodeType&&(u=xF[c.nodeName.toLowerCase()]);){for(let p=u.length-1;p>=0;p--){let f=a.createElement(u[p]);for(;l.firstChild;)f.appendChild(l.firstChild);l.appendChild(f),d++}c=l.firstChild}return c&&1==c.nodeType&&c.setAttribute("data-pm-slice",`${r} ${o}${d?` -${d}`:""} ${JSON.stringify(e)}`),{dom:l,text:n.someProp("clipboardTextSerializer",p=>p(t,n))||t.content.textBetween(0,t.content.size,"\n\n")}}function MF(n,t,e,i,r){let s,a,o=r.parent.type.spec.code;if(!e&&!t)return null;let l=t&&(i||o||!e);if(l){if(n.someProp("transformPastedText",h=>{t=h(t,o||i,n)}),o)return t?new G(L.from(n.state.schema.text(t.replace(/\r\n?/g,"\n"))),0,0):G.empty;let d=n.someProp("clipboardTextParser",h=>h(t,r,i,n));if(d)a=d;else{let h=r.marks(),{schema:p}=n.state,f=oo.fromSchema(p);s=document.createElement("div"),t.split(/(?:\r\n?|\n)+/).forEach(g=>{let m=s.appendChild(document.createElement("p"));g&&m.appendChild(f.serializeNode(p.text(g,h)))})}}else n.someProp("transformPastedHTML",d=>{e=d(e,n)}),s=function nX(n){let t=/^(\s*]*>)*/.exec(n);t&&(n=n.slice(t[0].length));let r,e=BF().createElement("div"),i=/<([a-z][^>\s]+)/i.exec(n);if((r=i&&xF[i[1].toLowerCase()])&&(n=r.map(o=>"<"+o+">").join("")+n+r.map(o=>""+o+">").reverse().join("")),e.innerHTML=n,r)for(let o=0;o0;d--){let h=s.firstChild;for(;h&&1!=h.nodeType;)h=h.nextSibling;if(!h)break;s=h}if(a||(a=(n.someProp("clipboardParser")||n.someProp("domParser")||Ic.fromSchema(n.state.schema)).parseSlice(s,{preserveWhitespace:!(!l&&!u),context:r,ruleFromNode:h=>"BR"!=h.nodeName||h.nextSibling||!h.parentNode||eX.test(h.parentNode.nodeName)?null:{ignore:!0}})),u)a=function rX(n,t){if(!n.size)return n;let i,e=n.content.firstChild.type.schema;try{i=JSON.parse(t)}catch{return n}let{content:r,openStart:o,openEnd:s}=n;for(let a=i.length-2;a>=0;a-=2){let l=e.nodes[i[a]];if(!l||l.hasRequiredAttrs())break;r=L.from(l.create(i[a+1],r)),o++,s++}return new G(r,o,s)}(SF(a,+u[1],+u[2]),u[4]);else if(a=G.maxOpen(function tX(n,t){if(n.childCount<2)return n;for(let e=t.depth;e>=0;e--){let o,r=t.node(e).contentMatchAt(t.index(e)),s=[];if(n.forEach(a=>{if(!s)return;let c,l=r.findWrapping(a.type);if(!l)return s=null;if(c=s.length&&o.length&&DF(l,o,a,s[s.length-1],0))s[s.length-1]=c;else{s.length&&(s[s.length-1]=IF(s[s.length-1],o.length));let u=wF(a,l);s.push(u),r=r.matchType(u.type),o=l}}),s)return L.from(s)}return n}(a.content,r),!0),a.openStart||a.openEnd){let d=0,h=0;for(let p=a.content.firstChild;d{a=d(a,n)}),a}const eX=/^(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 wF(n,t,e=0){for(let i=t.length-1;i>=e;i--)n=t[i].create(null,L.from(n));return n}function DF(n,t,e,i,r){if(r=e&&(a=t<0?s.contentMatchAt(0).fillBefore(a,n.childCount>1||o<=r).append(a):a.append(s.contentMatchAt(s.childCount).fillBefore(L.empty,!0))),n.replaceChild(t<0?0:n.childCount-1,s.copy(a))}function SF(n,t,e){return t{for(let e in t)n.input.eventHandlers[e]||n.dom.addEventListener(e,n.input.eventHandlers[e]=i=>Av(n,i))})}function Av(n,t){return n.someProp("handleDOMEvents",e=>{let i=e[t.type];return!!i&&(i(n,t)||t.defaultPrevented)})}function cX(n,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let e=t.target;e!=n.dom;e=e.parentNode)if(!e||11==e.nodeType||e.pmViewDesc&&e.pmViewDesc.stopEvent(t))return!1;return!0}function hm(n){return{left:n.clientX,top:n.clientY}}function bv(n,t,e,i,r){if(-1==i)return!1;let o=n.state.doc.resolve(i);for(let s=o.depth+1;s>0;s--)if(n.someProp(t,a=>s>o.depth?a(n,e,o.nodeAfter,o.before(s),r,!0):a(n,e,o.node(s),o.before(s),r,!1)))return!0;return!1}function Vc(n,t,e){n.focused||n.focus();let i=n.state.tr.setSelection(t);"pointer"==e&&i.setMeta("pointer",!0),n.dispatch(i)}function gX(n,t,e,i){return bv(n,"handleDoubleClickOn",t,e,i)||n.someProp("handleDoubleClick",r=>r(n,t,i))}function mX(n,t,e,i){return bv(n,"handleTripleClickOn",t,e,i)||n.someProp("handleTripleClick",r=>r(n,t,i))||function AX(n,t,e){if(0!=e.button)return!1;let i=n.state.doc;if(-1==t)return!!i.inlineContent&&(Vc(n,Ee.create(i,0,i.content.size),"pointer"),!0);let r=i.resolve(t);for(let o=r.depth+1;o>0;o--){let s=o>r.depth?r.nodeAfter:r.node(o),a=r.before(o);if(s.inlineContent)Vc(n,Ee.create(i,a+1,a+1+s.content.size),"pointer");else{if(!ce.isSelectable(s))continue;Vc(n,ce.create(i,a),"pointer")}return!0}}(n,e,i)}function yv(n){return pm(n)}ci.keydown=(n,t)=>{let e=t;if(n.input.shiftKey=16==e.keyCode||e.shiftKey,!kF(n,e)&&(n.input.lastKeyCode=e.keyCode,n.input.lastKeyCodeTime=Date.now(),!ho||!Mi||13!=e.keyCode))if(229!=e.keyCode&&n.domObserver.forceFlush(),!jc||13!=e.keyCode||e.ctrlKey||e.altKey||e.metaKey)n.someProp("handleKeyDown",i=>i(n,e))||function Z7(n,t){let e=t.keyCode,i=function X7(n){let t="";return n.ctrlKey&&(t+="c"),n.metaKey&&(t+="m"),n.altKey&&(t+="a"),n.shiftKey&&(t+="s"),t}(t);return 8==e||ur&&72==e&&"c"==i?EF(n,-1)||hv(n):46==e||ur&&68==e&&"c"==i?EF(n,1)||pv(n):13==e||27==e||(37==e||ur&&66==e&&"c"==i?bF(n,-1,i)||hv(n):39==e||ur&&70==e&&"c"==i?bF(n,1,i)||pv(n):38==e||ur&&80==e&&"c"==i?_F(n,-1,i)||hv(n):40==e||ur&&78==e&&"c"==i?function q7(n){if(!ai||n.state.selection.$head.parentOffset>0)return!1;let{focusNode:t,focusOffset:e}=n.domSelectionRange();if(t&&1==t.nodeType&&0==e&&t.firstChild&&"false"==t.firstChild.contentEditable){let i=t.firstChild;CF(n,i,"true"),setTimeout(()=>CF(n,i,"false"),20)}return!1}(n)||_F(n,1,i)||pv(n):i==(ur?"m":"c")&&(66==e||73==e||89==e||90==e))}(n,e)?e.preventDefault():Ys(n,"key");else{let i=Date.now();n.input.lastIOSEnter=i,n.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{n.input.lastIOSEnter==i&&(n.someProp("handleKeyDown",r=>r(n,Uc(13,"Enter"))),n.input.lastIOSEnter=0)},200)}},ci.keyup=(n,t)=>{16==t.keyCode&&(n.input.shiftKey=!1)},ci.keypress=(n,t)=>{let e=t;if(kF(n,e)||!e.charCode||e.ctrlKey&&!e.altKey||ur&&e.metaKey)return;if(n.someProp("handleKeyPress",r=>r(n,e)))return void e.preventDefault();let i=n.state.selection;if(!(i instanceof Ee&&i.$from.sameParent(i.$to))){let r=String.fromCharCode(e.charCode);n.someProp("handleTextInput",o=>o(n,i.$from.pos,i.$to.pos,r))||n.dispatch(n.state.tr.insertText(r).scrollIntoView()),e.preventDefault()}};const OF=ur?"metaKey":"ctrlKey";li.mousedown=(n,t)=>{let e=t;n.input.shiftKey=e.shiftKey;let i=yv(n),r=Date.now(),o="singleClick";r-n.input.lastClick.time<500&&function dX(n,t){let e=t.x-n.clientX,i=t.y-n.clientY;return e*e+i*i<100}(e,n.input.lastClick)&&!e[OF]&&("singleClick"==n.input.lastClick.type?o="doubleClick":"doubleClick"==n.input.lastClick.type&&(o="tripleClick")),n.input.lastClick={time:r,x:e.clientX,y:e.clientY,type:o};let s=n.posAtCoords(hm(e));!s||("singleClick"==o?(n.input.mouseDown&&n.input.mouseDown.done(),n.input.mouseDown=new bX(n,s,e,!!i)):("doubleClick"==o?gX:mX)(n,s.pos,s.inside,e)?e.preventDefault():Ys(n,"pointer"))};class bX{constructor(t,e,i,r){let o,s;if(this.view=t,this.pos=e,this.event=i,this.flushed=r,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=t.state.doc,this.selectNode=!!i[OF],this.allowDefault=i.shiftKey,e.inside>-1)o=t.state.doc.nodeAt(e.inside),s=e.inside;else{let u=t.state.doc.resolve(e.pos);o=u.parent,s=u.depth?u.before():0}const a=r?null:i.target,l=a?t.docView.nearestDesc(a,!0):null;this.target=l?l.dom:null;let{selection:c}=t.state;(0==i.button&&o.type.spec.draggable&&!1!==o.type.spec.selectable||c instanceof ce&&c.from<=s&&c.to>s)&&(this.mightDrag={node:o,pos:s,addAttr:!(!this.target||this.target.draggable),setUneditable:!(!this.target||!kr||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)),Ys(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(()=>$o(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(hm(t))),this.updateAllowDefault(t),this.allowDefault||!e?Ys(this.view,"pointer"):function fX(n,t,e,i,r){return bv(n,"handleClickOn",t,e,i)||n.someProp("handleClick",o=>o(n,t,i))||(r?function pX(n,t){if(-1==t)return!1;let i,r,e=n.state.selection;e instanceof ce&&(i=e.node);let o=n.state.doc.resolve(t);for(let s=o.depth+1;s>0;s--){let a=s>o.depth?o.nodeAfter:o.node(s);if(ce.isSelectable(a)){r=i&&e.$from.depth>0&&s>=e.$from.depth&&o.before(e.$from.depth+1)==e.$from.pos?o.before(e.$from.depth):o.before(s);break}}return null!=r&&(Vc(n,ce.create(n.state.doc,r),"pointer"),!0)}(n,e):function hX(n,t){if(-1==t)return!1;let e=n.state.doc.resolve(t),i=e.nodeAfter;return!!(i&&i.isAtom&&ce.isSelectable(i))&&(Vc(n,new ce(e),"pointer"),!0)}(n,e))}(this.view,e.pos,e.inside,t,this.selectNode)?t.preventDefault():0==t.button&&(this.flushed||ai&&this.mightDrag&&!this.mightDrag.node.isAtom||Mi&&!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)?(Vc(this.view,_e.near(this.view.state.doc.resolve(e.pos)),"pointer"),t.preventDefault()):Ys(this.view,"pointer")}move(t){this.updateAllowDefault(t),Ys(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 kF(n,t){return!!n.composing||!!(ai&&Math.abs(t.timeStamp-n.input.compositionEndedAt)<500)&&(n.input.compositionEndedAt=-2e8,!0)}li.touchstart=n=>{n.input.lastTouch=Date.now(),yv(n),Ys(n,"pointer")},li.touchmove=n=>{n.input.lastTouch=Date.now(),Ys(n,"pointer")},li.contextmenu=n=>yv(n);const yX=ho?5e3:-1;function PF(n,t){clearTimeout(n.input.composingTimeout),t>-1&&(n.input.composingTimeout=setTimeout(()=>pm(n),t))}function FF(n){for(n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=function _X(){let n=document.createEvent("Event");return n.initEvent("event",!0,!0),n.timeStamp}());n.input.compositionNodes.length>0;)n.input.compositionNodes.pop().markParentsDirty()}function pm(n,t=!1){if(!(ho&&n.domObserver.flushingSoon>=0)){if(n.domObserver.forceFlush(),FF(n),t||n.docView&&n.docView.dirty){let e=lv(n);return e&&!e.eq(n.state.selection)?n.dispatch(n.state.tr.setSelection(e)):n.updateState(n.state),!0}return!1}}ci.compositionstart=ci.compositionupdate=n=>{if(!n.composing){n.domObserver.flush();let{state:t}=n,e=t.selection.$from;if(t.selection.empty&&(t.storedMarks||!e.textOffset&&e.parentOffset&&e.nodeBefore.marks.some(i=>!1===i.type.spec.inclusive)))n.markCursor=n.state.storedMarks||e.marks(),pm(n,!0),n.markCursor=null;else if(pm(n),kr&&t.selection.empty&&e.parentOffset&&!e.textOffset&&e.nodeBefore.marks.length){let i=n.domSelectionRange();for(let r=i.focusNode,o=i.focusOffset;r&&1==r.nodeType&&0!=o;){let s=o<0?r.lastChild:r.childNodes[o-1];if(!s)break;if(3==s.nodeType){n.domSelection().collapse(s,s.nodeValue.length);break}r=s,o=-1}}n.input.composing=!0}PF(n,yX)},ci.compositionend=(n,t)=>{n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=t.timeStamp,PF(n,20))};const Gc=vi&&Hs<15||jc&&C7<604;function _v(n,t,e,i){let r=MF(n,t,e,n.input.shiftKey,n.state.selection.$from);if(n.someProp("handlePaste",a=>a(n,i,r||G.empty)))return!0;if(!r)return!1;let o=function CX(n){return 0==n.openStart&&0==n.openEnd&&1==n.content.childCount?n.content.firstChild:null}(r),s=o?n.state.tr.replaceSelectionWith(o,n.input.shiftKey):n.state.tr.replaceSelection(r);return n.dispatch(s.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}li.copy=ci.cut=(n,t)=>{let e=t,i=n.state.selection,r="cut"==e.type;if(i.empty)return;let o=Gc?null:e.clipboardData,s=i.content(),{dom:a,text:l}=vF(n,s);o?(e.preventDefault(),o.clearData(),o.setData("text/html",a.innerHTML),o.setData("text/plain",l)):function EX(n,t){if(!n.dom.parentNode)return;let e=n.dom.parentNode.appendChild(document.createElement("div"));e.appendChild(t),e.style.cssText="position: fixed; left: -10000px; top: 10px";let i=getSelection(),r=document.createRange();r.selectNodeContents(t),n.dom.blur(),i.removeAllRanges(),i.addRange(r),setTimeout(()=>{e.parentNode&&e.parentNode.removeChild(e),n.focus()},50)}(n,a),r&&n.dispatch(n.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))},ci.paste=(n,t)=>{let e=t;if(n.composing&&!ho)return;let i=Gc?null:e.clipboardData;i&&_v(n,i.getData("text/plain"),i.getData("text/html"),e)?e.preventDefault():function vX(n,t){if(!n.dom.parentNode)return;let e=n.input.shiftKey||n.state.selection.$from.parent.type.spec.code,i=n.dom.parentNode.appendChild(document.createElement(e?"textarea":"div"));e||(i.contentEditable="true"),i.style.cssText="position: fixed; left: -10000px; top: 10px",i.focus(),setTimeout(()=>{n.focus(),i.parentNode&&i.parentNode.removeChild(i),e?_v(n,i.value,null,t):_v(n,i.textContent,i.innerHTML,t)},50)}(n,e)};class MX{constructor(t,e){this.slice=t,this.move=e}}const RF=ur?"altKey":"ctrlKey";li.dragstart=(n,t)=>{let e=t,i=n.input.mouseDown;if(i&&i.done(),!e.dataTransfer)return;let r=n.state.selection,o=r.empty?null:n.posAtCoords(hm(e));if(!(o&&o.pos>=r.from&&o.pos<=(r instanceof ce?r.to-1:r.to)))if(i&&i.mightDrag)n.dispatch(n.state.tr.setSelection(ce.create(n.state.doc,i.mightDrag.pos)));else if(e.target&&1==e.target.nodeType){let c=n.docView.nearestDesc(e.target,!0);c&&c.node.type.spec.draggable&&c!=n.docView&&n.dispatch(n.state.tr.setSelection(ce.create(n.state.doc,c.posBefore)))}let s=n.state.selection.content(),{dom:a,text:l}=vF(n,s);e.dataTransfer.clearData(),e.dataTransfer.setData(Gc?"Text":"text/html",a.innerHTML),e.dataTransfer.effectAllowed="copyMove",Gc||e.dataTransfer.setData("text/plain",l),n.dragging=new MX(s,!e[RF])},li.dragend=n=>{let t=n.dragging;window.setTimeout(()=>{n.dragging==t&&(n.dragging=null)},50)},ci.dragover=ci.dragenter=(n,t)=>t.preventDefault(),ci.drop=(n,t)=>{let e=t,i=n.dragging;if(n.dragging=null,!e.dataTransfer)return;let r=n.posAtCoords(hm(e));if(!r)return;let o=n.state.doc.resolve(r.pos),s=i&&i.slice;s?n.someProp("transformPasted",f=>{s=f(s,n)}):s=MF(n,e.dataTransfer.getData(Gc?"Text":"text/plain"),Gc?null:e.dataTransfer.getData("text/html"),!1,o);let a=!(!i||e[RF]);if(n.someProp("handleDrop",f=>f(n,e,s||G.empty,a)))return void e.preventDefault();if(!s)return;e.preventDefault();let l=s?Rk(n.state.doc,o.pos,s):o.pos;null==l&&(l=o.pos);let c=n.state.tr;a&&c.deleteSelection();let u=c.mapping.map(l),d=0==s.openStart&&0==s.openEnd&&1==s.content.childCount,h=c.doc;if(d?c.replaceRangeWith(u,u,s.content.firstChild):c.replaceRange(u,u,s),c.doc.eq(h))return;let p=c.doc.resolve(u);if(d&&ce.isSelectable(s.content.firstChild)&&p.nodeAfter&&p.nodeAfter.sameMarkup(s.content.firstChild))c.setSelection(new ce(p));else{let f=c.mapping.map(l);c.mapping.maps[c.mapping.maps.length-1].forEach((g,m,A,y)=>f=y),c.setSelection(uv(n,p,c.doc.resolve(f)))}n.focus(),n.dispatch(c.setMeta("uiEvent","drop"))},li.focus=n=>{n.input.lastFocus=Date.now(),n.focused||(n.domObserver.stop(),n.dom.classList.add("ProseMirror-focused"),n.domObserver.start(),n.focused=!0,setTimeout(()=>{n.docView&&n.hasFocus()&&!n.domObserver.currentSelection.eq(n.domSelectionRange())&&$o(n)},20))},li.blur=(n,t)=>{let e=t;n.focused&&(n.domObserver.stop(),n.dom.classList.remove("ProseMirror-focused"),n.domObserver.start(),e.relatedTarget&&n.dom.contains(e.relatedTarget)&&n.domObserver.currentSelection.clear(),n.focused=!1)},li.beforeinput=(n,t)=>{if(Mi&&ho&&"deleteContentBackward"==t.inputType){n.domObserver.flushSoon();let{domChangeCount:i}=n.input;setTimeout(()=>{if(n.input.domChangeCount!=i||(n.dom.blur(),n.focus(),n.someProp("handleKeyDown",o=>o(n,Uc(8,"Backspace")))))return;let{$cursor:r}=n.state.selection;r&&r.pos>0&&n.dispatch(n.state.tr.delete(r.pos-1,r.pos).scrollIntoView())},50)}};for(let n in ci)li[n]=ci[n];function gh(n,t){if(n==t)return!0;for(let e in n)if(n[e]!==t[e])return!1;for(let e in t)if(!(e in n))return!1;return!0}class Ev{constructor(t,e){this.toDOM=t,this.spec=e||il,this.side=this.spec.side||0}map(t,e,i,r){let{pos:o,deleted:s}=t.mapResult(e.from+r,this.side<0?-1:1);return s?null:new vn(o-i,o-i,this)}valid(){return!0}eq(t){return this==t||t instanceof Ev&&(this.spec.key&&this.spec.key==t.spec.key||this.toDOM==t.toDOM&&gh(this.spec,t.spec))}destroy(t){this.spec.destroy&&this.spec.destroy(t)}}class Ws{constructor(t,e){this.attrs=t,this.spec=e||il}map(t,e,i,r){let o=t.map(e.from+r,this.spec.inclusiveStart?-1:1)-i,s=t.map(e.to+r,this.spec.inclusiveEnd?1:-1)-i;return o>=s?null:new vn(o,s,this)}valid(t,e){return e.from=t&&(!o||o(a.spec))&&i.push(a.copy(a.from+r,a.to+r))}for(let s=0;st){let a=this.children[s]+1;this.children[s+2].findInner(t-a,e-a,i,r+a,o)}}map(t,e,i){return this==Jn||0==t.maps.length?this:this.mapInner(t,e,0,0,i||il)}mapInner(t,e,i,r,o){let s;for(let a=0;a{let m=g-f-(p-h);for(let A=0;Ay+u-d)continue;let E=a[A]+u-d;p>=E?a[A+1]=h<=E?-2:-1:f>=r&&m&&(a[A]+=m,a[A+1]+=m)}d+=m}),u=e.maps[c].map(u,-1)}let l=!1;for(let c=0;c=i.content.size){l=!0;continue}let p=e.map(n[c+1]+o,-1)-r,{index:f,offset:g}=i.content.findIndex(d),m=i.maybeChild(f);if(m&&g==d&&g+m.nodeSize==p){let A=a[c+2].mapInner(e,m,u+1,n[c]+o+1,s);A!=Jn?(a[c]=d,a[c+1]=p,a[c+2]=A):(a[c+1]=-2,l=!0)}else l=!0}if(l){let c=function DX(n,t,e,i,r,o,s){function a(l,c){for(let u=0;u{let u,c=l+i;if(u=LF(e,a,c)){for(r||(r=this.children.slice());oa&&d.to=t){this.children[a]==t&&(i=this.children[a+2]);break}let o=t+1,s=o+e.content.size;for(let a=0;ao&&l.type instanceof Ws){let c=Math.max(o,l.from)-o,u=Math.min(s,l.to)-o;cr.map(t,e,il));return Js.from(i)}forChild(t,e){if(e.isLeaf)return kt.empty;let i=[];for(let r=0;re instanceof kt)?t:t.reduce((e,i)=>e.concat(i instanceof kt?i:i.members),[]))}}}function NF(n,t){if(!t||!n.length)return n;let e=[];for(let i=0;ie&&s.to{let c=LF(n,a,l+e);if(c){o=!0;let u=fm(c,a,e+l+1,i);u!=Jn&&r.push(l,l+a.nodeSize,u)}});let s=NF(o?QF(n):n,-e).sort(rl);for(let a=0;a0;)t++;n.splice(t,0,e)}function Mv(n){let t=[];return n.someProp("decorations",e=>{let i=e(n.state);i&&i!=Jn&&t.push(i)}),n.cursorWrapper&&t.push(kt.create(n.state.doc,[n.cursorWrapper.deco])),Js.from(t)}const IX={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},SX=vi&&Hs<=11;class xX{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 TX{constructor(t,e){this.view=t,this.handleDOMChange=e,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new xX,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.observer=window.MutationObserver&&new window.MutationObserver(i=>{for(let r=0;r"childList"==r.type&&r.removedNodes.length||"characterData"==r.type&&r.oldValue.length>r.target.nodeValue.length)?this.flushSoon():this.flush()}),SX&&(this.onCharData=i=>{this.queue.push({target:i.target,type:"characterData",oldValue:i.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,IX)),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;ethis.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(mF(this.view)){if(this.suppressingSelectionUpdates)return $o(this.view);if(vi&&Hs<=11&&!this.view.state.selection.empty){let t=this.view.domSelectionRange();if(t.focusNode&&Xa(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 i,e=new Set;for(let o=t.focusNode;o;o=uh(o))e.add(o);for(let o=t.anchorNode;o;o=uh(o))if(e.has(o)){i=o;break}let r=i&&this.view.docView.nearestDesc(i);return r&&r.ignoreMutation({type:"selection",target:3==i.nodeType?i.parentNode:i})?(this.setCurSelection(),!0):void 0}flush(){let{view:t}=this;if(!t.docView||this.flushingSoon>-1)return;let e=this.observer?this.observer.takeRecords():[];this.queue.length&&(e=this.queue.concat(e),this.queue.length=0);let i=t.domSelectionRange(),r=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(i)&&mF(t)&&!this.ignoreSelectionChange(i),o=-1,s=-1,a=!1,l=[];if(t.editable)for(let u=0;u1){let u=l.filter(d=>"BR"==d.nodeName);if(2==u.length){let d=u[0],h=u[1];d.parentNode&&d.parentNode.parentNode==h.parentNode?h.remove():d.remove()}}let c=null;o<0&&r&&t.input.lastFocus>Date.now()-200&&t.input.lastTouch-1||r)&&(o>-1&&(t.docView.markDirty(o,s),function BX(n){if(!jF.has(n)&&(jF.set(n,null),-1!==["normal","nowrap","pre-line"].indexOf(getComputedStyle(n.dom).whiteSpace))){if(n.requiresGeckoHackNode=kr,zF)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."),zF=!0}}(t)),this.handleDOMChange(o,s,a,l),t.docView&&t.docView.dirty?t.updateState(t.state):this.currentSelection.eq(i)||$o(t),this.currentSelection.set(i))}registerMutation(t,e){if(e.indexOf(t.target)>-1)return null;let i=this.view.docView.nearestDesc(t.target);if("attributes"==t.type&&(i==this.view.docView||"contenteditable"==t.attributeName||"style"==t.attributeName&&!t.oldValue&&!t.target.getAttribute("style"))||!i||i.ignoreMutation(t))return null;if("childList"==t.type){for(let u=0;ut.content.size?null:uv(n,t.resolve(e.anchor),t.resolve(e.head))}function wv(n,t,e){let i=n.depth,r=t?n.end():n.pos;for(;i>0&&(t||n.indexAfter(i)==n.node(i).childCount);)i--,r++,t=!1;if(e){let o=n.node(i).maybeChild(n.indexAfter(i));for(;o&&!o.isLeaf;)o=o.firstChild,r++}return r}class QX{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 sX,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=e,this.state=e.state,this.directPlugins=e.plugins||[],this.directPlugins.forEach(JF),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=YF(this),GF(this),this.nodeViews=WF(this),this.docView=rF(this.state.doc,VF(this),Mv(this),this.dom,this),this.domObserver=new TX(this,(i,r,o,s)=>function FX(n,t,e,i,r){if(t<0){let O=n.input.lastSelectionTime>Date.now()-50?n.input.lastSelectionOrigin:null,q=lv(n,O);if(q&&!n.state.selection.eq(q)){let le=n.state.tr.setSelection(q);"pointer"==O?le.setMeta("pointer",!0):"key"==O&&le.scrollIntoView(),n.dispatch(le)}return}let o=n.state.doc.resolve(t),s=o.sharedDepth(e);t=o.before(s+1),e=n.state.doc.resolve(e).after(s+1);let d,h,a=n.state.selection,l=function kX(n,t,e){let c,{node:i,fromOffset:r,toOffset:o,from:s,to:a}=n.docView.parseRange(t,e),l=n.domSelectionRange(),u=l.anchorNode;if(u&&n.dom.contains(1==u.nodeType?u:u.parentNode)&&(c=[{node:u,offset:l.anchorOffset}],lm(l)||c.push({node:l.focusNode,offset:l.focusOffset})),Mi&&8===n.input.lastKeyCode)for(let m=o;m>r;m--){let A=i.childNodes[m-1],y=A.pmViewDesc;if("BR"==A.nodeName&&!y){o=m;break}if(!y||y.size)break}let d=n.state.doc,h=n.someProp("domParser")||Ic.fromSchema(n.state.schema),p=d.resolve(s),f=null,g=h.parse(i,{topNode:p.parent,topMatch:p.parent.contentMatchAt(p.index()),topOpen:!0,from:r,to:o,preserveWhitespace:"pre"!=p.parent.type.whitespace||"full",findPositions:c,ruleFromNode:PX,context:p});if(c&&null!=c[0].pos){let m=c[0].pos,A=c[1]&&c[1].pos;null==A&&(A=m),f={anchor:m+s,head:A+s}}return{doc:g,sel:f,from:s,to:a}}(n,t,e),c=n.state.doc,u=c.slice(l.from,l.to);8===n.input.lastKeyCode&&Date.now()-100=s?o-i:0,a=o+(a-s),s=o):a=a?o-i:0,s=o+(s-a),a=o),{start:o,endA:s,endB:a}}(u.content,l.doc.content,l.from,d,h);if((jc&&n.input.lastIOSEnter>Date.now()-225||ho)&&r.some(O=>"DIV"==O.nodeName||"P"==O.nodeName||"LI"==O.nodeName)&&(!p||p.endA>=p.endB)&&n.someProp("handleKeyDown",O=>O(n,Uc(13,"Enter"))))return void(n.input.lastIOSEnter=0);if(!p){if(!(i&&a instanceof Ee&&!a.empty&&a.$head.sameParent(a.$anchor))||n.composing||l.sel&&l.sel.anchor!=l.sel.head){if(l.sel){let O=HF(n,n.state.doc,l.sel);O&&!O.eq(n.state.selection)&&n.dispatch(n.state.tr.setSelection(O))}return}p={start:a.from,endA:a.to,endB:a.to}}if(Mi&&n.cursorWrapper&&l.sel&&l.sel.anchor==n.cursorWrapper.deco.from&&l.sel.head==l.sel.anchor){let O=p.endB-p.start;l.sel={anchor:l.sel.anchor+O,head:l.sel.anchor+O}}n.input.domChangeCount++,n.state.selection.fromn.state.selection.from&&p.start<=n.state.selection.from+2&&n.state.selection.from>=l.from?p.start=n.state.selection.from:p.endA=n.state.selection.to-2&&n.state.selection.to<=l.to&&(p.endB+=n.state.selection.to-p.endA,p.endA=n.state.selection.to)),vi&&Hs<=11&&p.endB==p.start+1&&p.endA==p.start&&p.start>l.from&&" \xa0"==l.doc.textBetween(p.start-l.from-1,p.start-l.from+1)&&(p.start--,p.endA--,p.endB--);let y,f=l.doc.resolveNoCache(p.start-l.from),g=l.doc.resolveNoCache(p.endB-l.from),m=c.resolve(p.start),A=f.sameParent(g)&&f.parent.inlineContent&&m.end()>=p.endA;if((jc&&n.input.lastIOSEnter>Date.now()-225&&(!A||r.some(O=>"DIV"==O.nodeName||"P"==O.nodeName))||!A&&f.posO(n,Uc(13,"Enter"))))return void(n.input.lastIOSEnter=0);if(n.state.selection.anchor>p.start&&function NX(n,t,e,i,r){if(!i.parent.isTextblock||e-t<=r.pos-i.pos||wv(i,!0,!1)e||wv(s,!0,!1)O(n,Uc(8,"Backspace"))))return void(ho&&Mi&&n.domObserver.suppressSelectionUpdates());Mi&&ho&&p.endB==p.start&&(n.input.lastAndroidDelete=Date.now()),ho&&!A&&f.start()!=g.start()&&0==g.parentOffset&&f.depth==g.depth&&l.sel&&l.sel.anchor==l.sel.head&&l.sel.head==p.endA&&(p.endB-=2,g=l.doc.resolveNoCache(p.endB-l.from),setTimeout(()=>{n.someProp("handleKeyDown",function(O){return O(n,Uc(13,"Enter"))})},20));let D,I,Q,E=p.start,b=p.endA;if(A)if(f.pos==g.pos)vi&&Hs<=11&&0==f.parentOffset&&(n.domObserver.suppressSelectionUpdates(),setTimeout(()=>$o(n),20)),D=n.state.tr.delete(E,b),I=c.resolve(p.start).marksAcross(c.resolve(p.endA));else if(p.endA==p.endB&&(Q=function RX(n,t){let s,a,l,e=n.firstChild.marks,i=t.firstChild.marks,r=e,o=i;for(let u=0;uu.mark(a.addToSet(u.marks));else{if(0!=r.length||1!=o.length)return null;a=o[0],s="remove",l=u=>u.mark(a.removeFromSet(u.marks))}let c=[];for(let u=0;uq(n,E,b,O)))return;D=n.state.tr.insertText(O,E,b)}if(D||(D=n.state.tr.replace(E,b,l.doc.slice(p.start-l.from,p.endB-l.from))),l.sel){let O=HF(n,D.doc,l.sel);O&&!(Mi&&ho&&n.composing&&O.empty&&(p.start!=p.endB||n.input.lastAndroidDelete{cX(n,i)&&!Av(n,i)&&(n.editable||!(i.type in ci))&&e(n,i)},oX[t]?{passive:!0}:void 0)}ai&&n.dom.addEventListener("input",()=>null),mv(n)}(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&&mv(this);let e=this._props;this._props=t,t.plugins&&(t.plugins.forEach(JF),this.directPlugins=t.plugins),this.updateStateInner(t.state,e)}setProps(t){let e={};for(let i in this._props)e[i]=this._props[i];e.state=this.state;for(let i in t)e[i]=t[i];this.update(e)}updateState(t){this.updateStateInner(t,this._props)}updateStateInner(t,e){let i=this.state,r=!1,o=!1;t.storedMarks&&this.composing&&(FF(this),o=!0),this.state=t;let s=i.plugins!=t.plugins||this._props.plugins!=e.plugins;if(s||this._props.plugins!=e.plugins||this._props.nodeViews!=e.nodeViews){let h=WF(this);(function jX(n,t){let e=0,i=0;for(let r in n){if(n[r]!=t[r])return!0;e++}for(let r in t)i++;return e!=i})(h,this.nodeViews)&&(this.nodeViews=h,r=!0)}(s||e.handleDOMEvents!=this._props.handleDOMEvents)&&mv(this),this.editable=YF(this),GF(this);let a=Mv(this),l=VF(this),c=i.plugins==t.plugins||i.doc.eq(t.doc)?t.scrollToSelection>i.scrollToSelection?"to selection":"preserve":"reset",u=r||!this.docView.matchesNode(t.doc,l,a);(u||!t.selection.eq(i.selection))&&(o=!0);let d="preserve"==c&&o&&null==this.dom.style.overflowAnchor&&function w7(n){let i,r,t=n.dom.getBoundingClientRect(),e=Math.max(0,t.top);for(let o=(t.left+t.right)/2,s=e+1;s=e-20){i=a,r=l.top;break}}return{refDOM:i,refTop:r,stack:WP(n.dom)}}(this);if(o){this.domObserver.stop();let h=u&&(vi||Mi)&&!this.composing&&!i.selection.empty&&!t.selection.empty&&function UX(n,t){let e=Math.min(n.$anchor.sharedDepth(n.head),t.$anchor.sharedDepth(t.head));return n.$anchor.start(e)!=t.$anchor.start(e)}(i.selection,t.selection);if(u){let p=Mi?this.trackWrites=this.domSelectionRange().focusNode:null;(r||!this.docView.update(t.doc,l,a,this))&&(this.docView.updateOuterDeco([]),this.docView.destroy(),this.docView=rF(t.doc,l,a,this.dom,this)),p&&!this.trackWrites&&(h=!0)}h||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&function $7(n){let t=n.docView.domFromPos(n.state.selection.anchor,0),e=n.domSelectionRange();return Xa(t.node,t.offset,e.anchorNode,e.anchorOffset)}(this))?$o(this,h):(fF(this,t.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(i),"reset"==c?this.dom.scrollTop=0:"to selection"==c?this.scrollToSelection():d&&function D7({refDOM:n,refTop:t,stack:e}){let i=n?n.getBoundingClientRect().top:0;JP(e,0==i?0:i-t)}(d)}scrollToSelection(){let t=this.domSelectionRange().focusNode;if(!this.someProp("handleScrollToSelection",e=>e(this)))if(this.state.selection instanceof ce){let e=this.docView.domAfterPos(this.state.selection.from);1==e.nodeType&&YP(this,e.getBoundingClientRect(),t)}else YP(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;ee.ownerDocument.getSelection()),this._root=e;return t||document}posAtCoords(t){return O7(this,t)}coordsAtPos(t,e=1){return qP(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,i=-1){let r=this.docView.posFromDOM(t,e,i);if(null==r)throw new RangeError("DOM position not inside the editor");return r}endOfTextblock(t,e){return function N7(n,t,e){return ZP==t&&eF==e?tF:(ZP=t,eF=e,tF="up"==e||"down"==e?function P7(n,t,e){let i=t.selection,r="up"==e?i.$from:i.$to;return XP(n,t,()=>{let{node:o}=n.docView.domFromPos(r.pos,"up"==e?-1:1);for(;;){let a=n.docView.nearestDesc(o,!0);if(!a)break;if(a.node.isBlock){o=a.dom;break}o=a.dom.parentNode}let s=qP(n,r.pos,1);for(let a=o.firstChild;a;a=a.nextSibling){let l;if(1==a.nodeType)l=a.getClientRects();else{if(3!=a.nodeType)continue;l=Ko(a,0,a.nodeValue.length).getClientRects()}for(let c=0;cu.top+1&&("up"==e?s.top-u.top>2*(u.bottom-s.top):u.bottom-s.bottom>2*(s.bottom-u.top)))return!1}}return!0})}(n,t,e):function R7(n,t,e){let{$head:i}=t.selection;if(!i.parent.isTextblock)return!1;let r=i.parentOffset,o=!r,s=r==i.parent.content.size,a=n.domSelection();return F7.test(i.parent.textContent)&&a.modify?XP(n,t,()=>{let{focusNode:l,focusOffset:c,anchorNode:u,anchorOffset:d}=n.domSelectionRange(),h=a.caretBidiLevel;a.modify("move",e,"character");let p=i.depth?n.docView.domAfterPos(i.before()):n.dom,{focusNode:f,focusOffset:g}=n.domSelectionRange(),m=f&&!p.contains(1==f.nodeType?f:f.parentNode)||l==f&&c==g;try{a.collapse(u,d),l&&(l!=u||c!=d)&&a.extend&&a.extend(l,c)}catch{}return null!=h&&(a.caretBidiLevel=h),m}):"left"==e||"backward"==e?o:s}(n,t,e))}(this,e||this.state,t)}destroy(){!this.docView||(function lX(n){n.domObserver.stop();for(let t in n.input.eventHandlers)n.dom.removeEventListener(t,n.input.eventHandlers[t]);clearTimeout(n.input.composingTimeout),clearTimeout(n.input.lastIOSEnterFallbackTimeout)}(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Mv(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 uX(n,t){!Av(n,t)&&li[t.type]&&(n.editable||!(t.type in ci))&&li[t.type](n,t)}(this,t)}dispatch(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))}domSelectionRange(){return ai&&11===this.root.nodeType&&function _7(n){let t=n.activeElement;for(;t&&t.shadowRoot;)t=t.shadowRoot.activeElement;return t}(this.dom.ownerDocument)==this.dom?function OX(n){let t;function e(l){l.preventDefault(),l.stopImmediatePropagation(),t=l.getTargetRanges()[0]}n.dom.addEventListener("beforeinput",e,!0),document.execCommand("indent"),n.dom.removeEventListener("beforeinput",e,!0);let i=t.startContainer,r=t.startOffset,o=t.endContainer,s=t.endOffset,a=n.domAtPos(n.state.selection.anchor);return Xa(a.node,a.offset,o,s)&&([i,r,o,s]=[o,s,i,r]),{anchorNode:i,anchorOffset:r,focusNode:o,focusOffset:s}}(this):this.domSelection()}domSelection(){return this.root.getSelection()}}function VF(n){let t=Object.create(null);return t.class="ProseMirror",t.contenteditable=String(n.editable),t.translate="no",n.someProp("attributes",e=>{if("function"==typeof e&&(e=e(n.state)),e)for(let i in e)"class"==i&&(t.class+=" "+e[i]),"style"==i?t.style=(t.style?t.style+";":"")+e[i]:!t[i]&&"contenteditable"!=i&&"nodeName"!=i&&(t[i]=String(e[i]))}),[vn.node(0,n.state.doc.content.size,t)]}function GF(n){if(n.markCursor){let t=document.createElement("img");t.className="ProseMirror-separator",t.setAttribute("mark-placeholder","true"),t.setAttribute("alt",""),n.cursorWrapper={dom:t,deco:vn.widget(n.state.selection.head,t,{raw:!0,marks:n.markCursor})}}else n.cursorWrapper=null}function YF(n){return!n.someProp("editable",t=>!1===t(n.state))}function WF(n){let t=Object.create(null);function e(i){for(let r in i)Object.prototype.hasOwnProperty.call(t,r)||(t[r]=i[r])}return n.someProp("nodeViews",e),n.someProp("markViews",e),t}function JF(n){if(n.spec.state||n.spec.filterTransaction||n.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}for(var Ks={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:"'"},gm={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},KF=typeof navigator<"u"&&/Chrome\/(\d+)/.exec(navigator.userAgent),zX=(typeof navigator<"u"&&/Gecko\/\d+/.test(navigator.userAgent),typeof navigator<"u"&&/Mac/.test(navigator.platform)),HX=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),VX=zX||KF&&+KF[1]<57,xn=0;xn<10;xn++)Ks[48+xn]=Ks[96+xn]=String(xn);for(xn=1;xn<=24;xn++)Ks[xn+111]="F"+xn;for(xn=65;xn<=90;xn++)Ks[xn]=String.fromCharCode(xn+32),gm[xn]=String.fromCharCode(xn);for(var Dv in Ks)gm.hasOwnProperty(Dv)||(gm[Dv]=Ks[Dv]);const YX=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform);function WX(n){let i,r,o,s,t=n.split(/-(?!$)/),e=t[t.length-1];"Space"==e&&(e=" ");for(let a=0;a