@harbour-enterprises/superdoc 0.10.66 → 0.10.67
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.
- package/dist/chunks/{super-editor.es-DEOcinxf.es.js → super-editor.es-BRYxQzRj.es.js} +22 -12
- package/dist/chunks/{super-editor.es-B8mb9SnY.cjs → super-editor.es-Bcx9TKdw.cjs} +3 -3
- package/dist/super-editor/ai-writer.es.js +1 -1
- package/dist/super-editor/chunks/{converter-BYpzj3lQ.js → converter-Dz-K_mnV.js} +376 -366
- package/dist/super-editor/chunks/{docx-zipper-NodqUi-d.js → docx-zipper-Dx87uIsl.js} +1 -1
- package/dist/super-editor/chunks/{editor-CdYaNtJ7.js → editor-rrhXdIHQ.js} +3 -3
- package/dist/super-editor/chunks/{toolbar-CUFvD__j.js → toolbar-Cl1-XAHv.js} +2 -2
- package/dist/super-editor/converter.es.js +1 -1
- package/dist/super-editor/core/super-converter/v2/importer/trackChangesImporter.d.ts.map +1 -1
- package/dist/super-editor/docx-zipper.es.js +2 -2
- package/dist/super-editor/editor.es.js +3 -3
- package/dist/super-editor/file-zipper.es.js +1 -1
- package/dist/super-editor/super-editor.es.js +6 -6
- package/dist/super-editor/toolbar.es.js +2 -2
- package/dist/super-editor.cjs +1 -1
- package/dist/super-editor.es.js +1 -1
- package/dist/superdoc.cjs +2 -2
- package/dist/superdoc.es.js +3 -3
- package/dist/superdoc.umd.js +378 -368
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +1 -1
|
@@ -27,7 +27,7 @@ Actual: `+A.attribValue);else{var F=A.tag,R=A.tags[A.tags.length-1]||A;F.ns===R.
|
|
|
27
27
|
`)}};us.empty=new us(!0);let oC=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 Ib(t){let e=[];do e.push(iC(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function iC(t){let e=[];do e.push(sC(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function sC(t){let e=cC(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=aC(t,e);else break;return e}function Xm(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function aC(t,e){let n=Xm(t),r=n;return t.eat(",")&&(t.next!="}"?r=Xm(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 cC(t){if(t.eat("(")){let e=Ib(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 uC(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 Fb(t,e){return e-t}function Ym(t,e){let n=[];return r(e),n.sort(Fb);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 dC(t){let e=Object.create(null);return n(Ym(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]);Ym(t,l).forEach(u=>{c||o.push([a,c=[]]),c.indexOf(u)==-1&&c.push(u)})})});let i=e[r.join(",")]=new us(r.indexOf(t.length-1)>-1);for(let s=0;s<o.length;s++){let a=o[s][1].sort(Fb);i.next.push({type:o[s][0],next:e[a.join(",")]||n(a)})}return i}}function fC(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 Bb(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 Rb(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 Lb(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 Pb(t,e){let n=Object.create(null);if(e)for(let r in e)n[r]=new hC(t,r,e[r]);return n}let Zm=class zb{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=Pb(e,r.attrs),this.defaultAttrs=Bb(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==us.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:Rb(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new to(this,this.computeAttrs(e),be.from(n),Je.setFrom(r))}createChecked(e=null,n,r){return n=be.from(n),this.checkContent(n),new to(this,this.computeAttrs(e),n,Je.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=be.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(be.empty,!0);return i?new to(this,e,n.append(i),Je.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){Lb(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:Je.none:e}static compile(e,n){let r=Object.create(null);e.forEach((i,s)=>r[i]=new zb(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 pC(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 hC=class{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?pC(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}},jb=class qb{constructor(e,n,r,o){this.name=e,this.rank=n,this.schema=r,this.spec=o,this.attrs=Pb(e,o.attrs),this.excluded=null;let i=Bb(this.attrs);this.instance=i?new Je(this,i):null}create(e=null){return!e&&this.instance?this.instance:new Je(this,Rb(this.attrs,e))}static compile(e,n){let r=Object.create(null),o=0;return e.forEach((i,s)=>r[i]=new qb(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){Lb(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}},Vb=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=St.from(e.nodes),n.marks=St.from(e.marks||{}),this.nodes=Zm.compile(this.spec.nodes,this),this.marks=jb.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]=us.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?Qm(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==""?[]:Qm(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 rC(r,r.defaultAttrs,e,Je.setFrom(n))}mark(e,n){return typeof e=="string"&&(e=this.marks[e]),e.create(n)}nodeFromJSON(e){return to.fromJSON(this,e)}markFromJSON(e){return Je.fromJSON(this,e)}nodeType(e){let n=this.nodes[e];if(!n)throw new RangeError("Unknown node type: "+e);return n}};function Qm(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 mC(t){return t.tag!=null}function gC(t){return t.style!=null}let Ar=class ud{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(o=>{if(mC(o))this.tags.push(o);else if(gC(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 tg(this,n,!1);return r.addAll(e,Je.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new tg(this,n,!0);return r.addAll(e,Je.none,n.from,n.to),xe.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(bC(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=ng(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=ng(s)),s.node||s.ignore||s.mark||(s.node=o)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new ud(e,ud.schemaRules(e)))}};const Ub={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},yC={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Hb={ol:!0,ul:!0},ds=1,dd=2,Oa=4;function eg(t,e,n){return e!=null?(e?ds:0)|(e==="full"?dd:0):t&&t.whitespace=="pre"?ds|dd:n&-5}let ea=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=Je.none,this.match=i||(s&Oa?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(be.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&ds)){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=be.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(be.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&&!Ub.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}},tg=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=eg(null,n.preserveWhitespace,0)|(r?Oa:0);o?i=new ea(o.type,o.attrs,Je.none,!0,n.topMatch||o.type.contentMatch,s):r?i=new ea(null,null,Je.none,!0,null,s):i=new ea(e.schema.topNodeType,null,Je.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&dd?"full":this.localPreserveWS||(o.options&ds)>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;Hb.hasOwnProperty(s)&&this.parser.normalizeLists&&wC(e);let l=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(a=this.parser.matchTag(e,this,r));e:if(l?l.ignore:yC.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(Ub.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=Je.none;for(let s of r.concat(e.marks))(o.type?o.type.allowsMarkType(s.type):rg(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=eg(e,i,s.options);s.options&Oa&&s.content.length==0&&(a|=Oa);let l=Je.none;return r=r.filter(c=>(s.type?s.type.allowsMarkType(c.type):rg(c.type,e))?(l=c.addToSet(l),!1):!0),this.nodes.push(new ea(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|=ds)}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 wC(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&Hb.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function bC(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function ng(t){let e={};for(let n in t)e[n]=t[n];return e}function rg(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 yi=class Wb{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},r){r||(r=ru(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}=Ma(ru(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&&Ma(ru(r),o(e,n),null,e.attrs)}static renderSpec(e,n,r=null,o){return Ma(e,n,r,o)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Wb(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=og(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return og(e.marks)}};function og(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function ru(t){return t.document||window.document}const ig=new WeakMap;function vC(t){let e=ig.get(t);return e===void 0&&ig.set(t,e=xC(t)),e}function xC(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 Ma(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=vC(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}=Ma(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 Gb=65535,Kb=Math.pow(2,16);function kC(t,e){return t+e*Kb}function sg(t){return t&Gb}function SC(t){return(t-(t&Gb))/Kb}const Jb=1,Xb=2,Da=4,Yb=8;let fd=class{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&Yb)>0}get deletedBefore(){return(this.delInfo&(Jb|Da))>0}get deletedAfter(){return(this.delInfo&(Xb|Da))>0}get deletedAcross(){return(this.delInfo&Da)>0}},uo=class Io{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&Io.empty)return Io.empty}recover(e){let n=0,r=sg(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+SC(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:kC(a/3,e-l),m=e==l?Xb:e==d?Jb:Da;return(n<0?e!=l:e!=d)&&(m|=Yb),new fd(p,m,h)}o+=u-c}return r?e+o:new fd(e+o,0,null)}touches(e,n){let r=0,o=sg(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 Io(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Io.empty:new Io(e<0?[0,-e,0]:[0,0,e])}};uo.empty=new uo([]);let Qo=class pd{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 pd(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 pd;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 fd(e,o,null)}};const ou=Object.create(null);let Bt=class{getMap(){return uo.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=ou[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 ou)throw new RangeError("Duplicate use of step JSON ID "+e);return ou[e]=n,n.prototype.jsonID=e,n}},jt=class Di{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new Di(e,null)}static fail(e){return new Di(null,e)}static fromReplace(e,n,r,o){try{return Di.ok(e.replace(n,r,o))}catch(i){if(i instanceof Qa)return Di.fail(i.message);throw i}}};function qf(t,e,n){let r=[];for(let o=0;o<t.childCount;o++){let i=t.child(o);i.content.size&&(i=i.copy(qf(i.content,e,i))),i.isInline&&(i=e(i,n,o)),r.push(i)}return be.fromArray(r)}let Ls=class _i extends Bt{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 xe(qf(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 vn(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))}};Bt.jsonID("addMark",Ls);let vn=class Ni extends Bt{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 xe(qf(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 Ls(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 Ni(n.pos,r.pos,this.mark)}merge(e){return e instanceof Ni&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Ni(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 Ni(n.from,n.to,e.markFromJSON(n.mark))}};Bt.jsonID("removeMark",vn);let Vf=class Ii extends Bt{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 xe(be.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 Ii(this.pos,n.marks[o]);return new Ii(this.pos,this.mark)}}return new Uf(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Ii(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 Ii(n.pos,e.markFromJSON(n.mark))}};Bt.jsonID("addNodeMark",Vf);let Uf=class hd extends Bt{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 xe(be.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new Vf(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new hd(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 hd(n.pos,e.markFromJSON(n.mark))}};Bt.jsonID("removeNodeMark",Uf);let $t=class qr extends Bt{constructor(e,n,r,o=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=o}apply(e){return this.structure&&md(e,this.from,this.to)?jt.fail("Structure replace would overwrite content"):jt.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new uo([this.from,this.to-this.from,this.slice.size])}invert(e){return new qr(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 qr(n.pos,Math.max(n.pos,r.pos),this.slice)}merge(e){if(!(e instanceof qr)||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?xe.empty:new xe(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new qr(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?xe.empty:new xe(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new qr(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 qr(n.from,n.to,xe.fromJSON(e,n.slice),!!n.structure)}};Bt.jsonID("replace",$t);let Zt=class _a extends Bt{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&&(md(e,this.from,this.gapFrom)||md(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 uo([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 _a(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 _a(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 _a(n.from,n.to,n.gapFrom,n.gapTo,xe.fromJSON(e,n.slice),n.insert,!!n.structure)}};Bt.jsonID("replaceAround",Zt);function md(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 EC(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 vn(f,p,d[m])));a&&a.to==f?a.to=p:i.push(a=new Ls(f,p,r))}}),o.forEach(l=>t.step(l)),i.forEach(l=>t.step(l))}function CC(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 jb){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 vn(s.from,s.to,s.style)))}function Hf(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,xe.empty));else{r=d;for(let f=0;f<c.marks.length;f++)n.allowsMarkType(c.marks[f].type)||t.step(new vn(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 xe(be.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(be.empty,!0);t.replace(a,a,new xe(l,0,0))}for(let l=s.length-1;l>=0;l--)t.step(s[l])}function AC(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function Ps(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||!AC(r,o,i))break}return null}function $C(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=be.empty,d=0;for(let h=i,m=!1;h>n;h--)m||r.index(h)>0?(m=!0,u=be.from(r.node(h).copy(u)),d++):l--;let f=be.empty,p=0;for(let h=i,m=!1;h>n;h--)m||o.after(h+1)<o.end(h)?(m=!0,f=be.from(o.node(h).copy(f)),p++):c++;t.step(new Zt(l,c,s,a,new xe(u.append(f),d,p),u.size-d,!0))}function Zb(t,e,n=null,r=t){let o=TC(t,e),i=o&&OC(r,e);return i?o.map(ag).concat({type:e,attrs:n}).concat(i.map(ag)):null}function ag(t){return{type:t,attrs:null}}function TC(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 OC(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 MC(t,e,n){let r=be.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=be.from(n[s].type.create(n[s].attrs,r))}let o=e.start,i=e.end;t.step(new Zt(o,i,o,i,new xe(r,0,0),n.length,!0))}function DC(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)&&_C(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&&e1(t,s,a,i),Hf(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 Zt(d,f,d+1,f-1,new xe(be.from(r.create(l,null,s.marks)),0,0),1,!0)),c===!0&&Qb(t,s,a,i),!1}})}function Qb(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 e1(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 _C(t,e,n){let r=t.resolve(e),o=r.index();return r.parent.canReplaceWith(o,o+1,n)}function NC(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 Zt(e,e+i.nodeSize,e+1,e+i.nodeSize-1,new xe(be.from(s),0,0),1,!0))}function er(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 IC(t,e,n=1,r){let o=t.doc.resolve(e),i=be.empty,s=be.empty;for(let a=o.depth,l=o.depth-n,c=n-1;a>l;a--,c--){i=be.from(o.node(a).copy(i));let u=r&&r[c];s=be.from(u?u.type.create(u.attrs,s):o.node(a).copy(s))}t.step(new $t(e,e,new xe(i.append(s),n,n),!0))}function Br(t,e){let n=t.resolve(e),r=n.index();return t1(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function FC(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 t1(t,e){return!!(t&&e&&!t.isLeaf&&FC(t,e))}function n1(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&&t1(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 BC(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);e1(t,u.node(),u.before(),a)}s.inlineContent&&Hf(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),xe.empty,!0)),r===!0){let u=t.doc.resolve(c);Qb(t,u.node(),u.before(),t.steps.length)}return t}function RC(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 r1(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 Wf(t,e,n=e,r=xe.empty){if(e==n&&!r.size)return null;let o=t.resolve(e),i=t.resolve(n);return o1(o,i,r)?new $t(e,n,r):new LC(o,i,r).fit()}function o1(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}let LC=class{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=be.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=be.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 xe(i,s,a);return e>-1?new Zt(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=iu(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(be.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=iu(e,n);return!o.childCount||o.firstChild.isLeaf?!1:(this.unplaced=new xe(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=iu(e,n);if(o.childCount<=1&&n>0){let i=e.size-n<=n+o.size;this.unplaced=new xe(Fi(e,n-1,1),n-1,i?n-1:r)}else this.unplaced=new xe(Fi(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(i1(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=Bi(this.placed,n,be.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?xe.empty:new xe(Fi(s.content,e-1,1),e-1,p<0?s.openEnd:e-1):new xe(Fi(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||!su(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=su(e,n,o,r,i);if(s){for(let a=n-1;a>=0;a--){let{match:l,type:c}=this.frontier[a],u=su(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=Bi(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=Bi(this.placed,this.depth,be.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let e=this.frontier.pop().match.fillBefore(be.empty,!0);e.childCount&&(this.placed=Bi(this.placed,this.frontier.length,e))}};function Fi(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(Fi(t.firstChild.content,e-1,n)))}function Bi(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(Bi(t.lastChild.content,e-1,n)))}function iu(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function i1(t,e,n){if(e<=0)return t;let r=t.content;return e>1&&(r=r.replaceChild(0,i1(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(be.empty,!0)))),t.copy(r)}function su(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&&!PC(n,i.content,s)?a:null}function PC(t,e,n){for(let r=n;r<e.childCount;r++)if(!t.allowsMarks(e.child(r).marks))return!0;return!1}function zC(t){return t.spec.defining||t.spec.definingForContent}function jC(t,e,n,r){if(!r.size)return t.deleteRange(e,n);let o=t.doc.resolve(e),i=t.doc.resolve(n);if(o1(o,i,r))return t.step(new $t(e,n,r));let s=a1(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=zC(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 xe(s1(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 s1(t,e,n,r,o){if(e<n){let i=t.firstChild;t=t.replaceChild(0,i.copy(s1(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(be.empty,!0))}return t}function qC(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let o=RC(t.doc,e,r.type);o!=null&&(e=n=o)}t.replaceRange(e,n,new xe(be.from(r),0,0))}function VC(t,e,n){let r=t.doc.resolve(e),o=t.doc.resolve(n),i=a1(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 a1(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 l1=class Na extends Bt{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 xe(be.from(o),0,n.isLeaf?0:1))}getMap(){return uo.empty}invert(e){return new Na(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 Na(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 Na(n.pos,n.attr,n.value)}};Bt.jsonID("attr",l1);let c1=class gd extends Bt{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 uo.empty}invert(e){return new gd(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 gd(n.attr,n.value)}};Bt.jsonID("docAttr",c1);let ei=class extends Error{};ei=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};ei.prototype=Object.create(Error.prototype);ei.prototype.constructor=ei;ei.prototype.name="TransformError";let u1=class{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Qo}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new ei(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=xe.empty){let o=Wf(this.doc,e,n,r);return o&&this.step(o),this}replaceWith(e,n,r){return this.replace(e,n,new xe(be.from(r),0,0))}delete(e,n){return this.replace(e,n,xe.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return jC(this,e,n,r),this}replaceRangeWith(e,n,r){return qC(this,e,n,r),this}deleteRange(e,n){return VC(this,e,n),this}lift(e,n){return $C(this,e,n),this}join(e,n=1){return BC(this,e,n),this}wrap(e,n){return MC(this,e,n),this}setBlockType(e,n=e,r,o=null){return DC(this,e,n,r,o),this}setNodeMarkup(e,n,r=null,o){return NC(this,e,n,r,o),this}setNodeAttribute(e,n,r){return this.step(new l1(e,n,r)),this}setDocAttribute(e,n){return this.step(new c1(e,n)),this}addNodeMark(e,n){return this.step(new Vf(e,n)),this}removeNodeMark(e,n){if(!(n instanceof Je)){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 Uf(e,n)),this}split(e,n=1,r){return IC(this,e,n,r),this}addMark(e,n,r){return EC(this,e,n,r),this}removeMark(e,n,r){return CC(this,e,n,r),this}clearIncompatible(e,n,r){return Hf(this,e,n,r),this}};const au=Object.create(null);let Le=class{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new d1(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=xe.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?xe.empty:n),a==0&&ug(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),ug(e,r,n.isInline?-1:1))}}static findFrom(e,n,r=!1){let o=e.parent.inlineContent?new je(e):Fo(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?Fo(e.node(0),e.node(i),e.before(i+1),e.index(i),n,r):Fo(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 Fo(e,e,0,0,1)||new _n(e)}static atEnd(e){return Fo(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=au[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 au)throw new RangeError("Duplicate use of selection JSON ID "+e);return au[e]=n,n.prototype.jsonID=e,n}getBookmark(){return je.between(this.$anchor,this.$head).getBookmark()}};Le.prototype.visible=!0;let d1=class{constructor(e,n){this.$from=e,this.$to=n}},lg=!1;function cg(t){!lg&&!t.parent.inlineContent&&(lg=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}let je=class Ri extends Le{constructor(e,n=e){cg(e),cg(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 Le.near(r);let o=e.resolve(n.map(this.anchor));return new Ri(o.parent.inlineContent?o:r,r)}replace(e,n=xe.empty){if(super.replace(e,n),n==xe.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof Ri&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new f1(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 Ri(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=Le.findFrom(n,r,!0)||Le.findFrom(n,-r,!0);if(i)n=i.$head;else return Le.near(n,r)}return e.parent.inlineContent||(o==0?e=n:(e=(Le.findFrom(e,-r,!0)||Le.findFrom(e,r,!0)).$anchor,e.pos<n.pos!=o<0&&(e=n))),new Ri(e,n)}};Le.jsonID("text",je);let f1=class p1{constructor(e,n){this.anchor=e,this.head=n}map(e){return new p1(e.map(this.anchor),e.map(this.head))}resolve(e){return je.between(e.resolve(this.anchor),e.resolve(this.head))}},Ie=class Li extends Le{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?Le.near(i):new Li(i)}content(){return new xe(be.from(this.node),0,0)}eq(e){return e instanceof Li&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new UC(this.anchor)}static fromJSON(e,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new Li(e.resolve(n.anchor))}static create(e,n){return new Li(e.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}};Ie.prototype.visible=!1;Le.jsonID("node",Ie);let UC=class h1{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:r}=e.mapResult(this.anchor);return n?new f1(r,r):new h1(r)}resolve(e){let n=e.resolve(this.anchor),r=n.nodeAfter;return r&&Ie.isSelectable(r)?new Ie(n):Le.near(n)}},_n=class Ia extends Le{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,n=xe.empty){if(n==xe.empty){e.delete(0,e.doc.content.size);let r=Le.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,n)}toJSON(){return{type:"all"}}static fromJSON(e){return new Ia(e)}map(e){return new Ia(e)}eq(e){return e instanceof Ia}getBookmark(){return HC}};Le.jsonID("all",_n);const HC={map(){return this},resolve(t){return new _n(t)}};function Fo(t,e,n,r,o,i=!1){if(e.inlineContent)return je.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&&Ie.isSelectable(a))return Ie.create(t,n-(o<0?a.nodeSize:0))}else{let l=Fo(t,a,n+o,o<0?a.childCount:0,o,i);if(l)return l}n+=a.nodeSize*o}return null}function ug(t,e,n){let r=t.steps.length-1;if(r<e)return;let o=t.steps[r];if(!(o instanceof $t||o instanceof Zt))return;let i=t.mapping.maps[r],s;i.forEach((a,l,c,u)=>{s==null&&(s=u)}),t.setSelection(Le.near(t.doc.resolve(s),n))}const dg=1,fg=2,pg=4;let WC=class extends u1{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|dg)&-3,this.storedMarks=null,this}get selectionSet(){return(this.updated&dg)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=fg,this}ensureMarks(e){return Je.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&fg)>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)||Je.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(Le.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|=pg,this}get scrolledIntoView(){return(this.updated&pg)>0}};function hg(t,e){return!e||!t?t:t.bind(e)}let Pi=class{constructor(e,n,r){this.name=e,this.init=hg(n.init,r),this.apply=hg(n.apply,r)}};const GC=[new Pi("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new Pi("selection",{init(t,e){return t.selection||Le.atStart(e.doc)},apply(t){return t.selection}}),new Pi("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new Pi("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];let lu=class{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=GC.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 Pi(r.key,r.spec.state,r))})}},Ji=class zi{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 zi(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 WC(this)}static create(e){let n=new lu(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new zi(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 lu(this.schema,e.plugins),r=n.fields,o=new zi(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 lu(e.schema,e.plugins),i=new zi(o);return o.fields.forEach(s=>{if(s.name=="doc")i.doc=to.fromJSON(e.schema,n.doc);else if(s.name=="selection")i.selection=Le.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 m1(t,e,n){for(let r in t){let o=t[r];o instanceof Function?o=o.bind(e):r=="handleDOMEvents"&&(o=m1(o,e,{})),n[r]=o}return n}let Xe=class{constructor(e){this.spec=e,this.props={},e.props&&m1(e.props,this,this.props),this.key=e.key?e.key.key:g1("plugin")}getState(e){return e[this.key]}};const cu=Object.create(null);function g1(t){return t in cu?t+"$"+ ++cu[t]:(cu[t]=0,t+"$")}let et=class{constructor(e="key"){this.key=g1(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}};const nl=t=>t.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`),KC=t=>nl(t),Fa=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"}),JC={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 We(t,e=null,...n){return typeof t=="function"?e?t.bind(e)(...n):t(...n):t}function XC(t={}){return Object.keys(t).length===0&&t.constructor===Object}const YC=()=>typeof navigator<"u"?/Mac/.test(navigator.platform):!1,ZC=()=>["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform),y1=t=>Object.prototype.toString.call(t)==="[object RegExp]";function ti(t,e,n={strict:!0}){const r=Object.keys(e);return r.length?r.every(o=>n.strict?e[o]===t[o]:y1(e[o])?e[o].test(t[o]):e[o]===t[o]):!0}function mg(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 QC=/[\d-.]+(\w+)$/,eA=["px","rem","em","in","q","mm","cm","pt","pc","vh","vw","vmin","vmax"];function tr(t="0"){const e=t.toString()||"0",n=Number.parseFloat(e),r=(e.match(QC)?.[1]??"").toLowerCase();return[n,eA.includes(r)?r:null]}function rl(t=0,e=0,n=0){return Math.min(Math.max(t,e),n)}function ni(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 nt(t){if(t!=null)return t=Wt(t),Math.round(t*96)}function lt(t){if(t!=null)return t=t/96,ni(t)}function Go(t){if(t!=null)return t/240}function yd(t){if(t!=null)return t*240}function tA(t){if(t!=null)return Math.round(t/2)}function Gt(t){if(t==null)return;typeof t=="string"&&(t=parseFloat(t));const e=t*96/914400;return Math.round(e)}function Ei(t){if(t!=null)return typeof t=="string"&&(t=parseFloat(t)),Math.round(t*9525)}function w1(t){return t==null?void 0:parseFloat(t)/8*1.3333}function b1(t){if(t!=null)return Math.round(t*6)}function v1(t){if(t!=null)return t/20}function nA(t){if(t!=null)return t*20}const rA=async t=>{const e=t.includes(",")?t.split(",",2)[1]:t;if(typeof globalThis.atob=="function"){const r=globalThis.atob(e),o=r.length,i=new Uint8Array(o);for(let s=0;s<o;s++)i[s]=r.charCodeAt(s);return i.buffer}const n=pt.from(e,"base64");return n.buffer.slice(n.byteOffset,n.byteOffset+n.byteLength)},oA=t=>{const e=new window.DOMParser().parseFromString(t,"text/xml").querySelectorAll("Default");return Array.from(e).map(n=>n.getAttribute("Extension"))},iA=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 sA(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 aA=t=>{const e=Number(t).toString(16);return e.length===1?"0"+e:e},lA=t=>"#"+t.match(/\d+/g).map(aA).join(""),zl=(t,e,n="",r=!1)=>{let[o,i]=tr(t);return Number.isNaN(o)||o===0?{}:n==="atLeast"&&o<1?{}:(i=i||e,o+=i?4:.2,r?{"line-height":`${o}${i}`}:`line-height: ${o}${i}`)},cA=(t,e)=>{const n=new Uint8Array(t),r=e.replace(/[-{}]/g,"");if(r.length!==32){console.error("Invalid GUID");return}const o=new Uint8Array(16);for(let i=0,s=0;i<32;i+=2,s++){const a=r[i]+r[i+1];o[s]=parseInt(a,16)}for(let i=0;i<32;i++){const s=15-i%16;n[i]^=o[s]}return n.buffer};function Xn(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 Gf(){return Math.floor(Math.random()*2147483647).toString(16).toUpperCase().padStart(8,"0")}const uA={"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"},dA={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:[]}]},fA={elements:[{type:"element",name:"w:settings",attributes:{"xmlns:w":"http://schemas.openxmlformats.org/wordprocessingml/2006/main"},elements:[]}]},pA={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"}]},gg={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"}}]}]}},hA={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:[]}]},mA={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:[]}]},gA={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:[]}]},yA={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:[]}]},wA={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"}}]}]},bA={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"}}]}]},Bo={COMMENTS_XML_DEF:hA,COMMENTS_EXTENDED_XML_DEF:mA,COMMENTS_EXTENSIBLE_XML_DEF:gA,COMMENTS_IDS_XML_DEF:yA,DOCUMENT_RELS_XML_DEF:wA,CONTENT_TYPES:bA},It="trackInsert",ut="trackDelete",vt="trackFormat",cn=t=>{if(t)try{return JSON.parse(JSON.stringify(t))}catch(e){console.error("Error in carbonCopy",t,e);return}},vA={attributes:{"w:abstractNumId":"1"}},xA={attributes:{"w:abstractNumId":"0"}},x1={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 yg(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=kA(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 kA=(t,e)=>({name:`w:commentRange${t}`,attributes:{"w:id":String(e)}}),SA=t=>({...t,commentParaId:Gf()}),EA=(t,e,n)=>{const r=E1({node:t.commentJSON}),o={"w:id":String(e),"w:author":t.creatorName||t.importedAuthor?.name,"w:email":t.creatorEmail||t.importedAuthor?.email,"w:date":k1(t.createdTime),"w:initials":CA(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]}},CA=t=>t?t.replace("(imported)","").trim().split(" ").map(e=>e[0]).join(""):null,k1=t=>new Date(t||Date.now()).toISOString().replace(/\.\d{3}Z$/,"Z"),AA=(t=[],e)=>{const n=cn(e);return t.forEach(r=>{r.elements[0].elements.unshift(pA);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},$A=(t=[],e)=>{const n=cn(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},TA=(t=[],e,n)=>{const r=cn(e),o=cn(n);return r.elements[0].elements=[],o.elements[0].elements=[],t.forEach(i=>{const s=Gf(),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":k1()}};o.elements[0].elements.push(l)}),{documentIdsUpdated:r,extensibleUpdated:o}},OA=t=>{const e=cn(t);return e["word/comments.xml"]=Bo.COMMENTS_XML_DEF,e["word/commentsExtended.xml"]=Bo.COMMENTS_EXTENDED_XML_DEF,e["word/commentsExtensible.xml"]=Bo.COMMENTS_EXTENSIBLE_XML_DEF,e["word/commentsIds.xml"]=Bo.COMMENTS_IDS_XML_DEF,e["[Content_Types].xml"]=Bo.CONTENT_TYPES,e},MA=t=>{const e=cn(t);return delete e["word/comments.xml"],delete e["word/commentsExtended.xml"],delete e["word/commentsExtensible.xml"],delete e["word/commentsIds.xml"],e},ta=t=>({...Bo.DOCUMENT_RELS_XML_DEF.elements[0].elements.find(e=>e.attributes.Target===t)}),DA=({convertedXml:t,defs:e,commentsWithParaIds:n,exportType:r,converter:o})=>{const i=[];if(r==="clean")return{documentXml:MA(t),relationships:i};const s=OA(t);s["word/comments.xml"]=AA(e,s["word/comments.xml"]),i.push(ta("comments.xml")),s["word/commentsExtended.xml"]=$A(n,s["word/commentsExtended.xml"]),i.push(ta("commentsExtended.xml"));const{documentIdsUpdated:a,extensibleUpdated:l}=TA(n,s["word/commentsIds.xml"],s["word/commentsExtensible.xml"]);return s["word/commentsIds.xml"]=a,s["word/commentsExtensible.xml"]=l,i.push(ta("commentsIds.xml")),i.push(ta("commentsExtensible.xml")),{relationships:i,documentXml:s}},wd=(t,e)=>e?["width",`${Math.max(e,t)}px`]:["min-width",`${t}px`],S1=(t,e,n,r)=>{let o=0,i=!0;const s=[],a=[],l=t.firstChild;if(!l)return{};for(let p=0,h=0;p<l.childCount;p++){const{colspan:m,colwidth:y}=l.child(p).attrs;for(let g=0;g<m;g++,h++){const x=n===h?r:y&&y[g];o+=x||e,x||(i=!1);const[k,b]=wd(e,x);s.push(["col",{style:`${k}: ${b}`}]),a.push(parseInt(b,10))}}const c=i?`${o}px`:"",u=i?"":`${o}px`,d=["colgroup",{},...s],f=[...a];return{colgroup:d,tableWidth:c,tableMinWidth:u,colgroupValues:f}};function wi(t){const{type:e}=t.node||{},n={doc:IA,body:_A,paragraph:E1,text:FA,bulletList:bg,orderedList:bg,lineBreak:VA,table:UA,tableRow:XA,tableCell:ZA,bookmarkStart:t4,fieldAnnotation:c4,tab:WA,image:$1,hardBreak:u4,commentRangeStart:()=>yg(t,"Start"),commentRangeEnd:()=>yg(t,"End"),commentReference:()=>null,shapeContainer:d4,shapeTextbox:f4,contentBlock:p4};return n[e]?n[e](t):(console.error("No translation function found for node type:",e),null)}function _A(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=ni(s);o[`w:${i}`]=a}),r.attributes=o}return{name:"w:body",elements:[...Rr(t),e]}}function E1(t){const e=Rr(t),n=e.find(i=>i.name==="htmlAnnotation");if(e.length===1&&n)return n.elements;const r=NA(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 NA(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,lineHeight:l,marksAttrs:c,keepLines:u,keepNext:d,dropcap:f}=e;if(o){const{lineSpaceBefore:h,lineSpaceAfter:m,line:y,lineRule:g}=o,x={};h>=0&&(x["w:before"]=lt(h)),m>=0&&(x["w:after"]=lt(m)),g==="exact"?l&&(x["w:line"]=nA(parseFloat(l))):l&&(x["w:line"]=yd(l)),x["w:lineRule"]=g||"auto";const k={name:"w:spacing",attributes:x};n.push(k)}if(l&&!o){const h={name:"w:spacing",attributes:{"w:line":yd(l)}};n.push(h)}if(i){const{left:h,right:m,firstLine:y,hanging:g}=i,x={};(h||h===0)&&(x["w:left"]=lt(h)),(m||m===0)&&(x["w:right"]=lt(m)),(y||y===0)&&(x["w:firstLine"]=lt(y)),(g||g===0)&&(x["w:hanging"]=lt(g)),a&&!x["w:left"]&&(x["w:left"]=ni(a));const k={name:"w:ind",attributes:x};n.push(k)}else if(a){const h={name:"w:ind",attributes:{"w:left":ni(a)}};n.push(h)}if(s){const h={name:"w:jc",attributes:{"w:val":s}};n.push(h)}if(c){const h=ql(c),m=C1(h);n.push(m)}u&&n.push({name:"w:keepLines",attributes:{"w:val":u}}),d&&n.push({name:"w:keepNext",attributes:{"w:val":d}}),f&&n.push({name:"w:framePr",attributes:{"w:dropCap":f.type,"w:lines":f.lines,"w:wrap":f.wrap,"w:vAnchor":f.vAnchor,"w:hAnchor":f.hAnchor}});const p=t.attrs?.paragraphProperties?.sectPr;return p&&n.push(p),n.length?{name:"w:pPr",elements:n}:null}function IA(t){const e={type:"body",content:t.node.content};return[{name:"w:document",elements:[wi({...t,node:e})],attributes:uA},t]}function Rr(t){const{content:e}=t.node;if(!e)return[];const n=[];return e.forEach(r=>{const o=wi({...t,node:r});o instanceof Array?n.push(...o):n.push(o)}),n.filter(r=>r)}function jl(t,e,n){const r=/^\s|\s$/.test(t)?"preserve":null,o=r?{"xml:space":r}:null,i=[],s=ql(e);if(i.push({name:"w:t",elements:[{text:t,type:"text"}],attributes:o}),n){const{editor:a}=n,l=a.extensionService.extensions.filter(c=>c.isExternal===!0);e.forEach(c=>{const u=l.some(f=>{const p=f.name;return c.type===p});if(!u)return;let d="";Object.entries(c.attrs).forEach(([f,p])=>{p&&(d+=`${f}=${p};`)}),u&&(i.unshift({type:"element",name:"w:bookmarkStart",attributes:{"w:id":"5000","w:name":c.type+";"+d}}),i.push({type:"element",name:"w:bookmarkEnd",attributes:{"w:id":"5000"}}))})}return zs(i,s)}function FA(t){const{node:e}=t,n=[It,ut];if(e.marks?.some(i=>n.includes(i.type)))return RA(t);if(e.marks?.some(i=>i.type==="link"))return LA(t);const{text:r,marks:o=[]}=e;return jl(r,o,t)}function BA(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=>ql([n])).filter(n=>n!==void 0)}}function RA(t){const{node:e}=t,n=e.marks,r=[It,ut,vt],o=n.find(l=>r.includes(l.type)),i=o.type===It,s=BA(n);e.marks=n.filter(l=>!r.includes(l.type)),s&&e.marks.push(s);const a=wi({...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 zs(t,e){let n=[];return Array.isArray(t)?n=t:n=[t],e&&e.length&&n.unshift(C1(e)),{name:"w:r",elements:n}}function C1(t=[]){return{name:"w:rPr",elements:t.filter(e=>!!Object.keys(e).length)}}function ql(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 vg(o)}):vg(e))}function LA(t){const{node:e}=t,n=e.marks.find(s=>s.type==="link"),r=n.attrs.href;let o=n.attrs.rId;o||(o=A1(t,r)),e.marks=e.marks.filter(s=>s.type!=="link");const i=wi({...t,node:e});return{name:"w:hyperlink",type:"element",attributes:{"r:id":o},elements:[i]}}function A1(t,e){const n="rId"+Xn();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 wg(t,e){const n="rId"+Xn(),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 bg(t){const{type:e}=t.node,n=qA(t),r=[];return n.forEach(o=>{const{level:i,listType:s,pPrs:a,content:l,attrs:c={}}=o,u=(o.attrs.numId||o.listId)??PA(t,s),d=jA(i,u,a);l.forEach((f,p)=>{const h=Object.assign({},f);h.attrs={...h.attrs,...o.attrs};const m=wi({...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={name:"w:p",type:"element",elements:f.attrs.paragraphProperties?[f.attrs.paragraphProperties]:[]};return r.push(k)}const{attributes:g}=c,{originalInlineRunProps:x}=g||{};if(x&&d.elements.push(x),y===-1)m.elements.unshift(cn(d));else{const k=cn(d).elements.map(b=>m.elements[y].elements.find(D=>D.name===b.name)||b);m.elements[y].elements=k}if(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 PA(t,e){const n=zA(t.converter?.numbering?.definitions),r=e==="bullet"?xA:vA,o=n,i=r.attributes["w:abstractNumId"],s={type:"element",name:"w:num",attributes:{"w:numId":String(o),"w16cid:durableId":"485517411"},elements:[{name:"w:abstractNumId",attributes:{"w:val":String(i)}}]};return t.converter.numbering.definitions[o]=s,o}const zA=t=>!t||!Object.keys(t).length?0:Math.max(...Object.keys(t).map(e=>parseInt(e,10)))+1;function jA(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 qA({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"]=lt(g)),x!==void 0&&(T["w:right"]=lt(x)),k!==void 0&&(T["w:firstLine"]=lt(k)),b!==void 0&&(T["w:hanging"]=lt(b));const D={type:"element",name:"w:ind",attributes:T},M=a.findIndex(I=>I.name==="w:ind");M!==-1&&(a[M]=D)}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 VA(t){const e={},{lineBreakType:n}=t.node?.attrs||{};return n&&(e["w:type"]=n),{name:"w:br",attributes:e}}function UA(t){t.node=HA(t.node,t);const e=Rr(t),n=GA(t.node),r=JA(t.node,t);return e.unshift(n),e.unshift(r),{name:"w:tbl",elements:e}}function HA(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 WA(t){const{marks:e=[]}=t.node,n=ql(e);return zs({name:"w:tab"},n)}function GA(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=KA(t);e.push(u)}if(a){const{width:u,type:d}=a,f={name:"w:tblInd",attributes:{"w:w":lt(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":lt(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 KA(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":b1(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 JA(t,e){const{editorSchema:n}=e;let r=[];try{const i=n.nodeFromJSON(t),s=25,{colgroupValues:a}=S1(i,s);r=a}catch{r=[]}const o=[];return r?.forEach(i=>{o.push({name:"w:gridCol",attributes:{"w:w":lt(i)}})}),{name:"w:tblGrid",elements:o}}function XA(t){const e=Rr(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":lt(r)};o&&(i["w:hRule"]=o);const s={name:"w:trHeight",attributes:i};n.push(s)}return{name:"w:trPr",elements:n}}function ZA(t){const e=Rr({...t,tableCell:t.node}),n=QA(t.node);return e.unshift(n),{name:"w:tc",elements:e}}function QA(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"?lt(c):ni(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:e4(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":b1(g.size),"w:space":g.space||0}}:{name:`w:${y}`,attributes:{"w:val":"nil"}})};e.push(m)}return{name:"w:tcPr",elements:e}}function e4(t){const e=[],{top:n,right:r,bottom:o,left:i}=t;return n!=null&&e.push({name:"w:top",attributes:{"w:w":lt(n)}}),r!=null&&e.push({name:"w:right",attributes:{"w:w":lt(r)}}),o!=null&&e.push({name:"w:bottom",attributes:{"w:w":lt(o)}}),i!=null&&e.push({name:"w:left",attributes:{"w:w":lt(i)}}),e}function t4(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 vg(t){const e=Dr.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=lA(i)),n.attributes["w:val"]=i;break;case"textAlign":n.attributes["w:val"]=r.textAlign;break;case"textIndent":n.attributes["w:firstline"]=ni(r.textIndent);break;case"lineHeight":n.attributes["w:line"]=yd(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 n4(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 r4(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 $1(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}=n4(s);let c=n.size?{w:Ei(n.size.width),h:Ei(n.size.height)}:e;if(a&&l){const p=Gt(c.w),h=Gt(c.h),{scaledWidth:m,scaledHeight:y}=r4(a,l,p,h);c={w:Ei(m),h:Ei(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=Ei(p-(h+m)),{width:g,height:x}=h4(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=wg(t,p)}else if(t.node.type==="fieldAnnotation"&&!i){const p=s?.split(";")[0].split("/")[1];if(!p)return T1(t);const h=Xn(4),m=n.fieldId.replace("-","_"),y=`media/${m}_${h}.${p}`;i=wg(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 zs({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 T1(t){const{node:{attrs:e={},marks:n=[]}}=t,r=l4(e);return jl(e.displayLabel,[...n,...r],t)}function o4(t){const{node:{attrs:e={},marks:n=[]}}=t,r=YE.decode(e.displayLabel);return jl(r,n,t)}function i4(t){const{node:{attrs:e={}}}=t,n=new window.DOMParser().parseFromString(e.rawHtml,"text/html"),r=Ji.create({doc:Ar.fromSchema(t.editorSchema).parse(n)}).doc.toJSON();return{name:"htmlAnnotation",elements:Rr({...t,node:r})}}function xg(t,e){return $1(t,e)}function s4(t){const{node:{attrs:e={},marks:n=[]}}=t,r=A1(t,e.linkUrl),o=jl(e.linkUrl,n,t);return{name:"w:hyperlink",type:"element",attributes:{"r:id":r,"w:history":1},elements:[o]}}function a4(t){const e={w:4286250,h:4286250},n={w:99e4,h:495e3};return{text:T1,image:r=>xg(r,e),signature:r=>xg(r,n),checkbox:o4,html:i4,link:s4}[t]}const l4=(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 c4(t){const{node:e,isFinalDoc:n}=t,{attrs:r={}}=e,o=a4(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 u4(t){const{node:e={}}=t,{attrs:n={}}=e,{pageBreakSource:r}=n;return r==="sectPr"?null:{name:"w:r",elements:[{name:"w:br",type:"element",attributes:{"w:type":"page"}}]}}function d4(t){const{node:e}=t,n=Rr(t),r={name:"v:shape",attributes:{...e.attrs.attributes,fillcolor:e.attrs.fillcolor},elements:[...n,...e.attrs.wrapAttributes?[{name:"w10:wrap",attributes:{...e.attrs.wrapAttributes}}]:[]]},o={name:"w:pict",attributes:{"w14:anchorId":Math.floor(Math.random()*4294967295).toString()},elements:[r]};return{name:"w:p",elements:[zs(o)]}}function f4(t){const{node:e}=t,n={name:"w:txbxContent",elements:Rr(t)};return{name:"v:textbox",attributes:{...e.attrs.attributes},elements:[n]}}function p4(t){const{node:e}=t,{drawingContent:n}=e.attrs,r={name:"w:drawing",elements:[...n?[...n.elements||[]]:[]]};return{name:"w:p",elements:[zs({name:"mc:AlternateContent",elements:[{name:"mc:Choice",attributes:{Requires:"wps"},elements:[r]}]})]}}var Hr,O1,uu,du;let kg=class{constructor(e){V0(this,Hr),this.converter=e}schemaToXml(e,n=!1){return Yn(this,Hr,O1).call(this,e,n).join("")}};Hr=new WeakSet,O1=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=Yn(this,Hr,du).call(this,n,e);return[o,...i]},uu=function(t){if(t)return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")},du=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"?Yn(this,Hr,uu).call(this,o[l]):o[l];i+=` ${l}="${c}"`}const s=n&&(!r||!r.length);s?i+=" />":i+=">";let a=[i];if(!n&&t.type==="text")return t.text;if(n==="w:instrText")a.push(r[0].text);else if(n==="w:t"||n==="w:delText"||n==="wp:posOffset"){const l=Yn(this,Hr,uu).call(this,r[0].text);a.push(l)}else if(r)for(let l of r){const c=Yn(this,Hr,du).call(this,l);if(!c)continue;if(typeof c=="string"){a.push(c);continue}const u=c.filter(d=>d!=="<undefined>"&&d!=="</undefined>");a.push(...u)}return s||a.push(`</${n}>`),a};function h4(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 m4='<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>',g4=t=>JSON.parse(Eb.xml2json(t,null,2)),y4=(t,e=m4)=>t["word/document.xml"]||g4(e),w4=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:[v4(n,t)],consumed:1}}return{nodes:[],consumed:0}},b4={handlerName:"tableNodeHandler",handler:w4};function v4(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}=D1(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:nt(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=M1(l,n),p=o.elements.find(k=>k.name==="w:tblW");p&&(c.tableWidth={width:nt(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=S4(k,t,g,l,e);b.content?.length&&x.push(b)}),{type:"table",content:x,attrs:c}}function x4(t,e,n,r,o=null,i,s,a){const{docx:l,nodeListHandler:c}=s,u=t.elements.find(N=>N.name==="w:tcPr"),d=u?.elements?.find(N=>N.name==="w:tcBorders"),f=k4(d,r),p=_1(n),h=u?.elements?.find(N=>N.name==="w:tcW");let m=h?nt(h.attributes["w:w"]):null;const y=h?.attributes["w:type"];!m&&o&&(m=o);const g=Sg(t),{attributes:x}=g||{},k={color:u?.elements?.find(N=>N.name==="w:shd")?.attributes["w:fill"]},b=u?.elements?.find(N=>N.name==="w:gridSpan")?.attributes["w:val"],T=u?.elements?.find(N=>N.name==="w:tcMar"),D=u?.elements?.find(N=>N.name==="w:vAlign")?.attributes["w:val"]||"top",M={},I=M1(i,l)||{};M.cellMargins=E4(T,I);const{fontSize:E,fonts:U={}}=I,oe=U.ascii;if(m){M.colwidth=[m],M.widthUnit="px";const N=p,W=p&&p.length>0,$=parseInt(b,10);if($&&$>1&&W){let J=[];for(let ie=0;ie<$;ie++){let G=N[a+ie];typeof G<"u"?J.push(G):J.push(100)}J.length&&(M.colwidth=[...J])}}if(y&&(M.widthType=y),b&&(M.colspan=parseInt(b,10)),k&&(M.background=k),M.verticalAlign=D,E&&(M.fontSize=E),oe&&(M.fontFamily=oe.ascii),r&&(M.borders={...r}),f&&(M.borders=Object.assign(M.borders||{},f)),x&&x["w:val"]==="restart"){const N=n.elements.filter(G=>G.name==="w:tr"),W=N.findIndex(G=>G===e),$=N.slice(W+1);let J=e.elements.filter(G=>G.name==="w:tc").findIndex(G=>G===t),ie=1;for(let G of $){const de=G.elements.findIndex(B=>B.name==="w:tc"),Y=G.elements[de+J];if(!Y)break;const ue=Sg(Y),{attributes:Z}=ue||{};if(!ue&&!Z||Z&&Z["w:val"]==="restart")break;ie++,G.elements.splice(de+J,1)}M.rowspan=ie}return{type:"tableCell",content:c.handler({...s,nodes:t.elements}),attrs:M}}const Sg=t=>t.elements.find(e=>e.name==="w:tcPr")?.elements?.find(e=>e.name==="w:vMerge"),na=(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=w1(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},k4=(t,e)=>{if(!t)return null;const n={},r=na(t,"bottom",e);r&&(n.bottom=r);const o=na(t,"top",e);o&&(n.top=o);const i=na(t,"left",e);i&&(n.left=i);const s=na(t,"right",e);return s&&(n.right=s),n};function M1(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=tA(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}=D1(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(I=>I.name==="w:left"),T=k.elements.find(I=>I.name==="w:right"),D=k.elements.find(I=>I.name==="w:top"),M=k.elements.find(I=>I.name==="w:bottom");r.cellMargins={marginLeft:b?.attributes["w:w"],marginRight:T?.attributes["w:w"],marginTop:D?.attributes["w:w"],marginBottom:M?.attributes["w:w"]}}}return r}function D1(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=w1(c)),["insideH","insideV"].includes(i)&&(n[i]=a),e[i]=a}),{borders:e,rowBorders:n}}function S4(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=nt(a));const c=_1(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 x4(d,t,e,l,p,r,o,f)})||[],attrs:i}}const E4=(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:nt(s??d),right:nt(a??f),top:nt(l??p),bottom:nt(c??h)}},_1=t=>t.elements.find(e=>e.name==="w:tblGrid")?.elements?.flatMap(e=>e.name!=="w:gridCol"?[]:nt(e.attributes["w:w"]))||[],C4=t=>{const{nodes:e,filename:n}=t,r=["w:drawing","w:p"];if(e.length===0||!r.includes(e[0].name))return{nodes:[],consumed:0};const o=e[0];let i;if(o.name==="w:drawing"?i=o:i=o.elements.find(u=>u.name==="w:drawing"),!i)return{nodes:[],consumed:0};let s;const{elements:a}=i,l=n||null;a.find(u=>u.name==="wp:anchor")&&(s=Eg(a[0],l,t));const c=a.find(u=>u.name==="wp:inline");return c&&(s=Eg(c,l,t)),{nodes:s?[s]:[],consumed:1}};function Eg(t,e,n){const{docx:r}=n,{attributes:o}=t,i={top:Gt(o.distT),bottom:Gt(o.distB),left:Gt(o.distL),right:Gt(o.distR)},s=t.elements.find(I=>I.name==="wp:extent"),a={width:Gt(s.attributes?.cx),height:Gt(s.attributes?.cy)},l=t.elements.find(I=>I.name==="a:graphic").elements.find(I=>I.name==="a:graphicData"),{uri:c}=l?.attributes;if(c&&c==="http://schemas.microsoft.com/office/word/2010/wordprocessingShape")return A4(n,t,l);const u=l.elements.find(I=>I.name==="pic:pic");if(!u||!u.elements)return null;const d=u.elements.find(I=>I.name==="pic:blipFill").elements.find(I=>I.name==="a:blip"),f=t.elements.find(I=>I.name==="wp:positionH")?.elements.find(I=>I.name==="wp:posOffset"),p=Gt(f?.elements[0]?.text),h=t.elements.find(I=>I.name==="wp:positionV")?.elements.find(I=>I.name==="wp:posOffset"),m=Gt(h?.elements[0]?.text),y={left:p,top:m},{attributes:g}=d,x=g["r:embed"];let k=r[`word/_rels/${e||"document.xml"}.rels`];k||(k=r["word/_rels/document.xml.rels"]);const b=k.elements.find(I=>I.name==="Relationships"),{elements:T}=b,D=T.find(I=>I.attributes.Id===x),{attributes:M}=D;return{type:"image",attrs:{src:`word/${M.Target}`,alt:"Image",inline:!0,padding:i,marginOffset:y,size:a,originalPadding:{distT:o.distT,distB:o.distB,distL:o.distL,distR:o.distR},rId:M.Id}}}const A4=(t,e,n)=>{const r=n.elements.find(l=>l.name==="wps:wsp"),o=r.elements.find(l=>l.name==="wps:txbx")?.elements?.find(l=>l.name==="w:txbxContent");e.elements.find(l=>l.name==="wp:docPr");const i=r.elements.find(l=>l.name==="wps:spPr"),s=i?.elements.find(l=>l.name==="a:prstGeom");if(s&&s.attributes.prst==="rect")return $4(t,i);if(!o)return null;const{nodeListHandler:a}=t;return a.handler({...t,node:o.elements[0],nodes:o.elements})[0]},$4=(t,e)=>{const n={},[r]=t.nodes;r?.name==="w:drawing"&&(n.drawingContent=r);const o=e.elements.find(u=>u.name==="a:xfrm"),i=o.elements.find(u=>u.name==="a:off"),s=o.elements.find(u=>u.name==="a:ext");e.elements.find(u=>u.name==="a:ln");const a=e.elements.find(u=>u.name==="a:solidFill"),l={top:Gt(i.attributes.y),left:Gt(i.attributes.x),width:Gt(s.attributes.cx),height:Gt(s.attributes.cy)};n.size=l;const c=a?.elements[0]?.attributes.val;return c&&(n.background="#"+c),{type:"contentBlock",attrs:n}},T4={handlerName:"drawingNodeHandler",handler:C4};function ri(t,e=[],n=null){const r=[],o=new Set;return t?.elements?.forEach(i=>{const s=Dr.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=M4(a.type,l,n);if(u==null)return;c.attrs={},c.attrs[a.property]=u}r.push(c)}})}),bd(r)}function O4(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=ri(n);return[{type:vt,attrs:{...o,before:i,after:[...e]}}]}function bd(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 M4(t,e,n){t==="tabs"&&(t="textIndent");const r={color:()=>`#${e["w:val"]}`,fontSize:()=>`${e["w:val"]/2}pt`,textIndent:()=>_4(e),fontFamily:()=>D4(e,n),lineHeight:()=>N4(e),textAlign:()=>e["w:val"],link:()=>e.href,underline:()=>e["w:val"],bold:()=>e?.["w:val"]||null,italic:()=>e?.["w:val"]||null,highlight:()=>I4(e)};if(t in r||console.debug("❗️❗️ No value mapper for:",t,"Attributes:",e),t in r)return r[t],r[t]()}function D4(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 _4(t){let e=t["w:left"];return e?`${Wt(e)}in`:null}function N4(t){const e=t["w:line"],n=t["w:lineRule"];return!e||e==="0"?null:n==="exact"?`${v1(e)}pt`:`${Go(e)}`}function I4(t){const e=t["w:fill"];return e&&e!=="auto"?`#${e}`:sA(t?.["w:val"])?`#${t["w:val"]}`:iA(t?.["w:val"])||null}function fo(t,e){const n=[],r=[],{attributes:o={},elements:i=[]}=t,{nodes:s,paragraphProperties:a={},runProperties:l={}}=F4(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(...ri(l,r)),a&&a.elements?.length&&n.push(...ri(a,r)),n.push(...O4(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 F4(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 Ba(t){return Dr.allowedElements[t.name||t.type]}const B4=t=>!!Dr.propertyTypes[t.name||t.type];function N1(t){return t.filter(e=>e.name==="w:r").some(e=>e.elements.some(n=>n.name==="w:t"))}const R4=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}=fo(r),a=n.handler({...t,insideTrackChange:!0,nodes:s}),l=o==="w:del"?ut:It,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}},L4={handlerName:"trackChangeNodeHandler",handler:R4},P4=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}},z4={handlerName:"hyperlinkNodeHandler",handler:P4},j4=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=q4(o,r);if(l){const{marks:u=[],attributes:d={}}=fo(i),f=u.find(m=>m.type==="textStyle"),p=f&&Object.keys(f.attrs).length>0;c.marks&&!p&&u.push(...c.marks),i.marks&&u.push(...i.marks);const h=bd(u);a=a.map(m=>{const y=m.marks||[];return{...m,marks:[...h,...y],attributes:d}})}else c.marks&&(a=a.map(u=>({...u,marks:bd(c.marks)})));return{nodes:a,consumed:1}},q4=(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?fo(r):{}},V4={handlerName:"runNodeHandler",handler:j4},U4=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=[]}=fo(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:Ba(r),text:l,attrs:{type:o,attributes:i||{}},marks:a}],consumed:1}},H4={handlerName:"textNodeHandler",handler:U4},I1=t=>{if(!t||!Array.isArray(t))return t;let e=[],n=null;for(let r of t)r.type==="text"?n&&W4(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},W4=(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].attrs||(n[o].attrs={}),r[o].attrs||(r[o].attrs={}),n[o].type!==r[o].type||Object.keys(n[o].attrs).length!==Object.keys(r[o].attrs).length||!G4(n[o].attrs,r[o].attrs))return!1;return!0},G4=(t={},e={})=>ti(t,e),K4=t=>{const{nodes:e,lists:n,docx:r}=t;if(e.length===0||e[0].name!=="w:p")return{nodes:[],consumed:0};const o=cn(e[0]),i=z1(o.elements);o.elements=i;const s=o.elements.find(a=>a.name==="w:pPr");if(vd(o,r)){const a=cn(e),l=[];let c=a.shift();for(;c&&vd(c,r);)l.push(c),c=a.shift(),c?.elements&&!N1(c.elements)&&(l.push(c),c=a.shift());return{nodes:[F1({listItems:l,params:t,originalPpr:s})],consumed:l.filter(u=>u.seen).length,lists:n}}else return{nodes:[],consumed:0,lists:n}},J4={handlerName:"listHandler",handler:K4};function F1({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(k=>k.handlerName==="standardNodeHandler")?.handler;if(!h)return console.error("Standard node handler not found"),{nodes:[],consumed:0};const m=t[0].elements.find(k=>k.name==="w:pPr")?.elements?.find(k=>k.name==="w:pStyle")?.attributes["w:val"],y=Vl({node:t[0],styleId:m,docx:l});i=oi(y),o=parseInt(y?.elements?.find(k=>k.name==="w:ilvl")?.attributes["w:val"])||0,o===void 0&&(o=B1(m,l));let g=0;for(let[k,b]of t.entries()){if(b.seen)continue;if(b.elements&&!N1(b.elements)){const A=h({...n,nodes:[b]}).nodes[0];A&&d[d.length-1]?.content.push(A),b.seen=!0;continue}const{attributes:T,elements:D,marks:M=[]}=fo(b),I=Kf(m,l)||{},{marks:E}=fo(I),U=M.find(A=>A.type==="textStyle"),oe=E?.find(A=>A.type==="textStyle"),{listType:N,listOrderingType:W,ilvl:$,listrPrs:J,listpPrs:ie,start:G,lvlText:de,lvlJc:Y,numId:ue}=Q4(b,r,l);p=W;const Z=parseInt($),B=o===Z&&ue===i,ee=Z4({firstListId:ue,secondListId:i,level:Z,pStyleId:null,docx:l}),te=ue!==i&&!ee,se=r<Z||r===Z&&te&&g===r;u[i]||(u[i]={}),u[i][r]||(u[i][r]=Number(G));const K={};if(B&&!se){f=N,b.seen=!0;const A=[];let C={type:"paragraph",content:c.handler({...n,nodes:[T.paragraphProperties,...D]})?.filter(S=>S)};C.content&&(C={...C,attrs:{textAlign:U?.attrs.textAlign||oe?.attrs.textAlign||null,rsidRDefault:T?.["w:rsidRDefault"]||null,styleId:m},content:I1(C.content)}),A.push(C),g=r;let H=[];if(p!=="bullet"&&(H=[...s,u[i][r]],u[i][o]++),!s.length&&o>0){const S=u[i];if(S){const re=[];Object.keys(S).forEach(Q=>{re.push(S[Q])}),H=re}}let P=b.elements.find(S=>S.name==="w:pPr")?.elements.find(S=>S.name==="w:ind");const F=I?.elements?.find(S=>S.name==="w:pPr")?.elements?.find(S=>S.name==="w:ind");if(P||(P=F),P){const S={};P.attributes||(P.attributes={}),P.attributes["w:left"]!==void 0&&(S.left=nt(P.attributes["w:left"])),P.attributes["w:right"]!==void 0&&(S.right=nt(P.attributes["w:right"])),P.attributes["w:firstLine"]!==void 0&&(S.firstLine=nt(P.attributes["w:firstLine"])),P.attributes["w:hanging"]!==void 0&&(S.hanging=nt(P.attributes["w:hanging"])),K.indent=S}ie&&(K.listParagraphProperties=ie),J&&(K.listRunProperties=J),K.textStyle=U,K.order=G,K.lvlText=de,K.lvlJc=U?.attrs.textAlign,K.listLevel=H,K.listNumberingType=W,K.attributes={parentAttributes:b?.attributes||null};const R=e?.elements?.find(S=>S.name==="w:rPr");R&&(K.attributes.originalInlineRunProps=R),K.numId=ue,l&&(K.spacing=L1(b,l,m));const le=Cg(A,K,[]);d.push(le)}else if(se){const A=[...s,u[i][r]],C=F1({listItems:t.slice(k),originalPpr:e,params:n,listLevel:r+1,actualListLevel:r,currentListNumId:ue,path:A,isNested:!0});g=C.lastNestedListLevel,delete C.lastNestedListLevel;const H=d[d.length-1];H?H.content.push(C):d.push(Cg([C],K,[]))}else if(ue){g=r,r>0&&b.elements[0].elements.find(A=>A.name==="w:numPr")&&(u[i][r]=0);break}else{b.seen=!0;const A=h({...n,nodes:[b]}).nodes[0];d[d.length-1]?.content.push(A)}}const x={type:f||"bulletList",content:d,attrs:{"list-style-type":p,listId:i,attributes:{parentAttributes:t[0]?.attributes||null}}};return a&&(x.lastNestedListLevel=g),x}const B1=(t,e)=>{const n=Kf(t,e)?.elements?.find(r=>r.name==="w:pPr")?.elements?.find(r=>r.name==="w:outlineLvl");try{return parseInt(n?.attributes["w:val"])}catch{}};function vd(t,e){const{elements:n}=t,r=n?.find(l=>l.name==="w:pPr");if(!r)return!1;const o=r.elements?.find(l=>l.name==="w:pStyle");let i=r.elements?.find(l=>l.name==="w:numPr"),s=oi(i);const a=o?.attributes["w:val"];return a&&!s&&(i=Vl({node:t,styleId:a,docx:e}),s=oi(i)),!!s}const oi=t=>t?.elements?.find(e=>e.name==="w:numId")?.attributes["w:val"];function Kf(t,e){const n=e["word/styles.xml"];return n?n.elements.find(r=>r.name==="w:styles").elements.filter(r=>r.name==="w:style").find(r=>r.attributes["w:styleId"]===t):{}}function Vl({node:t,styleId:e,docx:n,seenStyleIds:r=new Set}){let o=t?.elements?.find(l=>l.name==="w:pPr")?.elements?.find(l=>l.name==="w:numPr"),i=oi(o);if(i)return o;const s=Kf(e,n);o=s?.elements?.find(l=>l.name==="w:pPr")?.elements?.find(l=>l.name==="w:numPr"),i=oi(o);const a=s?.elements?.find(l=>l.name==="w:basedOn");if(!i&&!r.has(e)){const l=a?.attributes["w:val"];return r.add(e),l?Vl({styleId:l,docx:n,seenStyleIds:r}):null}return o}function Cg(t,e,n){return{type:"listItem",content:t,attrs:e,marks:n}}const X4=["decimal","decimalZero","lowerRoman","upperRoman","lowerLetter","upperLetter","ordinal","cardinalText","ordinalText","hex","chicago","none"],Y4=["bullet","square","circle","disc"],Z4=({firstListId:t,secondListId:e,level:n,pStyleId:r,docx:o})=>{const{numFmt:i,lvlText:s,lvlJc:a}=ol(t,n,r,o),{numFmt:l,lvlText:c,lvlJc:u}=ol(e,n,r,o);return i===l&&s===c&&a===u},Ag=(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=oi(a),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}},ol=(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}=Ag(n,r)||{};!t&&k&&(t=k),!e&&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=e6(u,e),f=u?.elements?.find(k=>k.name==="w:numStyleLink")?.attributes["w:val"];if(f){const k=Ag(f,r);return ol(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 Q4(t,e,n){if(!t)return;const{attributes:r={}}=t,{paragraphProperties:o={}}=r,{elements:i=[]}=o,s=t.elements.find(b=>b.name==="w:pPr")?.elements?.find(b=>b.name==="w:pStyle")?.attributes["w:val"],a=Vl({node:t,styleId:s,docx:n});if(!a)return{};const l=a?.elements.find(b=>b.name==="w:numId")?.attributes["w:val"],c=a?.elements.find(b=>b.name==="w:ilvl")?.attributes["w:val"]||B1(s,n),u=i.find(b=>b.name==="w:pStyle")?.attributes["w:val"],{start:d,numFmt:f,lvlText:p,lvlJc:h,pPr:m,rPr:y}=ol(l,e,u,n);let g,x;m&&(g=t6(m)),y&&(x=n6(y));let k;if(Y4.includes(f?.toLowerCase()))k="bulletList";else if(X4.includes(f))k="orderedList";else return{};return{listType:k,listOrderingType:f,ilvl:c,numId:l,listrPrs:x,listpPrs:g,start:d,lvlText:p,lvlJc:h}}function e6(t,e){return t?.elements?.find(n=>Number(n.attributes["w:ilvl"])===e)}function t6(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 n6(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 R1=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=cn(e[0]);let s,a=z1(i.elements);if(i.elements=a,vd(i,n))return{nodes:[],consumed:0};const l=r.handlerEntities.find(b=>b.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(b=>b.name==="w:pPr"),f=d?.elements?.find(b=>b.name==="w:pStyle"),p=d?.elements?.find(b=>b.name==="w:rPr"),h=d?.elements?.find(b=>b.name==="w:framePr");if(p){let b=ri(p,[]);if(!s.content?.length){let T=b?.findIndex(D=>D.type==="highlight");T!==-1&&b.splice(T,1)}s.attrs.marksAttrs=b}let m;if(f&&(m=f.attributes["w:val"],s.attrs.styleId=m),n){const b=r6(i,n,m);s.attrs.indent||(s.attrs.indent={}),(b.left||b.left===0)&&(s.attrs.indent.left=b.left),(b.right||b.right===0)&&(s.attrs.indent.right=b.right),(b.firstLine||b.firstLine===0)&&(s.attrs.indent.firstLine=b.firstLine),(b.hanging||b.hanging===0)&&(s.attrs.indent.hanging=b.hanging),(b.textIndent||b.textIndent===0)&&(s.attrs.textIndent=`${b.textIndent}in`)}const y=d?.elements?.find(b=>b.name==="w:jc");y&&y.attributes&&(s.attrs.textAlign=y.attributes["w:val"]);const g=d?.elements?.find(b=>b.name==="w:keepLines");g&&g.attributes&&(s.attrs.keepLines=g.attributes["w:val"]);const x=d?.elements?.find(b=>b.name==="w:keepNext");if(x&&x.attributes&&(s.attrs.keepNext=x.attributes["w:val"]),n){const b=i.attributes?.["w:rsidRDefault"];s.attrs.spacing=L1(i,n,m,s.attrs.marksAttrs),s.attrs.rsidRDefault=b}h&&h.attributes["w:dropCap"]&&(s.attrs.dropcap={type:h.attributes["w:dropCap"],lines:h.attributes["w:lines"],wrap:h.attributes["w:wrap"],hAnchor:h.attributes["w:hAnchor"],vAnchor:h.attributes["w:vAnchor"]}),s.attrs.filename=o,s&&s.content&&(s={...s,content:I1(s.content)});const k=d?.elements?.find(b=>b.name==="w:sectPr");return k&&(s.attrs.paragraphProperties||(s.attrs.paragraphProperties={}),s.attrs.paragraphProperties.sectPr=k,s.attrs.pageBreakSource="sectPr"),{nodes:s?[s]:[],consumed:1}},r6=(t,e,n="")=>{const r={left:0,right:0,firstLine:0,hanging:0,textIndent:0},{indent:o={}}=P1(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=nt(s)),a&&(r.right=nt(a)),l&&(r.firstLine=nt(l)),c&&(r.hanging=nt(c));const u=s-parseInt(c||0)||0;return u&&(r.textIndent=Wt(u)),r},L1=(t,e,n="",r=[])=>{const o={lineSpaceAfter:0,lineSpaceBefore:0,line:0,lineRule:null},{spacing:i={}}=P1(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=Go(f));const p=u?.["w:lineRule"]||c||i?.["w:lineRule"];p&&(o.lineRule=p),p==="exact"&&f&&(o.line=`${v1(f)}pt`);const h=u?.["w:before"]||a||i?.["w:before"];h&&(o.lineSpaceBefore=nt(h)),u?.["w:beforeAutospacing"]==="1"&&d&&(o.lineSpaceBefore+=Math.round(parseInt(d)*.5*96/72));const m=u?.["w:after"]||s||i?.["w:after"];return m&&(o.lineSpaceAfter=nt(m)),u?.["w:afterAutospacing"]==="1"&&d&&(o.lineSpaceAfter+=Math.round(parseInt(d)*.5*96/72)),o},P1=(t,e="")=>{const n=t["word/styles.xml"];if(!n)return{};const r=(n.elements[0].elements?.find(k=>k.name==="w:docDefaults")).elements.find(k=>k.name==="w:pPrDefault")?.elements?.find(k=>k.name==="w:pPr"),o=r?.elements?.find(k=>k.name==="w:spacing")||{},i=r?.elements?.find(k=>k.name==="w:ind")||{},s=n.elements[0].elements?.find(k=>k.name==="w:style"&&k.attributes["w:styleId"]==="Normal")?.elements?.find(k=>k.name==="w:pPr"),a=s?.elements?.find(k=>k.name==="w:spacing")||{},l=s?.elements?.find(k=>k.name==="w:ind")||{};let c={},u={},d={};if(e){const k=n.elements[0].elements?.find(b=>b.name==="w:style"&&b.attributes["w:styleId"]===e)?.elements?.find(b=>b.name==="w:pPr");c=k?.elements?.find(b=>b.name==="w:spacing")||{},u=k?.elements?.find(b=>b.name==="w:ind")||{},d=k?.elements?.find(b=>b.name==="w:jc")||{}}const{attributes:f}=o,{attributes:p}=a,{attributes:h}=c,{attributes:m}=d,{attributes:y}=i,{attributes:g}=l,{attributes:x}=u;return{spacing:h||f||p,indent:x||y||g,justify:m}},o6={handlerName:"paragraphNodeHandler",handler:R1};function i6(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(ie=>{const{attributes:G}=ie;return G&&G["w:styleId"]===t}),s=i[0];if(!s)return n;const a=i.find(ie=>ie.elements.find(G=>G.name==="w:qFormat")),l=i.find(ie=>ie.elements.some(G=>G.name==="w:name"))?.elements.find(ie=>ie.name==="w:name")?.attributes["w:val"],c=s.elements.find(ie=>ie.name==="w:pPr"),u=c?.elements?.find(ie=>ie.name==="w:spacing"),d=c?.elements?.find(ie=>ie.name==="w:jc"),f=c?.elements?.find(ie=>ie.name==="w:ind");let p,h,m;u&&(p=nt(u?.attributes["w:before"]),h=nt(u?.attributes["w:after"]),m=Go(u?.attributes["w:line"]));let y,g,x,k;f&&(y=d?.attributes["w:val"],g=nt(f?.attributes["w:left"]),x=nt(f?.attributes["w:right"]),k=nt(f?.attributes["w:firstLine"]));const b=c?.elements?.find(ie=>ie.name==="w:keepNext"),T=c?.elements?.find(ie=>ie.name==="w:keepLines"),D=c?.elements?.find(ie=>ie.name==="w:outlineLvl"),M=D?.attributes["w:val"],I=c?.elements?.find(ie=>ie.name==="w:pageBreakBefore");let E=0;I&&(I.attributes?.["w:val"]?E=Number(I?.attributes?.["w:val"]):E=1);const U=c?.elements?.find(ie=>ie.name==="w:pageBreakAfter");let oe;U&&(U.attributes?.["w:val"]?oe=Number(U?.attributes?.["w:val"]):oe=1);const N={name:l,qFormat:!!a,keepNext:!!b,keepLines:!!T,outlineLevel:D?parseInt(M):null,pageBreakBefore:!!E,pageBreakAfter:!!oe},W=s.elements.find(ie=>ie.name==="w:rPr"),$=ri(W,[],e)||{},J={spacing:{lineSpaceAfter:h,lineSpaceBefore:p,line:m},textAlign:y,indent:{leftIndent:g,rightIndent:x,firstLine:k}};return $.forEach(ie=>{const{type:G,attrs:de}=ie;if(G==="textStyle"){Object.entries(de).forEach(([Y,ue])=>{J[nl(Y)]=ue});return}J[G]=de}),{attrs:N,styles:J}}function z1(t){let e=[],n=[],r=!1;return t?.forEach(o=>{if(o.seen)return;o.seen=!0;const i=o.elements?.filter(s=>s.name==="w:fldChar")||[];if(i.length)if(i.length>1){const s=$g([o]);e.push(...s)}else{const s=i[0].attributes["w:fldCharType"];if(s==="begin")r=!0,n.push(o);else if(s==="end"){r=!1,n.push(o);const a=$g(n);e.push(...a),n=[]}}r?n.push(o):e.push(o)}),e}const $g=(t=[])=>{let e=[],n=!1,r=!1;const o=t.findIndex(c=>c.elements?.some(u=>u.name==="w:fldChar"&&u.attributes["w:fldCharType"]==="separate")),i=t.findIndex(c=>c.elements?.some(u=>u.name==="w:fldChar"&&u.attributes["w:fldCharType"]==="end")),s=t.slice(o+1,i),a=t.find(c=>c.elements?.some(u=>u.name==="w:instrText"))?.elements?.find(c=>c.name==="w:instrText")?.elements[0].text;n||(n=a?.trim().startsWith("PAGE")),r||(r=a?.trim().startsWith("NUMPAGES"));const l=a?.match(/HYPERLINK\s+"([^"]+)"/);if(n)e.push({name:"sd:autoPageNumber",type:"element"});else if(r)e.push({name:"sd:totalPageNumber",type:"element"});else if(l&&l?.length>=2){const c=l[1],u=[];s.forEach(f=>{const p=f.elements.find(m=>m.name==="w:rPr");if(!p)return;const{elements:h}=p;h.forEach(m=>{u.push(m)})});const d={name:"w:rPr",type:"element",elements:[{name:"link",attributes:{href:c}},...u]};e.push({name:"w:r",type:"element",elements:[d,...s]})}return e},s6=t=>nodeListHandler.handler({...t,nodes:node.elements}),a6=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(!Tg[r])return{nodes:[],consumed:0};const o=n?.elements.find(s=>s.name==="w:sdtContent"),i=Tg[r];return{nodes:i({...t,nodes:[o]}),consumed:1}},Tg={"Table of Contents":s6},l6=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}=c6(a);if(s?.elements.find(x=>x.name==="w:docPartObj"))return a6({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}},c6=(t={})=>{const e=t.elements?.find(i=>i.name==="w:r")?.elements?.find(i=>i.name==="w:rPr");if(!e)return{};const n=ri(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}},u6={handlerName:"annotationNodeHandler",handler:l6},d6=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=[]}=fo(o);if(i==="w:sdt")return{nodes:[],consumed:0};if(B4(o))return{nodes:[{type:Ba(o),attrs:{...s},marks:[]}],consumed:0};if(!Ba(o))return{nodes:[{type:i,content:a,attrs:{...s},marks:l}],consumed:0,unhandled:!0};const c=[],u=f6(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:Ba(o),content:c,attrs:{...s},marks:[]}],consumed:1}},f6=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},p6={handlerName:"standardNodeHandler",handler:d6},h6=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}},m6={handlerName:"lineBreakNodeHandler",handler:h6},g6=t=>{const{nodes:e,nodeListHandler:n,editor:r}=t;if(e.length===0||e[0].name!=="w:bookmarkStart")return{nodes:[],consumed:0};const o=e[0],i=n.handlerEntities.find(d=>d.handlerName==="standardNodeHandler")?.handler;if(!i)return console.error("Standard node handler not found"),{nodes:[],consumed:0};const s=r?.extensionService?.extensions?.filter(d=>d.isExternal===!0)||[],a=o.attributes["w:name"]?.split(";")[0],l=s.find(d=>d.name===a);if(l){const d=e.findIndex(y=>y.name==="w:bookmarkEnd"&&y.attributes["w:id"]===o.attributes["w:id"]),f=e.slice(1,d),p=t.nodeListHandler,h={};o.attributes["w:name"].split(";").forEach(y=>{const[g,x]=y.split("=");g&&x&&(h[g]=x)});const m=p.handler({...t,nodes:f});return m.forEach(y=>{y.marks.push({type:l.name,attrs:h})}),{nodes:m,consumed:m.length+2}}const c={...t,nodes:[o]},u=i(c);return u.nodes.length===1&&(u.nodes[0].attrs.name=o.attributes["w:name"],u.nodes[0].attrs.id=o.attributes["w:id"]),u},y6={handlerName:"bookmarkNodeHandler",handler:g6},w6=t=>{const e={nodes:[],consumed:0},{nodes:n,nodeListHandler:r,parentStyleId:o,docx:i}=t;if(n.length===0||n[0].name!=="w:p")return e;const s=n[0]?.elements?.find(d=>d.name==="w:r");if(!s?.elements?.some(d=>d.name==="mc:AlternateContent"))return e;const a=s.elements.find(d=>d.name==="mc:AlternateContent");s.elements.findIndex(d=>d.name==="mc:AlternateContent");const l=["wps","wp14","w14","w15"],c=a.elements.find(d=>d.name==="mc:Choice"&&l.includes(d.attributes.Requires));if(!c)return e;const u=c.elements;return{nodes:r.handler({...t,nodes:u}),consumed:1}},b6={handlerName:"alternateChoiceHandler",handler:w6},v6=t=>{const{nodes:e}=t;return e.length===0||e[0].name!=="sd:autoPageNumber"?{nodes:[],consumed:0}:{nodes:[{type:"page-number"}],consumed:1}},x6={handlerName:"autoPageNumberHandler",handler:v6},k6=t=>{const{nodes:e}=t;return e.length===0||e[0].name!=="sd:totalPageNumber"?{nodes:[],consumed:0}:{nodes:[{type:"total-page-number"}],consumed:1}},S6={handlerName:"autoTotalPageCountEntity",handler:k6},E6=t=>{const{nodes:e,docx:n,parentStyleId:r}=t;if(e.length===0||e[0].name!=="w:tab")return{nodes:[],consumed:0};const o=e[0],i=n["word/styles.xml"];if(i&&i.elements?.length){const a=i.elements[0]?.elements?.find(l=>l.attributes?.["w:styleId"]===r)?.elements?.find(l=>l.name==="w:pPr")?.elements?.find(l=>l.name==="w:tabs")?.elements?.find(l=>l.name==="w:tab");nt(a?.attributes?.["w:pos"])}const{attributes:s={}}=o;return{nodes:[{type:"tab",attrs:{tabSize:s["w:val"]||48},content:[]}],consumed:1}},C6={handlerName:"tabNodeHandler",handler:E6},A6=t=>{const{nodes:e}=t;if(!e.length||e[0].name!=="w:p")return{nodes:[],consumed:0};const[n]=e,r=n.elements?.find(l=>l.name==="w:r")?.elements?.find(l=>l.name==="w:pict");if(!r)return{nodes:[],consumed:0};const o=r,i=o.elements?.find(l=>l.name==="v:shape");o.elements?.find(l=>l.name==="v:shapetype");const s=o.elements?.find(l=>l.name==="v:group");if(!i&&!s)return{nodes:[],consumed:0};let a=null;return s&&!i?a=null:i.elements?.find(l=>l.name==="v:textbox")&&(a=$6({pict:r,pNode:n,shape:i,params:t})),{nodes:a?[a]:[],consumed:1}};function $6({pict:t,pNode:e,shape:n,params:r}){const o={},i={},s=n.attributes||{};o.attributes=s,s.fillcolor&&(o.fillcolor=s.fillcolor);const a=T6(s.style),l=O6(a);l&&(o.style=l);const c=n.elements?.find(f=>f.name==="v:textbox"),u=n.elements?.find(f=>f.name==="w10:wrap");u?.attributes&&(o.wrapAttributes=u.attributes),c?.attributes&&(i.attributes=c.attributes);const d=(c?.elements?.find(f=>f.name==="w:txbxContent")?.elements||[]).map(f=>R1({nodes:[f],docx:r.docx,nodeListHandler:fs()})).reduce((f,p)=>[...f,...p.nodes],[]);return{type:"shapeContainer",attrs:o,content:[{type:"shapeTextbox",attrs:i,content:d}]}}function T6(t){return t?t.split(";").filter(e=>!!e.trim()).reduce((e,n)=>{const[r,o]=n.split(":").map(i=>i.trim());return r&&o&&(e[r]=o),e},{}):{}}function O6(t){const e=["width","height"];let n="";for(const[r,o]of Object.entries(t))e.includes(r)&&(n+=`${r}: ${o};`);return n}const M6={handlerName:"handlePictNode",handler:A6};function D6({docx:t}){const e=fs(),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,D=e.handler({nodes:s.elements,nodeListHandler:e,docx:t}),{attrs:M}=D[0],I=M["w14:paraId"];return{commentId:p||bo(),importedId:l,creatorName:c,creatorEmail:u,createdTime:x,textJson:D[0],initials:d,paraId:I,trackedChange:h,trackedChangeText:y,trackedChangeType:m,trackedDeletedText:g}});return _6({docx:t,comments:i})}const _6=({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}=N6(a);let u;return c&&(u=e.find(d=>d.paraId===c)),{...s,isDone:l,parentCommentId:u?.commentId}})},N6=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}},I6=(t,e,n)=>{const r=cn(y4(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=fs(),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=D6({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:B6(s,t,e,n),comments:c,linkedStyles:R6(t),numbering:z6(t)}}return null},fs=()=>{const t=[b6,V4,M6,o6,J4,H4,m6,u6,y6,z4,T4,L4,b4,C6,x6,S6,p6];return{handler:F6(t),handlerEntities:t}},F6=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 B6(t,e,n,r){const o=t.elements?.find(s=>s.name==="w:sectPr"),i={};return o?.elements?.forEach(s=>{const{name:a,attributes:l}=s;switch(a){case"w:pgSz":i.pageSize={width:Wt(l["w:w"]),height:Wt(l["w:h"])};break;case"w:pgMar":i.pageMargins={top:Wt(l["w:top"]),right:Wt(l["w:right"]),bottom:Wt(l["w:bottom"]),left:Wt(l["w:left"]),header:Wt(l["w:header"]),footer:Wt(l["w:footer"]),gutter:Wt(l["w:gutter"])};break;case"w:cols":i.columns={space:Wt(l["w:space"]),num:l["w:num"],equalWidth:l["w:equalWidth"]};break;case"w:docGrid":i.docGrid={linePitch:Wt(l["w:linePitch"]),type:l["w:type"]};break;case"w:titlePg":n.headerIds.titlePg=!0}}),P6(e,n,r),i.alternateHeaders=j6(e),i}function R6(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=i6(s,t),l={id:i.attributes["w:styleId"],type:i.attributes["w:type"],definition:a,attributes:{}};o.push(l)}),o}function L6(t){if(!t)return null;const e=cn(t),{elements:n}=e.elements[0];return Object.keys(gg).forEach(r=>{if(!n.some(o=>o.attributes?.["w:styleId"]===r)){const o=gg[r];e.elements[0].elements.push(o)}}),e}const P6=(t,e,n)=>{const r=t["word/_rels/document.xml.rels"].elements.find(u=>u.name==="Relationships"),{elements:o}=r,i="http://schemas.openxmlformats.org/officeDocument/2006/relationships/header",s="http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer",a=o.filter(u=>u.attributes.Type===i),l=o.filter(u=>u.attributes.Type===s),c=(j1(t["word/document.xml"])||[]).flatMap(u=>u.elements);a.forEach(u=>{const{rId:d,referenceFile:f,currentFileName:p}=Og(u,t);let h=c.find(g=>g.name==="w:headerReference"&&g.attributes["r:id"]===d)?.attributes["w:type"];e.headerIds[h]&&(h=null);const m=fs(),y=m.handler({nodes:f.elements[0].elements,nodeListHandler:m,docx:t,converter:e,editor:n,filename:p});e.headerIds.ids||(e.headerIds.ids=[]),e.headerIds.ids.push(d),e.headers[d]={type:"doc",content:[...y]},h&&(e.headerIds[h]=d)}),l.forEach(u=>{const{rId:d,referenceFile:f,currentFileName:p}=Og(u,t),h=c.find(g=>g.name==="w:footerReference"&&g.attributes["r:id"]===d)?.attributes["w:type"],m=fs(),y=m.handler({nodes:f.elements[0].elements,nodeListHandler:m,docx:t,converter:e,editor:n,filename:p});e.footerIds.ids||(e.footerIds.ids=[]),e.footerIds.ids.push(d),e.footers[d]={type:"doc",content:[...y]},e.footerIds[h]=d})},j1=(t,e=[])=>{for(const n in t)t[n]==="w:sectPr"?e.push(t):typeof t[n]=="object"&&j1(t[n],e);return e},Og=(t,e)=>{const n=t.attributes.Id,r=t.attributes.Target,o=e[`word/${r}`];return{rId:n,referenceFile:o,currentFileName:r}};function z6(t){let e=t["word/numbering.xml"];(!e||!e.elements?.length||!e.elements[0].elements?.length)&&(e=x1);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 j6=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 Ro,q1,V1,U1,H1;const ji=class W1{constructor(e=null){V0(this,Ro),this.debug=e?.debug||!1,this.declaration=null,this.documentAttributes=null,this.convertedXml={},this.docx=e?.docx||[],this.media=e?.media||{},this.fonts=e?.fonts||{},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]=L6(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(Eb.xml2json(e,null,2))}static getStoredSuperdocVersion(e){try{const n=e.find(a=>a.name==="docProps/custom.xml");if(!n)return;const r=new W1,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.10.66"){const r="docProps/custom.xml";e[r]||(e[r]=G1());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=K1();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");if(!n.elements)return{};const r=n.elements[0].elements,o=r?.find(i=>i.name==="w:rFonts");if("elements"in n){const i=r.find(d=>d.name==="w:rFonts")?.attributes["w:asciiTheme"];let s,a,l;if(i){const d=this.getThemeInfo(i);s=d.typeface,a=d.panose}else o&&(s=o?.attributes["w:ascii"]);(e.elements[0].elements.filter(d=>d.name==="w:style"&&d.attributes["w:styleId"]==="Normal")||[]).forEach(d=>{const f=d.elements.find(p=>p.name==="w:rPr");s=f?.elements?.find(p=>p.name==="w:rFonts")?.attributes["w:ascii"],l=Number(f?.elements?.find(p=>p.name==="w:sz")?.attributes["w:val"])/2});const c=l||Number(r.find(d=>d.name==="w:sz")?.attributes["w:val"])/2||12,u=r.find(d=>d.name==="w:kern")?.attributes["w:val"];return{fontSizePt:c,kern:u,typeface:s,panose:a}}}getDocumentFonts(){const e=this.convertedXml["word/fontTable.xml"];if(!e||!Object.keys(this.fonts).length)return;const n=e.elements.find(s=>s.name==="w:fonts")?.elements.filter(s=>s.elements?.some(a=>a?.attributes&&a.attributes["r:id"]&&a.attributes["w:fontKey"]))?.reduce((s,a)=>{const l=a.elements.filter(c=>c.name.startsWith("w:embed"))?.map(c=>({...c,fontFamily:a.attributes["w:name"]}));return[...s,...l]},[]),r=this.convertedXml["word/_rels/fontTable.xml.rels"]?.elements.find(s=>s.name==="Relationships")||{},{elements:o}=r;let i="";for(const s of n){const a=o.find(y=>y.attributes.Id===s.attributes["r:id"])?.attributes?.Target;if(!a)return;const l=this.fonts[`word/${a}`]?.buffer;if(!l)return;const c=cA(l,s.attributes["w:fontKey"]);if(!c)return;const u=new Blob([c],{type:"font/ttf"}),d=URL.createObjectURL(u),f=s.name.includes("Regular"),p=s.name.includes("Bold"),h=s.name.includes("Italic"),m=s.name.includes("Light");i+=`
|
|
30
|
+
`))}})}function _C(t,e,n){let r=t.resolve(e),o=r.index();return r.parent.canReplaceWith(o,o+1,n)}function NC(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 Zt(e,e+i.nodeSize,e+1,e+i.nodeSize-1,new xe(be.from(s),0,0),1,!0))}function er(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 IC(t,e,n=1,r){let o=t.doc.resolve(e),i=be.empty,s=be.empty;for(let a=o.depth,l=o.depth-n,c=n-1;a>l;a--,c--){i=be.from(o.node(a).copy(i));let u=r&&r[c];s=be.from(u?u.type.create(u.attrs,s):o.node(a).copy(s))}t.step(new $t(e,e,new xe(i.append(s),n,n),!0))}function Br(t,e){let n=t.resolve(e),r=n.index();return t1(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function FC(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 t1(t,e){return!!(t&&e&&!t.isLeaf&&FC(t,e))}function n1(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&&t1(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 BC(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);e1(t,u.node(),u.before(),a)}s.inlineContent&&Hf(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),xe.empty,!0)),r===!0){let u=t.doc.resolve(c);Qb(t,u.node(),u.before(),t.steps.length)}return t}function RC(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 r1(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 Wf(t,e,n=e,r=xe.empty){if(e==n&&!r.size)return null;let o=t.resolve(e),i=t.resolve(n);return o1(o,i,r)?new $t(e,n,r):new LC(o,i,r).fit()}function o1(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}let LC=class{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=be.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=be.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 xe(i,s,a);return e>-1?new Zt(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=iu(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(be.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=iu(e,n);return!o.childCount||o.firstChild.isLeaf?!1:(this.unplaced=new xe(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=iu(e,n);if(o.childCount<=1&&n>0){let i=e.size-n<=n+o.size;this.unplaced=new xe(Fi(e,n-1,1),n-1,i?n-1:r)}else this.unplaced=new xe(Fi(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(i1(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=Bi(this.placed,n,be.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?xe.empty:new xe(Fi(s.content,e-1,1),e-1,p<0?s.openEnd:e-1):new xe(Fi(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||!su(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=su(e,n,o,r,i);if(s){for(let a=n-1;a>=0;a--){let{match:l,type:c}=this.frontier[a],u=su(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=Bi(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=Bi(this.placed,this.depth,be.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let e=this.frontier.pop().match.fillBefore(be.empty,!0);e.childCount&&(this.placed=Bi(this.placed,this.frontier.length,e))}};function Fi(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(Fi(t.firstChild.content,e-1,n)))}function Bi(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(Bi(t.lastChild.content,e-1,n)))}function iu(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function i1(t,e,n){if(e<=0)return t;let r=t.content;return e>1&&(r=r.replaceChild(0,i1(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(be.empty,!0)))),t.copy(r)}function su(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&&!PC(n,i.content,s)?a:null}function PC(t,e,n){for(let r=n;r<e.childCount;r++)if(!t.allowsMarks(e.child(r).marks))return!0;return!1}function zC(t){return t.spec.defining||t.spec.definingForContent}function jC(t,e,n,r){if(!r.size)return t.deleteRange(e,n);let o=t.doc.resolve(e),i=t.doc.resolve(n);if(o1(o,i,r))return t.step(new $t(e,n,r));let s=a1(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=zC(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 xe(s1(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 s1(t,e,n,r,o){if(e<n){let i=t.firstChild;t=t.replaceChild(0,i.copy(s1(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(be.empty,!0))}return t}function qC(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let o=RC(t.doc,e,r.type);o!=null&&(e=n=o)}t.replaceRange(e,n,new xe(be.from(r),0,0))}function VC(t,e,n){let r=t.doc.resolve(e),o=t.doc.resolve(n),i=a1(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 a1(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 l1=class Na extends Bt{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 xe(be.from(o),0,n.isLeaf?0:1))}getMap(){return uo.empty}invert(e){return new Na(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 Na(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 Na(n.pos,n.attr,n.value)}};Bt.jsonID("attr",l1);let c1=class gd extends Bt{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 uo.empty}invert(e){return new gd(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 gd(n.attr,n.value)}};Bt.jsonID("docAttr",c1);let ei=class extends Error{};ei=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};ei.prototype=Object.create(Error.prototype);ei.prototype.constructor=ei;ei.prototype.name="TransformError";let u1=class{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Qo}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new ei(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=xe.empty){let o=Wf(this.doc,e,n,r);return o&&this.step(o),this}replaceWith(e,n,r){return this.replace(e,n,new xe(be.from(r),0,0))}delete(e,n){return this.replace(e,n,xe.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return jC(this,e,n,r),this}replaceRangeWith(e,n,r){return qC(this,e,n,r),this}deleteRange(e,n){return VC(this,e,n),this}lift(e,n){return $C(this,e,n),this}join(e,n=1){return BC(this,e,n),this}wrap(e,n){return MC(this,e,n),this}setBlockType(e,n=e,r,o=null){return DC(this,e,n,r,o),this}setNodeMarkup(e,n,r=null,o){return NC(this,e,n,r,o),this}setNodeAttribute(e,n,r){return this.step(new l1(e,n,r)),this}setDocAttribute(e,n){return this.step(new c1(e,n)),this}addNodeMark(e,n){return this.step(new Vf(e,n)),this}removeNodeMark(e,n){if(!(n instanceof Je)){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 Uf(e,n)),this}split(e,n=1,r){return IC(this,e,n,r),this}addMark(e,n,r){return EC(this,e,n,r),this}removeMark(e,n,r){return CC(this,e,n,r),this}clearIncompatible(e,n,r){return Hf(this,e,n,r),this}};const au=Object.create(null);let Le=class{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new d1(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=xe.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?xe.empty:n),a==0&&ug(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),ug(e,r,n.isInline?-1:1))}}static findFrom(e,n,r=!1){let o=e.parent.inlineContent?new je(e):Fo(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?Fo(e.node(0),e.node(i),e.before(i+1),e.index(i),n,r):Fo(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 Fo(e,e,0,0,1)||new _n(e)}static atEnd(e){return Fo(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=au[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 au)throw new RangeError("Duplicate use of selection JSON ID "+e);return au[e]=n,n.prototype.jsonID=e,n}getBookmark(){return je.between(this.$anchor,this.$head).getBookmark()}};Le.prototype.visible=!0;let d1=class{constructor(e,n){this.$from=e,this.$to=n}},lg=!1;function cg(t){!lg&&!t.parent.inlineContent&&(lg=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}let je=class Ri extends Le{constructor(e,n=e){cg(e),cg(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 Le.near(r);let o=e.resolve(n.map(this.anchor));return new Ri(o.parent.inlineContent?o:r,r)}replace(e,n=xe.empty){if(super.replace(e,n),n==xe.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof Ri&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new f1(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 Ri(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=Le.findFrom(n,r,!0)||Le.findFrom(n,-r,!0);if(i)n=i.$head;else return Le.near(n,r)}return e.parent.inlineContent||(o==0?e=n:(e=(Le.findFrom(e,-r,!0)||Le.findFrom(e,r,!0)).$anchor,e.pos<n.pos!=o<0&&(e=n))),new Ri(e,n)}};Le.jsonID("text",je);let f1=class p1{constructor(e,n){this.anchor=e,this.head=n}map(e){return new p1(e.map(this.anchor),e.map(this.head))}resolve(e){return je.between(e.resolve(this.anchor),e.resolve(this.head))}},Ie=class Li extends Le{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?Le.near(i):new Li(i)}content(){return new xe(be.from(this.node),0,0)}eq(e){return e instanceof Li&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new UC(this.anchor)}static fromJSON(e,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new Li(e.resolve(n.anchor))}static create(e,n){return new Li(e.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}};Ie.prototype.visible=!1;Le.jsonID("node",Ie);let UC=class h1{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:r}=e.mapResult(this.anchor);return n?new f1(r,r):new h1(r)}resolve(e){let n=e.resolve(this.anchor),r=n.nodeAfter;return r&&Ie.isSelectable(r)?new Ie(n):Le.near(n)}},_n=class Ia extends Le{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,n=xe.empty){if(n==xe.empty){e.delete(0,e.doc.content.size);let r=Le.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,n)}toJSON(){return{type:"all"}}static fromJSON(e){return new Ia(e)}map(e){return new Ia(e)}eq(e){return e instanceof Ia}getBookmark(){return HC}};Le.jsonID("all",_n);const HC={map(){return this},resolve(t){return new _n(t)}};function Fo(t,e,n,r,o,i=!1){if(e.inlineContent)return je.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&&Ie.isSelectable(a))return Ie.create(t,n-(o<0?a.nodeSize:0))}else{let l=Fo(t,a,n+o,o<0?a.childCount:0,o,i);if(l)return l}n+=a.nodeSize*o}return null}function ug(t,e,n){let r=t.steps.length-1;if(r<e)return;let o=t.steps[r];if(!(o instanceof $t||o instanceof Zt))return;let i=t.mapping.maps[r],s;i.forEach((a,l,c,u)=>{s==null&&(s=u)}),t.setSelection(Le.near(t.doc.resolve(s),n))}const dg=1,fg=2,pg=4;let WC=class extends u1{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|dg)&-3,this.storedMarks=null,this}get selectionSet(){return(this.updated&dg)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=fg,this}ensureMarks(e){return Je.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&fg)>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)||Je.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(Le.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|=pg,this}get scrolledIntoView(){return(this.updated&pg)>0}};function hg(t,e){return!e||!t?t:t.bind(e)}let Pi=class{constructor(e,n,r){this.name=e,this.init=hg(n.init,r),this.apply=hg(n.apply,r)}};const GC=[new Pi("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new Pi("selection",{init(t,e){return t.selection||Le.atStart(e.doc)},apply(t){return t.selection}}),new Pi("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new Pi("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];let lu=class{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=GC.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 Pi(r.key,r.spec.state,r))})}},Ji=class zi{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 zi(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 WC(this)}static create(e){let n=new lu(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new zi(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 lu(this.schema,e.plugins),r=n.fields,o=new zi(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 lu(e.schema,e.plugins),i=new zi(o);return o.fields.forEach(s=>{if(s.name=="doc")i.doc=to.fromJSON(e.schema,n.doc);else if(s.name=="selection")i.selection=Le.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 m1(t,e,n){for(let r in t){let o=t[r];o instanceof Function?o=o.bind(e):r=="handleDOMEvents"&&(o=m1(o,e,{})),n[r]=o}return n}let Xe=class{constructor(e){this.spec=e,this.props={},e.props&&m1(e.props,this,this.props),this.key=e.key?e.key.key:g1("plugin")}getState(e){return e[this.key]}};const cu=Object.create(null);function g1(t){return t in cu?t+"$"+ ++cu[t]:(cu[t]=0,t+"$")}let et=class{constructor(e="key"){this.key=g1(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}};const nl=t=>t.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`),KC=t=>nl(t),Fa=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"}),JC={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 We(t,e=null,...n){return typeof t=="function"?e?t.bind(e)(...n):t(...n):t}function XC(t={}){return Object.keys(t).length===0&&t.constructor===Object}const YC=()=>typeof navigator<"u"?/Mac/.test(navigator.platform):!1,ZC=()=>["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform),y1=t=>Object.prototype.toString.call(t)==="[object RegExp]";function ti(t,e,n={strict:!0}){const r=Object.keys(e);return r.length?r.every(o=>n.strict?e[o]===t[o]:y1(e[o])?e[o].test(t[o]):e[o]===t[o]):!0}function mg(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 QC=/[\d-.]+(\w+)$/,eA=["px","rem","em","in","q","mm","cm","pt","pc","vh","vw","vmin","vmax"];function tr(t="0"){const e=t.toString()||"0",n=Number.parseFloat(e),r=(e.match(QC)?.[1]??"").toLowerCase();return[n,eA.includes(r)?r:null]}function rl(t=0,e=0,n=0){return Math.min(Math.max(t,e),n)}function ni(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 nt(t){if(t!=null)return t=Wt(t),Math.round(t*96)}function lt(t){if(t!=null)return t=t/96,ni(t)}function Go(t){if(t!=null)return t/240}function yd(t){if(t!=null)return t*240}function tA(t){if(t!=null)return Math.round(t/2)}function Gt(t){if(t==null)return;typeof t=="string"&&(t=parseFloat(t));const e=t*96/914400;return Math.round(e)}function Ei(t){if(t!=null)return typeof t=="string"&&(t=parseFloat(t)),Math.round(t*9525)}function w1(t){return t==null?void 0:parseFloat(t)/8*1.3333}function b1(t){if(t!=null)return Math.round(t*6)}function v1(t){if(t!=null)return t/20}function nA(t){if(t!=null)return t*20}const rA=async t=>{const e=t.includes(",")?t.split(",",2)[1]:t;if(typeof globalThis.atob=="function"){const r=globalThis.atob(e),o=r.length,i=new Uint8Array(o);for(let s=0;s<o;s++)i[s]=r.charCodeAt(s);return i.buffer}const n=pt.from(e,"base64");return n.buffer.slice(n.byteOffset,n.byteOffset+n.byteLength)},oA=t=>{const e=new window.DOMParser().parseFromString(t,"text/xml").querySelectorAll("Default");return Array.from(e).map(n=>n.getAttribute("Extension"))},iA=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 sA(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 aA=t=>{const e=Number(t).toString(16);return e.length===1?"0"+e:e},lA=t=>"#"+t.match(/\d+/g).map(aA).join(""),zl=(t,e,n="",r=!1)=>{let[o,i]=tr(t);return Number.isNaN(o)||o===0?{}:n==="atLeast"&&o<1?{}:(i=i||e,o+=i?4:.2,r?{"line-height":`${o}${i}`}:`line-height: ${o}${i}`)},cA=(t,e)=>{const n=new Uint8Array(t),r=e.replace(/[-{}]/g,"");if(r.length!==32){console.error("Invalid GUID");return}const o=new Uint8Array(16);for(let i=0,s=0;i<32;i+=2,s++){const a=r[i]+r[i+1];o[s]=parseInt(a,16)}for(let i=0;i<32;i++){const s=15-i%16;n[i]^=o[s]}return n.buffer};function Xn(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 Gf(){return Math.floor(Math.random()*2147483647).toString(16).toUpperCase().padStart(8,"0")}const uA={"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"},dA={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:[]}]},fA={elements:[{type:"element",name:"w:settings",attributes:{"xmlns:w":"http://schemas.openxmlformats.org/wordprocessingml/2006/main"},elements:[]}]},pA={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"}]},gg={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"}}]}]}},hA={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:[]}]},mA={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:[]}]},gA={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:[]}]},yA={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:[]}]},wA={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"}}]}]},bA={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"}}]}]},Bo={COMMENTS_XML_DEF:hA,COMMENTS_EXTENDED_XML_DEF:mA,COMMENTS_EXTENSIBLE_XML_DEF:gA,COMMENTS_IDS_XML_DEF:yA,DOCUMENT_RELS_XML_DEF:wA,CONTENT_TYPES:bA},It="trackInsert",ut="trackDelete",vt="trackFormat",cn=t=>{if(t)try{return JSON.parse(JSON.stringify(t))}catch(e){console.error("Error in carbonCopy",t,e);return}},vA={attributes:{"w:abstractNumId":"1"}},xA={attributes:{"w:abstractNumId":"0"}},x1={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 yg(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=kA(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 kA=(t,e)=>({name:`w:commentRange${t}`,attributes:{"w:id":String(e)}}),SA=t=>({...t,commentParaId:Gf()}),EA=(t,e,n)=>{const r=E1({node:t.commentJSON}),o={"w:id":String(e),"w:author":t.creatorName||t.importedAuthor?.name,"w:email":t.creatorEmail||t.importedAuthor?.email,"w:date":k1(t.createdTime),"w:initials":CA(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]}},CA=t=>t?t.replace("(imported)","").trim().split(" ").map(e=>e[0]).join(""):null,k1=t=>new Date(t||Date.now()).toISOString().replace(/\.\d{3}Z$/,"Z"),AA=(t=[],e)=>{const n=cn(e);return t.forEach(r=>{r.elements[0].elements.unshift(pA);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},$A=(t=[],e)=>{const n=cn(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},TA=(t=[],e,n)=>{const r=cn(e),o=cn(n);return r.elements[0].elements=[],o.elements[0].elements=[],t.forEach(i=>{const s=Gf(),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":k1()}};o.elements[0].elements.push(l)}),{documentIdsUpdated:r,extensibleUpdated:o}},OA=t=>{const e=cn(t);return e["word/comments.xml"]=Bo.COMMENTS_XML_DEF,e["word/commentsExtended.xml"]=Bo.COMMENTS_EXTENDED_XML_DEF,e["word/commentsExtensible.xml"]=Bo.COMMENTS_EXTENSIBLE_XML_DEF,e["word/commentsIds.xml"]=Bo.COMMENTS_IDS_XML_DEF,e["[Content_Types].xml"]=Bo.CONTENT_TYPES,e},MA=t=>{const e=cn(t);return delete e["word/comments.xml"],delete e["word/commentsExtended.xml"],delete e["word/commentsExtensible.xml"],delete e["word/commentsIds.xml"],e},ta=t=>({...Bo.DOCUMENT_RELS_XML_DEF.elements[0].elements.find(e=>e.attributes.Target===t)}),DA=({convertedXml:t,defs:e,commentsWithParaIds:n,exportType:r,converter:o})=>{const i=[];if(r==="clean")return{documentXml:MA(t),relationships:i};const s=OA(t);s["word/comments.xml"]=AA(e,s["word/comments.xml"]),i.push(ta("comments.xml")),s["word/commentsExtended.xml"]=$A(n,s["word/commentsExtended.xml"]),i.push(ta("commentsExtended.xml"));const{documentIdsUpdated:a,extensibleUpdated:l}=TA(n,s["word/commentsIds.xml"],s["word/commentsExtensible.xml"]);return s["word/commentsIds.xml"]=a,s["word/commentsExtensible.xml"]=l,i.push(ta("commentsIds.xml")),i.push(ta("commentsExtensible.xml")),{relationships:i,documentXml:s}},wd=(t,e)=>e?["width",`${Math.max(e,t)}px`]:["min-width",`${t}px`],S1=(t,e,n,r)=>{let o=0,i=!0;const s=[],a=[],l=t.firstChild;if(!l)return{};for(let p=0,h=0;p<l.childCount;p++){const{colspan:m,colwidth:y}=l.child(p).attrs;for(let g=0;g<m;g++,h++){const x=n===h?r:y&&y[g];o+=x||e,x||(i=!1);const[k,b]=wd(e,x);s.push(["col",{style:`${k}: ${b}`}]),a.push(parseInt(b,10))}}const c=i?`${o}px`:"",u=i?"":`${o}px`,d=["colgroup",{},...s],f=[...a];return{colgroup:d,tableWidth:c,tableMinWidth:u,colgroupValues:f}};function wi(t){const{type:e}=t.node||{},n={doc:IA,body:_A,paragraph:E1,text:FA,bulletList:bg,orderedList:bg,lineBreak:VA,table:UA,tableRow:XA,tableCell:ZA,bookmarkStart:t4,fieldAnnotation:c4,tab:WA,image:$1,hardBreak:u4,commentRangeStart:()=>yg(t,"Start"),commentRangeEnd:()=>yg(t,"End"),commentReference:()=>null,shapeContainer:d4,shapeTextbox:f4,contentBlock:p4};return n[e]?n[e](t):(console.error("No translation function found for node type:",e),null)}function _A(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=ni(s);o[`w:${i}`]=a}),r.attributes=o}return{name:"w:body",elements:[...Rr(t),e]}}function E1(t){const e=Rr(t),n=e.find(i=>i.name==="htmlAnnotation");if(e.length===1&&n)return n.elements;const r=NA(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 NA(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,lineHeight:l,marksAttrs:c,keepLines:u,keepNext:d,dropcap:f}=e;if(o){const{lineSpaceBefore:h,lineSpaceAfter:m,line:y,lineRule:g}=o,x={};h>=0&&(x["w:before"]=lt(h)),m>=0&&(x["w:after"]=lt(m)),g==="exact"?l&&(x["w:line"]=nA(parseFloat(l))):l&&(x["w:line"]=yd(l)),x["w:lineRule"]=g||"auto";const k={name:"w:spacing",attributes:x};n.push(k)}if(l&&!o){const h={name:"w:spacing",attributes:{"w:line":yd(l)}};n.push(h)}if(i){const{left:h,right:m,firstLine:y,hanging:g}=i,x={};(h||h===0)&&(x["w:left"]=lt(h)),(m||m===0)&&(x["w:right"]=lt(m)),(y||y===0)&&(x["w:firstLine"]=lt(y)),(g||g===0)&&(x["w:hanging"]=lt(g)),a&&!x["w:left"]&&(x["w:left"]=ni(a));const k={name:"w:ind",attributes:x};n.push(k)}else if(a){const h={name:"w:ind",attributes:{"w:left":ni(a)}};n.push(h)}if(s){const h={name:"w:jc",attributes:{"w:val":s}};n.push(h)}if(c){const h=ql(c),m=C1(h);n.push(m)}u&&n.push({name:"w:keepLines",attributes:{"w:val":u}}),d&&n.push({name:"w:keepNext",attributes:{"w:val":d}}),f&&n.push({name:"w:framePr",attributes:{"w:dropCap":f.type,"w:lines":f.lines,"w:wrap":f.wrap,"w:vAnchor":f.vAnchor,"w:hAnchor":f.hAnchor}});const p=t.attrs?.paragraphProperties?.sectPr;return p&&n.push(p),n.length?{name:"w:pPr",elements:n}:null}function IA(t){const e={type:"body",content:t.node.content};return[{name:"w:document",elements:[wi({...t,node:e})],attributes:uA},t]}function Rr(t){const{content:e}=t.node;if(!e)return[];const n=[];return e.forEach(r=>{const o=wi({...t,node:r});o instanceof Array?n.push(...o):n.push(o)}),n.filter(r=>r)}function jl(t,e,n){const r=/^\s|\s$/.test(t)?"preserve":null,o=r?{"xml:space":r}:null,i=[],s=ql(e);if(i.push({name:"w:t",elements:[{text:t,type:"text"}],attributes:o}),n){const{editor:a}=n,l=a.extensionService.extensions.filter(c=>c.isExternal===!0);e.forEach(c=>{const u=l.some(f=>{const p=f.name;return c.type===p});if(!u)return;let d="";Object.entries(c.attrs).forEach(([f,p])=>{p&&(d+=`${f}=${p};`)}),u&&(i.unshift({type:"element",name:"w:bookmarkStart",attributes:{"w:id":"5000","w:name":c.type+";"+d}}),i.push({type:"element",name:"w:bookmarkEnd",attributes:{"w:id":"5000"}}))})}return zs(i,s)}function FA(t){const{node:e}=t,n=[It,ut];if(e.marks?.some(i=>n.includes(i.type)))return RA(t);if(e.marks?.some(i=>i.type==="link"))return LA(t);const{text:r,marks:o=[]}=e;return jl(r,o,t)}function BA(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=>ql([n])).filter(n=>n!==void 0)}}function RA(t){const{node:e}=t,n=e.marks,r=[It,ut,vt],o=n.find(l=>r.includes(l.type)),i=o.type===It,s=BA(n);e.marks=n.filter(l=>!r.includes(l.type)),s&&e.marks.push(s);const a=wi({...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 zs(t,e){let n=[];return Array.isArray(t)?n=t:n=[t],e&&e.length&&n.unshift(C1(e)),{name:"w:r",elements:n}}function C1(t=[]){return{name:"w:rPr",elements:t.filter(e=>!!Object.keys(e).length)}}function ql(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 vg(o)}):vg(e))}function LA(t){const{node:e}=t,n=e.marks.find(s=>s.type==="link"),r=n.attrs.href;let o=n.attrs.rId;o||(o=A1(t,r)),e.marks=e.marks.filter(s=>s.type!=="link");const i=wi({...t,node:e});return{name:"w:hyperlink",type:"element",attributes:{"r:id":o},elements:[i]}}function A1(t,e){const n="rId"+Xn();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 wg(t,e){const n="rId"+Xn(),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 bg(t){const{type:e}=t.node,n=qA(t),r=[];return n.forEach(o=>{const{level:i,listType:s,pPrs:a,content:l,attrs:c={}}=o,u=(o.attrs.numId||o.listId)??PA(t,s),d=jA(i,u,a);l.forEach((f,p)=>{const h=Object.assign({},f);h.attrs={...h.attrs,...o.attrs};const m=wi({...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={name:"w:p",type:"element",elements:f.attrs.paragraphProperties?[f.attrs.paragraphProperties]:[]};return r.push(k)}const{attributes:g}=c,{originalInlineRunProps:x}=g||{};if(x&&d.elements.push(x),y===-1)m.elements.unshift(cn(d));else{const k=cn(d).elements.map(b=>m.elements[y].elements.find(D=>D.name===b.name)||b);m.elements[y].elements=k}if(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 PA(t,e){const n=zA(t.converter?.numbering?.definitions),r=e==="bullet"?xA:vA,o=n,i=r.attributes["w:abstractNumId"],s={type:"element",name:"w:num",attributes:{"w:numId":String(o),"w16cid:durableId":"485517411"},elements:[{name:"w:abstractNumId",attributes:{"w:val":String(i)}}]};return t.converter.numbering.definitions[o]=s,o}const zA=t=>!t||!Object.keys(t).length?0:Math.max(...Object.keys(t).map(e=>parseInt(e,10)))+1;function jA(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 qA({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"]=lt(g)),x!==void 0&&(T["w:right"]=lt(x)),k!==void 0&&(T["w:firstLine"]=lt(k)),b!==void 0&&(T["w:hanging"]=lt(b));const D={type:"element",name:"w:ind",attributes:T},M=a.findIndex(I=>I.name==="w:ind");M!==-1&&(a[M]=D)}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 VA(t){const e={},{lineBreakType:n}=t.node?.attrs||{};return n&&(e["w:type"]=n),{name:"w:br",attributes:e}}function UA(t){t.node=HA(t.node,t);const e=Rr(t),n=GA(t.node),r=JA(t.node,t);return e.unshift(n),e.unshift(r),{name:"w:tbl",elements:e}}function HA(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 WA(t){const{marks:e=[]}=t.node,n=ql(e);return zs({name:"w:tab"},n)}function GA(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=KA(t);e.push(u)}if(a){const{width:u,type:d}=a,f={name:"w:tblInd",attributes:{"w:w":lt(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":lt(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 KA(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":b1(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 JA(t,e){const{editorSchema:n}=e;let r=[];try{const i=n.nodeFromJSON(t),s=25,{colgroupValues:a}=S1(i,s);r=a}catch{r=[]}const o=[];return r?.forEach(i=>{o.push({name:"w:gridCol",attributes:{"w:w":lt(i)}})}),{name:"w:tblGrid",elements:o}}function XA(t){const e=Rr(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":lt(r)};o&&(i["w:hRule"]=o);const s={name:"w:trHeight",attributes:i};n.push(s)}return{name:"w:trPr",elements:n}}function ZA(t){const e=Rr({...t,tableCell:t.node}),n=QA(t.node);return e.unshift(n),{name:"w:tc",elements:e}}function QA(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"?lt(c):ni(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:e4(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":b1(g.size),"w:space":g.space||0}}:{name:`w:${y}`,attributes:{"w:val":"nil"}})};e.push(m)}return{name:"w:tcPr",elements:e}}function e4(t){const e=[],{top:n,right:r,bottom:o,left:i}=t;return n!=null&&e.push({name:"w:top",attributes:{"w:w":lt(n)}}),r!=null&&e.push({name:"w:right",attributes:{"w:w":lt(r)}}),o!=null&&e.push({name:"w:bottom",attributes:{"w:w":lt(o)}}),i!=null&&e.push({name:"w:left",attributes:{"w:w":lt(i)}}),e}function t4(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 vg(t){const e=Dr.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=lA(i)),n.attributes["w:val"]=i;break;case"textAlign":n.attributes["w:val"]=r.textAlign;break;case"textIndent":n.attributes["w:firstline"]=ni(r.textIndent);break;case"lineHeight":n.attributes["w:line"]=yd(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 n4(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 r4(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 $1(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}=n4(s);let c=n.size?{w:Ei(n.size.width),h:Ei(n.size.height)}:e;if(a&&l){const p=Gt(c.w),h=Gt(c.h),{scaledWidth:m,scaledHeight:y}=r4(a,l,p,h);c={w:Ei(m),h:Ei(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=Ei(p-(h+m)),{width:g,height:x}=h4(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=wg(t,p)}else if(t.node.type==="fieldAnnotation"&&!i){const p=s?.split(";")[0].split("/")[1];if(!p)return T1(t);const h=Xn(4),m=n.fieldId.replace("-","_"),y=`media/${m}_${h}.${p}`;i=wg(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 zs({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 T1(t){const{node:{attrs:e={},marks:n=[]}}=t,r=l4(e);return jl(e.displayLabel,[...n,...r],t)}function o4(t){const{node:{attrs:e={},marks:n=[]}}=t,r=YE.decode(e.displayLabel);return jl(r,n,t)}function i4(t){const{node:{attrs:e={}}}=t,n=new window.DOMParser().parseFromString(e.rawHtml,"text/html"),r=Ji.create({doc:Ar.fromSchema(t.editorSchema).parse(n)}).doc.toJSON();return{name:"htmlAnnotation",elements:Rr({...t,node:r})}}function xg(t,e){return $1(t,e)}function s4(t){const{node:{attrs:e={},marks:n=[]}}=t,r=A1(t,e.linkUrl),o=jl(e.linkUrl,n,t);return{name:"w:hyperlink",type:"element",attributes:{"r:id":r,"w:history":1},elements:[o]}}function a4(t){const e={w:4286250,h:4286250},n={w:99e4,h:495e3};return{text:T1,image:r=>xg(r,e),signature:r=>xg(r,n),checkbox:o4,html:i4,link:s4}[t]}const l4=(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 c4(t){const{node:e,isFinalDoc:n}=t,{attrs:r={}}=e,o=a4(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 u4(t){const{node:e={}}=t,{attrs:n={}}=e,{pageBreakSource:r}=n;return r==="sectPr"?null:{name:"w:r",elements:[{name:"w:br",type:"element",attributes:{"w:type":"page"}}]}}function d4(t){const{node:e}=t,n=Rr(t),r={name:"v:shape",attributes:{...e.attrs.attributes,fillcolor:e.attrs.fillcolor},elements:[...n,...e.attrs.wrapAttributes?[{name:"w10:wrap",attributes:{...e.attrs.wrapAttributes}}]:[]]},o={name:"w:pict",attributes:{"w14:anchorId":Math.floor(Math.random()*4294967295).toString()},elements:[r]};return{name:"w:p",elements:[zs(o)]}}function f4(t){const{node:e}=t,n={name:"w:txbxContent",elements:Rr(t)};return{name:"v:textbox",attributes:{...e.attrs.attributes},elements:[n]}}function p4(t){const{node:e}=t,{drawingContent:n}=e.attrs,r={name:"w:drawing",elements:[...n?[...n.elements||[]]:[]]};return{name:"w:p",elements:[zs({name:"mc:AlternateContent",elements:[{name:"mc:Choice",attributes:{Requires:"wps"},elements:[r]}]})]}}var Hr,O1,uu,du;let kg=class{constructor(e){V0(this,Hr),this.converter=e}schemaToXml(e,n=!1){return Yn(this,Hr,O1).call(this,e,n).join("")}};Hr=new WeakSet,O1=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=Yn(this,Hr,du).call(this,n,e);return[o,...i]},uu=function(t){if(t)return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")},du=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"?Yn(this,Hr,uu).call(this,o[l]):o[l];i+=` ${l}="${c}"`}const s=n&&(!r||!r.length);s?i+=" />":i+=">";let a=[i];if(!n&&t.type==="text")return t.text;if(n==="w:instrText")a.push(r[0].text);else if(n==="w:t"||n==="w:delText"||n==="wp:posOffset"){const l=Yn(this,Hr,uu).call(this,r[0].text);a.push(l)}else if(r)for(let l of r){const c=Yn(this,Hr,du).call(this,l);if(!c)continue;if(typeof c=="string"){a.push(c);continue}const u=c.filter(d=>d!=="<undefined>"&&d!=="</undefined>");a.push(...u)}return s||a.push(`</${n}>`),a};function h4(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 m4='<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>',g4=t=>JSON.parse(Eb.xml2json(t,null,2)),y4=(t,e=m4)=>t["word/document.xml"]||g4(e),w4=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:[v4(n,t)],consumed:1}}return{nodes:[],consumed:0}},b4={handlerName:"tableNodeHandler",handler:w4};function v4(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}=D1(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:nt(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=M1(l,n),p=o.elements.find(k=>k.name==="w:tblW");p&&(c.tableWidth={width:nt(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=S4(k,t,g,l,e);b.content?.length&&x.push(b)}),{type:"table",content:x,attrs:c}}function x4(t,e,n,r,o=null,i,s,a){const{docx:l,nodeListHandler:c}=s,u=t.elements.find(N=>N.name==="w:tcPr"),d=u?.elements?.find(N=>N.name==="w:tcBorders"),f=k4(d,r),p=_1(n),h=u?.elements?.find(N=>N.name==="w:tcW");let m=h?nt(h.attributes["w:w"]):null;const y=h?.attributes["w:type"];!m&&o&&(m=o);const g=Sg(t),{attributes:x}=g||{},k={color:u?.elements?.find(N=>N.name==="w:shd")?.attributes["w:fill"]},b=u?.elements?.find(N=>N.name==="w:gridSpan")?.attributes["w:val"],T=u?.elements?.find(N=>N.name==="w:tcMar"),D=u?.elements?.find(N=>N.name==="w:vAlign")?.attributes["w:val"]||"top",M={},I=M1(i,l)||{};M.cellMargins=E4(T,I);const{fontSize:E,fonts:U={}}=I,oe=U.ascii;if(m){M.colwidth=[m],M.widthUnit="px";const N=p,W=p&&p.length>0,$=parseInt(b,10);if($&&$>1&&W){let J=[];for(let ie=0;ie<$;ie++){let G=N[a+ie];typeof G<"u"?J.push(G):J.push(100)}J.length&&(M.colwidth=[...J])}}if(y&&(M.widthType=y),b&&(M.colspan=parseInt(b,10)),k&&(M.background=k),M.verticalAlign=D,E&&(M.fontSize=E),oe&&(M.fontFamily=oe.ascii),r&&(M.borders={...r}),f&&(M.borders=Object.assign(M.borders||{},f)),x&&x["w:val"]==="restart"){const N=n.elements.filter(G=>G.name==="w:tr"),W=N.findIndex(G=>G===e),$=N.slice(W+1);let J=e.elements.filter(G=>G.name==="w:tc").findIndex(G=>G===t),ie=1;for(let G of $){const de=G.elements.findIndex(B=>B.name==="w:tc"),Y=G.elements[de+J];if(!Y)break;const ue=Sg(Y),{attributes:Z}=ue||{};if(!ue&&!Z||Z&&Z["w:val"]==="restart")break;ie++,G.elements.splice(de+J,1)}M.rowspan=ie}return{type:"tableCell",content:c.handler({...s,nodes:t.elements}),attrs:M}}const Sg=t=>t.elements.find(e=>e.name==="w:tcPr")?.elements?.find(e=>e.name==="w:vMerge"),na=(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=w1(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},k4=(t,e)=>{if(!t)return null;const n={},r=na(t,"bottom",e);r&&(n.bottom=r);const o=na(t,"top",e);o&&(n.top=o);const i=na(t,"left",e);i&&(n.left=i);const s=na(t,"right",e);return s&&(n.right=s),n};function M1(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=tA(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}=D1(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(I=>I.name==="w:left"),T=k.elements.find(I=>I.name==="w:right"),D=k.elements.find(I=>I.name==="w:top"),M=k.elements.find(I=>I.name==="w:bottom");r.cellMargins={marginLeft:b?.attributes["w:w"],marginRight:T?.attributes["w:w"],marginTop:D?.attributes["w:w"],marginBottom:M?.attributes["w:w"]}}}return r}function D1(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=w1(c)),["insideH","insideV"].includes(i)&&(n[i]=a),e[i]=a}),{borders:e,rowBorders:n}}function S4(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=nt(a));const c=_1(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 x4(d,t,e,l,p,r,o,f)})||[],attrs:i}}const E4=(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:nt(s??d),right:nt(a??f),top:nt(l??p),bottom:nt(c??h)}},_1=t=>t.elements.find(e=>e.name==="w:tblGrid")?.elements?.flatMap(e=>e.name!=="w:gridCol"?[]:nt(e.attributes["w:w"]))||[],C4=t=>{const{nodes:e,filename:n}=t,r=["w:drawing","w:p"];if(e.length===0||!r.includes(e[0].name))return{nodes:[],consumed:0};const o=e[0];let i;if(o.name==="w:drawing"?i=o:i=o.elements.find(u=>u.name==="w:drawing"),!i)return{nodes:[],consumed:0};let s;const{elements:a}=i,l=n||null;a.find(u=>u.name==="wp:anchor")&&(s=Eg(a[0],l,t));const c=a.find(u=>u.name==="wp:inline");return c&&(s=Eg(c,l,t)),{nodes:s?[s]:[],consumed:1}};function Eg(t,e,n){const{docx:r}=n,{attributes:o}=t,i={top:Gt(o.distT),bottom:Gt(o.distB),left:Gt(o.distL),right:Gt(o.distR)},s=t.elements.find(I=>I.name==="wp:extent"),a={width:Gt(s.attributes?.cx),height:Gt(s.attributes?.cy)},l=t.elements.find(I=>I.name==="a:graphic").elements.find(I=>I.name==="a:graphicData"),{uri:c}=l?.attributes;if(c&&c==="http://schemas.microsoft.com/office/word/2010/wordprocessingShape")return A4(n,t,l);const u=l.elements.find(I=>I.name==="pic:pic");if(!u||!u.elements)return null;const d=u.elements.find(I=>I.name==="pic:blipFill").elements.find(I=>I.name==="a:blip"),f=t.elements.find(I=>I.name==="wp:positionH")?.elements.find(I=>I.name==="wp:posOffset"),p=Gt(f?.elements[0]?.text),h=t.elements.find(I=>I.name==="wp:positionV")?.elements.find(I=>I.name==="wp:posOffset"),m=Gt(h?.elements[0]?.text),y={left:p,top:m},{attributes:g}=d,x=g["r:embed"];let k=r[`word/_rels/${e||"document.xml"}.rels`];k||(k=r["word/_rels/document.xml.rels"]);const b=k.elements.find(I=>I.name==="Relationships"),{elements:T}=b,D=T.find(I=>I.attributes.Id===x),{attributes:M}=D;return{type:"image",attrs:{src:`word/${M.Target}`,alt:"Image",inline:!0,padding:i,marginOffset:y,size:a,originalPadding:{distT:o.distT,distB:o.distB,distL:o.distL,distR:o.distR},rId:M.Id}}}const A4=(t,e,n)=>{const r=n.elements.find(l=>l.name==="wps:wsp"),o=r.elements.find(l=>l.name==="wps:txbx")?.elements?.find(l=>l.name==="w:txbxContent");e.elements.find(l=>l.name==="wp:docPr");const i=r.elements.find(l=>l.name==="wps:spPr"),s=i?.elements.find(l=>l.name==="a:prstGeom");if(s&&s.attributes.prst==="rect")return $4(t,i);if(!o)return null;const{nodeListHandler:a}=t;return a.handler({...t,node:o.elements[0],nodes:o.elements})[0]},$4=(t,e)=>{const n={},[r]=t.nodes;r?.name==="w:drawing"&&(n.drawingContent=r);const o=e.elements.find(u=>u.name==="a:xfrm"),i=o.elements.find(u=>u.name==="a:off"),s=o.elements.find(u=>u.name==="a:ext");e.elements.find(u=>u.name==="a:ln");const a=e.elements.find(u=>u.name==="a:solidFill"),l={top:Gt(i.attributes.y),left:Gt(i.attributes.x),width:Gt(s.attributes.cx),height:Gt(s.attributes.cy)};n.size=l;const c=a?.elements[0]?.attributes.val;return c&&(n.background="#"+c),{type:"contentBlock",attrs:n}},T4={handlerName:"drawingNodeHandler",handler:C4};function ri(t,e=[],n=null){const r=[],o=new Set;return t?.elements?.forEach(i=>{const s=Dr.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=M4(a.type,l,n);if(u==null)return;c.attrs={},c.attrs[a.property]=u}r.push(c)}})}),bd(r)}function O4(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=ri(n);return[{type:vt,attrs:{...o,before:i,after:[...e]}}]}function bd(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 M4(t,e,n){t==="tabs"&&(t="textIndent");const r={color:()=>`#${e["w:val"]}`,fontSize:()=>`${e["w:val"]/2}pt`,textIndent:()=>_4(e),fontFamily:()=>D4(e,n),lineHeight:()=>N4(e),textAlign:()=>e["w:val"],link:()=>e.href,underline:()=>e["w:val"],bold:()=>e?.["w:val"]||null,italic:()=>e?.["w:val"]||null,highlight:()=>I4(e)};if(t in r||console.debug("❗️❗️ No value mapper for:",t,"Attributes:",e),t in r)return r[t],r[t]()}function D4(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 _4(t){let e=t["w:left"];return e?`${Wt(e)}in`:null}function N4(t){const e=t["w:line"],n=t["w:lineRule"];return!e||e==="0"?null:n==="exact"?`${v1(e)}pt`:`${Go(e)}`}function I4(t){const e=t["w:fill"];return e&&e!=="auto"?`#${e}`:sA(t?.["w:val"])?`#${t["w:val"]}`:iA(t?.["w:val"])||null}function fo(t,e){const n=[],r=[],{attributes:o={},elements:i=[]}=t,{nodes:s,paragraphProperties:a={},runProperties:l={}}=F4(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(...ri(l,r)),a&&a.elements?.length&&n.push(...ri(a,r)),n.push(...O4(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 F4(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 Ba(t){return Dr.allowedElements[t.name||t.type]}const B4=t=>!!Dr.propertyTypes[t.name||t.type];function N1(t){return t.filter(e=>e.name==="w:r").some(e=>e.elements.some(n=>n.name==="w:t"))}const R4=t=>{const{nodes:e,nodeListHandler:n}=t;if(e.length===0||!(e[0].name==="w:del"||e[0].name==="w:ins"||e[0].name==="w:sdt"))return{nodes:[],consumed:0};const r=e[0];let o;if(["w:ins","w:del"].includes(r.name))o=r;else{const d=r.elements.find(f=>f.name==="w:sdtContent")?.elements.find(f=>["w:ins","w:del"].includes(f.name));d&&(o=d)}if(!o)return{nodes:[],consumed:0};const{name:i}=o,{attributes:s,elements:a}=fo(o),l=n.handler({...t,insideTrackChange:!0,nodes:a}),c=i==="w:del"?ut:It,u={id:s["w:id"],date:s["w:date"],author:s["w:author"],authorEmail:s["w:authorEmail"]};return l.forEach(d=>{d.marks===void 0&&(d.marks=[]),d.marks.push({type:c,attrs:u})}),{nodes:l,consumed:1}},L4={handlerName:"trackChangeNodeHandler",handler:R4},P4=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}},z4={handlerName:"hyperlinkNodeHandler",handler:P4},j4=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=q4(o,r);if(l){const{marks:u=[],attributes:d={}}=fo(i),f=u.find(m=>m.type==="textStyle"),p=f&&Object.keys(f.attrs).length>0;c.marks&&!p&&u.push(...c.marks),i.marks&&u.push(...i.marks);const h=bd(u);a=a.map(m=>{const y=m.marks||[];return{...m,marks:[...h,...y],attributes:d}})}else c.marks&&(a=a.map(u=>({...u,marks:bd(c.marks)})));return{nodes:a,consumed:1}},q4=(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?fo(r):{}},V4={handlerName:"runNodeHandler",handler:j4},U4=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=[]}=fo(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:Ba(r),text:l,attrs:{type:o,attributes:i||{}},marks:a}],consumed:1}},H4={handlerName:"textNodeHandler",handler:U4},I1=t=>{if(!t||!Array.isArray(t))return t;let e=[],n=null;for(let r of t)r.type==="text"?n&&W4(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},W4=(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].attrs||(n[o].attrs={}),r[o].attrs||(r[o].attrs={}),n[o].type!==r[o].type||Object.keys(n[o].attrs).length!==Object.keys(r[o].attrs).length||!G4(n[o].attrs,r[o].attrs))return!1;return!0},G4=(t={},e={})=>ti(t,e),K4=t=>{const{nodes:e,lists:n,docx:r}=t;if(e.length===0||e[0].name!=="w:p")return{nodes:[],consumed:0};const o=cn(e[0]),i=z1(o.elements);o.elements=i;const s=o.elements.find(a=>a.name==="w:pPr");if(vd(o,r)){const a=cn(e),l=[];let c=a.shift();for(;c&&vd(c,r);)l.push(c),c=a.shift(),c?.elements&&!N1(c.elements)&&(l.push(c),c=a.shift());return{nodes:[F1({listItems:l,params:t,originalPpr:s})],consumed:l.filter(u=>u.seen).length,lists:n}}else return{nodes:[],consumed:0,lists:n}},J4={handlerName:"listHandler",handler:K4};function F1({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(k=>k.handlerName==="standardNodeHandler")?.handler;if(!h)return console.error("Standard node handler not found"),{nodes:[],consumed:0};const m=t[0].elements.find(k=>k.name==="w:pPr")?.elements?.find(k=>k.name==="w:pStyle")?.attributes["w:val"],y=Vl({node:t[0],styleId:m,docx:l});i=oi(y),o=parseInt(y?.elements?.find(k=>k.name==="w:ilvl")?.attributes["w:val"])||0,o===void 0&&(o=B1(m,l));let g=0;for(let[k,b]of t.entries()){if(b.seen)continue;if(b.elements&&!N1(b.elements)){const A=h({...n,nodes:[b]}).nodes[0];A&&d[d.length-1]?.content.push(A),b.seen=!0;continue}const{attributes:T,elements:D,marks:M=[]}=fo(b),I=Kf(m,l)||{},{marks:E}=fo(I),U=M.find(A=>A.type==="textStyle"),oe=E?.find(A=>A.type==="textStyle"),{listType:N,listOrderingType:W,ilvl:$,listrPrs:J,listpPrs:ie,start:G,lvlText:de,lvlJc:Y,numId:ue}=Q4(b,r,l);p=W;const Z=parseInt($),B=o===Z&&ue===i,ee=Z4({firstListId:ue,secondListId:i,level:Z,pStyleId:null,docx:l}),te=ue!==i&&!ee,se=r<Z||r===Z&&te&&g===r;u[i]||(u[i]={}),u[i][r]||(u[i][r]=Number(G));const K={};if(B&&!se){f=N,b.seen=!0;const A=[];let C={type:"paragraph",content:c.handler({...n,nodes:[T.paragraphProperties,...D]})?.filter(S=>S)};C.content&&(C={...C,attrs:{textAlign:U?.attrs.textAlign||oe?.attrs.textAlign||null,rsidRDefault:T?.["w:rsidRDefault"]||null,styleId:m},content:I1(C.content)}),A.push(C),g=r;let H=[];if(p!=="bullet"&&(H=[...s,u[i][r]],u[i][o]++),!s.length&&o>0){const S=u[i];if(S){const re=[];Object.keys(S).forEach(Q=>{re.push(S[Q])}),H=re}}let P=b.elements.find(S=>S.name==="w:pPr")?.elements.find(S=>S.name==="w:ind");const F=I?.elements?.find(S=>S.name==="w:pPr")?.elements?.find(S=>S.name==="w:ind");if(P||(P=F),P){const S={};P.attributes||(P.attributes={}),P.attributes["w:left"]!==void 0&&(S.left=nt(P.attributes["w:left"])),P.attributes["w:right"]!==void 0&&(S.right=nt(P.attributes["w:right"])),P.attributes["w:firstLine"]!==void 0&&(S.firstLine=nt(P.attributes["w:firstLine"])),P.attributes["w:hanging"]!==void 0&&(S.hanging=nt(P.attributes["w:hanging"])),K.indent=S}ie&&(K.listParagraphProperties=ie),J&&(K.listRunProperties=J),K.textStyle=U,K.order=G,K.lvlText=de,K.lvlJc=U?.attrs.textAlign,K.listLevel=H,K.listNumberingType=W,K.attributes={parentAttributes:b?.attributes||null};const R=e?.elements?.find(S=>S.name==="w:rPr");R&&(K.attributes.originalInlineRunProps=R),K.numId=ue,l&&(K.spacing=L1(b,l,m));const le=Cg(A,K,[]);d.push(le)}else if(se){const A=[...s,u[i][r]],C=F1({listItems:t.slice(k),originalPpr:e,params:n,listLevel:r+1,actualListLevel:r,currentListNumId:ue,path:A,isNested:!0});g=C.lastNestedListLevel,delete C.lastNestedListLevel;const H=d[d.length-1];H?H.content.push(C):d.push(Cg([C],K,[]))}else if(ue){g=r,r>0&&b.elements[0].elements.find(A=>A.name==="w:numPr")&&(u[i][r]=0);break}else{b.seen=!0;const A=h({...n,nodes:[b]}).nodes[0];d[d.length-1]?.content.push(A)}}const x={type:f||"bulletList",content:d,attrs:{"list-style-type":p,listId:i,attributes:{parentAttributes:t[0]?.attributes||null}}};return a&&(x.lastNestedListLevel=g),x}const B1=(t,e)=>{const n=Kf(t,e)?.elements?.find(r=>r.name==="w:pPr")?.elements?.find(r=>r.name==="w:outlineLvl");try{return parseInt(n?.attributes["w:val"])}catch{}};function vd(t,e){const{elements:n}=t,r=n?.find(l=>l.name==="w:pPr");if(!r)return!1;const o=r.elements?.find(l=>l.name==="w:pStyle");let i=r.elements?.find(l=>l.name==="w:numPr"),s=oi(i);const a=o?.attributes["w:val"];return a&&!s&&(i=Vl({node:t,styleId:a,docx:e}),s=oi(i)),!!s}const oi=t=>t?.elements?.find(e=>e.name==="w:numId")?.attributes["w:val"];function Kf(t,e){const n=e["word/styles.xml"];return n?n.elements.find(r=>r.name==="w:styles").elements.filter(r=>r.name==="w:style").find(r=>r.attributes["w:styleId"]===t):{}}function Vl({node:t,styleId:e,docx:n,seenStyleIds:r=new Set}){let o=t?.elements?.find(l=>l.name==="w:pPr")?.elements?.find(l=>l.name==="w:numPr"),i=oi(o);if(i)return o;const s=Kf(e,n);o=s?.elements?.find(l=>l.name==="w:pPr")?.elements?.find(l=>l.name==="w:numPr"),i=oi(o);const a=s?.elements?.find(l=>l.name==="w:basedOn");if(!i&&!r.has(e)){const l=a?.attributes["w:val"];return r.add(e),l?Vl({styleId:l,docx:n,seenStyleIds:r}):null}return o}function Cg(t,e,n){return{type:"listItem",content:t,attrs:e,marks:n}}const X4=["decimal","decimalZero","lowerRoman","upperRoman","lowerLetter","upperLetter","ordinal","cardinalText","ordinalText","hex","chicago","none"],Y4=["bullet","square","circle","disc"],Z4=({firstListId:t,secondListId:e,level:n,pStyleId:r,docx:o})=>{const{numFmt:i,lvlText:s,lvlJc:a}=ol(t,n,r,o),{numFmt:l,lvlText:c,lvlJc:u}=ol(e,n,r,o);return i===l&&s===c&&a===u},Ag=(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=oi(a),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}},ol=(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}=Ag(n,r)||{};!t&&k&&(t=k),!e&&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=e6(u,e),f=u?.elements?.find(k=>k.name==="w:numStyleLink")?.attributes["w:val"];if(f){const k=Ag(f,r);return ol(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 Q4(t,e,n){if(!t)return;const{attributes:r={}}=t,{paragraphProperties:o={}}=r,{elements:i=[]}=o,s=t.elements.find(b=>b.name==="w:pPr")?.elements?.find(b=>b.name==="w:pStyle")?.attributes["w:val"],a=Vl({node:t,styleId:s,docx:n});if(!a)return{};const l=a?.elements.find(b=>b.name==="w:numId")?.attributes["w:val"],c=a?.elements.find(b=>b.name==="w:ilvl")?.attributes["w:val"]||B1(s,n),u=i.find(b=>b.name==="w:pStyle")?.attributes["w:val"],{start:d,numFmt:f,lvlText:p,lvlJc:h,pPr:m,rPr:y}=ol(l,e,u,n);let g,x;m&&(g=t6(m)),y&&(x=n6(y));let k;if(Y4.includes(f?.toLowerCase()))k="bulletList";else if(X4.includes(f))k="orderedList";else return{};return{listType:k,listOrderingType:f,ilvl:c,numId:l,listrPrs:x,listpPrs:g,start:d,lvlText:p,lvlJc:h}}function e6(t,e){return t?.elements?.find(n=>Number(n.attributes["w:ilvl"])===e)}function t6(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 n6(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 R1=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=cn(e[0]);let s,a=z1(i.elements);if(i.elements=a,vd(i,n))return{nodes:[],consumed:0};const l=r.handlerEntities.find(b=>b.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(b=>b.name==="w:pPr"),f=d?.elements?.find(b=>b.name==="w:pStyle"),p=d?.elements?.find(b=>b.name==="w:rPr"),h=d?.elements?.find(b=>b.name==="w:framePr");if(p){let b=ri(p,[]);if(!s.content?.length){let T=b?.findIndex(D=>D.type==="highlight");T!==-1&&b.splice(T,1)}s.attrs.marksAttrs=b}let m;if(f&&(m=f.attributes["w:val"],s.attrs.styleId=m),n){const b=r6(i,n,m);s.attrs.indent||(s.attrs.indent={}),(b.left||b.left===0)&&(s.attrs.indent.left=b.left),(b.right||b.right===0)&&(s.attrs.indent.right=b.right),(b.firstLine||b.firstLine===0)&&(s.attrs.indent.firstLine=b.firstLine),(b.hanging||b.hanging===0)&&(s.attrs.indent.hanging=b.hanging),(b.textIndent||b.textIndent===0)&&(s.attrs.textIndent=`${b.textIndent}in`)}const y=d?.elements?.find(b=>b.name==="w:jc");y&&y.attributes&&(s.attrs.textAlign=y.attributes["w:val"]);const g=d?.elements?.find(b=>b.name==="w:keepLines");g&&g.attributes&&(s.attrs.keepLines=g.attributes["w:val"]);const x=d?.elements?.find(b=>b.name==="w:keepNext");if(x&&x.attributes&&(s.attrs.keepNext=x.attributes["w:val"]),n){const b=i.attributes?.["w:rsidRDefault"];s.attrs.spacing=L1(i,n,m,s.attrs.marksAttrs),s.attrs.rsidRDefault=b}h&&h.attributes["w:dropCap"]&&(s.attrs.dropcap={type:h.attributes["w:dropCap"],lines:h.attributes["w:lines"],wrap:h.attributes["w:wrap"],hAnchor:h.attributes["w:hAnchor"],vAnchor:h.attributes["w:vAnchor"]}),s.attrs.filename=o,s&&s.content&&(s={...s,content:I1(s.content)});const k=d?.elements?.find(b=>b.name==="w:sectPr");return k&&(s.attrs.paragraphProperties||(s.attrs.paragraphProperties={}),s.attrs.paragraphProperties.sectPr=k,s.attrs.pageBreakSource="sectPr"),{nodes:s?[s]:[],consumed:1}},r6=(t,e,n="")=>{const r={left:0,right:0,firstLine:0,hanging:0,textIndent:0},{indent:o={}}=P1(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=nt(s)),a&&(r.right=nt(a)),l&&(r.firstLine=nt(l)),c&&(r.hanging=nt(c));const u=s-parseInt(c||0)||0;return u&&(r.textIndent=Wt(u)),r},L1=(t,e,n="",r=[])=>{const o={lineSpaceAfter:0,lineSpaceBefore:0,line:0,lineRule:null},{spacing:i={}}=P1(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=Go(f));const p=u?.["w:lineRule"]||c||i?.["w:lineRule"];p&&(o.lineRule=p),p==="exact"&&f&&(o.line=`${v1(f)}pt`);const h=u?.["w:before"]||a||i?.["w:before"];h&&(o.lineSpaceBefore=nt(h)),u?.["w:beforeAutospacing"]==="1"&&d&&(o.lineSpaceBefore+=Math.round(parseInt(d)*.5*96/72));const m=u?.["w:after"]||s||i?.["w:after"];return m&&(o.lineSpaceAfter=nt(m)),u?.["w:afterAutospacing"]==="1"&&d&&(o.lineSpaceAfter+=Math.round(parseInt(d)*.5*96/72)),o},P1=(t,e="")=>{const n=t["word/styles.xml"];if(!n)return{};const r=(n.elements[0].elements?.find(k=>k.name==="w:docDefaults")).elements.find(k=>k.name==="w:pPrDefault")?.elements?.find(k=>k.name==="w:pPr"),o=r?.elements?.find(k=>k.name==="w:spacing")||{},i=r?.elements?.find(k=>k.name==="w:ind")||{},s=n.elements[0].elements?.find(k=>k.name==="w:style"&&k.attributes["w:styleId"]==="Normal")?.elements?.find(k=>k.name==="w:pPr"),a=s?.elements?.find(k=>k.name==="w:spacing")||{},l=s?.elements?.find(k=>k.name==="w:ind")||{};let c={},u={},d={};if(e){const k=n.elements[0].elements?.find(b=>b.name==="w:style"&&b.attributes["w:styleId"]===e)?.elements?.find(b=>b.name==="w:pPr");c=k?.elements?.find(b=>b.name==="w:spacing")||{},u=k?.elements?.find(b=>b.name==="w:ind")||{},d=k?.elements?.find(b=>b.name==="w:jc")||{}}const{attributes:f}=o,{attributes:p}=a,{attributes:h}=c,{attributes:m}=d,{attributes:y}=i,{attributes:g}=l,{attributes:x}=u;return{spacing:h||f||p,indent:x||y||g,justify:m}},o6={handlerName:"paragraphNodeHandler",handler:R1};function i6(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(ie=>{const{attributes:G}=ie;return G&&G["w:styleId"]===t}),s=i[0];if(!s)return n;const a=i.find(ie=>ie.elements.find(G=>G.name==="w:qFormat")),l=i.find(ie=>ie.elements.some(G=>G.name==="w:name"))?.elements.find(ie=>ie.name==="w:name")?.attributes["w:val"],c=s.elements.find(ie=>ie.name==="w:pPr"),u=c?.elements?.find(ie=>ie.name==="w:spacing"),d=c?.elements?.find(ie=>ie.name==="w:jc"),f=c?.elements?.find(ie=>ie.name==="w:ind");let p,h,m;u&&(p=nt(u?.attributes["w:before"]),h=nt(u?.attributes["w:after"]),m=Go(u?.attributes["w:line"]));let y,g,x,k;f&&(y=d?.attributes["w:val"],g=nt(f?.attributes["w:left"]),x=nt(f?.attributes["w:right"]),k=nt(f?.attributes["w:firstLine"]));const b=c?.elements?.find(ie=>ie.name==="w:keepNext"),T=c?.elements?.find(ie=>ie.name==="w:keepLines"),D=c?.elements?.find(ie=>ie.name==="w:outlineLvl"),M=D?.attributes["w:val"],I=c?.elements?.find(ie=>ie.name==="w:pageBreakBefore");let E=0;I&&(I.attributes?.["w:val"]?E=Number(I?.attributes?.["w:val"]):E=1);const U=c?.elements?.find(ie=>ie.name==="w:pageBreakAfter");let oe;U&&(U.attributes?.["w:val"]?oe=Number(U?.attributes?.["w:val"]):oe=1);const N={name:l,qFormat:!!a,keepNext:!!b,keepLines:!!T,outlineLevel:D?parseInt(M):null,pageBreakBefore:!!E,pageBreakAfter:!!oe},W=s.elements.find(ie=>ie.name==="w:rPr"),$=ri(W,[],e)||{},J={spacing:{lineSpaceAfter:h,lineSpaceBefore:p,line:m},textAlign:y,indent:{leftIndent:g,rightIndent:x,firstLine:k}};return $.forEach(ie=>{const{type:G,attrs:de}=ie;if(G==="textStyle"){Object.entries(de).forEach(([Y,ue])=>{J[nl(Y)]=ue});return}J[G]=de}),{attrs:N,styles:J}}function z1(t){let e=[],n=[],r=!1;return t?.forEach(o=>{if(o.seen)return;o.seen=!0;const i=o.elements?.filter(s=>s.name==="w:fldChar")||[];if(i.length)if(i.length>1){const s=$g([o]);e.push(...s)}else{const s=i[0].attributes["w:fldCharType"];if(s==="begin")r=!0,n.push(o);else if(s==="end"){r=!1,n.push(o);const a=$g(n);e.push(...a),n=[]}}r?n.push(o):e.push(o)}),e}const $g=(t=[])=>{let e=[],n=!1,r=!1;const o=t.findIndex(c=>c.elements?.some(u=>u.name==="w:fldChar"&&u.attributes["w:fldCharType"]==="separate")),i=t.findIndex(c=>c.elements?.some(u=>u.name==="w:fldChar"&&u.attributes["w:fldCharType"]==="end")),s=t.slice(o+1,i),a=t.find(c=>c.elements?.some(u=>u.name==="w:instrText"))?.elements?.find(c=>c.name==="w:instrText")?.elements[0].text;n||(n=a?.trim().startsWith("PAGE")),r||(r=a?.trim().startsWith("NUMPAGES"));const l=a?.match(/HYPERLINK\s+"([^"]+)"/);if(n)e.push({name:"sd:autoPageNumber",type:"element"});else if(r)e.push({name:"sd:totalPageNumber",type:"element"});else if(l&&l?.length>=2){const c=l[1],u=[];s.forEach(f=>{const p=f.elements.find(m=>m.name==="w:rPr");if(!p)return;const{elements:h}=p;h.forEach(m=>{u.push(m)})});const d={name:"w:rPr",type:"element",elements:[{name:"link",attributes:{href:c}},...u]};e.push({name:"w:r",type:"element",elements:[d,...s]})}return e},s6=t=>nodeListHandler.handler({...t,nodes:node.elements}),a6=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(!Tg[r])return{nodes:[],consumed:0};const o=n?.elements.find(s=>s.name==="w:sdtContent"),i=Tg[r];return{nodes:i({...t,nodes:[o]}),consumed:1}},Tg={"Table of Contents":s6},l6=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}=c6(a);if(s?.elements.find(x=>x.name==="w:docPartObj"))return a6({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}},c6=(t={})=>{const e=t.elements?.find(i=>i.name==="w:r")?.elements?.find(i=>i.name==="w:rPr");if(!e)return{};const n=ri(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}},u6={handlerName:"annotationNodeHandler",handler:l6},d6=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=[]}=fo(o);if(i==="w:sdt")return{nodes:[],consumed:0};if(B4(o))return{nodes:[{type:Ba(o),attrs:{...s},marks:[]}],consumed:0};if(!Ba(o))return{nodes:[{type:i,content:a,attrs:{...s},marks:l}],consumed:0,unhandled:!0};const c=[],u=f6(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:Ba(o),content:c,attrs:{...s},marks:[]}],consumed:1}},f6=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},p6={handlerName:"standardNodeHandler",handler:d6},h6=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}},m6={handlerName:"lineBreakNodeHandler",handler:h6},g6=t=>{const{nodes:e,nodeListHandler:n,editor:r}=t;if(e.length===0||e[0].name!=="w:bookmarkStart")return{nodes:[],consumed:0};const o=e[0],i=n.handlerEntities.find(d=>d.handlerName==="standardNodeHandler")?.handler;if(!i)return console.error("Standard node handler not found"),{nodes:[],consumed:0};const s=r?.extensionService?.extensions?.filter(d=>d.isExternal===!0)||[],a=o.attributes["w:name"]?.split(";")[0],l=s.find(d=>d.name===a);if(l){const d=e.findIndex(y=>y.name==="w:bookmarkEnd"&&y.attributes["w:id"]===o.attributes["w:id"]),f=e.slice(1,d),p=t.nodeListHandler,h={};o.attributes["w:name"].split(";").forEach(y=>{const[g,x]=y.split("=");g&&x&&(h[g]=x)});const m=p.handler({...t,nodes:f});return m.forEach(y=>{y.marks.push({type:l.name,attrs:h})}),{nodes:m,consumed:m.length+2}}const c={...t,nodes:[o]},u=i(c);return u.nodes.length===1&&(u.nodes[0].attrs.name=o.attributes["w:name"],u.nodes[0].attrs.id=o.attributes["w:id"]),u},y6={handlerName:"bookmarkNodeHandler",handler:g6},w6=t=>{const e={nodes:[],consumed:0},{nodes:n,nodeListHandler:r,parentStyleId:o,docx:i}=t;if(n.length===0||n[0].name!=="w:p")return e;const s=n[0]?.elements?.find(d=>d.name==="w:r");if(!s?.elements?.some(d=>d.name==="mc:AlternateContent"))return e;const a=s.elements.find(d=>d.name==="mc:AlternateContent");s.elements.findIndex(d=>d.name==="mc:AlternateContent");const l=["wps","wp14","w14","w15"],c=a.elements.find(d=>d.name==="mc:Choice"&&l.includes(d.attributes.Requires));if(!c)return e;const u=c.elements;return{nodes:r.handler({...t,nodes:u}),consumed:1}},b6={handlerName:"alternateChoiceHandler",handler:w6},v6=t=>{const{nodes:e}=t;return e.length===0||e[0].name!=="sd:autoPageNumber"?{nodes:[],consumed:0}:{nodes:[{type:"page-number"}],consumed:1}},x6={handlerName:"autoPageNumberHandler",handler:v6},k6=t=>{const{nodes:e}=t;return e.length===0||e[0].name!=="sd:totalPageNumber"?{nodes:[],consumed:0}:{nodes:[{type:"total-page-number"}],consumed:1}},S6={handlerName:"autoTotalPageCountEntity",handler:k6},E6=t=>{const{nodes:e,docx:n,parentStyleId:r}=t;if(e.length===0||e[0].name!=="w:tab")return{nodes:[],consumed:0};const o=e[0],i=n["word/styles.xml"];if(i&&i.elements?.length){const a=i.elements[0]?.elements?.find(l=>l.attributes?.["w:styleId"]===r)?.elements?.find(l=>l.name==="w:pPr")?.elements?.find(l=>l.name==="w:tabs")?.elements?.find(l=>l.name==="w:tab");nt(a?.attributes?.["w:pos"])}const{attributes:s={}}=o;return{nodes:[{type:"tab",attrs:{tabSize:s["w:val"]||48},content:[]}],consumed:1}},C6={handlerName:"tabNodeHandler",handler:E6},A6=t=>{const{nodes:e}=t;if(!e.length||e[0].name!=="w:p")return{nodes:[],consumed:0};const[n]=e,r=n.elements?.find(l=>l.name==="w:r")?.elements?.find(l=>l.name==="w:pict");if(!r)return{nodes:[],consumed:0};const o=r,i=o.elements?.find(l=>l.name==="v:shape");o.elements?.find(l=>l.name==="v:shapetype");const s=o.elements?.find(l=>l.name==="v:group");if(!i&&!s)return{nodes:[],consumed:0};let a=null;return s&&!i?a=null:i.elements?.find(l=>l.name==="v:textbox")&&(a=$6({pict:r,pNode:n,shape:i,params:t})),{nodes:a?[a]:[],consumed:1}};function $6({pict:t,pNode:e,shape:n,params:r}){const o={},i={},s=n.attributes||{};o.attributes=s,s.fillcolor&&(o.fillcolor=s.fillcolor);const a=T6(s.style),l=O6(a);l&&(o.style=l);const c=n.elements?.find(f=>f.name==="v:textbox"),u=n.elements?.find(f=>f.name==="w10:wrap");u?.attributes&&(o.wrapAttributes=u.attributes),c?.attributes&&(i.attributes=c.attributes);const d=(c?.elements?.find(f=>f.name==="w:txbxContent")?.elements||[]).map(f=>R1({nodes:[f],docx:r.docx,nodeListHandler:fs()})).reduce((f,p)=>[...f,...p.nodes],[]);return{type:"shapeContainer",attrs:o,content:[{type:"shapeTextbox",attrs:i,content:d}]}}function T6(t){return t?t.split(";").filter(e=>!!e.trim()).reduce((e,n)=>{const[r,o]=n.split(":").map(i=>i.trim());return r&&o&&(e[r]=o),e},{}):{}}function O6(t){const e=["width","height"];let n="";for(const[r,o]of Object.entries(t))e.includes(r)&&(n+=`${r}: ${o};`);return n}const M6={handlerName:"handlePictNode",handler:A6};function D6({docx:t}){const e=fs(),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,D=e.handler({nodes:s.elements,nodeListHandler:e,docx:t}),{attrs:M}=D[0],I=M["w14:paraId"];return{commentId:p||bo(),importedId:l,creatorName:c,creatorEmail:u,createdTime:x,textJson:D[0],initials:d,paraId:I,trackedChange:h,trackedChangeText:y,trackedChangeType:m,trackedDeletedText:g}});return _6({docx:t,comments:i})}const _6=({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}=N6(a);let u;return c&&(u=e.find(d=>d.paraId===c)),{...s,isDone:l,parentCommentId:u?.commentId}})},N6=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}},I6=(t,e,n)=>{const r=cn(y4(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=fs(),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=D6({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:B6(s,t,e,n),comments:c,linkedStyles:R6(t),numbering:z6(t)}}return null},fs=()=>{const t=[b6,V4,M6,o6,J4,H4,m6,u6,y6,z4,T4,L4,b4,C6,x6,S6,p6];return{handler:F6(t),handlerEntities:t}},F6=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 B6(t,e,n,r){const o=t.elements?.find(s=>s.name==="w:sectPr"),i={};return o?.elements?.forEach(s=>{const{name:a,attributes:l}=s;switch(a){case"w:pgSz":i.pageSize={width:Wt(l["w:w"]),height:Wt(l["w:h"])};break;case"w:pgMar":i.pageMargins={top:Wt(l["w:top"]),right:Wt(l["w:right"]),bottom:Wt(l["w:bottom"]),left:Wt(l["w:left"]),header:Wt(l["w:header"]),footer:Wt(l["w:footer"]),gutter:Wt(l["w:gutter"])};break;case"w:cols":i.columns={space:Wt(l["w:space"]),num:l["w:num"],equalWidth:l["w:equalWidth"]};break;case"w:docGrid":i.docGrid={linePitch:Wt(l["w:linePitch"]),type:l["w:type"]};break;case"w:titlePg":n.headerIds.titlePg=!0}}),P6(e,n,r),i.alternateHeaders=j6(e),i}function R6(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=i6(s,t),l={id:i.attributes["w:styleId"],type:i.attributes["w:type"],definition:a,attributes:{}};o.push(l)}),o}function L6(t){if(!t)return null;const e=cn(t),{elements:n}=e.elements[0];return Object.keys(gg).forEach(r=>{if(!n.some(o=>o.attributes?.["w:styleId"]===r)){const o=gg[r];e.elements[0].elements.push(o)}}),e}const P6=(t,e,n)=>{const r=t["word/_rels/document.xml.rels"].elements.find(u=>u.name==="Relationships"),{elements:o}=r,i="http://schemas.openxmlformats.org/officeDocument/2006/relationships/header",s="http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer",a=o.filter(u=>u.attributes.Type===i),l=o.filter(u=>u.attributes.Type===s),c=(j1(t["word/document.xml"])||[]).flatMap(u=>u.elements);a.forEach(u=>{const{rId:d,referenceFile:f,currentFileName:p}=Og(u,t);let h=c.find(g=>g.name==="w:headerReference"&&g.attributes["r:id"]===d)?.attributes["w:type"];e.headerIds[h]&&(h=null);const m=fs(),y=m.handler({nodes:f.elements[0].elements,nodeListHandler:m,docx:t,converter:e,editor:n,filename:p});e.headerIds.ids||(e.headerIds.ids=[]),e.headerIds.ids.push(d),e.headers[d]={type:"doc",content:[...y]},h&&(e.headerIds[h]=d)}),l.forEach(u=>{const{rId:d,referenceFile:f,currentFileName:p}=Og(u,t),h=c.find(g=>g.name==="w:footerReference"&&g.attributes["r:id"]===d)?.attributes["w:type"],m=fs(),y=m.handler({nodes:f.elements[0].elements,nodeListHandler:m,docx:t,converter:e,editor:n,filename:p});e.footerIds.ids||(e.footerIds.ids=[]),e.footerIds.ids.push(d),e.footers[d]={type:"doc",content:[...y]},e.footerIds[h]=d})},j1=(t,e=[])=>{for(const n in t)t[n]==="w:sectPr"?e.push(t):typeof t[n]=="object"&&j1(t[n],e);return e},Og=(t,e)=>{const n=t.attributes.Id,r=t.attributes.Target,o=e[`word/${r}`];return{rId:n,referenceFile:o,currentFileName:r}};function z6(t){let e=t["word/numbering.xml"];(!e||!e.elements?.length||!e.elements[0].elements?.length)&&(e=x1);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 j6=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 Ro,q1,V1,U1,H1;const ji=class W1{constructor(e=null){V0(this,Ro),this.debug=e?.debug||!1,this.declaration=null,this.documentAttributes=null,this.convertedXml={},this.docx=e?.docx||[],this.media=e?.media||{},this.fonts=e?.fonts||{},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]=L6(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(Eb.xml2json(e,null,2))}static getStoredSuperdocVersion(e){try{const n=e.find(a=>a.name==="docProps/custom.xml");if(!n)return;const r=new W1,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.10.67"){const r="docProps/custom.xml";e[r]||(e[r]=G1());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=K1();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");if(!n.elements)return{};const r=n.elements[0].elements,o=r?.find(i=>i.name==="w:rFonts");if("elements"in n){const i=r.find(d=>d.name==="w:rFonts")?.attributes["w:asciiTheme"];let s,a,l;if(i){const d=this.getThemeInfo(i);s=d.typeface,a=d.panose}else o&&(s=o?.attributes["w:ascii"]);(e.elements[0].elements.filter(d=>d.name==="w:style"&&d.attributes["w:styleId"]==="Normal")||[]).forEach(d=>{const f=d.elements.find(p=>p.name==="w:rPr");s=f?.elements?.find(p=>p.name==="w:rFonts")?.attributes["w:ascii"],l=Number(f?.elements?.find(p=>p.name==="w:sz")?.attributes["w:val"])/2});const c=l||Number(r.find(d=>d.name==="w:sz")?.attributes["w:val"])/2||12,u=r.find(d=>d.name==="w:kern")?.attributes["w:val"];return{fontSizePt:c,kern:u,typeface:s,panose:a}}}getDocumentFonts(){const e=this.convertedXml["word/fontTable.xml"];if(!e||!Object.keys(this.fonts).length)return;const n=e.elements.find(s=>s.name==="w:fonts")?.elements.filter(s=>s.elements?.some(a=>a?.attributes&&a.attributes["r:id"]&&a.attributes["w:fontKey"]))?.reduce((s,a)=>{const l=a.elements.filter(c=>c.name.startsWith("w:embed"))?.map(c=>({...c,fontFamily:a.attributes["w:name"]}));return[...s,...l]},[]),r=this.convertedXml["word/_rels/fontTable.xml.rels"]?.elements.find(s=>s.name==="Relationships")||{},{elements:o}=r;let i="";for(const s of n){const a=o.find(y=>y.attributes.Id===s.attributes["r:id"])?.attributes?.Target;if(!a)return;const l=this.fonts[`word/${a}`]?.buffer;if(!l)return;const c=cA(l,s.attributes["w:fontKey"]);if(!c)return;const u=new Blob([c],{type:"font/ttf"}),d=URL.createObjectURL(u),f=s.name.includes("Regular"),p=s.name.includes("Bold"),h=s.name.includes("Italic"),m=s.name.includes("Light");i+=`
|
|
31
31
|
@font-face {
|
|
32
32
|
font-style: ${h?"italic":"normal"};
|
|
33
33
|
font-weight: ${f?"normal":p?"bold":m?"200":"normal"};
|
|
@@ -35,14 +35,14 @@ Actual: `+A.attribValue);else{var F=A.tag,R=A.tags[A.tags.length-1]||A;F.ns===R.
|
|
|
35
35
|
font-family: ${s.fontFamily};
|
|
36
36
|
src: url(${d}) format('truetype');
|
|
37
37
|
}
|
|
38
|
-
`}return i}getDocumentInternalId(){const e="word/settings.xml";this.convertedXml[e]||(this.convertedXml[e]=fA);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=bo().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=I6({...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 kg(this).schemaToXml(e,n)}async exportToDocx(e,n,r,o=!1,i,s=[],a){const l=s.map(m=>SA(m)),c=l.map((m,y)=>EA(m,y,l)),{result:u,params:d}=this.exportToXmlJson({data:e,editorSchema:n,comments:s,commentDefinitions:c,commentsExportType:i,isFinalDoc:o,editor:a}),f=new kg(this).schemaToXml(u);await Yn(this,Ro,H1).call(this,{...r,...d.media,...this.media});let p={...this.convertedXml},h=[];if(s.length){const{documentXml:m,relationships:y}=Yn(this,Ro,V1).call(this,{defs:d.exportedCommentDefs,exportType:i,commentsWithParaIds:l});p={...m},h=y}return this.convertedXml={...this.convertedXml,...p},Yn(this,Ro,U1).call(this,[...d.relationships,...h]),q6(this.convertedXml),Yn(this,Ro,q1).call(this,d),f}exportToXmlJson({data:e,editorSchema:n,comments:r,commentDefinitions:o,commentsExportType:i="clean",isFinalDoc:s=!1,editor:a}){const l=this.savedTagsToRestore.find(d=>d.name==="w:body"),[c,u]=wi({node:e,bodyNode:l,relationships:[],documentMedia:{},media:{},isFinalDoc:s,editorSchema:n,converter:this,pageStyles:this.pageStyles,comments:r,commentsExportType:i,exportedCommentDefs:o,editor:a});return{result:c,params:u}}};Ro=new WeakSet,q1=function(t){const e="word/numbering.xml";let n=this.convertedXml[e];const r=this.numbering;n||(n=x1);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},V1=function({defs:t,exportType:e,commentsWithParaIds:n}){const{documentXml:r,relationships:o}=DA({exportType:e,convertedXml:this.convertedXml,defs:t,commentsWithParaIds:n,converter:this});return{documentXml:r,relationships:o}},U1=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,"&"),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},H1=async function(t){const e={};for(const n in t){if(typeof t[n]!="string")return;const r=n.split("/").pop();e[r]=await rA(t[n])}this.convertedXml.media={...this.convertedXml.media,...e},this.media=this.convertedXml.media,this.addedMedia=e},Xs(ji,"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"})),Xs(ji,"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"},{name:"w:shd",type:"highlight",mark:"highlight",property:"color"}]),Xs(ji,"propertyTypes",Object.freeze({"w:pPr":"paragraphProperties","w:rPr":"runProperties","w:sectPr":"sectionProperties","w:numPr":"numberingProperties","w:tcPr":"tableCellProperties"})),Xs(ji,"elements",new Set(["w:document","w:body","w:p","w:r","w:t","w:delText"]));let Dr=ji;function q6(t){const e="docProps/custom.xml";t[e]||(t[e]=G1());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(K1(i)),n.elements=o,t}function G1(){return dA}function K1(t=2,e="0.10.66"){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 ra(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 J1={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 ra=="function"&&ra;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 ra=="function"&&ra,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,D=p.compression,M=x!==c.utf8encode,I=a.transformTo("string",x(T.name)),E=a.transformTo("string",c.utf8encode(T.name)),U=T.comment,oe=a.transformTo("string",x(U)),N=a.transformTo("string",c.utf8encode(U)),W=E.length!==T.name.length,$=N.length!==U.length,J="",ie="",G="",de=T.dir,Y=T.date,ue={crc32:0,compressedSize:0,uncompressedSize:0};h&&!m||(ue.crc32=p.crc32,ue.compressedSize=p.compressedSize,ue.uncompressedSize=p.uncompressedSize);var Z=0;h&&(Z|=8),M||!W&&!$||(Z|=2048);var B=0,ee=0;de&&(B|=16),g==="UNIX"?(ee=798,B|=function(se,K){var A=se;return se||(A=K?16893:33204),(65535&A)<<16}(T.unixPermissions,de)):(ee=20,B|=function(se){return 63&(se||0)}(T.dosPermissions)),k=Y.getUTCHours(),k<<=6,k|=Y.getUTCMinutes(),k<<=5,k|=Y.getUTCSeconds()/2,b=Y.getUTCFullYear()-1980,b<<=4,b|=Y.getUTCMonth()+1,b<<=5,b|=Y.getUTCDate(),W&&(ie=i(1,1)+i(u(I),4)+E,J+="up"+i(ie.length,2)+ie),$&&(G=i(1,1)+i(u(oe),4)+N,J+="uc"+i(G.length,2)+G);var te="";return te+=`
|
|
38
|
+
`}return i}getDocumentInternalId(){const e="word/settings.xml";this.convertedXml[e]||(this.convertedXml[e]=fA);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=bo().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=I6({...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 kg(this).schemaToXml(e,n)}async exportToDocx(e,n,r,o=!1,i,s=[],a){const l=s.map(m=>SA(m)),c=l.map((m,y)=>EA(m,y,l)),{result:u,params:d}=this.exportToXmlJson({data:e,editorSchema:n,comments:s,commentDefinitions:c,commentsExportType:i,isFinalDoc:o,editor:a}),f=new kg(this).schemaToXml(u);await Yn(this,Ro,H1).call(this,{...r,...d.media,...this.media});let p={...this.convertedXml},h=[];if(s.length){const{documentXml:m,relationships:y}=Yn(this,Ro,V1).call(this,{defs:d.exportedCommentDefs,exportType:i,commentsWithParaIds:l});p={...m},h=y}return this.convertedXml={...this.convertedXml,...p},Yn(this,Ro,U1).call(this,[...d.relationships,...h]),q6(this.convertedXml),Yn(this,Ro,q1).call(this,d),f}exportToXmlJson({data:e,editorSchema:n,comments:r,commentDefinitions:o,commentsExportType:i="clean",isFinalDoc:s=!1,editor:a}){const l=this.savedTagsToRestore.find(d=>d.name==="w:body"),[c,u]=wi({node:e,bodyNode:l,relationships:[],documentMedia:{},media:{},isFinalDoc:s,editorSchema:n,converter:this,pageStyles:this.pageStyles,comments:r,commentsExportType:i,exportedCommentDefs:o,editor:a});return{result:c,params:u}}};Ro=new WeakSet,q1=function(t){const e="word/numbering.xml";let n=this.convertedXml[e];const r=this.numbering;n||(n=x1);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},V1=function({defs:t,exportType:e,commentsWithParaIds:n}){const{documentXml:r,relationships:o}=DA({exportType:e,convertedXml:this.convertedXml,defs:t,commentsWithParaIds:n,converter:this});return{documentXml:r,relationships:o}},U1=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,"&"),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},H1=async function(t){const e={};for(const n in t){if(typeof t[n]!="string")return;const r=n.split("/").pop();e[r]=await rA(t[n])}this.convertedXml.media={...this.convertedXml.media,...e},this.media=this.convertedXml.media,this.addedMedia=e},Xs(ji,"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"})),Xs(ji,"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"},{name:"w:shd",type:"highlight",mark:"highlight",property:"color"}]),Xs(ji,"propertyTypes",Object.freeze({"w:pPr":"paragraphProperties","w:rPr":"runProperties","w:sectPr":"sectionProperties","w:numPr":"numberingProperties","w:tcPr":"tableCellProperties"})),Xs(ji,"elements",new Set(["w:document","w:body","w:p","w:r","w:t","w:delText"]));let Dr=ji;function q6(t){const e="docProps/custom.xml";t[e]||(t[e]=G1());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(K1(i)),n.elements=o,t}function G1(){return dA}function K1(t=2,e="0.10.67"){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 ra(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 J1={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 ra=="function"&&ra;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 ra=="function"&&ra,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,D=p.compression,M=x!==c.utf8encode,I=a.transformTo("string",x(T.name)),E=a.transformTo("string",c.utf8encode(T.name)),U=T.comment,oe=a.transformTo("string",x(U)),N=a.transformTo("string",c.utf8encode(U)),W=E.length!==T.name.length,$=N.length!==U.length,J="",ie="",G="",de=T.dir,Y=T.date,ue={crc32:0,compressedSize:0,uncompressedSize:0};h&&!m||(ue.crc32=p.crc32,ue.compressedSize=p.compressedSize,ue.uncompressedSize=p.uncompressedSize);var Z=0;h&&(Z|=8),M||!W&&!$||(Z|=2048);var B=0,ee=0;de&&(B|=16),g==="UNIX"?(ee=798,B|=function(se,K){var A=se;return se||(A=K?16893:33204),(65535&A)<<16}(T.unixPermissions,de)):(ee=20,B|=function(se){return 63&(se||0)}(T.dosPermissions)),k=Y.getUTCHours(),k<<=6,k|=Y.getUTCMinutes(),k<<=5,k|=Y.getUTCSeconds()/2,b=Y.getUTCFullYear()-1980,b<<=4,b|=Y.getUTCMonth()+1,b<<=5,b|=Y.getUTCDate(),W&&(ie=i(1,1)+i(u(I),4)+E,J+="up"+i(ie.length,2)+ie),$&&(G=i(1,1)+i(u(oe),4)+N,J+="uc"+i(G.length,2)+G);var te="";return te+=`
|
|
39
39
|
\0`,te+=i(Z,2),te+=D.magic,te+=i(k,2),te+=i(b,2),te+=i(ue.crc32,4),te+=i(ue.compressedSize,4),te+=i(ue.uncompressedSize,4),te+=i(I.length,2),te+=i(J.length,2),{fileRecord:d.LOCAL_FILE_HEADER+te+I+J,dirRecord:d.CENTRAL_FILE_HEADER+i(ee,2)+te+i(oe.length,2)+"\0\0\0\0"+i(B,4)+i(y,4)+I+J+oe}}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 D=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(D.length,2)+D}(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 pt<"u",newBufferFrom:function(i,s){if(pt.from&&pt.from!==Uint8Array.from)return pt.from(i,s);if(typeof i=="number")throw new Error('The "data" argument must not be a number');return new pt(i,s)},allocBuffer:function(i){if(pt.alloc)return pt.alloc(i);var s=new pt(i);return s.fill(0),s},isBuffer:function(i){return pt.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,D,M){var I,E=a.getTypeOf(D),U=a.extend(M||{},u);U.date=U.date||new Date,U.compression!==null&&(U.compression=U.compression.toUpperCase()),typeof U.unixPermissions=="string"&&(U.unixPermissions=parseInt(U.unixPermissions,8)),U.unixPermissions&&16384&U.unixPermissions&&(U.dir=!0),U.dosPermissions&&16&U.dosPermissions&&(U.dir=!0),U.dir&&(T=g(T)),U.createFolders&&(I=y(T))&&x.call(this,I,!0);var oe=E==="string"&&U.binary===!1&&U.base64===!1;M&&M.binary!==void 0||(U.binary=!oe),(D instanceof d&&D.uncompressedSize===0||U.dir||!D||D.length===0)&&(U.base64=!1,U.binary=!0,D="",U.compression="STORE",E="string");var N=null;N=D instanceof d||D instanceof l?D:h.isNode&&h.isStream(D)?new m(T,D):a.prepareContent(T,D,U.binary,U.optimizedBinaryString,U.base64);var W=new f(T,N,U);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 D=T.lastIndexOf("/");return 0<D?T.substring(0,D):""},g=function(T){return T.slice(-1)!=="/"&&(T+="/"),T},x=function(T,D){return D=D!==void 0?D:u.createFolders,T=g(T),this.files[T]||i.call(this,T,null,{dir:!0,createFolders:D}),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 D,M,I;for(D in this.files)I=this.files[D],(M=D.slice(this.root.length,D.length))&&D.slice(0,this.root.length)===this.root&&T(M,I)},filter:function(T){var D=[];return this.forEach(function(M,I){T(M,I)&&D.push(I)}),D},file:function(T,D,M){if(arguments.length!==1)return T=this.root+T,i.call(this,T,D,M),this;if(k(T)){var I=T;return this.filter(function(U,oe){return!oe.dir&&I.test(U)})}var E=this.files[this.root+T];return E&&!E.dir?E:null},folder:function(T){if(!T)return this;if(k(T))return this.filter(function(E,U){return U.dir&&T.test(E)});var D=this.root+T,M=x.call(this,D),I=this.clone();return I.root=M.name,I},remove:function(T){T=this.root+T;var D=this.files[T];if(D||(T.slice(-1)!=="/"&&(T+="/"),D=this.files[T]),D&&!D.dir)delete this.files[T];else for(var M=this.filter(function(E,U){return U.name.slice(0,T.length)===T}),I=0;I<M.length;I++)delete this.files[M[I].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 D,M={};try{if((M=a.extend(T||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:s.utf8encode})).type=M.type.toLowerCase(),M.compression=M.compression.toUpperCase(),M.type==="binarystring"&&(M.type="string"),!M.type)throw new Error("No output type specified.");a.checkSupport(M.type),M.platform!=="darwin"&&M.platform!=="freebsd"&&M.platform!=="linux"&&M.platform!=="sunos"||(M.platform="UNIX"),M.platform==="win32"&&(M.platform="DOS");var I=M.comment||this.comment||"";D=p.generateWorker(this,M,I)}catch(E){(D=new l("error")).error(E)}return new c(D,M.type||"string",M.mimeType)},generateAsync:function(T,D){return this.generateInternalStream(T).accumulate(D)},generateNodeStream:function(T,D){return(T=T||{}).type||(T.type="nodebuffer"),this.generateInternalStream(T).toNodejsStream(D)}};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(D,M){x.push(D),m&&m(M)}).on("error",function(D){x=[],g(D)}).on("end",function(){try{var D=function(M,I,E){switch(M){case"blob":return i.newBlob(i.transformTo("arraybuffer",I),E);case"base64":return l.encode(I);default:return i.transformTo(M,I)}}(b,function(M,I){var E,U=0,oe=null,N=0;for(E=0;E<I.length;E++)N+=I[E].length;switch(M){case"string":return I.join("");case"array":return Array.prototype.concat.apply([],I);case"uint8array":for(oe=new Uint8Array(N),E=0;E<I.length;E++)oe.set(I[E],U),U+=I[E].length;return oe;case"nodebuffer":return pt.concat(I);default:throw new Error("concat : unsupported type '"+M+"'")}}(k,x),T);y(D)}catch(M){g(M)}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 pt<"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,D){var M=new FileReader;M.onload=function(I){T(I.target.result)},M.onerror=function(I){D(I.target.error)},M.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(D){return u(D,i.uint8array?new Uint8Array(D.length):new Array(D.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(M){k||(k=!0,a.reject(g,M))}function T(M){k||(k=!0,a.resolve(g,M))}var D=y(function(){x(T,b)});D.status==="error"&&b(D.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,D=g.queue.length;++T<D;)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),D=0,M=-1,I=new this(s);++M<k;)E(g[M],M);return I;function E(U,oe){x.resolve(U).then(function(N){T[oe]=N,++D!==k||b||(b=!0,a.resolve(I,T))},function(N){b||(b=!0,a.reject(I,N))})}},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,D=new this(s);++T<k;)M=g[T],x.resolve(M).then(function(I){b||(b=!0,a.resolve(D,I))},function(I){b||(b=!0,a.reject(D,I))});var M;return D}},{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,D=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(D),T.next_out=0,T.avail_out=D),(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,D,M=this.strm,I=this.options.chunkSize,E=this.options.dictionary,U=!1;if(this.ended)return!1;x=y===~~y?y:y===!0?l.Z_FINISH:l.Z_NO_FLUSH,typeof m=="string"?M.input=a.binstring2buf(m):f.call(m)==="[object ArrayBuffer]"?M.input=new Uint8Array(m):M.input=m,M.next_in=0,M.avail_in=M.input.length;do{if(M.avail_out===0&&(M.output=new s.Buf8(I),M.next_out=0,M.avail_out=I),(g=i.inflate(M,l.Z_NO_FLUSH))===l.Z_NEED_DICT&&E&&(D=typeof E=="string"?a.string2buf(E):f.call(E)==="[object ArrayBuffer]"?new Uint8Array(E):E,g=i.inflateSetDictionary(this.strm,D)),g===l.Z_BUF_ERROR&&U===!0&&(g=l.Z_OK,U=!1),g!==l.Z_STREAM_END&&g!==l.Z_OK)return this.onEnd(g),!(this.ended=!0);M.next_out&&(M.avail_out!==0&&g!==l.Z_STREAM_END&&(M.avail_in!==0||x!==l.Z_FINISH&&x!==l.Z_SYNC_FLUSH)||(this.options.to==="string"?(k=a.utf8border(M.output,M.next_out),b=M.next_out-k,T=a.buf2string(M.output,k),M.next_out=b,M.avail_out=I-b,b&&s.arraySet(M.output,M.output,k,b,0),this.onData(T)):this.onData(s.shrinkBuf(M.output,M.next_out)))),M.avail_in===0&&M.avail_out===0&&(U=!0)}while((0<M.avail_in||M.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),!(M.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,D=19,M=2*b+1,I=15,E=3,U=258,oe=U+E+1,N=42,W=113,$=1,J=2,ie=3,G=4;function de(S,re){return S.msg=u[re],re}function Y(S){return(S<<1)-(4<S?9:0)}function ue(S){for(var re=S.length;0<=--re;)S[re]=0}function Z(S){var re=S.state,Q=re.pending;Q>S.avail_out&&(Q=S.avail_out),Q!==0&&(s.arraySet(S.output,re.pending_buf,re.pending_out,Q,S.next_out),S.next_out+=Q,re.pending_out+=Q,S.total_out+=Q,S.avail_out-=Q,re.pending-=Q,re.pending===0&&(re.pending_out=0))}function B(S,re){a._tr_flush_block(S,0<=S.block_start?S.block_start:-1,S.strstart-S.block_start,re),S.block_start=S.strstart,Z(S.strm)}function ee(S,re){S.pending_buf[S.pending++]=re}function te(S,re){S.pending_buf[S.pending++]=re>>>8&255,S.pending_buf[S.pending++]=255&re}function se(S,re){var Q,L,j=S.max_chain_length,z=S.strstart,ce=S.prev_length,pe=S.nice_match,ae=S.strstart>S.w_size-oe?S.strstart-(S.w_size-oe):0,ge=S.window,ve=S.w_mask,me=S.prev,Se=S.strstart+U,he=ge[z+ce-1],we=ge[z+ce];S.prev_length>=S.good_match&&(j>>=2),pe>S.lookahead&&(pe=S.lookahead);do if(ge[(Q=re)+ce]===we&&ge[Q+ce-1]===he&&ge[Q]===ge[z]&&ge[++Q]===ge[z+1]){z+=2,Q++;do;while(ge[++z]===ge[++Q]&&ge[++z]===ge[++Q]&&ge[++z]===ge[++Q]&&ge[++z]===ge[++Q]&&ge[++z]===ge[++Q]&&ge[++z]===ge[++Q]&&ge[++z]===ge[++Q]&&ge[++z]===ge[++Q]&&z<Se);if(L=U-(Se-z),z=Se-U,ce<L){if(S.match_start=re,pe<=(ce=L))break;he=ge[z+ce-1],we=ge[z+ce]}}while((re=me[re&ve])>ae&&--j!=0);return ce<=S.lookahead?ce:S.lookahead}function K(S){var re,Q,L,j,z,ce,pe,ae,ge,ve,me=S.w_size;do{if(j=S.window_size-S.lookahead-S.strstart,S.strstart>=me+(me-oe)){for(s.arraySet(S.window,S.window,me,me,0),S.match_start-=me,S.strstart-=me,S.block_start-=me,re=Q=S.hash_size;L=S.head[--re],S.head[re]=me<=L?L-me:0,--Q;);for(re=Q=me;L=S.prev[--re],S.prev[re]=me<=L?L-me:0,--Q;);j+=me}if(S.strm.avail_in===0)break;if(ce=S.strm,pe=S.window,ae=S.strstart+S.lookahead,ge=j,ve=void 0,ve=ce.avail_in,ge<ve&&(ve=ge),Q=ve===0?0:(ce.avail_in-=ve,s.arraySet(pe,ce.input,ce.next_in,ve,ae),ce.state.wrap===1?ce.adler=l(ce.adler,pe,ve,ae):ce.state.wrap===2&&(ce.adler=c(ce.adler,pe,ve,ae)),ce.next_in+=ve,ce.total_in+=ve,ve),S.lookahead+=Q,S.lookahead+S.insert>=E)for(z=S.strstart-S.insert,S.ins_h=S.window[z],S.ins_h=(S.ins_h<<S.hash_shift^S.window[z+1])&S.hash_mask;S.insert&&(S.ins_h=(S.ins_h<<S.hash_shift^S.window[z+E-1])&S.hash_mask,S.prev[z&S.w_mask]=S.head[S.ins_h],S.head[S.ins_h]=z,z++,S.insert--,!(S.lookahead+S.insert<E)););}while(S.lookahead<oe&&S.strm.avail_in!==0)}function A(S,re){for(var Q,L;;){if(S.lookahead<oe){if(K(S),S.lookahead<oe&&re===d)return $;if(S.lookahead===0)break}if(Q=0,S.lookahead>=E&&(S.ins_h=(S.ins_h<<S.hash_shift^S.window[S.strstart+E-1])&S.hash_mask,Q=S.prev[S.strstart&S.w_mask]=S.head[S.ins_h],S.head[S.ins_h]=S.strstart),Q!==0&&S.strstart-Q<=S.w_size-oe&&(S.match_length=se(S,Q)),S.match_length>=E)if(L=a._tr_tally(S,S.strstart-S.match_start,S.match_length-E),S.lookahead-=S.match_length,S.match_length<=S.max_lazy_match&&S.lookahead>=E){for(S.match_length--;S.strstart++,S.ins_h=(S.ins_h<<S.hash_shift^S.window[S.strstart+E-1])&S.hash_mask,Q=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 $}return S.insert=S.strstart<E-1?S.strstart:E-1,re===f?(B(S,!0),S.strm.avail_out===0?ie:G):S.last_lit&&(B(S,!1),S.strm.avail_out===0)?$:J}function C(S,re){for(var Q,L,j;;){if(S.lookahead<oe){if(K(S),S.lookahead<oe&&re===d)return $;if(S.lookahead===0)break}if(Q=0,S.lookahead>=E&&(S.ins_h=(S.ins_h<<S.hash_shift^S.window[S.strstart+E-1])&S.hash_mask,Q=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=E-1,Q!==0&&S.prev_length<S.max_lazy_match&&S.strstart-Q<=S.w_size-oe&&(S.match_length=se(S,Q),S.match_length<=5&&(S.strategy===1||S.match_length===E&&4096<S.strstart-S.match_start)&&(S.match_length=E-1)),S.prev_length>=E&&S.match_length<=S.prev_length){for(j=S.strstart+S.lookahead-E,L=a._tr_tally(S,S.strstart-1-S.prev_match,S.prev_length-E),S.lookahead-=S.prev_length-1,S.prev_length-=2;++S.strstart<=j&&(S.ins_h=(S.ins_h<<S.hash_shift^S.window[S.strstart+E-1])&S.hash_mask,Q=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=E-1,S.strstart++,L&&(B(S,!1),S.strm.avail_out===0))return $}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 $}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<E-1?S.strstart:E-1,re===f?(B(S,!0),S.strm.avail_out===0?ie:G):S.last_lit&&(B(S,!1),S.strm.avail_out===0)?$:J}function H(S,re,Q,L,j){this.good_length=S,this.max_lazy=re,this.nice_length=Q,this.max_chain=L,this.func=j}function P(){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*M),this.dyn_dtree=new s.Buf16(2*(2*T+1)),this.bl_tree=new s.Buf16(2*(2*D+1)),ue(this.dyn_ltree),ue(this.dyn_dtree),ue(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new s.Buf16(I+1),this.heap=new s.Buf16(2*b+1),ue(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new s.Buf16(2*b+1),ue(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 F(S){var re;return S&&S.state?(S.total_in=S.total_out=0,S.data_type=g,(re=S.state).pending=0,re.pending_out=0,re.wrap<0&&(re.wrap=-re.wrap),re.status=re.wrap?N:W,S.adler=re.wrap===2?0:1,re.last_flush=d,a._tr_init(re),p):de(S,h)}function R(S){var re=F(S);return re===p&&function(Q){Q.window_size=2*Q.w_size,ue(Q.head),Q.max_lazy_match=i[Q.level].max_lazy,Q.good_match=i[Q.level].good_length,Q.nice_match=i[Q.level].nice_length,Q.max_chain_length=i[Q.level].max_chain,Q.strstart=0,Q.block_start=0,Q.lookahead=0,Q.insert=0,Q.match_length=Q.prev_length=E-1,Q.match_available=0,Q.ins_h=0}(S.state),re}function le(S,re,Q,L,j,z){if(!S)return h;var ce=1;if(re===m&&(re=6),L<0?(ce=0,L=-L):15<L&&(ce=2,L-=16),j<1||k<j||Q!==x||L<8||15<L||re<0||9<re||z<0||y<z)return de(S,h);L===8&&(L=9);var pe=new P;return(S.state=pe).strm=S,pe.wrap=ce,pe.gzhead=null,pe.w_bits=L,pe.w_size=1<<pe.w_bits,pe.w_mask=pe.w_size-1,pe.hash_bits=j+7,pe.hash_size=1<<pe.hash_bits,pe.hash_mask=pe.hash_size-1,pe.hash_shift=~~((pe.hash_bits+E-1)/E),pe.window=new s.Buf8(2*pe.w_size),pe.head=new s.Buf16(pe.hash_size),pe.prev=new s.Buf16(pe.w_size),pe.lit_bufsize=1<<j+6,pe.pending_buf_size=4*pe.lit_bufsize,pe.pending_buf=new s.Buf8(pe.pending_buf_size),pe.d_buf=1*pe.lit_bufsize,pe.l_buf=3*pe.lit_bufsize,pe.level=re,pe.strategy=z,pe.method=Q,R(S)}i=[new H(0,0,0,0,function(S,re){var Q=65535;for(Q>S.pending_buf_size-5&&(Q=S.pending_buf_size-5);;){if(S.lookahead<=1){if(K(S),S.lookahead===0&&re===d)return $;if(S.lookahead===0)break}S.strstart+=S.lookahead,S.lookahead=0;var L=S.block_start+Q;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-oe&&(B(S,!1),S.strm.avail_out===0))return $}return S.insert=0,re===f?(B(S,!0),S.strm.avail_out===0?ie:G):(S.strstart>S.block_start&&(B(S,!1),S.strm.avail_out),$)}),new H(4,4,8,4,A),new H(4,5,16,8,A),new H(4,6,32,32,A),new H(4,4,16,16,C),new H(8,16,32,32,C),new H(8,16,128,128,C),new H(8,32,128,256,C),new H(32,128,258,1024,C),new H(32,258,258,4096,C)],o.deflateInit=function(S,re){return le(S,re,x,15,8,0)},o.deflateInit2=le,o.deflateReset=R,o.deflateResetKeep=F,o.deflateSetHeader=function(S,re){return S&&S.state?S.state.wrap!==2?h:(S.state.gzhead=re,p):h},o.deflate=function(S,re){var Q,L,j,z;if(!S||!S.state||5<re||re<0)return S?de(S,h):h;if(L=S.state,!S.output||!S.input&&S.avail_in!==0||L.status===666&&re!==f)return de(S,S.avail_out===0?-5:h);if(L.strm=S,Q=L.last_flush,L.last_flush=re,L.status===N)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 ce=x+(L.w_bits-8<<4)<<8;ce|=(2<=L.strategy||L.level<2?0:L.level<6?1:L.level===6?2:3)<<6,L.strstart!==0&&(ce|=32),ce+=31-ce%31,L.status=W,te(L,ce),L.strstart!==0&&(te(L,S.adler>>>16),te(L,65535&S.adler)),S.adler=1}if(L.status===69)if(L.gzhead.extra){for(j=L.pending;L.gzindex<(65535&L.gzhead.extra.length)&&(L.pending!==L.pending_buf_size||(L.gzhead.hcrc&&L.pending>j&&(S.adler=c(S.adler,L.pending_buf,L.pending-j,j)),Z(S),j=L.pending,L.pending!==L.pending_buf_size));)ee(L,255&L.gzhead.extra[L.gzindex]),L.gzindex++;L.gzhead.hcrc&&L.pending>j&&(S.adler=c(S.adler,L.pending_buf,L.pending-j,j)),L.gzindex===L.gzhead.extra.length&&(L.gzindex=0,L.status=73)}else L.status=73;if(L.status===73)if(L.gzhead.name){j=L.pending;do{if(L.pending===L.pending_buf_size&&(L.gzhead.hcrc&&L.pending>j&&(S.adler=c(S.adler,L.pending_buf,L.pending-j,j)),Z(S),j=L.pending,L.pending===L.pending_buf_size)){z=1;break}z=L.gzindex<L.gzhead.name.length?255&L.gzhead.name.charCodeAt(L.gzindex++):0,ee(L,z)}while(z!==0);L.gzhead.hcrc&&L.pending>j&&(S.adler=c(S.adler,L.pending_buf,L.pending-j,j)),z===0&&(L.gzindex=0,L.status=91)}else L.status=91;if(L.status===91)if(L.gzhead.comment){j=L.pending;do{if(L.pending===L.pending_buf_size&&(L.gzhead.hcrc&&L.pending>j&&(S.adler=c(S.adler,L.pending_buf,L.pending-j,j)),Z(S),j=L.pending,L.pending===L.pending_buf_size)){z=1;break}z=L.gzindex<L.gzhead.comment.length?255&L.gzhead.comment.charCodeAt(L.gzindex++):0,ee(L,z)}while(z!==0);L.gzhead.hcrc&&L.pending>j&&(S.adler=c(S.adler,L.pending_buf,L.pending-j,j)),z===0&&(L.status=103)}else L.status=103;if(L.status===103&&(L.gzhead.hcrc?(L.pending+2>L.pending_buf_size&&Z(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(Z(S),S.avail_out===0)return L.last_flush=-1,p}else if(S.avail_in===0&&Y(re)<=Y(Q)&&re!==f)return de(S,-5);if(L.status===666&&S.avail_in!==0)return de(S,-5);if(S.avail_in!==0||L.lookahead!==0||re!==d&&L.status!==666){var pe=L.strategy===2?function(ae,ge){for(var ve;;){if(ae.lookahead===0&&(K(ae),ae.lookahead===0)){if(ge===d)return $;break}if(ae.match_length=0,ve=a._tr_tally(ae,0,ae.window[ae.strstart]),ae.lookahead--,ae.strstart++,ve&&(B(ae,!1),ae.strm.avail_out===0))return $}return ae.insert=0,ge===f?(B(ae,!0),ae.strm.avail_out===0?ie:G):ae.last_lit&&(B(ae,!1),ae.strm.avail_out===0)?$:J}(L,re):L.strategy===3?function(ae,ge){for(var ve,me,Se,he,we=ae.window;;){if(ae.lookahead<=U){if(K(ae),ae.lookahead<=U&&ge===d)return $;if(ae.lookahead===0)break}if(ae.match_length=0,ae.lookahead>=E&&0<ae.strstart&&(me=we[Se=ae.strstart-1])===we[++Se]&&me===we[++Se]&&me===we[++Se]){he=ae.strstart+U;do;while(me===we[++Se]&&me===we[++Se]&&me===we[++Se]&&me===we[++Se]&&me===we[++Se]&&me===we[++Se]&&me===we[++Se]&&me===we[++Se]&&Se<he);ae.match_length=U-(he-Se),ae.match_length>ae.lookahead&&(ae.match_length=ae.lookahead)}if(ae.match_length>=E?(ve=a._tr_tally(ae,1,ae.match_length-E),ae.lookahead-=ae.match_length,ae.strstart+=ae.match_length,ae.match_length=0):(ve=a._tr_tally(ae,0,ae.window[ae.strstart]),ae.lookahead--,ae.strstart++),ve&&(B(ae,!1),ae.strm.avail_out===0))return $}return ae.insert=0,ge===f?(B(ae,!0),ae.strm.avail_out===0?ie:G):ae.last_lit&&(B(ae,!1),ae.strm.avail_out===0)?$:J}(L,re):i[L.level].func(L,re);if(pe!==ie&&pe!==G||(L.status=666),pe===$||pe===ie)return S.avail_out===0&&(L.last_flush=-1),p;if(pe===J&&(re===1?a._tr_align(L):re!==5&&(a._tr_stored_block(L,0,0,!1),re===3&&(ue(L.head),L.lookahead===0&&(L.strstart=0,L.block_start=0,L.insert=0))),Z(S),S.avail_out===0))return L.last_flush=-1,p}return re!==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)):(te(L,S.adler>>>16),te(L,65535&S.adler)),Z(S),0<L.wrap&&(L.wrap=-L.wrap),L.pending!==0?p:1)},o.deflateEnd=function(S){var re;return S&&S.state?(re=S.state.status)!==N&&re!==69&&re!==73&&re!==91&&re!==103&&re!==W&&re!==666?de(S,h):(S.state=null,re===W?de(S,-3):p):h},o.deflateSetDictionary=function(S,re){var Q,L,j,z,ce,pe,ae,ge,ve=re.length;if(!S||!S.state||(z=(Q=S.state).wrap)===2||z===1&&Q.status!==N||Q.lookahead)return h;for(z===1&&(S.adler=l(S.adler,re,ve,0)),Q.wrap=0,ve>=Q.w_size&&(z===0&&(ue(Q.head),Q.strstart=0,Q.block_start=0,Q.insert=0),ge=new s.Buf8(Q.w_size),s.arraySet(ge,re,ve-Q.w_size,Q.w_size,0),re=ge,ve=Q.w_size),ce=S.avail_in,pe=S.next_in,ae=S.input,S.avail_in=ve,S.next_in=0,S.input=re,K(Q);Q.lookahead>=E;){for(L=Q.strstart,j=Q.lookahead-(E-1);Q.ins_h=(Q.ins_h<<Q.hash_shift^Q.window[L+E-1])&Q.hash_mask,Q.prev[L&Q.w_mask]=Q.head[Q.ins_h],Q.head[Q.ins_h]=L,L++,--j;);Q.strstart=L,Q.lookahead=E-1,K(Q)}return Q.strstart+=Q.lookahead,Q.block_start=Q.strstart,Q.insert=Q.lookahead,Q.lookahead=0,Q.match_length=Q.prev_length=E-1,Q.match_available=0,S.next_in=pe,S.input=ae,S.avail_in=ce,Q.wrap=z,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,D,M,I,E,U,oe,N,W,$,J;a=i.state,l=i.next_in,$=i.input,c=l+(i.avail_in-5),u=i.next_out,J=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,D=(1<<a.lenbits)-1,M=(1<<a.distbits)-1;e:do{k<15&&(x+=$[l++]<<k,k+=8,x+=$[l++]<<k,k+=8),I=b[x&D];t:for(;;){if(x>>>=E=I>>>24,k-=E,(E=I>>>16&255)===0)J[u++]=65535&I;else{if(!(16&E)){if(!(64&E)){I=b[(65535&I)+(x&(1<<E)-1)];continue t}if(32&E){a.mode=12;break e}i.msg="invalid literal/length code",a.mode=30;break e}U=65535&I,(E&=15)&&(k<E&&(x+=$[l++]<<k,k+=8),U+=x&(1<<E)-1,x>>>=E,k-=E),k<15&&(x+=$[l++]<<k,k+=8,x+=$[l++]<<k,k+=8),I=T[x&M];n:for(;;){if(x>>>=E=I>>>24,k-=E,!(16&(E=I>>>16&255))){if(!(64&E)){I=T[(65535&I)+(x&(1<<E)-1)];continue n}i.msg="invalid distance code",a.mode=30;break e}if(oe=65535&I,k<(E&=15)&&(x+=$[l++]<<k,(k+=8)<E&&(x+=$[l++]<<k,k+=8)),p<(oe+=x&(1<<E)-1)){i.msg="invalid distance too far back",a.mode=30;break e}if(x>>>=E,k-=E,(E=u-d)<oe){if(m<(E=oe-E)&&a.sane){i.msg="invalid distance too far back",a.mode=30;break e}if(W=g,(N=0)===y){if(N+=h-E,E<U){for(U-=E;J[u++]=g[N++],--E;);N=u-oe,W=J}}else if(y<E){if(N+=h+y-E,(E-=y)<U){for(U-=E;J[u++]=g[N++],--E;);if(N=0,y<U){for(U-=E=y;J[u++]=g[N++],--E;);N=u-oe,W=J}}}else if(N+=y-E,E<U){for(U-=E;J[u++]=g[N++],--E;);N=u-oe,W=J}for(;2<U;)J[u++]=W[N++],J[u++]=W[N++],J[u++]=W[N++],U-=3;U&&(J[u++]=W[N++],1<U&&(J[u++]=W[N++]))}else{for(N=u-oe;J[u++]=J[N++],J[u++]=J[N++],J[u++]=J[N++],2<(U-=3););U&&(J[u++]=J[N++],1<U&&(J[u++]=J[N++]))}break}}break}}while(l<c&&u<f);l-=U=k>>3,x&=(1<<(k-=U<<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(N){return(N>>>24&255)+(N>>>8&65280)+((65280&N)<<8)+((255&N)<<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(N){var W;return N&&N.state?(W=N.state,N.total_in=N.total_out=W.total=0,N.msg="",W.wrap&&(N.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(N){var W;return N&&N.state?((W=N.state).wsize=0,W.whave=0,W.wnext=0,k(N)):p}function T(N,W){var $,J;return N&&N.state?(J=N.state,W<0?($=0,W=-W):($=1+(W>>4),W<48&&(W&=15)),W&&(W<8||15<W)?p:(J.window!==null&&J.wbits!==W&&(J.window=null),J.wrap=$,J.wbits=W,b(N))):p}function D(N,W){var $,J;return N?(J=new x,(N.state=J).window=null,($=T(N,W))!==f&&(N.state=null),$):p}var M,I,E=!0;function U(N){if(E){var W;for(M=new i.Buf32(512),I=new i.Buf32(32),W=0;W<144;)N.lens[W++]=8;for(;W<256;)N.lens[W++]=9;for(;W<280;)N.lens[W++]=7;for(;W<288;)N.lens[W++]=8;for(c(u,N.lens,0,288,M,0,N.work,{bits:9}),W=0;W<32;)N.lens[W++]=5;c(d,N.lens,0,32,I,0,N.work,{bits:5}),E=!1}N.lencode=M,N.lenbits=9,N.distcode=I,N.distbits=5}function oe(N,W,$,J){var ie,G=N.state;return G.window===null&&(G.wsize=1<<G.wbits,G.wnext=0,G.whave=0,G.window=new i.Buf8(G.wsize)),J>=G.wsize?(i.arraySet(G.window,W,$-G.wsize,G.wsize,0),G.wnext=0,G.whave=G.wsize):(J<(ie=G.wsize-G.wnext)&&(ie=J),i.arraySet(G.window,W,$-J,ie,G.wnext),(J-=ie)?(i.arraySet(G.window,W,$-J,J,0),G.wnext=J,G.whave=G.wsize):(G.wnext+=ie,G.wnext===G.wsize&&(G.wnext=0),G.whave<G.wsize&&(G.whave+=ie))),0}o.inflateReset=b,o.inflateReset2=T,o.inflateResetKeep=k,o.inflateInit=function(N){return D(N,15)},o.inflateInit2=D,o.inflate=function(N,W){var $,J,ie,G,de,Y,ue,Z,B,ee,te,se,K,A,C,H,P,F,R,le,S,re,Q,L,j=0,z=new i.Buf8(4),ce=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!N||!N.state||!N.output||!N.input&&N.avail_in!==0)return p;($=N.state).mode===12&&($.mode=13),de=N.next_out,ie=N.output,ue=N.avail_out,G=N.next_in,J=N.input,Y=N.avail_in,Z=$.hold,B=$.bits,ee=Y,te=ue,re=f;e:for(;;)switch($.mode){case h:if($.wrap===0){$.mode=13;break}for(;B<16;){if(Y===0)break e;Y--,Z+=J[G++]<<B,B+=8}if(2&$.wrap&&Z===35615){z[$.check=0]=255&Z,z[1]=Z>>>8&255,$.check=a($.check,z,2,0),B=Z=0,$.mode=2;break}if($.flags=0,$.head&&($.head.done=!1),!(1&$.wrap)||(((255&Z)<<8)+(Z>>8))%31){N.msg="incorrect header check",$.mode=30;break}if((15&Z)!=8){N.msg="unknown compression method",$.mode=30;break}if(B-=4,S=8+(15&(Z>>>=4)),$.wbits===0)$.wbits=S;else if(S>$.wbits){N.msg="invalid window size",$.mode=30;break}$.dmax=1<<S,N.adler=$.check=1,$.mode=512&Z?10:12,B=Z=0;break;case 2:for(;B<16;){if(Y===0)break e;Y--,Z+=J[G++]<<B,B+=8}if($.flags=Z,(255&$.flags)!=8){N.msg="unknown compression method",$.mode=30;break}if(57344&$.flags){N.msg="unknown header flags set",$.mode=30;break}$.head&&($.head.text=Z>>8&1),512&$.flags&&(z[0]=255&Z,z[1]=Z>>>8&255,$.check=a($.check,z,2,0)),B=Z=0,$.mode=3;case 3:for(;B<32;){if(Y===0)break e;Y--,Z+=J[G++]<<B,B+=8}$.head&&($.head.time=Z),512&$.flags&&(z[0]=255&Z,z[1]=Z>>>8&255,z[2]=Z>>>16&255,z[3]=Z>>>24&255,$.check=a($.check,z,4,0)),B=Z=0,$.mode=4;case 4:for(;B<16;){if(Y===0)break e;Y--,Z+=J[G++]<<B,B+=8}$.head&&($.head.xflags=255&Z,$.head.os=Z>>8),512&$.flags&&(z[0]=255&Z,z[1]=Z>>>8&255,$.check=a($.check,z,2,0)),B=Z=0,$.mode=5;case 5:if(1024&$.flags){for(;B<16;){if(Y===0)break e;Y--,Z+=J[G++]<<B,B+=8}$.length=Z,$.head&&($.head.extra_len=Z),512&$.flags&&(z[0]=255&Z,z[1]=Z>>>8&255,$.check=a($.check,z,2,0)),B=Z=0}else $.head&&($.head.extra=null);$.mode=6;case 6:if(1024&$.flags&&(Y<(se=$.length)&&(se=Y),se&&($.head&&(S=$.head.extra_len-$.length,$.head.extra||($.head.extra=new Array($.head.extra_len)),i.arraySet($.head.extra,J,G,se,S)),512&$.flags&&($.check=a($.check,J,se,G)),Y-=se,G+=se,$.length-=se),$.length))break e;$.length=0,$.mode=7;case 7:if(2048&$.flags){if(Y===0)break e;for(se=0;S=J[G+se++],$.head&&S&&$.length<65536&&($.head.name+=String.fromCharCode(S)),S&&se<Y;);if(512&$.flags&&($.check=a($.check,J,se,G)),Y-=se,G+=se,S)break e}else $.head&&($.head.name=null);$.length=0,$.mode=8;case 8:if(4096&$.flags){if(Y===0)break e;for(se=0;S=J[G+se++],$.head&&S&&$.length<65536&&($.head.comment+=String.fromCharCode(S)),S&&se<Y;);if(512&$.flags&&($.check=a($.check,J,se,G)),Y-=se,G+=se,S)break e}else $.head&&($.head.comment=null);$.mode=9;case 9:if(512&$.flags){for(;B<16;){if(Y===0)break e;Y--,Z+=J[G++]<<B,B+=8}if(Z!==(65535&$.check)){N.msg="header crc mismatch",$.mode=30;break}B=Z=0}$.head&&($.head.hcrc=$.flags>>9&1,$.head.done=!0),N.adler=$.check=0,$.mode=12;break;case 10:for(;B<32;){if(Y===0)break e;Y--,Z+=J[G++]<<B,B+=8}N.adler=$.check=g(Z),B=Z=0,$.mode=11;case 11:if($.havedict===0)return N.next_out=de,N.avail_out=ue,N.next_in=G,N.avail_in=Y,$.hold=Z,$.bits=B,2;N.adler=$.check=1,$.mode=12;case 12:if(W===5||W===6)break e;case 13:if($.last){Z>>>=7&B,B-=7&B,$.mode=27;break}for(;B<3;){if(Y===0)break e;Y--,Z+=J[G++]<<B,B+=8}switch($.last=1&Z,B-=1,3&(Z>>>=1)){case 0:$.mode=14;break;case 1:if(U($),$.mode=20,W!==6)break;Z>>>=2,B-=2;break e;case 2:$.mode=17;break;case 3:N.msg="invalid block type",$.mode=30}Z>>>=2,B-=2;break;case 14:for(Z>>>=7&B,B-=7&B;B<32;){if(Y===0)break e;Y--,Z+=J[G++]<<B,B+=8}if((65535&Z)!=(Z>>>16^65535)){N.msg="invalid stored block lengths",$.mode=30;break}if($.length=65535&Z,B=Z=0,$.mode=15,W===6)break e;case 15:$.mode=16;case 16:if(se=$.length){if(Y<se&&(se=Y),ue<se&&(se=ue),se===0)break e;i.arraySet(ie,J,G,se,de),Y-=se,G+=se,ue-=se,de+=se,$.length-=se;break}$.mode=12;break;case 17:for(;B<14;){if(Y===0)break e;Y--,Z+=J[G++]<<B,B+=8}if($.nlen=257+(31&Z),Z>>>=5,B-=5,$.ndist=1+(31&Z),Z>>>=5,B-=5,$.ncode=4+(15&Z),Z>>>=4,B-=4,286<$.nlen||30<$.ndist){N.msg="too many length or distance symbols",$.mode=30;break}$.have=0,$.mode=18;case 18:for(;$.have<$.ncode;){for(;B<3;){if(Y===0)break e;Y--,Z+=J[G++]<<B,B+=8}$.lens[ce[$.have++]]=7&Z,Z>>>=3,B-=3}for(;$.have<19;)$.lens[ce[$.have++]]=0;if($.lencode=$.lendyn,$.lenbits=7,Q={bits:$.lenbits},re=c(0,$.lens,0,19,$.lencode,0,$.work,Q),$.lenbits=Q.bits,re){N.msg="invalid code lengths set",$.mode=30;break}$.have=0,$.mode=19;case 19:for(;$.have<$.nlen+$.ndist;){for(;H=(j=$.lencode[Z&(1<<$.lenbits)-1])>>>16&255,P=65535&j,!((C=j>>>24)<=B);){if(Y===0)break e;Y--,Z+=J[G++]<<B,B+=8}if(P<16)Z>>>=C,B-=C,$.lens[$.have++]=P;else{if(P===16){for(L=C+2;B<L;){if(Y===0)break e;Y--,Z+=J[G++]<<B,B+=8}if(Z>>>=C,B-=C,$.have===0){N.msg="invalid bit length repeat",$.mode=30;break}S=$.lens[$.have-1],se=3+(3&Z),Z>>>=2,B-=2}else if(P===17){for(L=C+3;B<L;){if(Y===0)break e;Y--,Z+=J[G++]<<B,B+=8}B-=C,S=0,se=3+(7&(Z>>>=C)),Z>>>=3,B-=3}else{for(L=C+7;B<L;){if(Y===0)break e;Y--,Z+=J[G++]<<B,B+=8}B-=C,S=0,se=11+(127&(Z>>>=C)),Z>>>=7,B-=7}if($.have+se>$.nlen+$.ndist){N.msg="invalid bit length repeat",$.mode=30;break}for(;se--;)$.lens[$.have++]=S}}if($.mode===30)break;if($.lens[256]===0){N.msg="invalid code -- missing end-of-block",$.mode=30;break}if($.lenbits=9,Q={bits:$.lenbits},re=c(u,$.lens,0,$.nlen,$.lencode,0,$.work,Q),$.lenbits=Q.bits,re){N.msg="invalid literal/lengths set",$.mode=30;break}if($.distbits=6,$.distcode=$.distdyn,Q={bits:$.distbits},re=c(d,$.lens,$.nlen,$.ndist,$.distcode,0,$.work,Q),$.distbits=Q.bits,re){N.msg="invalid distances set",$.mode=30;break}if($.mode=20,W===6)break e;case 20:$.mode=21;case 21:if(6<=Y&&258<=ue){N.next_out=de,N.avail_out=ue,N.next_in=G,N.avail_in=Y,$.hold=Z,$.bits=B,l(N,te),de=N.next_out,ie=N.output,ue=N.avail_out,G=N.next_in,J=N.input,Y=N.avail_in,Z=$.hold,B=$.bits,$.mode===12&&($.back=-1);break}for($.back=0;H=(j=$.lencode[Z&(1<<$.lenbits)-1])>>>16&255,P=65535&j,!((C=j>>>24)<=B);){if(Y===0)break e;Y--,Z+=J[G++]<<B,B+=8}if(H&&!(240&H)){for(F=C,R=H,le=P;H=(j=$.lencode[le+((Z&(1<<F+R)-1)>>F)])>>>16&255,P=65535&j,!(F+(C=j>>>24)<=B);){if(Y===0)break e;Y--,Z+=J[G++]<<B,B+=8}Z>>>=F,B-=F,$.back+=F}if(Z>>>=C,B-=C,$.back+=C,$.length=P,H===0){$.mode=26;break}if(32&H){$.back=-1,$.mode=12;break}if(64&H){N.msg="invalid literal/length code",$.mode=30;break}$.extra=15&H,$.mode=22;case 22:if($.extra){for(L=$.extra;B<L;){if(Y===0)break e;Y--,Z+=J[G++]<<B,B+=8}$.length+=Z&(1<<$.extra)-1,Z>>>=$.extra,B-=$.extra,$.back+=$.extra}$.was=$.length,$.mode=23;case 23:for(;H=(j=$.distcode[Z&(1<<$.distbits)-1])>>>16&255,P=65535&j,!((C=j>>>24)<=B);){if(Y===0)break e;Y--,Z+=J[G++]<<B,B+=8}if(!(240&H)){for(F=C,R=H,le=P;H=(j=$.distcode[le+((Z&(1<<F+R)-1)>>F)])>>>16&255,P=65535&j,!(F+(C=j>>>24)<=B);){if(Y===0)break e;Y--,Z+=J[G++]<<B,B+=8}Z>>>=F,B-=F,$.back+=F}if(Z>>>=C,B-=C,$.back+=C,64&H){N.msg="invalid distance code",$.mode=30;break}$.offset=P,$.extra=15&H,$.mode=24;case 24:if($.extra){for(L=$.extra;B<L;){if(Y===0)break e;Y--,Z+=J[G++]<<B,B+=8}$.offset+=Z&(1<<$.extra)-1,Z>>>=$.extra,B-=$.extra,$.back+=$.extra}if($.offset>$.dmax){N.msg="invalid distance too far back",$.mode=30;break}$.mode=25;case 25:if(ue===0)break e;if(se=te-ue,$.offset>se){if((se=$.offset-se)>$.whave&&$.sane){N.msg="invalid distance too far back",$.mode=30;break}K=se>$.wnext?(se-=$.wnext,$.wsize-se):$.wnext-se,se>$.length&&(se=$.length),A=$.window}else A=ie,K=de-$.offset,se=$.length;for(ue<se&&(se=ue),ue-=se,$.length-=se;ie[de++]=A[K++],--se;);$.length===0&&($.mode=21);break;case 26:if(ue===0)break e;ie[de++]=$.length,ue--,$.mode=21;break;case 27:if($.wrap){for(;B<32;){if(Y===0)break e;Y--,Z|=J[G++]<<B,B+=8}if(te-=ue,N.total_out+=te,$.total+=te,te&&(N.adler=$.check=$.flags?a($.check,ie,te,de-te):s($.check,ie,te,de-te)),te=ue,($.flags?Z:g(Z))!==$.check){N.msg="incorrect data check",$.mode=30;break}B=Z=0}$.mode=28;case 28:if($.wrap&&$.flags){for(;B<32;){if(Y===0)break e;Y--,Z+=J[G++]<<B,B+=8}if(Z!==(4294967295&$.total)){N.msg="incorrect length check",$.mode=30;break}B=Z=0}$.mode=29;case 29:re=1;break e;case 30:re=-3;break e;case 31:return-4;case 32:default:return p}return N.next_out=de,N.avail_out=ue,N.next_in=G,N.avail_in=Y,$.hold=Z,$.bits=B,($.wsize||te!==N.avail_out&&$.mode<30&&($.mode<27||W!==4))&&oe(N,N.output,N.next_out,te-N.avail_out)?($.mode=31,-4):(ee-=N.avail_in,te-=N.avail_out,N.total_in+=ee,N.total_out+=te,$.total+=te,$.wrap&&te&&(N.adler=$.check=$.flags?a($.check,ie,te,N.next_out-te):s($.check,ie,te,N.next_out-te)),N.data_type=$.bits+($.last?64:0)+($.mode===12?128:0)+($.mode===20||$.mode===15?256:0),(ee==0&&te===0||W===4)&&re===f&&(re=-5),re)},o.inflateEnd=function(N){if(!N||!N.state)return p;var W=N.state;return W.window&&(W.window=null),N.state=null,f},o.inflateGetHeader=function(N,W){var $;return N&&N.state&&2&($=N.state).wrap?(($.head=W).done=!1,f):p},o.inflateSetDictionary=function(N,W){var $,J=W.length;return N&&N.state?($=N.state).wrap!==0&&$.mode!==11?p:$.mode===11&&s(1,W,J,0)!==$.check?-3:oe(N,W,J,J)?($.mode=31,-4):($.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,D,M,I,E,U,oe=g.bits,N=0,W=0,$=0,J=0,ie=0,G=0,de=0,Y=0,ue=0,Z=0,B=null,ee=0,te=new i.Buf16(16),se=new i.Buf16(16),K=null,A=0;for(N=0;N<=15;N++)te[N]=0;for(W=0;W<p;W++)te[d[f+W]]++;for(ie=oe,J=15;1<=J&&te[J]===0;J--);if(J<ie&&(ie=J),J===0)return h[m++]=20971520,h[m++]=20971520,g.bits=1,0;for($=1;$<J&&te[$]===0;$++);for(ie<$&&(ie=$),N=Y=1;N<=15;N++)if(Y<<=1,(Y-=te[N])<0)return-1;if(0<Y&&(u===0||J!==1))return-1;for(se[1]=0,N=1;N<15;N++)se[N+1]=se[N]+te[N];for(W=0;W<p;W++)d[f+W]!==0&&(y[se[d[f+W]]++]=W);if(M=u===0?(B=K=y,19):u===1?(B=s,ee-=257,K=a,A-=257,256):(B=l,K=c,-1),N=$,D=m,de=W=Z=0,b=-1,T=(ue=1<<(G=ie))-1,u===1&&852<ue||u===2&&592<ue)return 1;for(;;){for(I=N-de,U=y[W]<M?(E=0,y[W]):y[W]>M?(E=K[A+y[W]],B[ee+y[W]]):(E=96,0),x=1<<N-de,$=k=1<<G;h[D+(Z>>de)+(k-=x)]=I<<24|E<<16|U|0,k!==0;);for(x=1<<N-1;Z&x;)x>>=1;if(x!==0?(Z&=x-1,Z+=x):Z=0,W++,--te[N]==0){if(N===J)break;N=d[f+y[W]]}if(ie<N&&(Z&T)!==b){for(de===0&&(de=ie),D+=$,Y=1<<(G=N-de);G+de<J&&!((Y-=te[G+de])<=0);)G++,Y<<=1;if(ue+=1<<G,u===1&&852<ue||u===2&&592<ue)return 1;h[b=Z&T]=ie<<24|G<<16|D-m|0}}return Z!==0&&(h[D+Z]=N-de<<24|64<<16|0),g.bits=ie,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(j){for(var z=j.length;0<=--z;)j[z]=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,D=18,M=[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],I=[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],E=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],U=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],oe=new Array(2*(f+2));l(oe);var N=new Array(2*p);l(N);var W=new Array(512);l(W);var $=new Array(256);l($);var J=new Array(u);l(J);var ie,G,de,Y=new Array(p);function ue(j,z,ce,pe,ae){this.static_tree=j,this.extra_bits=z,this.extra_base=ce,this.elems=pe,this.max_length=ae,this.has_stree=j&&j.length}function Z(j,z){this.dyn_tree=j,this.max_code=0,this.stat_desc=z}function B(j){return j<256?W[j]:W[256+(j>>>7)]}function ee(j,z){j.pending_buf[j.pending++]=255&z,j.pending_buf[j.pending++]=z>>>8&255}function te(j,z,ce){j.bi_valid>g-ce?(j.bi_buf|=z<<j.bi_valid&65535,ee(j,j.bi_buf),j.bi_buf=z>>g-j.bi_valid,j.bi_valid+=ce-g):(j.bi_buf|=z<<j.bi_valid&65535,j.bi_valid+=ce)}function se(j,z,ce){te(j,ce[2*z],ce[2*z+1])}function K(j,z){for(var ce=0;ce|=1&j,j>>>=1,ce<<=1,0<--z;);return ce>>>1}function A(j,z,ce){var pe,ae,ge=new Array(y+1),ve=0;for(pe=1;pe<=y;pe++)ge[pe]=ve=ve+ce[pe-1]<<1;for(ae=0;ae<=z;ae++){var me=j[2*ae+1];me!==0&&(j[2*ae]=K(ge[me]++,me))}}function C(j){var z;for(z=0;z<f;z++)j.dyn_ltree[2*z]=0;for(z=0;z<p;z++)j.dyn_dtree[2*z]=0;for(z=0;z<h;z++)j.bl_tree[2*z]=0;j.dyn_ltree[2*k]=1,j.opt_len=j.static_len=0,j.last_lit=j.matches=0}function H(j){8<j.bi_valid?ee(j,j.bi_buf):0<j.bi_valid&&(j.pending_buf[j.pending++]=j.bi_buf),j.bi_buf=0,j.bi_valid=0}function P(j,z,ce,pe){var ae=2*z,ge=2*ce;return j[ae]<j[ge]||j[ae]===j[ge]&&pe[z]<=pe[ce]}function F(j,z,ce){for(var pe=j.heap[ce],ae=ce<<1;ae<=j.heap_len&&(ae<j.heap_len&&P(z,j.heap[ae+1],j.heap[ae],j.depth)&&ae++,!P(z,pe,j.heap[ae],j.depth));)j.heap[ce]=j.heap[ae],ce=ae,ae<<=1;j.heap[ce]=pe}function R(j,z,ce){var pe,ae,ge,ve,me=0;if(j.last_lit!==0)for(;pe=j.pending_buf[j.d_buf+2*me]<<8|j.pending_buf[j.d_buf+2*me+1],ae=j.pending_buf[j.l_buf+me],me++,pe===0?se(j,ae,z):(se(j,(ge=$[ae])+d+1,z),(ve=M[ge])!==0&&te(j,ae-=J[ge],ve),se(j,ge=B(--pe),ce),(ve=I[ge])!==0&&te(j,pe-=Y[ge],ve)),me<j.last_lit;);se(j,k,z)}function le(j,z){var ce,pe,ae,ge=z.dyn_tree,ve=z.stat_desc.static_tree,me=z.stat_desc.has_stree,Se=z.stat_desc.elems,he=-1;for(j.heap_len=0,j.heap_max=m,ce=0;ce<Se;ce++)ge[2*ce]!==0?(j.heap[++j.heap_len]=he=ce,j.depth[ce]=0):ge[2*ce+1]=0;for(;j.heap_len<2;)ge[2*(ae=j.heap[++j.heap_len]=he<2?++he:0)]=1,j.depth[ae]=0,j.opt_len--,me&&(j.static_len-=ve[2*ae+1]);for(z.max_code=he,ce=j.heap_len>>1;1<=ce;ce--)F(j,ge,ce);for(ae=Se;ce=j.heap[1],j.heap[1]=j.heap[j.heap_len--],F(j,ge,1),pe=j.heap[1],j.heap[--j.heap_max]=ce,j.heap[--j.heap_max]=pe,ge[2*ae]=ge[2*ce]+ge[2*pe],j.depth[ae]=(j.depth[ce]>=j.depth[pe]?j.depth[ce]:j.depth[pe])+1,ge[2*ce+1]=ge[2*pe+1]=ae,j.heap[1]=ae++,F(j,ge,1),2<=j.heap_len;);j.heap[--j.heap_max]=j.heap[1],function(we,Pe){var v,O,_,X,q,V,ne=Pe.dyn_tree,ye=Pe.max_code,ke=Pe.stat_desc.static_tree,Ee=Pe.stat_desc.has_stree,Oe=Pe.stat_desc.extra_bits,_e=Pe.stat_desc.extra_base,Ke=Pe.stat_desc.max_length,st=0;for(X=0;X<=y;X++)we.bl_count[X]=0;for(ne[2*we.heap[we.heap_max]+1]=0,v=we.heap_max+1;v<m;v++)Ke<(X=ne[2*ne[2*(O=we.heap[v])+1]+1]+1)&&(X=Ke,st++),ne[2*O+1]=X,ye<O||(we.bl_count[X]++,q=0,_e<=O&&(q=Oe[O-_e]),V=ne[2*O],we.opt_len+=V*(X+q),Ee&&(we.static_len+=V*(ke[2*O+1]+q)));if(st!==0){do{for(X=Ke-1;we.bl_count[X]===0;)X--;we.bl_count[X]--,we.bl_count[X+1]+=2,we.bl_count[Ke]--,st-=2}while(0<st);for(X=Ke;X!==0;X--)for(O=we.bl_count[X];O!==0;)ye<(_=we.heap[--v])||(ne[2*_+1]!==X&&(we.opt_len+=(X-ne[2*_+1])*ne[2*_],ne[2*_+1]=X),O--)}}(j,z),A(ge,he,j.bl_count)}function S(j,z,ce){var pe,ae,ge=-1,ve=z[1],me=0,Se=7,he=4;for(ve===0&&(Se=138,he=3),z[2*(ce+1)+1]=65535,pe=0;pe<=ce;pe++)ae=ve,ve=z[2*(pe+1)+1],++me<Se&&ae===ve||(me<he?j.bl_tree[2*ae]+=me:ae!==0?(ae!==ge&&j.bl_tree[2*ae]++,j.bl_tree[2*b]++):me<=10?j.bl_tree[2*T]++:j.bl_tree[2*D]++,ge=ae,he=(me=0)===ve?(Se=138,3):ae===ve?(Se=6,3):(Se=7,4))}function re(j,z,ce){var pe,ae,ge=-1,ve=z[1],me=0,Se=7,he=4;for(ve===0&&(Se=138,he=3),pe=0;pe<=ce;pe++)if(ae=ve,ve=z[2*(pe+1)+1],!(++me<Se&&ae===ve)){if(me<he)for(;se(j,ae,j.bl_tree),--me!=0;);else ae!==0?(ae!==ge&&(se(j,ae,j.bl_tree),me--),se(j,b,j.bl_tree),te(j,me-3,2)):me<=10?(se(j,T,j.bl_tree),te(j,me-3,3)):(se(j,D,j.bl_tree),te(j,me-11,7));ge=ae,he=(me=0)===ve?(Se=138,3):ae===ve?(Se=6,3):(Se=7,4)}}l(Y);var Q=!1;function L(j,z,ce,pe){te(j,(c<<1)+(pe?1:0),3),function(ae,ge,ve,me){H(ae),ee(ae,ve),ee(ae,~ve),i.arraySet(ae.pending_buf,ae.window,ge,ve,ae.pending),ae.pending+=ve}(j,z,ce)}o._tr_init=function(j){Q||(function(){var z,ce,pe,ae,ge,ve=new Array(y+1);for(ae=pe=0;ae<u-1;ae++)for(J[ae]=pe,z=0;z<1<<M[ae];z++)$[pe++]=ae;for($[pe-1]=ae,ae=ge=0;ae<16;ae++)for(Y[ae]=ge,z=0;z<1<<I[ae];z++)W[ge++]=ae;for(ge>>=7;ae<p;ae++)for(Y[ae]=ge<<7,z=0;z<1<<I[ae]-7;z++)W[256+ge++]=ae;for(ce=0;ce<=y;ce++)ve[ce]=0;for(z=0;z<=143;)oe[2*z+1]=8,z++,ve[8]++;for(;z<=255;)oe[2*z+1]=9,z++,ve[9]++;for(;z<=279;)oe[2*z+1]=7,z++,ve[7]++;for(;z<=287;)oe[2*z+1]=8,z++,ve[8]++;for(A(oe,f+1,ve),z=0;z<p;z++)N[2*z+1]=5,N[2*z]=K(z,5);ie=new ue(oe,M,d+1,f,y),G=new ue(N,I,0,p,y),de=new ue(new Array(0),E,0,h,x)}(),Q=!0),j.l_desc=new Z(j.dyn_ltree,ie),j.d_desc=new Z(j.dyn_dtree,G),j.bl_desc=new Z(j.bl_tree,de),j.bi_buf=0,j.bi_valid=0,C(j)},o._tr_stored_block=L,o._tr_flush_block=function(j,z,ce,pe){var ae,ge,ve=0;0<j.level?(j.strm.data_type===2&&(j.strm.data_type=function(me){var Se,he=4093624447;for(Se=0;Se<=31;Se++,he>>>=1)if(1&he&&me.dyn_ltree[2*Se]!==0)return s;if(me.dyn_ltree[18]!==0||me.dyn_ltree[20]!==0||me.dyn_ltree[26]!==0)return a;for(Se=32;Se<d;Se++)if(me.dyn_ltree[2*Se]!==0)return a;return s}(j)),le(j,j.l_desc),le(j,j.d_desc),ve=function(me){var Se;for(S(me,me.dyn_ltree,me.l_desc.max_code),S(me,me.dyn_dtree,me.d_desc.max_code),le(me,me.bl_desc),Se=h-1;3<=Se&&me.bl_tree[2*U[Se]+1]===0;Se--);return me.opt_len+=3*(Se+1)+5+5+4,Se}(j),ae=j.opt_len+3+7>>>3,(ge=j.static_len+3+7>>>3)<=ae&&(ae=ge)):ae=ge=ce+5,ce+4<=ae&&z!==-1?L(j,z,ce,pe):j.strategy===4||ge===ae?(te(j,2+(pe?1:0),3),R(j,oe,N)):(te(j,4+(pe?1:0),3),function(me,Se,he,we){var Pe;for(te(me,Se-257,5),te(me,he-1,5),te(me,we-4,4),Pe=0;Pe<we;Pe++)te(me,me.bl_tree[2*U[Pe]+1],3);re(me,me.dyn_ltree,Se-1),re(me,me.dyn_dtree,he-1)}(j,j.l_desc.max_code+1,j.d_desc.max_code+1,ve+1),R(j,j.dyn_ltree,j.dyn_dtree)),C(j),pe&&H(j)},o._tr_tally=function(j,z,ce){return j.pending_buf[j.d_buf+2*j.last_lit]=z>>>8&255,j.pending_buf[j.d_buf+2*j.last_lit+1]=255&z,j.pending_buf[j.l_buf+j.last_lit]=255&ce,j.last_lit++,z===0?j.dyn_ltree[2*ce]++:(j.matches++,z--,j.dyn_ltree[2*($[ce]+d+1)]++,j.dyn_dtree[2*B(z)]++),j.last_lit===j.lit_bufsize-1},o._tr_align=function(j){te(j,2,3),se(j,k,oe),function(z){z.bi_valid===16?(ee(z,z.bi_buf),z.bi_buf=0,z.bi_valid=0):8<=z.bi_valid&&(z.pending_buf[z.pending++]=255&z.bi_buf,z.bi_buf>>=8,z.bi_valid-=8)}(j)}},{"../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){Ce.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),D=0;D<T.length;D++)T[D]=arguments[D+1];var M={callback:b,args:T};return p[f]=M,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(D){var M=D.callback,I=D.args;switch(I.length){case 0:M();break;case 1:M(I[0]);break;case 2:M(I[0],I[1]);break;case 3:M(I[0],I[1],I[2]);break;default:M.apply(a,I)}})(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)})})(J1);var V6=J1.exports;const xd=Il(V6);let kd=class{constructor(e={}){this.debug=e.debug||!1,this.zip=new xd,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=oA(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 xd;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=pt.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 U6=Object.defineProperty,X1=t=>{throw TypeError(t)},H6=(t,e,n)=>e in t?U6(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Fe=(t,e,n)=>H6(t,typeof e!="symbol"?e+"":e,n),Jf=(t,e,n)=>e.has(t)||X1("Cannot "+n),Jn=(t,e,n)=>(Jf(t,e,"read from private field"),n?n.call(t):e.get(t)),$r=(t,e,n)=>e.has(t)?X1("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),Y1=(t,e,n,r)=>(Jf(t,e,"write to private field"),e.set(t,n),n),Me=(t,e,n)=>(Jf(t,e,"access private method"),n);function js(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 Ul=(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 Xf(t){const{state:e}=t,{selection:n}=e,r=js(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(Mg)),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(Mg))}const a=e.schema.marks.link,l=Ul(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=W6(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 Mg(t){const e=[],{attrs:n}=t;return Object.keys(n).forEach(r=>{n[r]&&e.push({name:r,attrs:{[r]:n[r]}})}),e}function W6(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 il=200,xt=function(){};xt.prototype.append=function(t){return t.length?(t=xt.from(t),!this.length&&t||t.length<il&&this.leafAppend(t)||this.length<il&&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 G6(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 Z1(t):xt.empty};var Z1=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<=il)return new e(this.values.concat(r.flatten()))},e.prototype.leafPrepend=function(r){if(this.length+r.length<=il)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 Z1([]);var G6=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 K6=500;let ps=class Lo{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 dr(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 dr(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 Lo(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 dr(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>X6&&(a=J6(a,c),s-=c),new Lo(a.append(i),s)}remapping(e,n){let r=new Qo;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 Lo(this.items.append(e.map(n=>new dr(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 dr(h,m,y))}else r.push(new dr(h))},o);let c=[];for(let f=n;f<s;f++)c.push(new dr(i.maps[f]));let u=this.items.slice(0,o).append(c).append(r),d=new Lo(u,a);return d.emptyItemCount()>K6&&(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 dr(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 Lo(xt.from(o.reverse()),i)}};ps.empty=new ps(xt.empty,0);function J6(t,e){let n;return t.forEach((r,o)=>{if(r.selection&&e--==0)return n=o,!1}),t.slice(n)}let dr=class Q1{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 Q1(n.getMap().invert(),n,this.selection)}}},wr=class{constructor(e,n,r,o,i){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=o,this.prevComposition=i}};const X6=20;function Y6(t,e,n,r){let o=n.getMeta(nr),i;if(o)return o.historyState;n.getMeta(e$)&&(t=new wr(t.done,t.undone,null,0,-1));let s=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(s&&s.getMeta(nr))return s.getMeta(nr).redo?new wr(t.done.addTransform(n,void 0,r,Ra(e)),t.undone,Dg(n.mapping.maps),t.prevTime,t.prevComposition):new wr(t.done,t.undone.addTransform(n,void 0,r,Ra(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||!Z6(n,t.prevRanges)),c=s?fu(t.prevRanges,n.mapping):Dg(n.mapping.maps);return new wr(t.done.addTransform(n,l?e.selection.getBookmark():void 0,r,Ra(e)),ps.empty,c,n.time,a??t.prevComposition)}else return(i=n.getMeta("rebased"))?new wr(t.done.rebased(n,i),t.undone.rebased(n,i),fu(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new wr(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),fu(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function Z6(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 Dg(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 fu(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 Q6(t,e,n){let r=Ra(e),o=nr.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 wr(n?a:i.remaining,n?i.remaining:a,null,0,-1);return i.transform.setSelection(s).setMeta(nr,{redo:n,historyState:l})}let pu=!1,_g=null;function Ra(t){let e=t.plugins;if(_g!=e){pu=!1,_g=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){pu=!0;break}}return pu}const nr=new et("history"),e$=new et("closeHistory");function t$(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new Xe({key:nr,state:{init(){return new wr(ps.empty,ps.empty,null,0,-1)},apply(e,n,r){return Y6(n,r,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let r=n.inputType,o=r=="historyUndo"?tv:r=="historyRedo"?nv:null;return o?(n.preventDefault(),o(e.state,e.dispatch)):!1}}}})}function ev(t,e){return(n,r)=>{let o=nr.getState(n);if(!o||(t?o.undone:o.done).eventCount==0)return!1;if(r){let i=Q6(o,n,t);i&&r(i.scrollIntoView())}return!0}}const tv=ev(!1),nv=ev(!0);function n$(t){let e=nr.getState(t);return e?e.done.eventCount:0}function r$(t){let e=nr.getState(t);return e?e.undone.eventCount:0}function Ne(t,e,n={}){return typeof t.config[e]=="function"?t.config[e].bind({...n}):t.config[e]}let rt=class rv{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=We(Ne(this,"addOptions",{name:this.name}))),this.storage=We(Ne(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(...e){return new rv(...e)}};const ov=rt.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addPmPlugins(){return[t$(this.options)]},addCommands(){return{undo:()=>({state:t,dispatch:e,tr:n})=>(n.setMeta("inputType","historyUndo"),tv(t,e)),redo:()=>({state:t,dispatch:e,tr:n})=>(n.setMeta("inputType","historyRedo"),nv(t,e))}},addShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Mod-Shift-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo()}}}),Kr=globalThis||void 0||self,Ct=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},ii=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let Sd=null;const Gn=function(t,e,n){let r=Sd||(Sd=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},o$=function(){Sd=null},po=function(t,e,n,r){return n&&(Ng(t,e,n,r,-1)||Ng(t,e,n,r,1))},i$=/^(img|br|input|textarea|hr)$/i;function Ng(t,e,n,r,o){for(;;){if(t==n&&e==r)return!0;if(e==(o<0?0:hn(t))){let i=t.parentNode;if(!i||i.nodeType!=1||qs(t)||i$.test(t.nodeName)||t.contentEditable=="false")return!1;e=Ct(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?hn(t):0}else return!1}}function hn(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function s$(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=hn(t)}else if(t.parentNode&&!qs(t))e=Ct(t),t=t.parentNode;else return null}}function a$(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&&!qs(t))e=Ct(t)+1,t=t.parentNode;else return null}}function l$(t,e,n){for(let r=e==0,o=e==hn(t);r||o;){if(t==n)return!0;let i=Ct(t);if(t=t.parentNode,!t)return!1;r=r&&i==0,o=o&&i==hn(t)}}function qs(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 Hl=function(t){return t.focusNode&&po(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function Wr(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function c$(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function u$(t,e,n){if(t.caretPositionFromPoint)try{let r=t.caretPositionFromPoint(e,n);if(r)return{node:r.offsetNode,offset:Math.min(hn(r.offsetNode),r.offset)}}catch{}if(t.caretRangeFromPoint){let r=t.caretRangeFromPoint(e,n);if(r)return{node:r.startContainer,offset:Math.min(hn(r.startContainer),r.startOffset)}}}const Bn=typeof navigator<"u"?navigator:null,Ig=typeof document<"u"?document:null,Lr=Bn&&Bn.userAgent||"",Ed=/Edge\/(\d+)/.exec(Lr),iv=/MSIE \d/.exec(Lr),Cd=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Lr),Kt=!!(iv||Cd||Ed),Tr=iv?document.documentMode:Cd?+Cd[1]:Ed?+Ed[1]:0,xn=!Kt&&/gecko\/(\d+)/i.test(Lr);xn&&+(/Firefox\/(\d+)/.exec(Lr)||[0,0])[1];const Ad=!Kt&&/Chrome\/(\d+)/.exec(Lr),Dt=!!Ad,sv=Ad?+Ad[1]:0,qt=!Kt&&!!Bn&&/Apple Computer/.test(Bn.vendor),si=qt&&(/Mobile\/\w+/.test(Lr)||!!Bn&&Bn.maxTouchPoints>2),pn=si||(Bn?/Mac/.test(Bn.platform):!1),d$=Bn?/Win/.test(Bn.platform):!1,Qn=/Android \d/.test(Lr),Vs=!!Ig&&"webkitFontSmoothing"in Ig.documentElement.style,f$=Vs?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function p$(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 Vn(t,e){return typeof t=="number"?t:t[e]}function h$(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 Fg(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=ii(s);continue}let a=s,l=a==i.body,c=l?p$(i):h$(a),u=0,d=0;if(e.top<c.top+Vn(r,"top")?d=-(c.top-e.top+Vn(o,"top")):e.bottom>c.bottom-Vn(r,"bottom")&&(d=e.bottom-e.top>c.bottom-c.top?e.top+Vn(o,"top")-c.top:e.bottom-c.bottom+Vn(o,"bottom")),e.left<c.left+Vn(r,"left")?u=-(c.left-e.left+Vn(o,"left")):e.right>c.right-Vn(r,"right")&&(u=e.right-c.right+Vn(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:ii(s)}}function m$(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:av(t.dom)}}function av(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=ii(r));return e}function g$({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;lv(n,r==0?0:r-e)}function lv(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 Co=null;function y$(t){if(t.setActive)return t.setActive();if(Co)return t.focus(Co);let e=av(t);t.focus(Co==null?{get preventScroll(){return Co={preventScroll:!0},!0}}:void 0),Co||(Co=!1,lv(e,0))}function cv(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=Gn(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?w$(n,o):!n||r&&n.nodeType==1?{node:t,offset:i}:cv(n,o)}function w$(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=hr(r,1);if(i.top!=i.bottom&&Yf(e,i))return{node:t,offset:o+(e.left>=(i.left+i.right)/2?1:0)}}return{node:t,offset:0}}function Yf(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function b$(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}function v$(t,e,n){let{node:r,offset:o}=cv(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 x$(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 uv(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(Yf(e,c))return uv(s,e,c)}}if((i=(i+1)%r)==o)break}return t}function k$(t,e){let n=t.dom.ownerDocument,r,o=0,i=u$(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(!Yf(e,c)||(s=uv(t.dom,e,c),!s))return null}if(qt)for(let c=s;r&&c;c=ii(c))c.draggable&&(r=void 0);if(s=b$(s,e),r){if(xn&&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;Vs&&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=x$(t,r,o,e))}a==null&&(a=v$(t,s,e));let l=t.docView.nearestDesc(s,!0);return{pos:a,inside:l?l.posAtStart-l.border:-1}}function Bg(t){return t.top<t.bottom||t.left<t.right}function hr(t,e){let n=t.getClientRects();if(n.length){let r=n[e<0?0:n.length-1];if(Bg(r))return r}return Array.prototype.find.call(n,Bg)||t.getBoundingClientRect()}const S$=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function dv(t,e,n){let{node:r,offset:o,atom:i}=t.docView.domFromPos(e,n<0?-1:1),s=Vs||xn;if(r.nodeType==3)if(s&&(S$.test(r.nodeValue)||(n<0?!o:o==r.nodeValue.length))){let a=hr(Gn(r,o,o),n);if(xn&&o&&/\s/.test(r.nodeValue[o-1])&&o<r.nodeValue.length){let l=hr(Gn(r,o-1,o-1),-1);if(l.top==a.top){let c=hr(Gn(r,o,o+1),-1);if(c.top!=a.top)return Ci(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++,Ci(hr(Gn(r,a,l),c),c<0)}if(!t.state.doc.resolve(e-(i||0)).parent.inlineContent){if(i==null&&o&&(n<0||o==hn(r))){let a=r.childNodes[o-1];if(a.nodeType==1)return hu(a.getBoundingClientRect(),!1)}if(i==null&&o<hn(r)){let a=r.childNodes[o];if(a.nodeType==1)return hu(a.getBoundingClientRect(),!0)}return hu(r.getBoundingClientRect(),n>=0)}if(i==null&&o&&(n<0||o==hn(r))){let a=r.childNodes[o-1],l=a.nodeType==3?Gn(a,hn(a)-(s?0:1)):a.nodeType==1&&(a.nodeName!="BR"||!a.nextSibling)?a:null;if(l)return Ci(hr(l,1),!1)}if(i==null&&o<hn(r)){let a=r.childNodes[o];for(;a.pmViewDesc&&a.pmViewDesc.ignoreForCoords;)a=a.nextSibling;let l=a?a.nodeType==3?Gn(a,0,s?0:1):a.nodeType==1?a:null:null;if(l)return Ci(hr(l,-1),!0)}return Ci(hr(r.nodeType==3?Gn(r):r,-n),n>=0)}function Ci(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 hu(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 fv(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 E$(t,e,n){let r=e.selection,o=n=="up"?r.$from:r.$to;return fv(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=dv(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=Gn(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 C$=/[\u0590-\u08ac]/;function A$(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?!C$.test(r.parent.textContent)||!a.modify?n=="left"||n=="backward"?i:s:fv(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 Rg=null,Lg=null,Pg=!1;function $$(t,e,n){return Rg==e&&Lg==n?Pg:(Rg=e,Lg=n,Pg=n=="up"||n=="down"?E$(t,e,n):A$(t,e,n))}const mn=0,zg=1,Jr=2,Rn=3;let Us=class{constructor(e,n,r,o){this.parent=e,this.children=n,this.dom=r,this.contentDOM=o,this.dirty=mn,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>Ct(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 yv){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 pv&&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?Ct(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?Ct(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=Ct(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=Ct(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((xn||qt)&&e==n){let{node:p,offset:h}=a;if(p.nodeType==3){if(d=!!(h&&p.nodeValue[h-1]==`
|
|
40
40
|
`),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:Ct(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(xn&&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)&&po(a.node,a.offset,u.anchorNode,u.anchorOffset)&&po(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?Jr:zg,e==a&&n==l&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=Rn:i.markDirty(e-a,n-a);return}else i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?Jr:Rn}r=s}this.dirty=Jr}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?Jr:zg;n.dirty<r&&(n.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}isText(e){return!1}},pv=class extends Us{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==mn&&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}};class T$ extends Us{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}}let sl=class $d extends Us{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=yi.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new $d(e,n,s.dom,s.contentDOM||s.dom,s)}parseRule(){return this.dirty&Rn||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Rn&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=mn){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=mn}}slice(e,n,r){let o=$d.create(this.parent,this.mark,!0,r),i=this.children,s=this.size;n<s&&(i=Od(i,n,s,r)),e>0&&(i=Od(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()}},Ko=class hv extends Us{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}=yi.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=vv(u,r,n),c?l=new O$(e,n,r,o,u,d||null,f,c,i,s+1):n.isText?new mv(e,n,r,o,u,f,i):new hv(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=()=>be.empty)}return e}matchesNode(e,n,r){return this.dirty==mn&&e.eq(this.node)&&al(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 D$(this,s&&s.node,e);I$(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?Je.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==Jr)&&(s&&this.protectLocalComposition(e,s),wv(this.contentDOM,this.children,e),si&&F$(this.dom))}localCompositionInfo(e,n){let{from:r,to:o}=e.state.selection;if(!(e.state.selection instanceof je)||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=B$(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 T$(this,i,n,o);e.input.compositionNodes.push(s),this.children=Od(this.children,r,r+o.length,e,s)}update(e,n,r,o){return this.dirty==Rn||!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=mn}updateOuterDeco(e){if(al(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=bv(this.dom,this.nodeDOM,Td(this.outerDeco,this.node,n),Td(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 jg(t,e,n,r,o){vv(r,e,t);let i=new Ko(void 0,t,e,n,r,r,r,o,0);return i.contentDOM&&i.updateChildren(o,0),i}let mv=class gv extends Ko{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==Rn||this.dirty!=mn&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=mn||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=mn,!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 gv(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=Rn)}get domAtom(){return!1}isText(e){return this.node.text==e}},yv=class extends Us{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==mn&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}};class O$ extends Ko{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==Rn)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 wv(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=qg(r),o=!0;r=r.nextSibling}else o=!0,t.insertBefore(a,r);if(s instanceof sl){let l=r?r.previousSibling:t.lastChild;wv(s.contentDOM,s.children,n),r=l?l.nextSibling:t.firstChild}}for(;r;)r=qg(r),o=!0;o&&n.trackWrites==t&&(n.trackWrites=null)}const Xi=function(t){t&&(this.nodeName=t)};Xi.prototype=Object.create(null);const Xr=[new Xi];function Td(t,e,n){if(t.length==0)return Xr;let r=n?Xr[0]:new Xi,o=[r];for(let i=0;i<t.length;i++){let s=t[i].type.attrs;if(s){s.nodeName&&o.push(r=new Xi(s.nodeName));for(let a in s){let l=s[a];l!=null&&(n&&o.length==1&&o.push(r=new Xi(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 bv(t,e,n,r){if(n==Xr&&r==Xr)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=Xr[0]),o=l}M$(o,a||Xr[0],s)}return o}function M$(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 vv(t,e,n){return bv(t,t,Xr,Td(e,n,t.nodeType!=1))}function al(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 qg(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class D${constructor(e,n,r){this.lock=n,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=_$(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=mn,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=sl.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==Rn&&s.dom==s.contentDOM&&(s.dirty=Jr),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 Ko){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!=Rn&&al(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=Jr,d.updateChildren(o,s+1),d.dirty=mn),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)||!al(r,e.outerDeco)||!o.eq(e.innerDeco))return null;let a=Ko.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=Ko.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 pv(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 sl;)n=e,e=n.children[n.children.length-1];(!e||!(e instanceof mv)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((qt||Dt)&&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 yv(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 _$(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 sl)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 N$(t,e){return t.type.side-e.type.side}function I$(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(N$);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 F$(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 B$(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 Od(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(Hl(n)){for(l=s;o&&!o.node;)o=o.parent;let d=o.node;if(o&&d.isAtom&&Ie.isSelectable(d)&&o.parent&&!(d.isInline&&l$(n.focusNode,n.focusOffset,o.dom))){let f=o.posBefore;c=new Ie(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=Qf(t,u,a,d)}return c}function xv(t){return t.editable?t.hasFocus():Sv(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function rr(t,e=!1){let n=t.state.selection;if(kv(t,n),!!xv(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&Dt){let r=t.domSelectionRange(),o=t.domObserver.currentSelection;if(r.anchorNode&&o.anchorNode&&po(r.anchorNode,r.anchorOffset,o.anchorNode,o.anchorOffset)){t.input.mouseDown.delayedSelectionSync=!0,t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)L$(t);else{let{anchor:r,head:o}=n,i,s;Vg&&!(n instanceof je)&&(n.$from.parent.inlineContent||(i=Ug(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(s=Ug(t,n.to))),t.docView.setSelection(r,o,t,e),Vg&&(i&&Hg(i),s&&Hg(s)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&R$(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const Vg=qt||Dt&&sv<63;function Ug(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 mu(o);if((!o||o.contentEditable=="false")&&(!i||i.contentEditable=="false")){if(o)return mu(o);if(i)return mu(i)}}function mu(t){return t.contentEditable="true",qt&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function Hg(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function R$(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(()=>{(!xv(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function L$(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,Ct(r)+1):n.setStart(r,0),n.collapse(!0),e.removeAllRanges(),e.addRange(n),!o&&!t.state.selection.visible&&Kt&&Tr<=11&&(r.disabled=!0,r.disabled=!1)}function kv(t,e){if(e instanceof Ie){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(Wg(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else Wg(t)}function Wg(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function Qf(t,e,n,r){return t.someProp("createSelectionBetween",o=>o(t,e,n))||je.between(e,n,r)}function Gg(t){return t.editable&&!t.hasFocus()?!1:Sv(t)}function Sv(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 P$(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return po(e.node,e.offset,n.anchorNode,n.anchorOffset)}function Md(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&&Le.findFrom(i,e)}function br(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function Kg(t,e,n){let r=t.state.selection;if(r instanceof je)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 br(t,new je(r.$anchor,s))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let o=Md(t.state,e);return o&&o instanceof Ie?br(t,o):!1}else if(!(pn&&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?Ie.isSelectable(i)?br(t,new Ie(e<0?t.state.doc.resolve(o.pos-i.nodeSize):o)):Vs?br(t,new je(t.state.doc.resolve(e<0?a:a+i.nodeSize))):!1:!1}}else return!1;else{if(r instanceof Ie&&r.node.isInline)return br(t,new je(e>0?r.$to:r.$from));{let o=Md(t.state,e);return o?br(t,o):!1}}}function ll(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function Yi(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function Ao(t,e){return e<0?z$(t):j$(t)}function z$(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let o,i,s=!1;for(xn&&n.nodeType==1&&r<ll(n)&&Yi(n.childNodes[r],-1)&&(s=!0);;)if(r>0){if(n.nodeType!=1)break;{let a=n.childNodes[r-1];if(Yi(a,-1))o=n,i=--r;else if(a.nodeType==3)n=a,r=n.nodeValue.length;else break}}else{if(Ev(n))break;{let a=n.previousSibling;for(;a&&Yi(a,-1);)o=n.parentNode,i=Ct(a),a=a.previousSibling;if(a)n=a,r=ll(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}s?Dd(t,n,r):o&&Dd(t,o,i)}function j$(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let o=ll(n),i,s;for(;;)if(r<o){if(n.nodeType!=1)break;let a=n.childNodes[r];if(Yi(a,1))i=n,s=++r;else break}else{if(Ev(n))break;{let a=n.nextSibling;for(;a&&Yi(a,1);)i=a.parentNode,s=Ct(a)+1,a=a.nextSibling;if(a)n=a,r=0,o=ll(n);else{if(n=n.parentNode,n==t.dom)break;r=o=0}}}i&&Dd(t,i,s)}function Ev(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function q$(t,e){for(;t&&e==t.childNodes.length&&!qs(t);)e=Ct(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 V$(t,e){for(;t&&!e&&!qs(t);)e=Ct(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 Dd(t,e,n){if(e.nodeType!=3){let i,s;(s=q$(e,n))?(e=s,n=0):(i=V$(e,n))&&(e=i,n=i.nodeValue.length)}let r=t.domSelection();if(!r)return;if(Hl(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&&rr(t)},50)}function Jg(t,e){let n=t.state.doc.resolve(e);if(!(Dt||d$)&&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 Xg(t,e,n){let r=t.state.selection;if(r instanceof je&&!r.empty||n.indexOf("s")>-1||pn&&n.indexOf("m")>-1)return!1;let{$from:o,$to:i}=r;if(!o.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let s=Md(t.state,e);if(s&&s instanceof Ie)return br(t,s)}if(!o.parent.inlineContent){let s=e<0?o:i,a=r instanceof _n?Le.near(s,e):Le.findFrom(s,e);return a?br(t,a):!1}return!1}function Yg(t,e){if(!(t.state.selection instanceof je))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 Zg(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function U$(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;Zg(t,r,"true"),setTimeout(()=>Zg(t,r,"false"),20)}return!1}function H$(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function W$(t,e){let n=e.keyCode,r=H$(e);if(n==8||pn&&n==72&&r=="c")return Yg(t,-1)||Ao(t,-1);if(n==46&&!e.shiftKey||pn&&n==68&&r=="c")return Yg(t,1)||Ao(t,1);if(n==13||n==27)return!0;if(n==37||pn&&n==66&&r=="c"){let o=n==37?Jg(t,t.state.selection.from)=="ltr"?-1:1:-1;return Kg(t,o,r)||Ao(t,o)}else if(n==39||pn&&n==70&&r=="c"){let o=n==39?Jg(t,t.state.selection.from)=="ltr"?1:-1:1;return Kg(t,o,r)||Ao(t,o)}else{if(n==38||pn&&n==80&&r=="c")return Xg(t,-1,r)||Ao(t,-1);if(n==40||pn&&n==78&&r=="c")return U$(t)||Xg(t,1,r)||Ao(t,1);if(r==(pn?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function ep(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")||yi.fromSchema(t.state.schema),a=Mv(),l=a.createElement("div");l.appendChild(s.serializeFragment(r,{document:a}));let c=l.firstChild,u,d=0;for(;c&&c.nodeType==1&&(u=Ov[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,`
|
|
41
41
|
|
|
42
42
|
`);return{dom:l,text:f,slice:e}}function Cv(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 xe(be.from(t.state.schema.text(e.replace(/\r\n?/g,`
|
|
43
43
|
`))),0,0):xe.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=yi.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=X$(n),Vs&&Y$(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")||Ar.fromSchema(t.state.schema)).parseSlice(s,{preserveWhitespace:!!(l||u),context:o,ruleFromNode(d){return d.nodeName=="BR"&&!d.nextSibling&&d.parentNode&&!G$.test(d.parentNode.nodeName)?{ignore:!0}:null}})),u)a=Z$(Qg(a,+u[1],+u[2]),u[4]);else if(a=xe.maxOpen(K$(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=Qg(a,d,f)}return t.someProp("transformPasted",d=>{a=d(a,t)}),a}const G$=/^(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 K$(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&&$v(a,o,s,i[i.length-1],0))i[i.length-1]=l;else{i.length&&(i[i.length-1]=Tv(i[i.length-1],o.length));let c=Av(s,a);i.push(c),r=r.matchType(c.type),o=a}}),i)return be.from(i)}return t}function Av(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,be.from(t));return t}function $v(t,e,n,r,o){if(o<t.length&&o<e.length&&t[o]==e[o]){let i=$v(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(be.from(Av(n,t,o+1))))}}function Tv(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,Tv(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(be.empty,!0);return t.copy(n.append(r))}function _d(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=_d(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(be.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,s.copy(a))}function Qg(t,e,n){return e<t.openStart&&(t=new xe(_d(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new xe(_d(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const Ov={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 ey=null;function Mv(){return ey||(ey=document.implementation.createHTMLDocument("title"))}let gu=null;function J$(t){let e=window.trustedTypes;return e?(gu||(gu=e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),gu.createHTML(t)):t}function X$(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=Mv().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),o;if((o=r&&Ov[r[1].toLowerCase()])&&(t=o.map(i=>"<"+i+">").join("")+t+o.map(i=>"</"+i+">").reverse().join("")),n.innerHTML=J$(t),o)for(let i=0;i<o.length;i++)n=n.querySelector(o[i])||n;return n}function Y$(t){let e=t.querySelectorAll(Dt?"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 Z$(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=be.from(l.create(r[a+1],o)),i++,s++}return new xe(o,i,s)}const Vt={},Ut={},Q$={touchstart:!0,touchmove:!0};class eT{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 tT(t){for(let e in Vt){let n=Vt[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{rT(t,r)&&!tp(t,r)&&(t.editable||!(r.type in Ut))&&n(t,r)},Q$[e]?{passive:!0}:void 0)}qt&&t.dom.addEventListener("input",()=>null),Nd(t)}function kr(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function nT(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 Nd(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>tp(t,r))})}function tp(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function rT(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 oT(t,e){!tp(t,e)&&Vt[e.type]&&(t.editable||!(e.type in Ut))&&Vt[e.type](t,e)}Ut.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!_v(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(Qn&&Dt&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),si&&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,Wr(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||W$(t,n)?n.preventDefault():kr(t,"key")};Ut.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};Ut.keypress=(t,e)=>{let n=e;if(_v(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||pn&&n.metaKey)return;if(t.someProp("handleKeyPress",o=>o(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof je)||!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 Wl(t){return{left:t.clientX,top:t.clientY}}function iT(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function np(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 Jo(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 sT(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&Ie.isSelectable(r)?(Jo(t,new Ie(n)),!0):!1}function aT(t,e){if(e==-1)return!1;let n=t.state.selection,r,o;n instanceof Ie&&(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(Ie.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?(Jo(t,Ie.create(t.state.doc,o)),!0):!1}function lT(t,e,n,r,o){return np(t,"handleClickOn",e,n,r)||t.someProp("handleClick",i=>i(t,e,r))||(o?aT(t,n):sT(t,n))}function cT(t,e,n,r){return np(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",o=>o(t,e,r))}function uT(t,e,n,r){return np(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",o=>o(t,e,r))||dT(t,n,r)}function dT(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?(Jo(t,je.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)Jo(t,je.create(r,a+1,a+1+s.content.size));else if(Ie.isSelectable(s))Jo(t,Ie.create(r,a));else continue;return!0}}function rp(t){return cl(t)}const Dv=pn?"metaKey":"ctrlKey";Vt.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=rp(t),o=Date.now(),i="singleClick";o-t.input.lastClick.time<500&&iT(n,t.input.lastClick)&&!n[Dv]&&(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(Wl(n));s&&(i=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new fT(t,s,n,!!r)):(i=="doubleClick"?cT:uT)(t,s.pos,s.inside,n)?n.preventDefault():kr(t,"pointer"))};let fT=class{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[Dv],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 Ie&&c.from<=s&&c.to>s)&&(this.mightDrag={node:i,pos:s,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&xn&&!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)),kr(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(()=>rr(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(Wl(e))),this.updateAllowDefault(e),this.allowDefault||!n?kr(this.view,"pointer"):lT(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||qt&&this.mightDrag&&!this.mightDrag.node.isAtom||Dt&&!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)?(Jo(this.view,Le.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):kr(this.view,"pointer")}move(e){this.updateAllowDefault(e),kr(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)}};Vt.touchstart=t=>{t.input.lastTouch=Date.now(),rp(t),kr(t,"pointer")};Vt.touchmove=t=>{t.input.lastTouch=Date.now(),kr(t,"pointer")};Vt.contextmenu=t=>rp(t);function _v(t,e){return t.composing?!0:qt&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const pT=Qn?5e3:-1;Ut.compositionstart=Ut.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof je&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)))t.markCursor=t.state.storedMarks||n.marks(),cl(t,!0),t.markCursor=null;else if(cl(t,!e.selection.empty),xn&&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}Nv(t,pT)};Ut.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++,Nv(t,20))};function Nv(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>cl(t),e))}function Iv(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=mT());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function hT(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=s$(e.focusNode,e.focusOffset),r=a$(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 mT(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function cl(t,e=!1){if(!(Qn&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),Iv(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 gT(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 hs=Kt&&Tr<15||si&&f$<604;Vt.copy=Ut.cut=(t,e)=>{let n=e,r=t.state.selection,o=n.type=="cut";if(r.empty)return;let i=hs?null:n.clipboardData,s=r.content(),{dom:a,text:l}=ep(t,s);i?(n.preventDefault(),i.clearData(),i.setData("text/html",a.innerHTML),i.setData("text/plain",l)):gT(t,a),o&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function yT(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function wT(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?ms(t,r.value,null,o,e):ms(t,r.textContent,r.innerHTML,o,e)},50)}function ms(t,e,n,r,o){let i=Cv(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",l=>l(t,o,i||xe.empty)))return!0;if(!i)return!1;let s=yT(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 Fv(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," "):""}Ut.paste=(t,e)=>{let n=e;if(t.composing&&!Qn)return;let r=hs?null:n.clipboardData,o=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&ms(t,Fv(r),r.getData("text/html"),o,n)?n.preventDefault():wT(t,n)};let Bv=class{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}};const bT=pn?"altKey":"ctrlKey";function Rv(t,e){return t.someProp("dragCopies",r=>!r(e))??!e[bT]}Vt.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(Wl(n)),s;if(!(i&&i.pos>=o.from&&i.pos<=(o instanceof Ie?o.to-1:o.to))){if(r&&r.mightDrag)s=Ie.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=Ie.create(t.state.doc,d.posBefore))}}let a=(s||t.state.selection).content(),{dom:l,text:c,slice:u}=ep(t,a);(!n.dataTransfer.files.length||!Dt||sv>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(hs?"Text":"text/html",l.innerHTML),n.dataTransfer.effectAllowed="copyMove",hs||n.dataTransfer.setData("text/plain",c),t.dragging=new Bv(u,Rv(t,n),s)};Vt.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};Ut.dragover=Ut.dragenter=(t,e)=>e.preventDefault();Ut.drop=(t,e)=>{let n=e,r=t.dragging;if(t.dragging=null,!n.dataTransfer)return;let o=t.posAtCoords(Wl(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=Cv(t,Fv(n.dataTransfer),hs?null:n.dataTransfer.getData("text/html"),!1,i);let a=!!(r&&Rv(t,n));if(t.someProp("handleDrop",h=>h(t,n,s||xe.empty,a))){n.preventDefault();return}if(!s)return;n.preventDefault();let l=s?r1(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&&Ie.isSelectable(s.content.firstChild)&&p.nodeAfter&&p.nodeAfter.sameMarkup(s.content.firstChild))c.setSelection(new Ie(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(Qf(t,p,c.doc.resolve(h)))}t.focus(),t.dispatch(c.setMeta("uiEvent","drop"))};Vt.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())&&rr(t)},20))};Vt.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)};Vt.beforeinput=(t,e)=>{if(Dt&&Qn&&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,Wr(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 Ut)Vt[t]=Ut[t];function gs(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 ty=class Lv{constructor(e,n){this.toDOM=e,this.spec=n||no,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 qe(i-r,i-r,this)}valid(){return!0}eq(e){return this==e||e instanceof Lv&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&gs(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}},Zi=class Id{constructor(e,n){this.attrs=e,this.spec=n||no}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 qe(i,s,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof Id&&gs(this.attrs,e.attrs)&&gs(this.spec,e.spec)}static is(e){return e.type instanceof Id}destroy(){}};class op{constructor(e,n){this.attrs=e,this.spec=n||no}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 qe(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 op&&gs(this.attrs,e.attrs)&&gs(this.spec,e.spec)}destroy(){}}class qe{constructor(e,n,r){this.from=e,this.to=n,this.type=r}copy(e,n){return new qe(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 qe(e,e,new ty(n,r))}static inline(e,n,r,o){return new qe(e,n,new Zi(r,o))}static node(e,n,r,o){return new qe(e,n,new op(r,o))}get spec(){return this.type.spec}get inline(){return this.type instanceof Zi}get widget(){return this.type instanceof ty}}const Po=[],no={};class Be{constructor(e,n){this.local=e.length?e:Po,this.children=n.length?n:Po}static create(e,n){return n.length?ul(n,e,0,no):Ot}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==Ot||e.maps.length==0?this:this.mapInner(e,n,0,0,r||no)}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?vT(this.children,s||[],e,n,r,o,i):s?new Be(s.sort(ro),Po):Ot}add(e,n){return n.length?this==Ot?Be.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=jv(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,ul(u,a,c+1,no)),i+=3}});let s=zv(i?qv(n):n,-r);for(let a=0;a<s.length;a++)s[a].type.valid(e,s[a])||s.splice(a--,1);return new Be(s.length?this.local.concat(s).sort(ro):this.local,o||this.children)}remove(e){return e.length==0||this==Ot?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!=Ot?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 Be(o,r):Ot}forChild(e,n){if(this==Ot)return this;if(n.isLeaf)return Be.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 Zi){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 Be(o.sort(ro),Po);return r?new Pv([a,r]):a}return r||Ot}eq(e){if(this==e)return!0;if(!(e instanceof Be)||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 ip(this.localsInner(e))}localsInner(e){if(this==Ot)return Po;if(e.inlineContent||!this.local.some(Zi.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof Zi||n.push(this.local[r]);return n}forEachSet(e){e(this)}}Be.empty=new Be([],[]);Be.removeOverlap=ip;const Ot=Be.empty;let Pv=class zo{constructor(e){this.members=e}map(e,n){const r=this.members.map(o=>o.map(e,n,no));return zo.from(r)}forChild(e,n){if(n.isLeaf)return Be.empty;let r=[];for(let o=0;o<this.members.length;o++){let i=this.members[o].forChild(e,n);i!=Ot&&(i instanceof zo?r=r.concat(i.members):r.push(i))}return zo.from(r)}eq(e){if(!(e instanceof zo)||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?ip(r?n:n.sort(ro)):Po}static from(e){switch(e.length){case 0:return Ot;case 1:return e[0];default:return new zo(e.every(n=>n instanceof Be)?e:e.reduce((n,r)=>n.concat(r instanceof Be?r:r.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(e)}};function vT(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!=Ot?(a[c]=d,a[c+1]=p,a[c+2]=g):(a[c+1]=-2,l=!0)}else l=!0}if(l){let c=xT(a,t,e,n,o,i,s),u=ul(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 Be(e.sort(ro),a)}function zv(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 qe(o.from+e,o.to+e,o.type))}return n}function xT(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 jv(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 qv(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function ul(t,e,n,r){let o=[],i=!1;e.forEach((a,l)=>{let c=jv(t,a,l+n);if(c){i=!0;let u=ul(c,a,n+l+1,r);u!=Ot&&o.push(l,l+a.nodeSize,u)}});let s=zv(i?qv(t):t,-n).sort(ro);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 Be(s,o):Ot}function ro(t,e){return t.from-e.from||t.to-e.to}function ip(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),ny(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),ny(e,o,r.copy(i.from,r.to)));break}}}return e}function ny(t,e,n){for(;e<t.length&&ro(n,t[e])>0;)e++;t.splice(e,0,n)}function yu(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=Ot&&e.push(r)}),t.cursorWrapper&&e.push(Be.create(t.state.doc,[t.cursorWrapper.deco])),Pv.from(e)}const kT={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},ST=Kt&&Tr<=11;let ET=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}},CT=class{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new ET,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]);Kt&&Tr<=11&&r.some(o=>o.type=="childList"&&o.removedNodes.length||o.type=="characterData"&&o.oldValue.length>o.target.nodeValue.length)?this.flushSoon():this.flush()}),ST&&(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,kT)),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(Gg(this.view)){if(this.suppressingSelectionUpdates)return rr(this.view);if(Kt&&Tr<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&po(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=ii(i))n.add(i);for(let i=e.anchorNode;i;i=ii(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)&&Gg(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(xn&&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||TT(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&&Hl(r)&&(c=Zf(e))&&c.eq(Le.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,rr(e),this.currentSelection.set(r),e.scrollToSelection()):(i>-1||o)&&(i>-1&&(e.docView.markDirty(i,s),AT(e)),this.handleDOMChange(i,s,a,l),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||rr(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(Kt&&Tr<=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?Ct(o)+1:0,a=r.localPosFromDOM(e.target,s,-1),l=i&&i.parentNode==e.target?Ct(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})}},ry=new WeakMap,oy=!1;function AT(t){if(!ry.has(t)&&(ry.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=xn,oy)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."),oy=!0}}function iy(t,e){let n=e.startContainer,r=e.startOffset,o=e.endContainer,i=e.endOffset,s=t.domAtPos(t.state.selection.anchor);return po(s.node,s.offset,o,i)&&([n,r,o,i]=[o,i,n,r]),{anchorNode:n,anchorOffset:r,focusNode:o,focusOffset:i}}function $T(t,e){if(e.getComposedRanges){let o=e.getComposedRanges(t.root)[0];if(o)return iy(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?iy(t,n):null}function TT(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 OT(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}],Hl(l)||c.push({node:l.focusNode,offset:l.focusOffset})),Dt&&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")||Ar.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:MT,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 MT(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 DT=/^(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 _T(t,e,n,r,o){let i=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let E=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,U=Zf(t,E);if(U&&!t.state.selection.eq(U)){if(Dt&&Qn&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",N=>N(t,Wr(13,"Enter"))))return;let oe=t.state.tr.setSelection(U);E=="pointer"?oe.setMeta("pointer",!0):E=="key"&&oe.scrollIntoView(),i&&oe.setMeta("composition",i),t.dispatch(oe)}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=OT(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=FT(d.content,c.doc.content,c.from,f,p);if(h&&t.input.domChangeCount++,(si&&t.input.lastIOSEnter>Date.now()-225||Qn)&&o.some(E=>E.nodeType==1&&!DT.test(E.nodeName))&&(!h||h.endA>=h.endB)&&t.someProp("handleKeyDown",E=>E(t,Wr(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!h)if(r&&l instanceof je&&!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 E=sy(t,t.state.doc,c.sel);if(E&&!E.eq(t.state.selection)){let U=t.state.tr.setSelection(E);i&&U.setMeta("composition",i),t.dispatch(U)}}return}t.state.selection.from<t.state.selection.to&&h.start==h.endB&&t.state.selection instanceof je&&(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)),Kt&&Tr<=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((si&&t.input.lastIOSEnter>Date.now()-225&&(!x||o.some(E=>E.nodeName=="DIV"||E.nodeName=="P"))||!x&&m.pos<c.doc.content.size&&(!m.sameParent(y)||!m.parent.inlineContent)&&(k=Le.findFrom(c.doc.resolve(m.pos+1),1,!0))&&k.head>m.pos)&&t.someProp("handleKeyDown",E=>E(t,Wr(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>h.start&&IT(u,h.start,h.endA,m,y)&&t.someProp("handleKeyDown",E=>E(t,Wr(8,"Backspace")))){Qn&&Dt&&t.domObserver.suppressSelectionUpdates();return}Dt&&h.endB==h.start&&(t.input.lastChromeDelete=Date.now()),Qn&&!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(E){return E(t,Wr(13,"Enter"))})},20));let b=h.start,T=h.endA,D,M,I;if(x){if(m.pos==y.pos)Kt&&Tr<=11&&m.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>rr(t),20)),D=t.state.tr.delete(b,T),M=u.resolve(h.start).marksAcross(u.resolve(h.endA));else if(h.endA==h.endB&&(I=NT(m.parent.content.cut(m.parentOffset,y.parentOffset),g.parent.content.cut(g.parentOffset,h.endA-g.start()))))D=t.state.tr,I.type=="add"?D.addMark(b,T,I.mark):D.removeMark(b,T,I.mark);else if(m.parent.child(m.index()).isText&&m.index()==y.index()-(y.textOffset?0:1)){let E=m.parent.textBetween(m.parentOffset,y.parentOffset);if(t.someProp("handleTextInput",U=>U(t,b,T,E)))return;D=t.state.tr.insertText(E,b,T)}}if(D||(D=t.state.tr.replace(b,T,c.doc.slice(h.start-c.from,h.endB-c.from))),c.sel){let E=sy(t,D.doc,c.sel);E&&!(Dt&&t.composing&&E.empty&&(h.start!=h.endB||t.input.lastChromeDelete<Date.now()-100)&&(E.head==b||E.head==D.mapping.map(T)-1)||Kt&&E.empty&&E.head==b)&&D.setSelection(E)}M&&D.ensureMarks(M),i&&D.setMeta("composition",i),t.dispatch(D.scrollIntoView())}function sy(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:Qf(t,e.resolve(n.anchor),e.resolve(n.head))}function NT(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(be.from(c).eq(t))return{mark:a,type:s}}function IT(t,e,n,r,o){if(n-e<=o.pos-r.pos||wu(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(wu(i,!0,!0));return!s.parent.isTextblock||s.pos>n||wu(s,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(s.parent.content)}function wu(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 FT(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&&ay(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&&ay(t.textBetween(i-1,i+1))&&(i+=l?1:-1),s=i+(s-a),a=i}return{start:i,endA:s,endB:a}}function ay(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 Vv=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 eT,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(fy),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=uy(this),cy(this),this.nodeViews=dy(this),this.docView=jg(this.state.doc,ly(this),yu(this),this.dom,this),this.domObserver=new CT(this,(r,o,i,s)=>_T(this,r,o,i,s)),this.domObserver.start(),tT(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&&Nd(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(fy),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&&(Iv(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=dy(this);RT(p,this.nodeViews)&&(this.nodeViews=p,i=!0)}(a||n.handleDOMEvents!=this._props.handleDOMEvents)&&Nd(this),this.editable=uy(this),cy(this);let l=yu(this),c=ly(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&&m$(this);if(s){this.domObserver.stop();let p=d&&(Kt||Dt)&&!this.composing&&!o.selection.empty&&!e.selection.empty&&BT(o.selection,e.selection);if(d){let h=Dt?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=hT(this)),(i||!this.docView.update(e.doc,c,l,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=jg(e.doc,c,l,this.dom,this)),h&&!this.trackWrites&&(p=!0)}p||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&P$(this))?rr(this,p):(kv(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&&g$(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 Ie){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&Fg(this,n.getBoundingClientRect(),e)}else Fg(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 Bv(e.slice,e.move,o<0?void 0:Ie.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(Kt){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&&y$(this.dom),rr(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 k$(this,e)}coordsAtPos(e,n=1){return dv(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 $$(this,n||this.state,e)}pasteHTML(e,n){return ms(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return ms(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return ep(this,e)}destroy(){this.docView&&(nT(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],yu(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,o$())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return oT(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&&c$(this.dom.ownerDocument)==this.dom&&$T(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}};function ly(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"),[qe.node(0,t.state.doc.content.size,e)]}function cy(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:qe.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function uy(t){return!t.someProp("editable",e=>e(t.state)===!1)}function BT(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 dy(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 RT(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 fy(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 ys=Math.floor,LT=Math.abs,Or=(t,e)=>t<e?t:e,ai=(t,e)=>t>e?t:e,PT=t=>t!==0?t<0:1/t<0,zT=64,ws=128,jT=1<<29,py=63,Qi=127,qT=2147483647,VT=Number.isInteger||(t=>typeof t=="number"&&isFinite(t)&&ys(t)===t),UT=()=>new Set,HT=Array.isArray,WT=String.fromCharCode,GT=t=>t.toLowerCase(),KT=/^\s*/g,JT=t=>t.replace(KT,""),XT=/([A-Z])/g,hy=(t,e)=>JT(t.replace(XT,n=>`${e}${GT(n)}`)),YT=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},bs=typeof TextEncoder<"u"?new TextEncoder:null,ZT=t=>bs.encode(t),QT=bs?ZT:YT;let bu=typeof TextDecoder>"u"?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});bu&&bu.decode(new Uint8Array).length===1&&(bu=null);let e5=class{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}};const t5=()=>new e5,n5=t=>{const e=t5();return t(e),o5(e)},r5=t=>{let e=t.cpos;for(let n=0;n<t.bufs.length;n++)e+=t.bufs[n].length;return e},o5=t=>{const e=new Uint8Array(r5(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},i5=(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(ai(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},vs=(t,e)=>{for(;e>Qi;)Et(t,ws|Qi&e),e=ys(e/128);Et(t,Qi&e)},s5=(t,e)=>{const n=PT(e);for(n&&(e=-e),Et(t,(e>py?ws:0)|(n?zT:0)|py&e),e=ys(e/64);e>0;)Et(t,(e>Qi?ws:0)|Qi&e),e=ys(e/128)},Fd=new Uint8Array(3e4),a5=Fd.length/3,l5=(t,e)=>{if(e.length<a5){const n=bs.encodeInto(e,Fd).written||0;vs(t,n);for(let r=0;r<n;r++)Et(t,Fd[r])}else Uv(t,QT(e))},c5=(t,e)=>{const n=unescape(encodeURIComponent(e)),r=n.length;vs(t,r);for(let o=0;o<r;o++)Et(t,n.codePointAt(o))},my=bs&&bs.encodeInto?l5:c5,u5=(t,e)=>{const n=t.cbuf.length,r=t.cpos,o=Or(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(ai(n*2,i)),t.cbuf.set(e.subarray(o)),t.cpos=i)},Uv=(t,e)=>{vs(t,e.byteLength),u5(t,e)},sp=(t,e)=>{i5(t,e);const n=new DataView(t.cbuf.buffer,t.cpos,e);return t.cpos+=e,n},d5=(t,e)=>sp(t,4).setFloat32(0,e,!1),f5=(t,e)=>sp(t,8).setFloat64(0,e,!1),p5=(t,e)=>sp(t,8).setBigInt64(0,e,!1),gy=new DataView(new ArrayBuffer(4)),h5=t=>(gy.setFloat32(0,t),gy.getFloat32(0)===t),Bd=(t,e)=>{switch(typeof e){case"string":Et(t,119),my(t,e);break;case"number":VT(e)&<(e)<=qT?(Et(t,125),s5(t,e)):h5(e)?(Et(t,124),d5(t,e)):(Et(t,123),f5(t,e));break;case"bigint":Et(t,122),p5(t,e);break;case"object":if(e===null)Et(t,126);else if(HT(e)){Et(t,117),vs(t,e.length);for(let n=0;n<e.length;n++)Bd(t,e[n])}else if(e instanceof Uint8Array)Et(t,116),Uv(t,e);else{Et(t,118);const n=Object.keys(e);vs(t,n.length);for(let r=0;r<n.length;r++){const o=n[r];my(t,o),Bd(t,e[o])}}break;case"boolean":Et(t,e?120:121);break;default:Et(t,127)}},Hv=t=>new Error(t),m5=()=>{throw Hv("Method unimplemented")},Wv=()=>{throw Hv("Unexpected case")},La=()=>new Map,Gv=(t,e,n)=>{let r=t.get(e);return r===void 0&&t.set(e,r=n()),r},g5=Object.keys,y5=(t,e)=>{for(const n in t)if(!e(t[n],n))return!1;return!0},w5=(t,e)=>e.includes(t),b5=()=>{let t=!0;return(e,n)=>{if(t){t=!1;try{e()}finally{t=!0}}else n!==void 0&&n()}},v5=/[\uD800-\uDBFF]/,x5=/[\uDC00-\uDFFF]/,k5=(t,e)=>{let n=0,r=0;for(;n<t.length&&n<e.length&&t[n]===e[n];)n++;for(n>0&&v5.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&&x5.test(t[t.length-r])&&r--,{index:n,remove:t.length-n-r,insert:e.slice(n,e.length-r)}},S5=k5,ot=new et("y-sync"),Mr=new et("y-undo"),oa=new et("yjs-cursor"),E5=Math.random,C5=t=>t[ys(E5()*t.length)],A5=t=>t===void 0?null:t;class $5{constructor(){this.map=new Map}setItem(e,n){this.map.set(e,n)}getItem(e){return this.map.get(e)}}let Kv=new $5,T5=!0;try{typeof localStorage<"u"&&localStorage&&(Kv=localStorage,T5=!1)}catch{}const O5=Kv,li=typeof Ce<"u"&&Ce.release&&/node|io\.js/.test(Ce.release.name)&&Object.prototype.toString.call(typeof Ce<"u"?Ce:0)==="[object process]",Jv=typeof window<"u"&&typeof document<"u"&&!li;let En;const M5=()=>{if(En===void 0)if(li){En=La();const t=Ce.argv;let e=null;for(let n=0;n<t.length;n++){const r=t[n];r[0]==="-"?(e!==null&&En.set(e,""),e=r):e!==null&&(En.set(e,r),e=null)}e!==null&&En.set(e,"")}else typeof location=="object"?(En=La(),(location.search||"?").slice(1).split("&").forEach(t=>{if(t.length!==0){const[e,n]=t.split("=");En.set(`--${hy(e,"-")}`,n),En.set(`-${hy(e,"-")}`,n)}})):En=La();return En},Rd=t=>M5().has(t),Ld=t=>A5(li?Ce.env[t.toUpperCase().replaceAll("-","_")]:O5.getItem(t)),Xv=t=>Rd("--"+t)||Ld(t)!==null;Xv("production");const D5=li&&w5(Ce.env.FORCE_COLOR,["true","1","2"]);D5||!Rd("--no-colors")&&!Xv("no-color")&&(!li||Ce.stdout.isTTY)&&(!li||Rd("--color")||Ld("COLORTERM")!==null||(Ld("TERM")||"").includes("color"));const _5=typeof document<"u"?document:{};typeof DOMParser<"u"&&new DOMParser;const N5=t=>class{constructor(e){this._=e}destroy(){t(this._)}},I5=N5(clearTimeout),ap=(t,e)=>new I5(setTimeout(e,t)),Nn=(t,e)=>t>>>e|t<<32-e,F5=t=>Nn(t,2)^Nn(t,13)^Nn(t,22),B5=t=>Nn(t,6)^Nn(t,11)^Nn(t,25),R5=t=>Nn(t,7)^Nn(t,18)^t>>>3,L5=t=>Nn(t,17)^Nn(t,19)^t>>>10,P5=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]),z5=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]);class j5{constructor(){const e=new ArrayBuffer(320);this._H=new Uint32Array(e,0,8),this._H.set(z5),this._W=new Uint32Array(e,64,64)}_updateHash(){const e=this._H,n=this._W;for(let d=16;d<64;d++)n[d]=L5(n[d-2])+n[d-7]+R5(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+B5(a)+(a&l^~a&c)+P5[d]+n[d]>>>0,p=F5(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]|=ws<<(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)]|=ws<<(3-n%4)*8),this._W[14]=e.byteLength/jT,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 q5=t=>new j5().digest(t),V5=t=>{let e="";for(let n=0;n<t.byteLength;n++)e+=WT(t[n]);return btoa(e)},U5=t=>pt.from(t.buffer,t.byteOffset,t.byteLength).toString("base64"),H5=Jv?V5:U5,W5=t=>n5(e=>Bd(e,t)),G5=t=>{for(let e=6;e<t.length;e++)t[e%6]=t[e%6]^t[e];return t.slice(0,6)},K5=t=>H5(G5(q5(W5(t)))),J5=()=>({mapping:new Map,isOMark:new Map}),dl=(t,e)=>e===void 0?!t.deleted:e.sv.has(t.id.client)&&e.sv.get(t.id.client)>t.id.clock&&!Te.isDeleted(e.ds,t.id),X5=[{light:"#ecd44433",dark:"#ecd444"}],Y5=(t,e,n)=>{if(!t.has(n)){if(t.size<e.length){const r=UT();t.forEach(o=>r.add(o)),e=e.filter(o=>!r.has(o))}t.set(n,C5(e))}return t.get(n)},Z5=(t,{colors:e=X5,colorMapping:n=new Map,permanentUserData:r=null,onFirstRender:o=()=>{},mapping:i}={})=>{let s=!1;const a=new eO(t,i),l=new Xe({props:{editable:c=>{const u=ot.getState(c);return u.snapshot==null&&u.prevSnapshot==null}},key:ot,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(ot);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)&&ap(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=Mr.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)},ot)})}},destroy:()=>{a.destroy()}})});return l},Q5=(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=ks(n.doc,n.type,e.anchor,n.mapping),o=ks(n.doc,n.type,e.head,n.mapping);r!==null&&o!==null&&(t=t.setSelection(je.create(t.doc,r,o)))}},Pd=(t,e)=>({type:e.selection.jsonID,anchor:pl(e.selection.anchor,t.type,t.mapping),head:pl(e.selection.head,t.type,t.mapping)});class eO{constructor(e,n=new Map){this.type=e,this.prosemirrorView=null,this.mux=b5(),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=Pd(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()?(Jv&&this._domSelectionInView===null&&(ap(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=_5.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=Te.createSnapshot(Te.createDeleteSet(),new Map)),this.prosemirrorView.dispatch(this._tr.setMeta(ot,{snapshot:e,prevSnapshot:n}))}unrenderSnapshot(){this.mapping.clear(),this.mux(()=>{const e=this.type.toArray().map(r=>es(r,this.prosemirrorView.state.schema,this)).filter(r=>r!==null),n=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new xe(be.from(e),0,0));n.setMeta(ot,{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=>es(o,this.prosemirrorView.state.schema,this)).filter(o=>o!==null),r=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new xe(be.from(n),0,0));if(e){const o=Or(ai(e.anchor,0),r.doc.content.size),i=Or(ai(e.head,0),r.doc.content.size);r.setSelection(je.create(r.doc,o,i))}this.prosemirrorView.dispatch(r.setMeta(ot,{isChangeOrigin:!0,binding:this}))})}_renderSnapshot(e,n,r){let o=this.doc,i=this.type;if(e||(e=Te.snapshot(this.doc)),e instanceof Uint8Array||n instanceof Uint8Array)if((!(e instanceof Uint8Array)||!(n instanceof Uint8Array))&&Wv(),o=new Te.Doc({gc:!1}),Te.applyUpdateV2(o,n),n=Te.snapshot(o),Te.applyUpdateV2(o,e),e=Te.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=Te.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=>{Te.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:Y5(r.colorMapping,r.colors,p)}},c=Te.typeListToArraySnapshot(i,new Te.Snapshot(n.ds,e.sv)).map(d=>!d._item.deleted||dl(d._item,e)||dl(d._item,n)?es(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 xe(be.from(c),0,0));this.prosemirrorView.dispatch(u.setMeta(ot,{isChangeOrigin:!0}))},ot)})}_typeChanged(e,n){if(this.prosemirrorView==null)return;const r=ot.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);Te.iterateDeletedStructs(n,n.deleteSet,a=>{if(a.constructor===Te.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=>Yv(a,this.prosemirrorView.state.schema,this)).filter(a=>a!==null);let s=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new xe(be.from(i),0,0));Q5(s,this.beforeTransactionSelection,this),s=s.setMeta(ot,{isChangeOrigin:!0,isUndoRedoOperation:n.origin instanceof Te.UndoManager}),this.beforeTransactionSelection!==null&&this._isLocalCursorInView()&&s.scrollIntoView(),this.prosemirrorView.dispatch(s)})}_prosemirrorChanged(e){this.doc.transact(()=>{jd(this.doc,this.type,e,this),this.beforeTransactionSelection=Pd(this,this.prosemirrorView.state)},ot)}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 Yv=(t,e,n,r,o,i)=>{const s=n.mapping.get(t);if(s===void 0){if(t instanceof Te.XmlElement)return es(t,e,n,r,o,i);throw m5()}return s},es=(t,e,n,r,o,i)=>{const s=[],a=l=>{if(l instanceof Te.XmlElement){const c=Yv(l,e,n,r,o,i);c!==null&&s.push(c)}else{const c=l._item.right?.content?.type;c instanceof Te.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=tO(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):Te.typeListToArraySnapshot(t,new Te.Snapshot(o.ds,r.sv)).forEach(a);try{const l=t.getAttributes(r);r!==void 0&&(dl(t._item,r)?dl(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)},ot),n.mapping.delete(t),null}},tO=(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,aO(c.attributes,e)))}}catch{return t.doc.transact(l=>{t._item.delete(l)},ot),null}return s},nO=(t,e)=>{const n=new Te.XmlText,r=t.map(o=>({insert:o.text,attributes:e2(o.marks,e)}));return n.applyDelta(r),e.mapping.set(n,t),n},rO=(t,e)=>{const n=new Te.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,Gl(t).map(r=>zd(r,e))),e.mapping.set(n,t),n},zd=(t,e)=>t instanceof Array?nO(t,e):rO(t,e),yy=t=>typeof t=="object"&&t!==null,lp=(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||yy(s)&&yy(a)&&lp(s,a)}return r},Gl=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},Zv=(t,e)=>{const n=t.toDelta();return n.length===e.length&&n.every((r,o)=>r.insert===e[o].text&&g5(r.attributes||{}).length===e[o].marks.length&&y5(r.attributes,(i,s)=>{const a=Qv(s),l=e[o].marks;return lp(i,l.find(c=>c.type.name===a)?.attrs)}))},xs=(t,e)=>{if(t instanceof Te.XmlElement&&!(e instanceof Array)&&qd(t,e)){const n=Gl(e);return t._length===n.length&&lp(t.getAttributes(),e.attrs)&&t.toArray().every((r,o)=>xs(r,n[o]))}return t instanceof Te.XmlText&&e instanceof Array&&Zv(t,e)},fl=(t,e)=>t===e||t instanceof Array&&e instanceof Array&&t.length===e.length&&t.every((n,r)=>e[r]===n),wy=(t,e,n)=>{const r=t.toArray(),o=Gl(e),i=o.length,s=r.length,a=Or(s,i);let l=0,c=0,u=!1;for(;l<a;l++){const d=r[l],f=o[l];if(fl(n.mapping.get(d),f))u=!0;else if(!xs(d,f))break}for(;l+c<a;c++){const d=r[s-c-1],f=o[i-c-1];if(fl(n.mapping.get(d),f))u=!0;else if(!xs(d,f))break}return{equalityFactor:l+c,foundMappedChild:u}},oO=t=>{let e="",n=t._start;const r={};for(;n!==null;)n.deleted||(n.countable&&n.content instanceof Te.ContentString?e+=n.content.str:n.content instanceof Te.ContentFormat&&(r[n.content.key]=null)),n=n.right;return{str:e,nAttrs:r}},iO=(t,e,n)=>{n.mapping.set(t,e);const{nAttrs:r,str:o}=oO(t),i=e.map(c=>({insert:c.text,attributes:Object.assign({},r,e2(c.marks,n))})),{insert:s,remove:a,index:l}=S5(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})))},sO=/(.*)(--[a-zA-Z0-9+/=]{8})$/,Qv=t=>sO.exec(t)?.[1]??t,aO=(t,e)=>{const n=[];for(const r in t)n.push(e.mark(Qv(r),t[r]));return n},e2=(t,e)=>{const n={};return t.forEach(r=>{if(r.type.name!=="ychange"){const o=Gv(e.isOMark,r.type,()=>!r.type.excludes(r.type));n[o?`${r.type.name}--${K5(r.toJSON())}`:r.type.name]=r.attrs}}),n},jd=(t,e,n,r)=>{if(e instanceof Te.XmlElement&&e.nodeName!==n.type.name)throw new Error("node name mismatch!");if(r.mapping.set(e,n),e instanceof Te.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=Gl(n),i=o.length,s=e.toArray(),a=s.length,l=Or(i,a);let c=0,u=0;for(;c<l;c++){const d=s[c],f=o[c];if(!fl(r.mapping.get(d),f))if(xs(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(!fl(r.mapping.get(d),f))if(xs(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 Te.XmlText&&p instanceof Array)Zv(f,p)||iO(f,p,r),c+=1;else{let y=f instanceof Te.XmlElement&&qd(f,p),g=h instanceof Te.XmlElement&&qd(h,m);if(y&&g){const x=wy(f,p,r),k=wy(h,m,r);x.foundMappedChild&&!k.foundMappedChild?g=!1:!x.foundMappedChild&&k.foundMappedChild||x.equalityFactor<k.equalityFactor?y=!1:g=!1}y?(jd(t,f,p,r),c+=1):g?(jd(t,h,m,r),u+=1):(r.mapping.delete(e.get(c)),e.delete(c,1),e.insert(c,[zd(p,r)]),c+=1)}}const d=a-c-u;if(a===1&&i===0&&s[0]instanceof Te.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(zd(o[p],r));e.insert(c,f)}},ot)},qd=(t,e)=>!(e instanceof Array)&&t.nodeName===e.type.name;let ts=null;const lO=()=>{const t=ts;ts=null,t.forEach((e,n)=>{const r=n.state.tr,o=ot.getState(n.state);o&&o.binding&&!o.binding.isDestroyed&&(e.forEach((i,s)=>{r.setMeta(s,i)}),n.dispatch(r))})},cO=(t,e,n)=>{ts||(ts=new Map,ap(0,lO)),Gv(ts,t,La).set(e,n)},pl=(t,e,n)=>{if(t===0)return Te.createRelativePositionFromTypeIndex(e,0,-1);let r=e._first===null?null:e._first.content.type;for(;r!==null&&e!==r;){if(r instanceof Te.XmlText){if(r._length>=t)return Te.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 Te.RelativePosition(r._item===null?null:r._item.id,r._item===null?Te.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 Te.RelativePosition(r._item===null?null:r._item.id,r._item===null?Te.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 Wv();if(t===0&&r.constructor!==Te.XmlText&&r!==e)return uO(r._item.parent,r._item)}return Te.createRelativePositionFromTypeIndex(e,e._length,-1)},uO=(t,e)=>{let n=null,r=null;return t._item===null?r=Te.findRootTypeKey(t):n=Te.createID(t._item.id.client,t._item.id.clock),new Te.RelativePosition(n,r,e.id)},ks=(t,e,n,r)=>{const o=Te.createAbsolutePositionFromRelativePosition(n,t);if(o===null||o.type!==e&&!Te.isParentOf(e,o.type._item))return null;let i=o.type,s=0;if(i.constructor===Te.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 Te.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 Te.XmlText?s+=c._length:s+=r.get(c).nodeSize),l=l.right}}i=a}return s-1},dO=(t,e)=>{const n=t.toArray().map(r=>es(r,e,J5())).filter(r=>r!==null);return be.fromArray(n)},fO=(t,e)=>e.topNodeType.create(null,dO(t,e)),pO=(t,e,n)=>t!==e,hO=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},mO=t=>({style:`background-color: ${t.color}70`,class:"ProseMirror-yjs-selection"}),gO=/^#[0-9a-fA-F]{6}$/,by=(t,e,n,r,o)=>{const i=ot.getState(t),s=i.doc,a=[];return i.snapshot!=null||i.prevSnapshot!=null||i.binding.mapping.size===0?Be.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":gO.test(u.color)||console.warn("A user uses an unsupported color format",u),u.name==null&&(u.name=`User: ${c}`);let d=ks(s,i.type,Te.createRelativePositionFromJSON(l.cursor.anchor),i.binding.mapping),f=ks(s,i.type,Te.createRelativePositionFromJSON(l.cursor.head),i.binding.mapping);if(d!==null&&f!==null){const p=ai(t.doc.content.size-1,0);d=Or(d,p),f=Or(f,p),a.push(qe.widget(f,()=>r(u,c),{key:c+"",side:10}));const h=Or(d,f),m=ai(d,f);a.push(qe.inline(h,m,o(u,c),{inclusiveEnd:!0,inclusiveStart:!1}))}}}),Be.create(t.doc,a))},yO=(t,{awarenessStateFilter:e=pO,cursorBuilder:n=hO,selectionBuilder:r=mO,getSelection:o=s=>s.selection}={},i="cursor")=>new Xe({key:oa,state:{init(s,a){return by(a,t,e,n,r)},apply(s,a,l,c){const u=ot.getState(c),d=s.getMeta(oa);return u&&u.isChangeOrigin||d&&d.awarenessUpdated?by(c,t,e,n,r):a.map(s.mapping,s.doc)}},props:{decorations:s=>oa.getState(s)},view:s=>{const a=()=>{s.docView&&cO(s,oa,{awarenessUpdated:!0})},l=()=>{const c=ot.getState(s.state),u=t.getLocalState()||{};if(s.hasFocus()){const d=o(s.state),f=pl(d.anchor,c.type,c.binding.mapping),p=pl(d.head,c.type,c.binding.mapping);(u.cursor==null||!Te.compareRelativePositions(Te.createRelativePositionFromJSON(u.cursor.anchor),f)||!Te.compareRelativePositions(Te.createRelativePositionFromJSON(u.cursor.head),p))&&t.setLocalStateField(i,{anchor:f,head:p})}else u.cursor!=null&&ks(c.doc,c.type,Te.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)}}}}),wO=t=>{const e=Mr.getState(t).undoManager;if(e!=null)return e.undo(),!0},bO=t=>{const e=Mr.getState(t).undoManager;if(e!=null)return e.redo(),!0},vO=new Set(["paragraph"]),xO=(t,e)=>!(t instanceof Vo.Item)||!(t.content instanceof Vo.ContentType)||!(t.content.type instanceof Vo.Text||t.content.type instanceof Vo.XmlElement&&e.has(t.content.type.nodeName))||t.content.type._length===0,kO=({protectedNodes:t=vO,trackedOrigins:e=[],undoManager:n=null}={})=>new Xe({key:Mr,state:{init:(r,o)=>{const i=ot.getState(o),s=n||new Vo.UndoManager(i.type,{trackedOrigins:new Set([ot].concat(e)),deleteFilter:a=>xO(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=ot.getState(s).binding,l=o.undoManager,c=l.undoStack.length>0,u=l.redoStack.length>0;return a?{undoManager:l,prevSel:Pd(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=ot.getState(r.state),i=Mr.getState(r.state).undoManager;return i.on("stack-item-added",({stackItem:s})=>{const a=o.binding;a&&s.meta.set(a,Mr.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 Hn;class SO{constructor(){$r(this,Hn,new Map)}on(e,n){const r=Jn(this,Hn).get(e);r?r.push(n):Jn(this,Hn).set(e,[n])}emit(e,...n){const r=Jn(this,Hn).get(e);if(r)for(const o of r)o.apply(this,n)}off(e,n){const r=Jn(this,Hn).get(e);r&&(n?Jn(this,Hn).set(e,r.filter(o=>o!==n)):Jn(this,Hn).delete(e))}removeAllListeners(){Y1(this,Hn,new Map)}}Hn=new WeakMap;var _r={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:"'"},hl={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},EO=typeof navigator<"u"&&/Mac/.test(navigator.platform),CO=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var At=0;At<10;At++)_r[48+At]=_r[96+At]=String(At);for(var At=1;At<=24;At++)_r[At+111]="F"+At;for(var At=65;At<=90;At++)_r[At]=String.fromCharCode(At+32),hl[At]=String.fromCharCode(At);for(var vu in _r)hl.hasOwnProperty(vu)||(hl[vu]=_r[vu]);function AO(t){var e=EO&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||CO&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?hl:_r)[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 $O=typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):!1;function TO(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))$O?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 OO(t){let e=Object.create(null);for(let n in t)e[TO(n)]=t[n];return e}function xu(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 MO(t){return new Xe({props:{handleKeyDown:cp(t)}})}function cp(t){let e=OO(t);return function(n,r){let o=AO(r),i,s=e[xu(o,r)];if(s&&s(n.state,n.dispatch,n))return!0;if(o.length==1&&o!=" "){if(r.shiftKey){let a=e[xu(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=_r[r.keyCode])&&i!=o){let a=e[xu(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 ar(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 Hs(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}var ml,t2,n2;class Ae{static getAttributesFromExtensions(e){const n=[],r={default:null,rendered:!0,renderDOM:null,parseDOM:null,keepOnSplit:!0},o=Me(this,ml,t2).call(this,e,r),i=Me(this,ml,n2).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=ar(n,e.schema),o=js(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=Hs(typeof n=="string"?n:n.name,e.schema);return r==="node"?this.getNodeAttributes(e,n):r==="mark"?this.getMarkAttributes(e,n):{}}}ml=new WeakSet,t2=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=Ne(o,"addGlobalAttributes",i);if(!s)continue;const a=s();for(const l of a)r(l)}return n},n2=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=Ne(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},$r(Ae,ml);function Vd(t){const e=Object.entries(t).filter(([n,r])=>n==="attrs"&&XC(r)?!1:r!=null);return Object.fromEntries(e)}var gl,r2,o2;const i2=class Ud{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=>Ne(d,"topNode"))?.name,l=Ae.getAttributesFromExtensions(e),c=Me(r=Ud,gl,r2).call(r,i,l,n),u=Me(o=Ud,gl,o2).call(o,s,l,n);return new Vb({topNode:a,nodes:c,marks:u})}};gl=new WeakSet,r2=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=Ne(h,"extendNodeSchema",s);return{...p,...m?m(o):{}}},{}),c=Vd({content:We(Ne(o,"content",s)),group:We(Ne(o,"group",s)),marks:We(Ne(o,"marks",s)),inline:We(Ne(o,"inline",s)),atom:We(Ne(o,"atom",s)),selectable:We(Ne(o,"selectable",s)),draggable:We(Ne(o,"draggable",s)),code:We(Ne(o,"code",s)),defining:We(Ne(o,"defining",s)),isolating:We(Ne(o,"isolating",s)),attrs:a,...l}),u=We(Ne(o,"parseDOM",s));u&&(c.parseDOM=u.map(p=>Ae.insertExtensionAttrsToParseRule(p,i)));const d=Ne(o,"renderDOM",s);d&&(c.toDOM=p=>d({node:p,htmlAttributes:Ae.getAttributesToRender(p,i)}));const f=Ne(o,"renderText",s);return f&&(c.toText=f),[o.name,c]});return Object.fromEntries(r)},o2=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=Vd({group:We(Ne(o,"group",s)),inclusive:We(Ne(o,"inclusive",s)),excludes:We(Ne(o,"excludes",s)),spanning:We(Ne(o,"spanning",s)),code:We(Ne(o,"code",s)),attrs:a}),c=We(Ne(o,"parseDOM",s));c&&(l.parseDOM=c.map(d=>Ae.insertExtensionAttrsToParseRule(d,i)));const u=Ne(o,"renderDOM",s);return u&&(l.toDOM=d=>u({mark:d,htmlAttributes:Ae.getAttributesToRender(d,i)})),[o.name,l]});return Object.fromEntries(r)},$r(i2,gl);let DO=i2;function Ss(t,e){return e.nodes[t]||e.marks[t]||null}function _O(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function up(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 s2=class a2{constructor(e){Fe(this,"editor"),Fe(this,"rawCommands"),this.editor=e.editor,this.rawCommands=this.editor.extensionService.commands}static create(...e){return new a2(...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:up(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 NO(t,e){const n=yi.fromSchema(e).serializeFragment(t),r=document.implementation.createHTMLDocument().createElement("div");return r.appendChild(n),r.innerHTML}const IO=(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 FO{constructor(e){Fe(this,"match"),Fe(this,"handler"),this.match=e.match,this.handler=e.handler}}const BO=(t,e)=>{if(y1(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},ku=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=IO(l)+o;return i.forEach(d=>{if(c)return;const f=BO(u,d.match);if(!f)return;const p=a.state.tr,h=up(p,a.state),m={from:n-(f[0].length-o.length),to:r},{commands:y,chain:g,can:x}=new s2({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},RO=({editor:t,rules:e})=>{const n=new Xe({key:new et("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=NO(be.from(l),i.schema));const{from:c}=a,u=c+l.length;ku({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 ku({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?ku({editor:t,from:i.pos,to:i.pos,text:`
|
|
44
44
|
`,rules:e,plugin:n}):!1},handlePaste(r,o,i){const s=o.clipboardData;Array.from(s.types);const a=s.getData("text/html");s.getData("text/plain");let l;switch(a?/class="?Mso|xmlns:o="urn:schemas-microsoft-com|name="?Generator" content="?Microsoft Word|<!--\[if gte mso/i.test(a)?l="word-html":l="browser-html":l="plain-text",l){case"plain-text":break;case"word-html":break;case"browser-html":return LO(a,t)}return!1}},isInputRules:!0});return n},LO=(t,e,n)=>{const r=PO(t),o=document.createElement("div");o.innerHTML=r;const i=Ar.fromSchema(e.schema).parse(o);o.remove();const{dispatch:s}=e.view;return s?(s(e.view.state.tr.replaceSelectionWith(i,!0)),!0):!1},PO=t=>t.replace(/font-size\s*:\s*([\d.]+)em/gi,(e,n)=>{const r=parseFloat(n);return`font-size: ${Math.round(r*12*100)/100}pt`});var yl,l2,vy;const zO=class qi{constructor(e,n,r){$r(this,yl),Fe(this,"editor"),Fe(this,"schema"),Fe(this,"extensions"),Fe(this,"externalExtensions",[]),Fe(this,"splittableMarks",[]),this.editor=r,this.externalExtensions=n||[],this.externalExtensions=this.externalExtensions.map(o=>({...o,isExternal:!0})),this.extensions=qi.getResolvedExtensions([...e,...this.externalExtensions]),this.schema=DO.createSchemaByExtensions(this.extensions,r),Me(this,yl,l2).call(this)}static create(...e){return new qi(...e)}static getResolvedExtensions(e){return qi.sortByPriority(e)}static sortByPriority(e){return e.sort((n,r)=>{const o=Ne(n,"priority")||100,i=Ne(r,"priority")||100;return o>i?-1:o<i?1:0})}get attributes(){return Ae.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:Ss(n.name,this.schema)},o=Ne(n,"addCommands",r);o&&(e={...e,...o()})}return e}get plugins(){const e=this.editor,n=qi.sortByPriority([...this.extensions].reverse()),r=[],o=n.map(i=>{const s={name:i.name,options:i.options,storage:i.storage,editor:e,type:Ss(i.name,this.schema)},a=[],l=Ne(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(MO(c));const u=Ne(i,"addInputRules",s);_O(i,e.options.enableInputRules)&&u&&r.push(...u());const d=Ne(i,"addPmPlugins",s);if(d){const f=d();a.push(...f)}return a}).flat();return[RO({editor:e,rules:r}),...o]}get nodeViews(){const{editor:e}=this,n=this.extensions.filter(r=>r.type==="node").filter(r=>!!Ne(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=Ne(r,"addNodeView",i);if(!s)return[];const a=(l,c,u,d)=>{const f=Ae.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)}};yl=new WeakSet,l2=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:Ss(t.name,this.schema)};t.type==="mark"&&(We(Ne(t,"keepOnSplit",e))??!0)&&this.splittableMarks.push(t.name),Me(this,yl,vy).call(this,t)}},vy=function(t){const e={name:t.name,options:t.options,storage:t.storage,editor:this.editor,type:Ss(t.name,this.schema)},n=Ne(t,"onBeforeCreate",e),r=Ne(t,"onCreate",e),o=Ne(t,"onUpdate",e),i=Ne(t,"onSelectionUpdate",e),s=Ne(t,"onTransaction",e),a=Ne(t,"onFocus",e),l=Ne(t,"onBlur",e),c=Ne(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 jO=zO;const qO=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},VO=t=>e=>t(e),UO=()=>({tr:t})=>(t.insertText(" ",t.selection.from,t.selection.to),!0),HO=()=>({tr:t,state:e})=>{let n=t.selection.from;const r=e.schema.nodes.tab.create();return t.insert(n,r),!0},WO=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),dp=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function GO(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const c2=(t,e,n)=>{let r=GO(t,n);if(!r)return!1;let o=d2(r);if(!o){let s=r.blockRange(),a=s&&Ps(s);return a==null?!1:(e&&e(t.tr.lift(s,a).scrollIntoView()),!0)}let i=o.nodeBefore;if(w2(t,o,e,-1))return!0;if(r.parent.content.size==0&&(ci(i,"end")||Ie.isSelectable(i)))for(let s=r.depth;;s--){let a=Wf(t.doc,r.before(s),r.after(s),xe.empty);if(a&&a.slice.size<a.to-a.from){if(e){let l=t.tr.step(a);l.setSelection(ci(i,"end")?Le.findFrom(l.doc.resolve(l.mapping.map(o.pos,-1)),-1):Ie.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 ci(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 u2=(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=d2(r)}let s=i&&i.nodeBefore;return!s||!Ie.isSelectable(s)?!1:(e&&e(t.tr.setSelection(Ie.create(t.doc,i.pos-s.nodeSize)).scrollIntoView()),!0)};function d2(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 KO(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset<n.parent.content.size)?null:n}const f2=(t,e,n)=>{let r=KO(t,n);if(!r)return!1;let o=h2(r);if(!o)return!1;let i=o.nodeAfter;if(w2(t,o,e,1))return!0;if(r.parent.content.size==0&&(ci(i,"start")||Ie.isSelectable(i))){let s=Wf(t.doc,r.before(),r.after(),xe.empty);if(s&&s.slice.size<s.to-s.from){if(e){let a=t.tr.step(s);a.setSelection(ci(i,"start")?Le.findFrom(a.doc.resolve(a.mapping.map(o.pos)),1):Ie.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},p2=(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=h2(r)}let s=i&&i.nodeAfter;return!s||!Ie.isSelectable(s)?!1:(e&&e(t.tr.setSelection(Ie.create(t.doc,i.pos)).scrollIntoView()),!0)};function h2(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 JO=(t,e)=>{let n=t.selection,r=n instanceof Ie,o;if(r){if(n.node.isTextblock||!Br(t.doc,n.from))return!1;o=n.from}else if(o=n1(t.doc,n.from,-1),o==null)return!1;if(e){let i=t.tr.join(o);r&&i.setSelection(Ie.create(i.doc,o-t.doc.resolve(o).nodeBefore.nodeSize)),e(i.scrollIntoView())}return!0},XO=(t,e)=>{let n=t.selection,r;if(n instanceof Ie){if(n.node.isTextblock||!Br(t.doc,n.to))return!1;r=n.to}else if(r=n1(t.doc,n.to,1),r==null)return!1;return e&&e(t.tr.join(r).scrollIntoView()),!0},m2=(t,e)=>{let{$head:n,$anchor:r}=t.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(e&&e(t.tr.insertText(`
|
|
45
|
-
`).scrollIntoView()),!0)};function fp(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 YO=(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=fp(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(Le.near(l.doc.resolve(a),1)),e(l.scrollIntoView())}return!0},g2=(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=fp(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(je.create(a.doc,s+1)),e(a.scrollIntoView())}return!0},y2=(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(er(t.doc,i))return e&&e(t.tr.split(i).scrollIntoView()),!0}let r=n.blockRange(),o=r&&Ps(r);return o==null?!1:(e&&e(t.tr.lift(r,o).scrollIntoView()),!0)};function ZO(t){return(e,n)=>{let{$from:r,$to:o}=e.selection;if(e.selection instanceof Ie&&e.selection.node.isBlock)return!r.parentOffset||!er(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=fp(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 je||e.selection instanceof _n)&&u.deleteSelection();let d=u.mapping.map(r.pos),f=er(u.doc,d,i.length,i);if(f||(i[0]=a?{type:a}:null,f=er(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 QO=ZO(),eM=(t,e)=>(e&&e(t.tr.setSelection(new _n(t.doc))),!0);function tM(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||Br(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function w2(t,e,n,r){let o=e.nodeBefore,i=e.nodeAfter,s,a,l=o.type.spec.isolating||i.type.spec.isolating;if(!l&&tM(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=be.empty;for(let g=s.length-1;g>=0;g--)h=be.from(s[g].create(null,h));h=be.from(o.copy(h));let m=t.tr.step(new Zt(e.pos-1,p,e.pos,p,new xe(h,1,0),s.length,!0)),y=m.doc.resolve(p+2*s.length);y.nodeAfter&&y.nodeAfter.type==o.type&&Br(m.doc,y.pos)&&m.join(y.pos),n(m.scrollIntoView())}return!0}let u=i.type.spec.isolating||r>0&&l?null:Le.findFrom(e,1),d=u&&u.$from.blockRange(u.$to),f=d&&Ps(d);if(f!=null&&f>=e.depth)return n&&n(t.tr.lift(d,f).scrollIntoView()),!0;if(c&&ci(i,"start",!0)&&ci(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=be.empty;for(let k=h.length-1;k>=0;k--)g=be.from(h[k].copy(g));let x=t.tr.step(new Zt(e.pos-h.length,e.pos+i.nodeSize,e.pos+y,e.pos+i.nodeSize-y,new xe(g,h.length,0),0,!0));n(x.scrollIntoView())}return!0}}return!1}function b2(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(je.create(e.doc,t<0?o.start(i):o.end(i)))),!0):!1}}const nM=b2(-1),rM=b2(1);function xy(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 pp(...t){return function(e,n,r){for(let o=0;o<t.length;o++)if(t[o](e,n,r))return!0;return!1}}pp(dp,c2,u2);pp(dp,f2,p2);pp(m2,g2,y2,QO);typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function v2(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 ky=(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)}},oM=({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=Ae.getSplittedAttributes(u,l.node().type.name,l.node().attrs);if(s instanceof Ie&&s.node.isBlock)return!l.parentOffset||!er(a,l.pos)?!1:(o&&(t&&ky(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 je&&n.deleteSelection();const p=l.depth===0?null:v2(l.node(-1).contentMatchAt(l.indexAfter(-1)));let h=f&&p?[{type:p,attrs:d}]:void 0,m=er(n.doc,n.mapping.map(l.pos),1,h);if(!h&&!m&&er(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&&ky(r,i.extensionService.splittableMarks),n.scrollIntoView()}return!0},iM=()=>({state:t,dispatch:e})=>y2(t,e),sM=()=>({state:t,dispatch:e})=>g2(t,e),aM=()=>({state:t,dispatch:e})=>m2(t,e),lM=()=>({state:t,dispatch:e})=>YO(t,e),x2=t=>{};function cM(t,e,n){const{selection:r}=e;let o=null;if(x2()&&(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 uM=(t,e={})=>({tr:n,state:r,dispatch:o})=>{const{selection:i}=n,{empty:s,ranges:a}=i,l=ar(t,r.schema);if(o)if(s){const c=Ae.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 cM(r,n,l)};function Hd(t,e,n={}){return t.find(r=>r.type===e&&ti(r.attrs,n))}function dM(t,e,n={}){return!!Hd(t,e,n)}function hp(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=Hd([...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(Hd([...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&&dM([...t.parent.child(a).marks],e,n);)l+=t.parent.child(a).nodeSize,a+=1;return{from:s,to:l}}const fM=(t,e={})=>({tr:n,state:r,dispatch:o})=>{const{extendEmptyMarkRange:i=!1}=e,{selection:s}=n,a=ar(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=hp(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},pM=()=>({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 wl(t,e,n={}){const{empty:r,ranges:o}=t.selection,i=e?ar(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter(u=>i?i.name===u.type.name:!0).find(u=>ti(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=>ti(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 hM=(t,e={},n={})=>({state:r,commands:o})=>{const{extendEmptyMarkRange:i=!1}=n,s=ar(t,r.schema);return wl(r,s,e)?o.unsetMark(s,{extendEmptyMarkRange:i}):o.setMark(s,e)},mM=()=>({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=Ps(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},gM=(t,e={})=>({state:n,dispatch:r,chain:o})=>{const i=mt(t,n.schema);return i.isTextblock?o().command(({commands:s})=>xy(i,e)(n)?!0:s.clearNodes()).command(({state:s})=>xy(i,e)(s,r)).run():!1};function bl(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=>ti(u.node.attrs,n,{strict:!1}));return i?!!c.length:c.reduce((u,d)=>u+d.to-d.from,0)>=l}const yM=(t,e,n={})=>({state:r,commands:o})=>{const i=mt(t,r.schema),s=mt(e,r.schema);return bl(r,i,n)?o.setNode(s):o.setNode(i,n)},wM=()=>({state:t,dispatch:e})=>eM(t,e),bM=()=>({state:t,dispatch:e})=>dp(t,e),vM=(t,e={})=>({tr:n,state:r,dispatch:o})=>{let i=null,s=null;const a=Hs(typeof t=="string"?t:t.name,r.schema);return a?(a==="node"&&(i=mt(t,r.schema)),a==="mark"&&(s=ar(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},xM=(t,e)=>({tr:n,state:r,dispatch:o})=>{let i=null,s=null;const a=Hs(typeof t=="string"?t:t.name,r.schema);return a?(a==="node"&&(i=mt(t,r.schema)),a==="mark"&&(s=ar(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,mg(c.attrs,e)),s&&c.marks.length&&c.marks.forEach(d=>{s===d.type&&n.addMark(u,u+c.nodeSize,s.create(mg(d.attrs,e)))})})}),!0):!1},kM=()=>({state:t,dispatch:e})=>JO(t,e),SM=()=>({state:t,dispatch:e})=>XO(t,e),EM=()=>({state:t,dispatch:e})=>c2(t,e),CM=()=>({state:t,dispatch:e})=>f2(t,e),AM=()=>({state:t,dispatch:e})=>u2(t,e),$M=()=>({state:t,dispatch:e})=>p2(t,e),TM=()=>({state:t,dispatch:e})=>nM(t,e),OM=()=>({state:t,dispatch:e})=>rM(t,e),MM=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),k2=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&&k2(r)}return t};function ia(t){const e=`<body>${t}</body>`,n=new window.DOMParser().parseFromString(e,"text/html").body;return k2(n)}function Wd(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 be.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),Wd("",e,n)}if(o){if(n.errorOnInvalidContent){let s=!1,a="";const l=new Vb({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?Ar.fromSchema(l).parseSlice(ia(t),n.parseOptions):Ar.fromSchema(l).parse(ia(t),n.parseOptions),n.errorOnInvalidContent&&s)throw new Error("[super-editor error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${a}`)})}const i=Ar.fromSchema(e);return n.slice?i.parseSlice(ia(t),n.parseOptions).content:i.parse(ia(t),n.parseOptions)}return Wd("",e,n)}function DM(t,e,n){const r=t.steps.length-1;if(r<e)return;const o=t.steps[r];if(!(o instanceof $t||o instanceof Zt))return;const i=t.mapping.maps[r];let s=0;i.forEach((a,l,c,u)=>{s===0&&(s=u)}),t.setSelection(Le.near(t.doc.resolve(s),n))}const _M=t=>!("type"in t),NM=(t,e,n)=>({tr:r,dispatch:o,editor:i})=>{if(o){n={parseOptions:{},updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let s;try{s=Wd(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((_M(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&&DM(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},IM=()=>({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 FM(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 BM(a,s,t,e)?(r&&r(a.scrollIntoView()),!0):!1}}function BM(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 tl(l,l,e.depth),e.endIndex<e.parent.childCount&&(e=new tl(e.$from,s.resolve(e.$to.end(e.depth)),e.depth)),o=!0}let a=Zb(i,n,r,e);return a?(t&&RM(t,e,a,o,n),!0):!1}function RM(t,e,n,r,o){let i=be.empty;for(let u=n.length-1;u>=0;u--)i=be.from(n[u].type.create(n[u].attrs,i));t.step(new Zt(e.start-(r?2:0),e.end,e.start,e.end,new xe(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&&er(t.doc,l,a)&&(t.split(l,a),l+=2*a),l+=c.child(u).nodeSize;return t}function LM(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?PM(e,n,t,i):zM(e,n,i):!0:!1}}function PM(t,e,n,r){let o=t.tr,i=r.end,s=r.$to.end(r.depth);i<s&&(o.step(new Zt(i-1,s,i,s,new xe(be.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new tl(o.doc.resolve(r.$from.pos),o.doc.resolve(s),r.depth));const a=Ps(r);if(a==null)return!1;o.lift(r,a);let l=o.doc.resolve(o.mapping.map(i,-1)-1);return Br(o.doc,l.pos)&&l.nodeBefore.type==l.nodeAfter.type&&o.join(l.pos),e(o.scrollIntoView()),!0}function zM(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?be.empty:be.from(o))))return!1;let d=i.pos,f=d+s.nodeSize;return r.step(new Zt(d-(a?1:0),f+(l?1:0),d+1,f-1,new xe((a?be.empty:be.from(o.copy(be.empty))).append(l?be.empty:be.from(o.copy(be.empty))),a?0:1,l?0:1),a?0:1)),e(r.scrollIntoView()),!0}function jM(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=be.from(c?t.create():null),d=new xe(be.from(t.create(null,be.from(a.type.create(null,u)))),c?3:1,0),f=i.start,p=i.end;n(e.tr.step(new Zt(f-(c?3:1),p,f,p,d,1,!0)).scrollIntoView())}return!0}}const qM=(t,e={})=>({state:n,dispatch:r})=>{const o=mt(t,n.schema);return FM(o,e)(n,r)},Kl=(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}}},Jt=t=>({$from:e})=>Kl(e,t),Gd=(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=We(Ne(n,"group",r));return typeof o!="string"?!1:o.split(" ").includes("list")},VM={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"}}]}]}]},UM={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"}}]}]}]},Su=(t,e)=>{const n=Jt(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&&Br(t.doc,n.pos)&&t.join(n.pos),!0},Eu=(t,e)=>{const n=Jt(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&&Br(t.doc,r)&&t.join(r),!0},HM=(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 D=Jt(U=>Gd(U.type.name,f))(y),{numbering:M}=i.converter;if(b.depth>=1&&D&&b.depth-D.depth<=1){if(D.node.type===h){const{listId:U}=D.node.attrs;return i.converter.numbering=GM(U,M),d.liftListItem(m)}if(Gd(D.node.type.name,f)&&h.validContent(D.node.content)&&l)return c().command(()=>(s.setNodeMarkup(D.pos,h),!0)).command(()=>Su(s,h)).command(()=>Eu(s,h)).run()}const I=({ensureMarks:U=!1})=>()=>{const oe=u().wrapInList(h,r);if(U){const N=T.filter(W=>p.includes(W.type.name));s.ensureMarks(N)}return oe?!0:d.clearNodes()},E=S2(M.definitions);return i.converter.numbering=WM(E,M,h),r.listId=E,!n||!T||!l?c().command(I({ensureMarks:!1})).wrapInList(h,r).command(()=>Su(s,h)).command(()=>Eu(s,h)).run():c().command(I({ensureMarks:!0})).wrapInList(h,r).command(()=>Su(s,h)).command(()=>Eu(s,h)).run()},S2=t=>Math.max(...Object.keys(t).map(Number))+1,WM=(t,e,n)=>{const r=n.name==="orderedList"?VM:UM,o={...e},i=S2(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},GM=(t,e)=>{const{definitions:n,abstracts:r}=e,o=n[t].elements[0].attributes["w:val"];return delete n[t],delete r[o],e},KM=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=be.empty;const g=a.index(-1)?1:a.index(-2)?2:3;for(let M=a.depth-g;M>=a.depth-3;M--)y=be.from(a.node(M).copy(y));const x=a.indexAfter(-1)<a.node(-2).childCount?1:a.indexAfter(-2)<a.node(-3).childCount?2:3,k=Ae.getSplittedAttributes(d,a.node().type.name,a.node().attrs),b=s.contentMatch.defaultType?.createAndFill(k)||void 0;y=y.append(be.from(s.createAndFill(null,b)||void 0));const T=a.before(a.depth-(g-1));n.replace(T,a.after(-x),new xe(y,4-g,0));let D=-1;n.doc.nodesBetween(T,n.doc.content.size,(M,I)=>{if(D>-1)return!1;M.isTextblock&&M.content.size===0&&(D=I+1)}),D>-1&&n.setSelection(je.near(n.doc.resolve(D))),n.scrollIntoView()}return!0}const f=l.pos===a.end()?u.contentMatchAt(0).defaultType:null,p=Ae.getSplittedAttributes(d,u.type.name,u.attrs),h=Ae.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(!er(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},JM=t=>({state:e,dispatch:n})=>{const r=mt(t,e.schema);return jM(r)(e,n)},XM=t=>({state:e,dispatch:n})=>{const r=mt(t,e.schema);return LM(r)(e,n)},YM=Object.freeze(Object.defineProperty({__proto__:null,clearNodes:mM,command:VO,createParagraphNear:sM,deleteSelection:bM,exitCode:lM,first:qO,insertContent:MM,insertContentAt:NM,insertTabChar:UO,insertTabNode:HO,joinBackward:EM,joinDown:SM,joinForward:CM,joinUp:kM,liftEmptyBlock:iM,liftListItem:XM,newlineInCode:aM,resetAttributes:xM,selectAll:wM,selectNodeBackward:AM,selectNodeForward:$M,selectTextblockEnd:OM,selectTextblockStart:TM,setMark:uM,setMeta:WO,setNode:gM,sinkListItem:JM,splitBlock:oM,splitListItem:KM,toggleList:HM,toggleMark:hM,toggleNode:yM,undoInputRule:IM,unsetAllMarks:pM,unsetMark:fM,updateAttributes:vM,wrapInList:qM},Symbol.toStringTag,{value:"Module"})),ZM=rt.create({name:"commands",addCommands(){return{...YM}}}),QM=t=>{t.commands.first(({commands:e})=>[()=>e.newlineInCode(),()=>e.createParagraphNear(),()=>e.liftEmptyBlock(),()=>e.splitBlock()])},Ai=t=>{t.commands.first(({commands:e,tr:n})=>[()=>e.undoInputRule(),()=>(n.setMeta("inputType","deleteContentBackward"),!1),()=>e.deleteSelection(),()=>e.joinBackward(),()=>e.selectNodeBackward()])},$o=t=>{t.commands.first(({commands:e})=>[()=>e.deleteSelection(),()=>e.joinForward(),()=>e.selectNodeForward()])},eD=rt.create({name:"keymap",addShortcuts(){const t={Enter:()=>QM(this.editor),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:()=>Ai(this.editor),"Mod-Backspace":()=>Ai(this.editor),"Shift-Backspace":()=>Ai(this.editor),Delete:()=>$o(this.editor),"Mod-Delete":()=>$o(this.editor),"Mod-a":()=>this.editor.commands.selectAll(),Tab:()=>this.editor.commands.insertTabNode()},e={...t},n={...t,"Ctrl-h":()=>Ai(this.editor),"Alt-Backspace":()=>Ai(this.editor),"Ctrl-d":()=>$o(this.editor),"Ctrl-Alt-Backspace":()=>$o(this.editor),"Alt-Delete":()=>$o(this.editor),"Alt-d":()=>$o(this.editor),"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd(),"Ctrl-t":()=>this.editor.commands.insertTabChar()};return YC()||ZC()?n:e}}),tD=rt.create({name:"editable",addPmPlugins(){return[new Xe({key:new et("editable"),props:{editable:()=>this.editor.options.editable}})]}}),nD=rt.create({name:"editorFocus",addPmPlugins(){const t=this.editor;return[new Xe({key:new et("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 E2(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 C2(t,e,n={}){if(!e)return bl(t,null,n)||wl(t,null,n);const r=Hs(e,t.schema);return r==="node"?bl(t,e,n):r==="mark"?wl(t,e,n):!1}const mp=({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[It]);let i=mp({tr:t,from:e,to:n,markName:It,attrs:{authorEmail:r.email}}),s;i?s=i.mark.attrs.id:s=bo();const a=t.doc.type.schema.marks[It].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},$2=({tr:t,from:e,to:n,user:r,date:o})=>{let i=mp({tr:t,from:e,to:n,markName:ut,attrs:{authorEmail:r.email}}),s;i?s=i.mark.attrs.id:s=bo();const a=t.doc.type.schema.marks[ut].create({id:s,author:r.name,authorEmail:r.email,date:o}),l=new Qo;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===It&&f.attrs.authorEmail===r.email)){const f=new $t(l.map(Math.max(e,d)),l.map(Math.min(n,d+u.nodeSize)),xe.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 rD(t){const e={bulletList:1,orderedList:2};return{attributes:{parentAttributes:{"w14:paraId":Xn(),"w14:textId":Xn(),"w:rsidR":Xn(),"w:rsidRDefault":Xn(),"w:rsidP":Xn(),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 oD(t,e,n){const r=[];return t===e?n.resolve(t).marks().forEach(o=>{const i=n.resolve(t-1),s=hp(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 gp(t,e){const n=[];return t.descendants((r,o)=>{e(r)&&n.push({node:r,pos:o})}),n}function T2(t,e,n){const r=t.state.doc.content.size,o=rl(e,0,r),i=rl(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 yp=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},wp=Object.freeze(Object.defineProperty({__proto__:null,chainableEditorState:up,cleanSchemaItem:Vd,createDocument:E2,defaultBlockAt:v2,findChildren:gp,findMark:Ul,findParentNode:Jt,findParentNodeClosestToPos:Kl,generateDocxListAttributes:rD,generateDocxRandomId:Xn,generateRandom32BitHex:Gf,getActiveFormatting:Xf,getExtensionConfigField:Ne,getMarkRange:hp,getMarkType:ar,getMarksBetween:oD,getMarksFromSelection:js,getNodeType:mt,getSchemaTypeByName:Ss,getSchemaTypeNameByName:Hs,isActive:C2,isInTable:yp,isList:Gd,isMarkActive:wl,isNodeActive:bl,isTextSelection:x2,posToDOMRect:T2},Symbol.toStringTag,{value:"Module"})),iD=(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}},O2=(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},M2=(t,e,n)=>{if(t){if(!e)throw new Error('Invalid "predicate" parameter')}else throw new Error('Invalid "node" parameter');return O2(t,n).filter(r=>e(r.node))},D2=(t,e)=>M2(t,n=>n.isInline,e),sD=Object.freeze(Object.defineProperty({__proto__:null,findChildren:M2,findInlineNodes:D2,findMarkPosition:iD,flatten:O2},Symbol.toStringTag,{value:"Module"})),bp=(t,e=null)=>{const n=[],r=D2(t.doc);return r.length?(r.forEach(({node:o,pos:i})=>{const{marks:s}=o,a=[It,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 et("TrackChangesBase"),aD=(t={})=>new Xe({key:ht,state:{init(e,n){return{isTrackChangesActive:!1,onlyOriginalShown:!1,onlyModifiedShown:!1,decorations:To(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:To(o,n.onlyOriginalShown,n.onlyModifiedShown)}:i.type==="SHOW_ONLY_ORIGINAL"?{...n,onlyOriginalShown:i.value===!0,onlyModifiedShown:!1,decorations:To(o,i.value===!0,!1)}:i.type==="SHOW_ONLY_MODIFIED"?{...n,onlyOriginalShown:!1,onlyModifiedShown:i.value===!0,decorations:To(o,!1,i.value===!0)}:{...n,decorations:To(o,n.onlyOriginalShown,n.onlyModifiedShown)}:{...n,decorations:To(o,n.onlyOriginalShown,n.onlyModifiedShown)}}},props:{decorations(e){return this.getState(e)?.decorations}}}),To=(t,e,n)=>{if(!t.doc||!t.doc.nodeSize||n&&e)return Be.empty;const r=[],o=bp(t);return o.length?(o.forEach(({mark:i,from:s,to:a})=>{if(i.type.name===It)if(e){const l=qe.inline(s,a,{class:"track-insert-dec hidden"});r.push(l)}else if(n){const l=qe.inline(s,a,{class:"track-insert-dec normal"});r.push(l)}else{const l=qe.inline(s,a,{class:"track-insert-dec highlighted"});r.push(l)}if(i.type.name===ut)if(e){const l=qe.inline(s,a,{class:"track-delete-dec normal"});r.push(l)}else if(n){const l=qe.inline(s,a,{class:"track-delete-dec hidden"});r.push(l)}else{const l=qe.inline(s,a,{class:"track-delete-dec highlighted"});r.push(l);const c=qe.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=qe.inline(s,a,{class:"track-format-dec before"});r.push(l)}else if(n){const l=qe.inline(s,a,{class:"track-format-dec normal"});r.push(l)}else{const l=qe.inline(s,a,{class:"track-format-dec highlighted"});r.push(l)}}),Be.create(t.doc,r)):Be.empty},sn="commentMark",Sy=({commentId:t,state:e,tr:n,dispatch:r})=>{lD(t,e.doc).forEach(({from:o,to:i})=>{n.removeMark(o,i,e.schema.marks[sn])}),r(n)},lD=(t,e)=>{const n=[];return e.descendants((r,o)=>{const{marks:i}=r,s=i.find(a=>a.type.name===sn);if(s){const{attrs:a}=s,{commentId:l}=a;t===l&&n.push({from:o,to:o+r.nodeSize})}}),n},cD=(t,e,n,r=[])=>{const o=[],i=[],s=new Set;return t.descendants((a,l)=>{(a.marks?.filter(c=>c.type.name===sn)).forEach(c=>{if(c){const{attrs:u={}}=c,{commentId:d}=u;if(d==="pending"||s.has(d))return;s.add(d);const f=Ey(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=Ey(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},Ey=t=>{const{commentId:e,internal:n}=t;return{"w:id":e,internal:n}},uD=(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[sn].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)})},dD=(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."},fD=({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}`},oo=new et("paginationPlugin"),pD=async t=>{if(!t.converter)return;const e={headers:{},footers:{}},n=t.converter.headerIds.ids,r=t.converter.footerIds.ids;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 Cy(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 Cy(t,s);e.footers[i].height=a,e.footers[i].sectionEditor=l,e.footers[i].sectionContainer=c}return e},Cy=async(t,e)=>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 Es({loadFromSchema:!0,mode:"text",editable:!1,element:r,content:e,extensions:Np(),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})})})}):{},vp=[It,ut,vt],bt=new et("comments"),hD=rt.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[sn].create({commentId:a,internal:l})),n(e),!0},removeComment:({commentId:t,importedId:e})=>({tr:n,dispatch:r,state:o})=>{n.setMeta(bt,{event:"deleted"}),Sy({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===sn);if(d){const{attrs:f}=d;f.commentId===t&&(s=l,a=c)}}),s?(n.addMark(a,a+s.nodeSize,this.editor.schema.marks[sn].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"}),Sy({commentId:t,state:r,tr:e,dispatch:n})}}},addPmPlugins(){const t=this.editor;let e,n;return t.options.isHeadless?[]:[new Xe({key:bt,state:{init(){return{activeThreadId:null,externalColor:"#B1124B",internalColor:"#078383",decorations:Be.empty,allCommentPositions:{},allCommentIds:[],changedActiveThread:!1,trackedChanges:{}}},apply(r,o,i,s){const a=r.getMeta(oo)?.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=gD(u,d,s,t));const f=l?.type==="setActiveComment";if(!r.docChanged&&r.selectionSet||f){const{selection:p}=r;let h=mD(s.doc,p);if(f&&(h=l.activeThreadId),n!==h){n=h;const m={type:Fa.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===sn);let g=!1;y.forEach(k=>{const{attrs:b}=k,T=b.commentId||b.importedId,D=i.coordsAtPos(h);Ay({allCommentPositions:d,threadId:T,pos:h,currentBounds:D,node:p});const M=b.internal;g||(g=n===T);let I=fD({activeThreadId:n,threadId:T,isInternal:M,editor:t});const E=qe.inline(h,h+p.nodeSize,{style:`background-color: ${I};`,"data-thread-id":T,class:"comment-highlight"});g&&n!==T||u.push(E)});const x=_2({doc:l,from:h,to:h+p.nodeSize});if(x){const k=i.coordsAtPos(h),{id:b}=x.mark.attrs;Ay({allCommentPositions:d,threadId:b,pos:h,currentBounds:k,node:p})}});const f=Be.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})}}}})]}}),Ay=({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)}},mD=(t,e)=>{if(!e)return;const{$from:n,$to:r}=e;if(n.pos!==r.pos||!t.nodeAt(n.pos))return;const o=_2({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===sn)&&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===sn);return u?.attrs?.commentId||u?.attrs?.importedId},_2=({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=>vp.includes(u.type.name));c&&!s&&(s={from:l,to:l+a.nodeSize,mark:c})}),s},gD=(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=wD({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},yD=({state:t,node:e,mark:n,marks:r,trackedChangeType:o,isDeletionInsertion:i,deletionNodes:s=[]})=>{let a="",l="";if(o===It&&(a=e?.text??""),o===vt&&(a=dD(n.attrs)),(o===ut||i)&&(l=e?.text??"",i)){let{id:c}=r.deletionMark.attrs;l=bD(t.doc,u=>{const{marks:d=[]}=u,f=d.filter(p=>vp.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}},wD=({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:D=[]}=b,M=D.filter(I=>vp.includes(I.type.name));if(M.length&&(M.find(I=>I.attrs.id===p)&&(y=b),y))return!1});const{deletionText:g,trackedChangeText:x}=yD({state:o,node:y||h,mark:s,marks:e,trackedChangeType:c,isDeletionInsertion:m,deletionNodes:n});if(!g&&!x)return;const k={event:Fa.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=Fa.ADD:t==="update"&&(k.event=Fa.UPDATE),k};function bD(t,e){let n=null;return t.descendants((r,o)=>{if(e(r)&&(n={node:r,pos:o}),n)return!1}),n}const N2=({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=Ul(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}=$2({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"})},vD=()=>{},xD=()=>{},I2=({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:bo();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&&ti(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)}})},F2=({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:bo(),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)}})},B2=({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 Qo,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?(N2({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 Ls?(I2({state:e,tr:t,step:d,newTr:i,map:s,doc:f,user:n,date:l}),console.debug("[track-changes]: addMarkStep")):d instanceof vn?(F2({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=Ul(e,c,!1);if(t.selection instanceof je&&(t.selection.from<e.selection.from||t.getMeta("inputType")==="deleteContentBackward")){const d=s.map(t.selection.from,-1);i.setSelection(new je(i.doc.resolve(d)))}else if(t.selection.from>e.selection.from&&u){const d=s.map(u.to+1,1);i.setSelection(new je(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 je(i.doc.resolve(c)))}return t.storedMarksSet&&i.setStoredMarks(t.storedMarks),t.scrolledIntoView&&i.scrollIntoView(),i},kD=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:Go(lt(a.line)),lineSpaceBefore:Go(lt(a.lineSpaceBefore)),lineSpaceAfter:Go(lt(a.lineSpaceAfter))};r.setNodeMarkup(i,void 0,{...s,spacing:{...a,...l}})}}),n(r),!0},SD={initial:kD},$y=t=>{if(t==="initial"||t==="0.4.14")return Object.values(SD)};var Uo,R2,ze,L2,P2,Kd,Cu,z2,Pa,Jd,Au,$u,Xd,Yd,Ty,Tu,Ou,Mu,Du,Oy,Vi,Ui,My,Dy,j2,q2;const ED=class V2 extends SO{constructor(e){super(),$r(this,ze),$r(this,Uo),Fe(this,"extensionService"),Fe(this,"extensionStorage",{}),Fe(this,"schema"),Fe(this,"view"),Fe(this,"isFocused",!1),$r(this,R2),Fe(this,"options",{element:null,selector: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}),Me(this,ze,L2).call(this,e),Me(this,ze,z2).call(this,e),this.setOptions(e);let n={docx:()=>Me(this,ze,P2).call(this,this.options),text:()=>Me(this,ze,Kd).call(this,this.options),html:()=>Me(this,ze,Kd).call(this,this.options),default:()=>{console.log("Not implemented.")}};(n[this.options.mode]??n.default)()}setToolbar(e){this.toolbar=e}focus(){this.view?.focus()}get state(){return this.view.state}get storage(){return this.extensionStorage}get commands(){return Jn(this,Uo).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 Jn(this,Uo).chain()}can(){return Jn(this,Uo).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"?(Me(this,ze,Jd).call(this,"TrackChangesBase"),this.commands.disableTrackChangesShowOriginal(),this.commands.enableTrackChanges(),this.setEditable(!0,!1)):n==="editing"&&(Me(this,ze,Jd).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),Me(this,ze,Pa).call(this)};e.synced?Me(this,ze,Pa).call(this):e.on("synced",n)}setOptions(e){if(this.options={...this.options,...e},this.options.collaborationProvider&&this.options.ydoc){const n=this.options.extensions.findIndex(r=>r.name==="history");n!==-1&&this.options.extensions.splice(n,1)}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 kd,o=await r.getDocxData(e,n),i=r.media;return[o,i,r.mediaFiles,r.fonts]}static getDocumentVersion(e){return Dr.getStoredSuperdocVersion(e)}static updateDocumentVersion(e,n){return Dr.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",e.style.isolation="isolate",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.2;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 Ae.getAttributes(this.state,e)}isActive(e,n){const r=typeof e=="string"?e:null,o=typeof e=="string"?n:e;return C2(this.state,r,o)}getJSON(){return this.state.doc.toJSON()}getHTML(){const e=document.createElement("div"),n=yi.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=Me(this,ze,j2).call(this,r),i=await this.converter.exportToDocx(o,this.schema,this.storage.image.media,e,n,r,this),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,"&")};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 kd().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(),Me(this,ze,q2).call(this),this.removeAllListeners()}static checkIfMigrationsNeeded(e){e||(e="initial");const n=$y(e)||[];return console.debug("[checkVersionMigrations] Migrations needed:",e,n.length),n.length>0}processCollaborationMigrations(){if(console.debug("[checkVersionMigrations] Current editor version","0.10.66"),!this.options.ydoc)return;let e=this.options.ydoc.getMap("meta").get("version");e||(e="initial"),console.debug("[checkVersionMigrations] Document version",e);const n=$y(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){this.setOptions({annotations:!0});const[n,r,o,i]=await V2.loadXmlData(e);this.setOptions({fileSource:e,content:n,media:r,mediaFiles:o,fonts:i,isNewFile:!0,shouldLoadComments:!0,replacedFile:!0}),Me(this,ze,Xd).call(this),Me(this,ze,Yd).call(this),this.initDefaultStyles(),this.options.ydoc&&this.options.collaborationProvider?this.initializeCollaborationData(!0):Me(this,ze,Pa).call(this),this.options.ydoc||(Me(this,ze,Ui).call(this),Me(this,ze,Vi).call(this))}};Uo=new WeakMap,R2=new WeakMap,ze=new WeakSet,L2=function(t){if(!t.element&&t.selector){const{selector:e}=t;e.startsWith("#")||e.startsWith(".")?t.element=document.querySelector(e):t.element=document.getElementById(e),["text","html"].includes(t.mode)&&t.element&&t.element.classList.add("sd-super-editor-html")}t.element=t.isHeadless?null:t.element||document.createElement("div")},P2=function(t){Me(this,ze,Au).call(this),Me(this,ze,$u).call(this),Me(this,ze,Tu).call(this),Me(this,ze,Xd).call(this),Me(this,ze,Yd).call(this),this.options.isHeadless||Me(this,ze,Ty).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),Me(this,ze,Du).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",Me(this,ze,Cu)),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",Me(this,ze,Oy)),this.on("paginationUpdate",this.options.onPaginationUpdate),this.on("comment-positions",this.options.onCommentLocationsUpdate),this.initializeCollaborationData(),this.options.ydoc||(Me(this,ze,Ui).call(this),Me(this,ze,Vi).call(this)),window.setTimeout(()=>{this.isDestroyed||this.emit("create",{editor:this})},0))},Kd=function(t){(!t.extensions||!t.extensions.length)&&(this.options.extensions=_p()),Me(this,ze,Au).call(this),Me(this,ze,$u).call(this),Me(this,ze,Tu).call(this),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("contentError",this.options.onContentError),Me(this,ze,Du).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",Me(this,ze,Cu)),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)},Cu=function({editor:t,event:e}){this.toolbar?.setActiveEditor(t),this.options.onFocus({editor:t,event:e})},z2=function(t){t.isHeadless&&(typeof navigator>"u"&&(Kr.navigator={isHeadless:!0}),t.mockDocument&&(Kr.document=t.mockDocument,Kr.window=t.mockWindow))},Pa=function(){if(!this.options.isNewFile)return;this.options.isNewFile=!1;const t=Me(this,ze,Ou).call(this),e=this.state.tr.replaceWith(0,this.state.doc.content.size,t);this.view.dispatch(e),setTimeout(()=>{Me(this,ze,Ui).call(this),Me(this,ze,Vi).call(this)},50)},Jd=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},Au=function(){const t=["extension","node","mark"],e=[tD,ZM,nD,eD],n=this.options.externalExtensions||[],r=[...e,...this.options.extensions].filter(o=>t.includes(o?.type));this.extensionService=jO.create(r,n,this)},$u=function(){Y1(this,Uo,s2.create({editor:this}))},Xd=function(){this.options.converter?this.converter=this.options.converter:this.converter=new Dr({docx:this.options.content,media:this.options.mediaFiles,fonts:this.options.fonts,debug:!0,telemetry:this.options.telemetry,fileSource:this.options.fileSource,documentId:this.options.documentId})},Yd=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())},Ty=function(){const t=this.converter.getDocumentFonts();if(t?.length){const e=document.createElement("style");e.textContent=t,document.head.appendChild(e)}},Tu=function(){this.schema=this.extensionService.schema},Ou=function(){let t;try{const{mode:e,fragment:n,isHeadless:r,content:o,loadFromSchema:i}=this.options;e==="docx"?(t=E2(this.converter,this.schema,this),t=Me(this,ze,Dy).call(this,t),this.options.html&&(t=Me(this,ze,Mu).call(this,this.options.html)),n&&(t=fO(n,this.schema))):(e==="text"||e==="html")&&(i?t=this.schema.nodeFromJSON(o):o?t=Me(this,ze,Mu).call(this,o):t=this.schema.topNodeType.createAndFill())}catch(e){console.error(e),this.emit("contentError",{editor:this,error:e})}return t},Mu=function(t){let e=t;if(typeof t=="string"){const n=document.createElement("div");n.innerHTML=t,e=n,n.remove()}return Ar.fromSchema(this.schema).parse(e)},Du=function(){let t=Me(this,ze,Ou).call(this);const e={schema:this.schema};this.options.ydoc||(e.doc=t),this.view=new Vv(this.options.element,{...this.options.editorProps,dispatchTransaction:Me(this,ze,My).bind(this),state:Ji.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()},Oy=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||(Me(this,ze,Ui).call(this),Me(this,ze,Vi).call(this)))},Vi=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)},Ui=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 pD(this);this.storage.pagination.sectionData=t;const{state:e,dispatch:n}=this.view,r=e.tr.setMeta(oo,{isReadyToInit:!0});n(r)}},My=function(t){if(this.view.isDestroyed)return;let e;try{const i=ht.getState(this.view.state)?.isTrackChangesActive??!1?B2({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})},Dy=function(t){const e=Ji.create({schema:this.schema,doc:t}),{tr:n,doc:r}=e;return uD(r,n,this.schema,this.converter),e.apply(n).doc},j2=function(t=[]){const e=Ji.create({schema:this.schema,doc:this.state.doc,plugins:this.state.plugins}),{tr:n,doc:r}=e;return cD(r,n,this.schema,t),e.apply(n).doc.toJSON()},q2=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 Es=ED,Ge=class U2{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=We(Ne(this,"addOptions",{name:this.name}))),this.storage=We(Ne(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(...e){return new U2(...e)}},en=class H2{constructor(e){Fe(this,"type","mark"),Fe(this,"name","mark"),Fe(this,"options"),Fe(this,"storage"),Fe(this,"isExternal"),Fe(this,"config",{name:this.name}),this.config={...this.config,...e},this.name=this.config.name,this.isExternal=!!this.config.isExternal,this.config.addOptions&&(this.options=We(Ne(this,"addOptions",{name:this.name}))),this.storage=We(Ne(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(...e){return new H2(...e)}};const W2=rt.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()}}}),G2=rt.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()}}}),K2=rt.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]=tr(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]=tr(t);if(Number.isNaN(n))return!1;let{min:o,max:i,unit:s}=this.options.defaults;return n=rl(n,o,i),r=r||s,e().setMark("textStyle",{fontSize:`${n}${r}`}).run()},unsetFontSize:()=>({chain:t})=>t().setMark("textStyle",{fontSize:null}).removeEmptyTextStyle().run()}}}),J2=rt.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=>{if(t.textAlign===this.options.defaultAlignment)return{};const e=t.textAlign==="both"?"justify":t.textAlign;return e?{style:`text-align: ${e}`}:{}}}}}]},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")}}}),X2=rt.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]=tr(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]=tr(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]=tr(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)}}}),Y2=rt.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=>t.lineHeight?{style:zl(t.lineHeight,this.options.defaults.unit,t.spacing?.lineRule)}:{}}}}]},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)}}}),Z2=rt.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=js(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 CD(t={}){return new Xe({view(e){return new AD(e,t)}})}class AD{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=r1(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 Q2=rt.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:2,class:void 0}},addPmPlugins(){return[CD(this.options)]}});let Qt=class mr extends Le{constructor(e){super(e,e)}map(e,n){let r=e.resolve(n.map(this.head));return mr.valid(r)?new mr(r):Le.near(r)}content(){return xe.empty}eq(e){return e instanceof mr&&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 mr(e.resolve(n.pos))}getBookmark(){return new xp(this.anchor)}static valid(e){let n=e.parent;if(n.isTextblock||!$D(e)||!TD(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&&mr.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(mr.valid(l))return l}for(;;){let s=n>0?i.firstChild:i.lastChild;if(!s){if(i.isAtom&&!i.isText&&!Ie.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(mr.valid(a))return a}return null}}};Qt.prototype.visible=!1;Qt.findFrom=Qt.findGapCursorFrom;Le.jsonID("gapcursor",Qt);class xp{constructor(e){this.pos=e}map(e){return new xp(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return Qt.valid(n)?new Qt(n):Le.near(n)}}function $D(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 TD(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 OD(){return new Xe({props:{decorations:ND,createSelectionBetween(t,e,n){return e.pos==n.pos&&Qt.valid(n)?new Qt(n):null},handleClick:DD,handleKeyDown:MD,handleDOMEvents:{beforeinput:_D}}})}const MD=cp({ArrowLeft:sa("horiz",-1),ArrowRight:sa("horiz",1),ArrowUp:sa("vert",-1),ArrowDown:sa("vert",1)});function sa(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 je){if(!i.endOfTextblock(n)||a.depth==0)return!1;l=!1,a=r.doc.resolve(e>0?a.after():a.before())}let c=Qt.findGapCursorFrom(a,e,l);return c?(o&&o(r.tr.setSelection(new Qt(c))),!0):!1}}function DD(t,e,n){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!Qt.valid(r))return!1;let o=t.posAtCoords({left:n.clientX,top:n.clientY});return o&&o.inside>-1&&Ie.isSelectable(t.state.doc.nodeAt(o.inside))?!1:(t.dispatch(t.state.tr.setSelection(new Qt(r))),!0)}function _D(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof Qt))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=be.empty;for(let s=r.length-1;s>=0;s--)o=be.from(r[s].createAndFill(null,o));let i=t.state.tr.replace(n.pos,n.pos,new xe(o,0,0));return i.setSelection(je.near(i.doc.resolve(n.pos+1))),t.dispatch(i),!1}function ND(t){if(!(t.selection instanceof Qt))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",Be.create(t.doc,[qe.widget(t.selection.head,e,{key:"gapcursor"})])}const ID=rt.create({name:"gapCursor",addPmPlugins(){return[OD()]},extendNodeSchema(t){return{allowGapCursor:We(Ne(t,"allowGapCursor",{name:t.name,options:t.options,storage:t.storage}))??null}}}),FD=new et("collaboration"),BD=rt.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=LD();PD(this.options.ydoc,this.editor),zD(this.options.ydoc,this.editor,this);const[e,n]=RD(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"),Mr.getState(e).undoManager.undoStack.length===0?!1:n?wO(e):!0),redo:()=>({tr:t,state:e,dispatch:n})=>(t.setMeta("preventDispatch",!0),t.setMeta("inputType","historyRedo"),Mr.getState(e).undoManager.redoStack.length===0?!1:n?bO(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()}}}),RD=(t,e)=>{const n=t.getXmlFragment("supereditor");return[Z5(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]},LD=()=>kO(),PD=(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}))})},zD=(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)},jD=rt.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?[yO(t.awareness,{cursorBuilder:qD})]:[]}}),qD=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},Xo="aiMark",aa="aiAnimationMark",VD=en.create({name:Xo,group:"ai",inclusive:!1,addOptions(){return{htmlAttributes:{class:"super-editor-ai"}}},addAttributes(){return{id:{default:null,rendered:!1}}},parseDOM(){return[{tag:Xo}]},renderDOM({htmlAttributes:t}){return[Xo,Ae.mergeAttributes(this.options.htmlAttributes,t)]}}),UD=en.create({name:aa,group:"ai",inclusive:!1,spanning:!1,excludes:aa,addOptions(){return{htmlAttributes:{}}},addAttributes(){return{id:{default:null,rendered:!1},class:{default:null,rendered:!0},dataMarkId:{default:null,rendered:!0}}},parseDOM(){return[{tag:aa}]},renderDOM({htmlAttributes:t}){return[aa,Ae.mergeAttributes(this.options.htmlAttributes,t)]}}),HD=new et("ai"),ex=rt.create({name:"ai",addCommands(){return{insertAiMark:()=>({tr:t,dispatch:e,state:n})=>{const{selection:r}=t,{$from:o,$to:i}=r;return o.pos===i.pos?!1:(t.addMark(o.pos,i.pos,this.editor.schema.marks[Xo].create({id:"ai-highlight"})),e&&e(t),!0)},removeAiMark:(t=Xo)=>({tr:e,dispatch:n,state:r})=>{const{doc:o}=r;let i=!1;return o.descendants((s,a)=>{const{marks:l=[]}=s;l.find(c=>c.type.name===t)&&(i=!0,e.removeMark(a,a+s.nodeSize,r.schema.marks[t]))}),i?(n&&n(e),!0):!1}}},addPmPlugins(){const t=this.editor;return[new Xe({key:HD,state:{init(){return{decorations:Be.empty,highlightColor:"#6366f1"}},apply(e,n,r,o){if(!e.docChanged)return n;const{decorations:i}=WD(t,o.doc,n.highlightColor)||{},s=Be.create(o.doc,i);return{...n,decorations:s}}},props:{decorations(e){return this.getState(e).decorations}}})]}}),WD=(t,e,n)=>{const r=[];return e.descendants((o,i)=>{const{marks:s=[]}=o;if(s.find(a=>a.type.name===Xo)){const a=qe.inline(i,i+o.nodeSize,{style:`background-color: ${n}33; border-radius: 4px; transition: background-color 250ms ease;`});r.push(a)}}),{decorations:r}},tx=Ge.create({name:"doc",topNode:!0,content:"block+",parseDOM(){return[{tag:"doc"}]},renderDOM(){return["doc",0]},addAttributes(){return{attributes:{rendered:!1}}}}),nx=Ge.create({name:"text",group:"inline",inline:!0}),GD=Ge.create({name:"run",group:"inline",content:"text*",inline:!0,parseDOM(){return[{tag:"run"}]},renderDOM(){return["run",0]},addAttributes(){return{attributes:{rendered:!1}}}});function vl(t){return new FO({match:t.match,handler:({state:e,range:n,match:r,chain:o})=>{const i=We(t.getAttributes,null,r)||{},s=e.tr.delete(n.from,n.to),a=s.doc.resolve(n.from).blockRange(),l=a&&Zb(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&&Br(s.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(r,c))&&s.join(n.from-1)}})}const _y=/^\s*([-+*])\s$/,rx=Ge.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",Ae.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=vl({match:_y,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=vl({match:_y,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes("textStyle"),editor:this.editor})),[t]}});function KD(t={}){return new Xe({key:new et("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 JD(){return Math.floor(Math.random()*4294967295).toString()}function XD(t){return new Xe({key:new et("orderedListMarker"),appendTransaction:(e,n,r)=>{if(!(e.some(l=>l.docChanged)&&!n.doc.eq(r.doc)))return;let{doc:o,tr:i}=r,s=YD(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=>QD(i,x)),a=!0;return}if(p){let x=ZD({state:r,list:u});x.length&&(d=x)}let h=d[0],m=e8({state:r,listItems:d}),y=ox(),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&&Ny(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:D,listLevel:M,listNumberingType:I}=b.attrs;Array.isArray(g.listLevel)||(g.listLevel=JSON.parse(g.listLevel));let E=[...g.listLevel.slice(0,-1),g.listLevel.at(-1)+1];if(!(D===g.lvlText&&I===g.listNumberingType&&Ny(M,E))){let{selection:U,storedMarks:oe}=r,N=oe||U.$to.parentOffset&&U.$from.marks();i.setNodeMarkup(T,void 0,{...b.attrs,listLevel:E,lvlText:g.lvlText,listNumberingType:g.listNumberingType}),N&&i.ensureMarks(N),a=!0}g={...g,listLevel:E}})}),i.setMeta("orderedListMarker",!0),a?i:null}})}function YD(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 ZD({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 ox({lvlText:t="",listLevel:e=[],listNumberingType:n="decimal"}={}){return{lvlText:t,listLevel:e,listNumberingType:n}}function QD(t,e){let{pos:n,node:r}=e;t.setNodeMarkup(n,void 0,{...r.attrs,lvlText:null,listLevel:null,listNumberingType:null})}function Ny(t,e){return t.length===e.length&&t.every((n,r)=>n===e[r])}function e8({state:t,listItems:e}){let{doc:n}=t,r=e[0],{lvlText:o,listLevel:i,listNumberingType:s}=r.node.attrs,a=ox({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 Iy=/^(\d+)\.\s$/,ix=Ge.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: ${KC(e)};`}):{}}},attributes:{rendered:!1,keepOnSplit:!0}}},parseDOM(){return[{tag:"ol"}]},renderDOM({htmlAttributes:t}){const{start:e,...n}=t;return e===1?["ol",Ae.mergeAttributes(this.options.htmlAttributes,n),0]:["ol",Ae.mergeAttributes(this.options.htmlAttributes,t),0]},addCommands(){return{toggleOrderedList:()=>({commands:t})=>t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks),getCurrentList:()=>({state:t})=>Jt(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=Jt(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=Jt(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,D=b||JD();r.setNodeMarkup(h,void 0,{...m.attrs,order:T,syncId:D}),b||r.setNodeMarkup(d,void 0,{...p.attrs,syncId:D})}}return!0}}},addShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList(),Enter:()=>this.editor.commands.liftEmptyBlockAndContinueListOrder()}},addPmPlugins(){return[XD(this.editor),KD()]},addInputRules(){let t=vl({match:Iy,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=vl({match:Iy,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]}}),t8=({listLevel:t,lvlText:e,listNumberingType:n})=>{const r=i8[n];return r?r(t,e):null},n8=(t,e)=>kp(t,e,String),sx=(t,e)=>kp(t,e,a8),r8=(t,e)=>sx(t,e).toLowerCase(),o8=(t,e)=>ax(t,e).toLowerCase(),ax=(t,e)=>kp(t,e,n=>l8(n)),i8={decimal:n8,lowerRoman:r8,upperRoman:sx,lowerLetter:o8,upperLetter:ax},s8=(t,e)=>t.reduce((n,r,o)=>n.replace(`%${o+1}`,r),e),kp=(t,e,n)=>{const r=t.map(n);return s8(r,e)},a8=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},l8=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 c8(t={}){return new Xe({key:new et("styledListMarker"),state:{init(e,n){const r=[...Fy(n),...By(n)];return Be.create(n.doc,r)},apply(e,n,r,o){if(!e.docChanged||e.getMeta("orderedListMarker"))return n;const i=e.getMeta("splitListItem"),s=[...Fy(o,i),...By(o)];return Be.create(o.doc,s)}},props:{decorations(e){return this.getState(e)}}})}function Fy(t,e=[]){let{doc:n,storedMarks:r}=t,o=[];Array.isArray(r)&&e.push(...r);let i=gp(n,s=>s.type.name==="listItem");return i.length&&i.forEach(({node:s,pos:a})=>{let l=ar("textStyle",n.type.schema),c=[...e.filter(y=>y.type===l)];if(d8(s)&&e.length){const y=e.filter(g=>g.type===l);c.push(...y)}else{const y=u8(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]=tr(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=Ae.mergeAttributes(f,p),m=qe.node(a,a+s.nodeSize,h);o.push(m)}),o}function By(t){let{doc:e}=t,n=[],r=gp(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:`
|
|
45
|
+
`).scrollIntoView()),!0)};function fp(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 YO=(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=fp(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(Le.near(l.doc.resolve(a),1)),e(l.scrollIntoView())}return!0},g2=(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=fp(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(je.create(a.doc,s+1)),e(a.scrollIntoView())}return!0},y2=(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(er(t.doc,i))return e&&e(t.tr.split(i).scrollIntoView()),!0}let r=n.blockRange(),o=r&&Ps(r);return o==null?!1:(e&&e(t.tr.lift(r,o).scrollIntoView()),!0)};function ZO(t){return(e,n)=>{let{$from:r,$to:o}=e.selection;if(e.selection instanceof Ie&&e.selection.node.isBlock)return!r.parentOffset||!er(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=fp(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 je||e.selection instanceof _n)&&u.deleteSelection();let d=u.mapping.map(r.pos),f=er(u.doc,d,i.length,i);if(f||(i[0]=a?{type:a}:null,f=er(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 QO=ZO(),eM=(t,e)=>(e&&e(t.tr.setSelection(new _n(t.doc))),!0);function tM(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||Br(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function w2(t,e,n,r){let o=e.nodeBefore,i=e.nodeAfter,s,a,l=o.type.spec.isolating||i.type.spec.isolating;if(!l&&tM(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=be.empty;for(let g=s.length-1;g>=0;g--)h=be.from(s[g].create(null,h));h=be.from(o.copy(h));let m=t.tr.step(new Zt(e.pos-1,p,e.pos,p,new xe(h,1,0),s.length,!0)),y=m.doc.resolve(p+2*s.length);y.nodeAfter&&y.nodeAfter.type==o.type&&Br(m.doc,y.pos)&&m.join(y.pos),n(m.scrollIntoView())}return!0}let u=i.type.spec.isolating||r>0&&l?null:Le.findFrom(e,1),d=u&&u.$from.blockRange(u.$to),f=d&&Ps(d);if(f!=null&&f>=e.depth)return n&&n(t.tr.lift(d,f).scrollIntoView()),!0;if(c&&ci(i,"start",!0)&&ci(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=be.empty;for(let k=h.length-1;k>=0;k--)g=be.from(h[k].copy(g));let x=t.tr.step(new Zt(e.pos-h.length,e.pos+i.nodeSize,e.pos+y,e.pos+i.nodeSize-y,new xe(g,h.length,0),0,!0));n(x.scrollIntoView())}return!0}}return!1}function b2(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(je.create(e.doc,t<0?o.start(i):o.end(i)))),!0):!1}}const nM=b2(-1),rM=b2(1);function xy(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 pp(...t){return function(e,n,r){for(let o=0;o<t.length;o++)if(t[o](e,n,r))return!0;return!1}}pp(dp,c2,u2);pp(dp,f2,p2);pp(m2,g2,y2,QO);typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function v2(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 ky=(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)}},oM=({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=Ae.getSplittedAttributes(u,l.node().type.name,l.node().attrs);if(s instanceof Ie&&s.node.isBlock)return!l.parentOffset||!er(a,l.pos)?!1:(o&&(t&&ky(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 je&&n.deleteSelection();const p=l.depth===0?null:v2(l.node(-1).contentMatchAt(l.indexAfter(-1)));let h=f&&p?[{type:p,attrs:d}]:void 0,m=er(n.doc,n.mapping.map(l.pos),1,h);if(!h&&!m&&er(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&&ky(r,i.extensionService.splittableMarks),n.scrollIntoView()}return!0},iM=()=>({state:t,dispatch:e})=>y2(t,e),sM=()=>({state:t,dispatch:e})=>g2(t,e),aM=()=>({state:t,dispatch:e})=>m2(t,e),lM=()=>({state:t,dispatch:e})=>YO(t,e),x2=t=>{};function cM(t,e,n){const{selection:r}=e;let o=null;if(x2()&&(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 uM=(t,e={})=>({tr:n,state:r,dispatch:o})=>{const{selection:i}=n,{empty:s,ranges:a}=i,l=ar(t,r.schema);if(o)if(s){const c=Ae.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 cM(r,n,l)};function Hd(t,e,n={}){return t.find(r=>r.type===e&&ti(r.attrs,n))}function dM(t,e,n={}){return!!Hd(t,e,n)}function hp(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=Hd([...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(Hd([...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&&dM([...t.parent.child(a).marks],e,n);)l+=t.parent.child(a).nodeSize,a+=1;return{from:s,to:l}}const fM=(t,e={})=>({tr:n,state:r,dispatch:o})=>{const{extendEmptyMarkRange:i=!1}=e,{selection:s}=n,a=ar(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=hp(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},pM=()=>({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 wl(t,e,n={}){const{empty:r,ranges:o}=t.selection,i=e?ar(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter(u=>i?i.name===u.type.name:!0).find(u=>ti(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=>ti(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 hM=(t,e={},n={})=>({state:r,commands:o})=>{const{extendEmptyMarkRange:i=!1}=n,s=ar(t,r.schema);return wl(r,s,e)?o.unsetMark(s,{extendEmptyMarkRange:i}):o.setMark(s,e)},mM=()=>({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=Ps(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},gM=(t,e={})=>({state:n,dispatch:r,chain:o})=>{const i=mt(t,n.schema);return i.isTextblock?o().command(({commands:s})=>xy(i,e)(n)?!0:s.clearNodes()).command(({state:s})=>xy(i,e)(s,r)).run():!1};function bl(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=>ti(u.node.attrs,n,{strict:!1}));return i?!!c.length:c.reduce((u,d)=>u+d.to-d.from,0)>=l}const yM=(t,e,n={})=>({state:r,commands:o})=>{const i=mt(t,r.schema),s=mt(e,r.schema);return bl(r,i,n)?o.setNode(s):o.setNode(i,n)},wM=()=>({state:t,dispatch:e})=>eM(t,e),bM=()=>({state:t,dispatch:e})=>dp(t,e),vM=(t,e={})=>({tr:n,state:r,dispatch:o})=>{let i=null,s=null;const a=Hs(typeof t=="string"?t:t.name,r.schema);return a?(a==="node"&&(i=mt(t,r.schema)),a==="mark"&&(s=ar(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},xM=(t,e)=>({tr:n,state:r,dispatch:o})=>{let i=null,s=null;const a=Hs(typeof t=="string"?t:t.name,r.schema);return a?(a==="node"&&(i=mt(t,r.schema)),a==="mark"&&(s=ar(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,mg(c.attrs,e)),s&&c.marks.length&&c.marks.forEach(d=>{s===d.type&&n.addMark(u,u+c.nodeSize,s.create(mg(d.attrs,e)))})})}),!0):!1},kM=()=>({state:t,dispatch:e})=>JO(t,e),SM=()=>({state:t,dispatch:e})=>XO(t,e),EM=()=>({state:t,dispatch:e})=>c2(t,e),CM=()=>({state:t,dispatch:e})=>f2(t,e),AM=()=>({state:t,dispatch:e})=>u2(t,e),$M=()=>({state:t,dispatch:e})=>p2(t,e),TM=()=>({state:t,dispatch:e})=>nM(t,e),OM=()=>({state:t,dispatch:e})=>rM(t,e),MM=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),k2=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&&k2(r)}return t};function ia(t){const e=`<body>${t}</body>`,n=new window.DOMParser().parseFromString(e,"text/html").body;return k2(n)}function Wd(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 be.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),Wd("",e,n)}if(o){if(n.errorOnInvalidContent){let s=!1,a="";const l=new Vb({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?Ar.fromSchema(l).parseSlice(ia(t),n.parseOptions):Ar.fromSchema(l).parse(ia(t),n.parseOptions),n.errorOnInvalidContent&&s)throw new Error("[super-editor error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${a}`)})}const i=Ar.fromSchema(e);return n.slice?i.parseSlice(ia(t),n.parseOptions).content:i.parse(ia(t),n.parseOptions)}return Wd("",e,n)}function DM(t,e,n){const r=t.steps.length-1;if(r<e)return;const o=t.steps[r];if(!(o instanceof $t||o instanceof Zt))return;const i=t.mapping.maps[r];let s=0;i.forEach((a,l,c,u)=>{s===0&&(s=u)}),t.setSelection(Le.near(t.doc.resolve(s),n))}const _M=t=>!("type"in t),NM=(t,e,n)=>({tr:r,dispatch:o,editor:i})=>{if(o){n={parseOptions:{},updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let s;try{s=Wd(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((_M(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&&DM(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},IM=()=>({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 FM(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 BM(a,s,t,e)?(r&&r(a.scrollIntoView()),!0):!1}}function BM(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 tl(l,l,e.depth),e.endIndex<e.parent.childCount&&(e=new tl(e.$from,s.resolve(e.$to.end(e.depth)),e.depth)),o=!0}let a=Zb(i,n,r,e);return a?(t&&RM(t,e,a,o,n),!0):!1}function RM(t,e,n,r,o){let i=be.empty;for(let u=n.length-1;u>=0;u--)i=be.from(n[u].type.create(n[u].attrs,i));t.step(new Zt(e.start-(r?2:0),e.end,e.start,e.end,new xe(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&&er(t.doc,l,a)&&(t.split(l,a),l+=2*a),l+=c.child(u).nodeSize;return t}function LM(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?PM(e,n,t,i):zM(e,n,i):!0:!1}}function PM(t,e,n,r){let o=t.tr,i=r.end,s=r.$to.end(r.depth);i<s&&(o.step(new Zt(i-1,s,i,s,new xe(be.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new tl(o.doc.resolve(r.$from.pos),o.doc.resolve(s),r.depth));const a=Ps(r);if(a==null)return!1;o.lift(r,a);let l=o.doc.resolve(o.mapping.map(i,-1)-1);return Br(o.doc,l.pos)&&l.nodeBefore.type==l.nodeAfter.type&&o.join(l.pos),e(o.scrollIntoView()),!0}function zM(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?be.empty:be.from(o))))return!1;let d=i.pos,f=d+s.nodeSize;return r.step(new Zt(d-(a?1:0),f+(l?1:0),d+1,f-1,new xe((a?be.empty:be.from(o.copy(be.empty))).append(l?be.empty:be.from(o.copy(be.empty))),a?0:1,l?0:1),a?0:1)),e(r.scrollIntoView()),!0}function jM(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=be.from(c?t.create():null),d=new xe(be.from(t.create(null,be.from(a.type.create(null,u)))),c?3:1,0),f=i.start,p=i.end;n(e.tr.step(new Zt(f-(c?3:1),p,f,p,d,1,!0)).scrollIntoView())}return!0}}const qM=(t,e={})=>({state:n,dispatch:r})=>{const o=mt(t,n.schema);return FM(o,e)(n,r)},Kl=(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}}},Jt=t=>({$from:e})=>Kl(e,t),Gd=(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=We(Ne(n,"group",r));return typeof o!="string"?!1:o.split(" ").includes("list")},VM={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"}}]}]}]},UM={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"}}]}]}]},Su=(t,e)=>{const n=Jt(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&&Br(t.doc,n.pos)&&t.join(n.pos),!0},Eu=(t,e)=>{const n=Jt(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&&Br(t.doc,r)&&t.join(r),!0},HM=(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 D=Jt(U=>Gd(U.type.name,f))(y),{numbering:M}=i.converter;if(b.depth>=1&&D&&b.depth-D.depth<=1){if(D.node.type===h){const{listId:U}=D.node.attrs;return i.converter.numbering=GM(U,M),d.liftListItem(m)}if(Gd(D.node.type.name,f)&&h.validContent(D.node.content)&&l)return c().command(()=>(s.setNodeMarkup(D.pos,h),!0)).command(()=>Su(s,h)).command(()=>Eu(s,h)).run()}const I=({ensureMarks:U=!1})=>()=>{const oe=u().wrapInList(h,r);if(U){const N=T.filter(W=>p.includes(W.type.name));s.ensureMarks(N)}return oe?!0:d.clearNodes()},E=S2(M.definitions);return i.converter.numbering=WM(E,M,h),r.listId=E,!n||!T||!l?c().command(I({ensureMarks:!1})).wrapInList(h,r).command(()=>Su(s,h)).command(()=>Eu(s,h)).run():c().command(I({ensureMarks:!0})).wrapInList(h,r).command(()=>Su(s,h)).command(()=>Eu(s,h)).run()},S2=t=>Math.max(...Object.keys(t).map(Number))+1,WM=(t,e,n)=>{const r=n.name==="orderedList"?VM:UM,o={...e},i=S2(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},GM=(t,e)=>{const{definitions:n,abstracts:r}=e,o=n[t].elements[0].attributes["w:val"];return delete n[t],delete r[o],e},KM=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=be.empty;const g=a.index(-1)?1:a.index(-2)?2:3;for(let M=a.depth-g;M>=a.depth-3;M--)y=be.from(a.node(M).copy(y));const x=a.indexAfter(-1)<a.node(-2).childCount?1:a.indexAfter(-2)<a.node(-3).childCount?2:3,k=Ae.getSplittedAttributes(d,a.node().type.name,a.node().attrs),b=s.contentMatch.defaultType?.createAndFill(k)||void 0;y=y.append(be.from(s.createAndFill(null,b)||void 0));const T=a.before(a.depth-(g-1));n.replace(T,a.after(-x),new xe(y,4-g,0));let D=-1;n.doc.nodesBetween(T,n.doc.content.size,(M,I)=>{if(D>-1)return!1;M.isTextblock&&M.content.size===0&&(D=I+1)}),D>-1&&n.setSelection(je.near(n.doc.resolve(D))),n.scrollIntoView()}return!0}const f=l.pos===a.end()?u.contentMatchAt(0).defaultType:null,p=Ae.getSplittedAttributes(d,u.type.name,u.attrs),h=Ae.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(!er(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},JM=t=>({state:e,dispatch:n})=>{const r=mt(t,e.schema);return jM(r)(e,n)},XM=t=>({state:e,dispatch:n})=>{const r=mt(t,e.schema);return LM(r)(e,n)},YM=Object.freeze(Object.defineProperty({__proto__:null,clearNodes:mM,command:VO,createParagraphNear:sM,deleteSelection:bM,exitCode:lM,first:qO,insertContent:MM,insertContentAt:NM,insertTabChar:UO,insertTabNode:HO,joinBackward:EM,joinDown:SM,joinForward:CM,joinUp:kM,liftEmptyBlock:iM,liftListItem:XM,newlineInCode:aM,resetAttributes:xM,selectAll:wM,selectNodeBackward:AM,selectNodeForward:$M,selectTextblockEnd:OM,selectTextblockStart:TM,setMark:uM,setMeta:WO,setNode:gM,sinkListItem:JM,splitBlock:oM,splitListItem:KM,toggleList:HM,toggleMark:hM,toggleNode:yM,undoInputRule:IM,unsetAllMarks:pM,unsetMark:fM,updateAttributes:vM,wrapInList:qM},Symbol.toStringTag,{value:"Module"})),ZM=rt.create({name:"commands",addCommands(){return{...YM}}}),QM=t=>{t.commands.first(({commands:e})=>[()=>e.newlineInCode(),()=>e.createParagraphNear(),()=>e.liftEmptyBlock(),()=>e.splitBlock()])},Ai=t=>{t.commands.first(({commands:e,tr:n})=>[()=>e.undoInputRule(),()=>(n.setMeta("inputType","deleteContentBackward"),!1),()=>e.deleteSelection(),()=>e.joinBackward(),()=>e.selectNodeBackward()])},$o=t=>{t.commands.first(({commands:e})=>[()=>e.deleteSelection(),()=>e.joinForward(),()=>e.selectNodeForward()])},eD=rt.create({name:"keymap",addShortcuts(){const t={Enter:()=>QM(this.editor),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:()=>Ai(this.editor),"Mod-Backspace":()=>Ai(this.editor),"Shift-Backspace":()=>Ai(this.editor),Delete:()=>$o(this.editor),"Mod-Delete":()=>$o(this.editor),"Mod-a":()=>this.editor.commands.selectAll(),Tab:()=>this.editor.commands.insertTabNode()},e={...t},n={...t,"Ctrl-h":()=>Ai(this.editor),"Alt-Backspace":()=>Ai(this.editor),"Ctrl-d":()=>$o(this.editor),"Ctrl-Alt-Backspace":()=>$o(this.editor),"Alt-Delete":()=>$o(this.editor),"Alt-d":()=>$o(this.editor),"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd(),"Ctrl-t":()=>this.editor.commands.insertTabChar()};return YC()||ZC()?n:e}}),tD=rt.create({name:"editable",addPmPlugins(){return[new Xe({key:new et("editable"),props:{editable:()=>this.editor.options.editable}})]}}),nD=rt.create({name:"editorFocus",addPmPlugins(){const t=this.editor;return[new Xe({key:new et("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 E2(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 C2(t,e,n={}){if(!e)return bl(t,null,n)||wl(t,null,n);const r=Hs(e,t.schema);return r==="node"?bl(t,e,n):r==="mark"?wl(t,e,n):!1}const mp=({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[It]);let i=mp({tr:t,from:e,to:n,markName:It,attrs:{authorEmail:r.email}}),s;i?s=i.mark.attrs.id:s=bo();const a=t.doc.type.schema.marks[It].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},$2=({tr:t,from:e,to:n,user:r,date:o})=>{let i=mp({tr:t,from:e,to:n,markName:ut,attrs:{authorEmail:r.email}}),s;i?s=i.mark.attrs.id:s=bo();const a=t.doc.type.schema.marks[ut].create({id:s,author:r.name,authorEmail:r.email,date:o}),l=new Qo;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===It&&f.attrs.authorEmail===r.email)){const f=new $t(l.map(Math.max(e,d)),l.map(Math.min(n,d+u.nodeSize)),xe.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 rD(t){const e={bulletList:1,orderedList:2};return{attributes:{parentAttributes:{"w14:paraId":Xn(),"w14:textId":Xn(),"w:rsidR":Xn(),"w:rsidRDefault":Xn(),"w:rsidP":Xn(),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 oD(t,e,n){const r=[];return t===e?n.resolve(t).marks().forEach(o=>{const i=n.resolve(t-1),s=hp(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 gp(t,e){const n=[];return t.descendants((r,o)=>{e(r)&&n.push({node:r,pos:o})}),n}function T2(t,e,n){const r=t.state.doc.content.size,o=rl(e,0,r),i=rl(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 yp=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},wp=Object.freeze(Object.defineProperty({__proto__:null,chainableEditorState:up,cleanSchemaItem:Vd,createDocument:E2,defaultBlockAt:v2,findChildren:gp,findMark:Ul,findParentNode:Jt,findParentNodeClosestToPos:Kl,generateDocxListAttributes:rD,generateDocxRandomId:Xn,generateRandom32BitHex:Gf,getActiveFormatting:Xf,getExtensionConfigField:Ne,getMarkRange:hp,getMarkType:ar,getMarksBetween:oD,getMarksFromSelection:js,getNodeType:mt,getSchemaTypeByName:Ss,getSchemaTypeNameByName:Hs,isActive:C2,isInTable:yp,isList:Gd,isMarkActive:wl,isNodeActive:bl,isTextSelection:x2,posToDOMRect:T2},Symbol.toStringTag,{value:"Module"})),iD=(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}},O2=(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},M2=(t,e,n)=>{if(t){if(!e)throw new Error('Invalid "predicate" parameter')}else throw new Error('Invalid "node" parameter');return O2(t,n).filter(r=>e(r.node))},D2=(t,e)=>M2(t,n=>n.isInline,e),sD=Object.freeze(Object.defineProperty({__proto__:null,findChildren:M2,findInlineNodes:D2,findMarkPosition:iD,flatten:O2},Symbol.toStringTag,{value:"Module"})),bp=(t,e=null)=>{const n=[],r=D2(t.doc);return r.length?(r.forEach(({node:o,pos:i})=>{const{marks:s}=o,a=[It,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 et("TrackChangesBase"),aD=(t={})=>new Xe({key:ht,state:{init(e,n){return{isTrackChangesActive:!1,onlyOriginalShown:!1,onlyModifiedShown:!1,decorations:To(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:To(o,n.onlyOriginalShown,n.onlyModifiedShown)}:i.type==="SHOW_ONLY_ORIGINAL"?{...n,onlyOriginalShown:i.value===!0,onlyModifiedShown:!1,decorations:To(o,i.value===!0,!1)}:i.type==="SHOW_ONLY_MODIFIED"?{...n,onlyOriginalShown:!1,onlyModifiedShown:i.value===!0,decorations:To(o,!1,i.value===!0)}:{...n,decorations:To(o,n.onlyOriginalShown,n.onlyModifiedShown)}:{...n,decorations:To(o,n.onlyOriginalShown,n.onlyModifiedShown)}}},props:{decorations(e){return this.getState(e)?.decorations}}}),To=(t,e,n)=>{if(!t.doc||!t.doc.nodeSize||n&&e)return Be.empty;const r=[],o=bp(t);return o.length?(o.forEach(({mark:i,from:s,to:a})=>{if(i.type.name===It)if(e){const l=qe.inline(s,a,{class:"track-insert-dec hidden"});r.push(l)}else if(n){const l=qe.inline(s,a,{class:"track-insert-dec normal"});r.push(l)}else{const l=qe.inline(s,a,{class:"track-insert-dec highlighted"});r.push(l)}if(i.type.name===ut)if(e){const l=qe.inline(s,a,{class:"track-delete-dec normal"});r.push(l)}else if(n){const l=qe.inline(s,a,{class:"track-delete-dec hidden"});r.push(l)}else{const l=qe.inline(s,a,{class:"track-delete-dec highlighted"});r.push(l);const c=qe.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=qe.inline(s,a,{class:"track-format-dec before"});r.push(l)}else if(n){const l=qe.inline(s,a,{class:"track-format-dec normal"});r.push(l)}else{const l=qe.inline(s,a,{class:"track-format-dec highlighted"});r.push(l)}}),Be.create(t.doc,r)):Be.empty},sn="commentMark",Sy=({commentId:t,state:e,tr:n,dispatch:r})=>{lD(t,e.doc).forEach(({from:o,to:i})=>{n.removeMark(o,i,e.schema.marks[sn])}),r(n)},lD=(t,e)=>{const n=[];return e.descendants((r,o)=>{const{marks:i}=r,s=i.find(a=>a.type.name===sn);if(s){const{attrs:a}=s,{commentId:l}=a;t===l&&n.push({from:o,to:o+r.nodeSize})}}),n},cD=(t,e,n,r=[])=>{const o=[],i=[],s=new Set;return t.descendants((a,l)=>{(a.marks?.filter(c=>c.type.name===sn)).forEach(c=>{if(c){const{attrs:u={}}=c,{commentId:d}=u;if(d==="pending"||s.has(d))return;s.add(d);const f=Ey(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=Ey(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},Ey=t=>{const{commentId:e,internal:n}=t;return{"w:id":e,internal:n}},uD=(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[sn].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)})},dD=(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."},fD=({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}`},oo=new et("paginationPlugin"),pD=async t=>{if(!t.converter)return;const e={headers:{},footers:{}},n=t.converter.headerIds.ids,r=t.converter.footerIds.ids;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 Cy(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 Cy(t,s);e.footers[i].height=a,e.footers[i].sectionEditor=l,e.footers[i].sectionContainer=c}return e},Cy=async(t,e)=>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 Es({loadFromSchema:!0,mode:"text",editable:!1,element:r,content:e,extensions:Np(),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})})})}):{},vp=[It,ut,vt],bt=new et("comments"),hD=rt.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[sn].create({commentId:a,internal:l})),n(e),!0},removeComment:({commentId:t,importedId:e})=>({tr:n,dispatch:r,state:o})=>{n.setMeta(bt,{event:"deleted"}),Sy({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===sn);if(d){const{attrs:f}=d;f.commentId===t&&(s=l,a=c)}}),s?(n.addMark(a,a+s.nodeSize,this.editor.schema.marks[sn].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"}),Sy({commentId:t,state:r,tr:e,dispatch:n})}}},addPmPlugins(){const t=this.editor;let e,n;return t.options.isHeadless?[]:[new Xe({key:bt,state:{init(){return{activeThreadId:null,externalColor:"#B1124B",internalColor:"#078383",decorations:Be.empty,allCommentPositions:{},allCommentIds:[],changedActiveThread:!1,trackedChanges:{}}},apply(r,o,i,s){const a=r.getMeta(oo)?.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=gD(u,d,s,t));const f=l?.type==="setActiveComment";if(!r.docChanged&&r.selectionSet||f){const{selection:p}=r;let h=mD(s.doc,p);if(f&&(h=l.activeThreadId),n!==h){n=h;const m={type:Fa.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===sn);let g=!1;y.forEach(k=>{const{attrs:b}=k,T=b.commentId||b.importedId,D=i.coordsAtPos(h);Ay({allCommentPositions:d,threadId:T,pos:h,currentBounds:D,node:p});const M=b.internal;g||(g=n===T);let I=fD({activeThreadId:n,threadId:T,isInternal:M,editor:t});const E=qe.inline(h,h+p.nodeSize,{style:`background-color: ${I};`,"data-thread-id":T,class:"comment-highlight"});g&&n!==T||u.push(E)});const x=_2({doc:l,from:h,to:h+p.nodeSize});if(x){const k=i.coordsAtPos(h),{id:b}=x.mark.attrs;Ay({allCommentPositions:d,threadId:b,pos:h,currentBounds:k,node:p})}});const f=Be.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})}}}})]}}),Ay=({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)}},mD=(t,e)=>{if(!e)return;const{$from:n,$to:r}=e;if(n.pos!==r.pos||!t.nodeAt(n.pos))return;const o=_2({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===sn)&&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===sn);return u?.attrs?.commentId||u?.attrs?.importedId},_2=({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=>vp.includes(u.type.name));c&&!s&&(s={from:l,to:l+a.nodeSize,mark:c})}),s},gD=(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=wD({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},yD=({state:t,node:e,mark:n,marks:r,trackedChangeType:o,isDeletionInsertion:i,deletionNodes:s=[]})=>{let a="",l="";if(o===It&&(a=e?.text??""),o===vt&&(a=dD(n.attrs)),(o===ut||i)&&(l=e?.text??"",i)){let{id:c}=r.deletionMark.attrs;l=bD(t.doc,u=>{const{marks:d=[]}=u,f=d.filter(p=>vp.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}},wD=({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:D=[]}=b,M=D.filter(I=>vp.includes(I.type.name));if(M.length&&(M.find(I=>I.attrs.id===p)&&(y=b),y))return!1});const{deletionText:g,trackedChangeText:x}=yD({state:o,node:y||h,mark:s,marks:e,trackedChangeType:c,isDeletionInsertion:m,deletionNodes:n});if(!g&&!x)return;const k={event:Fa.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=Fa.ADD:t==="update"&&(k.event=Fa.UPDATE),k};function bD(t,e){let n=null;return t.descendants((r,o)=>{if(e(r)&&(n={node:r,pos:o}),n)return!1}),n}const N2=({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=Ul(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}=$2({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"})},vD=()=>{},xD=()=>{},I2=({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:bo();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&&ti(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)}})},F2=({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:bo(),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)}})},B2=({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 Qo,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?(N2({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 Ls?(I2({state:e,tr:t,step:d,newTr:i,map:s,doc:f,user:n,date:l}),console.debug("[track-changes]: addMarkStep")):d instanceof vn?(F2({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=Ul(e,c,!1);if(t.selection instanceof je&&(t.selection.from<e.selection.from||t.getMeta("inputType")==="deleteContentBackward")){const d=s.map(t.selection.from,-1);i.setSelection(new je(i.doc.resolve(d)))}else if(t.selection.from>e.selection.from&&u){const d=s.map(u.to+1,1);i.setSelection(new je(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 je(i.doc.resolve(c)))}return t.storedMarksSet&&i.setStoredMarks(t.storedMarks),t.scrolledIntoView&&i.scrollIntoView(),i},kD=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:Go(lt(a.line)),lineSpaceBefore:Go(lt(a.lineSpaceBefore)),lineSpaceAfter:Go(lt(a.lineSpaceAfter))};r.setNodeMarkup(i,void 0,{...s,spacing:{...a,...l}})}}),n(r),!0},SD={initial:kD},$y=t=>{if(t==="initial"||t==="0.4.14")return Object.values(SD)};var Uo,R2,ze,L2,P2,Kd,Cu,z2,Pa,Jd,Au,$u,Xd,Yd,Ty,Tu,Ou,Mu,Du,Oy,Vi,Ui,My,Dy,j2,q2;const ED=class V2 extends SO{constructor(e){super(),$r(this,ze),$r(this,Uo),Fe(this,"extensionService"),Fe(this,"extensionStorage",{}),Fe(this,"schema"),Fe(this,"view"),Fe(this,"isFocused",!1),$r(this,R2),Fe(this,"options",{element:null,selector: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}),Me(this,ze,L2).call(this,e),Me(this,ze,z2).call(this,e),this.setOptions(e);let n={docx:()=>Me(this,ze,P2).call(this,this.options),text:()=>Me(this,ze,Kd).call(this,this.options),html:()=>Me(this,ze,Kd).call(this,this.options),default:()=>{console.log("Not implemented.")}};(n[this.options.mode]??n.default)()}setToolbar(e){this.toolbar=e}focus(){this.view?.focus()}get state(){return this.view.state}get storage(){return this.extensionStorage}get commands(){return Jn(this,Uo).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 Jn(this,Uo).chain()}can(){return Jn(this,Uo).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"?(Me(this,ze,Jd).call(this,"TrackChangesBase"),this.commands.disableTrackChangesShowOriginal(),this.commands.enableTrackChanges(),this.setEditable(!0,!1)):n==="editing"&&(Me(this,ze,Jd).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),Me(this,ze,Pa).call(this)};e.synced?Me(this,ze,Pa).call(this):e.on("synced",n)}setOptions(e){if(this.options={...this.options,...e},this.options.collaborationProvider&&this.options.ydoc){const n=this.options.extensions.findIndex(r=>r.name==="history");n!==-1&&this.options.extensions.splice(n,1)}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 kd,o=await r.getDocxData(e,n),i=r.media;return[o,i,r.mediaFiles,r.fonts]}static getDocumentVersion(e){return Dr.getStoredSuperdocVersion(e)}static updateDocumentVersion(e,n){return Dr.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",e.style.isolation="isolate",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.2;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 Ae.getAttributes(this.state,e)}isActive(e,n){const r=typeof e=="string"?e:null,o=typeof e=="string"?n:e;return C2(this.state,r,o)}getJSON(){return this.state.doc.toJSON()}getHTML(){const e=document.createElement("div"),n=yi.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=Me(this,ze,j2).call(this,r),i=await this.converter.exportToDocx(o,this.schema,this.storage.image.media,e,n,r,this),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,"&")};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 kd().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(),Me(this,ze,q2).call(this),this.removeAllListeners()}static checkIfMigrationsNeeded(e){e||(e="initial");const n=$y(e)||[];return console.debug("[checkVersionMigrations] Migrations needed:",e,n.length),n.length>0}processCollaborationMigrations(){if(console.debug("[checkVersionMigrations] Current editor version","0.10.67"),!this.options.ydoc)return;let e=this.options.ydoc.getMap("meta").get("version");e||(e="initial"),console.debug("[checkVersionMigrations] Document version",e);const n=$y(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){this.setOptions({annotations:!0});const[n,r,o,i]=await V2.loadXmlData(e);this.setOptions({fileSource:e,content:n,media:r,mediaFiles:o,fonts:i,isNewFile:!0,shouldLoadComments:!0,replacedFile:!0}),Me(this,ze,Xd).call(this),Me(this,ze,Yd).call(this),this.initDefaultStyles(),this.options.ydoc&&this.options.collaborationProvider?this.initializeCollaborationData(!0):Me(this,ze,Pa).call(this),this.options.ydoc||(Me(this,ze,Ui).call(this),Me(this,ze,Vi).call(this))}};Uo=new WeakMap,R2=new WeakMap,ze=new WeakSet,L2=function(t){if(!t.element&&t.selector){const{selector:e}=t;e.startsWith("#")||e.startsWith(".")?t.element=document.querySelector(e):t.element=document.getElementById(e),["text","html"].includes(t.mode)&&t.element&&t.element.classList.add("sd-super-editor-html")}t.element=t.isHeadless?null:t.element||document.createElement("div")},P2=function(t){Me(this,ze,Au).call(this),Me(this,ze,$u).call(this),Me(this,ze,Tu).call(this),Me(this,ze,Xd).call(this),Me(this,ze,Yd).call(this),this.options.isHeadless||Me(this,ze,Ty).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),Me(this,ze,Du).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",Me(this,ze,Cu)),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",Me(this,ze,Oy)),this.on("paginationUpdate",this.options.onPaginationUpdate),this.on("comment-positions",this.options.onCommentLocationsUpdate),this.initializeCollaborationData(),this.options.ydoc||(Me(this,ze,Ui).call(this),Me(this,ze,Vi).call(this)),window.setTimeout(()=>{this.isDestroyed||this.emit("create",{editor:this})},0))},Kd=function(t){(!t.extensions||!t.extensions.length)&&(this.options.extensions=_p()),Me(this,ze,Au).call(this),Me(this,ze,$u).call(this),Me(this,ze,Tu).call(this),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("contentError",this.options.onContentError),Me(this,ze,Du).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",Me(this,ze,Cu)),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)},Cu=function({editor:t,event:e}){this.toolbar?.setActiveEditor(t),this.options.onFocus({editor:t,event:e})},z2=function(t){t.isHeadless&&(typeof navigator>"u"&&(Kr.navigator={isHeadless:!0}),t.mockDocument&&(Kr.document=t.mockDocument,Kr.window=t.mockWindow))},Pa=function(){if(!this.options.isNewFile)return;this.options.isNewFile=!1;const t=Me(this,ze,Ou).call(this),e=this.state.tr.replaceWith(0,this.state.doc.content.size,t);this.view.dispatch(e),setTimeout(()=>{Me(this,ze,Ui).call(this),Me(this,ze,Vi).call(this)},50)},Jd=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},Au=function(){const t=["extension","node","mark"],e=[tD,ZM,nD,eD],n=this.options.externalExtensions||[],r=[...e,...this.options.extensions].filter(o=>t.includes(o?.type));this.extensionService=jO.create(r,n,this)},$u=function(){Y1(this,Uo,s2.create({editor:this}))},Xd=function(){this.options.converter?this.converter=this.options.converter:this.converter=new Dr({docx:this.options.content,media:this.options.mediaFiles,fonts:this.options.fonts,debug:!0,telemetry:this.options.telemetry,fileSource:this.options.fileSource,documentId:this.options.documentId})},Yd=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())},Ty=function(){const t=this.converter.getDocumentFonts();if(t?.length){const e=document.createElement("style");e.textContent=t,document.head.appendChild(e)}},Tu=function(){this.schema=this.extensionService.schema},Ou=function(){let t;try{const{mode:e,fragment:n,isHeadless:r,content:o,loadFromSchema:i}=this.options;e==="docx"?(t=E2(this.converter,this.schema,this),t=Me(this,ze,Dy).call(this,t),this.options.html&&(t=Me(this,ze,Mu).call(this,this.options.html)),n&&(t=fO(n,this.schema))):(e==="text"||e==="html")&&(i?t=this.schema.nodeFromJSON(o):o?t=Me(this,ze,Mu).call(this,o):t=this.schema.topNodeType.createAndFill())}catch(e){console.error(e),this.emit("contentError",{editor:this,error:e})}return t},Mu=function(t){let e=t;if(typeof t=="string"){const n=document.createElement("div");n.innerHTML=t,e=n,n.remove()}return Ar.fromSchema(this.schema).parse(e)},Du=function(){let t=Me(this,ze,Ou).call(this);const e={schema:this.schema};this.options.ydoc||(e.doc=t),this.view=new Vv(this.options.element,{...this.options.editorProps,dispatchTransaction:Me(this,ze,My).bind(this),state:Ji.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()},Oy=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||(Me(this,ze,Ui).call(this),Me(this,ze,Vi).call(this)))},Vi=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)},Ui=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 pD(this);this.storage.pagination.sectionData=t;const{state:e,dispatch:n}=this.view,r=e.tr.setMeta(oo,{isReadyToInit:!0});n(r)}},My=function(t){if(this.view.isDestroyed)return;let e;try{const i=ht.getState(this.view.state)?.isTrackChangesActive??!1?B2({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})},Dy=function(t){const e=Ji.create({schema:this.schema,doc:t}),{tr:n,doc:r}=e;return uD(r,n,this.schema,this.converter),e.apply(n).doc},j2=function(t=[]){const e=Ji.create({schema:this.schema,doc:this.state.doc,plugins:this.state.plugins}),{tr:n,doc:r}=e;return cD(r,n,this.schema,t),e.apply(n).doc.toJSON()},q2=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 Es=ED,Ge=class U2{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=We(Ne(this,"addOptions",{name:this.name}))),this.storage=We(Ne(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(...e){return new U2(...e)}},en=class H2{constructor(e){Fe(this,"type","mark"),Fe(this,"name","mark"),Fe(this,"options"),Fe(this,"storage"),Fe(this,"isExternal"),Fe(this,"config",{name:this.name}),this.config={...this.config,...e},this.name=this.config.name,this.isExternal=!!this.config.isExternal,this.config.addOptions&&(this.options=We(Ne(this,"addOptions",{name:this.name}))),this.storage=We(Ne(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(...e){return new H2(...e)}};const W2=rt.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()}}}),G2=rt.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()}}}),K2=rt.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]=tr(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]=tr(t);if(Number.isNaN(n))return!1;let{min:o,max:i,unit:s}=this.options.defaults;return n=rl(n,o,i),r=r||s,e().setMark("textStyle",{fontSize:`${n}${r}`}).run()},unsetFontSize:()=>({chain:t})=>t().setMark("textStyle",{fontSize:null}).removeEmptyTextStyle().run()}}}),J2=rt.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=>{if(t.textAlign===this.options.defaultAlignment)return{};const e=t.textAlign==="both"?"justify":t.textAlign;return e?{style:`text-align: ${e}`}:{}}}}}]},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")}}}),X2=rt.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]=tr(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]=tr(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]=tr(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)}}}),Y2=rt.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=>t.lineHeight?{style:zl(t.lineHeight,this.options.defaults.unit,t.spacing?.lineRule)}:{}}}}]},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)}}}),Z2=rt.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=js(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 CD(t={}){return new Xe({view(e){return new AD(e,t)}})}class AD{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=r1(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 Q2=rt.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:2,class:void 0}},addPmPlugins(){return[CD(this.options)]}});let Qt=class mr extends Le{constructor(e){super(e,e)}map(e,n){let r=e.resolve(n.map(this.head));return mr.valid(r)?new mr(r):Le.near(r)}content(){return xe.empty}eq(e){return e instanceof mr&&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 mr(e.resolve(n.pos))}getBookmark(){return new xp(this.anchor)}static valid(e){let n=e.parent;if(n.isTextblock||!$D(e)||!TD(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&&mr.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(mr.valid(l))return l}for(;;){let s=n>0?i.firstChild:i.lastChild;if(!s){if(i.isAtom&&!i.isText&&!Ie.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(mr.valid(a))return a}return null}}};Qt.prototype.visible=!1;Qt.findFrom=Qt.findGapCursorFrom;Le.jsonID("gapcursor",Qt);class xp{constructor(e){this.pos=e}map(e){return new xp(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return Qt.valid(n)?new Qt(n):Le.near(n)}}function $D(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 TD(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 OD(){return new Xe({props:{decorations:ND,createSelectionBetween(t,e,n){return e.pos==n.pos&&Qt.valid(n)?new Qt(n):null},handleClick:DD,handleKeyDown:MD,handleDOMEvents:{beforeinput:_D}}})}const MD=cp({ArrowLeft:sa("horiz",-1),ArrowRight:sa("horiz",1),ArrowUp:sa("vert",-1),ArrowDown:sa("vert",1)});function sa(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 je){if(!i.endOfTextblock(n)||a.depth==0)return!1;l=!1,a=r.doc.resolve(e>0?a.after():a.before())}let c=Qt.findGapCursorFrom(a,e,l);return c?(o&&o(r.tr.setSelection(new Qt(c))),!0):!1}}function DD(t,e,n){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!Qt.valid(r))return!1;let o=t.posAtCoords({left:n.clientX,top:n.clientY});return o&&o.inside>-1&&Ie.isSelectable(t.state.doc.nodeAt(o.inside))?!1:(t.dispatch(t.state.tr.setSelection(new Qt(r))),!0)}function _D(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof Qt))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=be.empty;for(let s=r.length-1;s>=0;s--)o=be.from(r[s].createAndFill(null,o));let i=t.state.tr.replace(n.pos,n.pos,new xe(o,0,0));return i.setSelection(je.near(i.doc.resolve(n.pos+1))),t.dispatch(i),!1}function ND(t){if(!(t.selection instanceof Qt))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",Be.create(t.doc,[qe.widget(t.selection.head,e,{key:"gapcursor"})])}const ID=rt.create({name:"gapCursor",addPmPlugins(){return[OD()]},extendNodeSchema(t){return{allowGapCursor:We(Ne(t,"allowGapCursor",{name:t.name,options:t.options,storage:t.storage}))??null}}}),FD=new et("collaboration"),BD=rt.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=LD();PD(this.options.ydoc,this.editor),zD(this.options.ydoc,this.editor,this);const[e,n]=RD(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"),Mr.getState(e).undoManager.undoStack.length===0?!1:n?wO(e):!0),redo:()=>({tr:t,state:e,dispatch:n})=>(t.setMeta("preventDispatch",!0),t.setMeta("inputType","historyRedo"),Mr.getState(e).undoManager.redoStack.length===0?!1:n?bO(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()}}}),RD=(t,e)=>{const n=t.getXmlFragment("supereditor");return[Z5(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]},LD=()=>kO(),PD=(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}))})},zD=(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)},jD=rt.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?[yO(t.awareness,{cursorBuilder:qD})]:[]}}),qD=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},Xo="aiMark",aa="aiAnimationMark",VD=en.create({name:Xo,group:"ai",inclusive:!1,addOptions(){return{htmlAttributes:{class:"super-editor-ai"}}},addAttributes(){return{id:{default:null,rendered:!1}}},parseDOM(){return[{tag:Xo}]},renderDOM({htmlAttributes:t}){return[Xo,Ae.mergeAttributes(this.options.htmlAttributes,t)]}}),UD=en.create({name:aa,group:"ai",inclusive:!1,spanning:!1,excludes:aa,addOptions(){return{htmlAttributes:{}}},addAttributes(){return{id:{default:null,rendered:!1},class:{default:null,rendered:!0},dataMarkId:{default:null,rendered:!0}}},parseDOM(){return[{tag:aa}]},renderDOM({htmlAttributes:t}){return[aa,Ae.mergeAttributes(this.options.htmlAttributes,t)]}}),HD=new et("ai"),ex=rt.create({name:"ai",addCommands(){return{insertAiMark:()=>({tr:t,dispatch:e,state:n})=>{const{selection:r}=t,{$from:o,$to:i}=r;return o.pos===i.pos?!1:(t.addMark(o.pos,i.pos,this.editor.schema.marks[Xo].create({id:"ai-highlight"})),e&&e(t),!0)},removeAiMark:(t=Xo)=>({tr:e,dispatch:n,state:r})=>{const{doc:o}=r;let i=!1;return o.descendants((s,a)=>{const{marks:l=[]}=s;l.find(c=>c.type.name===t)&&(i=!0,e.removeMark(a,a+s.nodeSize,r.schema.marks[t]))}),i?(n&&n(e),!0):!1}}},addPmPlugins(){const t=this.editor;return[new Xe({key:HD,state:{init(){return{decorations:Be.empty,highlightColor:"#6366f1"}},apply(e,n,r,o){if(!e.docChanged)return n;const{decorations:i}=WD(t,o.doc,n.highlightColor)||{},s=Be.create(o.doc,i);return{...n,decorations:s}}},props:{decorations(e){return this.getState(e).decorations}}})]}}),WD=(t,e,n)=>{const r=[];return e.descendants((o,i)=>{const{marks:s=[]}=o;if(s.find(a=>a.type.name===Xo)){const a=qe.inline(i,i+o.nodeSize,{style:`background-color: ${n}33; border-radius: 4px; transition: background-color 250ms ease;`});r.push(a)}}),{decorations:r}},tx=Ge.create({name:"doc",topNode:!0,content:"block+",parseDOM(){return[{tag:"doc"}]},renderDOM(){return["doc",0]},addAttributes(){return{attributes:{rendered:!1}}}}),nx=Ge.create({name:"text",group:"inline",inline:!0}),GD=Ge.create({name:"run",group:"inline",content:"text*",inline:!0,parseDOM(){return[{tag:"run"}]},renderDOM(){return["run",0]},addAttributes(){return{attributes:{rendered:!1}}}});function vl(t){return new FO({match:t.match,handler:({state:e,range:n,match:r,chain:o})=>{const i=We(t.getAttributes,null,r)||{},s=e.tr.delete(n.from,n.to),a=s.doc.resolve(n.from).blockRange(),l=a&&Zb(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&&Br(s.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(r,c))&&s.join(n.from-1)}})}const _y=/^\s*([-+*])\s$/,rx=Ge.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",Ae.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=vl({match:_y,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=vl({match:_y,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes("textStyle"),editor:this.editor})),[t]}});function KD(t={}){return new Xe({key:new et("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 JD(){return Math.floor(Math.random()*4294967295).toString()}function XD(t){return new Xe({key:new et("orderedListMarker"),appendTransaction:(e,n,r)=>{if(!(e.some(l=>l.docChanged)&&!n.doc.eq(r.doc)))return;let{doc:o,tr:i}=r,s=YD(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=>QD(i,x)),a=!0;return}if(p){let x=ZD({state:r,list:u});x.length&&(d=x)}let h=d[0],m=e8({state:r,listItems:d}),y=ox(),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&&Ny(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:D,listLevel:M,listNumberingType:I}=b.attrs;Array.isArray(g.listLevel)||(g.listLevel=JSON.parse(g.listLevel));let E=[...g.listLevel.slice(0,-1),g.listLevel.at(-1)+1];if(!(D===g.lvlText&&I===g.listNumberingType&&Ny(M,E))){let{selection:U,storedMarks:oe}=r,N=oe||U.$to.parentOffset&&U.$from.marks();i.setNodeMarkup(T,void 0,{...b.attrs,listLevel:E,lvlText:g.lvlText,listNumberingType:g.listNumberingType}),N&&i.ensureMarks(N),a=!0}g={...g,listLevel:E}})}),i.setMeta("orderedListMarker",!0),a?i:null}})}function YD(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 ZD({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 ox({lvlText:t="",listLevel:e=[],listNumberingType:n="decimal"}={}){return{lvlText:t,listLevel:e,listNumberingType:n}}function QD(t,e){let{pos:n,node:r}=e;t.setNodeMarkup(n,void 0,{...r.attrs,lvlText:null,listLevel:null,listNumberingType:null})}function Ny(t,e){return t.length===e.length&&t.every((n,r)=>n===e[r])}function e8({state:t,listItems:e}){let{doc:n}=t,r=e[0],{lvlText:o,listLevel:i,listNumberingType:s}=r.node.attrs,a=ox({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 Iy=/^(\d+)\.\s$/,ix=Ge.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: ${KC(e)};`}):{}}},attributes:{rendered:!1,keepOnSplit:!0}}},parseDOM(){return[{tag:"ol"}]},renderDOM({htmlAttributes:t}){const{start:e,...n}=t;return e===1?["ol",Ae.mergeAttributes(this.options.htmlAttributes,n),0]:["ol",Ae.mergeAttributes(this.options.htmlAttributes,t),0]},addCommands(){return{toggleOrderedList:()=>({commands:t})=>t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks),getCurrentList:()=>({state:t})=>Jt(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=Jt(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=Jt(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,D=b||JD();r.setNodeMarkup(h,void 0,{...m.attrs,order:T,syncId:D}),b||r.setNodeMarkup(d,void 0,{...p.attrs,syncId:D})}}return!0}}},addShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList(),Enter:()=>this.editor.commands.liftEmptyBlockAndContinueListOrder()}},addPmPlugins(){return[XD(this.editor),KD()]},addInputRules(){let t=vl({match:Iy,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=vl({match:Iy,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]}}),t8=({listLevel:t,lvlText:e,listNumberingType:n})=>{const r=i8[n];return r?r(t,e):null},n8=(t,e)=>kp(t,e,String),sx=(t,e)=>kp(t,e,a8),r8=(t,e)=>sx(t,e).toLowerCase(),o8=(t,e)=>ax(t,e).toLowerCase(),ax=(t,e)=>kp(t,e,n=>l8(n)),i8={decimal:n8,lowerRoman:r8,upperRoman:sx,lowerLetter:o8,upperLetter:ax},s8=(t,e)=>t.reduce((n,r,o)=>n.replace(`%${o+1}`,r),e),kp=(t,e,n)=>{const r=t.map(n);return s8(r,e)},a8=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},l8=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 c8(t={}){return new Xe({key:new et("styledListMarker"),state:{init(e,n){const r=[...Fy(n),...By(n)];return Be.create(n.doc,r)},apply(e,n,r,o){if(!e.docChanged||e.getMeta("orderedListMarker"))return n;const i=e.getMeta("splitListItem"),s=[...Fy(o,i),...By(o)];return Be.create(o.doc,s)}},props:{decorations(e){return this.getState(e)}}})}function Fy(t,e=[]){let{doc:n,storedMarks:r}=t,o=[];Array.isArray(r)&&e.push(...r);let i=gp(n,s=>s.type.name==="listItem");return i.length&&i.forEach(({node:s,pos:a})=>{let l=ar("textStyle",n.type.schema),c=[...e.filter(y=>y.type===l)];if(d8(s)&&e.length){const y=e.filter(g=>g.type===l);c.push(...y)}else{const y=u8(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]=tr(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=Ae.mergeAttributes(f,p),m=qe.node(a,a+s.nodeSize,h);o.push(m)}),o}function By(t){let{doc:e}=t,n=[],r=gp(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:`
|
|
46
46
|
${l?`margin-top: ${l}px;`:""}
|
|
47
47
|
${c?`margin-bottom: ${c}px;`:""}
|
|
48
48
|
${u?zl(u,""):""}
|