@harbour-enterprises/superdoc 0.9.24 → 0.9.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -27,14 +27,14 @@ Actual: `+$.attribValue);else{var D=$.tag,R=$.tags[$.tags.length-1]||$;D.ns===R.
27
27
  `)}};is.empty=new is(!0);let IC=class{constructor(e,n){this.string=e,this.nodeTypes=n,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}};function bb(t){let e=[];do e.push(FC(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function FC(t){let e=[];do e.push(BC(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function BC(t){let e=PC(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else if(t.eat("{"))e=RC(t,e);else break;return e}function Lm(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function RC(t,e){let n=Lm(t),r=n;return t.eat(",")&&(t.next!="}"?r=Lm(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function LC(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let o=[];for(let i in n){let s=n[i];s.isInGroup(e)&&o.push(s)}return o.length==0&&t.err("No node type or group '"+e+"' found"),o}function PC(t){if(t.eat("(")){let e=bb(t);return t.eat(")")||t.err("Missing closing paren"),e}else if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=LC(t,t.next).map(n=>(t.inline==null?t.inline=n.isInline:t.inline!=n.isInline&&t.err("Mixing inline and block content"),{type:"name",value:n}));return t.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function zC(t){let e=[[]];return o(i(t,0),n()),e;function n(){return e.push([])-1}function r(s,a,l){let c={term:l,to:a};return e[s].push(c),c}function o(s,a){s.forEach(l=>l.to=a)}function i(s,a){if(s.type=="choice")return s.exprs.reduce((l,c)=>l.concat(i(c,a)),[]);if(s.type=="seq")for(let l=0;;l++){let c=i(s.exprs[l],a);if(l==s.exprs.length-1)return c;o(c,a=n())}else if(s.type=="star"){let l=n();return r(a,l),o(i(s.expr,l),l),[r(l)]}else if(s.type=="plus"){let l=n();return o(i(s.expr,a),l),o(i(s.expr,l),l),[r(l)]}else{if(s.type=="opt")return[r(a)].concat(i(s.expr,a));if(s.type=="range"){let l=a;for(let c=0;c<s.min;c++){let u=n();o(i(s.expr,l),u),l=u}if(s.max==-1)o(i(s.expr,l),l);else for(let c=s.min;c<s.max;c++){let u=n();r(l,u),o(i(s.expr,l),u),l=u}return[r(l)]}else{if(s.type=="name")return[r(a,void 0,s.value)];throw new Error("Unknown expr type")}}}}function vb(t,e){return e-t}function Pm(t,e){let n=[];return r(e),n.sort(vb);function r(o){let i=t[o];if(i.length==1&&!i[0].term)return r(i[0].to);n.push(o);for(let s=0;s<i.length;s++){let{term:a,to:l}=i[s];!a&&n.indexOf(l)==-1&&r(l)}}}function jC(t){let e=Object.create(null);return n(Pm(t,0));function n(r){let o=[];r.forEach(s=>{t[s].forEach(({term:a,to:l})=>{if(!a)return;let c;for(let u=0;u<o.length;u++)o[u][0]==a&&(c=o[u][1]);Pm(t,l).forEach(u=>{c||o.push([a,c=[]]),c.indexOf(u)==-1&&c.push(u)})})});let i=e[r.join(",")]=new is(r.indexOf(t.length-1)>-1);for(let s=0;s<o.length;s++){let a=o[s][1].sort(vb);i.next.push({type:o[s][0],next:e[a.join(",")]||n(a)})}return i}}function qC(t,e){for(let n=0,r=[t];n<r.length;n++){let o=r[n],i=!o.validEnd,s=[];for(let a=0;a<o.next.length;a++){let{type:l,next:c}=o.next[a];s.push(l.name),i&&!(l.isText||l.hasRequiredAttrs())&&(i=!1),r.indexOf(c)==-1&&r.push(c)}i&&e.err("Only non-generatable nodes ("+s.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function xb(t){let e=Object.create(null);for(let n in t){let r=t[n];if(!r.hasDefault)return null;e[n]=r.default}return e}function kb(t,e){let n=Object.create(null);for(let r in t){let o=e&&e[r];if(o===void 0){let i=t[r];if(i.hasDefault)o=i.default;else throw new RangeError("No value supplied for attribute "+r)}n[r]=o}return n}function Sb(t,e,n,r){for(let o in e)if(!(o in t))throw new RangeError(`Unsupported attribute ${o} for ${n} of type ${o}`);for(let o in t){let i=t[o];i.validate&&i.validate(e[o])}}function Cb(t,e){let n=Object.create(null);if(e)for(let r in e)n[r]=new VC(t,r,e[r]);return n}let zm=class Eb{constructor(e,n,r){this.name=e,this.schema=n,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=Cb(e,r.attrs),this.defaultAttrs=xb(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==is.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:kb(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Yr(this,this.computeAttrs(e),ye.from(n),Ge.setFrom(r))}createChecked(e=null,n,r){return n=ye.from(n),this.checkContent(n),new Yr(this,this.computeAttrs(e),n,Ge.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=ye.from(n),n.size){let s=this.contentMatch.fillBefore(n);if(!s)return null;n=s.append(n)}let o=this.contentMatch.matchFragment(n),i=o&&o.fillBefore(ye.empty,!0);return i?new Yr(this,e,n.append(i),Ge.setFrom(r)):null}validContent(e){let n=this.contentMatch.matchFragment(e);if(!n||!n.validEnd)return!1;for(let r=0;r<e.childCount;r++)if(!this.allowsMarks(e.child(r).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){Sb(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let n=0;n<e.length;n++)if(!this.allowsMarkType(e[n].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let n;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?n&&n.push(e[r]):n||(n=e.slice(0,r));return n?n.length?n:Ge.none:e}static compile(e,n){let r=Object.create(null);e.forEach((i,s)=>r[i]=new Eb(i,n,s));let o=n.spec.topNode||"doc";if(!r[o])throw new RangeError("Schema is missing its top node type ('"+o+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let i in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function UC(t,e,n){let r=n.split("|");return o=>{let i=o===null?"null":typeof o;if(r.indexOf(i)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${t}, got ${i}`)}}let VC=class{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?UC(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}},Ab=class Tb{constructor(e,n,r,o){this.name=e,this.rank=n,this.schema=r,this.spec=o,this.attrs=Cb(e,o.attrs),this.excluded=null;let i=xb(this.attrs);this.instance=i?new Ge(this,i):null}create(e=null){return!e&&this.instance?this.instance:new Ge(this,kb(this.attrs,e))}static compile(e,n){let r=Object.create(null),o=0;return e.forEach((i,s)=>r[i]=new Tb(i,o++,n,s)),r}removeFromSet(e){for(var n=0;n<e.length;n++)e[n].type==this&&(e=e.slice(0,n).concat(e.slice(n+1)),n--);return e}isInSet(e){for(let n=0;n<e.length;n++)if(e[n].type==this)return e[n]}checkAttrs(e){Sb(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}},$b=class{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let o in e)n[o]=e[o];n.nodes=Ct.from(e.nodes),n.marks=Ct.from(e.marks||{}),this.nodes=zm.compile(this.spec.nodes,this),this.marks=Ab.compile(this.spec.marks,this);let r=Object.create(null);for(let o in this.nodes){if(o in this.marks)throw new RangeError(o+" can not be both a node and a mark");let i=this.nodes[o],s=i.spec.content||"",a=i.spec.marks;if(i.contentMatch=r[s]||(r[s]=is.parse(s,this.nodes)),i.inlineContent=i.contentMatch.inlineContent,i.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!i.isInline||!i.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=i}i.markSet=a=="_"?null:a?jm(this,a.split(" ")):a==""||!i.inlineContent?[]:null}for(let o in this.marks){let i=this.marks[o],s=i.spec.excludes;i.excluded=s==null?[i]:s==""?[]:jm(this,s.split(" "))}this.nodeFromJSON=this.nodeFromJSON.bind(this),this.markFromJSON=this.markFromJSON.bind(this),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,r,o){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof zm){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(n,r,o)}text(e,n){let r=this.nodes.text;return new DC(r,r.defaultAttrs,e,Ge.setFrom(n))}mark(e,n){return typeof e=="string"&&(e=this.marks[e]),e.create(n)}nodeFromJSON(e){return Yr.fromJSON(this,e)}markFromJSON(e){return Ge.fromJSON(this,e)}nodeType(e){let n=this.nodes[e];if(!n)throw new RangeError("Unknown node type: "+e);return n}};function jm(t,e){let n=[];for(let r=0;r<e.length;r++){let o=e[r],i=t.marks[o],s=i;if(i)n.push(i);else for(let a in t.marks){let l=t.marks[a];(o=="_"||l.spec.group&&l.spec.group.split(" ").indexOf(o)>-1)&&n.push(s=l)}if(!s)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}function HC(t){return t.tag!=null}function WC(t){return t.style!=null}let Zr=class Qu{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(o=>{if(HC(o))this.tags.push(o);else if(WC(o)){let i=/[^=]*/.exec(o.style)[0];r.indexOf(i)<0&&r.push(i),this.styles.push(o)}}),this.normalizeLists=!this.tags.some(o=>{if(!/^(ul|ol)\b/.test(o.tag)||!o.node)return!1;let i=e.nodes[o.node];return i.contentMatch.matchType(i)})}parse(e,n={}){let r=new Um(this,n,!1);return r.addAll(e,Ge.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new Um(this,n,!0);return r.addAll(e,Ge.none,n.from,n.to),ve.maxOpen(r.finish())}matchTag(e,n,r){for(let o=r?this.tags.indexOf(r)+1:0;o<this.tags.length;o++){let i=this.tags[o];if(JC(e,i.tag)&&(i.namespace===void 0||e.namespaceURI==i.namespace)&&(!i.context||n.matchesContext(i.context))){if(i.getAttrs){let s=i.getAttrs(e);if(s===!1)continue;i.attrs=s||void 0}return i}}}matchStyle(e,n,r,o){for(let i=o?this.styles.indexOf(o)+1:0;i<this.styles.length;i++){let s=this.styles[i],a=s.style;if(!(a.indexOf(e)!=0||s.context&&!r.matchesContext(s.context)||a.length>e.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=n))){if(s.getAttrs){let l=s.getAttrs(n);if(l===!1)continue;s.attrs=l||void 0}return s}}}static schemaRules(e){let n=[];function r(o){let i=o.priority==null?50:o.priority,s=0;for(;s<n.length;s++){let a=n[s];if((a.priority==null?50:a.priority)<i)break}n.splice(s,0,o)}for(let o in e.marks){let i=e.marks[o].spec.parseDOM;i&&i.forEach(s=>{r(s=Vm(s)),s.mark||s.ignore||s.clearMark||(s.mark=o)})}for(let o in e.nodes){let i=e.nodes[o].spec.parseDOM;i&&i.forEach(s=>{r(s=Vm(s)),s.node||s.ignore||s.mark||(s.node=o)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Qu(e,Qu.schemaRules(e)))}};const Ob={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},GC={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Mb={ol:!0,ul:!0},ss=1,ed=2,va=4;function qm(t,e,n){return e!=null?(e?ss:0)|(e==="full"?ed:0):t&&t.whitespace=="pre"?ss|ed:n&-5}let Gs=class{constructor(e,n,r,o,i,s){this.type=e,this.attrs=n,this.marks=r,this.solid=o,this.options=s,this.content=[],this.activeMarks=Ge.none,this.match=i||(s&va?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(ye.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,o;return(o=r.findWrapping(e.type))?(this.match=r,o):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&ss)){let r=this.content[this.content.length-1],o;if(r&&r.isText&&(o=/[ \t\r\n\u000c]+$/.exec(r.text))){let i=r;r.text.length==o[0].length?this.content.pop():this.content[this.content.length-1]=i.withText(i.text.slice(0,i.text.length-o[0].length))}}let n=ye.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(ye.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!Ob.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}},Um=class{constructor(e,n,r){this.parser=e,this.options=n,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let o=n.topNode,i,s=qm(null,n.preserveWhitespace,0)|(r?va:0);o?i=new Gs(o.type,o.attrs,Ge.none,!0,n.topMatch||o.type.contentMatch,s):r?i=new Gs(null,null,Ge.none,!0,null,s):i=new Gs(e.schema.topNodeType,null,Ge.none,!0,null,s),this.nodes=[i],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,n){e.nodeType==3?this.addTextNode(e,n):e.nodeType==1&&this.addElement(e,n)}addTextNode(e,n){let r=e.nodeValue,o=this.top,i=o.options&ed?"full":this.localPreserveWS||(o.options&ss)>0;if(i==="full"||o.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(i)i!=="full"?r=r.replace(/\r?\n|\r/g," "):r=r.replace(/\r\n?/g,`
28
28
  `);else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let s=o.content[o.content.length-1],a=e.previousSibling;(!s||a&&a.nodeName=="BR"||s.isText&&/[ \t\r\n\u000c]$/.test(s.text))&&(r=r.slice(1))}r&&this.insertNode(this.parser.schema.text(r),n),this.findInText(e)}else this.findInside(e)}addElement(e,n,r){let o=this.localPreserveWS,i=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let s=e.nodeName.toLowerCase(),a;Mb.hasOwnProperty(s)&&this.parser.normalizeLists&&KC(e);let l=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(a=this.parser.matchTag(e,this,r));e:if(l?l.ignore:GC.hasOwnProperty(s))this.findInside(e),this.ignoreFallback(e,n);else if(!l||l.skip||l.closeParent){l&&l.closeParent?this.open=Math.max(0,this.open-1):l&&l.skip.nodeType&&(e=l.skip);let c,u=this.needsBlock;if(Ob.hasOwnProperty(s))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),c=!0,i.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,n);break e}let d=l&&l.skip?n:this.readStyles(e,n);d&&this.addAll(e,d),c&&this.sync(i),this.needsBlock=u}else{let c=this.readStyles(e,n);c&&this.addElementByRule(e,l,c,l.consuming===!1?a:void 0)}this.localPreserveWS=o}leafFallback(e,n){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
29
29
  `),n)}ignoreFallback(e,n){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),n)}readStyles(e,n){let r=e.style;if(r&&r.length)for(let o=0;o<this.parser.matchedStyles.length;o++){let i=this.parser.matchedStyles[o],s=r.getPropertyValue(i);if(s)for(let a=void 0;;){let l=this.parser.matchStyle(i,s,this,a);if(!l)break;if(l.ignore)return null;if(l.clearMark?n=n.filter(c=>!l.clearMark(c)):n=n.concat(this.parser.schema.marks[l.mark].create(l.attrs)),l.consuming===!1)a=l;else break}}return n}addElementByRule(e,n,r,o){let i,s;if(n.node)if(s=this.parser.schema.nodes[n.node],s.isLeaf)this.insertNode(s.create(n.attrs),r)||this.leafFallback(e,r);else{let l=this.enter(s,n.attrs||null,r,n.preserveWhitespace);l&&(i=!0,r=l)}else{let l=this.parser.schema.marks[n.mark];r=r.concat(l.create(n.attrs))}let a=this.top;if(s&&s.isLeaf)this.findInside(e);else if(o)this.addElement(e,r,o);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(l=>this.insertNode(l,r));else{let l=e;typeof n.contentElement=="string"?l=e.querySelector(n.contentElement):typeof n.contentElement=="function"?l=n.contentElement(e):n.contentElement&&(l=n.contentElement),this.findAround(e,l,!0),this.addAll(l,r),this.findAround(e,l,!1)}i&&this.sync(a)&&this.open--}addAll(e,n,r,o){let i=r||0;for(let s=r?e.childNodes[r]:e.firstChild,a=o==null?null:e.childNodes[o];s!=a;s=s.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(s,n);this.findAtPoint(e,i)}findPlace(e,n){let r,o;for(let i=this.open;i>=0;i--){let s=this.nodes[i],a=s.findWrapping(e);if(a&&(!r||r.length>a.length)&&(r=a,o=s,!a.length)||s.solid)break}if(!r)return null;this.sync(o);for(let i=0;i<r.length;i++)n=this.enterInner(r[i],null,n,!1);return n}insertNode(e,n){if(e.isInline&&this.needsBlock&&!this.top.type){let o=this.textblockFromContext();o&&(n=this.enterInner(o,null,n))}let r=this.findPlace(e,n);if(r){this.closeExtra();let o=this.top;o.match&&(o.match=o.match.matchType(e.type));let i=Ge.none;for(let s of r.concat(e.marks))(o.type?o.type.allowsMarkType(s.type):Hm(s.type,e.type))&&(i=s.addToSet(i));return o.content.push(e.mark(i)),!0}return!1}enter(e,n,r,o){let i=this.findPlace(e.create(n),r);return i&&(i=this.enterInner(e,n,r,!0,o)),i}enterInner(e,n,r,o=!1,i){this.closeExtra();let s=this.top;s.match=s.match&&s.match.matchType(e);let a=qm(e,i,s.options);s.options&va&&s.content.length==0&&(a|=va);let l=Ge.none;return r=r.filter(c=>(s.type?s.type.allowsMarkType(c.type):Hm(c.type,e))?(l=c.addToSet(l),!1):!0),this.nodes.push(new Gs(e,n,l,o,null,a)),this.open++,r}closeExtra(e=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let n=this.open;n>=0;n--){if(this.nodes[n]==e)return this.open=n,!0;this.localPreserveWS&&(this.nodes[n].options|=ss)}return!1}get currentPos(){this.closeExtra();let e=0;for(let n=this.open;n>=0;n--){let r=this.nodes[n].content;for(let o=r.length-1;o>=0;o--)e+=r[o].nodeSize;n&&e++}return e}findAtPoint(e,n){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==n&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].pos==null&&e.nodeType==1&&e.contains(this.find[n].node)&&(this.find[n].pos=this.currentPos)}findAround(e,n,r){if(e!=n&&this.find)for(let o=0;o<this.find.length;o++)this.find[o].pos==null&&e.nodeType==1&&e.contains(this.find[o].node)&&n.compareDocumentPosition(this.find[o].node)&(r?2:4)&&(this.find[o].pos=this.currentPos)}findInText(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&(this.find[n].pos=this.currentPos-(e.nodeValue.length-this.find[n].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let n=e.split("/"),r=this.options.context,o=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),i=-(r?r.depth+1:0)+(o?0:1),s=(a,l)=>{for(;a>=0;a--){let c=n[a];if(c==""){if(a==n.length-1||a==0)continue;for(;l>=i;l--)if(s(a-1,l))return!0;return!1}else{let u=l>0||l==0&&o?this.nodes[l].type:r&&l>=i?r.node(l-i).type:null;if(!u||u.name!=c&&!u.isInGroup(c))return!1;l--}}return!0};return s(n.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let n=e.depth;n>=0;n--){let r=e.node(n).contentMatchAt(e.indexAfter(n)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let n in this.parser.schema.nodes){let r=this.parser.schema.nodes[n];if(r.isTextblock&&r.defaultAttrs)return r}}};function KC(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&Mb.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function JC(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function Vm(t){let e={};for(let n in t)e[n]=t[n];return e}function Hm(t,e){let n=e.schema.nodes;for(let r in n){let o=n[r];if(!o.allowsMarkType(t))continue;let i=[],s=a=>{i.push(a);for(let l=0;l<a.edgeCount;l++){let{type:c,next:u}=a.edge(l);if(c==e||i.indexOf(u)<0&&s(u))return!0}};if(s(o.contentMatch))return!0}}let di=class _b{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},r){r||(r=Hc(n).createDocumentFragment());let o=r,i=[];return e.forEach(s=>{if(i.length||s.marks.length){let a=0,l=0;for(;a<i.length&&l<s.marks.length;){let c=s.marks[l];if(!this.marks[c.type.name]){l++;continue}if(!c.eq(i[a][0])||c.type.spec.spanning===!1)break;a++,l++}for(;a<i.length;)o=i.pop()[1];for(;l<s.marks.length;){let c=s.marks[l++],u=this.serializeMark(c,s.isInline,n);u&&(i.push([c,o]),o.appendChild(u.dom),o=u.contentDOM||u.dom)}}o.appendChild(this.serializeNodeInner(s,n))}),r}serializeNodeInner(e,n){let{dom:r,contentDOM:o}=xa(Hc(n),this.nodes[e.type.name](e),null,e.attrs);if(o){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,n,o)}return r}serializeNode(e,n={}){let r=this.serializeNodeInner(e,n);for(let o=e.marks.length-1;o>=0;o--){let i=this.serializeMark(e.marks[o],e.isInline,n);i&&((i.contentDOM||i.dom).appendChild(r),r=i.dom)}return r}serializeMark(e,n,r={}){let o=this.marks[e.type.name];return o&&xa(Hc(r),o(e,n),null,e.attrs)}static renderSpec(e,n,r=null,o){return xa(e,n,r,o)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new _b(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=Wm(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return Wm(e.marks)}};function Wm(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function Hc(t){return t.document||window.document}const Gm=new WeakMap;function XC(t){let e=Gm.get(t);return e===void 0&&Gm.set(t,e=YC(t)),e}function YC(t){let e=null;function n(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let o=0;o<r.length;o++)n(r[o]);else for(let o in r)n(r[o])}return n(t),e}function xa(t,e,n,r){if(typeof e=="string")return{dom:t.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let o=e[0],i;if(typeof o!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(i=XC(r))&&i.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let s=o.indexOf(" ");s>0&&(n=o.slice(0,s),o=o.slice(s+1));let a,l=n?t.createElementNS(n,o):t.createElement(o),c=e[1],u=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){u=2;for(let d in c)if(c[d]!=null){let f=d.indexOf(" ");f>0?l.setAttributeNS(d.slice(0,f),d.slice(f+1),c[d]):l.setAttribute(d,c[d])}}for(let d=u;d<e.length;d++){let f=e[d];if(f===0){if(d<e.length-1||d>u)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}else{let{dom:p,contentDOM:h}=xa(t,f,n,r);if(l.appendChild(p),h){if(a)throw new RangeError("Multiple content holes");a=h}}}return{dom:l,contentDOM:a}}const Nb=65535,Db=Math.pow(2,16);function ZC(t,e){return t+e*Db}function Km(t){return t&Nb}function QC(t){return(t-(t&Nb))/Db}const Ib=1,Fb=2,ka=4,Bb=8;let td=class{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&Bb)>0}get deletedBefore(){return(this.delInfo&(Ib|ka))>0}get deletedAfter(){return(this.delInfo&(Fb|ka))>0}get deletedAcross(){return(this.delInfo&ka)>0}},ao=class _o{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&_o.empty)return _o.empty}recover(e){let n=0,r=Km(e);if(!this.inverted)for(let o=0;o<r;o++)n+=this.ranges[o*3+2]-this.ranges[o*3+1];return this.ranges[r*3]+n+QC(e)}mapResult(e,n=1){return this._map(e,n,!1)}map(e,n=1){return this._map(e,n,!0)}_map(e,n,r){let o=0,i=this.inverted?2:1,s=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?o:0);if(l>e)break;let c=this.ranges[a+i],u=this.ranges[a+s],d=l+c;if(e<=d){let f=c?e==l?-1:e==d?1:n:n,p=l+o+(f<0?0:u);if(r)return p;let h=e==(n<0?l:d)?null:ZC(a/3,e-l),m=e==l?Fb:e==d?Ib:ka;return(n<0?e!=l:e!=d)&&(m|=Bb),new td(p,m,h)}o+=u-c}return r?e+o:new td(e+o,0,null)}touches(e,n){let r=0,o=Km(n),i=this.inverted?2:1,s=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?r:0);if(l>e)break;let c=this.ranges[a+i],u=l+c;if(e<=u&&a==o*3)return!0;r+=this.ranges[a+s]-c}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let o=0,i=0;o<this.ranges.length;o+=3){let s=this.ranges[o],a=s-(this.inverted?i:0),l=s+(this.inverted?0:i),c=this.ranges[o+n],u=this.ranges[o+r];e(a,a+c,l,l+u),i+=u-c}}invert(){return new _o(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?_o.empty:new _o(e<0?[0,-e,0]:[0,0,e])}};ao.empty=new ao([]);let Jo=class nd{constructor(e,n,r=0,o=e?e.length:0){this.mirror=n,this.from=r,this.to=o,this._maps=e||[],this.ownData=!(e||n)}get maps(){return this._maps}slice(e=0,n=this.maps.length){return new nd(this._maps,this.mirror,e,n)}appendMap(e,n){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),n!=null&&this.setMirror(this._maps.length-1,n)}appendMapping(e){for(let n=0,r=this._maps.length;n<e._maps.length;n++){let o=e.getMirror(n);this.appendMap(e._maps[n],o!=null&&o<n?r+o:void 0)}}getMirror(e){if(this.mirror){for(let n=0;n<this.mirror.length;n++)if(this.mirror[n]==e)return this.mirror[n+(n%2?-1:1)]}}setMirror(e,n){this.mirror||(this.mirror=[]),this.mirror.push(e,n)}appendMappingInverted(e){for(let n=e.maps.length-1,r=this._maps.length+e._maps.length;n>=0;n--){let o=e.getMirror(n);this.appendMap(e._maps[n].invert(),o!=null&&o>n?r-o-1:void 0)}}invert(){let e=new nd;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let r=this.from;r<this.to;r++)e=this._maps[r].map(e,n);return e}mapResult(e,n=1){return this._map(e,n,!1)}_map(e,n,r){let o=0;for(let i=this.from;i<this.to;i++){let s=this._maps[i],a=s.mapResult(e,n);if(a.recover!=null){let l=this.getMirror(i);if(l!=null&&l>i&&l<this.to){i=l,e=this._maps[l].recover(a.recover);continue}}o|=a.delInfo,e=a.pos}return r?e:new td(e,o,null)}};const Wc=Object.create(null);let Rt=class{getMap(){return ao.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=Wc[n.stepType];if(!r)throw new RangeError(`No step type ${n.stepType} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in Wc)throw new RangeError("Duplicate use of step JSON ID "+e);return Wc[e]=n,n.prototype.jsonID=e,n}},jt=class Ti{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new Ti(e,null)}static fail(e){return new Ti(null,e)}static fromReplace(e,n,r,o){try{return Ti.ok(e.replace(n,r,o))}catch(i){if(i instanceof Ua)return Ti.fail(i.message);throw i}}};function Of(t,e,n){let r=[];for(let o=0;o<t.childCount;o++){let i=t.child(o);i.content.size&&(i=i.copy(Of(i.content,e,i))),i.isInline&&(i=e(i,n,o)),r.push(i)}return ye.fromArray(r)}let Ns=class $i extends Rt{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=e.resolve(this.from),o=r.node(r.sharedDepth(this.to)),i=new ve(Of(n.content,(s,a)=>!s.isAtom||!a.type.allowsMarkType(this.mark.type)?s:s.mark(this.mark.addToSet(s.marks)),o),n.openStart,n.openEnd);return jt.fromReplace(e,this.from,this.to,i)}invert(){return new yn(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new $i(n.pos,r.pos,this.mark)}merge(e){return e instanceof $i&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new $i(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new $i(n.from,n.to,e.markFromJSON(n.mark))}};Rt.jsonID("addMark",Ns);let yn=class Oi extends Rt{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=new ve(Of(n.content,o=>o.mark(this.mark.removeFromSet(o.marks)),e),n.openStart,n.openEnd);return jt.fromReplace(e,this.from,this.to,r)}invert(){return new Ns(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new Oi(n.pos,r.pos,this.mark)}merge(e){return e instanceof Oi&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Oi(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new Oi(n.from,n.to,e.markFromJSON(n.mark))}};Rt.jsonID("removeMark",yn);let Mf=class Mi extends Rt{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return jt.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return jt.fromReplace(e,this.pos,this.pos+1,new ve(ye.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let o=0;o<n.marks.length;o++)if(!n.marks[o].isInSet(r))return new Mi(this.pos,n.marks[o]);return new Mi(this.pos,this.mark)}}return new _f(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Mi(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new Mi(n.pos,e.markFromJSON(n.mark))}};Rt.jsonID("addNodeMark",Mf);let _f=class rd extends Rt{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return jt.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return jt.fromReplace(e,this.pos,this.pos+1,new ve(ye.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new Mf(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new rd(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new rd(n.pos,e.markFromJSON(n.mark))}};Rt.jsonID("removeNodeMark",_f);let $t=class Lr extends Rt{constructor(e,n,r,o=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=o}apply(e){return this.structure&&od(e,this.from,this.to)?jt.fail("Structure replace would overwrite content"):jt.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new ao([this.from,this.to-this.from,this.slice.size])}invert(e){return new Lr(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deletedAcross&&r.deletedAcross?null:new Lr(n.pos,Math.max(n.pos,r.pos),this.slice)}merge(e){if(!(e instanceof Lr)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let n=this.slice.size+e.slice.size==0?ve.empty:new ve(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new Lr(this.from,this.to+(e.to-e.from),n,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let n=this.slice.size+e.slice.size==0?ve.empty:new ve(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new Lr(e.from,this.to,n,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new Lr(n.from,n.to,ve.fromJSON(e,n.slice),!!n.structure)}};Rt.jsonID("replace",$t);let Yt=class Sa extends Rt{constructor(e,n,r,o,i,s,a=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=o,this.slice=i,this.insert=s,this.structure=a}apply(e){if(this.structure&&(od(e,this.from,this.gapFrom)||od(e,this.gapTo,this.to)))return jt.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return jt.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?jt.fromReplace(e,this.from,this.to,r):jt.fail("Content does not fit in gap")}getMap(){return new ao([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let n=this.gapTo-this.gapFrom;return new Sa(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),o=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),i=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||o<n.pos||i>r.pos?null:new Sa(n.pos,r.pos,o,i,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Sa(n.from,n.to,n.gapFrom,n.gapTo,ve.fromJSON(e,n.slice),n.insert,!!n.structure)}};Rt.jsonID("replaceAround",Yt);function od(t,e,n){let r=t.resolve(e),o=n-e,i=r.depth;for(;o>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,o--;if(o>0){let s=r.node(i).maybeChild(r.indexAfter(i));for(;o>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,o--}}return!1}function eE(t,e,n,r){let o=[],i=[],s,a;t.doc.nodesBetween(e,n,(l,c,u)=>{if(!l.isInline)return;let d=l.marks;if(!r.isInSet(d)&&u.type.allowsMarkType(r.type)){let f=Math.max(c,e),p=Math.min(c+l.nodeSize,n),h=r.addToSet(d);for(let m=0;m<d.length;m++)d[m].isInSet(h)||(s&&s.to==f&&s.mark.eq(d[m])?s.to=p:o.push(s=new yn(f,p,d[m])));a&&a.to==f?a.to=p:i.push(a=new Ns(f,p,r))}}),o.forEach(l=>t.step(l)),i.forEach(l=>t.step(l))}function tE(t,e,n,r){let o=[],i=0;t.doc.nodesBetween(e,n,(s,a)=>{if(!s.isInline)return;i++;let l=null;if(r instanceof Ab){let c=s.marks,u;for(;u=r.isInSet(c);)(l||(l=[])).push(u),c=u.removeFromSet(c)}else r?r.isInSet(s.marks)&&(l=[r]):l=s.marks;if(l&&l.length){let c=Math.min(a+s.nodeSize,n);for(let u=0;u<l.length;u++){let d=l[u],f;for(let p=0;p<o.length;p++){let h=o[p];h.step==i-1&&d.eq(o[p].style)&&(f=h)}f?(f.to=c,f.step=i):o.push({style:d,from:Math.max(a,e),to:c,step:i})}}}),o.forEach(s=>t.step(new yn(s.from,s.to,s.style)))}function Nf(t,e,n,r=n.contentMatch,o=!0){let i=t.doc.nodeAt(e),s=[],a=e+1;for(let l=0;l<i.childCount;l++){let c=i.child(l),u=a+c.nodeSize,d=r.matchType(c.type);if(!d)s.push(new $t(a,u,ve.empty));else{r=d;for(let f=0;f<c.marks.length;f++)n.allowsMarkType(c.marks[f].type)||t.step(new yn(a,u,c.marks[f]));if(o&&c.isText&&n.whitespace!="pre"){let f,p=/\r?\n|\r/g,h;for(;f=p.exec(c.text);)h||(h=new ve(ye.from(n.schema.text(" ",n.allowedMarks(c.marks))),0,0)),s.push(new $t(a+f.index,a+f.index+f[0].length,h))}}a=u}if(!r.validEnd){let l=r.fillBefore(ye.empty,!0);t.replace(a,a,new ve(l,0,0))}for(let l=s.length-1;l>=0;l--)t.step(s[l])}function nE(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function Ds(t){let e=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let n=t.depth;;--n){let r=t.$from.node(n),o=t.$from.index(n),i=t.$to.indexAfter(n);if(n<t.depth&&r.canReplace(o,i,e))return n;if(n==0||r.type.spec.isolating||!nE(r,o,i))break}return null}function rE(t,e,n){let{$from:r,$to:o,depth:i}=e,s=r.before(i+1),a=o.after(i+1),l=s,c=a,u=ye.empty,d=0;for(let h=i,m=!1;h>n;h--)m||r.index(h)>0?(m=!0,u=ye.from(r.node(h).copy(u)),d++):l--;let f=ye.empty,p=0;for(let h=i,m=!1;h>n;h--)m||o.after(h+1)<o.end(h)?(m=!0,f=ye.from(o.node(h).copy(f)),p++):c++;t.step(new Yt(l,c,s,a,new ve(u.append(f),d,p),u.size-d,!0))}function Rb(t,e,n=null,r=t){let o=oE(t,e),i=o&&iE(r,e);return i?o.map(Jm).concat({type:e,attrs:n}).concat(i.map(Jm)):null}function Jm(t){return{type:t,attrs:null}}function oE(t,e){let{parent:n,startIndex:r,endIndex:o}=t,i=n.contentMatchAt(r).findWrapping(e);if(!i)return null;let s=i.length?i[0]:e;return n.canReplaceWith(r,o,s)?i:null}function iE(t,e){let{parent:n,startIndex:r,endIndex:o}=t,i=n.child(r),s=e.contentMatch.findWrapping(i.type);if(!s)return null;let a=(s.length?s[s.length-1]:e).contentMatch;for(let l=r;a&&l<o;l++)a=a.matchType(n.child(l).type);return!a||!a.validEnd?null:s}function sE(t,e,n){let r=ye.empty;for(let s=n.length-1;s>=0;s--){if(r.size){let a=n[s].type.contentMatch.matchFragment(r);if(!a||!a.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=ye.from(n[s].type.create(n[s].attrs,r))}let o=e.start,i=e.end;t.step(new Yt(o,i,o,i,new ve(r,0,0),n.length,!0))}function aE(t,e,n,r,o){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let i=t.steps.length;t.doc.nodesBetween(e,n,(s,a)=>{let l=typeof o=="function"?o(s):o;if(s.isTextblock&&!s.hasMarkup(r,l)&&lE(t.doc,t.mapping.slice(i).map(a),r)){let c=null;if(r.schema.linebreakReplacement){let p=r.whitespace=="pre",h=!!r.contentMatch.matchType(r.schema.linebreakReplacement);p&&!h?c=!1:!p&&h&&(c=!0)}c===!1&&Pb(t,s,a,i),Nf(t,t.mapping.slice(i).map(a,1),r,void 0,c===null);let u=t.mapping.slice(i),d=u.map(a,1),f=u.map(a+s.nodeSize,1);return t.step(new Yt(d,f,d+1,f-1,new ve(ye.from(r.create(l,null,s.marks)),0,0),1,!0)),c===!0&&Lb(t,s,a,i),!1}})}function Lb(t,e,n,r){e.forEach((o,i)=>{if(o.isText){let s,a=/\r?\n|\r/g;for(;s=a.exec(o.text);){let l=t.mapping.slice(r).map(n+1+i+s.index);t.replaceWith(l,l+1,e.type.schema.linebreakReplacement.create())}}})}function Pb(t,e,n,r){e.forEach((o,i)=>{if(o.type==o.type.schema.linebreakReplacement){let s=t.mapping.slice(r).map(n+1+i);t.replaceWith(s,s+1,e.type.schema.text(`
30
- `))}})}function lE(t,e,n){let r=t.resolve(e),o=r.index();return r.parent.canReplaceWith(o,o+1,n)}function cE(t,e,n,r,o){let i=t.doc.nodeAt(e);if(!i)throw new RangeError("No node at given position");n||(n=i.type);let s=n.create(r,null,o||i.marks);if(i.isLeaf)return t.replaceWith(e,e+i.nodeSize,s);if(!n.validContent(i.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new Yt(e,e+i.nodeSize,e+1,e+i.nodeSize-1,new ve(ye.from(s),0,0),1,!0))}function Qn(t,e,n=1,r){let o=t.resolve(e),i=o.depth-n,s=r&&r[r.length-1]||o.parent;if(i<0||o.parent.type.spec.isolating||!o.parent.canReplace(o.index(),o.parent.childCount)||!s.type.validContent(o.parent.content.cutByIndex(o.index(),o.parent.childCount)))return!1;for(let c=o.depth-1,u=n-2;c>i;c--,u--){let d=o.node(c),f=o.index(c);if(d.type.spec.isolating)return!1;let p=d.content.cutByIndex(f,d.childCount),h=r&&r[u+1];h&&(p=p.replaceChild(0,h.type.create(h.attrs)));let m=r&&r[u]||d;if(!d.canReplace(f+1,d.childCount)||!m.type.validContent(p))return!1}let a=o.indexAfter(i),l=r&&r[0];return o.node(i).canReplaceWith(a,a,l?l.type:o.node(i+1).type)}function uE(t,e,n=1,r){let o=t.doc.resolve(e),i=ye.empty,s=ye.empty;for(let a=o.depth,l=o.depth-n,c=n-1;a>l;a--,c--){i=ye.from(o.node(a).copy(i));let u=r&&r[c];s=ye.from(u?u.type.create(u.attrs,s):o.node(a).copy(s))}t.step(new $t(e,e,new ve(i.append(s),n,n),!0))}function Dr(t,e){let n=t.resolve(e),r=n.index();return zb(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function dE(t,e){e.content.size||t.type.compatibleContent(e.type);let n=t.contentMatchAt(t.childCount),{linebreakReplacement:r}=t.type.schema;for(let o=0;o<e.childCount;o++){let i=e.child(o),s=i.type==r?t.type.schema.nodes.text:i.type;if(n=n.matchType(s),!n||!t.type.allowsMarks(i.marks))return!1}return n.validEnd}function zb(t,e){return!!(t&&e&&!t.isLeaf&&dE(t,e))}function jb(t,e,n=-1){let r=t.resolve(e);for(let o=r.depth;;o--){let i,s,a=r.index(o);if(o==r.depth?(i=r.nodeBefore,s=r.nodeAfter):n>0?(i=r.node(o+1),a++,s=r.node(o).maybeChild(a)):(i=r.node(o).maybeChild(a-1),s=r.node(o+1)),i&&!i.isTextblock&&zb(i,s)&&r.node(o).canReplace(a,a+1))return e;if(o==0)break;e=n<0?r.before(o):r.after(o)}}function fE(t,e,n){let r=null,{linebreakReplacement:o}=t.doc.type.schema,i=t.doc.resolve(e-n),s=i.node().type;if(o&&s.inlineContent){let u=s.whitespace=="pre",d=!!s.contentMatch.matchType(o);u&&!d?r=!1:!u&&d&&(r=!0)}let a=t.steps.length;if(r===!1){let u=t.doc.resolve(e+n);Pb(t,u.node(),u.before(),a)}s.inlineContent&&Nf(t,e+n-1,s,i.node().contentMatchAt(i.index()),r==null);let l=t.mapping.slice(a),c=l.map(e-n);if(t.step(new $t(c,l.map(e+n,-1),ve.empty,!0)),r===!0){let u=t.doc.resolve(c);Lb(t,u.node(),u.before(),t.steps.length)}return t}function pE(t,e,n){let r=t.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),n))return e;if(r.parentOffset==0)for(let o=r.depth-1;o>=0;o--){let i=r.index(o);if(r.node(o).canReplaceWith(i,i,n))return r.before(o+1);if(i>0)return null}if(r.parentOffset==r.parent.content.size)for(let o=r.depth-1;o>=0;o--){let i=r.indexAfter(o);if(r.node(o).canReplaceWith(i,i,n))return r.after(o+1);if(i<r.node(o).childCount)return null}return null}function qb(t,e,n){let r=t.resolve(e);if(!n.content.size)return e;let o=n.content;for(let i=0;i<n.openStart;i++)o=o.firstChild.content;for(let i=1;i<=(n.openStart==0&&n.size?2:1);i++)for(let s=r.depth;s>=0;s--){let a=s==r.depth?0:r.pos<=(r.start(s+1)+r.end(s+1))/2?-1:1,l=r.index(s)+(a>0?1:0),c=r.node(s),u=!1;if(i==1)u=c.canReplace(l,l,o);else{let d=c.contentMatchAt(l).findWrapping(o.firstChild.type);u=d&&c.canReplaceWith(l,l,d[0])}if(u)return a==0?r.pos:a<0?r.before(s+1):r.after(s+1)}return null}function Df(t,e,n=e,r=ve.empty){if(e==n&&!r.size)return null;let o=t.resolve(e),i=t.resolve(n);return Ub(o,i,r)?new $t(e,n,r):new hE(o,i,r).fit()}function Ub(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}let hE=class{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=ye.empty;for(let o=0;o<=e.depth;o++){let i=e.node(o);this.frontier.push({type:i.type,match:i.contentMatchAt(e.indexAfter(o))})}for(let o=e.depth;o>0;o--)this.placed=ye.from(e.node(o).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let c=this.findFittable();c?this.placeNodes(c):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,o=this.close(e<0?this.$to:r.doc.resolve(e));if(!o)return null;let i=this.placed,s=r.depth,a=o.depth;for(;s&&a&&i.childCount==1;)i=i.firstChild.content,s--,a--;let l=new ve(i,s,a);return e>-1?new Yt(r.pos,e,this.$to.pos,this.$to.end(),l,n):l.size||r.pos!=this.$to.pos?new $t(r.pos,o.pos,l):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,o=this.unplaced.openEnd;r<e;r++){let i=n.firstChild;if(n.childCount>1&&(o=0),i.type.spec.isolating&&o<=r){e=r;break}n=i.content}for(let n=1;n<=2;n++)for(let r=n==1?e:this.unplaced.openStart;r>=0;r--){let o,i=null;r?(i=Gc(this.unplaced.content,r-1).firstChild,o=i.content):o=this.unplaced.content;let s=o.firstChild;for(let a=this.depth;a>=0;a--){let{type:l,match:c}=this.frontier[a],u,d=null;if(n==1&&(s?c.matchType(s.type)||(d=c.fillBefore(ye.from(s),!1)):i&&l.compatibleContent(i.type)))return{sliceDepth:r,frontierDepth:a,parent:i,inject:d};if(n==2&&s&&(u=c.findWrapping(s.type)))return{sliceDepth:r,frontierDepth:a,parent:i,wrap:u};if(i&&c.matchType(i.type))break}}}openMore(){let{content:e,openStart:n,openEnd:r}=this.unplaced,o=Gc(e,n);return!o.childCount||o.firstChild.isLeaf?!1:(this.unplaced=new ve(e,n+1,Math.max(r,o.size+n>=e.size-r?n+1:0)),!0)}dropNode(){let{content:e,openStart:n,openEnd:r}=this.unplaced,o=Gc(e,n);if(o.childCount<=1&&n>0){let i=e.size-n<=n+o.size;this.unplaced=new ve(_i(e,n-1,1),n-1,i?n-1:r)}else this.unplaced=new ve(_i(e,n,1),n,r)}placeNodes({sliceDepth:e,frontierDepth:n,parent:r,inject:o,wrap:i}){for(;this.depth>n;)this.closeFrontierNode();if(i)for(let m=0;m<i.length;m++)this.openFrontierNode(i[m]);let s=this.unplaced,a=r?r.content:s.content,l=s.openStart-e,c=0,u=[],{match:d,type:f}=this.frontier[n];if(o){for(let m=0;m<o.childCount;m++)u.push(o.child(m));d=d.matchFragment(o)}let p=a.size+e-(s.content.size-s.openEnd);for(;c<a.childCount;){let m=a.child(c),y=d.matchType(m.type);if(!y)break;c++,(c>1||l==0||m.content.size)&&(d=y,u.push(Vb(m.mark(f.allowedMarks(m.marks)),c==1?l:0,c==a.childCount?p:-1)))}let h=c==a.childCount;h||(p=-1),this.placed=Ni(this.placed,n,ye.from(u)),this.frontier[n].match=d,h&&p<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let m=0,y=a;m<p;m++){let g=y.lastChild;this.frontier.push({type:g.type,match:g.contentMatchAt(g.childCount)}),y=g.content}this.unplaced=h?e==0?ve.empty:new ve(_i(s.content,e-1,1),e-1,p<0?s.openEnd:e-1):new ve(_i(s.content,e,c),s.openStart,s.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],n;if(!e.type.isTextblock||!Kc(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(n=this.findCloseLevel(this.$to))&&n.depth==this.depth)return-1;let{depth:r}=this.$to,o=this.$to.after(r);for(;r>1&&o==this.$to.end(--r);)++o;return o}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:r,type:o}=this.frontier[n],i=n<e.depth&&e.end(n+1)==e.pos+(e.depth-(n+1)),s=Kc(e,n,o,r,i);if(s){for(let a=n-1;a>=0;a--){let{match:l,type:c}=this.frontier[a],u=Kc(e,a,c,l,!0);if(!u||u.childCount)continue e}return{depth:n,fit:s,move:i?e.doc.resolve(e.after(n+1)):e}}}}close(e){let n=this.findCloseLevel(e);if(!n)return null;for(;this.depth>n.depth;)this.closeFrontierNode();n.fit.childCount&&(this.placed=Ni(this.placed,n.depth,n.fit)),e=n.move;for(let r=n.depth+1;r<=e.depth;r++){let o=e.node(r),i=o.type.contentMatch.fillBefore(o.content,!0,e.index(r));this.openFrontierNode(o.type,o.attrs,i)}return e}openFrontierNode(e,n=null,r){let o=this.frontier[this.depth];o.match=o.match.matchType(e),this.placed=Ni(this.placed,this.depth,ye.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let e=this.frontier.pop().match.fillBefore(ye.empty,!0);e.childCount&&(this.placed=Ni(this.placed,this.frontier.length,e))}};function _i(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(_i(t.firstChild.content,e-1,n)))}function Ni(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(Ni(t.lastChild.content,e-1,n)))}function Gc(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function Vb(t,e,n){if(e<=0)return t;let r=t.content;return e>1&&(r=r.replaceChild(0,Vb(r.firstChild,e-1,r.childCount==1?n-1:0))),e>0&&(r=t.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(t.type.contentMatch.matchFragment(r).fillBefore(ye.empty,!0)))),t.copy(r)}function Kc(t,e,n,r,o){let i=t.node(e),s=o?t.indexAfter(e):t.index(e);if(s==i.childCount&&!n.compatibleContent(i.type))return null;let a=r.fillBefore(i.content,!0,s);return a&&!mE(n,i.content,s)?a:null}function mE(t,e,n){for(let r=n;r<e.childCount;r++)if(!t.allowsMarks(e.child(r).marks))return!0;return!1}function gE(t){return t.spec.defining||t.spec.definingForContent}function yE(t,e,n,r){if(!r.size)return t.deleteRange(e,n);let o=t.doc.resolve(e),i=t.doc.resolve(n);if(Ub(o,i,r))return t.step(new $t(e,n,r));let s=Wb(o,t.doc.resolve(n));s[s.length-1]==0&&s.pop();let a=-(o.depth+1);s.unshift(a);for(let f=o.depth,p=o.pos-1;f>0;f--,p--){let h=o.node(f).type.spec;if(h.defining||h.definingAsContext||h.isolating)break;s.indexOf(f)>-1?a=f:o.before(f)==p&&s.splice(1,0,-f)}let l=s.indexOf(a),c=[],u=r.openStart;for(let f=r.content,p=0;;p++){let h=f.firstChild;if(c.push(h),p==r.openStart)break;f=h.content}for(let f=u-1;f>=0;f--){let p=c[f],h=gE(p.type);if(h&&!p.sameMarkup(o.node(Math.abs(a)-1)))u=f;else if(h||!p.type.isTextblock)break}for(let f=r.openStart;f>=0;f--){let p=(f+u+1)%(r.openStart+1),h=c[p];if(h)for(let m=0;m<s.length;m++){let y=s[(m+l)%s.length],g=!0;y<0&&(g=!1,y=-y);let x=o.node(y-1),k=o.index(y-1);if(x.canReplaceWith(k,k,h.type,h.marks))return t.replace(o.before(y),g?i.after(y):n,new ve(Hb(r.content,0,r.openStart,p),p,r.openEnd))}}let d=t.steps.length;for(let f=s.length-1;f>=0&&(t.replace(e,n,r),!(t.steps.length>d));f--){let p=s[f];p<0||(e=o.before(p),n=i.after(p))}}function Hb(t,e,n,r,o){if(e<n){let i=t.firstChild;t=t.replaceChild(0,i.copy(Hb(i.content,e+1,n,r,i)))}if(e>r){let i=o.contentMatchAt(0),s=i.fillBefore(t).append(t);t=s.append(i.matchFragment(s).fillBefore(ye.empty,!0))}return t}function wE(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let o=pE(t.doc,e,r.type);o!=null&&(e=n=o)}t.replaceRange(e,n,new ve(ye.from(r),0,0))}function bE(t,e,n){let r=t.doc.resolve(e),o=t.doc.resolve(n),i=Wb(r,o);for(let s=0;s<i.length;s++){let a=i[s],l=s==i.length-1;if(l&&a==0||r.node(a).type.contentMatch.validEnd)return t.delete(r.start(a),o.end(a));if(a>0&&(l||r.node(a-1).canReplace(r.index(a-1),o.indexAfter(a-1))))return t.delete(r.before(a),o.after(a))}for(let s=1;s<=r.depth&&s<=o.depth;s++)if(e-r.start(s)==r.depth-s&&n>r.end(s)&&o.end(s)-n!=o.depth-s&&r.start(s-1)==o.start(s-1)&&r.node(s-1).canReplace(r.index(s-1),o.index(s-1)))return t.delete(r.before(s),n);t.delete(e,n)}function Wb(t,e){let n=[],r=Math.min(t.depth,e.depth);for(let o=r;o>=0;o--){let i=t.start(o);if(i<t.pos-(t.depth-o)||e.end(o)>e.pos+(e.depth-o)||t.node(o).type.spec.isolating||e.node(o).type.spec.isolating)break;(i==e.start(o)||o==t.depth&&o==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&o&&e.start(o-1)==i-1)&&n.push(o)}return n}let Gb=class Ca extends Rt{constructor(e,n,r){super(),this.pos=e,this.attr=n,this.value=r}apply(e){let n=e.nodeAt(this.pos);if(!n)return jt.fail("No node at attribute step's position");let r=Object.create(null);for(let i in n.attrs)r[i]=n.attrs[i];r[this.attr]=this.value;let o=n.type.create(r,null,n.marks);return jt.fromReplace(e,this.pos,this.pos+1,new ve(ye.from(o),0,n.isLeaf?0:1))}getMap(){return ao.empty}invert(e){return new Ca(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Ca(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new Ca(n.pos,n.attr,n.value)}};Rt.jsonID("attr",Gb);let Kb=class id extends Rt{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let o in e.attrs)n[o]=e.attrs[o];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return jt.ok(r)}getMap(){return ao.empty}invert(e){return new id(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new id(n.attr,n.value)}};Rt.jsonID("docAttr",Kb);let Xo=class extends Error{};Xo=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};Xo.prototype=Object.create(Error.prototype);Xo.prototype.constructor=Xo;Xo.prototype.name="TransformError";let Jb=class{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Jo}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new Xo(n.failed);return this}maybeStep(e){let n=e.apply(this.doc);return n.failed||this.addStep(e,n.doc),n}get docChanged(){return this.steps.length>0}addStep(e,n){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=n}replace(e,n=e,r=ve.empty){let o=Df(this.doc,e,n,r);return o&&this.step(o),this}replaceWith(e,n,r){return this.replace(e,n,new ve(ye.from(r),0,0))}delete(e,n){return this.replace(e,n,ve.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return yE(this,e,n,r),this}replaceRangeWith(e,n,r){return wE(this,e,n,r),this}deleteRange(e,n){return bE(this,e,n),this}lift(e,n){return rE(this,e,n),this}join(e,n=1){return fE(this,e,n),this}wrap(e,n){return sE(this,e,n),this}setBlockType(e,n=e,r,o=null){return aE(this,e,n,r,o),this}setNodeMarkup(e,n,r=null,o){return cE(this,e,n,r,o),this}setNodeAttribute(e,n,r){return this.step(new Gb(e,n,r)),this}setDocAttribute(e,n){return this.step(new Kb(e,n)),this}addNodeMark(e,n){return this.step(new Mf(e,n)),this}removeNodeMark(e,n){if(!(n instanceof Ge)){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(n=n.isInSet(r.marks),!n)return this}return this.step(new _f(e,n)),this}split(e,n=1,r){return uE(this,e,n,r),this}addMark(e,n,r){return eE(this,e,n,r),this}removeMark(e,n,r){return tE(this,e,n,r),this}clearIncompatible(e,n,r){return Nf(this,e,n,r),this}};const Jc=Object.create(null);let Re=class{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new Xb(e.min(n),e.max(n))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let n=0;n<e.length;n++)if(e[n].$from.pos!=e[n].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,n=ve.empty){let r=n.content.lastChild,o=null;for(let a=0;a<n.openEnd;a++)o=r,r=r.lastChild;let i=e.steps.length,s=this.ranges;for(let a=0;a<s.length;a++){let{$from:l,$to:c}=s[a],u=e.mapping.slice(i);e.replaceRange(u.map(l.pos),u.map(c.pos),a?ve.empty:n),a==0&&Zm(e,i,(r?r.isInline:o&&o.isTextblock)?-1:1)}}replaceWith(e,n){let r=e.steps.length,o=this.ranges;for(let i=0;i<o.length;i++){let{$from:s,$to:a}=o[i],l=e.mapping.slice(r),c=l.map(s.pos),u=l.map(a.pos);i?e.deleteRange(c,u):(e.replaceRangeWith(c,u,n),Zm(e,r,n.isInline?-1:1))}}static findFrom(e,n,r=!1){let o=e.parent.inlineContent?new Pe(e):No(e.node(0),e.parent,e.pos,e.index(),n,r);if(o)return o;for(let i=e.depth-1;i>=0;i--){let s=n<0?No(e.node(0),e.node(i),e.before(i+1),e.index(i),n,r):No(e.node(0),e.node(i),e.after(i+1),e.index(i)+1,n,r);if(s)return s}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new _n(e.node(0))}static atStart(e){return No(e,e,0,0,1)||new _n(e)}static atEnd(e){return No(e,e,e.content.size,e.childCount,-1)||new _n(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Jc[n.type];if(!r)throw new RangeError(`No selection type ${n.type} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in Jc)throw new RangeError("Duplicate use of selection JSON ID "+e);return Jc[e]=n,n.prototype.jsonID=e,n}getBookmark(){return Pe.between(this.$anchor,this.$head).getBookmark()}};Re.prototype.visible=!0;let Xb=class{constructor(e,n){this.$from=e,this.$to=n}},Xm=!1;function Ym(t){!Xm&&!t.parent.inlineContent&&(Xm=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}let Pe=class Di extends Re{constructor(e,n=e){Ym(e),Ym(n),super(e,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,n){let r=e.resolve(n.map(this.head));if(!r.parent.inlineContent)return Re.near(r);let o=e.resolve(n.map(this.anchor));return new Di(o.parent.inlineContent?o:r,r)}replace(e,n=ve.empty){if(super.replace(e,n),n==ve.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof Di&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Yb(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,n){if(typeof n.anchor!="number"||typeof n.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new Di(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){let o=e.resolve(n);return new this(o,r==n?o:e.resolve(r))}static between(e,n,r){let o=e.pos-n.pos;if((!r||o)&&(r=o>=0?1:-1),!n.parent.inlineContent){let i=Re.findFrom(n,r,!0)||Re.findFrom(n,-r,!0);if(i)n=i.$head;else return Re.near(n,r)}return e.parent.inlineContent||(o==0?e=n:(e=(Re.findFrom(e,-r,!0)||Re.findFrom(e,r,!0)).$anchor,e.pos<n.pos!=o<0&&(e=n))),new Di(e,n)}};Re.jsonID("text",Pe);let Yb=class Zb{constructor(e,n){this.anchor=e,this.head=n}map(e){return new Zb(e.map(this.anchor),e.map(this.head))}resolve(e){return Pe.between(e.resolve(this.anchor),e.resolve(this.head))}},De=class Ii extends Re{constructor(e){let n=e.nodeAfter,r=e.node(0).resolve(e.pos+n.nodeSize);super(e,r),this.node=n}map(e,n){let{deleted:r,pos:o}=n.mapResult(this.anchor),i=e.resolve(o);return r?Re.near(i):new Ii(i)}content(){return new ve(ye.from(this.node),0,0)}eq(e){return e instanceof Ii&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new vE(this.anchor)}static fromJSON(e,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new Ii(e.resolve(n.anchor))}static create(e,n){return new Ii(e.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}};De.prototype.visible=!1;Re.jsonID("node",De);let vE=class Qb{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:r}=e.mapResult(this.anchor);return n?new Yb(r,r):new Qb(r)}resolve(e){let n=e.resolve(this.anchor),r=n.nodeAfter;return r&&De.isSelectable(r)?new De(n):Re.near(n)}},_n=class Ea extends Re{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,n=ve.empty){if(n==ve.empty){e.delete(0,e.doc.content.size);let r=Re.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,n)}toJSON(){return{type:"all"}}static fromJSON(e){return new Ea(e)}map(e){return new Ea(e)}eq(e){return e instanceof Ea}getBookmark(){return xE}};Re.jsonID("all",_n);const xE={map(){return this},resolve(t){return new _n(t)}};function No(t,e,n,r,o,i=!1){if(e.inlineContent)return Pe.create(t,n);for(let s=r-(o>0?0:1);o>0?s<e.childCount:s>=0;s+=o){let a=e.child(s);if(a.isAtom){if(!i&&De.isSelectable(a))return De.create(t,n-(o<0?a.nodeSize:0))}else{let l=No(t,a,n+o,o<0?a.childCount:0,o,i);if(l)return l}n+=a.nodeSize*o}return null}function Zm(t,e,n){let r=t.steps.length-1;if(r<e)return;let o=t.steps[r];if(!(o instanceof $t||o instanceof Yt))return;let i=t.mapping.maps[r],s;i.forEach((a,l,c,u)=>{s==null&&(s=u)}),t.setSelection(Re.near(t.doc.resolve(s),n))}const Qm=1,eg=2,tg=4;let kE=class extends Jb{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(this.updated|Qm)&-3,this.storedMarks=null,this}get selectionSet(){return(this.updated&Qm)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=eg,this}ensureMarks(e){return Ge.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&eg)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&-3,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,n=!0){let r=this.selection;return n&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||Ge.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,n,r){let o=this.doc.type.schema;if(n==null)return e?this.replaceSelectionWith(o.text(e),!0):this.deleteSelection();{if(r==null&&(r=n),r=r??n,!e)return this.deleteRange(n,r);let i=this.storedMarks;if(!i){let s=this.doc.resolve(n);i=r==n?s.marks():s.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(n,r,o.text(e,i)),this.selection.empty||this.setSelection(Re.near(this.selection.$to)),this}}setMeta(e,n){return this.meta[typeof e=="string"?e:e.key]=n,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=tg,this}get scrolledIntoView(){return(this.updated&tg)>0}};function ng(t,e){return!e||!t?t:t.bind(e)}let Fi=class{constructor(e,n,r){this.name=e,this.init=ng(n.init,r),this.apply=ng(n.apply,r)}};const SE=[new Fi("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new Fi("selection",{init(t,e){return t.selection||Re.atStart(e.doc)},apply(t){return t.selection}}),new Fi("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new Fi("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];let Xc=class{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=SE.slice(),n&&n.forEach(r=>{if(this.pluginsByKey[r.key])throw new RangeError("Adding different instances of a keyed plugin ("+r.key+")");this.plugins.push(r),this.pluginsByKey[r.key]=r,r.spec.state&&this.fields.push(new Fi(r.key,r.spec.state,r))})}},Hi=class Bi{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,n=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=n){let o=this.config.plugins[r];if(o.spec.filterTransaction&&!o.spec.filterTransaction.call(o,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let n=[e],r=this.applyInner(e),o=null;for(;;){let i=!1;for(let s=0;s<this.config.plugins.length;s++){let a=this.config.plugins[s];if(a.spec.appendTransaction){let l=o?o[s].n:0,c=o?o[s].state:this,u=l<n.length&&a.spec.appendTransaction.call(a,l?n.slice(l):n,c,r);if(u&&r.filterTransaction(u,s)){if(u.setMeta("appendedTransaction",e),!o){o=[];for(let d=0;d<this.config.plugins.length;d++)o.push(d<s?{state:r,n:n.length}:{state:this,n:0})}n.push(u),r=r.applyInner(u),i=!0}o&&(o[s]={state:r,n:n.length})}}if(!i)return{state:r,transactions:n}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let n=new Bi(this.config),r=this.config.fields;for(let o=0;o<r.length;o++){let i=r[o];n[i.name]=i.apply(e,this[i.name],this,n)}return n}get tr(){return new kE(this)}static create(e){let n=new Xc(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new Bi(n);for(let o=0;o<n.fields.length;o++)r[n.fields[o].name]=n.fields[o].init(e,r);return r}reconfigure(e){let n=new Xc(this.schema,e.plugins),r=n.fields,o=new Bi(n);for(let i=0;i<r.length;i++){let s=r[i].name;o[s]=this.hasOwnProperty(s)?this[s]:r[i].init(e,o)}return o}toJSON(e){let n={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(n.storedMarks=this.storedMarks.map(r=>r.toJSON())),e&&typeof e=="object")for(let r in e){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let o=e[r],i=o.spec.state;i&&i.toJSON&&(n[r]=i.toJSON.call(o,this[o.key]))}return n}static fromJSON(e,n,r){if(!n)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let o=new Xc(e.schema,e.plugins),i=new Bi(o);return o.fields.forEach(s=>{if(s.name=="doc")i.doc=Yr.fromJSON(e.schema,n.doc);else if(s.name=="selection")i.selection=Re.fromJSON(i.doc,n.selection);else if(s.name=="storedMarks")n.storedMarks&&(i.storedMarks=n.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let a in r){let l=r[a],c=l.spec.state;if(l.key==s.name&&c&&c.fromJSON&&Object.prototype.hasOwnProperty.call(n,a)){i[s.name]=c.fromJSON.call(l,e,n[a],i);return}}i[s.name]=s.init(e,i)}}),i}};function ev(t,e,n){for(let r in t){let o=t[r];o instanceof Function?o=o.bind(e):r=="handleDOMEvents"&&(o=ev(o,e,{})),n[r]=o}return n}let Qe=class{constructor(e){this.spec=e,this.props={},e.props&&ev(e.props,this,this.props),this.key=e.key?e.key.key:tv("plugin")}getState(e){return e[this.key]}};const Yc=Object.create(null);function tv(t){return t in Yc?t+"$"+ ++Yc[t]:(Yc[t]=0,t+"$")}let tt=class{constructor(e="key"){this.key=tv(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}};const Wa=t=>t.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`),CE=t=>Wa(t),Aa=Object.freeze({RESOLVED:"resolved",NEW:"new",ADD:"add",UPDATE:"update",DELETED:"deleted",PENDING:"pending",SELECTED:"selected",COMMENTS_LIST:"comments-list",CHANGE_ACCEPTED:"change-accepted",CHANGE_REJECTED:"change-rejected"}),EE={mounted(t,e,n){const r=o=>{t.contains(o.target)||e.value(o)};document.addEventListener("click",r),t.__clickOutsideHandler=r},unmounted(t){document.removeEventListener("click",t.__clickOutsideHandler),delete t.__clickOutsideHandler}};function lo(t){if(t!=null)return typeof t=="string"&&(t=parseFloat(t)),Math.round(t*1440)}function Wt(t){if(t!=null)return typeof t=="string"&&(t=parseInt(t,10)),Math.round(t/1440*100)/100}function et(t){if(t!=null)return t=Wt(t),Math.round(t*96)}function ct(t){if(t!=null)return t=t/96,lo(t)}function Vo(t){if(t!=null)return t/240}function nv(t){if(t!=null)return t*240}function AE(t){if(t!=null)return Math.round(t/2)}function En(t){if(t==null)return;typeof t=="string"&&(t=parseFloat(t));const e=t*96/914400;return Math.round(e)}function vi(t){if(t!=null)return typeof t=="string"&&(t=parseFloat(t)),Math.round(t*9525)}function rv(t){return t==null?void 0:parseFloat(t)/8*1.3333}function ov(t){if(t!=null)return Math.round(t*6)}const TE=async t=>await(await fetch(t)).arrayBuffer(),$E=t=>{const e=new window.DOMParser().parseFromString(t,"text/xml").querySelectorAll("Default");return Array.from(e).map(n=>n.getAttribute("Extension"))},OE=t=>new Map([["yellow","#ffff00"],["green","#00ff00"],["blue","#0000FFFF"],["cyan","#00ffff"],["magenta","#ff00ff"],["red","#ff0000"],["darkYellow","#808000FF"],["darkGreen","#008000FF"],["darkBlue","#000080"],["darkCyan","#008080FF"],["darkMagenta","#800080FF"],["darkGray","#808080FF"],["darkRed","#800000FF"],["lightGray","#C0C0C0FF"],["black","#000"]]).get(t)||null;function ME(t){if(!t||typeof t!="string")return!1;switch(t.length){case 3:return/^[0-9A-F]{3}$/i.test(t);case 6:return/^[0-9A-F]{6}$/i.test(t);case 8:return/^[0-9A-F]{8}$/i.test(t);default:return!1}}const _E=t=>{const e=Number(t).toString(16);return e.length===1?"0"+e:e},NE=t=>"#"+t.match(/\d+/g).map(_E).join("");function Jn(t=8){const e="0123456789abcdef";let n=[];for(let r=0;r<t;r++){const o=Math.floor(Math.random()*e.length);n.push(e[o])}return n.join("")}function If(){return Math.floor(Math.random()*2147483647).toString(16).toUpperCase().padStart(8,"0")}const DE={"xmlns:wpc":"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas","xmlns:cx":"http://schemas.microsoft.com/office/drawing/2014/chartex","xmlns:cx1":"http://schemas.microsoft.com/office/drawing/2015/9/8/chartex","xmlns:cx2":"http://schemas.microsoft.com/office/drawing/2015/10/21/chartex","xmlns:cx3":"http://schemas.microsoft.com/office/drawing/2016/5/9/chartex","xmlns:cx4":"http://schemas.microsoft.com/office/drawing/2016/5/10/chartex","xmlns:cx5":"http://schemas.microsoft.com/office/drawing/2016/5/11/chartex","xmlns:cx6":"http://schemas.microsoft.com/office/drawing/2016/5/12/chartex","xmlns:cx7":"http://schemas.microsoft.com/office/drawing/2016/5/13/chartex","xmlns:cx8":"http://schemas.microsoft.com/office/drawing/2016/5/14/chartex","xmlns:mc":"http://schemas.openxmlformats.org/markup-compatibility/2006","xmlns:aink":"http://schemas.microsoft.com/office/drawing/2016/ink","xmlns:am3d":"http://schemas.microsoft.com/office/drawing/2017/model3d","xmlns:o":"urn:schemas-microsoft-com:office:office","xmlns:oel":"http://schemas.microsoft.com/office/2019/extlst","xmlns:r":"http://schemas.openxmlformats.org/officeDocument/2006/relationships","xmlns:m":"http://schemas.openxmlformats.org/officeDocument/2006/math","xmlns:v":"urn:schemas-microsoft-com:vml","xmlns:wp14":"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing","xmlns:wp":"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing","xmlns:w10":"urn:schemas-microsoft-com:office:word","xmlns:w":"http://schemas.openxmlformats.org/wordprocessingml/2006/main","xmlns:w14":"http://schemas.microsoft.com/office/word/2010/wordml","xmlns:w15":"http://schemas.microsoft.com/office/word/2012/wordml","xmlns:w16cex":"http://schemas.microsoft.com/office/word/2018/wordml/cex","xmlns:w16cid":"http://schemas.microsoft.com/office/word/2016/wordml/cid","xmlns:w16":"http://schemas.microsoft.com/office/word/2018/wordml","xmlns:w16du":"http://schemas.microsoft.com/office/word/2023/wordml/word16du","xmlns:w16sdtdh":"http://schemas.microsoft.com/office/word/2020/wordml/sdtdatahash","xmlns:w16sdtfl":"http://schemas.microsoft.com/office/word/2024/wordml/sdtformatlock","xmlns:w16se":"http://schemas.microsoft.com/office/word/2015/wordml/symex","xmlns:wpg":"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup","xmlns:wpi":"http://schemas.microsoft.com/office/word/2010/wordprocessingInk","xmlns:wne":"http://schemas.microsoft.com/office/word/2006/wordml","xmlns:wps":"http://schemas.microsoft.com/office/word/2010/wordprocessingShape","mc:Ignorable":"w14 w15 w16se w16cid w16 w16cex w16sdtdh w16sdtfl w16du wp14"},IE={elements:[{type:"element",name:"Properties",attributes:{xmlns:"http://schemas.openxmlformats.org/officeDocument/2006/custom-properties","xmlns:vt":"http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes"},elements:[]}]},FE={elements:[{type:"element",name:"w:settings",attributes:{"xmlns:w":"http://schemas.openxmlformats.org/wordprocessingml/2006/main"},elements:[]}]},BE={type:"element",name:"w:r",elements:[{type:"element",name:"w:rPr",elements:[{type:"element",name:"w:rStyle",attributes:{"w:val":"CommentReference"}}]},{type:"element",name:"w:annotationRef"}]},rg={Normal:{type:"element",name:"w:style",attributes:{"w:type":"paragraph","w:default":"1","w:styleId":"Normal"},elements:[{type:"element",name:"w:name",attributes:{"w:val":"Normal"}},{type:"element",name:"w:qFormat"}]},Title:{type:"element",name:"w:style",attributes:{"w:type":"paragraph","w:styleId":"Title"},elements:[{type:"element",name:"w:name",attributes:{"w:val":"Title"}},{type:"element",name:"w:basedOn",attributes:{"w:val":"Normal"}},{type:"element",name:"w:next",attributes:{"w:val":"Normal"}},{type:"element",name:"w:link",attributes:{"w:val":"TitleChar"}},{type:"element",name:"w:uiPriority",attributes:{"w:val":"10"}},{type:"element",name:"w:qFormat"},{type:"element",name:"w:rsid",attributes:{"w:val":"00B72667"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:spacing",attributes:{"w:after":"80"}},{type:"element",name:"w:contextualSpacing"}]},{type:"element",name:"w:rPr",elements:[{type:"element",name:"w:rFonts",attributes:{"w:asciiTheme":"majorHAnsi","w:eastAsiaTheme":"majorEastAsia","w:hAnsiTheme":"majorHAnsi","w:cstheme":"majorBidi"}},{type:"element",name:"w:spacing",attributes:{"w:val":"-10"}},{type:"element",name:"w:kern",attributes:{"w:val":"28"}},{type:"element",name:"w:sz",attributes:{"w:val":"56"}},{type:"element",name:"w:szCs",attributes:{"w:val":"56"}}]}]},Subtitle:{type:"element",name:"w:style",attributes:{"w:type":"paragraph","w:styleId":"Subtitle"},elements:[{type:"element",name:"w:name",attributes:{"w:val":"Subtitle"}},{type:"element",name:"w:basedOn",attributes:{"w:val":"Normal"}},{type:"element",name:"w:next",attributes:{"w:val":"Normal"}},{type:"element",name:"w:link",attributes:{"w:val":"SubtitleChar"}},{type:"element",name:"w:uiPriority",attributes:{"w:val":"11"}},{type:"element",name:"w:qFormat"},{type:"element",name:"w:rsid",attributes:{"w:val":"00B72667"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:numPr",elements:[{type:"element",name:"w:ilvl",attributes:{"w:val":"1"}}]},{type:"element",name:"w:spacing",attributes:{"w:after":"160"}}]},{type:"element",name:"w:rPr",elements:[{type:"element",name:"w:rFonts",attributes:{"w:asciiTheme":"minorHAnsi","w:eastAsiaTheme":"majorEastAsia","w:hAnsiTheme":"minorHAnsi","w:cstheme":"majorBidi"}},{type:"element",name:"w:color",attributes:{"w:val":"595959","w:themeColor":"text1","w:themeTint":"A6"}},{type:"element",name:"w:spacing",attributes:{"w:val":"15"}},{type:"element",name:"w:sz",attributes:{"w:val":"28"}},{type:"element",name:"w:szCs",attributes:{"w:val":"28"}}]}]},Heading1:{type:"element",name:"w:style",attributes:{"w:type":"paragraph","w:styleId":"Heading1"},elements:[{type:"element",name:"w:name",attributes:{"w:val":"heading 1"}},{type:"element",name:"w:basedOn",attributes:{"w:val":"Normal"}},{type:"element",name:"w:next",attributes:{"w:val":"Normal"}},{type:"element",name:"w:link",attributes:{"w:val":"Heading1Char"}},{type:"element",name:"w:uiPriority",attributes:{"w:val":"9"}},{type:"element",name:"w:qFormat"},{type:"element",name:"w:rsid",attributes:{"w:val":"00233D7B"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:keepNext"},{type:"element",name:"w:keepLines"},{type:"element",name:"w:spacing",attributes:{"w:before":"360","w:after":"80"}},{type:"element",name:"w:outlineLvl",attributes:{"w:val":"0"}}]},{type:"element",name:"w:rPr",elements:[{type:"element",name:"w:rFonts",attributes:{"w:asciiTheme":"majorHAnsi","w:eastAsiaTheme":"majorEastAsia","w:hAnsiTheme":"majorHAnsi","w:cstheme":"majorBidi"}},{type:"element",name:"w:color",attributes:{"w:val":"0F4761","w:themeColor":"accent1","w:themeShade":"BF"}},{type:"element",name:"w:sz",attributes:{"w:val":"40"}},{type:"element",name:"w:szCs",attributes:{"w:val":"40"}}]}]},Heading2:{type:"element",name:"w:style",attributes:{"w:type":"paragraph","w:styleId":"Heading2"},elements:[{type:"element",name:"w:name",attributes:{"w:val":"heading 2"}},{type:"element",name:"w:basedOn",attributes:{"w:val":"Normal"}},{type:"element",name:"w:next",attributes:{"w:val":"Normal"}},{type:"element",name:"w:link",attributes:{"w:val":"Heading2Char"}},{type:"element",name:"w:uiPriority",attributes:{"w:val":"9"}},{type:"element",name:"w:semiHidden"},{type:"element",name:"w:unhideWhenUsed"},{type:"element",name:"w:qFormat"},{type:"element",name:"w:rsid",attributes:{"w:val":"00233D7B"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:keepNext"},{type:"element",name:"w:keepLines"},{type:"element",name:"w:spacing",attributes:{"w:before":"160","w:after":"80"}},{type:"element",name:"w:outlineLvl",attributes:{"w:val":"1"}}]},{type:"element",name:"w:rPr",elements:[{type:"element",name:"w:rFonts",attributes:{"w:asciiTheme":"majorHAnsi","w:eastAsiaTheme":"majorEastAsia","w:hAnsiTheme":"majorHAnsi","w:cstheme":"majorBidi"}},{type:"element",name:"w:color",attributes:{"w:val":"0F4761","w:themeColor":"accent1","w:themeShade":"BF"}},{type:"element",name:"w:sz",attributes:{"w:val":"32"}},{type:"element",name:"w:szCs",attributes:{"w:val":"32"}}]}]},Heading3:{type:"element",name:"w:style",attributes:{"w:type":"paragraph","w:styleId":"Heading3"},elements:[{type:"element",name:"w:name",attributes:{"w:val":"heading 3"}},{type:"element",name:"w:basedOn",attributes:{"w:val":"Normal"}},{type:"element",name:"w:next",attributes:{"w:val":"Normal"}},{type:"element",name:"w:link",attributes:{"w:val":"Heading3Char"}},{type:"element",name:"w:uiPriority",attributes:{"w:val":"9"}},{type:"element",name:"w:semiHidden"},{type:"element",name:"w:unhideWhenUsed"},{type:"element",name:"w:qFormat"},{type:"element",name:"w:rsid",attributes:{"w:val":"00233D7B"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:keepNext"},{type:"element",name:"w:keepLines"},{type:"element",name:"w:spacing",attributes:{"w:before":"160","w:after":"80"}},{type:"element",name:"w:outlineLvl",attributes:{"w:val":"2"}}]},{type:"element",name:"w:rPr",elements:[{type:"element",name:"w:rFonts",attributes:{"w:eastAsiaTheme":"majorEastAsia","w:cstheme":"majorBidi"}},{type:"element",name:"w:color",attributes:{"w:val":"0F4761","w:themeColor":"accent1","w:themeShade":"BF"}},{type:"element",name:"w:sz",attributes:{"w:val":"28"}},{type:"element",name:"w:szCs",attributes:{"w:val":"28"}}]}]}},RE={declaration:{attributes:{version:"1.0",encoding:"UTF-8",standalone:"yes"}},elements:[{type:"element",name:"w:comments",attributes:{"xmlns:wpc":"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas","xmlns:cx":"http://schemas.microsoft.com/office/drawing/2014/chartex","xmlns:cx1":"http://schemas.microsoft.com/office/drawing/2015/9/8/chartex","xmlns:cx2":"http://schemas.microsoft.com/office/drawing/2015/10/21/chartex","xmlns:cx3":"http://schemas.microsoft.com/office/drawing/2016/5/9/chartex","xmlns:cx4":"http://schemas.microsoft.com/office/drawing/2016/5/10/chartex","xmlns:cx5":"http://schemas.microsoft.com/office/drawing/2016/5/11/chartex","xmlns:cx6":"http://schemas.microsoft.com/office/drawing/2016/5/12/chartex","xmlns:cx7":"http://schemas.microsoft.com/office/drawing/2016/5/13/chartex","xmlns:cx8":"http://schemas.microsoft.com/office/drawing/2016/5/14/chartex","xmlns:mc":"http://schemas.openxmlformats.org/markup-compatibility/2006","xmlns:aink":"http://schemas.microsoft.com/office/drawing/2016/ink","xmlns:am3d":"http://schemas.microsoft.com/office/drawing/2017/model3d","xmlns:o":"urn:schemas-microsoft-com:office:office","xmlns:oel":"http://schemas.microsoft.com/office/2019/extlst","xmlns:r":"http://schemas.openxmlformats.org/officeDocument/2006/relationships","xmlns:m":"http://schemas.openxmlformats.org/officeDocument/2006/math","xmlns:v":"urn:schemas-microsoft-com:vml","xmlns:wp14":"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing","xmlns:wp":"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing","xmlns:w10":"urn:schemas-microsoft-com:office:word","xmlns:w":"http://schemas.openxmlformats.org/wordprocessingml/2006/main","xmlns:w14":"http://schemas.microsoft.com/office/word/2010/wordml","xmlns:w15":"http://schemas.microsoft.com/office/word/2012/wordml","xmlns:w16cex":"http://schemas.microsoft.com/office/word/2018/wordml/cex","xmlns:w16cid":"http://schemas.microsoft.com/office/word/2016/wordml/cid","xmlns:w16":"http://schemas.microsoft.com/office/word/2018/wordml","xmlns:w16du":"http://schemas.microsoft.com/office/word/2023/wordml/word16du","xmlns:w16sdtdh":"http://schemas.microsoft.com/office/word/2020/wordml/sdtdatahash","xmlns:w16sdtfl":"http://schemas.microsoft.com/office/word/2024/wordml/sdtformatlock","xmlns:w16se":"http://schemas.microsoft.com/office/word/2015/wordml/symex","xmlns:wpg":"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup","xmlns:wpi":"http://schemas.microsoft.com/office/word/2010/wordprocessingInk","xmlns:wne":"http://schemas.microsoft.com/office/word/2006/wordml","xmlns:wps":"http://schemas.microsoft.com/office/word/2010/wordprocessingShape","mc:Ignorable":"w14 w15 w16se w16cid w16 w16cex w16sdtdh w16sdtfl w16du wp14"},elements:[]}]},LE={declaration:{attributes:{version:"1.0",encoding:"UTF-8",standalone:"yes"}},elements:[{type:"element",name:"w15:commentsEx",attributes:{"xmlns:wpc":"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas","xmlns:cx":"http://schemas.microsoft.com/office/drawing/2014/chartex","xmlns:cx1":"http://schemas.microsoft.com/office/drawing/2015/9/8/chartex","xmlns:cx2":"http://schemas.microsoft.com/office/drawing/2015/10/21/chartex","xmlns:cx3":"http://schemas.microsoft.com/office/drawing/2016/5/9/chartex","xmlns:cx4":"http://schemas.microsoft.com/office/drawing/2016/5/10/chartex","xmlns:cx5":"http://schemas.microsoft.com/office/drawing/2016/5/11/chartex","xmlns:cx6":"http://schemas.microsoft.com/office/drawing/2016/5/12/chartex","xmlns:cx7":"http://schemas.microsoft.com/office/drawing/2016/5/13/chartex","xmlns:cx8":"http://schemas.microsoft.com/office/drawing/2016/5/14/chartex","xmlns:mc":"http://schemas.openxmlformats.org/markup-compatibility/2006","xmlns:aink":"http://schemas.microsoft.com/office/drawing/2016/ink","xmlns:am3d":"http://schemas.microsoft.com/office/drawing/2017/model3d","xmlns:o":"urn:schemas-microsoft-com:office:office","xmlns:oel":"http://schemas.microsoft.com/office/2019/extlst","xmlns:r":"http://schemas.openxmlformats.org/officeDocument/2006/relationships","xmlns:m":"http://schemas.openxmlformats.org/officeDocument/2006/math","xmlns:v":"urn:schemas-microsoft-com:vml","xmlns:wp14":"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing","xmlns:wp":"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing","xmlns:w10":"urn:schemas-microsoft-com:office:word","xmlns:w":"http://schemas.openxmlformats.org/wordprocessingml/2006/main","xmlns:w14":"http://schemas.microsoft.com/office/word/2010/wordml","xmlns:w15":"http://schemas.microsoft.com/office/word/2012/wordml","xmlns:w16cex":"http://schemas.microsoft.com/office/word/2018/wordml/cex","xmlns:w16cid":"http://schemas.microsoft.com/office/word/2016/wordml/cid","xmlns:w16":"http://schemas.microsoft.com/office/word/2018/wordml","xmlns:w16du":"http://schemas.microsoft.com/office/word/2023/wordml/word16du","xmlns:w16sdtdh":"http://schemas.microsoft.com/office/word/2020/wordml/sdtdatahash","xmlns:w16sdtfl":"http://schemas.microsoft.com/office/word/2024/wordml/sdtformatlock","xmlns:w16se":"http://schemas.microsoft.com/office/word/2015/wordml/symex","xmlns:wpg":"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup","xmlns:wpi":"http://schemas.microsoft.com/office/word/2010/wordprocessingInk","xmlns:wne":"http://schemas.microsoft.com/office/word/2006/wordml","xmlns:wps":"http://schemas.microsoft.com/office/word/2010/wordprocessingShape","mc:Ignorable":"w14 w15 w16se w16cid w16 w16cex w16sdtdh w16sdtfl w16du wp14"},elements:[]}]},PE={declaration:{attributes:{version:"1.0",encoding:"UTF-8",standalone:"yes"}},elements:[{type:"element",name:"w16cex:commentsExtensible",attributes:{"xmlns:wpc":"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas","xmlns:cx":"http://schemas.microsoft.com/office/drawing/2014/chartex","xmlns:cx1":"http://schemas.microsoft.com/office/drawing/2015/9/8/chartex","xmlns:cx2":"http://schemas.microsoft.com/office/drawing/2015/10/21/chartex","xmlns:cx3":"http://schemas.microsoft.com/office/drawing/2016/5/9/chartex","xmlns:cx4":"http://schemas.microsoft.com/office/drawing/2016/5/10/chartex","xmlns:cx5":"http://schemas.microsoft.com/office/drawing/2016/5/11/chartex","xmlns:cx6":"http://schemas.microsoft.com/office/drawing/2016/5/12/chartex","xmlns:cx7":"http://schemas.microsoft.com/office/drawing/2016/5/13/chartex","xmlns:cx8":"http://schemas.microsoft.com/office/drawing/2016/5/14/chartex","xmlns:cr":"http://schemas.microsoft.com/office/comments/2020/reactions","xmlns:mc":"http://schemas.openxmlformats.org/markup-compatibility/2006","xmlns:aink":"http://schemas.microsoft.com/office/drawing/2016/ink","xmlns:am3d":"http://schemas.microsoft.com/office/drawing/2017/model3d","xmlns:o":"urn:schemas-microsoft-com:office:office","xmlns:oel":"http://schemas.microsoft.com/office/2019/extlst","xmlns:r":"http://schemas.openxmlformats.org/officeDocument/2006/relationships","xmlns:m":"http://schemas.openxmlformats.org/officeDocument/2006/math","xmlns:v":"urn:schemas-microsoft-com:vml","xmlns:wp14":"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing","xmlns:wp":"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing","xmlns:w10":"urn:schemas-microsoft-com:office:word","xmlns:w":"http://schemas.openxmlformats.org/wordprocessingml/2006/main","xmlns:w14":"http://schemas.microsoft.com/office/word/2010/wordml","xmlns:w15":"http://schemas.microsoft.com/office/word/2012/wordml","xmlns:w16cex":"http://schemas.microsoft.com/office/word/2018/wordml/cex","xmlns:w16cid":"http://schemas.microsoft.com/office/word/2016/wordml/cid","xmlns:w16":"http://schemas.microsoft.com/office/word/2018/wordml","xmlns:w16du":"http://schemas.microsoft.com/office/word/2023/wordml/word16du","xmlns:w16sdtdh":"http://schemas.microsoft.com/office/word/2020/wordml/sdtdatahash","xmlns:w16sdtfl":"http://schemas.microsoft.com/office/word/2024/wordml/sdtformatlock","xmlns:w16se":"http://schemas.microsoft.com/office/word/2015/wordml/symex","xmlns:wpg":"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup","xmlns:wpi":"http://schemas.microsoft.com/office/word/2010/wordprocessingInk","xmlns:wne":"http://schemas.microsoft.com/office/word/2006/wordml","xmlns:wps":"http://schemas.microsoft.com/office/word/2010/wordprocessingShape","mc:Ignorable":"w14 w15 w16se w16cid w16 w16cex w16sdtdh w16sdtfl cr w16du wp14"},elements:[]}]},zE={declaration:{attributes:{version:"1.0",encoding:"UTF-8",standalone:"yes"}},elements:[{type:"element",name:"w16cid:commentsIds",attributes:{"xmlns:wpc":"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas","xmlns:cx":"http://schemas.microsoft.com/office/drawing/2014/chartex","xmlns:cx1":"http://schemas.microsoft.com/office/drawing/2015/9/8/chartex","xmlns:cx2":"http://schemas.microsoft.com/office/drawing/2015/10/21/chartex","xmlns:cx3":"http://schemas.microsoft.com/office/drawing/2016/5/9/chartex","xmlns:cx4":"http://schemas.microsoft.com/office/drawing/2016/5/10/chartex","xmlns:cx5":"http://schemas.microsoft.com/office/drawing/2016/5/11/chartex","xmlns:cx6":"http://schemas.microsoft.com/office/drawing/2016/5/12/chartex","xmlns:cx7":"http://schemas.microsoft.com/office/drawing/2016/5/13/chartex","xmlns:cx8":"http://schemas.microsoft.com/office/drawing/2016/5/14/chartex","xmlns:mc":"http://schemas.openxmlformats.org/markup-compatibility/2006","xmlns:aink":"http://schemas.microsoft.com/office/drawing/2016/ink","xmlns:am3d":"http://schemas.microsoft.com/office/drawing/2017/model3d","xmlns:o":"urn:schemas-microsoft-com:office:office","xmlns:oel":"http://schemas.microsoft.com/office/2019/extlst","xmlns:r":"http://schemas.openxmlformats.org/officeDocument/2006/relationships","xmlns:m":"http://schemas.openxmlformats.org/officeDocument/2006/math","xmlns:v":"urn:schemas-microsoft-com:vml","xmlns:wp14":"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing","xmlns:wp":"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing","xmlns:w10":"urn:schemas-microsoft-com:office:word","xmlns:w":"http://schemas.openxmlformats.org/wordprocessingml/2006/main","xmlns:w14":"http://schemas.microsoft.com/office/word/2010/wordml","xmlns:w15":"http://schemas.microsoft.com/office/word/2012/wordml","xmlns:w16cex":"http://schemas.microsoft.com/office/word/2018/wordml/cex","xmlns:w16cid":"http://schemas.microsoft.com/office/word/2016/wordml/cid","xmlns:w16":"http://schemas.microsoft.com/office/word/2018/wordml","xmlns:w16du":"http://schemas.microsoft.com/office/word/2023/wordml/word16du","xmlns:w16sdtdh":"http://schemas.microsoft.com/office/word/2020/wordml/sdtdatahash","xmlns:w16sdtfl":"http://schemas.microsoft.com/office/word/2024/wordml/sdtformatlock","xmlns:w16se":"http://schemas.microsoft.com/office/word/2015/wordml/symex","xmlns:wpg":"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup","xmlns:wpi":"http://schemas.microsoft.com/office/word/2010/wordprocessingInk","xmlns:wne":"http://schemas.microsoft.com/office/word/2006/wordml","xmlns:wps":"http://schemas.microsoft.com/office/word/2010/wordprocessingShape","mc:Ignorable":"w14 w15 w16se w16cid w16 w16cex w16sdtdh w16sdtfl w16du wp14"},elements:[]}]},jE={elements:[{type:"element",name:"Relationships",attributes:{xmlns:"http://schemas.openxmlformats.org/package/2006/relationships"},elements:[{type:"element",name:"Relationship",attributes:{Id:"rId8",Type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable",Target:"fontTable.xml"}},{type:"element",name:"Relationship",attributes:{Id:"rId3",Type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/webSettings",Target:"webSettings.xml"}},{type:"element",name:"Relationship",attributes:{Id:"rId7",Type:"http://schemas.microsoft.com/office/2018/08/relationships/commentsExtensible",Target:"commentsExtensible.xml"}},{type:"element",name:"Relationship",attributes:{Id:"rId2",Type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings",Target:"settings.xml"}},{type:"element",name:"Relationship",attributes:{Id:"rId1",Type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles",Target:"styles.xml"}},{type:"element",name:"Relationship",attributes:{Id:"rId6",Type:"http://schemas.microsoft.com/office/2016/09/relationships/commentsIds",Target:"commentsIds.xml"}},{type:"element",name:"Relationship",attributes:{Id:"rId5",Type:"http://schemas.microsoft.com/office/2011/relationships/commentsExtended",Target:"commentsExtended.xml"}},{type:"element",name:"Relationship",attributes:{Id:"rId10",Type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme",Target:"theme/theme1.xml"}},{type:"element",name:"Relationship",attributes:{Id:"rId4",Type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments",Target:"comments.xml"}}]}]},qE={declaration:{attributes:{version:"1.0",encoding:"UTF-8",standalone:"yes"}},elements:[{type:"element",name:"Types",attributes:{xmlns:"http://schemas.openxmlformats.org/package/2006/content-types"},elements:[{type:"element",name:"Default",attributes:{Extension:"rels",ContentType:"application/vnd.openxmlformats-package.relationships+xml"}},{type:"element",name:"Default",attributes:{Extension:"xml",ContentType:"application/xml"}},{type:"element",name:"Override",attributes:{PartName:"/word/document.xml",ContentType:"application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml"}},{type:"element",name:"Override",attributes:{PartName:"/word/styles.xml",ContentType:"application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml"}},{type:"element",name:"Override",attributes:{PartName:"/word/settings.xml",ContentType:"application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml"}},{type:"element",name:"Override",attributes:{PartName:"/word/webSettings.xml",ContentType:"application/vnd.openxmlformats-officedocument.wordprocessingml.webSettings+xml"}},{type:"element",name:"Override",attributes:{PartName:"/word/comments.xml",ContentType:"application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml"}},{type:"element",name:"Override",attributes:{PartName:"/word/commentsExtended.xml",ContentType:"application/vnd.openxmlformats-officedocument.wordprocessingml.commentsExtended+xml"}},{type:"element",name:"Override",attributes:{PartName:"/word/commentsIds.xml",ContentType:"application/vnd.openxmlformats-officedocument.wordprocessingml.commentsIds+xml"}},{type:"element",name:"Override",attributes:{PartName:"/word/commentsExtensible.xml",ContentType:"application/vnd.openxmlformats-officedocument.wordprocessingml.commentsExtensible+xml"}},{type:"element",name:"Override",attributes:{PartName:"/word/fontTable.xml",ContentType:"application/vnd.openxmlformats-officedocument.wordprocessingml.fontTable+xml"}},{type:"element",name:"Override",attributes:{PartName:"/word/people.xml",ContentType:"application/vnd.openxmlformats-officedocument.wordprocessingml.people+xml"}},{type:"element",name:"Override",attributes:{PartName:"/word/theme/theme1.xml",ContentType:"application/vnd.openxmlformats-officedocument.theme+xml"}},{type:"element",name:"Override",attributes:{PartName:"/docProps/core.xml",ContentType:"application/vnd.openxmlformats-package.core-properties+xml"}},{type:"element",name:"Override",attributes:{PartName:"/docProps/app.xml",ContentType:"application/vnd.openxmlformats-officedocument.extended-properties+xml"}},{type:"element",name:"Override",attributes:{PartName:"/word/numbering.xml",ContentType:"application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml"}}]}]},Do={COMMENTS_XML_DEF:RE,COMMENTS_EXTENDED_XML_DEF:LE,COMMENTS_EXTENSIBLE_XML_DEF:PE,COMMENTS_IDS_XML_DEF:zE,DOCUMENT_RELS_XML_DEF:jE,CONTENT_TYPES:qE},Ft="trackInsert",ut="trackDelete",vt="trackFormat",sn=t=>{if(t)try{return JSON.parse(JSON.stringify(t))}catch(e){console.error("Error in carbonCopy",t,e);return}},iv={declaration:{attributes:{version:"1.0",encoding:"UTF-8",standalone:"yes"}},elements:[{type:"element",name:"w:numbering",attributes:{"xmlns:wpc":"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas","xmlns:cx":"http://schemas.microsoft.com/office/drawing/2014/chartex","xmlns:cx1":"http://schemas.microsoft.com/office/drawing/2015/9/8/chartex","xmlns:cx2":"http://schemas.microsoft.com/office/drawing/2015/10/21/chartex","xmlns:cx3":"http://schemas.microsoft.com/office/drawing/2016/5/9/chartex","xmlns:cx4":"http://schemas.microsoft.com/office/drawing/2016/5/10/chartex","xmlns:cx5":"http://schemas.microsoft.com/office/drawing/2016/5/11/chartex","xmlns:cx6":"http://schemas.microsoft.com/office/drawing/2016/5/12/chartex","xmlns:cx7":"http://schemas.microsoft.com/office/drawing/2016/5/13/chartex","xmlns:cx8":"http://schemas.microsoft.com/office/drawing/2016/5/14/chartex","xmlns:mc":"http://schemas.openxmlformats.org/markup-compatibility/2006","xmlns:aink":"http://schemas.microsoft.com/office/drawing/2016/ink","xmlns:am3d":"http://schemas.microsoft.com/office/drawing/2017/model3d","xmlns:o":"urn:schemas-microsoft-com:office:office","xmlns:oel":"http://schemas.microsoft.com/office/2019/extlst","xmlns:r":"http://schemas.openxmlformats.org/officeDocument/2006/relationships","xmlns:m":"http://schemas.openxmlformats.org/officeDocument/2006/math","xmlns:v":"urn:schemas-microsoft-com:vml","xmlns:wp14":"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing","xmlns:wp":"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing","xmlns:w10":"urn:schemas-microsoft-com:office:word","xmlns:w":"http://schemas.openxmlformats.org/wordprocessingml/2006/main","xmlns:w14":"http://schemas.microsoft.com/office/word/2010/wordml","xmlns:w15":"http://schemas.microsoft.com/office/word/2012/wordml","xmlns:w16cex":"http://schemas.microsoft.com/office/word/2018/wordml/cex","xmlns:w16cid":"http://schemas.microsoft.com/office/word/2016/wordml/cid","xmlns:w16":"http://schemas.microsoft.com/office/word/2018/wordml","xmlns:w16du":"http://schemas.microsoft.com/office/word/2023/wordml/word16du","xmlns:w16sdtdh":"http://schemas.microsoft.com/office/word/2020/wordml/sdtdatahash","xmlns:w16se":"http://schemas.microsoft.com/office/word/2015/wordml/symex","xmlns:wpg":"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup","xmlns:wpi":"http://schemas.microsoft.com/office/word/2010/wordprocessingInk","xmlns:wne":"http://schemas.microsoft.com/office/word/2006/wordml","xmlns:wps":"http://schemas.microsoft.com/office/word/2010/wordprocessingShape","mc:Ignorable":"w14 w15 w16se w16cid w16 w16cex w16sdtdh w16du wp14"},elements:[{type:"element",name:"w:abstractNum",attributes:{"w:abstractNumId":"0","w15:restartNumberingAfterBreak":"0"},elements:[{type:"element",name:"w:nsid",attributes:{"w:val":"16126B07"}},{type:"element",name:"w:multiLevelType",attributes:{"w:val":"hybridMultilevel"}},{type:"element",name:"w:tmpl",attributes:{"w:val":"51EC4E08"}},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"0","w:tplc":"04090001"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"bullet"}},{type:"element",name:"w:lvlText",attributes:{"w:val":""}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"left"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"720","w:hanging":"360"}}]},{type:"element",name:"w:rPr",elements:[{type:"element",name:"w:rFonts",attributes:{"w:ascii":"Symbol","w:hAnsi":"Symbol","w:hint":"default"}}]}]},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"1","w:tplc":"04090003","w:tentative":"1"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"bullet"}},{type:"element",name:"w:lvlText",attributes:{"w:val":"o"}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"left"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"1440","w:hanging":"360"}}]},{type:"element",name:"w:rPr",elements:[{type:"element",name:"w:rFonts",attributes:{"w:ascii":"Courier New","w:hAnsi":"Courier New","w:cs":"Courier New","w:hint":"default"}}]}]},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"2","w:tplc":"04090005","w:tentative":"1"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"bullet"}},{type:"element",name:"w:lvlText",attributes:{"w:val":""}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"left"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"2160","w:hanging":"360"}}]},{type:"element",name:"w:rPr",elements:[{type:"element",name:"w:rFonts",attributes:{"w:ascii":"Wingdings","w:hAnsi":"Wingdings","w:hint":"default"}}]}]},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"3","w:tplc":"04090001","w:tentative":"1"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"bullet"}},{type:"element",name:"w:lvlText",attributes:{"w:val":""}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"left"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"2880","w:hanging":"360"}}]},{type:"element",name:"w:rPr",elements:[{type:"element",name:"w:rFonts",attributes:{"w:ascii":"Symbol","w:hAnsi":"Symbol","w:hint":"default"}}]}]},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"4","w:tplc":"04090003","w:tentative":"1"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"bullet"}},{type:"element",name:"w:lvlText",attributes:{"w:val":"o"}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"left"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"3600","w:hanging":"360"}}]},{type:"element",name:"w:rPr",elements:[{type:"element",name:"w:rFonts",attributes:{"w:ascii":"Courier New","w:hAnsi":"Courier New","w:cs":"Courier New","w:hint":"default"}}]}]},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"5","w:tplc":"04090005","w:tentative":"1"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"bullet"}},{type:"element",name:"w:lvlText",attributes:{"w:val":""}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"left"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"4320","w:hanging":"360"}}]},{type:"element",name:"w:rPr",elements:[{type:"element",name:"w:rFonts",attributes:{"w:ascii":"Wingdings","w:hAnsi":"Wingdings","w:hint":"default"}}]}]},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"6","w:tplc":"04090001","w:tentative":"1"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"bullet"}},{type:"element",name:"w:lvlText",attributes:{"w:val":""}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"left"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"5040","w:hanging":"360"}}]},{type:"element",name:"w:rPr",elements:[{type:"element",name:"w:rFonts",attributes:{"w:ascii":"Symbol","w:hAnsi":"Symbol","w:hint":"default"}}]}]},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"7","w:tplc":"04090003","w:tentative":"1"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"bullet"}},{type:"element",name:"w:lvlText",attributes:{"w:val":"o"}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"left"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"5760","w:hanging":"360"}}]},{type:"element",name:"w:rPr",elements:[{type:"element",name:"w:rFonts",attributes:{"w:ascii":"Courier New","w:hAnsi":"Courier New","w:cs":"Courier New","w:hint":"default"}}]}]},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"8","w:tplc":"04090005","w:tentative":"1"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"bullet"}},{type:"element",name:"w:lvlText",attributes:{"w:val":""}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"left"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"6480","w:hanging":"360"}}]},{type:"element",name:"w:rPr",elements:[{type:"element",name:"w:rFonts",attributes:{"w:ascii":"Wingdings","w:hAnsi":"Wingdings","w:hint":"default"}}]}]}]},{type:"element",name:"w:abstractNum",attributes:{"w:abstractNumId":"1","w15:restartNumberingAfterBreak":"0"},elements:[{type:"element",name:"w:nsid",attributes:{"w:val":"587013BA"}},{type:"element",name:"w:multiLevelType",attributes:{"w:val":"hybridMultilevel"}},{type:"element",name:"w:tmpl",attributes:{"w:val":"EE6417C4"}},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"0","w:tplc":"0409000F"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"decimal"}},{type:"element",name:"w:lvlText",attributes:{"w:val":"%1."}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"left"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"720","w:hanging":"360"}}]}]},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"1","w:tplc":"04090019","w:tentative":"1"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"lowerLetter"}},{type:"element",name:"w:lvlText",attributes:{"w:val":"%2."}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"left"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"1440","w:hanging":"360"}}]}]},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"2","w:tplc":"0409001B","w:tentative":"1"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"lowerRoman"}},{type:"element",name:"w:lvlText",attributes:{"w:val":"%3."}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"right"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"2160","w:hanging":"180"}}]}]},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"3","w:tplc":"0409000F","w:tentative":"1"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"decimal"}},{type:"element",name:"w:lvlText",attributes:{"w:val":"%4."}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"left"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"2880","w:hanging":"360"}}]}]},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"4","w:tplc":"04090019","w:tentative":"1"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"lowerLetter"}},{type:"element",name:"w:lvlText",attributes:{"w:val":"%5."}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"left"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"3600","w:hanging":"360"}}]}]},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"5","w:tplc":"0409001B","w:tentative":"1"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"lowerRoman"}},{type:"element",name:"w:lvlText",attributes:{"w:val":"%6."}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"right"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"4320","w:hanging":"180"}}]}]},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"6","w:tplc":"0409000F","w:tentative":"1"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"decimal"}},{type:"element",name:"w:lvlText",attributes:{"w:val":"%7."}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"left"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"5040","w:hanging":"360"}}]}]},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"7","w:tplc":"04090019","w:tentative":"1"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"lowerLetter"}},{type:"element",name:"w:lvlText",attributes:{"w:val":"%8."}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"left"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"5760","w:hanging":"360"}}]}]},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"8","w:tplc":"0409001B","w:tentative":"1"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"lowerRoman"}},{type:"element",name:"w:lvlText",attributes:{"w:val":"%9."}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"right"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"6480","w:hanging":"180"}}]}]}]},{type:"element",name:"w:num",attributes:{"w:numId":"1","w16cid:durableId":"100147962"},elements:[{type:"element",name:"w:abstractNumId",attributes:{"w:val":"0"}}]},{type:"element",name:"w:num",attributes:{"w:numId":"2","w16cid:durableId":"485517411"},elements:[{type:"element",name:"w:abstractNumId",attributes:{"w:val":"1"}}]}]}]};function og(t,e){const{node:n,commentsExportType:r,exportedCommentDefs:o=[]}=t;if(!o.length||r==="clean")return;const i=n.attrs["w:id"],s=t.comments.find(f=>f.commentId==i);if(!s)return;const a=t.comments?.findIndex(f=>f.commentId===s.commentId),l=s.parentCommentId;let c;l&&(c=t.comments.find(f=>f.commentId===l||f.importedId===l));const u=c?.isInternal||s.isInternal;if(r==="external"&&u||s.resolvedTime)return;let d=UE(e,a);if(e==="End"){const f={name:"w:r",elements:[{name:"w:commentReference",attributes:{"w:id":String(a)}}]};d=[d,f]}return d}const UE=(t,e)=>({name:`w:commentRange${t}`,attributes:{"w:id":String(e)}}),VE=t=>({...t,commentParaId:If()}),HE=(t,e,n)=>{const r=av({node:t.commentJSON}),o={"w:id":String(e),"w:author":t.creatorName||t.importedAuthor?.name,"w:email":t.creatorEmail||t.importedAuthor?.email,"w:date":sv(t.createdTime),"w:initials":WE(t.creatorName),"w:done":t.resolvedTime?"1":"0","w15:paraId":t.commentParaId,"custom:internalId":t.commentId||t.internalId,"custom:trackedChange":t.trackedChange,"custom:trackedChangeText":t.trackedChangeText||null,"custom:trackedChangeType":t.trackedChangeType,"custom:trackedDeletedText":t.deletedText||null};if(t?.parentCommentId){const i=n.find(s=>s.commentId===t.parentCommentId);o["w15:paraIdParent"]=i.commentParaId}return{type:"element",name:"w:comment",attributes:o,elements:[r]}},WE=t=>t?t.replace("(imported)","").trim().split(" ").map(e=>e[0]).join(""):null,sv=t=>new Date(t||Date.now()).toISOString().replace(/\.\d{3}Z$/,"Z"),GE=(t=[],e)=>{const n=sn(e);return t.forEach(r=>{r.elements[0].elements.unshift(BE);const o=r.attributes["w15:paraId"];r.elements[0].attributes["w14:paraId"]=o,r.attributes={"w:id":r.attributes["w:id"],"w:author":r.attributes["w:author"],"w:email":r.attributes["w:email"],"w:date":r.attributes["w:date"],"w:initials":r.attributes["w:initials"],"custom:internalId":r.attributes["custom:internalId"],"custom:trackedChange":r.attributes["custom:trackedChange"],"custom:trackedChangeText":r.attributes["custom:trackedChangeText"],"custom:trackedChangeType":r.attributes["custom:trackedChangeType"],"custom:trackedDeletedText":r.attributes["custom:trackedDeletedText"],"xmlns:custom":"http://schemas.openxmlformats.org/wordprocessingml/2006/main"}}),n.elements[0].elements=t,n},KE=(t=[],e)=>{const n=sn(e),r=t.map(o=>{const i={"w15:paraId":o.commentParaId,"w15:done":o.resolvedTime?"1":"0"},s=o.parentCommentId;if(s){const a=t.find(l=>l.commentId===s);i["w15:paraIdParent"]=a.commentParaId}return{type:"element",name:"w15:commentEx",attributes:i}});return n.elements[0].elements=r,n},JE=(t=[],e,n)=>{const r=sn(e),o=sn(n);return r.elements[0].elements=[],o.elements[0].elements=[],t.forEach(i=>{const s=If(),a={type:"element",name:"w16cid:commentId",attributes:{"w16cid:paraId":i.commentParaId,"w16cid:durableId":s}};r.elements[0].elements.push(a);const l={type:"element",name:"w16cex:commentExtensible",attributes:{"w16cex:durableId":s,"w16cex:dateUtc":sv()}};o.elements[0].elements.push(l)}),{documentIdsUpdated:r,extensibleUpdated:o}},XE=t=>{const e=sn(t);return e["word/comments.xml"]=Do.COMMENTS_XML_DEF,e["word/commentsExtended.xml"]=Do.COMMENTS_EXTENDED_XML_DEF,e["word/commentsExtensible.xml"]=Do.COMMENTS_EXTENSIBLE_XML_DEF,e["word/commentsIds.xml"]=Do.COMMENTS_IDS_XML_DEF,e["[Content_Types].xml"]=Do.CONTENT_TYPES,e},YE=t=>{const e=sn(t);return delete e["word/comments.xml"],delete e["word/commentsExtended.xml"],delete e["word/commentsExtensible.xml"],delete e["word/commentsIds.xml"],e},Ks=t=>({...Do.DOCUMENT_RELS_XML_DEF.elements[0].elements.find(e=>e.attributes.Target===t)}),ZE=({convertedXml:t,defs:e,commentsWithParaIds:n,exportType:r,converter:o})=>{const i=[];if(r==="clean")return{documentXml:YE(t),relationships:i};const s=XE(t);s["word/comments.xml"]=GE(e,s["word/comments.xml"]),i.push(Ks("comments.xml")),s["word/commentsExtended.xml"]=KE(n,s["word/commentsExtended.xml"]),i.push(Ks("commentsExtended.xml"));const{documentIdsUpdated:a,extensibleUpdated:l}=JE(n,s["word/commentsIds.xml"],s["word/commentsExtensible.xml"]);return s["word/commentsIds.xml"]=a,s["word/commentsExtensible.xml"]=l,i.push(Ks("commentsIds.xml")),i.push(Ks("commentsExtensible.xml")),{relationships:i,documentXml:s}};function fi(t){const{type:e}=t.node||{},n={doc:tA,body:QE,paragraph:av,text:nA,bulletList:sg,orderedList:sg,lineBreak:cA,table:uA,tableRow:gA,tableCell:wA,bookmarkStart:xA,fieldAnnotation:OA,tab:fA,image:uv,hardBreak:MA,commentRangeStart:()=>og(t,"Start"),commentRangeEnd:()=>og(t,"End"),commentReference:()=>null};return n[e]?n[e](t):(console.error("No translation function found for node type:",e),null)}function QE(t){const e=t.bodyNode?.elements.find(n=>n.name==="w:sectPr")||{};if(t.converter){const n=t.converter.pageStyles.pageMargins,r=e.elements.find(i=>i.name==="w:pgMar"),{attributes:o}=r;Object.entries(n).forEach(([i,s])=>{const a=lo(s);o[`w:${i}`]=a}),r.attributes=o}return{name:"w:body",elements:[...pi(t),e]}}function av(t){const e=pi(t),n=e.find(i=>i.name==="htmlAnnotation");if(e.length===1&&n)return n.elements;const r=eA(t.node);r&&e.unshift(r);let o={};return t.node.attrs?.rsidRDefault&&(o["w:rsidRDefault"]=t.node.attrs.rsidRDefault),{name:"w:p",elements:e,attributes:o}}function eA(t){const{attrs:e={}}=t,n=[],{styleId:r}=e;r&&n.push({name:"w:pStyle",attributes:{"w:val":r}});const{spacing:o,indent:i,textAlign:s,textIndent:a,marksAttrs:l,keepLines:c,keepNext:u}=e;if(o){const{lineSpaceBefore:d,lineSpaceAfter:f,line:p,lineRule:h}=o,m={};d>=0&&(m["w:before"]=ct(d)),f>=0&&(m["w:after"]=ct(f)),p&&(m["w:line"]=nv(p)),m["w:lineRule"]=h||"auto";const y={name:"w:spacing",attributes:m};n.push(y)}if(i){const{left:d,right:f,firstLine:p,hanging:h}=i,m={};(d||d===0)&&(m["w:left"]=ct(d)),(f||f===0)&&(m["w:right"]=ct(f)),(p||p===0)&&(m["w:firstLine"]=ct(p)),(h||h===0)&&(m["w:hanging"]=ct(h)),a&&!m["w:left"]&&(m["w:left"]=lo(a));const y={name:"w:ind",attributes:m};n.push(y)}else if(a){const d={name:"w:ind",attributes:{"w:left":lo(a)}};n.push(d)}if(s){const d={name:"w:jc",attributes:{"w:val":s}};n.push(d)}if(l){const d=_l(l),f=lv(d);n.push(f)}return c&&n.push({name:"w:keepLines",attributes:{"w:val":c}}),u&&n.push({name:"w:keepNext",attributes:{"w:val":u}}),n.length?{name:"w:pPr",elements:n}:null}function tA(t){const e={type:"body",content:t.node.content};return[{name:"w:document",elements:[fi({...t,node:e})],attributes:DE},t]}function pi(t){const{content:e}=t.node;if(!e)return[];const n=[];return e.forEach(r=>{const o=fi({...t,node:r});o instanceof Array?n.push(...o):n.push(o)}),n.filter(r=>r)}function Ml(t,e){const n=/^\s|\s$/.test(t)?"preserve":null,r=n?{"xml:space":n}:null,o=_l(e);return Ff({name:"w:t",elements:[{text:t,type:"text"}],attributes:r},o)}function nA(t){const{node:e}=t,n=[Ft,ut];if(e.marks?.some(i=>n.includes(i.type)))return oA(t);if(e.marks?.some(i=>i.type==="link"))return iA(t);const{text:r,marks:o=[]}=e;return Ml(r,o)}function rA(t){const e=t.find(n=>n.type===vt);if(e)return{type:"element",name:"w:rPrChange",attributes:{"w:id":e.attrs.id,"w:author":e.attrs.author,"w:authorEmail":e.attrs.authorEmail,"w:date":e.attrs.date},elements:e.attrs.before.map(n=>_l([n])).filter(n=>n!==void 0)}}function oA(t){const{node:e}=t,n=e.marks,r=[Ft,ut,vt],o=n.find(l=>r.includes(l.type)),i=o.type===Ft,s=rA(n);e.marks=n.filter(l=>!r.includes(l.type)),s&&e.marks.push(s);const a=fi({...t,node:e});if(!i){const l=a.elements.find(c=>c.name==="w:t");l.name="w:delText"}return{name:i?"w:ins":"w:del",type:"element",attributes:{"w:id":o.attrs.id,"w:author":o.attrs.author,"w:authorEmail":o.attrs.authorEmail,"w:date":o.attrs.date},elements:[a]}}function Ff(t,e){const n=[t];return e&&e.length&&n.unshift(lv(e)),{name:"w:r",elements:n}}function lv(t=[]){return{name:"w:rPr",elements:t.filter(e=>!!Object.keys(e).length)}}function _l(t=[]){return t.flatMap(e=>e.type==="textStyle"?Object.entries(e.attrs).filter(([n,r])=>r).map(([n,r])=>{const o={type:n,attrs:e.attrs};return ag(o)}):ag(e))}function iA(t){const{node:e}=t,n=e.marks.find(s=>s.type==="link"),r=n.attrs.href;let o=n.attrs.rId;o||(o=cv(t,r)),e.marks=e.marks.filter(s=>s.type!=="link");const i=fi({...t,node:e});return{name:"w:hyperlink",type:"element",attributes:{"r:id":o},elements:[i]}}function cv(t,e){const n="rId"+Jn();return(!t.relationships||!Array.isArray(t.relationships))&&(t.relationships=[]),t.relationships.push({type:"element",name:"Relationship",attributes:{Id:n,Type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink",Target:e,TargetMode:"External"}}),n}function ig(t,e){const n="rId"+Jn(),r={type:"element",name:"Relationship",attributes:{Id:n,Type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",Target:e}};return t.relationships.push(r),n}function sg(t){const{type:e}=t.node,n=lA(t),r=[];return n.forEach(o=>{const{level:i,listType:s,pPrs:a,content:l,attrs:c={}}=o,u=(o.attrs.numId||o.listId)??sA(t),d=aA(i,u,a);l.forEach((f,p)=>{const h=Object.assign({},f);h.attrs={...h.attrs,...o.attrs};const m=fi({...t,node:h});m.elements||(m.elements=[]);const y=m.elements.findIndex(k=>k.name==="w:pPr");if(!m.elements.filter(k=>k.name!=="w:pPr").length){const k=m.elements[y]?.elements.find(T=>T.name==="w:spacing"),b={name:"w:p",type:"element",elements:k?[{name:"w:pPr",type:"element",elements:[k]}]:[]};return r.push(b)}const{attributes:g}=c,{originalInlineRunProps:x}=g||{};if(x&&d.elements.push(x),y===-1?m.elements.unshift(sn(d)):m.elements[y]=sn(d),p!==0){const k=m.elements.find(T=>T.name==="w:pPr"),b=k.elements.findIndex(T=>T.name==="w:numPr");b!==-1&&k.elements.splice(b,1)}r.push(m)})}),r}function sA({abstractId:t,listId:e}){const n={...definition,attributes:{...definition.attributes,"w:abstractNumId":t}},r={type:"element",name:"w:num",attributes:{"w:numId":String(t),"w16cid:durableId":"485517411"},elements:[{name:"w:abstractNumId",attributes:{"w:val":String(e)}}]};return{newAbstractDef:n,newNumDef:r}}function aA(t,e,n=[]){return{name:"w:pPr",type:"element",elements:[{name:"w:numPr",type:"element",elements:[{name:"w:ilvl",type:"element",attributes:{"w:val":t}},{name:"w:numId",type:"element",attributes:{"w:val":e}}]},...n]}}function lA({node:t}){const{content:e,attrs:n={}}=t,{listId:r,syncId:o}=t.attrs||{},i=t.attrs["list-style-type"],{attributes:s={}}=n,a=s?.parentAttributes?.paragraphProperties?.elements?.filter(u=>u.name!=="w:numPr")||[],l=[];function c(u,d=0){!u||!u.length||u.forEach(f=>{const p=f.attrs?.indent;if(p){const{left:g,right:x,firstLine:k,hanging:b}=p,T={};g!==void 0&&(T["w:left"]=ct(g)),x!==void 0&&(T["w:right"]=ct(x)),k!==void 0&&(T["w:firstLine"]=ct(k)),b!==void 0&&(T["w:hanging"]=ct(b));const M={type:"element",name:"w:ind",indentAttrs:T},_=a.findIndex(F=>F.name==="w:ind");_!==-1&&(a[_]=M)}const h=f.content?.filter(g=>g.type==="bulletList"||g.type==="orderedList")||[],m=f.content?.filter(g=>g.type!=="bulletList"&&g.type!=="orderedList")||[],y={...f,content:m,listId:r,level:d,listType:i,syncId:o,pPrs:a};l.push(y),h.length&&c(h[0].content,d+1)})}return c(e),l}function cA(t){const e={},{lineBreakType:n}=t.node?.attrs||{};return n&&(e["w:type"]=n),{name:"w:br",attributes:e}}function uA(t){t.node=dA(t.node,t);const e=pi(t),n=pA(t.node),r=mA(t.node);return e.unshift(n),e.unshift(r),{name:"w:tbl",elements:e}}function dA(t,{editorSchema:e}){const{content:n}=t;for(let r=0;r<n.length;r++){const o=n[r];if(o.content)for(let i=0;i<o.content?.length;i++){const s=o.content[i];if(!s){console.log("no cell");continue}const{attrs:a}=s;if(a.rowspan>1){const l=n.slice(r+1,r+a.rowspan),c={type:s.type,content:[e.nodes.paragraph.createAndFill().toJSON()],attrs:{...s.attrs,colspan:null,rowspan:null,continueMerge:!0}};l.forEach((u,d)=>{u.content.splice(i,0,c)})}}}return t}function fA(t){const{marks:e=[]}=t.node,n=_l(e);return Ff({name:"w:tab"},n)}function pA(t){const e=[],{attrs:n}=t,{tableWidth:r,tableWidthType:o,tableStyleId:i,borders:s,tableIndent:a,tableLayout:l,tableCellSpacing:c}=n;if(i){const u={name:"w:tblStyle",attributes:{"w:val":i}};e.push(u)}if(s){const u=hA(t);e.push(u)}if(a){const{width:u,type:d}=a,f={name:"w:tblInd",attributes:{"w:w":ct(u),"w:type":d}};e.push(f)}if(l){const u={name:"w:tblLayout",attributes:{"w:type":l}};e.push(u)}if(r&&r.width){const u={name:"w:tblW",attributes:{"w:w":ct(r.width),"w:type":r.type}};e.push(u)}return c&&e.push({name:"w:tblCellSpacing",attributes:{"w:w":c.w,"w:type":c.type}}),{name:"w:tblPr",elements:e}}function hA(t){const{borders:e}=t.attrs,n=[];return e?(["top","bottom","left","right","insideH","insideV"].forEach(r=>{const o=e[r];if(!o)return;let i={};!Object.keys(o).length||!o.size?i={"w:val":"nil"}:i={"w:val":"single","w:sz":ov(o.size),"w:space":o.space||0,"w:color":o?.color?.substring(1)||"000000"};const s={name:`w:${r}`,attributes:i};n.push(s)}),{name:"w:tblBorders",elements:n}):void 0}function mA(t){const{gridColumnWidths:e}=t.attrs,n=[];return e?.forEach(r=>{n.push({name:"w:gridCol",attributes:{"w:w":lo(r)}})}),{name:"w:tblGrid",elements:n}}function gA(t){const e=pi(t),n=yA(t.node);return n.elements.length&&e.unshift(n),{name:"w:tr",elements:e}}function yA(t){const{attrs:e}=t,n=[],{rowHeight:r,rowHeightType:o}=e;if(r){const i={"w:val":ct(r)};o&&(i["w:hRule"]=o);const s={name:"w:trHeight",attributes:i};n.push(s)}return{name:"w:trPr",elements:n}}function wA(t){const e=pi({...t,tableCell:t.node}),n=bA(t.node);return e.unshift(n),{name:"w:tc",elements:e}}function bA(t){const e=[],{attrs:n}=t,{colwidth:r=[],cellWidthType:o="dxa",background:i={},colspan:s,rowspan:a,widthUnit:l}=n,c=r.reduce((m,y)=>m+y,0),u={name:"w:tcW",attributes:{"w:w":l==="px"?ct(c):lo(c),"w:type":o}};if(e.push(u),s){const m={name:"w:gridSpan",attributes:{"w:val":`${s}`}};e.push(m)}const{color:d}=i||{};if(d){const m={name:"w:shd",attributes:{"w:fill":d}};e.push(m)}const{cellMargins:f}=n;if(f){const m={name:"w:tcMar",elements:vA(f)};e.push(m)}const{verticalAlign:p}=n;if(p){const m={name:"w:vAlign",attributes:{"w:val":p}};e.push(m)}if(a&&a>1){const m={name:"w:vMerge",type:"element",attributes:{"w:val":"restart"}};e.push(m)}else if(n.continueMerge){const m={name:"w:vMerge",type:"element"};e.push(m)}const{borders:h={}}=n;if(h&&Object.keys(h).length){const m={name:"w:tcBorders",elements:Object.entries(h).map(([y,g])=>g.size?{name:`w:${y}`,attributes:{"w:val":"single","w:color":g.color?g.color.substring(1):"auto","w:sz":ov(g.size),"w:space":g.space||0}}:{name:`w:${y}`,attributes:{"w:val":"nil"}})};e.push(m)}return{name:"w:tcPr",elements:e}}function vA(t){const e=[],{top:n,right:r,bottom:o,left:i}=t;return n!=null&&e.push({name:"w:top",attributes:{"w:w":ct(n)}}),r!=null&&e.push({name:"w:right",attributes:{"w:w":ct(r)}}),o!=null&&e.push({name:"w:bottom",attributes:{"w:w":ct(o)}}),i!=null&&e.push({name:"w:left",attributes:{"w:w":ct(i)}}),e}function xA(t){const e={name:"w:bookmarkStart",attributes:{"w:id":t.node.attrs.id,"w:name":t.node.attrs.name}},n={name:"w:bookmarkEnd",attributes:{"w:id":t.node.attrs.id}};return[e,n]}function ag(t){const e=$r.markTypes.find(i=>i.type===t.type);if(!e)return{};const n={name:e.name,attributes:{}},{attrs:r}=t;let o;switch(t.type){case"bold":case"italic":delete n.attributes,n.type="element";break;case"underline":n.type="element",n.attributes["w:val"]=r.underlineType;break;case"fontSize":o=r.fontSize,n.attributes["w:val"]=o.slice(0,-2)*2;break;case"fontFamily":o=r.fontFamily,["w:ascii","w:eastAsia","w:hAnsi","w:cs"].forEach(s=>{n.attributes[s]=o});break;case"color":let i=r.color.replace(/^#/,"").replace(/;$/,"");i.startsWith("rgb")&&(i=NE(i)),n.attributes["w:val"]=i;break;case"textAlign":n.attributes["w:val"]=r.textAlign;break;case"textIndent":n.attributes["w:firstline"]=lo(r.textIndent);break;case"lineHeight":n.attributes["w:line"]=nv(r.lineHeight);break;case"highlight":n.attributes["w:fill"]=r.color?.substring(1),n.attributes["w:color"]="auto",n.attributes["w:val"]="clear",n.name="w:shd";break}return n}function kA(t){if(!t)return{};const e=t.split(";")[0].split("/")[1];if(!t||e!=="png")return{originalWidth:void 0,originalHeight:void 0};let n=t.split(",")[1].slice(0,50),r=Uint8Array.from(atob(n),i=>i.charCodeAt(0)),o=new DataView(r.buffer,0,28);return{originalWidth:o.getInt32(16),originalHeight:o.getInt32(20)}}function SA(t,e,n,r){let o=t,i=e,s=Math.min(n/t,r/e);return o=Math.round(o*s),i=Math.round(i*s),{scaledWidth:o,scaledHeight:i}}function uv(t,e){const{node:{attrs:n={},marks:r=[]},tableCell:o}=t;let i=n.rId;const s=n.src||n.imageSrc,{originalWidth:a,originalHeight:l}=kA(s);let c=n.size?{w:vi(n.size.width),h:vi(n.size.height)}:e;if(a&&l){const p=En(c.w),h=En(c.h),{scaledWidth:m,scaledHeight:y}=SA(a,l,p,h);c={w:vi(m),h:vi(y)}}if(o){const p=o.attrs.colwidth.reduce((k,b)=>k+b,0),h=o.attrs.cellMargins?.left||8,m=o.attrs.cellMargins?.right||8,y=vi(p-(h+m)),{width:g,height:x}=_A(c.w,c.h,y);g&&x&&(c={w:g,h:x})}if(t.node.type==="image"&&!i){const p=s?.split("word/")[1];i=ig(t,p)}else if(t.node.type==="fieldAnnotation"&&!i){const p=s?.split(";")[0].split("/")[1];if(!p)return dv(t);const h=Jn(4),m=n.fieldId.replace("-","_"),y=`media/${m}_${h}.${p}`;i=ig(t,y),t.media[`${m}_${h}.${p}`]=s}const u=n.originalPadding||{distT:0,distB:0,distL:0,distR:0},d="http://schemas.openxmlformats.org/drawingml/2006/main",f="http://schemas.openxmlformats.org/drawingml/2006/picture";return Ff({name:"w:drawing",elements:[{name:"wp:inline",attributes:u,elements:[{name:"wp:extent",attributes:{cx:c.w,cy:c.h}},{name:"wp:effectExtent",attributes:{l:0,t:0,r:0,b:0}},{name:"wp:docPr",attributes:{id:0,name:"",descr:""}},{name:"wp:cNvGraphicFramePr",elements:[{name:"a:graphicFrameLocks",attributes:{"xmlns:a":d,noChangeAspect:1}}]},{name:"a:graphic",attributes:{"xmlns:a":d},elements:[{name:"a:graphicData",attributes:{uri:f},elements:[{name:"pic:pic",attributes:{"xmlns:pic":f},elements:[{name:"pic:nvPicPr",elements:[{name:"pic:cNvPr",attributes:{id:0,name:"",desc:""}},{name:"pic:cNvPicPr",elements:[{name:"a:picLocks",attributes:{noChangeAspect:1,noChangeArrowheads:1}}]}]},{name:"pic:blipFill",elements:[{name:"a:blip",attributes:{"r:embed":i,cstate:"none"}},{name:"a:srcRect"},{name:"a:stretch",elements:[{name:"a:fillRect"}]}]},{name:"pic:spPr",attributes:{bwMode:"auto"},elements:[{name:"a:xfrm",elements:[{name:"a:ext",attributes:{cx:c.w,cy:c.h}},{name:"a:off",attributes:{x:0,y:0}}]},{name:"a:prstGeom",attributes:{prst:"rect"},elements:[{name:"a:avLst"}]}]}]}]}]}]}]},[])}function dv(t){const{node:{attrs:e={},marks:n=[]}}=t,r=$A(e);return Ml(e.displayLabel,[...n,...r])}function CA(t){const{node:{attrs:e={},marks:n=[]}}=t,r=TC.decode(e.displayLabel);return Ml(r,n)}function EA(t){const{node:{attrs:e={}}}=t,n=new window.DOMParser().parseFromString(e.rawHtml,"text/html"),r=Hi.create({doc:Zr.fromSchema(t.editorSchema).parse(n)}).doc.toJSON();return{name:"htmlAnnotation",elements:pi({node:r})}}function lg(t,e){return uv(t,e)}function AA(t){const{node:{attrs:e={},marks:n=[]}}=t,r=cv(t,e.linkUrl),o=Ml(e.linkUrl,n);return{name:"w:hyperlink",type:"element",attributes:{"r:id":r,"w:history":1},elements:[o]}}function TA(t){const e={w:4286250,h:4286250},n={w:99e4,h:495e3};return{text:dv,image:r=>lg(r,e),signature:r=>lg(r,n),checkbox:CA,html:EA,link:AA}[t]}const $A=(t={})=>{const{fontFamily:e,fontSize:n,bold:r,underline:o,italic:i}=t,s=[];return e&&s.push({type:"fontFamily",attrs:{fontFamily:e}}),n&&s.push({type:"fontSize",attrs:{fontSize:n}}),r&&s.push({type:"bold",attrs:{}}),o&&s.push({type:"underline",attrs:{}}),i&&s.push({type:"italic",attrs:{}}),s};function OA(t){const{node:e,isFinalDoc:n}=t,{attrs:r={}}=e,o=TA(r.type);if(!o)return{};let i,s;if(n)return o(t);i=o(t),s=[i],r.type==="html"&&(s=[...i.elements]);const a="http://schemas.openxmlformats.org/wordprocessingml/2006/main";return{name:"w:sdt",elements:[{name:"w:sdtPr",elements:[{name:"w:tag",attributes:{"w:val":r.fieldId}},{name:"w:alias",attributes:{"w:val":r.displayLabel}},{name:"w:fieldType",attributes:{"xmlns:w":a,"w:val":r.fieldType}},{name:"w:fieldTypeShort",attributes:{"xmlns:w":a,"w:val":r.type}},{name:"w:fieldColor",attributes:{"xmlns:w":a,"w:val":r.fieldColor}},{name:"w:fieldMultipleImage",attributes:{"xmlns:w":a,"w:val":r.multipleImage}}]},{name:"w:sdtContent",elements:s}]}}function MA(){return{name:"w:r",elements:[{name:"w:br",type:"element",attributes:{"w:type":"page"}}]}}var jr,fv,Zc,Qc;let cg=class{constructor(e){$0(this,jr),this.converter=e}schemaToXml(e,n=!1){return Xn(this,jr,fv).call(this,e,n).join("")}};jr=new WeakSet,fv=function(t,e=falase){const n=JSON.parse(JSON.stringify(t)),r=this.converter.declaration.attributes,o=`<?xml${Object.entries(r).map(([s,a])=>` ${s}="${a}"`).join("")}?>`,i=Xn(this,jr,Qc).call(this,n,e);return[o,...i]},Zc=function(t){if(t)return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")},Qc=function(t,e=!1){if(!t)return null;let{name:n}=t;const{elements:r,attributes:o}=t;let i=`<${n}`;for(let l in o){const c=typeof o[l]=="string"?Xn(this,jr,Zc).call(this,o[l]):o[l];i+=` ${l}="${c}"`}const s=n&&(!r||!r.length);s?i+=" />":i+=">";let a=[i];if(n==="w:instrText")a.push(r[0].text);else if(n==="w:t"||n==="w:delText"){const l=Xn(this,jr,Zc).call(this,r[0].text);a.push(l)}else if(r)for(let l of r){const c=Xn(this,jr,Qc).call(this,l);if(!c)continue;const u=c.filter(d=>d!=="<undefined>"&&d!=="</undefined>");a.push(...u)}return s||a.push(`</${n}>`),a};function _A(t,e,n){if(t>n){let r=n/t,o=Math.round(e*r);return{width:n,height:o}}return{width:t,height:e}}const NA='<w:document xmlns:wpc="http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas" xmlns:cx="http://schemas.microsoft.com/office/drawing/2014/chartex" xmlns:cx1="http://schemas.microsoft.com/office/drawing/2015/9/8/chartex" xmlns:cx2="http://schemas.microsoft.com/office/drawing/2015/10/21/chartex" xmlns:cx3="http://schemas.microsoft.com/office/drawing/2016/5/9/chartex" xmlns:cx4="http://schemas.microsoft.com/office/drawing/2016/5/10/chartex" xmlns:cx5="http://schemas.microsoft.com/office/drawing/2016/5/11/chartex" xmlns:cx6="http://schemas.microsoft.com/office/drawing/2016/5/12/chartex" xmlns:cx7="http://schemas.microsoft.com/office/drawing/2016/5/13/chartex" xmlns:cx8="http://schemas.microsoft.com/office/drawing/2016/5/14/chartex" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:aink="http://schemas.microsoft.com/office/drawing/2016/ink" xmlns:am3d="http://schemas.microsoft.com/office/drawing/2017/model3d" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:oel="http://schemas.microsoft.com/office/2019/extlst" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:wp14="http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:w14="http://schemas.microsoft.com/office/word/2010/wordml" xmlns:w15="http://schemas.microsoft.com/office/word/2012/wordml" xmlns:w16cex="http://schemas.microsoft.com/office/word/2018/wordml/cex" xmlns:w16cid="http://schemas.microsoft.com/office/word/2016/wordml/cid" xmlns:w16="http://schemas.microsoft.com/office/word/2018/wordml" xmlns:w16sdtdh="http://schemas.microsoft.com/office/word/2020/wordml/sdtdatahash" xmlns:w16se="http://schemas.microsoft.com/office/word/2015/wordml/symex" xmlns:wpg="http://schemas.microsoft.com/office/word/2010/wordprocessingGroup" xmlns:wpi="http://schemas.microsoft.com/office/word/2010/wordprocessingInk" xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml" xmlns:wps="http://schemas.microsoft.com/office/word/2010/wordprocessingShape" mc:Ignorable="w14 w15 w16se w16cid w16 w16cex w16sdtdh wp14"><w:body></w:body></w:document>',DA=t=>JSON.parse(cb.xml2json(t,null,2)),IA=(t,e=NA)=>t["word/document.xml"]||DA(e),FA=t=>{const{nodes:e}=t;if(e.length===0)return{nodes:[],consumed:0};const n=e[0];switch(n.name){case"w:tbl":return{nodes:[RA(n,t)],consumed:1}}return{nodes:[],consumed:0}},BA={handlerName:"tableNodeHandler",handler:FA};function RA(t,e){const{docx:n,nodeListHandler:r}=e,o=t.elements.find(k=>k.name==="w:tblPr"),i=o.elements.find(k=>k.name==="w:tblBorders")?.elements||[],{borders:s,rowBorders:a}=hv(i),l=o.elements.find(k=>k.name==="w:tblStyle"),c={tableStyleId:l?.attributes["w:val"]},u=o?.elements.find(k=>k.name==="w:tblInd");if(u){const{"w:w":k,"w:type":b}=u.attributes;c.tableIndent={width:et(k),type:b}}const d=o?.elements.find(k=>k.name==="w:tblLayout");if(d){const{"w:type":k}=d.attributes;c.tableLayout=k}const f=pv(l,n),p=o.elements.find(k=>k.name==="w:tblW");p&&(c.tableWidth={width:et(p.attributes["w:w"]),type:p.attributes["w:type"]});const h=o.elements.find(k=>k.name==="w:tblCellSpacing");h&&(c.tableCellSpacing={w:h.attributes["w:w"],type:h.attributes["w:type"]},c.borderCollapse="separate");const m=t.elements.filter(k=>k.name==="w:tr"),y=Object.keys(s)?.length?s:f?.borders,g=Object.keys(a)?.length?a:f?.rowBorders;c.borders=y;const x=[];return m.forEach(k=>{const b=zA(k,t,g,l,e);b.content?.length&&x.push(b)}),{type:"table",content:x,attrs:c}}function LA(t,e,n,r,o=null,i,s){const{docx:a,nodeListHandler:l}=s,c=t.elements.find(V=>V.name==="w:tcPr"),u=c?.elements?.find(V=>V.name==="w:tcBorders"),d=PA(u,r);mv(n);const f=c?.elements?.find(V=>V.name==="w:tcW");let p=f?et(f.attributes["w:w"]):null;const h=f?.attributes["w:type"];!p&&o&&(p=o);const m=ug(t),{attributes:y}=m||{},g={color:c?.elements?.find(V=>V.name==="w:shd")?.attributes["w:fill"]},x=c?.elements?.find(V=>V.name==="w:gridSpan")?.attributes["w:val"],k=c?.elements?.find(V=>V.name==="w:tcMar"),b=c?.elements?.find(V=>V.name==="w:vAlign")?.attributes["w:val"]||"top",T={},M=pv(i,a)||{};T.cellMargins=jA(k,M);const{fontSize:_,fonts:F={}}=M,C=F.ascii;if(p&&(T.colwidth=[p],T.widthUnit="px"),h&&(T.widthType=h),x&&(T.colspan=Number(x)),g&&(T.background=g),T.verticalAlign=b,_&&(T.fontSize=_),C&&(T.fontFamily=C.ascii),r&&(T.borders={...r}),d&&(T.borders=Object.assign(T.borders||{},d)),y&&y["w:val"]==="restart"){const V=n.elements.filter(G=>G.name==="w:tr"),ie=V.findIndex(G=>G===e),I=V.slice(ie+1);let W=e.elements.filter(G=>G.name==="w:tc").findIndex(G=>G===t),A=1;for(let G of I){const ae=G.elements.findIndex(pe=>pe.name==="w:tc"),J=G.elements[ae+W];if(!J)break;const ue=ug(J),{attributes:X}=ue||{};if(!ue&&!X||X&&X["w:val"]==="restart")break;A++,G.elements.splice(ae+W,1)}T.rowspan=A}return{type:"tableCell",content:l.handler({...s,nodes:t.elements}),attrs:T}}const ug=t=>t.elements.find(e=>e.name==="w:tcPr")?.elements?.find(e=>e.name==="w:vMerge"),Js=(t,e,n={})=>{const r=t?.elements?.find(o=>o.name===`w:${e}`)?.attributes;if(r&&r["w:val"]!=="nil"){const o={},i=r["w:color"];i&&(o.color=i==="auto"?"#000000":`#${i}`);const s=r["w:sz"];return s&&(o.size=rv(s)),o}if(r&&r["w:val"]==="nil"){const o=Object.assign({},n[e]||{});return Object.keys(o)?(o.val="none",o):null}return null},PA=(t,e)=>{if(!t)return null;const n={},r=Js(t,"bottom",e);r&&(n.bottom=r);const o=Js(t,"top",e);o&&(n.top=o);const i=Js(t,"left",e);i&&(n.left=i);const s=Js(t,"right",e);return s&&(n.right=s),n};function pv(t,e,n){if(!t)return null;const r={},{attributes:o={}}=t,i=o["w:val"];if(!i)return null;const s=e["word/styles.xml"],{elements:a}=s.elements[0],l=a.filter(m=>m.name==="w:style"),c=l.find(m=>m.attributes["w:styleId"]===i);if(!c)return null;r.name=c.elements.find(m=>m.name==="w:name");const u=c.elements.find(m=>m.name==="w:basedOn");c.elements.find(m=>m.name==="w:uiPriority");let d;if(u?.attributes){const m=l.find(y=>y.attributes["w:styleId"]===u.attributes["w:val"]);d=m?m.elements.find(y=>y.name==="w:tblPr"):{}}const f=c.elements.find(m=>m.name==="w:pPr");if(f){const m=f.elements.find(y=>y.name==="w:jc");m?.attributes&&(r.justification=m.attributes["w:val"])}const p=c?.elements.find(m=>m.name==="w:rPr");if(p){const m=p.elements.find(g=>g.name==="w:rFonts");if(m){const{"w:ascii":g,"w:hAnsi":x,"w:cs":k}=m.attributes;r.fonts={ascii:g,hAnsi:x,cs:k}}const y=p.elements.find(g=>g.name==="w:sz");y?.attributes&&(r.fontSize=AE(y.attributes["w:val"])+"pt")}const h=c.elements.find(m=>m.name==="w:tblPr");if(h&&h.elements){d&&d.elements&&h.elements.push(...d.elements);const m=h?.elements?.find(b=>b.name==="w:tblBorders"),{elements:y=[]}=m||{},{borders:g,rowBorders:x}=hv(y);g&&(r.borders=g),x&&(r.rowBorders=x);const k=h?.elements.find(b=>b.name==="w:tblCellMar");if(k){const b=k.elements.find(F=>F.name==="w:left"),T=k.elements.find(F=>F.name==="w:right"),M=k.elements.find(F=>F.name==="w:top"),_=k.elements.find(F=>F.name==="w:bottom");r.cellMargins={marginLeft:b?.attributes["w:w"],marginRight:T?.attributes["w:w"],marginTop:M?.attributes["w:w"],marginBottom:_?.attributes["w:w"]}}}return r}function hv(t){const e={},n={};return t.forEach(r=>{const{name:o}=r,i=o.split("w:")[1],{attributes:s}=r,a={},l=s["w:color"],c=s["w:sz"];l&&l!=="auto"&&(a.color=l.startsWith("#")?l:`#${l}`),c&&c!=="auto"&&(a.size=rv(c)),["insideH","insideV"].includes(i)&&(n[i]=a),e[i]=a}),{borders:e,rowBorders:n}}function zA(t,e,n,r,o){const i={},s=t.elements.find(d=>d.name==="w:trPr")?.elements?.find(d=>d.name==="w:trHeight"),a=s?.attributes["w:val"];s?.attributes["w:hRule"];const l={};n?.insideH&&(l.bottom=n.insideH),n?.insideV&&(l.right=n.insideV),i.borders=l,a&&(i.rowHeight=et(a));const c=mv(e),u=t.elements.filter(d=>d.name==="w:tc");return{type:"tableRow",content:u?.map((d,f)=>{const p=u.length>1?c[f]:null;return LA(d,t,e,l,p,r,o)})||[],attrs:i}}const jA=(t,e)=>{const n=t?.elements?.find(m=>m.name==="w:left"),r=t?.elements?.find(m=>m.name==="w:right"),o=t?.elements?.find(m=>m.name==="w:top"),i=t?.elements?.find(m=>m.name==="w:bottom"),s=n?.attributes["w:w"],a=r?.attributes["w:w"],l=o?.attributes["w:w"],c=i?.attributes["w:w"],{cellMargins:u={}}=e,{marginLeft:d,marginRight:f,marginTop:p,marginBottom:h}=u;return{left:et(s??d),right:et(a??f),top:et(l??p),bottom:et(c??h)}},mv=t=>t.elements.find(e=>e.name==="w:tblGrid")?.elements?.flatMap(e=>e.name!=="w:gridCol"?[]:et(e.attributes["w:w"]))||{},qA=t=>{const{nodes:e,filename:n}=t;if(e.length===0||e[0].name!=="w:drawing")return{nodes:[],consumed:0};const r=e[0];let o;const{elements:i}=r,s=n||null;i.find(l=>l.name==="wp:anchor")&&(o=dg(i[0],s,t));const a=i.find(l=>l.name==="wp:inline");return a&&(o=dg(a,s,t)),{nodes:o?[o]:[],consumed:1}};function dg(t,e,n){const{docx:r}=n,{attributes:o}=t,i={top:En(o.distT),bottom:En(o.distB),left:En(o.distL),right:En(o.distR)},s=t.elements.find(M=>M.name==="wp:extent"),a={width:En(s.attributes?.cx),height:En(s.attributes?.cy)},l=t.elements.find(M=>M.name==="a:graphic").elements.find(M=>M.name==="a:graphicData").elements.find(M=>M.name==="pic:pic");if(!l||!l.elements)return null;const c=l.elements.find(M=>M.name==="pic:blipFill").elements.find(M=>M.name==="a:blip"),u=t.elements.find(M=>M.name==="wp:positionH")?.elements.find(M=>M.name==="wp:posOffset"),d=En(u?.elements[0]?.text),f=t.elements.find(M=>M.name==="wp:positionV")?.elements.find(M=>M.name==="wp:posOffset"),p=En(f?.elements[0]?.text),h={left:d,top:p},{attributes:m}=c,y=m["r:embed"];let g=r[`word/_rels/${e||"document.xml"}.rels`];g||(g=r["word/_rels/document.xml.rels"]);const x=g.elements.find(M=>M.name==="Relationships"),{elements:k}=x,b=k.find(M=>M.attributes.Id===y),{attributes:T}=b;return{type:"image",attrs:{src:`word/${T.Target}`,alt:"Image",inline:!0,padding:i,marginOffset:h,size:a,originalPadding:{distT:o.distT,distB:o.distB,distL:o.distL,distR:o.distR},rId:T.Id}}}const UA={handlerName:"drawingNodeHandler",handler:qA};function Yo(t,e=[],n=null){const r=[],o=new Set;return t?.elements?.forEach(i=>{const s=$r.markTypes.filter(a=>a.name===i.name);s.length||["w:shd","w:rStyle","w:pStyle","w:numPr","w:outlineLvl","w:bdr","w:pBdr","w:noProof","w:contextualSpacing","w:keepNext","w:tabs","w:keepLines"].includes(i.name)&&e.push(i.name),s.forEach(a=>{if(!a||o.has(a.type))return;o.add(a.type);const{attributes:l={}}=i,c={type:a.type};if(!(l["w:val"]=="0"||l["w:val"]==="none")){if(a.mark&&(c.type=a.mark),Object.keys(l).length){const u=HA(a.type,l,n);if(u==null)return;c.attrs={},c.attrs[a.property]=u}r.push(c)}})}),sd(r)}function VA(t,e){const n=t.elements?.find(s=>s.name==="w:rPrChange");if(!n)return[];const{attributes:r}=n,o={id:r["w:id"],date:r["w:date"],author:r["w:author"],authorEmail:r["w:authorEmail"]},i=Yo(n);return[{type:vt,attrs:{...o,before:i,after:[...e]}}]}function sd(t){const e=t.filter(o=>o.type==="textStyle"),n=t.filter(o=>o.type!=="textStyle"),r={};return e.length&&e.forEach(o=>{const{attrs:i={}}=o;Object.keys(i).forEach(s=>{r[s]=i[s]})}),[...n,{type:"textStyle",attrs:r}]}function HA(t,e,n){t==="tabs"&&(t="textIndent");const r={color:()=>`#${e["w:val"]}`,fontSize:()=>`${e["w:val"]/2}pt`,textIndent:()=>GA(e),fontFamily:()=>WA(e,n),lineHeight:()=>KA(e),textAlign:()=>e["w:val"],link:()=>e.href,underline:()=>e["w:val"],bold:()=>e?.["w:val"]||null,italic:()=>e?.["w:val"]||null,highlight:()=>JA(e)};if(t in r||console.debug("❗️❗️ No value mapper for:",t,"Attributes:",e),t in r)return r[t],r[t]()}function WA(t,e){const n=t["w:ascii"],r=t["w:asciiTheme"];if(!e||!r)return n;const o=e["word/theme/theme1.xml"];if(!o)return n;const{elements:i}=o,{elements:s}=i[0];return s.find(a=>a.name==="a:themeElements").elements.find(a=>a.name==="a:fontScheme").elements.find(a=>a.name==="a:majorFont").elements.find(a=>a.name==="a:latin").attributes.typeface}function GA(t){let e=t["w:left"];return e?`${Wt(e)}in`:null}function KA(t){let e=t["w:line"];return!e||e==="0"?null:`${Vo(e)}`}function JA(t){return t["w:fill"]?`#${t["w:fill"]}`:ME(t?.["w:val"])?`#${t["w:val"]}`:OE(t?.["w:val"])||null}function hi(t,e){const n=[],r=[],{attributes:o={},elements:i=[]}=t,{nodes:s,paragraphProperties:a={},runProperties:l={}}=XA(i);return i.find(c=>c.name==="w:r")&&(a.elements=a?.elements?.filter(c=>c.name!=="w:rPr")),l&&l?.elements?.length&&n.push(...Yo(l,r)),a&&a.elements?.length&&n.push(...Yo(a,r)),n.push(...VA(l,n)),a&&a.elements?.length&&(o.paragraphProperties=a),n&&t.name==="w:p"&&n.forEach(c=>{const u=Object.keys(c.attrs??{})[0];if(u){const d=c.attrs[u];o[u]=d}}),{elements:s,attributes:o,marks:n,unknownMarks:r}}function XA(t){const e=t.find(o=>o.name==="w:pPr"),n=t.find(o=>o.name==="w:rPr"),r=t.find(o=>o.name==="w:sectPr");return{nodes:t.filter(o=>o.name!=="w:pPr"&&o.name!=="w:rPr"&&o.name!=="w:sectPr"),paragraphProperties:e,runProperties:n,sectionProperties:r}}function Ta(t){return $r.allowedElements[t.name||t.type]}const YA=t=>!!$r.propertyTypes[t.name||t.type];function gv(t){return t.filter(e=>e.name==="w:r").some(e=>e.elements.some(n=>n.name==="w:t"))}const ZA=t=>{const{nodes:e,nodeListHandler:n}=t;if(e.length===0||!(e[0].name==="w:del"||e[0].name==="w:ins"))return{nodes:[],consumed:0};const r=e[0],{name:o}=r,{attributes:i,elements:s}=hi(r),a=n.handler({...t,insideTrackChange:!0,nodes:s}),l=o==="w:del"?ut:Ft,c={id:i["w:id"],date:i["w:date"],author:i["w:author"],authorEmail:i["w:authorEmail"]};return a.forEach(u=>{u.marks===void 0&&(u.marks=[]),u.marks.push({type:l,attrs:c})}),{nodes:a,consumed:1}},QA={handlerName:"trackChangeNodeHandler",handler:ZA},e4=t=>{const{nodes:e,docx:n,nodeListHandler:r}=t;if(e.length===0||e[0].name!=="w:hyperlink")return{nodes:[],consumed:0};const o=e[0],i=n["word/_rels/document.xml.rels"].elements.find(m=>m.name==="Relationships"),{elements:s}=i,{attributes:a}=o,l=a["r:id"],c=a["w:anchor"];a["w:history"];const u=s.find(m=>m.attributes.Id===l)||{},{attributes:d={}}=u;let f=d.Target;c&&!f&&(f=`#${c}`);const p=o.elements.filter(m=>m.name==="w:r"),h={type:"link",attrs:{href:f,rId:l}};for(const m of p){m.marks||(m.marks=[]),m.marks.push(h);const y=m.elements.find(g=>g.name==="w:rPr");if(y&&y.elements.find(g=>g.name==="w:rStyle")){const g=n["word/styles.xml"],{elements:x}=g.elements[0],k=x.filter(b=>b.name==="w:style").find(b=>b.attributes["w:styleId"]==="Hyperlink")?.elements?.find(b=>b.name==="w:rPr");k&&m.elements.unshift(k)}}return{nodes:r.handler({...t,nodes:p}),consumed:1}},t4={handlerName:"hyperlinkNodeHandler",handler:e4},n4=t=>{const{nodes:e,nodeListHandler:n,parentStyleId:r,docx:o}=t;if(e.length===0||e[0].name!=="w:r")return{nodes:[],consumed:0};const i=e[0],s={...t,nodes:i.elements};let a=n.handler(s)?.filter(u=>u)||[];const l=i.elements?.some(u=>u.name==="w:rPr"),c=r4(o,r);if(l){const{marks:u=[],attributes:d={}}=hi(i),f=u.find(h=>h.type==="textStyle"),p=f&&Object.keys(f.attrs).length>0;c.marks&&!p&&u.push(...c.marks),i.marks&&u.push(...i.marks),a=a.map(h=>({...h,marks:sd(u),attributes:d}))}else c.marks&&(a=a.map(u=>({...u,marks:sd(c.marks)})));return{nodes:a,consumed:1}},r4=(t,e)=>{const n=t?.["word/styles.xml"];if(!n)return{};const r=n.elements[0].elements.filter(o=>o.name==="w:style").find(o=>o.attributes["w:styleId"]===e)||{};return r?hi(r):{}},o4={handlerName:"runNodeHandler",handler:n4},i4=t=>{const{nodes:e,insideTrackChange:n}=t;if(e.length===0||!(e[0].name==="w:t"||n&&e[0].name==="w:delText"))return{nodes:[],consumed:0};const r=e[0],{type:o}=r,{attributes:i,elements:s,marks:a=[]}=hi(r);let l;if(s.length===1)l=s[0].text;else if(!s.length&&"attributes"in r&&r.attributes["xml:space"]==="preserve")l=" ";else return{nodes:[],consumed:0};return{nodes:[{type:Ta(r),text:l,attrs:{type:o,attributes:i||{}},marks:a}],consumed:1}},s4={handlerName:"textNodeHandler",handler:i4},yv=t=>Object.prototype.toString.call(t)==="[object RegExp]";function Zo(t,e,n={strict:!0}){const r=Object.keys(e);return r.length?r.every(o=>n.strict?e[o]===t[o]:yv(e[o])?e[o].test(t[o]):e[o]===t[o]):!0}const wv=t=>{if(!t||!Array.isArray(t))return t;let e=[],n=null;for(let r of t)r.type==="text"?n&&a4(n,r)?n={...n,text:n.text+=r.text}:(n&&e.push(n),n={...r}):(n&&(e.push(n),n=null),e.push(r));return n&&e.push(n),e},a4=(t,e)=>{if(!t||!e)return!1;let n=t.marks??[],r=e.marks??[];if(n.length!==r.length)return!1;for(let o=0;o<n.length;o++)if(n[o].type!==r[o].type||!l4(n[o].attrs,r[o].attrs))return!1;return!0},l4=(t={},e={})=>Zo(t,e);function bv(t,e,n){this.name=t,this.message=e||"",this.details=n;const r=new Error(this.message);this.stack=r.stack,r.name=this.name}bv.prototype=Object.create(Error.prototype);const c4=t=>{const{nodes:e,lists:n}=t;if(e.length===0||e[0].name!=="w:p")return{nodes:[],consumed:0};const r=sn(e[0]),o=Sv(r.elements);r.elements=o;const i=r.elements.find(s=>s.name==="w:pPr");if(ad(r)){const s=sn(e),a=[];let l=s.shift();for(;l&&ad(l,!0);)a.push(l),l=s.shift(),l?.elements&&!gv(l.elements)&&(a.push(l),l=s.shift());return{nodes:[vv({listItems:a,params:t,originalPpr:i})],consumed:a.filter(c=>c.seen).length,lists:n}}else return{nodes:[],consumed:0,lists:n}},u4={handlerName:"listHandler",handler:c4};function vv({listItems:t,originalPpr:e,params:n,listLevel:r=0,actualListLevel:o=0,currentListNumId:i=null,path:s="",isNested:a=!1}){const{docx:l,nodeListHandler:c,lists:u}=n,d=[];let f,p;const h=c.handlerEntities.find(b=>b.handlerName==="standardNodeHandler")?.handler;if(!h)return console.error("Standard node handler not found"),{nodes:[],consumed:0};const m=t[0].elements.find(b=>b.name==="w:pPr")?.elements?.find(b=>b.name==="w:numPr"),y=m?.elements?.find(b=>b.name==="w:numId")||{},{attributes:g={}}=y;i=g["w:val"],o=parseInt(m?.elements?.find(b=>b.name==="w:ilvl")?.attributes["w:val"])||0;let x=0;for(let[b,T]of t.entries()){if(T.seen)continue;if(T.elements&&!gv(T.elements)){const re=h({...n,nodes:[T]}).nodes[0];re&&d[d.length-1]?.content.push(re),T.seen=!0;continue}const{attributes:M,elements:_,marks:F=[]}=hi(T),C=F.find(re=>re.type==="textStyle"),{listType:V,listOrderingType:ie,ilvl:I,listrPrs:W,listpPrs:A,start:G,lvlText:ae,lvlJc:J,numId:ue}=h4(M,r,l);p=ie;const X=parseInt(I),pe=o===X&&ue===i,Q=p4({firstListId:ue,secondListId:i,level:X,pStyleId:null,docx:l}),B=ue!==i&&!Q,ee=r<X||r===X&&B&&x===r;u[i]||(u[i]={}),u[i][r]||(u[i][r]=0);const Z={};if(pe&&!ee){u[i][o]++,f=V,T.seen=!0;const re=[];let K={type:"paragraph",content:c.handler({...n,nodes:[M.paragraphProperties,..._]})?.filter(D=>D)};K.content&&(K={...K,attrs:{textAlign:C?.attrs.textAlign||null,rsidRDefault:M?.["w:rsidRDefault"]||null},content:wv(K.content)}),re.push(K),x=r;let $=[];if(p!=="bullet"&&($=[...s,u[i][r]]),!s.length&&o>0){const D=u[i];if(D){const R=[];Object.keys(D).forEach(le=>{R.push(D[le])}),$=R}}const E=T.elements.find(D=>D.name==="w:pPr")?.elements.find(D=>D.name==="w:ind");if(E){const D={};E.attributes["w:left"]!==void 0&&(D.left=et(E.attributes["w:left"])),E.attributes["w:right"]!==void 0&&(D.right=et(E.attributes["w:right"])),E.attributes["w:firstLine"]!==void 0&&(D.firstLine=et(E.attributes["w:firstLine"])),E.attributes["w:hanging"]!==void 0&&(D.hanging=et(E.attributes["w:hanging"])),Z.indent=D}A&&(Z.listParagraphProperties=A),W&&(Z.listRunProperties=W),Z.textStyle=C,Z.order=G,Z.lvlText=ae,Z.lvlJc=C?.attrs.textAlign,Z.listLevel=$,Z.listNumberingType=ie,Z.attributes={parentAttributes:T?.attributes||null};const H=e?.elements?.find(D=>D.name==="w:rPr");H&&(Z.attributes.originalInlineRunProps=H),Z.numId=ue,l&&(Z.spacing=xv(T,l));const q=fg(re,Z,[]);d.push(q)}else if(ee){const re=[...s,u[i][r]],K=vv({listItems:t.slice(b),originalPpr:e,params:n,listLevel:r+1,actualListLevel:r,currentListNumId:ue,path:re,isNested:!0});x=K.lastNestedListLevel,delete K.lastNestedListLevel;const $=d[d.length-1];$?$.content.push(K):d.push(fg([K],Z,[]))}else if(ue){x=r,r>0&&T.elements[0].elements.find(re=>re.name==="w:numPr")&&(u[i][r]=0);break}else{T.seen=!0;const re=h({...n,nodes:[T]}).nodes[0];d[d.length-1]?.content.push(re)}}const k={type:f||"bulletList",content:d,attrs:{"list-style-type":p,listId:i,attributes:{parentAttributes:t[0]?.attributes||null}}};return a&&(k.lastNestedListLevel=x),k}function ad(t,e=!1){const{elements:n}=t,r=n?.find(s=>s.name==="w:pPr");if(!r)return!1;const o=r.elements?.find(s=>s.name==="w:pStyle")?.attributes["w:val"]==="ListParagraph",i=r.elements?.find(s=>s.name==="w:numPr");return o||i}function fg(t,e,n){return{type:"listItem",content:t,attrs:e,marks:n}}const d4=["decimal","decimalZero","lowerRoman","upperRoman","lowerLetter","upperLetter","ordinal","cardinalText","ordinalText","hex","chicago","none"],f4=["bullet","square","circle","disc"],p4=({firstListId:t,secondListId:e,level:n,pStyleId:r,docx:o})=>{const{numFmt:i,lvlText:s,lvlJc:a}=Ga(t,n,r,o),{numFmt:l,lvlText:c,lvlJc:u}=Ga(e,n,r,o);return i===l&&s===c&&a===u},pg=(t,e)=>{const n=e["word/styles.xml"];if(!n)return null;const{elements:r}=n,o=r[0].elements.filter(h=>h.name==="w:style"),i=o.find(h=>h.attributes["w:styleId"]===t)||{},s=i?.elements?.find(h=>h.name==="w:pPr");if(!s)return null;let a=s?.elements?.find(h=>h.name==="w:numPr");if(!a)return null;let l=a?.elements?.find(h=>h.name==="w:numId")||{},c=l?.attributes?.["w:val"],u=a?.elements?.find(h=>h.name==="w:ilvl"),d=u?.attributes?.["w:val"];const f=i?.elements?.find(h=>h.name==="w:basedOn")?.attributes?.["w:val"];let p=0;for(;a&&!c&&p<10;)a=(o.find(h=>h.attributes["w:styleId"]===f)||{})?.elements?.find(h=>h.name==="w:pPr")?.elements?.find(h=>h.name==="w:numPr"),l=a?.elements?.find(h=>h.name==="w:numId")||{},c=l?.attributes?.["w:val"],u||(u=a?.elements?.find(h=>h.name==="w:ilvl"),d=u?.attributes?.["w:val"]),p++;return{numId:c,ilvl:d}},Ga=(t,e,n,r)=>{const o=r["word/numbering.xml"];if(!o)return{};const{elements:i}=o,s=i[0];if(n){const{numId:k,ilvl:b}=pg(n,r)||{};k&&(t=k),b&&(e=b?parseInt(b):null)}const a=s.elements,l=a.filter(k=>k.name==="w:abstractNum"),c=a.filter(k=>k.name==="w:num").find(k=>k.attributes["w:numId"]===t)?.elements[0].attributes["w:val"],u=l?.find(k=>k.attributes["w:abstractNumId"]===c),d=m4(u,e),f=u?.elements?.find(k=>k.name==="w:numStyleLink")?.attributes["w:val"];if(f){const k=pg(f,r);return Ga(k.numId,e,null,r)}const p=d?.elements?.find(k=>k.name==="w:start")?.attributes["w:val"],h=d?.elements?.find(k=>k.name==="w:numFmt")?.attributes["w:val"],m=d?.elements?.find(k=>k.name==="w:lvlText").attributes["w:val"],y=d?.elements?.find(k=>k.name==="w:lvlJc").attributes["w:val"],g=d?.elements?.find(k=>k.name==="w:pPr"),x=d?.elements?.find(k=>k.name==="w:rPr");return{start:p,numFmt:h,lvlText:m,lvlJc:y,pPr:g,rPr:x}};function h4(t,e,n){if(!t)return;const{paragraphProperties:r={}}=t,{elements:o=[]}=r,i=o.find(x=>x.name==="w:numPr");if(!i)return{};const s=i.elements.find(x=>x.name==="w:ilvl").attributes["w:val"],a=i.elements.find(x=>x.name==="w:numId").attributes["w:val"],l=o.find(x=>x.name==="w:pStyle")?.attributes["w:val"],{start:c,numFmt:u,lvlText:d,lvlJc:f,pPr:p,rPr:h}=Ga(a,e,l,n);let m,y;p&&(m=g4(p)),h&&(y=y4(h));let g;if(f4.includes(u?.toLowerCase()))g="bulletList";else if(d4.includes(u))g="orderedList";else throw new bv("ListParsingError",`Unknown list type found during import: ${u}`,{listOrderingType:u,ilvl:s,numId:a,listrPrs:y,listpPrs:m,start:c,lvlText:d,lvlJc:f});return{listType:g,listOrderingType:u,ilvl:s,numId:a,listrPrs:y,listpPrs:m,start:c,lvlText:d,lvlJc:f}}function m4(t,e){return t?.elements?.find(n=>Number(n.attributes["w:ilvl"])===e)}function g4(t){const{elements:e}=t,n=["w:ind","w:jc","w:tabs"],r={};return e&&e.forEach(o=>{n.includes(o.name);const{attributes:i={}}=o;Object.keys(i).forEach(s=>{r[s]=i[s]})}),r}function y4(t){const{elements:e}=t,n=["w:rFonts","w:b","w:bCs","w:i","w:iCs","w:strike","w:dstrike","w:color","w:sz","w:szCs","w:u","w:bdr","w:shd","w:vertAlign","w:jc","w:spacing","w:w","w:smallCaps","w:position","w:lang"],r={};return e&&e.forEach(o=>{n.includes(o.name);const{attributes:i={}}=o;Object.keys(i).forEach(s=>{r[s]=i[s]})}),r}const w4=t=>{const{nodes:e,docx:n,nodeListHandler:r,filename:o}=t;if(e.length===0||e[0].name!=="w:p")return{nodes:[],consumed:0};const i=sn(e[0]);let s,a=Sv(i.elements);if(i.elements=a,ad(i))return{nodes:[],consumed:0};const l=r.handlerEntities.find(g=>g.handlerName==="standardNodeHandler")?.handler;if(!l)return console.error("Standard node handler not found"),{nodes:[],consumed:0};const c={...t,nodes:[i]},u=l(c);u.nodes.length===1&&(s=u.nodes[0]);const d=i.elements?.find(g=>g.name==="w:pPr"),f=d?.elements?.find(g=>g.name==="w:pStyle"),p=d?.elements?.find(g=>g.name==="w:rPr");if(p&&(s.attrs.marksAttrs=Yo(p,[])),f&&(s.attrs.styleId=f.attributes["w:val"]),n){const g=b4(i,n,s.attrs.styleId);s.attrs.indent||(s.attrs.indent={}),g.left&&(s.attrs.indent.left=g.left),g.right&&(s.attrs.indent.right=g.right),g.firstLine&&(s.attrs.indent.firstLine=g.firstLine),g.hanging&&(s.attrs.indent.hanging=g.hanging),g.textIndent&&(s.attrs.textIndent=`${g.textIndent}in`)}const h=d?.elements?.find(g=>g.name==="w:jc");h&&h.attributes&&(s.attrs.textAlign=h.attributes["w:val"]);const m=d?.elements?.find(g=>g.name==="w:keepLines");m&&m.attributes&&(s.attrs.keepLines=m.attributes["w:val"]);const y=d?.elements?.find(g=>g.name==="w:keepNext");if(y&&y.attributes&&(s.attrs.keepNext=y.attributes["w:val"]),n){const g=i.attributes?.["w:rsidRDefault"];s.attrs.spacing=xv(i,n,s.attrs.styleId,s.attrs.marksAttrs),s.attrs.rsidRDefault=g}return s.attrs.filename=o,s&&s.content&&(s={...s,content:wv(s.content)}),{nodes:s?[s]:[],consumed:1}},b4=(t,e,n="")=>{const r={left:0,right:0,firstLine:0,hanging:0,textIndent:0},{indent:o={}}=kv(e,n),i=t.elements?.find(d=>d.name==="w:pPr")?.elements?.find(d=>d.name==="w:ind")?.attributes||{},s=i?.["w:left"]||o?.["w:left"],a=i?.["w:right"]||o?.["w:right"],l=i?.["w:firstLine"]||o?.["w:firstLine"],c=i?.["w:hanging"]||o?.["w:hanging"];s&&(r.left=et(s)),a&&(r.right=et(a)),l&&(r.firstLine=et(l)),c&&(r.hanging=et(c));const u=s-parseInt(c||0)||0;return u&&(r.textIndent=Wt(u)),r},xv=(t,e,n="",r=[])=>{const o={lineSpaceAfter:0,lineSpaceBefore:0,line:0,lineRule:null},{spacing:i={}}=kv(e,n);let s,a,l,c;const u=t.elements?.find(y=>y.name==="w:pPr")?.elements?.find(y=>y.name==="w:spacing")?.attributes||{},d=r.find(y=>y.type==="textStyle")?.attrs?.fontSize,f=u?.["w:line"]||l||i?.["w:line"];f&&(o.line=Vo(f));const p=u?.["w:before"]||a||i?.["w:before"];p&&(o.lineSpaceBefore=et(p)),u?.["w:beforeAutospacing"]==="1"&&d&&(o.lineSpaceBefore+=Math.round(parseInt(d)*.5*96/72));const h=u?.["w:after"]||s||i?.["w:after"];h&&(o.lineSpaceAfter=et(h)),u?.["w:afterAutospacing"]==="1"&&d&&(o.lineSpaceAfter+=Math.round(parseInt(d)*.5*96/72));const m=u?.["w:lineRule"]||c||i?.["w:lineRule"];return m&&(o.lineRule=m),o},kv=(t,e="")=>{const n=t["word/styles.xml"];if(!n)return{};const r=(n.elements[0].elements?.find(g=>g.name==="w:docDefaults")).elements.find(g=>g.name==="w:pPrDefault")?.elements?.find(g=>g.name==="w:pPr"),o=r?.elements?.find(g=>g.name==="w:spacing")||{},i=r?.elements?.find(g=>g.name==="w:ind")||{},s=n.elements[0].elements?.find(g=>g.name==="w:style"&&g.attributes["w:styleId"]==="Normal")?.elements?.find(g=>g.name==="w:pPr"),a=s?.elements?.find(g=>g.name==="w:spacing")||{},l=s?.elements?.find(g=>g.name==="w:ind")||{};let c={},u={};if(e){const g=n.elements[0].elements?.find(x=>x.name==="w:style"&&x.attributes["w:styleId"]===e)?.elements?.find(x=>x.name==="w:pPr");c=g?.elements?.find(x=>x.name==="w:spacing")||{},u=g?.elements?.find(x=>x.name==="w:ind")||{}}const{attributes:d}=o,{attributes:f}=a,{attributes:p}=c,{attributes:h}=i,{attributes:m}=l,{attributes:y}=u;return{spacing:p||d||f,indent:y||h||m}},v4={handlerName:"paragraphNodeHandler",handler:w4};function x4(t,e){const n={lineSpaceBefore:null,lineSpaceAfter:null};if(!t)return n;const r=e["word/styles.xml"];if(!r)return n;const{elements:o}=r.elements[0],i=o.filter(ae=>{const{attributes:J}=ae;return J&&J["w:styleId"]===t}),s=i[0];if(!s)return n;const a=i.find(ae=>ae.elements.find(J=>J.name==="w:qFormat")),l=i.find(ae=>ae.elements.some(J=>J.name==="w:name"))?.elements.find(ae=>ae.name==="w:name")?.attributes["w:val"],c=s.elements.find(ae=>ae.name==="w:pPr"),u=c?.elements?.find(ae=>ae.name==="w:spacing"),d=c?.elements?.find(ae=>ae.name==="w:jc"),f=c?.elements?.find(ae=>ae.name==="w:ind");let p,h,m;u&&(p=et(u?.attributes["w:before"]),h=et(u?.attributes["w:after"]),m=Vo(u?.attributes["w:line"]));let y,g,x,k;f&&(y=d?.attributes["w:val"],g=et(f?.attributes["w:left"]),x=et(f?.attributes["w:right"]),k=et(f?.attributes["w:firstLine"]));const b=c?.elements?.find(ae=>ae.name==="w:keepNext"),T=c?.elements?.find(ae=>ae.name==="w:keepLines"),M=c?.elements?.find(ae=>ae.name==="w:outlineLvl"),_=M?.attributes["w:val"],F=c?.elements?.find(ae=>ae.name==="w:pageBreakBefore");let C=0;F&&(F.attributes?.["w:val"]?C=Number(F?.attributes?.["w:val"]):C=1);const V=c?.elements?.find(ae=>ae.name==="w:pageBreakAfter");let ie;V&&(V.attributes?.["w:val"]?ie=Number(V?.attributes?.["w:val"]):ie=1);const I={name:l,qFormat:!!a,keepNext:!!b,keepLines:!!T,outlineLevel:M?parseInt(_):null,pageBreakBefore:!!C,pageBreakAfter:!!ie},W=s.elements.find(ae=>ae.name==="w:rPr"),A=Yo(W,[],e)||{},G={spacing:{lineSpaceAfter:h,lineSpaceBefore:p,line:m},textAlign:y,indent:{leftIndent:g,rightIndent:x,firstLine:k}};return A.forEach(ae=>{const{type:J,attrs:ue}=ae;if(J==="textStyle"){Object.entries(ue).forEach(([X,pe])=>{G[Wa(X)]=pe});return}G[J]=ue}),{attrs:I,styles:G}}function Sv(t){let e=[];const n=[];let r=!1,o=!1;return t?.forEach(i=>{const s=i.elements?.find(a=>a.name==="w:fldChar");if(s){const a=s.attributes["w:fldCharType"];a==="begin"?(r=!0,n.push(i)):a==="end"&&(n.push(i),r=!1)}else e.push(i);if(r)n.push(i);else if(!r&&n.length){const a=n.findIndex(m=>m.elements?.some(y=>y.name==="w:fldChar"&&y.attributes["w:fldCharType"]==="separate")),l=n.findIndex(m=>m.elements?.some(y=>y.name==="w:fldChar"&&y.attributes["w:fldCharType"]==="end")),c=n.slice(a+1,l),u=(n.find(m=>m.elements?.some(y=>y.name==="w:instrText"))?.elements?.find(m=>m.name==="w:instrText")).elements[0].text;o||(o=u?.includes("PAGE"));const d=u?.match(/HYPERLINK\s+"([^"]+)"/);if(o)return e=e.filter(m=>m.name!=="w:r"),e.push({name:"sd:autoPageNumber",type:"element"}),[];if(!d||d?.length<2)return[];const f=d[1],p=[];c.forEach(m=>{const y=m.elements.find(x=>x.name==="w:rPr");if(!y)return;const{elements:g}=y;g.forEach(x=>{p.push(x)})});const h={name:"w:rPr",type:"element",elements:[{name:"link",attributes:{href:f}},...p]};e.push({name:"w:r",type:"element",elements:[h,...c]})}}),e}const k4=t=>nodeListHandler.handler({...t,nodes:node.elements}),S4=t=>{const{nodes:e}=t;if(e.length===0||e[0].name!=="w:sdt")return{nodes:[],consumed:0};const n=e[0],r=n.elements.find(s=>s.name==="w:sdtPr")?.elements.find(s=>s.name==="w:docPartObj")?.elements.find(s=>s.name==="w:docPartGallery")?.attributes["w:val"];if(!r)return{nodes:[],consumed:0};if(!hg[r])return{nodes:[],consumed:0};const o=n?.elements.find(s=>s.name==="w:sdtContent"),i=hg[r];return{nodes:i({...t,nodes:[o]}),consumed:1}},hg={"Table of Contents":k4},C4=t=>{const{nodes:e,docx:n,nodeListHandler:r,insideTrackChange:o}=t;if(e.length===0||e[0].name!=="w:sdt")return{nodes:[],consumed:0};const i=e[0],s=i.elements.find(x=>x.name==="w:sdtPr"),a=i.elements.find(x=>x.name==="w:sdtContent"),{attrs:l,marks:c}=E4(a);if(s?.elements.find(x=>x.name==="w:docPartObj"))return S4({nodes:e,docx:n,nodeListHandler:r,insideTrackChange:o});const u=s?.elements.find(x=>x.name==="w:alias"),d=s?.elements.find(x=>x.name==="w:tag"),f=s?.elements.find(x=>x.name==="w:fieldType")?.attributes["w:val"],p=s?.elements.find(x=>x.name==="w:fieldTypeShort")?.attributes["w:val"],h=s?.elements.find(x=>x.name==="w:fieldColor")?.attributes["w:val"],m=s?.elements.find(x=>x.name==="w:fieldMultipleImage")?.attributes["w:val"],y={type:p,fieldId:d?.attributes["w:val"],displayLabel:u?.attributes["w:val"],fieldType:f,fieldColor:h,multipleImage:m==="true"};if(!y.fieldId||!y.displayLabel)return{nodes:[],consumed:0};let g={type:"text",text:`{{${y.displayLabel}}}`,attrs:{...y,...l},marks:c};return t.editor.options.annotations&&(g={type:"fieldAnnotation",attrs:{...y,...l}}),{nodes:[g],consumed:1}},E4=(t={})=>{const e=t.elements?.find(i=>i.name==="w:r")?.elements?.find(i=>i.name==="w:rPr");if(!e)return{};const n=Yo(e,[])||[],r=[];n.forEach(i=>{const{type:s}=i;if(s==="textStyle"){const{attrs:a}=i;Object.keys(a).forEach(l=>{r.push({type:l,attrs:a[l]})})}else r.push(i)});const o={};return r?.forEach(i=>{const{type:s}=i;o[s]=i.attrs||!0}),{attrs:o,marks:n}},A4={handlerName:"annotationNodeHandler",handler:C4},T4=t=>{const{nodes:e,docx:n,nodeListHandler:r}=t;if(!e||e.length===0)return{nodes:[],consumed:0};const o=e[0],{name:i}=o,{attributes:s,elements:a,marks:l=[]}=hi(o);if(i==="w:sdt")return{nodes:[],consumed:0};if(YA(o))return{nodes:[{type:Ta(o),attrs:{...s},marks:[]}],consumed:0};if(!Ta(o))return{nodes:[{type:i,content:a,attrs:{...s},marks:l}],consumed:0,unhandled:!0};const c=[],u=$4(o);if(a&&a.length){const d=a.map(h=>(h.marks||(h.marks=[]),h.marks.push(...l),h)),f={...t,nodes:d,parentStyleId:u},p=r.handler(f);c.push(...p)}return{nodes:[{type:Ta(o),content:c,attrs:{...s},marks:[]}],consumed:1}},$4=t=>{const e=t.elements?.find(n=>n.name==="w:pPr")?.elements?.find(n=>n.name==="w:pStyle");return e?e.attributes["w:val"]:null},O4={handlerName:"standardNodeHandler",handler:T4},M4=t=>{const{nodes:e}=t;return e.length===0||e[0].name!=="w:br"?{nodes:[],consumed:0}:{nodes:[{type:e[0].attributes?.["w:type"]==="page"?"hardBreak":"lineBreak"}],consumed:1}},_4={handlerName:"lineBreakNodeHandler",handler:M4},N4=t=>{const{nodes:e,nodeListHandler:n}=t;if(e.length===0||e[0].name!=="w:bookmarkStart")return{nodes:[],consumed:0};const r=e[0],o=n.handlerEntities.find(a=>a.handlerName==="standardNodeHandler")?.handler;if(!o)return console.error("Standard node handler not found"),{nodes:[],consumed:0};const i={...t,nodes:[r]},s=o(i);return s.nodes.length===1&&(s.nodes[0].attrs.name=r.attributes["w:name"],s.nodes[0].attrs.id=r.attributes["w:id"]),s},D4={handlerName:"bookmarkNodeHandler",handler:N4},I4=t=>{const{nodes:e}=t;return e.length===0||e[0].name!=="sd:autoPageNumber"?{nodes:[],consumed:0}:{nodes:[{type:"page-number"}],consumed:1}},F4={handlerName:"autoPageNumberHandler",handler:I4},B4=t=>{const{nodes:e}=t;if(e.length===0||e[0].name!=="w:tab")return{nodes:[],consumed:0};const n=e[0],{attributes:r={}}=n;return{nodes:[{type:"tab",attrs:{tabSize:r["w:val"]||48},content:[]}],consumed:1}},R4={handlerName:"tabNodeHandler",handler:B4};function L4({docx:t}){const e=Bf(),n=t["word/comments.xml"];if(!n)return;const{elements:r}=n;if(!r||!r.length)return;const{elements:o=[]}=r[0],i=o.map(s=>{const{attributes:a}=s,l=a["w:id"],c=a["w:author"],u=a["w:email"],d=a["w:initials"],f=a["w:date"],p=a["custom:internalId"],h=a["custom:trackedChange"]==="true",m=a["custom:trackedChangeType"],y=a["custom:trackedChangeText"]!=="null"?a["custom:trackedChangeText"]:null,g=a["custom:trackedDeletedText"]!=="null"?a["custom:trackedDeletedText"]:null,x=new Date(f).getTime(),{elements:k}=s,b=k[0],{elements:T}=b,M=e.handler({nodes:s.elements,nodeListHandler:e,docx:t}),{attrs:_}=M[0],F=_["w14:paraId"];return{commentId:p||go(),importedId:l,creatorName:c,creatorEmail:u,createdTime:x,textJson:M[0],initials:d,paraId:F,trackedChange:h,trackedChangeText:y,trackedChangeType:m,trackedDeletedText:g}});return P4({docx:t,comments:i})}const P4=({docx:t,comments:e})=>{const n=t["word/commentsExtended.xml"];if(!n)return[];const{elements:r}=n,{elements:o}=r[0],i=o.filter(s=>s.name==="w15:commentEx");return e.map(s=>{const a=i.find(d=>d.attributes["w15:paraId"]===s.paraId);if(!a)return{...s};const{isDone:l,paraIdParent:c}=z4(a);let u;return c&&(u=e.find(d=>d.paraId===c)),{...s,isDone:l,parentCommentId:u?.commentId}})},z4=t=>{const{attributes:e}=t,n=e["w15:paraId"],r=e["w15:done"]==="1",o=e["w15:paraIdParent"];return{paraId:n,isDone:r,paraIdParent:o}},j4=(t,e,n)=>{const r=sn(IA(t));if(!r)return null;if(e?.telemetry){const s=Object.keys(t).map(a=>{const l=a.split("/");return{filePath:a,fileDepth:l.length,fileType:a.split(".").pop()}});e.telemetry.trackFileStructure({totalFiles:s.length,maxDepth:Math.max(...s.map(a=>a.fileDepth)),totalNodes:0,files:s},e.fileSource,e.documentId,e.documentInternalId)}const o=Bf(),i=r.elements[0].elements.find(s=>s.name==="w:body");if(i){const s=i,a=["w:sectPr"],l=s.elements?.filter(f=>!a.includes(f.name))??[],c=L4({docx:t}),u={},d={type:"doc",content:o.handler({nodes:l,nodeListHandler:o,docx:t,converter:e,editor:n,lists:u}),attrs:{attributes:r.elements[0].attributes}};return d.content.length>1&&e?.telemetry?.trackUsage("document_import",{documentType:"docx",timestamp:new Date().toISOString()}),{pmDoc:d,savedTagsToRestore:s,pageStyles:U4(s,t,e,n),comments:c,linkedStyles:V4(t),numbering:W4(t)}}return null},Bf=()=>{const t=[o4,v4,u4,s4,_4,A4,D4,t4,UA,QA,BA,R4,F4,O4];return{handler:q4(t),handlerEntities:t}},q4=t=>{const e=(r,o,i,s)=>!r||o<0||o>=r.length?{elementIndex:o,error:"index_out_of_bounds",arrayLength:r?.length}:{elementName:r[o]?.name,attributes:i?.attrs,marks:i?.marks,elementPath:s,type:i?.type,content:i?.content},n=({nodes:r,docx:o,insideTrackChange:i,converter:s,editor:a,filename:l,parentStyleId:c,lists:u})=>{if(!r||!r.length)return[];const d=[];try{for(let f=0;f<r.length;f++)try{const p=r.slice(f);if(!p||p.length===0)continue;const{nodes:h,consumed:m,unhandled:y}=t.reduce((x,k)=>x.consumed>0?x:k.handler({nodes:p,docx:o,nodeListHandler:{handler:n,handlerEntities:t},insideTrackChange:i,converter:s,editor:a,filename:l,parentStyleId:c,lists:u}),{nodes:[],consumed:0}),g=e(r,f,h[0],`/word/${l||"document.xml"}`);if(y){if(!g.elementName)continue;s?.telemetry?.trackStatistic("unknown",g);continue}else{s?.telemetry?.trackStatistic("node",g),(g.type==="orderedList"||g.type==="bulletList")&&g.content.forEach(k=>{const b=e([k],0,k,`/word/${l||"document.xml"}`);s?.telemetry?.trackStatistic("attributes",b)});const x=h[0]?.marks?.find(k=>k.type==="highlight");x&&s?.docHiglightColors.add(x.attrs.color.toUpperCase())}m>0&&(f+=m-1),h&&h.forEach(x=>{if(x?.type&&!["runProperties"].includes(x.type)){if(x.type==="text"&&Array.isArray(x.content)&&!x.content.length)return;d.push(x)}})}catch(p){console.debug("Import error",p),a?.emit("exception",{error:p}),s?.telemetry?.trackStatistic("error",{type:"processing_error",message:p.message,name:p.name,stack:p.stack,fileName:`/word/${l||"document.xml"}`})}return d}catch(f){throw console.debug("Error during import",f),a?.emit("exception",{error:f}),s?.telemetry?.trackStatistic("error",{type:"fatal_error",message:f.message,name:f.name,stack:f.stack,fileName:`/word/${l||"document.xml"}`}),f}};return n};function U4(t,e,n,r){const o=t.elements?.find(a=>a.name==="w:sectPr"),i={},s=G4(e);return o?.elements?.forEach(a=>{const{name:l,attributes:c}=a;switch(l){case"w:pgSz":i.pageSize={width:Wt(c["w:w"]),height:Wt(c["w:h"])};break;case"w:pgMar":i.pageMargins={top:Wt(c["w:top"]),right:Wt(c["w:right"]),bottom:Wt(c["w:bottom"]),left:Wt(c["w:left"]),header:Wt(c["w:header"]),footer:Wt(c["w:footer"]),gutter:Wt(c["w:gutter"])};break;case"w:cols":i.columns={space:Wt(c["w:space"]),num:c["w:num"],equalWidth:c["w:equalWidth"]};break;case"w:docGrid":i.docGrid={linePitch:Wt(c["w:linePitch"]),type:c["w:type"]};break;case"w:headerReference":mg(a,"header",e,n,r);break;case"w:footerReference":mg(a,"footer",e,n,r);break;case"w:titlePg":n.headerIds.titlePg=!0}}),i.alternateHeaders=s,i}function V4(t){const e=t["word/styles.xml"];if(!e)return[];const{elements:n}=e.elements[0],r=n.filter(i=>i.name==="w:style");n.find(i=>i.name==="w:latentStyles")?.elements.forEach(i=>{const{attributes:s}=i;r.find(a=>a.attributes["w:styleId"]===s["w:name"])});const o=[];return r.forEach(i=>{const s=i.attributes["w:styleId"],a=x4(s,t),l={id:i.attributes["w:styleId"],type:i.attributes["w:type"],definition:a,attributes:{}};o.push(l)}),o}function H4(t){if(!t)return null;const e=sn(t),{elements:n}=e.elements[0];return Object.keys(rg).forEach(r=>{if(!n.some(o=>o.attributes?.["w:styleId"]===r)){const o=rg[r];e.elements[0].elements.push(o)}}),e}function mg(t,e,n,r,o){const i=n["word/_rels/document.xml.rels"].elements.find(y=>y.name==="Relationships"),{elements:s}=i,a=t.attributes["w:type"],l=t.attributes["r:id"],c=s.find(y=>y.attributes.Id===l).attributes.Target,u=n[`word/${c}`],d=c,f=Bf(),p=f.handler({nodes:u.elements[0].elements,nodeListHandler:f,docx:n,converter:r,editor:o,filename:d});let h,m;e==="header"?(h=r.headers,m=r.headerIds):e==="footer"&&(h=r.footers,m=r.footerIds),h[l]={type:"doc",content:[...p]},m[a]=l}function W4(t){let e=t["word/numbering.xml"];(!e||!e.elements?.length||!e.elements[0].elements?.length)&&(e=iv);const n=e.elements[0].elements,r=n.filter(a=>a.name==="w:abstractNum"),o=n.filter(a=>a.name==="w:num"),i={};r.forEach(a=>{const l=Number(a.attributes["w:abstractNumId"]);i[l]=a});const s={};return o.forEach(a=>{const l=Number(a.attributes["w:numId"]);s[l]=a}),{abstracts:i,definitions:s}}const G4=t=>{const e=t["word/settings.xml"];if(!e||!e.elements?.length)return!1;const{elements:n=[]}=e.elements[0];return!!n.find(r=>r.name==="w:evenAndOddHeaders")};var Io,Cv,Ev,Av,Tv;const Ri=class $v{constructor(e=null){$0(this,Io),this.debug=e?.debug||!1,this.declaration=null,this.documentAttributes=null,this.convertedXml={},this.docx=e?.docx||[],this.media=e?.media||{},this.addedMedia={},this.comments=[],this.docHiglightColors=new Set([]),this.xml=e?.xml,this.declaration=null,this.numbering={},this.numbering=null,this.pageStyles=null,this.initialJSON=null,this.headers={},this.headerIds={default:null,even:null,odd:null,first:null},this.footers={},this.footerIds={default:null,even:null,odd:null,first:null},this.linkedStyles=[],this.json=e?.json,this.tagsNotInSchema=["w:body"],this.savedTagsToRestore=[],this.telemetry=e?.telemetry||null,this.documentInternalId=null,this.fileSource=e?.fileSource||null,this.documentId=e?.documentId||null,(this.docx.length||this.xml)&&this.parseFromXml()}parseFromXml(){this.docx?.forEach(e=>{this.convertedXml[e.name]=this.parseXmlToJson(e.content),e.name==="word/document.xml"&&(this.documentAttributes=this.convertedXml[e.name].elements[0]?.attributes),e.name==="word/styles.xml"&&(this.convertedXml[e.name]=H4(this.convertedXml[e.name]))}),this.initialJSON=this.convertedXml["word/document.xml"],this.initialJSON||(this.initialJSON=this.parseXmlToJson(this.xml)),this.declaration=this.initialJSON?.declaration}parseXmlToJson(e){return JSON.parse(cb.xml2json(e,null,2))}static getStoredSuperdocVersion(e){try{const n=e.find(a=>a.name==="docProps/custom.xml");if(!n)return;const r=new $v,o=n.content,i=r.parseXmlToJson(o).elements.find(a=>a.name==="Properties");if(!i.elements)return;const s=i.elements.find(a=>a.name==="property"&&a.attributes.name==="SuperdocVersion");return s?s.elements[0].elements[0].text:void 0}catch(n){console.warn("Error getting Superdoc version",n);return}}static updateDocumentVersion(e=this.convertedXml,n="0.9.24"){const r="docProps/custom.xml";e[r]||(e[r]=Ov());const o=e["docProps/custom.xml"];if(!o)return;const i=o.elements.find(a=>a.name==="Properties");i.elements||(i.elements=[]);const s=i.elements.find(a=>a.name==="property"&&a.attributes.name==="SuperdocVersion");if(s)s.elements[0].elements[0].elements[0].text=n;else{const a=Mv();i.elements.push(a)}return e}getDocumentDefaultStyles(){const e=this.convertedXml["word/styles.xml"];if(!e)return{};const n=e.elements[0].elements.find(i=>i.name==="w:docDefaults").elements.find(i=>i.name==="w:rPrDefault"),r=n.elements[0].elements,o=r?.find(i=>i.name==="w:rFonts");if("elements"in n){const i=r.find(u=>u.name==="w:rFonts")?.attributes["w:asciiTheme"];let s,a;if(i){const u=this.getThemeInfo(i);s=u.typeface,a=u.panose}else o?s=o?.attributes["w:ascii"]:(e.elements[0].elements.filter(u=>u.name==="w:style"&&u.attributes["w:styleId"]==="Normal")||[]).forEach(u=>{s=u.elements.find(d=>d.name==="w:rPr")?.elements?.find(d=>d.name==="w:rFonts")?.attributes["w:ascii"]});const l=Number(r.find(u=>u.name==="w:sz")?.attributes["w:val"])/2||12,c=r.find(u=>u.name==="w:kern")?.attributes["w:val"];return{fontSizePt:l,kern:c,typeface:s,panose:a}}}getDocumentInternalId(){const e="word/settings.xml";this.convertedXml[e]||(this.convertedXml[e]=FE);const n=Object.assign({},this.convertedXml[e]);if(!n.elements[0]?.elements?.length){const o=this.createDocumentIdElement(n);n.elements[0].elements=[o],n.elements[0].attributes["xmlns:w15"]||(n.elements[0].attributes["xmlns:w15"]="http://schemas.microsoft.com/office/word/2012/wordml"),this.convertedXml[e]=n;return}const r=n.elements[0].elements.find(o=>o.name==="w15:docId");this.documentInternalId=r?.attributes["w15:val"]}createDocumentIdElement(){const e=go().toUpperCase();return this.documentInternalId=e,{type:"element",name:"w15:docId",attributes:{"w15:val":`{${e}}`}}}getThemeInfo(e){e=e.toLowerCase();const n=this.convertedXml["word/theme/theme1.xml"].elements.find(s=>s.name==="a:theme").elements.find(s=>s.name==="a:themeElements").elements.find(s=>s.name==="a:fontScheme");let r;e.startsWith("major")?r=n.elements.find(s=>s.name==="a:majorFont").elements[0]:e.startsWith("minor")&&(r=n.elements.find(s=>s.name==="a:minorFont").elements[0]);const{typeface:o,panose:i}=r.attributes;return{typeface:o,panose:i}}getSchema(e){this.getDocumentInternalId();const n=j4({...this.convertedXml,media:this.media},this,e);return n?(this.savedTagsToRestore.push({...n.savedTagsToRestore}),this.pageStyles=n.pageStyles,this.numbering=n.numbering,this.comments=n.comments,this.linkedStyles=n.linkedStyles,n.pmDoc):null}schemaToXml(e,n=!1){return new cg(this).schemaToXml(e,n)}async exportToDocx(e,n,r,o=!1,i,s=[]){const a=s.map(h=>VE(h)),l=a.map((h,m)=>HE(h,m,a)),{result:c,params:u}=this.exportToXmlJson({data:e,editorSchema:n,comments:s,commentDefinitions:l,commentsExportType:i,isFinalDoc:o}),d=new cg(this).schemaToXml(c);await Xn(this,Io,Tv).call(this,{...r,...u.media,...this.media});let f={...this.convertedXml},p=[];if(s.length){const{documentXml:h,relationships:m}=Xn(this,Io,Ev).call(this,{defs:u.exportedCommentDefs,exportType:i,commentsWithParaIds:a});f={...h},p=m}return this.convertedXml={...this.convertedXml,...f},Xn(this,Io,Av).call(this,[...u.relationships,...p]),K4(this.convertedXml),Xn(this,Io,Cv).call(this,u),d}exportToXmlJson({data:e,editorSchema:n,comments:r,commentDefinitions:o,commentsExportType:i="clean",isFinalDoc:s=!1}){const a=this.savedTagsToRestore.find(u=>u.name==="w:body"),[l,c]=fi({node:e,bodyNode:a,relationships:[],documentMedia:{},media:{},isFinalDoc:s,editorSchema:n,converter:this,pageStyles:this.pageStyles,comments:r,commentsExportType:i,exportedCommentDefs:o});return{result:l,params:c}}};Io=new WeakSet,Cv=function(t){const e="word/numbering.xml";let n=this.convertedXml[e];const r=this.numbering;n||(n=iv);const o=n.elements[0],i=Object.values(r.abstracts).map(a=>a),s=Object.values(r.definitions).map(a=>a);o.elements=[...i,...s],this.convertedXml[e]=n},Ev=function({defs:t,exportType:e,commentsWithParaIds:n}){const{documentXml:r,relationships:o}=ZE({exportType:e,convertedXml:this.convertedXml,defs:t,commentsWithParaIds:n,converter:this});return{documentXml:r,relationships:o}},Av=function(t=[]){const e=this.convertedXml["word/_rels/document.xml.rels"],n=e.elements.find(s=>s.name==="Relationships"),r=[],o=/rId|mi/g;let i=Math.max(...n.elements.map(s=>Number(s.attributes.Id.replace(o,""))));t.forEach(s=>{const a=s.attributes.Id,l=n.elements.find(u=>u.attributes.Target===s.attributes.Target),c=s.attributes.Target?.startsWith("media/")&&a.length>6;l&&!c||(s.attributes.Target=s.attributes?.Target?.replace(/&/g,"&amp;"),s.attributes.Id=a.length>6?a:`rId${++i}`,r.push(s))}),n.elements=[...n.elements,...r],this.convertedXml["word/_rels/document.xml.rels"]=e},Tv=async function(t){const e={};for(const n in t){if(typeof t[n]!="string")return;const r=n.split("/").pop();e[r]=await TE(t[n])}this.convertedXml.media={...this.convertedXml.media,...e},this.media=this.convertedXml.media,this.addedMedia=e},Us(Ri,"allowedElements",Object.freeze({"w:document":"doc","w:body":"body","w:p":"paragraph","w:r":"run","w:t":"text","w:delText":"text","w:br":"lineBreak","w:tbl":"table","w:tr":"tableRow","w:tc":"tableCell","w:drawing":"drawing","w:bookmarkStart":"bookmarkStart","w:sectPr":"sectionProperties","w:rPr":"runProperties","w:commentRangeStart":"commentRangeStart","w:commentRangeEnd":"commentRangeEnd","w:commentReference":"commentReference"})),Us(Ri,"markTypes",[{name:"w:b",type:"bold"},{name:"w:bCs",type:"bold"},{name:"w:i",type:"italic"},{name:"w:iCs",type:"italic"},{name:"w:u",type:"underline",mark:"underline",property:"underlineType"},{name:"w:strike",type:"strike"},{name:"w:color",type:"color",mark:"textStyle",property:"color"},{name:"w:sz",type:"fontSize",mark:"textStyle",property:"fontSize"},{name:"w:szCs",type:"fontSize",mark:"textStyle",property:"fontSize"},{name:"w:rFonts",type:"fontFamily",mark:"textStyle",property:"fontFamily"},{name:"w:jc",type:"textAlign",mark:"textStyle",property:"textAlign"},{name:"w:ind",type:"textIndent",mark:"textStyle",property:"textIndent"},{name:"w:spacing",type:"lineHeight",mark:"textStyle",property:"lineHeight"},{name:"link",type:"link",mark:"link",property:"href"},{name:"w:highlight",type:"highlight",mark:"highlight",property:"color"}]),Us(Ri,"propertyTypes",Object.freeze({"w:pPr":"paragraphProperties","w:rPr":"runProperties","w:sectPr":"sectionProperties","w:numPr":"numberingProperties","w:tcPr":"tableCellProperties"})),Us(Ri,"elements",new Set(["w:document","w:body","w:p","w:r","w:t","w:delText"]));let $r=Ri;function K4(t){const e="docProps/custom.xml";t[e]||(t[e]=Ov());const n=t[e].elements.find(s=>s.name==="Properties");n.elements||(n.elements=[]);const r=n.elements,o=r.filter(s=>typeof s=="object"&&s!==null).filter(s=>{const{attributes:a}=s;return a.name!=="SuperdocVersion"});let i=2;try{i=o.length?Math.max(...r.map(s=>s.attributes.pid))+1:2}catch{}return o.push(Mv(i)),n.elements=o,t}function Ov(){return IE}function Mv(t=2,e="0.9.24"){return{type:"element",name:"property",attributes:{name:"SuperdocVersion",fmtid:"{D5CDD505-2E9C-101B-9397-08002B2CF9AE}",pid:t},elements:[{type:"element",name:"vt:lpwstr",elements:[{type:"text",text:e}]}]}}function Xs(t){throw new Error('Could not dynamically require "'+t+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var _v={exports:{}};(function(t,e){(function(n){t.exports=n()})(function(){return function n(r,o,i){function s(c,u){if(!o[c]){if(!r[c]){var d=typeof Xs=="function"&&Xs;if(!u&&d)return d(c,!0);if(a)return a(c,!0);var f=new Error("Cannot find module '"+c+"'");throw f.code="MODULE_NOT_FOUND",f}var p=o[c]={exports:{}};r[c][0].call(p.exports,function(h){var m=r[c][1][h];return s(m||h)},p,p.exports,n,r,o,i)}return o[c].exports}for(var a=typeof Xs=="function"&&Xs,l=0;l<i.length;l++)s(i[l]);return s}({1:[function(n,r,o){var i=n("./utils"),s=n("./support"),a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";o.encode=function(l){for(var c,u,d,f,p,h,m,y=[],g=0,x=l.length,k=x,b=i.getTypeOf(l)!=="string";g<l.length;)k=x-g,d=b?(c=l[g++],u=g<x?l[g++]:0,g<x?l[g++]:0):(c=l.charCodeAt(g++),u=g<x?l.charCodeAt(g++):0,g<x?l.charCodeAt(g++):0),f=c>>2,p=(3&c)<<4|u>>4,h=1<k?(15&u)<<2|d>>6:64,m=2<k?63&d:64,y.push(a.charAt(f)+a.charAt(p)+a.charAt(h)+a.charAt(m));return y.join("")},o.decode=function(l){var c,u,d,f,p,h,m=0,y=0,g="data:";if(l.substr(0,g.length)===g)throw new Error("Invalid base64 input, it looks like a data url.");var x,k=3*(l=l.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(l.charAt(l.length-1)===a.charAt(64)&&k--,l.charAt(l.length-2)===a.charAt(64)&&k--,k%1!=0)throw new Error("Invalid base64 input, bad content length.");for(x=s.uint8array?new Uint8Array(0|k):new Array(0|k);m<l.length;)c=a.indexOf(l.charAt(m++))<<2|(f=a.indexOf(l.charAt(m++)))>>4,u=(15&f)<<4|(p=a.indexOf(l.charAt(m++)))>>2,d=(3&p)<<6|(h=a.indexOf(l.charAt(m++))),x[y++]=c,p!==64&&(x[y++]=u),h!==64&&(x[y++]=d);return x}},{"./support":30,"./utils":32}],2:[function(n,r,o){var i=n("./external"),s=n("./stream/DataWorker"),a=n("./stream/Crc32Probe"),l=n("./stream/DataLengthProbe");function c(u,d,f,p,h){this.compressedSize=u,this.uncompressedSize=d,this.crc32=f,this.compression=p,this.compressedContent=h}c.prototype={getContentWorker:function(){var u=new s(i.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new l("data_length")),d=this;return u.on("end",function(){if(this.streamInfo.data_length!==d.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),u},getCompressedWorker:function(){return new s(i.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},c.createWorkerFrom=function(u,d,f){return u.pipe(new a).pipe(new l("uncompressedSize")).pipe(d.compressWorker(f)).pipe(new l("compressedSize")).withStreamInfo("compression",d)},r.exports=c},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(n,r,o){var i=n("./stream/GenericWorker");o.STORE={magic:"\0\0",compressWorker:function(){return new i("STORE compression")},uncompressWorker:function(){return new i("STORE decompression")}},o.DEFLATE=n("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(n,r,o){var i=n("./utils"),s=function(){for(var a,l=[],c=0;c<256;c++){a=c;for(var u=0;u<8;u++)a=1&a?3988292384^a>>>1:a>>>1;l[c]=a}return l}();r.exports=function(a,l){return a!==void 0&&a.length?i.getTypeOf(a)!=="string"?function(c,u,d,f){var p=s,h=f+d;c^=-1;for(var m=f;m<h;m++)c=c>>>8^p[255&(c^u[m])];return-1^c}(0|l,a,a.length,0):function(c,u,d,f){var p=s,h=f+d;c^=-1;for(var m=f;m<h;m++)c=c>>>8^p[255&(c^u.charCodeAt(m))];return-1^c}(0|l,a,a.length,0):0}},{"./utils":32}],5:[function(n,r,o){o.base64=!1,o.binary=!1,o.dir=!1,o.createFolders=!0,o.date=null,o.compression=null,o.compressionOptions=null,o.comment=null,o.unixPermissions=null,o.dosPermissions=null},{}],6:[function(n,r,o){var i=null;i=typeof Promise<"u"?Promise:n("lie"),r.exports={Promise:i}},{lie:37}],7:[function(n,r,o){var i=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",s=n("pako"),a=n("./utils"),l=n("./stream/GenericWorker"),c=i?"uint8array":"array";function u(d,f){l.call(this,"FlateWorker/"+d),this._pako=null,this._pakoAction=d,this._pakoOptions=f,this.meta={}}o.magic="\b\0",a.inherits(u,l),u.prototype.processChunk=function(d){this.meta=d.meta,this._pako===null&&this._createPako(),this._pako.push(a.transformTo(c,d.data),!1)},u.prototype.flush=function(){l.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},u.prototype.cleanUp=function(){l.prototype.cleanUp.call(this),this._pako=null},u.prototype._createPako=function(){this._pako=new s[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var d=this;this._pako.onData=function(f){d.push({data:f,meta:d.meta})}},o.compressWorker=function(d){return new u("Deflate",d)},o.uncompressWorker=function(){return new u("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(n,r,o){function i(p,h){var m,y="";for(m=0;m<h;m++)y+=String.fromCharCode(255&p),p>>>=8;return y}function s(p,h,m,y,g,x){var k,b,T=p.file,M=p.compression,_=x!==c.utf8encode,F=a.transformTo("string",x(T.name)),C=a.transformTo("string",c.utf8encode(T.name)),V=T.comment,ie=a.transformTo("string",x(V)),I=a.transformTo("string",c.utf8encode(V)),W=C.length!==T.name.length,A=I.length!==V.length,G="",ae="",J="",ue=T.dir,X=T.date,pe={crc32:0,compressedSize:0,uncompressedSize:0};h&&!m||(pe.crc32=p.crc32,pe.compressedSize=p.compressedSize,pe.uncompressedSize=p.uncompressedSize);var Q=0;h&&(Q|=8),_||!W&&!A||(Q|=2048);var B=0,ee=0;ue&&(B|=16),g==="UNIX"?(ee=798,B|=function(re,K){var $=re;return re||($=K?16893:33204),(65535&$)<<16}(T.unixPermissions,ue)):(ee=20,B|=function(re){return 63&(re||0)}(T.dosPermissions)),k=X.getUTCHours(),k<<=6,k|=X.getUTCMinutes(),k<<=5,k|=X.getUTCSeconds()/2,b=X.getUTCFullYear()-1980,b<<=4,b|=X.getUTCMonth()+1,b<<=5,b|=X.getUTCDate(),W&&(ae=i(1,1)+i(u(F),4)+C,G+="up"+i(ae.length,2)+ae),A&&(J=i(1,1)+i(u(ie),4)+I,G+="uc"+i(J.length,2)+J);var Z="";return Z+=`
30
+ `))}})}function lE(t,e,n){let r=t.resolve(e),o=r.index();return r.parent.canReplaceWith(o,o+1,n)}function cE(t,e,n,r,o){let i=t.doc.nodeAt(e);if(!i)throw new RangeError("No node at given position");n||(n=i.type);let s=n.create(r,null,o||i.marks);if(i.isLeaf)return t.replaceWith(e,e+i.nodeSize,s);if(!n.validContent(i.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new Yt(e,e+i.nodeSize,e+1,e+i.nodeSize-1,new ve(ye.from(s),0,0),1,!0))}function Qn(t,e,n=1,r){let o=t.resolve(e),i=o.depth-n,s=r&&r[r.length-1]||o.parent;if(i<0||o.parent.type.spec.isolating||!o.parent.canReplace(o.index(),o.parent.childCount)||!s.type.validContent(o.parent.content.cutByIndex(o.index(),o.parent.childCount)))return!1;for(let c=o.depth-1,u=n-2;c>i;c--,u--){let d=o.node(c),f=o.index(c);if(d.type.spec.isolating)return!1;let p=d.content.cutByIndex(f,d.childCount),h=r&&r[u+1];h&&(p=p.replaceChild(0,h.type.create(h.attrs)));let m=r&&r[u]||d;if(!d.canReplace(f+1,d.childCount)||!m.type.validContent(p))return!1}let a=o.indexAfter(i),l=r&&r[0];return o.node(i).canReplaceWith(a,a,l?l.type:o.node(i+1).type)}function uE(t,e,n=1,r){let o=t.doc.resolve(e),i=ye.empty,s=ye.empty;for(let a=o.depth,l=o.depth-n,c=n-1;a>l;a--,c--){i=ye.from(o.node(a).copy(i));let u=r&&r[c];s=ye.from(u?u.type.create(u.attrs,s):o.node(a).copy(s))}t.step(new $t(e,e,new ve(i.append(s),n,n),!0))}function Dr(t,e){let n=t.resolve(e),r=n.index();return zb(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function dE(t,e){e.content.size||t.type.compatibleContent(e.type);let n=t.contentMatchAt(t.childCount),{linebreakReplacement:r}=t.type.schema;for(let o=0;o<e.childCount;o++){let i=e.child(o),s=i.type==r?t.type.schema.nodes.text:i.type;if(n=n.matchType(s),!n||!t.type.allowsMarks(i.marks))return!1}return n.validEnd}function zb(t,e){return!!(t&&e&&!t.isLeaf&&dE(t,e))}function jb(t,e,n=-1){let r=t.resolve(e);for(let o=r.depth;;o--){let i,s,a=r.index(o);if(o==r.depth?(i=r.nodeBefore,s=r.nodeAfter):n>0?(i=r.node(o+1),a++,s=r.node(o).maybeChild(a)):(i=r.node(o).maybeChild(a-1),s=r.node(o+1)),i&&!i.isTextblock&&zb(i,s)&&r.node(o).canReplace(a,a+1))return e;if(o==0)break;e=n<0?r.before(o):r.after(o)}}function fE(t,e,n){let r=null,{linebreakReplacement:o}=t.doc.type.schema,i=t.doc.resolve(e-n),s=i.node().type;if(o&&s.inlineContent){let u=s.whitespace=="pre",d=!!s.contentMatch.matchType(o);u&&!d?r=!1:!u&&d&&(r=!0)}let a=t.steps.length;if(r===!1){let u=t.doc.resolve(e+n);Pb(t,u.node(),u.before(),a)}s.inlineContent&&Nf(t,e+n-1,s,i.node().contentMatchAt(i.index()),r==null);let l=t.mapping.slice(a),c=l.map(e-n);if(t.step(new $t(c,l.map(e+n,-1),ve.empty,!0)),r===!0){let u=t.doc.resolve(c);Lb(t,u.node(),u.before(),t.steps.length)}return t}function pE(t,e,n){let r=t.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),n))return e;if(r.parentOffset==0)for(let o=r.depth-1;o>=0;o--){let i=r.index(o);if(r.node(o).canReplaceWith(i,i,n))return r.before(o+1);if(i>0)return null}if(r.parentOffset==r.parent.content.size)for(let o=r.depth-1;o>=0;o--){let i=r.indexAfter(o);if(r.node(o).canReplaceWith(i,i,n))return r.after(o+1);if(i<r.node(o).childCount)return null}return null}function qb(t,e,n){let r=t.resolve(e);if(!n.content.size)return e;let o=n.content;for(let i=0;i<n.openStart;i++)o=o.firstChild.content;for(let i=1;i<=(n.openStart==0&&n.size?2:1);i++)for(let s=r.depth;s>=0;s--){let a=s==r.depth?0:r.pos<=(r.start(s+1)+r.end(s+1))/2?-1:1,l=r.index(s)+(a>0?1:0),c=r.node(s),u=!1;if(i==1)u=c.canReplace(l,l,o);else{let d=c.contentMatchAt(l).findWrapping(o.firstChild.type);u=d&&c.canReplaceWith(l,l,d[0])}if(u)return a==0?r.pos:a<0?r.before(s+1):r.after(s+1)}return null}function Df(t,e,n=e,r=ve.empty){if(e==n&&!r.size)return null;let o=t.resolve(e),i=t.resolve(n);return Ub(o,i,r)?new $t(e,n,r):new hE(o,i,r).fit()}function Ub(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}let hE=class{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=ye.empty;for(let o=0;o<=e.depth;o++){let i=e.node(o);this.frontier.push({type:i.type,match:i.contentMatchAt(e.indexAfter(o))})}for(let o=e.depth;o>0;o--)this.placed=ye.from(e.node(o).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let c=this.findFittable();c?this.placeNodes(c):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,o=this.close(e<0?this.$to:r.doc.resolve(e));if(!o)return null;let i=this.placed,s=r.depth,a=o.depth;for(;s&&a&&i.childCount==1;)i=i.firstChild.content,s--,a--;let l=new ve(i,s,a);return e>-1?new Yt(r.pos,e,this.$to.pos,this.$to.end(),l,n):l.size||r.pos!=this.$to.pos?new $t(r.pos,o.pos,l):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,o=this.unplaced.openEnd;r<e;r++){let i=n.firstChild;if(n.childCount>1&&(o=0),i.type.spec.isolating&&o<=r){e=r;break}n=i.content}for(let n=1;n<=2;n++)for(let r=n==1?e:this.unplaced.openStart;r>=0;r--){let o,i=null;r?(i=Gc(this.unplaced.content,r-1).firstChild,o=i.content):o=this.unplaced.content;let s=o.firstChild;for(let a=this.depth;a>=0;a--){let{type:l,match:c}=this.frontier[a],u,d=null;if(n==1&&(s?c.matchType(s.type)||(d=c.fillBefore(ye.from(s),!1)):i&&l.compatibleContent(i.type)))return{sliceDepth:r,frontierDepth:a,parent:i,inject:d};if(n==2&&s&&(u=c.findWrapping(s.type)))return{sliceDepth:r,frontierDepth:a,parent:i,wrap:u};if(i&&c.matchType(i.type))break}}}openMore(){let{content:e,openStart:n,openEnd:r}=this.unplaced,o=Gc(e,n);return!o.childCount||o.firstChild.isLeaf?!1:(this.unplaced=new ve(e,n+1,Math.max(r,o.size+n>=e.size-r?n+1:0)),!0)}dropNode(){let{content:e,openStart:n,openEnd:r}=this.unplaced,o=Gc(e,n);if(o.childCount<=1&&n>0){let i=e.size-n<=n+o.size;this.unplaced=new ve(_i(e,n-1,1),n-1,i?n-1:r)}else this.unplaced=new ve(_i(e,n,1),n,r)}placeNodes({sliceDepth:e,frontierDepth:n,parent:r,inject:o,wrap:i}){for(;this.depth>n;)this.closeFrontierNode();if(i)for(let m=0;m<i.length;m++)this.openFrontierNode(i[m]);let s=this.unplaced,a=r?r.content:s.content,l=s.openStart-e,c=0,u=[],{match:d,type:f}=this.frontier[n];if(o){for(let m=0;m<o.childCount;m++)u.push(o.child(m));d=d.matchFragment(o)}let p=a.size+e-(s.content.size-s.openEnd);for(;c<a.childCount;){let m=a.child(c),y=d.matchType(m.type);if(!y)break;c++,(c>1||l==0||m.content.size)&&(d=y,u.push(Vb(m.mark(f.allowedMarks(m.marks)),c==1?l:0,c==a.childCount?p:-1)))}let h=c==a.childCount;h||(p=-1),this.placed=Ni(this.placed,n,ye.from(u)),this.frontier[n].match=d,h&&p<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let m=0,y=a;m<p;m++){let g=y.lastChild;this.frontier.push({type:g.type,match:g.contentMatchAt(g.childCount)}),y=g.content}this.unplaced=h?e==0?ve.empty:new ve(_i(s.content,e-1,1),e-1,p<0?s.openEnd:e-1):new ve(_i(s.content,e,c),s.openStart,s.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],n;if(!e.type.isTextblock||!Kc(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(n=this.findCloseLevel(this.$to))&&n.depth==this.depth)return-1;let{depth:r}=this.$to,o=this.$to.after(r);for(;r>1&&o==this.$to.end(--r);)++o;return o}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:r,type:o}=this.frontier[n],i=n<e.depth&&e.end(n+1)==e.pos+(e.depth-(n+1)),s=Kc(e,n,o,r,i);if(s){for(let a=n-1;a>=0;a--){let{match:l,type:c}=this.frontier[a],u=Kc(e,a,c,l,!0);if(!u||u.childCount)continue e}return{depth:n,fit:s,move:i?e.doc.resolve(e.after(n+1)):e}}}}close(e){let n=this.findCloseLevel(e);if(!n)return null;for(;this.depth>n.depth;)this.closeFrontierNode();n.fit.childCount&&(this.placed=Ni(this.placed,n.depth,n.fit)),e=n.move;for(let r=n.depth+1;r<=e.depth;r++){let o=e.node(r),i=o.type.contentMatch.fillBefore(o.content,!0,e.index(r));this.openFrontierNode(o.type,o.attrs,i)}return e}openFrontierNode(e,n=null,r){let o=this.frontier[this.depth];o.match=o.match.matchType(e),this.placed=Ni(this.placed,this.depth,ye.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let e=this.frontier.pop().match.fillBefore(ye.empty,!0);e.childCount&&(this.placed=Ni(this.placed,this.frontier.length,e))}};function _i(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(_i(t.firstChild.content,e-1,n)))}function Ni(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(Ni(t.lastChild.content,e-1,n)))}function Gc(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function Vb(t,e,n){if(e<=0)return t;let r=t.content;return e>1&&(r=r.replaceChild(0,Vb(r.firstChild,e-1,r.childCount==1?n-1:0))),e>0&&(r=t.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(t.type.contentMatch.matchFragment(r).fillBefore(ye.empty,!0)))),t.copy(r)}function Kc(t,e,n,r,o){let i=t.node(e),s=o?t.indexAfter(e):t.index(e);if(s==i.childCount&&!n.compatibleContent(i.type))return null;let a=r.fillBefore(i.content,!0,s);return a&&!mE(n,i.content,s)?a:null}function mE(t,e,n){for(let r=n;r<e.childCount;r++)if(!t.allowsMarks(e.child(r).marks))return!0;return!1}function gE(t){return t.spec.defining||t.spec.definingForContent}function yE(t,e,n,r){if(!r.size)return t.deleteRange(e,n);let o=t.doc.resolve(e),i=t.doc.resolve(n);if(Ub(o,i,r))return t.step(new $t(e,n,r));let s=Wb(o,t.doc.resolve(n));s[s.length-1]==0&&s.pop();let a=-(o.depth+1);s.unshift(a);for(let f=o.depth,p=o.pos-1;f>0;f--,p--){let h=o.node(f).type.spec;if(h.defining||h.definingAsContext||h.isolating)break;s.indexOf(f)>-1?a=f:o.before(f)==p&&s.splice(1,0,-f)}let l=s.indexOf(a),c=[],u=r.openStart;for(let f=r.content,p=0;;p++){let h=f.firstChild;if(c.push(h),p==r.openStart)break;f=h.content}for(let f=u-1;f>=0;f--){let p=c[f],h=gE(p.type);if(h&&!p.sameMarkup(o.node(Math.abs(a)-1)))u=f;else if(h||!p.type.isTextblock)break}for(let f=r.openStart;f>=0;f--){let p=(f+u+1)%(r.openStart+1),h=c[p];if(h)for(let m=0;m<s.length;m++){let y=s[(m+l)%s.length],g=!0;y<0&&(g=!1,y=-y);let x=o.node(y-1),k=o.index(y-1);if(x.canReplaceWith(k,k,h.type,h.marks))return t.replace(o.before(y),g?i.after(y):n,new ve(Hb(r.content,0,r.openStart,p),p,r.openEnd))}}let d=t.steps.length;for(let f=s.length-1;f>=0&&(t.replace(e,n,r),!(t.steps.length>d));f--){let p=s[f];p<0||(e=o.before(p),n=i.after(p))}}function Hb(t,e,n,r,o){if(e<n){let i=t.firstChild;t=t.replaceChild(0,i.copy(Hb(i.content,e+1,n,r,i)))}if(e>r){let i=o.contentMatchAt(0),s=i.fillBefore(t).append(t);t=s.append(i.matchFragment(s).fillBefore(ye.empty,!0))}return t}function wE(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let o=pE(t.doc,e,r.type);o!=null&&(e=n=o)}t.replaceRange(e,n,new ve(ye.from(r),0,0))}function bE(t,e,n){let r=t.doc.resolve(e),o=t.doc.resolve(n),i=Wb(r,o);for(let s=0;s<i.length;s++){let a=i[s],l=s==i.length-1;if(l&&a==0||r.node(a).type.contentMatch.validEnd)return t.delete(r.start(a),o.end(a));if(a>0&&(l||r.node(a-1).canReplace(r.index(a-1),o.indexAfter(a-1))))return t.delete(r.before(a),o.after(a))}for(let s=1;s<=r.depth&&s<=o.depth;s++)if(e-r.start(s)==r.depth-s&&n>r.end(s)&&o.end(s)-n!=o.depth-s&&r.start(s-1)==o.start(s-1)&&r.node(s-1).canReplace(r.index(s-1),o.index(s-1)))return t.delete(r.before(s),n);t.delete(e,n)}function Wb(t,e){let n=[],r=Math.min(t.depth,e.depth);for(let o=r;o>=0;o--){let i=t.start(o);if(i<t.pos-(t.depth-o)||e.end(o)>e.pos+(e.depth-o)||t.node(o).type.spec.isolating||e.node(o).type.spec.isolating)break;(i==e.start(o)||o==t.depth&&o==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&o&&e.start(o-1)==i-1)&&n.push(o)}return n}let Gb=class Ca extends Rt{constructor(e,n,r){super(),this.pos=e,this.attr=n,this.value=r}apply(e){let n=e.nodeAt(this.pos);if(!n)return jt.fail("No node at attribute step's position");let r=Object.create(null);for(let i in n.attrs)r[i]=n.attrs[i];r[this.attr]=this.value;let o=n.type.create(r,null,n.marks);return jt.fromReplace(e,this.pos,this.pos+1,new ve(ye.from(o),0,n.isLeaf?0:1))}getMap(){return ao.empty}invert(e){return new Ca(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Ca(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new Ca(n.pos,n.attr,n.value)}};Rt.jsonID("attr",Gb);let Kb=class id extends Rt{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let o in e.attrs)n[o]=e.attrs[o];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return jt.ok(r)}getMap(){return ao.empty}invert(e){return new id(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new id(n.attr,n.value)}};Rt.jsonID("docAttr",Kb);let Xo=class extends Error{};Xo=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};Xo.prototype=Object.create(Error.prototype);Xo.prototype.constructor=Xo;Xo.prototype.name="TransformError";let Jb=class{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Jo}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new Xo(n.failed);return this}maybeStep(e){let n=e.apply(this.doc);return n.failed||this.addStep(e,n.doc),n}get docChanged(){return this.steps.length>0}addStep(e,n){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=n}replace(e,n=e,r=ve.empty){let o=Df(this.doc,e,n,r);return o&&this.step(o),this}replaceWith(e,n,r){return this.replace(e,n,new ve(ye.from(r),0,0))}delete(e,n){return this.replace(e,n,ve.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return yE(this,e,n,r),this}replaceRangeWith(e,n,r){return wE(this,e,n,r),this}deleteRange(e,n){return bE(this,e,n),this}lift(e,n){return rE(this,e,n),this}join(e,n=1){return fE(this,e,n),this}wrap(e,n){return sE(this,e,n),this}setBlockType(e,n=e,r,o=null){return aE(this,e,n,r,o),this}setNodeMarkup(e,n,r=null,o){return cE(this,e,n,r,o),this}setNodeAttribute(e,n,r){return this.step(new Gb(e,n,r)),this}setDocAttribute(e,n){return this.step(new Kb(e,n)),this}addNodeMark(e,n){return this.step(new Mf(e,n)),this}removeNodeMark(e,n){if(!(n instanceof Ge)){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(n=n.isInSet(r.marks),!n)return this}return this.step(new _f(e,n)),this}split(e,n=1,r){return uE(this,e,n,r),this}addMark(e,n,r){return eE(this,e,n,r),this}removeMark(e,n,r){return tE(this,e,n,r),this}clearIncompatible(e,n,r){return Nf(this,e,n,r),this}};const Jc=Object.create(null);let Re=class{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new Xb(e.min(n),e.max(n))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let n=0;n<e.length;n++)if(e[n].$from.pos!=e[n].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,n=ve.empty){let r=n.content.lastChild,o=null;for(let a=0;a<n.openEnd;a++)o=r,r=r.lastChild;let i=e.steps.length,s=this.ranges;for(let a=0;a<s.length;a++){let{$from:l,$to:c}=s[a],u=e.mapping.slice(i);e.replaceRange(u.map(l.pos),u.map(c.pos),a?ve.empty:n),a==0&&Zm(e,i,(r?r.isInline:o&&o.isTextblock)?-1:1)}}replaceWith(e,n){let r=e.steps.length,o=this.ranges;for(let i=0;i<o.length;i++){let{$from:s,$to:a}=o[i],l=e.mapping.slice(r),c=l.map(s.pos),u=l.map(a.pos);i?e.deleteRange(c,u):(e.replaceRangeWith(c,u,n),Zm(e,r,n.isInline?-1:1))}}static findFrom(e,n,r=!1){let o=e.parent.inlineContent?new Pe(e):No(e.node(0),e.parent,e.pos,e.index(),n,r);if(o)return o;for(let i=e.depth-1;i>=0;i--){let s=n<0?No(e.node(0),e.node(i),e.before(i+1),e.index(i),n,r):No(e.node(0),e.node(i),e.after(i+1),e.index(i)+1,n,r);if(s)return s}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new _n(e.node(0))}static atStart(e){return No(e,e,0,0,1)||new _n(e)}static atEnd(e){return No(e,e,e.content.size,e.childCount,-1)||new _n(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Jc[n.type];if(!r)throw new RangeError(`No selection type ${n.type} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in Jc)throw new RangeError("Duplicate use of selection JSON ID "+e);return Jc[e]=n,n.prototype.jsonID=e,n}getBookmark(){return Pe.between(this.$anchor,this.$head).getBookmark()}};Re.prototype.visible=!0;let Xb=class{constructor(e,n){this.$from=e,this.$to=n}},Xm=!1;function Ym(t){!Xm&&!t.parent.inlineContent&&(Xm=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}let Pe=class Di extends Re{constructor(e,n=e){Ym(e),Ym(n),super(e,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,n){let r=e.resolve(n.map(this.head));if(!r.parent.inlineContent)return Re.near(r);let o=e.resolve(n.map(this.anchor));return new Di(o.parent.inlineContent?o:r,r)}replace(e,n=ve.empty){if(super.replace(e,n),n==ve.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof Di&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Yb(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,n){if(typeof n.anchor!="number"||typeof n.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new Di(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){let o=e.resolve(n);return new this(o,r==n?o:e.resolve(r))}static between(e,n,r){let o=e.pos-n.pos;if((!r||o)&&(r=o>=0?1:-1),!n.parent.inlineContent){let i=Re.findFrom(n,r,!0)||Re.findFrom(n,-r,!0);if(i)n=i.$head;else return Re.near(n,r)}return e.parent.inlineContent||(o==0?e=n:(e=(Re.findFrom(e,-r,!0)||Re.findFrom(e,r,!0)).$anchor,e.pos<n.pos!=o<0&&(e=n))),new Di(e,n)}};Re.jsonID("text",Pe);let Yb=class Zb{constructor(e,n){this.anchor=e,this.head=n}map(e){return new Zb(e.map(this.anchor),e.map(this.head))}resolve(e){return Pe.between(e.resolve(this.anchor),e.resolve(this.head))}},De=class Ii extends Re{constructor(e){let n=e.nodeAfter,r=e.node(0).resolve(e.pos+n.nodeSize);super(e,r),this.node=n}map(e,n){let{deleted:r,pos:o}=n.mapResult(this.anchor),i=e.resolve(o);return r?Re.near(i):new Ii(i)}content(){return new ve(ye.from(this.node),0,0)}eq(e){return e instanceof Ii&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new vE(this.anchor)}static fromJSON(e,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new Ii(e.resolve(n.anchor))}static create(e,n){return new Ii(e.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}};De.prototype.visible=!1;Re.jsonID("node",De);let vE=class Qb{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:r}=e.mapResult(this.anchor);return n?new Yb(r,r):new Qb(r)}resolve(e){let n=e.resolve(this.anchor),r=n.nodeAfter;return r&&De.isSelectable(r)?new De(n):Re.near(n)}},_n=class Ea extends Re{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,n=ve.empty){if(n==ve.empty){e.delete(0,e.doc.content.size);let r=Re.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,n)}toJSON(){return{type:"all"}}static fromJSON(e){return new Ea(e)}map(e){return new Ea(e)}eq(e){return e instanceof Ea}getBookmark(){return xE}};Re.jsonID("all",_n);const xE={map(){return this},resolve(t){return new _n(t)}};function No(t,e,n,r,o,i=!1){if(e.inlineContent)return Pe.create(t,n);for(let s=r-(o>0?0:1);o>0?s<e.childCount:s>=0;s+=o){let a=e.child(s);if(a.isAtom){if(!i&&De.isSelectable(a))return De.create(t,n-(o<0?a.nodeSize:0))}else{let l=No(t,a,n+o,o<0?a.childCount:0,o,i);if(l)return l}n+=a.nodeSize*o}return null}function Zm(t,e,n){let r=t.steps.length-1;if(r<e)return;let o=t.steps[r];if(!(o instanceof $t||o instanceof Yt))return;let i=t.mapping.maps[r],s;i.forEach((a,l,c,u)=>{s==null&&(s=u)}),t.setSelection(Re.near(t.doc.resolve(s),n))}const Qm=1,eg=2,tg=4;let kE=class extends Jb{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(this.updated|Qm)&-3,this.storedMarks=null,this}get selectionSet(){return(this.updated&Qm)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=eg,this}ensureMarks(e){return Ge.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&eg)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&-3,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,n=!0){let r=this.selection;return n&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||Ge.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,n,r){let o=this.doc.type.schema;if(n==null)return e?this.replaceSelectionWith(o.text(e),!0):this.deleteSelection();{if(r==null&&(r=n),r=r??n,!e)return this.deleteRange(n,r);let i=this.storedMarks;if(!i){let s=this.doc.resolve(n);i=r==n?s.marks():s.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(n,r,o.text(e,i)),this.selection.empty||this.setSelection(Re.near(this.selection.$to)),this}}setMeta(e,n){return this.meta[typeof e=="string"?e:e.key]=n,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=tg,this}get scrolledIntoView(){return(this.updated&tg)>0}};function ng(t,e){return!e||!t?t:t.bind(e)}let Fi=class{constructor(e,n,r){this.name=e,this.init=ng(n.init,r),this.apply=ng(n.apply,r)}};const SE=[new Fi("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new Fi("selection",{init(t,e){return t.selection||Re.atStart(e.doc)},apply(t){return t.selection}}),new Fi("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new Fi("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];let Xc=class{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=SE.slice(),n&&n.forEach(r=>{if(this.pluginsByKey[r.key])throw new RangeError("Adding different instances of a keyed plugin ("+r.key+")");this.plugins.push(r),this.pluginsByKey[r.key]=r,r.spec.state&&this.fields.push(new Fi(r.key,r.spec.state,r))})}},Hi=class Bi{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,n=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=n){let o=this.config.plugins[r];if(o.spec.filterTransaction&&!o.spec.filterTransaction.call(o,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let n=[e],r=this.applyInner(e),o=null;for(;;){let i=!1;for(let s=0;s<this.config.plugins.length;s++){let a=this.config.plugins[s];if(a.spec.appendTransaction){let l=o?o[s].n:0,c=o?o[s].state:this,u=l<n.length&&a.spec.appendTransaction.call(a,l?n.slice(l):n,c,r);if(u&&r.filterTransaction(u,s)){if(u.setMeta("appendedTransaction",e),!o){o=[];for(let d=0;d<this.config.plugins.length;d++)o.push(d<s?{state:r,n:n.length}:{state:this,n:0})}n.push(u),r=r.applyInner(u),i=!0}o&&(o[s]={state:r,n:n.length})}}if(!i)return{state:r,transactions:n}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let n=new Bi(this.config),r=this.config.fields;for(let o=0;o<r.length;o++){let i=r[o];n[i.name]=i.apply(e,this[i.name],this,n)}return n}get tr(){return new kE(this)}static create(e){let n=new Xc(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new Bi(n);for(let o=0;o<n.fields.length;o++)r[n.fields[o].name]=n.fields[o].init(e,r);return r}reconfigure(e){let n=new Xc(this.schema,e.plugins),r=n.fields,o=new Bi(n);for(let i=0;i<r.length;i++){let s=r[i].name;o[s]=this.hasOwnProperty(s)?this[s]:r[i].init(e,o)}return o}toJSON(e){let n={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(n.storedMarks=this.storedMarks.map(r=>r.toJSON())),e&&typeof e=="object")for(let r in e){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let o=e[r],i=o.spec.state;i&&i.toJSON&&(n[r]=i.toJSON.call(o,this[o.key]))}return n}static fromJSON(e,n,r){if(!n)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let o=new Xc(e.schema,e.plugins),i=new Bi(o);return o.fields.forEach(s=>{if(s.name=="doc")i.doc=Yr.fromJSON(e.schema,n.doc);else if(s.name=="selection")i.selection=Re.fromJSON(i.doc,n.selection);else if(s.name=="storedMarks")n.storedMarks&&(i.storedMarks=n.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let a in r){let l=r[a],c=l.spec.state;if(l.key==s.name&&c&&c.fromJSON&&Object.prototype.hasOwnProperty.call(n,a)){i[s.name]=c.fromJSON.call(l,e,n[a],i);return}}i[s.name]=s.init(e,i)}}),i}};function ev(t,e,n){for(let r in t){let o=t[r];o instanceof Function?o=o.bind(e):r=="handleDOMEvents"&&(o=ev(o,e,{})),n[r]=o}return n}let Qe=class{constructor(e){this.spec=e,this.props={},e.props&&ev(e.props,this,this.props),this.key=e.key?e.key.key:tv("plugin")}getState(e){return e[this.key]}};const Yc=Object.create(null);function tv(t){return t in Yc?t+"$"+ ++Yc[t]:(Yc[t]=0,t+"$")}let tt=class{constructor(e="key"){this.key=tv(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}};const Wa=t=>t.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`),CE=t=>Wa(t),Aa=Object.freeze({RESOLVED:"resolved",NEW:"new",ADD:"add",UPDATE:"update",DELETED:"deleted",PENDING:"pending",SELECTED:"selected",COMMENTS_LIST:"comments-list",CHANGE_ACCEPTED:"change-accepted",CHANGE_REJECTED:"change-rejected"}),EE={mounted(t,e,n){const r=o=>{t.contains(o.target)||e.value(o)};document.addEventListener("click",r),t.__clickOutsideHandler=r},unmounted(t){document.removeEventListener("click",t.__clickOutsideHandler),delete t.__clickOutsideHandler}};function lo(t){if(t!=null)return typeof t=="string"&&(t=parseFloat(t)),Math.round(t*1440)}function Wt(t){if(t!=null)return typeof t=="string"&&(t=parseInt(t,10)),Math.round(t/1440*100)/100}function et(t){if(t!=null)return t=Wt(t),Math.round(t*96)}function ct(t){if(t!=null)return t=t/96,lo(t)}function Vo(t){if(t!=null)return t/240}function nv(t){if(t!=null)return t*240}function AE(t){if(t!=null)return Math.round(t/2)}function En(t){if(t==null)return;typeof t=="string"&&(t=parseFloat(t));const e=t*96/914400;return Math.round(e)}function vi(t){if(t!=null)return typeof t=="string"&&(t=parseFloat(t)),Math.round(t*9525)}function rv(t){return t==null?void 0:parseFloat(t)/8*1.3333}function ov(t){if(t!=null)return Math.round(t*6)}const TE=async t=>await(await fetch(t)).arrayBuffer(),$E=t=>{const e=new window.DOMParser().parseFromString(t,"text/xml").querySelectorAll("Default");return Array.from(e).map(n=>n.getAttribute("Extension"))},OE=t=>new Map([["yellow","#ffff00"],["green","#00ff00"],["blue","#0000FFFF"],["cyan","#00ffff"],["magenta","#ff00ff"],["red","#ff0000"],["darkYellow","#808000FF"],["darkGreen","#008000FF"],["darkBlue","#000080"],["darkCyan","#008080FF"],["darkMagenta","#800080FF"],["darkGray","#808080FF"],["darkRed","#800000FF"],["lightGray","#C0C0C0FF"],["black","#000"]]).get(t)||null;function ME(t){if(!t||typeof t!="string")return!1;switch(t.length){case 3:return/^[0-9A-F]{3}$/i.test(t);case 6:return/^[0-9A-F]{6}$/i.test(t);case 8:return/^[0-9A-F]{8}$/i.test(t);default:return!1}}const _E=t=>{const e=Number(t).toString(16);return e.length===1?"0"+e:e},NE=t=>"#"+t.match(/\d+/g).map(_E).join("");function Jn(t=8){const e="0123456789abcdef";let n=[];for(let r=0;r<t;r++){const o=Math.floor(Math.random()*e.length);n.push(e[o])}return n.join("")}function If(){return Math.floor(Math.random()*2147483647).toString(16).toUpperCase().padStart(8,"0")}const DE={"xmlns:wpc":"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas","xmlns:cx":"http://schemas.microsoft.com/office/drawing/2014/chartex","xmlns:cx1":"http://schemas.microsoft.com/office/drawing/2015/9/8/chartex","xmlns:cx2":"http://schemas.microsoft.com/office/drawing/2015/10/21/chartex","xmlns:cx3":"http://schemas.microsoft.com/office/drawing/2016/5/9/chartex","xmlns:cx4":"http://schemas.microsoft.com/office/drawing/2016/5/10/chartex","xmlns:cx5":"http://schemas.microsoft.com/office/drawing/2016/5/11/chartex","xmlns:cx6":"http://schemas.microsoft.com/office/drawing/2016/5/12/chartex","xmlns:cx7":"http://schemas.microsoft.com/office/drawing/2016/5/13/chartex","xmlns:cx8":"http://schemas.microsoft.com/office/drawing/2016/5/14/chartex","xmlns:mc":"http://schemas.openxmlformats.org/markup-compatibility/2006","xmlns:aink":"http://schemas.microsoft.com/office/drawing/2016/ink","xmlns:am3d":"http://schemas.microsoft.com/office/drawing/2017/model3d","xmlns:o":"urn:schemas-microsoft-com:office:office","xmlns:oel":"http://schemas.microsoft.com/office/2019/extlst","xmlns:r":"http://schemas.openxmlformats.org/officeDocument/2006/relationships","xmlns:m":"http://schemas.openxmlformats.org/officeDocument/2006/math","xmlns:v":"urn:schemas-microsoft-com:vml","xmlns:wp14":"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing","xmlns:wp":"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing","xmlns:w10":"urn:schemas-microsoft-com:office:word","xmlns:w":"http://schemas.openxmlformats.org/wordprocessingml/2006/main","xmlns:w14":"http://schemas.microsoft.com/office/word/2010/wordml","xmlns:w15":"http://schemas.microsoft.com/office/word/2012/wordml","xmlns:w16cex":"http://schemas.microsoft.com/office/word/2018/wordml/cex","xmlns:w16cid":"http://schemas.microsoft.com/office/word/2016/wordml/cid","xmlns:w16":"http://schemas.microsoft.com/office/word/2018/wordml","xmlns:w16du":"http://schemas.microsoft.com/office/word/2023/wordml/word16du","xmlns:w16sdtdh":"http://schemas.microsoft.com/office/word/2020/wordml/sdtdatahash","xmlns:w16sdtfl":"http://schemas.microsoft.com/office/word/2024/wordml/sdtformatlock","xmlns:w16se":"http://schemas.microsoft.com/office/word/2015/wordml/symex","xmlns:wpg":"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup","xmlns:wpi":"http://schemas.microsoft.com/office/word/2010/wordprocessingInk","xmlns:wne":"http://schemas.microsoft.com/office/word/2006/wordml","xmlns:wps":"http://schemas.microsoft.com/office/word/2010/wordprocessingShape","mc:Ignorable":"w14 w15 w16se w16cid w16 w16cex w16sdtdh w16sdtfl w16du wp14"},IE={elements:[{type:"element",name:"Properties",attributes:{xmlns:"http://schemas.openxmlformats.org/officeDocument/2006/custom-properties","xmlns:vt":"http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes"},elements:[]}]},FE={elements:[{type:"element",name:"w:settings",attributes:{"xmlns:w":"http://schemas.openxmlformats.org/wordprocessingml/2006/main"},elements:[]}]},BE={type:"element",name:"w:r",elements:[{type:"element",name:"w:rPr",elements:[{type:"element",name:"w:rStyle",attributes:{"w:val":"CommentReference"}}]},{type:"element",name:"w:annotationRef"}]},rg={Normal:{type:"element",name:"w:style",attributes:{"w:type":"paragraph","w:default":"1","w:styleId":"Normal"},elements:[{type:"element",name:"w:name",attributes:{"w:val":"Normal"}},{type:"element",name:"w:qFormat"}]},Title:{type:"element",name:"w:style",attributes:{"w:type":"paragraph","w:styleId":"Title"},elements:[{type:"element",name:"w:name",attributes:{"w:val":"Title"}},{type:"element",name:"w:basedOn",attributes:{"w:val":"Normal"}},{type:"element",name:"w:next",attributes:{"w:val":"Normal"}},{type:"element",name:"w:link",attributes:{"w:val":"TitleChar"}},{type:"element",name:"w:uiPriority",attributes:{"w:val":"10"}},{type:"element",name:"w:qFormat"},{type:"element",name:"w:rsid",attributes:{"w:val":"00B72667"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:spacing",attributes:{"w:after":"80"}},{type:"element",name:"w:contextualSpacing"}]},{type:"element",name:"w:rPr",elements:[{type:"element",name:"w:rFonts",attributes:{"w:asciiTheme":"majorHAnsi","w:eastAsiaTheme":"majorEastAsia","w:hAnsiTheme":"majorHAnsi","w:cstheme":"majorBidi"}},{type:"element",name:"w:spacing",attributes:{"w:val":"-10"}},{type:"element",name:"w:kern",attributes:{"w:val":"28"}},{type:"element",name:"w:sz",attributes:{"w:val":"56"}},{type:"element",name:"w:szCs",attributes:{"w:val":"56"}}]}]},Subtitle:{type:"element",name:"w:style",attributes:{"w:type":"paragraph","w:styleId":"Subtitle"},elements:[{type:"element",name:"w:name",attributes:{"w:val":"Subtitle"}},{type:"element",name:"w:basedOn",attributes:{"w:val":"Normal"}},{type:"element",name:"w:next",attributes:{"w:val":"Normal"}},{type:"element",name:"w:link",attributes:{"w:val":"SubtitleChar"}},{type:"element",name:"w:uiPriority",attributes:{"w:val":"11"}},{type:"element",name:"w:qFormat"},{type:"element",name:"w:rsid",attributes:{"w:val":"00B72667"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:numPr",elements:[{type:"element",name:"w:ilvl",attributes:{"w:val":"1"}}]},{type:"element",name:"w:spacing",attributes:{"w:after":"160"}}]},{type:"element",name:"w:rPr",elements:[{type:"element",name:"w:rFonts",attributes:{"w:asciiTheme":"minorHAnsi","w:eastAsiaTheme":"majorEastAsia","w:hAnsiTheme":"minorHAnsi","w:cstheme":"majorBidi"}},{type:"element",name:"w:color",attributes:{"w:val":"595959","w:themeColor":"text1","w:themeTint":"A6"}},{type:"element",name:"w:spacing",attributes:{"w:val":"15"}},{type:"element",name:"w:sz",attributes:{"w:val":"28"}},{type:"element",name:"w:szCs",attributes:{"w:val":"28"}}]}]},Heading1:{type:"element",name:"w:style",attributes:{"w:type":"paragraph","w:styleId":"Heading1"},elements:[{type:"element",name:"w:name",attributes:{"w:val":"heading 1"}},{type:"element",name:"w:basedOn",attributes:{"w:val":"Normal"}},{type:"element",name:"w:next",attributes:{"w:val":"Normal"}},{type:"element",name:"w:link",attributes:{"w:val":"Heading1Char"}},{type:"element",name:"w:uiPriority",attributes:{"w:val":"9"}},{type:"element",name:"w:qFormat"},{type:"element",name:"w:rsid",attributes:{"w:val":"00233D7B"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:keepNext"},{type:"element",name:"w:keepLines"},{type:"element",name:"w:spacing",attributes:{"w:before":"360","w:after":"80"}},{type:"element",name:"w:outlineLvl",attributes:{"w:val":"0"}}]},{type:"element",name:"w:rPr",elements:[{type:"element",name:"w:rFonts",attributes:{"w:asciiTheme":"majorHAnsi","w:eastAsiaTheme":"majorEastAsia","w:hAnsiTheme":"majorHAnsi","w:cstheme":"majorBidi"}},{type:"element",name:"w:color",attributes:{"w:val":"0F4761","w:themeColor":"accent1","w:themeShade":"BF"}},{type:"element",name:"w:sz",attributes:{"w:val":"40"}},{type:"element",name:"w:szCs",attributes:{"w:val":"40"}}]}]},Heading2:{type:"element",name:"w:style",attributes:{"w:type":"paragraph","w:styleId":"Heading2"},elements:[{type:"element",name:"w:name",attributes:{"w:val":"heading 2"}},{type:"element",name:"w:basedOn",attributes:{"w:val":"Normal"}},{type:"element",name:"w:next",attributes:{"w:val":"Normal"}},{type:"element",name:"w:link",attributes:{"w:val":"Heading2Char"}},{type:"element",name:"w:uiPriority",attributes:{"w:val":"9"}},{type:"element",name:"w:semiHidden"},{type:"element",name:"w:unhideWhenUsed"},{type:"element",name:"w:qFormat"},{type:"element",name:"w:rsid",attributes:{"w:val":"00233D7B"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:keepNext"},{type:"element",name:"w:keepLines"},{type:"element",name:"w:spacing",attributes:{"w:before":"160","w:after":"80"}},{type:"element",name:"w:outlineLvl",attributes:{"w:val":"1"}}]},{type:"element",name:"w:rPr",elements:[{type:"element",name:"w:rFonts",attributes:{"w:asciiTheme":"majorHAnsi","w:eastAsiaTheme":"majorEastAsia","w:hAnsiTheme":"majorHAnsi","w:cstheme":"majorBidi"}},{type:"element",name:"w:color",attributes:{"w:val":"0F4761","w:themeColor":"accent1","w:themeShade":"BF"}},{type:"element",name:"w:sz",attributes:{"w:val":"32"}},{type:"element",name:"w:szCs",attributes:{"w:val":"32"}}]}]},Heading3:{type:"element",name:"w:style",attributes:{"w:type":"paragraph","w:styleId":"Heading3"},elements:[{type:"element",name:"w:name",attributes:{"w:val":"heading 3"}},{type:"element",name:"w:basedOn",attributes:{"w:val":"Normal"}},{type:"element",name:"w:next",attributes:{"w:val":"Normal"}},{type:"element",name:"w:link",attributes:{"w:val":"Heading3Char"}},{type:"element",name:"w:uiPriority",attributes:{"w:val":"9"}},{type:"element",name:"w:semiHidden"},{type:"element",name:"w:unhideWhenUsed"},{type:"element",name:"w:qFormat"},{type:"element",name:"w:rsid",attributes:{"w:val":"00233D7B"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:keepNext"},{type:"element",name:"w:keepLines"},{type:"element",name:"w:spacing",attributes:{"w:before":"160","w:after":"80"}},{type:"element",name:"w:outlineLvl",attributes:{"w:val":"2"}}]},{type:"element",name:"w:rPr",elements:[{type:"element",name:"w:rFonts",attributes:{"w:eastAsiaTheme":"majorEastAsia","w:cstheme":"majorBidi"}},{type:"element",name:"w:color",attributes:{"w:val":"0F4761","w:themeColor":"accent1","w:themeShade":"BF"}},{type:"element",name:"w:sz",attributes:{"w:val":"28"}},{type:"element",name:"w:szCs",attributes:{"w:val":"28"}}]}]}},RE={declaration:{attributes:{version:"1.0",encoding:"UTF-8",standalone:"yes"}},elements:[{type:"element",name:"w:comments",attributes:{"xmlns:wpc":"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas","xmlns:cx":"http://schemas.microsoft.com/office/drawing/2014/chartex","xmlns:cx1":"http://schemas.microsoft.com/office/drawing/2015/9/8/chartex","xmlns:cx2":"http://schemas.microsoft.com/office/drawing/2015/10/21/chartex","xmlns:cx3":"http://schemas.microsoft.com/office/drawing/2016/5/9/chartex","xmlns:cx4":"http://schemas.microsoft.com/office/drawing/2016/5/10/chartex","xmlns:cx5":"http://schemas.microsoft.com/office/drawing/2016/5/11/chartex","xmlns:cx6":"http://schemas.microsoft.com/office/drawing/2016/5/12/chartex","xmlns:cx7":"http://schemas.microsoft.com/office/drawing/2016/5/13/chartex","xmlns:cx8":"http://schemas.microsoft.com/office/drawing/2016/5/14/chartex","xmlns:mc":"http://schemas.openxmlformats.org/markup-compatibility/2006","xmlns:aink":"http://schemas.microsoft.com/office/drawing/2016/ink","xmlns:am3d":"http://schemas.microsoft.com/office/drawing/2017/model3d","xmlns:o":"urn:schemas-microsoft-com:office:office","xmlns:oel":"http://schemas.microsoft.com/office/2019/extlst","xmlns:r":"http://schemas.openxmlformats.org/officeDocument/2006/relationships","xmlns:m":"http://schemas.openxmlformats.org/officeDocument/2006/math","xmlns:v":"urn:schemas-microsoft-com:vml","xmlns:wp14":"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing","xmlns:wp":"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing","xmlns:w10":"urn:schemas-microsoft-com:office:word","xmlns:w":"http://schemas.openxmlformats.org/wordprocessingml/2006/main","xmlns:w14":"http://schemas.microsoft.com/office/word/2010/wordml","xmlns:w15":"http://schemas.microsoft.com/office/word/2012/wordml","xmlns:w16cex":"http://schemas.microsoft.com/office/word/2018/wordml/cex","xmlns:w16cid":"http://schemas.microsoft.com/office/word/2016/wordml/cid","xmlns:w16":"http://schemas.microsoft.com/office/word/2018/wordml","xmlns:w16du":"http://schemas.microsoft.com/office/word/2023/wordml/word16du","xmlns:w16sdtdh":"http://schemas.microsoft.com/office/word/2020/wordml/sdtdatahash","xmlns:w16sdtfl":"http://schemas.microsoft.com/office/word/2024/wordml/sdtformatlock","xmlns:w16se":"http://schemas.microsoft.com/office/word/2015/wordml/symex","xmlns:wpg":"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup","xmlns:wpi":"http://schemas.microsoft.com/office/word/2010/wordprocessingInk","xmlns:wne":"http://schemas.microsoft.com/office/word/2006/wordml","xmlns:wps":"http://schemas.microsoft.com/office/word/2010/wordprocessingShape","mc:Ignorable":"w14 w15 w16se w16cid w16 w16cex w16sdtdh w16sdtfl w16du wp14"},elements:[]}]},LE={declaration:{attributes:{version:"1.0",encoding:"UTF-8",standalone:"yes"}},elements:[{type:"element",name:"w15:commentsEx",attributes:{"xmlns:wpc":"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas","xmlns:cx":"http://schemas.microsoft.com/office/drawing/2014/chartex","xmlns:cx1":"http://schemas.microsoft.com/office/drawing/2015/9/8/chartex","xmlns:cx2":"http://schemas.microsoft.com/office/drawing/2015/10/21/chartex","xmlns:cx3":"http://schemas.microsoft.com/office/drawing/2016/5/9/chartex","xmlns:cx4":"http://schemas.microsoft.com/office/drawing/2016/5/10/chartex","xmlns:cx5":"http://schemas.microsoft.com/office/drawing/2016/5/11/chartex","xmlns:cx6":"http://schemas.microsoft.com/office/drawing/2016/5/12/chartex","xmlns:cx7":"http://schemas.microsoft.com/office/drawing/2016/5/13/chartex","xmlns:cx8":"http://schemas.microsoft.com/office/drawing/2016/5/14/chartex","xmlns:mc":"http://schemas.openxmlformats.org/markup-compatibility/2006","xmlns:aink":"http://schemas.microsoft.com/office/drawing/2016/ink","xmlns:am3d":"http://schemas.microsoft.com/office/drawing/2017/model3d","xmlns:o":"urn:schemas-microsoft-com:office:office","xmlns:oel":"http://schemas.microsoft.com/office/2019/extlst","xmlns:r":"http://schemas.openxmlformats.org/officeDocument/2006/relationships","xmlns:m":"http://schemas.openxmlformats.org/officeDocument/2006/math","xmlns:v":"urn:schemas-microsoft-com:vml","xmlns:wp14":"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing","xmlns:wp":"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing","xmlns:w10":"urn:schemas-microsoft-com:office:word","xmlns:w":"http://schemas.openxmlformats.org/wordprocessingml/2006/main","xmlns:w14":"http://schemas.microsoft.com/office/word/2010/wordml","xmlns:w15":"http://schemas.microsoft.com/office/word/2012/wordml","xmlns:w16cex":"http://schemas.microsoft.com/office/word/2018/wordml/cex","xmlns:w16cid":"http://schemas.microsoft.com/office/word/2016/wordml/cid","xmlns:w16":"http://schemas.microsoft.com/office/word/2018/wordml","xmlns:w16du":"http://schemas.microsoft.com/office/word/2023/wordml/word16du","xmlns:w16sdtdh":"http://schemas.microsoft.com/office/word/2020/wordml/sdtdatahash","xmlns:w16sdtfl":"http://schemas.microsoft.com/office/word/2024/wordml/sdtformatlock","xmlns:w16se":"http://schemas.microsoft.com/office/word/2015/wordml/symex","xmlns:wpg":"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup","xmlns:wpi":"http://schemas.microsoft.com/office/word/2010/wordprocessingInk","xmlns:wne":"http://schemas.microsoft.com/office/word/2006/wordml","xmlns:wps":"http://schemas.microsoft.com/office/word/2010/wordprocessingShape","mc:Ignorable":"w14 w15 w16se w16cid w16 w16cex w16sdtdh w16sdtfl w16du wp14"},elements:[]}]},PE={declaration:{attributes:{version:"1.0",encoding:"UTF-8",standalone:"yes"}},elements:[{type:"element",name:"w16cex:commentsExtensible",attributes:{"xmlns:wpc":"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas","xmlns:cx":"http://schemas.microsoft.com/office/drawing/2014/chartex","xmlns:cx1":"http://schemas.microsoft.com/office/drawing/2015/9/8/chartex","xmlns:cx2":"http://schemas.microsoft.com/office/drawing/2015/10/21/chartex","xmlns:cx3":"http://schemas.microsoft.com/office/drawing/2016/5/9/chartex","xmlns:cx4":"http://schemas.microsoft.com/office/drawing/2016/5/10/chartex","xmlns:cx5":"http://schemas.microsoft.com/office/drawing/2016/5/11/chartex","xmlns:cx6":"http://schemas.microsoft.com/office/drawing/2016/5/12/chartex","xmlns:cx7":"http://schemas.microsoft.com/office/drawing/2016/5/13/chartex","xmlns:cx8":"http://schemas.microsoft.com/office/drawing/2016/5/14/chartex","xmlns:cr":"http://schemas.microsoft.com/office/comments/2020/reactions","xmlns:mc":"http://schemas.openxmlformats.org/markup-compatibility/2006","xmlns:aink":"http://schemas.microsoft.com/office/drawing/2016/ink","xmlns:am3d":"http://schemas.microsoft.com/office/drawing/2017/model3d","xmlns:o":"urn:schemas-microsoft-com:office:office","xmlns:oel":"http://schemas.microsoft.com/office/2019/extlst","xmlns:r":"http://schemas.openxmlformats.org/officeDocument/2006/relationships","xmlns:m":"http://schemas.openxmlformats.org/officeDocument/2006/math","xmlns:v":"urn:schemas-microsoft-com:vml","xmlns:wp14":"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing","xmlns:wp":"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing","xmlns:w10":"urn:schemas-microsoft-com:office:word","xmlns:w":"http://schemas.openxmlformats.org/wordprocessingml/2006/main","xmlns:w14":"http://schemas.microsoft.com/office/word/2010/wordml","xmlns:w15":"http://schemas.microsoft.com/office/word/2012/wordml","xmlns:w16cex":"http://schemas.microsoft.com/office/word/2018/wordml/cex","xmlns:w16cid":"http://schemas.microsoft.com/office/word/2016/wordml/cid","xmlns:w16":"http://schemas.microsoft.com/office/word/2018/wordml","xmlns:w16du":"http://schemas.microsoft.com/office/word/2023/wordml/word16du","xmlns:w16sdtdh":"http://schemas.microsoft.com/office/word/2020/wordml/sdtdatahash","xmlns:w16sdtfl":"http://schemas.microsoft.com/office/word/2024/wordml/sdtformatlock","xmlns:w16se":"http://schemas.microsoft.com/office/word/2015/wordml/symex","xmlns:wpg":"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup","xmlns:wpi":"http://schemas.microsoft.com/office/word/2010/wordprocessingInk","xmlns:wne":"http://schemas.microsoft.com/office/word/2006/wordml","xmlns:wps":"http://schemas.microsoft.com/office/word/2010/wordprocessingShape","mc:Ignorable":"w14 w15 w16se w16cid w16 w16cex w16sdtdh w16sdtfl cr w16du wp14"},elements:[]}]},zE={declaration:{attributes:{version:"1.0",encoding:"UTF-8",standalone:"yes"}},elements:[{type:"element",name:"w16cid:commentsIds",attributes:{"xmlns:wpc":"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas","xmlns:cx":"http://schemas.microsoft.com/office/drawing/2014/chartex","xmlns:cx1":"http://schemas.microsoft.com/office/drawing/2015/9/8/chartex","xmlns:cx2":"http://schemas.microsoft.com/office/drawing/2015/10/21/chartex","xmlns:cx3":"http://schemas.microsoft.com/office/drawing/2016/5/9/chartex","xmlns:cx4":"http://schemas.microsoft.com/office/drawing/2016/5/10/chartex","xmlns:cx5":"http://schemas.microsoft.com/office/drawing/2016/5/11/chartex","xmlns:cx6":"http://schemas.microsoft.com/office/drawing/2016/5/12/chartex","xmlns:cx7":"http://schemas.microsoft.com/office/drawing/2016/5/13/chartex","xmlns:cx8":"http://schemas.microsoft.com/office/drawing/2016/5/14/chartex","xmlns:mc":"http://schemas.openxmlformats.org/markup-compatibility/2006","xmlns:aink":"http://schemas.microsoft.com/office/drawing/2016/ink","xmlns:am3d":"http://schemas.microsoft.com/office/drawing/2017/model3d","xmlns:o":"urn:schemas-microsoft-com:office:office","xmlns:oel":"http://schemas.microsoft.com/office/2019/extlst","xmlns:r":"http://schemas.openxmlformats.org/officeDocument/2006/relationships","xmlns:m":"http://schemas.openxmlformats.org/officeDocument/2006/math","xmlns:v":"urn:schemas-microsoft-com:vml","xmlns:wp14":"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing","xmlns:wp":"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing","xmlns:w10":"urn:schemas-microsoft-com:office:word","xmlns:w":"http://schemas.openxmlformats.org/wordprocessingml/2006/main","xmlns:w14":"http://schemas.microsoft.com/office/word/2010/wordml","xmlns:w15":"http://schemas.microsoft.com/office/word/2012/wordml","xmlns:w16cex":"http://schemas.microsoft.com/office/word/2018/wordml/cex","xmlns:w16cid":"http://schemas.microsoft.com/office/word/2016/wordml/cid","xmlns:w16":"http://schemas.microsoft.com/office/word/2018/wordml","xmlns:w16du":"http://schemas.microsoft.com/office/word/2023/wordml/word16du","xmlns:w16sdtdh":"http://schemas.microsoft.com/office/word/2020/wordml/sdtdatahash","xmlns:w16sdtfl":"http://schemas.microsoft.com/office/word/2024/wordml/sdtformatlock","xmlns:w16se":"http://schemas.microsoft.com/office/word/2015/wordml/symex","xmlns:wpg":"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup","xmlns:wpi":"http://schemas.microsoft.com/office/word/2010/wordprocessingInk","xmlns:wne":"http://schemas.microsoft.com/office/word/2006/wordml","xmlns:wps":"http://schemas.microsoft.com/office/word/2010/wordprocessingShape","mc:Ignorable":"w14 w15 w16se w16cid w16 w16cex w16sdtdh w16sdtfl w16du wp14"},elements:[]}]},jE={elements:[{type:"element",name:"Relationships",attributes:{xmlns:"http://schemas.openxmlformats.org/package/2006/relationships"},elements:[{type:"element",name:"Relationship",attributes:{Id:"rId8",Type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable",Target:"fontTable.xml"}},{type:"element",name:"Relationship",attributes:{Id:"rId3",Type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/webSettings",Target:"webSettings.xml"}},{type:"element",name:"Relationship",attributes:{Id:"rId7",Type:"http://schemas.microsoft.com/office/2018/08/relationships/commentsExtensible",Target:"commentsExtensible.xml"}},{type:"element",name:"Relationship",attributes:{Id:"rId2",Type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings",Target:"settings.xml"}},{type:"element",name:"Relationship",attributes:{Id:"rId1",Type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles",Target:"styles.xml"}},{type:"element",name:"Relationship",attributes:{Id:"rId6",Type:"http://schemas.microsoft.com/office/2016/09/relationships/commentsIds",Target:"commentsIds.xml"}},{type:"element",name:"Relationship",attributes:{Id:"rId5",Type:"http://schemas.microsoft.com/office/2011/relationships/commentsExtended",Target:"commentsExtended.xml"}},{type:"element",name:"Relationship",attributes:{Id:"rId10",Type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme",Target:"theme/theme1.xml"}},{type:"element",name:"Relationship",attributes:{Id:"rId4",Type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments",Target:"comments.xml"}}]}]},qE={declaration:{attributes:{version:"1.0",encoding:"UTF-8",standalone:"yes"}},elements:[{type:"element",name:"Types",attributes:{xmlns:"http://schemas.openxmlformats.org/package/2006/content-types"},elements:[{type:"element",name:"Default",attributes:{Extension:"rels",ContentType:"application/vnd.openxmlformats-package.relationships+xml"}},{type:"element",name:"Default",attributes:{Extension:"xml",ContentType:"application/xml"}},{type:"element",name:"Override",attributes:{PartName:"/word/document.xml",ContentType:"application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml"}},{type:"element",name:"Override",attributes:{PartName:"/word/styles.xml",ContentType:"application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml"}},{type:"element",name:"Override",attributes:{PartName:"/word/settings.xml",ContentType:"application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml"}},{type:"element",name:"Override",attributes:{PartName:"/word/webSettings.xml",ContentType:"application/vnd.openxmlformats-officedocument.wordprocessingml.webSettings+xml"}},{type:"element",name:"Override",attributes:{PartName:"/word/comments.xml",ContentType:"application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml"}},{type:"element",name:"Override",attributes:{PartName:"/word/commentsExtended.xml",ContentType:"application/vnd.openxmlformats-officedocument.wordprocessingml.commentsExtended+xml"}},{type:"element",name:"Override",attributes:{PartName:"/word/commentsIds.xml",ContentType:"application/vnd.openxmlformats-officedocument.wordprocessingml.commentsIds+xml"}},{type:"element",name:"Override",attributes:{PartName:"/word/commentsExtensible.xml",ContentType:"application/vnd.openxmlformats-officedocument.wordprocessingml.commentsExtensible+xml"}},{type:"element",name:"Override",attributes:{PartName:"/word/fontTable.xml",ContentType:"application/vnd.openxmlformats-officedocument.wordprocessingml.fontTable+xml"}},{type:"element",name:"Override",attributes:{PartName:"/word/people.xml",ContentType:"application/vnd.openxmlformats-officedocument.wordprocessingml.people+xml"}},{type:"element",name:"Override",attributes:{PartName:"/word/theme/theme1.xml",ContentType:"application/vnd.openxmlformats-officedocument.theme+xml"}},{type:"element",name:"Override",attributes:{PartName:"/docProps/core.xml",ContentType:"application/vnd.openxmlformats-package.core-properties+xml"}},{type:"element",name:"Override",attributes:{PartName:"/docProps/app.xml",ContentType:"application/vnd.openxmlformats-officedocument.extended-properties+xml"}},{type:"element",name:"Override",attributes:{PartName:"/word/numbering.xml",ContentType:"application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml"}}]}]},Do={COMMENTS_XML_DEF:RE,COMMENTS_EXTENDED_XML_DEF:LE,COMMENTS_EXTENSIBLE_XML_DEF:PE,COMMENTS_IDS_XML_DEF:zE,DOCUMENT_RELS_XML_DEF:jE,CONTENT_TYPES:qE},Ft="trackInsert",ut="trackDelete",vt="trackFormat",sn=t=>{if(t)try{return JSON.parse(JSON.stringify(t))}catch(e){console.error("Error in carbonCopy",t,e);return}},iv={declaration:{attributes:{version:"1.0",encoding:"UTF-8",standalone:"yes"}},elements:[{type:"element",name:"w:numbering",attributes:{"xmlns:wpc":"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas","xmlns:cx":"http://schemas.microsoft.com/office/drawing/2014/chartex","xmlns:cx1":"http://schemas.microsoft.com/office/drawing/2015/9/8/chartex","xmlns:cx2":"http://schemas.microsoft.com/office/drawing/2015/10/21/chartex","xmlns:cx3":"http://schemas.microsoft.com/office/drawing/2016/5/9/chartex","xmlns:cx4":"http://schemas.microsoft.com/office/drawing/2016/5/10/chartex","xmlns:cx5":"http://schemas.microsoft.com/office/drawing/2016/5/11/chartex","xmlns:cx6":"http://schemas.microsoft.com/office/drawing/2016/5/12/chartex","xmlns:cx7":"http://schemas.microsoft.com/office/drawing/2016/5/13/chartex","xmlns:cx8":"http://schemas.microsoft.com/office/drawing/2016/5/14/chartex","xmlns:mc":"http://schemas.openxmlformats.org/markup-compatibility/2006","xmlns:aink":"http://schemas.microsoft.com/office/drawing/2016/ink","xmlns:am3d":"http://schemas.microsoft.com/office/drawing/2017/model3d","xmlns:o":"urn:schemas-microsoft-com:office:office","xmlns:oel":"http://schemas.microsoft.com/office/2019/extlst","xmlns:r":"http://schemas.openxmlformats.org/officeDocument/2006/relationships","xmlns:m":"http://schemas.openxmlformats.org/officeDocument/2006/math","xmlns:v":"urn:schemas-microsoft-com:vml","xmlns:wp14":"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing","xmlns:wp":"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing","xmlns:w10":"urn:schemas-microsoft-com:office:word","xmlns:w":"http://schemas.openxmlformats.org/wordprocessingml/2006/main","xmlns:w14":"http://schemas.microsoft.com/office/word/2010/wordml","xmlns:w15":"http://schemas.microsoft.com/office/word/2012/wordml","xmlns:w16cex":"http://schemas.microsoft.com/office/word/2018/wordml/cex","xmlns:w16cid":"http://schemas.microsoft.com/office/word/2016/wordml/cid","xmlns:w16":"http://schemas.microsoft.com/office/word/2018/wordml","xmlns:w16du":"http://schemas.microsoft.com/office/word/2023/wordml/word16du","xmlns:w16sdtdh":"http://schemas.microsoft.com/office/word/2020/wordml/sdtdatahash","xmlns:w16se":"http://schemas.microsoft.com/office/word/2015/wordml/symex","xmlns:wpg":"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup","xmlns:wpi":"http://schemas.microsoft.com/office/word/2010/wordprocessingInk","xmlns:wne":"http://schemas.microsoft.com/office/word/2006/wordml","xmlns:wps":"http://schemas.microsoft.com/office/word/2010/wordprocessingShape","mc:Ignorable":"w14 w15 w16se w16cid w16 w16cex w16sdtdh w16du wp14"},elements:[{type:"element",name:"w:abstractNum",attributes:{"w:abstractNumId":"0","w15:restartNumberingAfterBreak":"0"},elements:[{type:"element",name:"w:nsid",attributes:{"w:val":"16126B07"}},{type:"element",name:"w:multiLevelType",attributes:{"w:val":"hybridMultilevel"}},{type:"element",name:"w:tmpl",attributes:{"w:val":"51EC4E08"}},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"0","w:tplc":"04090001"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"bullet"}},{type:"element",name:"w:lvlText",attributes:{"w:val":""}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"left"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"720","w:hanging":"360"}}]},{type:"element",name:"w:rPr",elements:[{type:"element",name:"w:rFonts",attributes:{"w:ascii":"Symbol","w:hAnsi":"Symbol","w:hint":"default"}}]}]},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"1","w:tplc":"04090003","w:tentative":"1"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"bullet"}},{type:"element",name:"w:lvlText",attributes:{"w:val":"o"}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"left"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"1440","w:hanging":"360"}}]},{type:"element",name:"w:rPr",elements:[{type:"element",name:"w:rFonts",attributes:{"w:ascii":"Courier New","w:hAnsi":"Courier New","w:cs":"Courier New","w:hint":"default"}}]}]},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"2","w:tplc":"04090005","w:tentative":"1"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"bullet"}},{type:"element",name:"w:lvlText",attributes:{"w:val":""}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"left"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"2160","w:hanging":"360"}}]},{type:"element",name:"w:rPr",elements:[{type:"element",name:"w:rFonts",attributes:{"w:ascii":"Wingdings","w:hAnsi":"Wingdings","w:hint":"default"}}]}]},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"3","w:tplc":"04090001","w:tentative":"1"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"bullet"}},{type:"element",name:"w:lvlText",attributes:{"w:val":""}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"left"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"2880","w:hanging":"360"}}]},{type:"element",name:"w:rPr",elements:[{type:"element",name:"w:rFonts",attributes:{"w:ascii":"Symbol","w:hAnsi":"Symbol","w:hint":"default"}}]}]},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"4","w:tplc":"04090003","w:tentative":"1"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"bullet"}},{type:"element",name:"w:lvlText",attributes:{"w:val":"o"}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"left"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"3600","w:hanging":"360"}}]},{type:"element",name:"w:rPr",elements:[{type:"element",name:"w:rFonts",attributes:{"w:ascii":"Courier New","w:hAnsi":"Courier New","w:cs":"Courier New","w:hint":"default"}}]}]},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"5","w:tplc":"04090005","w:tentative":"1"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"bullet"}},{type:"element",name:"w:lvlText",attributes:{"w:val":""}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"left"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"4320","w:hanging":"360"}}]},{type:"element",name:"w:rPr",elements:[{type:"element",name:"w:rFonts",attributes:{"w:ascii":"Wingdings","w:hAnsi":"Wingdings","w:hint":"default"}}]}]},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"6","w:tplc":"04090001","w:tentative":"1"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"bullet"}},{type:"element",name:"w:lvlText",attributes:{"w:val":""}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"left"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"5040","w:hanging":"360"}}]},{type:"element",name:"w:rPr",elements:[{type:"element",name:"w:rFonts",attributes:{"w:ascii":"Symbol","w:hAnsi":"Symbol","w:hint":"default"}}]}]},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"7","w:tplc":"04090003","w:tentative":"1"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"bullet"}},{type:"element",name:"w:lvlText",attributes:{"w:val":"o"}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"left"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"5760","w:hanging":"360"}}]},{type:"element",name:"w:rPr",elements:[{type:"element",name:"w:rFonts",attributes:{"w:ascii":"Courier New","w:hAnsi":"Courier New","w:cs":"Courier New","w:hint":"default"}}]}]},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"8","w:tplc":"04090005","w:tentative":"1"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"bullet"}},{type:"element",name:"w:lvlText",attributes:{"w:val":""}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"left"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"6480","w:hanging":"360"}}]},{type:"element",name:"w:rPr",elements:[{type:"element",name:"w:rFonts",attributes:{"w:ascii":"Wingdings","w:hAnsi":"Wingdings","w:hint":"default"}}]}]}]},{type:"element",name:"w:abstractNum",attributes:{"w:abstractNumId":"1","w15:restartNumberingAfterBreak":"0"},elements:[{type:"element",name:"w:nsid",attributes:{"w:val":"587013BA"}},{type:"element",name:"w:multiLevelType",attributes:{"w:val":"hybridMultilevel"}},{type:"element",name:"w:tmpl",attributes:{"w:val":"EE6417C4"}},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"0","w:tplc":"0409000F"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"decimal"}},{type:"element",name:"w:lvlText",attributes:{"w:val":"%1."}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"left"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"720","w:hanging":"360"}}]}]},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"1","w:tplc":"04090019","w:tentative":"1"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"lowerLetter"}},{type:"element",name:"w:lvlText",attributes:{"w:val":"%2."}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"left"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"1440","w:hanging":"360"}}]}]},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"2","w:tplc":"0409001B","w:tentative":"1"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"lowerRoman"}},{type:"element",name:"w:lvlText",attributes:{"w:val":"%3."}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"right"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"2160","w:hanging":"180"}}]}]},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"3","w:tplc":"0409000F","w:tentative":"1"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"decimal"}},{type:"element",name:"w:lvlText",attributes:{"w:val":"%4."}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"left"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"2880","w:hanging":"360"}}]}]},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"4","w:tplc":"04090019","w:tentative":"1"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"lowerLetter"}},{type:"element",name:"w:lvlText",attributes:{"w:val":"%5."}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"left"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"3600","w:hanging":"360"}}]}]},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"5","w:tplc":"0409001B","w:tentative":"1"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"lowerRoman"}},{type:"element",name:"w:lvlText",attributes:{"w:val":"%6."}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"right"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"4320","w:hanging":"180"}}]}]},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"6","w:tplc":"0409000F","w:tentative":"1"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"decimal"}},{type:"element",name:"w:lvlText",attributes:{"w:val":"%7."}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"left"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"5040","w:hanging":"360"}}]}]},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"7","w:tplc":"04090019","w:tentative":"1"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"lowerLetter"}},{type:"element",name:"w:lvlText",attributes:{"w:val":"%8."}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"left"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"5760","w:hanging":"360"}}]}]},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"8","w:tplc":"0409001B","w:tentative":"1"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"lowerRoman"}},{type:"element",name:"w:lvlText",attributes:{"w:val":"%9."}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"right"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"6480","w:hanging":"180"}}]}]}]},{type:"element",name:"w:num",attributes:{"w:numId":"1","w16cid:durableId":"100147962"},elements:[{type:"element",name:"w:abstractNumId",attributes:{"w:val":"0"}}]},{type:"element",name:"w:num",attributes:{"w:numId":"2","w16cid:durableId":"485517411"},elements:[{type:"element",name:"w:abstractNumId",attributes:{"w:val":"1"}}]}]}]};function og(t,e){const{node:n,commentsExportType:r,exportedCommentDefs:o=[]}=t;if(!o.length||r==="clean")return;const i=n.attrs["w:id"],s=t.comments.find(f=>f.commentId==i);if(!s)return;const a=t.comments?.findIndex(f=>f.commentId===s.commentId),l=s.parentCommentId;let c;l&&(c=t.comments.find(f=>f.commentId===l||f.importedId===l));const u=c?.isInternal||s.isInternal;if(r==="external"&&u||s.resolvedTime)return;let d=UE(e,a);if(e==="End"){const f={name:"w:r",elements:[{name:"w:commentReference",attributes:{"w:id":String(a)}}]};d=[d,f]}return d}const UE=(t,e)=>({name:`w:commentRange${t}`,attributes:{"w:id":String(e)}}),VE=t=>({...t,commentParaId:If()}),HE=(t,e,n)=>{const r=av({node:t.commentJSON}),o={"w:id":String(e),"w:author":t.creatorName||t.importedAuthor?.name,"w:email":t.creatorEmail||t.importedAuthor?.email,"w:date":sv(t.createdTime),"w:initials":WE(t.creatorName),"w:done":t.resolvedTime?"1":"0","w15:paraId":t.commentParaId,"custom:internalId":t.commentId||t.internalId,"custom:trackedChange":t.trackedChange,"custom:trackedChangeText":t.trackedChangeText||null,"custom:trackedChangeType":t.trackedChangeType,"custom:trackedDeletedText":t.deletedText||null};if(t?.parentCommentId){const i=n.find(s=>s.commentId===t.parentCommentId);o["w15:paraIdParent"]=i.commentParaId}return{type:"element",name:"w:comment",attributes:o,elements:[r]}},WE=t=>t?t.replace("(imported)","").trim().split(" ").map(e=>e[0]).join(""):null,sv=t=>new Date(t||Date.now()).toISOString().replace(/\.\d{3}Z$/,"Z"),GE=(t=[],e)=>{const n=sn(e);return t.forEach(r=>{r.elements[0].elements.unshift(BE);const o=r.attributes["w15:paraId"];r.elements[0].attributes["w14:paraId"]=o,r.attributes={"w:id":r.attributes["w:id"],"w:author":r.attributes["w:author"],"w:email":r.attributes["w:email"],"w:date":r.attributes["w:date"],"w:initials":r.attributes["w:initials"],"custom:internalId":r.attributes["custom:internalId"],"custom:trackedChange":r.attributes["custom:trackedChange"],"custom:trackedChangeText":r.attributes["custom:trackedChangeText"],"custom:trackedChangeType":r.attributes["custom:trackedChangeType"],"custom:trackedDeletedText":r.attributes["custom:trackedDeletedText"],"xmlns:custom":"http://schemas.openxmlformats.org/wordprocessingml/2006/main"}}),n.elements[0].elements=t,n},KE=(t=[],e)=>{const n=sn(e),r=t.map(o=>{const i={"w15:paraId":o.commentParaId,"w15:done":o.resolvedTime?"1":"0"},s=o.parentCommentId;if(s){const a=t.find(l=>l.commentId===s);i["w15:paraIdParent"]=a.commentParaId}return{type:"element",name:"w15:commentEx",attributes:i}});return n.elements[0].elements=r,n},JE=(t=[],e,n)=>{const r=sn(e),o=sn(n);return r.elements[0].elements=[],o.elements[0].elements=[],t.forEach(i=>{const s=If(),a={type:"element",name:"w16cid:commentId",attributes:{"w16cid:paraId":i.commentParaId,"w16cid:durableId":s}};r.elements[0].elements.push(a);const l={type:"element",name:"w16cex:commentExtensible",attributes:{"w16cex:durableId":s,"w16cex:dateUtc":sv()}};o.elements[0].elements.push(l)}),{documentIdsUpdated:r,extensibleUpdated:o}},XE=t=>{const e=sn(t);return e["word/comments.xml"]=Do.COMMENTS_XML_DEF,e["word/commentsExtended.xml"]=Do.COMMENTS_EXTENDED_XML_DEF,e["word/commentsExtensible.xml"]=Do.COMMENTS_EXTENSIBLE_XML_DEF,e["word/commentsIds.xml"]=Do.COMMENTS_IDS_XML_DEF,e["[Content_Types].xml"]=Do.CONTENT_TYPES,e},YE=t=>{const e=sn(t);return delete e["word/comments.xml"],delete e["word/commentsExtended.xml"],delete e["word/commentsExtensible.xml"],delete e["word/commentsIds.xml"],e},Ks=t=>({...Do.DOCUMENT_RELS_XML_DEF.elements[0].elements.find(e=>e.attributes.Target===t)}),ZE=({convertedXml:t,defs:e,commentsWithParaIds:n,exportType:r,converter:o})=>{const i=[];if(r==="clean")return{documentXml:YE(t),relationships:i};const s=XE(t);s["word/comments.xml"]=GE(e,s["word/comments.xml"]),i.push(Ks("comments.xml")),s["word/commentsExtended.xml"]=KE(n,s["word/commentsExtended.xml"]),i.push(Ks("commentsExtended.xml"));const{documentIdsUpdated:a,extensibleUpdated:l}=JE(n,s["word/commentsIds.xml"],s["word/commentsExtensible.xml"]);return s["word/commentsIds.xml"]=a,s["word/commentsExtensible.xml"]=l,i.push(Ks("commentsIds.xml")),i.push(Ks("commentsExtensible.xml")),{relationships:i,documentXml:s}};function fi(t){const{type:e}=t.node||{},n={doc:tA,body:QE,paragraph:av,text:nA,bulletList:sg,orderedList:sg,lineBreak:cA,table:uA,tableRow:gA,tableCell:wA,bookmarkStart:xA,fieldAnnotation:OA,tab:fA,image:uv,hardBreak:MA,commentRangeStart:()=>og(t,"Start"),commentRangeEnd:()=>og(t,"End"),commentReference:()=>null};return n[e]?n[e](t):(console.error("No translation function found for node type:",e),null)}function QE(t){const e=t.bodyNode?.elements.find(n=>n.name==="w:sectPr")||{};if(t.converter){const n=t.converter.pageStyles.pageMargins,r=e.elements.find(i=>i.name==="w:pgMar"),{attributes:o}=r;Object.entries(n).forEach(([i,s])=>{const a=lo(s);o[`w:${i}`]=a}),r.attributes=o}return{name:"w:body",elements:[...pi(t),e]}}function av(t){const e=pi(t),n=e.find(i=>i.name==="htmlAnnotation");if(e.length===1&&n)return n.elements;const r=eA(t.node);r&&e.unshift(r);let o={};return t.node.attrs?.rsidRDefault&&(o["w:rsidRDefault"]=t.node.attrs.rsidRDefault),{name:"w:p",elements:e,attributes:o}}function eA(t){const{attrs:e={}}=t,n=[],{styleId:r}=e;r&&n.push({name:"w:pStyle",attributes:{"w:val":r}});const{spacing:o,indent:i,textAlign:s,textIndent:a,marksAttrs:l,keepLines:c,keepNext:u}=e;if(o){const{lineSpaceBefore:d,lineSpaceAfter:f,line:p,lineRule:h}=o,m={};d>=0&&(m["w:before"]=ct(d)),f>=0&&(m["w:after"]=ct(f)),p&&(m["w:line"]=nv(p)),m["w:lineRule"]=h||"auto";const y={name:"w:spacing",attributes:m};n.push(y)}if(i){const{left:d,right:f,firstLine:p,hanging:h}=i,m={};(d||d===0)&&(m["w:left"]=ct(d)),(f||f===0)&&(m["w:right"]=ct(f)),(p||p===0)&&(m["w:firstLine"]=ct(p)),(h||h===0)&&(m["w:hanging"]=ct(h)),a&&!m["w:left"]&&(m["w:left"]=lo(a));const y={name:"w:ind",attributes:m};n.push(y)}else if(a){const d={name:"w:ind",attributes:{"w:left":lo(a)}};n.push(d)}if(s){const d={name:"w:jc",attributes:{"w:val":s}};n.push(d)}if(l){const d=_l(l),f=lv(d);n.push(f)}return c&&n.push({name:"w:keepLines",attributes:{"w:val":c}}),u&&n.push({name:"w:keepNext",attributes:{"w:val":u}}),n.length?{name:"w:pPr",elements:n}:null}function tA(t){const e={type:"body",content:t.node.content};return[{name:"w:document",elements:[fi({...t,node:e})],attributes:DE},t]}function pi(t){const{content:e}=t.node;if(!e)return[];const n=[];return e.forEach(r=>{const o=fi({...t,node:r});o instanceof Array?n.push(...o):n.push(o)}),n.filter(r=>r)}function Ml(t,e){const n=/^\s|\s$/.test(t)?"preserve":null,r=n?{"xml:space":n}:null,o=_l(e);return Ff({name:"w:t",elements:[{text:t,type:"text"}],attributes:r},o)}function nA(t){const{node:e}=t,n=[Ft,ut];if(e.marks?.some(i=>n.includes(i.type)))return oA(t);if(e.marks?.some(i=>i.type==="link"))return iA(t);const{text:r,marks:o=[]}=e;return Ml(r,o)}function rA(t){const e=t.find(n=>n.type===vt);if(e)return{type:"element",name:"w:rPrChange",attributes:{"w:id":e.attrs.id,"w:author":e.attrs.author,"w:authorEmail":e.attrs.authorEmail,"w:date":e.attrs.date},elements:e.attrs.before.map(n=>_l([n])).filter(n=>n!==void 0)}}function oA(t){const{node:e}=t,n=e.marks,r=[Ft,ut,vt],o=n.find(l=>r.includes(l.type)),i=o.type===Ft,s=rA(n);e.marks=n.filter(l=>!r.includes(l.type)),s&&e.marks.push(s);const a=fi({...t,node:e});if(!i){const l=a.elements.find(c=>c.name==="w:t");l.name="w:delText"}return{name:i?"w:ins":"w:del",type:"element",attributes:{"w:id":o.attrs.id,"w:author":o.attrs.author,"w:authorEmail":o.attrs.authorEmail,"w:date":o.attrs.date},elements:[a]}}function Ff(t,e){const n=[t];return e&&e.length&&n.unshift(lv(e)),{name:"w:r",elements:n}}function lv(t=[]){return{name:"w:rPr",elements:t.filter(e=>!!Object.keys(e).length)}}function _l(t=[]){return t.flatMap(e=>e.type==="textStyle"?Object.entries(e.attrs).filter(([n,r])=>r).map(([n,r])=>{const o={type:n,attrs:e.attrs};return ag(o)}):ag(e))}function iA(t){const{node:e}=t,n=e.marks.find(s=>s.type==="link"),r=n.attrs.href;let o=n.attrs.rId;o||(o=cv(t,r)),e.marks=e.marks.filter(s=>s.type!=="link");const i=fi({...t,node:e});return{name:"w:hyperlink",type:"element",attributes:{"r:id":o},elements:[i]}}function cv(t,e){const n="rId"+Jn();return(!t.relationships||!Array.isArray(t.relationships))&&(t.relationships=[]),t.relationships.push({type:"element",name:"Relationship",attributes:{Id:n,Type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink",Target:e,TargetMode:"External"}}),n}function ig(t,e){const n="rId"+Jn(),r={type:"element",name:"Relationship",attributes:{Id:n,Type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",Target:e}};return t.relationships.push(r),n}function sg(t){const{type:e}=t.node,n=lA(t),r=[];return n.forEach(o=>{const{level:i,listType:s,pPrs:a,content:l,attrs:c={}}=o,u=(o.attrs.numId||o.listId)??sA(t),d=aA(i,u,a);l.forEach((f,p)=>{const h=Object.assign({},f);h.attrs={...h.attrs,...o.attrs};const m=fi({...t,node:h});m.elements||(m.elements=[]);const y=m.elements.findIndex(k=>k.name==="w:pPr");if(!m.elements.filter(k=>k.name!=="w:pPr").length){const k=m.elements[y]?.elements.find(T=>T.name==="w:spacing"),b={name:"w:p",type:"element",elements:k?[{name:"w:pPr",type:"element",elements:[k]}]:[]};return r.push(b)}const{attributes:g}=c,{originalInlineRunProps:x}=g||{};if(x&&d.elements.push(x),y===-1?m.elements.unshift(sn(d)):m.elements[y]=sn(d),p!==0){const k=m.elements.find(T=>T.name==="w:pPr"),b=k.elements.findIndex(T=>T.name==="w:numPr");b!==-1&&k.elements.splice(b,1)}r.push(m)})}),r}function sA({abstractId:t,listId:e}){const n={...definition,attributes:{...definition.attributes,"w:abstractNumId":t}},r={type:"element",name:"w:num",attributes:{"w:numId":String(t),"w16cid:durableId":"485517411"},elements:[{name:"w:abstractNumId",attributes:{"w:val":String(e)}}]};return{newAbstractDef:n,newNumDef:r}}function aA(t,e,n=[]){return{name:"w:pPr",type:"element",elements:[{name:"w:numPr",type:"element",elements:[{name:"w:ilvl",type:"element",attributes:{"w:val":t}},{name:"w:numId",type:"element",attributes:{"w:val":e}}]},...n]}}function lA({node:t}){const{content:e,attrs:n={}}=t,{listId:r,syncId:o}=t.attrs||{},i=t.attrs["list-style-type"],{attributes:s={}}=n,a=s?.parentAttributes?.paragraphProperties?.elements?.filter(u=>u.name!=="w:numPr")||[],l=[];function c(u,d=0){!u||!u.length||u.forEach(f=>{const p=f.attrs?.indent;if(p){const{left:g,right:x,firstLine:k,hanging:b}=p,T={};g!==void 0&&(T["w:left"]=ct(g)),x!==void 0&&(T["w:right"]=ct(x)),k!==void 0&&(T["w:firstLine"]=ct(k)),b!==void 0&&(T["w:hanging"]=ct(b));const M={type:"element",name:"w:ind",indentAttrs:T},_=a.findIndex(F=>F.name==="w:ind");_!==-1&&(a[_]=M)}const h=f.content?.filter(g=>g.type==="bulletList"||g.type==="orderedList")||[],m=f.content?.filter(g=>g.type!=="bulletList"&&g.type!=="orderedList")||[],y={...f,content:m,listId:r,level:d,listType:i,syncId:o,pPrs:a};l.push(y),h.length&&c(h[0].content,d+1)})}return c(e),l}function cA(t){const e={},{lineBreakType:n}=t.node?.attrs||{};return n&&(e["w:type"]=n),{name:"w:br",attributes:e}}function uA(t){t.node=dA(t.node,t);const e=pi(t),n=pA(t.node),r=mA(t.node);return e.unshift(n),e.unshift(r),{name:"w:tbl",elements:e}}function dA(t,{editorSchema:e}){const{content:n}=t;for(let r=0;r<n.length;r++){const o=n[r];if(o.content)for(let i=0;i<o.content?.length;i++){const s=o.content[i];if(!s){console.log("no cell");continue}const{attrs:a}=s;if(a.rowspan>1){const l=n.slice(r+1,r+a.rowspan),c={type:s.type,content:[e.nodes.paragraph.createAndFill().toJSON()],attrs:{...s.attrs,colspan:null,rowspan:null,continueMerge:!0}};l.forEach((u,d)=>{u.content.splice(i,0,c)})}}}return t}function fA(t){const{marks:e=[]}=t.node,n=_l(e);return Ff({name:"w:tab"},n)}function pA(t){const e=[],{attrs:n}=t,{tableWidth:r,tableWidthType:o,tableStyleId:i,borders:s,tableIndent:a,tableLayout:l,tableCellSpacing:c}=n;if(i){const u={name:"w:tblStyle",attributes:{"w:val":i}};e.push(u)}if(s){const u=hA(t);e.push(u)}if(a){const{width:u,type:d}=a,f={name:"w:tblInd",attributes:{"w:w":ct(u),"w:type":d}};e.push(f)}if(l){const u={name:"w:tblLayout",attributes:{"w:type":l}};e.push(u)}if(r&&r.width){const u={name:"w:tblW",attributes:{"w:w":ct(r.width),"w:type":r.type}};e.push(u)}return c&&e.push({name:"w:tblCellSpacing",attributes:{"w:w":c.w,"w:type":c.type}}),{name:"w:tblPr",elements:e}}function hA(t){const{borders:e}=t.attrs,n=[];return e?(["top","bottom","left","right","insideH","insideV"].forEach(r=>{const o=e[r];if(!o)return;let i={};!Object.keys(o).length||!o.size?i={"w:val":"nil"}:i={"w:val":"single","w:sz":ov(o.size),"w:space":o.space||0,"w:color":o?.color?.substring(1)||"000000"};const s={name:`w:${r}`,attributes:i};n.push(s)}),{name:"w:tblBorders",elements:n}):void 0}function mA(t){const{gridColumnWidths:e}=t.attrs,n=[];return e?.forEach(r=>{n.push({name:"w:gridCol",attributes:{"w:w":lo(r)}})}),{name:"w:tblGrid",elements:n}}function gA(t){const e=pi(t),n=yA(t.node);return n.elements.length&&e.unshift(n),{name:"w:tr",elements:e}}function yA(t){const{attrs:e}=t,n=[],{rowHeight:r,rowHeightType:o}=e;if(r){const i={"w:val":ct(r)};o&&(i["w:hRule"]=o);const s={name:"w:trHeight",attributes:i};n.push(s)}return{name:"w:trPr",elements:n}}function wA(t){const e=pi({...t,tableCell:t.node}),n=bA(t.node);return e.unshift(n),{name:"w:tc",elements:e}}function bA(t){const e=[],{attrs:n}=t,{colwidth:r=[],cellWidthType:o="dxa",background:i={},colspan:s,rowspan:a,widthUnit:l}=n,c=r.reduce((m,y)=>m+y,0),u={name:"w:tcW",attributes:{"w:w":l==="px"?ct(c):lo(c),"w:type":o}};if(e.push(u),s){const m={name:"w:gridSpan",attributes:{"w:val":`${s}`}};e.push(m)}const{color:d}=i||{};if(d){const m={name:"w:shd",attributes:{"w:fill":d}};e.push(m)}const{cellMargins:f}=n;if(f){const m={name:"w:tcMar",elements:vA(f)};e.push(m)}const{verticalAlign:p}=n;if(p){const m={name:"w:vAlign",attributes:{"w:val":p}};e.push(m)}if(a&&a>1){const m={name:"w:vMerge",type:"element",attributes:{"w:val":"restart"}};e.push(m)}else if(n.continueMerge){const m={name:"w:vMerge",type:"element"};e.push(m)}const{borders:h={}}=n;if(h&&Object.keys(h).length){const m={name:"w:tcBorders",elements:Object.entries(h).map(([y,g])=>g.size?{name:`w:${y}`,attributes:{"w:val":"single","w:color":g.color?g.color.substring(1):"auto","w:sz":ov(g.size),"w:space":g.space||0}}:{name:`w:${y}`,attributes:{"w:val":"nil"}})};e.push(m)}return{name:"w:tcPr",elements:e}}function vA(t){const e=[],{top:n,right:r,bottom:o,left:i}=t;return n!=null&&e.push({name:"w:top",attributes:{"w:w":ct(n)}}),r!=null&&e.push({name:"w:right",attributes:{"w:w":ct(r)}}),o!=null&&e.push({name:"w:bottom",attributes:{"w:w":ct(o)}}),i!=null&&e.push({name:"w:left",attributes:{"w:w":ct(i)}}),e}function xA(t){const e={name:"w:bookmarkStart",attributes:{"w:id":t.node.attrs.id,"w:name":t.node.attrs.name}},n={name:"w:bookmarkEnd",attributes:{"w:id":t.node.attrs.id}};return[e,n]}function ag(t){const e=$r.markTypes.find(i=>i.type===t.type);if(!e)return{};const n={name:e.name,attributes:{}},{attrs:r}=t;let o;switch(t.type){case"bold":case"italic":delete n.attributes,n.type="element";break;case"underline":n.type="element",n.attributes["w:val"]=r.underlineType;break;case"fontSize":o=r.fontSize,n.attributes["w:val"]=o.slice(0,-2)*2;break;case"fontFamily":o=r.fontFamily,["w:ascii","w:eastAsia","w:hAnsi","w:cs"].forEach(s=>{n.attributes[s]=o});break;case"color":let i=r.color.replace(/^#/,"").replace(/;$/,"");i.startsWith("rgb")&&(i=NE(i)),n.attributes["w:val"]=i;break;case"textAlign":n.attributes["w:val"]=r.textAlign;break;case"textIndent":n.attributes["w:firstline"]=lo(r.textIndent);break;case"lineHeight":n.attributes["w:line"]=nv(r.lineHeight);break;case"highlight":n.attributes["w:fill"]=r.color?.substring(1),n.attributes["w:color"]="auto",n.attributes["w:val"]="clear",n.name="w:shd";break}return n}function kA(t){if(!t)return{};const e=t.split(";")[0].split("/")[1];if(!t||e!=="png")return{originalWidth:void 0,originalHeight:void 0};let n=t.split(",")[1].slice(0,50),r=Uint8Array.from(atob(n),i=>i.charCodeAt(0)),o=new DataView(r.buffer,0,28);return{originalWidth:o.getInt32(16),originalHeight:o.getInt32(20)}}function SA(t,e,n,r){let o=t,i=e,s=Math.min(n/t,r/e);return o=Math.round(o*s),i=Math.round(i*s),{scaledWidth:o,scaledHeight:i}}function uv(t,e){const{node:{attrs:n={},marks:r=[]},tableCell:o}=t;let i=n.rId;const s=n.src||n.imageSrc,{originalWidth:a,originalHeight:l}=kA(s);let c=n.size?{w:vi(n.size.width),h:vi(n.size.height)}:e;if(a&&l){const p=En(c.w),h=En(c.h),{scaledWidth:m,scaledHeight:y}=SA(a,l,p,h);c={w:vi(m),h:vi(y)}}if(o){const p=o.attrs.colwidth.reduce((k,b)=>k+b,0),h=o.attrs.cellMargins?.left||8,m=o.attrs.cellMargins?.right||8,y=vi(p-(h+m)),{width:g,height:x}=_A(c.w,c.h,y);g&&x&&(c={w:g,h:x})}if(t.node.type==="image"&&!i){const p=s?.split("word/")[1];i=ig(t,p)}else if(t.node.type==="fieldAnnotation"&&!i){const p=s?.split(";")[0].split("/")[1];if(!p)return dv(t);const h=Jn(4),m=n.fieldId.replace("-","_"),y=`media/${m}_${h}.${p}`;i=ig(t,y),t.media[`${m}_${h}.${p}`]=s}const u=n.originalPadding||{distT:0,distB:0,distL:0,distR:0},d="http://schemas.openxmlformats.org/drawingml/2006/main",f="http://schemas.openxmlformats.org/drawingml/2006/picture";return Ff({name:"w:drawing",elements:[{name:"wp:inline",attributes:u,elements:[{name:"wp:extent",attributes:{cx:c.w,cy:c.h}},{name:"wp:effectExtent",attributes:{l:0,t:0,r:0,b:0}},{name:"wp:docPr",attributes:{id:0,name:"",descr:""}},{name:"wp:cNvGraphicFramePr",elements:[{name:"a:graphicFrameLocks",attributes:{"xmlns:a":d,noChangeAspect:1}}]},{name:"a:graphic",attributes:{"xmlns:a":d},elements:[{name:"a:graphicData",attributes:{uri:f},elements:[{name:"pic:pic",attributes:{"xmlns:pic":f},elements:[{name:"pic:nvPicPr",elements:[{name:"pic:cNvPr",attributes:{id:0,name:"",desc:""}},{name:"pic:cNvPicPr",elements:[{name:"a:picLocks",attributes:{noChangeAspect:1,noChangeArrowheads:1}}]}]},{name:"pic:blipFill",elements:[{name:"a:blip",attributes:{"r:embed":i,cstate:"none"}},{name:"a:srcRect"},{name:"a:stretch",elements:[{name:"a:fillRect"}]}]},{name:"pic:spPr",attributes:{bwMode:"auto"},elements:[{name:"a:xfrm",elements:[{name:"a:ext",attributes:{cx:c.w,cy:c.h}},{name:"a:off",attributes:{x:0,y:0}}]},{name:"a:prstGeom",attributes:{prst:"rect"},elements:[{name:"a:avLst"}]}]}]}]}]}]}]},[])}function dv(t){const{node:{attrs:e={},marks:n=[]}}=t,r=$A(e);return Ml(e.displayLabel,[...n,...r])}function CA(t){const{node:{attrs:e={},marks:n=[]}}=t,r=TC.decode(e.displayLabel);return Ml(r,n)}function EA(t){const{node:{attrs:e={}}}=t,n=new window.DOMParser().parseFromString(e.rawHtml,"text/html"),r=Hi.create({doc:Zr.fromSchema(t.editorSchema).parse(n)}).doc.toJSON();return{name:"htmlAnnotation",elements:pi({node:r})}}function lg(t,e){return uv(t,e)}function AA(t){const{node:{attrs:e={},marks:n=[]}}=t,r=cv(t,e.linkUrl),o=Ml(e.linkUrl,n);return{name:"w:hyperlink",type:"element",attributes:{"r:id":r,"w:history":1},elements:[o]}}function TA(t){const e={w:4286250,h:4286250},n={w:99e4,h:495e3};return{text:dv,image:r=>lg(r,e),signature:r=>lg(r,n),checkbox:CA,html:EA,link:AA}[t]}const $A=(t={})=>{const{fontFamily:e,fontSize:n,bold:r,underline:o,italic:i}=t,s=[];return e&&s.push({type:"fontFamily",attrs:{fontFamily:e}}),n&&s.push({type:"fontSize",attrs:{fontSize:n}}),r&&s.push({type:"bold",attrs:{}}),o&&s.push({type:"underline",attrs:{}}),i&&s.push({type:"italic",attrs:{}}),s};function OA(t){const{node:e,isFinalDoc:n}=t,{attrs:r={}}=e,o=TA(r.type);if(!o)return{};let i,s;if(n)return o(t);i=o(t),s=[i],r.type==="html"&&(s=[...i.elements]);const a="http://schemas.openxmlformats.org/wordprocessingml/2006/main";return{name:"w:sdt",elements:[{name:"w:sdtPr",elements:[{name:"w:tag",attributes:{"w:val":r.fieldId}},{name:"w:alias",attributes:{"w:val":r.displayLabel}},{name:"w:fieldType",attributes:{"xmlns:w":a,"w:val":r.fieldType}},{name:"w:fieldTypeShort",attributes:{"xmlns:w":a,"w:val":r.type}},{name:"w:fieldColor",attributes:{"xmlns:w":a,"w:val":r.fieldColor}},{name:"w:fieldMultipleImage",attributes:{"xmlns:w":a,"w:val":r.multipleImage}}]},{name:"w:sdtContent",elements:s}]}}function MA(){return{name:"w:r",elements:[{name:"w:br",type:"element",attributes:{"w:type":"page"}}]}}var jr,fv,Zc,Qc;let cg=class{constructor(e){$0(this,jr),this.converter=e}schemaToXml(e,n=!1){return Xn(this,jr,fv).call(this,e,n).join("")}};jr=new WeakSet,fv=function(t,e=falase){const n=JSON.parse(JSON.stringify(t)),r=this.converter.declaration.attributes,o=`<?xml${Object.entries(r).map(([s,a])=>` ${s}="${a}"`).join("")}?>`,i=Xn(this,jr,Qc).call(this,n,e);return[o,...i]},Zc=function(t){if(t)return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")},Qc=function(t,e=!1){if(!t)return null;let{name:n}=t;const{elements:r,attributes:o}=t;let i=`<${n}`;for(let l in o){const c=typeof o[l]=="string"?Xn(this,jr,Zc).call(this,o[l]):o[l];i+=` ${l}="${c}"`}const s=n&&(!r||!r.length);s?i+=" />":i+=">";let a=[i];if(n==="w:instrText")a.push(r[0].text);else if(n==="w:t"||n==="w:delText"){const l=Xn(this,jr,Zc).call(this,r[0].text);a.push(l)}else if(r)for(let l of r){const c=Xn(this,jr,Qc).call(this,l);if(!c)continue;const u=c.filter(d=>d!=="<undefined>"&&d!=="</undefined>");a.push(...u)}return s||a.push(`</${n}>`),a};function _A(t,e,n){if(t>n){let r=n/t,o=Math.round(e*r);return{width:n,height:o}}return{width:t,height:e}}const NA='<w:document xmlns:wpc="http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas" xmlns:cx="http://schemas.microsoft.com/office/drawing/2014/chartex" xmlns:cx1="http://schemas.microsoft.com/office/drawing/2015/9/8/chartex" xmlns:cx2="http://schemas.microsoft.com/office/drawing/2015/10/21/chartex" xmlns:cx3="http://schemas.microsoft.com/office/drawing/2016/5/9/chartex" xmlns:cx4="http://schemas.microsoft.com/office/drawing/2016/5/10/chartex" xmlns:cx5="http://schemas.microsoft.com/office/drawing/2016/5/11/chartex" xmlns:cx6="http://schemas.microsoft.com/office/drawing/2016/5/12/chartex" xmlns:cx7="http://schemas.microsoft.com/office/drawing/2016/5/13/chartex" xmlns:cx8="http://schemas.microsoft.com/office/drawing/2016/5/14/chartex" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:aink="http://schemas.microsoft.com/office/drawing/2016/ink" xmlns:am3d="http://schemas.microsoft.com/office/drawing/2017/model3d" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:oel="http://schemas.microsoft.com/office/2019/extlst" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:wp14="http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:w14="http://schemas.microsoft.com/office/word/2010/wordml" xmlns:w15="http://schemas.microsoft.com/office/word/2012/wordml" xmlns:w16cex="http://schemas.microsoft.com/office/word/2018/wordml/cex" xmlns:w16cid="http://schemas.microsoft.com/office/word/2016/wordml/cid" xmlns:w16="http://schemas.microsoft.com/office/word/2018/wordml" xmlns:w16sdtdh="http://schemas.microsoft.com/office/word/2020/wordml/sdtdatahash" xmlns:w16se="http://schemas.microsoft.com/office/word/2015/wordml/symex" xmlns:wpg="http://schemas.microsoft.com/office/word/2010/wordprocessingGroup" xmlns:wpi="http://schemas.microsoft.com/office/word/2010/wordprocessingInk" xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml" xmlns:wps="http://schemas.microsoft.com/office/word/2010/wordprocessingShape" mc:Ignorable="w14 w15 w16se w16cid w16 w16cex w16sdtdh wp14"><w:body></w:body></w:document>',DA=t=>JSON.parse(cb.xml2json(t,null,2)),IA=(t,e=NA)=>t["word/document.xml"]||DA(e),FA=t=>{const{nodes:e}=t;if(e.length===0)return{nodes:[],consumed:0};const n=e[0];switch(n.name){case"w:tbl":return{nodes:[RA(n,t)],consumed:1}}return{nodes:[],consumed:0}},BA={handlerName:"tableNodeHandler",handler:FA};function RA(t,e){const{docx:n,nodeListHandler:r}=e,o=t.elements.find(k=>k.name==="w:tblPr"),i=o.elements.find(k=>k.name==="w:tblBorders")?.elements||[],{borders:s,rowBorders:a}=hv(i),l=o.elements.find(k=>k.name==="w:tblStyle"),c={tableStyleId:l?.attributes["w:val"]},u=o?.elements.find(k=>k.name==="w:tblInd");if(u){const{"w:w":k,"w:type":b}=u.attributes;c.tableIndent={width:et(k),type:b}}const d=o?.elements.find(k=>k.name==="w:tblLayout");if(d){const{"w:type":k}=d.attributes;c.tableLayout=k}const f=pv(l,n),p=o.elements.find(k=>k.name==="w:tblW");p&&(c.tableWidth={width:et(p.attributes["w:w"]),type:p.attributes["w:type"]});const h=o.elements.find(k=>k.name==="w:tblCellSpacing");h&&(c.tableCellSpacing={w:h.attributes["w:w"],type:h.attributes["w:type"]},c.borderCollapse="separate");const m=t.elements.filter(k=>k.name==="w:tr"),y=Object.keys(s)?.length?s:f?.borders,g=Object.keys(a)?.length?a:f?.rowBorders;c.borders=y;const x=[];return m.forEach(k=>{const b=zA(k,t,g,l,e);b.content?.length&&x.push(b)}),{type:"table",content:x,attrs:c}}function LA(t,e,n,r,o=null,i,s){const{docx:a,nodeListHandler:l}=s,c=t.elements.find(V=>V.name==="w:tcPr"),u=c?.elements?.find(V=>V.name==="w:tcBorders"),d=PA(u,r);mv(n);const f=c?.elements?.find(V=>V.name==="w:tcW");let p=f?et(f.attributes["w:w"]):null;const h=f?.attributes["w:type"];!p&&o&&(p=o);const m=ug(t),{attributes:y}=m||{},g={color:c?.elements?.find(V=>V.name==="w:shd")?.attributes["w:fill"]},x=c?.elements?.find(V=>V.name==="w:gridSpan")?.attributes["w:val"],k=c?.elements?.find(V=>V.name==="w:tcMar"),b=c?.elements?.find(V=>V.name==="w:vAlign")?.attributes["w:val"]||"top",T={},M=pv(i,a)||{};T.cellMargins=jA(k,M);const{fontSize:_,fonts:F={}}=M,C=F.ascii;if(p&&(T.colwidth=[p],T.widthUnit="px"),h&&(T.widthType=h),x&&(T.colspan=Number(x)),g&&(T.background=g),T.verticalAlign=b,_&&(T.fontSize=_),C&&(T.fontFamily=C.ascii),r&&(T.borders={...r}),d&&(T.borders=Object.assign(T.borders||{},d)),y&&y["w:val"]==="restart"){const V=n.elements.filter(G=>G.name==="w:tr"),ie=V.findIndex(G=>G===e),I=V.slice(ie+1);let W=e.elements.filter(G=>G.name==="w:tc").findIndex(G=>G===t),A=1;for(let G of I){const ae=G.elements.findIndex(pe=>pe.name==="w:tc"),J=G.elements[ae+W];if(!J)break;const ue=ug(J),{attributes:X}=ue||{};if(!ue&&!X||X&&X["w:val"]==="restart")break;A++,G.elements.splice(ae+W,1)}T.rowspan=A}return{type:"tableCell",content:l.handler({...s,nodes:t.elements}),attrs:T}}const ug=t=>t.elements.find(e=>e.name==="w:tcPr")?.elements?.find(e=>e.name==="w:vMerge"),Js=(t,e,n={})=>{const r=t?.elements?.find(o=>o.name===`w:${e}`)?.attributes;if(r&&r["w:val"]!=="nil"){const o={},i=r["w:color"];i&&(o.color=i==="auto"?"#000000":`#${i}`);const s=r["w:sz"];return s&&(o.size=rv(s)),o}if(r&&r["w:val"]==="nil"){const o=Object.assign({},n[e]||{});return Object.keys(o)?(o.val="none",o):null}return null},PA=(t,e)=>{if(!t)return null;const n={},r=Js(t,"bottom",e);r&&(n.bottom=r);const o=Js(t,"top",e);o&&(n.top=o);const i=Js(t,"left",e);i&&(n.left=i);const s=Js(t,"right",e);return s&&(n.right=s),n};function pv(t,e,n){if(!t)return null;const r={},{attributes:o={}}=t,i=o["w:val"];if(!i)return null;const s=e["word/styles.xml"],{elements:a}=s.elements[0],l=a.filter(m=>m.name==="w:style"),c=l.find(m=>m.attributes["w:styleId"]===i);if(!c)return null;r.name=c.elements.find(m=>m.name==="w:name");const u=c.elements.find(m=>m.name==="w:basedOn");c.elements.find(m=>m.name==="w:uiPriority");let d;if(u?.attributes){const m=l.find(y=>y.attributes["w:styleId"]===u.attributes["w:val"]);d=m?m.elements.find(y=>y.name==="w:tblPr"):{}}const f=c.elements.find(m=>m.name==="w:pPr");if(f){const m=f.elements.find(y=>y.name==="w:jc");m?.attributes&&(r.justification=m.attributes["w:val"])}const p=c?.elements.find(m=>m.name==="w:rPr");if(p){const m=p.elements.find(g=>g.name==="w:rFonts");if(m){const{"w:ascii":g,"w:hAnsi":x,"w:cs":k}=m.attributes;r.fonts={ascii:g,hAnsi:x,cs:k}}const y=p.elements.find(g=>g.name==="w:sz");y?.attributes&&(r.fontSize=AE(y.attributes["w:val"])+"pt")}const h=c.elements.find(m=>m.name==="w:tblPr");if(h&&h.elements){d&&d.elements&&h.elements.push(...d.elements);const m=h?.elements?.find(b=>b.name==="w:tblBorders"),{elements:y=[]}=m||{},{borders:g,rowBorders:x}=hv(y);g&&(r.borders=g),x&&(r.rowBorders=x);const k=h?.elements.find(b=>b.name==="w:tblCellMar");if(k){const b=k.elements.find(F=>F.name==="w:left"),T=k.elements.find(F=>F.name==="w:right"),M=k.elements.find(F=>F.name==="w:top"),_=k.elements.find(F=>F.name==="w:bottom");r.cellMargins={marginLeft:b?.attributes["w:w"],marginRight:T?.attributes["w:w"],marginTop:M?.attributes["w:w"],marginBottom:_?.attributes["w:w"]}}}return r}function hv(t){const e={},n={};return t.forEach(r=>{const{name:o}=r,i=o.split("w:")[1],{attributes:s}=r,a={},l=s["w:color"],c=s["w:sz"];l&&l!=="auto"&&(a.color=l.startsWith("#")?l:`#${l}`),c&&c!=="auto"&&(a.size=rv(c)),["insideH","insideV"].includes(i)&&(n[i]=a),e[i]=a}),{borders:e,rowBorders:n}}function zA(t,e,n,r,o){const i={},s=t.elements.find(d=>d.name==="w:trPr")?.elements?.find(d=>d.name==="w:trHeight"),a=s?.attributes["w:val"];s?.attributes["w:hRule"];const l={};n?.insideH&&(l.bottom=n.insideH),n?.insideV&&(l.right=n.insideV),i.borders=l,a&&(i.rowHeight=et(a));const c=mv(e),u=t.elements.filter(d=>d.name==="w:tc");return{type:"tableRow",content:u?.map((d,f)=>{const p=u.length>1?c[f]:null;return LA(d,t,e,l,p,r,o)})||[],attrs:i}}const jA=(t,e)=>{const n=t?.elements?.find(m=>m.name==="w:left"),r=t?.elements?.find(m=>m.name==="w:right"),o=t?.elements?.find(m=>m.name==="w:top"),i=t?.elements?.find(m=>m.name==="w:bottom"),s=n?.attributes["w:w"],a=r?.attributes["w:w"],l=o?.attributes["w:w"],c=i?.attributes["w:w"],{cellMargins:u={}}=e,{marginLeft:d,marginRight:f,marginTop:p,marginBottom:h}=u;return{left:et(s??d),right:et(a??f),top:et(l??p),bottom:et(c??h)}},mv=t=>t.elements.find(e=>e.name==="w:tblGrid")?.elements?.flatMap(e=>e.name!=="w:gridCol"?[]:et(e.attributes["w:w"]))||{},qA=t=>{const{nodes:e,filename:n}=t;if(e.length===0||e[0].name!=="w:drawing")return{nodes:[],consumed:0};const r=e[0];let o;const{elements:i}=r,s=n||null;i.find(l=>l.name==="wp:anchor")&&(o=dg(i[0],s,t));const a=i.find(l=>l.name==="wp:inline");return a&&(o=dg(a,s,t)),{nodes:o?[o]:[],consumed:1}};function dg(t,e,n){const{docx:r}=n,{attributes:o}=t,i={top:En(o.distT),bottom:En(o.distB),left:En(o.distL),right:En(o.distR)},s=t.elements.find(M=>M.name==="wp:extent"),a={width:En(s.attributes?.cx),height:En(s.attributes?.cy)},l=t.elements.find(M=>M.name==="a:graphic").elements.find(M=>M.name==="a:graphicData").elements.find(M=>M.name==="pic:pic");if(!l||!l.elements)return null;const c=l.elements.find(M=>M.name==="pic:blipFill").elements.find(M=>M.name==="a:blip"),u=t.elements.find(M=>M.name==="wp:positionH")?.elements.find(M=>M.name==="wp:posOffset"),d=En(u?.elements[0]?.text),f=t.elements.find(M=>M.name==="wp:positionV")?.elements.find(M=>M.name==="wp:posOffset"),p=En(f?.elements[0]?.text),h={left:d,top:p},{attributes:m}=c,y=m["r:embed"];let g=r[`word/_rels/${e||"document.xml"}.rels`];g||(g=r["word/_rels/document.xml.rels"]);const x=g.elements.find(M=>M.name==="Relationships"),{elements:k}=x,b=k.find(M=>M.attributes.Id===y),{attributes:T}=b;return{type:"image",attrs:{src:`word/${T.Target}`,alt:"Image",inline:!0,padding:i,marginOffset:h,size:a,originalPadding:{distT:o.distT,distB:o.distB,distL:o.distL,distR:o.distR},rId:T.Id}}}const UA={handlerName:"drawingNodeHandler",handler:qA};function Yo(t,e=[],n=null){const r=[],o=new Set;return t?.elements?.forEach(i=>{const s=$r.markTypes.filter(a=>a.name===i.name);s.length||["w:shd","w:rStyle","w:pStyle","w:numPr","w:outlineLvl","w:bdr","w:pBdr","w:noProof","w:contextualSpacing","w:keepNext","w:tabs","w:keepLines"].includes(i.name)&&e.push(i.name),s.forEach(a=>{if(!a||o.has(a.type))return;o.add(a.type);const{attributes:l={}}=i,c={type:a.type};if(!(l["w:val"]=="0"||l["w:val"]==="none")){if(a.mark&&(c.type=a.mark),Object.keys(l).length){const u=HA(a.type,l,n);if(u==null)return;c.attrs={},c.attrs[a.property]=u}r.push(c)}})}),sd(r)}function VA(t,e){const n=t.elements?.find(s=>s.name==="w:rPrChange");if(!n)return[];const{attributes:r}=n,o={id:r["w:id"],date:r["w:date"],author:r["w:author"],authorEmail:r["w:authorEmail"]},i=Yo(n);return[{type:vt,attrs:{...o,before:i,after:[...e]}}]}function sd(t){const e=t.filter(o=>o.type==="textStyle"),n=t.filter(o=>o.type!=="textStyle"),r={};return e.length&&e.forEach(o=>{const{attrs:i={}}=o;Object.keys(i).forEach(s=>{r[s]=i[s]})}),[...n,{type:"textStyle",attrs:r}]}function HA(t,e,n){t==="tabs"&&(t="textIndent");const r={color:()=>`#${e["w:val"]}`,fontSize:()=>`${e["w:val"]/2}pt`,textIndent:()=>GA(e),fontFamily:()=>WA(e,n),lineHeight:()=>KA(e),textAlign:()=>e["w:val"],link:()=>e.href,underline:()=>e["w:val"],bold:()=>e?.["w:val"]||null,italic:()=>e?.["w:val"]||null,highlight:()=>JA(e)};if(t in r||console.debug("❗️❗️ No value mapper for:",t,"Attributes:",e),t in r)return r[t],r[t]()}function WA(t,e){const n=t["w:ascii"],r=t["w:asciiTheme"];if(!e||!r)return n;const o=e["word/theme/theme1.xml"];if(!o)return n;const{elements:i}=o,{elements:s}=i[0];return s.find(a=>a.name==="a:themeElements").elements.find(a=>a.name==="a:fontScheme").elements.find(a=>a.name==="a:majorFont").elements.find(a=>a.name==="a:latin").attributes.typeface}function GA(t){let e=t["w:left"];return e?`${Wt(e)}in`:null}function KA(t){let e=t["w:line"];return!e||e==="0"?null:`${Vo(e)}`}function JA(t){return t["w:fill"]?`#${t["w:fill"]}`:ME(t?.["w:val"])?`#${t["w:val"]}`:OE(t?.["w:val"])||null}function hi(t,e){const n=[],r=[],{attributes:o={},elements:i=[]}=t,{nodes:s,paragraphProperties:a={},runProperties:l={}}=XA(i);return i.find(c=>c.name==="w:r")&&(a.elements=a?.elements?.filter(c=>c.name!=="w:rPr")),l&&l?.elements?.length&&n.push(...Yo(l,r)),a&&a.elements?.length&&n.push(...Yo(a,r)),n.push(...VA(l,n)),a&&a.elements?.length&&(o.paragraphProperties=a),n&&t.name==="w:p"&&n.forEach(c=>{const u=Object.keys(c.attrs??{})[0];if(u){const d=c.attrs[u];o[u]=d}}),{elements:s,attributes:o,marks:n,unknownMarks:r}}function XA(t){const e=t.find(o=>o.name==="w:pPr"),n=t.find(o=>o.name==="w:rPr"),r=t.find(o=>o.name==="w:sectPr");return{nodes:t.filter(o=>o.name!=="w:pPr"&&o.name!=="w:rPr"&&o.name!=="w:sectPr"),paragraphProperties:e,runProperties:n,sectionProperties:r}}function Ta(t){return $r.allowedElements[t.name||t.type]}const YA=t=>!!$r.propertyTypes[t.name||t.type];function gv(t){return t.filter(e=>e.name==="w:r").some(e=>e.elements.some(n=>n.name==="w:t"))}const ZA=t=>{const{nodes:e,nodeListHandler:n}=t;if(e.length===0||!(e[0].name==="w:del"||e[0].name==="w:ins"))return{nodes:[],consumed:0};const r=e[0],{name:o}=r,{attributes:i,elements:s}=hi(r),a=n.handler({...t,insideTrackChange:!0,nodes:s}),l=o==="w:del"?ut:Ft,c={id:i["w:id"],date:i["w:date"],author:i["w:author"],authorEmail:i["w:authorEmail"]};return a.forEach(u=>{u.marks===void 0&&(u.marks=[]),u.marks.push({type:l,attrs:c})}),{nodes:a,consumed:1}},QA={handlerName:"trackChangeNodeHandler",handler:ZA},e4=t=>{const{nodes:e,docx:n,nodeListHandler:r}=t;if(e.length===0||e[0].name!=="w:hyperlink")return{nodes:[],consumed:0};const o=e[0],i=n["word/_rels/document.xml.rels"].elements.find(m=>m.name==="Relationships"),{elements:s}=i,{attributes:a}=o,l=a["r:id"],c=a["w:anchor"];a["w:history"];const u=s.find(m=>m.attributes.Id===l)||{},{attributes:d={}}=u;let f=d.Target;c&&!f&&(f=`#${c}`);const p=o.elements.filter(m=>m.name==="w:r"),h={type:"link",attrs:{href:f,rId:l}};for(const m of p){m.marks||(m.marks=[]),m.marks.push(h);const y=m.elements.find(g=>g.name==="w:rPr");if(y&&y.elements.find(g=>g.name==="w:rStyle")){const g=n["word/styles.xml"],{elements:x}=g.elements[0],k=x.filter(b=>b.name==="w:style").find(b=>b.attributes["w:styleId"]==="Hyperlink")?.elements?.find(b=>b.name==="w:rPr");k&&m.elements.unshift(k)}}return{nodes:r.handler({...t,nodes:p}),consumed:1}},t4={handlerName:"hyperlinkNodeHandler",handler:e4},n4=t=>{const{nodes:e,nodeListHandler:n,parentStyleId:r,docx:o}=t;if(e.length===0||e[0].name!=="w:r")return{nodes:[],consumed:0};const i=e[0],s={...t,nodes:i.elements};let a=n.handler(s)?.filter(u=>u)||[];const l=i.elements?.some(u=>u.name==="w:rPr"),c=r4(o,r);if(l){const{marks:u=[],attributes:d={}}=hi(i),f=u.find(h=>h.type==="textStyle"),p=f&&Object.keys(f.attrs).length>0;c.marks&&!p&&u.push(...c.marks),i.marks&&u.push(...i.marks),a=a.map(h=>({...h,marks:sd(u),attributes:d}))}else c.marks&&(a=a.map(u=>({...u,marks:sd(c.marks)})));return{nodes:a,consumed:1}},r4=(t,e)=>{const n=t?.["word/styles.xml"];if(!n)return{};const r=n.elements[0].elements.filter(o=>o.name==="w:style").find(o=>o.attributes["w:styleId"]===e)||{};return r?hi(r):{}},o4={handlerName:"runNodeHandler",handler:n4},i4=t=>{const{nodes:e,insideTrackChange:n}=t;if(e.length===0||!(e[0].name==="w:t"||n&&e[0].name==="w:delText"))return{nodes:[],consumed:0};const r=e[0],{type:o}=r,{attributes:i,elements:s,marks:a=[]}=hi(r);let l;if(s.length===1)l=s[0].text;else if(!s.length&&"attributes"in r&&r.attributes["xml:space"]==="preserve")l=" ";else return{nodes:[],consumed:0};return{nodes:[{type:Ta(r),text:l,attrs:{type:o,attributes:i||{}},marks:a}],consumed:1}},s4={handlerName:"textNodeHandler",handler:i4},yv=t=>Object.prototype.toString.call(t)==="[object RegExp]";function Zo(t,e,n={strict:!0}){const r=Object.keys(e);return r.length?r.every(o=>n.strict?e[o]===t[o]:yv(e[o])?e[o].test(t[o]):e[o]===t[o]):!0}const wv=t=>{if(!t||!Array.isArray(t))return t;let e=[],n=null;for(let r of t)r.type==="text"?n&&a4(n,r)?n={...n,text:n.text+=r.text}:(n&&e.push(n),n={...r}):(n&&(e.push(n),n=null),e.push(r));return n&&e.push(n),e},a4=(t,e)=>{if(!t||!e)return!1;let n=t.marks??[],r=e.marks??[];if(n.length!==r.length)return!1;for(let o=0;o<n.length;o++)if(n[o].type!==r[o].type||!l4(n[o].attrs,r[o].attrs))return!1;return!0},l4=(t={},e={})=>Zo(t,e);function bv(t,e,n){this.name=t,this.message=e||"",this.details=n;const r=new Error(this.message);this.stack=r.stack,r.name=this.name}bv.prototype=Object.create(Error.prototype);const c4=t=>{const{nodes:e,lists:n}=t;if(e.length===0||e[0].name!=="w:p")return{nodes:[],consumed:0};const r=sn(e[0]),o=Sv(r.elements);r.elements=o;const i=r.elements.find(s=>s.name==="w:pPr");if(ad(r)){const s=sn(e),a=[];let l=s.shift();for(;l&&ad(l,!0);)a.push(l),l=s.shift(),l?.elements&&!gv(l.elements)&&(a.push(l),l=s.shift());return{nodes:[vv({listItems:a,params:t,originalPpr:i})],consumed:a.filter(c=>c.seen).length,lists:n}}else return{nodes:[],consumed:0,lists:n}},u4={handlerName:"listHandler",handler:c4};function vv({listItems:t,originalPpr:e,params:n,listLevel:r=0,actualListLevel:o=0,currentListNumId:i=null,path:s="",isNested:a=!1}){const{docx:l,nodeListHandler:c,lists:u}=n,d=[];let f,p;const h=c.handlerEntities.find(b=>b.handlerName==="standardNodeHandler")?.handler;if(!h)return console.error("Standard node handler not found"),{nodes:[],consumed:0};const m=t[0].elements.find(b=>b.name==="w:pPr")?.elements?.find(b=>b.name==="w:numPr"),y=m?.elements?.find(b=>b.name==="w:numId")||{},{attributes:g={}}=y;i=g["w:val"],o=parseInt(m?.elements?.find(b=>b.name==="w:ilvl")?.attributes["w:val"])||0;let x=0;for(let[b,T]of t.entries()){if(T.seen)continue;if(T.elements&&!gv(T.elements)){const re=h({...n,nodes:[T]}).nodes[0];re&&d[d.length-1]?.content.push(re),T.seen=!0;continue}const{attributes:M,elements:_,marks:F=[]}=hi(T),C=F.find(re=>re.type==="textStyle"),{listType:V,listOrderingType:ie,ilvl:I,listrPrs:W,listpPrs:A,start:G,lvlText:ae,lvlJc:J,numId:ue}=h4(M,r,l);p=ie;const X=parseInt(I),pe=o===X&&ue===i,Q=p4({firstListId:ue,secondListId:i,level:X,pStyleId:null,docx:l}),B=ue!==i&&!Q,ee=r<X||r===X&&B&&x===r;u[i]||(u[i]={}),u[i][r]||(u[i][r]=0);const Z={};if(pe&&!ee){u[i][o]++,f=V,T.seen=!0;const re=[];let K={type:"paragraph",content:c.handler({...n,nodes:[M.paragraphProperties,..._]})?.filter(D=>D)};K.content&&(K={...K,attrs:{textAlign:C?.attrs.textAlign||null,rsidRDefault:M?.["w:rsidRDefault"]||null},content:wv(K.content)}),re.push(K),x=r;let $=[];if(p!=="bullet"&&($=[...s,u[i][r]]),!s.length&&o>0){const D=u[i];if(D){const R=[];Object.keys(D).forEach(le=>{R.push(D[le])}),$=R}}const E=T.elements.find(D=>D.name==="w:pPr")?.elements.find(D=>D.name==="w:ind");if(E){const D={};E.attributes["w:left"]!==void 0&&(D.left=et(E.attributes["w:left"])),E.attributes["w:right"]!==void 0&&(D.right=et(E.attributes["w:right"])),E.attributes["w:firstLine"]!==void 0&&(D.firstLine=et(E.attributes["w:firstLine"])),E.attributes["w:hanging"]!==void 0&&(D.hanging=et(E.attributes["w:hanging"])),Z.indent=D}A&&(Z.listParagraphProperties=A),W&&(Z.listRunProperties=W),Z.textStyle=C,Z.order=G,Z.lvlText=ae,Z.lvlJc=C?.attrs.textAlign,Z.listLevel=$,Z.listNumberingType=ie,Z.attributes={parentAttributes:T?.attributes||null};const H=e?.elements?.find(D=>D.name==="w:rPr");H&&(Z.attributes.originalInlineRunProps=H),Z.numId=ue,l&&(Z.spacing=xv(T,l));const q=fg(re,Z,[]);d.push(q)}else if(ee){const re=[...s,u[i][r]],K=vv({listItems:t.slice(b),originalPpr:e,params:n,listLevel:r+1,actualListLevel:r,currentListNumId:ue,path:re,isNested:!0});x=K.lastNestedListLevel,delete K.lastNestedListLevel;const $=d[d.length-1];$?$.content.push(K):d.push(fg([K],Z,[]))}else if(ue){x=r,r>0&&T.elements[0].elements.find(re=>re.name==="w:numPr")&&(u[i][r]=0);break}else{T.seen=!0;const re=h({...n,nodes:[T]}).nodes[0];d[d.length-1]?.content.push(re)}}const k={type:f||"bulletList",content:d,attrs:{"list-style-type":p,listId:i,attributes:{parentAttributes:t[0]?.attributes||null}}};return a&&(k.lastNestedListLevel=x),k}function ad(t,e=!1){const{elements:n}=t,r=n?.find(s=>s.name==="w:pPr");if(!r)return!1;const o=r.elements?.find(s=>s.name==="w:pStyle")?.attributes["w:val"]==="ListParagraph",i=r.elements?.find(s=>s.name==="w:numPr");return o||i}function fg(t,e,n){return{type:"listItem",content:t,attrs:e,marks:n}}const d4=["decimal","decimalZero","lowerRoman","upperRoman","lowerLetter","upperLetter","ordinal","cardinalText","ordinalText","hex","chicago","none"],f4=["bullet","square","circle","disc"],p4=({firstListId:t,secondListId:e,level:n,pStyleId:r,docx:o})=>{const{numFmt:i,lvlText:s,lvlJc:a}=Ga(t,n,r,o),{numFmt:l,lvlText:c,lvlJc:u}=Ga(e,n,r,o);return i===l&&s===c&&a===u},pg=(t,e)=>{const n=e["word/styles.xml"];if(!n)return null;const{elements:r}=n,o=r[0].elements.filter(h=>h.name==="w:style"),i=o.find(h=>h.attributes["w:styleId"]===t)||{},s=i?.elements?.find(h=>h.name==="w:pPr");if(!s)return null;let a=s?.elements?.find(h=>h.name==="w:numPr");if(!a)return null;let l=a?.elements?.find(h=>h.name==="w:numId")||{},c=l?.attributes?.["w:val"],u=a?.elements?.find(h=>h.name==="w:ilvl"),d=u?.attributes?.["w:val"];const f=i?.elements?.find(h=>h.name==="w:basedOn")?.attributes?.["w:val"];let p=0;for(;a&&!c&&p<10;)a=(o.find(h=>h.attributes["w:styleId"]===f)||{})?.elements?.find(h=>h.name==="w:pPr")?.elements?.find(h=>h.name==="w:numPr"),l=a?.elements?.find(h=>h.name==="w:numId")||{},c=l?.attributes?.["w:val"],u||(u=a?.elements?.find(h=>h.name==="w:ilvl"),d=u?.attributes?.["w:val"]),p++;return{numId:c,ilvl:d}},Ga=(t,e,n,r)=>{const o=r["word/numbering.xml"];if(!o)return{};const{elements:i}=o,s=i[0];if(n){const{numId:k,ilvl:b}=pg(n,r)||{};k&&(t=k),b&&(e=b?parseInt(b):null)}const a=s.elements,l=a.filter(k=>k.name==="w:abstractNum"),c=a.filter(k=>k.name==="w:num").find(k=>k.attributes["w:numId"]===t)?.elements[0].attributes["w:val"],u=l?.find(k=>k.attributes["w:abstractNumId"]===c),d=m4(u,e),f=u?.elements?.find(k=>k.name==="w:numStyleLink")?.attributes["w:val"];if(f){const k=pg(f,r);return Ga(k.numId,e,null,r)}const p=d?.elements?.find(k=>k.name==="w:start")?.attributes["w:val"],h=d?.elements?.find(k=>k.name==="w:numFmt")?.attributes["w:val"],m=d?.elements?.find(k=>k.name==="w:lvlText").attributes["w:val"],y=d?.elements?.find(k=>k.name==="w:lvlJc").attributes["w:val"],g=d?.elements?.find(k=>k.name==="w:pPr"),x=d?.elements?.find(k=>k.name==="w:rPr");return{start:p,numFmt:h,lvlText:m,lvlJc:y,pPr:g,rPr:x}};function h4(t,e,n){if(!t)return;const{paragraphProperties:r={}}=t,{elements:o=[]}=r,i=o.find(x=>x.name==="w:numPr");if(!i)return{};const s=i.elements.find(x=>x.name==="w:ilvl").attributes["w:val"],a=i.elements.find(x=>x.name==="w:numId").attributes["w:val"],l=o.find(x=>x.name==="w:pStyle")?.attributes["w:val"],{start:c,numFmt:u,lvlText:d,lvlJc:f,pPr:p,rPr:h}=Ga(a,e,l,n);let m,y;p&&(m=g4(p)),h&&(y=y4(h));let g;if(f4.includes(u?.toLowerCase()))g="bulletList";else if(d4.includes(u))g="orderedList";else throw new bv("ListParsingError",`Unknown list type found during import: ${u}`,{listOrderingType:u,ilvl:s,numId:a,listrPrs:y,listpPrs:m,start:c,lvlText:d,lvlJc:f});return{listType:g,listOrderingType:u,ilvl:s,numId:a,listrPrs:y,listpPrs:m,start:c,lvlText:d,lvlJc:f}}function m4(t,e){return t?.elements?.find(n=>Number(n.attributes["w:ilvl"])===e)}function g4(t){const{elements:e}=t,n=["w:ind","w:jc","w:tabs"],r={};return e&&e.forEach(o=>{n.includes(o.name);const{attributes:i={}}=o;Object.keys(i).forEach(s=>{r[s]=i[s]})}),r}function y4(t){const{elements:e}=t,n=["w:rFonts","w:b","w:bCs","w:i","w:iCs","w:strike","w:dstrike","w:color","w:sz","w:szCs","w:u","w:bdr","w:shd","w:vertAlign","w:jc","w:spacing","w:w","w:smallCaps","w:position","w:lang"],r={};return e&&e.forEach(o=>{n.includes(o.name);const{attributes:i={}}=o;Object.keys(i).forEach(s=>{r[s]=i[s]})}),r}const w4=t=>{const{nodes:e,docx:n,nodeListHandler:r,filename:o}=t;if(e.length===0||e[0].name!=="w:p")return{nodes:[],consumed:0};const i=sn(e[0]);let s,a=Sv(i.elements);if(i.elements=a,ad(i))return{nodes:[],consumed:0};const l=r.handlerEntities.find(g=>g.handlerName==="standardNodeHandler")?.handler;if(!l)return console.error("Standard node handler not found"),{nodes:[],consumed:0};const c={...t,nodes:[i]},u=l(c);u.nodes.length===1&&(s=u.nodes[0]);const d=i.elements?.find(g=>g.name==="w:pPr"),f=d?.elements?.find(g=>g.name==="w:pStyle"),p=d?.elements?.find(g=>g.name==="w:rPr");if(p&&(s.attrs.marksAttrs=Yo(p,[])),f&&(s.attrs.styleId=f.attributes["w:val"]),n){const g=b4(i,n,s.attrs.styleId);s.attrs.indent||(s.attrs.indent={}),g.left&&(s.attrs.indent.left=g.left),g.right&&(s.attrs.indent.right=g.right),g.firstLine&&(s.attrs.indent.firstLine=g.firstLine),g.hanging&&(s.attrs.indent.hanging=g.hanging),g.textIndent&&(s.attrs.textIndent=`${g.textIndent}in`)}const h=d?.elements?.find(g=>g.name==="w:jc");h&&h.attributes&&(s.attrs.textAlign=h.attributes["w:val"]);const m=d?.elements?.find(g=>g.name==="w:keepLines");m&&m.attributes&&(s.attrs.keepLines=m.attributes["w:val"]);const y=d?.elements?.find(g=>g.name==="w:keepNext");if(y&&y.attributes&&(s.attrs.keepNext=y.attributes["w:val"]),n){const g=i.attributes?.["w:rsidRDefault"];s.attrs.spacing=xv(i,n,s.attrs.styleId,s.attrs.marksAttrs),s.attrs.rsidRDefault=g}return s.attrs.filename=o,s&&s.content&&(s={...s,content:wv(s.content)}),{nodes:s?[s]:[],consumed:1}},b4=(t,e,n="")=>{const r={left:0,right:0,firstLine:0,hanging:0,textIndent:0},{indent:o={}}=kv(e,n),i=t.elements?.find(d=>d.name==="w:pPr")?.elements?.find(d=>d.name==="w:ind")?.attributes||{},s=i?.["w:left"]||o?.["w:left"],a=i?.["w:right"]||o?.["w:right"],l=i?.["w:firstLine"]||o?.["w:firstLine"],c=i?.["w:hanging"]||o?.["w:hanging"];s&&(r.left=et(s)),a&&(r.right=et(a)),l&&(r.firstLine=et(l)),c&&(r.hanging=et(c));const u=s-parseInt(c||0)||0;return u&&(r.textIndent=Wt(u)),r},xv=(t,e,n="",r=[])=>{const o={lineSpaceAfter:0,lineSpaceBefore:0,line:0,lineRule:null},{spacing:i={}}=kv(e,n);let s,a,l,c;const u=t.elements?.find(y=>y.name==="w:pPr")?.elements?.find(y=>y.name==="w:spacing")?.attributes||{},d=r.find(y=>y.type==="textStyle")?.attrs?.fontSize,f=u?.["w:line"]||l||i?.["w:line"];f&&(o.line=Vo(f));const p=u?.["w:before"]||a||i?.["w:before"];p&&(o.lineSpaceBefore=et(p)),u?.["w:beforeAutospacing"]==="1"&&d&&(o.lineSpaceBefore+=Math.round(parseInt(d)*.5*96/72));const h=u?.["w:after"]||s||i?.["w:after"];h&&(o.lineSpaceAfter=et(h)),u?.["w:afterAutospacing"]==="1"&&d&&(o.lineSpaceAfter+=Math.round(parseInt(d)*.5*96/72));const m=u?.["w:lineRule"]||c||i?.["w:lineRule"];return m&&(o.lineRule=m),o},kv=(t,e="")=>{const n=t["word/styles.xml"];if(!n)return{};const r=(n.elements[0].elements?.find(g=>g.name==="w:docDefaults")).elements.find(g=>g.name==="w:pPrDefault")?.elements?.find(g=>g.name==="w:pPr"),o=r?.elements?.find(g=>g.name==="w:spacing")||{},i=r?.elements?.find(g=>g.name==="w:ind")||{},s=n.elements[0].elements?.find(g=>g.name==="w:style"&&g.attributes["w:styleId"]==="Normal")?.elements?.find(g=>g.name==="w:pPr"),a=s?.elements?.find(g=>g.name==="w:spacing")||{},l=s?.elements?.find(g=>g.name==="w:ind")||{};let c={},u={};if(e){const g=n.elements[0].elements?.find(x=>x.name==="w:style"&&x.attributes["w:styleId"]===e)?.elements?.find(x=>x.name==="w:pPr");c=g?.elements?.find(x=>x.name==="w:spacing")||{},u=g?.elements?.find(x=>x.name==="w:ind")||{}}const{attributes:d}=o,{attributes:f}=a,{attributes:p}=c,{attributes:h}=i,{attributes:m}=l,{attributes:y}=u;return{spacing:p||d||f,indent:y||h||m}},v4={handlerName:"paragraphNodeHandler",handler:w4};function x4(t,e){const n={lineSpaceBefore:null,lineSpaceAfter:null};if(!t)return n;const r=e["word/styles.xml"];if(!r)return n;const{elements:o}=r.elements[0],i=o.filter(ae=>{const{attributes:J}=ae;return J&&J["w:styleId"]===t}),s=i[0];if(!s)return n;const a=i.find(ae=>ae.elements.find(J=>J.name==="w:qFormat")),l=i.find(ae=>ae.elements.some(J=>J.name==="w:name"))?.elements.find(ae=>ae.name==="w:name")?.attributes["w:val"],c=s.elements.find(ae=>ae.name==="w:pPr"),u=c?.elements?.find(ae=>ae.name==="w:spacing"),d=c?.elements?.find(ae=>ae.name==="w:jc"),f=c?.elements?.find(ae=>ae.name==="w:ind");let p,h,m;u&&(p=et(u?.attributes["w:before"]),h=et(u?.attributes["w:after"]),m=Vo(u?.attributes["w:line"]));let y,g,x,k;f&&(y=d?.attributes["w:val"],g=et(f?.attributes["w:left"]),x=et(f?.attributes["w:right"]),k=et(f?.attributes["w:firstLine"]));const b=c?.elements?.find(ae=>ae.name==="w:keepNext"),T=c?.elements?.find(ae=>ae.name==="w:keepLines"),M=c?.elements?.find(ae=>ae.name==="w:outlineLvl"),_=M?.attributes["w:val"],F=c?.elements?.find(ae=>ae.name==="w:pageBreakBefore");let C=0;F&&(F.attributes?.["w:val"]?C=Number(F?.attributes?.["w:val"]):C=1);const V=c?.elements?.find(ae=>ae.name==="w:pageBreakAfter");let ie;V&&(V.attributes?.["w:val"]?ie=Number(V?.attributes?.["w:val"]):ie=1);const I={name:l,qFormat:!!a,keepNext:!!b,keepLines:!!T,outlineLevel:M?parseInt(_):null,pageBreakBefore:!!C,pageBreakAfter:!!ie},W=s.elements.find(ae=>ae.name==="w:rPr"),A=Yo(W,[],e)||{},G={spacing:{lineSpaceAfter:h,lineSpaceBefore:p,line:m},textAlign:y,indent:{leftIndent:g,rightIndent:x,firstLine:k}};return A.forEach(ae=>{const{type:J,attrs:ue}=ae;if(J==="textStyle"){Object.entries(ue).forEach(([X,pe])=>{G[Wa(X)]=pe});return}G[J]=ue}),{attrs:I,styles:G}}function Sv(t){let e=[];const n=[];let r=!1,o=!1;return t?.forEach(i=>{const s=i.elements?.find(a=>a.name==="w:fldChar");if(s){const a=s.attributes["w:fldCharType"];a==="begin"?(r=!0,n.push(i)):a==="end"&&(n.push(i),r=!1)}else e.push(i);if(r)n.push(i);else if(!r&&n.length){const a=n.findIndex(m=>m.elements?.some(y=>y.name==="w:fldChar"&&y.attributes["w:fldCharType"]==="separate")),l=n.findIndex(m=>m.elements?.some(y=>y.name==="w:fldChar"&&y.attributes["w:fldCharType"]==="end")),c=n.slice(a+1,l),u=(n.find(m=>m.elements?.some(y=>y.name==="w:instrText"))?.elements?.find(m=>m.name==="w:instrText")).elements[0].text;o||(o=u?.includes("PAGE"));const d=u?.match(/HYPERLINK\s+"([^"]+)"/);if(o)return e=e.filter(m=>m.name!=="w:r"),e.push({name:"sd:autoPageNumber",type:"element"}),[];if(!d||d?.length<2)return[];const f=d[1],p=[];c.forEach(m=>{const y=m.elements.find(x=>x.name==="w:rPr");if(!y)return;const{elements:g}=y;g.forEach(x=>{p.push(x)})});const h={name:"w:rPr",type:"element",elements:[{name:"link",attributes:{href:f}},...p]};e.push({name:"w:r",type:"element",elements:[h,...c]})}}),e}const k4=t=>nodeListHandler.handler({...t,nodes:node.elements}),S4=t=>{const{nodes:e}=t;if(e.length===0||e[0].name!=="w:sdt")return{nodes:[],consumed:0};const n=e[0],r=n.elements.find(s=>s.name==="w:sdtPr")?.elements.find(s=>s.name==="w:docPartObj")?.elements.find(s=>s.name==="w:docPartGallery")?.attributes["w:val"];if(!r)return{nodes:[],consumed:0};if(!hg[r])return{nodes:[],consumed:0};const o=n?.elements.find(s=>s.name==="w:sdtContent"),i=hg[r];return{nodes:i({...t,nodes:[o]}),consumed:1}},hg={"Table of Contents":k4},C4=t=>{const{nodes:e,docx:n,nodeListHandler:r,insideTrackChange:o}=t;if(e.length===0||e[0].name!=="w:sdt")return{nodes:[],consumed:0};const i=e[0],s=i.elements.find(x=>x.name==="w:sdtPr"),a=i.elements.find(x=>x.name==="w:sdtContent"),{attrs:l,marks:c}=E4(a);if(s?.elements.find(x=>x.name==="w:docPartObj"))return S4({nodes:e,docx:n,nodeListHandler:r,insideTrackChange:o});const u=s?.elements.find(x=>x.name==="w:alias"),d=s?.elements.find(x=>x.name==="w:tag"),f=s?.elements.find(x=>x.name==="w:fieldType")?.attributes["w:val"],p=s?.elements.find(x=>x.name==="w:fieldTypeShort")?.attributes["w:val"],h=s?.elements.find(x=>x.name==="w:fieldColor")?.attributes["w:val"],m=s?.elements.find(x=>x.name==="w:fieldMultipleImage")?.attributes["w:val"],y={type:p,fieldId:d?.attributes["w:val"],displayLabel:u?.attributes["w:val"],fieldType:f,fieldColor:h,multipleImage:m==="true"};if(!y.fieldId||!y.displayLabel)return{nodes:[],consumed:0};let g={type:"text",text:`{{${y.displayLabel}}}`,attrs:{...y,...l},marks:c};return t.editor.options.annotations&&(g={type:"fieldAnnotation",attrs:{...y,...l}}),{nodes:[g],consumed:1}},E4=(t={})=>{const e=t.elements?.find(i=>i.name==="w:r")?.elements?.find(i=>i.name==="w:rPr");if(!e)return{};const n=Yo(e,[])||[],r=[];n.forEach(i=>{const{type:s}=i;if(s==="textStyle"){const{attrs:a}=i;Object.keys(a).forEach(l=>{r.push({type:l,attrs:a[l]})})}else r.push(i)});const o={};return r?.forEach(i=>{const{type:s}=i;o[s]=i.attrs||!0}),{attrs:o,marks:n}},A4={handlerName:"annotationNodeHandler",handler:C4},T4=t=>{const{nodes:e,docx:n,nodeListHandler:r}=t;if(!e||e.length===0)return{nodes:[],consumed:0};const o=e[0],{name:i}=o,{attributes:s,elements:a,marks:l=[]}=hi(o);if(i==="w:sdt")return{nodes:[],consumed:0};if(YA(o))return{nodes:[{type:Ta(o),attrs:{...s},marks:[]}],consumed:0};if(!Ta(o))return{nodes:[{type:i,content:a,attrs:{...s},marks:l}],consumed:0,unhandled:!0};const c=[],u=$4(o);if(a&&a.length){const d=a.map(h=>(h.marks||(h.marks=[]),h.marks.push(...l),h)),f={...t,nodes:d,parentStyleId:u},p=r.handler(f);c.push(...p)}return{nodes:[{type:Ta(o),content:c,attrs:{...s},marks:[]}],consumed:1}},$4=t=>{const e=t.elements?.find(n=>n.name==="w:pPr")?.elements?.find(n=>n.name==="w:pStyle");return e?e.attributes["w:val"]:null},O4={handlerName:"standardNodeHandler",handler:T4},M4=t=>{const{nodes:e}=t;return e.length===0||e[0].name!=="w:br"?{nodes:[],consumed:0}:{nodes:[{type:e[0].attributes?.["w:type"]==="page"?"hardBreak":"lineBreak"}],consumed:1}},_4={handlerName:"lineBreakNodeHandler",handler:M4},N4=t=>{const{nodes:e,nodeListHandler:n}=t;if(e.length===0||e[0].name!=="w:bookmarkStart")return{nodes:[],consumed:0};const r=e[0],o=n.handlerEntities.find(a=>a.handlerName==="standardNodeHandler")?.handler;if(!o)return console.error("Standard node handler not found"),{nodes:[],consumed:0};const i={...t,nodes:[r]},s=o(i);return s.nodes.length===1&&(s.nodes[0].attrs.name=r.attributes["w:name"],s.nodes[0].attrs.id=r.attributes["w:id"]),s},D4={handlerName:"bookmarkNodeHandler",handler:N4},I4=t=>{const{nodes:e}=t;return e.length===0||e[0].name!=="sd:autoPageNumber"?{nodes:[],consumed:0}:{nodes:[{type:"page-number"}],consumed:1}},F4={handlerName:"autoPageNumberHandler",handler:I4},B4=t=>{const{nodes:e}=t;if(e.length===0||e[0].name!=="w:tab")return{nodes:[],consumed:0};const n=e[0],{attributes:r={}}=n;return{nodes:[{type:"tab",attrs:{tabSize:r["w:val"]||48},content:[]}],consumed:1}},R4={handlerName:"tabNodeHandler",handler:B4};function L4({docx:t}){const e=Bf(),n=t["word/comments.xml"];if(!n)return;const{elements:r}=n;if(!r||!r.length)return;const{elements:o=[]}=r[0],i=o.map(s=>{const{attributes:a}=s,l=a["w:id"],c=a["w:author"],u=a["w:email"],d=a["w:initials"],f=a["w:date"],p=a["custom:internalId"],h=a["custom:trackedChange"]==="true",m=a["custom:trackedChangeType"],y=a["custom:trackedChangeText"]!=="null"?a["custom:trackedChangeText"]:null,g=a["custom:trackedDeletedText"]!=="null"?a["custom:trackedDeletedText"]:null,x=new Date(f).getTime(),{elements:k}=s,b=k[0],{elements:T}=b,M=e.handler({nodes:s.elements,nodeListHandler:e,docx:t}),{attrs:_}=M[0],F=_["w14:paraId"];return{commentId:p||go(),importedId:l,creatorName:c,creatorEmail:u,createdTime:x,textJson:M[0],initials:d,paraId:F,trackedChange:h,trackedChangeText:y,trackedChangeType:m,trackedDeletedText:g}});return P4({docx:t,comments:i})}const P4=({docx:t,comments:e})=>{const n=t["word/commentsExtended.xml"];if(!n)return[];const{elements:r}=n,{elements:o}=r[0],i=o.filter(s=>s.name==="w15:commentEx");return e.map(s=>{const a=i.find(d=>d.attributes["w15:paraId"]===s.paraId);if(!a)return{...s};const{isDone:l,paraIdParent:c}=z4(a);let u;return c&&(u=e.find(d=>d.paraId===c)),{...s,isDone:l,parentCommentId:u?.commentId}})},z4=t=>{const{attributes:e}=t,n=e["w15:paraId"],r=e["w15:done"]==="1",o=e["w15:paraIdParent"];return{paraId:n,isDone:r,paraIdParent:o}},j4=(t,e,n)=>{const r=sn(IA(t));if(!r)return null;if(e?.telemetry){const s=Object.keys(t).map(a=>{const l=a.split("/");return{filePath:a,fileDepth:l.length,fileType:a.split(".").pop()}});e.telemetry.trackFileStructure({totalFiles:s.length,maxDepth:Math.max(...s.map(a=>a.fileDepth)),totalNodes:0,files:s},e.fileSource,e.documentId,e.documentInternalId)}const o=Bf(),i=r.elements[0].elements.find(s=>s.name==="w:body");if(i){const s=i,a=["w:sectPr"],l=s.elements?.filter(f=>!a.includes(f.name))??[],c=L4({docx:t}),u={},d={type:"doc",content:o.handler({nodes:l,nodeListHandler:o,docx:t,converter:e,editor:n,lists:u}),attrs:{attributes:r.elements[0].attributes}};return d.content.length>1&&e?.telemetry?.trackUsage("document_import",{documentType:"docx",timestamp:new Date().toISOString()}),{pmDoc:d,savedTagsToRestore:s,pageStyles:U4(s,t,e,n),comments:c,linkedStyles:V4(t),numbering:W4(t)}}return null},Bf=()=>{const t=[o4,v4,u4,s4,_4,A4,D4,t4,UA,QA,BA,R4,F4,O4];return{handler:q4(t),handlerEntities:t}},q4=t=>{const e=(r,o,i,s)=>!r||o<0||o>=r.length?{elementIndex:o,error:"index_out_of_bounds",arrayLength:r?.length}:{elementName:r[o]?.name,attributes:i?.attrs,marks:i?.marks,elementPath:s,type:i?.type,content:i?.content},n=({nodes:r,docx:o,insideTrackChange:i,converter:s,editor:a,filename:l,parentStyleId:c,lists:u})=>{if(!r||!r.length)return[];const d=[];try{for(let f=0;f<r.length;f++)try{const p=r.slice(f);if(!p||p.length===0)continue;const{nodes:h,consumed:m,unhandled:y}=t.reduce((x,k)=>x.consumed>0?x:k.handler({nodes:p,docx:o,nodeListHandler:{handler:n,handlerEntities:t},insideTrackChange:i,converter:s,editor:a,filename:l,parentStyleId:c,lists:u}),{nodes:[],consumed:0}),g=e(r,f,h[0],`/word/${l||"document.xml"}`);if(y){if(!g.elementName)continue;s?.telemetry?.trackStatistic("unknown",g);continue}else{s?.telemetry?.trackStatistic("node",g),(g.type==="orderedList"||g.type==="bulletList")&&g.content.forEach(k=>{const b=e([k],0,k,`/word/${l||"document.xml"}`);s?.telemetry?.trackStatistic("attributes",b)});const x=h[0]?.marks?.find(k=>k.type==="highlight");x&&s?.docHiglightColors.add(x.attrs.color.toUpperCase())}m>0&&(f+=m-1),h&&h.forEach(x=>{if(x?.type&&!["runProperties"].includes(x.type)){if(x.type==="text"&&Array.isArray(x.content)&&!x.content.length)return;d.push(x)}})}catch(p){console.debug("Import error",p),a?.emit("exception",{error:p}),s?.telemetry?.trackStatistic("error",{type:"processing_error",message:p.message,name:p.name,stack:p.stack,fileName:`/word/${l||"document.xml"}`})}return d}catch(f){throw console.debug("Error during import",f),a?.emit("exception",{error:f}),s?.telemetry?.trackStatistic("error",{type:"fatal_error",message:f.message,name:f.name,stack:f.stack,fileName:`/word/${l||"document.xml"}`}),f}};return n};function U4(t,e,n,r){const o=t.elements?.find(a=>a.name==="w:sectPr"),i={},s=G4(e);return o?.elements?.forEach(a=>{const{name:l,attributes:c}=a;switch(l){case"w:pgSz":i.pageSize={width:Wt(c["w:w"]),height:Wt(c["w:h"])};break;case"w:pgMar":i.pageMargins={top:Wt(c["w:top"]),right:Wt(c["w:right"]),bottom:Wt(c["w:bottom"]),left:Wt(c["w:left"]),header:Wt(c["w:header"]),footer:Wt(c["w:footer"]),gutter:Wt(c["w:gutter"])};break;case"w:cols":i.columns={space:Wt(c["w:space"]),num:c["w:num"],equalWidth:c["w:equalWidth"]};break;case"w:docGrid":i.docGrid={linePitch:Wt(c["w:linePitch"]),type:c["w:type"]};break;case"w:headerReference":mg(a,"header",e,n,r);break;case"w:footerReference":mg(a,"footer",e,n,r);break;case"w:titlePg":n.headerIds.titlePg=!0}}),i.alternateHeaders=s,i}function V4(t){const e=t["word/styles.xml"];if(!e)return[];const{elements:n}=e.elements[0],r=n.filter(i=>i.name==="w:style");n.find(i=>i.name==="w:latentStyles")?.elements.forEach(i=>{const{attributes:s}=i;r.find(a=>a.attributes["w:styleId"]===s["w:name"])});const o=[];return r.forEach(i=>{const s=i.attributes["w:styleId"],a=x4(s,t),l={id:i.attributes["w:styleId"],type:i.attributes["w:type"],definition:a,attributes:{}};o.push(l)}),o}function H4(t){if(!t)return null;const e=sn(t),{elements:n}=e.elements[0];return Object.keys(rg).forEach(r=>{if(!n.some(o=>o.attributes?.["w:styleId"]===r)){const o=rg[r];e.elements[0].elements.push(o)}}),e}function mg(t,e,n,r,o){const i=n["word/_rels/document.xml.rels"].elements.find(y=>y.name==="Relationships"),{elements:s}=i,a=t.attributes["w:type"],l=t.attributes["r:id"],c=s.find(y=>y.attributes.Id===l).attributes.Target,u=n[`word/${c}`],d=c,f=Bf(),p=f.handler({nodes:u.elements[0].elements,nodeListHandler:f,docx:n,converter:r,editor:o,filename:d});let h,m;e==="header"?(h=r.headers,m=r.headerIds):e==="footer"&&(h=r.footers,m=r.footerIds),h[l]={type:"doc",content:[...p]},m[a]=l}function W4(t){let e=t["word/numbering.xml"];(!e||!e.elements?.length||!e.elements[0].elements?.length)&&(e=iv);const n=e.elements[0].elements,r=n.filter(a=>a.name==="w:abstractNum"),o=n.filter(a=>a.name==="w:num"),i={};r.forEach(a=>{const l=Number(a.attributes["w:abstractNumId"]);i[l]=a});const s={};return o.forEach(a=>{const l=Number(a.attributes["w:numId"]);s[l]=a}),{abstracts:i,definitions:s}}const G4=t=>{const e=t["word/settings.xml"];if(!e||!e.elements?.length)return!1;const{elements:n=[]}=e.elements[0];return!!n.find(r=>r.name==="w:evenAndOddHeaders")};var Io,Cv,Ev,Av,Tv;const Ri=class $v{constructor(e=null){$0(this,Io),this.debug=e?.debug||!1,this.declaration=null,this.documentAttributes=null,this.convertedXml={},this.docx=e?.docx||[],this.media=e?.media||{},this.addedMedia={},this.comments=[],this.docHiglightColors=new Set([]),this.xml=e?.xml,this.declaration=null,this.numbering={},this.numbering=null,this.pageStyles=null,this.initialJSON=null,this.headers={},this.headerIds={default:null,even:null,odd:null,first:null},this.footers={},this.footerIds={default:null,even:null,odd:null,first:null},this.linkedStyles=[],this.json=e?.json,this.tagsNotInSchema=["w:body"],this.savedTagsToRestore=[],this.telemetry=e?.telemetry||null,this.documentInternalId=null,this.fileSource=e?.fileSource||null,this.documentId=e?.documentId||null,(this.docx.length||this.xml)&&this.parseFromXml()}parseFromXml(){this.docx?.forEach(e=>{this.convertedXml[e.name]=this.parseXmlToJson(e.content),e.name==="word/document.xml"&&(this.documentAttributes=this.convertedXml[e.name].elements[0]?.attributes),e.name==="word/styles.xml"&&(this.convertedXml[e.name]=H4(this.convertedXml[e.name]))}),this.initialJSON=this.convertedXml["word/document.xml"],this.initialJSON||(this.initialJSON=this.parseXmlToJson(this.xml)),this.declaration=this.initialJSON?.declaration}parseXmlToJson(e){return JSON.parse(cb.xml2json(e,null,2))}static getStoredSuperdocVersion(e){try{const n=e.find(a=>a.name==="docProps/custom.xml");if(!n)return;const r=new $v,o=n.content,i=r.parseXmlToJson(o).elements.find(a=>a.name==="Properties");if(!i.elements)return;const s=i.elements.find(a=>a.name==="property"&&a.attributes.name==="SuperdocVersion");return s?s.elements[0].elements[0].text:void 0}catch(n){console.warn("Error getting Superdoc version",n);return}}static updateDocumentVersion(e=this.convertedXml,n="0.9.25"){const r="docProps/custom.xml";e[r]||(e[r]=Ov());const o=e["docProps/custom.xml"];if(!o)return;const i=o.elements.find(a=>a.name==="Properties");i.elements||(i.elements=[]);const s=i.elements.find(a=>a.name==="property"&&a.attributes.name==="SuperdocVersion");if(s)s.elements[0].elements[0].elements[0].text=n;else{const a=Mv();i.elements.push(a)}return e}getDocumentDefaultStyles(){const e=this.convertedXml["word/styles.xml"];if(!e)return{};const n=e.elements[0].elements.find(i=>i.name==="w:docDefaults").elements.find(i=>i.name==="w:rPrDefault"),r=n.elements[0].elements,o=r?.find(i=>i.name==="w:rFonts");if("elements"in n){const i=r.find(u=>u.name==="w:rFonts")?.attributes["w:asciiTheme"];let s,a;if(i){const u=this.getThemeInfo(i);s=u.typeface,a=u.panose}else o?s=o?.attributes["w:ascii"]:(e.elements[0].elements.filter(u=>u.name==="w:style"&&u.attributes["w:styleId"]==="Normal")||[]).forEach(u=>{s=u.elements.find(d=>d.name==="w:rPr")?.elements?.find(d=>d.name==="w:rFonts")?.attributes["w:ascii"]});const l=Number(r.find(u=>u.name==="w:sz")?.attributes["w:val"])/2||12,c=r.find(u=>u.name==="w:kern")?.attributes["w:val"];return{fontSizePt:l,kern:c,typeface:s,panose:a}}}getDocumentInternalId(){const e="word/settings.xml";this.convertedXml[e]||(this.convertedXml[e]=FE);const n=Object.assign({},this.convertedXml[e]);if(!n.elements[0]?.elements?.length){const o=this.createDocumentIdElement(n);n.elements[0].elements=[o],n.elements[0].attributes["xmlns:w15"]||(n.elements[0].attributes["xmlns:w15"]="http://schemas.microsoft.com/office/word/2012/wordml"),this.convertedXml[e]=n;return}const r=n.elements[0].elements.find(o=>o.name==="w15:docId");this.documentInternalId=r?.attributes["w15:val"]}createDocumentIdElement(){const e=go().toUpperCase();return this.documentInternalId=e,{type:"element",name:"w15:docId",attributes:{"w15:val":`{${e}}`}}}getThemeInfo(e){e=e.toLowerCase();const n=this.convertedXml["word/theme/theme1.xml"].elements.find(s=>s.name==="a:theme").elements.find(s=>s.name==="a:themeElements").elements.find(s=>s.name==="a:fontScheme");let r;e.startsWith("major")?r=n.elements.find(s=>s.name==="a:majorFont").elements[0]:e.startsWith("minor")&&(r=n.elements.find(s=>s.name==="a:minorFont").elements[0]);const{typeface:o,panose:i}=r.attributes;return{typeface:o,panose:i}}getSchema(e){this.getDocumentInternalId();const n=j4({...this.convertedXml,media:this.media},this,e);return n?(this.savedTagsToRestore.push({...n.savedTagsToRestore}),this.pageStyles=n.pageStyles,this.numbering=n.numbering,this.comments=n.comments,this.linkedStyles=n.linkedStyles,n.pmDoc):null}schemaToXml(e,n=!1){return new cg(this).schemaToXml(e,n)}async exportToDocx(e,n,r,o=!1,i,s=[]){const a=s.map(h=>VE(h)),l=a.map((h,m)=>HE(h,m,a)),{result:c,params:u}=this.exportToXmlJson({data:e,editorSchema:n,comments:s,commentDefinitions:l,commentsExportType:i,isFinalDoc:o}),d=new cg(this).schemaToXml(c);await Xn(this,Io,Tv).call(this,{...r,...u.media,...this.media});let f={...this.convertedXml},p=[];if(s.length){const{documentXml:h,relationships:m}=Xn(this,Io,Ev).call(this,{defs:u.exportedCommentDefs,exportType:i,commentsWithParaIds:a});f={...h},p=m}return this.convertedXml={...this.convertedXml,...f},Xn(this,Io,Av).call(this,[...u.relationships,...p]),K4(this.convertedXml),Xn(this,Io,Cv).call(this,u),d}exportToXmlJson({data:e,editorSchema:n,comments:r,commentDefinitions:o,commentsExportType:i="clean",isFinalDoc:s=!1}){const a=this.savedTagsToRestore.find(u=>u.name==="w:body"),[l,c]=fi({node:e,bodyNode:a,relationships:[],documentMedia:{},media:{},isFinalDoc:s,editorSchema:n,converter:this,pageStyles:this.pageStyles,comments:r,commentsExportType:i,exportedCommentDefs:o});return{result:l,params:c}}};Io=new WeakSet,Cv=function(t){const e="word/numbering.xml";let n=this.convertedXml[e];const r=this.numbering;n||(n=iv);const o=n.elements[0],i=Object.values(r.abstracts).map(a=>a),s=Object.values(r.definitions).map(a=>a);o.elements=[...i,...s],this.convertedXml[e]=n},Ev=function({defs:t,exportType:e,commentsWithParaIds:n}){const{documentXml:r,relationships:o}=ZE({exportType:e,convertedXml:this.convertedXml,defs:t,commentsWithParaIds:n,converter:this});return{documentXml:r,relationships:o}},Av=function(t=[]){const e=this.convertedXml["word/_rels/document.xml.rels"],n=e.elements.find(s=>s.name==="Relationships"),r=[],o=/rId|mi/g;let i=Math.max(...n.elements.map(s=>Number(s.attributes.Id.replace(o,""))));t.forEach(s=>{const a=s.attributes.Id,l=n.elements.find(u=>u.attributes.Target===s.attributes.Target),c=s.attributes.Target?.startsWith("media/")&&a.length>6;l&&!c||(s.attributes.Target=s.attributes?.Target?.replace(/&/g,"&amp;"),s.attributes.Id=a.length>6?a:`rId${++i}`,r.push(s))}),n.elements=[...n.elements,...r],this.convertedXml["word/_rels/document.xml.rels"]=e},Tv=async function(t){const e={};for(const n in t){if(typeof t[n]!="string")return;const r=n.split("/").pop();e[r]=await TE(t[n])}this.convertedXml.media={...this.convertedXml.media,...e},this.media=this.convertedXml.media,this.addedMedia=e},Us(Ri,"allowedElements",Object.freeze({"w:document":"doc","w:body":"body","w:p":"paragraph","w:r":"run","w:t":"text","w:delText":"text","w:br":"lineBreak","w:tbl":"table","w:tr":"tableRow","w:tc":"tableCell","w:drawing":"drawing","w:bookmarkStart":"bookmarkStart","w:sectPr":"sectionProperties","w:rPr":"runProperties","w:commentRangeStart":"commentRangeStart","w:commentRangeEnd":"commentRangeEnd","w:commentReference":"commentReference"})),Us(Ri,"markTypes",[{name:"w:b",type:"bold"},{name:"w:bCs",type:"bold"},{name:"w:i",type:"italic"},{name:"w:iCs",type:"italic"},{name:"w:u",type:"underline",mark:"underline",property:"underlineType"},{name:"w:strike",type:"strike"},{name:"w:color",type:"color",mark:"textStyle",property:"color"},{name:"w:sz",type:"fontSize",mark:"textStyle",property:"fontSize"},{name:"w:szCs",type:"fontSize",mark:"textStyle",property:"fontSize"},{name:"w:rFonts",type:"fontFamily",mark:"textStyle",property:"fontFamily"},{name:"w:jc",type:"textAlign",mark:"textStyle",property:"textAlign"},{name:"w:ind",type:"textIndent",mark:"textStyle",property:"textIndent"},{name:"w:spacing",type:"lineHeight",mark:"textStyle",property:"lineHeight"},{name:"link",type:"link",mark:"link",property:"href"},{name:"w:highlight",type:"highlight",mark:"highlight",property:"color"}]),Us(Ri,"propertyTypes",Object.freeze({"w:pPr":"paragraphProperties","w:rPr":"runProperties","w:sectPr":"sectionProperties","w:numPr":"numberingProperties","w:tcPr":"tableCellProperties"})),Us(Ri,"elements",new Set(["w:document","w:body","w:p","w:r","w:t","w:delText"]));let $r=Ri;function K4(t){const e="docProps/custom.xml";t[e]||(t[e]=Ov());const n=t[e].elements.find(s=>s.name==="Properties");n.elements||(n.elements=[]);const r=n.elements,o=r.filter(s=>typeof s=="object"&&s!==null).filter(s=>{const{attributes:a}=s;return a.name!=="SuperdocVersion"});let i=2;try{i=o.length?Math.max(...r.map(s=>s.attributes.pid))+1:2}catch{}return o.push(Mv(i)),n.elements=o,t}function Ov(){return IE}function Mv(t=2,e="0.9.25"){return{type:"element",name:"property",attributes:{name:"SuperdocVersion",fmtid:"{D5CDD505-2E9C-101B-9397-08002B2CF9AE}",pid:t},elements:[{type:"element",name:"vt:lpwstr",elements:[{type:"text",text:e}]}]}}function Xs(t){throw new Error('Could not dynamically require "'+t+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var _v={exports:{}};(function(t,e){(function(n){t.exports=n()})(function(){return function n(r,o,i){function s(c,u){if(!o[c]){if(!r[c]){var d=typeof Xs=="function"&&Xs;if(!u&&d)return d(c,!0);if(a)return a(c,!0);var f=new Error("Cannot find module '"+c+"'");throw f.code="MODULE_NOT_FOUND",f}var p=o[c]={exports:{}};r[c][0].call(p.exports,function(h){var m=r[c][1][h];return s(m||h)},p,p.exports,n,r,o,i)}return o[c].exports}for(var a=typeof Xs=="function"&&Xs,l=0;l<i.length;l++)s(i[l]);return s}({1:[function(n,r,o){var i=n("./utils"),s=n("./support"),a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";o.encode=function(l){for(var c,u,d,f,p,h,m,y=[],g=0,x=l.length,k=x,b=i.getTypeOf(l)!=="string";g<l.length;)k=x-g,d=b?(c=l[g++],u=g<x?l[g++]:0,g<x?l[g++]:0):(c=l.charCodeAt(g++),u=g<x?l.charCodeAt(g++):0,g<x?l.charCodeAt(g++):0),f=c>>2,p=(3&c)<<4|u>>4,h=1<k?(15&u)<<2|d>>6:64,m=2<k?63&d:64,y.push(a.charAt(f)+a.charAt(p)+a.charAt(h)+a.charAt(m));return y.join("")},o.decode=function(l){var c,u,d,f,p,h,m=0,y=0,g="data:";if(l.substr(0,g.length)===g)throw new Error("Invalid base64 input, it looks like a data url.");var x,k=3*(l=l.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(l.charAt(l.length-1)===a.charAt(64)&&k--,l.charAt(l.length-2)===a.charAt(64)&&k--,k%1!=0)throw new Error("Invalid base64 input, bad content length.");for(x=s.uint8array?new Uint8Array(0|k):new Array(0|k);m<l.length;)c=a.indexOf(l.charAt(m++))<<2|(f=a.indexOf(l.charAt(m++)))>>4,u=(15&f)<<4|(p=a.indexOf(l.charAt(m++)))>>2,d=(3&p)<<6|(h=a.indexOf(l.charAt(m++))),x[y++]=c,p!==64&&(x[y++]=u),h!==64&&(x[y++]=d);return x}},{"./support":30,"./utils":32}],2:[function(n,r,o){var i=n("./external"),s=n("./stream/DataWorker"),a=n("./stream/Crc32Probe"),l=n("./stream/DataLengthProbe");function c(u,d,f,p,h){this.compressedSize=u,this.uncompressedSize=d,this.crc32=f,this.compression=p,this.compressedContent=h}c.prototype={getContentWorker:function(){var u=new s(i.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new l("data_length")),d=this;return u.on("end",function(){if(this.streamInfo.data_length!==d.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),u},getCompressedWorker:function(){return new s(i.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},c.createWorkerFrom=function(u,d,f){return u.pipe(new a).pipe(new l("uncompressedSize")).pipe(d.compressWorker(f)).pipe(new l("compressedSize")).withStreamInfo("compression",d)},r.exports=c},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(n,r,o){var i=n("./stream/GenericWorker");o.STORE={magic:"\0\0",compressWorker:function(){return new i("STORE compression")},uncompressWorker:function(){return new i("STORE decompression")}},o.DEFLATE=n("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(n,r,o){var i=n("./utils"),s=function(){for(var a,l=[],c=0;c<256;c++){a=c;for(var u=0;u<8;u++)a=1&a?3988292384^a>>>1:a>>>1;l[c]=a}return l}();r.exports=function(a,l){return a!==void 0&&a.length?i.getTypeOf(a)!=="string"?function(c,u,d,f){var p=s,h=f+d;c^=-1;for(var m=f;m<h;m++)c=c>>>8^p[255&(c^u[m])];return-1^c}(0|l,a,a.length,0):function(c,u,d,f){var p=s,h=f+d;c^=-1;for(var m=f;m<h;m++)c=c>>>8^p[255&(c^u.charCodeAt(m))];return-1^c}(0|l,a,a.length,0):0}},{"./utils":32}],5:[function(n,r,o){o.base64=!1,o.binary=!1,o.dir=!1,o.createFolders=!0,o.date=null,o.compression=null,o.compressionOptions=null,o.comment=null,o.unixPermissions=null,o.dosPermissions=null},{}],6:[function(n,r,o){var i=null;i=typeof Promise<"u"?Promise:n("lie"),r.exports={Promise:i}},{lie:37}],7:[function(n,r,o){var i=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",s=n("pako"),a=n("./utils"),l=n("./stream/GenericWorker"),c=i?"uint8array":"array";function u(d,f){l.call(this,"FlateWorker/"+d),this._pako=null,this._pakoAction=d,this._pakoOptions=f,this.meta={}}o.magic="\b\0",a.inherits(u,l),u.prototype.processChunk=function(d){this.meta=d.meta,this._pako===null&&this._createPako(),this._pako.push(a.transformTo(c,d.data),!1)},u.prototype.flush=function(){l.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},u.prototype.cleanUp=function(){l.prototype.cleanUp.call(this),this._pako=null},u.prototype._createPako=function(){this._pako=new s[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var d=this;this._pako.onData=function(f){d.push({data:f,meta:d.meta})}},o.compressWorker=function(d){return new u("Deflate",d)},o.uncompressWorker=function(){return new u("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(n,r,o){function i(p,h){var m,y="";for(m=0;m<h;m++)y+=String.fromCharCode(255&p),p>>>=8;return y}function s(p,h,m,y,g,x){var k,b,T=p.file,M=p.compression,_=x!==c.utf8encode,F=a.transformTo("string",x(T.name)),C=a.transformTo("string",c.utf8encode(T.name)),V=T.comment,ie=a.transformTo("string",x(V)),I=a.transformTo("string",c.utf8encode(V)),W=C.length!==T.name.length,A=I.length!==V.length,G="",ae="",J="",ue=T.dir,X=T.date,pe={crc32:0,compressedSize:0,uncompressedSize:0};h&&!m||(pe.crc32=p.crc32,pe.compressedSize=p.compressedSize,pe.uncompressedSize=p.uncompressedSize);var Q=0;h&&(Q|=8),_||!W&&!A||(Q|=2048);var B=0,ee=0;ue&&(B|=16),g==="UNIX"?(ee=798,B|=function(re,K){var $=re;return re||($=K?16893:33204),(65535&$)<<16}(T.unixPermissions,ue)):(ee=20,B|=function(re){return 63&(re||0)}(T.dosPermissions)),k=X.getUTCHours(),k<<=6,k|=X.getUTCMinutes(),k<<=5,k|=X.getUTCSeconds()/2,b=X.getUTCFullYear()-1980,b<<=4,b|=X.getUTCMonth()+1,b<<=5,b|=X.getUTCDate(),W&&(ae=i(1,1)+i(u(F),4)+C,G+="up"+i(ae.length,2)+ae),A&&(J=i(1,1)+i(u(ie),4)+I,G+="uc"+i(J.length,2)+J);var Z="";return Z+=`
31
31
  \0`,Z+=i(Q,2),Z+=M.magic,Z+=i(k,2),Z+=i(b,2),Z+=i(pe.crc32,4),Z+=i(pe.compressedSize,4),Z+=i(pe.uncompressedSize,4),Z+=i(F.length,2),Z+=i(G.length,2),{fileRecord:d.LOCAL_FILE_HEADER+Z+F+G,dirRecord:d.CENTRAL_FILE_HEADER+i(ee,2)+Z+i(ie.length,2)+"\0\0\0\0"+i(B,4)+i(y,4)+F+G+ie}}var a=n("../utils"),l=n("../stream/GenericWorker"),c=n("../utf8"),u=n("../crc32"),d=n("../signature");function f(p,h,m,y){l.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=h,this.zipPlatform=m,this.encodeFileName=y,this.streamFiles=p,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}a.inherits(f,l),f.prototype.push=function(p){var h=p.meta.percent||0,m=this.entriesCount,y=this._sources.length;this.accumulate?this.contentBuffer.push(p):(this.bytesWritten+=p.data.length,l.prototype.push.call(this,{data:p.data,meta:{currentFile:this.currentFile,percent:m?(h+100*(m-y-1))/m:100}}))},f.prototype.openedSource=function(p){this.currentSourceOffset=this.bytesWritten,this.currentFile=p.file.name;var h=this.streamFiles&&!p.file.dir;if(h){var m=s(p,h,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:m.fileRecord,meta:{percent:0}})}else this.accumulate=!0},f.prototype.closedSource=function(p){this.accumulate=!1;var h=this.streamFiles&&!p.file.dir,m=s(p,h,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(m.dirRecord),h)this.push({data:function(y){return d.DATA_DESCRIPTOR+i(y.crc32,4)+i(y.compressedSize,4)+i(y.uncompressedSize,4)}(p),meta:{percent:100}});else for(this.push({data:m.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},f.prototype.flush=function(){for(var p=this.bytesWritten,h=0;h<this.dirRecords.length;h++)this.push({data:this.dirRecords[h],meta:{percent:100}});var m=this.bytesWritten-p,y=function(g,x,k,b,T){var M=a.transformTo("string",T(b));return d.CENTRAL_DIRECTORY_END+"\0\0\0\0"+i(g,2)+i(g,2)+i(x,4)+i(k,4)+i(M.length,2)+M}(this.dirRecords.length,m,p,this.zipComment,this.encodeFileName);this.push({data:y,meta:{percent:100}})},f.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},f.prototype.registerPrevious=function(p){this._sources.push(p);var h=this;return p.on("data",function(m){h.processChunk(m)}),p.on("end",function(){h.closedSource(h.previous.streamInfo),h._sources.length?h.prepareNextSource():h.end()}),p.on("error",function(m){h.error(m)}),this},f.prototype.resume=function(){return!!l.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},f.prototype.error=function(p){var h=this._sources;if(!l.prototype.error.call(this,p))return!1;for(var m=0;m<h.length;m++)try{h[m].error(p)}catch{}return!0},f.prototype.lock=function(){l.prototype.lock.call(this);for(var p=this._sources,h=0;h<p.length;h++)p[h].lock()},r.exports=f},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(n,r,o){var i=n("../compressions"),s=n("./ZipFileWorker");o.generateWorker=function(a,l,c){var u=new s(l.streamFiles,c,l.platform,l.encodeFileName),d=0;try{a.forEach(function(f,p){d++;var h=function(x,k){var b=x||k,T=i[b];if(!T)throw new Error(b+" is not a valid compression method !");return T}(p.options.compression,l.compression),m=p.options.compressionOptions||l.compressionOptions||{},y=p.dir,g=p.date;p._compressWorker(h,m).withStreamInfo("file",{name:f,dir:y,date:g,comment:p.comment||"",unixPermissions:p.unixPermissions,dosPermissions:p.dosPermissions}).pipe(u)}),u.entriesCount=d}catch(f){u.error(f)}return u}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(n,r,o){function i(){if(!(this instanceof i))return new i;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var s=new i;for(var a in this)typeof this[a]!="function"&&(s[a]=this[a]);return s}}(i.prototype=n("./object")).loadAsync=n("./load"),i.support=n("./support"),i.defaults=n("./defaults"),i.version="3.10.1",i.loadAsync=function(s,a){return new i().loadAsync(s,a)},i.external=n("./external"),r.exports=i},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(n,r,o){var i=n("./utils"),s=n("./external"),a=n("./utf8"),l=n("./zipEntries"),c=n("./stream/Crc32Probe"),u=n("./nodejsUtils");function d(f){return new s.Promise(function(p,h){var m=f.decompressed.getContentWorker().pipe(new c);m.on("error",function(y){h(y)}).on("end",function(){m.streamInfo.crc32!==f.decompressed.crc32?h(new Error("Corrupted zip : CRC32 mismatch")):p()}).resume()})}r.exports=function(f,p){var h=this;return p=i.extend(p||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:a.utf8decode}),u.isNode&&u.isStream(f)?s.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):i.prepareContent("the loaded zip file",f,!0,p.optimizedBinaryString,p.base64).then(function(m){var y=new l(p);return y.load(m),y}).then(function(m){var y=[s.Promise.resolve(m)],g=m.files;if(p.checkCRC32)for(var x=0;x<g.length;x++)y.push(d(g[x]));return s.Promise.all(y)}).then(function(m){for(var y=m.shift(),g=y.files,x=0;x<g.length;x++){var k=g[x],b=k.fileNameStr,T=i.resolve(k.fileNameStr);h.file(T,k.decompressed,{binary:!0,optimizedBinaryString:!0,date:k.date,dir:k.dir,comment:k.fileCommentStr.length?k.fileCommentStr:null,unixPermissions:k.unixPermissions,dosPermissions:k.dosPermissions,createFolders:p.createFolders}),k.dir||(h.file(T).unsafeOriginalName=b)}return y.zipComment.length&&(h.comment=y.zipComment),h})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(n,r,o){var i=n("../utils"),s=n("../stream/GenericWorker");function a(l,c){s.call(this,"Nodejs stream input adapter for "+l),this._upstreamEnded=!1,this._bindStream(c)}i.inherits(a,s),a.prototype._bindStream=function(l){var c=this;(this._stream=l).pause(),l.on("data",function(u){c.push({data:u,meta:{percent:0}})}).on("error",function(u){c.isPaused?this.generatedError=u:c.error(u)}).on("end",function(){c.isPaused?c._upstreamEnded=!0:c.end()})},a.prototype.pause=function(){return!!s.prototype.pause.call(this)&&(this._stream.pause(),!0)},a.prototype.resume=function(){return!!s.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},r.exports=a},{"../stream/GenericWorker":28,"../utils":32}],13:[function(n,r,o){var i=n("readable-stream").Readable;function s(a,l,c){i.call(this,l),this._helper=a;var u=this;a.on("data",function(d,f){u.push(d)||u._helper.pause(),c&&c(f)}).on("error",function(d){u.emit("error",d)}).on("end",function(){u.push(null)})}n("../utils").inherits(s,i),s.prototype._read=function(){this._helper.resume()},r.exports=s},{"../utils":32,"readable-stream":16}],14:[function(n,r,o){r.exports={isNode:typeof wt<"u",newBufferFrom:function(i,s){if(wt.from&&wt.from!==Uint8Array.from)return wt.from(i,s);if(typeof i=="number")throw new Error('The "data" argument must not be a number');return new wt(i,s)},allocBuffer:function(i){if(wt.alloc)return wt.alloc(i);var s=new wt(i);return s.fill(0),s},isBuffer:function(i){return wt.isBuffer(i)},isStream:function(i){return i&&typeof i.on=="function"&&typeof i.pause=="function"&&typeof i.resume=="function"}}},{}],15:[function(n,r,o){function i(T,M,_){var F,C=a.getTypeOf(M),V=a.extend(_||{},u);V.date=V.date||new Date,V.compression!==null&&(V.compression=V.compression.toUpperCase()),typeof V.unixPermissions=="string"&&(V.unixPermissions=parseInt(V.unixPermissions,8)),V.unixPermissions&&16384&V.unixPermissions&&(V.dir=!0),V.dosPermissions&&16&V.dosPermissions&&(V.dir=!0),V.dir&&(T=g(T)),V.createFolders&&(F=y(T))&&x.call(this,F,!0);var ie=C==="string"&&V.binary===!1&&V.base64===!1;_&&_.binary!==void 0||(V.binary=!ie),(M instanceof d&&M.uncompressedSize===0||V.dir||!M||M.length===0)&&(V.base64=!1,V.binary=!0,M="",V.compression="STORE",C="string");var I=null;I=M instanceof d||M instanceof l?M:h.isNode&&h.isStream(M)?new m(T,M):a.prepareContent(T,M,V.binary,V.optimizedBinaryString,V.base64);var W=new f(T,I,V);this.files[T]=W}var s=n("./utf8"),a=n("./utils"),l=n("./stream/GenericWorker"),c=n("./stream/StreamHelper"),u=n("./defaults"),d=n("./compressedObject"),f=n("./zipObject"),p=n("./generate"),h=n("./nodejsUtils"),m=n("./nodejs/NodejsStreamInputAdapter"),y=function(T){T.slice(-1)==="/"&&(T=T.substring(0,T.length-1));var M=T.lastIndexOf("/");return 0<M?T.substring(0,M):""},g=function(T){return T.slice(-1)!=="/"&&(T+="/"),T},x=function(T,M){return M=M!==void 0?M:u.createFolders,T=g(T),this.files[T]||i.call(this,T,null,{dir:!0,createFolders:M}),this.files[T]};function k(T){return Object.prototype.toString.call(T)==="[object RegExp]"}var b={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(T){var M,_,F;for(M in this.files)F=this.files[M],(_=M.slice(this.root.length,M.length))&&M.slice(0,this.root.length)===this.root&&T(_,F)},filter:function(T){var M=[];return this.forEach(function(_,F){T(_,F)&&M.push(F)}),M},file:function(T,M,_){if(arguments.length!==1)return T=this.root+T,i.call(this,T,M,_),this;if(k(T)){var F=T;return this.filter(function(V,ie){return!ie.dir&&F.test(V)})}var C=this.files[this.root+T];return C&&!C.dir?C:null},folder:function(T){if(!T)return this;if(k(T))return this.filter(function(C,V){return V.dir&&T.test(C)});var M=this.root+T,_=x.call(this,M),F=this.clone();return F.root=_.name,F},remove:function(T){T=this.root+T;var M=this.files[T];if(M||(T.slice(-1)!=="/"&&(T+="/"),M=this.files[T]),M&&!M.dir)delete this.files[T];else for(var _=this.filter(function(C,V){return V.name.slice(0,T.length)===T}),F=0;F<_.length;F++)delete this.files[_[F].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(T){var M,_={};try{if((_=a.extend(T||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:s.utf8encode})).type=_.type.toLowerCase(),_.compression=_.compression.toUpperCase(),_.type==="binarystring"&&(_.type="string"),!_.type)throw new Error("No output type specified.");a.checkSupport(_.type),_.platform!=="darwin"&&_.platform!=="freebsd"&&_.platform!=="linux"&&_.platform!=="sunos"||(_.platform="UNIX"),_.platform==="win32"&&(_.platform="DOS");var F=_.comment||this.comment||"";M=p.generateWorker(this,_,F)}catch(C){(M=new l("error")).error(C)}return new c(M,_.type||"string",_.mimeType)},generateAsync:function(T,M){return this.generateInternalStream(T).accumulate(M)},generateNodeStream:function(T,M){return(T=T||{}).type||(T.type="nodebuffer"),this.generateInternalStream(T).toNodejsStream(M)}};r.exports=b},{"./compressedObject":2,"./defaults":5,"./generate":9,"./nodejs/NodejsStreamInputAdapter":12,"./nodejsUtils":14,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31,"./utils":32,"./zipObject":35}],16:[function(n,r,o){r.exports=n("stream")},{stream:void 0}],17:[function(n,r,o){var i=n("./DataReader");function s(a){i.call(this,a);for(var l=0;l<this.data.length;l++)a[l]=255&a[l]}n("../utils").inherits(s,i),s.prototype.byteAt=function(a){return this.data[this.zero+a]},s.prototype.lastIndexOfSignature=function(a){for(var l=a.charCodeAt(0),c=a.charCodeAt(1),u=a.charCodeAt(2),d=a.charCodeAt(3),f=this.length-4;0<=f;--f)if(this.data[f]===l&&this.data[f+1]===c&&this.data[f+2]===u&&this.data[f+3]===d)return f-this.zero;return-1},s.prototype.readAndCheckSignature=function(a){var l=a.charCodeAt(0),c=a.charCodeAt(1),u=a.charCodeAt(2),d=a.charCodeAt(3),f=this.readData(4);return l===f[0]&&c===f[1]&&u===f[2]&&d===f[3]},s.prototype.readData=function(a){if(this.checkOffset(a),a===0)return[];var l=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},r.exports=s},{"../utils":32,"./DataReader":18}],18:[function(n,r,o){var i=n("../utils");function s(a){this.data=a,this.length=a.length,this.index=0,this.zero=0}s.prototype={checkOffset:function(a){this.checkIndex(this.index+a)},checkIndex:function(a){if(this.length<this.zero+a||a<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+a+"). Corrupted zip ?")},setIndex:function(a){this.checkIndex(a),this.index=a},skip:function(a){this.setIndex(this.index+a)},byteAt:function(){},readInt:function(a){var l,c=0;for(this.checkOffset(a),l=this.index+a-1;l>=this.index;l--)c=(c<<8)+this.byteAt(l);return this.index+=a,c},readString:function(a){return i.transformTo("string",this.readData(a))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var a=this.readInt(4);return new Date(Date.UTC(1980+(a>>25&127),(a>>21&15)-1,a>>16&31,a>>11&31,a>>5&63,(31&a)<<1))}},r.exports=s},{"../utils":32}],19:[function(n,r,o){var i=n("./Uint8ArrayReader");function s(a){i.call(this,a)}n("../utils").inherits(s,i),s.prototype.readData=function(a){this.checkOffset(a);var l=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},r.exports=s},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(n,r,o){var i=n("./DataReader");function s(a){i.call(this,a)}n("../utils").inherits(s,i),s.prototype.byteAt=function(a){return this.data.charCodeAt(this.zero+a)},s.prototype.lastIndexOfSignature=function(a){return this.data.lastIndexOf(a)-this.zero},s.prototype.readAndCheckSignature=function(a){return a===this.readData(4)},s.prototype.readData=function(a){this.checkOffset(a);var l=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},r.exports=s},{"../utils":32,"./DataReader":18}],21:[function(n,r,o){var i=n("./ArrayReader");function s(a){i.call(this,a)}n("../utils").inherits(s,i),s.prototype.readData=function(a){if(this.checkOffset(a),a===0)return new Uint8Array(0);var l=this.data.subarray(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},r.exports=s},{"../utils":32,"./ArrayReader":17}],22:[function(n,r,o){var i=n("../utils"),s=n("../support"),a=n("./ArrayReader"),l=n("./StringReader"),c=n("./NodeBufferReader"),u=n("./Uint8ArrayReader");r.exports=function(d){var f=i.getTypeOf(d);return i.checkSupport(f),f!=="string"||s.uint8array?f==="nodebuffer"?new c(d):s.uint8array?new u(i.transformTo("uint8array",d)):new a(i.transformTo("array",d)):new l(d)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(n,r,o){o.LOCAL_FILE_HEADER="PK",o.CENTRAL_FILE_HEADER="PK",o.CENTRAL_DIRECTORY_END="PK",o.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",o.ZIP64_CENTRAL_DIRECTORY_END="PK",o.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(n,r,o){var i=n("./GenericWorker"),s=n("../utils");function a(l){i.call(this,"ConvertWorker to "+l),this.destType=l}s.inherits(a,i),a.prototype.processChunk=function(l){this.push({data:s.transformTo(this.destType,l.data),meta:l.meta})},r.exports=a},{"../utils":32,"./GenericWorker":28}],25:[function(n,r,o){var i=n("./GenericWorker"),s=n("../crc32");function a(){i.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}n("../utils").inherits(a,i),a.prototype.processChunk=function(l){this.streamInfo.crc32=s(l.data,this.streamInfo.crc32||0),this.push(l)},r.exports=a},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(n,r,o){var i=n("../utils"),s=n("./GenericWorker");function a(l){s.call(this,"DataLengthProbe for "+l),this.propName=l,this.withStreamInfo(l,0)}i.inherits(a,s),a.prototype.processChunk=function(l){if(l){var c=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=c+l.data.length}s.prototype.processChunk.call(this,l)},r.exports=a},{"../utils":32,"./GenericWorker":28}],27:[function(n,r,o){var i=n("../utils"),s=n("./GenericWorker");function a(l){s.call(this,"DataWorker");var c=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,l.then(function(u){c.dataIsReady=!0,c.data=u,c.max=u&&u.length||0,c.type=i.getTypeOf(u),c.isPaused||c._tickAndRepeat()},function(u){c.error(u)})}i.inherits(a,s),a.prototype.cleanUp=function(){s.prototype.cleanUp.call(this),this.data=null},a.prototype.resume=function(){return!!s.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,i.delay(this._tickAndRepeat,[],this)),!0)},a.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(i.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},a.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var l=null,c=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":l=this.data.substring(this.index,c);break;case"uint8array":l=this.data.subarray(this.index,c);break;case"array":case"nodebuffer":l=this.data.slice(this.index,c)}return this.index=c,this.push({data:l,meta:{percent:this.max?this.index/this.max*100:0}})},r.exports=a},{"../utils":32,"./GenericWorker":28}],28:[function(n,r,o){function i(s){this.name=s||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}i.prototype={push:function(s){this.emit("data",s)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(s){this.emit("error",s)}return!0},error:function(s){return!this.isFinished&&(this.isPaused?this.generatedError=s:(this.isFinished=!0,this.emit("error",s),this.previous&&this.previous.error(s),this.cleanUp()),!0)},on:function(s,a){return this._listeners[s].push(a),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(s,a){if(this._listeners[s])for(var l=0;l<this._listeners[s].length;l++)this._listeners[s][l].call(this,a)},pipe:function(s){return s.registerPrevious(this)},registerPrevious:function(s){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=s.streamInfo,this.mergeStreamInfo(),this.previous=s;var a=this;return s.on("data",function(l){a.processChunk(l)}),s.on("end",function(){a.end()}),s.on("error",function(l){a.error(l)}),this},pause:function(){return!this.isPaused&&!this.isFinished&&(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;var s=this.isPaused=!1;return this.generatedError&&(this.error(this.generatedError),s=!0),this.previous&&this.previous.resume(),!s},flush:function(){},processChunk:function(s){this.push(s)},withStreamInfo:function(s,a){return this.extraStreamInfo[s]=a,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var s in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,s)&&(this.streamInfo[s]=this.extraStreamInfo[s])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var s="Worker "+this.name;return this.previous?this.previous+" -> "+s:s}},r.exports=i},{}],29:[function(n,r,o){var i=n("../utils"),s=n("./ConvertWorker"),a=n("./GenericWorker"),l=n("../base64"),c=n("../support"),u=n("../external"),d=null;if(c.nodestream)try{d=n("../nodejs/NodejsStreamOutputAdapter")}catch{}function f(h,m){return new u.Promise(function(y,g){var x=[],k=h._internalType,b=h._outputType,T=h._mimeType;h.on("data",function(M,_){x.push(M),m&&m(_)}).on("error",function(M){x=[],g(M)}).on("end",function(){try{var M=function(_,F,C){switch(_){case"blob":return i.newBlob(i.transformTo("arraybuffer",F),C);case"base64":return l.encode(F);default:return i.transformTo(_,F)}}(b,function(_,F){var C,V=0,ie=null,I=0;for(C=0;C<F.length;C++)I+=F[C].length;switch(_){case"string":return F.join("");case"array":return Array.prototype.concat.apply([],F);case"uint8array":for(ie=new Uint8Array(I),C=0;C<F.length;C++)ie.set(F[C],V),V+=F[C].length;return ie;case"nodebuffer":return wt.concat(F);default:throw new Error("concat : unsupported type '"+_+"'")}}(k,x),T);y(M)}catch(_){g(_)}x=[]}).resume()})}function p(h,m,y){var g=m;switch(m){case"blob":case"arraybuffer":g="uint8array";break;case"base64":g="string"}try{this._internalType=g,this._outputType=m,this._mimeType=y,i.checkSupport(g),this._worker=h.pipe(new s(g)),h.lock()}catch(x){this._worker=new a("error"),this._worker.error(x)}}p.prototype={accumulate:function(h){return f(this,h)},on:function(h,m){var y=this;return h==="data"?this._worker.on(h,function(g){m.call(y,g.data,g.meta)}):this._worker.on(h,function(){i.delay(m,arguments,y)}),this},resume:function(){return i.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(h){if(i.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw new Error(this._outputType+" is not supported by this method");return new d(this,{objectMode:this._outputType!=="nodebuffer"},h)}},r.exports=p},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(n,r,o){if(o.base64=!0,o.array=!0,o.string=!0,o.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",o.nodebuffer=typeof wt<"u",o.uint8array=typeof Uint8Array<"u",typeof ArrayBuffer>"u")o.blob=!1;else{var i=new ArrayBuffer(0);try{o.blob=new Blob([i],{type:"application/zip"}).size===0}catch{try{var s=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);s.append(i),o.blob=s.getBlob("application/zip").size===0}catch{o.blob=!1}}}try{o.nodestream=!!n("readable-stream").Readable}catch{o.nodestream=!1}},{"readable-stream":16}],31:[function(n,r,o){for(var i=n("./utils"),s=n("./support"),a=n("./nodejsUtils"),l=n("./stream/GenericWorker"),c=new Array(256),u=0;u<256;u++)c[u]=252<=u?6:248<=u?5:240<=u?4:224<=u?3:192<=u?2:1;c[254]=c[254]=1;function d(){l.call(this,"utf-8 decode"),this.leftOver=null}function f(){l.call(this,"utf-8 encode")}o.utf8encode=function(p){return s.nodebuffer?a.newBufferFrom(p,"utf-8"):function(h){var m,y,g,x,k,b=h.length,T=0;for(x=0;x<b;x++)(64512&(y=h.charCodeAt(x)))==55296&&x+1<b&&(64512&(g=h.charCodeAt(x+1)))==56320&&(y=65536+(y-55296<<10)+(g-56320),x++),T+=y<128?1:y<2048?2:y<65536?3:4;for(m=s.uint8array?new Uint8Array(T):new Array(T),x=k=0;k<T;x++)(64512&(y=h.charCodeAt(x)))==55296&&x+1<b&&(64512&(g=h.charCodeAt(x+1)))==56320&&(y=65536+(y-55296<<10)+(g-56320),x++),y<128?m[k++]=y:(y<2048?m[k++]=192|y>>>6:(y<65536?m[k++]=224|y>>>12:(m[k++]=240|y>>>18,m[k++]=128|y>>>12&63),m[k++]=128|y>>>6&63),m[k++]=128|63&y);return m}(p)},o.utf8decode=function(p){return s.nodebuffer?i.transformTo("nodebuffer",p).toString("utf-8"):function(h){var m,y,g,x,k=h.length,b=new Array(2*k);for(m=y=0;m<k;)if((g=h[m++])<128)b[y++]=g;else if(4<(x=c[g]))b[y++]=65533,m+=x-1;else{for(g&=x===2?31:x===3?15:7;1<x&&m<k;)g=g<<6|63&h[m++],x--;1<x?b[y++]=65533:g<65536?b[y++]=g:(g-=65536,b[y++]=55296|g>>10&1023,b[y++]=56320|1023&g)}return b.length!==y&&(b.subarray?b=b.subarray(0,y):b.length=y),i.applyFromCharCode(b)}(p=i.transformTo(s.uint8array?"uint8array":"array",p))},i.inherits(d,l),d.prototype.processChunk=function(p){var h=i.transformTo(s.uint8array?"uint8array":"array",p.data);if(this.leftOver&&this.leftOver.length){if(s.uint8array){var m=h;(h=new Uint8Array(m.length+this.leftOver.length)).set(this.leftOver,0),h.set(m,this.leftOver.length)}else h=this.leftOver.concat(h);this.leftOver=null}var y=function(x,k){var b;for((k=k||x.length)>x.length&&(k=x.length),b=k-1;0<=b&&(192&x[b])==128;)b--;return b<0||b===0?k:b+c[x[b]]>k?b:k}(h),g=h;y!==h.length&&(s.uint8array?(g=h.subarray(0,y),this.leftOver=h.subarray(y,h.length)):(g=h.slice(0,y),this.leftOver=h.slice(y,h.length))),this.push({data:o.utf8decode(g),meta:p.meta})},d.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:o.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},o.Utf8DecodeWorker=d,i.inherits(f,l),f.prototype.processChunk=function(p){this.push({data:o.utf8encode(p.data),meta:p.meta})},o.Utf8EncodeWorker=f},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(n,r,o){var i=n("./support"),s=n("./base64"),a=n("./nodejsUtils"),l=n("./external");function c(m){return m}function u(m,y){for(var g=0;g<m.length;++g)y[g]=255&m.charCodeAt(g);return y}n("setimmediate"),o.newBlob=function(m,y){o.checkSupport("blob");try{return new Blob([m],{type:y})}catch{try{var g=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return g.append(m),g.getBlob(y)}catch{throw new Error("Bug : can't construct the Blob.")}}};var d={stringifyByChunk:function(m,y,g){var x=[],k=0,b=m.length;if(b<=g)return String.fromCharCode.apply(null,m);for(;k<b;)y==="array"||y==="nodebuffer"?x.push(String.fromCharCode.apply(null,m.slice(k,Math.min(k+g,b)))):x.push(String.fromCharCode.apply(null,m.subarray(k,Math.min(k+g,b)))),k+=g;return x.join("")},stringifyByChar:function(m){for(var y="",g=0;g<m.length;g++)y+=String.fromCharCode(m[g]);return y},applyCanBeUsed:{uint8array:function(){try{return i.uint8array&&String.fromCharCode.apply(null,new Uint8Array(1)).length===1}catch{return!1}}(),nodebuffer:function(){try{return i.nodebuffer&&String.fromCharCode.apply(null,a.allocBuffer(1)).length===1}catch{return!1}}()}};function f(m){var y=65536,g=o.getTypeOf(m),x=!0;if(g==="uint8array"?x=d.applyCanBeUsed.uint8array:g==="nodebuffer"&&(x=d.applyCanBeUsed.nodebuffer),x)for(;1<y;)try{return d.stringifyByChunk(m,g,y)}catch{y=Math.floor(y/2)}return d.stringifyByChar(m)}function p(m,y){for(var g=0;g<m.length;g++)y[g]=m[g];return y}o.applyFromCharCode=f;var h={};h.string={string:c,array:function(m){return u(m,new Array(m.length))},arraybuffer:function(m){return h.string.uint8array(m).buffer},uint8array:function(m){return u(m,new Uint8Array(m.length))},nodebuffer:function(m){return u(m,a.allocBuffer(m.length))}},h.array={string:f,array:c,arraybuffer:function(m){return new Uint8Array(m).buffer},uint8array:function(m){return new Uint8Array(m)},nodebuffer:function(m){return a.newBufferFrom(m)}},h.arraybuffer={string:function(m){return f(new Uint8Array(m))},array:function(m){return p(new Uint8Array(m),new Array(m.byteLength))},arraybuffer:c,uint8array:function(m){return new Uint8Array(m)},nodebuffer:function(m){return a.newBufferFrom(new Uint8Array(m))}},h.uint8array={string:f,array:function(m){return p(m,new Array(m.length))},arraybuffer:function(m){return m.buffer},uint8array:c,nodebuffer:function(m){return a.newBufferFrom(m)}},h.nodebuffer={string:f,array:function(m){return p(m,new Array(m.length))},arraybuffer:function(m){return h.nodebuffer.uint8array(m).buffer},uint8array:function(m){return p(m,new Uint8Array(m.length))},nodebuffer:c},o.transformTo=function(m,y){if(y=y||"",!m)return y;o.checkSupport(m);var g=o.getTypeOf(y);return h[g][m](y)},o.resolve=function(m){for(var y=m.split("/"),g=[],x=0;x<y.length;x++){var k=y[x];k==="."||k===""&&x!==0&&x!==y.length-1||(k===".."?g.pop():g.push(k))}return g.join("/")},o.getTypeOf=function(m){return typeof m=="string"?"string":Object.prototype.toString.call(m)==="[object Array]"?"array":i.nodebuffer&&a.isBuffer(m)?"nodebuffer":i.uint8array&&m instanceof Uint8Array?"uint8array":i.arraybuffer&&m instanceof ArrayBuffer?"arraybuffer":void 0},o.checkSupport=function(m){if(!i[m.toLowerCase()])throw new Error(m+" is not supported by this platform")},o.MAX_VALUE_16BITS=65535,o.MAX_VALUE_32BITS=-1,o.pretty=function(m){var y,g,x="";for(g=0;g<(m||"").length;g++)x+="\\x"+((y=m.charCodeAt(g))<16?"0":"")+y.toString(16).toUpperCase();return x},o.delay=function(m,y,g){setImmediate(function(){m.apply(g||null,y||[])})},o.inherits=function(m,y){function g(){}g.prototype=y.prototype,m.prototype=new g},o.extend=function(){var m,y,g={};for(m=0;m<arguments.length;m++)for(y in arguments[m])Object.prototype.hasOwnProperty.call(arguments[m],y)&&g[y]===void 0&&(g[y]=arguments[m][y]);return g},o.prepareContent=function(m,y,g,x,k){return l.Promise.resolve(y).then(function(b){return i.blob&&(b instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(b))!==-1)&&typeof FileReader<"u"?new l.Promise(function(T,M){var _=new FileReader;_.onload=function(F){T(F.target.result)},_.onerror=function(F){M(F.target.error)},_.readAsArrayBuffer(b)}):b}).then(function(b){var T=o.getTypeOf(b);return T?(T==="arraybuffer"?b=o.transformTo("uint8array",b):T==="string"&&(k?b=s.decode(b):g&&x!==!0&&(b=function(M){return u(M,i.uint8array?new Uint8Array(M.length):new Array(M.length))}(b))),b):l.Promise.reject(new Error("Can't read the data of '"+m+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,setimmediate:54}],33:[function(n,r,o){var i=n("./reader/readerFor"),s=n("./utils"),a=n("./signature"),l=n("./zipEntry"),c=n("./support");function u(d){this.files=[],this.loadOptions=d}u.prototype={checkSignature:function(d){if(!this.reader.readAndCheckSignature(d)){this.reader.index-=4;var f=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+s.pretty(f)+", expected "+s.pretty(d)+")")}},isSignature:function(d,f){var p=this.reader.index;this.reader.setIndex(d);var h=this.reader.readString(4)===f;return this.reader.setIndex(p),h},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var d=this.reader.readData(this.zipCommentLength),f=c.uint8array?"uint8array":"array",p=s.transformTo(f,d);this.zipComment=this.loadOptions.decodeFileName(p)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var d,f,p,h=this.zip64EndOfCentralSize-44;0<h;)d=this.reader.readInt(2),f=this.reader.readInt(4),p=this.reader.readData(f),this.zip64ExtensibleData[d]={id:d,length:f,value:p}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),1<this.disksCount)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var d,f;for(d=0;d<this.files.length;d++)f=this.files[d],this.reader.setIndex(f.localHeaderOffset),this.checkSignature(a.LOCAL_FILE_HEADER),f.readLocalPart(this.reader),f.handleUTF8(),f.processAttributes()},readCentralDir:function(){var d;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(a.CENTRAL_FILE_HEADER);)(d=new l({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(d);if(this.centralDirRecords!==this.files.length&&this.centralDirRecords!==0&&this.files.length===0)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var d=this.reader.lastIndexOfSignature(a.CENTRAL_DIRECTORY_END);if(d<0)throw this.isSignature(0,a.LOCAL_FILE_HEADER)?new Error("Corrupted zip: can't find end of central directory"):new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html");this.reader.setIndex(d);var f=d;if(this.checkSignature(a.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===s.MAX_VALUE_16BITS||this.diskWithCentralDirStart===s.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===s.MAX_VALUE_16BITS||this.centralDirRecords===s.MAX_VALUE_16BITS||this.centralDirSize===s.MAX_VALUE_32BITS||this.centralDirOffset===s.MAX_VALUE_32BITS){if(this.zip64=!0,(d=this.reader.lastIndexOfSignature(a.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(d),this.checkSignature(a.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,a.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(a.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(a.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var p=this.centralDirOffset+this.centralDirSize;this.zip64&&(p+=20,p+=12+this.zip64EndOfCentralSize);var h=f-p;if(0<h)this.isSignature(f,a.CENTRAL_FILE_HEADER)||(this.reader.zero=h);else if(h<0)throw new Error("Corrupted zip: missing "+Math.abs(h)+" bytes.")},prepareReader:function(d){this.reader=i(d)},load:function(d){this.prepareReader(d),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},r.exports=u},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(n,r,o){var i=n("./reader/readerFor"),s=n("./utils"),a=n("./compressedObject"),l=n("./crc32"),c=n("./utf8"),u=n("./compressions"),d=n("./support");function f(p,h){this.options=p,this.loadOptions=h}f.prototype={isEncrypted:function(){return(1&this.bitFlag)==1},useUTF8:function(){return(2048&this.bitFlag)==2048},readLocalPart:function(p){var h,m;if(p.skip(22),this.fileNameLength=p.readInt(2),m=p.readInt(2),this.fileName=p.readData(this.fileNameLength),p.skip(m),this.compressedSize===-1||this.uncompressedSize===-1)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if((h=function(y){for(var g in u)if(Object.prototype.hasOwnProperty.call(u,g)&&u[g].magic===y)return u[g];return null}(this.compressionMethod))===null)throw new Error("Corrupted zip : compression "+s.pretty(this.compressionMethod)+" unknown (inner file : "+s.transformTo("string",this.fileName)+")");this.decompressed=new a(this.compressedSize,this.uncompressedSize,this.crc32,h,p.readData(this.compressedSize))},readCentralPart:function(p){this.versionMadeBy=p.readInt(2),p.skip(2),this.bitFlag=p.readInt(2),this.compressionMethod=p.readString(2),this.date=p.readDate(),this.crc32=p.readInt(4),this.compressedSize=p.readInt(4),this.uncompressedSize=p.readInt(4);var h=p.readInt(2);if(this.extraFieldsLength=p.readInt(2),this.fileCommentLength=p.readInt(2),this.diskNumberStart=p.readInt(2),this.internalFileAttributes=p.readInt(2),this.externalFileAttributes=p.readInt(4),this.localHeaderOffset=p.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");p.skip(h),this.readExtraFields(p),this.parseZIP64ExtraField(p),this.fileComment=p.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var p=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),p==0&&(this.dosPermissions=63&this.externalFileAttributes),p==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var p=i(this.extraFields[1].value);this.uncompressedSize===s.MAX_VALUE_32BITS&&(this.uncompressedSize=p.readInt(8)),this.compressedSize===s.MAX_VALUE_32BITS&&(this.compressedSize=p.readInt(8)),this.localHeaderOffset===s.MAX_VALUE_32BITS&&(this.localHeaderOffset=p.readInt(8)),this.diskNumberStart===s.MAX_VALUE_32BITS&&(this.diskNumberStart=p.readInt(4))}},readExtraFields:function(p){var h,m,y,g=p.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});p.index+4<g;)h=p.readInt(2),m=p.readInt(2),y=p.readData(m),this.extraFields[h]={id:h,length:m,value:y};p.setIndex(g)},handleUTF8:function(){var p=d.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=c.utf8decode(this.fileName),this.fileCommentStr=c.utf8decode(this.fileComment);else{var h=this.findExtraFieldUnicodePath();if(h!==null)this.fileNameStr=h;else{var m=s.transformTo(p,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(m)}var y=this.findExtraFieldUnicodeComment();if(y!==null)this.fileCommentStr=y;else{var g=s.transformTo(p,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(g)}}},findExtraFieldUnicodePath:function(){var p=this.extraFields[28789];if(p){var h=i(p.value);return h.readInt(1)!==1||l(this.fileName)!==h.readInt(4)?null:c.utf8decode(h.readData(p.length-5))}return null},findExtraFieldUnicodeComment:function(){var p=this.extraFields[25461];if(p){var h=i(p.value);return h.readInt(1)!==1||l(this.fileComment)!==h.readInt(4)?null:c.utf8decode(h.readData(p.length-5))}return null}},r.exports=f},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(n,r,o){function i(h,m,y){this.name=h,this.dir=y.dir,this.date=y.date,this.comment=y.comment,this.unixPermissions=y.unixPermissions,this.dosPermissions=y.dosPermissions,this._data=m,this._dataBinary=y.binary,this.options={compression:y.compression,compressionOptions:y.compressionOptions}}var s=n("./stream/StreamHelper"),a=n("./stream/DataWorker"),l=n("./utf8"),c=n("./compressedObject"),u=n("./stream/GenericWorker");i.prototype={internalStream:function(h){var m=null,y="string";try{if(!h)throw new Error("No output type specified.");var g=(y=h.toLowerCase())==="string"||y==="text";y!=="binarystring"&&y!=="text"||(y="string"),m=this._decompressWorker();var x=!this._dataBinary;x&&!g&&(m=m.pipe(new l.Utf8EncodeWorker)),!x&&g&&(m=m.pipe(new l.Utf8DecodeWorker))}catch(k){(m=new u("error")).error(k)}return new s(m,y,"")},async:function(h,m){return this.internalStream(h).accumulate(m)},nodeStream:function(h,m){return this.internalStream(h||"nodebuffer").toNodejsStream(m)},_compressWorker:function(h,m){if(this._data instanceof c&&this._data.compression.magic===h.magic)return this._data.getCompressedWorker();var y=this._decompressWorker();return this._dataBinary||(y=y.pipe(new l.Utf8EncodeWorker)),c.createWorkerFrom(y,h,m)},_decompressWorker:function(){return this._data instanceof c?this._data.getContentWorker():this._data instanceof u?this._data:new a(this._data)}};for(var d=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],f=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},p=0;p<d.length;p++)i.prototype[d[p]]=f;r.exports=i},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(n,r,o){(function(i){var s,a,l=i.MutationObserver||i.WebKitMutationObserver;if(l){var c=0,u=new l(h),d=i.document.createTextNode("");u.observe(d,{characterData:!0}),s=function(){d.data=c=++c%2}}else if(i.setImmediate||i.MessageChannel===void 0)s="document"in i&&"onreadystatechange"in i.document.createElement("script")?function(){var m=i.document.createElement("script");m.onreadystatechange=function(){h(),m.onreadystatechange=null,m.parentNode.removeChild(m),m=null},i.document.documentElement.appendChild(m)}:function(){setTimeout(h,0)};else{var f=new i.MessageChannel;f.port1.onmessage=h,s=function(){f.port2.postMessage(0)}}var p=[];function h(){var m,y;a=!0;for(var g=p.length;g;){for(y=p,p=[],m=-1;++m<g;)y[m]();g=p.length}a=!1}r.exports=function(m){p.push(m)!==1||a||s()}}).call(this,typeof zt<"u"?zt:typeof self<"u"?self:typeof window<"u"?window:{})},{}],37:[function(n,r,o){var i=n("immediate");function s(){}var a={},l=["REJECTED"],c=["FULFILLED"],u=["PENDING"];function d(g){if(typeof g!="function")throw new TypeError("resolver must be a function");this.state=u,this.queue=[],this.outcome=void 0,g!==s&&m(this,g)}function f(g,x,k){this.promise=g,typeof x=="function"&&(this.onFulfilled=x,this.callFulfilled=this.otherCallFulfilled),typeof k=="function"&&(this.onRejected=k,this.callRejected=this.otherCallRejected)}function p(g,x,k){i(function(){var b;try{b=x(k)}catch(T){return a.reject(g,T)}b===g?a.reject(g,new TypeError("Cannot resolve promise with itself")):a.resolve(g,b)})}function h(g){var x=g&&g.then;if(g&&(typeof g=="object"||typeof g=="function")&&typeof x=="function")return function(){x.apply(g,arguments)}}function m(g,x){var k=!1;function b(_){k||(k=!0,a.reject(g,_))}function T(_){k||(k=!0,a.resolve(g,_))}var M=y(function(){x(T,b)});M.status==="error"&&b(M.value)}function y(g,x){var k={};try{k.value=g(x),k.status="success"}catch(b){k.status="error",k.value=b}return k}(r.exports=d).prototype.finally=function(g){if(typeof g!="function")return this;var x=this.constructor;return this.then(function(k){return x.resolve(g()).then(function(){return k})},function(k){return x.resolve(g()).then(function(){throw k})})},d.prototype.catch=function(g){return this.then(null,g)},d.prototype.then=function(g,x){if(typeof g!="function"&&this.state===c||typeof x!="function"&&this.state===l)return this;var k=new this.constructor(s);return this.state!==u?p(k,this.state===c?g:x,this.outcome):this.queue.push(new f(k,g,x)),k},f.prototype.callFulfilled=function(g){a.resolve(this.promise,g)},f.prototype.otherCallFulfilled=function(g){p(this.promise,this.onFulfilled,g)},f.prototype.callRejected=function(g){a.reject(this.promise,g)},f.prototype.otherCallRejected=function(g){p(this.promise,this.onRejected,g)},a.resolve=function(g,x){var k=y(h,x);if(k.status==="error")return a.reject(g,k.value);var b=k.value;if(b)m(g,b);else{g.state=c,g.outcome=x;for(var T=-1,M=g.queue.length;++T<M;)g.queue[T].callFulfilled(x)}return g},a.reject=function(g,x){g.state=l,g.outcome=x;for(var k=-1,b=g.queue.length;++k<b;)g.queue[k].callRejected(x);return g},d.resolve=function(g){return g instanceof this?g:a.resolve(new this(s),g)},d.reject=function(g){var x=new this(s);return a.reject(x,g)},d.all=function(g){var x=this;if(Object.prototype.toString.call(g)!=="[object Array]")return this.reject(new TypeError("must be an array"));var k=g.length,b=!1;if(!k)return this.resolve([]);for(var T=new Array(k),M=0,_=-1,F=new this(s);++_<k;)C(g[_],_);return F;function C(V,ie){x.resolve(V).then(function(I){T[ie]=I,++M!==k||b||(b=!0,a.resolve(F,T))},function(I){b||(b=!0,a.reject(F,I))})}},d.race=function(g){var x=this;if(Object.prototype.toString.call(g)!=="[object Array]")return this.reject(new TypeError("must be an array"));var k=g.length,b=!1;if(!k)return this.resolve([]);for(var T=-1,M=new this(s);++T<k;)_=g[T],x.resolve(_).then(function(F){b||(b=!0,a.resolve(M,F))},function(F){b||(b=!0,a.reject(M,F))});var _;return M}},{immediate:36}],38:[function(n,r,o){var i={};(0,n("./lib/utils/common").assign)(i,n("./lib/deflate"),n("./lib/inflate"),n("./lib/zlib/constants")),r.exports=i},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(n,r,o){var i=n("./zlib/deflate"),s=n("./utils/common"),a=n("./utils/strings"),l=n("./zlib/messages"),c=n("./zlib/zstream"),u=Object.prototype.toString,d=0,f=-1,p=0,h=8;function m(g){if(!(this instanceof m))return new m(g);this.options=s.assign({level:f,method:h,chunkSize:16384,windowBits:15,memLevel:8,strategy:p,to:""},g||{});var x=this.options;x.raw&&0<x.windowBits?x.windowBits=-x.windowBits:x.gzip&&0<x.windowBits&&x.windowBits<16&&(x.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new c,this.strm.avail_out=0;var k=i.deflateInit2(this.strm,x.level,x.method,x.windowBits,x.memLevel,x.strategy);if(k!==d)throw new Error(l[k]);if(x.header&&i.deflateSetHeader(this.strm,x.header),x.dictionary){var b;if(b=typeof x.dictionary=="string"?a.string2buf(x.dictionary):u.call(x.dictionary)==="[object ArrayBuffer]"?new Uint8Array(x.dictionary):x.dictionary,(k=i.deflateSetDictionary(this.strm,b))!==d)throw new Error(l[k]);this._dict_set=!0}}function y(g,x){var k=new m(x);if(k.push(g,!0),k.err)throw k.msg||l[k.err];return k.result}m.prototype.push=function(g,x){var k,b,T=this.strm,M=this.options.chunkSize;if(this.ended)return!1;b=x===~~x?x:x===!0?4:0,typeof g=="string"?T.input=a.string2buf(g):u.call(g)==="[object ArrayBuffer]"?T.input=new Uint8Array(g):T.input=g,T.next_in=0,T.avail_in=T.input.length;do{if(T.avail_out===0&&(T.output=new s.Buf8(M),T.next_out=0,T.avail_out=M),(k=i.deflate(T,b))!==1&&k!==d)return this.onEnd(k),!(this.ended=!0);T.avail_out!==0&&(T.avail_in!==0||b!==4&&b!==2)||(this.options.to==="string"?this.onData(a.buf2binstring(s.shrinkBuf(T.output,T.next_out))):this.onData(s.shrinkBuf(T.output,T.next_out)))}while((0<T.avail_in||T.avail_out===0)&&k!==1);return b===4?(k=i.deflateEnd(this.strm),this.onEnd(k),this.ended=!0,k===d):b!==2||(this.onEnd(d),!(T.avail_out=0))},m.prototype.onData=function(g){this.chunks.push(g)},m.prototype.onEnd=function(g){g===d&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=s.flattenChunks(this.chunks)),this.chunks=[],this.err=g,this.msg=this.strm.msg},o.Deflate=m,o.deflate=y,o.deflateRaw=function(g,x){return(x=x||{}).raw=!0,y(g,x)},o.gzip=function(g,x){return(x=x||{}).gzip=!0,y(g,x)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(n,r,o){var i=n("./zlib/inflate"),s=n("./utils/common"),a=n("./utils/strings"),l=n("./zlib/constants"),c=n("./zlib/messages"),u=n("./zlib/zstream"),d=n("./zlib/gzheader"),f=Object.prototype.toString;function p(m){if(!(this instanceof p))return new p(m);this.options=s.assign({chunkSize:16384,windowBits:0,to:""},m||{});var y=this.options;y.raw&&0<=y.windowBits&&y.windowBits<16&&(y.windowBits=-y.windowBits,y.windowBits===0&&(y.windowBits=-15)),!(0<=y.windowBits&&y.windowBits<16)||m&&m.windowBits||(y.windowBits+=32),15<y.windowBits&&y.windowBits<48&&!(15&y.windowBits)&&(y.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new u,this.strm.avail_out=0;var g=i.inflateInit2(this.strm,y.windowBits);if(g!==l.Z_OK)throw new Error(c[g]);this.header=new d,i.inflateGetHeader(this.strm,this.header)}function h(m,y){var g=new p(y);if(g.push(m,!0),g.err)throw g.msg||c[g.err];return g.result}p.prototype.push=function(m,y){var g,x,k,b,T,M,_=this.strm,F=this.options.chunkSize,C=this.options.dictionary,V=!1;if(this.ended)return!1;x=y===~~y?y:y===!0?l.Z_FINISH:l.Z_NO_FLUSH,typeof m=="string"?_.input=a.binstring2buf(m):f.call(m)==="[object ArrayBuffer]"?_.input=new Uint8Array(m):_.input=m,_.next_in=0,_.avail_in=_.input.length;do{if(_.avail_out===0&&(_.output=new s.Buf8(F),_.next_out=0,_.avail_out=F),(g=i.inflate(_,l.Z_NO_FLUSH))===l.Z_NEED_DICT&&C&&(M=typeof C=="string"?a.string2buf(C):f.call(C)==="[object ArrayBuffer]"?new Uint8Array(C):C,g=i.inflateSetDictionary(this.strm,M)),g===l.Z_BUF_ERROR&&V===!0&&(g=l.Z_OK,V=!1),g!==l.Z_STREAM_END&&g!==l.Z_OK)return this.onEnd(g),!(this.ended=!0);_.next_out&&(_.avail_out!==0&&g!==l.Z_STREAM_END&&(_.avail_in!==0||x!==l.Z_FINISH&&x!==l.Z_SYNC_FLUSH)||(this.options.to==="string"?(k=a.utf8border(_.output,_.next_out),b=_.next_out-k,T=a.buf2string(_.output,k),_.next_out=b,_.avail_out=F-b,b&&s.arraySet(_.output,_.output,k,b,0),this.onData(T)):this.onData(s.shrinkBuf(_.output,_.next_out)))),_.avail_in===0&&_.avail_out===0&&(V=!0)}while((0<_.avail_in||_.avail_out===0)&&g!==l.Z_STREAM_END);return g===l.Z_STREAM_END&&(x=l.Z_FINISH),x===l.Z_FINISH?(g=i.inflateEnd(this.strm),this.onEnd(g),this.ended=!0,g===l.Z_OK):x!==l.Z_SYNC_FLUSH||(this.onEnd(l.Z_OK),!(_.avail_out=0))},p.prototype.onData=function(m){this.chunks.push(m)},p.prototype.onEnd=function(m){m===l.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=s.flattenChunks(this.chunks)),this.chunks=[],this.err=m,this.msg=this.strm.msg},o.Inflate=p,o.inflate=h,o.inflateRaw=function(m,y){return(y=y||{}).raw=!0,h(m,y)},o.ungzip=h},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(n,r,o){var i=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";o.assign=function(l){for(var c=Array.prototype.slice.call(arguments,1);c.length;){var u=c.shift();if(u){if(typeof u!="object")throw new TypeError(u+"must be non-object");for(var d in u)u.hasOwnProperty(d)&&(l[d]=u[d])}}return l},o.shrinkBuf=function(l,c){return l.length===c?l:l.subarray?l.subarray(0,c):(l.length=c,l)};var s={arraySet:function(l,c,u,d,f){if(c.subarray&&l.subarray)l.set(c.subarray(u,u+d),f);else for(var p=0;p<d;p++)l[f+p]=c[u+p]},flattenChunks:function(l){var c,u,d,f,p,h;for(c=d=0,u=l.length;c<u;c++)d+=l[c].length;for(h=new Uint8Array(d),c=f=0,u=l.length;c<u;c++)p=l[c],h.set(p,f),f+=p.length;return h}},a={arraySet:function(l,c,u,d,f){for(var p=0;p<d;p++)l[f+p]=c[u+p]},flattenChunks:function(l){return[].concat.apply([],l)}};o.setTyped=function(l){l?(o.Buf8=Uint8Array,o.Buf16=Uint16Array,o.Buf32=Int32Array,o.assign(o,s)):(o.Buf8=Array,o.Buf16=Array,o.Buf32=Array,o.assign(o,a))},o.setTyped(i)},{}],42:[function(n,r,o){var i=n("./common"),s=!0,a=!0;try{String.fromCharCode.apply(null,[0])}catch{s=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{a=!1}for(var l=new i.Buf8(256),c=0;c<256;c++)l[c]=252<=c?6:248<=c?5:240<=c?4:224<=c?3:192<=c?2:1;function u(d,f){if(f<65537&&(d.subarray&&a||!d.subarray&&s))return String.fromCharCode.apply(null,i.shrinkBuf(d,f));for(var p="",h=0;h<f;h++)p+=String.fromCharCode(d[h]);return p}l[254]=l[254]=1,o.string2buf=function(d){var f,p,h,m,y,g=d.length,x=0;for(m=0;m<g;m++)(64512&(p=d.charCodeAt(m)))==55296&&m+1<g&&(64512&(h=d.charCodeAt(m+1)))==56320&&(p=65536+(p-55296<<10)+(h-56320),m++),x+=p<128?1:p<2048?2:p<65536?3:4;for(f=new i.Buf8(x),m=y=0;y<x;m++)(64512&(p=d.charCodeAt(m)))==55296&&m+1<g&&(64512&(h=d.charCodeAt(m+1)))==56320&&(p=65536+(p-55296<<10)+(h-56320),m++),p<128?f[y++]=p:(p<2048?f[y++]=192|p>>>6:(p<65536?f[y++]=224|p>>>12:(f[y++]=240|p>>>18,f[y++]=128|p>>>12&63),f[y++]=128|p>>>6&63),f[y++]=128|63&p);return f},o.buf2binstring=function(d){return u(d,d.length)},o.binstring2buf=function(d){for(var f=new i.Buf8(d.length),p=0,h=f.length;p<h;p++)f[p]=d.charCodeAt(p);return f},o.buf2string=function(d,f){var p,h,m,y,g=f||d.length,x=new Array(2*g);for(p=h=0;p<g;)if((m=d[p++])<128)x[h++]=m;else if(4<(y=l[m]))x[h++]=65533,p+=y-1;else{for(m&=y===2?31:y===3?15:7;1<y&&p<g;)m=m<<6|63&d[p++],y--;1<y?x[h++]=65533:m<65536?x[h++]=m:(m-=65536,x[h++]=55296|m>>10&1023,x[h++]=56320|1023&m)}return u(x,h)},o.utf8border=function(d,f){var p;for((f=f||d.length)>d.length&&(f=d.length),p=f-1;0<=p&&(192&d[p])==128;)p--;return p<0||p===0?f:p+l[d[p]]>f?p:f}},{"./common":41}],43:[function(n,r,o){r.exports=function(i,s,a,l){for(var c=65535&i|0,u=i>>>16&65535|0,d=0;a!==0;){for(a-=d=2e3<a?2e3:a;u=u+(c=c+s[l++]|0)|0,--d;);c%=65521,u%=65521}return c|u<<16|0}},{}],44:[function(n,r,o){r.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],45:[function(n,r,o){var i=function(){for(var s,a=[],l=0;l<256;l++){s=l;for(var c=0;c<8;c++)s=1&s?3988292384^s>>>1:s>>>1;a[l]=s}return a}();r.exports=function(s,a,l,c){var u=i,d=c+l;s^=-1;for(var f=c;f<d;f++)s=s>>>8^u[255&(s^a[f])];return-1^s}},{}],46:[function(n,r,o){var i,s=n("../utils/common"),a=n("./trees"),l=n("./adler32"),c=n("./crc32"),u=n("./messages"),d=0,f=4,p=0,h=-2,m=-1,y=4,g=2,x=8,k=9,b=286,T=30,M=19,_=2*b+1,F=15,C=3,V=258,ie=V+C+1,I=42,W=113,A=1,G=2,ae=3,J=4;function ue(S,oe){return S.msg=u[oe],oe}function X(S){return(S<<1)-(4<S?9:0)}function pe(S){for(var oe=S.length;0<=--oe;)S[oe]=0}function Q(S){var oe=S.state,te=oe.pending;te>S.avail_out&&(te=S.avail_out),te!==0&&(s.arraySet(S.output,oe.pending_buf,oe.pending_out,te,S.next_out),S.next_out+=te,oe.pending_out+=te,S.total_out+=te,S.avail_out-=te,oe.pending-=te,oe.pending===0&&(oe.pending_out=0))}function B(S,oe){a._tr_flush_block(S,0<=S.block_start?S.block_start:-1,S.strstart-S.block_start,oe),S.block_start=S.strstart,Q(S.strm)}function ee(S,oe){S.pending_buf[S.pending++]=oe}function Z(S,oe){S.pending_buf[S.pending++]=oe>>>8&255,S.pending_buf[S.pending++]=255&oe}function re(S,oe){var te,L,z=S.max_chain_length,P=S.strstart,fe=S.prev_length,me=S.nice_match,se=S.strstart>S.w_size-ie?S.strstart-(S.w_size-ie):0,ge=S.window,ce=S.w_mask,de=S.prev,be=S.strstart+V,Ne=ge[P+fe-1],Ce=ge[P+fe];S.prev_length>=S.good_match&&(z>>=2),me>S.lookahead&&(me=S.lookahead);do if(ge[(te=oe)+fe]===Ce&&ge[te+fe-1]===Ne&&ge[te]===ge[P]&&ge[++te]===ge[P+1]){P+=2,te++;do;while(ge[++P]===ge[++te]&&ge[++P]===ge[++te]&&ge[++P]===ge[++te]&&ge[++P]===ge[++te]&&ge[++P]===ge[++te]&&ge[++P]===ge[++te]&&ge[++P]===ge[++te]&&ge[++P]===ge[++te]&&P<be);if(L=V-(be-P),P=be-V,fe<L){if(S.match_start=oe,me<=(fe=L))break;Ne=ge[P+fe-1],Ce=ge[P+fe]}}while((oe=de[oe&ce])>se&&--z!=0);return fe<=S.lookahead?fe:S.lookahead}function K(S){var oe,te,L,z,P,fe,me,se,ge,ce,de=S.w_size;do{if(z=S.window_size-S.lookahead-S.strstart,S.strstart>=de+(de-ie)){for(s.arraySet(S.window,S.window,de,de,0),S.match_start-=de,S.strstart-=de,S.block_start-=de,oe=te=S.hash_size;L=S.head[--oe],S.head[oe]=de<=L?L-de:0,--te;);for(oe=te=de;L=S.prev[--oe],S.prev[oe]=de<=L?L-de:0,--te;);z+=de}if(S.strm.avail_in===0)break;if(fe=S.strm,me=S.window,se=S.strstart+S.lookahead,ge=z,ce=void 0,ce=fe.avail_in,ge<ce&&(ce=ge),te=ce===0?0:(fe.avail_in-=ce,s.arraySet(me,fe.input,fe.next_in,ce,se),fe.state.wrap===1?fe.adler=l(fe.adler,me,ce,se):fe.state.wrap===2&&(fe.adler=c(fe.adler,me,ce,se)),fe.next_in+=ce,fe.total_in+=ce,ce),S.lookahead+=te,S.lookahead+S.insert>=C)for(P=S.strstart-S.insert,S.ins_h=S.window[P],S.ins_h=(S.ins_h<<S.hash_shift^S.window[P+1])&S.hash_mask;S.insert&&(S.ins_h=(S.ins_h<<S.hash_shift^S.window[P+C-1])&S.hash_mask,S.prev[P&S.w_mask]=S.head[S.ins_h],S.head[S.ins_h]=P,P++,S.insert--,!(S.lookahead+S.insert<C)););}while(S.lookahead<ie&&S.strm.avail_in!==0)}function $(S,oe){for(var te,L;;){if(S.lookahead<ie){if(K(S),S.lookahead<ie&&oe===d)return A;if(S.lookahead===0)break}if(te=0,S.lookahead>=C&&(S.ins_h=(S.ins_h<<S.hash_shift^S.window[S.strstart+C-1])&S.hash_mask,te=S.prev[S.strstart&S.w_mask]=S.head[S.ins_h],S.head[S.ins_h]=S.strstart),te!==0&&S.strstart-te<=S.w_size-ie&&(S.match_length=re(S,te)),S.match_length>=C)if(L=a._tr_tally(S,S.strstart-S.match_start,S.match_length-C),S.lookahead-=S.match_length,S.match_length<=S.max_lazy_match&&S.lookahead>=C){for(S.match_length--;S.strstart++,S.ins_h=(S.ins_h<<S.hash_shift^S.window[S.strstart+C-1])&S.hash_mask,te=S.prev[S.strstart&S.w_mask]=S.head[S.ins_h],S.head[S.ins_h]=S.strstart,--S.match_length!=0;);S.strstart++}else S.strstart+=S.match_length,S.match_length=0,S.ins_h=S.window[S.strstart],S.ins_h=(S.ins_h<<S.hash_shift^S.window[S.strstart+1])&S.hash_mask;else L=a._tr_tally(S,0,S.window[S.strstart]),S.lookahead--,S.strstart++;if(L&&(B(S,!1),S.strm.avail_out===0))return A}return S.insert=S.strstart<C-1?S.strstart:C-1,oe===f?(B(S,!0),S.strm.avail_out===0?ae:J):S.last_lit&&(B(S,!1),S.strm.avail_out===0)?A:G}function E(S,oe){for(var te,L,z;;){if(S.lookahead<ie){if(K(S),S.lookahead<ie&&oe===d)return A;if(S.lookahead===0)break}if(te=0,S.lookahead>=C&&(S.ins_h=(S.ins_h<<S.hash_shift^S.window[S.strstart+C-1])&S.hash_mask,te=S.prev[S.strstart&S.w_mask]=S.head[S.ins_h],S.head[S.ins_h]=S.strstart),S.prev_length=S.match_length,S.prev_match=S.match_start,S.match_length=C-1,te!==0&&S.prev_length<S.max_lazy_match&&S.strstart-te<=S.w_size-ie&&(S.match_length=re(S,te),S.match_length<=5&&(S.strategy===1||S.match_length===C&&4096<S.strstart-S.match_start)&&(S.match_length=C-1)),S.prev_length>=C&&S.match_length<=S.prev_length){for(z=S.strstart+S.lookahead-C,L=a._tr_tally(S,S.strstart-1-S.prev_match,S.prev_length-C),S.lookahead-=S.prev_length-1,S.prev_length-=2;++S.strstart<=z&&(S.ins_h=(S.ins_h<<S.hash_shift^S.window[S.strstart+C-1])&S.hash_mask,te=S.prev[S.strstart&S.w_mask]=S.head[S.ins_h],S.head[S.ins_h]=S.strstart),--S.prev_length!=0;);if(S.match_available=0,S.match_length=C-1,S.strstart++,L&&(B(S,!1),S.strm.avail_out===0))return A}else if(S.match_available){if((L=a._tr_tally(S,0,S.window[S.strstart-1]))&&B(S,!1),S.strstart++,S.lookahead--,S.strm.avail_out===0)return A}else S.match_available=1,S.strstart++,S.lookahead--}return S.match_available&&(L=a._tr_tally(S,0,S.window[S.strstart-1]),S.match_available=0),S.insert=S.strstart<C-1?S.strstart:C-1,oe===f?(B(S,!0),S.strm.avail_out===0?ae:J):S.last_lit&&(B(S,!1),S.strm.avail_out===0)?A:G}function H(S,oe,te,L,z){this.good_length=S,this.max_lazy=oe,this.nice_length=te,this.max_chain=L,this.func=z}function q(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=x,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new s.Buf16(2*_),this.dyn_dtree=new s.Buf16(2*(2*T+1)),this.bl_tree=new s.Buf16(2*(2*M+1)),pe(this.dyn_ltree),pe(this.dyn_dtree),pe(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new s.Buf16(F+1),this.heap=new s.Buf16(2*b+1),pe(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new s.Buf16(2*b+1),pe(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function D(S){var oe;return S&&S.state?(S.total_in=S.total_out=0,S.data_type=g,(oe=S.state).pending=0,oe.pending_out=0,oe.wrap<0&&(oe.wrap=-oe.wrap),oe.status=oe.wrap?I:W,S.adler=oe.wrap===2?0:1,oe.last_flush=d,a._tr_init(oe),p):ue(S,h)}function R(S){var oe=D(S);return oe===p&&function(te){te.window_size=2*te.w_size,pe(te.head),te.max_lazy_match=i[te.level].max_lazy,te.good_match=i[te.level].good_length,te.nice_match=i[te.level].nice_length,te.max_chain_length=i[te.level].max_chain,te.strstart=0,te.block_start=0,te.lookahead=0,te.insert=0,te.match_length=te.prev_length=C-1,te.match_available=0,te.ins_h=0}(S.state),oe}function le(S,oe,te,L,z,P){if(!S)return h;var fe=1;if(oe===m&&(oe=6),L<0?(fe=0,L=-L):15<L&&(fe=2,L-=16),z<1||k<z||te!==x||L<8||15<L||oe<0||9<oe||P<0||y<P)return ue(S,h);L===8&&(L=9);var me=new q;return(S.state=me).strm=S,me.wrap=fe,me.gzhead=null,me.w_bits=L,me.w_size=1<<me.w_bits,me.w_mask=me.w_size-1,me.hash_bits=z+7,me.hash_size=1<<me.hash_bits,me.hash_mask=me.hash_size-1,me.hash_shift=~~((me.hash_bits+C-1)/C),me.window=new s.Buf8(2*me.w_size),me.head=new s.Buf16(me.hash_size),me.prev=new s.Buf16(me.w_size),me.lit_bufsize=1<<z+6,me.pending_buf_size=4*me.lit_bufsize,me.pending_buf=new s.Buf8(me.pending_buf_size),me.d_buf=1*me.lit_bufsize,me.l_buf=3*me.lit_bufsize,me.level=oe,me.strategy=P,me.method=te,R(S)}i=[new H(0,0,0,0,function(S,oe){var te=65535;for(te>S.pending_buf_size-5&&(te=S.pending_buf_size-5);;){if(S.lookahead<=1){if(K(S),S.lookahead===0&&oe===d)return A;if(S.lookahead===0)break}S.strstart+=S.lookahead,S.lookahead=0;var L=S.block_start+te;if((S.strstart===0||S.strstart>=L)&&(S.lookahead=S.strstart-L,S.strstart=L,B(S,!1),S.strm.avail_out===0)||S.strstart-S.block_start>=S.w_size-ie&&(B(S,!1),S.strm.avail_out===0))return A}return S.insert=0,oe===f?(B(S,!0),S.strm.avail_out===0?ae:J):(S.strstart>S.block_start&&(B(S,!1),S.strm.avail_out),A)}),new H(4,4,8,4,$),new H(4,5,16,8,$),new H(4,6,32,32,$),new H(4,4,16,16,E),new H(8,16,32,32,E),new H(8,16,128,128,E),new H(8,32,128,256,E),new H(32,128,258,1024,E),new H(32,258,258,4096,E)],o.deflateInit=function(S,oe){return le(S,oe,x,15,8,0)},o.deflateInit2=le,o.deflateReset=R,o.deflateResetKeep=D,o.deflateSetHeader=function(S,oe){return S&&S.state?S.state.wrap!==2?h:(S.state.gzhead=oe,p):h},o.deflate=function(S,oe){var te,L,z,P;if(!S||!S.state||5<oe||oe<0)return S?ue(S,h):h;if(L=S.state,!S.output||!S.input&&S.avail_in!==0||L.status===666&&oe!==f)return ue(S,S.avail_out===0?-5:h);if(L.strm=S,te=L.last_flush,L.last_flush=oe,L.status===I)if(L.wrap===2)S.adler=0,ee(L,31),ee(L,139),ee(L,8),L.gzhead?(ee(L,(L.gzhead.text?1:0)+(L.gzhead.hcrc?2:0)+(L.gzhead.extra?4:0)+(L.gzhead.name?8:0)+(L.gzhead.comment?16:0)),ee(L,255&L.gzhead.time),ee(L,L.gzhead.time>>8&255),ee(L,L.gzhead.time>>16&255),ee(L,L.gzhead.time>>24&255),ee(L,L.level===9?2:2<=L.strategy||L.level<2?4:0),ee(L,255&L.gzhead.os),L.gzhead.extra&&L.gzhead.extra.length&&(ee(L,255&L.gzhead.extra.length),ee(L,L.gzhead.extra.length>>8&255)),L.gzhead.hcrc&&(S.adler=c(S.adler,L.pending_buf,L.pending,0)),L.gzindex=0,L.status=69):(ee(L,0),ee(L,0),ee(L,0),ee(L,0),ee(L,0),ee(L,L.level===9?2:2<=L.strategy||L.level<2?4:0),ee(L,3),L.status=W);else{var fe=x+(L.w_bits-8<<4)<<8;fe|=(2<=L.strategy||L.level<2?0:L.level<6?1:L.level===6?2:3)<<6,L.strstart!==0&&(fe|=32),fe+=31-fe%31,L.status=W,Z(L,fe),L.strstart!==0&&(Z(L,S.adler>>>16),Z(L,65535&S.adler)),S.adler=1}if(L.status===69)if(L.gzhead.extra){for(z=L.pending;L.gzindex<(65535&L.gzhead.extra.length)&&(L.pending!==L.pending_buf_size||(L.gzhead.hcrc&&L.pending>z&&(S.adler=c(S.adler,L.pending_buf,L.pending-z,z)),Q(S),z=L.pending,L.pending!==L.pending_buf_size));)ee(L,255&L.gzhead.extra[L.gzindex]),L.gzindex++;L.gzhead.hcrc&&L.pending>z&&(S.adler=c(S.adler,L.pending_buf,L.pending-z,z)),L.gzindex===L.gzhead.extra.length&&(L.gzindex=0,L.status=73)}else L.status=73;if(L.status===73)if(L.gzhead.name){z=L.pending;do{if(L.pending===L.pending_buf_size&&(L.gzhead.hcrc&&L.pending>z&&(S.adler=c(S.adler,L.pending_buf,L.pending-z,z)),Q(S),z=L.pending,L.pending===L.pending_buf_size)){P=1;break}P=L.gzindex<L.gzhead.name.length?255&L.gzhead.name.charCodeAt(L.gzindex++):0,ee(L,P)}while(P!==0);L.gzhead.hcrc&&L.pending>z&&(S.adler=c(S.adler,L.pending_buf,L.pending-z,z)),P===0&&(L.gzindex=0,L.status=91)}else L.status=91;if(L.status===91)if(L.gzhead.comment){z=L.pending;do{if(L.pending===L.pending_buf_size&&(L.gzhead.hcrc&&L.pending>z&&(S.adler=c(S.adler,L.pending_buf,L.pending-z,z)),Q(S),z=L.pending,L.pending===L.pending_buf_size)){P=1;break}P=L.gzindex<L.gzhead.comment.length?255&L.gzhead.comment.charCodeAt(L.gzindex++):0,ee(L,P)}while(P!==0);L.gzhead.hcrc&&L.pending>z&&(S.adler=c(S.adler,L.pending_buf,L.pending-z,z)),P===0&&(L.status=103)}else L.status=103;if(L.status===103&&(L.gzhead.hcrc?(L.pending+2>L.pending_buf_size&&Q(S),L.pending+2<=L.pending_buf_size&&(ee(L,255&S.adler),ee(L,S.adler>>8&255),S.adler=0,L.status=W)):L.status=W),L.pending!==0){if(Q(S),S.avail_out===0)return L.last_flush=-1,p}else if(S.avail_in===0&&X(oe)<=X(te)&&oe!==f)return ue(S,-5);if(L.status===666&&S.avail_in!==0)return ue(S,-5);if(S.avail_in!==0||L.lookahead!==0||oe!==d&&L.status!==666){var me=L.strategy===2?function(se,ge){for(var ce;;){if(se.lookahead===0&&(K(se),se.lookahead===0)){if(ge===d)return A;break}if(se.match_length=0,ce=a._tr_tally(se,0,se.window[se.strstart]),se.lookahead--,se.strstart++,ce&&(B(se,!1),se.strm.avail_out===0))return A}return se.insert=0,ge===f?(B(se,!0),se.strm.avail_out===0?ae:J):se.last_lit&&(B(se,!1),se.strm.avail_out===0)?A:G}(L,oe):L.strategy===3?function(se,ge){for(var ce,de,be,Ne,Ce=se.window;;){if(se.lookahead<=V){if(K(se),se.lookahead<=V&&ge===d)return A;if(se.lookahead===0)break}if(se.match_length=0,se.lookahead>=C&&0<se.strstart&&(de=Ce[be=se.strstart-1])===Ce[++be]&&de===Ce[++be]&&de===Ce[++be]){Ne=se.strstart+V;do;while(de===Ce[++be]&&de===Ce[++be]&&de===Ce[++be]&&de===Ce[++be]&&de===Ce[++be]&&de===Ce[++be]&&de===Ce[++be]&&de===Ce[++be]&&be<Ne);se.match_length=V-(Ne-be),se.match_length>se.lookahead&&(se.match_length=se.lookahead)}if(se.match_length>=C?(ce=a._tr_tally(se,1,se.match_length-C),se.lookahead-=se.match_length,se.strstart+=se.match_length,se.match_length=0):(ce=a._tr_tally(se,0,se.window[se.strstart]),se.lookahead--,se.strstart++),ce&&(B(se,!1),se.strm.avail_out===0))return A}return se.insert=0,ge===f?(B(se,!0),se.strm.avail_out===0?ae:J):se.last_lit&&(B(se,!1),se.strm.avail_out===0)?A:G}(L,oe):i[L.level].func(L,oe);if(me!==ae&&me!==J||(L.status=666),me===A||me===ae)return S.avail_out===0&&(L.last_flush=-1),p;if(me===G&&(oe===1?a._tr_align(L):oe!==5&&(a._tr_stored_block(L,0,0,!1),oe===3&&(pe(L.head),L.lookahead===0&&(L.strstart=0,L.block_start=0,L.insert=0))),Q(S),S.avail_out===0))return L.last_flush=-1,p}return oe!==f?p:L.wrap<=0?1:(L.wrap===2?(ee(L,255&S.adler),ee(L,S.adler>>8&255),ee(L,S.adler>>16&255),ee(L,S.adler>>24&255),ee(L,255&S.total_in),ee(L,S.total_in>>8&255),ee(L,S.total_in>>16&255),ee(L,S.total_in>>24&255)):(Z(L,S.adler>>>16),Z(L,65535&S.adler)),Q(S),0<L.wrap&&(L.wrap=-L.wrap),L.pending!==0?p:1)},o.deflateEnd=function(S){var oe;return S&&S.state?(oe=S.state.status)!==I&&oe!==69&&oe!==73&&oe!==91&&oe!==103&&oe!==W&&oe!==666?ue(S,h):(S.state=null,oe===W?ue(S,-3):p):h},o.deflateSetDictionary=function(S,oe){var te,L,z,P,fe,me,se,ge,ce=oe.length;if(!S||!S.state||(P=(te=S.state).wrap)===2||P===1&&te.status!==I||te.lookahead)return h;for(P===1&&(S.adler=l(S.adler,oe,ce,0)),te.wrap=0,ce>=te.w_size&&(P===0&&(pe(te.head),te.strstart=0,te.block_start=0,te.insert=0),ge=new s.Buf8(te.w_size),s.arraySet(ge,oe,ce-te.w_size,te.w_size,0),oe=ge,ce=te.w_size),fe=S.avail_in,me=S.next_in,se=S.input,S.avail_in=ce,S.next_in=0,S.input=oe,K(te);te.lookahead>=C;){for(L=te.strstart,z=te.lookahead-(C-1);te.ins_h=(te.ins_h<<te.hash_shift^te.window[L+C-1])&te.hash_mask,te.prev[L&te.w_mask]=te.head[te.ins_h],te.head[te.ins_h]=L,L++,--z;);te.strstart=L,te.lookahead=C-1,K(te)}return te.strstart+=te.lookahead,te.block_start=te.strstart,te.insert=te.lookahead,te.lookahead=0,te.match_length=te.prev_length=C-1,te.match_available=0,S.next_in=me,S.input=se,S.avail_in=fe,te.wrap=P,p},o.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(n,r,o){r.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},{}],48:[function(n,r,o){r.exports=function(i,s){var a,l,c,u,d,f,p,h,m,y,g,x,k,b,T,M,_,F,C,V,ie,I,W,A,G;a=i.state,l=i.next_in,A=i.input,c=l+(i.avail_in-5),u=i.next_out,G=i.output,d=u-(s-i.avail_out),f=u+(i.avail_out-257),p=a.dmax,h=a.wsize,m=a.whave,y=a.wnext,g=a.window,x=a.hold,k=a.bits,b=a.lencode,T=a.distcode,M=(1<<a.lenbits)-1,_=(1<<a.distbits)-1;e:do{k<15&&(x+=A[l++]<<k,k+=8,x+=A[l++]<<k,k+=8),F=b[x&M];t:for(;;){if(x>>>=C=F>>>24,k-=C,(C=F>>>16&255)===0)G[u++]=65535&F;else{if(!(16&C)){if(!(64&C)){F=b[(65535&F)+(x&(1<<C)-1)];continue t}if(32&C){a.mode=12;break e}i.msg="invalid literal/length code",a.mode=30;break e}V=65535&F,(C&=15)&&(k<C&&(x+=A[l++]<<k,k+=8),V+=x&(1<<C)-1,x>>>=C,k-=C),k<15&&(x+=A[l++]<<k,k+=8,x+=A[l++]<<k,k+=8),F=T[x&_];n:for(;;){if(x>>>=C=F>>>24,k-=C,!(16&(C=F>>>16&255))){if(!(64&C)){F=T[(65535&F)+(x&(1<<C)-1)];continue n}i.msg="invalid distance code",a.mode=30;break e}if(ie=65535&F,k<(C&=15)&&(x+=A[l++]<<k,(k+=8)<C&&(x+=A[l++]<<k,k+=8)),p<(ie+=x&(1<<C)-1)){i.msg="invalid distance too far back",a.mode=30;break e}if(x>>>=C,k-=C,(C=u-d)<ie){if(m<(C=ie-C)&&a.sane){i.msg="invalid distance too far back",a.mode=30;break e}if(W=g,(I=0)===y){if(I+=h-C,C<V){for(V-=C;G[u++]=g[I++],--C;);I=u-ie,W=G}}else if(y<C){if(I+=h+y-C,(C-=y)<V){for(V-=C;G[u++]=g[I++],--C;);if(I=0,y<V){for(V-=C=y;G[u++]=g[I++],--C;);I=u-ie,W=G}}}else if(I+=y-C,C<V){for(V-=C;G[u++]=g[I++],--C;);I=u-ie,W=G}for(;2<V;)G[u++]=W[I++],G[u++]=W[I++],G[u++]=W[I++],V-=3;V&&(G[u++]=W[I++],1<V&&(G[u++]=W[I++]))}else{for(I=u-ie;G[u++]=G[I++],G[u++]=G[I++],G[u++]=G[I++],2<(V-=3););V&&(G[u++]=G[I++],1<V&&(G[u++]=G[I++]))}break}}break}}while(l<c&&u<f);l-=V=k>>3,x&=(1<<(k-=V<<3))-1,i.next_in=l,i.next_out=u,i.avail_in=l<c?c-l+5:5-(l-c),i.avail_out=u<f?f-u+257:257-(u-f),a.hold=x,a.bits=k}},{}],49:[function(n,r,o){var i=n("../utils/common"),s=n("./adler32"),a=n("./crc32"),l=n("./inffast"),c=n("./inftrees"),u=1,d=2,f=0,p=-2,h=1,m=852,y=592;function g(I){return(I>>>24&255)+(I>>>8&65280)+((65280&I)<<8)+((255&I)<<24)}function x(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new i.Buf16(320),this.work=new i.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function k(I){var W;return I&&I.state?(W=I.state,I.total_in=I.total_out=W.total=0,I.msg="",W.wrap&&(I.adler=1&W.wrap),W.mode=h,W.last=0,W.havedict=0,W.dmax=32768,W.head=null,W.hold=0,W.bits=0,W.lencode=W.lendyn=new i.Buf32(m),W.distcode=W.distdyn=new i.Buf32(y),W.sane=1,W.back=-1,f):p}function b(I){var W;return I&&I.state?((W=I.state).wsize=0,W.whave=0,W.wnext=0,k(I)):p}function T(I,W){var A,G;return I&&I.state?(G=I.state,W<0?(A=0,W=-W):(A=1+(W>>4),W<48&&(W&=15)),W&&(W<8||15<W)?p:(G.window!==null&&G.wbits!==W&&(G.window=null),G.wrap=A,G.wbits=W,b(I))):p}function M(I,W){var A,G;return I?(G=new x,(I.state=G).window=null,(A=T(I,W))!==f&&(I.state=null),A):p}var _,F,C=!0;function V(I){if(C){var W;for(_=new i.Buf32(512),F=new i.Buf32(32),W=0;W<144;)I.lens[W++]=8;for(;W<256;)I.lens[W++]=9;for(;W<280;)I.lens[W++]=7;for(;W<288;)I.lens[W++]=8;for(c(u,I.lens,0,288,_,0,I.work,{bits:9}),W=0;W<32;)I.lens[W++]=5;c(d,I.lens,0,32,F,0,I.work,{bits:5}),C=!1}I.lencode=_,I.lenbits=9,I.distcode=F,I.distbits=5}function ie(I,W,A,G){var ae,J=I.state;return J.window===null&&(J.wsize=1<<J.wbits,J.wnext=0,J.whave=0,J.window=new i.Buf8(J.wsize)),G>=J.wsize?(i.arraySet(J.window,W,A-J.wsize,J.wsize,0),J.wnext=0,J.whave=J.wsize):(G<(ae=J.wsize-J.wnext)&&(ae=G),i.arraySet(J.window,W,A-G,ae,J.wnext),(G-=ae)?(i.arraySet(J.window,W,A-G,G,0),J.wnext=G,J.whave=J.wsize):(J.wnext+=ae,J.wnext===J.wsize&&(J.wnext=0),J.whave<J.wsize&&(J.whave+=ae))),0}o.inflateReset=b,o.inflateReset2=T,o.inflateResetKeep=k,o.inflateInit=function(I){return M(I,15)},o.inflateInit2=M,o.inflate=function(I,W){var A,G,ae,J,ue,X,pe,Q,B,ee,Z,re,K,$,E,H,q,D,R,le,S,oe,te,L,z=0,P=new i.Buf8(4),fe=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!I||!I.state||!I.output||!I.input&&I.avail_in!==0)return p;(A=I.state).mode===12&&(A.mode=13),ue=I.next_out,ae=I.output,pe=I.avail_out,J=I.next_in,G=I.input,X=I.avail_in,Q=A.hold,B=A.bits,ee=X,Z=pe,oe=f;e:for(;;)switch(A.mode){case h:if(A.wrap===0){A.mode=13;break}for(;B<16;){if(X===0)break e;X--,Q+=G[J++]<<B,B+=8}if(2&A.wrap&&Q===35615){P[A.check=0]=255&Q,P[1]=Q>>>8&255,A.check=a(A.check,P,2,0),B=Q=0,A.mode=2;break}if(A.flags=0,A.head&&(A.head.done=!1),!(1&A.wrap)||(((255&Q)<<8)+(Q>>8))%31){I.msg="incorrect header check",A.mode=30;break}if((15&Q)!=8){I.msg="unknown compression method",A.mode=30;break}if(B-=4,S=8+(15&(Q>>>=4)),A.wbits===0)A.wbits=S;else if(S>A.wbits){I.msg="invalid window size",A.mode=30;break}A.dmax=1<<S,I.adler=A.check=1,A.mode=512&Q?10:12,B=Q=0;break;case 2:for(;B<16;){if(X===0)break e;X--,Q+=G[J++]<<B,B+=8}if(A.flags=Q,(255&A.flags)!=8){I.msg="unknown compression method",A.mode=30;break}if(57344&A.flags){I.msg="unknown header flags set",A.mode=30;break}A.head&&(A.head.text=Q>>8&1),512&A.flags&&(P[0]=255&Q,P[1]=Q>>>8&255,A.check=a(A.check,P,2,0)),B=Q=0,A.mode=3;case 3:for(;B<32;){if(X===0)break e;X--,Q+=G[J++]<<B,B+=8}A.head&&(A.head.time=Q),512&A.flags&&(P[0]=255&Q,P[1]=Q>>>8&255,P[2]=Q>>>16&255,P[3]=Q>>>24&255,A.check=a(A.check,P,4,0)),B=Q=0,A.mode=4;case 4:for(;B<16;){if(X===0)break e;X--,Q+=G[J++]<<B,B+=8}A.head&&(A.head.xflags=255&Q,A.head.os=Q>>8),512&A.flags&&(P[0]=255&Q,P[1]=Q>>>8&255,A.check=a(A.check,P,2,0)),B=Q=0,A.mode=5;case 5:if(1024&A.flags){for(;B<16;){if(X===0)break e;X--,Q+=G[J++]<<B,B+=8}A.length=Q,A.head&&(A.head.extra_len=Q),512&A.flags&&(P[0]=255&Q,P[1]=Q>>>8&255,A.check=a(A.check,P,2,0)),B=Q=0}else A.head&&(A.head.extra=null);A.mode=6;case 6:if(1024&A.flags&&(X<(re=A.length)&&(re=X),re&&(A.head&&(S=A.head.extra_len-A.length,A.head.extra||(A.head.extra=new Array(A.head.extra_len)),i.arraySet(A.head.extra,G,J,re,S)),512&A.flags&&(A.check=a(A.check,G,re,J)),X-=re,J+=re,A.length-=re),A.length))break e;A.length=0,A.mode=7;case 7:if(2048&A.flags){if(X===0)break e;for(re=0;S=G[J+re++],A.head&&S&&A.length<65536&&(A.head.name+=String.fromCharCode(S)),S&&re<X;);if(512&A.flags&&(A.check=a(A.check,G,re,J)),X-=re,J+=re,S)break e}else A.head&&(A.head.name=null);A.length=0,A.mode=8;case 8:if(4096&A.flags){if(X===0)break e;for(re=0;S=G[J+re++],A.head&&S&&A.length<65536&&(A.head.comment+=String.fromCharCode(S)),S&&re<X;);if(512&A.flags&&(A.check=a(A.check,G,re,J)),X-=re,J+=re,S)break e}else A.head&&(A.head.comment=null);A.mode=9;case 9:if(512&A.flags){for(;B<16;){if(X===0)break e;X--,Q+=G[J++]<<B,B+=8}if(Q!==(65535&A.check)){I.msg="header crc mismatch",A.mode=30;break}B=Q=0}A.head&&(A.head.hcrc=A.flags>>9&1,A.head.done=!0),I.adler=A.check=0,A.mode=12;break;case 10:for(;B<32;){if(X===0)break e;X--,Q+=G[J++]<<B,B+=8}I.adler=A.check=g(Q),B=Q=0,A.mode=11;case 11:if(A.havedict===0)return I.next_out=ue,I.avail_out=pe,I.next_in=J,I.avail_in=X,A.hold=Q,A.bits=B,2;I.adler=A.check=1,A.mode=12;case 12:if(W===5||W===6)break e;case 13:if(A.last){Q>>>=7&B,B-=7&B,A.mode=27;break}for(;B<3;){if(X===0)break e;X--,Q+=G[J++]<<B,B+=8}switch(A.last=1&Q,B-=1,3&(Q>>>=1)){case 0:A.mode=14;break;case 1:if(V(A),A.mode=20,W!==6)break;Q>>>=2,B-=2;break e;case 2:A.mode=17;break;case 3:I.msg="invalid block type",A.mode=30}Q>>>=2,B-=2;break;case 14:for(Q>>>=7&B,B-=7&B;B<32;){if(X===0)break e;X--,Q+=G[J++]<<B,B+=8}if((65535&Q)!=(Q>>>16^65535)){I.msg="invalid stored block lengths",A.mode=30;break}if(A.length=65535&Q,B=Q=0,A.mode=15,W===6)break e;case 15:A.mode=16;case 16:if(re=A.length){if(X<re&&(re=X),pe<re&&(re=pe),re===0)break e;i.arraySet(ae,G,J,re,ue),X-=re,J+=re,pe-=re,ue+=re,A.length-=re;break}A.mode=12;break;case 17:for(;B<14;){if(X===0)break e;X--,Q+=G[J++]<<B,B+=8}if(A.nlen=257+(31&Q),Q>>>=5,B-=5,A.ndist=1+(31&Q),Q>>>=5,B-=5,A.ncode=4+(15&Q),Q>>>=4,B-=4,286<A.nlen||30<A.ndist){I.msg="too many length or distance symbols",A.mode=30;break}A.have=0,A.mode=18;case 18:for(;A.have<A.ncode;){for(;B<3;){if(X===0)break e;X--,Q+=G[J++]<<B,B+=8}A.lens[fe[A.have++]]=7&Q,Q>>>=3,B-=3}for(;A.have<19;)A.lens[fe[A.have++]]=0;if(A.lencode=A.lendyn,A.lenbits=7,te={bits:A.lenbits},oe=c(0,A.lens,0,19,A.lencode,0,A.work,te),A.lenbits=te.bits,oe){I.msg="invalid code lengths set",A.mode=30;break}A.have=0,A.mode=19;case 19:for(;A.have<A.nlen+A.ndist;){for(;H=(z=A.lencode[Q&(1<<A.lenbits)-1])>>>16&255,q=65535&z,!((E=z>>>24)<=B);){if(X===0)break e;X--,Q+=G[J++]<<B,B+=8}if(q<16)Q>>>=E,B-=E,A.lens[A.have++]=q;else{if(q===16){for(L=E+2;B<L;){if(X===0)break e;X--,Q+=G[J++]<<B,B+=8}if(Q>>>=E,B-=E,A.have===0){I.msg="invalid bit length repeat",A.mode=30;break}S=A.lens[A.have-1],re=3+(3&Q),Q>>>=2,B-=2}else if(q===17){for(L=E+3;B<L;){if(X===0)break e;X--,Q+=G[J++]<<B,B+=8}B-=E,S=0,re=3+(7&(Q>>>=E)),Q>>>=3,B-=3}else{for(L=E+7;B<L;){if(X===0)break e;X--,Q+=G[J++]<<B,B+=8}B-=E,S=0,re=11+(127&(Q>>>=E)),Q>>>=7,B-=7}if(A.have+re>A.nlen+A.ndist){I.msg="invalid bit length repeat",A.mode=30;break}for(;re--;)A.lens[A.have++]=S}}if(A.mode===30)break;if(A.lens[256]===0){I.msg="invalid code -- missing end-of-block",A.mode=30;break}if(A.lenbits=9,te={bits:A.lenbits},oe=c(u,A.lens,0,A.nlen,A.lencode,0,A.work,te),A.lenbits=te.bits,oe){I.msg="invalid literal/lengths set",A.mode=30;break}if(A.distbits=6,A.distcode=A.distdyn,te={bits:A.distbits},oe=c(d,A.lens,A.nlen,A.ndist,A.distcode,0,A.work,te),A.distbits=te.bits,oe){I.msg="invalid distances set",A.mode=30;break}if(A.mode=20,W===6)break e;case 20:A.mode=21;case 21:if(6<=X&&258<=pe){I.next_out=ue,I.avail_out=pe,I.next_in=J,I.avail_in=X,A.hold=Q,A.bits=B,l(I,Z),ue=I.next_out,ae=I.output,pe=I.avail_out,J=I.next_in,G=I.input,X=I.avail_in,Q=A.hold,B=A.bits,A.mode===12&&(A.back=-1);break}for(A.back=0;H=(z=A.lencode[Q&(1<<A.lenbits)-1])>>>16&255,q=65535&z,!((E=z>>>24)<=B);){if(X===0)break e;X--,Q+=G[J++]<<B,B+=8}if(H&&!(240&H)){for(D=E,R=H,le=q;H=(z=A.lencode[le+((Q&(1<<D+R)-1)>>D)])>>>16&255,q=65535&z,!(D+(E=z>>>24)<=B);){if(X===0)break e;X--,Q+=G[J++]<<B,B+=8}Q>>>=D,B-=D,A.back+=D}if(Q>>>=E,B-=E,A.back+=E,A.length=q,H===0){A.mode=26;break}if(32&H){A.back=-1,A.mode=12;break}if(64&H){I.msg="invalid literal/length code",A.mode=30;break}A.extra=15&H,A.mode=22;case 22:if(A.extra){for(L=A.extra;B<L;){if(X===0)break e;X--,Q+=G[J++]<<B,B+=8}A.length+=Q&(1<<A.extra)-1,Q>>>=A.extra,B-=A.extra,A.back+=A.extra}A.was=A.length,A.mode=23;case 23:for(;H=(z=A.distcode[Q&(1<<A.distbits)-1])>>>16&255,q=65535&z,!((E=z>>>24)<=B);){if(X===0)break e;X--,Q+=G[J++]<<B,B+=8}if(!(240&H)){for(D=E,R=H,le=q;H=(z=A.distcode[le+((Q&(1<<D+R)-1)>>D)])>>>16&255,q=65535&z,!(D+(E=z>>>24)<=B);){if(X===0)break e;X--,Q+=G[J++]<<B,B+=8}Q>>>=D,B-=D,A.back+=D}if(Q>>>=E,B-=E,A.back+=E,64&H){I.msg="invalid distance code",A.mode=30;break}A.offset=q,A.extra=15&H,A.mode=24;case 24:if(A.extra){for(L=A.extra;B<L;){if(X===0)break e;X--,Q+=G[J++]<<B,B+=8}A.offset+=Q&(1<<A.extra)-1,Q>>>=A.extra,B-=A.extra,A.back+=A.extra}if(A.offset>A.dmax){I.msg="invalid distance too far back",A.mode=30;break}A.mode=25;case 25:if(pe===0)break e;if(re=Z-pe,A.offset>re){if((re=A.offset-re)>A.whave&&A.sane){I.msg="invalid distance too far back",A.mode=30;break}K=re>A.wnext?(re-=A.wnext,A.wsize-re):A.wnext-re,re>A.length&&(re=A.length),$=A.window}else $=ae,K=ue-A.offset,re=A.length;for(pe<re&&(re=pe),pe-=re,A.length-=re;ae[ue++]=$[K++],--re;);A.length===0&&(A.mode=21);break;case 26:if(pe===0)break e;ae[ue++]=A.length,pe--,A.mode=21;break;case 27:if(A.wrap){for(;B<32;){if(X===0)break e;X--,Q|=G[J++]<<B,B+=8}if(Z-=pe,I.total_out+=Z,A.total+=Z,Z&&(I.adler=A.check=A.flags?a(A.check,ae,Z,ue-Z):s(A.check,ae,Z,ue-Z)),Z=pe,(A.flags?Q:g(Q))!==A.check){I.msg="incorrect data check",A.mode=30;break}B=Q=0}A.mode=28;case 28:if(A.wrap&&A.flags){for(;B<32;){if(X===0)break e;X--,Q+=G[J++]<<B,B+=8}if(Q!==(4294967295&A.total)){I.msg="incorrect length check",A.mode=30;break}B=Q=0}A.mode=29;case 29:oe=1;break e;case 30:oe=-3;break e;case 31:return-4;case 32:default:return p}return I.next_out=ue,I.avail_out=pe,I.next_in=J,I.avail_in=X,A.hold=Q,A.bits=B,(A.wsize||Z!==I.avail_out&&A.mode<30&&(A.mode<27||W!==4))&&ie(I,I.output,I.next_out,Z-I.avail_out)?(A.mode=31,-4):(ee-=I.avail_in,Z-=I.avail_out,I.total_in+=ee,I.total_out+=Z,A.total+=Z,A.wrap&&Z&&(I.adler=A.check=A.flags?a(A.check,ae,Z,I.next_out-Z):s(A.check,ae,Z,I.next_out-Z)),I.data_type=A.bits+(A.last?64:0)+(A.mode===12?128:0)+(A.mode===20||A.mode===15?256:0),(ee==0&&Z===0||W===4)&&oe===f&&(oe=-5),oe)},o.inflateEnd=function(I){if(!I||!I.state)return p;var W=I.state;return W.window&&(W.window=null),I.state=null,f},o.inflateGetHeader=function(I,W){var A;return I&&I.state&&2&(A=I.state).wrap?((A.head=W).done=!1,f):p},o.inflateSetDictionary=function(I,W){var A,G=W.length;return I&&I.state?(A=I.state).wrap!==0&&A.mode!==11?p:A.mode===11&&s(1,W,G,0)!==A.check?-3:ie(I,W,G,G)?(A.mode=31,-4):(A.havedict=1,f):p},o.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(n,r,o){var i=n("../utils/common"),s=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],a=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],l=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],c=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];r.exports=function(u,d,f,p,h,m,y,g){var x,k,b,T,M,_,F,C,V,ie=g.bits,I=0,W=0,A=0,G=0,ae=0,J=0,ue=0,X=0,pe=0,Q=0,B=null,ee=0,Z=new i.Buf16(16),re=new i.Buf16(16),K=null,$=0;for(I=0;I<=15;I++)Z[I]=0;for(W=0;W<p;W++)Z[d[f+W]]++;for(ae=ie,G=15;1<=G&&Z[G]===0;G--);if(G<ae&&(ae=G),G===0)return h[m++]=20971520,h[m++]=20971520,g.bits=1,0;for(A=1;A<G&&Z[A]===0;A++);for(ae<A&&(ae=A),I=X=1;I<=15;I++)if(X<<=1,(X-=Z[I])<0)return-1;if(0<X&&(u===0||G!==1))return-1;for(re[1]=0,I=1;I<15;I++)re[I+1]=re[I]+Z[I];for(W=0;W<p;W++)d[f+W]!==0&&(y[re[d[f+W]]++]=W);if(_=u===0?(B=K=y,19):u===1?(B=s,ee-=257,K=a,$-=257,256):(B=l,K=c,-1),I=A,M=m,ue=W=Q=0,b=-1,T=(pe=1<<(J=ae))-1,u===1&&852<pe||u===2&&592<pe)return 1;for(;;){for(F=I-ue,V=y[W]<_?(C=0,y[W]):y[W]>_?(C=K[$+y[W]],B[ee+y[W]]):(C=96,0),x=1<<I-ue,A=k=1<<J;h[M+(Q>>ue)+(k-=x)]=F<<24|C<<16|V|0,k!==0;);for(x=1<<I-1;Q&x;)x>>=1;if(x!==0?(Q&=x-1,Q+=x):Q=0,W++,--Z[I]==0){if(I===G)break;I=d[f+y[W]]}if(ae<I&&(Q&T)!==b){for(ue===0&&(ue=ae),M+=A,X=1<<(J=I-ue);J+ue<G&&!((X-=Z[J+ue])<=0);)J++,X<<=1;if(pe+=1<<J,u===1&&852<pe||u===2&&592<pe)return 1;h[b=Q&T]=ae<<24|J<<16|M-m|0}}return Q!==0&&(h[M+Q]=I-ue<<24|64<<16|0),g.bits=ae,0}},{"../utils/common":41}],51:[function(n,r,o){r.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],52:[function(n,r,o){var i=n("../utils/common"),s=0,a=1;function l(z){for(var P=z.length;0<=--P;)z[P]=0}var c=0,u=29,d=256,f=d+1+u,p=30,h=19,m=2*f+1,y=15,g=16,x=7,k=256,b=16,T=17,M=18,_=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],F=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],C=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],V=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],ie=new Array(2*(f+2));l(ie);var I=new Array(2*p);l(I);var W=new Array(512);l(W);var A=new Array(256);l(A);var G=new Array(u);l(G);var ae,J,ue,X=new Array(p);function pe(z,P,fe,me,se){this.static_tree=z,this.extra_bits=P,this.extra_base=fe,this.elems=me,this.max_length=se,this.has_stree=z&&z.length}function Q(z,P){this.dyn_tree=z,this.max_code=0,this.stat_desc=P}function B(z){return z<256?W[z]:W[256+(z>>>7)]}function ee(z,P){z.pending_buf[z.pending++]=255&P,z.pending_buf[z.pending++]=P>>>8&255}function Z(z,P,fe){z.bi_valid>g-fe?(z.bi_buf|=P<<z.bi_valid&65535,ee(z,z.bi_buf),z.bi_buf=P>>g-z.bi_valid,z.bi_valid+=fe-g):(z.bi_buf|=P<<z.bi_valid&65535,z.bi_valid+=fe)}function re(z,P,fe){Z(z,fe[2*P],fe[2*P+1])}function K(z,P){for(var fe=0;fe|=1&z,z>>>=1,fe<<=1,0<--P;);return fe>>>1}function $(z,P,fe){var me,se,ge=new Array(y+1),ce=0;for(me=1;me<=y;me++)ge[me]=ce=ce+fe[me-1]<<1;for(se=0;se<=P;se++){var de=z[2*se+1];de!==0&&(z[2*se]=K(ge[de]++,de))}}function E(z){var P;for(P=0;P<f;P++)z.dyn_ltree[2*P]=0;for(P=0;P<p;P++)z.dyn_dtree[2*P]=0;for(P=0;P<h;P++)z.bl_tree[2*P]=0;z.dyn_ltree[2*k]=1,z.opt_len=z.static_len=0,z.last_lit=z.matches=0}function H(z){8<z.bi_valid?ee(z,z.bi_buf):0<z.bi_valid&&(z.pending_buf[z.pending++]=z.bi_buf),z.bi_buf=0,z.bi_valid=0}function q(z,P,fe,me){var se=2*P,ge=2*fe;return z[se]<z[ge]||z[se]===z[ge]&&me[P]<=me[fe]}function D(z,P,fe){for(var me=z.heap[fe],se=fe<<1;se<=z.heap_len&&(se<z.heap_len&&q(P,z.heap[se+1],z.heap[se],z.depth)&&se++,!q(P,me,z.heap[se],z.depth));)z.heap[fe]=z.heap[se],fe=se,se<<=1;z.heap[fe]=me}function R(z,P,fe){var me,se,ge,ce,de=0;if(z.last_lit!==0)for(;me=z.pending_buf[z.d_buf+2*de]<<8|z.pending_buf[z.d_buf+2*de+1],se=z.pending_buf[z.l_buf+de],de++,me===0?re(z,se,P):(re(z,(ge=A[se])+d+1,P),(ce=_[ge])!==0&&Z(z,se-=G[ge],ce),re(z,ge=B(--me),fe),(ce=F[ge])!==0&&Z(z,me-=X[ge],ce)),de<z.last_lit;);re(z,k,P)}function le(z,P){var fe,me,se,ge=P.dyn_tree,ce=P.stat_desc.static_tree,de=P.stat_desc.has_stree,be=P.stat_desc.elems,Ne=-1;for(z.heap_len=0,z.heap_max=m,fe=0;fe<be;fe++)ge[2*fe]!==0?(z.heap[++z.heap_len]=Ne=fe,z.depth[fe]=0):ge[2*fe+1]=0;for(;z.heap_len<2;)ge[2*(se=z.heap[++z.heap_len]=Ne<2?++Ne:0)]=1,z.depth[se]=0,z.opt_len--,de&&(z.static_len-=ce[2*se+1]);for(P.max_code=Ne,fe=z.heap_len>>1;1<=fe;fe--)D(z,ge,fe);for(se=be;fe=z.heap[1],z.heap[1]=z.heap[z.heap_len--],D(z,ge,1),me=z.heap[1],z.heap[--z.heap_max]=fe,z.heap[--z.heap_max]=me,ge[2*se]=ge[2*fe]+ge[2*me],z.depth[se]=(z.depth[fe]>=z.depth[me]?z.depth[fe]:z.depth[me])+1,ge[2*fe+1]=ge[2*me+1]=se,z.heap[1]=se++,D(z,ge,1),2<=z.heap_len;);z.heap[--z.heap_max]=z.heap[1],function(Ce,ft){var v,O,N,Y,j,U,ne=ft.dyn_tree,we=ft.max_code,xe=ft.stat_desc.static_tree,ke=ft.stat_desc.has_stree,Te=ft.stat_desc.extra_bits,Me=ft.stat_desc.extra_base,We=ft.stat_desc.max_length,it=0;for(Y=0;Y<=y;Y++)Ce.bl_count[Y]=0;for(ne[2*Ce.heap[Ce.heap_max]+1]=0,v=Ce.heap_max+1;v<m;v++)We<(Y=ne[2*ne[2*(O=Ce.heap[v])+1]+1]+1)&&(Y=We,it++),ne[2*O+1]=Y,we<O||(Ce.bl_count[Y]++,j=0,Me<=O&&(j=Te[O-Me]),U=ne[2*O],Ce.opt_len+=U*(Y+j),ke&&(Ce.static_len+=U*(xe[2*O+1]+j)));if(it!==0){do{for(Y=We-1;Ce.bl_count[Y]===0;)Y--;Ce.bl_count[Y]--,Ce.bl_count[Y+1]+=2,Ce.bl_count[We]--,it-=2}while(0<it);for(Y=We;Y!==0;Y--)for(O=Ce.bl_count[Y];O!==0;)we<(N=Ce.heap[--v])||(ne[2*N+1]!==Y&&(Ce.opt_len+=(Y-ne[2*N+1])*ne[2*N],ne[2*N+1]=Y),O--)}}(z,P),$(ge,Ne,z.bl_count)}function S(z,P,fe){var me,se,ge=-1,ce=P[1],de=0,be=7,Ne=4;for(ce===0&&(be=138,Ne=3),P[2*(fe+1)+1]=65535,me=0;me<=fe;me++)se=ce,ce=P[2*(me+1)+1],++de<be&&se===ce||(de<Ne?z.bl_tree[2*se]+=de:se!==0?(se!==ge&&z.bl_tree[2*se]++,z.bl_tree[2*b]++):de<=10?z.bl_tree[2*T]++:z.bl_tree[2*M]++,ge=se,Ne=(de=0)===ce?(be=138,3):se===ce?(be=6,3):(be=7,4))}function oe(z,P,fe){var me,se,ge=-1,ce=P[1],de=0,be=7,Ne=4;for(ce===0&&(be=138,Ne=3),me=0;me<=fe;me++)if(se=ce,ce=P[2*(me+1)+1],!(++de<be&&se===ce)){if(de<Ne)for(;re(z,se,z.bl_tree),--de!=0;);else se!==0?(se!==ge&&(re(z,se,z.bl_tree),de--),re(z,b,z.bl_tree),Z(z,de-3,2)):de<=10?(re(z,T,z.bl_tree),Z(z,de-3,3)):(re(z,M,z.bl_tree),Z(z,de-11,7));ge=se,Ne=(de=0)===ce?(be=138,3):se===ce?(be=6,3):(be=7,4)}}l(X);var te=!1;function L(z,P,fe,me){Z(z,(c<<1)+(me?1:0),3),function(se,ge,ce,de){H(se),ee(se,ce),ee(se,~ce),i.arraySet(se.pending_buf,se.window,ge,ce,se.pending),se.pending+=ce}(z,P,fe)}o._tr_init=function(z){te||(function(){var P,fe,me,se,ge,ce=new Array(y+1);for(se=me=0;se<u-1;se++)for(G[se]=me,P=0;P<1<<_[se];P++)A[me++]=se;for(A[me-1]=se,se=ge=0;se<16;se++)for(X[se]=ge,P=0;P<1<<F[se];P++)W[ge++]=se;for(ge>>=7;se<p;se++)for(X[se]=ge<<7,P=0;P<1<<F[se]-7;P++)W[256+ge++]=se;for(fe=0;fe<=y;fe++)ce[fe]=0;for(P=0;P<=143;)ie[2*P+1]=8,P++,ce[8]++;for(;P<=255;)ie[2*P+1]=9,P++,ce[9]++;for(;P<=279;)ie[2*P+1]=7,P++,ce[7]++;for(;P<=287;)ie[2*P+1]=8,P++,ce[8]++;for($(ie,f+1,ce),P=0;P<p;P++)I[2*P+1]=5,I[2*P]=K(P,5);ae=new pe(ie,_,d+1,f,y),J=new pe(I,F,0,p,y),ue=new pe(new Array(0),C,0,h,x)}(),te=!0),z.l_desc=new Q(z.dyn_ltree,ae),z.d_desc=new Q(z.dyn_dtree,J),z.bl_desc=new Q(z.bl_tree,ue),z.bi_buf=0,z.bi_valid=0,E(z)},o._tr_stored_block=L,o._tr_flush_block=function(z,P,fe,me){var se,ge,ce=0;0<z.level?(z.strm.data_type===2&&(z.strm.data_type=function(de){var be,Ne=4093624447;for(be=0;be<=31;be++,Ne>>>=1)if(1&Ne&&de.dyn_ltree[2*be]!==0)return s;if(de.dyn_ltree[18]!==0||de.dyn_ltree[20]!==0||de.dyn_ltree[26]!==0)return a;for(be=32;be<d;be++)if(de.dyn_ltree[2*be]!==0)return a;return s}(z)),le(z,z.l_desc),le(z,z.d_desc),ce=function(de){var be;for(S(de,de.dyn_ltree,de.l_desc.max_code),S(de,de.dyn_dtree,de.d_desc.max_code),le(de,de.bl_desc),be=h-1;3<=be&&de.bl_tree[2*V[be]+1]===0;be--);return de.opt_len+=3*(be+1)+5+5+4,be}(z),se=z.opt_len+3+7>>>3,(ge=z.static_len+3+7>>>3)<=se&&(se=ge)):se=ge=fe+5,fe+4<=se&&P!==-1?L(z,P,fe,me):z.strategy===4||ge===se?(Z(z,2+(me?1:0),3),R(z,ie,I)):(Z(z,4+(me?1:0),3),function(de,be,Ne,Ce){var ft;for(Z(de,be-257,5),Z(de,Ne-1,5),Z(de,Ce-4,4),ft=0;ft<Ce;ft++)Z(de,de.bl_tree[2*V[ft]+1],3);oe(de,de.dyn_ltree,be-1),oe(de,de.dyn_dtree,Ne-1)}(z,z.l_desc.max_code+1,z.d_desc.max_code+1,ce+1),R(z,z.dyn_ltree,z.dyn_dtree)),E(z),me&&H(z)},o._tr_tally=function(z,P,fe){return z.pending_buf[z.d_buf+2*z.last_lit]=P>>>8&255,z.pending_buf[z.d_buf+2*z.last_lit+1]=255&P,z.pending_buf[z.l_buf+z.last_lit]=255&fe,z.last_lit++,P===0?z.dyn_ltree[2*fe]++:(z.matches++,P--,z.dyn_ltree[2*(A[fe]+d+1)]++,z.dyn_dtree[2*B(P)]++),z.last_lit===z.lit_bufsize-1},o._tr_align=function(z){Z(z,2,3),re(z,k,ie),function(P){P.bi_valid===16?(ee(P,P.bi_buf),P.bi_buf=0,P.bi_valid=0):8<=P.bi_valid&&(P.pending_buf[P.pending++]=255&P.bi_buf,P.bi_buf>>=8,P.bi_valid-=8)}(z)}},{"../utils/common":41}],53:[function(n,r,o){r.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(n,r,o){(function(i){(function(s,a){if(!s.setImmediate){var l,c,u,d,f=1,p={},h=!1,m=s.document,y=Object.getPrototypeOf&&Object.getPrototypeOf(s);y=y&&y.setTimeout?y:s,l={}.toString.call(s.process)==="[object process]"?function(b){Se.nextTick(function(){x(b)})}:function(){if(s.postMessage&&!s.importScripts){var b=!0,T=s.onmessage;return s.onmessage=function(){b=!1},s.postMessage("","*"),s.onmessage=T,b}}()?(d="setImmediate$"+Math.random()+"$",s.addEventListener?s.addEventListener("message",k,!1):s.attachEvent("onmessage",k),function(b){s.postMessage(d+b,"*")}):s.MessageChannel?((u=new MessageChannel).port1.onmessage=function(b){x(b.data)},function(b){u.port2.postMessage(b)}):m&&"onreadystatechange"in m.createElement("script")?(c=m.documentElement,function(b){var T=m.createElement("script");T.onreadystatechange=function(){x(b),T.onreadystatechange=null,c.removeChild(T),T=null},c.appendChild(T)}):function(b){setTimeout(x,0,b)},y.setImmediate=function(b){typeof b!="function"&&(b=new Function(""+b));for(var T=new Array(arguments.length-1),M=0;M<T.length;M++)T[M]=arguments[M+1];var _={callback:b,args:T};return p[f]=_,l(f),f++},y.clearImmediate=g}function g(b){delete p[b]}function x(b){if(h)setTimeout(x,0,b);else{var T=p[b];if(T){h=!0;try{(function(M){var _=M.callback,F=M.args;switch(F.length){case 0:_();break;case 1:_(F[0]);break;case 2:_(F[0],F[1]);break;case 3:_(F[0],F[1],F[2]);break;default:_.apply(a,F)}})(T)}finally{g(b),h=!1}}}}function k(b){b.source===s&&typeof b.data=="string"&&b.data.indexOf(d)===0&&x(+b.data.slice(d.length))}})(typeof self>"u"?i===void 0?this:i:self)}).call(this,typeof zt<"u"?zt:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(_v);var J4=_v.exports;const ld=Cl(J4);let cd=class{constructor(e={}){this.debug=e.debug||!1,this.zip=new ld,this.files=[],this.media={},this.mediaFiles={},this.fonts={}}async getDocxData(e,n=!1){const r=await this.unzip(e),o=Object.entries(r.files),i={},s=["xml","rels"];for(const a of o){const[l,c]=a;if(s.some(u=>c.name.endsWith(u))){const u=await c.async("string");this.files.push({name:c.name,content:u})}else if(c.name.startsWith("word/media")&&c.name!=="word/media/")if(n){const u=(await c.async("nodebuffer")).toString("base64");i[c.name]=u}else{const u=await c.async("blob"),d=this.getFileExtension(c.name),f=await c.async("base64");this.mediaFiles[c.name]=`data:image/${d};base64,${f}`;const p=new File([u],c.name,{type:u.type}),h=URL.createObjectURL(p);this.media[c.name]=h}else if(c.name.startsWith("word/fonts")&&c.name!=="word/fonts/"){const u=await c.async("uint8array");this.fonts[c.name]=u}}return this.files}getFileExtension(e){return e.split(".").pop()}async updateContentTypes(e,n){const r=Object.keys(n).map(d=>this.getFileExtension(d)),o="[Content_Types].xml",i=await e.file(o).async("string");let s="";const a=$E(i),l=new Set;for(let d of r){if(a.includes(d)||l.has(d))continue;const f=`<Default Extension="${d}" ContentType="image/${d}"/>`;s+=f,l.add(d)}if(e.files["word/comments.xml"]){const d='<Override PartName="/word/comments.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml" />';i.includes(d)||(s+=d)}if(e.files["word/commentsExtended.xml"]){const d='<Override PartName="/word/commentsExtended.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.commentsExtended+xml" />';i.includes(d)||(s+=d)}if(e.files["word/commentsIds.xml"]){const d='<Override PartName="/word/commentsIds.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.commentsIds+xml" />';i.includes(d)||(s+=d)}if(e.files["word/commentsExtensible.xml"]){const d='<Override PartName="/word/commentsExtensible.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.commentsExtensible+xml" />';i.includes(d)||(s+=d)}const c='<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types">',u=i.replace(c,`${c}${s}`);e.file(o,u)}async unzip(e){return await this.zip.loadAsync(e)}async updateZip({docx:e,updatedDocs:n,originalDocxFile:r,media:o,fonts:i,isHeadless:s}){let a;r?a=await this.exportFromOriginalFile(r,n,o):a=await this.exportFromCollaborativeDocx(e,n,o,i);const l=s?"nodebuffer":"blob";return await a.generateAsync({type:l})}async exportFromCollaborativeDocx(e,n,r,o){const i=new ld;for(const s of e){const a=s.content;i.file(s.name,a)}Object.keys(n).forEach(s=>{const a=n[s];i.file(s,a)}),Object.keys(r).forEach(s=>{const a=wt.from(r[s],"base64");i.file(`word/media/${s}`,a)});for(const[s,a]of Object.entries(o))i.file(s,a);return await this.updateContentTypes(i,r),i}async exportFromOriginalFile(e,n,r){const o=await this.unzip(e),i=[];return o.forEach((s,a)=>{const l=a.async("string").then(c=>{o.file(a.name,c)});i.push(l)}),await Promise.all(i),Object.keys(n).forEach(s=>{o.file(s,n[s])}),Object.keys(r).forEach(s=>{o.file(`word/media/${s}`,r[s])}),await this.updateContentTypes(o,r),o}};var X4=Object.defineProperty,Nv=t=>{throw TypeError(t)},Y4=(t,e,n)=>e in t?X4(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Fe=(t,e,n)=>Y4(t,typeof e!="symbol"?e+"":e,n),Rf=(t,e,n)=>e.has(t)||Nv("Cannot "+n),Kn=(t,e,n)=>(Rf(t,e,"read from private field"),n?n.call(t):e.get(t)),Sr=(t,e,n)=>e.has(t)?Nv("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),Dv=(t,e,n,r)=>(Rf(t,e,"write to private field"),e.set(t,n),n),Ie=(t,e,n)=>(Rf(t,e,"access private method"),n);function Is(t){const{from:e,to:n,empty:r}=t.selection,o=[];return r?(t.storedMarks&&o.push(...t.storedMarks),o.push(...t.selection.$head.marks())):t.doc.nodesBetween(e,n,i=>{o.push(...i.marks)}),o}const Nl=(t,e,n=!1)=>{const{selection:r,doc:o}=t,{$from:i,$to:s}=r,a=i.marks().find(d=>d.type===e),l=s.marks().find(d=>d.type===e);let c;const u=[];return o.nodesBetween(i.pos,s.pos,(d,f)=>{if(d.marks){const p=d.marks.find(h=>h.type===e);p&&(c={from:f,to:f+d.nodeSize,attrs:p.attrs,contained:!a||!l||a===l},u.push(c))}}),n?u:c};function Lf(t){const{state:e}=t,{selection:n}=e,r=Is(e),o=n.$head.parent.attrs.marksAttrs,i=r.filter(d=>!["textStyle","link"].includes(d.type.name)).map(d=>({name:d.type.name,attrs:d.attrs})),s=r.filter(d=>d.type.name==="textStyle");if(i.push(...s.flatMap(gg)),o){const d=o.filter(p=>!["textStyle","link"].includes(p.type)).map(p=>({name:p.type,attrs:p.attrs||{}})),f=o.filter(p=>p.type==="textStyle");i.push(...d),i.push(...f.flatMap(gg))}const a=e.schema.marks.link,l=Nl(e,a);if(l){let{from:d,to:f,attrs:p}=l;n.from>=d&&n.to<=f&&i.push({name:"link",attrs:p})}const c=["paragraphSpacing"],u=Z4(e);return Object.keys(u).forEach(d=>{if(c.includes(d))return;const f={};f[d]=u[d],i.push({name:d,attrs:f})}),t.storage.formatCommands?.storedStyle&&i.push({name:"copyFormat",attrs:!0}),i}function gg(t){const e=[],{attrs:n}=t;return Object.keys(n).forEach(r=>{n[r]&&e.push({name:r,attrs:{[r]:n[r]}})}),e}function Z4(t){try{const{from:e,to:n,empty:r}=t.selection,o={},i=l=>{Object.keys(l.attrs).forEach(c=>{const u=l.attrs[c];u&&(o[c]=u)})};let s=e,a=n;return r?t.doc.nodesBetween(s,a+1,l=>i(l)):t.doc.nodesBetween(e,n,l=>i(l)),o}catch{return{}}}var Ka=200,xt=function(){};xt.prototype.append=function(t){return t.length?(t=xt.from(t),!this.length&&t||t.length<Ka&&this.leafAppend(t)||this.length<Ka&&t.leafPrepend(this)||this.appendInner(t)):this};xt.prototype.prepend=function(t){return t.length?xt.from(t).append(this):this};xt.prototype.appendInner=function(t){return new Q4(this,t)};xt.prototype.slice=function(t,e){return t===void 0&&(t=0),e===void 0&&(e=this.length),t>=e?xt.empty:this.sliceInner(Math.max(0,t),Math.min(this.length,e))};xt.prototype.get=function(t){if(!(t<0||t>=this.length))return this.getInner(t)};xt.prototype.forEach=function(t,e,n){e===void 0&&(e=0),n===void 0&&(n=this.length),e<=n?this.forEachInner(t,e,n,0):this.forEachInvertedInner(t,e,n,0)};xt.prototype.map=function(t,e,n){e===void 0&&(e=0),n===void 0&&(n=this.length);var r=[];return this.forEach(function(o,i){return r.push(t(o,i))},e,n),r};xt.from=function(t){return t instanceof xt?t:t&&t.length?new Iv(t):xt.empty};var Iv=function(t){function e(r){t.call(this),this.values=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(r,o){return r==0&&o==this.length?this:new e(this.values.slice(r,o))},e.prototype.getInner=function(r){return this.values[r]},e.prototype.forEachInner=function(r,o,i,s){for(var a=o;a<i;a++)if(r(this.values[a],s+a)===!1)return!1},e.prototype.forEachInvertedInner=function(r,o,i,s){for(var a=o-1;a>=i;a--)if(r(this.values[a],s+a)===!1)return!1},e.prototype.leafAppend=function(r){if(this.length+r.length<=Ka)return new e(this.values.concat(r.flatten()))},e.prototype.leafPrepend=function(r){if(this.length+r.length<=Ka)return new e(r.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e}(xt);xt.empty=new Iv([]);var Q4=function(t){function e(n,r){t.call(this),this.left=n,this.right=r,this.length=n.length+r.length,this.depth=Math.max(n.depth,r.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(n){return n<this.left.length?this.left.get(n):this.right.get(n-this.left.length)},e.prototype.forEachInner=function(n,r,o,i){var s=this.left.length;if(r<s&&this.left.forEachInner(n,r,Math.min(o,s),i)===!1||o>s&&this.right.forEachInner(n,Math.max(r-s,0),Math.min(this.length,o)-s,i+s)===!1)return!1},e.prototype.forEachInvertedInner=function(n,r,o,i){var s=this.left.length;if(r>s&&this.right.forEachInvertedInner(n,r-s,Math.max(o,s)-s,i+s)===!1||o<s&&this.left.forEachInvertedInner(n,Math.min(r,s),o,i)===!1)return!1},e.prototype.sliceInner=function(n,r){if(n==0&&r==this.length)return this;var o=this.left.length;return r<=o?this.left.slice(n,r):n>=o?this.right.slice(n-o,r-o):this.left.slice(n,o).append(this.right.slice(0,r-o))},e.prototype.leafAppend=function(n){var r=this.right.leafAppend(n);if(r)return new e(this.left,r)},e.prototype.leafPrepend=function(n){var r=this.left.leafPrepend(n);if(r)return new e(r,this.right)},e.prototype.appendInner=function(n){return this.left.depth>=Math.max(this.right.depth,n.depth)+1?new e(this.left,new e(this.right,n)):new e(this,n)},e}(xt);const eT=500;let as=class Fo{constructor(e,n){this.items=e,this.eventCount=n}popEvent(e,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let o,i;n&&(o=this.remapping(r,this.items.length),i=o.maps.length);let s=e.tr,a,l,c=[],u=[];return this.items.forEach((d,f)=>{if(!d.step){o||(o=this.remapping(r,f+1),i=o.maps.length),i--,u.push(d);return}if(o){u.push(new ur(d.map));let p=d.step.map(o.slice(i)),h;p&&s.maybeStep(p).doc&&(h=s.mapping.maps[s.mapping.maps.length-1],c.push(new ur(h,void 0,void 0,c.length+u.length))),i--,h&&o.appendMap(h,i)}else s.maybeStep(d.step);if(d.selection)return a=o?d.selection.map(o.slice(i)):d.selection,l=new Fo(this.items.slice(0,r).append(u.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:l,transform:s,selection:a}}addTransform(e,n,r,o){let i=[],s=this.eventCount,a=this.items,l=!o&&a.length?a.get(a.length-1):null;for(let u=0;u<e.steps.length;u++){let d=e.steps[u].invert(e.docs[u]),f=new ur(e.mapping.maps[u],d,n),p;(p=l&&l.merge(f))&&(f=p,u?i.pop():a=a.slice(0,a.length-1)),i.push(f),n&&(s++,n=void 0),o||(l=f)}let c=s-r.depth;return c>nT&&(a=tT(a,c),s-=c),new Fo(a.append(i),s)}remapping(e,n){let r=new Jo;return this.items.forEach((o,i)=>{let s=o.mirrorOffset!=null&&i-o.mirrorOffset>=e?r.maps.length-o.mirrorOffset:void 0;r.appendMap(o.map,s)},e,n),r}addMaps(e){return this.eventCount==0?this:new Fo(this.items.append(e.map(n=>new ur(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let r=[],o=Math.max(0,this.items.length-n),i=e.mapping,s=e.steps.length,a=this.eventCount;this.items.forEach(f=>{f.selection&&a--},o);let l=n;this.items.forEach(f=>{let p=i.getMirror(--l);if(p==null)return;s=Math.min(s,p);let h=i.maps[p];if(f.step){let m=e.steps[p].invert(e.docs[p]),y=f.selection&&f.selection.map(i.slice(l+1,p));y&&a++,r.push(new ur(h,m,y))}else r.push(new ur(h))},o);let c=[];for(let f=n;f<s;f++)c.push(new ur(i.maps[f]));let u=this.items.slice(0,o).append(c).append(r),d=new Fo(u,a);return d.emptyItemCount()>eT&&(d=d.compress(this.items.length-r.length)),d}emptyItemCount(){let e=0;return this.items.forEach(n=>{n.step||e++}),e}compress(e=this.items.length){let n=this.remapping(0,e),r=n.maps.length,o=[],i=0;return this.items.forEach((s,a)=>{if(a>=e)o.push(s),s.selection&&i++;else if(s.step){let l=s.step.map(n.slice(r)),c=l&&l.getMap();if(r--,c&&n.appendMap(c,r),l){let u=s.selection&&s.selection.map(n.slice(r));u&&i++;let d=new ur(c.invert(),l,u),f,p=o.length-1;(f=o.length&&o[p].merge(d))?o[p]=f:o.push(d)}}else s.map&&r--},this.items.length,0),new Fo(xt.from(o.reverse()),i)}};as.empty=new as(xt.empty,0);function tT(t,e){let n;return t.forEach((r,o)=>{if(r.selection&&e--==0)return n=o,!1}),t.slice(n)}let ur=class Fv{constructor(e,n,r,o){this.map=e,this.step=n,this.selection=r,this.mirrorOffset=o}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new Fv(n.getMap().invert(),n,this.selection)}}},mr=class{constructor(e,n,r,o,i){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=o,this.prevComposition=i}};const nT=20;function rT(t,e,n,r){let o=n.getMeta(er),i;if(o)return o.historyState;n.getMeta(sT)&&(t=new mr(t.done,t.undone,null,0,-1));let s=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(s&&s.getMeta(er))return s.getMeta(er).redo?new mr(t.done.addTransform(n,void 0,r,$a(e)),t.undone,yg(n.mapping.maps),t.prevTime,t.prevComposition):new mr(t.done,t.undone.addTransform(n,void 0,r,$a(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(s&&s.getMeta("addToHistory")===!1)){let a=n.getMeta("composition"),l=t.prevTime==0||!s&&t.prevComposition!=a&&(t.prevTime<(n.time||0)-r.newGroupDelay||!oT(n,t.prevRanges)),c=s?eu(t.prevRanges,n.mapping):yg(n.mapping.maps);return new mr(t.done.addTransform(n,l?e.selection.getBookmark():void 0,r,$a(e)),as.empty,c,n.time,a??t.prevComposition)}else return(i=n.getMeta("rebased"))?new mr(t.done.rebased(n,i),t.undone.rebased(n,i),eu(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new mr(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),eu(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function oT(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((r,o)=>{for(let i=0;i<e.length;i+=2)r<=e[i+1]&&o>=e[i]&&(n=!0)}),n}function yg(t){let e=[];for(let n=t.length-1;n>=0&&e.length==0;n--)t[n].forEach((r,o,i,s)=>e.push(i,s));return e}function eu(t,e){if(!t)return null;let n=[];for(let r=0;r<t.length;r+=2){let o=e.map(t[r],1),i=e.map(t[r+1],-1);o<=i&&n.push(o,i)}return n}function iT(t,e,n){let r=$a(e),o=er.get(e).spec.config,i=(n?t.undone:t.done).popEvent(e,r);if(!i)return null;let s=i.selection.resolve(i.transform.doc),a=(n?t.done:t.undone).addTransform(i.transform,e.selection.getBookmark(),o,r),l=new mr(n?a:i.remaining,n?i.remaining:a,null,0,-1);return i.transform.setSelection(s).setMeta(er,{redo:n,historyState:l})}let tu=!1,wg=null;function $a(t){let e=t.plugins;if(wg!=e){tu=!1,wg=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){tu=!0;break}}return tu}const er=new tt("history"),sT=new tt("closeHistory");function aT(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new Qe({key:er,state:{init(){return new mr(as.empty,as.empty,null,0,-1)},apply(e,n,r){return rT(n,r,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let r=n.inputType,o=r=="historyUndo"?Rv:r=="historyRedo"?Lv:null;return o?(n.preventDefault(),o(e.state,e.dispatch)):!1}}}})}function Bv(t,e){return(n,r)=>{let o=er.getState(n);if(!o||(t?o.undone:o.done).eventCount==0)return!1;if(r){let i=iT(o,n,t);i&&r(i.scrollIntoView())}return!0}}const Rv=Bv(!1),Lv=Bv(!0);function lT(t){let e=er.getState(t);return e?e.done.eventCount:0}function cT(t){let e=er.getState(t);return e?e.undone.eventCount:0}function _e(t,e,n={}){return typeof t.config[e]=="function"?t.config[e].bind({...n}):t.config[e]}function He(t,e=null,...n){return typeof t=="function"?e?t.bind(e)(...n):t(...n):t}let ot=class Pv{constructor(e){Fe(this,"type","extension"),Fe(this,"name","extension"),Fe(this,"options"),Fe(this,"storage"),Fe(this,"config",{name:this.name}),this.config={...this.config,...e},this.name=this.config.name,this.config.addOptions&&(this.options=He(_e(this,"addOptions",{name:this.name}))),this.storage=He(_e(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(...e){return new Pv(...e)}};const uT=ot.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addPmPlugins(){return[aT(this.options)]},addCommands(){return{undo:()=>({state:t,dispatch:e,tr:n})=>(n.setMeta("inputType","historyUndo"),Rv(t,e)),redo:()=>({state:t,dispatch:e,tr:n})=>(n.setMeta("inputType","historyRedo"),Lv(t,e))}},addShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Mod-Shift-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo()}}}),Vr=globalThis||void 0||self,At=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},Qo=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let ud=null;const Wn=function(t,e,n){let r=ud||(ud=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},dT=function(){ud=null},co=function(t,e,n,r){return n&&(bg(t,e,n,r,-1)||bg(t,e,n,r,1))},fT=/^(img|br|input|textarea|hr)$/i;function bg(t,e,n,r,o){for(;;){if(t==n&&e==r)return!0;if(e==(o<0?0:dn(t))){let i=t.parentNode;if(!i||i.nodeType!=1||Fs(t)||fT.test(t.nodeName)||t.contentEditable=="false")return!1;e=At(t)+(o<0?0:1),t=i}else if(t.nodeType==1){if(t=t.childNodes[e+(o<0?-1:0)],t.contentEditable=="false")return!1;e=o<0?dn(t):0}else return!1}}function dn(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function pT(t,e){for(;;){if(t.nodeType==3&&e)return t;if(t.nodeType==1&&e>0){if(t.contentEditable=="false")return null;t=t.childNodes[e-1],e=dn(t)}else if(t.parentNode&&!Fs(t))e=At(t),t=t.parentNode;else return null}}function hT(t,e){for(;;){if(t.nodeType==3&&e<t.nodeValue.length)return t;if(t.nodeType==1&&e<t.childNodes.length){if(t.contentEditable=="false")return null;t=t.childNodes[e],e=0}else if(t.parentNode&&!Fs(t))e=At(t)+1,t=t.parentNode;else return null}}function mT(t,e,n){for(let r=e==0,o=e==dn(t);r||o;){if(t==n)return!0;let i=At(t);if(t=t.parentNode,!t)return!1;r=r&&i==0,o=o&&i==dn(t)}}function Fs(t){let e;for(let n=t;n&&!(e=n.pmViewDesc);n=n.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==t||e.contentDOM==t)}const Dl=function(t){return t.focusNode&&co(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function qr(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function gT(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function yT(t,e,n){if(t.caretPositionFromPoint)try{let r=t.caretPositionFromPoint(e,n);if(r)return{node:r.offsetNode,offset:Math.min(dn(r.offsetNode),r.offset)}}catch{}if(t.caretRangeFromPoint){let r=t.caretRangeFromPoint(e,n);if(r)return{node:r.startContainer,offset:Math.min(dn(r.startContainer),r.startOffset)}}}const Fn=typeof navigator<"u"?navigator:null,vg=typeof document<"u"?document:null,Ir=Fn&&Fn.userAgent||"",dd=/Edge\/(\d+)/.exec(Ir),zv=/MSIE \d/.exec(Ir),fd=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Ir),Gt=!!(zv||fd||dd),Cr=zv?document.documentMode:fd?+fd[1]:dd?+dd[1]:0,wn=!Gt&&/gecko\/(\d+)/i.test(Ir);wn&&+(/Firefox\/(\d+)/.exec(Ir)||[0,0])[1];const pd=!Gt&&/Chrome\/(\d+)/.exec(Ir),Nt=!!pd,jv=pd?+pd[1]:0,qt=!Gt&&!!Fn&&/Apple Computer/.test(Fn.vendor),ei=qt&&(/Mobile\/\w+/.test(Ir)||!!Fn&&Fn.maxTouchPoints>2),un=ei||(Fn?/Mac/.test(Fn.platform):!1),wT=Fn?/Win/.test(Fn.platform):!1,Zn=/Android \d/.test(Ir),Bs=!!vg&&"webkitFontSmoothing"in vg.documentElement.style,bT=Bs?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function vT(t){let e=t.defaultView&&t.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.documentElement.clientWidth,top:0,bottom:t.documentElement.clientHeight}}function qn(t,e){return typeof t=="number"?t:t[e]}function xT(t){let e=t.getBoundingClientRect(),n=e.width/t.offsetWidth||1,r=e.height/t.offsetHeight||1;return{left:e.left,right:e.left+t.clientWidth*n,top:e.top,bottom:e.top+t.clientHeight*r}}function xg(t,e,n){let r=t.someProp("scrollThreshold")||0,o=t.someProp("scrollMargin")||5,i=t.dom.ownerDocument;for(let s=n||t.dom;s;){if(s.nodeType!=1){s=Qo(s);continue}let a=s,l=a==i.body,c=l?vT(i):xT(a),u=0,d=0;if(e.top<c.top+qn(r,"top")?d=-(c.top-e.top+qn(o,"top")):e.bottom>c.bottom-qn(r,"bottom")&&(d=e.bottom-e.top>c.bottom-c.top?e.top+qn(o,"top")-c.top:e.bottom-c.bottom+qn(o,"bottom")),e.left<c.left+qn(r,"left")?u=-(c.left-e.left+qn(o,"left")):e.right>c.right-qn(r,"right")&&(u=e.right-c.right+qn(o,"right")),u||d)if(l)i.defaultView.scrollBy(u,d);else{let p=a.scrollLeft,h=a.scrollTop;d&&(a.scrollTop+=d),u&&(a.scrollLeft+=u);let m=a.scrollLeft-p,y=a.scrollTop-h;e={left:e.left-m,top:e.top-y,right:e.right-m,bottom:e.bottom-y}}let f=l?"fixed":getComputedStyle(s).position;if(/^(fixed|sticky)$/.test(f))break;s=f=="absolute"?s.offsetParent:Qo(s)}}function kT(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),r,o;for(let i=(e.left+e.right)/2,s=n+1;s<Math.min(innerHeight,e.bottom);s+=5){let a=t.root.elementFromPoint(i,s);if(!a||a==t.dom||!t.dom.contains(a))continue;let l=a.getBoundingClientRect();if(l.top>=n-20){r=a,o=l.top;break}}return{refDOM:r,refTop:o,stack:qv(t.dom)}}function qv(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=Qo(r));return e}function ST({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;Uv(n,r==0?0:r-e)}function Uv(t,e){for(let n=0;n<t.length;n++){let{dom:r,top:o,left:i}=t[n];r.scrollTop!=o+e&&(r.scrollTop=o+e),r.scrollLeft!=i&&(r.scrollLeft=i)}}let ko=null;function CT(t){if(t.setActive)return t.setActive();if(ko)return t.focus(ko);let e=qv(t);t.focus(ko==null?{get preventScroll(){return ko={preventScroll:!0},!0}}:void 0),ko||(ko=!1,Uv(e,0))}function Vv(t,e){let n,r=2e8,o,i=0,s=e.top,a=e.top,l,c;for(let u=t.firstChild,d=0;u;u=u.nextSibling,d++){let f;if(u.nodeType==1)f=u.getClientRects();else if(u.nodeType==3)f=Wn(u).getClientRects();else continue;for(let p=0;p<f.length;p++){let h=f[p];if(h.top<=s&&h.bottom>=a){s=Math.max(h.bottom,s),a=Math.min(h.top,a);let m=h.left>e.left?h.left-e.left:h.right<e.left?e.left-h.right:0;if(m<r){n=u,r=m,o=m&&n.nodeType==3?{left:h.right<e.left?h.right:h.left,top:e.top}:e,u.nodeType==1&&m&&(i=d+(e.left>=(h.left+h.right)/2?1:0));continue}}else h.top>e.top&&!l&&h.left<=e.left&&h.right>=e.left&&(l=u,c={left:Math.max(h.left,Math.min(h.right,e.left)),top:h.top});!n&&(e.left>=h.right&&e.top>=h.top||e.left>=h.left&&e.top>=h.bottom)&&(i=d+1)}}return!n&&l&&(n=l,o=c,r=0),n&&n.nodeType==3?ET(n,o):!n||r&&n.nodeType==1?{node:t,offset:i}:Vv(n,o)}function ET(t,e){let n=t.nodeValue.length,r=document.createRange();for(let o=0;o<n;o++){r.setEnd(t,o+1),r.setStart(t,o);let i=fr(r,1);if(i.top!=i.bottom&&Pf(e,i))return{node:t,offset:o+(e.left>=(i.left+i.right)/2?1:0)}}return{node:t,offset:0}}function Pf(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function AT(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}function TT(t,e,n){let{node:r,offset:o}=Vv(e,n),i=-1;if(r.nodeType==1&&!r.firstChild){let s=r.getBoundingClientRect();i=s.left!=s.right&&n.left>(s.left+s.right)/2?1:-1}return t.docView.posFromDOM(r,o,i)}function $T(t,e,n,r){let o=-1;for(let i=e,s=!1;i!=t.dom;){let a=t.docView.nearestDesc(i,!0),l;if(!a)return null;if(a.dom.nodeType==1&&(a.node.isBlock&&a.parent||!a.contentDOM)&&((l=a.dom.getBoundingClientRect()).width||l.height)&&(a.node.isBlock&&a.parent&&(!s&&l.left>r.left||l.top>r.top?o=a.posBefore:(!s&&l.right<r.left||l.bottom<r.top)&&(o=a.posAfter),s=!0),!a.contentDOM&&o<0&&!a.node.isText))return(a.node.isBlock?r.top<(l.top+l.bottom)/2:r.left<(l.left+l.right)/2)?a.posBefore:a.posAfter;i=a.dom.parentNode}return o>-1?o:t.docView.posFromDOM(e,n,-1)}function Hv(t,e,n){let r=t.childNodes.length;if(r&&n.top<n.bottom)for(let o=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-n.top)/(n.bottom-n.top))-2)),i=o;;){let s=t.childNodes[i];if(s.nodeType==1){let a=s.getClientRects();for(let l=0;l<a.length;l++){let c=a[l];if(Pf(e,c))return Hv(s,e,c)}}if((i=(i+1)%r)==o)break}return t}function OT(t,e){let n=t.dom.ownerDocument,r,o=0,i=yT(n,e.left,e.top);i&&({node:r,offset:o}=i);let s=(t.root.elementFromPoint?t.root:n).elementFromPoint(e.left,e.top),a;if(!s||!t.dom.contains(s.nodeType!=1?s.parentNode:s)){let c=t.dom.getBoundingClientRect();if(!Pf(e,c)||(s=Hv(t.dom,e,c),!s))return null}if(qt)for(let c=s;r&&c;c=Qo(c))c.draggable&&(r=void 0);if(s=AT(s,e),r){if(wn&&r.nodeType==1&&(o=Math.min(o,r.childNodes.length),o<r.childNodes.length)){let u=r.childNodes[o],d;u.nodeName=="IMG"&&(d=u.getBoundingClientRect()).right<=e.left&&d.bottom>e.top&&o++}let c;Bs&&o&&r.nodeType==1&&(c=r.childNodes[o-1]).nodeType==1&&c.contentEditable=="false"&&c.getBoundingClientRect().top>=e.top&&o--,r==t.dom&&o==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?a=t.state.doc.content.size:(o==0||r.nodeType!=1||r.childNodes[o-1].nodeName!="BR")&&(a=$T(t,r,o,e))}a==null&&(a=TT(t,s,e));let l=t.docView.nearestDesc(s,!0);return{pos:a,inside:l?l.posAtStart-l.border:-1}}function kg(t){return t.top<t.bottom||t.left<t.right}function fr(t,e){let n=t.getClientRects();if(n.length){let r=n[e<0?0:n.length-1];if(kg(r))return r}return Array.prototype.find.call(n,kg)||t.getBoundingClientRect()}const MT=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function Wv(t,e,n){let{node:r,offset:o,atom:i}=t.docView.domFromPos(e,n<0?-1:1),s=Bs||wn;if(r.nodeType==3)if(s&&(MT.test(r.nodeValue)||(n<0?!o:o==r.nodeValue.length))){let a=fr(Wn(r,o,o),n);if(wn&&o&&/\s/.test(r.nodeValue[o-1])&&o<r.nodeValue.length){let l=fr(Wn(r,o-1,o-1),-1);if(l.top==a.top){let c=fr(Wn(r,o,o+1),-1);if(c.top!=a.top)return xi(c,c.left<l.left)}}return a}else{let a=o,l=o,c=n<0?1:-1;return n<0&&!o?(l++,c=-1):n>=0&&o==r.nodeValue.length?(a--,c=1):n<0?a--:l++,xi(fr(Wn(r,a,l),c),c<0)}if(!t.state.doc.resolve(e-(i||0)).parent.inlineContent){if(i==null&&o&&(n<0||o==dn(r))){let a=r.childNodes[o-1];if(a.nodeType==1)return nu(a.getBoundingClientRect(),!1)}if(i==null&&o<dn(r)){let a=r.childNodes[o];if(a.nodeType==1)return nu(a.getBoundingClientRect(),!0)}return nu(r.getBoundingClientRect(),n>=0)}if(i==null&&o&&(n<0||o==dn(r))){let a=r.childNodes[o-1],l=a.nodeType==3?Wn(a,dn(a)-(s?0:1)):a.nodeType==1&&(a.nodeName!="BR"||!a.nextSibling)?a:null;if(l)return xi(fr(l,1),!1)}if(i==null&&o<dn(r)){let a=r.childNodes[o];for(;a.pmViewDesc&&a.pmViewDesc.ignoreForCoords;)a=a.nextSibling;let l=a?a.nodeType==3?Wn(a,0,s?0:1):a.nodeType==1?a:null:null;if(l)return xi(fr(l,-1),!0)}return xi(fr(r.nodeType==3?Wn(r):r,-n),n>=0)}function xi(t,e){if(t.width==0)return t;let n=e?t.left:t.right;return{top:t.top,bottom:t.bottom,left:n,right:n}}function nu(t,e){if(t.height==0)return t;let n=e?t.top:t.bottom;return{top:n,bottom:n,left:t.left,right:t.right}}function Gv(t,e,n){let r=t.state,o=t.root.activeElement;r!=e&&t.updateState(e),o!=t.dom&&t.focus();try{return n()}finally{r!=e&&t.updateState(r),o!=t.dom&&o&&o.focus()}}function _T(t,e,n){let r=e.selection,o=n=="up"?r.$from:r.$to;return Gv(t,e,()=>{let{node:i}=t.docView.domFromPos(o.pos,n=="up"?-1:1);for(;;){let a=t.docView.nearestDesc(i,!0);if(!a)break;if(a.node.isBlock){i=a.contentDOM||a.dom;break}i=a.dom.parentNode}let s=Wv(t,o.pos,1);for(let a=i.firstChild;a;a=a.nextSibling){let l;if(a.nodeType==1)l=a.getClientRects();else if(a.nodeType==3)l=Wn(a,0,a.nodeValue.length).getClientRects();else continue;for(let c=0;c<l.length;c++){let u=l[c];if(u.bottom>u.top+1&&(n=="up"?s.top-u.top>(u.bottom-s.top)*2:u.bottom-s.bottom>(s.bottom-u.top)*2))return!1}}return!0})}const NT=/[\u0590-\u08ac]/;function DT(t,e,n){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let o=r.parentOffset,i=!o,s=o==r.parent.content.size,a=t.domSelection();return a?!NT.test(r.parent.textContent)||!a.modify?n=="left"||n=="backward"?i:s:Gv(t,e,()=>{let{focusNode:l,focusOffset:c,anchorNode:u,anchorOffset:d}=t.domSelectionRange(),f=a.caretBidiLevel;a.modify("move",n,"character");let p=r.depth?t.docView.domAfterPos(r.before()):t.dom,{focusNode:h,focusOffset:m}=t.domSelectionRange(),y=h&&!p.contains(h.nodeType==1?h:h.parentNode)||l==h&&c==m;try{a.collapse(u,d),l&&(l!=u||c!=d)&&a.extend&&a.extend(l,c)}catch{}return f!=null&&(a.caretBidiLevel=f),y}):r.pos==r.start()||r.pos==r.end()}let Sg=null,Cg=null,Eg=!1;function IT(t,e,n){return Sg==e&&Cg==n?Eg:(Sg=e,Cg=n,Eg=n=="up"||n=="down"?_T(t,e,n):DT(t,e,n))}const fn=0,Ag=1,Hr=2,Bn=3;class Rs{constructor(e,n,r,o){this.parent=e,this.children=n,this.dom=r,this.contentDOM=o,this.dirty=fn,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,n,r){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let n=0;n<this.children.length;n++)e+=this.children[n].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let n=0,r=this.posAtStart;;n++){let o=this.children[n];if(o==e)return r;r+=o.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,n,r){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(r<0){let i,s;if(e==this.contentDOM)i=e.childNodes[n-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;i=e.previousSibling}for(;i&&!((s=i.pmViewDesc)&&s.parent==this);)i=i.previousSibling;return i?this.posBeforeChild(s)+s.size:this.posAtStart}else{let i,s;if(e==this.contentDOM)i=e.childNodes[n];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;i=e.nextSibling}for(;i&&!((s=i.pmViewDesc)&&s.parent==this);)i=i.nextSibling;return i?this.posBeforeChild(s):this.posAtEnd}let o;if(e==this.dom&&this.contentDOM)o=n>At(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))o=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(n==0)for(let i=e;;i=i.parentNode){if(i==this.dom){o=!1;break}if(i.previousSibling)break}if(o==null&&n==e.childNodes.length)for(let i=e;;i=i.parentNode){if(i==this.dom){o=!0;break}if(i.nextSibling)break}}return o??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,n=!1){for(let r=!0,o=e;o;o=o.parentNode){let i=this.getDesc(o),s;if(i&&(!n||i.node))if(r&&(s=i.nodeDOM)&&!(s.nodeType==1?s.contains(e.nodeType==1?e:e.parentNode):s==e))r=!1;else return i}}getDesc(e){let n=e.pmViewDesc;for(let r=n;r;r=r.parent)if(r==this)return n}posFromDOM(e,n,r){for(let o=e;o;o=o.parentNode){let i=this.getDesc(o);if(i)return i.localPosFromDOM(e,n,r)}return-1}descAt(e){for(let n=0,r=0;n<this.children.length;n++){let o=this.children[n],i=r+o.size;if(r==e&&i!=r){for(;!o.border&&o.children.length;)for(let s=0;s<o.children.length;s++){let a=o.children[s];if(a.size){o=a;break}}return o}if(e<i)return o.descAt(e-r-o.border);r=i}}domFromPos(e,n){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let r=0,o=0;for(let i=0;r<this.children.length;r++){let s=this.children[r],a=i+s.size;if(a>e||s instanceof Zv){o=e-i;break}i=a}if(o)return this.children[r].domFromPos(o-this.children[r].border,n);for(let i;r&&!(i=this.children[r-1]).size&&i instanceof Kv&&i.side>=0;r--);if(n<=0){let i,s=!0;for(;i=r?this.children[r-1]:null,!(!i||i.dom.parentNode==this.contentDOM);r--,s=!1);return i&&n&&s&&!i.border&&!i.domAtom?i.domFromPos(i.size,n):{node:this.contentDOM,offset:i?At(i.dom)+1:0}}else{let i,s=!0;for(;i=r<this.children.length?this.children[r]:null,!(!i||i.dom.parentNode==this.contentDOM);r++,s=!1);return i&&s&&!i.border&&!i.domAtom?i.domFromPos(0,n):{node:this.contentDOM,offset:i?At(i.dom):this.contentDOM.childNodes.length}}}parseRange(e,n,r=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:n,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let o=-1,i=-1;for(let s=r,a=0;;a++){let l=this.children[a],c=s+l.size;if(o==-1&&e<=c){let u=s+l.border;if(e>=u&&n<=c-l.border&&l.node&&l.contentDOM&&this.contentDOM.contains(l.contentDOM))return l.parseRange(e,n,u);e=s;for(let d=a;d>0;d--){let f=this.children[d-1];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(1)){o=At(f.dom)+1;break}e-=f.size}o==-1&&(o=0)}if(o>-1&&(c>n||a==this.children.length-1)){n=c;for(let u=a+1;u<this.children.length;u++){let d=this.children[u];if(d.size&&d.dom.parentNode==this.contentDOM&&!d.emptyChildAt(-1)){i=At(d.dom);break}n+=d.size}i==-1&&(i=this.contentDOM.childNodes.length);break}s=c}return{node:this.contentDOM,from:e,to:n,fromOffset:o,toOffset:i}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let n=this.children[e<0?0:this.children.length-1];return n.size==0||n.emptyChildAt(e)}domAfterPos(e){let{node:n,offset:r}=this.domFromPos(e,0);if(n.nodeType!=1||r==n.childNodes.length)throw new RangeError("No node after pos "+e);return n.childNodes[r]}setSelection(e,n,r,o=!1){let i=Math.min(e,n),s=Math.max(e,n);for(let p=0,h=0;p<this.children.length;p++){let m=this.children[p],y=h+m.size;if(i>h&&s<y)return m.setSelection(e-h-m.border,n-h-m.border,r,o);h=y}let a=this.domFromPos(e,e?-1:1),l=n==e?a:this.domFromPos(n,n?-1:1),c=r.root.getSelection(),u=r.domSelectionRange(),d=!1;if((wn||qt)&&e==n){let{node:p,offset:h}=a;if(p.nodeType==3){if(d=!!(h&&p.nodeValue[h-1]==`
32
32
  `),d&&h==p.nodeValue.length)for(let m=p,y;m;m=m.parentNode){if(y=m.nextSibling){y.nodeName=="BR"&&(a=l={node:y.parentNode,offset:At(y)+1});break}let g=m.pmViewDesc;if(g&&g.node&&g.node.isBlock)break}}else{let m=p.childNodes[h-1];d=m&&(m.nodeName=="BR"||m.contentEditable=="false")}}if(wn&&u.focusNode&&u.focusNode!=l.node&&u.focusNode.nodeType==1){let p=u.focusNode.childNodes[u.focusOffset];p&&p.contentEditable=="false"&&(o=!0)}if(!(o||d&&qt)&&co(a.node,a.offset,u.anchorNode,u.anchorOffset)&&co(l.node,l.offset,u.focusNode,u.focusOffset))return;let f=!1;if((c.extend||e==n)&&!d){c.collapse(a.node,a.offset);try{e!=n&&c.extend(l.node,l.offset),f=!0}catch{}}if(!f){if(e>n){let h=a;a=l,l=h}let p=document.createRange();p.setEnd(l.node,l.offset),p.setStart(a.node,a.offset),c.removeAllRanges(),c.addRange(p)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,n){for(let r=0,o=0;o<this.children.length;o++){let i=this.children[o],s=r+i.size;if(r==s?e<=s&&n>=r:e<s&&n>r){let a=r+i.border,l=s-i.border;if(e>=a&&n<=l){this.dirty=e==r||n==s?Hr:Ag,e==a&&n==l&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=Bn:i.markDirty(e-a,n-a);return}else i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?Hr:Bn}r=s}this.dirty=Hr}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?Hr:Ag;n.dirty<r&&(n.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}isText(e){return!1}}let Kv=class extends Rs{constructor(e,n,r,o){let i,s=n.type.toDOM;if(typeof s=="function"&&(s=s(r,()=>{if(!i)return o;if(i.parent)return i.parent.posBeforeChild(i)})),!n.type.spec.raw){if(s.nodeType!=1){let a=document.createElement("span");a.appendChild(s),s=a}s.contentEditable="false",s.classList.add("ProseMirror-widget")}super(e,[],s,null),this.widget=n,this.widget=n,i=this}matchesWidget(e){return this.dirty==fn&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let n=this.widget.spec.stopEvent;return n?n(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get side(){return this.widget.type.side}},FT=class extends Rs{constructor(e,n,r,o){super(e,[],n,null),this.textDOM=r,this.text=o}get size(){return this.text.length}localPosFromDOM(e,n){return e!=this.textDOM?this.posAtStart+(n?this.size:0):this.posAtStart+n}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}},Ja=class hd extends Rs{constructor(e,n,r,o,i){super(e,[],r,o),this.mark=n,this.spec=i}static create(e,n,r,o){let i=o.nodeViews[n.type.name],s=i&&i(n,o,r);return(!s||!s.dom)&&(s=di.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new hd(e,n,s.dom,s.contentDOM||s.dom,s)}parseRule(){return this.dirty&Bn||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Bn&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=fn){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=fn}}slice(e,n,r){let o=hd.create(this.parent,this.mark,!0,r),i=this.children,s=this.size;n<s&&(i=gd(i,n,s,r)),e>0&&(i=gd(i,0,e,r));for(let a=0;a<i.length;a++)i[a].parent=o;return o.children=i,o}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}},Ho=class Jv extends Rs{constructor(e,n,r,o,i,s,a,l,c){super(e,[],i,s),this.node=n,this.outerDeco=r,this.innerDeco=o,this.nodeDOM=a}static create(e,n,r,o,i,s){let a=i.nodeViews[n.type.name],l,c=a&&a(n,i,()=>{if(!l)return s;if(l.parent)return l.parent.posBeforeChild(l)},r,o),u=c&&c.dom,d=c&&c.contentDOM;if(n.isText){if(!u)u=document.createTextNode(n.text);else if(u.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else u||({dom:u,contentDOM:d}=di.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!d&&!n.isText&&u.nodeName!="BR"&&(u.hasAttribute("contenteditable")||(u.contentEditable="false"),n.type.spec.draggable&&(u.draggable=!0));let f=u;return u=t1(u,r,n),c?l=new BT(e,n,r,o,u,d||null,f,c,i,s+1):n.isText?new Xv(e,n,r,o,u,f,i):new Jv(e,n,r,o,u,d||null,f,i,s+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let n=this.children.length-1;n>=0;n--){let r=this.children[n];if(this.dom.contains(r.dom.parentNode)){e.contentElement=r.dom.parentNode;break}}e.contentElement||(e.getContent=()=>ye.empty)}return e}matchesNode(e,n,r){return this.dirty==fn&&e.eq(this.node)&&Xa(n,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,n){let r=this.node.inlineContent,o=n,i=e.composing?this.localCompositionInfo(e,n):null,s=i&&i.pos>-1?i:null,a=i&&i.pos<0,l=new LT(this,s&&s.node,e);jT(this.node,this.innerDeco,(c,u,d)=>{c.spec.marks?l.syncToMarks(c.spec.marks,r,e):c.type.side>=0&&!d&&l.syncToMarks(u==this.node.childCount?Ge.none:this.node.child(u).marks,r,e),l.placeWidget(c,e,o)},(c,u,d,f)=>{l.syncToMarks(c.marks,r,e);let p;l.findNodeMatch(c,u,d,f)||a&&e.state.selection.from>o&&e.state.selection.to<o+c.nodeSize&&(p=l.findIndexWithChild(i.node))>-1&&l.updateNodeAt(c,u,d,p,e)||l.updateNextNode(c,u,d,e,f,o)||l.addNode(c,u,d,e,o),o+=c.nodeSize}),l.syncToMarks([],r,e),this.node.isTextblock&&l.addTextblockHacks(),l.destroyRest(),(l.changed||this.dirty==Hr)&&(s&&this.protectLocalComposition(e,s),Qv(this.contentDOM,this.children,e),ei&&qT(this.dom))}localCompositionInfo(e,n){let{from:r,to:o}=e.state.selection;if(!(e.state.selection instanceof Pe)||r<n||o>n+this.node.content.size)return null;let i=e.input.compositionNode;if(!i||!this.dom.contains(i.parentNode))return null;if(this.node.inlineContent){let s=i.nodeValue,a=UT(this.node.content,s,r-n,o-n);return a<0?null:{node:i,pos:a,text:s}}else return{node:i,pos:-1,text:""}}protectLocalComposition(e,{node:n,pos:r,text:o}){if(this.getDesc(n))return;let i=n;for(;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&(i.pmViewDesc=void 0)}let s=new FT(this,i,n,o);e.input.compositionNodes.push(s),this.children=gd(this.children,r,r+o.length,e,s)}update(e,n,r,o){return this.dirty==Bn||!e.sameMarkup(this.node)?!1:(this.updateInner(e,n,r,o),!0)}updateInner(e,n,r,o){this.updateOuterDeco(n),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(o,this.posAtStart),this.dirty=fn}updateOuterDeco(e){if(Xa(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=e1(this.dom,this.nodeDOM,md(this.outerDeco,this.node,n),md(e,this.node,n)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.dom.draggable=!0)}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.dom.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}};function Tg(t,e,n,r,o){t1(r,e,t);let i=new Ho(void 0,t,e,n,r,r,r,o,0);return i.contentDOM&&i.updateChildren(o,0),i}let Xv=class Yv extends Ho{constructor(e,n,r,o,i,s,a){super(e,n,r,o,i,null,s,a,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,n,r,o){return this.dirty==Bn||this.dirty!=fn&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=fn||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,o.trackWrites==this.nodeDOM&&(o.trackWrites=null)),this.node=e,this.dirty=fn,!0)}inParent(){let e=this.parent.contentDOM;for(let n=this.nodeDOM;n;n=n.parentNode)if(n==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,n,r){return e==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):super.localPosFromDOM(e,n,r)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,n,r){let o=this.node.cut(e,n),i=document.createTextNode(o.text);return new Yv(this.parent,o,this.outerDeco,this.innerDeco,i,i,r)}markDirty(e,n){super.markDirty(e,n),this.dom!=this.nodeDOM&&(e==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=Bn)}get domAtom(){return!1}isText(e){return this.node.text==e}},Zv=class extends Rs{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==fn&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}},BT=class extends Ho{constructor(e,n,r,o,i,s,a,l,c,u){super(e,n,r,o,i,s,a,c,u),this.spec=l}update(e,n,r,o){if(this.dirty==Bn)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let i=this.spec.update(e,n,r);return i&&this.updateInner(e,n,r,o),i}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,n,r,o)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,n,r,o){this.spec.setSelection?this.spec.setSelection(e,n,r.root):super.setSelection(e,n,r,o)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}};function Qv(t,e,n){let r=t.firstChild,o=!1;for(let i=0;i<e.length;i++){let s=e[i],a=s.dom;if(a.parentNode==t){for(;a!=r;)r=$g(r),o=!0;r=r.nextSibling}else o=!0,t.insertBefore(a,r);if(s instanceof Ja){let l=r?r.previousSibling:t.lastChild;Qv(s.contentDOM,s.children,n),r=l?l.nextSibling:t.firstChild}}for(;r;)r=$g(r),o=!0;o&&n.trackWrites==t&&(n.trackWrites=null)}const Wi=function(t){t&&(this.nodeName=t)};Wi.prototype=Object.create(null);const Wr=[new Wi];function md(t,e,n){if(t.length==0)return Wr;let r=n?Wr[0]:new Wi,o=[r];for(let i=0;i<t.length;i++){let s=t[i].type.attrs;if(s){s.nodeName&&o.push(r=new Wi(s.nodeName));for(let a in s){let l=s[a];l!=null&&(n&&o.length==1&&o.push(r=new Wi(e.isInline?"span":"div")),a=="class"?r.class=(r.class?r.class+" ":"")+l:a=="style"?r.style=(r.style?r.style+";":"")+l:a!="nodeName"&&(r[a]=l))}}}return o}function e1(t,e,n,r){if(n==Wr&&r==Wr)return e;let o=e;for(let i=0;i<r.length;i++){let s=r[i],a=n[i];if(i){let l;a&&a.nodeName==s.nodeName&&o!=t&&(l=o.parentNode)&&l.nodeName.toLowerCase()==s.nodeName||(l=document.createElement(s.nodeName),l.pmIsDeco=!0,l.appendChild(o),a=Wr[0]),o=l}RT(o,a||Wr[0],s)}return o}function RT(t,e,n){for(let r in e)r!="class"&&r!="style"&&r!="nodeName"&&!(r in n)&&t.removeAttribute(r);for(let r in n)r!="class"&&r!="style"&&r!="nodeName"&&n[r]!=e[r]&&t.setAttribute(r,n[r]);if(e.class!=n.class){let r=e.class?e.class.split(" ").filter(Boolean):[],o=n.class?n.class.split(" ").filter(Boolean):[];for(let i=0;i<r.length;i++)o.indexOf(r[i])==-1&&t.classList.remove(r[i]);for(let i=0;i<o.length;i++)r.indexOf(o[i])==-1&&t.classList.add(o[i]);t.classList.length==0&&t.removeAttribute("class")}if(e.style!=n.style){if(e.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,o;for(;o=r.exec(e.style);)t.style.removeProperty(o[1])}n.style&&(t.style.cssText+=n.style)}}function t1(t,e,n){return e1(t,t,Wr,md(e,n,t.nodeType!=1))}function Xa(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(!t[n].type.eq(e[n].type))return!1;return!0}function $g(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}let LT=class{constructor(e,n,r){this.lock=n,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=PT(e.node.content,e)}destroyBetween(e,n){if(e!=n){for(let r=e;r<n;r++)this.top.children[r].destroy();this.top.children.splice(e,n-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,n,r){let o=0,i=this.stack.length>>1,s=Math.min(i,e.length);for(;o<s&&(o==i-1?this.top:this.stack[o+1<<1]).matchesMark(e[o])&&e[o].type.spec.spanning!==!1;)o++;for(;o<i;)this.destroyRest(),this.top.dirty=fn,this.index=this.stack.pop(),this.top=this.stack.pop(),i--;for(;i<e.length;){this.stack.push(this.top,this.index+1);let a=-1;for(let l=this.index;l<Math.min(this.index+3,this.top.children.length);l++){let c=this.top.children[l];if(c.matchesMark(e[i])&&!this.isLocked(c.dom)){a=l;break}}if(a>-1)a>this.index&&(this.changed=!0,this.destroyBetween(this.index,a)),this.top=this.top.children[this.index];else{let l=Ja.create(this.top,e[i],n,r);this.top.children.splice(this.index,0,l),this.top=l,this.changed=!0}this.index=0,i++}}findNodeMatch(e,n,r,o){let i=-1,s;if(o>=this.preMatch.index&&(s=this.preMatch.matches[o-this.preMatch.index]).parent==this.top&&s.matchesNode(e,n,r))i=this.top.children.indexOf(s,this.index);else for(let a=this.index,l=Math.min(this.top.children.length,a+5);a<l;a++){let c=this.top.children[a];if(c.matchesNode(e,n,r)&&!this.preMatch.matched.has(c)){i=a;break}}return i<0?!1:(this.destroyBetween(this.index,i),this.index++,!0)}updateNodeAt(e,n,r,o,i){let s=this.top.children[o];return s.dirty==Bn&&s.dom==s.contentDOM&&(s.dirty=Hr),s.update(e,n,r,i)?(this.destroyBetween(this.index,o),this.index++,!0):!1}findIndexWithChild(e){for(;;){let n=e.parentNode;if(!n)return-1;if(n==this.top.contentDOM){let r=e.pmViewDesc;if(r){for(let o=this.index;o<this.top.children.length;o++)if(this.top.children[o]==r)return o}return-1}e=n}}updateNextNode(e,n,r,o,i,s){for(let a=this.index;a<this.top.children.length;a++){let l=this.top.children[a];if(l instanceof Ho){let c=this.preMatch.matched.get(l);if(c!=null&&c!=i)return!1;let u=l.dom,d,f=this.isLocked(u)&&!(e.isText&&l.node&&l.node.isText&&l.nodeDOM.nodeValue==e.text&&l.dirty!=Bn&&Xa(n,l.outerDeco));if(!f&&l.update(e,n,r,o))return this.destroyBetween(this.index,a),l.dom!=u&&(this.changed=!0),this.index++,!0;if(!f&&(d=this.recreateWrapper(l,e,n,r,o,s)))return this.destroyBetween(this.index,a),this.top.children[this.index]=d,d.contentDOM&&(d.dirty=Hr,d.updateChildren(o,s+1),d.dirty=fn),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,n,r,o,i,s){if(e.dirty||n.isAtom||!e.children.length||!e.node.content.eq(n.content)||!Xa(r,e.outerDeco)||!o.eq(e.innerDeco))return null;let a=Ho.create(this.top,n,r,o,i,s);if(a.contentDOM){a.children=e.children,e.children=[];for(let l of a.children)l.parent=a}return e.destroy(),a}addNode(e,n,r,o,i){let s=Ho.create(this.top,e,n,r,o,i);s.contentDOM&&s.updateChildren(o,i+1),this.top.children.splice(this.index++,0,s),this.changed=!0}placeWidget(e,n,r){let o=this.index<this.top.children.length?this.top.children[this.index]:null;if(o&&o.matchesWidget(e)&&(e==o.widget||!o.widget.type.toDOM.parentNode))this.index++;else{let i=new Kv(this.top,e,n,r);this.top.children.splice(this.index++,0,i),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],n=this.top;for(;e instanceof Ja;)n=e,e=n.children[n.children.length-1];(!e||!(e instanceof Xv)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((qt||Nt)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",n),this.addHackNode("BR",this.top))}addHackNode(e,n){if(n==this.top&&this.index<n.children.length&&n.children[this.index].matchesHack(e))this.index++;else{let r=document.createElement(e);e=="IMG"&&(r.className="ProseMirror-separator",r.alt=""),e=="BR"&&(r.className="ProseMirror-trailingBreak");let o=new Zv(this.top,[],r,null);n!=this.top?n.children.push(o):n.children.splice(this.index++,0,o),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}};function PT(t,e){let n=e,r=n.children.length,o=t.childCount,i=new Map,s=[];e:for(;o>0;){let a;for(;;)if(r){let c=n.children[r-1];if(c instanceof Ja)n=c,r=c.children.length;else{a=c,r--;break}}else{if(n==e)break e;r=n.parent.children.indexOf(n),n=n.parent}let l=a.node;if(l){if(l!=t.child(o-1))break;--o,i.set(a,o),s.push(a)}}return{index:o,matched:i,matches:s.reverse()}}function zT(t,e){return t.type.side-e.type.side}function jT(t,e,n,r){let o=e.locals(t),i=0;if(o.length==0){for(let c=0;c<t.childCount;c++){let u=t.child(c);r(u,o,e.forChild(i,u),c),i+=u.nodeSize}return}let s=0,a=[],l=null;for(let c=0;;){let u,d;for(;s<o.length&&o[s].to==i;){let y=o[s++];y.widget&&(u?(d||(d=[u])).push(y):u=y)}if(u)if(d){d.sort(zT);for(let y=0;y<d.length;y++)n(d[y],c,!!l)}else n(u,c,!!l);let f,p;if(l)p=-1,f=l,l=null;else if(c<t.childCount)p=c,f=t.child(c++);else break;for(let y=0;y<a.length;y++)a[y].to<=i&&a.splice(y--,1);for(;s<o.length&&o[s].from<=i&&o[s].to>i;)a.push(o[s++]);let h=i+f.nodeSize;if(f.isText){let y=h;s<o.length&&o[s].from<y&&(y=o[s].from);for(let g=0;g<a.length;g++)a[g].to<y&&(y=a[g].to);y<h&&(l=f.cut(y-i),f=f.cut(0,y-i),h=y,p=-1)}else for(;s<o.length&&o[s].to<h;)s++;let m=f.isInline&&!f.isLeaf?a.filter(y=>!y.inline):a.slice();r(f,m,e.forChild(i,f),p),i=h}}function qT(t){if(t.nodeName=="UL"||t.nodeName=="OL"){let e=t.style.cssText;t.style.cssText=e+"; list-style: square !important",window.getComputedStyle(t).listStyle,t.style.cssText=e}}function UT(t,e,n,r){for(let o=0,i=0;o<t.childCount&&i<=r;){let s=t.child(o++),a=i;if(i+=s.nodeSize,!s.isText)continue;let l=s.text;for(;o<t.childCount;){let c=t.child(o++);if(i+=c.nodeSize,!c.isText)break;l+=c.text}if(i>=n){if(i>=r&&l.slice(r-e.length-a,r-a)==e)return r-e.length;let c=a<r?l.lastIndexOf(e,r-a-1):-1;if(c>=0&&c+e.length+a>=n)return a+c;if(n==r&&l.length>=r+e.length-a&&l.slice(r-a,r-a+e.length)==e)return r}}return-1}function gd(t,e,n,r,o){let i=[];for(let s=0,a=0;s<t.length;s++){let l=t[s],c=a,u=a+=l.size;c>=n||u<=e?i.push(l):(c<e&&i.push(l.slice(0,e-c,r)),o&&(i.push(o),o=void 0),u>n&&i.push(l.slice(n-c,l.size,r)))}return i}function zf(t,e=null){let n=t.domSelectionRange(),r=t.state.doc;if(!n.focusNode)return null;let o=t.docView.nearestDesc(n.focusNode),i=o&&o.size==0,s=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(s<0)return null;let a=r.resolve(s),l,c;if(Dl(n)){for(l=s;o&&!o.node;)o=o.parent;let d=o.node;if(o&&d.isAtom&&De.isSelectable(d)&&o.parent&&!(d.isInline&&mT(n.focusNode,n.focusOffset,o.dom))){let f=o.posBefore;c=new De(s==f?a:r.resolve(f))}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let d=s,f=s;for(let p=0;p<n.rangeCount;p++){let h=n.getRangeAt(p);d=Math.min(d,t.docView.posFromDOM(h.startContainer,h.startOffset,1)),f=Math.max(f,t.docView.posFromDOM(h.endContainer,h.endOffset,-1))}if(d<0)return null;[l,s]=f==t.state.selection.anchor?[f,d]:[d,f],a=r.resolve(s)}else l=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(l<0)return null}let u=r.resolve(l);if(!c){let d=e=="pointer"||t.state.selection.head<a.pos&&!i?1:-1;c=jf(t,u,a,d)}return c}function n1(t){return t.editable?t.hasFocus():o1(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function tr(t,e=!1){let n=t.state.selection;if(r1(t,n),!!n1(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&Nt){let r=t.domSelectionRange(),o=t.domObserver.currentSelection;if(r.anchorNode&&o.anchorNode&&co(r.anchorNode,r.anchorOffset,o.anchorNode,o.anchorOffset)){t.input.mouseDown.delayedSelectionSync=!0,t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)HT(t);else{let{anchor:r,head:o}=n,i,s;Og&&!(n instanceof Pe)&&(n.$from.parent.inlineContent||(i=Mg(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(s=Mg(t,n.to))),t.docView.setSelection(r,o,t,e),Og&&(i&&_g(i),s&&_g(s)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&VT(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const Og=qt||Nt&&jv<63;function Mg(t,e){let{node:n,offset:r}=t.docView.domFromPos(e,0),o=r<n.childNodes.length?n.childNodes[r]:null,i=r?n.childNodes[r-1]:null;if(qt&&o&&o.contentEditable=="false")return ru(o);if((!o||o.contentEditable=="false")&&(!i||i.contentEditable=="false")){if(o)return ru(o);if(i)return ru(i)}}function ru(t){return t.contentEditable="true",qt&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function _g(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function VT(t){let e=t.dom.ownerDocument;e.removeEventListener("selectionchange",t.input.hideSelectionGuard);let n=t.domSelectionRange(),r=n.anchorNode,o=n.anchorOffset;e.addEventListener("selectionchange",t.input.hideSelectionGuard=()=>{(n.anchorNode!=r||n.anchorOffset!=o)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!n1(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function HT(t){let e=t.domSelection(),n=document.createRange();if(!e)return;let r=t.cursorWrapper.dom,o=r.nodeName=="IMG";o?n.setStart(r.parentNode,At(r)+1):n.setStart(r,0),n.collapse(!0),e.removeAllRanges(),e.addRange(n),!o&&!t.state.selection.visible&&Gt&&Cr<=11&&(r.disabled=!0,r.disabled=!1)}function r1(t,e){if(e instanceof De){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(Ng(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else Ng(t)}function Ng(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function jf(t,e,n,r){return t.someProp("createSelectionBetween",o=>o(t,e,n))||Pe.between(e,n,r)}function Dg(t){return t.editable&&!t.hasFocus()?!1:o1(t)}function o1(t){let e=t.domSelectionRange();if(!e.anchorNode)return!1;try{return t.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(t.editable||t.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function WT(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return co(e.node,e.offset,n.anchorNode,n.anchorOffset)}function yd(t,e){let{$anchor:n,$head:r}=t.selection,o=e>0?n.max(r):n.min(r),i=o.parent.inlineContent?o.depth?t.doc.resolve(e>0?o.after():o.before()):null:o;return i&&Re.findFrom(i,e)}function gr(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function Ig(t,e,n){let r=t.state.selection;if(r instanceof Pe)if(n.indexOf("s")>-1){let{$head:o}=r,i=o.textOffset?null:e<0?o.nodeBefore:o.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let s=t.state.doc.resolve(o.pos+i.nodeSize*(e<0?-1:1));return gr(t,new Pe(r.$anchor,s))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let o=yd(t.state,e);return o&&o instanceof De?gr(t,o):!1}else if(!(un&&n.indexOf("m")>-1)){let o=r.$head,i=o.textOffset?null:e<0?o.nodeBefore:o.nodeAfter,s;if(!i||i.isText)return!1;let a=e<0?o.pos-i.nodeSize:o.pos;return i.isAtom||(s=t.docView.descAt(a))&&!s.contentDOM?De.isSelectable(i)?gr(t,new De(e<0?t.state.doc.resolve(o.pos-i.nodeSize):o)):Bs?gr(t,new Pe(t.state.doc.resolve(e<0?a:a+i.nodeSize))):!1:!1}}else return!1;else{if(r instanceof De&&r.node.isInline)return gr(t,new Pe(e>0?r.$to:r.$from));{let o=yd(t.state,e);return o?gr(t,o):!1}}}function Ya(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function Gi(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function So(t,e){return e<0?GT(t):KT(t)}function GT(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let o,i,s=!1;for(wn&&n.nodeType==1&&r<Ya(n)&&Gi(n.childNodes[r],-1)&&(s=!0);;)if(r>0){if(n.nodeType!=1)break;{let a=n.childNodes[r-1];if(Gi(a,-1))o=n,i=--r;else if(a.nodeType==3)n=a,r=n.nodeValue.length;else break}}else{if(i1(n))break;{let a=n.previousSibling;for(;a&&Gi(a,-1);)o=n.parentNode,i=At(a),a=a.previousSibling;if(a)n=a,r=Ya(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}s?wd(t,n,r):o&&wd(t,o,i)}function KT(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let o=Ya(n),i,s;for(;;)if(r<o){if(n.nodeType!=1)break;let a=n.childNodes[r];if(Gi(a,1))i=n,s=++r;else break}else{if(i1(n))break;{let a=n.nextSibling;for(;a&&Gi(a,1);)i=a.parentNode,s=At(a)+1,a=a.nextSibling;if(a)n=a,r=0,o=Ya(n);else{if(n=n.parentNode,n==t.dom)break;r=o=0}}}i&&wd(t,i,s)}function i1(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function JT(t,e){for(;t&&e==t.childNodes.length&&!Fs(t);)e=At(t)+1,t=t.parentNode;for(;t&&e<t.childNodes.length;){let n=t.childNodes[e];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=0}}function XT(t,e){for(;t&&!e&&!Fs(t);)e=At(t),t=t.parentNode;for(;t&&e;){let n=t.childNodes[e-1];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=t.childNodes.length}}function wd(t,e,n){if(e.nodeType!=3){let i,s;(s=JT(e,n))?(e=s,n=0):(i=XT(e,n))&&(e=i,n=i.nodeValue.length)}let r=t.domSelection();if(!r)return;if(Dl(r)){let i=document.createRange();i.setEnd(e,n),i.setStart(e,n),r.removeAllRanges(),r.addRange(i)}else r.extend&&r.extend(e,n);t.domObserver.setCurSelection();let{state:o}=t;setTimeout(()=>{t.state==o&&tr(t)},50)}function Fg(t,e){let n=t.state.doc.resolve(e);if(!(Nt||wT)&&n.parent.inlineContent){let r=t.coordsAtPos(e);if(e>n.start()){let o=t.coordsAtPos(e-1),i=(o.top+o.bottom)/2;if(i>r.top&&i<r.bottom&&Math.abs(o.left-r.left)>1)return o.left<r.left?"ltr":"rtl"}if(e<n.end()){let o=t.coordsAtPos(e+1),i=(o.top+o.bottom)/2;if(i>r.top&&i<r.bottom&&Math.abs(o.left-r.left)>1)return o.left>r.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function Bg(t,e,n){let r=t.state.selection;if(r instanceof Pe&&!r.empty||n.indexOf("s")>-1||un&&n.indexOf("m")>-1)return!1;let{$from:o,$to:i}=r;if(!o.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let s=yd(t.state,e);if(s&&s instanceof De)return gr(t,s)}if(!o.parent.inlineContent){let s=e<0?o:i,a=r instanceof _n?Re.near(s,e):Re.findFrom(s,e);return a?gr(t,a):!1}return!1}function Rg(t,e){if(!(t.state.selection instanceof Pe))return!0;let{$head:n,$anchor:r,empty:o}=t.state.selection;if(!n.sameParent(r))return!0;if(!o)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let i=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(i&&!i.isText){let s=t.state.tr;return e<0?s.delete(n.pos-i.nodeSize,n.pos):s.delete(n.pos,n.pos+i.nodeSize),t.dispatch(s),!0}return!1}function Lg(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function YT(t){if(!qt||t.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(e&&e.nodeType==1&&n==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;Lg(t,r,"true"),setTimeout(()=>Lg(t,r,"false"),20)}return!1}function ZT(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function QT(t,e){let n=e.keyCode,r=ZT(e);if(n==8||un&&n==72&&r=="c")return Rg(t,-1)||So(t,-1);if(n==46&&!e.shiftKey||un&&n==68&&r=="c")return Rg(t,1)||So(t,1);if(n==13||n==27)return!0;if(n==37||un&&n==66&&r=="c"){let o=n==37?Fg(t,t.state.selection.from)=="ltr"?-1:1:-1;return Ig(t,o,r)||So(t,o)}else if(n==39||un&&n==70&&r=="c"){let o=n==39?Fg(t,t.state.selection.from)=="ltr"?1:-1:1;return Ig(t,o,r)||So(t,o)}else{if(n==38||un&&n==80&&r=="c")return Bg(t,-1,r)||So(t,-1);if(n==40||un&&n==78&&r=="c")return YT(t)||Bg(t,1,r)||So(t,1);if(r==(un?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function qf(t,e){t.someProp("transformCopied",p=>{e=p(e,t)});let n=[],{content:r,openStart:o,openEnd:i}=e;for(;o>1&&i>1&&r.childCount==1&&r.firstChild.childCount==1;){o--,i--;let p=r.firstChild;n.push(p.type.name,p.attrs!=p.type.defaultAttrs?p.attrs:null),r=p.content}let s=t.someProp("clipboardSerializer")||di.fromSchema(t.state.schema),a=d1(),l=a.createElement("div");l.appendChild(s.serializeFragment(r,{document:a}));let c=l.firstChild,u,d=0;for(;c&&c.nodeType==1&&(u=u1[c.nodeName.toLowerCase()]);){for(let p=u.length-1;p>=0;p--){let h=a.createElement(u[p]);for(;l.firstChild;)h.appendChild(l.firstChild);l.appendChild(h),d++}c=l.firstChild}c&&c.nodeType==1&&c.setAttribute("data-pm-slice",`${o} ${i}${d?` -${d}`:""} ${JSON.stringify(n)}`);let f=t.someProp("clipboardTextSerializer",p=>p(e,t))||e.content.textBetween(0,e.content.size,`
33
33
 
34
34
  `);return{dom:l,text:f,slice:e}}function s1(t,e,n,r,o){let i=o.parent.type.spec.code,s,a;if(!n&&!e)return null;let l=e&&(r||i||!n);if(l){if(t.someProp("transformPastedText",f=>{e=f(e,i||r,t)}),i)return e?new ve(ye.from(t.state.schema.text(e.replace(/\r\n?/g,`
35
35
  `))),0,0):ve.empty;let d=t.someProp("clipboardTextParser",f=>f(e,o,r,t));if(d)a=d;else{let f=o.marks(),{schema:p}=t.state,h=di.fromSchema(p);s=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(m=>{let y=s.appendChild(document.createElement("p"));m&&y.appendChild(h.serializeNode(p.text(m,f)))})}}else t.someProp("transformPastedHTML",d=>{n=d(n,t)}),s=r6(n),Bs&&o6(s);let c=s&&s.querySelector("[data-pm-slice]"),u=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(u&&u[3])for(let d=+u[3];d>0;d--){let f=s.firstChild;for(;f&&f.nodeType!=1;)f=f.nextSibling;if(!f)break;s=f}if(a||(a=(t.someProp("clipboardParser")||t.someProp("domParser")||Zr.fromSchema(t.state.schema)).parseSlice(s,{preserveWhitespace:!!(l||u),context:o,ruleFromNode(d){return d.nodeName=="BR"&&!d.nextSibling&&d.parentNode&&!e6.test(d.parentNode.nodeName)?{ignore:!0}:null}})),u)a=i6(Pg(a,+u[1],+u[2]),u[4]);else if(a=ve.maxOpen(t6(a.content,o),!0),a.openStart||a.openEnd){let d=0,f=0;for(let p=a.content.firstChild;d<a.openStart&&!p.type.spec.isolating;d++,p=p.firstChild);for(let p=a.content.lastChild;f<a.openEnd&&!p.type.spec.isolating;f++,p=p.lastChild);a=Pg(a,d,f)}return t.someProp("transformPasted",d=>{a=d(a,t)}),a}const e6=/^(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 t6(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let r=e.node(n).contentMatchAt(e.index(n)),o,i=[];if(t.forEach(s=>{if(!i)return;let a=r.findWrapping(s.type),l;if(!a)return i=null;if(l=i.length&&o.length&&l1(a,o,s,i[i.length-1],0))i[i.length-1]=l;else{i.length&&(i[i.length-1]=c1(i[i.length-1],o.length));let c=a1(s,a);i.push(c),r=r.matchType(c.type),o=a}}),i)return ye.from(i)}return t}function a1(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,ye.from(t));return t}function l1(t,e,n,r,o){if(o<t.length&&o<e.length&&t[o]==e[o]){let i=l1(t,e,n,r.lastChild,o+1);if(i)return r.copy(r.content.replaceChild(r.childCount-1,i));if(r.contentMatchAt(r.childCount).matchType(o==t.length-1?n.type:t[o+1]))return r.copy(r.content.append(ye.from(a1(n,t,o+1))))}}function c1(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,c1(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(ye.empty,!0);return t.copy(n.append(r))}function bd(t,e,n,r,o,i){let s=e<0?t.firstChild:t.lastChild,a=s.content;return t.childCount>1&&(i=0),o<r-1&&(a=bd(a,e,n,r,o+1,i)),o>=n&&(a=e<0?s.contentMatchAt(0).fillBefore(a,i<=o).append(a):a.append(s.contentMatchAt(s.childCount).fillBefore(ye.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,s.copy(a))}function Pg(t,e,n){return e<t.openStart&&(t=new ve(bd(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new ve(bd(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const u1={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let zg=null;function d1(){return zg||(zg=document.implementation.createHTMLDocument("title"))}let ou=null;function n6(t){let e=window.trustedTypes;return e?(ou||(ou=e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),ou.createHTML(t)):t}function r6(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=d1().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),o;if((o=r&&u1[r[1].toLowerCase()])&&(t=o.map(i=>"<"+i+">").join("")+t+o.map(i=>"</"+i+">").reverse().join("")),n.innerHTML=n6(t),o)for(let i=0;i<o.length;i++)n=n.querySelector(o[i])||n;return n}function o6(t){let e=t.querySelectorAll(Nt?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<e.length;n++){let r=e[n];r.childNodes.length==1&&r.textContent==" "&&r.parentNode&&r.parentNode.replaceChild(t.ownerDocument.createTextNode(" "),r)}}function i6(t,e){if(!t.size)return t;let n=t.content.firstChild.type.schema,r;try{r=JSON.parse(e)}catch{return t}let{content:o,openStart:i,openEnd:s}=t;for(let a=r.length-2;a>=0;a-=2){let l=n.nodes[r[a]];if(!l||l.hasRequiredAttrs())break;o=ye.from(l.create(r[a+1],o)),i++,s++}return new ve(o,i,s)}const Ut={},Vt={},s6={touchstart:!0,touchmove:!0};class a6{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:""},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function l6(t){for(let e in Ut){let n=Ut[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{u6(t,r)&&!Uf(t,r)&&(t.editable||!(r.type in Vt))&&n(t,r)},s6[e]?{passive:!0}:void 0)}qt&&t.dom.addEventListener("input",()=>null),vd(t)}function br(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function c6(t){t.domObserver.stop();for(let e in t.input.eventHandlers)t.dom.removeEventListener(e,t.input.eventHandlers[e]);clearTimeout(t.input.composingTimeout),clearTimeout(t.input.lastIOSEnterFallbackTimeout)}function vd(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>Uf(t,r))})}function Uf(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function u6(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target;n!=t.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(e))return!1;return!0}function d6(t,e){!Uf(t,e)&&Ut[e.type]&&(t.editable||!(e.type in Vt))&&Ut[e.type](t,e)}Vt.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!p1(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(Zn&&Nt&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),ei&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let r=Date.now();t.input.lastIOSEnter=r,t.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{t.input.lastIOSEnter==r&&(t.someProp("handleKeyDown",o=>o(t,qr(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||QT(t,n)?n.preventDefault():br(t,"key")};Vt.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};Vt.keypress=(t,e)=>{let n=e;if(p1(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||un&&n.metaKey)return;if(t.someProp("handleKeyPress",o=>o(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof Pe)||!r.$from.sameParent(r.$to)){let o=String.fromCharCode(n.charCode);!/[\r\n]/.test(o)&&!t.someProp("handleTextInput",i=>i(t,r.$from.pos,r.$to.pos,o))&&t.dispatch(t.state.tr.insertText(o).scrollIntoView()),n.preventDefault()}};function Il(t){return{left:t.clientX,top:t.clientY}}function f6(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function Vf(t,e,n,r,o){if(r==-1)return!1;let i=t.state.doc.resolve(r);for(let s=i.depth+1;s>0;s--)if(t.someProp(e,a=>s>i.depth?a(t,n,i.nodeAfter,i.before(s),o,!0):a(t,n,i.node(s),i.before(s),o,!1)))return!0;return!1}function Wo(t,e,n){if(t.focused||t.focus(),t.state.selection.eq(e))return;let r=t.state.tr.setSelection(e);r.setMeta("pointer",!0),t.dispatch(r)}function p6(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&De.isSelectable(r)?(Wo(t,new De(n)),!0):!1}function h6(t,e){if(e==-1)return!1;let n=t.state.selection,r,o;n instanceof De&&(r=n.node);let i=t.state.doc.resolve(e);for(let s=i.depth+1;s>0;s--){let a=s>i.depth?i.nodeAfter:i.node(s);if(De.isSelectable(a)){r&&n.$from.depth>0&&s>=n.$from.depth&&i.before(n.$from.depth+1)==n.$from.pos?o=i.before(n.$from.depth):o=i.before(s);break}}return o!=null?(Wo(t,De.create(t.state.doc,o)),!0):!1}function m6(t,e,n,r,o){return Vf(t,"handleClickOn",e,n,r)||t.someProp("handleClick",i=>i(t,e,r))||(o?h6(t,n):p6(t,n))}function g6(t,e,n,r){return Vf(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",o=>o(t,e,r))}function y6(t,e,n,r){return Vf(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",o=>o(t,e,r))||w6(t,n,r)}function w6(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?(Wo(t,Pe.create(r,0,r.content.size)),!0):!1;let o=r.resolve(e);for(let i=o.depth+1;i>0;i--){let s=i>o.depth?o.nodeAfter:o.node(i),a=o.before(i);if(s.inlineContent)Wo(t,Pe.create(r,a+1,a+1+s.content.size));else if(De.isSelectable(s))Wo(t,De.create(r,a));else continue;return!0}}function Hf(t){return Za(t)}const f1=un?"metaKey":"ctrlKey";Ut.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=Hf(t),o=Date.now(),i="singleClick";o-t.input.lastClick.time<500&&f6(n,t.input.lastClick)&&!n[f1]&&(t.input.lastClick.type=="singleClick"?i="doubleClick":t.input.lastClick.type=="doubleClick"&&(i="tripleClick")),t.input.lastClick={time:o,x:n.clientX,y:n.clientY,type:i};let s=t.posAtCoords(Il(n));s&&(i=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new b6(t,s,n,!!r)):(i=="doubleClick"?g6:y6)(t,s.pos,s.inside,n)?n.preventDefault():br(t,"pointer"))};class b6{constructor(e,n,r,o){this.view=e,this.pos=n,this.event=r,this.flushed=o,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[f1],this.allowDefault=r.shiftKey;let i,s;if(n.inside>-1)i=e.state.doc.nodeAt(n.inside),s=n.inside;else{let u=e.state.doc.resolve(n.pos);i=u.parent,s=u.depth?u.before():0}const a=o?null:r.target,l=a?e.docView.nearestDesc(a,!0):null;this.target=l&&l.dom.nodeType==1?l.dom:null;let{selection:c}=e.state;(r.button==0&&i.type.spec.draggable&&i.type.spec.selectable!==!1||c instanceof De&&c.from<=s&&c.to>s)&&(this.mightDrag={node:i,pos:s,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&wn&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),br(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>tr(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(Il(e))),this.updateAllowDefault(e),this.allowDefault||!n?br(this.view,"pointer"):m6(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||qt&&this.mightDrag&&!this.mightDrag.node.isAtom||Nt&&!this.view.state.selection.visible&&Math.min(Math.abs(n.pos-this.view.state.selection.from),Math.abs(n.pos-this.view.state.selection.to))<=2)?(Wo(this.view,Re.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):br(this.view,"pointer")}move(e){this.updateAllowDefault(e),br(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}Ut.touchstart=t=>{t.input.lastTouch=Date.now(),Hf(t),br(t,"pointer")};Ut.touchmove=t=>{t.input.lastTouch=Date.now(),br(t,"pointer")};Ut.contextmenu=t=>Hf(t);function p1(t,e){return t.composing?!0:qt&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const v6=Zn?5e3:-1;Vt.compositionstart=Vt.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof Pe&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)))t.markCursor=t.state.storedMarks||n.marks(),Za(t,!0),t.markCursor=null;else if(Za(t,!e.selection.empty),wn&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=t.domSelectionRange();for(let o=r.focusNode,i=r.focusOffset;o&&o.nodeType==1&&i!=0;){let s=i<0?o.lastChild:o.childNodes[i-1];if(!s)break;if(s.nodeType==3){let a=t.domSelection();a&&a.collapse(s,s.nodeValue.length);break}else o=s,i=-1}}t.input.composing=!0}h1(t,v6)};Vt.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=e.timeStamp,t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0,t.input.compositionNode=null,t.input.compositionPendingChanges&&Promise.resolve().then(()=>t.domObserver.flush()),t.input.compositionID++,h1(t,20))};function h1(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>Za(t),e))}function m1(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=k6());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function x6(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=pT(e.focusNode,e.focusOffset),r=hT(e.focusNode,e.focusOffset);if(n&&r&&n!=r){let o=r.pmViewDesc,i=t.domObserver.lastChangedTextNode;if(n==i||r==i)return i;if(!o||!o.isText(r.nodeValue))return r;if(t.input.compositionNode==r){let s=n.pmViewDesc;if(!(!s||!s.isText(n.nodeValue)))return r}}return n||r}function k6(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function Za(t,e=!1){if(!(Zn&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),m1(t),e||t.docView&&t.docView.dirty){let n=zf(t);return n&&!n.eq(t.state.selection)?t.dispatch(t.state.tr.setSelection(n)):(t.markCursor||e)&&!t.state.selection.empty?t.dispatch(t.state.tr.deleteSelection()):t.updateState(t.state),!0}return!1}}function S6(t,e){if(!t.dom.parentNode)return;let n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),o=document.createRange();o.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(o),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}const ls=Gt&&Cr<15||ei&&bT<604;Ut.copy=Vt.cut=(t,e)=>{let n=e,r=t.state.selection,o=n.type=="cut";if(r.empty)return;let i=ls?null:n.clipboardData,s=r.content(),{dom:a,text:l}=qf(t,s);i?(n.preventDefault(),i.clearData(),i.setData("text/html",a.innerHTML),i.setData("text/plain",l)):S6(t,a),o&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function C6(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function E6(t,e){if(!t.dom.parentNode)return;let n=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,r=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let o=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),r.parentNode&&r.parentNode.removeChild(r),n?cs(t,r.value,null,o,e):cs(t,r.textContent,r.innerHTML,o,e)},50)}function cs(t,e,n,r,o){let i=s1(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",l=>l(t,o,i||ve.empty)))return!0;if(!i)return!1;let s=C6(i),a=s?t.state.tr.replaceSelectionWith(s,r):t.state.tr.replaceSelection(i);return t.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function g1(t){let e=t.getData("text/plain")||t.getData("Text");if(e)return e;let n=t.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}Vt.paste=(t,e)=>{let n=e;if(t.composing&&!Zn)return;let r=ls?null:n.clipboardData,o=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&cs(t,g1(r),r.getData("text/html"),o,n)?n.preventDefault():E6(t,n)};let y1=class{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}};const A6=un?"altKey":"ctrlKey";function w1(t,e){return t.someProp("dragCopies",r=>!r(e))??!e[A6]}Ut.dragstart=(t,e)=>{let n=e,r=t.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let o=t.state.selection,i=o.empty?null:t.posAtCoords(Il(n)),s;if(!(i&&i.pos>=o.from&&i.pos<=(o instanceof De?o.to-1:o.to))){if(r&&r.mightDrag)s=De.create(t.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let d=t.docView.nearestDesc(n.target,!0);d&&d.node.type.spec.draggable&&d!=t.docView&&(s=De.create(t.state.doc,d.posBefore))}}let a=(s||t.state.selection).content(),{dom:l,text:c,slice:u}=qf(t,a);(!n.dataTransfer.files.length||!Nt||jv>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(ls?"Text":"text/html",l.innerHTML),n.dataTransfer.effectAllowed="copyMove",ls||n.dataTransfer.setData("text/plain",c),t.dragging=new y1(u,w1(t,n),s)};Ut.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};Vt.dragover=Vt.dragenter=(t,e)=>e.preventDefault();Vt.drop=(t,e)=>{let n=e,r=t.dragging;if(t.dragging=null,!n.dataTransfer)return;let o=t.posAtCoords(Il(n));if(!o)return;let i=t.state.doc.resolve(o.pos),s=r&&r.slice;s?t.someProp("transformPasted",h=>{s=h(s,t)}):s=s1(t,g1(n.dataTransfer),ls?null:n.dataTransfer.getData("text/html"),!1,i);let a=!!(r&&w1(t,n));if(t.someProp("handleDrop",h=>h(t,n,s||ve.empty,a))){n.preventDefault();return}if(!s)return;n.preventDefault();let l=s?qb(t.state.doc,i.pos,s):i.pos;l==null&&(l=i.pos);let c=t.state.tr;if(a){let{node:h}=r;h?h.replace(c):c.deleteSelection()}let u=c.mapping.map(l),d=s.openStart==0&&s.openEnd==0&&s.content.childCount==1,f=c.doc;if(d?c.replaceRangeWith(u,u,s.content.firstChild):c.replaceRange(u,u,s),c.doc.eq(f))return;let p=c.doc.resolve(u);if(d&&De.isSelectable(s.content.firstChild)&&p.nodeAfter&&p.nodeAfter.sameMarkup(s.content.firstChild))c.setSelection(new De(p));else{let h=c.mapping.map(l);c.mapping.maps[c.mapping.maps.length-1].forEach((m,y,g,x)=>h=x),c.setSelection(jf(t,p,c.doc.resolve(h)))}t.focus(),t.dispatch(c.setMeta("uiEvent","drop"))};Ut.focus=t=>{t.input.lastFocus=Date.now(),t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout(()=>{t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.domSelectionRange())&&tr(t)},20))};Ut.blur=(t,e)=>{let n=e;t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),n.relatedTarget&&t.dom.contains(n.relatedTarget)&&t.domObserver.currentSelection.clear(),t.focused=!1)};Ut.beforeinput=(t,e)=>{if(Nt&&Zn&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:n}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=n||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",o=>o(t,qr(8,"Backspace")))))return;let{$cursor:r}=t.state.selection;r&&r.pos>0&&t.dispatch(t.state.tr.delete(r.pos-1,r.pos).scrollIntoView())},50)}};for(let t in Vt)Ut[t]=Vt[t];function us(t,e){if(t==e)return!0;for(let n in t)if(t[n]!==e[n])return!1;for(let n in e)if(!(n in t))return!1;return!0}let jg=class b1{constructor(e,n){this.toDOM=e,this.spec=n||Qr,this.side=this.spec.side||0}map(e,n,r,o){let{pos:i,deleted:s}=e.mapResult(n.from+o,this.side<0?-1:1);return s?null:new ze(i-r,i-r,this)}valid(){return!0}eq(e){return this==e||e instanceof b1&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&us(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}};class Er{constructor(e,n){this.attrs=e,this.spec=n||Qr}map(e,n,r,o){let i=e.map(n.from+o,this.spec.inclusiveStart?-1:1)-r,s=e.map(n.to+o,this.spec.inclusiveEnd?1:-1)-r;return i>=s?null:new ze(i,s,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof Er&&us(this.attrs,e.attrs)&&us(this.spec,e.spec)}static is(e){return e.type instanceof Er}destroy(){}}class Wf{constructor(e,n){this.attrs=e,this.spec=n||Qr}map(e,n,r,o){let i=e.mapResult(n.from+o,1);if(i.deleted)return null;let s=e.mapResult(n.to+o,-1);return s.deleted||s.pos<=i.pos?null:new ze(i.pos-r,s.pos-r,this)}valid(e,n){let{index:r,offset:o}=e.content.findIndex(n.from),i;return o==n.from&&!(i=e.child(r)).isText&&o+i.nodeSize==n.to}eq(e){return this==e||e instanceof Wf&&us(this.attrs,e.attrs)&&us(this.spec,e.spec)}destroy(){}}class ze{constructor(e,n,r){this.from=e,this.to=n,this.type=r}copy(e,n){return new ze(e,n,this.type)}eq(e,n=0){return this.type.eq(e.type)&&this.from+n==e.from&&this.to+n==e.to}map(e,n,r){return this.type.map(e,this,n,r)}static widget(e,n,r){return new ze(e,e,new jg(n,r))}static inline(e,n,r,o){return new ze(e,n,new Er(r,o))}static node(e,n,r,o){return new ze(e,n,new Wf(r,o))}get spec(){return this.type.spec}get inline(){return this.type instanceof Er}get widget(){return this.type instanceof jg}}const Bo=[],Qr={};class Le{constructor(e,n){this.local=e.length?e:Bo,this.children=n.length?n:Bo}static create(e,n){return n.length?Qa(n,e,0,Qr):Mt}find(e,n,r){let o=[];return this.findInner(e??0,n??1e9,o,0,r),o}findInner(e,n,r,o,i){for(let s=0;s<this.local.length;s++){let a=this.local[s];a.from<=n&&a.to>=e&&(!i||i(a.spec))&&r.push(a.copy(a.from+o,a.to+o))}for(let s=0;s<this.children.length;s+=3)if(this.children[s]<n&&this.children[s+1]>e){let a=this.children[s]+1;this.children[s+2].findInner(e-a,n-a,r,o+a,i)}}map(e,n,r){return this==Mt||e.maps.length==0?this:this.mapInner(e,n,0,0,r||Qr)}mapInner(e,n,r,o,i){let s;for(let a=0;a<this.local.length;a++){let l=this.local[a].map(e,r,o);l&&l.type.valid(n,l)?(s||(s=[])).push(l):i.onRemove&&i.onRemove(this.local[a].spec)}return this.children.length?T6(this.children,s||[],e,n,r,o,i):s?new Le(s.sort(eo),Bo):Mt}add(e,n){return n.length?this==Mt?Le.create(e,n):this.addInner(e,n,0):this}addInner(e,n,r){let o,i=0;e.forEach((a,l)=>{let c=l+r,u;if(u=k1(n,a,c)){for(o||(o=this.children.slice());i<o.length&&o[i]<l;)i+=3;o[i]==l?o[i+2]=o[i+2].addInner(a,u,c+1):o.splice(i,0,l,l+a.nodeSize,Qa(u,a,c+1,Qr)),i+=3}});let s=x1(i?S1(n):n,-r);for(let a=0;a<s.length;a++)s[a].type.valid(e,s[a])||s.splice(a--,1);return new Le(s.length?this.local.concat(s).sort(eo):this.local,o||this.children)}remove(e){return e.length==0||this==Mt?this:this.removeInner(e,0)}removeInner(e,n){let r=this.children,o=this.local;for(let i=0;i<r.length;i+=3){let s,a=r[i]+n,l=r[i+1]+n;for(let u=0,d;u<e.length;u++)(d=e[u])&&d.from>a&&d.to<l&&(e[u]=null,(s||(s=[])).push(d));if(!s)continue;r==this.children&&(r=this.children.slice());let c=r[i+2].removeInner(s,a+1);c!=Mt?r[i+2]=c:(r.splice(i,3),i-=3)}if(o.length){for(let i=0,s;i<e.length;i++)if(s=e[i])for(let a=0;a<o.length;a++)o[a].eq(s,n)&&(o==this.local&&(o=this.local.slice()),o.splice(a--,1))}return r==this.children&&o==this.local?this:o.length||r.length?new Le(o,r):Mt}forChild(e,n){if(this==Mt)return this;if(n.isLeaf)return Le.empty;let r,o;for(let a=0;a<this.children.length;a+=3)if(this.children[a]>=e){this.children[a]==e&&(r=this.children[a+2]);break}let i=e+1,s=i+n.content.size;for(let a=0;a<this.local.length;a++){let l=this.local[a];if(l.from<s&&l.to>i&&l.type instanceof Er){let c=Math.max(i,l.from)-i,u=Math.min(s,l.to)-i;c<u&&(o||(o=[])).push(l.copy(c,u))}}if(o){let a=new Le(o.sort(eo),Bo);return r?new v1([a,r]):a}return r||Mt}eq(e){if(this==e)return!0;if(!(e instanceof Le)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let n=0;n<this.local.length;n++)if(!this.local[n].eq(e.local[n]))return!1;for(let n=0;n<this.children.length;n+=3)if(this.children[n]!=e.children[n]||this.children[n+1]!=e.children[n+1]||!this.children[n+2].eq(e.children[n+2]))return!1;return!0}locals(e){return Gf(this.localsInner(e))}localsInner(e){if(this==Mt)return Bo;if(e.inlineContent||!this.local.some(Er.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof Er||n.push(this.local[r]);return n}forEachSet(e){e(this)}}Le.empty=new Le([],[]);Le.removeOverlap=Gf;const Mt=Le.empty;let v1=class Ro{constructor(e){this.members=e}map(e,n){const r=this.members.map(o=>o.map(e,n,Qr));return Ro.from(r)}forChild(e,n){if(n.isLeaf)return Le.empty;let r=[];for(let o=0;o<this.members.length;o++){let i=this.members[o].forChild(e,n);i!=Mt&&(i instanceof Ro?r=r.concat(i.members):r.push(i))}return Ro.from(r)}eq(e){if(!(e instanceof Ro)||e.members.length!=this.members.length)return!1;for(let n=0;n<this.members.length;n++)if(!this.members[n].eq(e.members[n]))return!1;return!0}locals(e){let n,r=!0;for(let o=0;o<this.members.length;o++){let i=this.members[o].localsInner(e);if(i.length)if(!n)n=i;else{r&&(n=n.slice(),r=!1);for(let s=0;s<i.length;s++)n.push(i[s])}}return n?Gf(r?n:n.sort(eo)):Bo}static from(e){switch(e.length){case 0:return Mt;case 1:return e[0];default:return new Ro(e.every(n=>n instanceof Le)?e:e.reduce((n,r)=>n.concat(r instanceof Le?r:r.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(e)}};function T6(t,e,n,r,o,i,s){let a=t.slice();for(let c=0,u=i;c<n.maps.length;c++){let d=0;n.maps[c].forEach((f,p,h,m)=>{let y=m-h-(p-f);for(let g=0;g<a.length;g+=3){let x=a[g+1];if(x<0||f>x+u-d)continue;let k=a[g]+u-d;p>=k?a[g+1]=f<=k?-2:-1:f>=u&&y&&(a[g]+=y,a[g+1]+=y)}d+=y}),u=n.maps[c].map(u,-1)}let l=!1;for(let c=0;c<a.length;c+=3)if(a[c+1]<0){if(a[c+1]==-2){l=!0,a[c+1]=-1;continue}let u=n.map(t[c]+i),d=u-o;if(d<0||d>=r.content.size){l=!0;continue}let f=n.map(t[c+1]+i,-1),p=f-o,{index:h,offset:m}=r.content.findIndex(d),y=r.maybeChild(h);if(y&&m==d&&m+y.nodeSize==p){let g=a[c+2].mapInner(n,y,u+1,t[c]+i+1,s);g!=Mt?(a[c]=d,a[c+1]=p,a[c+2]=g):(a[c+1]=-2,l=!0)}else l=!0}if(l){let c=$6(a,t,e,n,o,i,s),u=Qa(c,r,0,s);e=u.local;for(let d=0;d<a.length;d+=3)a[d+1]<0&&(a.splice(d,3),d-=3);for(let d=0,f=0;d<u.children.length;d+=3){let p=u.children[d];for(;f<a.length&&a[f]<p;)f+=3;a.splice(f,0,u.children[d],u.children[d+1],u.children[d+2])}}return new Le(e.sort(eo),a)}function x1(t,e){if(!e||!t.length)return t;let n=[];for(let r=0;r<t.length;r++){let o=t[r];n.push(new ze(o.from+e,o.to+e,o.type))}return n}function $6(t,e,n,r,o,i,s){function a(l,c){for(let u=0;u<l.local.length;u++){let d=l.local[u].map(r,o,c);d?n.push(d):s.onRemove&&s.onRemove(l.local[u].spec)}for(let u=0;u<l.children.length;u+=3)a(l.children[u+2],l.children[u]+c+1)}for(let l=0;l<t.length;l+=3)t[l+1]==-1&&a(t[l+2],e[l]+i+1);return n}function k1(t,e,n){if(e.isLeaf)return null;let r=n+e.nodeSize,o=null;for(let i=0,s;i<t.length;i++)(s=t[i])&&s.from>n&&s.to<r&&((o||(o=[])).push(s),t[i]=null);return o}function S1(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function Qa(t,e,n,r){let o=[],i=!1;e.forEach((a,l)=>{let c=k1(t,a,l+n);if(c){i=!0;let u=Qa(c,a,n+l+1,r);u!=Mt&&o.push(l,l+a.nodeSize,u)}});let s=x1(i?S1(t):t,-n).sort(eo);for(let a=0;a<s.length;a++)s[a].type.valid(e,s[a])||(r.onRemove&&r.onRemove(s[a].spec),s.splice(a--,1));return s.length||o.length?new Le(s,o):Mt}function eo(t,e){return t.from-e.from||t.to-e.to}function Gf(t){let e=t;for(let n=0;n<e.length-1;n++){let r=e[n];if(r.from!=r.to)for(let o=n+1;o<e.length;o++){let i=e[o];if(i.from==r.from){i.to!=r.to&&(e==t&&(e=t.slice()),e[o]=i.copy(i.from,r.to),qg(e,o+1,i.copy(r.to,i.to)));continue}else{i.from<r.to&&(e==t&&(e=t.slice()),e[n]=r.copy(r.from,i.from),qg(e,o,r.copy(i.from,r.to)));break}}}return e}function qg(t,e,n){for(;e<t.length&&eo(n,t[e])>0;)e++;t.splice(e,0,n)}function iu(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=Mt&&e.push(r)}),t.cursorWrapper&&e.push(Le.create(t.state.doc,[t.cursorWrapper.deco])),v1.from(e)}const O6={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},M6=Gt&&Cr<=11;let _6=class{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}},N6=class{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new _6,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let o=0;o<r.length;o++)this.queue.push(r[o]);Gt&&Cr<=11&&r.some(o=>o.type=="childList"&&o.removedNodes.length||o.type=="characterData"&&o.oldValue.length>o.target.nodeValue.length)?this.flushSoon():this.flush()}),M6&&(this.onCharData=r=>{this.queue.push({target:r.target,type:"characterData",oldValue:r.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,O6)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let n=0;n<e.length;n++)this.queue.push(e[n]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(Dg(this.view)){if(this.suppressingSelectionUpdates)return tr(this.view);if(Gt&&Cr<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&co(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let n=new Set,r;for(let i=e.focusNode;i;i=Qo(i))n.add(i);for(let i=e.anchorNode;i;i=Qo(i))if(n.has(i)){r=i;break}let o=r&&this.view.docView.nearestDesc(r);if(o&&o.ignoreMutation({type:"selection",target:r.nodeType==3?r.parentNode:r}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let n=this.pendingRecords();n.length&&(this.queue=[]);let r=e.domSelectionRange(),o=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&Dg(e)&&!this.ignoreSelectionChange(r),i=-1,s=-1,a=!1,l=[];if(e.editable)for(let u=0;u<n.length;u++){let d=this.registerMutation(n[u],l);d&&(i=i<0?d.from:Math.min(d.from,i),s=s<0?d.to:Math.max(d.to,s),d.typeOver&&(a=!0))}if(wn&&l.length){let u=l.filter(d=>d.nodeName=="BR");if(u.length==2){let[d,f]=u;d.parentNode&&d.parentNode.parentNode==f.parentNode?f.remove():d.remove()}else{let{focusNode:d}=this.currentSelection;for(let f of u){let p=f.parentNode;p&&p.nodeName=="LI"&&(!d||F6(e,d)!=p)&&f.remove()}}}let c=null;i<0&&o&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&Dl(r)&&(c=zf(e))&&c.eq(Re.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,tr(e),this.currentSelection.set(r),e.scrollToSelection()):(i>-1||o)&&(i>-1&&(e.docView.markDirty(i,s),D6(e)),this.handleDOMChange(i,s,a,l),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||tr(e),this.currentSelection.set(r))}registerMutation(e,n){if(n.indexOf(e.target)>-1)return null;let r=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(r==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!r||r.ignoreMutation(e))return null;if(e.type=="childList"){for(let u=0;u<e.addedNodes.length;u++){let d=e.addedNodes[u];n.push(d),d.nodeType==3&&(this.lastChangedTextNode=d)}if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(e.target))return{from:r.posBefore,to:r.posAfter};let o=e.previousSibling,i=e.nextSibling;if(Gt&&Cr<=11&&e.addedNodes.length)for(let u=0;u<e.addedNodes.length;u++){let{previousSibling:d,nextSibling:f}=e.addedNodes[u];(!d||Array.prototype.indexOf.call(e.addedNodes,d)<0)&&(o=d),(!f||Array.prototype.indexOf.call(e.addedNodes,f)<0)&&(i=f)}let s=o&&o.parentNode==e.target?At(o)+1:0,a=r.localPosFromDOM(e.target,s,-1),l=i&&i.parentNode==e.target?At(i):e.target.childNodes.length,c=r.localPosFromDOM(e.target,l,1);return{from:a,to:c}}else return e.type=="attributes"?{from:r.posAtStart-r.border,to:r.posAtEnd+r.border}:(this.lastChangedTextNode=e.target,{from:r.posAtStart,to:r.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}},Ug=new WeakMap,Vg=!1;function D6(t){if(!Ug.has(t)&&(Ug.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=wn,Vg)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."),Vg=!0}}function Hg(t,e){let n=e.startContainer,r=e.startOffset,o=e.endContainer,i=e.endOffset,s=t.domAtPos(t.state.selection.anchor);return co(s.node,s.offset,o,i)&&([n,r,o,i]=[o,i,n,r]),{anchorNode:n,anchorOffset:r,focusNode:o,focusOffset:i}}function I6(t,e){if(e.getComposedRanges){let o=e.getComposedRanges(t.root)[0];if(o)return Hg(t,o)}let n;function r(o){o.preventDefault(),o.stopImmediatePropagation(),n=o.getTargetRanges()[0]}return t.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),t.dom.removeEventListener("beforeinput",r,!0),n?Hg(t,n):null}function F6(t,e){for(let n=e.parentNode;n&&n!=t.dom;n=n.parentNode){let r=t.docView.nearestDesc(n,!0);if(r&&r.node.isBlock)return n}return null}function B6(t,e,n){let{node:r,fromOffset:o,toOffset:i,from:s,to:a}=t.docView.parseRange(e,n),l=t.domSelectionRange(),c,u=l.anchorNode;if(u&&t.dom.contains(u.nodeType==1?u:u.parentNode)&&(c=[{node:u,offset:l.anchorOffset}],Dl(l)||c.push({node:l.focusNode,offset:l.focusOffset})),Nt&&t.input.lastKeyCode===8)for(let y=i;y>o;y--){let g=r.childNodes[y-1],x=g.pmViewDesc;if(g.nodeName=="BR"&&!x){i=y;break}if(!x||x.size)break}let d=t.state.doc,f=t.someProp("domParser")||Zr.fromSchema(t.state.schema),p=d.resolve(s),h=null,m=f.parse(r,{topNode:p.parent,topMatch:p.parent.contentMatchAt(p.index()),topOpen:!0,from:o,to:i,preserveWhitespace:p.parent.type.whitespace=="pre"?"full":!0,findPositions:c,ruleFromNode:R6,context:p});if(c&&c[0].pos!=null){let y=c[0].pos,g=c[1]&&c[1].pos;g==null&&(g=y),h={anchor:y+s,head:g+s}}return{doc:m,sel:h,from:s,to:a}}function R6(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(qt&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){let n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}else if(t.parentNode.lastChild==t||qt&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if(t.nodeName=="IMG"&&t.getAttribute("mark-placeholder"))return{ignore:!0};return null}const L6=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function P6(t,e,n,r,o){let i=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let C=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,V=zf(t,C);if(V&&!t.state.selection.eq(V)){if(Nt&&Zn&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",I=>I(t,qr(13,"Enter"))))return;let ie=t.state.tr.setSelection(V);C=="pointer"?ie.setMeta("pointer",!0):C=="key"&&ie.scrollIntoView(),i&&ie.setMeta("composition",i),t.dispatch(ie)}return}let s=t.state.doc.resolve(e),a=s.sharedDepth(n);e=s.before(a+1),n=t.state.doc.resolve(n).after(a+1);let l=t.state.selection,c=B6(t,e,n),u=t.state.doc,d=u.slice(c.from,c.to),f,p;t.input.lastKeyCode===8&&Date.now()-100<t.input.lastKeyCodeTime?(f=t.state.selection.to,p="end"):(f=t.state.selection.from,p="start"),t.input.lastKeyCode=null;let h=q6(d.content,c.doc.content,c.from,f,p);if(h&&t.input.domChangeCount++,(ei&&t.input.lastIOSEnter>Date.now()-225||Zn)&&o.some(C=>C.nodeType==1&&!L6.test(C.nodeName))&&(!h||h.endA>=h.endB)&&t.someProp("handleKeyDown",C=>C(t,qr(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!h)if(r&&l instanceof Pe&&!l.empty&&l.$head.sameParent(l.$anchor)&&!t.composing&&!(c.sel&&c.sel.anchor!=c.sel.head))h={start:l.from,endA:l.to,endB:l.to};else{if(c.sel){let C=Wg(t,t.state.doc,c.sel);if(C&&!C.eq(t.state.selection)){let V=t.state.tr.setSelection(C);i&&V.setMeta("composition",i),t.dispatch(V)}}return}t.state.selection.from<t.state.selection.to&&h.start==h.endB&&t.state.selection instanceof Pe&&(h.start>t.state.selection.from&&h.start<=t.state.selection.from+2&&t.state.selection.from>=c.from?h.start=t.state.selection.from:h.endA<t.state.selection.to&&h.endA>=t.state.selection.to-2&&t.state.selection.to<=c.to&&(h.endB+=t.state.selection.to-h.endA,h.endA=t.state.selection.to)),Gt&&Cr<=11&&h.endB==h.start+1&&h.endA==h.start&&h.start>c.from&&c.doc.textBetween(h.start-c.from-1,h.start-c.from+1)=="  "&&(h.start--,h.endA--,h.endB--);let m=c.doc.resolveNoCache(h.start-c.from),y=c.doc.resolveNoCache(h.endB-c.from),g=u.resolve(h.start),x=m.sameParent(y)&&m.parent.inlineContent&&g.end()>=h.endA,k;if((ei&&t.input.lastIOSEnter>Date.now()-225&&(!x||o.some(C=>C.nodeName=="DIV"||C.nodeName=="P"))||!x&&m.pos<c.doc.content.size&&(!m.sameParent(y)||!m.parent.inlineContent)&&(k=Re.findFrom(c.doc.resolve(m.pos+1),1,!0))&&k.head>m.pos)&&t.someProp("handleKeyDown",C=>C(t,qr(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>h.start&&j6(u,h.start,h.endA,m,y)&&t.someProp("handleKeyDown",C=>C(t,qr(8,"Backspace")))){Zn&&Nt&&t.domObserver.suppressSelectionUpdates();return}Nt&&h.endB==h.start&&(t.input.lastChromeDelete=Date.now()),Zn&&!x&&m.start()!=y.start()&&y.parentOffset==0&&m.depth==y.depth&&c.sel&&c.sel.anchor==c.sel.head&&c.sel.head==h.endA&&(h.endB-=2,y=c.doc.resolveNoCache(h.endB-c.from),setTimeout(()=>{t.someProp("handleKeyDown",function(C){return C(t,qr(13,"Enter"))})},20));let b=h.start,T=h.endA,M,_,F;if(x){if(m.pos==y.pos)Gt&&Cr<=11&&m.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>tr(t),20)),M=t.state.tr.delete(b,T),_=u.resolve(h.start).marksAcross(u.resolve(h.endA));else if(h.endA==h.endB&&(F=z6(m.parent.content.cut(m.parentOffset,y.parentOffset),g.parent.content.cut(g.parentOffset,h.endA-g.start()))))M=t.state.tr,F.type=="add"?M.addMark(b,T,F.mark):M.removeMark(b,T,F.mark);else if(m.parent.child(m.index()).isText&&m.index()==y.index()-(y.textOffset?0:1)){let C=m.parent.textBetween(m.parentOffset,y.parentOffset);if(t.someProp("handleTextInput",V=>V(t,b,T,C)))return;M=t.state.tr.insertText(C,b,T)}}if(M||(M=t.state.tr.replace(b,T,c.doc.slice(h.start-c.from,h.endB-c.from))),c.sel){let C=Wg(t,M.doc,c.sel);C&&!(Nt&&t.composing&&C.empty&&(h.start!=h.endB||t.input.lastChromeDelete<Date.now()-100)&&(C.head==b||C.head==M.mapping.map(T)-1)||Gt&&C.empty&&C.head==b)&&M.setSelection(C)}_&&M.ensureMarks(_),i&&M.setMeta("composition",i),t.dispatch(M.scrollIntoView())}function Wg(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:jf(t,e.resolve(n.anchor),e.resolve(n.head))}function z6(t,e){let n=t.firstChild.marks,r=e.firstChild.marks,o=n,i=r,s,a,l;for(let u=0;u<r.length;u++)o=r[u].removeFromSet(o);for(let u=0;u<n.length;u++)i=n[u].removeFromSet(i);if(o.length==1&&i.length==0)a=o[0],s="add",l=u=>u.mark(a.addToSet(u.marks));else if(o.length==0&&i.length==1)a=i[0],s="remove",l=u=>u.mark(a.removeFromSet(u.marks));else return null;let c=[];for(let u=0;u<e.childCount;u++)c.push(l(e.child(u)));if(ye.from(c).eq(t))return{mark:a,type:s}}function j6(t,e,n,r,o){if(n-e<=o.pos-r.pos||su(r,!0,!1)<o.pos)return!1;let i=t.resolve(e);if(!r.parent.isTextblock){let a=i.nodeAfter;return a!=null&&n==e+a.nodeSize}if(i.parentOffset<i.parent.content.size||!i.parent.isTextblock)return!1;let s=t.resolve(su(i,!0,!0));return!s.parent.isTextblock||s.pos>n||su(s,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(s.parent.content)}function su(t,e,n){let r=t.depth,o=e?t.end():t.pos;for(;r>0&&(e||t.indexAfter(r)==t.node(r).childCount);)r--,o++,e=!1;if(n){let i=t.node(r).maybeChild(t.indexAfter(r));for(;i&&!i.isLeaf;)i=i.firstChild,o++}return o}function q6(t,e,n,r,o){let i=t.findDiffStart(e,n);if(i==null)return null;let{a:s,b:a}=t.findDiffEnd(e,n+t.size,n+e.size);if(o=="end"){let l=Math.max(0,i-Math.min(s,a));r-=s+l-i}if(s<i&&t.size<e.size){let l=r<=i&&r>=s?i-r:0;i-=l,i&&i<e.size&&Gg(e.textBetween(i-1,i+1))&&(i+=l?1:-1),a=i+(a-s),s=i}else if(a<i){let l=r<=i&&r>=a?i-r:0;i-=l,i&&i<t.size&&Gg(t.textBetween(i-1,i+1))&&(i+=l?1:-1),s=i+(s-a),a=i}return{start:i,endA:s,endB:a}}function Gg(t){if(t.length!=2)return!1;let e=t.charCodeAt(0),n=t.charCodeAt(1);return e>=56320&&e<=57343&&n>=55296&&n<=56319}let C1=class{constructor(e,n){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 a6,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(Zg),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):typeof e=="function"?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=Xg(this),Jg(this),this.nodeViews=Yg(this),this.docView=Tg(this.state.doc,Kg(this),iu(this),this.dom,this),this.domObserver=new N6(this,(r,o,i,s)=>P6(this,r,o,i,s)),this.domObserver.start(),l6(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let n in e)this._props[n]=e[n];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&vd(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(Zg),this.directPlugins=e.plugins),this.updateStateInner(e.state,n)}setProps(e){let n={};for(let r in this._props)n[r]=this._props[r];n.state=this.state;for(let r in e)n[r]=e[r];this.update(n)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,n){var r;let o=this.state,i=!1,s=!1;e.storedMarks&&this.composing&&(m1(this),s=!0),this.state=e;let a=o.plugins!=e.plugins||this._props.plugins!=n.plugins;if(a||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let p=Yg(this);V6(p,this.nodeViews)&&(this.nodeViews=p,i=!0)}(a||n.handleDOMEvents!=this._props.handleDOMEvents)&&vd(this),this.editable=Xg(this),Jg(this);let l=iu(this),c=Kg(this),u=o.plugins!=e.plugins&&!o.doc.eq(e.doc)?"reset":e.scrollToSelection>o.scrollToSelection?"to selection":"preserve",d=i||!this.docView.matchesNode(e.doc,c,l);(d||!e.selection.eq(o.selection))&&(s=!0);let f=u=="preserve"&&s&&this.dom.style.overflowAnchor==null&&kT(this);if(s){this.domObserver.stop();let p=d&&(Gt||Nt)&&!this.composing&&!o.selection.empty&&!e.selection.empty&&U6(o.selection,e.selection);if(d){let h=Nt?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=x6(this)),(i||!this.docView.update(e.doc,c,l,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=Tg(e.doc,c,l,this.dom,this)),h&&!this.trackWrites&&(p=!0)}p||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&WT(this))?tr(this,p):(r1(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(o),!((r=this.dragging)===null||r===void 0)&&r.node&&!o.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,o),u=="reset"?this.dom.scrollTop=0:u=="to selection"?this.scrollToSelection():f&&ST(f)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))&&!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof De){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&xg(this,n.getBoundingClientRect(),e)}else xg(this,this.coordsAtPos(this.state.selection.head,1),e)}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let n=0;n<this.directPlugins.length;n++){let r=this.directPlugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}for(let n=0;n<this.state.plugins.length;n++){let r=this.state.plugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}}else for(let n=0;n<this.pluginViews.length;n++){let r=this.pluginViews[n];r.update&&r.update(this,e)}}updateDraggedNode(e,n){let r=e.node,o=-1;if(this.state.doc.nodeAt(r.from)==r.node)o=r.from;else{let i=r.from+(this.state.doc.content.size-n.doc.content.size);(i>0&&this.state.doc.nodeAt(i))==r.node&&(o=i)}this.dragging=new y1(e.slice,e.move,o<0?void 0:De.create(this.state.doc,o))}someProp(e,n){let r=this._props&&this._props[e],o;if(r!=null&&(o=n?n(r):r))return o;for(let s=0;s<this.directPlugins.length;s++){let a=this.directPlugins[s].props[e];if(a!=null&&(o=n?n(a):a))return o}let i=this.state.plugins;if(i)for(let s=0;s<i.length;s++){let a=i[s].props[e];if(a!=null&&(o=n?n(a):a))return o}}hasFocus(){if(Gt){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if(e.contentEditable=="false")return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&CT(this.dom),tr(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let n=this.dom.parentNode;n;n=n.parentNode)if(n.nodeType==9||n.nodeType==11&&n.host)return n.getSelection||(Object.getPrototypeOf(n).getSelection=()=>n.ownerDocument.getSelection()),this._root=n}return e||document}updateRoot(){this._root=null}posAtCoords(e){return OT(this,e)}coordsAtPos(e,n=1){return Wv(this,e,n)}domAtPos(e,n=0){return this.docView.domFromPos(e,n)}nodeDOM(e){let n=this.docView.descAt(e);return n?n.nodeDOM:null}posAtDOM(e,n,r=-1){let o=this.docView.posFromDOM(e,n,r);if(o==null)throw new RangeError("DOM position not inside the editor");return o}endOfTextblock(e,n){return IT(this,n||this.state,e)}pasteHTML(e,n){return cs(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return cs(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return qf(this,e)}destroy(){this.docView&&(c6(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],iu(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,dT())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return d6(this,e)}dispatch(e){let n=this._props.dispatchTransaction;n?n.call(this,e):this.updateState(this.state.apply(e))}domSelectionRange(){let e=this.domSelection();return e?qt&&this.root.nodeType===11&&gT(this.dom.ownerDocument)==this.dom&&I6(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}};function Kg(t){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(t.editable),t.someProp("attributes",n=>{if(typeof n=="function"&&(n=n(t.state)),n)for(let r in n)r=="class"?e.class+=" "+n[r]:r=="style"?e.style=(e.style?e.style+";":"")+n[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(n[r]))}),e.translate||(e.translate="no"),[ze.node(0,t.state.doc.content.size,e)]}function Jg(t){if(t.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),t.cursorWrapper={dom:e,deco:ze.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function Xg(t){return!t.someProp("editable",e=>e(t.state)===!1)}function U6(t,e){let n=Math.min(t.$anchor.sharedDepth(t.head),e.$anchor.sharedDepth(e.head));return t.$anchor.start(n)!=e.$anchor.start(n)}function Yg(t){let e=Object.create(null);function n(r){for(let o in r)Object.prototype.hasOwnProperty.call(e,o)||(e[o]=r[o])}return t.someProp("nodeViews",n),t.someProp("markViews",n),e}function V6(t,e){let n=0,r=0;for(let o in t){if(t[o]!=e[o])return!0;n++}for(let o in e)r++;return n!=r}function Zg(t){if(t.spec.state||t.spec.filterTransaction||t.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}const ds=Math.floor,H6=Math.abs,Ar=(t,e)=>t<e?t:e,ti=(t,e)=>t>e?t:e,W6=t=>t!==0?t<0:1/t<0,G6=64,fs=128,K6=1<<29,Qg=63,Ki=127,J6=2147483647,X6=Number.isInteger||(t=>typeof t=="number"&&isFinite(t)&&ds(t)===t),Y6=()=>new Set,Z6=Array.isArray,Q6=String.fromCharCode,e$=t=>t.toLowerCase(),t$=/^\s*/g,n$=t=>t.replace(t$,""),r$=/([A-Z])/g,ey=(t,e)=>n$(t.replace(r$,n=>`${e}${e$(n)}`)),o$=t=>{const e=unescape(encodeURIComponent(t)),n=e.length,r=new Uint8Array(n);for(let o=0;o<n;o++)r[o]=e.codePointAt(o);return r},ps=typeof TextEncoder<"u"?new TextEncoder:null,i$=t=>ps.encode(t),s$=ps?i$:o$;let au=typeof TextDecoder>"u"?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});au&&au.decode(new Uint8Array).length===1&&(au=null);let a$=class{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}};const l$=()=>new a$,c$=t=>{const e=l$();return t(e),d$(e)},u$=t=>{let e=t.cpos;for(let n=0;n<t.bufs.length;n++)e+=t.bufs[n].length;return e},d$=t=>{const e=new Uint8Array(u$(t));let n=0;for(let r=0;r<t.bufs.length;r++){const o=t.bufs[r];e.set(o,n),n+=o.length}return e.set(new Uint8Array(t.cbuf.buffer,0,t.cpos),n),e},f$=(t,e)=>{const n=t.cbuf.length;n-t.cpos<e&&(t.bufs.push(new Uint8Array(t.cbuf.buffer,0,t.cpos)),t.cbuf=new Uint8Array(ti(n,e)*2),t.cpos=0)},Et=(t,e)=>{const n=t.cbuf.length;t.cpos===n&&(t.bufs.push(t.cbuf),t.cbuf=new Uint8Array(n*2),t.cpos=0),t.cbuf[t.cpos++]=e},hs=(t,e)=>{for(;e>Ki;)Et(t,fs|Ki&e),e=ds(e/128);Et(t,Ki&e)},p$=(t,e)=>{const n=W6(e);for(n&&(e=-e),Et(t,(e>Qg?fs:0)|(n?G6:0)|Qg&e),e=ds(e/64);e>0;)Et(t,(e>Ki?fs:0)|Ki&e),e=ds(e/128)},xd=new Uint8Array(3e4),h$=xd.length/3,m$=(t,e)=>{if(e.length<h$){const n=ps.encodeInto(e,xd).written||0;hs(t,n);for(let r=0;r<n;r++)Et(t,xd[r])}else E1(t,s$(e))},g$=(t,e)=>{const n=unescape(encodeURIComponent(e)),r=n.length;hs(t,r);for(let o=0;o<r;o++)Et(t,n.codePointAt(o))},ty=ps&&ps.encodeInto?m$:g$,y$=(t,e)=>{const n=t.cbuf.length,r=t.cpos,o=Ar(n-r,e.length),i=e.length-o;t.cbuf.set(e.subarray(0,o),r),t.cpos+=o,i>0&&(t.bufs.push(t.cbuf),t.cbuf=new Uint8Array(ti(n*2,i)),t.cbuf.set(e.subarray(o)),t.cpos=i)},E1=(t,e)=>{hs(t,e.byteLength),y$(t,e)},Kf=(t,e)=>{f$(t,e);const n=new DataView(t.cbuf.buffer,t.cpos,e);return t.cpos+=e,n},w$=(t,e)=>Kf(t,4).setFloat32(0,e,!1),b$=(t,e)=>Kf(t,8).setFloat64(0,e,!1),v$=(t,e)=>Kf(t,8).setBigInt64(0,e,!1),ny=new DataView(new ArrayBuffer(4)),x$=t=>(ny.setFloat32(0,t),ny.getFloat32(0)===t),kd=(t,e)=>{switch(typeof e){case"string":Et(t,119),ty(t,e);break;case"number":X6(e)&&H6(e)<=J6?(Et(t,125),p$(t,e)):x$(e)?(Et(t,124),w$(t,e)):(Et(t,123),b$(t,e));break;case"bigint":Et(t,122),v$(t,e);break;case"object":if(e===null)Et(t,126);else if(Z6(e)){Et(t,117),hs(t,e.length);for(let n=0;n<e.length;n++)kd(t,e[n])}else if(e instanceof Uint8Array)Et(t,116),E1(t,e);else{Et(t,118);const n=Object.keys(e);hs(t,n.length);for(let r=0;r<n.length;r++){const o=n[r];ty(t,o),kd(t,e[o])}}break;case"boolean":Et(t,e?120:121);break;default:Et(t,127)}},A1=t=>new Error(t),k$=()=>{throw A1("Method unimplemented")},T1=()=>{throw A1("Unexpected case")},Oa=()=>new Map,$1=(t,e,n)=>{let r=t.get(e);return r===void 0&&t.set(e,r=n()),r},S$=Object.keys,C$=(t,e)=>{for(const n in t)if(!e(t[n],n))return!1;return!0},E$=(t,e)=>e.includes(t),A$=()=>{let t=!0;return(e,n)=>{if(t){t=!1;try{e()}finally{t=!0}}else n!==void 0&&n()}},T$=/[\uD800-\uDBFF]/,$$=/[\uDC00-\uDFFF]/,O$=(t,e)=>{let n=0,r=0;for(;n<t.length&&n<e.length&&t[n]===e[n];)n++;for(n>0&&T$.test(t[n-1])&&n--;r+n<t.length&&r+n<e.length&&t[t.length-r-1]===e[e.length-r-1];)r++;return r>0&&$$.test(t[t.length-r])&&r--,{index:n,remove:t.length-n-r,insert:e.slice(n,e.length-r)}},M$=O$,nt=new tt("y-sync"),Tr=new tt("y-undo"),Ys=new tt("yjs-cursor"),_$=Math.random,N$=t=>t[ds(_$()*t.length)],D$=t=>t===void 0?null:t;class I${constructor(){this.map=new Map}setItem(e,n){this.map.set(e,n)}getItem(e){return this.map.get(e)}}let O1=new I$,F$=!0;try{typeof localStorage<"u"&&localStorage&&(O1=localStorage,F$=!1)}catch{}const B$=O1,ni=typeof Se<"u"&&Se.release&&/node|io\.js/.test(Se.release.name)&&Object.prototype.toString.call(typeof Se<"u"?Se:0)==="[object process]",M1=typeof window<"u"&&typeof document<"u"&&!ni;let kn;const R$=()=>{if(kn===void 0)if(ni){kn=Oa();const t=Se.argv;let e=null;for(let n=0;n<t.length;n++){const r=t[n];r[0]==="-"?(e!==null&&kn.set(e,""),e=r):e!==null&&(kn.set(e,r),e=null)}e!==null&&kn.set(e,"")}else typeof location=="object"?(kn=Oa(),(location.search||"?").slice(1).split("&").forEach(t=>{if(t.length!==0){const[e,n]=t.split("=");kn.set(`--${ey(e,"-")}`,n),kn.set(`-${ey(e,"-")}`,n)}})):kn=Oa();return kn},Sd=t=>R$().has(t),Cd=t=>D$(ni?Se.env[t.toUpperCase().replaceAll("-","_")]:B$.getItem(t)),_1=t=>Sd("--"+t)||Cd(t)!==null;_1("production");const L$=ni&&E$(Se.env.FORCE_COLOR,["true","1","2"]);L$||!Sd("--no-colors")&&!_1("no-color")&&(!ni||Se.stdout.isTTY)&&(!ni||Sd("--color")||Cd("COLORTERM")!==null||(Cd("TERM")||"").includes("color"));const P$=typeof document<"u"?document:{};typeof DOMParser<"u"&&new DOMParser;const z$=t=>class{constructor(e){this._=e}destroy(){t(this._)}},j$=z$(clearTimeout),Jf=(t,e)=>new j$(setTimeout(e,t)),Nn=(t,e)=>t>>>e|t<<32-e,q$=t=>Nn(t,2)^Nn(t,13)^Nn(t,22),U$=t=>Nn(t,6)^Nn(t,11)^Nn(t,25),V$=t=>Nn(t,7)^Nn(t,18)^t>>>3,H$=t=>Nn(t,17)^Nn(t,19)^t>>>10,W$=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),G$=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]);class K${constructor(){const e=new ArrayBuffer(320);this._H=new Uint32Array(e,0,8),this._H.set(G$),this._W=new Uint32Array(e,64,64)}_updateHash(){const e=this._H,n=this._W;for(let d=16;d<64;d++)n[d]=H$(n[d-2])+n[d-7]+V$(n[d-15])+n[d-16];let r=e[0],o=e[1],i=e[2],s=e[3],a=e[4],l=e[5],c=e[6],u=e[7];for(let d=0,f,p;d<64;d++)f=u+U$(a)+(a&l^~a&c)+W$[d]+n[d]>>>0,p=q$(r)+(r&o^r&i^o&i)>>>0,u=c,c=l,l=a,a=s+f>>>0,s=i,i=o,o=r,r=f+p>>>0;e[0]+=r,e[1]+=o,e[2]+=i,e[3]+=s,e[4]+=a,e[5]+=l,e[6]+=c,e[7]+=u}digest(e){let n=0;for(;n+56<=e.length;){let s=0;for(;s<16&&n+3<e.length;s++)this._W[s]=e[n++]<<24|e[n++]<<16|e[n++]<<8|e[n++];if(n%64!==0){for(this._W.fill(0,s,16);n<e.length;)this._W[s]|=e[n]<<(3-n%4)*8,n++;this._W[s]|=fs<<(3-n%4)*8}this._updateHash()}const r=n%64!==0;this._W.fill(0,0,16);let o=0;for(;n<e.length;o++)for(let s=3;s>=0&&n<e.length;s--)this._W[o]|=e[n++]<<s*8;r||(this._W[o-(n%4===0?0:1)]|=fs<<(3-n%4)*8),this._W[14]=e.byteLength/K6,this._W[15]=e.byteLength*8,this._updateHash();const i=new Uint8Array(32);for(let s=0;s<this._H.length;s++)for(let a=0;a<4;a++)i[s*4+a]=this._H[s]>>>(3-a)*8;return i}}const J$=t=>new K$().digest(t),X$=t=>{let e="";for(let n=0;n<t.byteLength;n++)e+=Q6(t[n]);return btoa(e)},Y$=t=>wt.from(t.buffer,t.byteOffset,t.byteLength).toString("base64"),Z$=M1?X$:Y$,Q$=t=>c$(e=>kd(e,t)),eO=t=>{for(let e=6;e<t.length;e++)t[e%6]=t[e%6]^t[e];return t.slice(0,6)},tO=t=>Z$(eO(J$(Q$(t)))),nO=()=>({mapping:new Map,isOMark:new Map}),el=(t,e)=>e===void 0?!t.deleted:e.sv.has(t.id.client)&&e.sv.get(t.id.client)>t.id.clock&&!Ae.isDeleted(e.ds,t.id),rO=[{light:"#ecd44433",dark:"#ecd444"}],oO=(t,e,n)=>{if(!t.has(n)){if(t.size<e.length){const r=Y6();t.forEach(o=>r.add(o)),e=e.filter(o=>!r.has(o))}t.set(n,N$(e))}return t.get(n)},iO=(t,{colors:e=rO,colorMapping:n=new Map,permanentUserData:r=null,onFirstRender:o=()=>{},mapping:i}={})=>{let s=!1;const a=new aO(t,i),l=new Qe({props:{editable:c=>{const u=nt.getState(c);return u.snapshot==null&&u.prevSnapshot==null}},key:nt,state:{init:(c,u)=>({type:t,doc:t.doc,binding:a,snapshot:null,prevSnapshot:null,isChangeOrigin:!1,isUndoRedoOperation:!1,addToHistory:!0,colors:e,colorMapping:n,permanentUserData:r}),apply:(c,u)=>{const d=c.getMeta(nt);if(d!==void 0){u=Object.assign({},u);for(const f in d)u[f]=d[f]}return u.addToHistory=c.getMeta("addToHistory")!==!1,u.isChangeOrigin=d!==void 0&&!!d.isChangeOrigin,u.isUndoRedoOperation=d!==void 0&&!!d.isChangeOrigin&&!!d.isUndoRedoOperation,a.prosemirrorView!==null&&d!==void 0&&(d.snapshot!=null||d.prevSnapshot!=null)&&Jf(0,()=>{a.prosemirrorView!=null&&(d.restore==null?a._renderSnapshot(d.snapshot,d.prevSnapshot,u):(a._renderSnapshot(d.snapshot,d.snapshot,u),delete u.restore,delete u.snapshot,delete u.prevSnapshot,a.mux(()=>{a._prosemirrorChanged(a.prosemirrorView.state.doc)})))}),u}},view:c=>(a.initView(c),i==null&&a._forceRerender(),o(),{update:()=>{const u=l.getState(c.state);if(u.snapshot==null&&u.prevSnapshot==null&&(s||c.state.doc.content.findDiffStart(c.state.doc.type.createAndFill().content)!==null)){if(s=!0,u.addToHistory===!1&&!u.isChangeOrigin){const d=Tr.getState(c.state),f=d&&d.undoManager;f&&f.stopCapturing()}a.mux(()=>{u.doc.transact(d=>{d.meta.set("addToHistory",u.addToHistory),a._prosemirrorChanged(c.state.doc)},nt)})}},destroy:()=>{a.destroy()}})});return l},sO=(t,e,n)=>{if(e!==null&&e.anchor!==null&&e.head!==null)if(e.type==="all")t.setSelection(new _n(t.doc));else{const r=gs(n.doc,n.type,e.anchor,n.mapping),o=gs(n.doc,n.type,e.head,n.mapping);r!==null&&o!==null&&(t=t.setSelection(Pe.create(t.doc,r,o)))}},Ed=(t,e)=>({type:e.selection.jsonID,anchor:nl(e.selection.anchor,t.type,t.mapping),head:nl(e.selection.head,t.type,t.mapping)});class aO{constructor(e,n=new Map){this.type=e,this.prosemirrorView=null,this.mux=A$(),this.mapping=n,this.isOMark=new Map,this._observeFunction=this._typeChanged.bind(this),this.doc=e.doc,this.beforeTransactionSelection=null,this.beforeAllTransactions=()=>{this.beforeTransactionSelection===null&&this.prosemirrorView!=null&&(this.beforeTransactionSelection=Ed(this,this.prosemirrorView.state))},this.afterAllTransactions=()=>{this.beforeTransactionSelection=null},this._domSelectionInView=null}get _tr(){return this.prosemirrorView.state.tr.setMeta("addToHistory",!1)}_isLocalCursorInView(){return this.prosemirrorView.hasFocus()?(M1&&this._domSelectionInView===null&&(Jf(0,()=>{this._domSelectionInView=null}),this._domSelectionInView=this._isDomSelectionInView()),this._domSelectionInView):!1}_isDomSelectionInView(){const e=this.prosemirrorView._root.getSelection();if(e==null||e.anchorNode==null)return!1;const n=this.prosemirrorView._root.createRange();n.setStart(e.anchorNode,e.anchorOffset),n.setEnd(e.focusNode,e.focusOffset),n.getClientRects().length===0&&n.startContainer&&n.collapsed&&n.selectNodeContents(n.startContainer);const r=n.getBoundingClientRect(),o=P$.documentElement;return r.bottom>=0&&r.right>=0&&r.left<=(window.innerWidth||o.clientWidth||0)&&r.top<=(window.innerHeight||o.clientHeight||0)}renderSnapshot(e,n){n||(n=Ae.createSnapshot(Ae.createDeleteSet(),new Map)),this.prosemirrorView.dispatch(this._tr.setMeta(nt,{snapshot:e,prevSnapshot:n}))}unrenderSnapshot(){this.mapping.clear(),this.mux(()=>{const e=this.type.toArray().map(r=>Ji(r,this.prosemirrorView.state.schema,this)).filter(r=>r!==null),n=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new ve(ye.from(e),0,0));n.setMeta(nt,{snapshot:null,prevSnapshot:null}),this.prosemirrorView.dispatch(n)})}_forceRerender(){this.mapping.clear(),this.mux(()=>{const e=this.beforeTransactionSelection!==null?null:this.prosemirrorView.state.selection,n=this.type.toArray().map(o=>Ji(o,this.prosemirrorView.state.schema,this)).filter(o=>o!==null),r=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new ve(ye.from(n),0,0));if(e){const o=Ar(ti(e.anchor,0),r.doc.content.size),i=Ar(ti(e.head,0),r.doc.content.size);r.setSelection(Pe.create(r.doc,o,i))}this.prosemirrorView.dispatch(r.setMeta(nt,{isChangeOrigin:!0,binding:this}))})}_renderSnapshot(e,n,r){let o=this.doc,i=this.type;if(e||(e=Ae.snapshot(this.doc)),e instanceof Uint8Array||n instanceof Uint8Array)if((!(e instanceof Uint8Array)||!(n instanceof Uint8Array))&&T1(),o=new Ae.Doc({gc:!1}),Ae.applyUpdateV2(o,n),n=Ae.snapshot(o),Ae.applyUpdateV2(o,e),e=Ae.snapshot(o),i._item===null){const s=Array.from(this.doc.share.keys()).find(a=>this.doc.share.get(a)===this.type);i=o.getXmlFragment(s)}else{const s=o.store.clients.get(i._item.id.client)??[],a=Ae.findIndexSS(s,i._item.id.clock);i=s[a].content.type}this.mapping.clear(),this.mux(()=>{o.transact(s=>{const a=r.permanentUserData;a&&a.dss.forEach(d=>{Ae.iterateDeletedStructs(s,d,f=>{})});const l=(d,f)=>{const p=d==="added"?a.getUserByClientId(f.client):a.getUserByDeletedId(f);return{user:p,type:d,color:oO(r.colorMapping,r.colors,p)}},c=Ae.typeListToArraySnapshot(i,new Ae.Snapshot(n.ds,e.sv)).map(d=>!d._item.deleted||el(d._item,e)||el(d._item,n)?Ji(d,this.prosemirrorView.state.schema,{mapping:new Map,isOMark:new Map},e,n,l):null).filter(d=>d!==null),u=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new ve(ye.from(c),0,0));this.prosemirrorView.dispatch(u.setMeta(nt,{isChangeOrigin:!0}))},nt)})}_typeChanged(e,n){if(this.prosemirrorView==null)return;const r=nt.getState(this.prosemirrorView.state);if(e.length===0||r.snapshot!=null||r.prevSnapshot!=null){this.renderSnapshot(r.snapshot,r.prevSnapshot);return}this.mux(()=>{const o=(a,l)=>this.mapping.delete(l);Ae.iterateDeletedStructs(n,n.deleteSet,a=>{if(a.constructor===Ae.Item){const l=a.content.type;l&&this.mapping.delete(l)}}),n.changed.forEach(o),n.changedParentTypes.forEach(o);const i=this.type.toArray().map(a=>N1(a,this.prosemirrorView.state.schema,this)).filter(a=>a!==null);let s=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new ve(ye.from(i),0,0));sO(s,this.beforeTransactionSelection,this),s=s.setMeta(nt,{isChangeOrigin:!0,isUndoRedoOperation:n.origin instanceof Ae.UndoManager}),this.beforeTransactionSelection!==null&&this._isLocalCursorInView()&&s.scrollIntoView(),this.prosemirrorView.dispatch(s)})}_prosemirrorChanged(e){this.doc.transact(()=>{Td(this.doc,this.type,e,this),this.beforeTransactionSelection=Ed(this,this.prosemirrorView.state)},nt)}initView(e){this.prosemirrorView!=null&&this.destroy(),this.prosemirrorView=e,this.doc.on("beforeAllTransactions",this.beforeAllTransactions),this.doc.on("afterAllTransactions",this.afterAllTransactions),this.type.observeDeep(this._observeFunction)}destroy(){this.prosemirrorView!=null&&(this.prosemirrorView=null,this.type.unobserveDeep(this._observeFunction),this.doc.off("beforeAllTransactions",this.beforeAllTransactions),this.doc.off("afterAllTransactions",this.afterAllTransactions))}}const N1=(t,e,n,r,o,i)=>{const s=n.mapping.get(t);if(s===void 0){if(t instanceof Ae.XmlElement)return Ji(t,e,n,r,o,i);throw k$()}return s},Ji=(t,e,n,r,o,i)=>{const s=[],a=l=>{if(l instanceof Ae.XmlElement){const c=N1(l,e,n,r,o,i);c!==null&&s.push(c)}else{const c=l._item.right?.content?.type;c instanceof Ae.Text&&!c._item.deleted&&c._item.id.client===c.doc.clientID&&(l.applyDelta([{retain:l.length},...c.toDelta()]),c.doc.transact(d=>{c._item.delete(d)}));const u=lO(l,e,n,r,o,i);u!==null&&u.forEach(d=>{d!==null&&s.push(d)})}};r===void 0||o===void 0?t.toArray().forEach(a):Ae.typeListToArraySnapshot(t,new Ae.Snapshot(o.ds,r.sv)).forEach(a);try{const l=t.getAttributes(r);r!==void 0&&(el(t._item,r)?el(t._item,o)||(l.ychange=i?i("added",t._item.id):{type:"added"}):l.ychange=i?i("removed",t._item.id):{type:"removed"});const c=e.node(t.nodeName,l,s);return n.mapping.set(t,c),c}catch{return t.doc.transact(l=>{t._item.delete(l)},nt),n.mapping.delete(t),null}},lO=(t,e,n,r,o,i)=>{const s=[],a=t.toDelta(r,o,i);try{for(let l=0;l<a.length;l++){const c=a[l];s.push(e.text(c.insert,hO(c.attributes,e)))}}catch{return t.doc.transact(l=>{t._item.delete(l)},nt),null}return s},cO=(t,e)=>{const n=new Ae.XmlText,r=t.map(o=>({insert:o.text,attributes:F1(o.marks,e)}));return n.applyDelta(r),e.mapping.set(n,t),n},uO=(t,e)=>{const n=new Ae.XmlElement(t.type.name);for(const r in t.attrs){const o=t.attrs[r];o!==null&&r!=="ychange"&&n.setAttribute(r,o)}return n.insert(0,Fl(t).map(r=>Ad(r,e))),e.mapping.set(n,t),n},Ad=(t,e)=>t instanceof Array?cO(t,e):uO(t,e),ry=t=>typeof t=="object"&&t!==null,Xf=(t,e)=>{const n=Object.keys(t).filter(o=>t[o]!==null);let r=n.length===Object.keys(e).filter(o=>e[o]!==null).length;for(let o=0;o<n.length&&r;o++){const i=n[o],s=t[i],a=e[i];r=i==="ychange"||s===a||ry(s)&&ry(a)&&Xf(s,a)}return r},Fl=t=>{const e=t.content.content,n=[];for(let r=0;r<e.length;r++){const o=e[r];if(o.isText){const i=[];for(let s=e[r];r<e.length&&s.isText;s=e[++r])i.push(s);r--,n.push(i)}else n.push(o)}return n},D1=(t,e)=>{const n=t.toDelta();return n.length===e.length&&n.every((r,o)=>r.insert===e[o].text&&S$(r.attributes||{}).length===e[o].marks.length&&C$(r.attributes,(i,s)=>{const a=I1(s),l=e[o].marks;return Xf(i,l.find(c=>c.type.name===a)?.attrs)}))},ms=(t,e)=>{if(t instanceof Ae.XmlElement&&!(e instanceof Array)&&$d(t,e)){const n=Fl(e);return t._length===n.length&&Xf(t.getAttributes(),e.attrs)&&t.toArray().every((r,o)=>ms(r,n[o]))}return t instanceof Ae.XmlText&&e instanceof Array&&D1(t,e)},tl=(t,e)=>t===e||t instanceof Array&&e instanceof Array&&t.length===e.length&&t.every((n,r)=>e[r]===n),oy=(t,e,n)=>{const r=t.toArray(),o=Fl(e),i=o.length,s=r.length,a=Ar(s,i);let l=0,c=0,u=!1;for(;l<a;l++){const d=r[l],f=o[l];if(tl(n.mapping.get(d),f))u=!0;else if(!ms(d,f))break}for(;l+c<a;c++){const d=r[s-c-1],f=o[i-c-1];if(tl(n.mapping.get(d),f))u=!0;else if(!ms(d,f))break}return{equalityFactor:l+c,foundMappedChild:u}},dO=t=>{let e="",n=t._start;const r={};for(;n!==null;)n.deleted||(n.countable&&n.content instanceof Ae.ContentString?e+=n.content.str:n.content instanceof Ae.ContentFormat&&(r[n.content.key]=null)),n=n.right;return{str:e,nAttrs:r}},fO=(t,e,n)=>{n.mapping.set(t,e);const{nAttrs:r,str:o}=dO(t),i=e.map(c=>({insert:c.text,attributes:Object.assign({},r,F1(c.marks,n))})),{insert:s,remove:a,index:l}=M$(o,i.map(c=>c.insert).join(""));t.delete(l,a),t.insert(l,s),t.applyDelta(i.map(c=>({retain:c.insert.length,attributes:c.attributes})))},pO=/(.*)(--[a-zA-Z0-9+/=]{8})$/,I1=t=>pO.exec(t)?.[1]??t,hO=(t,e)=>{const n=[];for(const r in t)n.push(e.mark(I1(r),t[r]));return n},F1=(t,e)=>{const n={};return t.forEach(r=>{if(r.type.name!=="ychange"){const o=$1(e.isOMark,r.type,()=>!r.type.excludes(r.type));n[o?`${r.type.name}--${tO(r.toJSON())}`:r.type.name]=r.attrs}}),n},Td=(t,e,n,r)=>{if(e instanceof Ae.XmlElement&&e.nodeName!==n.type.name)throw new Error("node name mismatch!");if(r.mapping.set(e,n),e instanceof Ae.XmlElement){const d=e.getAttributes(),f=n.attrs;for(const p in f)f[p]!==null?d[p]!==f[p]&&p!=="ychange"&&e.setAttribute(p,f[p]):e.removeAttribute(p);for(const p in d)f[p]===void 0&&e.removeAttribute(p)}const o=Fl(n),i=o.length,s=e.toArray(),a=s.length,l=Ar(i,a);let c=0,u=0;for(;c<l;c++){const d=s[c],f=o[c];if(!tl(r.mapping.get(d),f))if(ms(d,f))r.mapping.set(d,f);else break}for(;u+c+1<l;u++){const d=s[a-u-1],f=o[i-u-1];if(!tl(r.mapping.get(d),f))if(ms(d,f))r.mapping.set(d,f);else break}t.transact(()=>{for(;a-c-u>0&&i-c-u>0;){const f=s[c],p=o[c],h=s[a-u-1],m=o[i-u-1];if(f instanceof Ae.XmlText&&p instanceof Array)D1(f,p)||fO(f,p,r),c+=1;else{let y=f instanceof Ae.XmlElement&&$d(f,p),g=h instanceof Ae.XmlElement&&$d(h,m);if(y&&g){const x=oy(f,p,r),k=oy(h,m,r);x.foundMappedChild&&!k.foundMappedChild?g=!1:!x.foundMappedChild&&k.foundMappedChild||x.equalityFactor<k.equalityFactor?y=!1:g=!1}y?(Td(t,f,p,r),c+=1):g?(Td(t,h,m,r),u+=1):(r.mapping.delete(e.get(c)),e.delete(c,1),e.insert(c,[Ad(p,r)]),c+=1)}}const d=a-c-u;if(a===1&&i===0&&s[0]instanceof Ae.XmlText?(r.mapping.delete(s[0]),s[0].delete(0,s[0].length)):d>0&&(e.slice(c,c+d).forEach(f=>r.mapping.delete(f)),e.delete(c,d)),c+u<i){const f=[];for(let p=c;p<i-u;p++)f.push(Ad(o[p],r));e.insert(c,f)}},nt)},$d=(t,e)=>!(e instanceof Array)&&t.nodeName===e.type.name;let Xi=null;const mO=()=>{const t=Xi;Xi=null,t.forEach((e,n)=>{const r=n.state.tr,o=nt.getState(n.state);o&&o.binding&&!o.binding.isDestroyed&&(e.forEach((i,s)=>{r.setMeta(s,i)}),n.dispatch(r))})},gO=(t,e,n)=>{Xi||(Xi=new Map,Jf(0,mO)),$1(Xi,t,Oa).set(e,n)},nl=(t,e,n)=>{if(t===0)return Ae.createRelativePositionFromTypeIndex(e,0,-1);let r=e._first===null?null:e._first.content.type;for(;r!==null&&e!==r;){if(r instanceof Ae.XmlText){if(r._length>=t)return Ae.createRelativePositionFromTypeIndex(r,t,-1);if(t-=r._length,r._item!==null&&r._item.next!==null)r=r._item.next.content.type;else{do r=r._item===null?null:r._item.parent,t--;while(r!==e&&r!==null&&r._item!==null&&r._item.next===null);r!==null&&r!==e&&(r=r._item===null?null:r._item.next.content.type)}}else{const o=(n.get(r)||{nodeSize:0}).nodeSize;if(r._first!==null&&t<o)r=r._first.content.type,t--;else{if(t===1&&r._length===0&&o>1)return new Ae.RelativePosition(r._item===null?null:r._item.id,r._item===null?Ae.findRootTypeKey(r):null,null);if(t-=o,r._item!==null&&r._item.next!==null)r=r._item.next.content.type;else{if(t===0)return r=r._item===null?r:r._item.parent,new Ae.RelativePosition(r._item===null?null:r._item.id,r._item===null?Ae.findRootTypeKey(r):null,null);do r=r._item.parent,t--;while(r!==e&&r._item.next===null);r!==e&&(r=r._item.next.content.type)}}}if(r===null)throw T1();if(t===0&&r.constructor!==Ae.XmlText&&r!==e)return yO(r._item.parent,r._item)}return Ae.createRelativePositionFromTypeIndex(e,e._length,-1)},yO=(t,e)=>{let n=null,r=null;return t._item===null?r=Ae.findRootTypeKey(t):n=Ae.createID(t._item.id.client,t._item.id.clock),new Ae.RelativePosition(n,r,e.id)},gs=(t,e,n,r)=>{const o=Ae.createAbsolutePositionFromRelativePosition(n,t);if(o===null||o.type!==e&&!Ae.isParentOf(e,o.type._item))return null;let i=o.type,s=0;if(i.constructor===Ae.XmlText)s=o.index;else if(i._item===null||!i._item.deleted){let a=i._first,l=0;for(;l<i._length&&l<o.index&&a!==null;){if(!a.deleted){const c=a.content.type;l++,c instanceof Ae.XmlText?s+=c._length:s+=r.get(c).nodeSize}a=a.right}s+=1}for(;i!==e&&i._item!==null;){const a=i._item.parent;if(a._item===null||!a._item.deleted){s+=1;let l=a._first;for(;l!==null;){const c=l.content.type;if(c===i)break;l.deleted||(c instanceof Ae.XmlText?s+=c._length:s+=r.get(c).nodeSize),l=l.right}}i=a}return s-1},wO=(t,e)=>{const n=t.toArray().map(r=>Ji(r,e,nO())).filter(r=>r!==null);return ye.fromArray(n)},bO=(t,e)=>e.topNodeType.create(null,wO(t,e)),vO=(t,e,n)=>t!==e,xO=t=>{const e=document.createElement("span");e.classList.add("ProseMirror-yjs-cursor"),e.setAttribute("style",`border-color: ${t.color}`);const n=document.createElement("div");n.setAttribute("style",`background-color: ${t.color}`),n.insertBefore(document.createTextNode(t.name),null);const r=document.createTextNode("⁠"),o=document.createTextNode("⁠");return e.insertBefore(r,null),e.insertBefore(n,null),e.insertBefore(o,null),e},kO=t=>({style:`background-color: ${t.color}70`,class:"ProseMirror-yjs-selection"}),SO=/^#[0-9a-fA-F]{6}$/,iy=(t,e,n,r,o)=>{const i=nt.getState(t),s=i.doc,a=[];return i.snapshot!=null||i.prevSnapshot!=null||i.binding.mapping.size===0?Le.create(t.doc,[]):(e.getStates().forEach((l,c)=>{if(n(s.clientID,c,l)&&l.cursor!=null){const u=l.user||{};u.color==null?u.color="#ffa500":SO.test(u.color)||console.warn("A user uses an unsupported color format",u),u.name==null&&(u.name=`User: ${c}`);let d=gs(s,i.type,Ae.createRelativePositionFromJSON(l.cursor.anchor),i.binding.mapping),f=gs(s,i.type,Ae.createRelativePositionFromJSON(l.cursor.head),i.binding.mapping);if(d!==null&&f!==null){const p=ti(t.doc.content.size-1,0);d=Ar(d,p),f=Ar(f,p),a.push(ze.widget(f,()=>r(u,c),{key:c+"",side:10}));const h=Ar(d,f),m=ti(d,f);a.push(ze.inline(h,m,o(u,c),{inclusiveEnd:!0,inclusiveStart:!1}))}}}),Le.create(t.doc,a))},CO=(t,{awarenessStateFilter:e=vO,cursorBuilder:n=xO,selectionBuilder:r=kO,getSelection:o=s=>s.selection}={},i="cursor")=>new Qe({key:Ys,state:{init(s,a){return iy(a,t,e,n,r)},apply(s,a,l,c){const u=nt.getState(c),d=s.getMeta(Ys);return u&&u.isChangeOrigin||d&&d.awarenessUpdated?iy(c,t,e,n,r):a.map(s.mapping,s.doc)}},props:{decorations:s=>Ys.getState(s)},view:s=>{const a=()=>{s.docView&&gO(s,Ys,{awarenessUpdated:!0})},l=()=>{const c=nt.getState(s.state),u=t.getLocalState()||{};if(s.hasFocus()){const d=o(s.state),f=nl(d.anchor,c.type,c.binding.mapping),p=nl(d.head,c.type,c.binding.mapping);(u.cursor==null||!Ae.compareRelativePositions(Ae.createRelativePositionFromJSON(u.cursor.anchor),f)||!Ae.compareRelativePositions(Ae.createRelativePositionFromJSON(u.cursor.head),p))&&t.setLocalStateField(i,{anchor:f,head:p})}else u.cursor!=null&&gs(c.doc,c.type,Ae.createRelativePositionFromJSON(u.cursor.anchor),c.binding.mapping)!==null&&t.setLocalStateField(i,null)};return t.on("change",a),s.dom.addEventListener("focusin",l),s.dom.addEventListener("focusout",l),{update:l,destroy:()=>{s.dom.removeEventListener("focusin",l),s.dom.removeEventListener("focusout",l),t.off("change",a),t.setLocalStateField(i,null)}}}}),EO=t=>{const e=Tr.getState(t).undoManager;if(e!=null)return e.undo(),!0},AO=t=>{const e=Tr.getState(t).undoManager;if(e!=null)return e.redo(),!0},TO=new Set(["paragraph"]),$O=(t,e)=>!(t instanceof zo.Item)||!(t.content instanceof zo.ContentType)||!(t.content.type instanceof zo.Text||t.content.type instanceof zo.XmlElement&&e.has(t.content.type.nodeName))||t.content.type._length===0,OO=({protectedNodes:t=TO,trackedOrigins:e=[],undoManager:n=null}={})=>new Qe({key:Tr,state:{init:(r,o)=>{const i=nt.getState(o),s=n||new zo.UndoManager(i.type,{trackedOrigins:new Set([nt].concat(e)),deleteFilter:a=>$O(a,t),captureTransaction:a=>a.meta.get("addToHistory")!==!1});return{undoManager:s,prevSel:null,hasUndoOps:s.undoStack.length>0,hasRedoOps:s.redoStack.length>0}},apply:(r,o,i,s)=>{const a=nt.getState(s).binding,l=o.undoManager,c=l.undoStack.length>0,u=l.redoStack.length>0;return a?{undoManager:l,prevSel:Ed(a,i),hasUndoOps:c,hasRedoOps:u}:c!==o.hasUndoOps||u!==o.hasRedoOps?Object.assign({},o,{hasUndoOps:l.undoStack.length>0,hasRedoOps:l.redoStack.length>0}):o}},view:r=>{const o=nt.getState(r.state),i=Tr.getState(r.state).undoManager;return i.on("stack-item-added",({stackItem:s})=>{const a=o.binding;a&&s.meta.set(a,Tr.getState(r.state).prevSel)}),i.on("stack-item-popped",({stackItem:s})=>{const a=o.binding;a&&(a.beforeTransactionSelection=s.meta.get(a)||a.beforeTransactionSelection)}),{destroy:()=>{i.destroy()}}}});var Vn;class MO{constructor(){Sr(this,Vn,new Map)}on(e,n){const r=Kn(this,Vn).get(e);r?r.push(n):Kn(this,Vn).set(e,[n])}emit(e,...n){const r=Kn(this,Vn).get(e);if(r)for(const o of r)o.apply(this,n)}off(e,n){const r=Kn(this,Vn).get(e);r&&(n?Kn(this,Vn).set(e,r.filter(o=>o!==n)):Kn(this,Vn).delete(e))}removeAllListeners(){Dv(this,Vn,new Map)}}Vn=new WeakMap;var Or={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:"'"},rl={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},_O=typeof navigator<"u"&&/Mac/.test(navigator.platform),NO=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Tt=0;Tt<10;Tt++)Or[48+Tt]=Or[96+Tt]=String(Tt);for(var Tt=1;Tt<=24;Tt++)Or[Tt+111]="F"+Tt;for(var Tt=65;Tt<=90;Tt++)Or[Tt]=String.fromCharCode(Tt+32),rl[Tt]=String.fromCharCode(Tt);for(var lu in Or)rl.hasOwnProperty(lu)||(rl[lu]=Or[lu]);function DO(t){var e=_O&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||NO&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?rl:Or)[t.keyCode]||t.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}const IO=typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):!1;function FO(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let r,o,i,s;for(let a=0;a<e.length-1;a++){let l=e[a];if(/^(cmd|meta|m)$/i.test(l))s=!0;else if(/^a(lt)?$/i.test(l))r=!0;else if(/^(c|ctrl|control)$/i.test(l))o=!0;else if(/^s(hift)?$/i.test(l))i=!0;else if(/^mod$/i.test(l))IO?s=!0:o=!0;else throw new Error("Unrecognized modifier name: "+l)}return r&&(n="Alt-"+n),o&&(n="Ctrl-"+n),s&&(n="Meta-"+n),i&&(n="Shift-"+n),n}function BO(t){let e=Object.create(null);for(let n in t)e[FO(n)]=t[n];return e}function cu(t,e,n=!0){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),n&&e.shiftKey&&(t="Shift-"+t),t}function RO(t){return new Qe({props:{handleKeyDown:Yf(t)}})}function Yf(t){let e=BO(t);return function(n,r){let o=DO(r),i,s=e[cu(o,r)];if(s&&s(n.state,n.dispatch,n))return!0;if(o.length==1&&o!=" "){if(r.shiftKey){let a=e[cu(o,r,!1)];if(a&&a(n.state,n.dispatch,n))return!0}if((r.shiftKey||r.altKey||r.metaKey||o.charCodeAt(0)>127)&&(i=Or[r.keyCode])&&i!=o){let a=e[cu(i,r)];if(a&&a(n.state,n.dispatch,n))return!0}}return!1}}function mt(t,e){if(typeof t=="string"){if(!e.nodes[t])throw Error(`There is no node type named '${t}' in schema.`);return e.nodes[t]}return t}function sr(t,e){if(typeof t=="string"){if(!e.marks[t])throw Error(`There is no mark type named '${t}' in schema.`);return e.marks[t]}return t}function Ls(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}var ol,B1,R1;class Oe{static getAttributesFromExtensions(e){const n=[],r={default:null,rendered:!0,renderDOM:null,parseDOM:null,keepOnSplit:!0},o=Ie(this,ol,B1).call(this,e,r),i=Ie(this,ol,R1).call(this,e,r);return n.push(...o,...i),n}static insertExtensionAttrsToParseRule(e,n){return"style"in e?e:{...e,getAttrs:r=>{const o=e.getAttrs?e.getAttrs(r):e.attrs;if(o===!1)return!1;const i=a=>typeof a!="string"?a:a.match(/^[+-]?(\d*\.)?\d+$/)?Number(a):a==="true"?!0:a==="false"?!1:a;let s={};for(const a of n){const l=a.attribute.parseDOM?a.attribute.parseDOM(r):i(r.getAttribute(a.name));l!=null&&(s={...s,[a.name]:l})}return{...o,...s}}}}static getAttributesToRender(e,n){const r=n.filter(i=>i.attribute.rendered).map(i=>i.attribute.renderDOM?i.attribute.renderDOM(e.attrs)||{}:{[i.name]:e.attrs[i.name]});let o={};for(const i of r)o=this.mergeAttributes(o,i);return o}static mergeAttributes(...e){const n=e.filter(o=>!!o);let r={};for(const o of n){const i={...r};for(const[s,a]of Object.entries(o)){if(!i[s]){i[s]=a;continue}if(s==="class"){const l=a?a.split(" "):[],c=i[s]?i[s].split(" "):[],u=l.filter(d=>!c.includes(d));i[s]=[...c,...u].join(" ")}else s==="style"?i[s]=[i[s],a].join("; "):i[s]=a}r=i}return r}static getSplittedAttributes(e,n,r){const o=Object.entries(r).filter(([i])=>{const s=e.find(a=>a.type===n&&a.name===i);return s?s.attribute.keepOnSplit:!1});return Object.fromEntries(o)}static getMarkAttributes(e,n){const r=sr(n,e.schema),o=Is(e).find(i=>i.type.name===r.name);return o?{...o.attrs}:{}}static getNodeAttributes(e,n){const r=mt(n,e.schema),{from:o,to:i}=e.selection,s=[];e.doc.nodesBetween(o,i,l=>{s.push(l)});const a=s.reverse().find(l=>l.type.name===r.name);return a?{...a.attrs}:{}}static getAttributes(e,n){const r=Ls(typeof n=="string"?n:n.name,e.schema);return r==="node"?this.getNodeAttributes(e,n):r==="mark"?this.getMarkAttributes(e,n):{}}}ol=new WeakSet,B1=function(t,e){const n=[],r=o=>{for(const i of o.types){const s=Object.entries(o.attributes);for(const[a,l]of s)n.push({type:i,name:a,attribute:{...e,...l}})}};for(const o of t){const i={name:o.name,options:o.options,storage:o.storage},s=_e(o,"addGlobalAttributes",i);if(!s)continue;const a=s();for(const l of a)r(l)}return n},R1=function(t,e){const n=[],r=t.filter(o=>o.type==="node"||o.type==="mark");for(const o of r){const i={name:o.name,options:o.options,storage:o.storage},s=_e(o,"addAttributes",i);if(!s)continue;const a=s();for(const[l,c]of Object.entries(a)){const u={...e,...c};typeof u.default=="function"&&(u.default=u.default()),n.push({type:o.name,name:l,attribute:u})}}return n},Sr(Oe,ol);function LO(t={}){return Object.keys(t).length===0&&t.constructor===Object}function Od(t){const e=Object.entries(t).filter(([n,r])=>n==="attrs"&&LO(r)?!1:r!=null);return Object.fromEntries(e)}var il,L1,P1;const z1=class Md{static createSchemaByExtensions(e,n){var r,o;const i=e.filter(d=>d.type==="node"),s=e.filter(d=>d.type==="mark"),a=i.find(d=>_e(d,"topNode"))?.name,l=Oe.getAttributesFromExtensions(e),c=Ie(r=Md,il,L1).call(r,i,l,n),u=Ie(o=Md,il,P1).call(o,s,l,n);return new $b({topNode:a,nodes:c,marks:u})}};il=new WeakSet,L1=function(t,e,n){const r=t.map(o=>{const i=e.filter(p=>p.type===o.name),s={name:o.name,options:o.options,storage:o.storage,editor:n},a=Object.fromEntries(i.map(p=>[p.name,{default:p?.attribute?.default}])),l=t.reduce((p,h)=>{const m=_e(h,"extendNodeSchema",s);return{...p,...m?m(o):{}}},{}),c=Od({content:He(_e(o,"content",s)),group:He(_e(o,"group",s)),marks:He(_e(o,"marks",s)),inline:He(_e(o,"inline",s)),atom:He(_e(o,"atom",s)),selectable:He(_e(o,"selectable",s)),draggable:He(_e(o,"draggable",s)),code:He(_e(o,"code",s)),defining:He(_e(o,"defining",s)),isolating:He(_e(o,"isolating",s)),attrs:a,...l}),u=He(_e(o,"parseDOM",s));u&&(c.parseDOM=u.map(p=>Oe.insertExtensionAttrsToParseRule(p,i)));const d=_e(o,"renderDOM",s);d&&(c.toDOM=p=>d({node:p,htmlAttributes:Oe.getAttributesToRender(p,i)}));const f=_e(o,"renderText",s);return f&&(c.toText=f),[o.name,c]});return Object.fromEntries(r)},P1=function(t,e,n){const r=t.map(o=>{const i=e.filter(d=>d.type===o.name),s={name:o.name,options:o.options,storage:o.storage,editor:n},a=Object.fromEntries(i.map(d=>[d.name,{default:d?.attribute?.default}])),l=Od({group:He(_e(o,"group",s)),inclusive:He(_e(o,"inclusive",s)),excludes:He(_e(o,"excludes",s)),spanning:He(_e(o,"spanning",s)),code:He(_e(o,"code",s)),attrs:a}),c=He(_e(o,"parseDOM",s));c&&(l.parseDOM=c.map(d=>Oe.insertExtensionAttrsToParseRule(d,i)));const u=_e(o,"renderDOM",s);return u&&(l.toDOM=d=>u({mark:d,htmlAttributes:Oe.getAttributesToRender(d,i)})),[o.name,l]});return Object.fromEntries(r)},Sr(z1,il);let PO=z1;function ys(t,e){return e.nodes[t]||e.marks[t]||null}function zO(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function Zf(t,e){let{selection:n,doc:r,storedMarks:o}=t;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return o},get selection(){return n},get doc(){return r},get tr(){return n=t.selection,r=t.doc,o=t.storedMarks,t}}}let j1=class q1{constructor(e){Fe(this,"editor"),Fe(this,"rawCommands"),this.editor=e.editor,this.rawCommands=this.editor.extensionService.commands}static create(...e){return new q1(...e)}get state(){return this.editor.state}get commands(){const{editor:e,state:n}=this,{view:r}=e,{tr:o}=n,i=this.createProps(o),s=Object.entries(this.rawCommands).map(([a,l])=>[a,(...c)=>{const u=l(...c)(i);return o.getMeta("preventDispatch")||r.dispatch(o),u}]);return Object.fromEntries(s)}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,n=!0){const{editor:r,state:o,rawCommands:i}=this,{view:s}=r,a=[],l=!!e,c=e||o.tr,u=()=>(!l&&n&&!c.getMeta("preventDispatch")&&s.dispatch(c),a.every(p=>p===!0)),d=Object.entries(i).map(([p,h])=>[p,(...m)=>{const y=this.createProps(c,n),g=h(...m)(y);return a.push(g),f}]),f={...Object.fromEntries(d),run:u};return f}createCan(e){const{rawCommands:n,state:r}=this,o=!1,i=e||r.tr,s=this.createProps(i,o);return{...Object.fromEntries(Object.entries(n).map(([a,l])=>[a,(...c)=>l(...c)({...s,dispatch:void 0})])),chain:()=>this.createChain(i,o)}}createProps(e,n=!0){const{editor:r,state:o,rawCommands:i}=this,{view:s}=r,a={tr:e,editor:r,view:s,state:Zf(e,o),dispatch:n?()=>{}:void 0,chain:()=>this.createChain(e,n),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(i).map(([l,c])=>[l,(...u)=>c(...u)(a)]))}};return a}};function jO(t,e){const n=di.fromSchema(e).serializeFragment(t),r=document.implementation.createHTMLDocument().createElement("div");return r.appendChild(n),r.innerHTML}const qO=(t,e=500)=>{let n="";const r=t.parentOffset;return t.parent.nodesBetween(Math.max(0,r-e),r,(o,i,s,a)=>{const l=o.type.spec.toText?.({node:o,pos:i,parent:s,index:a})||o.textContent||"%leaf%";n+=o.isAtom&&!o.isText?l:l.slice(0,Math.max(0,r-i))}),n};class UO{constructor(e){Fe(this,"match"),Fe(this,"handler"),this.match=e.match,this.handler=e.handler}}const VO=(t,e)=>{if(yv(e))return e.exec(t);const n=e(t);if(!n)return null;const r=[n.text];return r.index=n.index,r.input=t,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[super-editor warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(n.replaceWith)),r},uu=t=>{const{editor:e,from:n,to:r,text:o,rules:i,plugin:s}=t,{view:a}=e;if(a.composing)return!1;const l=a.state.doc.resolve(n);if(l.parent.type.spec.code||(l.nodeBefore||l.nodeAfter)?.marks.find(d=>d.type.spec.code))return!1;let c=!1;const u=qO(l)+o;return i.forEach(d=>{if(c)return;const f=VO(u,d.match);if(!f)return;const p=a.state.tr,h=Zf(p,a.state),m={from:n-(f[0].length-o.length),to:r},{commands:y,chain:g,can:x}=new j1({editor:e,state:h});d.handler({state:h,range:m,match:f,commands:y,chain:g,can:x})===null||!p.steps.length||(p.setMeta(s,{transform:p,from:n,to:r,text:o}),a.dispatch(p),c=!0)}),c},HO=({editor:t,rules:e})=>{const n=new Qe({key:new tt("inputRulesPlugin"),state:{init(){return null},apply(r,o,i){const s=r.getMeta(n);if(s)return s;const a=r.getMeta("applyInputRules");return a&&setTimeout(()=>{let{text:l}=a;typeof l!="string"&&(l=jO(ye.from(l),i.schema));const{from:c}=a,u=c+l.length;uu({editor:t,from:c,to:u,text:l,rules:e,plugin:n})}),r.selectionSet||r.docChanged?null:o}},props:{handleTextInput(r,o,i,s){return uu({editor:t,from:o,to:i,text:s,rules:e,plugin:n})},handleKeyDown(r,o){if(o.key!=="Enter")return!1;const{$cursor:i}=r.state.selection;return i?uu({editor:t,from:i.pos,to:i.pos,text:`
36
36
  `,rules:e,plugin:n}):!1}},isInputRules:!0});return n};var sl,U1,sy;const WO=class Li{constructor(e,n,r){Sr(this,sl),Fe(this,"editor"),Fe(this,"schema"),Fe(this,"extensions"),Fe(this,"externalExtensions",[]),Fe(this,"splittableMarks",[]),this.editor=r,this.externalExtensions=n||[],this.extensions=Li.getResolvedExtensions([...e,...this.externalExtensions]),this.schema=PO.createSchemaByExtensions(this.extensions,r),Ie(this,sl,U1).call(this)}static create(...e){return new Li(...e)}static getResolvedExtensions(e){return Li.sortByPriority(e)}static sortByPriority(e){return e.sort((n,r)=>{const o=_e(n,"priority")||100,i=_e(r,"priority")||100;return o>i?-1:o<i?1:0})}get attributes(){return Oe.getAttributesFromExtensions(this.extensions)}get commands(){let e={};for(const n of this.extensions){const r={name:n.name,options:n.options,storage:n.storage,editor:this.editor,type:ys(n.name,this.schema)},o=_e(n,"addCommands",r);o&&(e={...e,...o()})}return e}get plugins(){const e=this.editor,n=Li.sortByPriority([...this.extensions].reverse()),r=[],o=n.map(i=>{const s={name:i.name,options:i.options,storage:i.storage,editor:e,type:ys(i.name,this.schema)},a=[],l=_e(i,"addShortcuts",s);let c={};if(l){const f=Object.entries(l()).map(([p,h])=>[p,(...m)=>h({editor:e,keymapArgs:m})]);c={...Object.fromEntries(f)}}a.push(RO(c));const u=_e(i,"addInputRules",s);zO(i,e.options.enableInputRules)&&u&&r.push(...u());const d=_e(i,"addPmPlugins",s);if(d){const f=d();a.push(...f)}return a}).flat();return[HO({editor:e,rules:r}),...o]}get nodeViews(){const{editor:e}=this,n=this.extensions.filter(r=>r.type==="node").filter(r=>!!_e(r,"addNodeView")).map(r=>{const o=this.attributes.filter(l=>l.type===r.name),i={name:r.name,options:r.options,storage:r.storage,editor:e,type:mt(r.name,this.schema)},s=_e(r,"addNodeView",i);if(!s)return[];const a=(l,c,u,d)=>{const f=Oe.getAttributesToRender(l,o);return s()({editor:e,node:l,getPos:u,decorations:d,htmlAttributes:f,extension:r})};return[r.name,a]});return Object.fromEntries(n)}};sl=new WeakSet,U1=function(){for(const t of this.extensions){this.editor.extensionStorage[t.name]=t.storage;const e={name:t.name,options:t.options,storage:t.storage,editor:this.editor,type:ys(t.name,this.schema)};t.type==="mark"&&(He(_e(t,"keepOnSplit",e))??!0)&&this.splittableMarks.push(t.name),Ie(this,sl,sy).call(this,t)}},sy=function(t){const e={name:t.name,options:t.options,storage:t.storage,editor:this.editor,type:ys(t.name,this.schema)},n=_e(t,"onBeforeCreate",e),r=_e(t,"onCreate",e),o=_e(t,"onUpdate",e),i=_e(t,"onSelectionUpdate",e),s=_e(t,"onTransaction",e),a=_e(t,"onFocus",e),l=_e(t,"onBlur",e),c=_e(t,"onDestroy",e);n&&this.editor.on("beforeCreate",n),r&&this.editor.on("create",r),o&&this.editor.on("update",o),i&&this.editor.on("selectionUpdate",i),s&&this.editor.on("transaction",s),a&&this.editor.on("focus",a),l&&this.editor.on("blur",l),c&&this.editor.on("destroy",c)};let GO=WO;const KO=t=>e=>{const n=typeof t=="function"?t(e):t;for(let r=0;r<n.length;r+=1)if(n[r](e))return!0;return!1},JO=t=>e=>t(e),XO=()=>({tr:t})=>(t.insertText(" ",t.selection.from,t.selection.to),!0),YO=()=>({tr:t,state:e})=>{let n=t.selection.from;const r=e.schema.nodes.tab.create();return t.insert(n,r),!0},ZO=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),Qf=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function QO(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const V1=(t,e,n)=>{let r=QO(t,n);if(!r)return!1;let o=W1(r);if(!o){let s=r.blockRange(),a=s&&Ds(s);return a==null?!1:(e&&e(t.tr.lift(s,a).scrollIntoView()),!0)}let i=o.nodeBefore;if(Q1(t,o,e,-1))return!0;if(r.parent.content.size==0&&(ri(i,"end")||De.isSelectable(i)))for(let s=r.depth;;s--){let a=Df(t.doc,r.before(s),r.after(s),ve.empty);if(a&&a.slice.size<a.to-a.from){if(e){let l=t.tr.step(a);l.setSelection(ri(i,"end")?Re.findFrom(l.doc.resolve(l.mapping.map(o.pos,-1)),-1):De.create(l.doc,o.pos-i.nodeSize)),e(l.scrollIntoView())}return!0}if(s==1||r.node(s-1).childCount>1)break}return i.isAtom&&o.depth==r.depth-1?(e&&e(t.tr.delete(o.pos-i.nodeSize,o.pos).scrollIntoView()),!0):!1};function ri(t,e,n=!1){for(let r=t;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&r.childCount!=1)return!1}return!1}const H1=(t,e,n)=>{let{$head:r,empty:o}=t.selection,i=r;if(!o)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):r.parentOffset>0)return!1;i=W1(r)}let s=i&&i.nodeBefore;return!s||!De.isSelectable(s)?!1:(e&&e(t.tr.setSelection(De.create(t.doc,i.pos-s.nodeSize)).scrollIntoView()),!0)};function W1(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){if(t.index(e)>0)return t.doc.resolve(t.before(e+1));if(t.node(e).type.spec.isolating)break}return null}function eM(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset<n.parent.content.size)?null:n}const G1=(t,e,n)=>{let r=eM(t,n);if(!r)return!1;let o=J1(r);if(!o)return!1;let i=o.nodeAfter;if(Q1(t,o,e,1))return!0;if(r.parent.content.size==0&&(ri(i,"start")||De.isSelectable(i))){let s=Df(t.doc,r.before(),r.after(),ve.empty);if(s&&s.slice.size<s.to-s.from){if(e){let a=t.tr.step(s);a.setSelection(ri(i,"start")?Re.findFrom(a.doc.resolve(a.mapping.map(o.pos)),1):De.create(a.doc,a.mapping.map(o.pos))),e(a.scrollIntoView())}return!0}}return i.isAtom&&o.depth==r.depth-1?(e&&e(t.tr.delete(o.pos,o.pos+i.nodeSize).scrollIntoView()),!0):!1},K1=(t,e,n)=>{let{$head:r,empty:o}=t.selection,i=r;if(!o)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):r.parentOffset<r.parent.content.size)return!1;i=J1(r)}let s=i&&i.nodeAfter;return!s||!De.isSelectable(s)?!1:(e&&e(t.tr.setSelection(De.create(t.doc,i.pos)).scrollIntoView()),!0)};function J1(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){let n=t.node(e);if(t.index(e)+1<n.childCount)return t.doc.resolve(t.after(e+1));if(n.type.spec.isolating)break}return null}const tM=(t,e)=>{let n=t.selection,r=n instanceof De,o;if(r){if(n.node.isTextblock||!Dr(t.doc,n.from))return!1;o=n.from}else if(o=jb(t.doc,n.from,-1),o==null)return!1;if(e){let i=t.tr.join(o);r&&i.setSelection(De.create(i.doc,o-t.doc.resolve(o).nodeBefore.nodeSize)),e(i.scrollIntoView())}return!0},nM=(t,e)=>{let n=t.selection,r;if(n instanceof De){if(n.node.isTextblock||!Dr(t.doc,n.to))return!1;r=n.to}else if(r=jb(t.doc,n.to,1),r==null)return!1;return e&&e(t.tr.join(r).scrollIntoView()),!0},X1=(t,e)=>{let{$head:n,$anchor:r}=t.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(e&&e(t.tr.insertText(`
37
- `).scrollIntoView()),!0)};function ep(t){for(let e=0;e<t.edgeCount;e++){let{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}const rM=(t,e)=>{let{$head:n,$anchor:r}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let o=n.node(-1),i=n.indexAfter(-1),s=ep(o.contentMatchAt(i));if(!s||!o.canReplaceWith(i,i,s))return!1;if(e){let a=n.after(),l=t.tr.replaceWith(a,a,s.createAndFill());l.setSelection(Re.near(l.doc.resolve(a),1)),e(l.scrollIntoView())}return!0},Y1=(t,e)=>{let n=t.selection,{$from:r,$to:o}=n;if(n instanceof _n||r.parent.inlineContent||o.parent.inlineContent)return!1;let i=ep(o.parent.contentMatchAt(o.indexAfter()));if(!i||!i.isTextblock)return!1;if(e){let s=(!r.parentOffset&&o.index()<o.parent.childCount?r:o).pos,a=t.tr.insert(s,i.createAndFill());a.setSelection(Pe.create(a.doc,s+1)),e(a.scrollIntoView())}return!0},Z1=(t,e)=>{let{$cursor:n}=t.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let i=n.before();if(Qn(t.doc,i))return e&&e(t.tr.split(i).scrollIntoView()),!0}let r=n.blockRange(),o=r&&Ds(r);return o==null?!1:(e&&e(t.tr.lift(r,o).scrollIntoView()),!0)};function oM(t){return(e,n)=>{let{$from:r,$to:o}=e.selection;if(e.selection instanceof De&&e.selection.node.isBlock)return!r.parentOffset||!Qn(e.doc,r.pos)?!1:(n&&n(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let i=[],s,a,l=!1,c=!1;for(let p=r.depth;;p--)if(r.node(p).isBlock){l=r.end(p)==r.pos+(r.depth-p),c=r.start(p)==r.pos-(r.depth-p),a=ep(r.node(p-1).contentMatchAt(r.indexAfter(p-1))),i.unshift(l&&a?{type:a}:null),s=p;break}else{if(p==1)return!1;i.unshift(null)}let u=e.tr;(e.selection instanceof Pe||e.selection instanceof _n)&&u.deleteSelection();let d=u.mapping.map(r.pos),f=Qn(u.doc,d,i.length,i);if(f||(i[0]=a?{type:a}:null,f=Qn(u.doc,d,i.length,i)),u.split(d,i.length,i),!l&&c&&r.node(s).type!=a){let p=u.mapping.map(r.before(s)),h=u.doc.resolve(p);a&&r.node(s-1).canReplaceWith(h.index(),h.index()+1,a)&&u.setNodeMarkup(u.mapping.map(r.before(s)),a)}return n&&n(u.scrollIntoView()),!0}}const iM=oM(),sM=(t,e)=>(e&&e(t.tr.setSelection(new _n(t.doc))),!0);function aM(t,e,n){let r=e.nodeBefore,o=e.nodeAfter,i=e.index();return!r||!o||!r.type.compatibleContent(o.type)?!1:!r.content.size&&e.parent.canReplace(i-1,i)?(n&&n(t.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(i,i+1)||!(o.isTextblock||Dr(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function Q1(t,e,n,r){let o=e.nodeBefore,i=e.nodeAfter,s,a,l=o.type.spec.isolating||i.type.spec.isolating;if(!l&&aM(t,e,n))return!0;let c=!l&&e.parent.canReplace(e.index(),e.index()+1);if(c&&(s=(a=o.contentMatchAt(o.childCount)).findWrapping(i.type))&&a.matchType(s[0]||i.type).validEnd){if(n){let p=e.pos+i.nodeSize,h=ye.empty;for(let g=s.length-1;g>=0;g--)h=ye.from(s[g].create(null,h));h=ye.from(o.copy(h));let m=t.tr.step(new Yt(e.pos-1,p,e.pos,p,new ve(h,1,0),s.length,!0)),y=m.doc.resolve(p+2*s.length);y.nodeAfter&&y.nodeAfter.type==o.type&&Dr(m.doc,y.pos)&&m.join(y.pos),n(m.scrollIntoView())}return!0}let u=i.type.spec.isolating||r>0&&l?null:Re.findFrom(e,1),d=u&&u.$from.blockRange(u.$to),f=d&&Ds(d);if(f!=null&&f>=e.depth)return n&&n(t.tr.lift(d,f).scrollIntoView()),!0;if(c&&ri(i,"start",!0)&&ri(o,"end")){let p=o,h=[];for(;h.push(p),!p.isTextblock;)p=p.lastChild;let m=i,y=1;for(;!m.isTextblock;m=m.firstChild)y++;if(p.canReplace(p.childCount,p.childCount,m.content)){if(n){let g=ye.empty;for(let k=h.length-1;k>=0;k--)g=ye.from(h[k].copy(g));let x=t.tr.step(new Yt(e.pos-h.length,e.pos+i.nodeSize,e.pos+y,e.pos+i.nodeSize-y,new ve(g,h.length,0),0,!0));n(x.scrollIntoView())}return!0}}return!1}function e2(t){return function(e,n){let r=e.selection,o=t<0?r.$from:r.$to,i=o.depth;for(;o.node(i).isInline;){if(!i)return!1;i--}return o.node(i).isTextblock?(n&&n(e.tr.setSelection(Pe.create(e.doc,t<0?o.start(i):o.end(i)))),!0):!1}}const lM=e2(-1),cM=e2(1);function ay(t,e=null){return function(n,r){let o=!1;for(let i=0;i<n.selection.ranges.length&&!o;i++){let{$from:{pos:s},$to:{pos:a}}=n.selection.ranges[i];n.doc.nodesBetween(s,a,(l,c)=>{if(o)return!1;if(!(!l.isTextblock||l.hasMarkup(t,e)))if(l.type==t)o=!0;else{let u=n.doc.resolve(c),d=u.index();o=u.parent.canReplaceWith(d,d+1,t)}})}if(!o)return!1;if(r){let i=n.tr;for(let s=0;s<n.selection.ranges.length;s++){let{$from:{pos:a},$to:{pos:l}}=n.selection.ranges[s];i.setBlockType(a,l,t,e)}r(i.scrollIntoView())}return!0}}function tp(...t){return function(e,n,r){for(let o=0;o<t.length;o++)if(t[o](e,n,r))return!0;return!1}}tp(Qf,V1,H1);tp(Qf,G1,K1);tp(X1,Y1,Z1,iM);typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function t2(t){for(let e=0;e<t.edgeCount;e++){const{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}const ly=(t,e)=>{const n=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();if(n){const r=n.filter(o=>e?.includes(o.type.name));t.tr.ensureMarks(r)}},uM=({keepMarks:t=!0}={})=>e=>{const{tr:n,state:r,dispatch:o,editor:i}=e,{selection:s,doc:a}=n,{$from:l,$to:c}=s,u=i.extensionService.attributes,d=Oe.getSplittedAttributes(u,l.node().type.name,l.node().attrs);if(s instanceof De&&s.node.isBlock)return!l.parentOffset||!Qn(a,l.pos)?!1:(o&&(t&&ly(r,i.extensionService.splittableMarks),n.split(l.pos).scrollIntoView()),!0);if(!l.parent.isBlock)return!1;if(o){const f=c.parentOffset===c.parent.content.size;s instanceof Pe&&n.deleteSelection();const p=l.depth===0?null:t2(l.node(-1).contentMatchAt(l.indexAfter(-1)));let h=f&&p?[{type:p,attrs:d}]:void 0,m=Qn(n.doc,n.mapping.map(l.pos),1,h);if(!h&&!m&&Qn(n.doc,n.mapping.map(l.pos),1,p?[{type:p}]:void 0)&&(m=!0,h=p?[{type:p,attrs:d}]:void 0),m&&(n.split(n.mapping.map(l.pos),1,h),p&&!f&&!l.parentOffset&&l.parent.type!==p)){const y=n.mapping.map(l.before()),g=n.doc.resolve(y);l.node(-1).canReplaceWith(g.index(),g.index()+1,p)&&n.setNodeMarkup(n.mapping.map(l.before()),p)}t&&ly(r,i.extensionService.splittableMarks),n.scrollIntoView()}return!0},dM=()=>({state:t,dispatch:e})=>Z1(t,e),fM=()=>({state:t,dispatch:e})=>Y1(t,e),pM=()=>({state:t,dispatch:e})=>X1(t,e),hM=()=>({state:t,dispatch:e})=>rM(t,e),n2=t=>{};function mM(t,e,n){const{selection:r}=e;let o=null;if(n2()&&(o=r.$cursor),o){const i=t.storedMarks??o.marks();return!!n.isInSet(i)||!i.some(s=>s.type.excludes(n))}return r.ranges.some(({$from:i,$to:s})=>{let a=i.depth===0?t.doc.inlineContent&&t.doc.type.allowsMarkType(n):!1;return t.doc.nodesBetween(i.pos,s.pos,(l,c,u)=>{if(a)return!1;if(l.isInline){const d=!u||u.type.allowsMarkType(n),f=!!n.isInSet(l.marks)||!l.marks.some(p=>p.type.excludes(n));a=d&&f}return!a}),a})}const gM=(t,e={})=>({tr:n,state:r,dispatch:o})=>{const{selection:i}=n,{empty:s,ranges:a}=i,l=sr(t,r.schema);if(o)if(s){const c=Oe.getMarkAttributes(r,l);n.addStoredMark(l.create({...c,...e}))}else a.forEach(c=>{const u=c.$from.pos,d=c.$to.pos;r.doc.nodesBetween(u,d,(f,p)=>{const h=Math.max(p,u),m=Math.min(p+f.nodeSize,d);f.marks.find(y=>y.type===l)?f.marks.forEach(y=>{l===y.type&&n.addMark(h,m,l.create({...y.attrs,...e}))}):n.addMark(h,m,l.create(e))})});return mM(r,n,l)};function _d(t,e,n={}){return t.find(r=>r.type===e&&Zo(r.attrs,n))}function yM(t,e,n={}){return!!_d(t,e,n)}function np(t,e,n={}){if(!t||!e)return;let r=t.parent.childAfter(t.parentOffset);if(t.parentOffset===r.offset&&r.offset!==0&&(r=t.parent.childBefore(t.parentOffset)),!r.node)return;const o=_d([...r.node.marks],e,n);if(!o)return;let i=r.index,s=t.start()+r.offset,a=i+1,l=s+r.node.nodeSize;for(_d([...r.node.marks],e,n);i>0&&o.isInSet(t.parent.child(i-1).marks);)i-=1,s-=t.parent.child(i).nodeSize;for(;a<t.parent.childCount&&yM([...t.parent.child(a).marks],e,n);)l+=t.parent.child(a).nodeSize,a+=1;return{from:s,to:l}}const wM=(t,e={})=>({tr:n,state:r,dispatch:o})=>{const{extendEmptyMarkRange:i=!1}=e,{selection:s}=n,a=sr(t,r.schema),{$from:l,empty:c,ranges:u}=s;if(!o)return!0;if(c&&i){let{from:d,to:f}=s;const p=l.marks().find(m=>m.type===a)?.attrs,h=np(l,a,p);h&&(d=h.from,f=h.to),n.removeMark(d,f,a)}else u.forEach(d=>{n.removeMark(d.$from.pos,d.$to.pos,a)});return n.removeStoredMark(a),!0},bM=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,{empty:r,ranges:o}=n;return r||e&&o.forEach(i=>{t.removeMark(i.$from.pos,i.$to.pos)}),!0};function al(t,e,n={}){const{empty:r,ranges:o}=t.selection,i=e?sr(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter(u=>i?i.name===u.type.name:!0).find(u=>Zo(u.attrs,n,{strict:!1}));let s=0;const a=[];if(o.forEach(({$from:u,$to:d})=>{const f=u.pos,p=d.pos;t.doc.nodesBetween(f,p,(h,m)=>{if(!h.isText&&!h.marks.length)return;const y=Math.max(f,m),g=Math.min(p,m+h.nodeSize),x=g-y;s+=x,a.push(...h.marks.map(k=>({mark:k,from:y,to:g})))})}),s===0)return!1;const l=a.filter(u=>i?i.name===u.mark.type.name:!0).filter(u=>Zo(u.mark.attrs,n,{strict:!1})).reduce((u,d)=>u+d.to-d.from,0),c=a.filter(u=>i?u.mark.type!==i&&u.mark.type.excludes(i):!0).reduce((u,d)=>u+d.to-d.from,0);return(l>0?l+c:l)>=s}const vM=(t,e={},n={})=>({state:r,commands:o})=>{const{extendEmptyMarkRange:i=!1}=n,s=sr(t,r.schema);return al(r,s,e)?o.unsetMark(s,{extendEmptyMarkRange:i}):o.setMark(s,e)},xM=()=>({state:t,tr:e,dispatch:n})=>{const{selection:r}=e,{ranges:o}=r;return n&&o.forEach(({$from:i,$to:s})=>{t.doc.nodesBetween(i.pos,s.pos,(a,l)=>{if(a.type.isText)return;const{doc:c,mapping:u}=e,d=c.resolve(u.map(l)),f=c.resolve(u.map(l+a.nodeSize)),p=d.blockRange(f);if(!p)return;const h=Ds(p);if(a.type.isTextblock){const{defaultType:m}=d.parent.contentMatchAt(d.index());e.setNodeMarkup(p.start,m)}(h||h===0)&&e.lift(p,h)})}),!0},kM=(t,e={})=>({state:n,dispatch:r,chain:o})=>{const i=mt(t,n.schema);return i.isTextblock?o().command(({commands:s})=>ay(i,e)(n)?!0:s.clearNodes()).command(({state:s})=>ay(i,e)(s,r)).run():!1};function ll(t,e,n={}){const{from:r,to:o,empty:i}=t.selection,s=e?mt(e,t.schema):null,a=[];t.doc.nodesBetween(r,o,(u,d)=>{if(u.isText)return;const f=Math.max(r,d),p=Math.min(o,d+u.nodeSize);a.push({node:u,from:f,to:p})});const l=o-r,c=a.filter(u=>s?s.name===u.node.type.name:!0).filter(u=>Zo(u.node.attrs,n,{strict:!1}));return i?!!c.length:c.reduce((u,d)=>u+d.to-d.from,0)>=l}const SM=(t,e,n={})=>({state:r,commands:o})=>{const i=mt(t,r.schema),s=mt(e,r.schema);return ll(r,i,n)?o.setNode(s):o.setNode(i,n)},CM=()=>({state:t,dispatch:e})=>sM(t,e),EM=()=>({state:t,dispatch:e})=>Qf(t,e),AM=(t,e={})=>({tr:n,state:r,dispatch:o})=>{let i=null,s=null;const a=Ls(typeof t=="string"?t:t.name,r.schema);return a?(a==="node"&&(i=mt(t,r.schema)),a==="mark"&&(s=sr(t,r.schema)),o&&n.selection.ranges.forEach(l=>{const c=l.$from.pos,u=l.$to.pos;r.doc.nodesBetween(c,u,(d,f)=>{i&&i===d.type&&n.setNodeMarkup(f,void 0,{...d.attrs,...e}),s&&d.marks.length&&d.marks.forEach(p=>{if(s===p.type){const h=Math.max(f,c),m=Math.min(f+d.nodeSize,u);n.addMark(h,m,s.create({...p.attrs,...e}))}})})}),!0):!1};function cy(t,e){const n=typeof e=="string"?[e]:e;return Object.keys(t).reduce((r,o)=>(n.includes(o)||(r[o]=t[o]),r),{})}const TM=(t,e)=>({tr:n,state:r,dispatch:o})=>{let i=null,s=null;const a=Ls(typeof t=="string"?t:t.name,r.schema);return a?(a==="node"&&(i=mt(t,r.schema)),a==="mark"&&(s=sr(t,r.schema)),o&&n.selection.ranges.forEach(l=>{r.doc.nodesBetween(l.$from.pos,l.$to.pos,(c,u)=>{i&&i===c.type&&n.setNodeMarkup(u,void 0,cy(c.attrs,e)),s&&c.marks.length&&c.marks.forEach(d=>{s===d.type&&n.addMark(u,u+c.nodeSize,s.create(cy(d.attrs,e)))})})}),!0):!1},$M=()=>({state:t,dispatch:e})=>tM(t,e),OM=()=>({state:t,dispatch:e})=>nM(t,e),MM=()=>({state:t,dispatch:e})=>V1(t,e),_M=()=>({state:t,dispatch:e})=>G1(t,e),NM=()=>({state:t,dispatch:e})=>H1(t,e),DM=()=>({state:t,dispatch:e})=>K1(t,e),IM=()=>({state:t,dispatch:e})=>lM(t,e),FM=()=>({state:t,dispatch:e})=>cM(t,e),BM=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),r2=t=>{const e=t.childNodes;for(let n=e.length-1;n>=0;n-=1){const r=e[n];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?t.removeChild(r):r.nodeType===1&&r2(r)}return t};function Zs(t){const e=`<body>${t}</body>`,n=new window.DOMParser().parseFromString(e,"text/html").body;return r2(n)}function Nd(t,e,n){n={slice:!0,parseOptions:{},...n};const r=typeof t=="object"&&t!==null,o=typeof t=="string";if(r)try{if(Array.isArray(t)&&t.length>0)return ye.fromArray(t.map(s=>e.nodeFromJSON(s)));const i=e.nodeFromJSON(t);return n.errorOnInvalidContent&&i.check(),i}catch(i){if(n.errorOnInvalidContent)throw new Error("[super-editor error]: Invalid JSON content",{cause:i});return console.warn("[super-editor warn]: Invalid content.","Passed value:",t,"Error:",i),Nd("",e,n)}if(o){if(n.errorOnInvalidContent){let s=!1,a="";const l=new $b({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__supereditor__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:c=>(s=!0,a=typeof c=="string"?c:c.outerHTML,null)}]}})});if(n.slice?Zr.fromSchema(l).parseSlice(Zs(t),n.parseOptions):Zr.fromSchema(l).parse(Zs(t),n.parseOptions),n.errorOnInvalidContent&&s)throw new Error("[super-editor error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${a}`)})}const i=Zr.fromSchema(e);return n.slice?i.parseSlice(Zs(t),n.parseOptions).content:i.parse(Zs(t),n.parseOptions)}return Nd("",e,n)}function RM(t,e,n){const r=t.steps.length-1;if(r<e)return;const o=t.steps[r];if(!(o instanceof $t||o instanceof Yt))return;const i=t.mapping.maps[r];let s=0;i.forEach((a,l,c,u)=>{s===0&&(s=u)}),t.setSelection(Re.near(t.doc.resolve(s),n))}const LM=t=>!("type"in t),PM=(t,e,n)=>({tr:r,dispatch:o,editor:i})=>{if(o){n={parseOptions:{},updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let s;try{s=Nd(e,i.schema,{parseOptions:{preserveWhitespace:"full",...n.parseOptions},errorOnInvalidContent:n.errorOnInvalidContent??i.options.enableContentCheck})}catch(f){return i.emit("contentError",{editor:i,error:f,disableCollaboration:()=>{console.error("[super-editor error]: Unable to disable collaboration at this point in time")}}),!1}let{from:a,to:l}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},c=!0,u=!0;if((LM(s)?s:[s]).forEach(f=>{f.check(),c=c?f.isText&&f.marks.length===0:!1,u=u?f.isBlock:!1}),a===l&&u){const{parent:f}=r.doc.resolve(a);f.isTextblock&&!f.type.spec.code&&!f.childCount&&(a-=1,l+=1)}let d;c?(Array.isArray(e)?d=e.map(f=>f.text||"").join(""):typeof e=="object"&&e&&e.text?d=e.text:d=e,r.insertText(d,a,l)):(d=s,r.replaceWith(a,l,d)),n.updateSelection&&RM(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:a,text:d}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:a,text:d})}return!0},zM=()=>({state:t,dispatch:e})=>{const n=t.plugins;for(let r=0;r<n.length;r+=1){const o=n[r];let i;if(o.spec.isInputRules&&(i=o.getState(t))){if(e){const s=t.tr,a=i.transform;for(let l=a.steps.length-1;l>=0;l-=1)s.step(a.steps[l].invert(a.docs[l]));if(i.text){const l=s.doc.resolve(i.from).marks();s.replaceWith(i.from,i.to,t.schema.text(i.text,l))}else s.delete(i.from,i.to)}return!0}}return!1};function jM(t,e=null){return function(n,r){let{$from:o,$to:i}=n.selection,s=o.blockRange(i);if(!s)return!1;let a=r?n.tr:null;return qM(a,s,t,e)?(r&&r(a.scrollIntoView()),!0):!1}}function qM(t,e,n,r=null){let o=!1,i=e,s=e.$from.doc;if(e.depth>=2&&e.$from.node(e.depth-1).type.compatibleContent(n)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let l=s.resolve(e.start-2);i=new Ha(l,l,e.depth),e.endIndex<e.parent.childCount&&(e=new Ha(e.$from,s.resolve(e.$to.end(e.depth)),e.depth)),o=!0}let a=Rb(i,n,r,e);return a?(t&&UM(t,e,a,o,n),!0):!1}function UM(t,e,n,r,o){let i=ye.empty;for(let u=n.length-1;u>=0;u--)i=ye.from(n[u].type.create(n[u].attrs,i));t.step(new Yt(e.start-(r?2:0),e.end,e.start,e.end,new ve(i,0,0),n.length,!0));let s=0;for(let u=0;u<n.length;u++)n[u].type==o&&(s=u+1);let a=n.length-s,l=e.start+n.length-(r?2:0),c=e.parent;for(let u=e.startIndex,d=e.endIndex,f=!0;u<d;u++,f=!1)!f&&Qn(t.doc,l,a)&&(t.split(l,a),l+=2*a),l+=c.child(u).nodeSize;return t}function VM(t){return function(e,n){let{$from:r,$to:o}=e.selection,i=r.blockRange(o,s=>s.childCount>0&&s.firstChild.type==t);return i?n?r.node(i.depth-1).type==t?HM(e,n,t,i):WM(e,n,i):!0:!1}}function HM(t,e,n,r){let o=t.tr,i=r.end,s=r.$to.end(r.depth);i<s&&(o.step(new Yt(i-1,s,i,s,new ve(ye.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new Ha(o.doc.resolve(r.$from.pos),o.doc.resolve(s),r.depth));const a=Ds(r);if(a==null)return!1;o.lift(r,a);let l=o.doc.resolve(o.mapping.map(i,-1)-1);return Dr(o.doc,l.pos)&&l.nodeBefore.type==l.nodeAfter.type&&o.join(l.pos),e(o.scrollIntoView()),!0}function WM(t,e,n){let r=t.tr,o=n.parent;for(let p=n.end,h=n.endIndex-1,m=n.startIndex;h>m;h--)p-=o.child(h).nodeSize,r.delete(p-1,p+1);let i=r.doc.resolve(n.start),s=i.nodeAfter;if(r.mapping.map(n.end)!=n.start+i.nodeAfter.nodeSize)return!1;let a=n.startIndex==0,l=n.endIndex==o.childCount,c=i.node(-1),u=i.index(-1);if(!c.canReplace(u+(a?0:1),u+1,s.content.append(l?ye.empty:ye.from(o))))return!1;let d=i.pos,f=d+s.nodeSize;return r.step(new Yt(d-(a?1:0),f+(l?1:0),d+1,f-1,new ve((a?ye.empty:ye.from(o.copy(ye.empty))).append(l?ye.empty:ye.from(o.copy(ye.empty))),a?0:1,l?0:1),a?0:1)),e(r.scrollIntoView()),!0}function GM(t){return function(e,n){let{$from:r,$to:o}=e.selection,i=r.blockRange(o,c=>c.childCount>0&&c.firstChild.type==t);if(!i)return!1;let s=i.startIndex;if(s==0)return!1;let a=i.parent,l=a.child(s-1);if(l.type!=t)return!1;if(n){let c=l.lastChild&&l.lastChild.type==a.type,u=ye.from(c?t.create():null),d=new ve(ye.from(t.create(null,ye.from(a.type.create(null,u)))),c?3:1,0),f=i.start,p=i.end;n(e.tr.step(new Yt(f-(c?3:1),p,f,p,d,1,!0)).scrollIntoView())}return!0}}const KM=(t,e={})=>({state:n,dispatch:r})=>{const o=mt(t,n.schema);return jM(o,e)(n,r)},Bl=(t,e)=>{for(let n=t.depth;n>0;n--){const r=t.node(n);if(e(r))return{pos:n>0?t.before(n):0,start:t.start(n),depth:n,node:r}}},Kt=t=>({$from:e})=>Bl(e,t),Dd=(t,e)=>{const n=e.filter(i=>i.type==="node").find(i=>i.name===t);if(!n)return!1;const r={name:n.name,options:n.options,storage:n.storage},o=He(_e(n,"group",r));return typeof o!="string"?!1:o.split(" ").includes("list")},JM={type:"element",name:"w:abstractNum",attributes:{"w:abstractNumId":"1","w15:restartNumberingAfterBreak":"0"},elements:[{type:"element",name:"w:multiLevelType",attributes:{"w:val":"hybridMultilevel"}},{type:"element",name:"w:tmpl",attributes:{"w:val":"EE6417C4"}},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"0","w:tplc":"0409000F"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"decimal"}},{type:"element",name:"w:lvlText",attributes:{"w:val":"%1."}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"left"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"720","w:hanging":"360"}}]}]},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"1","w:tplc":"04090019","w:tentative":"1"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"lowerLetter"}},{type:"element",name:"w:lvlText",attributes:{"w:val":"%2."}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"left"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"1440","w:hanging":"360"}}]}]},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"2","w:tplc":"0409001B","w:tentative":"1"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"lowerRoman"}},{type:"element",name:"w:lvlText",attributes:{"w:val":"%3."}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"right"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"2160","w:hanging":"180"}}]}]},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"3","w:tplc":"0409000F","w:tentative":"1"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"decimal"}},{type:"element",name:"w:lvlText",attributes:{"w:val":"%4."}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"left"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"2880","w:hanging":"360"}}]}]},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"4","w:tplc":"04090019","w:tentative":"1"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"lowerLetter"}},{type:"element",name:"w:lvlText",attributes:{"w:val":"%5."}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"left"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"3600","w:hanging":"360"}}]}]},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"5","w:tplc":"0409001B","w:tentative":"1"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"lowerRoman"}},{type:"element",name:"w:lvlText",attributes:{"w:val":"%6."}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"right"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"4320","w:hanging":"180"}}]}]},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"6","w:tplc":"0409000F","w:tentative":"1"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"decimal"}},{type:"element",name:"w:lvlText",attributes:{"w:val":"%7."}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"left"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"5040","w:hanging":"360"}}]}]},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"7","w:tplc":"04090019","w:tentative":"1"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"lowerLetter"}},{type:"element",name:"w:lvlText",attributes:{"w:val":"%8."}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"left"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"5760","w:hanging":"360"}}]}]},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"8","w:tplc":"0409001B","w:tentative":"1"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"lowerRoman"}},{type:"element",name:"w:lvlText",attributes:{"w:val":"%9."}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"right"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"6480","w:hanging":"180"}}]}]}]},XM={type:"element",name:"w:abstractNum",attributes:{"w:abstractNumId":"0","w15:restartNumberingAfterBreak":"0"},elements:[{type:"element",name:"w:nsid",attributes:{"w:val":"16126B07"}},{type:"element",name:"w:multiLevelType",attributes:{"w:val":"hybridMultilevel"}},{type:"element",name:"w:tmpl",attributes:{"w:val":"51EC4E08"}},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"0","w:tplc":"04090001"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"bullet"}},{type:"element",name:"w:lvlText",attributes:{"w:val":""}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"left"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"720","w:hanging":"360"}}]},{type:"element",name:"w:rPr",elements:[{type:"element",name:"w:rFonts",attributes:{"w:ascii":"Symbol","w:hAnsi":"Symbol","w:hint":"default"}}]}]},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"1","w:tplc":"04090003","w:tentative":"1"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"bullet"}},{type:"element",name:"w:lvlText",attributes:{"w:val":"o"}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"left"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"1440","w:hanging":"360"}}]},{type:"element",name:"w:rPr",elements:[{type:"element",name:"w:rFonts",attributes:{"w:ascii":"Courier New","w:hAnsi":"Courier New","w:cs":"Courier New","w:hint":"default"}}]}]},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"2","w:tplc":"04090005","w:tentative":"1"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"bullet"}},{type:"element",name:"w:lvlText",attributes:{"w:val":""}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"left"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"2160","w:hanging":"360"}}]},{type:"element",name:"w:rPr",elements:[{type:"element",name:"w:rFonts",attributes:{"w:ascii":"Wingdings","w:hAnsi":"Wingdings","w:hint":"default"}}]}]},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"3","w:tplc":"04090001","w:tentative":"1"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"bullet"}},{type:"element",name:"w:lvlText",attributes:{"w:val":""}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"left"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"2880","w:hanging":"360"}}]},{type:"element",name:"w:rPr",elements:[{type:"element",name:"w:rFonts",attributes:{"w:ascii":"Symbol","w:hAnsi":"Symbol","w:hint":"default"}}]}]},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"4","w:tplc":"04090003","w:tentative":"1"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"bullet"}},{type:"element",name:"w:lvlText",attributes:{"w:val":"o"}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"left"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"3600","w:hanging":"360"}}]},{type:"element",name:"w:rPr",elements:[{type:"element",name:"w:rFonts",attributes:{"w:ascii":"Courier New","w:hAnsi":"Courier New","w:cs":"Courier New","w:hint":"default"}}]}]},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"5","w:tplc":"04090005","w:tentative":"1"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"bullet"}},{type:"element",name:"w:lvlText",attributes:{"w:val":""}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"left"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"4320","w:hanging":"360"}}]},{type:"element",name:"w:rPr",elements:[{type:"element",name:"w:rFonts",attributes:{"w:ascii":"Wingdings","w:hAnsi":"Wingdings","w:hint":"default"}}]}]},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"6","w:tplc":"04090001","w:tentative":"1"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"bullet"}},{type:"element",name:"w:lvlText",attributes:{"w:val":""}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"left"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"5040","w:hanging":"360"}}]},{type:"element",name:"w:rPr",elements:[{type:"element",name:"w:rFonts",attributes:{"w:ascii":"Symbol","w:hAnsi":"Symbol","w:hint":"default"}}]}]},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"7","w:tplc":"04090003","w:tentative":"1"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"bullet"}},{type:"element",name:"w:lvlText",attributes:{"w:val":"o"}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"left"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"5760","w:hanging":"360"}}]},{type:"element",name:"w:rPr",elements:[{type:"element",name:"w:rFonts",attributes:{"w:ascii":"Courier New","w:hAnsi":"Courier New","w:cs":"Courier New","w:hint":"default"}}]}]},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"8","w:tplc":"04090005","w:tentative":"1"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"bullet"}},{type:"element",name:"w:lvlText",attributes:{"w:val":""}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"left"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"6480","w:hanging":"360"}}]},{type:"element",name:"w:rPr",elements:[{type:"element",name:"w:rFonts",attributes:{"w:ascii":"Wingdings","w:hAnsi":"Wingdings","w:hint":"default"}}]}]}]},du=(t,e)=>{const n=Kt(i=>i.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(r===void 0)return!0;const o=t.doc.nodeAt(r);return n.node.type===o?.type&&Dr(t.doc,n.pos)&&t.join(n.pos),!0},fu=(t,e)=>{const n=Kt(i=>i.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(n.start).after(n.depth);if(r===void 0)return!0;const o=t.doc.nodeAt(r);return n.node.type===o?.type&&Dr(t.doc,r)&&t.join(r),!0},YM=(t,e,n,r={})=>o=>{const{editor:i,tr:s,state:a,dispatch:l,chain:c,can:u,commands:d}=o,{extensions:f,splittableMarks:p}=i.extensionService,h=mt(t,a.schema),m=mt(e,a.schema),{selection:y,storedMarks:g}=a,{$from:x,$to:k}=y,b=x.blockRange(k),T=g||y.$to.parentOffset&&y.$from.marks();if(!b)return!1;const M=Kt(V=>Dd(V.type.name,f))(y),{numbering:_}=i.converter;if(b.depth>=1&&M&&b.depth-M.depth<=1){if(M.node.type===h){const{listId:V}=M.node.attrs;return i.converter.numbering=QM(V,_),d.liftListItem(m)}if(Dd(M.node.type.name,f)&&h.validContent(M.node.content)&&l)return c().command(()=>(s.setNodeMarkup(M.pos,h),!0)).command(()=>du(s,h)).command(()=>fu(s,h)).run()}const F=({ensureMarks:V=!1})=>()=>{const ie=u().wrapInList(h,r);if(V){const I=T.filter(W=>p.includes(W.type.name));s.ensureMarks(I)}return ie?!0:d.clearNodes()},C=o2(_.definitions);return i.converter.numbering=ZM(C,_,h),r.listId=C,!n||!T||!l?c().command(F({ensureMarks:!1})).wrapInList(h,r).command(()=>du(s,h)).command(()=>fu(s,h)).run():c().command(F({ensureMarks:!0})).wrapInList(h,r).command(()=>du(s,h)).command(()=>fu(s,h)).run()},o2=t=>Math.max(...Object.keys(t).map(Number))+1,ZM=(t,e,n)=>{const r=n.name==="orderedList"?JM:XM,o={...e},i=o2(o.abstracts),s={...r,attributes:{...r.attributes,"w:abstractNumId":String(i)}};o.abstracts[i]=s;const a={type:"element",name:"w:num",attributes:{"w:numId":String(t),"w16cid:durableId":"485517411"},elements:[{name:"w:abstractNumId",attributes:{"w:val":String(i)}}]};return o.definitions[t]=a,o},QM=(t,e)=>{const{definitions:n,abstracts:r}=e,o=n[t].elements[0].attributes["w:val"];return delete n[t],delete r[o],e},e5=t=>e=>{const{tr:n,state:r,dispatch:o,editor:i}=e,s=mt(t,r.schema),{$from:a,$to:l,node:c}=r.selection;if(c&&c.isBlock||a.depth<2||!a.sameParent(l))return!1;const u=a.node(-1);if(u.type!==s)return!1;const d=i.extensionService.attributes;if(a.parent.content.size===0&&a.node(-1).childCount===a.indexAfter(-1)){if(a.depth===2||a.node(-3).type!==s||a.index(-2)!==a.node(-2).childCount-1)return!1;if(o){let y=ye.empty;const g=a.index(-1)?1:a.index(-2)?2:3;for(let _=a.depth-g;_>=a.depth-3;_--)y=ye.from(a.node(_).copy(y));const x=a.indexAfter(-1)<a.node(-2).childCount?1:a.indexAfter(-2)<a.node(-3).childCount?2:3,k=Oe.getSplittedAttributes(d,a.node().type.name,a.node().attrs),b=s.contentMatch.defaultType?.createAndFill(k)||void 0;y=y.append(ye.from(s.createAndFill(null,b)||void 0));const T=a.before(a.depth-(g-1));n.replace(T,a.after(-x),new ve(y,4-g,0));let M=-1;n.doc.nodesBetween(T,n.doc.content.size,(_,F)=>{if(M>-1)return!1;_.isTextblock&&_.content.size===0&&(M=F+1)}),M>-1&&n.setSelection(Pe.near(n.doc.resolve(M))),n.scrollIntoView()}return!0}const f=l.pos===a.end()?u.contentMatchAt(0).defaultType:null,p=Oe.getSplittedAttributes(d,u.type.name,u.attrs),h=Oe.getSplittedAttributes(d,a.node().type.name,a.node().attrs);n.delete(a.pos,l.pos);const m=f?[{type:s,attrs:p},{type:f,attrs:h}]:[{type:s,attrs:p}];if(!Qn(n.doc,a.pos,2))return!1;if(o){const{selection:y,storedMarks:g}=r,{splittableMarks:x}=i.extensionService,k=g||y.$to.parentOffset&&y.$from.marks();if(n.split(a.pos,2,m).scrollIntoView(),!k||!o)return!0;const b=k.filter(T=>x.includes(T.type.name));n.ensureMarks(b)}return!0},t5=t=>({state:e,dispatch:n})=>{const r=mt(t,e.schema);return GM(r)(e,n)},n5=t=>({state:e,dispatch:n})=>{const r=mt(t,e.schema);return VM(r)(e,n)},r5=Object.freeze(Object.defineProperty({__proto__:null,clearNodes:xM,command:JO,createParagraphNear:fM,deleteSelection:EM,exitCode:hM,first:KO,insertContent:BM,insertContentAt:PM,insertTabChar:XO,insertTabNode:YO,joinBackward:MM,joinDown:OM,joinForward:_M,joinUp:$M,liftEmptyBlock:dM,liftListItem:n5,newlineInCode:pM,resetAttributes:TM,selectAll:CM,selectNodeBackward:NM,selectNodeForward:DM,selectTextblockEnd:FM,selectTextblockStart:IM,setMark:gM,setMeta:ZO,setNode:kM,sinkListItem:t5,splitBlock:uM,splitListItem:e5,toggleList:YM,toggleMark:vM,toggleNode:SM,undoInputRule:zM,unsetAllMarks:bM,unsetMark:wM,updateAttributes:AM,wrapInList:KM},Symbol.toStringTag,{value:"Module"})),o5=ot.create({name:"commands",addCommands(){return{...r5}}}),i5=()=>["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform),s5=()=>typeof navigator<"u"?/Mac/.test(navigator.platform):!1,a5=t=>{t.commands.first(({commands:e})=>[()=>e.newlineInCode(),()=>e.createParagraphNear(),()=>e.liftEmptyBlock(),()=>e.splitBlock()])},ki=t=>{t.commands.first(({commands:e,tr:n})=>[()=>e.undoInputRule(),()=>(n.setMeta("inputType","deleteContentBackward"),!1),()=>e.deleteSelection(),()=>e.joinBackward(),()=>e.selectNodeBackward()])},Co=t=>{t.commands.first(({commands:e})=>[()=>e.deleteSelection(),()=>e.joinForward(),()=>e.selectNodeForward()])},l5=ot.create({name:"keymap",addShortcuts(){const t={Enter:()=>a5(this.editor),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:()=>ki(this.editor),"Mod-Backspace":()=>ki(this.editor),"Shift-Backspace":()=>ki(this.editor),Delete:()=>Co(this.editor),"Mod-Delete":()=>Co(this.editor),"Mod-a":()=>this.editor.commands.selectAll(),Tab:()=>this.editor.commands.insertTabNode()},e={...t},n={...t,"Ctrl-h":()=>ki(this.editor),"Alt-Backspace":()=>ki(this.editor),"Ctrl-d":()=>Co(this.editor),"Ctrl-Alt-Backspace":()=>Co(this.editor),"Alt-Delete":()=>Co(this.editor),"Alt-d":()=>Co(this.editor),"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd(),"Ctrl-t":()=>this.editor.commands.insertTabChar()};return s5()||i5()?n:e}}),c5=ot.create({name:"editable",addPmPlugins(){return[new Qe({key:new tt("editable"),props:{editable:()=>this.editor.options.editable}})]}}),u5=ot.create({name:"editorFocus",addPmPlugins(){const t=this.editor;return[new Qe({key:new tt("editorFocus"),props:{handleDOMEvents:{focus:(e,n)=>{t.isFocused=!0;const r=t.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1},blur:(e,n)=>{t.isFocused=!1;const r=t.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1}}}})]}});function i2(t,e,n,{check:r=!1}={}){const o=t.getSchema(n);if(o){const i=e.nodeFromJSON(o);return r&&i.check(),i}return e.topNodeType.createAndFill()}function s2(t,e,n={}){if(!e)return ll(t,null,n)||al(t,null,n);const r=Ls(e,t.schema);return r==="node"?ll(t,e,n):r==="mark"?al(t,e,n):!1}const rp=({tr:t,from:e,to:n,markName:r,attrs:o={},offset:i=1})=>{const{doc:s}=t,a=Math.max(e-i,0),l=Math.min(n+i,s.content.size);let c;return s.nodesBetween(a,l,(u,d)=>{if(!u||u?.nodeSize===void 0)return;const f=u.marks.find(p=>p.type.name===r&&Object.keys(o).every(h=>p.attrs[h]===o[h]));f&&!c&&(c={from:d,to:d+u.nodeSize,mark:f})}),c},a2=({tr:t,from:e,to:n,user:r,date:o})=>{t.removeMark(e,n,t.doc.type.schema.marks[ut]),t.removeMark(e,n,t.doc.type.schema.marks[Ft]);let i=rp({tr:t,from:e,to:n,markName:Ft,attrs:{authorEmail:r.email}}),s;i?s=i.mark.attrs.id:s=go();const a=t.doc.type.schema.marks[Ft].create({id:s,author:r.name,authorEmail:r.email,date:o});return t.addMark(e,n,a),t.doc.nodesBetween(e,n,(l,c)=>{if(c<e||["bulletList","orderedList"].includes(l.type.name))return!0;if(l.isInline||["tableRow","tableCell"].includes(l.type.name)||(l.attrs.track,l.type.name==="table"))return!1}),a},l2=({tr:t,from:e,to:n,user:r,date:o})=>{let i=rp({tr:t,from:e,to:n,markName:ut,attrs:{authorEmail:r.email}}),s;i?s=i.mark.attrs.id:s=go();const a=t.doc.type.schema.marks[ut].create({id:s,author:r.name,authorEmail:r.email,date:o}),l=new Jo;let c=[];return t.doc.nodesBetween(e,n,(u,d)=>{if(!u.type.name.includes("table"))if(u.isInline&&u.marks.find(f=>f.type.name===Ft&&f.attrs.authorEmail===r.email)){const f=new $t(l.map(Math.max(e,d)),l.map(Math.min(n,d+u.nodeSize)),ve.empty);t.maybeStep(f).failed||l.appendMap(f.getMap())}else u.isInline&&!u.marks.find(f=>f.type.name===ut)?(c.push(u),t.addMark(l.map(Math.max(e,d)),l.map(Math.min(n,d+u.nodeSize)),a)):u.attrs.track&&!u.attrs.track.find(f=>f.type===ut)&&["bulletList","orderedList"].includes(u.type.name)}),{deletionMark:a,deletionMap:l,nodes:c}};function d5(t){const e={bulletList:1,orderedList:2};return{attributes:{parentAttributes:{"w14:paraId":Jn(),"w14:textId":Jn(),"w:rsidR":Jn(),"w:rsidRDefault":Jn(),"w:rsidP":Jn(),paragraphProperties:{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:pStyle",attributes:{"w:val":"ListParagraph"}},{type:"element",name:"w:numPr",elements:[{type:"element",name:"w:ilvl",attributes:{"w:val":"0"}},{type:"element",name:"w:numId",attributes:{"w:val":e[t]||0}}]}]}}}}}function f5(t,e,n){const r=[];return t===e?n.resolve(t).marks().forEach(o=>{const i=n.resolve(t-1),s=np(i,o.type);s&&r.push({mark:o,...s})}):n.nodesBetween(t,e,(o,i)=>{!o||o?.nodeSize===void 0||r.push(...o.marks.map(s=>({from:i,to:i+o.nodeSize,mark:s})))}),r}function op(t,e){const n=[];return t.descendants((r,o)=>{e(r)&&n.push({node:r,pos:o})}),n}function cl(t=0,e=0,n=0){return Math.min(Math.max(t,e),n)}function c2(t,e,n){const r=t.state.doc.content.size,o=cl(e,0,r),i=cl(n,0,r),s=t.coordsAtPos(o),a=t.coordsAtPos(i,-1),l=Math.min(s.top,a.top),c=Math.max(s.bottom,a.bottom),u=Math.min(s.left,a.left),d=Math.max(s.right,a.right),f=d-u,p=c-l,h={top:l,bottom:c,left:u,right:d,width:f,height:p,x:u,y:l};return{...h,toJSON:()=>h}}const ip=t=>{const{$head:e}=t.selection;for(let n=e.depth;n>0;n-=1)if(e.node(n).type?.spec?.tableRole==="row")return!0;return!1},sp=Object.freeze(Object.defineProperty({__proto__:null,chainableEditorState:Zf,cleanSchemaItem:Od,createDocument:i2,defaultBlockAt:t2,findChildren:op,findMark:Nl,findParentNode:Kt,findParentNodeClosestToPos:Bl,generateDocxListAttributes:d5,generateDocxRandomId:Jn,generateRandom32BitHex:If,getActiveFormatting:Lf,getExtensionConfigField:_e,getMarkRange:np,getMarkType:sr,getMarksBetween:f5,getMarksFromSelection:Is,getNodeType:mt,getSchemaTypeByName:ys,getSchemaTypeNameByName:Ls,isActive:s2,isInTable:ip,isList:Dd,isMarkActive:al,isNodeActive:ll,isTextSelection:n2,posToDOMRect:c2},Symbol.toStringTag,{value:"Module"})),p5=(t,e,n)=>{const r=t.resolve(e),o=r.parent,i=o.childAfter(r.parentOffset);if(!i.node)return null;const s=i.node.marks.find(d=>d.type.name===n);let a=r.index(),l=r.start()+i.offset;for(;a>0&&s.isInSet(o.child(a-1).marks);)l-=o.child(--a).nodeSize;let c=r.index()+1,u=r.start()+i.offset+i.node.nodeSize;for(;c<o.childCount&&s.isInSet(o.child(c).marks);)u+=o.child(c++).nodeSize;return{from:l,to:u,attrs:s.attrs}},u2=(t,e=!0)=>{if(!t)throw new Error('Invalid "node" parameter');const n=[];return t.descendants((r,o)=>{if(n.push({node:r,pos:o}),!e)return!1}),n},d2=(t,e,n)=>{if(t){if(!e)throw new Error('Invalid "predicate" parameter')}else throw new Error('Invalid "node" parameter');return u2(t,n).filter(r=>e(r.node))},f2=(t,e)=>d2(t,n=>n.isInline,e),h5=Object.freeze(Object.defineProperty({__proto__:null,findChildren:d2,findInlineNodes:f2,findMarkPosition:p5,flatten:u2},Symbol.toStringTag,{value:"Module"})),ap=(t,e=null)=>{const n=[],r=f2(t.doc);return r.length?(r.forEach(({node:o,pos:i})=>{const{marks:s}=o,a=[Ft,ut,vt];s.length>0&&s.forEach(l=>{a.includes(l.type.name)&&n.push({mark:l,from:i,to:i+o.nodeSize})})}),e?n.filter(({mark:o})=>o.attrs.id===e):n):n},ht=new tt("TrackChangesBase"),m5=(t={})=>new Qe({key:ht,state:{init(e,n){return{isTrackChangesActive:!1,onlyOriginalShown:!1,onlyModifiedShown:!1,decorations:Eo(n,!1,!1)}},apply(e,n,r,o){const i=e.getMeta(ht);return i?i.type==="TRACK_CHANGES_ENABLE"?{...n,isTrackChangesActive:i.value===!0,decorations:Eo(o,n.onlyOriginalShown,n.onlyModifiedShown)}:i.type==="SHOW_ONLY_ORIGINAL"?{...n,onlyOriginalShown:i.value===!0,onlyModifiedShown:!1,decorations:Eo(o,i.value===!0,!1)}:i.type==="SHOW_ONLY_MODIFIED"?{...n,onlyOriginalShown:!1,onlyModifiedShown:i.value===!0,decorations:Eo(o,!1,i.value===!0)}:{...n,decorations:Eo(o,n.onlyOriginalShown,n.onlyModifiedShown)}:{...n,decorations:Eo(o,n.onlyOriginalShown,n.onlyModifiedShown)}}},props:{decorations(e){return this.getState(e)?.decorations}}}),Eo=(t,e,n)=>{if(!t.doc||!t.doc.nodeSize||n&&e)return Le.empty;const r=[],o=ap(t);return o.length?(o.forEach(({mark:i,from:s,to:a})=>{if(i.type.name===Ft)if(e){const l=ze.inline(s,a,{class:"track-insert-dec hidden"});r.push(l)}else if(n){const l=ze.inline(s,a,{class:"track-insert-dec normal"});r.push(l)}else{const l=ze.inline(s,a,{class:"track-insert-dec highlighted"});r.push(l)}if(i.type.name===ut)if(e){const l=ze.inline(s,a,{class:"track-delete-dec normal"});r.push(l)}else if(n){const l=ze.inline(s,a,{class:"track-delete-dec hidden"});r.push(l)}else{const l=ze.inline(s,a,{class:"track-delete-dec highlighted"});r.push(l);const c=ze.widget(s,()=>{const u=document.createElement("span");return u.classList.add("track-delete-widget"),u.contentEditable=!1,u},{ignoreSelection:!0});r.push(c)}if(i.type.name===vt)if(e){const l=ze.inline(s,a,{class:"track-format-dec before"});r.push(l)}else if(n){const l=ze.inline(s,a,{class:"track-format-dec normal"});r.push(l)}else{const l=ze.inline(s,a,{class:"track-format-dec highlighted"});r.push(l)}}),Le.create(t.doc,r)):Le.empty},nn="commentMark",uy=({commentId:t,state:e,tr:n,dispatch:r})=>{g5(t,e.doc).forEach(({from:o,to:i})=>{n.removeMark(o,i,e.schema.marks[nn])}),r(n)},g5=(t,e)=>{const n=[];return e.descendants((r,o)=>{const{marks:i}=r,s=i.find(a=>a.type.name===nn);if(s){const{attrs:a}=s,{commentId:l}=a;t===l&&n.push({from:o,to:o+r.nodeSize})}}),n},y5=(t,e,n,r=[])=>{const o=[],i=[],s=new Set;return t.descendants((a,l)=>{(a.marks?.filter(c=>c.type.name===nn)).forEach(c=>{if(c){const{attrs:u={}}=c,{commentId:d}=u;if(d==="pending"||s.has(d))return;s.add(d);const f=dy(c.attrs),p=n.nodes.commentRangeStart.create(f);o.push({pos:l,node:p});const h=n.nodes.commentRangeEnd.create(f);i.push({pos:l+a.nodeSize,node:h});const m=d;m&&r.filter(y=>y.parentCommentId===m).sort((y,g)=>y.createdTime-g.createdTime).forEach(y=>{const g=dy(y),x=n.nodes.commentRangeStart.create(g);s.add(y.commentId),o.push({pos:l,node:x});const k=n.nodes.commentRangeEnd.create(g);i.push({pos:l+a.nodeSize,node:k})})}})}),o.forEach(a=>{const{pos:l,node:c}=a,u=e.mapping.map(l);e.insert(u,c)}),i.forEach(a=>{const{pos:l,node:c}=a,u=e.mapping.map(l);e.insert(u,c)}),e},dy=t=>{const{commentId:e,internal:n}=t;return{"w:id":e,internal:n}},w5=(t,e,n,r)=>{const o=[],i=[];t.descendants((s,a)=>{const{type:l}=s;if(!["commentRangeStart","commentRangeEnd","commentReference"].includes(l.name))return;const c=r.comments?.find(d=>d.importedId==s.attrs["w:id"])||{},{commentId:u}=c;if(u)if(l.name==="commentRangeStart")o.push({"w:id":u,importedId:s.attrs["w:id"],internal:!1,start:a}),i.push({start:a,end:a+1});else if(l.name==="commentRangeEnd"){const d=o.find(h=>h.importedId===s.attrs["w:id"]);if(!d)return;const{start:f}=d,p={commentId:u,importedId:s.attrs["w:id"],internal:d.internal};e.addMark(f,a+1,n.marks[nn].create(p)),i.push({start:a,end:a+1})}else l.name==="commentReference"&&i.push({start:a,end:a+1})}),i.sort((s,a)=>a.start-s.start).forEach(({start:s,end:a})=>{e.delete(s,a)})},b5=(t={})=>{const{before:e=[],after:n=[]}=t,r=new Set(e.map(h=>h.type)),o=new Set(n.map(h=>h.type)),i=[...o].filter(h=>!r.has(h)),s=[...r].filter(h=>!o.has(h)),a=[],l=i.filter(h=>!["textStyle","commentMark"].includes(h));l.length&&a.push(`Added formatting: ${l.join(", ")}`);const c=s.filter(h=>!["textStyle","commentMark"].includes(h));c.length&&a.push(`Removed formatting: ${c.join(", ")}`);const u=e.find(h=>h.type==="textStyle")?.attrs||{},d=n.find(h=>h.type==="textStyle")?.attrs||{},f=[],p=h=>h.replace(/([a-z])([A-Z])/g,"$1 $2").toLowerCase();return Object.keys({...u,...d}).forEach(h=>{const m=u[h],y=d[h];if(m!==y){if(y===null)return;if(h==="color")f.push("Changed color");else{const g=p(h);m==null?f.push(`Set ${g} to ${y}`):f.push(`Changed ${g} from ${m} to ${y}`)}}}),f.length&&a.push(`Modified text style: ${f.join(", ")}`),a.length?a.join(". "):"No formatting changes."},v5=({activeThreadId:t,threadId:e,isInternal:n,editor:r})=>{if(!r.options.isInternal&&n)return"transparent";const o=bt.getState(r.state),i=n?o.internalColor:o.externalColor,s=t==e?"44":"22";return`${i}${s}`},to=new tt("paginationPlugin"),x5=async t=>{if(!t.converter)return;const e={headers:{},footers:{}},n=t.converter.headerIds,r=t.converter.footerIds;for(let o in n){const i=n[o];if(!i)continue;const s=t.converter.headers[i];e.headers[i]||(e.headers[i]={}),e.headers[i].data=s;const{height:a,sectionEditor:l,sectionContainer:c}=await fy(t,s);e.headers[i].height=a,e.headers[i].sectionEditor=l,e.headers[i].sectionContainer=c}for(let o in r){const i=r[o];if(!i)continue;const s=t.converter.footers[i];e.headers[i]||(e.footers[i]={}),e.footers[i].data=s;const{height:a,sectionEditor:l,sectionContainer:c}=await fy(t,s);e.footers[i].height=a,e.footers[i].sectionEditor=l,e.footers[i].sectionContainer=c}return e},fy=async(t,e)=>new Promise(n=>{const r=document.createElement("div");r.className="super-editor",r.style.padding=0,r.style.margin=0;const o=t.converter.getDocumentDefaultStyles(),{fontSizePt:i,typeface:s}=o,a=i*1.3333,l=a*1.15;Object.assign(r.style,{padding:"0",margin:"0",border:"none",boxSizing:"border-box",position:"absolute",top:"0",left:"0",width:"auto",maxWidth:"none",fontFamily:s,fontSize:`${a}px`,lineHeight:`${l}px`}),document.body.appendChild(r);const c=new ws({loadFromSchema:!0,mode:"text",editable:!1,element:r,content:e,extensions:xp(),documentId:"sectionId"});c.on("create",()=>{requestAnimationFrame(()=>{const u=r.offsetHeight;document.body.removeChild(r),Object.assign(r.style,{padding:"0",margin:"0",border:"none",boxSizing:"border-box",position:"relative",top:"initial",left:"initial",width:"initial",maxWidth:"initial",fontFamily:"initial",fontSize:"initial",lineHeight:"initial"}),n({height:u,sectionEditor:c,sectionContainer:r})})})}),lp=[Ft,ut,vt],bt=new tt("comments"),k5=ot.create({name:"comments",addCommands(){return{insertComment:t=>({tr:e,dispatch:n,state:r})=>{const{selection:o}=e,{$from:i,$to:s}=o,{commentId:a,isInternal:l}=t;return e.setMeta(bt,{event:"add"}),e.addMark(i.pos,s.pos,this.editor.schema.marks[nn].create({commentId:a,internal:l})),n(e),!0},removeComment:({commentId:t,importedId:e})=>({tr:n,dispatch:r,state:o})=>{n.setMeta(bt,{event:"deleted"}),uy({commentId:t,state:o,tr:n,dispatch:r})},setActiveComment:({commentId:t})=>({tr:e,dispatch:n})=>{let r=t;return e.setMeta(bt,{type:"setActiveComment",activeThreadId:r}),!0},setCommentInternal:({commentId:t,isInternal:e})=>({tr:n,dispatch:r,state:o})=>{const{doc:i}=o;let s,a;return n.setMeta(bt,{event:"update"}),i.descendants((l,c)=>{if(s)return;const{marks:u=[]}=l,d=u.find(f=>f.type.name===nn);if(d){const{attrs:f}=d;f.commentId===t&&(s=l,a=c)}}),s?(n.addMark(a,a+s.nodeSize,this.editor.schema.marks[nn].create({commentId:t,internal:e})),n.setMeta(bt,{type:"setCommentInternal"}),r(n),!0):!1},resolveComment:({commentId:t})=>({tr:e,dispatch:n,state:r})=>{e.setMeta(bt,{event:"update"}),uy({commentId:t,state:r,tr:e,dispatch:n})}}},addPmPlugins(){const t=this.editor;let e,n;return t.options.isHeadless?[]:[new Qe({key:bt,state:{init(){return{activeThreadId:null,externalColor:"#B1124B",internalColor:"#078383",decorations:Le.empty,allCommentPositions:{},allCommentIds:[],changedActiveThread:!1,trackedChanges:{}}},apply(r,o,i,s){const a=r.getMeta(to)?.isReadyToInit;a&&(e=!0);const l=r.getMeta(bt),{type:c}=l||{};if(c==="force"&&(e=!0),!a&&!e&&l&&l.decorations)return{...o,decorations:l.decorations,allCommentPositions:l.allCommentPositions};const u=r.getMeta(ht),d=o.trackedChanges;u&&(o.trackedChanges=C5(u,d,s,t));const f=l?.type==="setActiveComment";if(!r.docChanged&&r.selectionSet||f){const{selection:p}=r;let h=S5(s.doc,p);if(f&&(h=l.activeThreadId),n!==h){n=h;const m={type:Aa.SELECTED,activeCommentId:n||null};e=!0,t.emit("commentsUpdate",m);const{tr:y}=t.view.state,{dispatch:g}=t.view;y.setMeta(bt,{type:"force"}),g(y)}}return o}},props:{decorations(r){return this.getState(r).decorations}},view(r){let o;return{update(i,s){const{state:a}=i,{doc:l,tr:c}=a;if(o&&!o.eq(l)&&(e=!0),!e)return;o=l,e=!1;const u=[],d={};l.descendants((p,h)=>{const{marks:m=[]}=p,y=m.filter(k=>k.type.name===nn);let g=!1;y.forEach(k=>{const{attrs:b}=k,T=b.commentId||b.importedId,M=i.coordsAtPos(h);py({allCommentPositions:d,threadId:T,pos:h,currentBounds:M,node:p});const _=b.internal;g||(g=n===T);let F=v5({activeThreadId:n,threadId:T,isInternal:_,editor:t});const C=ze.inline(h,h+p.nodeSize,{style:`background-color: ${F};`,"data-thread-id":T,class:"comment-highlight"});g&&n!==T||u.push(C)});const x=p2({doc:l,from:h,to:h+p.nodeSize});if(x){const k=i.coordsAtPos(h),{id:b}=x.mark.attrs;py({allCommentPositions:d,threadId:b,pos:h,currentBounds:k,node:p})}});const f=Le.create(l,u);if(!bt.getState(a).decorations.eq(f)){const p=a.tr.setMeta(bt,{decorations:f,allCommentPositions:d});i.dispatch(p)}t.emit("comment-positions",{allCommentPositions:d})}}}})]}}),py=({allCommentPositions:t,threadId:e,pos:n,currentBounds:r,node:o})=>{let i={};if(r instanceof DOMRect?i={top:r.top,bottom:r.bottom,left:r.left,right:r.right}:i={...r},!t[e])t[e]={threadId:e,start:n,end:n+o.nodeSize,bounds:i};else{const s=t[e];s.start=Math.min(s.start,n),s.end=Math.max(s.end,n+o.nodeSize),s.bounds.top=Math.min(s.bounds.top,r.top),s.bounds.bottom=Math.max(s.bounds.bottom,r.bottom)}},S5=(t,e)=>{if(!e)return;const{$from:n,$to:r}=e;if(n.pos!==r.pos||!t.nodeAt(n.pos))return;const o=p2({doc:t,from:n.pos,to:r.pos});if(o)return o.mark.attrs.id;const i=[];let s=!1;t.descendants((d,f)=>{if(s)return;const p=f+d.nodeSize;if(n.pos<f||n.pos>=p)return;const{marks:h=[]}=d;h.find(m=>m.type.name===nn)&&i.push({node:d,pos:f,size:d.nodeSize}),f>n.pos&&(s=!0)});let a=null,l=null;i.forEach(({pos:d,node:f})=>{a||(a=n.pos-d);const p=n.pos-d;p>=0&&p<=a&&(l=f,a=p)});const{marks:c=[]}=l||{},u=c.find(d=>d.type.name===nn);return u?.attrs?.commentId||u?.attrs?.importedId},p2=({doc:t,from:e,to:n,offset:r=1})=>{const o=Math.max(e-r,0),i=Math.min(n+r,t.content.size);let s;return t.nodesBetween(o,i,(a,l)=>{if(!a||a?.nodeSize===void 0)return;const c=a.marks.find(u=>lp.includes(u.type.name));c&&!s&&(s={from:l,to:l+a.nodeSize,mark:c})}),s},C5=(t,e,n,r)=>{const{insertedMark:o,deletionMark:i,formatMark:s,deletionNodes:a}=t;if(!o&&!i&&!s)return;const l={...e};let c=o?.attrs?.id||i?.attrs?.id||s?.attrs?.id;if(!c)return e;let u=!1;l[c]||(l[c]={},u=!0),o&&(l[c].insertion=c),i&&(l[c].deletion=i.attrs?.id),s&&(l[c].format=s.attrs?.id);const{step:d}=t;let f=d?.slice?.content?.content||[];f.length||n.doc.descendants((h,m)=>{if(h.marks.find(y=>y.type.name===vt))return f=[h],!1});const p=A5({documentId:r.options.documentId,event:u?"add":"update",marks:{insertedMark:o,deletionMark:i,formatMark:s},deletionNodes:a,nodes:f,newEditorState:n});return p&&r.emit("commentsUpdate",p),l},E5=({state:t,node:e,mark:n,marks:r,trackedChangeType:o,isDeletionInsertion:i,deletionNodes:s=[]})=>{let a="",l="";if(o===Ft&&(a=e?.text??""),o===vt&&(a=b5(n.attrs)),(o===ut||i)&&(l=e?.text??"",i)){let{id:c}=r.deletionMark.attrs;l=T5(t.doc,u=>{const{marks:d=[]}=u,f=d.filter(p=>lp.includes(p.type.name));if(!f.length)return!1;if(f.find(p=>p.attrs.id===c))return!0})?.node.text??""}return{deletionText:l,trackedChangeText:a}},A5=({event:t,marks:e,deletionNodes:n,nodes:r,newEditorState:o,documentId:i})=>{const s=e.insertedMark||e.deletionMark||e.formatMark,{type:a,attrs:l}=s,{name:c}=a,{author:u,authorEmail:d,date:f}=l,p=l.id,h=r[0],m=!!(e.insertedMark&&e.deletionMark);let y;o.doc.descendants((b,T)=>{const{marks:M=[]}=b,_=M.filter(F=>lp.includes(F.type.name));if(_.length&&(_.find(F=>F.attrs.id===p)&&(y=b),y))return!1});const{deletionText:g,trackedChangeText:x}=E5({state:o,node:y||h,mark:s,marks:e,trackedChangeType:c,isDeletionInsertion:m,deletionNodes:n});if(!g&&!x)return;const k={event:Aa.ADD,type:"trackedChange",documentId:i,changeId:p,trackedChangeType:m?"both":c,trackedChangeText:x,deletedText:e.deletionMark?g:null,author:u,authorEmail:d,date:f};return t==="add"?k.event=Aa.ADD:t==="update"&&(k.event=Aa.UPDATE),k};function T5(t,e){let n=null;return t.descendants((r,o)=>{if(e(r)&&(n={node:r,pos:o}),n)return!1}),n}const h2=({state:t,tr:e,step:n,newTr:r,map:o,doc:i,user:s,date:a,originalStep:l,originalStepIndex:c})=>{const u=t.schema.marks[ut],d=Nl(t,u,!1),f=d?d.to:n.to,p=new $t(f,f,n.slice,n.structure),h=l.invert(e.docs[c]).map(o);o.appendMap(h.getMap());const m={};if(p){const y=t.apply(r).tr;if(y.maybeStep(p).failed)return;const g=p.getMap().map(p.to),x=a2({tr:y,from:p.from,to:g,user:s,date:a}),k=new $t(p.from,p.to,y.doc.slice(p.from,g));r.step(k);const b=o.maps.length-1;o.appendMap(k.getMap(),b),p.from!==g&&(m.insertedMark=x,m.step=k),r.selection.eq(y.selection)||r.setSelection(y.selection)}if(n.from!==n.to){const{deletionMark:y,deletionMap:g,nodes:x}=l2({tr:r,from:n.from,to:n.to,user:s,date:a});m.deletionNodes=x,m.deletionMark=y,o.appendMapping(g)}r.setMeta(ht,m),r.setMeta(bt,{type:"force"})},$5=()=>{},O5=()=>{},m2=({state:t,tr:e,step:n,newTr:r,map:o,doc:i,user:s,date:a})=>{const l={};i.nodesBetween(n.from,n.to,(c,u)=>{if(!c.isInline)return;if(c.marks.find(p=>p.type.name===ut))return!1;const d=c.marks.find(p=>[ut,vt].includes(p.type.name)),f=d?d.attrs.id:go();if(r.addMark(Math.max(n.from,u),Math.min(n.to,u+c.nodeSize),n.mark),["bold","italic","strike","underline","textStyle"].includes(n.mark.type.name)&&!c.marks.find(p=>p.type===n.mark.type)){const p=c.marks.find(y=>y.type.name===vt);let h=[],m=[];if(p?p.attrs.before.find(y=>y.type==="textStyle"?y.type===n.mark.type.name&&Zo(y.attrs,n.mark.attrs):y.type===n.mark.type.name)?(m=[...p.attrs.before.filter(y=>y.type!==n.mark.type.name)],h=[...p.attrs.after]):(m=[...p.attrs.before],h=[...p.attrs.after,{type:n.mark.type.name,attrs:{...n.mark.attrs}}]):(m=c.marks.map(y=>({type:y.type.name,attrs:{...y.attrs}})),h=[{type:n.mark.type.name,attrs:{...n.mark.attrs}}]),h.length||m.length){const y=t.schema.marks[vt].create({id:f,author:s.name,authorEmail:s.email,date:a,before:m,after:h});r.addMark(n.from,n.to,y),l.formatMark=y,l.step=n,r.setMeta(ht,l),r.setMeta(bt,{type:"force"})}else p&&r.removeMark(Math.max(n.from,u),Math.min(n.to,u+c.nodeSize),p)}})},g2=({state:t,tr:e,step:n,newTr:r,map:o,doc:i,user:s,date:a})=>{const l={};i.nodesBetween(n.from,n.to,(c,u)=>{if(!c.isInline)return!0;if(c.marks.find(d=>d.type.name===ut))return!1;if(r.removeMark(Math.max(n.from,u),Math.min(n.to,u+c.nodeSize),n.mark),["bold","italic","strike","underline","textStyle"].includes(n.mark.type.name)&&c.marks.find(d=>d.type===n.mark.type)){const d=c.marks.find(h=>h.type.name===vt);let f=[],p=[];if(d?d.attrs.after.find(h=>h.type===n.mark.type.name)?(f=[...d.attrs.after.filter(h=>h.type!==n.mark.type.name)],p=[...d.attrs.before]):(f=[...d.attrs.after],p=[...d.attrs.before,{type:n.mark.type.name,attrs:{...n.mark.attrs}}]):(f=[],p=[{type:n.mark.type.name,attrs:{...n.mark.attrs}}]),f.length||p.length){const h=t.schema.marks[vt].create({id:go(),author:s.name,authorEmail:s.email,date:a,before:p,after:f});r.addMark(Math.max(n.from,u),Math.min(n.to,u+c.nodeSize),h),l.formatMark=h,l.step=n,r.setMeta(ht,l),r.setMeta(bt,{type:"force"})}else d&&r.removeMark(Math.max(n.from,u),Math.min(n.to,u+c.nodeSize),d)}})},y2=({tr:t,state:e,user:n})=>{const r=["inputType","uiEvent","paste","pointer"],o=["historyUndo","historyRedo","acceptReject"];if(!t.steps.length||t.meta&&!Object.keys(t.meta).every(c=>r.includes(c))||o.includes(t.getMeta("inputType"))||t.getMeta(bt))return t;const i=e.tr,s=new Jo,a=Math.floor(Date.now()/6e5)*6e5,l=new Date(a).toISOString();if(t.steps.forEach((c,u)=>{const d=c.map(s),{doc:f}=i;d&&(d instanceof $t?(h2({state:e,tr:t,step:d,newTr:i,map:s,doc:f,user:n,date:l,originalStep:c,originalStepIndex:u}),console.debug("[track-changes]: replaceStep")):d instanceof Ns?(m2({state:e,tr:t,step:d,newTr:i,map:s,doc:f,user:n,date:l}),console.debug("[track-changes]: addMarkStep")):d instanceof yn?(g2({state:e,tr:t,step:d,newTr:i,map:s,doc:f,user:n,date:l}),console.debug("[track-changes]: removeMarkStep")):(i.step(d),console.log("[track-changes]: otherStep")))}),t.getMeta("inputType")&&i.setMeta(t.getMeta("inputType")),t.getMeta("uiEvent")&&i.setMeta(t.getMeta("uiEvent")),t.selectionSet){const c=e.schema.marks[ut],u=Nl(e,c,!1);if(t.selection instanceof Pe&&(t.selection.from<e.selection.from||t.getMeta("inputType")==="deleteContentBackward")){const d=s.map(t.selection.from,-1);i.setSelection(new Pe(i.doc.resolve(d)))}else if(t.selection.from>e.selection.from&&u){const d=s.map(u.to+1,1);i.setSelection(new Pe(i.doc.resolve(d)))}else i.setSelection(t.selection.map(i.doc,s))}else if(e.selection.from-t.selection.from>1&&t.selection.$head.depth>1){const c=s.map(t.selection.from-2,-1);i.setSelection(new Pe(i.doc.resolve(c)))}return t.storedMarksSet&&i.setStoredMarks(t.storedMarks),t.scrolledIntoView&&i.scrollIntoView(),i},M5=t=>{const{state:e}=t,{dispatch:n}=t.view,{tr:r}=e;if(n)return e.doc.descendants((o,i)=>{if(o.type.name==="paragraph"){const{attrs:s}=o,{spacing:a}=s;if(!a)return;const l={line:Vo(ct(a.line)),lineSpaceBefore:Vo(ct(a.lineSpaceBefore)),lineSpaceAfter:Vo(ct(a.lineSpaceAfter))};r.setNodeMarkup(i,void 0,{...s,spacing:{...a,...l}})}}),n(r),!0},_5={initial:M5},hy=t=>{if(t==="initial"||t==="0.4.14")return Object.values(_5)};var jo,w2,qe,b2,v2,pu,x2,Id,Fd,hu,mu,Bd,Rd,gu,yu,wu,my,Pi,zi,gy,yy,k2,S2;const N5=class C2 extends MO{constructor(e){super(),Sr(this,qe),Sr(this,jo),Fe(this,"extensionService"),Fe(this,"extensionStorage",{}),Fe(this,"schema"),Fe(this,"view"),Fe(this,"isFocused",!1),Sr(this,w2),Fe(this,"options",{element:null,isHeadless:!1,mockDocument:null,mockWindow:null,content:"",user:null,users:[],media:{},mediaFiles:{},fonts:{},documentMode:"editing",mode:"docx",role:"editor",colors:[],converter:null,fileSource:null,initialState:null,documentId:null,extensions:[],editable:!0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,isCommentsEnabled:!1,isNewFile:!1,scale:1,annotations:!1,isInternal:!1,externalExtensions:[],numbering:{},onBeforeCreate:()=>null,onCreate:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:r})=>{throw r},onTrackedChangesUpdate:()=>null,onCommentsUpdate:()=>null,onCommentsLoaded:()=>null,onCommentClicked:()=>null,onCommentLocationsUpdate:()=>null,onDocumentLocked:()=>null,onFirstRender:()=>null,onCollaborationReady:()=>null,onPaginationUpdate:()=>null,onException:()=>null,handleImageUpload:null,telemetry:null}),e.element=e.isHeadless?null:e.element||document.createElement("div"),Ie(this,qe,x2).call(this,e),this.setOptions(e);let n={docx:()=>Ie(this,qe,b2).call(this,this.options),text:()=>Ie(this,qe,v2).call(this,this.options),default:()=>{console.log("Not implemented.")}};(n[this.options.mode]??n.default)()}setToolbar(e){this.toolbar=e}get state(){return this.view.state}get storage(){return this.extensionStorage}get commands(){return Kn(this,jo).commands}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get isDestroyed(){return this.view.isDestroyed}get element(){return this.options.element}get users(){return this.options.users}chain(){return Kn(this,jo).chain()}can(){return Kn(this,jo).can()}setDocumentMode(e){let n=e?.toLowerCase()||"editing";this.extensionService&&(this.options.role==="viewer"&&(n="viewing"),this.options.role==="suggester"&&n==="editing"&&(n="suggesting"),n==="viewing"?(this.commands.toggleTrackChangesShowOriginal(),this.setEditable(!1,!1)):n==="suggesting"?(Ie(this,qe,Fd).call(this,"TrackChangesBase"),this.commands.disableTrackChangesShowOriginal(),this.commands.enableTrackChanges(),this.setEditable(!0,!1)):n==="editing"&&(Ie(this,qe,Fd).call(this,"TrackChangesBase"),this.commands.disableTrackChangesShowOriginal(),this.commands.disableTrackChanges(),this.setEditable(!0,!1)))}initializeCollaborationData(){if(!this.options.isNewFile||!this.options.collaborationProvider)return;const{collaborationProvider:e}=this.options,n=()=>{e.off("synced",n),Ie(this,qe,Id).call(this)};e.synced?Ie(this,qe,Id).call(this):e.on("synced",n)}setOptions(e){this.options={...this.options,...e},this.options.isNewFile&&this.options.isCommentsEnabled&&(this.options.shouldLoadComments=!0),!(!this.view||!this.state||this.ifsDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(e,n=!0){this.setOptions({editable:e}),n&&this.emit("update",{editor:this,transaction:this.state.tr})}registerPlugin(e,n){const r=typeof n=="function"?n(e,[...this.state.plugins]):[...this.state.plugins,e],o=this.state.reconfigure({plugins:r});this.view.updateState(o)}unregisterPlugin(e){if(this.isDestroyed)return;const n=typeof e=="string"?`${e}$`:e.key,r=this.state.reconfigure({plugins:this.state.plugins.filter(o=>!o.key.startsWith(n))});this.view.updateState(r)}static async loadXmlData(e,n=!1){if(!e)return;const r=new cd,o=await r.getDocxData(e,n),i=r.media;return[o,i,r.mediaFiles,r.fonts]}static getDocumentVersion(e){return $r.getStoredSuperdocVersion(e)}static updateDocumentVersion(e,n){return $r.updateDocumentVersion(e,n)}createNodeViews(){this.view.setProps({nodeViews:this.extensionService.nodeViews})}getMaxContentSize(){if(!this.converter)return{};const{pageSize:e={},pageMargins:n={}}=this.converter.pageStyles??{},{width:r,height:o}=e,{top:i=0,bottom:s=0,left:a=0,right:l=0}=n;if(!r||!o)return{};const c=o*96-i*96-s*96-50;return{width:r*96-a*96-l*96-20,height:c}}initDefaultStyles(e=this.element){if(this.options.isHeadless)return;const n=e?.querySelector(".ProseMirror"),{pageSize:r,pageMargins:o}=this.converter.pageStyles??{};if(!n||!r||!o)return;e.style.width=r.width+"in",e.style.minWidth=r.width+"in",e.style.minHeight=r.height+"in",e.style.paddingLeft=o.left+"in",e.style.paddingRight=o.right+"in",e.style.boxSizing="border-box",n.style.outline="none",n.style.border="none";const{typeface:i,fontSizePt:s}=this.converter.getDocumentDefaultStyles()??{};i&&(e.style.fontFamily=i),s&&(e.style.fontSize=`${s}pt`),e.style.transformOrigin="top left",e.style.touchAction="auto",e.style.webkitOverflowScrolling="touch";const a=1.15;n.style.lineHeight=a,this.options.extensions.find(l=>l.name==="pagination")||(n.style.paddingTop="1in",n.style.paddingBottom="1in"),this.initMobileStyles(e)}initMobileStyles(e){if(!e)return;const n=e.offsetWidth,r=()=>{const i=n,s=document.documentElement.clientWidth-10;this.options.scale=Math.min(1,s/i);const a=e.closest(".super-editor"),l=e.closest(".super-editor-container");!a||!l||(this.options.scale<1?(a.style.maxWidth=`${i*this.options.scale}px`,l.style.minWidth="0px",e.style.transform=`scale(${this.options.scale})`):(a.style.maxWidth="",l.style.minWidth="",e.style.transform="none"))};r();const o=()=>{setTimeout(()=>{r()},150)};"orientation"in screen&&"addEventListener"in screen.orientation?screen.orientation.addEventListener("change",o):window.matchMedia("(orientation: portrait)").addEventListener("change",o),window.addEventListener("resize",()=>o)}getAttributes(e){return Oe.getAttributes(this.state,e)}isActive(e,n){const r=typeof e=="string"?e:null,o=typeof e=="string"?n:e;return s2(this.state,r,o)}getJSON(){return this.state.doc.toJSON()}getHTML(){const e=document.createElement("div"),n=di.fromSchema(this.schema).serializeFragment(this.state.doc.content);return e.appendChild(n),e.innerHTML}getPageStyles(){return this.converter?.pageStyles||{}}updatePageStyle({pageMargins:e}){if(!this.converter)return;let n=!1;if(e&&(this.converter.pageStyles.pageMargins=e,this.initDefaultStyles(),n=!0),n){const r=this.view.state.tr;r.setMeta("forceUpdatePagination",!0),this.view.dispatch(r)}}async exportDocx({isFinalDoc:e=!1,commentsType:n,comments:r=[]}={}){const o=Ie(this,qe,k2).call(this,r),i=await this.converter.exportToDocx(o,this.schema,this.storage.image.media,e,n,r),s=this.converter.schemaToXml(this.converter.convertedXml["docProps/custom.xml"].elements[0]),a=this.converter.schemaToXml(this.converter.convertedXml["word/styles.xml"].elements[0]),l=this.converter.schemaToXml(this.converter.convertedXml["word/settings.xml"].elements[0]),c=this.converter.schemaToXml(this.converter.convertedXml["word/_rels/document.xml.rels"].elements[0]),u=this.converter.addedMedia,d=this.converter.convertedXml["word/numbering.xml"],f=this.converter.schemaToXml(d.elements[0]),p={"word/document.xml":String(i),"docProps/custom.xml":String(s),"word/settings.xml":String(l),"word/_rels/document.xml.rels":String(c),"word/numbering.xml":String(f),"word/styles.xml":String(a).replace(/&/gi,"&amp;")};if(r.length){const m=this.converter.schemaToXml(this.converter.convertedXml["word/comments.xml"].elements[0]),y=this.converter.schemaToXml(this.converter.convertedXml["word/commentsExtended.xml"].elements[0]),g=this.converter.schemaToXml(this.converter.convertedXml["word/commentsExtensible.xml"].elements[0]),x=this.converter.schemaToXml(this.converter.convertedXml["word/commentsIds.xml"].elements[0]);p["word/comments.xml"]=String(m),p["word/commentsExtended.xml"]=String(y),p["word/commentsExtensible.xml"]=String(g),p["word/commentsIds.xml"]=String(x)}const h=await new cd().updateZip({docx:this.options.content,updatedDocs:p,originalDocxFile:this.options.fileSource,media:u,fonts:this.options.fonts,isHeadless:this.options.isHeadless});return this.options.telemetry?.trackUsage("document_export",{documentType:"docx",timestamp:new Date().toISOString()}),h}destroy(){this.emit("destroy"),this.view&&this.view.destroy(),Ie(this,qe,S2).call(this),this.removeAllListeners()}static checkIfMigrationsNeeded(e){e||(e="initial");const n=hy(e)||[];return console.debug("[checkVersionMigrations] Migrations needed:",e,n.length),n.length>0}processCollaborationMigrations(){if(console.debug("[checkVersionMigrations] Current editor version","0.9.24"),!this.options.ydoc)return;let e=this.options.ydoc.getMap("meta").get("version");e||(e="initial"),console.debug("[checkVersionMigrations] Document version",e);const n=hy(e)||[],r=this.state.plugins.find(i=>i.key.startsWith("y-sync"));if(!r)return this.options.ydoc;let o=!1;for(let i of n)if(console.debug("🏃‍♂️ Running migration",i.name),i(this))o=!0;else throw new Error("Migration failed at "+i.name);return o?(r?.getState(this.state)).doc:void 0}async replaceFile(e){const[n,r,o,i]=await C2.loadXmlData(e);this.setOptions({fileSource:e,content:n,media:r,mediaFiles:o,fonts:i,isNewFile:!0,shouldLoadComments:!0,replacedFile:!0}),Ie(this,qe,Bd).call(this),Ie(this,qe,Rd).call(this),this.initDefaultStyles(),this.initializeCollaborationData(!0),this.options.ydoc||(Ie(this,qe,zi).call(this),Ie(this,qe,Pi).call(this))}};jo=new WeakMap,w2=new WeakMap,qe=new WeakSet,b2=function(t){Ie(this,qe,hu).call(this),Ie(this,qe,mu).call(this),Ie(this,qe,gu).call(this),Ie(this,qe,Bd).call(this),Ie(this,qe,Rd).call(this),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("contentError",this.options.onContentError),this.on("exception",this.options.onException),Ie(this,qe,wu).call(this),this.initDefaultStyles(),this.setDocumentMode(t.documentMode),!this.options.isHeadless&&(this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",Ie(this,qe,pu)),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("trackedChangesUpdate",this.options.onTrackedChangesUpdate),this.on("commentsLoaded",this.options.onCommentsLoaded),this.on("commentClick",this.options.onCommentClicked),this.on("commentsUpdate",this.options.onCommentsUpdate),this.on("locked",this.options.onDocumentLocked),this.on("collaborationReady",Ie(this,qe,my)),this.on("paginationUpdate",this.options.onPaginationUpdate),this.on("comment-positions",this.options.onCommentLocationsUpdate),this.initializeCollaborationData(),this.options.ydoc||(Ie(this,qe,zi).call(this),Ie(this,qe,Pi).call(this)),window.setTimeout(()=>{this.isDestroyed||this.emit("create",{editor:this})},0))},v2=function(t){(!t.extensions||!t.extensions.length)&&(this.options.extensions=vp()),Ie(this,qe,hu).call(this),Ie(this,qe,mu).call(this),Ie(this,qe,gu).call(this),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("contentError",this.options.onContentError),Ie(this,qe,wu).call(this),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",Ie(this,qe,pu)),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("commentsLoaded",this.options.onCommentsLoaded),this.on("commentClick",this.options.onCommentClicked),this.on("locked",this.options.onDocumentLocked),window.setTimeout(()=>{this.isDestroyed||this.emit("create",{editor:this})},0)},pu=function({editor:t,event:e}){this.toolbar?.setActiveEditor(t),this.options.onFocus({editor:t,event:e})},x2=function(t){t.isHeadless&&(typeof navigator>"u"&&(Vr.navigator={isHeadless:!0}),t.mockDocument&&(Vr.document=t.mockDocument,Vr.window=t.mockWindow))},Id=function(){if(!this.options.isNewFile)return;this.options.isNewFile=!1;const t=Ie(this,qe,yu).call(this),e=this.state.tr.replaceWith(0,this.state.doc.content.size,t);this.view.dispatch(e),setTimeout(()=>{Ie(this,qe,zi).call(this),Ie(this,qe,Pi).call(this)},50)},Fd=function(t){const e=this.extensionService?.plugins.find(r=>r.key.startsWith(t)),n=this.state.plugins.find(r=>r.key.startsWith(t));return e&&!n&&this.registerPlugin(e),e?.key},hu=function(){const t=["extension","node","mark"],e=[c5,o5,u5,l5],n=this.options.externalExtensions||[],r=[...e,...this.options.extensions].filter(o=>t.includes(o?.type));this.extensionService=GO.create(r,n,this)},mu=function(){Dv(this,jo,j1.create({editor:this}))},Bd=function(){this.options.converter?this.converter=this.options.converter:this.converter=new $r({docx:this.options.content,media:this.options.mediaFiles,debug:!0,telemetry:this.options.telemetry,fileSource:this.options.fileSource,documentId:this.options.documentId})},Rd=function(){if(!this.options.ydoc)return this.storage.image.media=this.options.mediaFiles;const t=this.options.ydoc.getMap("media");this.options.isNewFile?(Object.entries(this.options.mediaFiles).forEach(([e,n])=>{t.set(e,n)}),this.storage.image.media=this.options.mediaFiles):this.storage.image.media=Object.fromEntries(t.entries())},gu=function(){this.schema=this.extensionService.schema},yu=function(){let t;try{const{mode:e,fragment:n,isHeadless:r,content:o,loadFromSchema:i}=this.options;if(e==="docx")t=i2(this.converter,this.schema,this),t=Ie(this,qe,yy).call(this,t),n&&r&&(t=bO(n,this.schema));else if(e==="text")if(o){let s=o;if(typeof o=="string"){const a=document.createElement("div");a.innerHTML=o,s=a,a.remove()}t=i?this.schema.nodeFromJSON(s):Zr.fromSchema(this.schema).parse(s)}else t=this.schema.topNodeType.createAndFill()}catch(e){console.error(e),this.emit("contentError",{editor:this,error:e})}return t},wu=function(){let t=Ie(this,qe,yu).call(this);const e={schema:this.schema};this.options.ydoc||(e.doc=t),this.view=new C1(this.options.element,{...this.options.editorProps,dispatchTransaction:Ie(this,qe,gy).bind(this),state:Hi.create(e)});const n=this.state.reconfigure({plugins:this.extensionService.plugins});this.view.updateState(n),this.createNodeViews();const r=this.view.dom;r.editor=this,this.options.telemetry?.sendReport()},my=function({editor:t,ydoc:e}){this.options.collaborationIsReady||(console.debug("🔗 [super-editor] Collaboration ready"),this.options.onCollaborationReady({editor:t,ydoc:e}),this.options.collaborationIsReady=!0,this.options.isNewFile||(Ie(this,qe,zi).call(this),Ie(this,qe,Pi).call(this)))},Pi=function(){if(!this.options.isCommentsEnabled||this.options.isHeadless||!this.options.shouldLoadComments)return;const t=this.options.replacedFile;this.emit("commentsLoaded",{editor:this,replacedFile:t,comments:this.converter.comments||[]}),setTimeout(()=>{this.options.replacedFile=!1;const{state:e,dispatch:n}=this.view,r=e.tr.setMeta(bt,{type:"force"});n(r)},50)},zi=async function(){if(!(this.options.isHeadless||!this.extensionService)&&this.options.extensions.find(t=>t.name==="pagination")&&this.options.pagination){console.debug("🔗 [super-editor] Initializing pagination");const t=await x5(this);this.storage.pagination.sectionData=t;const{state:e,dispatch:n}=this.view,r=e.tr.setMeta(to,{isReadyToInit:!0});n(r)}},gy=function(t){if(this.view.isDestroyed)return;let e;try{const i=ht.getState(this.view.state)?.isTrackChangesActive??!1?y2({tr:t,state:this.state,user:this.options.user}):t,{state:s}=this.view.state.applyTransaction(i);e=s}catch(i){e=this.state.apply(t),console.log(i)}const n=!this.state.selection.eq(e.selection);this.view.updateState(e),this.emit("transaction",{editor:this,transaction:t}),n&&this.emit("selectionUpdate",{editor:this,transaction:t});const r=t.getMeta("focus");r&&this.emit("focus",{editor:this,event:r.event,transaction:t});const o=t.getMeta("blur");o&&this.emit("blur",{editor:this,event:o.event,transaction:t}),t.docChanged&&this.emit("update",{editor:this,transaction:t})},yy=function(t){const e=Hi.create({schema:this.schema,doc:t}),{tr:n,doc:r}=e;return w5(r,n,this.schema,this.converter),e.apply(n).doc},k2=function(t=[]){const e=Hi.create({schema:this.schema,doc:this.state.doc,plugins:this.state.plugins}),{tr:n,doc:r}=e;return y5(r,n,this.schema,t),e.apply(n).doc.toJSON()},S2=function(){if(this.options.ydoc)try{console.debug("🔗 [super-editor] Ending collaboration"),this.options.collaborationProvider&&this.options.collaborationProvider.disconnect(),this.options.ydoc&&this.options.ydoc.destroy()}catch{}};let ws=N5;class Ye{constructor(e){Fe(this,"type","node"),Fe(this,"name","node"),Fe(this,"options"),Fe(this,"storage"),Fe(this,"config",{name:this.name}),this.config={...this.config,...e},this.name=this.config.name,this.config.addOptions&&(this.options=He(_e(this,"addOptions",{name:this.name}))),this.storage=He(_e(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(...e){return new Ye(...e)}}let bn=class E2{constructor(e){Fe(this,"type","mark"),Fe(this,"name","mark"),Fe(this,"options"),Fe(this,"storage"),Fe(this,"config",{name:this.name}),this.config={...this.config,...e},this.name=this.config.name,this.config.addOptions&&(this.options=He(_e(this,"addOptions",{name:this.name}))),this.storage=He(_e(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(...e){return new E2(...e)}};const D5=/[\d-.]+(\w+)$/,I5=["px","rem","em","in","q","mm","cm","pt","pc","vh","vw","vmin","vmax"];function nr(t="0"){const e=t||"0",n=Number.parseFloat(e),r=(e.match(D5)?.[1]??"").toLowerCase();return[n,I5.includes(r)?r:null]}const A2=ot.create({name:"color",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{color:{default:null,parseDOM:t=>t.style.color?.replace(/['"]+/g,""),renderDOM:t=>t.color?{style:`color: ${t.color}`}:{}}}}]},addCommands(){return{setColor:t=>({chain:e})=>e().setMark("textStyle",{color:t}).run(),unsetColor:()=>({chain:t})=>t().setMark("textStyle",{color:null}).removeEmptyTextStyle().run()}}}),T2=ot.create({name:"fontFamily",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontFamily:{default:null,parseDOM:t=>t.style.fontFamily?.replace(/['"]+/g,""),renderDOM:t=>t.fontFamily?{style:`font-family: ${t.fontFamily}`}:{}}}}]},addCommands(){return{setFontFamily:t=>({chain:e})=>e().setMark("textStyle",{fontFamily:t}).run(),unsetFontFamily:()=>({chain:t})=>t().setMark("textStyle",{fontFamily:null}).removeEmptyTextStyle().run()}}}),$2=ot.create({name:"fontSize",addOptions(){return{types:["textStyle","tableCell"],defaults:{value:12,unit:"pt",min:8,max:96}}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontSize:{default:null,parseDOM:t=>t.style.fontSize,renderDOM:t=>{if(!t.fontSize)return{};let[e,n]=nr(t.fontSize);return Number.isNaN(e)?{}:(n=n||this.options.defaults.unit,{style:`font-size: ${e}${n}`})}}}}]},addCommands(){return{setFontSize:t=>({chain:e})=>{let[n,r]=nr(t);if(Number.isNaN(n))return!1;let{min:o,max:i,unit:s}=this.options.defaults;return n=cl(n,o,i),r=r||s,e().setMark("textStyle",{fontSize:`${n}${r}`}).run()},unsetFontSize:()=>({chain:t})=>t().setMark("textStyle",{fontSize:null}).removeEmptyTextStyle().run()}}}),O2=ot.create({name:"textAlign",addOptions(){return{types:["heading","paragraph"],alignments:["left","center","right","justify"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseDOM:t=>{const e=t.style.textAlign||this.options.defaultAlignment;return this.options.alignments.includes(e)?e:this.options.defaultAlignment},renderDOM:t=>t.textAlign===this.options.defaultAlignment?{}:{style:`text-align: ${t.textAlign==="both"?"justify":t.textAlign}`}}}}]},addCommands(){return{setTextAlign:t=>({commands:e})=>this.options.alignments.includes(t)?this.options.types.map(n=>e.updateAttributes(n,{textAlign:t})).every(n=>n):!1,unsetTextAlign:()=>({commands:t})=>this.options.types.map(e=>t.resetAttributes(e,"textAlign")).every(e=>e)}},addShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign("left"),"Mod-Shift-e":()=>this.editor.commands.setTextAlign("center"),"Mod-Shift-r":()=>this.editor.commands.setTextAlign("right"),"Mod-Shift-j":()=>this.editor.commands.setTextAlign("justify")}}}),M2=ot.create({name:"textIndent",addOptions(){return{types:["heading","paragraph"],defaults:{unit:"in",increment:.125}}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textIndent:{default:null,parseDOM:t=>t.style.textIndent,renderDOM:t=>{if(!t.textIndent)return{};let[e,n]=nr(t.textIndent);return Number.isNaN(e)||!e?{}:(n=n||this.options.defaults.unit,{style:`margin-left: ${e}${n}`})}}}}]},addCommands(){return{setTextIndent:t=>({commands:e})=>t?this.options.types.map(n=>e.updateAttributes(n,{textIndent:t})).every(n=>n):!1,unsetTextIndent:()=>({commands:t})=>this.options.types.map(e=>t.resetAttributes(e,"textIndent")).every(e=>e),increaseTextIndent:()=>({commands:t})=>this.options.types.map(e=>{let{textIndent:n}=this.editor.getAttributes(e);if(!n){let{increment:i,unit:s}=this.options.defaults;return t.updateAttributes(e,{textIndent:`${i}${s}`})}let[r,o]=nr(n);return r=r+this.options.defaults.increment,o=o||this.options.defaults.unit,Number.isNaN(r)?!1:t.updateAttributes(e,{textIndent:`${r}${o}`})}).every(e=>e),decreaseTextIndent:()=>({commands:t})=>this.options.types.map(e=>{let{textIndent:n}=this.editor.getAttributes(e);if(!n)return!1;let[r,o]=nr(n);return r=r-this.options.defaults.increment,o=o||this.options.defaults.unit,Number.isNaN(r)?!1:r<=0?t.unsetTextIndent():t.updateAttributes(e,{textIndent:`${r}${o}`})}).every(e=>e)}}}),_2=ot.create({name:"lineHeight",addOptions(){return{types:["heading","paragraph"],defaults:{unit:""}}},addGlobalAttributes(){return[{types:this.options.types,attributes:{lineHeight:{default:null,parseDOM:t=>t.style.lineHeight,renderDOM:t=>{if(!t.lineHeight)return{};let[e,n]=nr(t.lineHeight);return Number.isNaN(e)?{}:(n=n||this.options.defaults.unit,{style:`line-height: ${e}${n}`})}}}}]},addCommands(){return{setLineHeight:t=>({commands:e})=>t?this.options.types.map(n=>e.updateAttributes(n,{lineHeight:t})).every(n=>n):!1,unsetLineHeight:()=>({commands:t})=>this.options.types.map(e=>t.resetAttributes(e,"lineHeight")).every(e=>e)}}}),N2=ot.create({name:"formatCommands",addOptions(){return{}},addStorage(){return{storedStyle:null}},addCommands(){return{clearFormat:()=>({chain:t})=>t().clearNodes().unsetAllMarks().run(),clearMarksFormat:()=>({chain:t})=>t().unsetAllMarks().run(),clearNodesFormat:()=>({chain:t})=>t().clearNodes().run(),copyFormat:()=>({chain:t})=>{if(!this.storage.storedStyle){const i=Is(this.editor.state);return this.storage.storedStyle=i,!0}if(!this.storage.storedStyle.length)return this.storage.storedStyle=null,t().clearFormat().run();const e=this.storage.storedStyle,n=[];e.forEach(i=>{const{type:s,attrs:a}=i,{name:l}=s;l==="textStyle"?Object.keys(a).forEach(c=>{if(!a[c])return;const u={};u[c]=a[c],n.push({name:c,attrs:u})}):n.push({name:l,attrs:a})});const r={bold:["setBold","unsetBold"],italic:["setItalic","unsetItalic"],underline:["setUnderline","unsetUnderline"],color:["setColor","setColor",null],fontSize:["setFontSize","unsetFontSize"],fontFamily:["setFontFamily","unsetFontFamily"]};let o=t();return Object.keys(r).forEach(i=>{const[s,a,l]=r[i],c=n.find(f=>f.name===i),u=c?.attrs&&c?.attrs[i];let d={};!c&&!u?d={command:a,argument:l}:d={command:s,argument:c.attrs[i]||l},o=o[d.command](d.argument)}),this.storage.storedStyle=null,o}}},addShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.clearFormat()}}});function F5(t={}){return new Qe({view(e){return new B5(e,t)}})}class B5{constructor(e,n){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=n.width)!==null&&r!==void 0?r:1,this.color=n.color===!1?void 0:n.color||"black",this.class=n.class,this.handlers=["dragover","dragend","drop","dragleave"].map(o=>{let i=s=>{this[o](s)};return e.dom.addEventListener(o,i),{name:o,handler:i}})}destroy(){this.handlers.forEach(({name:e,handler:n})=>this.editorView.dom.removeEventListener(e,n))}update(e,n){this.cursorPos!=null&&n.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),n=!e.parent.inlineContent,r;if(n){let a=e.nodeBefore,l=e.nodeAfter;if(a||l){let c=this.editorView.nodeDOM(this.cursorPos-(a?a.nodeSize:0));if(c){let u=c.getBoundingClientRect(),d=a?u.bottom:u.top;a&&l&&(d=(d+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2),r={left:u.left,right:u.right,top:d-this.width/2,bottom:d+this.width/2}}}}if(!r){let a=this.editorView.coordsAtPos(this.cursorPos);r={left:a.left-this.width/2,right:a.left+this.width/2,top:a.top,bottom:a.bottom}}let o=this.editorView.dom.offsetParent;this.element||(this.element=o.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n);let i,s;if(!o||o==document.body&&getComputedStyle(o).position=="static")i=-pageXOffset,s=-pageYOffset;else{let a=o.getBoundingClientRect();i=a.left-o.scrollLeft,s=a.top-o.scrollTop}this.element.style.left=r.left-i+"px",this.element.style.top=r.top-s+"px",this.element.style.width=r.right-r.left+"px",this.element.style.height=r.bottom-r.top+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let n=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),o=r&&r.type.spec.disableDropCursor,i=typeof o=="function"?o(this.editorView,n,e):o;if(n&&!i){let s=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let a=qb(this.editorView.state.doc,s,this.editorView.dragging.slice);a!=null&&(s=a)}this.setCursor(s),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){(e.target==this.editorView.dom||!this.editorView.dom.contains(e.relatedTarget))&&this.setCursor(null)}}const D2=ot.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:2,class:void 0}},addPmPlugins(){return[F5(this.options)]}});class at extends Re{constructor(e){super(e,e)}map(e,n){let r=e.resolve(n.map(this.head));return at.valid(r)?new at(r):Re.near(r)}content(){return ve.empty}eq(e){return e instanceof at&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new at(e.resolve(n.pos))}getBookmark(){return new cp(this.anchor)}static valid(e){let n=e.parent;if(n.isTextblock||!R5(e)||!L5(e))return!1;let r=n.type.spec.allowGapCursor;if(r!=null)return r;let o=n.contentMatchAt(e.index()).defaultType;return o&&o.isTextblock}static findGapCursorFrom(e,n,r=!1){e:for(;;){if(!r&&at.valid(e))return e;let o=e.pos,i=null;for(let s=e.depth;;s--){let a=e.node(s);if(n>0?e.indexAfter(s)<a.childCount:e.index(s)>0){i=a.child(n>0?e.indexAfter(s):e.index(s)-1);break}else if(s==0)return null;o+=n;let l=e.doc.resolve(o);if(at.valid(l))return l}for(;;){let s=n>0?i.firstChild:i.lastChild;if(!s){if(i.isAtom&&!i.isText&&!De.isSelectable(i)){e=e.doc.resolve(o+i.nodeSize*n),r=!1;continue e}break}i=s,o+=n;let a=e.doc.resolve(o);if(at.valid(a))return a}return null}}}at.prototype.visible=!1;at.findFrom=at.findGapCursorFrom;Re.jsonID("gapcursor",at);class cp{constructor(e){this.pos=e}map(e){return new cp(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return at.valid(n)?new at(n):Re.near(n)}}function R5(t){for(let e=t.depth;e>=0;e--){let n=t.index(e),r=t.node(e);if(n==0){if(r.type.spec.isolating)return!0;continue}for(let o=r.child(n-1);;o=o.lastChild){if(o.childCount==0&&!o.inlineContent||o.isAtom||o.type.spec.isolating)return!0;if(o.inlineContent)return!1}}return!0}function L5(t){for(let e=t.depth;e>=0;e--){let n=t.indexAfter(e),r=t.node(e);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let o=r.child(n);;o=o.firstChild){if(o.childCount==0&&!o.inlineContent||o.isAtom||o.type.spec.isolating)return!0;if(o.inlineContent)return!1}}return!0}function P5(){return new Qe({props:{decorations:U5,createSelectionBetween(t,e,n){return e.pos==n.pos&&at.valid(n)?new at(n):null},handleClick:j5,handleKeyDown:z5,handleDOMEvents:{beforeinput:q5}}})}const z5=Yf({ArrowLeft:Qs("horiz",-1),ArrowRight:Qs("horiz",1),ArrowUp:Qs("vert",-1),ArrowDown:Qs("vert",1)});function Qs(t,e){const n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,o,i){let s=r.selection,a=e>0?s.$to:s.$from,l=s.empty;if(s instanceof Pe){if(!i.endOfTextblock(n)||a.depth==0)return!1;l=!1,a=r.doc.resolve(e>0?a.after():a.before())}let c=at.findGapCursorFrom(a,e,l);return c?(o&&o(r.tr.setSelection(new at(c))),!0):!1}}function j5(t,e,n){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!at.valid(r))return!1;let o=t.posAtCoords({left:n.clientX,top:n.clientY});return o&&o.inside>-1&&De.isSelectable(t.state.doc.nodeAt(o.inside))?!1:(t.dispatch(t.state.tr.setSelection(new at(r))),!0)}function q5(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof at))return!1;let{$from:n}=t.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(t.state.schema.nodes.text);if(!r)return!1;let o=ye.empty;for(let s=r.length-1;s>=0;s--)o=ye.from(r[s].createAndFill(null,o));let i=t.state.tr.replace(n.pos,n.pos,new ve(o,0,0));return i.setSelection(Pe.near(i.doc.resolve(n.pos+1))),t.dispatch(i),!1}function U5(t){if(!(t.selection instanceof at))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",Le.create(t.doc,[ze.widget(t.selection.head,e,{key:"gapcursor"})])}const V5=ot.create({name:"gapCursor",addPmPlugins(){return[P5()]},extendNodeSchema(t){return{allowGapCursor:He(_e(t,"allowGapCursor",{name:t.name,options:t.options,storage:t.storage}))??null}}}),H5=new tt("collaboration"),W5=ot.create({name:"collaboration",priority:1e3,addOptions(){return{ydoc:null,field:"supereditor",fragment:null,isReady:!1}},addPmPlugins(){if(!this.editor.options.ydoc)return[];this.options.ydoc=this.editor.options.ydoc;const t=K5();J5(this.options.ydoc,this.editor),X5(this.options.ydoc,this.editor,this);const[e,n]=G5(this.options.ydoc,this.editor);this.options.fragment=n;const r=this.options.ydoc.getMap("media");return r.observe(o=>{o.changes.keys.forEach((i,s)=>{if(!(s in this.editor.storage.image.media)){const a=r.get(s);this.editor.storage.image.media[s]=a}})}),[e,t]},addCommands(){return{undo:()=>({tr:t,state:e,dispatch:n})=>(t.setMeta("preventDispatch",!0),t.setMeta("inputType","historyUndo"),Tr.getState(e).undoManager.undoStack.length===0?!1:n?EO(e):!0),redo:()=>({tr:t,state:e,dispatch:n})=>(t.setMeta("preventDispatch",!0),t.setMeta("inputType","historyRedo"),Tr.getState(e).undoManager.redoStack.length===0?!1:n?AO(e):!0),addImageToCollaboration:({mediaPath:t,fileData:e})=>()=>{this.options.ydoc&&this.options.ydoc.getMap("media").set(t,e)}}},addShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Mod-Shift-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo()}}}),G5=(t,e)=>{const n=t.getXmlFragment("supereditor");return[iO(n,{onFirstRender:()=>{if(!e.options.isNewFile)return;const r=t.getMap("meta");r.set("docx",e.options.content),r.set("fonts",e.options.fonts)}}),n]},K5=()=>OO(),J5=(t,e)=>{const n=t.getMap("meta");n.observe(r=>{const o=n.get("lockedBy"),i=n.get("locked");if(!e.options.user||!o)return;const s=o?.email!==e.options.user?.email,a=e.options.editable!==!i;!s||!a||(i?console.debug("--- Locking editor ---",o,e.options.user):console.debug("--- Unlocking editor ---",o),e.setEditable(!i),e.emit("locked",{editor:e,isLocked:i,lockedBy:o}))})},X5=(t,e,n)=>{const r=e.options.collaborationProvider;if(!r)return;const o=()=>{n.options.isReady=!0,r.off("synced",o),e.emit("collaborationReady",{editor:e,ydoc:t})};if(r.synced){setTimeout(()=>{o()},250);return}r.on("synced",o)},Y5=ot.create({name:"collaborationCursor",priority:999,addOptions(){return{provider:null,user:{name:null,color:null}}},addStorage(){return{users:[]}},addPmPlugins(){const{collaborationProvider:t=null}=this.editor.options;return t?[CO(t.awareness,{cursorBuilder:Z5})]:[]}}),Z5=t=>{const e=document.createElement("span");e.classList.add("ProseMirror-yjs-cursor"),e.setAttribute("style",`border-color: ${t.color}`);const n=document.createElement("div");return n.setAttribute("style",`background-color: ${t.color}`),n.insertBefore(document.createTextNode(t.name||t.email),null),e.insertBefore(n,null),e},I2=Ye.create({name:"doc",topNode:!0,content:"block+",parseDOM(){return[{tag:"doc"}]},renderDOM(){return["doc",0]},addAttributes(){return{attributes:{rendered:!1}}}}),F2=Ye.create({name:"text",group:"inline",inline:!0}),Q5=Ye.create({name:"run",group:"inline",content:"text*",inline:!0,parseDOM(){return[{tag:"run"}]},renderDOM(){return["run",0]},addAttributes(){return{attributes:{rendered:!1}}}});function ul(t){return new UO({match:t.match,handler:({state:e,range:n,match:r,chain:o})=>{const i=He(t.getAttributes,null,r)||{},s=e.tr.delete(n.from,n.to),a=s.doc.resolve(n.from).blockRange(),l=a&&Rb(a,t.type,i);if(!l)return null;if(s.wrap(a,l),t.keepMarks&&t.editor){const{selection:u,storedMarks:d}=e,{splittableMarks:f}=t.editor.extensionService,p=d||u.$to.parentOffset&&u.$from.marks();if(p){const h=p.filter(m=>f.includes(m.type.name));s.ensureMarks(h)}}if(t.keepAttributes){const u=t.type.name==="bulletList"||t.type.name==="orderedList"?"listItem":t.type.name;o().updateAttributes(u,i).run()}const c=s.doc.resolve(n.from-1).nodeBefore;c&&c.type===t.type&&Dr(s.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(r,c))&&s.join(n.from-1)}})}const wy=/^\s*([-+*])\s$/,B2=Ye.create({name:"bulletList",group:"block list",content(){return`${this.options.itemTypeName}+`},addOptions(){return{itemTypeName:"listItem",htmlAttributes:{},keepMarks:!0,keepAttributes:!1}},parseDOM(){return[{tag:"ul"}]},renderDOM({htmlAttributes:t}){return["ul",Oe.mergeAttributes(this.options.htmlAttributes,t),0]},addAttributes(){return{"list-style-type":{default:"bullet",rendered:!1},listId:{rendered:!1},attributes:{rendered:!1,keepOnSplit:!0}}},addCommands(){return{toggleBulletList:()=>t=>{const{commands:e,chain:n}=t;return e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}}},addShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=ul({match:wy,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=ul({match:wy,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes("textStyle"),editor:this.editor})),[t]}});function e_(t={}){return new Qe({key:new tt("orderedListSync"),appendTransaction:(e,n,r)=>{if(!(e.some(l=>l.docChanged)&&!n.doc.eq(r.doc)))return;let{doc:o,tr:i}=r,s={};if(o.descendants((l,c)=>{if(l.type.name==="orderedList"&&l.attrs.syncId){let u=l.attrs.syncId;s[u]||(s[u]=[]),s[u].push({node:l,pos:c})}}),!Object.keys(s).length)return;let a=!1;return Object.entries(s).forEach(([l,c])=>{if(c.length<1){let[f]=c;i.setNodeMarkup(f.pos,void 0,{...f.node.attrs,syncId:null}),a=!0;return}let[u]=c,d=u.node.attrs.order;c.forEach((f,p)=>{if(p===0)return;let{node:h,pos:m}=f,y=c[p-1],g=d+y.node.childCount;h.attrs.order!==g&&(i.setNodeMarkup(m,void 0,{...h.attrs,order:g}),a=!0),d=g})}),a?i:null}})}function t_(){return Math.floor(Math.random()*4294967295).toString()}function n_(t){return new Qe({key:new tt("orderedListMarker"),appendTransaction:(e,n,r)=>{if(!(e.some(l=>l.docChanged)&&!n.doc.eq(r.doc)))return;let{doc:o,tr:i}=r,s=r_(r);if(!s.size)return;let a=!1;return Array.from(s).forEach(([l,c])=>{const u=c[0];let d=c,f=u.node.type.name==="bulletList";u.node.attrs.syncId;let p=u.node.childCount!==d.length;if(f){d.forEach(x=>i_(i,x)),a=!0;return}if(p){let x=o_({state:r,list:u});x.length&&(d=x)}let h=d[0],m=s_({state:r,listItems:d}),y=R2(),g={lvlText:h.node.attrs.lvlText??y.lvlText,listLevel:h.node.attrs.listLevel??y.listLevel,listNumberingType:h.node.attrs.listNumberingType??y.listNumberingType};g.lvlText===m.lvlText&&g.listNumberingType===m.listNumberingType&&by(g.listLevel,m.listLevel)||(i.setNodeMarkup(h.pos,void 0,{...h.node.attrs,...m}),a=!0,g=m),d.forEach((x,k)=>{if(k===0)return;let{node:b,pos:T}=x,{lvlText:M,listLevel:_,listNumberingType:F}=b.attrs;Array.isArray(g.listLevel)||(g.listLevel=JSON.parse(g.listLevel));let C=[...g.listLevel.slice(0,-1),g.listLevel.at(-1)+1];if(!(M===g.lvlText&&F===g.listNumberingType&&by(_,C))){let{selection:V,storedMarks:ie}=r,I=ie||V.$to.parentOffset&&V.$from.marks();i.setNodeMarkup(T,void 0,{...b.attrs,listLevel:C,lvlText:g.lvlText,listNumberingType:g.listNumberingType}),I&&i.ensureMarks(I),a=!0}g={...g,listLevel:C}})}),a?i:null}})}function r_(t){let{doc:e}=t,n=new Map;return e.descendants((r,o)=>{let{attrs:i}=r,s=r.type.name==="listItem",a=!!i.listLevel?.length,l=!!i.lvlText,c=i.listNumberingType&&i.listNumberingType!=="bullet";if(s&&a&&l&&c){const u=`${e.resolve(o).parent.attrs.listId}, ${r.attrs.listLevel.slice(0,-1)}`;n.get(u)||n.set(u,[]),n.get(u).push({node:r,pos:o})}}),n}function o_({state:t,list:e}){let{doc:n}=t,r=[];return n.descendants((o,i)=>{let s=o.type.name==="listItem",a=n.resolve(i);s&&a.parent===e&&r.push({node:o,pos:i})}),r}function R2({lvlText:t="",listLevel:e=[],listNumberingType:n="decimal"}={}){return{lvlText:t,listLevel:e,listNumberingType:n}}function i_(t,e){let{pos:n,node:r}=e;t.setNodeMarkup(n,void 0,{...r.attrs,lvlText:null,listLevel:null,listNumberingType:null})}function by(t,e){return t.length===e.length&&t.every((n,r)=>n===e[r])}function s_({state:t,listItems:e}){let{doc:n}=t,r=e[0],{lvlText:o,listLevel:i,listNumberingType:s}=r.node.attrs,a=R2({lvlText:"%1.",listLevel:[1],listNumberingType:"decimal"}),l=(n.resolve(r.pos).depth-1)/2;if(!(o&&i?.length&&s))({lvlText:o,listLevel:i,listNumberingType:s}=a);else{let c=l>0;c&&l>=3?{lvlText:o,listLevel:i,listNumberingType:s}=a:c&&l<3&&(i=[...i.slice(0,-1),1])}return{lvlText:o,listLevel:i,listNumberingType:s}}const vy=/^(\d+)\.\s$/,L2=Ye.create({name:"orderedList",group:"block list",content(){return`${this.options.itemTypeName}+`},addOptions(){return{itemTypeName:"listItem",htmlAttributes:{},keepMarks:!0,keepAttributes:!1,listStyleTypes:["decimal","lowerAlpha","lowerRoman"]}},addAttributes(){return{order:{default:1,parseDOM:t=>t.hasAttribute("start")?parseInt(t.getAttribute("start")||"",10):1,renderDOM:t=>({start:t.order})},syncId:{default:null,parseDOM:t=>t.getAttribute("data-sync-id"),renderDOM:t=>t.syncId?{"data-sync-id":t.syncId}:{}},listId:{default:null,render:!1},"list-style-type":{default:"decimal",renderDOM:t=>{let e=t["list-style-type"];return e?(e==="lowerLetter"&&(e="lowerAlpha"),{style:`list-style-type: ${CE(e)};`}):{}}},attributes:{rendered:!1,keepOnSplit:!0}}},parseDOM(){return[{tag:"ol"}]},renderDOM({htmlAttributes:t}){const{start:e,...n}=t;return e===1?["ol",Oe.mergeAttributes(this.options.htmlAttributes,n),0]:["ol",Oe.mergeAttributes(this.options.htmlAttributes,t),0]},addCommands(){return{toggleOrderedList:()=>({commands:t})=>t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks),getCurrentList:()=>({state:t})=>Kt(e=>e.type.name===this.name)(t.selection),restartListNodes:(t,e)=>({tr:n,state:r})=>{let o=e;return t.map(i=>{const s={node:i,pos:o};return o+=i.nodeSize,s}).forEach(i=>{const{pos:s}=i,a=n.mapping.map(s);n.setNodeMarkup(a,void 0,{})}),!0},updateOrderedListStyleType:()=>({dispatch:t,state:e,tr:n})=>{let r=Kt(o=>o.type.name===this.name)(n.selection);if(!r)return!0;if(t){let o=(r.depth-1)/2,i=this.options.listStyleTypes,s=i[o%i.length],a=r.node.attrs["list-style-type"],l=n.doc.nodeAt(r.pos);a!==s&&l.eq(r.node)&&n.setNodeMarkup(r.pos,void 0,{...r.node.attrs,"list-style-type":s})}return!0},liftEmptyBlockAndContinueListOrder:()=>({editor:t,dispatch:e,state:n,tr:r,commands:o})=>{let i=Kt(d=>d.type.name===this.name)(n.selection);if(!i)return!1;let s=t.can().liftEmptyBlock(),a=i.depth===1,l=i.node.childCount===1,c=n.selection.$from.node(-1),u=i.node.lastChild.eq(c);if(!(s&&a&&!l&&!u))return!1;if(e){let d=i.pos;if(!o.liftEmptyBlock(n,e))return!1;let{$from:f}=r.selection,p=r.doc.nodeAt(d),h=f.after(),m=r.doc.nodeAt(h),y=p?.type.name===this.name,g=m?.type.name===this.name;if(y&&g){let x=p.attrs.order||1,k=p.childCount,b=p.attrs.syncId,T=k+x,M=b||t_();r.setNodeMarkup(h,void 0,{...m.attrs,order:T,syncId:M}),b||r.setNodeMarkup(d,void 0,{...p.attrs,syncId:M})}}return!0}}},addShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList(),Enter:()=>this.editor.commands.liftEmptyBlockAndContinueListOrder()}},addPmPlugins(){return[n_(this.editor),e_()]},addInputRules(){let t=ul({match:vy,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(t=ul({match:vy,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes("textStyle")}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),a_=({listLevel:t,lvlText:e,listNumberingType:n})=>{const r=d_[n];return r?r(t,e):null},l_=(t,e)=>up(t,e,String),P2=(t,e)=>up(t,e,p_),c_=(t,e)=>P2(t,e).toLowerCase(),u_=(t,e)=>z2(t,e).toLowerCase(),z2=(t,e)=>up(t,e,n=>h_(n)),d_={decimal:l_,lowerRoman:c_,upperRoman:P2,lowerLetter:u_,upperLetter:z2},f_=(t,e)=>t.reduce((n,r,o)=>n.replace(`%${o+1}`,r),e),up=(t,e,n)=>{const r=t.map(n);return f_(r,e)},p_=t=>{const e=[{value:1e3,numeral:"M"},{value:900,numeral:"CM"},{value:500,numeral:"D"},{value:400,numeral:"CD"},{value:100,numeral:"C"},{value:90,numeral:"XC"},{value:50,numeral:"L"},{value:40,numeral:"XL"},{value:10,numeral:"X"},{value:9,numeral:"IX"},{value:5,numeral:"V"},{value:4,numeral:"IV"},{value:1,numeral:"I"}];let n="";for(const{value:r,numeral:o}of e)for(;t>=r;)n+=o,t-=r;return n},h_=t=>{let e="";const n="ABCDEFGHIJKLMNOPQRSTUVWXYZ";for(;t>0;){let r=(t-1)%26;e=n[r]+e,t=Math.floor((t-1)/26)}return e};function m_(t={}){return new Qe({key:new tt("styledListMarker"),state:{init(e,n){const r=[...xy(n),...ky(n)];return Le.create(n.doc,r)},apply(e,n,r,o){if(!e.docChanged)return n;const i=[...xy(o),...ky(o)];return Le.create(o.doc,i)}},props:{decorations(e){return this.getState(e)}}})}function xy(t){let{doc:e,storedMarks:n}=t,r=[],o=op(e,i=>i.type.name==="listItem");return o.length&&o.forEach(({node:i,pos:s})=>{let a=[],l=sr("textStyle",e.type.schema);if(y_(i)&&n){let m=n.filter(y=>y.type===l);a.push(...m)}else{let m=g_(i,e,l);a.push(...m)}let c=null,u=null;a.forEach(m=>{let{attrs:y}=m;if(y.fontSize&&!c){let[g,x]=nr(y.fontSize);Number.isNaN(g)||(x=x??"pt",c=`${g}${x}`)}y.fontFamily&&!u&&(u=y.fontFamily)});let d={style:`--marker-font-size: ${c??"initial"}`},f={style:`--marker-font-family: ${u??"initial"}`},p=Oe.mergeAttributes(d,f),h=ze.node(s,s+i.nodeSize,p);r.push(h)}),r}function ky(t){let{doc:e}=t,n=[],r=op(e,o=>o.type.name==="listItem");return r.length&&r.forEach(({node:o,pos:i})=>{let s={};if(o.attrs.spacing){const{lineSpaceBefore:l,lineSpaceAfter:c,line:u}=o.attrs.spacing;s={style:`
37
+ `).scrollIntoView()),!0)};function ep(t){for(let e=0;e<t.edgeCount;e++){let{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}const rM=(t,e)=>{let{$head:n,$anchor:r}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let o=n.node(-1),i=n.indexAfter(-1),s=ep(o.contentMatchAt(i));if(!s||!o.canReplaceWith(i,i,s))return!1;if(e){let a=n.after(),l=t.tr.replaceWith(a,a,s.createAndFill());l.setSelection(Re.near(l.doc.resolve(a),1)),e(l.scrollIntoView())}return!0},Y1=(t,e)=>{let n=t.selection,{$from:r,$to:o}=n;if(n instanceof _n||r.parent.inlineContent||o.parent.inlineContent)return!1;let i=ep(o.parent.contentMatchAt(o.indexAfter()));if(!i||!i.isTextblock)return!1;if(e){let s=(!r.parentOffset&&o.index()<o.parent.childCount?r:o).pos,a=t.tr.insert(s,i.createAndFill());a.setSelection(Pe.create(a.doc,s+1)),e(a.scrollIntoView())}return!0},Z1=(t,e)=>{let{$cursor:n}=t.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let i=n.before();if(Qn(t.doc,i))return e&&e(t.tr.split(i).scrollIntoView()),!0}let r=n.blockRange(),o=r&&Ds(r);return o==null?!1:(e&&e(t.tr.lift(r,o).scrollIntoView()),!0)};function oM(t){return(e,n)=>{let{$from:r,$to:o}=e.selection;if(e.selection instanceof De&&e.selection.node.isBlock)return!r.parentOffset||!Qn(e.doc,r.pos)?!1:(n&&n(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let i=[],s,a,l=!1,c=!1;for(let p=r.depth;;p--)if(r.node(p).isBlock){l=r.end(p)==r.pos+(r.depth-p),c=r.start(p)==r.pos-(r.depth-p),a=ep(r.node(p-1).contentMatchAt(r.indexAfter(p-1))),i.unshift(l&&a?{type:a}:null),s=p;break}else{if(p==1)return!1;i.unshift(null)}let u=e.tr;(e.selection instanceof Pe||e.selection instanceof _n)&&u.deleteSelection();let d=u.mapping.map(r.pos),f=Qn(u.doc,d,i.length,i);if(f||(i[0]=a?{type:a}:null,f=Qn(u.doc,d,i.length,i)),u.split(d,i.length,i),!l&&c&&r.node(s).type!=a){let p=u.mapping.map(r.before(s)),h=u.doc.resolve(p);a&&r.node(s-1).canReplaceWith(h.index(),h.index()+1,a)&&u.setNodeMarkup(u.mapping.map(r.before(s)),a)}return n&&n(u.scrollIntoView()),!0}}const iM=oM(),sM=(t,e)=>(e&&e(t.tr.setSelection(new _n(t.doc))),!0);function aM(t,e,n){let r=e.nodeBefore,o=e.nodeAfter,i=e.index();return!r||!o||!r.type.compatibleContent(o.type)?!1:!r.content.size&&e.parent.canReplace(i-1,i)?(n&&n(t.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(i,i+1)||!(o.isTextblock||Dr(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function Q1(t,e,n,r){let o=e.nodeBefore,i=e.nodeAfter,s,a,l=o.type.spec.isolating||i.type.spec.isolating;if(!l&&aM(t,e,n))return!0;let c=!l&&e.parent.canReplace(e.index(),e.index()+1);if(c&&(s=(a=o.contentMatchAt(o.childCount)).findWrapping(i.type))&&a.matchType(s[0]||i.type).validEnd){if(n){let p=e.pos+i.nodeSize,h=ye.empty;for(let g=s.length-1;g>=0;g--)h=ye.from(s[g].create(null,h));h=ye.from(o.copy(h));let m=t.tr.step(new Yt(e.pos-1,p,e.pos,p,new ve(h,1,0),s.length,!0)),y=m.doc.resolve(p+2*s.length);y.nodeAfter&&y.nodeAfter.type==o.type&&Dr(m.doc,y.pos)&&m.join(y.pos),n(m.scrollIntoView())}return!0}let u=i.type.spec.isolating||r>0&&l?null:Re.findFrom(e,1),d=u&&u.$from.blockRange(u.$to),f=d&&Ds(d);if(f!=null&&f>=e.depth)return n&&n(t.tr.lift(d,f).scrollIntoView()),!0;if(c&&ri(i,"start",!0)&&ri(o,"end")){let p=o,h=[];for(;h.push(p),!p.isTextblock;)p=p.lastChild;let m=i,y=1;for(;!m.isTextblock;m=m.firstChild)y++;if(p.canReplace(p.childCount,p.childCount,m.content)){if(n){let g=ye.empty;for(let k=h.length-1;k>=0;k--)g=ye.from(h[k].copy(g));let x=t.tr.step(new Yt(e.pos-h.length,e.pos+i.nodeSize,e.pos+y,e.pos+i.nodeSize-y,new ve(g,h.length,0),0,!0));n(x.scrollIntoView())}return!0}}return!1}function e2(t){return function(e,n){let r=e.selection,o=t<0?r.$from:r.$to,i=o.depth;for(;o.node(i).isInline;){if(!i)return!1;i--}return o.node(i).isTextblock?(n&&n(e.tr.setSelection(Pe.create(e.doc,t<0?o.start(i):o.end(i)))),!0):!1}}const lM=e2(-1),cM=e2(1);function ay(t,e=null){return function(n,r){let o=!1;for(let i=0;i<n.selection.ranges.length&&!o;i++){let{$from:{pos:s},$to:{pos:a}}=n.selection.ranges[i];n.doc.nodesBetween(s,a,(l,c)=>{if(o)return!1;if(!(!l.isTextblock||l.hasMarkup(t,e)))if(l.type==t)o=!0;else{let u=n.doc.resolve(c),d=u.index();o=u.parent.canReplaceWith(d,d+1,t)}})}if(!o)return!1;if(r){let i=n.tr;for(let s=0;s<n.selection.ranges.length;s++){let{$from:{pos:a},$to:{pos:l}}=n.selection.ranges[s];i.setBlockType(a,l,t,e)}r(i.scrollIntoView())}return!0}}function tp(...t){return function(e,n,r){for(let o=0;o<t.length;o++)if(t[o](e,n,r))return!0;return!1}}tp(Qf,V1,H1);tp(Qf,G1,K1);tp(X1,Y1,Z1,iM);typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function t2(t){for(let e=0;e<t.edgeCount;e++){const{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}const ly=(t,e)=>{const n=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();if(n){const r=n.filter(o=>e?.includes(o.type.name));t.tr.ensureMarks(r)}},uM=({keepMarks:t=!0}={})=>e=>{const{tr:n,state:r,dispatch:o,editor:i}=e,{selection:s,doc:a}=n,{$from:l,$to:c}=s,u=i.extensionService.attributes,d=Oe.getSplittedAttributes(u,l.node().type.name,l.node().attrs);if(s instanceof De&&s.node.isBlock)return!l.parentOffset||!Qn(a,l.pos)?!1:(o&&(t&&ly(r,i.extensionService.splittableMarks),n.split(l.pos).scrollIntoView()),!0);if(!l.parent.isBlock)return!1;if(o){const f=c.parentOffset===c.parent.content.size;s instanceof Pe&&n.deleteSelection();const p=l.depth===0?null:t2(l.node(-1).contentMatchAt(l.indexAfter(-1)));let h=f&&p?[{type:p,attrs:d}]:void 0,m=Qn(n.doc,n.mapping.map(l.pos),1,h);if(!h&&!m&&Qn(n.doc,n.mapping.map(l.pos),1,p?[{type:p}]:void 0)&&(m=!0,h=p?[{type:p,attrs:d}]:void 0),m&&(n.split(n.mapping.map(l.pos),1,h),p&&!f&&!l.parentOffset&&l.parent.type!==p)){const y=n.mapping.map(l.before()),g=n.doc.resolve(y);l.node(-1).canReplaceWith(g.index(),g.index()+1,p)&&n.setNodeMarkup(n.mapping.map(l.before()),p)}t&&ly(r,i.extensionService.splittableMarks),n.scrollIntoView()}return!0},dM=()=>({state:t,dispatch:e})=>Z1(t,e),fM=()=>({state:t,dispatch:e})=>Y1(t,e),pM=()=>({state:t,dispatch:e})=>X1(t,e),hM=()=>({state:t,dispatch:e})=>rM(t,e),n2=t=>{};function mM(t,e,n){const{selection:r}=e;let o=null;if(n2()&&(o=r.$cursor),o){const i=t.storedMarks??o.marks();return!!n.isInSet(i)||!i.some(s=>s.type.excludes(n))}return r.ranges.some(({$from:i,$to:s})=>{let a=i.depth===0?t.doc.inlineContent&&t.doc.type.allowsMarkType(n):!1;return t.doc.nodesBetween(i.pos,s.pos,(l,c,u)=>{if(a)return!1;if(l.isInline){const d=!u||u.type.allowsMarkType(n),f=!!n.isInSet(l.marks)||!l.marks.some(p=>p.type.excludes(n));a=d&&f}return!a}),a})}const gM=(t,e={})=>({tr:n,state:r,dispatch:o})=>{const{selection:i}=n,{empty:s,ranges:a}=i,l=sr(t,r.schema);if(o)if(s){const c=Oe.getMarkAttributes(r,l);n.addStoredMark(l.create({...c,...e}))}else a.forEach(c=>{const u=c.$from.pos,d=c.$to.pos;r.doc.nodesBetween(u,d,(f,p)=>{const h=Math.max(p,u),m=Math.min(p+f.nodeSize,d);f.marks.find(y=>y.type===l)?f.marks.forEach(y=>{l===y.type&&n.addMark(h,m,l.create({...y.attrs,...e}))}):n.addMark(h,m,l.create(e))})});return mM(r,n,l)};function _d(t,e,n={}){return t.find(r=>r.type===e&&Zo(r.attrs,n))}function yM(t,e,n={}){return!!_d(t,e,n)}function np(t,e,n={}){if(!t||!e)return;let r=t.parent.childAfter(t.parentOffset);if(t.parentOffset===r.offset&&r.offset!==0&&(r=t.parent.childBefore(t.parentOffset)),!r.node)return;const o=_d([...r.node.marks],e,n);if(!o)return;let i=r.index,s=t.start()+r.offset,a=i+1,l=s+r.node.nodeSize;for(_d([...r.node.marks],e,n);i>0&&o.isInSet(t.parent.child(i-1).marks);)i-=1,s-=t.parent.child(i).nodeSize;for(;a<t.parent.childCount&&yM([...t.parent.child(a).marks],e,n);)l+=t.parent.child(a).nodeSize,a+=1;return{from:s,to:l}}const wM=(t,e={})=>({tr:n,state:r,dispatch:o})=>{const{extendEmptyMarkRange:i=!1}=e,{selection:s}=n,a=sr(t,r.schema),{$from:l,empty:c,ranges:u}=s;if(!o)return!0;if(c&&i){let{from:d,to:f}=s;const p=l.marks().find(m=>m.type===a)?.attrs,h=np(l,a,p);h&&(d=h.from,f=h.to),n.removeMark(d,f,a)}else u.forEach(d=>{n.removeMark(d.$from.pos,d.$to.pos,a)});return n.removeStoredMark(a),!0},bM=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,{empty:r,ranges:o}=n;return r||e&&o.forEach(i=>{t.removeMark(i.$from.pos,i.$to.pos)}),!0};function al(t,e,n={}){const{empty:r,ranges:o}=t.selection,i=e?sr(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter(u=>i?i.name===u.type.name:!0).find(u=>Zo(u.attrs,n,{strict:!1}));let s=0;const a=[];if(o.forEach(({$from:u,$to:d})=>{const f=u.pos,p=d.pos;t.doc.nodesBetween(f,p,(h,m)=>{if(!h.isText&&!h.marks.length)return;const y=Math.max(f,m),g=Math.min(p,m+h.nodeSize),x=g-y;s+=x,a.push(...h.marks.map(k=>({mark:k,from:y,to:g})))})}),s===0)return!1;const l=a.filter(u=>i?i.name===u.mark.type.name:!0).filter(u=>Zo(u.mark.attrs,n,{strict:!1})).reduce((u,d)=>u+d.to-d.from,0),c=a.filter(u=>i?u.mark.type!==i&&u.mark.type.excludes(i):!0).reduce((u,d)=>u+d.to-d.from,0);return(l>0?l+c:l)>=s}const vM=(t,e={},n={})=>({state:r,commands:o})=>{const{extendEmptyMarkRange:i=!1}=n,s=sr(t,r.schema);return al(r,s,e)?o.unsetMark(s,{extendEmptyMarkRange:i}):o.setMark(s,e)},xM=()=>({state:t,tr:e,dispatch:n})=>{const{selection:r}=e,{ranges:o}=r;return n&&o.forEach(({$from:i,$to:s})=>{t.doc.nodesBetween(i.pos,s.pos,(a,l)=>{if(a.type.isText)return;const{doc:c,mapping:u}=e,d=c.resolve(u.map(l)),f=c.resolve(u.map(l+a.nodeSize)),p=d.blockRange(f);if(!p)return;const h=Ds(p);if(a.type.isTextblock){const{defaultType:m}=d.parent.contentMatchAt(d.index());e.setNodeMarkup(p.start,m)}(h||h===0)&&e.lift(p,h)})}),!0},kM=(t,e={})=>({state:n,dispatch:r,chain:o})=>{const i=mt(t,n.schema);return i.isTextblock?o().command(({commands:s})=>ay(i,e)(n)?!0:s.clearNodes()).command(({state:s})=>ay(i,e)(s,r)).run():!1};function ll(t,e,n={}){const{from:r,to:o,empty:i}=t.selection,s=e?mt(e,t.schema):null,a=[];t.doc.nodesBetween(r,o,(u,d)=>{if(u.isText)return;const f=Math.max(r,d),p=Math.min(o,d+u.nodeSize);a.push({node:u,from:f,to:p})});const l=o-r,c=a.filter(u=>s?s.name===u.node.type.name:!0).filter(u=>Zo(u.node.attrs,n,{strict:!1}));return i?!!c.length:c.reduce((u,d)=>u+d.to-d.from,0)>=l}const SM=(t,e,n={})=>({state:r,commands:o})=>{const i=mt(t,r.schema),s=mt(e,r.schema);return ll(r,i,n)?o.setNode(s):o.setNode(i,n)},CM=()=>({state:t,dispatch:e})=>sM(t,e),EM=()=>({state:t,dispatch:e})=>Qf(t,e),AM=(t,e={})=>({tr:n,state:r,dispatch:o})=>{let i=null,s=null;const a=Ls(typeof t=="string"?t:t.name,r.schema);return a?(a==="node"&&(i=mt(t,r.schema)),a==="mark"&&(s=sr(t,r.schema)),o&&n.selection.ranges.forEach(l=>{const c=l.$from.pos,u=l.$to.pos;r.doc.nodesBetween(c,u,(d,f)=>{i&&i===d.type&&n.setNodeMarkup(f,void 0,{...d.attrs,...e}),s&&d.marks.length&&d.marks.forEach(p=>{if(s===p.type){const h=Math.max(f,c),m=Math.min(f+d.nodeSize,u);n.addMark(h,m,s.create({...p.attrs,...e}))}})})}),!0):!1};function cy(t,e){const n=typeof e=="string"?[e]:e;return Object.keys(t).reduce((r,o)=>(n.includes(o)||(r[o]=t[o]),r),{})}const TM=(t,e)=>({tr:n,state:r,dispatch:o})=>{let i=null,s=null;const a=Ls(typeof t=="string"?t:t.name,r.schema);return a?(a==="node"&&(i=mt(t,r.schema)),a==="mark"&&(s=sr(t,r.schema)),o&&n.selection.ranges.forEach(l=>{r.doc.nodesBetween(l.$from.pos,l.$to.pos,(c,u)=>{i&&i===c.type&&n.setNodeMarkup(u,void 0,cy(c.attrs,e)),s&&c.marks.length&&c.marks.forEach(d=>{s===d.type&&n.addMark(u,u+c.nodeSize,s.create(cy(d.attrs,e)))})})}),!0):!1},$M=()=>({state:t,dispatch:e})=>tM(t,e),OM=()=>({state:t,dispatch:e})=>nM(t,e),MM=()=>({state:t,dispatch:e})=>V1(t,e),_M=()=>({state:t,dispatch:e})=>G1(t,e),NM=()=>({state:t,dispatch:e})=>H1(t,e),DM=()=>({state:t,dispatch:e})=>K1(t,e),IM=()=>({state:t,dispatch:e})=>lM(t,e),FM=()=>({state:t,dispatch:e})=>cM(t,e),BM=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),r2=t=>{const e=t.childNodes;for(let n=e.length-1;n>=0;n-=1){const r=e[n];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?t.removeChild(r):r.nodeType===1&&r2(r)}return t};function Zs(t){const e=`<body>${t}</body>`,n=new window.DOMParser().parseFromString(e,"text/html").body;return r2(n)}function Nd(t,e,n){n={slice:!0,parseOptions:{},...n};const r=typeof t=="object"&&t!==null,o=typeof t=="string";if(r)try{if(Array.isArray(t)&&t.length>0)return ye.fromArray(t.map(s=>e.nodeFromJSON(s)));const i=e.nodeFromJSON(t);return n.errorOnInvalidContent&&i.check(),i}catch(i){if(n.errorOnInvalidContent)throw new Error("[super-editor error]: Invalid JSON content",{cause:i});return console.warn("[super-editor warn]: Invalid content.","Passed value:",t,"Error:",i),Nd("",e,n)}if(o){if(n.errorOnInvalidContent){let s=!1,a="";const l=new $b({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__supereditor__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:c=>(s=!0,a=typeof c=="string"?c:c.outerHTML,null)}]}})});if(n.slice?Zr.fromSchema(l).parseSlice(Zs(t),n.parseOptions):Zr.fromSchema(l).parse(Zs(t),n.parseOptions),n.errorOnInvalidContent&&s)throw new Error("[super-editor error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${a}`)})}const i=Zr.fromSchema(e);return n.slice?i.parseSlice(Zs(t),n.parseOptions).content:i.parse(Zs(t),n.parseOptions)}return Nd("",e,n)}function RM(t,e,n){const r=t.steps.length-1;if(r<e)return;const o=t.steps[r];if(!(o instanceof $t||o instanceof Yt))return;const i=t.mapping.maps[r];let s=0;i.forEach((a,l,c,u)=>{s===0&&(s=u)}),t.setSelection(Re.near(t.doc.resolve(s),n))}const LM=t=>!("type"in t),PM=(t,e,n)=>({tr:r,dispatch:o,editor:i})=>{if(o){n={parseOptions:{},updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let s;try{s=Nd(e,i.schema,{parseOptions:{preserveWhitespace:"full",...n.parseOptions},errorOnInvalidContent:n.errorOnInvalidContent??i.options.enableContentCheck})}catch(f){return i.emit("contentError",{editor:i,error:f,disableCollaboration:()=>{console.error("[super-editor error]: Unable to disable collaboration at this point in time")}}),!1}let{from:a,to:l}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},c=!0,u=!0;if((LM(s)?s:[s]).forEach(f=>{f.check(),c=c?f.isText&&f.marks.length===0:!1,u=u?f.isBlock:!1}),a===l&&u){const{parent:f}=r.doc.resolve(a);f.isTextblock&&!f.type.spec.code&&!f.childCount&&(a-=1,l+=1)}let d;c?(Array.isArray(e)?d=e.map(f=>f.text||"").join(""):typeof e=="object"&&e&&e.text?d=e.text:d=e,r.insertText(d,a,l)):(d=s,r.replaceWith(a,l,d)),n.updateSelection&&RM(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:a,text:d}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:a,text:d})}return!0},zM=()=>({state:t,dispatch:e})=>{const n=t.plugins;for(let r=0;r<n.length;r+=1){const o=n[r];let i;if(o.spec.isInputRules&&(i=o.getState(t))){if(e){const s=t.tr,a=i.transform;for(let l=a.steps.length-1;l>=0;l-=1)s.step(a.steps[l].invert(a.docs[l]));if(i.text){const l=s.doc.resolve(i.from).marks();s.replaceWith(i.from,i.to,t.schema.text(i.text,l))}else s.delete(i.from,i.to)}return!0}}return!1};function jM(t,e=null){return function(n,r){let{$from:o,$to:i}=n.selection,s=o.blockRange(i);if(!s)return!1;let a=r?n.tr:null;return qM(a,s,t,e)?(r&&r(a.scrollIntoView()),!0):!1}}function qM(t,e,n,r=null){let o=!1,i=e,s=e.$from.doc;if(e.depth>=2&&e.$from.node(e.depth-1).type.compatibleContent(n)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let l=s.resolve(e.start-2);i=new Ha(l,l,e.depth),e.endIndex<e.parent.childCount&&(e=new Ha(e.$from,s.resolve(e.$to.end(e.depth)),e.depth)),o=!0}let a=Rb(i,n,r,e);return a?(t&&UM(t,e,a,o,n),!0):!1}function UM(t,e,n,r,o){let i=ye.empty;for(let u=n.length-1;u>=0;u--)i=ye.from(n[u].type.create(n[u].attrs,i));t.step(new Yt(e.start-(r?2:0),e.end,e.start,e.end,new ve(i,0,0),n.length,!0));let s=0;for(let u=0;u<n.length;u++)n[u].type==o&&(s=u+1);let a=n.length-s,l=e.start+n.length-(r?2:0),c=e.parent;for(let u=e.startIndex,d=e.endIndex,f=!0;u<d;u++,f=!1)!f&&Qn(t.doc,l,a)&&(t.split(l,a),l+=2*a),l+=c.child(u).nodeSize;return t}function VM(t){return function(e,n){let{$from:r,$to:o}=e.selection,i=r.blockRange(o,s=>s.childCount>0&&s.firstChild.type==t);return i?n?r.node(i.depth-1).type==t?HM(e,n,t,i):WM(e,n,i):!0:!1}}function HM(t,e,n,r){let o=t.tr,i=r.end,s=r.$to.end(r.depth);i<s&&(o.step(new Yt(i-1,s,i,s,new ve(ye.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new Ha(o.doc.resolve(r.$from.pos),o.doc.resolve(s),r.depth));const a=Ds(r);if(a==null)return!1;o.lift(r,a);let l=o.doc.resolve(o.mapping.map(i,-1)-1);return Dr(o.doc,l.pos)&&l.nodeBefore.type==l.nodeAfter.type&&o.join(l.pos),e(o.scrollIntoView()),!0}function WM(t,e,n){let r=t.tr,o=n.parent;for(let p=n.end,h=n.endIndex-1,m=n.startIndex;h>m;h--)p-=o.child(h).nodeSize,r.delete(p-1,p+1);let i=r.doc.resolve(n.start),s=i.nodeAfter;if(r.mapping.map(n.end)!=n.start+i.nodeAfter.nodeSize)return!1;let a=n.startIndex==0,l=n.endIndex==o.childCount,c=i.node(-1),u=i.index(-1);if(!c.canReplace(u+(a?0:1),u+1,s.content.append(l?ye.empty:ye.from(o))))return!1;let d=i.pos,f=d+s.nodeSize;return r.step(new Yt(d-(a?1:0),f+(l?1:0),d+1,f-1,new ve((a?ye.empty:ye.from(o.copy(ye.empty))).append(l?ye.empty:ye.from(o.copy(ye.empty))),a?0:1,l?0:1),a?0:1)),e(r.scrollIntoView()),!0}function GM(t){return function(e,n){let{$from:r,$to:o}=e.selection,i=r.blockRange(o,c=>c.childCount>0&&c.firstChild.type==t);if(!i)return!1;let s=i.startIndex;if(s==0)return!1;let a=i.parent,l=a.child(s-1);if(l.type!=t)return!1;if(n){let c=l.lastChild&&l.lastChild.type==a.type,u=ye.from(c?t.create():null),d=new ve(ye.from(t.create(null,ye.from(a.type.create(null,u)))),c?3:1,0),f=i.start,p=i.end;n(e.tr.step(new Yt(f-(c?3:1),p,f,p,d,1,!0)).scrollIntoView())}return!0}}const KM=(t,e={})=>({state:n,dispatch:r})=>{const o=mt(t,n.schema);return jM(o,e)(n,r)},Bl=(t,e)=>{for(let n=t.depth;n>0;n--){const r=t.node(n);if(e(r))return{pos:n>0?t.before(n):0,start:t.start(n),depth:n,node:r}}},Kt=t=>({$from:e})=>Bl(e,t),Dd=(t,e)=>{const n=e.filter(i=>i.type==="node").find(i=>i.name===t);if(!n)return!1;const r={name:n.name,options:n.options,storage:n.storage},o=He(_e(n,"group",r));return typeof o!="string"?!1:o.split(" ").includes("list")},JM={type:"element",name:"w:abstractNum",attributes:{"w:abstractNumId":"1","w15:restartNumberingAfterBreak":"0"},elements:[{type:"element",name:"w:multiLevelType",attributes:{"w:val":"hybridMultilevel"}},{type:"element",name:"w:tmpl",attributes:{"w:val":"EE6417C4"}},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"0","w:tplc":"0409000F"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"decimal"}},{type:"element",name:"w:lvlText",attributes:{"w:val":"%1."}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"left"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"720","w:hanging":"360"}}]}]},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"1","w:tplc":"04090019","w:tentative":"1"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"lowerLetter"}},{type:"element",name:"w:lvlText",attributes:{"w:val":"%2."}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"left"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"1440","w:hanging":"360"}}]}]},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"2","w:tplc":"0409001B","w:tentative":"1"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"lowerRoman"}},{type:"element",name:"w:lvlText",attributes:{"w:val":"%3."}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"right"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"2160","w:hanging":"180"}}]}]},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"3","w:tplc":"0409000F","w:tentative":"1"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"decimal"}},{type:"element",name:"w:lvlText",attributes:{"w:val":"%4."}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"left"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"2880","w:hanging":"360"}}]}]},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"4","w:tplc":"04090019","w:tentative":"1"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"lowerLetter"}},{type:"element",name:"w:lvlText",attributes:{"w:val":"%5."}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"left"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"3600","w:hanging":"360"}}]}]},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"5","w:tplc":"0409001B","w:tentative":"1"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"lowerRoman"}},{type:"element",name:"w:lvlText",attributes:{"w:val":"%6."}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"right"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"4320","w:hanging":"180"}}]}]},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"6","w:tplc":"0409000F","w:tentative":"1"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"decimal"}},{type:"element",name:"w:lvlText",attributes:{"w:val":"%7."}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"left"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"5040","w:hanging":"360"}}]}]},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"7","w:tplc":"04090019","w:tentative":"1"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"lowerLetter"}},{type:"element",name:"w:lvlText",attributes:{"w:val":"%8."}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"left"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"5760","w:hanging":"360"}}]}]},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"8","w:tplc":"0409001B","w:tentative":"1"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"lowerRoman"}},{type:"element",name:"w:lvlText",attributes:{"w:val":"%9."}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"right"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"6480","w:hanging":"180"}}]}]}]},XM={type:"element",name:"w:abstractNum",attributes:{"w:abstractNumId":"0","w15:restartNumberingAfterBreak":"0"},elements:[{type:"element",name:"w:nsid",attributes:{"w:val":"16126B07"}},{type:"element",name:"w:multiLevelType",attributes:{"w:val":"hybridMultilevel"}},{type:"element",name:"w:tmpl",attributes:{"w:val":"51EC4E08"}},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"0","w:tplc":"04090001"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"bullet"}},{type:"element",name:"w:lvlText",attributes:{"w:val":""}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"left"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"720","w:hanging":"360"}}]},{type:"element",name:"w:rPr",elements:[{type:"element",name:"w:rFonts",attributes:{"w:ascii":"Symbol","w:hAnsi":"Symbol","w:hint":"default"}}]}]},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"1","w:tplc":"04090003","w:tentative":"1"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"bullet"}},{type:"element",name:"w:lvlText",attributes:{"w:val":"o"}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"left"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"1440","w:hanging":"360"}}]},{type:"element",name:"w:rPr",elements:[{type:"element",name:"w:rFonts",attributes:{"w:ascii":"Courier New","w:hAnsi":"Courier New","w:cs":"Courier New","w:hint":"default"}}]}]},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"2","w:tplc":"04090005","w:tentative":"1"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"bullet"}},{type:"element",name:"w:lvlText",attributes:{"w:val":""}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"left"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"2160","w:hanging":"360"}}]},{type:"element",name:"w:rPr",elements:[{type:"element",name:"w:rFonts",attributes:{"w:ascii":"Wingdings","w:hAnsi":"Wingdings","w:hint":"default"}}]}]},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"3","w:tplc":"04090001","w:tentative":"1"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"bullet"}},{type:"element",name:"w:lvlText",attributes:{"w:val":""}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"left"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"2880","w:hanging":"360"}}]},{type:"element",name:"w:rPr",elements:[{type:"element",name:"w:rFonts",attributes:{"w:ascii":"Symbol","w:hAnsi":"Symbol","w:hint":"default"}}]}]},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"4","w:tplc":"04090003","w:tentative":"1"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"bullet"}},{type:"element",name:"w:lvlText",attributes:{"w:val":"o"}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"left"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"3600","w:hanging":"360"}}]},{type:"element",name:"w:rPr",elements:[{type:"element",name:"w:rFonts",attributes:{"w:ascii":"Courier New","w:hAnsi":"Courier New","w:cs":"Courier New","w:hint":"default"}}]}]},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"5","w:tplc":"04090005","w:tentative":"1"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"bullet"}},{type:"element",name:"w:lvlText",attributes:{"w:val":""}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"left"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"4320","w:hanging":"360"}}]},{type:"element",name:"w:rPr",elements:[{type:"element",name:"w:rFonts",attributes:{"w:ascii":"Wingdings","w:hAnsi":"Wingdings","w:hint":"default"}}]}]},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"6","w:tplc":"04090001","w:tentative":"1"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"bullet"}},{type:"element",name:"w:lvlText",attributes:{"w:val":""}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"left"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"5040","w:hanging":"360"}}]},{type:"element",name:"w:rPr",elements:[{type:"element",name:"w:rFonts",attributes:{"w:ascii":"Symbol","w:hAnsi":"Symbol","w:hint":"default"}}]}]},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"7","w:tplc":"04090003","w:tentative":"1"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"bullet"}},{type:"element",name:"w:lvlText",attributes:{"w:val":"o"}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"left"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"5760","w:hanging":"360"}}]},{type:"element",name:"w:rPr",elements:[{type:"element",name:"w:rFonts",attributes:{"w:ascii":"Courier New","w:hAnsi":"Courier New","w:cs":"Courier New","w:hint":"default"}}]}]},{type:"element",name:"w:lvl",attributes:{"w:ilvl":"8","w:tplc":"04090005","w:tentative":"1"},elements:[{type:"element",name:"w:start",attributes:{"w:val":"1"}},{type:"element",name:"w:numFmt",attributes:{"w:val":"bullet"}},{type:"element",name:"w:lvlText",attributes:{"w:val":""}},{type:"element",name:"w:lvlJc",attributes:{"w:val":"left"}},{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:ind",attributes:{"w:left":"6480","w:hanging":"360"}}]},{type:"element",name:"w:rPr",elements:[{type:"element",name:"w:rFonts",attributes:{"w:ascii":"Wingdings","w:hAnsi":"Wingdings","w:hint":"default"}}]}]}]},du=(t,e)=>{const n=Kt(i=>i.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(r===void 0)return!0;const o=t.doc.nodeAt(r);return n.node.type===o?.type&&Dr(t.doc,n.pos)&&t.join(n.pos),!0},fu=(t,e)=>{const n=Kt(i=>i.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(n.start).after(n.depth);if(r===void 0)return!0;const o=t.doc.nodeAt(r);return n.node.type===o?.type&&Dr(t.doc,r)&&t.join(r),!0},YM=(t,e,n,r={})=>o=>{const{editor:i,tr:s,state:a,dispatch:l,chain:c,can:u,commands:d}=o,{extensions:f,splittableMarks:p}=i.extensionService,h=mt(t,a.schema),m=mt(e,a.schema),{selection:y,storedMarks:g}=a,{$from:x,$to:k}=y,b=x.blockRange(k),T=g||y.$to.parentOffset&&y.$from.marks();if(!b)return!1;const M=Kt(V=>Dd(V.type.name,f))(y),{numbering:_}=i.converter;if(b.depth>=1&&M&&b.depth-M.depth<=1){if(M.node.type===h){const{listId:V}=M.node.attrs;return i.converter.numbering=QM(V,_),d.liftListItem(m)}if(Dd(M.node.type.name,f)&&h.validContent(M.node.content)&&l)return c().command(()=>(s.setNodeMarkup(M.pos,h),!0)).command(()=>du(s,h)).command(()=>fu(s,h)).run()}const F=({ensureMarks:V=!1})=>()=>{const ie=u().wrapInList(h,r);if(V){const I=T.filter(W=>p.includes(W.type.name));s.ensureMarks(I)}return ie?!0:d.clearNodes()},C=o2(_.definitions);return i.converter.numbering=ZM(C,_,h),r.listId=C,!n||!T||!l?c().command(F({ensureMarks:!1})).wrapInList(h,r).command(()=>du(s,h)).command(()=>fu(s,h)).run():c().command(F({ensureMarks:!0})).wrapInList(h,r).command(()=>du(s,h)).command(()=>fu(s,h)).run()},o2=t=>Math.max(...Object.keys(t).map(Number))+1,ZM=(t,e,n)=>{const r=n.name==="orderedList"?JM:XM,o={...e},i=o2(o.abstracts),s={...r,attributes:{...r.attributes,"w:abstractNumId":String(i)}};o.abstracts[i]=s;const a={type:"element",name:"w:num",attributes:{"w:numId":String(t),"w16cid:durableId":"485517411"},elements:[{name:"w:abstractNumId",attributes:{"w:val":String(i)}}]};return o.definitions[t]=a,o},QM=(t,e)=>{const{definitions:n,abstracts:r}=e,o=n[t].elements[0].attributes["w:val"];return delete n[t],delete r[o],e},e5=t=>e=>{const{tr:n,state:r,dispatch:o,editor:i}=e,s=mt(t,r.schema),{$from:a,$to:l,node:c}=r.selection;if(c&&c.isBlock||a.depth<2||!a.sameParent(l))return!1;const u=a.node(-1);if(u.type!==s)return!1;const d=i.extensionService.attributes;if(a.parent.content.size===0&&a.node(-1).childCount===a.indexAfter(-1)){if(a.depth===2||a.node(-3).type!==s||a.index(-2)!==a.node(-2).childCount-1)return!1;if(o){let y=ye.empty;const g=a.index(-1)?1:a.index(-2)?2:3;for(let _=a.depth-g;_>=a.depth-3;_--)y=ye.from(a.node(_).copy(y));const x=a.indexAfter(-1)<a.node(-2).childCount?1:a.indexAfter(-2)<a.node(-3).childCount?2:3,k=Oe.getSplittedAttributes(d,a.node().type.name,a.node().attrs),b=s.contentMatch.defaultType?.createAndFill(k)||void 0;y=y.append(ye.from(s.createAndFill(null,b)||void 0));const T=a.before(a.depth-(g-1));n.replace(T,a.after(-x),new ve(y,4-g,0));let M=-1;n.doc.nodesBetween(T,n.doc.content.size,(_,F)=>{if(M>-1)return!1;_.isTextblock&&_.content.size===0&&(M=F+1)}),M>-1&&n.setSelection(Pe.near(n.doc.resolve(M))),n.scrollIntoView()}return!0}const f=l.pos===a.end()?u.contentMatchAt(0).defaultType:null,p=Oe.getSplittedAttributes(d,u.type.name,u.attrs),h=Oe.getSplittedAttributes(d,a.node().type.name,a.node().attrs);n.delete(a.pos,l.pos);const m=f?[{type:s,attrs:p},{type:f,attrs:h}]:[{type:s,attrs:p}];if(!Qn(n.doc,a.pos,2))return!1;if(o){const{selection:y,storedMarks:g}=r,{splittableMarks:x}=i.extensionService,k=g||y.$to.parentOffset&&y.$from.marks();if(n.split(a.pos,2,m).scrollIntoView(),!k||!o)return!0;const b=k.filter(T=>x.includes(T.type.name));n.ensureMarks(b),n.setMeta("splitListItem",b)}return!0},t5=t=>({state:e,dispatch:n})=>{const r=mt(t,e.schema);return GM(r)(e,n)},n5=t=>({state:e,dispatch:n})=>{const r=mt(t,e.schema);return VM(r)(e,n)},r5=Object.freeze(Object.defineProperty({__proto__:null,clearNodes:xM,command:JO,createParagraphNear:fM,deleteSelection:EM,exitCode:hM,first:KO,insertContent:BM,insertContentAt:PM,insertTabChar:XO,insertTabNode:YO,joinBackward:MM,joinDown:OM,joinForward:_M,joinUp:$M,liftEmptyBlock:dM,liftListItem:n5,newlineInCode:pM,resetAttributes:TM,selectAll:CM,selectNodeBackward:NM,selectNodeForward:DM,selectTextblockEnd:FM,selectTextblockStart:IM,setMark:gM,setMeta:ZO,setNode:kM,sinkListItem:t5,splitBlock:uM,splitListItem:e5,toggleList:YM,toggleMark:vM,toggleNode:SM,undoInputRule:zM,unsetAllMarks:bM,unsetMark:wM,updateAttributes:AM,wrapInList:KM},Symbol.toStringTag,{value:"Module"})),o5=ot.create({name:"commands",addCommands(){return{...r5}}}),i5=()=>["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform),s5=()=>typeof navigator<"u"?/Mac/.test(navigator.platform):!1,a5=t=>{t.commands.first(({commands:e})=>[()=>e.newlineInCode(),()=>e.createParagraphNear(),()=>e.liftEmptyBlock(),()=>e.splitBlock()])},ki=t=>{t.commands.first(({commands:e,tr:n})=>[()=>e.undoInputRule(),()=>(n.setMeta("inputType","deleteContentBackward"),!1),()=>e.deleteSelection(),()=>e.joinBackward(),()=>e.selectNodeBackward()])},Co=t=>{t.commands.first(({commands:e})=>[()=>e.deleteSelection(),()=>e.joinForward(),()=>e.selectNodeForward()])},l5=ot.create({name:"keymap",addShortcuts(){const t={Enter:()=>a5(this.editor),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:()=>ki(this.editor),"Mod-Backspace":()=>ki(this.editor),"Shift-Backspace":()=>ki(this.editor),Delete:()=>Co(this.editor),"Mod-Delete":()=>Co(this.editor),"Mod-a":()=>this.editor.commands.selectAll(),Tab:()=>this.editor.commands.insertTabNode()},e={...t},n={...t,"Ctrl-h":()=>ki(this.editor),"Alt-Backspace":()=>ki(this.editor),"Ctrl-d":()=>Co(this.editor),"Ctrl-Alt-Backspace":()=>Co(this.editor),"Alt-Delete":()=>Co(this.editor),"Alt-d":()=>Co(this.editor),"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd(),"Ctrl-t":()=>this.editor.commands.insertTabChar()};return s5()||i5()?n:e}}),c5=ot.create({name:"editable",addPmPlugins(){return[new Qe({key:new tt("editable"),props:{editable:()=>this.editor.options.editable}})]}}),u5=ot.create({name:"editorFocus",addPmPlugins(){const t=this.editor;return[new Qe({key:new tt("editorFocus"),props:{handleDOMEvents:{focus:(e,n)=>{t.isFocused=!0;const r=t.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1},blur:(e,n)=>{t.isFocused=!1;const r=t.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1}}}})]}});function i2(t,e,n,{check:r=!1}={}){const o=t.getSchema(n);if(o){const i=e.nodeFromJSON(o);return r&&i.check(),i}return e.topNodeType.createAndFill()}function s2(t,e,n={}){if(!e)return ll(t,null,n)||al(t,null,n);const r=Ls(e,t.schema);return r==="node"?ll(t,e,n):r==="mark"?al(t,e,n):!1}const rp=({tr:t,from:e,to:n,markName:r,attrs:o={},offset:i=1})=>{const{doc:s}=t,a=Math.max(e-i,0),l=Math.min(n+i,s.content.size);let c;return s.nodesBetween(a,l,(u,d)=>{if(!u||u?.nodeSize===void 0)return;const f=u.marks.find(p=>p.type.name===r&&Object.keys(o).every(h=>p.attrs[h]===o[h]));f&&!c&&(c={from:d,to:d+u.nodeSize,mark:f})}),c},a2=({tr:t,from:e,to:n,user:r,date:o})=>{t.removeMark(e,n,t.doc.type.schema.marks[ut]),t.removeMark(e,n,t.doc.type.schema.marks[Ft]);let i=rp({tr:t,from:e,to:n,markName:Ft,attrs:{authorEmail:r.email}}),s;i?s=i.mark.attrs.id:s=go();const a=t.doc.type.schema.marks[Ft].create({id:s,author:r.name,authorEmail:r.email,date:o});return t.addMark(e,n,a),t.doc.nodesBetween(e,n,(l,c)=>{if(c<e||["bulletList","orderedList"].includes(l.type.name))return!0;if(l.isInline||["tableRow","tableCell"].includes(l.type.name)||(l.attrs.track,l.type.name==="table"))return!1}),a},l2=({tr:t,from:e,to:n,user:r,date:o})=>{let i=rp({tr:t,from:e,to:n,markName:ut,attrs:{authorEmail:r.email}}),s;i?s=i.mark.attrs.id:s=go();const a=t.doc.type.schema.marks[ut].create({id:s,author:r.name,authorEmail:r.email,date:o}),l=new Jo;let c=[];return t.doc.nodesBetween(e,n,(u,d)=>{if(!u.type.name.includes("table"))if(u.isInline&&u.marks.find(f=>f.type.name===Ft&&f.attrs.authorEmail===r.email)){const f=new $t(l.map(Math.max(e,d)),l.map(Math.min(n,d+u.nodeSize)),ve.empty);t.maybeStep(f).failed||l.appendMap(f.getMap())}else u.isInline&&!u.marks.find(f=>f.type.name===ut)?(c.push(u),t.addMark(l.map(Math.max(e,d)),l.map(Math.min(n,d+u.nodeSize)),a)):u.attrs.track&&!u.attrs.track.find(f=>f.type===ut)&&["bulletList","orderedList"].includes(u.type.name)}),{deletionMark:a,deletionMap:l,nodes:c}};function d5(t){const e={bulletList:1,orderedList:2};return{attributes:{parentAttributes:{"w14:paraId":Jn(),"w14:textId":Jn(),"w:rsidR":Jn(),"w:rsidRDefault":Jn(),"w:rsidP":Jn(),paragraphProperties:{type:"element",name:"w:pPr",elements:[{type:"element",name:"w:pStyle",attributes:{"w:val":"ListParagraph"}},{type:"element",name:"w:numPr",elements:[{type:"element",name:"w:ilvl",attributes:{"w:val":"0"}},{type:"element",name:"w:numId",attributes:{"w:val":e[t]||0}}]}]}}}}}function f5(t,e,n){const r=[];return t===e?n.resolve(t).marks().forEach(o=>{const i=n.resolve(t-1),s=np(i,o.type);s&&r.push({mark:o,...s})}):n.nodesBetween(t,e,(o,i)=>{!o||o?.nodeSize===void 0||r.push(...o.marks.map(s=>({from:i,to:i+o.nodeSize,mark:s})))}),r}function op(t,e){const n=[];return t.descendants((r,o)=>{e(r)&&n.push({node:r,pos:o})}),n}function cl(t=0,e=0,n=0){return Math.min(Math.max(t,e),n)}function c2(t,e,n){const r=t.state.doc.content.size,o=cl(e,0,r),i=cl(n,0,r),s=t.coordsAtPos(o),a=t.coordsAtPos(i,-1),l=Math.min(s.top,a.top),c=Math.max(s.bottom,a.bottom),u=Math.min(s.left,a.left),d=Math.max(s.right,a.right),f=d-u,p=c-l,h={top:l,bottom:c,left:u,right:d,width:f,height:p,x:u,y:l};return{...h,toJSON:()=>h}}const ip=t=>{const{$head:e}=t.selection;for(let n=e.depth;n>0;n-=1)if(e.node(n).type?.spec?.tableRole==="row")return!0;return!1},sp=Object.freeze(Object.defineProperty({__proto__:null,chainableEditorState:Zf,cleanSchemaItem:Od,createDocument:i2,defaultBlockAt:t2,findChildren:op,findMark:Nl,findParentNode:Kt,findParentNodeClosestToPos:Bl,generateDocxListAttributes:d5,generateDocxRandomId:Jn,generateRandom32BitHex:If,getActiveFormatting:Lf,getExtensionConfigField:_e,getMarkRange:np,getMarkType:sr,getMarksBetween:f5,getMarksFromSelection:Is,getNodeType:mt,getSchemaTypeByName:ys,getSchemaTypeNameByName:Ls,isActive:s2,isInTable:ip,isList:Dd,isMarkActive:al,isNodeActive:ll,isTextSelection:n2,posToDOMRect:c2},Symbol.toStringTag,{value:"Module"})),p5=(t,e,n)=>{const r=t.resolve(e),o=r.parent,i=o.childAfter(r.parentOffset);if(!i.node)return null;const s=i.node.marks.find(d=>d.type.name===n);let a=r.index(),l=r.start()+i.offset;for(;a>0&&s.isInSet(o.child(a-1).marks);)l-=o.child(--a).nodeSize;let c=r.index()+1,u=r.start()+i.offset+i.node.nodeSize;for(;c<o.childCount&&s.isInSet(o.child(c).marks);)u+=o.child(c++).nodeSize;return{from:l,to:u,attrs:s.attrs}},u2=(t,e=!0)=>{if(!t)throw new Error('Invalid "node" parameter');const n=[];return t.descendants((r,o)=>{if(n.push({node:r,pos:o}),!e)return!1}),n},d2=(t,e,n)=>{if(t){if(!e)throw new Error('Invalid "predicate" parameter')}else throw new Error('Invalid "node" parameter');return u2(t,n).filter(r=>e(r.node))},f2=(t,e)=>d2(t,n=>n.isInline,e),h5=Object.freeze(Object.defineProperty({__proto__:null,findChildren:d2,findInlineNodes:f2,findMarkPosition:p5,flatten:u2},Symbol.toStringTag,{value:"Module"})),ap=(t,e=null)=>{const n=[],r=f2(t.doc);return r.length?(r.forEach(({node:o,pos:i})=>{const{marks:s}=o,a=[Ft,ut,vt];s.length>0&&s.forEach(l=>{a.includes(l.type.name)&&n.push({mark:l,from:i,to:i+o.nodeSize})})}),e?n.filter(({mark:o})=>o.attrs.id===e):n):n},ht=new tt("TrackChangesBase"),m5=(t={})=>new Qe({key:ht,state:{init(e,n){return{isTrackChangesActive:!1,onlyOriginalShown:!1,onlyModifiedShown:!1,decorations:Eo(n,!1,!1)}},apply(e,n,r,o){const i=e.getMeta(ht);return i?i.type==="TRACK_CHANGES_ENABLE"?{...n,isTrackChangesActive:i.value===!0,decorations:Eo(o,n.onlyOriginalShown,n.onlyModifiedShown)}:i.type==="SHOW_ONLY_ORIGINAL"?{...n,onlyOriginalShown:i.value===!0,onlyModifiedShown:!1,decorations:Eo(o,i.value===!0,!1)}:i.type==="SHOW_ONLY_MODIFIED"?{...n,onlyOriginalShown:!1,onlyModifiedShown:i.value===!0,decorations:Eo(o,!1,i.value===!0)}:{...n,decorations:Eo(o,n.onlyOriginalShown,n.onlyModifiedShown)}:{...n,decorations:Eo(o,n.onlyOriginalShown,n.onlyModifiedShown)}}},props:{decorations(e){return this.getState(e)?.decorations}}}),Eo=(t,e,n)=>{if(!t.doc||!t.doc.nodeSize||n&&e)return Le.empty;const r=[],o=ap(t);return o.length?(o.forEach(({mark:i,from:s,to:a})=>{if(i.type.name===Ft)if(e){const l=ze.inline(s,a,{class:"track-insert-dec hidden"});r.push(l)}else if(n){const l=ze.inline(s,a,{class:"track-insert-dec normal"});r.push(l)}else{const l=ze.inline(s,a,{class:"track-insert-dec highlighted"});r.push(l)}if(i.type.name===ut)if(e){const l=ze.inline(s,a,{class:"track-delete-dec normal"});r.push(l)}else if(n){const l=ze.inline(s,a,{class:"track-delete-dec hidden"});r.push(l)}else{const l=ze.inline(s,a,{class:"track-delete-dec highlighted"});r.push(l);const c=ze.widget(s,()=>{const u=document.createElement("span");return u.classList.add("track-delete-widget"),u.contentEditable=!1,u},{ignoreSelection:!0});r.push(c)}if(i.type.name===vt)if(e){const l=ze.inline(s,a,{class:"track-format-dec before"});r.push(l)}else if(n){const l=ze.inline(s,a,{class:"track-format-dec normal"});r.push(l)}else{const l=ze.inline(s,a,{class:"track-format-dec highlighted"});r.push(l)}}),Le.create(t.doc,r)):Le.empty},nn="commentMark",uy=({commentId:t,state:e,tr:n,dispatch:r})=>{g5(t,e.doc).forEach(({from:o,to:i})=>{n.removeMark(o,i,e.schema.marks[nn])}),r(n)},g5=(t,e)=>{const n=[];return e.descendants((r,o)=>{const{marks:i}=r,s=i.find(a=>a.type.name===nn);if(s){const{attrs:a}=s,{commentId:l}=a;t===l&&n.push({from:o,to:o+r.nodeSize})}}),n},y5=(t,e,n,r=[])=>{const o=[],i=[],s=new Set;return t.descendants((a,l)=>{(a.marks?.filter(c=>c.type.name===nn)).forEach(c=>{if(c){const{attrs:u={}}=c,{commentId:d}=u;if(d==="pending"||s.has(d))return;s.add(d);const f=dy(c.attrs),p=n.nodes.commentRangeStart.create(f);o.push({pos:l,node:p});const h=n.nodes.commentRangeEnd.create(f);i.push({pos:l+a.nodeSize,node:h});const m=d;m&&r.filter(y=>y.parentCommentId===m).sort((y,g)=>y.createdTime-g.createdTime).forEach(y=>{const g=dy(y),x=n.nodes.commentRangeStart.create(g);s.add(y.commentId),o.push({pos:l,node:x});const k=n.nodes.commentRangeEnd.create(g);i.push({pos:l+a.nodeSize,node:k})})}})}),o.forEach(a=>{const{pos:l,node:c}=a,u=e.mapping.map(l);e.insert(u,c)}),i.forEach(a=>{const{pos:l,node:c}=a,u=e.mapping.map(l);e.insert(u,c)}),e},dy=t=>{const{commentId:e,internal:n}=t;return{"w:id":e,internal:n}},w5=(t,e,n,r)=>{const o=[],i=[];t.descendants((s,a)=>{const{type:l}=s;if(!["commentRangeStart","commentRangeEnd","commentReference"].includes(l.name))return;const c=r.comments?.find(d=>d.importedId==s.attrs["w:id"])||{},{commentId:u}=c;if(u)if(l.name==="commentRangeStart")o.push({"w:id":u,importedId:s.attrs["w:id"],internal:!1,start:a}),i.push({start:a,end:a+1});else if(l.name==="commentRangeEnd"){const d=o.find(h=>h.importedId===s.attrs["w:id"]);if(!d)return;const{start:f}=d,p={commentId:u,importedId:s.attrs["w:id"],internal:d.internal};e.addMark(f,a+1,n.marks[nn].create(p)),i.push({start:a,end:a+1})}else l.name==="commentReference"&&i.push({start:a,end:a+1})}),i.sort((s,a)=>a.start-s.start).forEach(({start:s,end:a})=>{e.delete(s,a)})},b5=(t={})=>{const{before:e=[],after:n=[]}=t,r=new Set(e.map(h=>h.type)),o=new Set(n.map(h=>h.type)),i=[...o].filter(h=>!r.has(h)),s=[...r].filter(h=>!o.has(h)),a=[],l=i.filter(h=>!["textStyle","commentMark"].includes(h));l.length&&a.push(`Added formatting: ${l.join(", ")}`);const c=s.filter(h=>!["textStyle","commentMark"].includes(h));c.length&&a.push(`Removed formatting: ${c.join(", ")}`);const u=e.find(h=>h.type==="textStyle")?.attrs||{},d=n.find(h=>h.type==="textStyle")?.attrs||{},f=[],p=h=>h.replace(/([a-z])([A-Z])/g,"$1 $2").toLowerCase();return Object.keys({...u,...d}).forEach(h=>{const m=u[h],y=d[h];if(m!==y){if(y===null)return;if(h==="color")f.push("Changed color");else{const g=p(h);m==null?f.push(`Set ${g} to ${y}`):f.push(`Changed ${g} from ${m} to ${y}`)}}}),f.length&&a.push(`Modified text style: ${f.join(", ")}`),a.length?a.join(". "):"No formatting changes."},v5=({activeThreadId:t,threadId:e,isInternal:n,editor:r})=>{if(!r.options.isInternal&&n)return"transparent";const o=bt.getState(r.state),i=n?o.internalColor:o.externalColor,s=t==e?"44":"22";return`${i}${s}`},to=new tt("paginationPlugin"),x5=async t=>{if(!t.converter)return;const e={headers:{},footers:{}},n=t.converter.headerIds,r=t.converter.footerIds;for(let o in n){const i=n[o];if(!i)continue;const s=t.converter.headers[i];e.headers[i]||(e.headers[i]={}),e.headers[i].data=s;const{height:a,sectionEditor:l,sectionContainer:c}=await fy(t,s);e.headers[i].height=a,e.headers[i].sectionEditor=l,e.headers[i].sectionContainer=c}for(let o in r){const i=r[o];if(!i)continue;const s=t.converter.footers[i];e.headers[i]||(e.footers[i]={}),e.footers[i].data=s;const{height:a,sectionEditor:l,sectionContainer:c}=await fy(t,s);e.footers[i].height=a,e.footers[i].sectionEditor=l,e.footers[i].sectionContainer=c}return e},fy=async(t,e)=>new Promise(n=>{const r=document.createElement("div");r.className="super-editor",r.style.padding=0,r.style.margin=0;const o=t.converter.getDocumentDefaultStyles(),{fontSizePt:i,typeface:s}=o,a=i*1.3333,l=a*1.15;Object.assign(r.style,{padding:"0",margin:"0",border:"none",boxSizing:"border-box",position:"absolute",top:"0",left:"0",width:"auto",maxWidth:"none",fontFamily:s,fontSize:`${a}px`,lineHeight:`${l}px`}),document.body.appendChild(r);const c=new ws({loadFromSchema:!0,mode:"text",editable:!1,element:r,content:e,extensions:xp(),documentId:"sectionId"});c.on("create",()=>{requestAnimationFrame(()=>{const u=r.offsetHeight;document.body.removeChild(r),Object.assign(r.style,{padding:"0",margin:"0",border:"none",boxSizing:"border-box",position:"relative",top:"initial",left:"initial",width:"initial",maxWidth:"initial",fontFamily:"initial",fontSize:"initial",lineHeight:"initial"}),n({height:u,sectionEditor:c,sectionContainer:r})})})}),lp=[Ft,ut,vt],bt=new tt("comments"),k5=ot.create({name:"comments",addCommands(){return{insertComment:t=>({tr:e,dispatch:n,state:r})=>{const{selection:o}=e,{$from:i,$to:s}=o,{commentId:a,isInternal:l}=t;return e.setMeta(bt,{event:"add"}),e.addMark(i.pos,s.pos,this.editor.schema.marks[nn].create({commentId:a,internal:l})),n(e),!0},removeComment:({commentId:t,importedId:e})=>({tr:n,dispatch:r,state:o})=>{n.setMeta(bt,{event:"deleted"}),uy({commentId:t,state:o,tr:n,dispatch:r})},setActiveComment:({commentId:t})=>({tr:e,dispatch:n})=>{let r=t;return e.setMeta(bt,{type:"setActiveComment",activeThreadId:r}),!0},setCommentInternal:({commentId:t,isInternal:e})=>({tr:n,dispatch:r,state:o})=>{const{doc:i}=o;let s,a;return n.setMeta(bt,{event:"update"}),i.descendants((l,c)=>{if(s)return;const{marks:u=[]}=l,d=u.find(f=>f.type.name===nn);if(d){const{attrs:f}=d;f.commentId===t&&(s=l,a=c)}}),s?(n.addMark(a,a+s.nodeSize,this.editor.schema.marks[nn].create({commentId:t,internal:e})),n.setMeta(bt,{type:"setCommentInternal"}),r(n),!0):!1},resolveComment:({commentId:t})=>({tr:e,dispatch:n,state:r})=>{e.setMeta(bt,{event:"update"}),uy({commentId:t,state:r,tr:e,dispatch:n})}}},addPmPlugins(){const t=this.editor;let e,n;return t.options.isHeadless?[]:[new Qe({key:bt,state:{init(){return{activeThreadId:null,externalColor:"#B1124B",internalColor:"#078383",decorations:Le.empty,allCommentPositions:{},allCommentIds:[],changedActiveThread:!1,trackedChanges:{}}},apply(r,o,i,s){const a=r.getMeta(to)?.isReadyToInit;a&&(e=!0);const l=r.getMeta(bt),{type:c}=l||{};if(c==="force"&&(e=!0),!a&&!e&&l&&l.decorations)return{...o,decorations:l.decorations,allCommentPositions:l.allCommentPositions};const u=r.getMeta(ht),d=o.trackedChanges;u&&(o.trackedChanges=C5(u,d,s,t));const f=l?.type==="setActiveComment";if(!r.docChanged&&r.selectionSet||f){const{selection:p}=r;let h=S5(s.doc,p);if(f&&(h=l.activeThreadId),n!==h){n=h;const m={type:Aa.SELECTED,activeCommentId:n||null};e=!0,t.emit("commentsUpdate",m);const{tr:y}=t.view.state,{dispatch:g}=t.view;y.setMeta(bt,{type:"force"}),g(y)}}return o}},props:{decorations(r){return this.getState(r).decorations}},view(r){let o;return{update(i,s){const{state:a}=i,{doc:l,tr:c}=a;if(o&&!o.eq(l)&&(e=!0),!e)return;o=l,e=!1;const u=[],d={};l.descendants((p,h)=>{const{marks:m=[]}=p,y=m.filter(k=>k.type.name===nn);let g=!1;y.forEach(k=>{const{attrs:b}=k,T=b.commentId||b.importedId,M=i.coordsAtPos(h);py({allCommentPositions:d,threadId:T,pos:h,currentBounds:M,node:p});const _=b.internal;g||(g=n===T);let F=v5({activeThreadId:n,threadId:T,isInternal:_,editor:t});const C=ze.inline(h,h+p.nodeSize,{style:`background-color: ${F};`,"data-thread-id":T,class:"comment-highlight"});g&&n!==T||u.push(C)});const x=p2({doc:l,from:h,to:h+p.nodeSize});if(x){const k=i.coordsAtPos(h),{id:b}=x.mark.attrs;py({allCommentPositions:d,threadId:b,pos:h,currentBounds:k,node:p})}});const f=Le.create(l,u);if(!bt.getState(a).decorations.eq(f)){const p=a.tr.setMeta(bt,{decorations:f,allCommentPositions:d});i.dispatch(p)}t.emit("comment-positions",{allCommentPositions:d})}}}})]}}),py=({allCommentPositions:t,threadId:e,pos:n,currentBounds:r,node:o})=>{let i={};if(r instanceof DOMRect?i={top:r.top,bottom:r.bottom,left:r.left,right:r.right}:i={...r},!t[e])t[e]={threadId:e,start:n,end:n+o.nodeSize,bounds:i};else{const s=t[e];s.start=Math.min(s.start,n),s.end=Math.max(s.end,n+o.nodeSize),s.bounds.top=Math.min(s.bounds.top,r.top),s.bounds.bottom=Math.max(s.bounds.bottom,r.bottom)}},S5=(t,e)=>{if(!e)return;const{$from:n,$to:r}=e;if(n.pos!==r.pos||!t.nodeAt(n.pos))return;const o=p2({doc:t,from:n.pos,to:r.pos});if(o)return o.mark.attrs.id;const i=[];let s=!1;t.descendants((d,f)=>{if(s)return;const p=f+d.nodeSize;if(n.pos<f||n.pos>=p)return;const{marks:h=[]}=d;h.find(m=>m.type.name===nn)&&i.push({node:d,pos:f,size:d.nodeSize}),f>n.pos&&(s=!0)});let a=null,l=null;i.forEach(({pos:d,node:f})=>{a||(a=n.pos-d);const p=n.pos-d;p>=0&&p<=a&&(l=f,a=p)});const{marks:c=[]}=l||{},u=c.find(d=>d.type.name===nn);return u?.attrs?.commentId||u?.attrs?.importedId},p2=({doc:t,from:e,to:n,offset:r=1})=>{const o=Math.max(e-r,0),i=Math.min(n+r,t.content.size);let s;return t.nodesBetween(o,i,(a,l)=>{if(!a||a?.nodeSize===void 0)return;const c=a.marks.find(u=>lp.includes(u.type.name));c&&!s&&(s={from:l,to:l+a.nodeSize,mark:c})}),s},C5=(t,e,n,r)=>{const{insertedMark:o,deletionMark:i,formatMark:s,deletionNodes:a}=t;if(!o&&!i&&!s)return;const l={...e};let c=o?.attrs?.id||i?.attrs?.id||s?.attrs?.id;if(!c)return e;let u=!1;l[c]||(l[c]={},u=!0),o&&(l[c].insertion=c),i&&(l[c].deletion=i.attrs?.id),s&&(l[c].format=s.attrs?.id);const{step:d}=t;let f=d?.slice?.content?.content||[];f.length||n.doc.descendants((h,m)=>{if(h.marks.find(y=>y.type.name===vt))return f=[h],!1});const p=A5({documentId:r.options.documentId,event:u?"add":"update",marks:{insertedMark:o,deletionMark:i,formatMark:s},deletionNodes:a,nodes:f,newEditorState:n});return p&&r.emit("commentsUpdate",p),l},E5=({state:t,node:e,mark:n,marks:r,trackedChangeType:o,isDeletionInsertion:i,deletionNodes:s=[]})=>{let a="",l="";if(o===Ft&&(a=e?.text??""),o===vt&&(a=b5(n.attrs)),(o===ut||i)&&(l=e?.text??"",i)){let{id:c}=r.deletionMark.attrs;l=T5(t.doc,u=>{const{marks:d=[]}=u,f=d.filter(p=>lp.includes(p.type.name));if(!f.length)return!1;if(f.find(p=>p.attrs.id===c))return!0})?.node.text??""}return{deletionText:l,trackedChangeText:a}},A5=({event:t,marks:e,deletionNodes:n,nodes:r,newEditorState:o,documentId:i})=>{const s=e.insertedMark||e.deletionMark||e.formatMark,{type:a,attrs:l}=s,{name:c}=a,{author:u,authorEmail:d,date:f}=l,p=l.id,h=r[0],m=!!(e.insertedMark&&e.deletionMark);let y;o.doc.descendants((b,T)=>{const{marks:M=[]}=b,_=M.filter(F=>lp.includes(F.type.name));if(_.length&&(_.find(F=>F.attrs.id===p)&&(y=b),y))return!1});const{deletionText:g,trackedChangeText:x}=E5({state:o,node:y||h,mark:s,marks:e,trackedChangeType:c,isDeletionInsertion:m,deletionNodes:n});if(!g&&!x)return;const k={event:Aa.ADD,type:"trackedChange",documentId:i,changeId:p,trackedChangeType:m?"both":c,trackedChangeText:x,deletedText:e.deletionMark?g:null,author:u,authorEmail:d,date:f};return t==="add"?k.event=Aa.ADD:t==="update"&&(k.event=Aa.UPDATE),k};function T5(t,e){let n=null;return t.descendants((r,o)=>{if(e(r)&&(n={node:r,pos:o}),n)return!1}),n}const h2=({state:t,tr:e,step:n,newTr:r,map:o,doc:i,user:s,date:a,originalStep:l,originalStepIndex:c})=>{const u=t.schema.marks[ut],d=Nl(t,u,!1),f=d?d.to:n.to,p=new $t(f,f,n.slice,n.structure),h=l.invert(e.docs[c]).map(o);o.appendMap(h.getMap());const m={};if(p){const y=t.apply(r).tr;if(y.maybeStep(p).failed)return;const g=p.getMap().map(p.to),x=a2({tr:y,from:p.from,to:g,user:s,date:a}),k=new $t(p.from,p.to,y.doc.slice(p.from,g));r.step(k);const b=o.maps.length-1;o.appendMap(k.getMap(),b),p.from!==g&&(m.insertedMark=x,m.step=k),r.selection.eq(y.selection)||r.setSelection(y.selection)}if(n.from!==n.to){const{deletionMark:y,deletionMap:g,nodes:x}=l2({tr:r,from:n.from,to:n.to,user:s,date:a});m.deletionNodes=x,m.deletionMark=y,o.appendMapping(g)}r.setMeta(ht,m),r.setMeta(bt,{type:"force"})},$5=()=>{},O5=()=>{},m2=({state:t,tr:e,step:n,newTr:r,map:o,doc:i,user:s,date:a})=>{const l={};i.nodesBetween(n.from,n.to,(c,u)=>{if(!c.isInline)return;if(c.marks.find(p=>p.type.name===ut))return!1;const d=c.marks.find(p=>[ut,vt].includes(p.type.name)),f=d?d.attrs.id:go();if(r.addMark(Math.max(n.from,u),Math.min(n.to,u+c.nodeSize),n.mark),["bold","italic","strike","underline","textStyle"].includes(n.mark.type.name)&&!c.marks.find(p=>p.type===n.mark.type)){const p=c.marks.find(y=>y.type.name===vt);let h=[],m=[];if(p?p.attrs.before.find(y=>y.type==="textStyle"?y.type===n.mark.type.name&&Zo(y.attrs,n.mark.attrs):y.type===n.mark.type.name)?(m=[...p.attrs.before.filter(y=>y.type!==n.mark.type.name)],h=[...p.attrs.after]):(m=[...p.attrs.before],h=[...p.attrs.after,{type:n.mark.type.name,attrs:{...n.mark.attrs}}]):(m=c.marks.map(y=>({type:y.type.name,attrs:{...y.attrs}})),h=[{type:n.mark.type.name,attrs:{...n.mark.attrs}}]),h.length||m.length){const y=t.schema.marks[vt].create({id:f,author:s.name,authorEmail:s.email,date:a,before:m,after:h});r.addMark(n.from,n.to,y),l.formatMark=y,l.step=n,r.setMeta(ht,l),r.setMeta(bt,{type:"force"})}else p&&r.removeMark(Math.max(n.from,u),Math.min(n.to,u+c.nodeSize),p)}})},g2=({state:t,tr:e,step:n,newTr:r,map:o,doc:i,user:s,date:a})=>{const l={};i.nodesBetween(n.from,n.to,(c,u)=>{if(!c.isInline)return!0;if(c.marks.find(d=>d.type.name===ut))return!1;if(r.removeMark(Math.max(n.from,u),Math.min(n.to,u+c.nodeSize),n.mark),["bold","italic","strike","underline","textStyle"].includes(n.mark.type.name)&&c.marks.find(d=>d.type===n.mark.type)){const d=c.marks.find(h=>h.type.name===vt);let f=[],p=[];if(d?d.attrs.after.find(h=>h.type===n.mark.type.name)?(f=[...d.attrs.after.filter(h=>h.type!==n.mark.type.name)],p=[...d.attrs.before]):(f=[...d.attrs.after],p=[...d.attrs.before,{type:n.mark.type.name,attrs:{...n.mark.attrs}}]):(f=[],p=[{type:n.mark.type.name,attrs:{...n.mark.attrs}}]),f.length||p.length){const h=t.schema.marks[vt].create({id:go(),author:s.name,authorEmail:s.email,date:a,before:p,after:f});r.addMark(Math.max(n.from,u),Math.min(n.to,u+c.nodeSize),h),l.formatMark=h,l.step=n,r.setMeta(ht,l),r.setMeta(bt,{type:"force"})}else d&&r.removeMark(Math.max(n.from,u),Math.min(n.to,u+c.nodeSize),d)}})},y2=({tr:t,state:e,user:n})=>{const r=["inputType","uiEvent","paste","pointer"],o=["historyUndo","historyRedo","acceptReject"];if(!t.steps.length||t.meta&&!Object.keys(t.meta).every(c=>r.includes(c))||o.includes(t.getMeta("inputType"))||t.getMeta(bt))return t;const i=e.tr,s=new Jo,a=Math.floor(Date.now()/6e5)*6e5,l=new Date(a).toISOString();if(t.steps.forEach((c,u)=>{const d=c.map(s),{doc:f}=i;d&&(d instanceof $t?(h2({state:e,tr:t,step:d,newTr:i,map:s,doc:f,user:n,date:l,originalStep:c,originalStepIndex:u}),console.debug("[track-changes]: replaceStep")):d instanceof Ns?(m2({state:e,tr:t,step:d,newTr:i,map:s,doc:f,user:n,date:l}),console.debug("[track-changes]: addMarkStep")):d instanceof yn?(g2({state:e,tr:t,step:d,newTr:i,map:s,doc:f,user:n,date:l}),console.debug("[track-changes]: removeMarkStep")):(i.step(d),console.log("[track-changes]: otherStep")))}),t.getMeta("inputType")&&i.setMeta(t.getMeta("inputType")),t.getMeta("uiEvent")&&i.setMeta(t.getMeta("uiEvent")),t.selectionSet){const c=e.schema.marks[ut],u=Nl(e,c,!1);if(t.selection instanceof Pe&&(t.selection.from<e.selection.from||t.getMeta("inputType")==="deleteContentBackward")){const d=s.map(t.selection.from,-1);i.setSelection(new Pe(i.doc.resolve(d)))}else if(t.selection.from>e.selection.from&&u){const d=s.map(u.to+1,1);i.setSelection(new Pe(i.doc.resolve(d)))}else i.setSelection(t.selection.map(i.doc,s))}else if(e.selection.from-t.selection.from>1&&t.selection.$head.depth>1){const c=s.map(t.selection.from-2,-1);i.setSelection(new Pe(i.doc.resolve(c)))}return t.storedMarksSet&&i.setStoredMarks(t.storedMarks),t.scrolledIntoView&&i.scrollIntoView(),i},M5=t=>{const{state:e}=t,{dispatch:n}=t.view,{tr:r}=e;if(n)return e.doc.descendants((o,i)=>{if(o.type.name==="paragraph"){const{attrs:s}=o,{spacing:a}=s;if(!a)return;const l={line:Vo(ct(a.line)),lineSpaceBefore:Vo(ct(a.lineSpaceBefore)),lineSpaceAfter:Vo(ct(a.lineSpaceAfter))};r.setNodeMarkup(i,void 0,{...s,spacing:{...a,...l}})}}),n(r),!0},_5={initial:M5},hy=t=>{if(t==="initial"||t==="0.4.14")return Object.values(_5)};var jo,w2,qe,b2,v2,pu,x2,Id,Fd,hu,mu,Bd,Rd,gu,yu,wu,my,Pi,zi,gy,yy,k2,S2;const N5=class C2 extends MO{constructor(e){super(),Sr(this,qe),Sr(this,jo),Fe(this,"extensionService"),Fe(this,"extensionStorage",{}),Fe(this,"schema"),Fe(this,"view"),Fe(this,"isFocused",!1),Sr(this,w2),Fe(this,"options",{element:null,isHeadless:!1,mockDocument:null,mockWindow:null,content:"",user:null,users:[],media:{},mediaFiles:{},fonts:{},documentMode:"editing",mode:"docx",role:"editor",colors:[],converter:null,fileSource:null,initialState:null,documentId:null,extensions:[],editable:!0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,isCommentsEnabled:!1,isNewFile:!1,scale:1,annotations:!1,isInternal:!1,externalExtensions:[],numbering:{},onBeforeCreate:()=>null,onCreate:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:r})=>{throw r},onTrackedChangesUpdate:()=>null,onCommentsUpdate:()=>null,onCommentsLoaded:()=>null,onCommentClicked:()=>null,onCommentLocationsUpdate:()=>null,onDocumentLocked:()=>null,onFirstRender:()=>null,onCollaborationReady:()=>null,onPaginationUpdate:()=>null,onException:()=>null,handleImageUpload:null,telemetry:null}),e.element=e.isHeadless?null:e.element||document.createElement("div"),Ie(this,qe,x2).call(this,e),this.setOptions(e);let n={docx:()=>Ie(this,qe,b2).call(this,this.options),text:()=>Ie(this,qe,v2).call(this,this.options),default:()=>{console.log("Not implemented.")}};(n[this.options.mode]??n.default)()}setToolbar(e){this.toolbar=e}get state(){return this.view.state}get storage(){return this.extensionStorage}get commands(){return Kn(this,jo).commands}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get isDestroyed(){return this.view.isDestroyed}get element(){return this.options.element}get users(){return this.options.users}chain(){return Kn(this,jo).chain()}can(){return Kn(this,jo).can()}setDocumentMode(e){let n=e?.toLowerCase()||"editing";this.extensionService&&(this.options.role==="viewer"&&(n="viewing"),this.options.role==="suggester"&&n==="editing"&&(n="suggesting"),n==="viewing"?(this.commands.toggleTrackChangesShowOriginal(),this.setEditable(!1,!1)):n==="suggesting"?(Ie(this,qe,Fd).call(this,"TrackChangesBase"),this.commands.disableTrackChangesShowOriginal(),this.commands.enableTrackChanges(),this.setEditable(!0,!1)):n==="editing"&&(Ie(this,qe,Fd).call(this,"TrackChangesBase"),this.commands.disableTrackChangesShowOriginal(),this.commands.disableTrackChanges(),this.setEditable(!0,!1)))}initializeCollaborationData(){if(!this.options.isNewFile||!this.options.collaborationProvider)return;const{collaborationProvider:e}=this.options,n=()=>{e.off("synced",n),Ie(this,qe,Id).call(this)};e.synced?Ie(this,qe,Id).call(this):e.on("synced",n)}setOptions(e){this.options={...this.options,...e},this.options.isNewFile&&this.options.isCommentsEnabled&&(this.options.shouldLoadComments=!0),!(!this.view||!this.state||this.ifsDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(e,n=!0){this.setOptions({editable:e}),n&&this.emit("update",{editor:this,transaction:this.state.tr})}registerPlugin(e,n){const r=typeof n=="function"?n(e,[...this.state.plugins]):[...this.state.plugins,e],o=this.state.reconfigure({plugins:r});this.view.updateState(o)}unregisterPlugin(e){if(this.isDestroyed)return;const n=typeof e=="string"?`${e}$`:e.key,r=this.state.reconfigure({plugins:this.state.plugins.filter(o=>!o.key.startsWith(n))});this.view.updateState(r)}static async loadXmlData(e,n=!1){if(!e)return;const r=new cd,o=await r.getDocxData(e,n),i=r.media;return[o,i,r.mediaFiles,r.fonts]}static getDocumentVersion(e){return $r.getStoredSuperdocVersion(e)}static updateDocumentVersion(e,n){return $r.updateDocumentVersion(e,n)}createNodeViews(){this.view.setProps({nodeViews:this.extensionService.nodeViews})}getMaxContentSize(){if(!this.converter)return{};const{pageSize:e={},pageMargins:n={}}=this.converter.pageStyles??{},{width:r,height:o}=e,{top:i=0,bottom:s=0,left:a=0,right:l=0}=n;if(!r||!o)return{};const c=o*96-i*96-s*96-50;return{width:r*96-a*96-l*96-20,height:c}}initDefaultStyles(e=this.element){if(this.options.isHeadless)return;const n=e?.querySelector(".ProseMirror"),{pageSize:r,pageMargins:o}=this.converter.pageStyles??{};if(!n||!r||!o)return;e.style.width=r.width+"in",e.style.minWidth=r.width+"in",e.style.minHeight=r.height+"in",e.style.paddingLeft=o.left+"in",e.style.paddingRight=o.right+"in",e.style.boxSizing="border-box",n.style.outline="none",n.style.border="none";const{typeface:i,fontSizePt:s}=this.converter.getDocumentDefaultStyles()??{};i&&(e.style.fontFamily=i),s&&(e.style.fontSize=`${s}pt`),e.style.transformOrigin="top left",e.style.touchAction="auto",e.style.webkitOverflowScrolling="touch";const a=1.15;n.style.lineHeight=a,this.options.extensions.find(l=>l.name==="pagination")||(n.style.paddingTop="1in",n.style.paddingBottom="1in"),this.initMobileStyles(e)}initMobileStyles(e){if(!e)return;const n=e.offsetWidth,r=()=>{const i=n,s=document.documentElement.clientWidth-10;this.options.scale=Math.min(1,s/i);const a=e.closest(".super-editor"),l=e.closest(".super-editor-container");!a||!l||(this.options.scale<1?(a.style.maxWidth=`${i*this.options.scale}px`,l.style.minWidth="0px",e.style.transform=`scale(${this.options.scale})`):(a.style.maxWidth="",l.style.minWidth="",e.style.transform="none"))};r();const o=()=>{setTimeout(()=>{r()},150)};"orientation"in screen&&"addEventListener"in screen.orientation?screen.orientation.addEventListener("change",o):window.matchMedia("(orientation: portrait)").addEventListener("change",o),window.addEventListener("resize",()=>o)}getAttributes(e){return Oe.getAttributes(this.state,e)}isActive(e,n){const r=typeof e=="string"?e:null,o=typeof e=="string"?n:e;return s2(this.state,r,o)}getJSON(){return this.state.doc.toJSON()}getHTML(){const e=document.createElement("div"),n=di.fromSchema(this.schema).serializeFragment(this.state.doc.content);return e.appendChild(n),e.innerHTML}getPageStyles(){return this.converter?.pageStyles||{}}updatePageStyle({pageMargins:e}){if(!this.converter)return;let n=!1;if(e&&(this.converter.pageStyles.pageMargins=e,this.initDefaultStyles(),n=!0),n){const r=this.view.state.tr;r.setMeta("forceUpdatePagination",!0),this.view.dispatch(r)}}async exportDocx({isFinalDoc:e=!1,commentsType:n,comments:r=[]}={}){const o=Ie(this,qe,k2).call(this,r),i=await this.converter.exportToDocx(o,this.schema,this.storage.image.media,e,n,r),s=this.converter.schemaToXml(this.converter.convertedXml["docProps/custom.xml"].elements[0]),a=this.converter.schemaToXml(this.converter.convertedXml["word/styles.xml"].elements[0]),l=this.converter.schemaToXml(this.converter.convertedXml["word/settings.xml"].elements[0]),c=this.converter.schemaToXml(this.converter.convertedXml["word/_rels/document.xml.rels"].elements[0]),u=this.converter.addedMedia,d=this.converter.convertedXml["word/numbering.xml"],f=this.converter.schemaToXml(d.elements[0]),p={"word/document.xml":String(i),"docProps/custom.xml":String(s),"word/settings.xml":String(l),"word/_rels/document.xml.rels":String(c),"word/numbering.xml":String(f),"word/styles.xml":String(a).replace(/&/gi,"&amp;")};if(r.length){const m=this.converter.schemaToXml(this.converter.convertedXml["word/comments.xml"].elements[0]),y=this.converter.schemaToXml(this.converter.convertedXml["word/commentsExtended.xml"].elements[0]),g=this.converter.schemaToXml(this.converter.convertedXml["word/commentsExtensible.xml"].elements[0]),x=this.converter.schemaToXml(this.converter.convertedXml["word/commentsIds.xml"].elements[0]);p["word/comments.xml"]=String(m),p["word/commentsExtended.xml"]=String(y),p["word/commentsExtensible.xml"]=String(g),p["word/commentsIds.xml"]=String(x)}const h=await new cd().updateZip({docx:this.options.content,updatedDocs:p,originalDocxFile:this.options.fileSource,media:u,fonts:this.options.fonts,isHeadless:this.options.isHeadless});return this.options.telemetry?.trackUsage("document_export",{documentType:"docx",timestamp:new Date().toISOString()}),h}destroy(){this.emit("destroy"),this.view&&this.view.destroy(),Ie(this,qe,S2).call(this),this.removeAllListeners()}static checkIfMigrationsNeeded(e){e||(e="initial");const n=hy(e)||[];return console.debug("[checkVersionMigrations] Migrations needed:",e,n.length),n.length>0}processCollaborationMigrations(){if(console.debug("[checkVersionMigrations] Current editor version","0.9.25"),!this.options.ydoc)return;let e=this.options.ydoc.getMap("meta").get("version");e||(e="initial"),console.debug("[checkVersionMigrations] Document version",e);const n=hy(e)||[],r=this.state.plugins.find(i=>i.key.startsWith("y-sync"));if(!r)return this.options.ydoc;let o=!1;for(let i of n)if(console.debug("🏃‍♂️ Running migration",i.name),i(this))o=!0;else throw new Error("Migration failed at "+i.name);return o?(r?.getState(this.state)).doc:void 0}async replaceFile(e){const[n,r,o,i]=await C2.loadXmlData(e);this.setOptions({fileSource:e,content:n,media:r,mediaFiles:o,fonts:i,isNewFile:!0,shouldLoadComments:!0,replacedFile:!0}),Ie(this,qe,Bd).call(this),Ie(this,qe,Rd).call(this),this.initDefaultStyles(),this.initializeCollaborationData(!0),this.options.ydoc||(Ie(this,qe,zi).call(this),Ie(this,qe,Pi).call(this))}};jo=new WeakMap,w2=new WeakMap,qe=new WeakSet,b2=function(t){Ie(this,qe,hu).call(this),Ie(this,qe,mu).call(this),Ie(this,qe,gu).call(this),Ie(this,qe,Bd).call(this),Ie(this,qe,Rd).call(this),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("contentError",this.options.onContentError),this.on("exception",this.options.onException),Ie(this,qe,wu).call(this),this.initDefaultStyles(),this.setDocumentMode(t.documentMode),!this.options.isHeadless&&(this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",Ie(this,qe,pu)),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("trackedChangesUpdate",this.options.onTrackedChangesUpdate),this.on("commentsLoaded",this.options.onCommentsLoaded),this.on("commentClick",this.options.onCommentClicked),this.on("commentsUpdate",this.options.onCommentsUpdate),this.on("locked",this.options.onDocumentLocked),this.on("collaborationReady",Ie(this,qe,my)),this.on("paginationUpdate",this.options.onPaginationUpdate),this.on("comment-positions",this.options.onCommentLocationsUpdate),this.initializeCollaborationData(),this.options.ydoc||(Ie(this,qe,zi).call(this),Ie(this,qe,Pi).call(this)),window.setTimeout(()=>{this.isDestroyed||this.emit("create",{editor:this})},0))},v2=function(t){(!t.extensions||!t.extensions.length)&&(this.options.extensions=vp()),Ie(this,qe,hu).call(this),Ie(this,qe,mu).call(this),Ie(this,qe,gu).call(this),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("contentError",this.options.onContentError),Ie(this,qe,wu).call(this),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",Ie(this,qe,pu)),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("commentsLoaded",this.options.onCommentsLoaded),this.on("commentClick",this.options.onCommentClicked),this.on("locked",this.options.onDocumentLocked),window.setTimeout(()=>{this.isDestroyed||this.emit("create",{editor:this})},0)},pu=function({editor:t,event:e}){this.toolbar?.setActiveEditor(t),this.options.onFocus({editor:t,event:e})},x2=function(t){t.isHeadless&&(typeof navigator>"u"&&(Vr.navigator={isHeadless:!0}),t.mockDocument&&(Vr.document=t.mockDocument,Vr.window=t.mockWindow))},Id=function(){if(!this.options.isNewFile)return;this.options.isNewFile=!1;const t=Ie(this,qe,yu).call(this),e=this.state.tr.replaceWith(0,this.state.doc.content.size,t);this.view.dispatch(e),setTimeout(()=>{Ie(this,qe,zi).call(this),Ie(this,qe,Pi).call(this)},50)},Fd=function(t){const e=this.extensionService?.plugins.find(r=>r.key.startsWith(t)),n=this.state.plugins.find(r=>r.key.startsWith(t));return e&&!n&&this.registerPlugin(e),e?.key},hu=function(){const t=["extension","node","mark"],e=[c5,o5,u5,l5],n=this.options.externalExtensions||[],r=[...e,...this.options.extensions].filter(o=>t.includes(o?.type));this.extensionService=GO.create(r,n,this)},mu=function(){Dv(this,jo,j1.create({editor:this}))},Bd=function(){this.options.converter?this.converter=this.options.converter:this.converter=new $r({docx:this.options.content,media:this.options.mediaFiles,debug:!0,telemetry:this.options.telemetry,fileSource:this.options.fileSource,documentId:this.options.documentId})},Rd=function(){if(!this.options.ydoc)return this.storage.image.media=this.options.mediaFiles;const t=this.options.ydoc.getMap("media");this.options.isNewFile?(Object.entries(this.options.mediaFiles).forEach(([e,n])=>{t.set(e,n)}),this.storage.image.media=this.options.mediaFiles):this.storage.image.media=Object.fromEntries(t.entries())},gu=function(){this.schema=this.extensionService.schema},yu=function(){let t;try{const{mode:e,fragment:n,isHeadless:r,content:o,loadFromSchema:i}=this.options;if(e==="docx")t=i2(this.converter,this.schema,this),t=Ie(this,qe,yy).call(this,t),n&&r&&(t=bO(n,this.schema));else if(e==="text")if(o){let s=o;if(typeof o=="string"){const a=document.createElement("div");a.innerHTML=o,s=a,a.remove()}t=i?this.schema.nodeFromJSON(s):Zr.fromSchema(this.schema).parse(s)}else t=this.schema.topNodeType.createAndFill()}catch(e){console.error(e),this.emit("contentError",{editor:this,error:e})}return t},wu=function(){let t=Ie(this,qe,yu).call(this);const e={schema:this.schema};this.options.ydoc||(e.doc=t),this.view=new C1(this.options.element,{...this.options.editorProps,dispatchTransaction:Ie(this,qe,gy).bind(this),state:Hi.create(e)});const n=this.state.reconfigure({plugins:this.extensionService.plugins});this.view.updateState(n),this.createNodeViews();const r=this.view.dom;r.editor=this,this.options.telemetry?.sendReport()},my=function({editor:t,ydoc:e}){this.options.collaborationIsReady||(console.debug("🔗 [super-editor] Collaboration ready"),this.options.onCollaborationReady({editor:t,ydoc:e}),this.options.collaborationIsReady=!0,this.options.isNewFile||(Ie(this,qe,zi).call(this),Ie(this,qe,Pi).call(this)))},Pi=function(){if(!this.options.isCommentsEnabled||this.options.isHeadless||!this.options.shouldLoadComments)return;const t=this.options.replacedFile;this.emit("commentsLoaded",{editor:this,replacedFile:t,comments:this.converter.comments||[]}),setTimeout(()=>{this.options.replacedFile=!1;const{state:e,dispatch:n}=this.view,r=e.tr.setMeta(bt,{type:"force"});n(r)},50)},zi=async function(){if(!(this.options.isHeadless||!this.extensionService)&&this.options.extensions.find(t=>t.name==="pagination")&&this.options.pagination){console.debug("🔗 [super-editor] Initializing pagination");const t=await x5(this);this.storage.pagination.sectionData=t;const{state:e,dispatch:n}=this.view,r=e.tr.setMeta(to,{isReadyToInit:!0});n(r)}},gy=function(t){if(this.view.isDestroyed)return;let e;try{const i=ht.getState(this.view.state)?.isTrackChangesActive??!1?y2({tr:t,state:this.state,user:this.options.user}):t,{state:s}=this.view.state.applyTransaction(i);e=s}catch(i){e=this.state.apply(t),console.log(i)}const n=!this.state.selection.eq(e.selection);this.view.updateState(e),this.emit("transaction",{editor:this,transaction:t}),n&&this.emit("selectionUpdate",{editor:this,transaction:t});const r=t.getMeta("focus");r&&this.emit("focus",{editor:this,event:r.event,transaction:t});const o=t.getMeta("blur");o&&this.emit("blur",{editor:this,event:o.event,transaction:t}),t.docChanged&&this.emit("update",{editor:this,transaction:t})},yy=function(t){const e=Hi.create({schema:this.schema,doc:t}),{tr:n,doc:r}=e;return w5(r,n,this.schema,this.converter),e.apply(n).doc},k2=function(t=[]){const e=Hi.create({schema:this.schema,doc:this.state.doc,plugins:this.state.plugins}),{tr:n,doc:r}=e;return y5(r,n,this.schema,t),e.apply(n).doc.toJSON()},S2=function(){if(this.options.ydoc)try{console.debug("🔗 [super-editor] Ending collaboration"),this.options.collaborationProvider&&this.options.collaborationProvider.disconnect(),this.options.ydoc&&this.options.ydoc.destroy()}catch{}};let ws=N5;class Ye{constructor(e){Fe(this,"type","node"),Fe(this,"name","node"),Fe(this,"options"),Fe(this,"storage"),Fe(this,"config",{name:this.name}),this.config={...this.config,...e},this.name=this.config.name,this.config.addOptions&&(this.options=He(_e(this,"addOptions",{name:this.name}))),this.storage=He(_e(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(...e){return new Ye(...e)}}let bn=class E2{constructor(e){Fe(this,"type","mark"),Fe(this,"name","mark"),Fe(this,"options"),Fe(this,"storage"),Fe(this,"config",{name:this.name}),this.config={...this.config,...e},this.name=this.config.name,this.config.addOptions&&(this.options=He(_e(this,"addOptions",{name:this.name}))),this.storage=He(_e(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(...e){return new E2(...e)}};const D5=/[\d-.]+(\w+)$/,I5=["px","rem","em","in","q","mm","cm","pt","pc","vh","vw","vmin","vmax"];function nr(t="0"){const e=t||"0",n=Number.parseFloat(e),r=(e.match(D5)?.[1]??"").toLowerCase();return[n,I5.includes(r)?r:null]}const A2=ot.create({name:"color",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{color:{default:null,parseDOM:t=>t.style.color?.replace(/['"]+/g,""),renderDOM:t=>t.color?{style:`color: ${t.color}`}:{}}}}]},addCommands(){return{setColor:t=>({chain:e})=>e().setMark("textStyle",{color:t}).run(),unsetColor:()=>({chain:t})=>t().setMark("textStyle",{color:null}).removeEmptyTextStyle().run()}}}),T2=ot.create({name:"fontFamily",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontFamily:{default:null,parseDOM:t=>t.style.fontFamily?.replace(/['"]+/g,""),renderDOM:t=>t.fontFamily?{style:`font-family: ${t.fontFamily}`}:{}}}}]},addCommands(){return{setFontFamily:t=>({chain:e})=>e().setMark("textStyle",{fontFamily:t}).run(),unsetFontFamily:()=>({chain:t})=>t().setMark("textStyle",{fontFamily:null}).removeEmptyTextStyle().run()}}}),$2=ot.create({name:"fontSize",addOptions(){return{types:["textStyle","tableCell"],defaults:{value:12,unit:"pt",min:8,max:96}}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontSize:{default:null,parseDOM:t=>t.style.fontSize,renderDOM:t=>{if(!t.fontSize)return{};let[e,n]=nr(t.fontSize);return Number.isNaN(e)?{}:(n=n||this.options.defaults.unit,{style:`font-size: ${e}${n}`})}}}}]},addCommands(){return{setFontSize:t=>({chain:e})=>{let[n,r]=nr(t);if(Number.isNaN(n))return!1;let{min:o,max:i,unit:s}=this.options.defaults;return n=cl(n,o,i),r=r||s,e().setMark("textStyle",{fontSize:`${n}${r}`}).run()},unsetFontSize:()=>({chain:t})=>t().setMark("textStyle",{fontSize:null}).removeEmptyTextStyle().run()}}}),O2=ot.create({name:"textAlign",addOptions(){return{types:["heading","paragraph"],alignments:["left","center","right","justify"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseDOM:t=>{const e=t.style.textAlign||this.options.defaultAlignment;return this.options.alignments.includes(e)?e:this.options.defaultAlignment},renderDOM:t=>t.textAlign===this.options.defaultAlignment?{}:{style:`text-align: ${t.textAlign==="both"?"justify":t.textAlign}`}}}}]},addCommands(){return{setTextAlign:t=>({commands:e})=>this.options.alignments.includes(t)?this.options.types.map(n=>e.updateAttributes(n,{textAlign:t})).every(n=>n):!1,unsetTextAlign:()=>({commands:t})=>this.options.types.map(e=>t.resetAttributes(e,"textAlign")).every(e=>e)}},addShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign("left"),"Mod-Shift-e":()=>this.editor.commands.setTextAlign("center"),"Mod-Shift-r":()=>this.editor.commands.setTextAlign("right"),"Mod-Shift-j":()=>this.editor.commands.setTextAlign("justify")}}}),M2=ot.create({name:"textIndent",addOptions(){return{types:["heading","paragraph"],defaults:{unit:"in",increment:.125}}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textIndent:{default:null,parseDOM:t=>t.style.textIndent,renderDOM:t=>{if(!t.textIndent)return{};let[e,n]=nr(t.textIndent);return Number.isNaN(e)||!e?{}:(n=n||this.options.defaults.unit,{style:`margin-left: ${e}${n}`})}}}}]},addCommands(){return{setTextIndent:t=>({commands:e})=>t?this.options.types.map(n=>e.updateAttributes(n,{textIndent:t})).every(n=>n):!1,unsetTextIndent:()=>({commands:t})=>this.options.types.map(e=>t.resetAttributes(e,"textIndent")).every(e=>e),increaseTextIndent:()=>({commands:t})=>this.options.types.map(e=>{let{textIndent:n}=this.editor.getAttributes(e);if(!n){let{increment:i,unit:s}=this.options.defaults;return t.updateAttributes(e,{textIndent:`${i}${s}`})}let[r,o]=nr(n);return r=r+this.options.defaults.increment,o=o||this.options.defaults.unit,Number.isNaN(r)?!1:t.updateAttributes(e,{textIndent:`${r}${o}`})}).every(e=>e),decreaseTextIndent:()=>({commands:t})=>this.options.types.map(e=>{let{textIndent:n}=this.editor.getAttributes(e);if(!n)return!1;let[r,o]=nr(n);return r=r-this.options.defaults.increment,o=o||this.options.defaults.unit,Number.isNaN(r)?!1:r<=0?t.unsetTextIndent():t.updateAttributes(e,{textIndent:`${r}${o}`})}).every(e=>e)}}}),_2=ot.create({name:"lineHeight",addOptions(){return{types:["heading","paragraph"],defaults:{unit:""}}},addGlobalAttributes(){return[{types:this.options.types,attributes:{lineHeight:{default:null,parseDOM:t=>t.style.lineHeight,renderDOM:t=>{if(!t.lineHeight)return{};let[e,n]=nr(t.lineHeight);return Number.isNaN(e)?{}:(n=n||this.options.defaults.unit,{style:`line-height: ${e}${n}`})}}}}]},addCommands(){return{setLineHeight:t=>({commands:e})=>t?this.options.types.map(n=>e.updateAttributes(n,{lineHeight:t})).every(n=>n):!1,unsetLineHeight:()=>({commands:t})=>this.options.types.map(e=>t.resetAttributes(e,"lineHeight")).every(e=>e)}}}),N2=ot.create({name:"formatCommands",addOptions(){return{}},addStorage(){return{storedStyle:null}},addCommands(){return{clearFormat:()=>({chain:t})=>t().clearNodes().unsetAllMarks().run(),clearMarksFormat:()=>({chain:t})=>t().unsetAllMarks().run(),clearNodesFormat:()=>({chain:t})=>t().clearNodes().run(),copyFormat:()=>({chain:t})=>{if(!this.storage.storedStyle){const i=Is(this.editor.state);return this.storage.storedStyle=i,!0}if(!this.storage.storedStyle.length)return this.storage.storedStyle=null,t().clearFormat().run();const e=this.storage.storedStyle,n=[];e.forEach(i=>{const{type:s,attrs:a}=i,{name:l}=s;l==="textStyle"?Object.keys(a).forEach(c=>{if(!a[c])return;const u={};u[c]=a[c],n.push({name:c,attrs:u})}):n.push({name:l,attrs:a})});const r={bold:["setBold","unsetBold"],italic:["setItalic","unsetItalic"],underline:["setUnderline","unsetUnderline"],color:["setColor","setColor",null],fontSize:["setFontSize","unsetFontSize"],fontFamily:["setFontFamily","unsetFontFamily"]};let o=t();return Object.keys(r).forEach(i=>{const[s,a,l]=r[i],c=n.find(f=>f.name===i),u=c?.attrs&&c?.attrs[i];let d={};!c&&!u?d={command:a,argument:l}:d={command:s,argument:c.attrs[i]||l},o=o[d.command](d.argument)}),this.storage.storedStyle=null,o}}},addShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.clearFormat()}}});function F5(t={}){return new Qe({view(e){return new B5(e,t)}})}class B5{constructor(e,n){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=n.width)!==null&&r!==void 0?r:1,this.color=n.color===!1?void 0:n.color||"black",this.class=n.class,this.handlers=["dragover","dragend","drop","dragleave"].map(o=>{let i=s=>{this[o](s)};return e.dom.addEventListener(o,i),{name:o,handler:i}})}destroy(){this.handlers.forEach(({name:e,handler:n})=>this.editorView.dom.removeEventListener(e,n))}update(e,n){this.cursorPos!=null&&n.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),n=!e.parent.inlineContent,r;if(n){let a=e.nodeBefore,l=e.nodeAfter;if(a||l){let c=this.editorView.nodeDOM(this.cursorPos-(a?a.nodeSize:0));if(c){let u=c.getBoundingClientRect(),d=a?u.bottom:u.top;a&&l&&(d=(d+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2),r={left:u.left,right:u.right,top:d-this.width/2,bottom:d+this.width/2}}}}if(!r){let a=this.editorView.coordsAtPos(this.cursorPos);r={left:a.left-this.width/2,right:a.left+this.width/2,top:a.top,bottom:a.bottom}}let o=this.editorView.dom.offsetParent;this.element||(this.element=o.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n);let i,s;if(!o||o==document.body&&getComputedStyle(o).position=="static")i=-pageXOffset,s=-pageYOffset;else{let a=o.getBoundingClientRect();i=a.left-o.scrollLeft,s=a.top-o.scrollTop}this.element.style.left=r.left-i+"px",this.element.style.top=r.top-s+"px",this.element.style.width=r.right-r.left+"px",this.element.style.height=r.bottom-r.top+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let n=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),o=r&&r.type.spec.disableDropCursor,i=typeof o=="function"?o(this.editorView,n,e):o;if(n&&!i){let s=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let a=qb(this.editorView.state.doc,s,this.editorView.dragging.slice);a!=null&&(s=a)}this.setCursor(s),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){(e.target==this.editorView.dom||!this.editorView.dom.contains(e.relatedTarget))&&this.setCursor(null)}}const D2=ot.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:2,class:void 0}},addPmPlugins(){return[F5(this.options)]}});class at extends Re{constructor(e){super(e,e)}map(e,n){let r=e.resolve(n.map(this.head));return at.valid(r)?new at(r):Re.near(r)}content(){return ve.empty}eq(e){return e instanceof at&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new at(e.resolve(n.pos))}getBookmark(){return new cp(this.anchor)}static valid(e){let n=e.parent;if(n.isTextblock||!R5(e)||!L5(e))return!1;let r=n.type.spec.allowGapCursor;if(r!=null)return r;let o=n.contentMatchAt(e.index()).defaultType;return o&&o.isTextblock}static findGapCursorFrom(e,n,r=!1){e:for(;;){if(!r&&at.valid(e))return e;let o=e.pos,i=null;for(let s=e.depth;;s--){let a=e.node(s);if(n>0?e.indexAfter(s)<a.childCount:e.index(s)>0){i=a.child(n>0?e.indexAfter(s):e.index(s)-1);break}else if(s==0)return null;o+=n;let l=e.doc.resolve(o);if(at.valid(l))return l}for(;;){let s=n>0?i.firstChild:i.lastChild;if(!s){if(i.isAtom&&!i.isText&&!De.isSelectable(i)){e=e.doc.resolve(o+i.nodeSize*n),r=!1;continue e}break}i=s,o+=n;let a=e.doc.resolve(o);if(at.valid(a))return a}return null}}}at.prototype.visible=!1;at.findFrom=at.findGapCursorFrom;Re.jsonID("gapcursor",at);class cp{constructor(e){this.pos=e}map(e){return new cp(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return at.valid(n)?new at(n):Re.near(n)}}function R5(t){for(let e=t.depth;e>=0;e--){let n=t.index(e),r=t.node(e);if(n==0){if(r.type.spec.isolating)return!0;continue}for(let o=r.child(n-1);;o=o.lastChild){if(o.childCount==0&&!o.inlineContent||o.isAtom||o.type.spec.isolating)return!0;if(o.inlineContent)return!1}}return!0}function L5(t){for(let e=t.depth;e>=0;e--){let n=t.indexAfter(e),r=t.node(e);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let o=r.child(n);;o=o.firstChild){if(o.childCount==0&&!o.inlineContent||o.isAtom||o.type.spec.isolating)return!0;if(o.inlineContent)return!1}}return!0}function P5(){return new Qe({props:{decorations:U5,createSelectionBetween(t,e,n){return e.pos==n.pos&&at.valid(n)?new at(n):null},handleClick:j5,handleKeyDown:z5,handleDOMEvents:{beforeinput:q5}}})}const z5=Yf({ArrowLeft:Qs("horiz",-1),ArrowRight:Qs("horiz",1),ArrowUp:Qs("vert",-1),ArrowDown:Qs("vert",1)});function Qs(t,e){const n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,o,i){let s=r.selection,a=e>0?s.$to:s.$from,l=s.empty;if(s instanceof Pe){if(!i.endOfTextblock(n)||a.depth==0)return!1;l=!1,a=r.doc.resolve(e>0?a.after():a.before())}let c=at.findGapCursorFrom(a,e,l);return c?(o&&o(r.tr.setSelection(new at(c))),!0):!1}}function j5(t,e,n){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!at.valid(r))return!1;let o=t.posAtCoords({left:n.clientX,top:n.clientY});return o&&o.inside>-1&&De.isSelectable(t.state.doc.nodeAt(o.inside))?!1:(t.dispatch(t.state.tr.setSelection(new at(r))),!0)}function q5(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof at))return!1;let{$from:n}=t.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(t.state.schema.nodes.text);if(!r)return!1;let o=ye.empty;for(let s=r.length-1;s>=0;s--)o=ye.from(r[s].createAndFill(null,o));let i=t.state.tr.replace(n.pos,n.pos,new ve(o,0,0));return i.setSelection(Pe.near(i.doc.resolve(n.pos+1))),t.dispatch(i),!1}function U5(t){if(!(t.selection instanceof at))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",Le.create(t.doc,[ze.widget(t.selection.head,e,{key:"gapcursor"})])}const V5=ot.create({name:"gapCursor",addPmPlugins(){return[P5()]},extendNodeSchema(t){return{allowGapCursor:He(_e(t,"allowGapCursor",{name:t.name,options:t.options,storage:t.storage}))??null}}}),H5=new tt("collaboration"),W5=ot.create({name:"collaboration",priority:1e3,addOptions(){return{ydoc:null,field:"supereditor",fragment:null,isReady:!1}},addPmPlugins(){if(!this.editor.options.ydoc)return[];this.options.ydoc=this.editor.options.ydoc;const t=K5();J5(this.options.ydoc,this.editor),X5(this.options.ydoc,this.editor,this);const[e,n]=G5(this.options.ydoc,this.editor);this.options.fragment=n;const r=this.options.ydoc.getMap("media");return r.observe(o=>{o.changes.keys.forEach((i,s)=>{if(!(s in this.editor.storage.image.media)){const a=r.get(s);this.editor.storage.image.media[s]=a}})}),[e,t]},addCommands(){return{undo:()=>({tr:t,state:e,dispatch:n})=>(t.setMeta("preventDispatch",!0),t.setMeta("inputType","historyUndo"),Tr.getState(e).undoManager.undoStack.length===0?!1:n?EO(e):!0),redo:()=>({tr:t,state:e,dispatch:n})=>(t.setMeta("preventDispatch",!0),t.setMeta("inputType","historyRedo"),Tr.getState(e).undoManager.redoStack.length===0?!1:n?AO(e):!0),addImageToCollaboration:({mediaPath:t,fileData:e})=>()=>{this.options.ydoc&&this.options.ydoc.getMap("media").set(t,e)}}},addShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Mod-Shift-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo()}}}),G5=(t,e)=>{const n=t.getXmlFragment("supereditor");return[iO(n,{onFirstRender:()=>{if(!e.options.isNewFile)return;const r=t.getMap("meta");r.set("docx",e.options.content),r.set("fonts",e.options.fonts)}}),n]},K5=()=>OO(),J5=(t,e)=>{const n=t.getMap("meta");n.observe(r=>{const o=n.get("lockedBy"),i=n.get("locked");if(!e.options.user||!o)return;const s=o?.email!==e.options.user?.email,a=e.options.editable!==!i;!s||!a||(i?console.debug("--- Locking editor ---",o,e.options.user):console.debug("--- Unlocking editor ---",o),e.setEditable(!i),e.emit("locked",{editor:e,isLocked:i,lockedBy:o}))})},X5=(t,e,n)=>{const r=e.options.collaborationProvider;if(!r)return;const o=()=>{n.options.isReady=!0,r.off("synced",o),e.emit("collaborationReady",{editor:e,ydoc:t})};if(r.synced){setTimeout(()=>{o()},250);return}r.on("synced",o)},Y5=ot.create({name:"collaborationCursor",priority:999,addOptions(){return{provider:null,user:{name:null,color:null}}},addStorage(){return{users:[]}},addPmPlugins(){const{collaborationProvider:t=null}=this.editor.options;return t?[CO(t.awareness,{cursorBuilder:Z5})]:[]}}),Z5=t=>{const e=document.createElement("span");e.classList.add("ProseMirror-yjs-cursor"),e.setAttribute("style",`border-color: ${t.color}`);const n=document.createElement("div");return n.setAttribute("style",`background-color: ${t.color}`),n.insertBefore(document.createTextNode(t.name||t.email),null),e.insertBefore(n,null),e},I2=Ye.create({name:"doc",topNode:!0,content:"block+",parseDOM(){return[{tag:"doc"}]},renderDOM(){return["doc",0]},addAttributes(){return{attributes:{rendered:!1}}}}),F2=Ye.create({name:"text",group:"inline",inline:!0}),Q5=Ye.create({name:"run",group:"inline",content:"text*",inline:!0,parseDOM(){return[{tag:"run"}]},renderDOM(){return["run",0]},addAttributes(){return{attributes:{rendered:!1}}}});function ul(t){return new UO({match:t.match,handler:({state:e,range:n,match:r,chain:o})=>{const i=He(t.getAttributes,null,r)||{},s=e.tr.delete(n.from,n.to),a=s.doc.resolve(n.from).blockRange(),l=a&&Rb(a,t.type,i);if(!l)return null;if(s.wrap(a,l),t.keepMarks&&t.editor){const{selection:u,storedMarks:d}=e,{splittableMarks:f}=t.editor.extensionService,p=d||u.$to.parentOffset&&u.$from.marks();if(p){const h=p.filter(m=>f.includes(m.type.name));s.ensureMarks(h)}}if(t.keepAttributes){const u=t.type.name==="bulletList"||t.type.name==="orderedList"?"listItem":t.type.name;o().updateAttributes(u,i).run()}const c=s.doc.resolve(n.from-1).nodeBefore;c&&c.type===t.type&&Dr(s.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(r,c))&&s.join(n.from-1)}})}const wy=/^\s*([-+*])\s$/,B2=Ye.create({name:"bulletList",group:"block list",content(){return`${this.options.itemTypeName}+`},addOptions(){return{itemTypeName:"listItem",htmlAttributes:{},keepMarks:!0,keepAttributes:!1}},parseDOM(){return[{tag:"ul"}]},renderDOM({htmlAttributes:t}){return["ul",Oe.mergeAttributes(this.options.htmlAttributes,t),0]},addAttributes(){return{"list-style-type":{default:"bullet",rendered:!1},listId:{rendered:!1},attributes:{rendered:!1,keepOnSplit:!0}}},addCommands(){return{toggleBulletList:()=>t=>{const{commands:e,chain:n}=t;return e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}}},addShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=ul({match:wy,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=ul({match:wy,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes("textStyle"),editor:this.editor})),[t]}});function e_(t={}){return new Qe({key:new tt("orderedListSync"),appendTransaction:(e,n,r)=>{if(!(e.some(l=>l.docChanged)&&!n.doc.eq(r.doc)))return;let{doc:o,tr:i}=r,s={};if(o.descendants((l,c)=>{if(l.type.name==="orderedList"&&l.attrs.syncId){let u=l.attrs.syncId;s[u]||(s[u]=[]),s[u].push({node:l,pos:c})}}),!Object.keys(s).length)return;let a=!1;return Object.entries(s).forEach(([l,c])=>{if(c.length<1){let[f]=c;i.setNodeMarkup(f.pos,void 0,{...f.node.attrs,syncId:null}),a=!0;return}let[u]=c,d=u.node.attrs.order;c.forEach((f,p)=>{if(p===0)return;let{node:h,pos:m}=f,y=c[p-1],g=d+y.node.childCount;h.attrs.order!==g&&(i.setNodeMarkup(m,void 0,{...h.attrs,order:g}),a=!0),d=g})}),a?i:null}})}function t_(){return Math.floor(Math.random()*4294967295).toString()}function n_(t){return new Qe({key:new tt("orderedListMarker"),appendTransaction:(e,n,r)=>{if(!(e.some(l=>l.docChanged)&&!n.doc.eq(r.doc)))return;let{doc:o,tr:i}=r,s=r_(r);if(!s.size)return;let a=!1;return Array.from(s).forEach(([l,c])=>{const u=c[0];let d=c,f=u.node.type.name==="bulletList";u.node.attrs.syncId;let p=u.node.childCount!==d.length;if(f){d.forEach(x=>i_(i,x)),a=!0;return}if(p){let x=o_({state:r,list:u});x.length&&(d=x)}let h=d[0],m=s_({state:r,listItems:d}),y=R2(),g={lvlText:h.node.attrs.lvlText??y.lvlText,listLevel:h.node.attrs.listLevel??y.listLevel,listNumberingType:h.node.attrs.listNumberingType??y.listNumberingType};g.lvlText===m.lvlText&&g.listNumberingType===m.listNumberingType&&by(g.listLevel,m.listLevel)||(i.setNodeMarkup(h.pos,void 0,{...h.node.attrs,...m}),a=!0,g=m),d.forEach((x,k)=>{if(k===0)return;let{node:b,pos:T}=x,{lvlText:M,listLevel:_,listNumberingType:F}=b.attrs;Array.isArray(g.listLevel)||(g.listLevel=JSON.parse(g.listLevel));let C=[...g.listLevel.slice(0,-1),g.listLevel.at(-1)+1];if(!(M===g.lvlText&&F===g.listNumberingType&&by(_,C))){let{selection:V,storedMarks:ie}=r,I=ie||V.$to.parentOffset&&V.$from.marks();i.setNodeMarkup(T,void 0,{...b.attrs,listLevel:C,lvlText:g.lvlText,listNumberingType:g.listNumberingType}),I&&i.ensureMarks(I),a=!0}g={...g,listLevel:C}})}),i.setMeta("orderedListMarker",!0),a?i:null}})}function r_(t){let{doc:e}=t,n=new Map;return e.descendants((r,o)=>{let{attrs:i}=r,s=r.type.name==="listItem",a=!!i.listLevel?.length,l=!!i.lvlText,c=i.listNumberingType&&i.listNumberingType!=="bullet";if(s&&a&&l&&c){const u=`${e.resolve(o).parent.attrs.listId}, ${r.attrs.listLevel.slice(0,-1)}`;n.get(u)||n.set(u,[]),n.get(u).push({node:r,pos:o})}}),n}function o_({state:t,list:e}){let{doc:n}=t,r=[];return n.descendants((o,i)=>{let s=o.type.name==="listItem",a=n.resolve(i);s&&a.parent===e&&r.push({node:o,pos:i})}),r}function R2({lvlText:t="",listLevel:e=[],listNumberingType:n="decimal"}={}){return{lvlText:t,listLevel:e,listNumberingType:n}}function i_(t,e){let{pos:n,node:r}=e;t.setNodeMarkup(n,void 0,{...r.attrs,lvlText:null,listLevel:null,listNumberingType:null})}function by(t,e){return t.length===e.length&&t.every((n,r)=>n===e[r])}function s_({state:t,listItems:e}){let{doc:n}=t,r=e[0],{lvlText:o,listLevel:i,listNumberingType:s}=r.node.attrs,a=R2({lvlText:"%1.",listLevel:[1],listNumberingType:"decimal"}),l=(n.resolve(r.pos).depth-1)/2;if(!(o&&i?.length&&s))({lvlText:o,listLevel:i,listNumberingType:s}=a);else{let c=l>0;c&&l>=3?{lvlText:o,listLevel:i,listNumberingType:s}=a:c&&l<3&&(i=[...i.slice(0,-1),1])}return{lvlText:o,listLevel:i,listNumberingType:s}}const vy=/^(\d+)\.\s$/,L2=Ye.create({name:"orderedList",group:"block list",content(){return`${this.options.itemTypeName}+`},addOptions(){return{itemTypeName:"listItem",htmlAttributes:{},keepMarks:!0,keepAttributes:!1,listStyleTypes:["decimal","lowerAlpha","lowerRoman"]}},addAttributes(){return{order:{default:1,parseDOM:t=>t.hasAttribute("start")?parseInt(t.getAttribute("start")||"",10):1,renderDOM:t=>({start:t.order})},syncId:{default:null,parseDOM:t=>t.getAttribute("data-sync-id"),renderDOM:t=>t.syncId?{"data-sync-id":t.syncId}:{}},listId:{default:null,render:!1},"list-style-type":{default:"decimal",renderDOM:t=>{let e=t["list-style-type"];return e?(e==="lowerLetter"&&(e="lowerAlpha"),{style:`list-style-type: ${CE(e)};`}):{}}},attributes:{rendered:!1,keepOnSplit:!0}}},parseDOM(){return[{tag:"ol"}]},renderDOM({htmlAttributes:t}){const{start:e,...n}=t;return e===1?["ol",Oe.mergeAttributes(this.options.htmlAttributes,n),0]:["ol",Oe.mergeAttributes(this.options.htmlAttributes,t),0]},addCommands(){return{toggleOrderedList:()=>({commands:t})=>t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks),getCurrentList:()=>({state:t})=>Kt(e=>e.type.name===this.name)(t.selection),restartListNodes:(t,e)=>({tr:n,state:r})=>{let o=e;return t.map(i=>{const s={node:i,pos:o};return o+=i.nodeSize,s}).forEach(i=>{const{pos:s}=i,a=n.mapping.map(s);n.setNodeMarkup(a,void 0,{})}),!0},updateOrderedListStyleType:()=>({dispatch:t,state:e,tr:n})=>{let r=Kt(o=>o.type.name===this.name)(n.selection);if(!r)return!0;if(t){let o=(r.depth-1)/2,i=this.options.listStyleTypes,s=i[o%i.length],a=r.node.attrs["list-style-type"],l=n.doc.nodeAt(r.pos);a!==s&&l.eq(r.node)&&n.setNodeMarkup(r.pos,void 0,{...r.node.attrs,"list-style-type":s})}return!0},liftEmptyBlockAndContinueListOrder:()=>({editor:t,dispatch:e,state:n,tr:r,commands:o})=>{let i=Kt(d=>d.type.name===this.name)(n.selection);if(!i)return!1;let s=t.can().liftEmptyBlock(),a=i.depth===1,l=i.node.childCount===1,c=n.selection.$from.node(-1),u=i.node.lastChild.eq(c);if(!(s&&a&&!l&&!u))return!1;if(e){let d=i.pos;if(!o.liftEmptyBlock(n,e))return!1;let{$from:f}=r.selection,p=r.doc.nodeAt(d),h=f.after(),m=r.doc.nodeAt(h),y=p?.type.name===this.name,g=m?.type.name===this.name;if(y&&g){let x=p.attrs.order||1,k=p.childCount,b=p.attrs.syncId,T=k+x,M=b||t_();r.setNodeMarkup(h,void 0,{...m.attrs,order:T,syncId:M}),b||r.setNodeMarkup(d,void 0,{...p.attrs,syncId:M})}}return!0}}},addShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList(),Enter:()=>this.editor.commands.liftEmptyBlockAndContinueListOrder()}},addPmPlugins(){return[n_(this.editor),e_()]},addInputRules(){let t=ul({match:vy,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(t=ul({match:vy,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes("textStyle")}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),a_=({listLevel:t,lvlText:e,listNumberingType:n})=>{const r=d_[n];return r?r(t,e):null},l_=(t,e)=>up(t,e,String),P2=(t,e)=>up(t,e,p_),c_=(t,e)=>P2(t,e).toLowerCase(),u_=(t,e)=>z2(t,e).toLowerCase(),z2=(t,e)=>up(t,e,n=>h_(n)),d_={decimal:l_,lowerRoman:c_,upperRoman:P2,lowerLetter:u_,upperLetter:z2},f_=(t,e)=>t.reduce((n,r,o)=>n.replace(`%${o+1}`,r),e),up=(t,e,n)=>{const r=t.map(n);return f_(r,e)},p_=t=>{const e=[{value:1e3,numeral:"M"},{value:900,numeral:"CM"},{value:500,numeral:"D"},{value:400,numeral:"CD"},{value:100,numeral:"C"},{value:90,numeral:"XC"},{value:50,numeral:"L"},{value:40,numeral:"XL"},{value:10,numeral:"X"},{value:9,numeral:"IX"},{value:5,numeral:"V"},{value:4,numeral:"IV"},{value:1,numeral:"I"}];let n="";for(const{value:r,numeral:o}of e)for(;t>=r;)n+=o,t-=r;return n},h_=t=>{let e="";const n="ABCDEFGHIJKLMNOPQRSTUVWXYZ";for(;t>0;){let r=(t-1)%26;e=n[r]+e,t=Math.floor((t-1)/26)}return e};function m_(t={}){return new Qe({key:new tt("styledListMarker"),state:{init(e,n){const r=[...xy(n),...ky(n)];return Le.create(n.doc,r)},apply(e,n,r,o){if(!e.docChanged||e.getMeta("orderedListMarker"))return n;const i=e.getMeta("splitListItem"),s=[...xy(o,i),...ky(o)];return Le.create(o.doc,s)}},props:{decorations(e){return this.getState(e)}}})}function xy(t,e=[]){let{doc:n,storedMarks:r}=t,o=[];Array.isArray(r)&&e.push(...r);let i=op(n,s=>s.type.name==="listItem");return i.length&&i.forEach(({node:s,pos:a})=>{let l=sr("textStyle",n.type.schema),c=[...e.filter(y=>y.type===l)];if(y_(s)&&e.length){const y=e.filter(g=>g.type===l);c.push(...y)}else{const y=g_(s,n,l);c.push(...y)}let u=null,d=null;c.forEach(y=>{let{attrs:g}=y;if(g.fontSize&&!u){let[x,k]=nr(g.fontSize);Number.isNaN(x)||(k=k??"pt",u=`${x}${k}`)}g.fontFamily&&!d&&(d=g.fontFamily)});let f={style:`--marker-font-size: ${u??"initial"}`},p={style:`--marker-font-family: ${d??"initial"}`},h=Oe.mergeAttributes(f,p),m=ze.node(a,a+s.nodeSize,h);o.push(m)}),o}function ky(t){let{doc:e}=t,n=[],r=op(e,o=>o.type.name==="listItem");return r.length&&r.forEach(({node:o,pos:i})=>{let s={};if(o.attrs.spacing){const{lineSpaceBefore:l,lineSpaceAfter:c,line:u}=o.attrs.spacing;s={style:`
38
38
  ${l?`margin-top: ${l}px;`:""}
39
39
  ${c?`margin-bottom: ${c}px;`:""}
40
40
  ${u?`line-height: ${u};`:""}