@harbour-enterprises/superdoc 0.11.50 → 0.11.52
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-CudgUBHs.cjs → super-editor.es-CF2_JeN2.cjs} +3 -3
- package/dist/chunks/{super-editor.es-CITIL9eV.es.js → super-editor.es-dqooeh-w.es.js} +3 -3
- package/dist/super-editor/ai-writer.es.js +2 -2
- package/dist/super-editor/chunks/{converter-BiL-klqi.js → converter-BlwBjbRD.js} +2 -2
- package/dist/super-editor/chunks/{docx-zipper-7JabcOwU.js → docx-zipper-BjmHiitA.js} +1 -1
- package/dist/super-editor/chunks/{editor-mLcbG4xA.js → editor-Cgp1LFJR.js} +3 -3
- package/dist/super-editor/chunks/{toolbar-DeKcvBhf.js → toolbar-xCbBnPnp.js} +2 -2
- package/dist/super-editor/converter.es.js +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 +4 -4
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +1 -1
|
@@ -27,7 +27,7 @@ Actual: `+O.attribValue);else{var F=O.tag,B=O.tags[O.tags.length-1]||O;F.ns===B.
|
|
|
27
27
|
`)}};hs.empty=new hs(!0);let SC=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 Kb(t){let e=[];do e.push(EC(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function EC(t){let e=[];do e.push(CC(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function CC(t){let e=TC(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 sg(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=sg(t),r=n;return t.eat(",")&&(t.next!="}"?r=sg(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function $C(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 TC(t){if(t.eat("(")){let e=Kb(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=$C(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 OC(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 Jb(t,e){return e-t}function ag(t,e){let n=[];return r(e),n.sort(Jb);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 MC(t){let e=Object.create(null);return n(ag(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]);ag(t,l).forEach(u=>{c||o.push([a,c=[]]),c.indexOf(u)==-1&&c.push(u)})})});let i=e[r.join(",")]=new hs(r.indexOf(t.length-1)>-1);for(let s=0;s<o.length;s++){let a=o[s][1].sort(Jb);i.next.push({type:o[s][0],next:e[a.join(",")]||n(a)})}return i}}function DC(t,e){for(let n=0,r=[t];n<r.length;n++){let o=r[n],i=!o.validEnd,s=[];for(let a=0;a<o.next.length;a++){let{type:l,next:c}=o.next[a];s.push(l.name),i&&!(l.isText||l.hasRequiredAttrs())&&(i=!1),r.indexOf(c)==-1&&r.push(c)}i&&e.err("Only non-generatable nodes ("+s.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function Xb(t){let e=Object.create(null);for(let n in t){let r=t[n];if(!r.hasDefault)return null;e[n]=r.default}return e}function Yb(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 Zb(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 Qb(t,e){let n=Object.create(null);if(e)for(let r in e)n[r]=new NC(t,r,e[r]);return n}let lg=class ev{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=Qb(e,r.attrs),this.defaultAttrs=Xb(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==hs.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:Yb(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new oo(this,this.computeAttrs(e),ge.from(n),Xe.setFrom(r))}createChecked(e=null,n,r){return n=ge.from(n),this.checkContent(n),new oo(this,this.computeAttrs(e),n,Xe.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=ge.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(ge.empty,!0);return i?new oo(this,e,n.append(i),Xe.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){Zb(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:Xe.none:e}static compile(e,n){let r=Object.create(null);e.forEach((i,s)=>r[i]=new ev(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 _C(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 NC=class{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?_C(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}},tv=class nv{constructor(e,n,r,o){this.name=e,this.rank=n,this.schema=r,this.spec=o,this.attrs=Qb(e,o.attrs),this.excluded=null;let i=Xb(this.attrs);this.instance=i?new Xe(this,i):null}create(e=null){return!e&&this.instance?this.instance:new Xe(this,Yb(this.attrs,e))}static compile(e,n){let r=Object.create(null),o=0;return e.forEach((i,s)=>r[i]=new nv(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){Zb(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}},rv=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=lg.compile(this.spec.nodes,this),this.marks=tv.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]=hs.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?cg(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==""?[]:cg(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 lg){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 kC(r,r.defaultAttrs,e,Xe.setFrom(n))}mark(e,n){return typeof e=="string"&&(e=this.marks[e]),e.create(n)}nodeFromJSON(e){return oo.fromJSON(this,e)}markFromJSON(e){return Xe.fromJSON(this,e)}nodeType(e){let n=this.nodes[e];if(!n)throw new RangeError("Unknown node type: "+e);return n}};function cg(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 IC(t){return t.tag!=null}function FC(t){return t.style!=null}let $r=class vd{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(o=>{if(IC(o))this.tags.push(o);else if(FC(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 dg(this,n,!1);return r.addAll(e,Xe.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new dg(this,n,!0);return r.addAll(e,Xe.none,n.from,n.to),be.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(LC(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=pg(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=pg(s)),s.node||s.ignore||s.mark||(s.node=o)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new vd(e,vd.schemaRules(e)))}};const ov={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},RC={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},iv={ol:!0,ul:!0},ms=1,xd=2,Ia=4;function ug(t,e,n){return e!=null?(e?ms:0)|(e==="full"?xd:0):t&&t.whitespace=="pre"?ms|xd:n&-5}let oa=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=Xe.none,this.match=i||(s&Ia?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(ge.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&ms)){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=ge.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(ge.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&&!ov.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}},dg=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=ug(null,n.preserveWhitespace,0)|(r?Ia:0);o?i=new oa(o.type,o.attrs,Xe.none,!0,n.topMatch||o.type.contentMatch,s):r?i=new oa(null,null,Xe.none,!0,null,s):i=new oa(e.schema.topNodeType,null,Xe.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&xd?"full":this.localPreserveWS||(o.options&ms)>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,!/\S/.test(r)),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;iv.hasOwnProperty(s)&&this.parser.normalizeLists&&BC(e);let l=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(a=this.parser.matchTag(e,this,r));e:if(l?l.ignore:RC.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(ov.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,!0)}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,e.nodeName=="BR")||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,!1));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,r){let o,i;for(let s=this.open,a=0;s>=0;s--){let l=this.nodes[s],c=l.findWrapping(e);if(c&&(!o||o.length>c.length+a)&&(o=c,i=l,!c.length))break;if(l.solid){if(r)break;a+=2}}if(!o)return null;this.sync(i);for(let s=0;s<o.length;s++)n=this.enterInner(o[s],null,n,!1);return n}insertNode(e,n,r){if(e.isInline&&this.needsBlock&&!this.top.type){let i=this.textblockFromContext();i&&(n=this.enterInner(i,null,n))}let o=this.findPlace(e,n,r);if(o){this.closeExtra();let i=this.top;i.match&&(i.match=i.match.matchType(e.type));let s=Xe.none;for(let a of o.concat(e.marks))(i.type?i.type.allowsMarkType(a.type):fg(a.type,e.type))&&(s=a.addToSet(s));return i.content.push(e.mark(s)),!0}return!1}enter(e,n,r,o){let i=this.findPlace(e.create(n),r,!1);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=ug(e,i,s.options);s.options&Ia&&s.content.length==0&&(a|=Ia);let l=Xe.none;return r=r.filter(c=>(s.type?s.type.allowsMarkType(c.type):fg(c.type,e))?(l=c.addToSet(l),!1):!0),this.nodes.push(new oa(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|=ms)}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 BC(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&iv.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function LC(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function pg(t){let e={};for(let n in t)e[n]=t[n];return e}function fg(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 xi=class sv{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},r){r||(r=uu(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}=Fa(uu(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&&Fa(uu(r),o(e,n),null,e.attrs)}static renderSpec(e,n,r=null,o){return Fa(e,n,r,o)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new sv(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=hg(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return hg(e.marks)}};function hg(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function uu(t){return t.document||window.document}const mg=new WeakMap;function PC(t){let e=mg.get(t);return e===void 0&&mg.set(t,e=zC(t)),e}function zC(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 Fa(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=PC(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 p=d.indexOf(" ");p>0?l.setAttributeNS(d.slice(0,p),d.slice(p+1),c[d]):l.setAttribute(d,c[d])}}for(let d=u;d<e.length;d++){let p=e[d];if(p===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:f,contentDOM:h}=Fa(t,p,n,r);if(l.appendChild(f),h){if(a)throw new RangeError("Multiple content holes");a=h}}}return{dom:l,contentDOM:a}}const av=65535,lv=Math.pow(2,16);function jC(t,e){return t+e*lv}function gg(t){return t&av}function qC(t){return(t-(t&av))/lv}const cv=1,uv=2,Ra=4,dv=8;let kd=class{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&dv)>0}get deletedBefore(){return(this.delInfo&(cv|Ra))>0}get deletedAfter(){return(this.delInfo&(uv|Ra))>0}get deletedAcross(){return(this.delInfo&Ra)>0}},fo=class Fo{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&Fo.empty)return Fo.empty}recover(e){let n=0,r=gg(e);if(!this.inverted)for(let o=0;o<r;o++)n+=this.ranges[o*3+2]-this.ranges[o*3+1];return this.ranges[r*3]+n+qC(e)}mapResult(e,n=1){return this._map(e,n,!1)}map(e,n=1){return this._map(e,n,!0)}_map(e,n,r){let o=0,i=this.inverted?2:1,s=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?o:0);if(l>e)break;let c=this.ranges[a+i],u=this.ranges[a+s],d=l+c;if(e<=d){let p=c?e==l?-1:e==d?1:n:n,f=l+o+(p<0?0:u);if(r)return f;let h=e==(n<0?l:d)?null:jC(a/3,e-l),m=e==l?uv:e==d?cv:Ra;return(n<0?e!=l:e!=d)&&(m|=dv),new kd(f,m,h)}o+=u-c}return r?e+o:new kd(e+o,0,null)}touches(e,n){let r=0,o=gg(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 Fo(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Fo.empty:new Fo(e<0?[0,-e,0]:[0,0,e])}};fo.empty=new fo([]);let ni=class Sd{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 Sd(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 Sd;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 kd(e,o,null)}};const du=Object.create(null);let Rt=class{getMap(){return fo.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=du[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 du)throw new RangeError("Duplicate use of step JSON ID "+e);return du[e]=n,n.prototype.jsonID=e,n}},jt=class Ii{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new Ii(e,null)}static fail(e){return new Ii(null,e)}static fromReplace(e,n,r,o){try{return Ii.ok(e.replace(n,r,o))}catch(i){if(i instanceof ol)return Ii.fail(i.message);throw i}}};function Zp(t,e,n){let r=[];for(let o=0;o<t.childCount;o++){let i=t.child(o);i.content.size&&(i=i.copy(Zp(i.content,e,i))),i.isInline&&(i=e(i,n,o)),r.push(i)}return ge.fromArray(r)}let qs=class Fi extends Rt{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=e.resolve(this.from),o=r.node(r.sharedDepth(this.to)),i=new be(Zp(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 Fi(n.pos,r.pos,this.mark)}merge(e){return e instanceof Fi&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Fi(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 Fi(n.from,n.to,e.markFromJSON(n.mark))}};Rt.jsonID("addMark",qs);let vn=class Ri extends Rt{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=new be(Zp(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 qs(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 Ri(n.pos,r.pos,this.mark)}merge(e){return e instanceof Ri&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Ri(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 Ri(n.from,n.to,e.markFromJSON(n.mark))}};Rt.jsonID("removeMark",vn);let Qp=class Bi extends Rt{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return jt.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return jt.fromReplace(e,this.pos,this.pos+1,new be(ge.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 Bi(this.pos,n.marks[o]);return new Bi(this.pos,this.mark)}}return new al(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Bi(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 Bi(n.pos,e.markFromJSON(n.mark))}};Rt.jsonID("addNodeMark",Qp);let al=class Ed extends Rt{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return jt.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return jt.fromReplace(e,this.pos,this.pos+1,new be(ge.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new Qp(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Ed(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 Ed(n.pos,e.markFromJSON(n.mark))}};Rt.jsonID("removeNodeMark",al);let $t=class Hr extends Rt{constructor(e,n,r,o=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=o}apply(e){return this.structure&&Cd(e,this.from,this.to)?jt.fail("Structure replace would overwrite content"):jt.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new fo([this.from,this.to-this.from,this.slice.size])}invert(e){return new Hr(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 Hr(n.pos,Math.max(n.pos,r.pos),this.slice,this.structure)}merge(e){if(!(e instanceof Hr)||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?be.empty:new be(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new Hr(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?be.empty:new be(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new Hr(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 Hr(n.from,n.to,be.fromJSON(e,n.slice),!!n.structure)}};Rt.jsonID("replace",$t);let Zt=class Ba extends Rt{constructor(e,n,r,o,i,s,a=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=o,this.slice=i,this.insert=s,this.structure=a}apply(e){if(this.structure&&(Cd(e,this.from,this.gapFrom)||Cd(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 fo([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 Ba(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 Ba(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 Ba(n.from,n.to,n.gapFrom,n.gapTo,be.fromJSON(e,n.slice),n.insert,!!n.structure)}};Rt.jsonID("replaceAround",Zt);function Cd(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 VC(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 p=Math.max(c,e),f=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==p&&s.mark.eq(d[m])?s.to=f:o.push(s=new vn(p,f,d[m])));a&&a.to==p?a.to=f:i.push(a=new qs(p,f,r))}}),o.forEach(l=>t.step(l)),i.forEach(l=>t.step(l))}function UC(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 tv){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],p;for(let f=0;f<o.length;f++){let h=o[f];h.step==i-1&&d.eq(o[f].style)&&(p=h)}p?(p.to=c,p.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 ef(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,be.empty));else{r=d;for(let p=0;p<c.marks.length;p++)n.allowsMarkType(c.marks[p].type)||t.step(new vn(a,u,c.marks[p]));if(o&&c.isText&&n.whitespace!="pre"){let p,f=/\r?\n|\r/g,h;for(;p=f.exec(c.text);)h||(h=new be(ge.from(n.schema.text(" ",n.allowedMarks(c.marks))),0,0)),s.push(new $t(a+p.index,a+p.index+p[0].length,h))}}a=u}if(!r.validEnd){let l=r.fillBefore(ge.empty,!0);t.replace(a,a,new be(l,0,0))}for(let l=s.length-1;l>=0;l--)t.step(s[l])}function HC(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function Vs(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||!HC(r,o,i))break}return null}function WC(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=ge.empty,d=0;for(let h=i,m=!1;h>n;h--)m||r.index(h)>0?(m=!0,u=ge.from(r.node(h).copy(u)),d++):l--;let p=ge.empty,f=0;for(let h=i,m=!1;h>n;h--)m||o.after(h+1)<o.end(h)?(m=!0,p=ge.from(o.node(h).copy(p)),f++):c++;t.step(new Zt(l,c,s,a,new be(u.append(p),d,f),u.size-d,!0))}function pv(t,e,n=null,r=t){let o=GC(t,e),i=o&&KC(r,e);return i?o.map(yg).concat({type:e,attrs:n}).concat(i.map(yg)):null}function yg(t){return{type:t,attrs:null}}function GC(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 KC(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 JC(t,e,n){let r=ge.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=ge.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 be(r,0,0),n.length,!0))}function XC(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)&&YC(t.doc,t.mapping.slice(i).map(a),r)){let c=null;if(r.schema.linebreakReplacement){let f=r.whitespace=="pre",h=!!r.contentMatch.matchType(r.schema.linebreakReplacement);f&&!h?c=!1:!f&&h&&(c=!0)}c===!1&&hv(t,s,a,i),ef(t,t.mapping.slice(i).map(a,1),r,void 0,c===null);let u=t.mapping.slice(i),d=u.map(a,1),p=u.map(a+s.nodeSize,1);return t.step(new Zt(d,p,d+1,p-1,new be(ge.from(r.create(l,null,s.marks)),0,0),1,!0)),c===!0&&fv(t,s,a,i),!1}})}function fv(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 hv(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 YC(t,e,n){let r=t.resolve(e),o=r.index();return r.parent.canReplaceWith(o,o+1,n)}function ZC(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 be(ge.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),p=o.index(c);if(d.type.spec.isolating)return!1;let f=d.content.cutByIndex(p,d.childCount),h=r&&r[u+1];h&&(f=f.replaceChild(0,h.type.create(h.attrs)));let m=r&&r[u]||d;if(!d.canReplace(p+1,d.childCount)||!m.type.validContent(f))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 QC(t,e,n=1,r){let o=t.doc.resolve(e),i=ge.empty,s=ge.empty;for(let a=o.depth,l=o.depth-n,c=n-1;a>l;a--,c--){i=ge.from(o.node(a).copy(i));let u=r&&r[c];s=ge.from(u?u.type.create(u.attrs,s):o.node(a).copy(s))}t.step(new $t(e,e,new be(i.append(s),n,n),!0))}function Pr(t,e){let n=t.resolve(e),r=n.index();return mv(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function eA(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 mv(t,e){return!!(t&&e&&!t.isLeaf&&eA(t,e))}function gv(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&&mv(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 tA(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);hv(t,u.node(),u.before(),a)}s.inlineContent&&ef(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),be.empty,!0)),r===!0){let u=t.doc.resolve(c);fv(t,u.node(),u.before(),t.steps.length)}return t}function nA(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 yv(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 tf(t,e,n=e,r=be.empty){if(e==n&&!r.size)return null;let o=t.resolve(e),i=t.resolve(n);return wv(o,i,r)?new $t(e,n,r):new rA(o,i,r).fit()}function wv(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}let rA=class{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=ge.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=ge.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 be(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=pu(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(ge.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=pu(e,n);return!o.childCount||o.firstChild.isLeaf?!1:(this.unplaced=new be(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=pu(e,n);if(o.childCount<=1&&n>0){let i=e.size-n<=n+o.size;this.unplaced=new be(Li(e,n-1,1),n-1,i?n-1:r)}else this.unplaced=new be(Li(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:p}=this.frontier[n];if(o){for(let m=0;m<o.childCount;m++)u.push(o.child(m));d=d.matchFragment(o)}let f=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(bv(m.mark(p.allowedMarks(m.marks)),c==1?l:0,c==a.childCount?f:-1)))}let h=c==a.childCount;h||(f=-1),this.placed=Pi(this.placed,n,ge.from(u)),this.frontier[n].match=d,h&&f<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let m=0,y=a;m<f;m++){let g=y.lastChild;this.frontier.push({type:g.type,match:g.contentMatchAt(g.childCount)}),y=g.content}this.unplaced=h?e==0?be.empty:new be(Li(s.content,e-1,1),e-1,f<0?s.openEnd:e-1):new be(Li(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||!fu(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=fu(e,n,o,r,i);if(s){for(let a=n-1;a>=0;a--){let{match:l,type:c}=this.frontier[a],u=fu(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=Pi(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=Pi(this.placed,this.depth,ge.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let e=this.frontier.pop().match.fillBefore(ge.empty,!0);e.childCount&&(this.placed=Pi(this.placed,this.frontier.length,e))}};function Li(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(Li(t.firstChild.content,e-1,n)))}function Pi(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(Pi(t.lastChild.content,e-1,n)))}function pu(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function bv(t,e,n){if(e<=0)return t;let r=t.content;return e>1&&(r=r.replaceChild(0,bv(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(ge.empty,!0)))),t.copy(r)}function fu(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&&!oA(n,i.content,s)?a:null}function oA(t,e,n){for(let r=n;r<e.childCount;r++)if(!t.allowsMarks(e.child(r).marks))return!0;return!1}function iA(t){return t.spec.defining||t.spec.definingForContent}function sA(t,e,n,r){if(!r.size)return t.deleteRange(e,n);let o=t.doc.resolve(e),i=t.doc.resolve(n);if(wv(o,i,r))return t.step(new $t(e,n,r));let s=xv(o,t.doc.resolve(n));s[s.length-1]==0&&s.pop();let a=-(o.depth+1);s.unshift(a);for(let p=o.depth,f=o.pos-1;p>0;p--,f--){let h=o.node(p).type.spec;if(h.defining||h.definingAsContext||h.isolating)break;s.indexOf(p)>-1?a=p:o.before(p)==f&&s.splice(1,0,-p)}let l=s.indexOf(a),c=[],u=r.openStart;for(let p=r.content,f=0;;f++){let h=p.firstChild;if(c.push(h),f==r.openStart)break;p=h.content}for(let p=u-1;p>=0;p--){let f=c[p],h=iA(f.type);if(h&&!f.sameMarkup(o.node(Math.abs(a)-1)))u=p;else if(h||!f.type.isTextblock)break}for(let p=r.openStart;p>=0;p--){let f=(p+u+1)%(r.openStart+1),h=c[f];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 be(vv(r.content,0,r.openStart,f),f,r.openEnd))}}let d=t.steps.length;for(let p=s.length-1;p>=0&&(t.replace(e,n,r),!(t.steps.length>d));p--){let f=s[p];f<0||(e=o.before(f),n=i.after(f))}}function vv(t,e,n,r,o){if(e<n){let i=t.firstChild;t=t.replaceChild(0,i.copy(vv(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(ge.empty,!0))}return t}function aA(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let o=nA(t.doc,e,r.type);o!=null&&(e=n=o)}t.replaceRange(e,n,new be(ge.from(r),0,0))}function lA(t,e,n){let r=t.doc.resolve(e),o=t.doc.resolve(n),i=xv(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 xv(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 kv=class La extends Rt{constructor(e,n,r){super(),this.pos=e,this.attr=n,this.value=r}apply(e){let n=e.nodeAt(this.pos);if(!n)return jt.fail("No node at attribute step's position");let r=Object.create(null);for(let i in n.attrs)r[i]=n.attrs[i];r[this.attr]=this.value;let o=n.type.create(r,null,n.marks);return jt.fromReplace(e,this.pos,this.pos+1,new be(ge.from(o),0,n.isLeaf?0:1))}getMap(){return fo.empty}invert(e){return new La(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 La(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 La(n.pos,n.attr,n.value)}};Rt.jsonID("attr",kv);let Sv=class Ad extends Rt{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let o in e.attrs)n[o]=e.attrs[o];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return jt.ok(r)}getMap(){return fo.empty}invert(e){return new Ad(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 Ad(n.attr,n.value)}};Rt.jsonID("docAttr",Sv);let ri=class extends Error{};ri=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};ri.prototype=Object.create(Error.prototype);ri.prototype.constructor=ri;ri.prototype.name="TransformError";let Ev=class{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new ni}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new ri(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=be.empty){let o=tf(this.doc,e,n,r);return o&&this.step(o),this}replaceWith(e,n,r){return this.replace(e,n,new be(ge.from(r),0,0))}delete(e,n){return this.replace(e,n,be.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return sA(this,e,n,r),this}replaceRangeWith(e,n,r){return aA(this,e,n,r),this}deleteRange(e,n){return lA(this,e,n),this}lift(e,n){return WC(this,e,n),this}join(e,n=1){return tA(this,e,n),this}wrap(e,n){return JC(this,e,n),this}setBlockType(e,n=e,r,o=null){return XC(this,e,n,r,o),this}setNodeMarkup(e,n,r=null,o){return ZC(this,e,n,r,o),this}setNodeAttribute(e,n,r){return this.step(new kv(e,n,r)),this}setDocAttribute(e,n){return this.step(new Sv(e,n)),this}addNodeMark(e,n){return this.step(new Qp(e,n)),this}removeNodeMark(e,n){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(n instanceof Xe)n.isInSet(r.marks)&&this.step(new al(e,n));else{let o=r.marks,i,s=[];for(;i=n.isInSet(o);)s.push(new al(e,i)),o=i.removeFromSet(o);for(let a=s.length-1;a>=0;a--)this.step(s[a])}return this}split(e,n=1,r){return QC(this,e,n,r),this}addMark(e,n,r){return VC(this,e,n,r),this}removeMark(e,n,r){return UC(this,e,n,r),this}clearIncompatible(e,n,r){return ef(this,e,n,r),this}};const hu=Object.create(null);let ze=class{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new Cv(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=be.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?be.empty:n),a==0&&vg(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),vg(e,r,n.isInline?-1:1))}}static findFrom(e,n,r=!1){let o=e.parent.inlineContent?new je(e):Ro(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?Ro(e.node(0),e.node(i),e.before(i+1),e.index(i),n,r):Ro(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 Ro(e,e,0,0,1)||new _n(e)}static atEnd(e){return Ro(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=hu[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 hu)throw new RangeError("Duplicate use of selection JSON ID "+e);return hu[e]=n,n.prototype.jsonID=e,n}getBookmark(){return je.between(this.$anchor,this.$head).getBookmark()}};ze.prototype.visible=!0;let Cv=class{constructor(e,n){this.$from=e,this.$to=n}},wg=!1;function bg(t){!wg&&!t.parent.inlineContent&&(wg=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}let je=class zi extends ze{constructor(e,n=e){bg(e),bg(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 ze.near(r);let o=e.resolve(n.map(this.anchor));return new zi(o.parent.inlineContent?o:r,r)}replace(e,n=be.empty){if(super.replace(e,n),n==be.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof zi&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Av(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 zi(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=ze.findFrom(n,r,!0)||ze.findFrom(n,-r,!0);if(i)n=i.$head;else return ze.near(n,r)}return e.parent.inlineContent||(o==0?e=n:(e=(ze.findFrom(e,-r,!0)||ze.findFrom(e,r,!0)).$anchor,e.pos<n.pos!=o<0&&(e=n))),new zi(e,n)}};ze.jsonID("text",je);let Av=class $v{constructor(e,n){this.anchor=e,this.head=n}map(e){return new $v(e.map(this.anchor),e.map(this.head))}resolve(e){return je.between(e.resolve(this.anchor),e.resolve(this.head))}},_e=class ji extends ze{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?ze.near(i):new ji(i)}content(){return new be(ge.from(this.node),0,0)}eq(e){return e instanceof ji&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new cA(this.anchor)}static fromJSON(e,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new ji(e.resolve(n.anchor))}static create(e,n){return new ji(e.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}};_e.prototype.visible=!1;ze.jsonID("node",_e);let cA=class Tv{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:r}=e.mapResult(this.anchor);return n?new Av(r,r):new Tv(r)}resolve(e){let n=e.resolve(this.anchor),r=n.nodeAfter;return r&&_e.isSelectable(r)?new _e(n):ze.near(n)}},_n=class Pa extends ze{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,n=be.empty){if(n==be.empty){e.delete(0,e.doc.content.size);let r=ze.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,n)}toJSON(){return{type:"all"}}static fromJSON(e){return new Pa(e)}map(e){return new Pa(e)}eq(e){return e instanceof Pa}getBookmark(){return uA}};ze.jsonID("all",_n);const uA={map(){return this},resolve(t){return new _n(t)}};function Ro(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&&_e.isSelectable(a))return _e.create(t,n-(o<0?a.nodeSize:0))}else{let l=Ro(t,a,n+o,o<0?a.childCount:0,o,i);if(l)return l}n+=a.nodeSize*o}return null}function vg(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(ze.near(t.doc.resolve(s),n))}const xg=1,kg=2,Sg=4;let dA=class extends Ev{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|xg)&-3,this.storedMarks=null,this}get selectionSet(){return(this.updated&xg)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=kg,this}ensureMarks(e){return Xe.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&kg)>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)||Xe.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(ze.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|=Sg,this}get scrolledIntoView(){return(this.updated&Sg)>0}};function Eg(t,e){return!e||!t?t:t.bind(e)}let qi=class{constructor(e,n,r){this.name=e,this.init=Eg(n.init,r),this.apply=Eg(n.apply,r)}};const pA=[new qi("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new qi("selection",{init(t,e){return t.selection||ze.atStart(e.doc)},apply(t){return t.selection}}),new qi("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new qi("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];let mu=class{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=pA.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 qi(r.key,r.spec.state,r))})}},Zi=class Vi{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 Vi(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 dA(this)}static create(e){let n=new mu(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new Vi(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 mu(this.schema,e.plugins),r=n.fields,o=new Vi(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 mu(e.schema,e.plugins),i=new Vi(o);return o.fields.forEach(s=>{if(s.name=="doc")i.doc=oo.fromJSON(e.schema,n.doc);else if(s.name=="selection")i.selection=ze.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 Ov(t,e,n){for(let r in t){let o=t[r];o instanceof Function?o=o.bind(e):r=="handleDOMEvents"&&(o=Ov(o,e,{})),n[r]=o}return n}let He=class{constructor(e){this.spec=e,this.props={},e.props&&Ov(e.props,this,this.props),this.key=e.key?e.key.key:Mv("plugin")}getState(e){return e[this.key]}};const gu=Object.create(null);function Mv(t){return t in gu?t+"$"+ ++gu[t]:(gu[t]=0,t+"$")}let Ge=class{constructor(e="key"){this.key=Mv(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}};const ll=t=>t.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`),fA=t=>ll(t),za=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"}),hA={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 Ke(t,e=null,...n){return typeof t=="function"?e?t.bind(e)(...n):t(...n):t}function mA(t={}){return Object.keys(t).length===0&&t.constructor===Object}const gA=()=>typeof navigator<"u"?/Mac/.test(navigator.platform):!1,yA=()=>["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform),Dv=t=>Object.prototype.toString.call(t)==="[object RegExp]";function oi(t,e,n={strict:!0}){const r=Object.keys(e);return r.length?r.every(o=>n.strict?e[o]===t[o]:Dv(e[o])?e[o].test(t[o]):e[o]===t[o]):!0}function Cg(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 wA=/[\d-.]+(\w+)$/,bA=["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(wA)?.[1]??"").toLowerCase();return[n,bA.includes(r)?r:null]}function cl(t=0,e=0,n=0){return Math.min(Math.max(t,e),n)}function ii(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,ii(t)}function Jo(t){if(t!=null)return t/240}function $d(t){if(t!=null)return t*240}function vA(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 Vr(t){if(t!=null)return typeof t=="string"&&(t=parseFloat(t)),Math.round(t*9525)}function _v(t){return t==null?void 0:parseFloat(t)/8*1.3333}function Nv(t){if(t!=null)return Math.round(t*6)}function Iv(t){if(t!=null)return t/20}function xA(t){if(t!=null)return t*20}const kA=async(t,e)=>{const n=/^https?:|^blob:|^file:|^data:/i.test(t);if(e&&n&&typeof fetch=="function"){const i=await fetch(t);if(!i.ok)throw new Error(`Fetch failed: ${i.status} ${i.statusText}`);return await i.arrayBuffer()}const r=t.includes(",")?t.split(",",2)[1]:t.trim().replace(/\s/g,"");try{if(typeof globalThis.atob=="function"){const i=globalThis.atob(r),s=new Uint8Array(i.length);for(let a=0;a<i.length;a++)s[a]=i.charCodeAt(a);return s.buffer}}catch(i){console.warn("atob failed, falling back to Buffer:",i)}const o=mt.from(r,"base64");return o.buffer.slice(o.byteOffset,o.byteOffset+o.byteLength)},SA=t=>{const e=new window.DOMParser().parseFromString(t,"text/xml").querySelectorAll("Default");return Array.from(e).map(n=>n.getAttribute("Extension"))},EA=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 CA(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},$A=t=>"#"+t.match(/\d+/g).map(AA).join(""),Wl=(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}`)},TA=(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 nf(){return Math.floor(Math.random()*2147483647).toString(16).toUpperCase().padStart(8,"0")}const OA={"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"},MA={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:[]}]},DA={elements:[{type:"element",name:"w:settings",attributes:{"xmlns:w":"http://schemas.openxmlformats.org/wordprocessingml/2006/main"},elements:[]}]},_A={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"}]},Ag={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"}}]}]}},NA={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:[]}]},IA={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:[]}]},FA={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:[]}]},RA={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:[]}]},BA={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"}}]}]},LA={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:NA,COMMENTS_EXTENDED_XML_DEF:IA,COMMENTS_EXTENSIBLE_XML_DEF:FA,COMMENTS_IDS_XML_DEF:RA,DOCUMENT_RELS_XML_DEF:BA,CONTENT_TYPES:LA},It="trackInsert",ut="trackDelete",vt="trackFormat",Qt=t=>{if(t)try{return JSON.parse(JSON.stringify(t))}catch(e){console.error("Error in carbonCopy",t,e);return}},PA={attributes:{"w:abstractNumId":"1"}},zA={attributes:{"w:abstractNumId":"0"}},Fv={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 $g(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(p=>p.commentId==i);if(!s)return;const a=t.comments?.findIndex(p=>p.commentId===s.commentId),l=s.parentCommentId;let c;l&&(c=t.comments.find(p=>p.commentId===l||p.importedId===l));const u=c?.isInternal||s.isInternal;if(r==="external"&&u||s.resolvedTime)return;let d=jA(e,a);if(e==="End"){const p={name:"w:r",elements:[{name:"w:commentReference",attributes:{"w:id":String(a)}}]};d=[d,p]}return d}const jA=(t,e)=>({name:`w:commentRange${t}`,attributes:{"w:id":String(e)}}),qA=t=>({...t,commentParaId:nf()}),VA=(t,e,n,r)=>{const o=Lv({editor:r,node:t.commentJSON}),i={"w:id":String(e),"w:author":t.creatorName||t.importedAuthor?.name,"w:email":t.creatorEmail||t.importedAuthor?.email,"w:date":Rv(t.createdTime),"w:initials":UA(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 s=n.find(a=>a.commentId===t.parentCommentId);i["w15:paraIdParent"]=s.commentParaId}return{type:"element",name:"w:comment",attributes:i,elements:[o]}},UA=t=>t?t.replace("(imported)","").trim().split(" ").map(e=>e[0]).join(""):null,Rv=t=>new Date(t||Date.now()).toISOString().replace(/\.\d{3}Z$/,"Z"),HA=(t=[],e)=>{const n=Qt(e);return t.forEach(r=>{r.elements[0].elements.unshift(_A);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},WA=(t=[],e)=>{const n=Qt(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},GA=(t=[],e,n)=>{const r=Qt(e),o=Qt(n);return r.elements[0].elements=[],o.elements[0].elements=[],t.forEach(i=>{const s=nf(),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":Rv()}};o.elements[0].elements.push(l)}),{documentIdsUpdated:r,extensibleUpdated:o}},KA=t=>{const e=Qt(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},JA=t=>{const e=Qt(t);return delete e["word/comments.xml"],delete e["word/commentsExtended.xml"],delete e["word/commentsExtensible.xml"],delete e["word/commentsIds.xml"],e},ia=t=>({...Bo.DOCUMENT_RELS_XML_DEF.elements[0].elements.find(e=>e.attributes.Target===t)}),XA=({convertedXml:t,defs:e,commentsWithParaIds:n,exportType:r,converter:o})=>{const i=[];if(r==="clean")return{documentXml:JA(t),relationships:i};const s=KA(t);s["word/comments.xml"]=HA(e,s["word/comments.xml"]),i.push(ia("comments.xml")),s["word/commentsExtended.xml"]=WA(n,s["word/commentsExtended.xml"]),i.push(ia("commentsExtended.xml"));const{documentIdsUpdated:a,extensibleUpdated:l}=GA(n,s["word/commentsIds.xml"],s["word/commentsExtensible.xml"]);return s["word/commentsIds.xml"]=a,s["word/commentsExtensible.xml"]=l,i.push(ia("commentsIds.xml")),i.push(ia("commentsExtensible.xml")),{relationships:i,documentXml:s}},Td=(t,e)=>e?["width",`${Math.max(e,t)}px`]:["min-width",`${t}px`],Bv=(t,e,n,r)=>{let o=0,i=!0;const s=[],a=[],l=t.firstChild;if(!l)return{};for(let f=0,h=0;f<l.childCount;f++){const{colspan:m,colwidth:y}=l.child(f).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]=Td(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],p=[...a];return{colgroup:d,tableWidth:c,tableMinWidth:u,colgroupValues:p}};function ki(t){const{type:e}=t.node||{},n={doc:QA,body:YA,paragraph:Lv,text:t4,bulletList:Og,orderedList:Og,lineBreak:c4,table:u4,tableRow:g4,tableCell:w4,bookmarkStart:x4,fieldAnnotation:T4,tab:p4,image:qv,hardBreak:O4,commentRangeStart:()=>$g(t,"Start"),commentRangeEnd:()=>$g(t,"End"),commentReference:()=>null,shapeContainer:M4,shapeTextbox:D4,contentBlock:_4,structuredContent:F4};return n[e]?n[e](t):(console.error("No translation function found for node type:",e),null)}function YA(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=ii(s);o[`w:${i}`]=a}),r.attributes=o}return{name:"w:body",elements:[...ar(t),e]}}function Lv(t){const e=ar(t),n=e.find(i=>i.name==="htmlAnnotation");if(n)return n.elements;const r=ZA(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 ZA(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:p}=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"]=xA(parseFloat(l))):l&&(x["w:line"]=$d(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":$d(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"]=ii(a));const k={name:"w:ind",attributes:x};n.push(k)}else if(a){const h={name:"w:ind",attributes:{"w:left":ii(a)}};n.push(h)}if(s){const h={name:"w:jc",attributes:{"w:val":s==="justify"?"both":s}};n.push(h)}if(c){const h=Kl(c),m=Pv(h);n.push(m)}u&&n.push({name:"w:keepLines",attributes:{"w:val":u}}),d&&n.push({name:"w:keepNext",attributes:{"w:val":d}}),p&&n.push({name:"w:framePr",attributes:{"w:dropCap":p.type,"w:lines":p.lines,"w:wrap":p.wrap,"w:vAnchor":p.vAnchor,"w:hAnchor":p.hAnchor}});const f=t.attrs?.paragraphProperties?.sectPr;return f&&n.push(f),n.length?{name:"w:pPr",elements:n}:null}function QA(t){const e={type:"body",content:t.node.content};return[{name:"w:document",elements:[ki({...t,node:e})],attributes:OA},t]}function ar(t){const{content:e}=t.node;if(!e)return[];const n=[];return e.forEach(r=>{let o=ki({...t,node:r});(o?.name||o?.type)!=="w:sdt"&&(o=e4(o)),o instanceof Array?n.push(...o):n.push(o)}),n.filter(r=>r)}const e4=t=>{if(!t)return t;const e=t.elements?.some(o=>o.name==="w:r"),n=t.elements?.some(o=>o.name==="w:sdt");if(!t.elements?.find(o=>o.name==="w:sdt")?.elements?.find(o=>o.name==="w:sdtPr")?.elements?.some(o=>o.name==="w:alias"))return t;let r=t;if(e&&n){const o=t.elements.filter(s=>s.name==="w:sdt"),i=t.elements.filter(s=>s.name!=="w:sdt");r=[...i.filter(s=>s.name==="w:r").every(s=>s.elements.filter(a=>a.name==="w:t")?.every(a=>a.elements[0].text.trim().length>0))?[{...t,elements:i}]:[],{name:"w:p",elements:o}]}return r};function Gl(t,e,n){const r=/^\s|\s$/.test(t)?"preserve":null,o=r?{"xml:space":r}:null,i=[],s=Kl(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(p=>{const f=p.name;return c.type===f});if(!u)return;let d="";Object.entries(c.attrs).forEach(([p,f])=>{f&&(d+=`${p}=${f};`)}),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 Us(i,s)}function t4(t){const{node:e}=t,n=[It,ut];if(e.marks?.some(i=>n.includes(i.type)))return r4(t);if(e.marks?.some(i=>i.type==="link"))return o4(t);const{text:r,marks:o=[]}=e;return Gl(r,o,t)}function n4(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=>Kl([n])).filter(n=>n!==void 0)}}function r4(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=n4(n);e.marks=n.filter(l=>!r.includes(l.type)),s&&e.marks.push(s);const a=ki({...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 Us(t,e){let n=[];return Array.isArray(t)?n=t:n=[t],e&&e.length&&n.unshift(Pv(e)),{name:"w:r",elements:n}}function Pv(t=[]){return{name:"w:rPr",elements:t.filter(e=>!!Object.keys(e).length)}}function Kl(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 Mg(o)}):Mg(e))}function o4(t){const{node:e}=t,n=e.marks.find(a=>a.type==="link"),r=n.attrs.href;let o=n.attrs.rId;o||(o=jv(t,r)),e.marks=e.marks.filter(a=>a.type!=="link");const i=ki({...t,node:e}),s=zv(i);return{name:"w:hyperlink",type:"element",attributes:{"r:id":o},elements:[s]}}function zv(t){if(!t)return t;const e=Qt(t);if(!e)return e;const n={name:"w:rStyle",attributes:{"w:val":"Hyperlink"}},r={name:"w:color",attributes:{"w:val":"467886"}};if(e.name==="w:r"){const o=e.elements.find(i=>i.name==="w:rPr");if(o){const i=o.elements.find(a=>a.name==="w:color"),s=o.elements.find(a=>a.name==="w:rStyle");i||o.elements.unshift(r),s||o.elements.unshift(n)}else{const i={name:"w:rPr",elements:[n,r]};e.elements.unshift(i)}}return e}function jv(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 Tg(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 Og(t){const{type:e}=t.node,n=l4(t),r=[];return n.forEach(o=>{const{level:i,listType:s,pPrs:a,content:l,attrs:c={}}=o,u=(o.attrs.numId||o.listId)??i4(t,s),d=a4(i,u,a);l.forEach((p,f)=>{const h=Object.assign({},p);h.attrs={...h.attrs,...o.attrs};const m=ki({...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:p.attrs.paragraphProperties?[p.attrs.paragraphProperties]:[]};return r.push(k)}const{attributes:g}=c,{originalInlineRunProps:x}=g||{};if(x&&d.elements.push(x),y===-1)m.elements.unshift(Qt(d));else{const k=Qt(d).elements.map(b=>m.elements[y].elements.find(D=>D.name===b.name)||b);m.elements[y].elements=k}if(f!==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 i4(t,e){const n=s4(t.converter?.numbering?.definitions),r=e==="bullet"?zA:PA,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 s4=t=>!t||!Object.keys(t).length?0:Math.max(...Object.keys(t).map(e=>parseInt(e,10)))+1;function a4(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 l4({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(p=>{const f=p.attrs?.indent;if(f){const{left:g,right:x,firstLine:k,hanging:b}=f,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=p.content?.filter(g=>g.type==="bulletList"||g.type==="orderedList")||[],m=p.content?.filter(g=>g.type!=="bulletList"&&g.type!=="orderedList")||[],y={...p,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 c4(t){const e={},{lineBreakType:n}=t.node?.attrs||{};return n&&(e["w:type"]=n),{name:"w:br",attributes:e}}function u4(t){t.node=d4(t.node,t);const e=ar(t),n=f4(t.node),r=m4(t.node,t);return e.unshift(n),e.unshift(r),{name:"w:tbl",elements:e}}function d4(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 p4(t){const{marks:e=[]}=t.node,n=Kl(e);return Us({name:"w:tab"},n)}function f4(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=h4(t);e.push(u)}if(a){const{width:u,type:d}=a,p={name:"w:tblInd",attributes:{"w:w":lt(u),"w:type":d}};e.push(p)}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 h4(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":Nv(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 m4(t,e){const{editorSchema:n}=e;let r=[];try{const i=n.nodeFromJSON(t),s=25,{colgroupValues:a}=Bv(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 g4(t){const e=ar(t),n=y4(t.node);return n.elements.length&&e.unshift(n),{name:"w:tr",elements:e}}function y4(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 w4(t){const e=ar({...t,tableCell:t.node}),n=b4(t.node);return e.unshift(n),{name:"w:tc",elements:e}}function b4(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):ii(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:p}=n;if(p){const m={name:"w:tcMar",elements:v4(p)};e.push(m)}const{verticalAlign:f}=n;if(f){const m={name:"w:vAlign",attributes:{"w:val":f}};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":Nv(g.size),"w:space":g.space||0}}:{name:`w:${y}`,attributes:{"w:val":"nil"}})};e.push(m)}return{name:"w:tcPr",elements:e}}function v4(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 x4(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 Mg(t){const e=Nr.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=>{const a=o.split(", ");n.attributes[s]=a[0]?a[0]:o});break;case"color":let i=r.color.replace(/^#/,"").replace(/;$/,"");i.startsWith("rgb")&&(i=$A(i)),n.attributes["w:val"]=i;break;case"textAlign":n.attributes["w:val"]=r.textAlign;break;case"textIndent":n.attributes["w:firstline"]=ii(r.textIndent);break;case"lineHeight":n.attributes["w:line"]=$d(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 k4(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 S4(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 qv(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}=k4(s);let c=n.size?{w:Vr(n.size.width),h:Vr(n.size.height)}:e;if(a&&l){const m=Gt(c.w),y=Gt(c.h),{scaledWidth:g,scaledHeight:x}=S4(a,l,m,y);c={w:Vr(g),h:Vr(x)}}if(o){const m=o.attrs.colwidth.reduce((T,D)=>T+D,0),y=o.attrs.cellMargins?.left||8,g=o.attrs.cellMargins?.right||8,x=Vr(m-(y+g)),{width:k,height:b}=N4(c.w,c.h,x);k&&b&&(c={w:k,h:b})}if(t.node.type==="image"&&!i){const m=s?.split("word/")[1];i=Tg(t,m)}else if(t.node.type==="fieldAnnotation"&&!i){const m=s?.split(";")[0].split("/")[1];if(!m)return Vv(t);const y=Xn(4),g=n.fieldId.replace("-","_"),x=`media/${g}_${y}.${m}`;i=Tg(t,x),t.media[`${g}_${y}.${m}`]=s}let u=n.originalPadding||{distT:0,distB:0,distL:0,distR:0};const d=[];let p=[];n.isAnchor&&(u={...u,simplePos:n.originalAttributes?.simplePos,relativeHeight:1,behindDoc:n.originalAttributes?.behindDoc,locked:n.originalAttributes?.locked,layoutInCell:n.originalAttributes?.layoutInCell,allowOverlap:n.originalAttributes?.allowOverlap},n.simplePos&&d.push({name:"wp:simplePos",attributes:{x:0,y:0}}),n.anchorData&&(d.push({name:"wp:positionH",attributes:{relativeFrom:n.anchorData.hRelativeFrom},...n.marginOffset.left&&{elements:[{name:"wp:posOffset",elements:[{type:"text",text:Vr(n.marginOffset.left).toString()}]}]},...n.anchorData.alignH&&{elements:[{name:"wp:align",elements:[{type:"text",text:n.anchorData.alignH}]}]}}),d.push({name:"wp:positionV",attributes:{relativeFrom:n.anchorData.vRelativeFrom},...n.marginOffset.top&&{elements:[{name:"wp:posOffset",elements:[{type:"text",text:Vr(n.marginOffset.top).toString()}]}]},...n.anchorData.alignV&&{elements:[{name:"wp:align",elements:[{type:"text",text:n.anchorData.alignV}]}]}})),n.wrapText&&p.push({name:"wp:wrapSquare",attributes:{wrapText:n.wrapText}}),n.wrapTopAndBottom&&p.push({name:"wp:wrapTopAndBottom"}));const f="http://schemas.openxmlformats.org/drawingml/2006/main",h="http://schemas.openxmlformats.org/drawingml/2006/picture";return Us({name:"w:drawing",elements:[{name:n.isAnchor?"wp:anchor":"wp:inline",attributes:u,elements:[...d,{name:"wp:extent",attributes:{cx:c.w,cy:c.h}},{name:"wp:effectExtent",attributes:{l:0,t:0,r:0,b:0}},...p,{name:"wp:docPr",attributes:{id:n.id||0,name:n.alt,descr:n.title}},{name:"wp:cNvGraphicFramePr",elements:[{name:"a:graphicFrameLocks",attributes:{"xmlns:a":f,noChangeAspect:1}}]},{name:"a:graphic",attributes:{"xmlns:a":f},elements:[{name:"a:graphicData",attributes:{uri:h},elements:[{name:"pic:pic",attributes:{"xmlns:pic":h},elements:[{name:"pic:nvPicPr",elements:[{name:"pic:cNvPr",attributes:{id:n.id||0,name:n.title}},{name:"pic:cNvPicPr",elements:[{name:"a:picLocks",attributes:{noChangeAspect:1,noChangeArrowheads:1}}]}]},{name:"pic:blipFill",elements:[{name:"a:blip",attributes:{"r:embed":i}},{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"}]},{name:"a:noFill"}]}]}]}]}]}]},[])}function Vv(t){const{node:{attrs:e={},marks:n=[]}}=t,r=Uv(e);return Gl(e.displayLabel,[...n,...r],t)}function E4(t){const{node:{attrs:e={},marks:n=[]}}=t,r=gC.decode(e.displayLabel);return Gl(r,n,t)}function C4(t){const{node:{attrs:e={},marks:n=[]},editorSchema:r}=t,o=new window.DOMParser().parseFromString(e.rawHtml||e.displayLabel,"text/html"),i=Uv(e),s=[...n,...i];let a=Zi.create({doc:$r.fromSchema(r).parse(o)});s.length&&(a=I4(a,s));const l=a.doc.toJSON();return{name:"htmlAnnotation",elements:ar({...t,node:l})}}function Dg(t,e){return qv(t,e)}function A4(t){const{node:{attrs:e={},marks:n=[]}}=t,r=jv(t,e.linkUrl),o=Gl(e.linkUrl,n,t),i=zv(o);return{name:"w:hyperlink",type:"element",attributes:{"r:id":r,"w:history":1},elements:[i]}}function $4(t){const e={w:4286250,h:4286250},n={w:99e4,h:495e3};return{text:Vv,image:r=>Dg(r,e),signature:r=>Dg(r,n),checkbox:E4,html:C4,link:A4}[t]}const Uv=(t={})=>{const{fontFamily:e,fontSize:n,bold:r,underline:o,italic:i,textColor:s,textHighlight:a}=t,l=[];return e&&l.push({type:"fontFamily",attrs:{fontFamily:e}}),n&&l.push({type:"fontSize",attrs:{fontSize:n}}),r&&l.push({type:"bold",attrs:{}}),o&&l.push({type:"underline",attrs:{}}),i&&l.push({type:"italic",attrs:{}}),s&&l.push({type:"color",attrs:{color:s}}),a&&l.push({type:"highlight",attrs:{color:a}}),l};function T4(t){const{node:e,isFinalDoc:n}=t,{attrs:r={}}=e,o=$4(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:fieldFontFamily",attributes:{"xmlns:w":a,"w:val":r.fontFamily}},{name:"w:fieldFontSize",attributes:{"xmlns:w":a,"w:val":r.fontSize}},{name:"w:fieldTextColor",attributes:{"xmlns:w":a,"w:val":r.textColor}},{name:"w:fieldTextHighlight",attributes:{"xmlns:w":a,"w:val":r.textHighlight}}]},{name:"w:sdtContent",elements:s}]}}function O4(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 M4(t){const{node:e}=t,n=ar(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:[Us(o)]}}function D4(t){const{node:e}=t,n={name:"w:txbxContent",elements:ar(t)};return{name:"v:textbox",attributes:{...e.attrs.attributes},elements:[n]}}function _4(t){const{node:e}=t,{drawingContent:n}=e.attrs,r={name:"w:drawing",elements:[...n?[...n.elements||[]]:[]]};return{name:"w:p",elements:[Us({name:"mc:AlternateContent",elements:[{name:"mc:Choice",attributes:{Requires:"wps"},elements:[r]}]})]}}var Kr,Hv,yu,wu;let _g=class{constructor(e){ob(this,Kr),this.converter=e}schemaToXml(e,n=!1){return Yn(this,Kr,Hv).call(this,e,n).join("")}};Kr=new WeakSet,Hv=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,Kr,wu).call(this,n,e);return[o,...i]},yu=function(t){if(t)return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")},wu=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,Kr,yu).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,Kr,yu).call(this,r[0].text);a.push(l)}else if(r)for(let l of r){const c=Yn(this,Kr,wu).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 N4(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}}function I4(t,e){const{tr:n,doc:r,schema:o}=t,i=["fontFamily","fontSize","highlight"];if(!e.some(d=>i.includes(d.type)))return t;const s=e.find(d=>d.type==="fontFamily"),a=e.find(d=>d.type==="fontSize"),l=e.find(d=>d.type==="highlight"),c=o.marks.textStyle,u=o.marks.highlight;return r.descendants((d,p)=>{if(!d.isText)return;const f=d.marks.find(m=>m.type.name==="textStyle"),h=d.marks.find(m=>m.type.name==="highlight");f?!f?.attrs.fontFamily&&s?n.addMark(p,p+d.nodeSize,c.create({...f?.attrs,...s.attrs})):!f?.attrs.fontSize&&a&&n.addMark(p,p+d.nodeSize,c.create({...f?.attrs,...a.attrs})):n.addMark(p,p+d.nodeSize,c.create({...s?.attrs,...a?.attrs})),h||n.addMark(p,p+d.nodeSize,u.create({...l?.attrs}))}),t.apply(n)}function F4(t){const{node:e}=t,{attrs:n={}}=e,r=[{name:"w:sdtContent",elements:ar({...t,nodes:e.content})}];return r.unshift(n.sdtPr),{name:"w:sdt",elements:r}}const R4='<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>',B4=t=>JSON.parse(Yp.xml2json(t,null,2)),L4=(t,e=R4)=>t["word/document.xml"]||B4(e),P4=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:[j4(n,t)],consumed:1}}return{nodes:[],consumed:0}},z4={handlerName:"tableNodeHandler",handler:P4};function j4(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}=Gv(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 p=Wv(l,n),f=o.elements.find(k=>k.name==="w:tblW");f&&(c.tableWidth={width:nt(f.attributes["w:w"]),type:f.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:p?.borders,g=Object.keys(a)?.length?a:p?.rowBorders;c.borders=y;const x=[];return m.forEach(k=>{const b=U4(k,t,g,l,e);b.content?.length&&x.push(b)}),{type:"table",content:x,attrs:c}}function q4(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"),p=V4(d,r),f=Kv(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=Ng(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=Wv(i,l)||{};M.cellMargins=H4(T,I);const{fontSize:C,fonts:V={}}=I,oe=V.ascii;if(m){M.colwidth=[m],M.widthUnit="px";const N=f,W=f&&f.length>0,E=parseInt(b,10);if(E&&E>1&&W){let K=[];for(let ie=0;ie<E;ie++){let G=N[a+ie];typeof G<"u"?K.push(G):K.push(100)}K.length&&(M.colwidth=[...K])}}if(y&&(M.widthType=y),b&&(M.colspan=parseInt(b,10)),k&&(M.background=k),M.verticalAlign=D,C&&(M.fontSize=C),oe&&(M.fontFamily=oe.ascii),r&&(M.borders={...r}),p&&(M.borders=Object.assign(M.borders||{},p)),x&&x["w:val"]==="restart"){const N=n.elements.filter(G=>G.name==="w:tr"),W=N.findIndex(G=>G===e),E=N.slice(W+1);let K=e.elements.filter(G=>G.name==="w:tc").findIndex(G=>G===t),ie=1;for(let G of E){const ce=G.elements.findIndex(R=>R.name==="w:tc"),J=G.elements[ce+K];if(!J)break;const ue=Ng(J),{attributes:Z}=ue||{};if(!ue&&!Z||Z&&Z["w:val"]==="restart")break;ie++,G.elements.splice(ce+K,1)}M.rowspan=ie}return{type:"tableCell",content:c.handler({...s,nodes:t.elements}),attrs:M}}const Ng=t=>t.elements.find(e=>e.name==="w:tcPr")?.elements?.find(e=>e.name==="w:vMerge"),sa=(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=_v(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},V4=(t,e)=>{if(!t)return null;const n={},r=sa(t,"bottom",e);r&&(n.bottom=r);const o=sa(t,"top",e);o&&(n.top=o);const i=sa(t,"left",e);i&&(n.left=i);const s=sa(t,"right",e);return s&&(n.right=s),n};function Wv(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 p=c.elements.find(m=>m.name==="w:pPr");if(p){const m=p.elements.find(y=>y.name==="w:jc");m?.attributes&&(r.justification=m.attributes["w:val"])}const f=c?.elements.find(m=>m.name==="w:rPr");if(f){const m=f.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=f.elements.find(g=>g.name==="w:sz");y?.attributes&&(r.fontSize=vA(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}=Gv(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 Gv(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=_v(c)),["insideH","insideV"].includes(i)&&(n[i]=a),e[i]=a}),{borders:e,rowBorders:n}}function U4(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=Kv(e),u=t.elements.filter(d=>d.name==="w:tc");return{type:"tableRow",content:u?.map((d,p)=>{const f=u.length>1?c[p]:null;return q4(d,t,e,l,f,r,o,p)})||[],attrs:i}}const H4=(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:p,marginTop:f,marginBottom:h}=u;return{left:nt(s??d),right:nt(a??p),top:nt(l??f),bottom:nt(c??h)}},Kv=t=>t.elements.find(e=>e.name==="w:tblGrid")?.elements?.flatMap(e=>e.name!=="w:gridCol"?[]:nt(e.attributes["w:w"]))||[],W4=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(d=>d.name==="w:drawing"),!i)return{nodes:[],consumed:0};let s;const{elements:a}=i,l=n||null,c=a.find(d=>d.name==="wp:anchor");c&&(s=Ig(a[0],l,t),s.attrs.isAnchor=c);const u=a.find(d=>d.name==="wp:inline");return u&&(s=Ig(u,l,t)),{nodes:s?[s]:[],consumed:1}};function Ig(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(J=>J.name==="wp:extent"),a={width:Gt(s.attributes?.cx),height:Gt(s.attributes?.cy)},l=t.elements.find(J=>J.name==="a:graphic").elements.find(J=>J.name==="a:graphicData"),{uri:c}=l?.attributes;if(c&&c==="http://schemas.microsoft.com/office/word/2010/wordprocessingShape")return G4(n,t,l);const u=l.elements.find(J=>J.name==="pic:pic");if(!u||!u.elements)return null;const d=u.elements.find(J=>J.name==="pic:blipFill").elements.find(J=>J.name==="a:blip"),p=t.elements.find(J=>J.name==="wp:positionH"),f=p?.elements.find(J=>J.name==="wp:posOffset"),h=Gt(f?.elements[0]?.text),m=p?.attributes.relativeFrom,y=p?.elements.find(J=>J.name==="wp:align")?.elements[0]?.text,g=t.elements.find(J=>J.name==="wp:positionV"),x=g?.elements.find(J=>J.name==="wp:posOffset"),k=Gt(x?.elements[0]?.text),b=g?.attributes.relativeFrom,T=g?.elements.find(J=>J.name==="wp:align")?.elements[0]?.text,D=t.elements.find(J=>J.name==="wp:simplePos"),M=t.elements.find(J=>J.name==="wp:wrapSquare"),I=t.elements.find(J=>J.name==="wp:wrapTopAndBottom"),C=t.elements.find(J=>J.name==="wp:docPr");let V=null;(m||y||b||T)&&(V={hRelativeFrom:m,vRelativeFrom:b,alignH:y,alignV:T});const oe={left:h,top:k},{attributes:N}=d,W=N["r:embed"];let E=r[`word/_rels/${e||"document.xml"}.rels`];E||(E=r["word/_rels/document.xml.rels"]);const K=E.elements.find(J=>J.name==="Relationships"),{elements:ie}=K,G=ie.find(J=>J.attributes.Id===W),{attributes:ce}=G;return{type:"image",attrs:{src:`word/${ce.Target}`,alt:C?.attributes.name||"Image",id:C?.attributes.id||"",title:C?.attributes.descr||"Image",inline:!0,padding:i,marginOffset:oe,size:a,anchorData:V,...D&&{simplePos:{x:D.attributes.x,y:D.attributes.y}},...M&&{wrapText:M.attributes.wrapText},wrapTopAndBottom:!!I,originalPadding:{distT:o.distT,distB:o.distB,distL:o.distL,distR:o.distR},originalAttributes:t.attributes,rId:ce.Id}}}const G4=(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 K4(t,i);if(!o)return null;const{nodeListHandler:a}=t;return a.handler({...t,node:o.elements[0],nodes:o.elements})[0]},K4=(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}},J4={handlerName:"drawingNodeHandler",handler:W4};function si(t,e=[],n=null){const r=[],o=new Set;return t?.elements?.forEach(i=>{const s=Nr.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=Y4(a.type,l,n);if(u==null)return;c.attrs={},c.attrs[a.property]=u}r.push(c)}})}),Od(r)}function X4(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=si(n);return[{type:vt,attrs:{...o,before:i,after:[...e]}}]}function Od(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 Y4(t,e,n){t==="tabs"&&(t="textIndent");const r={color:()=>`#${e["w:val"]}`,fontSize:()=>`${e["w:val"]/2}pt`,textIndent:()=>Q4(e),fontFamily:()=>Z4(e,n),lineHeight:()=>e6(e),textAlign:()=>e["w:val"],link:()=>e.href,underline:()=>e["w:val"],bold:()=>e?.["w:val"]||null,italic:()=>e?.["w:val"]||null,highlight:()=>t6(e)};if(t in r||console.debug("❗️❗️ No value mapper for:",t,"Attributes:",e),t in r)return r[t],r[t]()}function Z4(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 Q4(t){let e=t["w:left"];return e?`${Wt(e)}in`:null}function e6(t){const e=t["w:line"],n=t["w:lineRule"];return!e||e==="0"?null:n==="exact"?`${Iv(e)}pt`:`${Jo(e)}`}function t6(t){const e=t["w:fill"];return e&&e!=="auto"?`#${e}`:CA(t?.["w:val"])?`#${t["w:val"]}`:EA(t?.["w:val"])||null}function ho(t,e){const n=[],r=[],{attributes:o={},elements:i=[]}=t,{nodes:s,paragraphProperties:a={},runProperties:l={}}=n6(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(...si(l,r)),a&&a.elements?.length&&n.push(...si(a,r)),n.push(...X4(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 n6(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 ja(t){return Nr.allowedElements[t.name||t.type]}const r6=t=>!!Nr.propertyTypes[t.name||t.type];function Jv(t){return t.filter(e=>e.name==="w:r").some(e=>e.elements.some(n=>n.name==="w:t"))}const o6=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(p=>p.name==="w:sdtContent")?.elements.find(p=>["w:ins","w:del"].includes(p.name));d&&(o=d)}if(!o)return{nodes:[],consumed:0};const{name:i}=o,{attributes:s,elements:a}=ho(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}},i6={handlerName:"trackChangeNodeHandler",handler:o6},s6=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 p=d.Target;c&&!p&&(p=`#${c}`);const f=o.elements.filter(m=>m.name==="w:r"),h={type:"link",attrs:{href:p,rId:l}};for(const m of f){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:f}),consumed:1}},a6={handlerName:"hyperlinkNodeHandler",handler:s6},l6=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=c6(o,r);if(l){const{marks:u=[],attributes:d={}}=ho(i),p=u.find(m=>m.type==="textStyle"),f=p&&Object.keys(p.attrs).length>0;c.marks&&!f&&u.push(...c.marks),i.marks&&u.push(...i.marks);const h=Od(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:Od(c.marks)})));return{nodes:a,consumed:1}},c6=(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?ho(r):{}},u6={handlerName:"runNodeHandler",handler:l6},d6=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=[]}=ho(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:ja(r),text:l,attrs:{type:o,attributes:i||{}},marks:a}],consumed:1}},p6={handlerName:"textNodeHandler",handler:d6},Xv=t=>{if(!t||!Array.isArray(t))return t;let e=[],n=null;for(let r of t)r.type==="text"?n&&f6(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},f6=(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||!h6(n[o].attrs,r[o].attrs))return!1;return!0},h6=(t={},e={})=>oi(t,e),m6=t=>{const{nodes:e,lists:n,docx:r}=t;if(e.length===0||e[0].name!=="w:p")return{nodes:[],consumed:0};const o=Qt(e[0]),i=n1(o.elements);o.elements=i;const s=o.elements.find(a=>a.name==="w:pPr");if(Md(o,r)){const a=Qt(e),l=[];let c=a.shift();for(;c&&Md(c,r);)l.push(c),c=a.shift(),c?.elements&&!Jv(c.elements)&&(l.push(c),c=a.shift());return{nodes:[Yv({listItems:l,params:t,originalPpr:s})],consumed:l.filter(u=>u.seen).length,lists:n}}else return{nodes:[],consumed:0,lists:n}},g6={handlerName:"listHandler",handler:m6};function Yv({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 p,f;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=Jl({node:t[0],styleId:m,docx:l});i=ai(y),o=parseInt(y?.elements?.find(k=>k.name==="w:ilvl")?.attributes["w:val"])||0,o===void 0&&(o=Zv(m,l));let g=0;for(let[k,b]of t.entries()){if(b.seen)continue;if(b.elements&&!Jv(b.elements)){const O=h({...n,nodes:[b]}).nodes[0];O&&d[d.length-1]?.content.push(O),b.seen=!0;continue}const{attributes:T,elements:D,marks:M=[]}=ho(b),I=rf(m,l)||{},{marks:C}=ho(I),V=M.find(O=>O.type==="textStyle"),oe=C?.find(O=>O.type==="textStyle"),{listType:N,listOrderingType:W,ilvl:E,listrPrs:K,listpPrs:ie,start:G,lvlText:ce,lvlJc:J,numId:ue}=v6(b,r,l);f=W;const Z=parseInt(E),R=o===Z&&ue===i,ee=b6({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 X={};if(R&&!se){p=N,b.seen=!0;const O=[];let A={type:"paragraph",content:c.handler({...n,nodes:[T.paragraphProperties,...D]})?.filter(S=>S)};A.content&&(A={...A,attrs:{textAlign:V?.attrs.textAlign||oe?.attrs.textAlign||null,rsidRDefault:T?.["w:rsidRDefault"]||null,styleId:m},content:Xv(A.content)}),O.push(A),g=r;let U=[];if(f!=="bullet"&&(U=[...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])}),U=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"])),X.indent=S}ie&&(X.listParagraphProperties=ie),K&&(X.listRunProperties=K),X.textStyle=V,X.order=G,X.lvlText=ce,X.lvlJc=V?.attrs.textAlign,X.listLevel=U,X.listNumberingType=W,X.attributes={parentAttributes:b?.attributes||null};const B=e?.elements?.find(S=>S.name==="w:rPr");B&&(X.attributes.originalInlineRunProps=B),X.numId=ue,l&&(X.spacing=e1(b,l,m));const le=Fg(O,X,[]);d.push(le)}else if(se){const O=[...s,u[i][r]],A=Yv({listItems:t.slice(k),originalPpr:e,params:n,listLevel:r+1,actualListLevel:r,currentListNumId:ue,path:O,isNested:!0});g=A.lastNestedListLevel,delete A.lastNestedListLevel;const U=d[d.length-1];U?U.content.push(A):d.push(Fg([A],X,[]))}else if(ue){g=r,r>0&&b.elements[0].elements.find(O=>O.name==="w:numPr")&&(u[i][r]=0);break}else{b.seen=!0;const O=h({...n,nodes:[b]}).nodes[0];d[d.length-1]?.content.push(O)}}const x={type:p||"bulletList",content:d,attrs:{"list-style-type":f,listId:i,attributes:{parentAttributes:t[0]?.attributes||null}}};return a&&(x.lastNestedListLevel=g),x}const Zv=(t,e)=>{const n=rf(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 Md(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=ai(i);const a=o?.attributes["w:val"];return a&&!s&&(i=Jl({node:t,styleId:a,docx:e}),s=ai(i)),!!s}const ai=t=>t?.elements?.find(e=>e.name==="w:numId")?.attributes["w:val"];function rf(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 Jl({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=ai(o);if(i)return o;const s=rf(e,n);o=s?.elements?.find(l=>l.name==="w:pPr")?.elements?.find(l=>l.name==="w:numPr"),i=ai(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?Jl({styleId:l,docx:n,seenStyleIds:r}):null}return o}function Fg(t,e,n){return{type:"listItem",content:t,attrs:e,marks:n}}const y6=["decimal","decimalZero","lowerRoman","upperRoman","lowerLetter","upperLetter","ordinal","cardinalText","ordinalText","hex","chicago","none"],w6=["bullet","square","circle","disc"],b6=({firstListId:t,secondListId:e,level:n,pStyleId:r,docx:o})=>{const{numFmt:i,lvlText:s,lvlJc:a}=ul(t,n,r,o),{numFmt:l,lvlText:c,lvlJc:u}=ul(e,n,r,o);return i===l&&s===c&&a===u},Rg=(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=ai(a),u=a?.elements?.find(h=>h.name==="w:ilvl"),d=u?.attributes?.["w:val"];const p=i?.elements?.find(h=>h.name==="w:basedOn")?.attributes?.["w:val"];let f=0;for(;a&&!c&&f<10;)a=(o.find(h=>h.attributes["w:styleId"]===p)||{})?.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"]),f++;return{numId:c,ilvl:d}},ul=(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}=Rg(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=x6(u,e),p=u?.elements?.find(k=>k.name==="w:numStyleLink")?.attributes["w:val"];if(p){const k=Rg(p,r);return ul(k.numId,e,null,r)}const f=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:f,numFmt:h,lvlText:m,lvlJc:y,pPr:g,rPr:x}};function v6(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=Jl({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"]||Zv(s,n),u=i.find(b=>b.name==="w:pStyle")?.attributes["w:val"],{start:d,numFmt:p,lvlText:f,lvlJc:h,pPr:m,rPr:y}=ul(l,e,u,n);let g,x;m&&(g=k6(m)),y&&(x=S6(y));let k;if(w6.includes(p?.toLowerCase()))k="bulletList";else if(y6.includes(p))k="orderedList";else return{};return{listType:k,listOrderingType:p,ilvl:c,numId:l,listrPrs:x,listpPrs:g,start:d,lvlText:f,lvlJc:h}}function x6(t,e){return t?.elements?.find(n=>Number(n.attributes["w:ilvl"])===e)}function k6(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 S6(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 Qv=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=Qt(e[0]);let s,a=n1(i.elements);if(i.elements=a,Md(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"),p=d?.elements?.find(b=>b.name==="w:pStyle"),f=d?.elements?.find(b=>b.name==="w:rPr"),h=d?.elements?.find(b=>b.name==="w:framePr");if(f){let b=si(f,[]);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(p&&(m=p.attributes["w:val"],s.attrs.styleId=m),n){const b=E6(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=e1(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:Xv(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}},E6=(t,e,n="")=>{const r={left:0,right:0,firstLine:0,hanging:0,textIndent:0},{indent:o={}}=t1(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},e1=(t,e,n="",r=[])=>{const o={lineSpaceAfter:0,lineSpaceBefore:0,line:0,lineRule:null},{spacing:i={}}=t1(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,p=u?.["w:line"]||l||i?.["w:line"];p&&(o.line=Jo(p));const f=u?.["w:lineRule"]||c||i?.["w:lineRule"];f&&(o.lineRule=f),f==="exact"&&p&&(o.line=`${Iv(p)}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},t1=(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:p}=o,{attributes:f}=a,{attributes:h}=c,{attributes:m}=d,{attributes:y}=i,{attributes:g}=l,{attributes:x}=u;return{spacing:h||p||f,indent:x||y||g,justify:m}},C6={handlerName:"paragraphNodeHandler",handler:Qv};function A6(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"),p=c?.elements?.find(ie=>ie.name==="w:ind");let f,h,m;u&&(f=nt(u?.attributes["w:before"]),h=nt(u?.attributes["w:after"]),m=Jo(u?.attributes["w:line"]));let y,g,x,k;p&&(y=d?.attributes["w:val"],g=nt(p?.attributes["w:left"]),x=nt(p?.attributes["w:right"]),k=nt(p?.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 C=0;I&&(I.attributes?.["w:val"]?C=Number(I?.attributes?.["w:val"]):C=1);const V=c?.elements?.find(ie=>ie.name==="w:pageBreakAfter");let oe;V&&(V.attributes?.["w:val"]?oe=Number(V?.attributes?.["w:val"]):oe=1);const N={name:l,qFormat:!!a,keepNext:!!b,keepLines:!!T,outlineLevel:D?parseInt(M):null,pageBreakBefore:!!C,pageBreakAfter:!!oe},W=s.elements.find(ie=>ie.name==="w:rPr"),E=si(W,[],e)||{},K={spacing:{lineSpaceAfter:h,lineSpaceBefore:f,line:m},textAlign:y,indent:{leftIndent:g,rightIndent:x,firstLine:k}};return E.forEach(ie=>{const{type:G,attrs:ce}=ie;if(G==="textStyle"){Object.entries(ce).forEach(([J,ue])=>{K[ll(J)]=ue});return}K[G]=ce}),{attrs:N,styles:K}}function n1(t=[]){const e=[];let n=[],r=!1;for(const o of t){const i=o.elements?.find(s=>s.name==="w:fldChar")?.attributes?.["w:fldCharType"];if(i==="begin"){n=[o],r=!0;continue}if(i==="separate"&&r){n.push(o);continue}if(i==="end"&&r){n.push(o),e.push(...$6(n)),n=[],r=!1;continue}r?n.push(o):e.push(o)}return n.length&&e.push(...n),e}const $6=(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(p=>{const f=p.elements.find(m=>m.name==="w:rPr");if(!f)return;const{elements:h}=f;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},T6=t=>nodeListHandler.handler({...t,nodes:node.elements}),O6=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(!Bg[r])return{nodes:[],consumed:0};const o=n?.elements.find(s=>s.name==="w:sdtContent"),i=Bg[r];return{nodes:i({...t,nodes:[o]}),consumed:1}},Bg={"Table of Contents":T6},M6=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(M=>M.name==="w:sdtPr"),a=i.elements.find(M=>M.name==="w:sdtContent"),l=s?.elements.find(M=>M.name==="w:fieldTypeShort")?.attributes["w:val"],{attrs:c,marks:u}=r1(a);if(s?.elements.find(M=>M.name==="w:docPartObj"))return O6({nodes:e,docx:n,nodeListHandler:r,insideTrackChange:o});const d=s?.elements.find(M=>M.name==="w:alias"),p=s?.elements.find(M=>M.name==="w:tag"),f=s?.elements.find(M=>M.name==="w:fieldType")?.attributes["w:val"],h=s?.elements.find(M=>M.name==="w:fieldColor")?.attributes["w:val"],m=s?.elements.find(M=>M.name==="w:fieldMultipleImage")?.attributes["w:val"],y=s?.elements.find(M=>M.name==="w:fieldFontFamily")?.attributes["w:val"],g=s?.elements.find(M=>M.name==="w:fieldFontSize")?.attributes["w:val"],x=s?.elements.find(M=>M.name==="w:fieldTextColor")?.attributes["w:val"],k=s?.elements.find(M=>M.name==="w:fieldTextHighlight")?.attributes["w:val"],b={type:l,fieldId:p?.attributes["w:val"],displayLabel:d?.attributes["w:val"],fieldType:f,fieldColor:h,multipleImage:m==="true",fontFamily:y!=="null"?y:null,fontSize:g!=="null"?g:null,textColor:x!=="null"?x:null,textHighlight:k!=="null"?k:null},T={...b,...c};if(!b.fieldId||!b.displayLabel)return{nodes:[],consumed:0};let D={type:"text",text:`{{${b.displayLabel}}}`,attrs:T,marks:u};return t.editor.options.annotations&&(D={type:"fieldAnnotation",attrs:T}),{nodes:[D],consumed:1}},r1=(t={},e)=>{const n=t.elements?.find(s=>s.name==="w:r")?.elements?.find(s=>s.name==="w:rPr");if(!n)return{};const r=si(n,[])||[],o=[];r.forEach(s=>{const{type:a}=s;if(a==="textStyle"){const{attrs:l}=s;Object.keys(l).forEach(c=>{o.push({type:c,attrs:l[c]})})}else o.push(s)});const i={};return o?.forEach(s=>{const{type:a}=s;i[a]=s.attrs||!0}),{attrs:i,marks:r}},D6={handlerName:"annotationNodeHandler",handler:M6},_6=t=>{const{nodes:e,nodeListHandler:n}=t;if(e.length===0||e[0].name!=="w:sdt")return{nodes:[],consumed:0};const r=e[0],o=r.elements.find(a=>a.name==="w:sdtPr"),i=r.elements.find(a=>a.name==="w:sdtContent"),{marks:s}=r1(i);return{nodes:[{type:"structuredContent",content:n.handler({...t,nodes:i?.elements}),marks:s,attrs:{sdtPr:o}}],consumed:1}},N6={handlerName:"sdtNodeHandler",handler:_6},I6=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=[]}=ho(o);if(i==="w:sdt")return{nodes:[],consumed:0};if(r6(o))return{nodes:[{type:ja(o),attrs:{...s},marks:[]}],consumed:0};if(!ja(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)),p={...t,nodes:d,parentStyleId:u},f=r.handler(p);c.push(...f)}return{nodes:[{type:ja(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},R6={handlerName:"standardNodeHandler",handler:I6},B6=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}},L6={handlerName:"lineBreakNodeHandler",handler:B6},P6=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"]),p=e.slice(1,d),f=t.nodeListHandler,h={};o.attributes["w:name"].split(";").forEach(y=>{const[g,x]=y.split("=");g&&x&&(h[g]=x)});const m=f.handler({...t,nodes:p});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},z6={handlerName:"bookmarkNodeHandler",handler:P6},j6=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}},q6={handlerName:"alternateChoiceHandler",handler:j6},V6=t=>{const{nodes:e}=t;return e.length===0||e[0].name!=="sd:autoPageNumber"?{nodes:[],consumed:0}:{nodes:[{type:"page-number"}],consumed:1}},U6={handlerName:"autoPageNumberHandler",handler:V6},H6=t=>{const{nodes:e}=t;return e.length===0||e[0].name!=="sd:totalPageNumber"?{nodes:[],consumed:0}:{nodes:[{type:"total-page-number"}],consumed:1}},W6={handlerName:"autoTotalPageCountEntity",handler:H6},G6=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}},K6={handlerName:"tabNodeHandler",handler:G6},J6=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=X6({pict:r,pNode:n,shape:i,params:t})),{nodes:a?[a]:[],consumed:1}};function X6({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=Y6(s.style),l=Z6(a);l&&(o.style=l);const c=n.elements?.find(p=>p.name==="v:textbox"),u=n.elements?.find(p=>p.name==="w10:wrap");u?.attributes&&(o.wrapAttributes=u.attributes),c?.attributes&&(i.attributes=c.attributes);const d=(c?.elements?.find(p=>p.name==="w:txbxContent")?.elements||[]).map(p=>Qv({nodes:[p],docx:r.docx,nodeListHandler:gs()})).reduce((p,f)=>[...p,...f.nodes],[]);return{type:"shapeContainer",attrs:o,content:[{type:"shapeTextbox",attrs:i,content:d}]}}function Y6(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 Z6(t){const e=["width","height"];let n="";for(const[r,o]of Object.entries(t))e.includes(r)&&(n+=`${r}: ${o};`);return n}const Q6={handlerName:"handlePictNode",handler:J6};function e$({docx:t}){const e=gs(),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"],p=a["w:date"],f=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(p).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:f||Lr(),importedId:l,creatorName:c,creatorEmail:u,createdTime:x,textJson:D[0],initials:d,paraId:I,trackedChange:h,trackedChangeText:y,trackedChangeType:m,trackedDeletedText:g}});return t$({docx:t,comments:i})}const t$=({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}=n$(a);let u;return c&&(u=e.find(d=>d.paraId===c)),{...s,isDone:l,parentCommentId:u?.commentId}})},n$=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}},r$=(t,e,n)=>{const r=Qt(L4(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=gs(),i=r.elements[0].elements.find(s=>s.name==="w:body");if(i){const s=i,a=["w:sectPr"],l=s.elements?.filter(p=>!a.includes(p.name))??[],c=e$({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:i$(s,t,e,n),comments:c,linkedStyles:s$(t),numbering:c$(t)}}return null},gs=()=>{const t=[q6,u6,Q6,C6,g6,p6,L6,D6,N6,z6,a6,J4,i6,z4,K6,U6,W6,R6];return{handler:o$(t),handlerEntities:t}},o$=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 p=0;p<r.length;p++)try{const f=r.slice(p);if(!f||f.length===0)continue;const{nodes:h,consumed:m,unhandled:y}=t.reduce((x,k)=>x.consumed>0?x:k.handler({nodes:f,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,p,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&&(p+=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(f){console.debug("Import error",f),a?.emit("exception",{error:f}),s?.telemetry?.trackStatistic("error",{type:"processing_error",message:f.message,name:f.name,stack:f.stack,fileName:`/word/${l||"document.xml"}`})}return d}catch(p){throw console.debug("Error during import",p),a?.emit("exception",{error:p}),s?.telemetry?.trackStatistic("error",{type:"fatal_error",message:p.message,name:p.name,stack:p.stack,fileName:`/word/${l||"document.xml"}`}),p}};return n};function i$(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}}),l$(e,n,r),i.alternateHeaders=u$(e),i}function s$(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=A6(s,t),l={id:i.attributes["w:styleId"],type:i.attributes["w:type"],definition:a,attributes:{}};o.push(l)}),o}function a$(t){if(!t)return null;const e=Qt(t),{elements:n}=e.elements[0];return Object.keys(Ag).forEach(r=>{if(!n.some(o=>o.attributes?.["w:styleId"]===r)){const o=Ag[r];e.elements[0].elements.push(o)}}),e}const l$=(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=(o1(t["word/document.xml"])||[]).flatMap(u=>u.elements);a.forEach(u=>{const{rId:d,referenceFile:p,currentFileName:f}=Lg(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=gs(),y=m.handler({nodes:p.elements[0].elements,nodeListHandler:m,docx:t,converter:e,editor:n,filename:f});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:p,currentFileName:f}=Lg(u,t),h=c.find(g=>g.name==="w:footerReference"&&g.attributes["r:id"]===d)?.attributes["w:type"],m=gs(),y=m.handler({nodes:p.elements[0].elements,nodeListHandler:m,docx:t,converter:e,editor:n,filename:f});e.footerIds.ids||(e.footerIds.ids=[]),e.footerIds.ids.push(d),e.footers[d]={type:"doc",content:[...y]},e.footerIds[h]=d})},o1=(t,e=[])=>{for(const n in t)t[n]==="w:sectPr"?e.push(t):typeof t[n]=="object"&&o1(t[n],e);return e},Lg=(t,e)=>{const n=t.attributes.Id,r=t.attributes.Target,o=e[`word/${r}`];return{rId:n,referenceFile:o,currentFileName:r}};function c$(t){let e=t["word/numbering.xml"];(!e||!e.elements?.length||!e.elements[0].elements?.length)&&(e=Fv);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 u$=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")},d$="http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink";var Lo,i1,s1,a1,l1;const Ui=class c1{constructor(e=null){ob(this,Lo),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]=a$(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(Yp.xml2json(e,null,2))}static getStoredSuperdocVersion(e){try{const n=e.find(a=>a.name==="docProps/custom.xml");if(!n)return;const r=new c1,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.11.50"){const r="docProps/custom.xml";e[r]||(e[r]=u1());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=d1();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 p=d.elements.find(f=>f.name==="w:rPr");s=p?.elements?.find(f=>f.name==="w:rFonts")?.attributes["w:ascii"],l=Number(p?.elements?.find(f=>f.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=TA(l,s.attributes["w:fontKey"]);if(!c)return;const u=new Blob([c],{type:"font/ttf"}),d=URL.createObjectURL(u),p=s.name.includes("Regular"),f=s.name.includes("Bold"),h=s.name.includes("Italic"),m=s.name.includes("Light");i+=`
|
|
30
|
+
`))}})}function YC(t,e,n){let r=t.resolve(e),o=r.index();return r.parent.canReplaceWith(o,o+1,n)}function ZC(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 be(ge.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),p=o.index(c);if(d.type.spec.isolating)return!1;let f=d.content.cutByIndex(p,d.childCount),h=r&&r[u+1];h&&(f=f.replaceChild(0,h.type.create(h.attrs)));let m=r&&r[u]||d;if(!d.canReplace(p+1,d.childCount)||!m.type.validContent(f))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 QC(t,e,n=1,r){let o=t.doc.resolve(e),i=ge.empty,s=ge.empty;for(let a=o.depth,l=o.depth-n,c=n-1;a>l;a--,c--){i=ge.from(o.node(a).copy(i));let u=r&&r[c];s=ge.from(u?u.type.create(u.attrs,s):o.node(a).copy(s))}t.step(new $t(e,e,new be(i.append(s),n,n),!0))}function Pr(t,e){let n=t.resolve(e),r=n.index();return mv(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function eA(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 mv(t,e){return!!(t&&e&&!t.isLeaf&&eA(t,e))}function gv(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&&mv(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 tA(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);hv(t,u.node(),u.before(),a)}s.inlineContent&&ef(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),be.empty,!0)),r===!0){let u=t.doc.resolve(c);fv(t,u.node(),u.before(),t.steps.length)}return t}function nA(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 yv(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 tf(t,e,n=e,r=be.empty){if(e==n&&!r.size)return null;let o=t.resolve(e),i=t.resolve(n);return wv(o,i,r)?new $t(e,n,r):new rA(o,i,r).fit()}function wv(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}let rA=class{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=ge.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=ge.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 be(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=pu(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(ge.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=pu(e,n);return!o.childCount||o.firstChild.isLeaf?!1:(this.unplaced=new be(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=pu(e,n);if(o.childCount<=1&&n>0){let i=e.size-n<=n+o.size;this.unplaced=new be(Li(e,n-1,1),n-1,i?n-1:r)}else this.unplaced=new be(Li(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:p}=this.frontier[n];if(o){for(let m=0;m<o.childCount;m++)u.push(o.child(m));d=d.matchFragment(o)}let f=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(bv(m.mark(p.allowedMarks(m.marks)),c==1?l:0,c==a.childCount?f:-1)))}let h=c==a.childCount;h||(f=-1),this.placed=Pi(this.placed,n,ge.from(u)),this.frontier[n].match=d,h&&f<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let m=0,y=a;m<f;m++){let g=y.lastChild;this.frontier.push({type:g.type,match:g.contentMatchAt(g.childCount)}),y=g.content}this.unplaced=h?e==0?be.empty:new be(Li(s.content,e-1,1),e-1,f<0?s.openEnd:e-1):new be(Li(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||!fu(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=fu(e,n,o,r,i);if(s){for(let a=n-1;a>=0;a--){let{match:l,type:c}=this.frontier[a],u=fu(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=Pi(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=Pi(this.placed,this.depth,ge.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let e=this.frontier.pop().match.fillBefore(ge.empty,!0);e.childCount&&(this.placed=Pi(this.placed,this.frontier.length,e))}};function Li(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(Li(t.firstChild.content,e-1,n)))}function Pi(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(Pi(t.lastChild.content,e-1,n)))}function pu(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function bv(t,e,n){if(e<=0)return t;let r=t.content;return e>1&&(r=r.replaceChild(0,bv(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(ge.empty,!0)))),t.copy(r)}function fu(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&&!oA(n,i.content,s)?a:null}function oA(t,e,n){for(let r=n;r<e.childCount;r++)if(!t.allowsMarks(e.child(r).marks))return!0;return!1}function iA(t){return t.spec.defining||t.spec.definingForContent}function sA(t,e,n,r){if(!r.size)return t.deleteRange(e,n);let o=t.doc.resolve(e),i=t.doc.resolve(n);if(wv(o,i,r))return t.step(new $t(e,n,r));let s=xv(o,t.doc.resolve(n));s[s.length-1]==0&&s.pop();let a=-(o.depth+1);s.unshift(a);for(let p=o.depth,f=o.pos-1;p>0;p--,f--){let h=o.node(p).type.spec;if(h.defining||h.definingAsContext||h.isolating)break;s.indexOf(p)>-1?a=p:o.before(p)==f&&s.splice(1,0,-p)}let l=s.indexOf(a),c=[],u=r.openStart;for(let p=r.content,f=0;;f++){let h=p.firstChild;if(c.push(h),f==r.openStart)break;p=h.content}for(let p=u-1;p>=0;p--){let f=c[p],h=iA(f.type);if(h&&!f.sameMarkup(o.node(Math.abs(a)-1)))u=p;else if(h||!f.type.isTextblock)break}for(let p=r.openStart;p>=0;p--){let f=(p+u+1)%(r.openStart+1),h=c[f];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 be(vv(r.content,0,r.openStart,f),f,r.openEnd))}}let d=t.steps.length;for(let p=s.length-1;p>=0&&(t.replace(e,n,r),!(t.steps.length>d));p--){let f=s[p];f<0||(e=o.before(f),n=i.after(f))}}function vv(t,e,n,r,o){if(e<n){let i=t.firstChild;t=t.replaceChild(0,i.copy(vv(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(ge.empty,!0))}return t}function aA(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let o=nA(t.doc,e,r.type);o!=null&&(e=n=o)}t.replaceRange(e,n,new be(ge.from(r),0,0))}function lA(t,e,n){let r=t.doc.resolve(e),o=t.doc.resolve(n),i=xv(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 xv(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 kv=class La extends Rt{constructor(e,n,r){super(),this.pos=e,this.attr=n,this.value=r}apply(e){let n=e.nodeAt(this.pos);if(!n)return jt.fail("No node at attribute step's position");let r=Object.create(null);for(let i in n.attrs)r[i]=n.attrs[i];r[this.attr]=this.value;let o=n.type.create(r,null,n.marks);return jt.fromReplace(e,this.pos,this.pos+1,new be(ge.from(o),0,n.isLeaf?0:1))}getMap(){return fo.empty}invert(e){return new La(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 La(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 La(n.pos,n.attr,n.value)}};Rt.jsonID("attr",kv);let Sv=class Ad extends Rt{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let o in e.attrs)n[o]=e.attrs[o];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return jt.ok(r)}getMap(){return fo.empty}invert(e){return new Ad(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 Ad(n.attr,n.value)}};Rt.jsonID("docAttr",Sv);let ri=class extends Error{};ri=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};ri.prototype=Object.create(Error.prototype);ri.prototype.constructor=ri;ri.prototype.name="TransformError";let Ev=class{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new ni}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new ri(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=be.empty){let o=tf(this.doc,e,n,r);return o&&this.step(o),this}replaceWith(e,n,r){return this.replace(e,n,new be(ge.from(r),0,0))}delete(e,n){return this.replace(e,n,be.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return sA(this,e,n,r),this}replaceRangeWith(e,n,r){return aA(this,e,n,r),this}deleteRange(e,n){return lA(this,e,n),this}lift(e,n){return WC(this,e,n),this}join(e,n=1){return tA(this,e,n),this}wrap(e,n){return JC(this,e,n),this}setBlockType(e,n=e,r,o=null){return XC(this,e,n,r,o),this}setNodeMarkup(e,n,r=null,o){return ZC(this,e,n,r,o),this}setNodeAttribute(e,n,r){return this.step(new kv(e,n,r)),this}setDocAttribute(e,n){return this.step(new Sv(e,n)),this}addNodeMark(e,n){return this.step(new Qp(e,n)),this}removeNodeMark(e,n){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(n instanceof Xe)n.isInSet(r.marks)&&this.step(new al(e,n));else{let o=r.marks,i,s=[];for(;i=n.isInSet(o);)s.push(new al(e,i)),o=i.removeFromSet(o);for(let a=s.length-1;a>=0;a--)this.step(s[a])}return this}split(e,n=1,r){return QC(this,e,n,r),this}addMark(e,n,r){return VC(this,e,n,r),this}removeMark(e,n,r){return UC(this,e,n,r),this}clearIncompatible(e,n,r){return ef(this,e,n,r),this}};const hu=Object.create(null);let ze=class{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new Cv(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=be.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?be.empty:n),a==0&&vg(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),vg(e,r,n.isInline?-1:1))}}static findFrom(e,n,r=!1){let o=e.parent.inlineContent?new je(e):Ro(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?Ro(e.node(0),e.node(i),e.before(i+1),e.index(i),n,r):Ro(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 Ro(e,e,0,0,1)||new _n(e)}static atEnd(e){return Ro(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=hu[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 hu)throw new RangeError("Duplicate use of selection JSON ID "+e);return hu[e]=n,n.prototype.jsonID=e,n}getBookmark(){return je.between(this.$anchor,this.$head).getBookmark()}};ze.prototype.visible=!0;let Cv=class{constructor(e,n){this.$from=e,this.$to=n}},wg=!1;function bg(t){!wg&&!t.parent.inlineContent&&(wg=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}let je=class zi extends ze{constructor(e,n=e){bg(e),bg(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 ze.near(r);let o=e.resolve(n.map(this.anchor));return new zi(o.parent.inlineContent?o:r,r)}replace(e,n=be.empty){if(super.replace(e,n),n==be.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof zi&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Av(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 zi(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=ze.findFrom(n,r,!0)||ze.findFrom(n,-r,!0);if(i)n=i.$head;else return ze.near(n,r)}return e.parent.inlineContent||(o==0?e=n:(e=(ze.findFrom(e,-r,!0)||ze.findFrom(e,r,!0)).$anchor,e.pos<n.pos!=o<0&&(e=n))),new zi(e,n)}};ze.jsonID("text",je);let Av=class $v{constructor(e,n){this.anchor=e,this.head=n}map(e){return new $v(e.map(this.anchor),e.map(this.head))}resolve(e){return je.between(e.resolve(this.anchor),e.resolve(this.head))}},_e=class ji extends ze{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?ze.near(i):new ji(i)}content(){return new be(ge.from(this.node),0,0)}eq(e){return e instanceof ji&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new cA(this.anchor)}static fromJSON(e,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new ji(e.resolve(n.anchor))}static create(e,n){return new ji(e.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}};_e.prototype.visible=!1;ze.jsonID("node",_e);let cA=class Tv{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:r}=e.mapResult(this.anchor);return n?new Av(r,r):new Tv(r)}resolve(e){let n=e.resolve(this.anchor),r=n.nodeAfter;return r&&_e.isSelectable(r)?new _e(n):ze.near(n)}},_n=class Pa extends ze{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,n=be.empty){if(n==be.empty){e.delete(0,e.doc.content.size);let r=ze.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,n)}toJSON(){return{type:"all"}}static fromJSON(e){return new Pa(e)}map(e){return new Pa(e)}eq(e){return e instanceof Pa}getBookmark(){return uA}};ze.jsonID("all",_n);const uA={map(){return this},resolve(t){return new _n(t)}};function Ro(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&&_e.isSelectable(a))return _e.create(t,n-(o<0?a.nodeSize:0))}else{let l=Ro(t,a,n+o,o<0?a.childCount:0,o,i);if(l)return l}n+=a.nodeSize*o}return null}function vg(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(ze.near(t.doc.resolve(s),n))}const xg=1,kg=2,Sg=4;let dA=class extends Ev{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|xg)&-3,this.storedMarks=null,this}get selectionSet(){return(this.updated&xg)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=kg,this}ensureMarks(e){return Xe.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&kg)>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)||Xe.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(ze.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|=Sg,this}get scrolledIntoView(){return(this.updated&Sg)>0}};function Eg(t,e){return!e||!t?t:t.bind(e)}let qi=class{constructor(e,n,r){this.name=e,this.init=Eg(n.init,r),this.apply=Eg(n.apply,r)}};const pA=[new qi("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new qi("selection",{init(t,e){return t.selection||ze.atStart(e.doc)},apply(t){return t.selection}}),new qi("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new qi("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];let mu=class{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=pA.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 qi(r.key,r.spec.state,r))})}},Zi=class Vi{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 Vi(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 dA(this)}static create(e){let n=new mu(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new Vi(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 mu(this.schema,e.plugins),r=n.fields,o=new Vi(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 mu(e.schema,e.plugins),i=new Vi(o);return o.fields.forEach(s=>{if(s.name=="doc")i.doc=oo.fromJSON(e.schema,n.doc);else if(s.name=="selection")i.selection=ze.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 Ov(t,e,n){for(let r in t){let o=t[r];o instanceof Function?o=o.bind(e):r=="handleDOMEvents"&&(o=Ov(o,e,{})),n[r]=o}return n}let He=class{constructor(e){this.spec=e,this.props={},e.props&&Ov(e.props,this,this.props),this.key=e.key?e.key.key:Mv("plugin")}getState(e){return e[this.key]}};const gu=Object.create(null);function Mv(t){return t in gu?t+"$"+ ++gu[t]:(gu[t]=0,t+"$")}let Ge=class{constructor(e="key"){this.key=Mv(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}};const ll=t=>t.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`),fA=t=>ll(t),za=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"}),hA={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 Ke(t,e=null,...n){return typeof t=="function"?e?t.bind(e)(...n):t(...n):t}function mA(t={}){return Object.keys(t).length===0&&t.constructor===Object}const gA=()=>typeof navigator<"u"?/Mac/.test(navigator.platform):!1,yA=()=>["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform),Dv=t=>Object.prototype.toString.call(t)==="[object RegExp]";function oi(t,e,n={strict:!0}){const r=Object.keys(e);return r.length?r.every(o=>n.strict?e[o]===t[o]:Dv(e[o])?e[o].test(t[o]):e[o]===t[o]):!0}function Cg(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 wA=/[\d-.]+(\w+)$/,bA=["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(wA)?.[1]??"").toLowerCase();return[n,bA.includes(r)?r:null]}function cl(t=0,e=0,n=0){return Math.min(Math.max(t,e),n)}function ii(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,ii(t)}function Jo(t){if(t!=null)return t/240}function $d(t){if(t!=null)return t*240}function vA(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 Vr(t){if(t!=null)return typeof t=="string"&&(t=parseFloat(t)),Math.round(t*9525)}function _v(t){return t==null?void 0:parseFloat(t)/8*1.3333}function Nv(t){if(t!=null)return Math.round(t*6)}function Iv(t){if(t!=null)return t/20}function xA(t){if(t!=null)return t*20}const kA=async(t,e)=>{const n=/^https?:|^blob:|^file:|^data:/i.test(t);if(e&&n&&typeof fetch=="function"){const i=await fetch(t);if(!i.ok)throw new Error(`Fetch failed: ${i.status} ${i.statusText}`);return await i.arrayBuffer()}const r=t.includes(",")?t.split(",",2)[1]:t.trim().replace(/\s/g,"");try{if(typeof globalThis.atob=="function"){const i=globalThis.atob(r),s=new Uint8Array(i.length);for(let a=0;a<i.length;a++)s[a]=i.charCodeAt(a);return s.buffer}}catch(i){console.warn("atob failed, falling back to Buffer:",i)}const o=mt.from(r,"base64");return o.buffer.slice(o.byteOffset,o.byteOffset+o.byteLength)},SA=t=>{const e=new window.DOMParser().parseFromString(t,"text/xml").querySelectorAll("Default");return Array.from(e).map(n=>n.getAttribute("Extension"))},EA=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 CA(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},$A=t=>"#"+t.match(/\d+/g).map(AA).join(""),Wl=(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}`)},TA=(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 nf(){return Math.floor(Math.random()*2147483647).toString(16).toUpperCase().padStart(8,"0")}const OA={"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"},MA={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:[]}]},DA={elements:[{type:"element",name:"w:settings",attributes:{"xmlns:w":"http://schemas.openxmlformats.org/wordprocessingml/2006/main"},elements:[]}]},_A={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"}]},Ag={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"}}]}]}},NA={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:[]}]},IA={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:[]}]},FA={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:[]}]},RA={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:[]}]},BA={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"}}]}]},LA={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:NA,COMMENTS_EXTENDED_XML_DEF:IA,COMMENTS_EXTENSIBLE_XML_DEF:FA,COMMENTS_IDS_XML_DEF:RA,DOCUMENT_RELS_XML_DEF:BA,CONTENT_TYPES:LA},It="trackInsert",ut="trackDelete",vt="trackFormat",Qt=t=>{if(t)try{return JSON.parse(JSON.stringify(t))}catch(e){console.error("Error in carbonCopy",t,e);return}},PA={attributes:{"w:abstractNumId":"1"}},zA={attributes:{"w:abstractNumId":"0"}},Fv={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 $g(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(p=>p.commentId==i);if(!s)return;const a=t.comments?.findIndex(p=>p.commentId===s.commentId),l=s.parentCommentId;let c;l&&(c=t.comments.find(p=>p.commentId===l||p.importedId===l));const u=c?.isInternal||s.isInternal;if(r==="external"&&u||s.resolvedTime)return;let d=jA(e,a);if(e==="End"){const p={name:"w:r",elements:[{name:"w:commentReference",attributes:{"w:id":String(a)}}]};d=[d,p]}return d}const jA=(t,e)=>({name:`w:commentRange${t}`,attributes:{"w:id":String(e)}}),qA=t=>({...t,commentParaId:nf()}),VA=(t,e,n,r)=>{const o=Lv({editor:r,node:t.commentJSON}),i={"w:id":String(e),"w:author":t.creatorName||t.importedAuthor?.name,"w:email":t.creatorEmail||t.importedAuthor?.email,"w:date":Rv(t.createdTime),"w:initials":UA(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 s=n.find(a=>a.commentId===t.parentCommentId);i["w15:paraIdParent"]=s.commentParaId}return{type:"element",name:"w:comment",attributes:i,elements:[o]}},UA=t=>t?t.replace("(imported)","").trim().split(" ").map(e=>e[0]).join(""):null,Rv=t=>new Date(t||Date.now()).toISOString().replace(/\.\d{3}Z$/,"Z"),HA=(t=[],e)=>{const n=Qt(e);return t.forEach(r=>{r.elements[0].elements.unshift(_A);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},WA=(t=[],e)=>{const n=Qt(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},GA=(t=[],e,n)=>{const r=Qt(e),o=Qt(n);return r.elements[0].elements=[],o.elements[0].elements=[],t.forEach(i=>{const s=nf(),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":Rv()}};o.elements[0].elements.push(l)}),{documentIdsUpdated:r,extensibleUpdated:o}},KA=t=>{const e=Qt(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},JA=t=>{const e=Qt(t);return delete e["word/comments.xml"],delete e["word/commentsExtended.xml"],delete e["word/commentsExtensible.xml"],delete e["word/commentsIds.xml"],e},ia=t=>({...Bo.DOCUMENT_RELS_XML_DEF.elements[0].elements.find(e=>e.attributes.Target===t)}),XA=({convertedXml:t,defs:e,commentsWithParaIds:n,exportType:r,converter:o})=>{const i=[];if(r==="clean")return{documentXml:JA(t),relationships:i};const s=KA(t);s["word/comments.xml"]=HA(e,s["word/comments.xml"]),i.push(ia("comments.xml")),s["word/commentsExtended.xml"]=WA(n,s["word/commentsExtended.xml"]),i.push(ia("commentsExtended.xml"));const{documentIdsUpdated:a,extensibleUpdated:l}=GA(n,s["word/commentsIds.xml"],s["word/commentsExtensible.xml"]);return s["word/commentsIds.xml"]=a,s["word/commentsExtensible.xml"]=l,i.push(ia("commentsIds.xml")),i.push(ia("commentsExtensible.xml")),{relationships:i,documentXml:s}},Td=(t,e)=>e?["width",`${Math.max(e,t)}px`]:["min-width",`${t}px`],Bv=(t,e,n,r)=>{let o=0,i=!0;const s=[],a=[],l=t.firstChild;if(!l)return{};for(let f=0,h=0;f<l.childCount;f++){const{colspan:m,colwidth:y}=l.child(f).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]=Td(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],p=[...a];return{colgroup:d,tableWidth:c,tableMinWidth:u,colgroupValues:p}};function ki(t){const{type:e}=t.node||{},n={doc:QA,body:YA,paragraph:Lv,text:t4,bulletList:Og,orderedList:Og,lineBreak:c4,table:u4,tableRow:g4,tableCell:w4,bookmarkStart:x4,fieldAnnotation:T4,tab:p4,image:qv,hardBreak:O4,commentRangeStart:()=>$g(t,"Start"),commentRangeEnd:()=>$g(t,"End"),commentReference:()=>null,shapeContainer:M4,shapeTextbox:D4,contentBlock:_4,structuredContent:F4};return n[e]?n[e](t):(console.error("No translation function found for node type:",e),null)}function YA(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=ii(s);o[`w:${i}`]=a}),r.attributes=o}return{name:"w:body",elements:[...ar(t),e]}}function Lv(t){const e=ar(t),n=e.find(i=>i.name==="htmlAnnotation");if(n)return n.elements;const r=ZA(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 ZA(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:p}=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"]=xA(parseFloat(l))):l&&(x["w:line"]=$d(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":$d(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"]=ii(a));const k={name:"w:ind",attributes:x};n.push(k)}else if(a){const h={name:"w:ind",attributes:{"w:left":ii(a)}};n.push(h)}if(s){const h={name:"w:jc",attributes:{"w:val":s==="justify"?"both":s}};n.push(h)}if(c){const h=Kl(c),m=Pv(h);n.push(m)}u&&n.push({name:"w:keepLines",attributes:{"w:val":u}}),d&&n.push({name:"w:keepNext",attributes:{"w:val":d}}),p&&n.push({name:"w:framePr",attributes:{"w:dropCap":p.type,"w:lines":p.lines,"w:wrap":p.wrap,"w:vAnchor":p.vAnchor,"w:hAnchor":p.hAnchor}});const f=t.attrs?.paragraphProperties?.sectPr;return f&&n.push(f),n.length?{name:"w:pPr",elements:n}:null}function QA(t){const e={type:"body",content:t.node.content};return[{name:"w:document",elements:[ki({...t,node:e})],attributes:OA},t]}function ar(t){const{content:e}=t.node;if(!e)return[];const n=[];return e.forEach(r=>{let o=ki({...t,node:r});(o?.name||o?.type)!=="w:sdt"&&(o=e4(o)),o instanceof Array?n.push(...o):n.push(o)}),n.filter(r=>r)}const e4=t=>{if(!t)return t;const e=t.elements?.some(o=>o.name==="w:r"),n=t.elements?.some(o=>o.name==="w:sdt");if(!t.elements?.find(o=>o.name==="w:sdt")?.elements?.find(o=>o.name==="w:sdtPr")?.elements?.some(o=>o.name==="w:alias"))return t;let r=t;if(e&&n){const o=t.elements.filter(s=>s.name==="w:sdt"),i=t.elements.filter(s=>s.name!=="w:sdt");r=[...i.filter(s=>s.name==="w:r").every(s=>s.elements.filter(a=>a.name==="w:t")?.every(a=>a.elements[0].text.trim().length>0))?[{...t,elements:i}]:[],{name:"w:p",elements:o}]}return r};function Gl(t,e,n){const r=/^\s|\s$/.test(t)?"preserve":null,o=r?{"xml:space":r}:null,i=[],s=Kl(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(p=>{const f=p.name;return c.type===f});if(!u)return;let d="";Object.entries(c.attrs).forEach(([p,f])=>{f&&(d+=`${p}=${f};`)}),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 Us(i,s)}function t4(t){const{node:e}=t,n=[It,ut];if(e.marks?.some(i=>n.includes(i.type)))return r4(t);if(e.marks?.some(i=>i.type==="link"))return o4(t);const{text:r,marks:o=[]}=e;return Gl(r,o,t)}function n4(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=>Kl([n])).filter(n=>n!==void 0)}}function r4(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=n4(n);e.marks=n.filter(l=>!r.includes(l.type)),s&&e.marks.push(s);const a=ki({...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 Us(t,e){let n=[];return Array.isArray(t)?n=t:n=[t],e&&e.length&&n.unshift(Pv(e)),{name:"w:r",elements:n}}function Pv(t=[]){return{name:"w:rPr",elements:t.filter(e=>!!Object.keys(e).length)}}function Kl(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 Mg(o)}):Mg(e))}function o4(t){const{node:e}=t,n=e.marks.find(a=>a.type==="link"),r=n.attrs.href;let o=n.attrs.rId;o||(o=jv(t,r)),e.marks=e.marks.filter(a=>a.type!=="link");const i=ki({...t,node:e}),s=zv(i);return{name:"w:hyperlink",type:"element",attributes:{"r:id":o},elements:[s]}}function zv(t){if(!t)return t;const e=Qt(t);if(!e)return e;const n={name:"w:rStyle",attributes:{"w:val":"Hyperlink"}},r={name:"w:color",attributes:{"w:val":"467886"}};if(e.name==="w:r"){const o=e.elements.find(i=>i.name==="w:rPr");if(o){const i=o.elements.find(a=>a.name==="w:color"),s=o.elements.find(a=>a.name==="w:rStyle");i||o.elements.unshift(r),s||o.elements.unshift(n)}else{const i={name:"w:rPr",elements:[n,r]};e.elements.unshift(i)}}return e}function jv(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 Tg(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 Og(t){const{type:e}=t.node,n=l4(t),r=[];return n.forEach(o=>{const{level:i,listType:s,pPrs:a,content:l,attrs:c={}}=o,u=(o.attrs.numId||o.listId)??i4(t,s),d=a4(i,u,a);l.forEach((p,f)=>{const h=Object.assign({},p);h.attrs={...h.attrs,...o.attrs};const m=ki({...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:p.attrs.paragraphProperties?[p.attrs.paragraphProperties]:[]};return r.push(k)}const{attributes:g}=c,{originalInlineRunProps:x}=g||{};if(x&&d.elements.push(x),y===-1)m.elements.unshift(Qt(d));else{const k=Qt(d).elements.map(b=>m.elements[y].elements.find(D=>D.name===b.name)||b);m.elements[y].elements=k}if(f!==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 i4(t,e){const n=s4(t.converter?.numbering?.definitions),r=e==="bullet"?zA:PA,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 s4=t=>!t||!Object.keys(t).length?0:Math.max(...Object.keys(t).map(e=>parseInt(e,10)))+1;function a4(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 l4({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(p=>{const f=p.attrs?.indent;if(f){const{left:g,right:x,firstLine:k,hanging:b}=f,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=p.content?.filter(g=>g.type==="bulletList"||g.type==="orderedList")||[],m=p.content?.filter(g=>g.type!=="bulletList"&&g.type!=="orderedList")||[],y={...p,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 c4(t){const e={},{lineBreakType:n}=t.node?.attrs||{};return n&&(e["w:type"]=n),{name:"w:br",attributes:e}}function u4(t){t.node=d4(t.node,t);const e=ar(t),n=f4(t.node),r=m4(t.node,t);return e.unshift(n),e.unshift(r),{name:"w:tbl",elements:e}}function d4(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 p4(t){const{marks:e=[]}=t.node,n=Kl(e);return Us({name:"w:tab"},n)}function f4(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=h4(t);e.push(u)}if(a){const{width:u,type:d}=a,p={name:"w:tblInd",attributes:{"w:w":lt(u),"w:type":d}};e.push(p)}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 h4(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":Nv(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 m4(t,e){const{editorSchema:n}=e;let r=[];try{const i=n.nodeFromJSON(t),s=25,{colgroupValues:a}=Bv(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 g4(t){const e=ar(t),n=y4(t.node);return n.elements.length&&e.unshift(n),{name:"w:tr",elements:e}}function y4(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 w4(t){const e=ar({...t,tableCell:t.node}),n=b4(t.node);return e.unshift(n),{name:"w:tc",elements:e}}function b4(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):ii(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:p}=n;if(p){const m={name:"w:tcMar",elements:v4(p)};e.push(m)}const{verticalAlign:f}=n;if(f){const m={name:"w:vAlign",attributes:{"w:val":f}};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":Nv(g.size),"w:space":g.space||0}}:{name:`w:${y}`,attributes:{"w:val":"nil"}})};e.push(m)}return{name:"w:tcPr",elements:e}}function v4(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 x4(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 Mg(t){const e=Nr.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=>{const a=o.split(", ");n.attributes[s]=a[0]?a[0]:o});break;case"color":let i=r.color.replace(/^#/,"").replace(/;$/,"");i.startsWith("rgb")&&(i=$A(i)),n.attributes["w:val"]=i;break;case"textAlign":n.attributes["w:val"]=r.textAlign;break;case"textIndent":n.attributes["w:firstline"]=ii(r.textIndent);break;case"lineHeight":n.attributes["w:line"]=$d(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 k4(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 S4(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 qv(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}=k4(s);let c=n.size?{w:Vr(n.size.width),h:Vr(n.size.height)}:e;if(a&&l){const m=Gt(c.w),y=Gt(c.h),{scaledWidth:g,scaledHeight:x}=S4(a,l,m,y);c={w:Vr(g),h:Vr(x)}}if(o){const m=o.attrs.colwidth.reduce((T,D)=>T+D,0),y=o.attrs.cellMargins?.left||8,g=o.attrs.cellMargins?.right||8,x=Vr(m-(y+g)),{width:k,height:b}=N4(c.w,c.h,x);k&&b&&(c={w:k,h:b})}if(t.node.type==="image"&&!i){const m=s?.split("word/")[1];i=Tg(t,m)}else if(t.node.type==="fieldAnnotation"&&!i){const m=s?.split(";")[0].split("/")[1];if(!m)return Vv(t);const y=Xn(4),g=n.fieldId.replace("-","_"),x=`media/${g}_${y}.${m}`;i=Tg(t,x),t.media[`${g}_${y}.${m}`]=s}let u=n.originalPadding||{distT:0,distB:0,distL:0,distR:0};const d=[];let p=[];n.isAnchor&&(u={...u,simplePos:n.originalAttributes?.simplePos,relativeHeight:1,behindDoc:n.originalAttributes?.behindDoc,locked:n.originalAttributes?.locked,layoutInCell:n.originalAttributes?.layoutInCell,allowOverlap:n.originalAttributes?.allowOverlap},n.simplePos&&d.push({name:"wp:simplePos",attributes:{x:0,y:0}}),n.anchorData&&(d.push({name:"wp:positionH",attributes:{relativeFrom:n.anchorData.hRelativeFrom},...n.marginOffset.left&&{elements:[{name:"wp:posOffset",elements:[{type:"text",text:Vr(n.marginOffset.left).toString()}]}]},...n.anchorData.alignH&&{elements:[{name:"wp:align",elements:[{type:"text",text:n.anchorData.alignH}]}]}}),d.push({name:"wp:positionV",attributes:{relativeFrom:n.anchorData.vRelativeFrom},...n.marginOffset.top&&{elements:[{name:"wp:posOffset",elements:[{type:"text",text:Vr(n.marginOffset.top).toString()}]}]},...n.anchorData.alignV&&{elements:[{name:"wp:align",elements:[{type:"text",text:n.anchorData.alignV}]}]}})),n.wrapText&&p.push({name:"wp:wrapSquare",attributes:{wrapText:n.wrapText}}),n.wrapTopAndBottom&&p.push({name:"wp:wrapTopAndBottom"}));const f="http://schemas.openxmlformats.org/drawingml/2006/main",h="http://schemas.openxmlformats.org/drawingml/2006/picture";return Us({name:"w:drawing",elements:[{name:n.isAnchor?"wp:anchor":"wp:inline",attributes:u,elements:[...d,{name:"wp:extent",attributes:{cx:c.w,cy:c.h}},{name:"wp:effectExtent",attributes:{l:0,t:0,r:0,b:0}},...p,{name:"wp:docPr",attributes:{id:n.id||0,name:n.alt,descr:n.title}},{name:"wp:cNvGraphicFramePr",elements:[{name:"a:graphicFrameLocks",attributes:{"xmlns:a":f,noChangeAspect:1}}]},{name:"a:graphic",attributes:{"xmlns:a":f},elements:[{name:"a:graphicData",attributes:{uri:h},elements:[{name:"pic:pic",attributes:{"xmlns:pic":h},elements:[{name:"pic:nvPicPr",elements:[{name:"pic:cNvPr",attributes:{id:n.id||0,name:n.title}},{name:"pic:cNvPicPr",elements:[{name:"a:picLocks",attributes:{noChangeAspect:1,noChangeArrowheads:1}}]}]},{name:"pic:blipFill",elements:[{name:"a:blip",attributes:{"r:embed":i}},{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"}]},{name:"a:noFill"}]}]}]}]}]}]},[])}function Vv(t){const{node:{attrs:e={},marks:n=[]}}=t,r=Uv(e);return Gl(e.displayLabel,[...n,...r],t)}function E4(t){const{node:{attrs:e={},marks:n=[]}}=t,r=gC.decode(e.displayLabel);return Gl(r,n,t)}function C4(t){const{node:{attrs:e={},marks:n=[]},editorSchema:r}=t,o=new window.DOMParser().parseFromString(e.rawHtml||e.displayLabel,"text/html"),i=Uv(e),s=[...n,...i];let a=Zi.create({doc:$r.fromSchema(r).parse(o)});s.length&&(a=I4(a,s));const l=a.doc.toJSON();return{name:"htmlAnnotation",elements:ar({...t,node:l})}}function Dg(t,e){return qv(t,e)}function A4(t){const{node:{attrs:e={},marks:n=[]}}=t,r=jv(t,e.linkUrl),o=Gl(e.linkUrl,n,t),i=zv(o);return{name:"w:hyperlink",type:"element",attributes:{"r:id":r,"w:history":1},elements:[i]}}function $4(t){const e={w:4286250,h:4286250},n={w:99e4,h:495e3};return{text:Vv,image:r=>Dg(r,e),signature:r=>Dg(r,n),checkbox:E4,html:C4,link:A4}[t]}const Uv=(t={})=>{const{fontFamily:e,fontSize:n,bold:r,underline:o,italic:i,textColor:s,textHighlight:a}=t,l=[];return e&&l.push({type:"fontFamily",attrs:{fontFamily:e}}),n&&l.push({type:"fontSize",attrs:{fontSize:n}}),r&&l.push({type:"bold",attrs:{}}),o&&l.push({type:"underline",attrs:{}}),i&&l.push({type:"italic",attrs:{}}),s&&l.push({type:"color",attrs:{color:s}}),a&&l.push({type:"highlight",attrs:{color:a}}),l};function T4(t){const{node:e,isFinalDoc:n}=t,{attrs:r={}}=e,o=$4(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:fieldFontFamily",attributes:{"xmlns:w":a,"w:val":r.fontFamily}},{name:"w:fieldFontSize",attributes:{"xmlns:w":a,"w:val":r.fontSize}},{name:"w:fieldTextColor",attributes:{"xmlns:w":a,"w:val":r.textColor}},{name:"w:fieldTextHighlight",attributes:{"xmlns:w":a,"w:val":r.textHighlight}}]},{name:"w:sdtContent",elements:s}]}}function O4(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 M4(t){const{node:e}=t,n=ar(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:[Us(o)]}}function D4(t){const{node:e}=t,n={name:"w:txbxContent",elements:ar(t)};return{name:"v:textbox",attributes:{...e.attrs.attributes},elements:[n]}}function _4(t){const{node:e}=t,{drawingContent:n}=e.attrs,r={name:"w:drawing",elements:[...n?[...n.elements||[]]:[]]};return{name:"w:p",elements:[Us({name:"mc:AlternateContent",elements:[{name:"mc:Choice",attributes:{Requires:"wps"},elements:[r]}]})]}}var Kr,Hv,yu,wu;let _g=class{constructor(e){ob(this,Kr),this.converter=e}schemaToXml(e,n=!1){return Yn(this,Kr,Hv).call(this,e,n).join("")}};Kr=new WeakSet,Hv=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,Kr,wu).call(this,n,e);return[o,...i]},yu=function(t){if(t)return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")},wu=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,Kr,yu).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,Kr,yu).call(this,r[0].text);a.push(l)}else if(r)for(let l of r){const c=Yn(this,Kr,wu).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 N4(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}}function I4(t,e){const{tr:n,doc:r,schema:o}=t,i=["fontFamily","fontSize","highlight"];if(!e.some(d=>i.includes(d.type)))return t;const s=e.find(d=>d.type==="fontFamily"),a=e.find(d=>d.type==="fontSize"),l=e.find(d=>d.type==="highlight"),c=o.marks.textStyle,u=o.marks.highlight;return r.descendants((d,p)=>{if(!d.isText)return;const f=d.marks.find(m=>m.type.name==="textStyle"),h=d.marks.find(m=>m.type.name==="highlight");f?!f?.attrs.fontFamily&&s?n.addMark(p,p+d.nodeSize,c.create({...f?.attrs,...s.attrs})):!f?.attrs.fontSize&&a&&n.addMark(p,p+d.nodeSize,c.create({...f?.attrs,...a.attrs})):n.addMark(p,p+d.nodeSize,c.create({...s?.attrs,...a?.attrs})),h||n.addMark(p,p+d.nodeSize,u.create({...l?.attrs}))}),t.apply(n)}function F4(t){const{node:e}=t,{attrs:n={}}=e,r=[{name:"w:sdtContent",elements:ar({...t,nodes:e.content})}];return r.unshift(n.sdtPr),{name:"w:sdt",elements:r}}const R4='<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>',B4=t=>JSON.parse(Yp.xml2json(t,null,2)),L4=(t,e=R4)=>t["word/document.xml"]||B4(e),P4=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:[j4(n,t)],consumed:1}}return{nodes:[],consumed:0}},z4={handlerName:"tableNodeHandler",handler:P4};function j4(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}=Gv(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 p=Wv(l,n),f=o.elements.find(k=>k.name==="w:tblW");f&&(c.tableWidth={width:nt(f.attributes["w:w"]),type:f.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:p?.borders,g=Object.keys(a)?.length?a:p?.rowBorders;c.borders=y;const x=[];return m.forEach(k=>{const b=U4(k,t,g,l,e);b.content?.length&&x.push(b)}),{type:"table",content:x,attrs:c}}function q4(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"),p=V4(d,r),f=Kv(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=Ng(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=Wv(i,l)||{};M.cellMargins=H4(T,I);const{fontSize:C,fonts:V={}}=I,oe=V.ascii;if(m){M.colwidth=[m],M.widthUnit="px";const N=f,W=f&&f.length>0,E=parseInt(b,10);if(E&&E>1&&W){let K=[];for(let ie=0;ie<E;ie++){let G=N[a+ie];typeof G<"u"?K.push(G):K.push(100)}K.length&&(M.colwidth=[...K])}}if(y&&(M.widthType=y),b&&(M.colspan=parseInt(b,10)),k&&(M.background=k),M.verticalAlign=D,C&&(M.fontSize=C),oe&&(M.fontFamily=oe.ascii),r&&(M.borders={...r}),p&&(M.borders=Object.assign(M.borders||{},p)),x&&x["w:val"]==="restart"){const N=n.elements.filter(G=>G.name==="w:tr"),W=N.findIndex(G=>G===e),E=N.slice(W+1);let K=e.elements.filter(G=>G.name==="w:tc").findIndex(G=>G===t),ie=1;for(let G of E){const ce=G.elements.findIndex(R=>R.name==="w:tc"),J=G.elements[ce+K];if(!J)break;const ue=Ng(J),{attributes:Z}=ue||{};if(!ue&&!Z||Z&&Z["w:val"]==="restart")break;ie++,G.elements.splice(ce+K,1)}M.rowspan=ie}return{type:"tableCell",content:c.handler({...s,nodes:t.elements}),attrs:M}}const Ng=t=>t.elements.find(e=>e.name==="w:tcPr")?.elements?.find(e=>e.name==="w:vMerge"),sa=(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=_v(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},V4=(t,e)=>{if(!t)return null;const n={},r=sa(t,"bottom",e);r&&(n.bottom=r);const o=sa(t,"top",e);o&&(n.top=o);const i=sa(t,"left",e);i&&(n.left=i);const s=sa(t,"right",e);return s&&(n.right=s),n};function Wv(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 p=c.elements.find(m=>m.name==="w:pPr");if(p){const m=p.elements.find(y=>y.name==="w:jc");m?.attributes&&(r.justification=m.attributes["w:val"])}const f=c?.elements.find(m=>m.name==="w:rPr");if(f){const m=f.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=f.elements.find(g=>g.name==="w:sz");y?.attributes&&(r.fontSize=vA(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}=Gv(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 Gv(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=_v(c)),["insideH","insideV"].includes(i)&&(n[i]=a),e[i]=a}),{borders:e,rowBorders:n}}function U4(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=Kv(e),u=t.elements.filter(d=>d.name==="w:tc");return{type:"tableRow",content:u?.map((d,p)=>{const f=u.length>1?c[p]:null;return q4(d,t,e,l,f,r,o,p)})||[],attrs:i}}const H4=(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:p,marginTop:f,marginBottom:h}=u;return{left:nt(s??d),right:nt(a??p),top:nt(l??f),bottom:nt(c??h)}},Kv=t=>t.elements.find(e=>e.name==="w:tblGrid")?.elements?.flatMap(e=>e.name!=="w:gridCol"?[]:nt(e.attributes["w:w"]))||[],W4=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(d=>d.name==="w:drawing"),!i)return{nodes:[],consumed:0};let s;const{elements:a}=i,l=n||null,c=a.find(d=>d.name==="wp:anchor");c&&(s=Ig(a[0],l,t),s.attrs.isAnchor=c);const u=a.find(d=>d.name==="wp:inline");return u&&(s=Ig(u,l,t)),{nodes:s?[s]:[],consumed:1}};function Ig(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(J=>J.name==="wp:extent"),a={width:Gt(s.attributes?.cx),height:Gt(s.attributes?.cy)},l=t.elements.find(J=>J.name==="a:graphic").elements.find(J=>J.name==="a:graphicData"),{uri:c}=l?.attributes;if(c&&c==="http://schemas.microsoft.com/office/word/2010/wordprocessingShape")return G4(n,t,l);const u=l.elements.find(J=>J.name==="pic:pic");if(!u||!u.elements)return null;const d=u.elements.find(J=>J.name==="pic:blipFill").elements.find(J=>J.name==="a:blip"),p=t.elements.find(J=>J.name==="wp:positionH"),f=p?.elements.find(J=>J.name==="wp:posOffset"),h=Gt(f?.elements[0]?.text),m=p?.attributes.relativeFrom,y=p?.elements.find(J=>J.name==="wp:align")?.elements[0]?.text,g=t.elements.find(J=>J.name==="wp:positionV"),x=g?.elements.find(J=>J.name==="wp:posOffset"),k=Gt(x?.elements[0]?.text),b=g?.attributes.relativeFrom,T=g?.elements.find(J=>J.name==="wp:align")?.elements[0]?.text,D=t.elements.find(J=>J.name==="wp:simplePos"),M=t.elements.find(J=>J.name==="wp:wrapSquare"),I=t.elements.find(J=>J.name==="wp:wrapTopAndBottom"),C=t.elements.find(J=>J.name==="wp:docPr");let V=null;(m||y||b||T)&&(V={hRelativeFrom:m,vRelativeFrom:b,alignH:y,alignV:T});const oe={left:h,top:k},{attributes:N}=d,W=N["r:embed"];let E=r[`word/_rels/${e||"document.xml"}.rels`];E||(E=r["word/_rels/document.xml.rels"]);const K=E.elements.find(J=>J.name==="Relationships"),{elements:ie}=K,G=ie.find(J=>J.attributes.Id===W),{attributes:ce}=G;return{type:"image",attrs:{src:`word/${ce.Target}`,alt:C?.attributes.name||"Image",id:C?.attributes.id||"",title:C?.attributes.descr||"Image",inline:!0,padding:i,marginOffset:oe,size:a,anchorData:V,...D&&{simplePos:{x:D.attributes.x,y:D.attributes.y}},...M&&{wrapText:M.attributes.wrapText},wrapTopAndBottom:!!I,originalPadding:{distT:o.distT,distB:o.distB,distL:o.distL,distR:o.distR},originalAttributes:t.attributes,rId:ce.Id}}}const G4=(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 K4(t,i);if(!o)return null;const{nodeListHandler:a}=t;return a.handler({...t,node:o.elements[0],nodes:o.elements})[0]},K4=(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}},J4={handlerName:"drawingNodeHandler",handler:W4};function si(t,e=[],n=null){const r=[],o=new Set;return t?.elements?.forEach(i=>{const s=Nr.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=Y4(a.type,l,n);if(u==null)return;c.attrs={},c.attrs[a.property]=u}r.push(c)}})}),Od(r)}function X4(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=si(n);return[{type:vt,attrs:{...o,before:i,after:[...e]}}]}function Od(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 Y4(t,e,n){t==="tabs"&&(t="textIndent");const r={color:()=>`#${e["w:val"]}`,fontSize:()=>`${e["w:val"]/2}pt`,textIndent:()=>Q4(e),fontFamily:()=>Z4(e,n),lineHeight:()=>e6(e),textAlign:()=>e["w:val"],link:()=>e.href,underline:()=>e["w:val"],bold:()=>e?.["w:val"]||null,italic:()=>e?.["w:val"]||null,highlight:()=>t6(e)};if(t in r||console.debug("❗️❗️ No value mapper for:",t,"Attributes:",e),t in r)return r[t],r[t]()}function Z4(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 Q4(t){let e=t["w:left"];return e?`${Wt(e)}in`:null}function e6(t){const e=t["w:line"],n=t["w:lineRule"];return!e||e==="0"?null:n==="exact"?`${Iv(e)}pt`:`${Jo(e)}`}function t6(t){const e=t["w:fill"];return e&&e!=="auto"?`#${e}`:CA(t?.["w:val"])?`#${t["w:val"]}`:EA(t?.["w:val"])||null}function ho(t,e){const n=[],r=[],{attributes:o={},elements:i=[]}=t,{nodes:s,paragraphProperties:a={},runProperties:l={}}=n6(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(...si(l,r)),a&&a.elements?.length&&n.push(...si(a,r)),n.push(...X4(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 n6(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 ja(t){return Nr.allowedElements[t.name||t.type]}const r6=t=>!!Nr.propertyTypes[t.name||t.type];function Jv(t){return t.filter(e=>e.name==="w:r").some(e=>e.elements.some(n=>n.name==="w:t"))}const o6=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(p=>p.name==="w:sdtContent")?.elements.find(p=>["w:ins","w:del"].includes(p.name));d&&(o=d)}if(!o)return{nodes:[],consumed:0};const{name:i}=o,{attributes:s,elements:a}=ho(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}},i6={handlerName:"trackChangeNodeHandler",handler:o6},s6=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 p=d.Target;c&&!p&&(p=`#${c}`);const f=o.elements.filter(m=>m.name==="w:r"),h={type:"link",attrs:{href:p,rId:l}};for(const m of f){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:f}),consumed:1}},a6={handlerName:"hyperlinkNodeHandler",handler:s6},l6=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=c6(o,r);if(l){const{marks:u=[],attributes:d={}}=ho(i),p=u.find(m=>m.type==="textStyle"),f=p&&Object.keys(p.attrs).length>0;c.marks&&!f&&u.push(...c.marks),i.marks&&u.push(...i.marks);const h=Od(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:Od(c.marks)})));return{nodes:a,consumed:1}},c6=(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?ho(r):{}},u6={handlerName:"runNodeHandler",handler:l6},d6=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=[]}=ho(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:ja(r),text:l,attrs:{type:o,attributes:i||{}},marks:a}],consumed:1}},p6={handlerName:"textNodeHandler",handler:d6},Xv=t=>{if(!t||!Array.isArray(t))return t;let e=[],n=null;for(let r of t)r.type==="text"?n&&f6(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},f6=(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||!h6(n[o].attrs,r[o].attrs))return!1;return!0},h6=(t={},e={})=>oi(t,e),m6=t=>{const{nodes:e,lists:n,docx:r}=t;if(e.length===0||e[0].name!=="w:p")return{nodes:[],consumed:0};const o=Qt(e[0]),i=n1(o.elements);o.elements=i;const s=o.elements.find(a=>a.name==="w:pPr");if(Md(o,r)){const a=Qt(e),l=[];let c=a.shift();for(;c&&Md(c,r);)l.push(c),c=a.shift(),c?.elements&&!Jv(c.elements)&&(l.push(c),c=a.shift());return{nodes:[Yv({listItems:l,params:t,originalPpr:s})],consumed:l.filter(u=>u.seen).length,lists:n}}else return{nodes:[],consumed:0,lists:n}},g6={handlerName:"listHandler",handler:m6};function Yv({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 p,f;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=Jl({node:t[0],styleId:m,docx:l});i=ai(y),o=parseInt(y?.elements?.find(k=>k.name==="w:ilvl")?.attributes["w:val"])||0,o===void 0&&(o=Zv(m,l));let g=0;for(let[k,b]of t.entries()){if(b.seen)continue;if(b.elements&&!Jv(b.elements)){const O=h({...n,nodes:[b]}).nodes[0];O&&d[d.length-1]?.content.push(O),b.seen=!0;continue}const{attributes:T,elements:D,marks:M=[]}=ho(b),I=rf(m,l)||{},{marks:C}=ho(I),V=M.find(O=>O.type==="textStyle"),oe=C?.find(O=>O.type==="textStyle"),{listType:N,listOrderingType:W,ilvl:E,listrPrs:K,listpPrs:ie,start:G,lvlText:ce,lvlJc:J,numId:ue}=v6(b,r,l);f=W;const Z=parseInt(E),R=o===Z&&ue===i,ee=b6({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 X={};if(R&&!se){p=N,b.seen=!0;const O=[];let A={type:"paragraph",content:c.handler({...n,nodes:[T.paragraphProperties,...D]})?.filter(S=>S)};A.content&&(A={...A,attrs:{textAlign:V?.attrs.textAlign||oe?.attrs.textAlign||null,rsidRDefault:T?.["w:rsidRDefault"]||null,styleId:m},content:Xv(A.content)}),O.push(A),g=r;let U=[];if(f!=="bullet"&&(U=[...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])}),U=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"])),X.indent=S}ie&&(X.listParagraphProperties=ie),K&&(X.listRunProperties=K),X.textStyle=V,X.order=G,X.lvlText=ce,X.lvlJc=V?.attrs.textAlign,X.listLevel=U,X.listNumberingType=W,X.attributes={parentAttributes:b?.attributes||null};const B=e?.elements?.find(S=>S.name==="w:rPr");B&&(X.attributes.originalInlineRunProps=B),X.numId=ue,l&&(X.spacing=e1(b,l,m));const le=Fg(O,X,[]);d.push(le)}else if(se){const O=[...s,u[i][r]],A=Yv({listItems:t.slice(k),originalPpr:e,params:n,listLevel:r+1,actualListLevel:r,currentListNumId:ue,path:O,isNested:!0});g=A.lastNestedListLevel,delete A.lastNestedListLevel;const U=d[d.length-1];U?U.content.push(A):d.push(Fg([A],X,[]))}else if(ue){g=r,r>0&&b.elements[0].elements.find(O=>O.name==="w:numPr")&&(u[i][r]=0);break}else{b.seen=!0;const O=h({...n,nodes:[b]}).nodes[0];d[d.length-1]?.content.push(O)}}const x={type:p||"bulletList",content:d,attrs:{"list-style-type":f,listId:i,attributes:{parentAttributes:t[0]?.attributes||null}}};return a&&(x.lastNestedListLevel=g),x}const Zv=(t,e)=>{const n=rf(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 Md(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=ai(i);const a=o?.attributes["w:val"];return a&&!s&&(i=Jl({node:t,styleId:a,docx:e}),s=ai(i)),!!s}const ai=t=>t?.elements?.find(e=>e.name==="w:numId")?.attributes["w:val"];function rf(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 Jl({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=ai(o);if(i)return o;const s=rf(e,n);o=s?.elements?.find(l=>l.name==="w:pPr")?.elements?.find(l=>l.name==="w:numPr"),i=ai(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?Jl({styleId:l,docx:n,seenStyleIds:r}):null}return o}function Fg(t,e,n){return{type:"listItem",content:t,attrs:e,marks:n}}const y6=["decimal","decimalZero","lowerRoman","upperRoman","lowerLetter","upperLetter","ordinal","cardinalText","ordinalText","hex","chicago","none"],w6=["bullet","square","circle","disc"],b6=({firstListId:t,secondListId:e,level:n,pStyleId:r,docx:o})=>{const{numFmt:i,lvlText:s,lvlJc:a}=ul(t,n,r,o),{numFmt:l,lvlText:c,lvlJc:u}=ul(e,n,r,o);return i===l&&s===c&&a===u},Rg=(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=ai(a),u=a?.elements?.find(h=>h.name==="w:ilvl"),d=u?.attributes?.["w:val"];const p=i?.elements?.find(h=>h.name==="w:basedOn")?.attributes?.["w:val"];let f=0;for(;a&&!c&&f<10;)a=(o.find(h=>h.attributes["w:styleId"]===p)||{})?.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"]),f++;return{numId:c,ilvl:d}},ul=(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}=Rg(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=x6(u,e),p=u?.elements?.find(k=>k.name==="w:numStyleLink")?.attributes["w:val"];if(p){const k=Rg(p,r);return ul(k.numId,e,null,r)}const f=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:f,numFmt:h,lvlText:m,lvlJc:y,pPr:g,rPr:x}};function v6(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=Jl({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"]||Zv(s,n),u=i.find(b=>b.name==="w:pStyle")?.attributes["w:val"],{start:d,numFmt:p,lvlText:f,lvlJc:h,pPr:m,rPr:y}=ul(l,e,u,n);let g,x;m&&(g=k6(m)),y&&(x=S6(y));let k;if(w6.includes(p?.toLowerCase()))k="bulletList";else if(y6.includes(p))k="orderedList";else return{};return{listType:k,listOrderingType:p,ilvl:c,numId:l,listrPrs:x,listpPrs:g,start:d,lvlText:f,lvlJc:h}}function x6(t,e){return t?.elements?.find(n=>Number(n.attributes["w:ilvl"])===e)}function k6(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 S6(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 Qv=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=Qt(e[0]);let s,a=n1(i.elements);if(i.elements=a,Md(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"),p=d?.elements?.find(b=>b.name==="w:pStyle"),f=d?.elements?.find(b=>b.name==="w:rPr"),h=d?.elements?.find(b=>b.name==="w:framePr");if(f){let b=si(f,[]);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(p&&(m=p.attributes["w:val"],s.attrs.styleId=m),n){const b=E6(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=e1(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:Xv(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}},E6=(t,e,n="")=>{const r={left:0,right:0,firstLine:0,hanging:0,textIndent:0},{indent:o={}}=t1(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},e1=(t,e,n="",r=[])=>{const o={lineSpaceAfter:0,lineSpaceBefore:0,line:0,lineRule:null},{spacing:i={}}=t1(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,p=u?.["w:line"]||l||i?.["w:line"];p&&(o.line=Jo(p));const f=u?.["w:lineRule"]||c||i?.["w:lineRule"];f&&(o.lineRule=f),f==="exact"&&p&&(o.line=`${Iv(p)}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},t1=(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:p}=o,{attributes:f}=a,{attributes:h}=c,{attributes:m}=d,{attributes:y}=i,{attributes:g}=l,{attributes:x}=u;return{spacing:h||p||f,indent:x||y||g,justify:m}},C6={handlerName:"paragraphNodeHandler",handler:Qv};function A6(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"),p=c?.elements?.find(ie=>ie.name==="w:ind");let f,h,m;u&&(f=nt(u?.attributes["w:before"]),h=nt(u?.attributes["w:after"]),m=Jo(u?.attributes["w:line"]));let y,g,x,k;p&&(y=d?.attributes["w:val"],g=nt(p?.attributes["w:left"]),x=nt(p?.attributes["w:right"]),k=nt(p?.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 C=0;I&&(I.attributes?.["w:val"]?C=Number(I?.attributes?.["w:val"]):C=1);const V=c?.elements?.find(ie=>ie.name==="w:pageBreakAfter");let oe;V&&(V.attributes?.["w:val"]?oe=Number(V?.attributes?.["w:val"]):oe=1);const N={name:l,qFormat:!!a,keepNext:!!b,keepLines:!!T,outlineLevel:D?parseInt(M):null,pageBreakBefore:!!C,pageBreakAfter:!!oe},W=s.elements.find(ie=>ie.name==="w:rPr"),E=si(W,[],e)||{},K={spacing:{lineSpaceAfter:h,lineSpaceBefore:f,line:m},textAlign:y,indent:{leftIndent:g,rightIndent:x,firstLine:k}};return E.forEach(ie=>{const{type:G,attrs:ce}=ie;if(G==="textStyle"){Object.entries(ce).forEach(([J,ue])=>{K[ll(J)]=ue});return}K[G]=ce}),{attrs:N,styles:K}}function n1(t=[]){const e=[];let n=[],r=!1;for(const o of t){const i=o.elements?.find(s=>s.name==="w:fldChar")?.attributes?.["w:fldCharType"];if(i==="begin"){n=[o],r=!0;continue}if(i==="separate"&&r){n.push(o);continue}if(i==="end"&&r){n.push(o),e.push(...$6(n)),n=[],r=!1;continue}r?n.push(o):e.push(o)}return n.length&&e.push(...n),e}const $6=(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(p=>{const f=p.elements.find(m=>m.name==="w:rPr");if(!f)return;const{elements:h}=f;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},T6=t=>nodeListHandler.handler({...t,nodes:node.elements}),O6=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(!Bg[r])return{nodes:[],consumed:0};const o=n?.elements.find(s=>s.name==="w:sdtContent"),i=Bg[r];return{nodes:i({...t,nodes:[o]}),consumed:1}},Bg={"Table of Contents":T6},M6=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(M=>M.name==="w:sdtPr"),a=i.elements.find(M=>M.name==="w:sdtContent"),l=s?.elements.find(M=>M.name==="w:fieldTypeShort")?.attributes["w:val"],{attrs:c,marks:u}=r1(a);if(s?.elements.find(M=>M.name==="w:docPartObj"))return O6({nodes:e,docx:n,nodeListHandler:r,insideTrackChange:o});const d=s?.elements.find(M=>M.name==="w:alias"),p=s?.elements.find(M=>M.name==="w:tag"),f=s?.elements.find(M=>M.name==="w:fieldType")?.attributes["w:val"],h=s?.elements.find(M=>M.name==="w:fieldColor")?.attributes["w:val"],m=s?.elements.find(M=>M.name==="w:fieldMultipleImage")?.attributes["w:val"],y=s?.elements.find(M=>M.name==="w:fieldFontFamily")?.attributes["w:val"],g=s?.elements.find(M=>M.name==="w:fieldFontSize")?.attributes["w:val"],x=s?.elements.find(M=>M.name==="w:fieldTextColor")?.attributes["w:val"],k=s?.elements.find(M=>M.name==="w:fieldTextHighlight")?.attributes["w:val"],b={type:l,fieldId:p?.attributes["w:val"],displayLabel:d?.attributes["w:val"],fieldType:f,fieldColor:h,multipleImage:m==="true",fontFamily:y!=="null"?y:null,fontSize:g!=="null"?g:null,textColor:x!=="null"?x:null,textHighlight:k!=="null"?k:null},T={...b,...c};if(!b.fieldId||!b.displayLabel)return{nodes:[],consumed:0};let D={type:"text",text:`{{${b.displayLabel}}}`,attrs:T,marks:u};return t.editor.options.annotations&&(D={type:"fieldAnnotation",attrs:T}),{nodes:[D],consumed:1}},r1=(t={},e)=>{const n=t.elements?.find(s=>s.name==="w:r")?.elements?.find(s=>s.name==="w:rPr");if(!n)return{};const r=si(n,[])||[],o=[];r.forEach(s=>{const{type:a}=s;if(a==="textStyle"){const{attrs:l}=s;Object.keys(l).forEach(c=>{o.push({type:c,attrs:l[c]})})}else o.push(s)});const i={};return o?.forEach(s=>{const{type:a}=s;i[a]=s.attrs||!0}),{attrs:i,marks:r}},D6={handlerName:"annotationNodeHandler",handler:M6},_6=t=>{const{nodes:e,nodeListHandler:n}=t;if(e.length===0||e[0].name!=="w:sdt")return{nodes:[],consumed:0};const r=e[0],o=r.elements.find(a=>a.name==="w:sdtPr"),i=r.elements.find(a=>a.name==="w:sdtContent"),{marks:s}=r1(i);return{nodes:[{type:"structuredContent",content:n.handler({...t,nodes:i?.elements}),marks:s,attrs:{sdtPr:o}}],consumed:1}},N6={handlerName:"sdtNodeHandler",handler:_6},I6=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=[]}=ho(o);if(i==="w:sdt")return{nodes:[],consumed:0};if(r6(o))return{nodes:[{type:ja(o),attrs:{...s},marks:[]}],consumed:0};if(!ja(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)),p={...t,nodes:d,parentStyleId:u},f=r.handler(p);c.push(...f)}return{nodes:[{type:ja(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},R6={handlerName:"standardNodeHandler",handler:I6},B6=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}},L6={handlerName:"lineBreakNodeHandler",handler:B6},P6=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"]),p=e.slice(1,d),f=t.nodeListHandler,h={};o.attributes["w:name"].split(";").forEach(y=>{const[g,x]=y.split("=");g&&x&&(h[g]=x)});const m=f.handler({...t,nodes:p});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},z6={handlerName:"bookmarkNodeHandler",handler:P6},j6=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}},q6={handlerName:"alternateChoiceHandler",handler:j6},V6=t=>{const{nodes:e}=t;return e.length===0||e[0].name!=="sd:autoPageNumber"?{nodes:[],consumed:0}:{nodes:[{type:"page-number"}],consumed:1}},U6={handlerName:"autoPageNumberHandler",handler:V6},H6=t=>{const{nodes:e}=t;return e.length===0||e[0].name!=="sd:totalPageNumber"?{nodes:[],consumed:0}:{nodes:[{type:"total-page-number"}],consumed:1}},W6={handlerName:"autoTotalPageCountEntity",handler:H6},G6=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}},K6={handlerName:"tabNodeHandler",handler:G6},J6=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=X6({pict:r,pNode:n,shape:i,params:t})),{nodes:a?[a]:[],consumed:1}};function X6({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=Y6(s.style),l=Z6(a);l&&(o.style=l);const c=n.elements?.find(p=>p.name==="v:textbox"),u=n.elements?.find(p=>p.name==="w10:wrap");u?.attributes&&(o.wrapAttributes=u.attributes),c?.attributes&&(i.attributes=c.attributes);const d=(c?.elements?.find(p=>p.name==="w:txbxContent")?.elements||[]).map(p=>Qv({nodes:[p],docx:r.docx,nodeListHandler:gs()})).reduce((p,f)=>[...p,...f.nodes],[]);return{type:"shapeContainer",attrs:o,content:[{type:"shapeTextbox",attrs:i,content:d}]}}function Y6(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 Z6(t){const e=["width","height"];let n="";for(const[r,o]of Object.entries(t))e.includes(r)&&(n+=`${r}: ${o};`);return n}const Q6={handlerName:"handlePictNode",handler:J6};function e$({docx:t}){const e=gs(),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"],p=a["w:date"],f=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(p).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:f||Lr(),importedId:l,creatorName:c,creatorEmail:u,createdTime:x,textJson:D[0],initials:d,paraId:I,trackedChange:h,trackedChangeText:y,trackedChangeType:m,trackedDeletedText:g}});return t$({docx:t,comments:i})}const t$=({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}=n$(a);let u;return c&&(u=e.find(d=>d.paraId===c)),{...s,isDone:l,parentCommentId:u?.commentId}})},n$=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}},r$=(t,e,n)=>{const r=Qt(L4(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=gs(),i=r.elements[0].elements.find(s=>s.name==="w:body");if(i){const s=i,a=["w:sectPr"],l=s.elements?.filter(p=>!a.includes(p.name))??[],c=e$({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:i$(s,t,e,n),comments:c,linkedStyles:s$(t),numbering:c$(t)}}return null},gs=()=>{const t=[q6,u6,Q6,C6,g6,p6,L6,D6,N6,z6,a6,J4,i6,z4,K6,U6,W6,R6];return{handler:o$(t),handlerEntities:t}},o$=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 p=0;p<r.length;p++)try{const f=r.slice(p);if(!f||f.length===0)continue;const{nodes:h,consumed:m,unhandled:y}=t.reduce((x,k)=>x.consumed>0?x:k.handler({nodes:f,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,p,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&&(p+=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(f){console.debug("Import error",f),a?.emit("exception",{error:f}),s?.telemetry?.trackStatistic("error",{type:"processing_error",message:f.message,name:f.name,stack:f.stack,fileName:`/word/${l||"document.xml"}`})}return d}catch(p){throw console.debug("Error during import",p),a?.emit("exception",{error:p}),s?.telemetry?.trackStatistic("error",{type:"fatal_error",message:p.message,name:p.name,stack:p.stack,fileName:`/word/${l||"document.xml"}`}),p}};return n};function i$(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}}),l$(e,n,r),i.alternateHeaders=u$(e),i}function s$(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=A6(s,t),l={id:i.attributes["w:styleId"],type:i.attributes["w:type"],definition:a,attributes:{}};o.push(l)}),o}function a$(t){if(!t)return null;const e=Qt(t),{elements:n}=e.elements[0];return Object.keys(Ag).forEach(r=>{if(!n.some(o=>o.attributes?.["w:styleId"]===r)){const o=Ag[r];e.elements[0].elements.push(o)}}),e}const l$=(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=(o1(t["word/document.xml"])||[]).flatMap(u=>u.elements);a.forEach(u=>{const{rId:d,referenceFile:p,currentFileName:f}=Lg(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=gs(),y=m.handler({nodes:p.elements[0].elements,nodeListHandler:m,docx:t,converter:e,editor:n,filename:f});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:p,currentFileName:f}=Lg(u,t),h=c.find(g=>g.name==="w:footerReference"&&g.attributes["r:id"]===d)?.attributes["w:type"],m=gs(),y=m.handler({nodes:p.elements[0].elements,nodeListHandler:m,docx:t,converter:e,editor:n,filename:f});e.footerIds.ids||(e.footerIds.ids=[]),e.footerIds.ids.push(d),e.footers[d]={type:"doc",content:[...y]},e.footerIds[h]=d})},o1=(t,e=[])=>{for(const n in t)t[n]==="w:sectPr"?e.push(t):typeof t[n]=="object"&&o1(t[n],e);return e},Lg=(t,e)=>{const n=t.attributes.Id,r=t.attributes.Target,o=e[`word/${r}`];return{rId:n,referenceFile:o,currentFileName:r}};function c$(t){let e=t["word/numbering.xml"];(!e||!e.elements?.length||!e.elements[0].elements?.length)&&(e=Fv);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 u$=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")},d$="http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink";var Lo,i1,s1,a1,l1;const Ui=class c1{constructor(e=null){ob(this,Lo),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]=a$(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(Yp.xml2json(e,null,2))}static getStoredSuperdocVersion(e){try{const n=e.find(a=>a.name==="docProps/custom.xml");if(!n)return;const r=new c1,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.11.52"){const r="docProps/custom.xml";e[r]||(e[r]=u1());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=d1();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 p=d.elements.find(f=>f.name==="w:rPr");s=p?.elements?.find(f=>f.name==="w:rFonts")?.attributes["w:ascii"],l=Number(p?.elements?.find(f=>f.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=TA(l,s.attributes["w:fontKey"]);if(!c)return;const u=new Blob([c],{type:"font/ttf"}),d=URL.createObjectURL(u),p=s.name.includes("Regular"),f=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: ${p?"normal":f?"bold":m?"200":"normal"};
|
|
@@ -35,14 +35,14 @@ Actual: `+O.attribValue);else{var F=O.tag,B=O.tags[O.tags.length-1]||O;F.ns===B.
|
|
|
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]=DA);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=Lr().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=r$({...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 _g(this).schemaToXml(e,n)}async exportToDocx(e,n,r,o=!1,i,s=[],a){const l=s.map(m=>qA(m)),c=l.map((m,y)=>VA(m,y,l,a)),{result:u,params:d}=this.exportToXmlJson({data:e,editorSchema:n,comments:s,commentDefinitions:c,commentsExportType:i,isFinalDoc:o,editor:a}),p=new _g(this).schemaToXml(u);await Yn(this,Lo,l1).call(this,{...r,...d.media,...this.media},a);let f={...this.convertedXml},h=[];if(s.length){const{documentXml:m,relationships:y}=Yn(this,Lo,s1).call(this,{defs:d.exportedCommentDefs,exportType:i,commentsWithParaIds:l});f={...m},h=y}return this.convertedXml={...this.convertedXml,...f},Yn(this,Lo,a1).call(this,[...d.relationships,...h]),p$(this.convertedXml),Yn(this,Lo,i1).call(this,d),p}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]=ki({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}}};Lo=new WeakSet,i1=function(t){const e="word/numbering.xml";let n=this.convertedXml[e];const r=this.numbering;n||(n=Fv);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},s1=function({defs:t,exportType:e,commentsWithParaIds:n}){const{documentXml:r,relationships:o}=XA({exportType:e,convertedXml:this.convertedXml,defs:t,commentsWithParaIds:n,converter:this});return{documentXml:r,relationships:o}},a1=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(d=>d.attributes.Target===s.attributes.Target),c=s.attributes.Target?.startsWith("media/")&&a.length>6,u=s.attributes.Type===d$&&a.length>6;l&&!c&&!u||(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},l1=async function(t,e){const n={};for(const r in t){if(typeof t[r]!="string")return;const o=r.split("/").pop();n[o]=await kA(t[r],e.options.isHeadless)}this.convertedXml.media={...this.convertedXml.media,...n},this.media=this.convertedXml.media,this.addedMedia=n},ea(Ui,"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"})),ea(Ui,"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"}]),ea(Ui,"propertyTypes",Object.freeze({"w:pPr":"paragraphProperties","w:rPr":"runProperties","w:sectPr":"sectionProperties","w:numPr":"numberingProperties","w:tcPr":"tableCellProperties"})),ea(Ui,"elements",new Set(["w:document","w:body","w:p","w:r","w:t","w:delText"]));let Nr=Ui;function p$(t){const e="docProps/custom.xml";t[e]||(t[e]=u1());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(d1(i)),n.elements=o,t}function u1(){return MA}function d1(t=2,e="0.11.50"){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 aa(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 p1={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 aa=="function"&&aa;if(!u&&d)return d(c,!0);if(a)return a(c,!0);var p=new Error("Cannot find module '"+c+"'");throw p.code="MODULE_NOT_FOUND",p}var f=o[c]={exports:{}};r[c][0].call(f.exports,function(h){var m=r[c][1][h];return s(m||h)},f,f.exports,n,r,o,i)}return o[c].exports}for(var a=typeof aa=="function"&&aa,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,p,f,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),p=c>>2,f=(3&c)<<4|u>>4,h=1<k?(15&u)<<2|d>>6:64,m=2<k?63&d:64,y.push(a.charAt(p)+a.charAt(f)+a.charAt(h)+a.charAt(m));return y.join("")},o.decode=function(l){var c,u,d,p,f,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|(p=a.indexOf(l.charAt(m++)))>>4,u=(15&p)<<4|(f=a.indexOf(l.charAt(m++)))>>2,d=(3&f)<<6|(h=a.indexOf(l.charAt(m++))),x[y++]=c,f!==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,p,f,h){this.compressedSize=u,this.uncompressedSize=d,this.crc32=p,this.compression=f,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,p){return u.pipe(new a).pipe(new l("uncompressedSize")).pipe(d.compressWorker(p)).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,p){var f=s,h=p+d;c^=-1;for(var m=p;m<h;m++)c=c>>>8^f[255&(c^u[m])];return-1^c}(0|l,a,a.length,0):function(c,u,d,p){var f=s,h=p+d;c^=-1;for(var m=p;m<h;m++)c=c>>>8^f[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,p){l.call(this,"FlateWorker/"+d),this._pako=null,this._pakoAction=d,this._pakoOptions=p,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(p){d.push({data:p,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(f,h){var m,y="";for(m=0;m<h;m++)y+=String.fromCharCode(255&f),f>>>=8;return y}function s(f,h,m,y,g,x){var k,b,T=f.file,D=f.compression,M=x!==c.utf8encode,I=a.transformTo("string",x(T.name)),C=a.transformTo("string",c.utf8encode(T.name)),V=T.comment,oe=a.transformTo("string",x(V)),N=a.transformTo("string",c.utf8encode(V)),W=C.length!==T.name.length,E=N.length!==V.length,K="",ie="",G="",ce=T.dir,J=T.date,ue={crc32:0,compressedSize:0,uncompressedSize:0};h&&!m||(ue.crc32=f.crc32,ue.compressedSize=f.compressedSize,ue.uncompressedSize=f.uncompressedSize);var Z=0;h&&(Z|=8),M||!W&&!E||(Z|=2048);var R=0,ee=0;ce&&(R|=16),g==="UNIX"?(ee=798,R|=function(se,X){var O=se;return se||(O=X?16893:33204),(65535&O)<<16}(T.unixPermissions,ce)):(ee=20,R|=function(se){return 63&(se||0)}(T.dosPermissions)),k=J.getUTCHours(),k<<=6,k|=J.getUTCMinutes(),k<<=5,k|=J.getUTCSeconds()/2,b=J.getUTCFullYear()-1980,b<<=4,b|=J.getUTCMonth()+1,b<<=5,b|=J.getUTCDate(),W&&(ie=i(1,1)+i(u(I),4)+C,K+="up"+i(ie.length,2)+ie),E&&(G=i(1,1)+i(u(oe),4)+N,K+="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]=DA);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=Lr().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=r$({...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 _g(this).schemaToXml(e,n)}async exportToDocx(e,n,r,o=!1,i,s=[],a){const l=s.map(m=>qA(m)),c=l.map((m,y)=>VA(m,y,l,a)),{result:u,params:d}=this.exportToXmlJson({data:e,editorSchema:n,comments:s,commentDefinitions:c,commentsExportType:i,isFinalDoc:o,editor:a}),p=new _g(this).schemaToXml(u);await Yn(this,Lo,l1).call(this,{...r,...d.media,...this.media},a);let f={...this.convertedXml},h=[];if(s.length){const{documentXml:m,relationships:y}=Yn(this,Lo,s1).call(this,{defs:d.exportedCommentDefs,exportType:i,commentsWithParaIds:l});f={...m},h=y}return this.convertedXml={...this.convertedXml,...f},Yn(this,Lo,a1).call(this,[...d.relationships,...h]),p$(this.convertedXml),Yn(this,Lo,i1).call(this,d),p}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]=ki({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}}};Lo=new WeakSet,i1=function(t){const e="word/numbering.xml";let n=this.convertedXml[e];const r=this.numbering;n||(n=Fv);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},s1=function({defs:t,exportType:e,commentsWithParaIds:n}){const{documentXml:r,relationships:o}=XA({exportType:e,convertedXml:this.convertedXml,defs:t,commentsWithParaIds:n,converter:this});return{documentXml:r,relationships:o}},a1=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(d=>d.attributes.Target===s.attributes.Target),c=s.attributes.Target?.startsWith("media/")&&a.length>6,u=s.attributes.Type===d$&&a.length>6;l&&!c&&!u||(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},l1=async function(t,e){const n={};for(const r in t){if(typeof t[r]!="string")return;const o=r.split("/").pop();n[o]=await kA(t[r],e.options.isHeadless)}this.convertedXml.media={...this.convertedXml.media,...n},this.media=this.convertedXml.media,this.addedMedia=n},ea(Ui,"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"})),ea(Ui,"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"}]),ea(Ui,"propertyTypes",Object.freeze({"w:pPr":"paragraphProperties","w:rPr":"runProperties","w:sectPr":"sectionProperties","w:numPr":"numberingProperties","w:tcPr":"tableCellProperties"})),ea(Ui,"elements",new Set(["w:document","w:body","w:p","w:r","w:t","w:delText"]));let Nr=Ui;function p$(t){const e="docProps/custom.xml";t[e]||(t[e]=u1());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(d1(i)),n.elements=o,t}function u1(){return MA}function d1(t=2,e="0.11.52"){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 aa(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 p1={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 aa=="function"&&aa;if(!u&&d)return d(c,!0);if(a)return a(c,!0);var p=new Error("Cannot find module '"+c+"'");throw p.code="MODULE_NOT_FOUND",p}var f=o[c]={exports:{}};r[c][0].call(f.exports,function(h){var m=r[c][1][h];return s(m||h)},f,f.exports,n,r,o,i)}return o[c].exports}for(var a=typeof aa=="function"&&aa,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,p,f,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),p=c>>2,f=(3&c)<<4|u>>4,h=1<k?(15&u)<<2|d>>6:64,m=2<k?63&d:64,y.push(a.charAt(p)+a.charAt(f)+a.charAt(h)+a.charAt(m));return y.join("")},o.decode=function(l){var c,u,d,p,f,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|(p=a.indexOf(l.charAt(m++)))>>4,u=(15&p)<<4|(f=a.indexOf(l.charAt(m++)))>>2,d=(3&f)<<6|(h=a.indexOf(l.charAt(m++))),x[y++]=c,f!==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,p,f,h){this.compressedSize=u,this.uncompressedSize=d,this.crc32=p,this.compression=f,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,p){return u.pipe(new a).pipe(new l("uncompressedSize")).pipe(d.compressWorker(p)).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,p){var f=s,h=p+d;c^=-1;for(var m=p;m<h;m++)c=c>>>8^f[255&(c^u[m])];return-1^c}(0|l,a,a.length,0):function(c,u,d,p){var f=s,h=p+d;c^=-1;for(var m=p;m<h;m++)c=c>>>8^f[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,p){l.call(this,"FlateWorker/"+d),this._pako=null,this._pakoAction=d,this._pakoOptions=p,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(p){d.push({data:p,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(f,h){var m,y="";for(m=0;m<h;m++)y+=String.fromCharCode(255&f),f>>>=8;return y}function s(f,h,m,y,g,x){var k,b,T=f.file,D=f.compression,M=x!==c.utf8encode,I=a.transformTo("string",x(T.name)),C=a.transformTo("string",c.utf8encode(T.name)),V=T.comment,oe=a.transformTo("string",x(V)),N=a.transformTo("string",c.utf8encode(V)),W=C.length!==T.name.length,E=N.length!==V.length,K="",ie="",G="",ce=T.dir,J=T.date,ue={crc32:0,compressedSize:0,uncompressedSize:0};h&&!m||(ue.crc32=f.crc32,ue.compressedSize=f.compressedSize,ue.uncompressedSize=f.uncompressedSize);var Z=0;h&&(Z|=8),M||!W&&!E||(Z|=2048);var R=0,ee=0;ce&&(R|=16),g==="UNIX"?(ee=798,R|=function(se,X){var O=se;return se||(O=X?16893:33204),(65535&O)<<16}(T.unixPermissions,ce)):(ee=20,R|=function(se){return 63&(se||0)}(T.dosPermissions)),k=J.getUTCHours(),k<<=6,k|=J.getUTCMinutes(),k<<=5,k|=J.getUTCSeconds()/2,b=J.getUTCFullYear()-1980,b<<=4,b|=J.getUTCMonth()+1,b<<=5,b|=J.getUTCDate(),W&&(ie=i(1,1)+i(u(I),4)+C,K+="up"+i(ie.length,2)+ie),E&&(G=i(1,1)+i(u(oe),4)+N,K+="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(K.length,2),{fileRecord:d.LOCAL_FILE_HEADER+te+I+K,dirRecord:d.CENTRAL_FILE_HEADER+i(ee,2)+te+i(oe.length,2)+"\0\0\0\0"+i(R,4)+i(y,4)+I+K+oe}}var a=n("../utils"),l=n("../stream/GenericWorker"),c=n("../utf8"),u=n("../crc32"),d=n("../signature");function p(f,h,m,y){l.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=h,this.zipPlatform=m,this.encodeFileName=y,this.streamFiles=f,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}a.inherits(p,l),p.prototype.push=function(f){var h=f.meta.percent||0,m=this.entriesCount,y=this._sources.length;this.accumulate?this.contentBuffer.push(f):(this.bytesWritten+=f.data.length,l.prototype.push.call(this,{data:f.data,meta:{currentFile:this.currentFile,percent:m?(h+100*(m-y-1))/m:100}}))},p.prototype.openedSource=function(f){this.currentSourceOffset=this.bytesWritten,this.currentFile=f.file.name;var h=this.streamFiles&&!f.file.dir;if(h){var m=s(f,h,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:m.fileRecord,meta:{percent:0}})}else this.accumulate=!0},p.prototype.closedSource=function(f){this.accumulate=!1;var h=this.streamFiles&&!f.file.dir,m=s(f,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)}(f),meta:{percent:100}});else for(this.push({data:m.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},p.prototype.flush=function(){for(var f=this.bytesWritten,h=0;h<this.dirRecords.length;h++)this.push({data:this.dirRecords[h],meta:{percent:100}});var m=this.bytesWritten-f,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,f,this.zipComment,this.encodeFileName);this.push({data:y,meta:{percent:100}})},p.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},p.prototype.registerPrevious=function(f){this._sources.push(f);var h=this;return f.on("data",function(m){h.processChunk(m)}),f.on("end",function(){h.closedSource(h.previous.streamInfo),h._sources.length?h.prepareNextSource():h.end()}),f.on("error",function(m){h.error(m)}),this},p.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))},p.prototype.error=function(f){var h=this._sources;if(!l.prototype.error.call(this,f))return!1;for(var m=0;m<h.length;m++)try{h[m].error(f)}catch{}return!0},p.prototype.lock=function(){l.prototype.lock.call(this);for(var f=this._sources,h=0;h<f.length;h++)f[h].lock()},r.exports=p},{"../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(p,f){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}(f.options.compression,l.compression),m=f.options.compressionOptions||l.compressionOptions||{},y=f.dir,g=f.date;f._compressWorker(h,m).withStreamInfo("file",{name:p,dir:y,date:g,comment:f.comment||"",unixPermissions:f.unixPermissions,dosPermissions:f.dosPermissions}).pipe(u)}),u.entriesCount=d}catch(p){u.error(p)}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(p){return new s.Promise(function(f,h){var m=p.decompressed.getContentWorker().pipe(new c);m.on("error",function(y){h(y)}).on("end",function(){m.streamInfo.crc32!==p.decompressed.crc32?h(new Error("Corrupted zip : CRC32 mismatch")):f()}).resume()})}r.exports=function(p,f){var h=this;return f=i.extend(f||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:a.utf8decode}),u.isNode&&u.isStream(p)?s.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):i.prepareContent("the loaded zip file",p,!0,f.optimizedBinaryString,f.base64).then(function(m){var y=new l(f);return y.load(m),y}).then(function(m){var y=[s.Promise.resolve(m)],g=m.files;if(f.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:f.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,p){u.push(d)||u._helper.pause(),c&&c(p)}).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 mt<"u",newBufferFrom:function(i,s){if(mt.from&&mt.from!==Uint8Array.from)return mt.from(i,s);if(typeof i=="number")throw new Error('The "data" argument must not be a number');return new mt(i,s)},allocBuffer:function(i){if(mt.alloc)return mt.alloc(i);var s=new mt(i);return s.fill(0),s},isBuffer:function(i){return mt.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,C=a.getTypeOf(D),V=a.extend(M||{},u);V.date=V.date||new Date,V.compression!==null&&(V.compression=V.compression.toUpperCase()),typeof V.unixPermissions=="string"&&(V.unixPermissions=parseInt(V.unixPermissions,8)),V.unixPermissions&&16384&V.unixPermissions&&(V.dir=!0),V.dosPermissions&&16&V.dosPermissions&&(V.dir=!0),V.dir&&(T=g(T)),V.createFolders&&(I=y(T))&&x.call(this,I,!0);var oe=C==="string"&&V.binary===!1&&V.base64===!1;M&&M.binary!==void 0||(V.binary=!oe),(D instanceof d&&D.uncompressedSize===0||V.dir||!D||D.length===0)&&(V.base64=!1,V.binary=!0,D="",V.compression="STORE",C="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,V.binary,V.optimizedBinaryString,V.base64);var W=new p(T,N,V);this.files[T]=W}var s=n("./utf8"),a=n("./utils"),l=n("./stream/GenericWorker"),c=n("./stream/StreamHelper"),u=n("./defaults"),d=n("./compressedObject"),p=n("./zipObject"),f=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(V,oe){return!oe.dir&&I.test(V)})}var C=this.files[this.root+T];return C&&!C.dir?C:null},folder:function(T){if(!T)return this;if(k(T))return this.filter(function(C,V){return V.dir&&T.test(C)});var 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(C,V){return V.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=f.generateWorker(this,M,I)}catch(C){(D=new l("error")).error(C)}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),p=this.length-4;0<=p;--p)if(this.data[p]===l&&this.data[p+1]===c&&this.data[p+2]===u&&this.data[p+3]===d)return p-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),p=this.readData(4);return l===p[0]&&c===p[1]&&u===p[2]&&d===p[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 p=i.getTypeOf(d);return i.checkSupport(p),p!=="string"||s.uint8array?p==="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 p(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,C){switch(M){case"blob":return i.newBlob(i.transformTo("arraybuffer",I),C);case"base64":return l.encode(I);default:return i.transformTo(M,I)}}(b,function(M,I){var C,V=0,oe=null,N=0;for(C=0;C<I.length;C++)N+=I[C].length;switch(M){case"string":return I.join("");case"array":return Array.prototype.concat.apply([],I);case"uint8array":for(oe=new Uint8Array(N),C=0;C<I.length;C++)oe.set(I[C],V),V+=I[C].length;return oe;case"nodebuffer":return mt.concat(I);default:throw new Error("concat : unsupported type '"+M+"'")}}(k,x),T);y(D)}catch(M){g(M)}x=[]}).resume()})}function f(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)}}f.prototype={accumulate:function(h){return p(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=f},{"../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 mt<"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 p(){l.call(this,"utf-8 encode")}o.utf8encode=function(f){return s.nodebuffer?a.newBufferFrom(f,"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}(f)},o.utf8decode=function(f){return s.nodebuffer?i.transformTo("nodebuffer",f).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)}(f=i.transformTo(s.uint8array?"uint8array":"array",f))},i.inherits(d,l),d.prototype.processChunk=function(f){var h=i.transformTo(s.uint8array?"uint8array":"array",f.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:f.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(p,l),p.prototype.processChunk=function(f){this.push({data:o.utf8encode(f.data),meta:f.meta})},o.Utf8EncodeWorker=p},{"./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 p(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 f(m,y){for(var g=0;g<m.length;g++)y[g]=m[g];return y}o.applyFromCharCode=p;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:p,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 p(new Uint8Array(m))},array:function(m){return f(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:p,array:function(m){return f(m,new Array(m.length))},arraybuffer:function(m){return m.buffer},uint8array:c,nodebuffer:function(m){return a.newBufferFrom(m)}},h.nodebuffer={string:p,array:function(m){return f(m,new Array(m.length))},arraybuffer:function(m){return h.nodebuffer.uint8array(m).buffer},uint8array:function(m){return f(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 p=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+s.pretty(p)+", expected "+s.pretty(d)+")")}},isSignature:function(d,p){var f=this.reader.index;this.reader.setIndex(d);var h=this.reader.readString(4)===p;return this.reader.setIndex(f),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),p=c.uint8array?"uint8array":"array",f=s.transformTo(p,d);this.zipComment=this.loadOptions.decodeFileName(f)},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,p,f,h=this.zip64EndOfCentralSize-44;0<h;)d=this.reader.readInt(2),p=this.reader.readInt(4),f=this.reader.readData(p),this.zip64ExtensibleData[d]={id:d,length:p,value:f}},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,p;for(d=0;d<this.files.length;d++)p=this.files[d],this.reader.setIndex(p.localHeaderOffset),this.checkSignature(a.LOCAL_FILE_HEADER),p.readLocalPart(this.reader),p.handleUTF8(),p.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 p=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 f=this.centralDirOffset+this.centralDirSize;this.zip64&&(f+=20,f+=12+this.zip64EndOfCentralSize);var h=p-f;if(0<h)this.isSignature(p,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 p(f,h){this.options=f,this.loadOptions=h}p.prototype={isEncrypted:function(){return(1&this.bitFlag)==1},useUTF8:function(){return(2048&this.bitFlag)==2048},readLocalPart:function(f){var h,m;if(f.skip(22),this.fileNameLength=f.readInt(2),m=f.readInt(2),this.fileName=f.readData(this.fileNameLength),f.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,f.readData(this.compressedSize))},readCentralPart:function(f){this.versionMadeBy=f.readInt(2),f.skip(2),this.bitFlag=f.readInt(2),this.compressionMethod=f.readString(2),this.date=f.readDate(),this.crc32=f.readInt(4),this.compressedSize=f.readInt(4),this.uncompressedSize=f.readInt(4);var h=f.readInt(2);if(this.extraFieldsLength=f.readInt(2),this.fileCommentLength=f.readInt(2),this.diskNumberStart=f.readInt(2),this.internalFileAttributes=f.readInt(2),this.externalFileAttributes=f.readInt(4),this.localHeaderOffset=f.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");f.skip(h),this.readExtraFields(f),this.parseZIP64ExtraField(f),this.fileComment=f.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var f=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),f==0&&(this.dosPermissions=63&this.externalFileAttributes),f==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var f=i(this.extraFields[1].value);this.uncompressedSize===s.MAX_VALUE_32BITS&&(this.uncompressedSize=f.readInt(8)),this.compressedSize===s.MAX_VALUE_32BITS&&(this.compressedSize=f.readInt(8)),this.localHeaderOffset===s.MAX_VALUE_32BITS&&(this.localHeaderOffset=f.readInt(8)),this.diskNumberStart===s.MAX_VALUE_32BITS&&(this.diskNumberStart=f.readInt(4))}},readExtraFields:function(f){var h,m,y,g=f.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});f.index+4<g;)h=f.readInt(2),m=f.readInt(2),y=f.readData(m),this.extraFields[h]={id:h,length:m,value:y};f.setIndex(g)},handleUTF8:function(){var f=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(f,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(m)}var y=this.findExtraFieldUnicodeComment();if(y!==null)this.fileCommentStr=y;else{var g=s.transformTo(f,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(g)}}},findExtraFieldUnicodePath:function(){var f=this.extraFields[28789];if(f){var h=i(f.value);return h.readInt(1)!==1||l(this.fileName)!==h.readInt(4)?null:c.utf8decode(h.readData(f.length-5))}return null},findExtraFieldUnicodeComment:function(){var f=this.extraFields[25461];if(f){var h=i(f.value);return h.readInt(1)!==1||l(this.fileComment)!==h.readInt(4)?null:c.utf8decode(h.readData(f.length-5))}return null}},r.exports=p},{"./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"],p=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},f=0;f<d.length;f++)i.prototype[d[f]]=p;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 p=new i.MessageChannel;p.port1.onmessage=h,s=function(){p.port2.postMessage(0)}}var f=[];function h(){var m,y;a=!0;for(var g=f.length;g;){for(y=f,f=[],m=-1;++m<g;)y[m]();g=f.length}a=!1}r.exports=function(m){f.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 p(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 f(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?f(k,this.state===c?g:x,this.outcome):this.queue.push(new p(k,g,x)),k},p.prototype.callFulfilled=function(g){a.resolve(this.promise,g)},p.prototype.otherCallFulfilled=function(g){f(this.promise,this.onFulfilled,g)},p.prototype.callRejected=function(g){a.reject(this.promise,g)},p.prototype.otherCallRejected=function(g){f(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;)C(g[M],M);return I;function C(V,oe){x.resolve(V).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,p=-1,f=0,h=8;function m(g){if(!(this instanceof m))return new m(g);this.options=s.assign({level:p,method:h,chunkSize:16384,windowBits:15,memLevel:8,strategy:f,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"),p=Object.prototype.toString;function f(m){if(!(this instanceof f))return new f(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 f(y);if(g.push(m,!0),g.err)throw g.msg||c[g.err];return g.result}f.prototype.push=function(m,y){var g,x,k,b,T,D,M=this.strm,I=this.options.chunkSize,C=this.options.dictionary,V=!1;if(this.ended)return!1;x=y===~~y?y:y===!0?l.Z_FINISH:l.Z_NO_FLUSH,typeof m=="string"?M.input=a.binstring2buf(m):p.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&&C&&(D=typeof C=="string"?a.string2buf(C):p.call(C)==="[object ArrayBuffer]"?new Uint8Array(C):C,g=i.inflateSetDictionary(this.strm,D)),g===l.Z_BUF_ERROR&&V===!0&&(g=l.Z_OK,V=!1),g!==l.Z_STREAM_END&&g!==l.Z_OK)return this.onEnd(g),!(this.ended=!0);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&&(V=!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))},f.prototype.onData=function(m){this.chunks.push(m)},f.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=f,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,p){if(c.subarray&&l.subarray)l.set(c.subarray(u,u+d),p);else for(var f=0;f<d;f++)l[p+f]=c[u+f]},flattenChunks:function(l){var c,u,d,p,f,h;for(c=d=0,u=l.length;c<u;c++)d+=l[c].length;for(h=new Uint8Array(d),c=p=0,u=l.length;c<u;c++)f=l[c],h.set(f,p),p+=f.length;return h}},a={arraySet:function(l,c,u,d,p){for(var f=0;f<d;f++)l[p+f]=c[u+f]},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,p){if(p<65537&&(d.subarray&&a||!d.subarray&&s))return String.fromCharCode.apply(null,i.shrinkBuf(d,p));for(var f="",h=0;h<p;h++)f+=String.fromCharCode(d[h]);return f}l[254]=l[254]=1,o.string2buf=function(d){var p,f,h,m,y,g=d.length,x=0;for(m=0;m<g;m++)(64512&(f=d.charCodeAt(m)))==55296&&m+1<g&&(64512&(h=d.charCodeAt(m+1)))==56320&&(f=65536+(f-55296<<10)+(h-56320),m++),x+=f<128?1:f<2048?2:f<65536?3:4;for(p=new i.Buf8(x),m=y=0;y<x;m++)(64512&(f=d.charCodeAt(m)))==55296&&m+1<g&&(64512&(h=d.charCodeAt(m+1)))==56320&&(f=65536+(f-55296<<10)+(h-56320),m++),f<128?p[y++]=f:(f<2048?p[y++]=192|f>>>6:(f<65536?p[y++]=224|f>>>12:(p[y++]=240|f>>>18,p[y++]=128|f>>>12&63),p[y++]=128|f>>>6&63),p[y++]=128|63&f);return p},o.buf2binstring=function(d){return u(d,d.length)},o.binstring2buf=function(d){for(var p=new i.Buf8(d.length),f=0,h=p.length;f<h;f++)p[f]=d.charCodeAt(f);return p},o.buf2string=function(d,p){var f,h,m,y,g=p||d.length,x=new Array(2*g);for(f=h=0;f<g;)if((m=d[f++])<128)x[h++]=m;else if(4<(y=l[m]))x[h++]=65533,f+=y-1;else{for(m&=y===2?31:y===3?15:7;1<y&&f<g;)m=m<<6|63&d[f++],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,p){var f;for((p=p||d.length)>d.length&&(p=d.length),f=p-1;0<=f&&(192&d[f])==128;)f--;return f<0||f===0?p:f+l[d[f]]>p?f:p}},{"./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 p=c;p<d;p++)s=s>>>8^u[255&(s^a[p])];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,p=4,f=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,C=3,V=258,oe=V+C+1,N=42,W=113,E=1,K=2,ie=3,G=4;function ce(S,re){return S.msg=u[re],re}function J(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 R(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,de=S.prev_length,fe=S.nice_match,ae=S.strstart>S.w_size-oe?S.strstart-(S.w_size-oe):0,he=S.window,we=S.w_mask,me=S.prev,xe=S.strstart+V,Re=he[z+de-1],Ee=he[z+de];S.prev_length>=S.good_match&&(j>>=2),fe>S.lookahead&&(fe=S.lookahead);do if(he[(Q=re)+de]===Ee&&he[Q+de-1]===Re&&he[Q]===he[z]&&he[++Q]===he[z+1]){z+=2,Q++;do;while(he[++z]===he[++Q]&&he[++z]===he[++Q]&&he[++z]===he[++Q]&&he[++z]===he[++Q]&&he[++z]===he[++Q]&&he[++z]===he[++Q]&&he[++z]===he[++Q]&&he[++z]===he[++Q]&&z<xe);if(L=V-(xe-z),z=xe-V,de<L){if(S.match_start=re,fe<=(de=L))break;Re=he[z+de-1],Ee=he[z+de]}}while((re=me[re&we])>ae&&--j!=0);return de<=S.lookahead?de:S.lookahead}function X(S){var re,Q,L,j,z,de,fe,ae,he,we,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(de=S.strm,fe=S.window,ae=S.strstart+S.lookahead,he=j,we=void 0,we=de.avail_in,he<we&&(we=he),Q=we===0?0:(de.avail_in-=we,s.arraySet(fe,de.input,de.next_in,we,ae),de.state.wrap===1?de.adler=l(de.adler,fe,we,ae):de.state.wrap===2&&(de.adler=c(de.adler,fe,we,ae)),de.next_in+=we,de.total_in+=we,we),S.lookahead+=Q,S.lookahead+S.insert>=C)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+C-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<C)););}while(S.lookahead<oe&&S.strm.avail_in!==0)}function O(S,re){for(var Q,L;;){if(S.lookahead<oe){if(X(S),S.lookahead<oe&&re===d)return E;if(S.lookahead===0)break}if(Q=0,S.lookahead>=C&&(S.ins_h=(S.ins_h<<S.hash_shift^S.window[S.strstart+C-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>=C)if(L=a._tr_tally(S,S.strstart-S.match_start,S.match_length-C),S.lookahead-=S.match_length,S.match_length<=S.max_lazy_match&&S.lookahead>=C){for(S.match_length--;S.strstart++,S.ins_h=(S.ins_h<<S.hash_shift^S.window[S.strstart+C-1])&S.hash_mask,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&&(R(S,!1),S.strm.avail_out===0))return E}return S.insert=S.strstart<C-1?S.strstart:C-1,re===p?(R(S,!0),S.strm.avail_out===0?ie:G):S.last_lit&&(R(S,!1),S.strm.avail_out===0)?E:K}function A(S,re){for(var Q,L,j;;){if(S.lookahead<oe){if(X(S),S.lookahead<oe&&re===d)return E;if(S.lookahead===0)break}if(Q=0,S.lookahead>=C&&(S.ins_h=(S.ins_h<<S.hash_shift^S.window[S.strstart+C-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=C-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===C&&4096<S.strstart-S.match_start)&&(S.match_length=C-1)),S.prev_length>=C&&S.match_length<=S.prev_length){for(j=S.strstart+S.lookahead-C,L=a._tr_tally(S,S.strstart-1-S.prev_match,S.prev_length-C),S.lookahead-=S.prev_length-1,S.prev_length-=2;++S.strstart<=j&&(S.ins_h=(S.ins_h<<S.hash_shift^S.window[S.strstart+C-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=C-1,S.strstart++,L&&(R(S,!1),S.strm.avail_out===0))return E}else if(S.match_available){if((L=a._tr_tally(S,0,S.window[S.strstart-1]))&&R(S,!1),S.strstart++,S.lookahead--,S.strm.avail_out===0)return E}else S.match_available=1,S.strstart++,S.lookahead--}return S.match_available&&(L=a._tr_tally(S,0,S.window[S.strstart-1]),S.match_available=0),S.insert=S.strstart<C-1?S.strstart:C-1,re===p?(R(S,!0),S.strm.avail_out===0?ie:G):S.last_lit&&(R(S,!1),S.strm.avail_out===0)?E:K}function U(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),f):ce(S,h)}function B(S){var re=F(S);return re===f&&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=C-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 de=1;if(re===m&&(re=6),L<0?(de=0,L=-L):15<L&&(de=2,L-=16),j<1||k<j||Q!==x||L<8||15<L||re<0||9<re||z<0||y<z)return ce(S,h);L===8&&(L=9);var fe=new P;return(S.state=fe).strm=S,fe.wrap=de,fe.gzhead=null,fe.w_bits=L,fe.w_size=1<<fe.w_bits,fe.w_mask=fe.w_size-1,fe.hash_bits=j+7,fe.hash_size=1<<fe.hash_bits,fe.hash_mask=fe.hash_size-1,fe.hash_shift=~~((fe.hash_bits+C-1)/C),fe.window=new s.Buf8(2*fe.w_size),fe.head=new s.Buf16(fe.hash_size),fe.prev=new s.Buf16(fe.w_size),fe.lit_bufsize=1<<j+6,fe.pending_buf_size=4*fe.lit_bufsize,fe.pending_buf=new s.Buf8(fe.pending_buf_size),fe.d_buf=1*fe.lit_bufsize,fe.l_buf=3*fe.lit_bufsize,fe.level=re,fe.strategy=z,fe.method=Q,B(S)}i=[new U(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(X(S),S.lookahead===0&&re===d)return E;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,R(S,!1),S.strm.avail_out===0)||S.strstart-S.block_start>=S.w_size-oe&&(R(S,!1),S.strm.avail_out===0))return E}return S.insert=0,re===p?(R(S,!0),S.strm.avail_out===0?ie:G):(S.strstart>S.block_start&&(R(S,!1),S.strm.avail_out),E)}),new U(4,4,8,4,O),new U(4,5,16,8,O),new U(4,6,32,32,O),new U(4,4,16,16,A),new U(8,16,32,32,A),new U(8,16,128,128,A),new U(8,32,128,256,A),new U(32,128,258,1024,A),new U(32,258,258,4096,A)],o.deflateInit=function(S,re){return le(S,re,x,15,8,0)},o.deflateInit2=le,o.deflateReset=B,o.deflateResetKeep=F,o.deflateSetHeader=function(S,re){return S&&S.state?S.state.wrap!==2?h:(S.state.gzhead=re,f):h},o.deflate=function(S,re){var Q,L,j,z;if(!S||!S.state||5<re||re<0)return S?ce(S,h):h;if(L=S.state,!S.output||!S.input&&S.avail_in!==0||L.status===666&&re!==p)return ce(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 de=x+(L.w_bits-8<<4)<<8;de|=(2<=L.strategy||L.level<2?0:L.level<6?1:L.level===6?2:3)<<6,L.strstart!==0&&(de|=32),de+=31-de%31,L.status=W,te(L,de),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,f}else if(S.avail_in===0&&J(re)<=J(Q)&&re!==p)return ce(S,-5);if(L.status===666&&S.avail_in!==0)return ce(S,-5);if(S.avail_in!==0||L.lookahead!==0||re!==d&&L.status!==666){var fe=L.strategy===2?function(ae,he){for(var we;;){if(ae.lookahead===0&&(X(ae),ae.lookahead===0)){if(he===d)return E;break}if(ae.match_length=0,we=a._tr_tally(ae,0,ae.window[ae.strstart]),ae.lookahead--,ae.strstart++,we&&(R(ae,!1),ae.strm.avail_out===0))return E}return ae.insert=0,he===p?(R(ae,!0),ae.strm.avail_out===0?ie:G):ae.last_lit&&(R(ae,!1),ae.strm.avail_out===0)?E:K}(L,re):L.strategy===3?function(ae,he){for(var we,me,xe,Re,Ee=ae.window;;){if(ae.lookahead<=V){if(X(ae),ae.lookahead<=V&&he===d)return E;if(ae.lookahead===0)break}if(ae.match_length=0,ae.lookahead>=C&&0<ae.strstart&&(me=Ee[xe=ae.strstart-1])===Ee[++xe]&&me===Ee[++xe]&&me===Ee[++xe]){Re=ae.strstart+V;do;while(me===Ee[++xe]&&me===Ee[++xe]&&me===Ee[++xe]&&me===Ee[++xe]&&me===Ee[++xe]&&me===Ee[++xe]&&me===Ee[++xe]&&me===Ee[++xe]&&xe<Re);ae.match_length=V-(Re-xe),ae.match_length>ae.lookahead&&(ae.match_length=ae.lookahead)}if(ae.match_length>=C?(we=a._tr_tally(ae,1,ae.match_length-C),ae.lookahead-=ae.match_length,ae.strstart+=ae.match_length,ae.match_length=0):(we=a._tr_tally(ae,0,ae.window[ae.strstart]),ae.lookahead--,ae.strstart++),we&&(R(ae,!1),ae.strm.avail_out===0))return E}return ae.insert=0,he===p?(R(ae,!0),ae.strm.avail_out===0?ie:G):ae.last_lit&&(R(ae,!1),ae.strm.avail_out===0)?E:K}(L,re):i[L.level].func(L,re);if(fe!==ie&&fe!==G||(L.status=666),fe===E||fe===ie)return S.avail_out===0&&(L.last_flush=-1),f;if(fe===K&&(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,f}return re!==p?f: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?f: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?ce(S,h):(S.state=null,re===W?ce(S,-3):f):h},o.deflateSetDictionary=function(S,re){var Q,L,j,z,de,fe,ae,he,we=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,we,0)),Q.wrap=0,we>=Q.w_size&&(z===0&&(ue(Q.head),Q.strstart=0,Q.block_start=0,Q.insert=0),he=new s.Buf8(Q.w_size),s.arraySet(he,re,we-Q.w_size,Q.w_size,0),re=he,we=Q.w_size),de=S.avail_in,fe=S.next_in,ae=S.input,S.avail_in=we,S.next_in=0,S.input=re,X(Q);Q.lookahead>=C;){for(L=Q.strstart,j=Q.lookahead-(C-1);Q.ins_h=(Q.ins_h<<Q.hash_shift^Q.window[L+C-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=C-1,X(Q)}return Q.strstart+=Q.lookahead,Q.block_start=Q.strstart,Q.insert=Q.lookahead,Q.lookahead=0,Q.match_length=Q.prev_length=C-1,Q.match_available=0,S.next_in=fe,S.input=ae,S.avail_in=de,Q.wrap=z,f},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,p,f,h,m,y,g,x,k,b,T,D,M,I,C,V,oe,N,W,E,K;a=i.state,l=i.next_in,E=i.input,c=l+(i.avail_in-5),u=i.next_out,K=i.output,d=u-(s-i.avail_out),p=u+(i.avail_out-257),f=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+=E[l++]<<k,k+=8,x+=E[l++]<<k,k+=8),I=b[x&D];t:for(;;){if(x>>>=C=I>>>24,k-=C,(C=I>>>16&255)===0)K[u++]=65535&I;else{if(!(16&C)){if(!(64&C)){I=b[(65535&I)+(x&(1<<C)-1)];continue t}if(32&C){a.mode=12;break e}i.msg="invalid literal/length code",a.mode=30;break e}V=65535&I,(C&=15)&&(k<C&&(x+=E[l++]<<k,k+=8),V+=x&(1<<C)-1,x>>>=C,k-=C),k<15&&(x+=E[l++]<<k,k+=8,x+=E[l++]<<k,k+=8),I=T[x&M];n:for(;;){if(x>>>=C=I>>>24,k-=C,!(16&(C=I>>>16&255))){if(!(64&C)){I=T[(65535&I)+(x&(1<<C)-1)];continue n}i.msg="invalid distance code",a.mode=30;break e}if(oe=65535&I,k<(C&=15)&&(x+=E[l++]<<k,(k+=8)<C&&(x+=E[l++]<<k,k+=8)),f<(oe+=x&(1<<C)-1)){i.msg="invalid distance too far back",a.mode=30;break e}if(x>>>=C,k-=C,(C=u-d)<oe){if(m<(C=oe-C)&&a.sane){i.msg="invalid distance too far back",a.mode=30;break e}if(W=g,(N=0)===y){if(N+=h-C,C<V){for(V-=C;K[u++]=g[N++],--C;);N=u-oe,W=K}}else if(y<C){if(N+=h+y-C,(C-=y)<V){for(V-=C;K[u++]=g[N++],--C;);if(N=0,y<V){for(V-=C=y;K[u++]=g[N++],--C;);N=u-oe,W=K}}}else if(N+=y-C,C<V){for(V-=C;K[u++]=g[N++],--C;);N=u-oe,W=K}for(;2<V;)K[u++]=W[N++],K[u++]=W[N++],K[u++]=W[N++],V-=3;V&&(K[u++]=W[N++],1<V&&(K[u++]=W[N++]))}else{for(N=u-oe;K[u++]=K[N++],K[u++]=K[N++],K[u++]=K[N++],2<(V-=3););V&&(K[u++]=K[N++],1<V&&(K[u++]=K[N++]))}break}}break}}while(l<c&&u<p);l-=V=k>>3,x&=(1<<(k-=V<<3))-1,i.next_in=l,i.next_out=u,i.avail_in=l<c?c-l+5:5-(l-c),i.avail_out=u<p?p-u+257:257-(u-p),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,p=0,f=-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,p):f}function b(N){var W;return N&&N.state?((W=N.state).wsize=0,W.whave=0,W.wnext=0,k(N)):f}function T(N,W){var E,K;return N&&N.state?(K=N.state,W<0?(E=0,W=-W):(E=1+(W>>4),W<48&&(W&=15)),W&&(W<8||15<W)?f:(K.window!==null&&K.wbits!==W&&(K.window=null),K.wrap=E,K.wbits=W,b(N))):f}function D(N,W){var E,K;return N?(K=new x,(N.state=K).window=null,(E=T(N,W))!==p&&(N.state=null),E):f}var M,I,C=!0;function V(N){if(C){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}),C=!1}N.lencode=M,N.lenbits=9,N.distcode=I,N.distbits=5}function oe(N,W,E,K){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)),K>=G.wsize?(i.arraySet(G.window,W,E-G.wsize,G.wsize,0),G.wnext=0,G.whave=G.wsize):(K<(ie=G.wsize-G.wnext)&&(ie=K),i.arraySet(G.window,W,E-K,ie,G.wnext),(K-=ie)?(i.arraySet(G.window,W,E-K,K,0),G.wnext=K,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 E,K,ie,G,ce,J,ue,Z,R,ee,te,se,X,O,A,U,P,F,B,le,S,re,Q,L,j=0,z=new i.Buf8(4),de=[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 f;(E=N.state).mode===12&&(E.mode=13),ce=N.next_out,ie=N.output,ue=N.avail_out,G=N.next_in,K=N.input,J=N.avail_in,Z=E.hold,R=E.bits,ee=J,te=ue,re=p;e:for(;;)switch(E.mode){case h:if(E.wrap===0){E.mode=13;break}for(;R<16;){if(J===0)break e;J--,Z+=K[G++]<<R,R+=8}if(2&E.wrap&&Z===35615){z[E.check=0]=255&Z,z[1]=Z>>>8&255,E.check=a(E.check,z,2,0),R=Z=0,E.mode=2;break}if(E.flags=0,E.head&&(E.head.done=!1),!(1&E.wrap)||(((255&Z)<<8)+(Z>>8))%31){N.msg="incorrect header check",E.mode=30;break}if((15&Z)!=8){N.msg="unknown compression method",E.mode=30;break}if(R-=4,S=8+(15&(Z>>>=4)),E.wbits===0)E.wbits=S;else if(S>E.wbits){N.msg="invalid window size",E.mode=30;break}E.dmax=1<<S,N.adler=E.check=1,E.mode=512&Z?10:12,R=Z=0;break;case 2:for(;R<16;){if(J===0)break e;J--,Z+=K[G++]<<R,R+=8}if(E.flags=Z,(255&E.flags)!=8){N.msg="unknown compression method",E.mode=30;break}if(57344&E.flags){N.msg="unknown header flags set",E.mode=30;break}E.head&&(E.head.text=Z>>8&1),512&E.flags&&(z[0]=255&Z,z[1]=Z>>>8&255,E.check=a(E.check,z,2,0)),R=Z=0,E.mode=3;case 3:for(;R<32;){if(J===0)break e;J--,Z+=K[G++]<<R,R+=8}E.head&&(E.head.time=Z),512&E.flags&&(z[0]=255&Z,z[1]=Z>>>8&255,z[2]=Z>>>16&255,z[3]=Z>>>24&255,E.check=a(E.check,z,4,0)),R=Z=0,E.mode=4;case 4:for(;R<16;){if(J===0)break e;J--,Z+=K[G++]<<R,R+=8}E.head&&(E.head.xflags=255&Z,E.head.os=Z>>8),512&E.flags&&(z[0]=255&Z,z[1]=Z>>>8&255,E.check=a(E.check,z,2,0)),R=Z=0,E.mode=5;case 5:if(1024&E.flags){for(;R<16;){if(J===0)break e;J--,Z+=K[G++]<<R,R+=8}E.length=Z,E.head&&(E.head.extra_len=Z),512&E.flags&&(z[0]=255&Z,z[1]=Z>>>8&255,E.check=a(E.check,z,2,0)),R=Z=0}else E.head&&(E.head.extra=null);E.mode=6;case 6:if(1024&E.flags&&(J<(se=E.length)&&(se=J),se&&(E.head&&(S=E.head.extra_len-E.length,E.head.extra||(E.head.extra=new Array(E.head.extra_len)),i.arraySet(E.head.extra,K,G,se,S)),512&E.flags&&(E.check=a(E.check,K,se,G)),J-=se,G+=se,E.length-=se),E.length))break e;E.length=0,E.mode=7;case 7:if(2048&E.flags){if(J===0)break e;for(se=0;S=K[G+se++],E.head&&S&&E.length<65536&&(E.head.name+=String.fromCharCode(S)),S&&se<J;);if(512&E.flags&&(E.check=a(E.check,K,se,G)),J-=se,G+=se,S)break e}else E.head&&(E.head.name=null);E.length=0,E.mode=8;case 8:if(4096&E.flags){if(J===0)break e;for(se=0;S=K[G+se++],E.head&&S&&E.length<65536&&(E.head.comment+=String.fromCharCode(S)),S&&se<J;);if(512&E.flags&&(E.check=a(E.check,K,se,G)),J-=se,G+=se,S)break e}else E.head&&(E.head.comment=null);E.mode=9;case 9:if(512&E.flags){for(;R<16;){if(J===0)break e;J--,Z+=K[G++]<<R,R+=8}if(Z!==(65535&E.check)){N.msg="header crc mismatch",E.mode=30;break}R=Z=0}E.head&&(E.head.hcrc=E.flags>>9&1,E.head.done=!0),N.adler=E.check=0,E.mode=12;break;case 10:for(;R<32;){if(J===0)break e;J--,Z+=K[G++]<<R,R+=8}N.adler=E.check=g(Z),R=Z=0,E.mode=11;case 11:if(E.havedict===0)return N.next_out=ce,N.avail_out=ue,N.next_in=G,N.avail_in=J,E.hold=Z,E.bits=R,2;N.adler=E.check=1,E.mode=12;case 12:if(W===5||W===6)break e;case 13:if(E.last){Z>>>=7&R,R-=7&R,E.mode=27;break}for(;R<3;){if(J===0)break e;J--,Z+=K[G++]<<R,R+=8}switch(E.last=1&Z,R-=1,3&(Z>>>=1)){case 0:E.mode=14;break;case 1:if(V(E),E.mode=20,W!==6)break;Z>>>=2,R-=2;break e;case 2:E.mode=17;break;case 3:N.msg="invalid block type",E.mode=30}Z>>>=2,R-=2;break;case 14:for(Z>>>=7&R,R-=7&R;R<32;){if(J===0)break e;J--,Z+=K[G++]<<R,R+=8}if((65535&Z)!=(Z>>>16^65535)){N.msg="invalid stored block lengths",E.mode=30;break}if(E.length=65535&Z,R=Z=0,E.mode=15,W===6)break e;case 15:E.mode=16;case 16:if(se=E.length){if(J<se&&(se=J),ue<se&&(se=ue),se===0)break e;i.arraySet(ie,K,G,se,ce),J-=se,G+=se,ue-=se,ce+=se,E.length-=se;break}E.mode=12;break;case 17:for(;R<14;){if(J===0)break e;J--,Z+=K[G++]<<R,R+=8}if(E.nlen=257+(31&Z),Z>>>=5,R-=5,E.ndist=1+(31&Z),Z>>>=5,R-=5,E.ncode=4+(15&Z),Z>>>=4,R-=4,286<E.nlen||30<E.ndist){N.msg="too many length or distance symbols",E.mode=30;break}E.have=0,E.mode=18;case 18:for(;E.have<E.ncode;){for(;R<3;){if(J===0)break e;J--,Z+=K[G++]<<R,R+=8}E.lens[de[E.have++]]=7&Z,Z>>>=3,R-=3}for(;E.have<19;)E.lens[de[E.have++]]=0;if(E.lencode=E.lendyn,E.lenbits=7,Q={bits:E.lenbits},re=c(0,E.lens,0,19,E.lencode,0,E.work,Q),E.lenbits=Q.bits,re){N.msg="invalid code lengths set",E.mode=30;break}E.have=0,E.mode=19;case 19:for(;E.have<E.nlen+E.ndist;){for(;U=(j=E.lencode[Z&(1<<E.lenbits)-1])>>>16&255,P=65535&j,!((A=j>>>24)<=R);){if(J===0)break e;J--,Z+=K[G++]<<R,R+=8}if(P<16)Z>>>=A,R-=A,E.lens[E.have++]=P;else{if(P===16){for(L=A+2;R<L;){if(J===0)break e;J--,Z+=K[G++]<<R,R+=8}if(Z>>>=A,R-=A,E.have===0){N.msg="invalid bit length repeat",E.mode=30;break}S=E.lens[E.have-1],se=3+(3&Z),Z>>>=2,R-=2}else if(P===17){for(L=A+3;R<L;){if(J===0)break e;J--,Z+=K[G++]<<R,R+=8}R-=A,S=0,se=3+(7&(Z>>>=A)),Z>>>=3,R-=3}else{for(L=A+7;R<L;){if(J===0)break e;J--,Z+=K[G++]<<R,R+=8}R-=A,S=0,se=11+(127&(Z>>>=A)),Z>>>=7,R-=7}if(E.have+se>E.nlen+E.ndist){N.msg="invalid bit length repeat",E.mode=30;break}for(;se--;)E.lens[E.have++]=S}}if(E.mode===30)break;if(E.lens[256]===0){N.msg="invalid code -- missing end-of-block",E.mode=30;break}if(E.lenbits=9,Q={bits:E.lenbits},re=c(u,E.lens,0,E.nlen,E.lencode,0,E.work,Q),E.lenbits=Q.bits,re){N.msg="invalid literal/lengths set",E.mode=30;break}if(E.distbits=6,E.distcode=E.distdyn,Q={bits:E.distbits},re=c(d,E.lens,E.nlen,E.ndist,E.distcode,0,E.work,Q),E.distbits=Q.bits,re){N.msg="invalid distances set",E.mode=30;break}if(E.mode=20,W===6)break e;case 20:E.mode=21;case 21:if(6<=J&&258<=ue){N.next_out=ce,N.avail_out=ue,N.next_in=G,N.avail_in=J,E.hold=Z,E.bits=R,l(N,te),ce=N.next_out,ie=N.output,ue=N.avail_out,G=N.next_in,K=N.input,J=N.avail_in,Z=E.hold,R=E.bits,E.mode===12&&(E.back=-1);break}for(E.back=0;U=(j=E.lencode[Z&(1<<E.lenbits)-1])>>>16&255,P=65535&j,!((A=j>>>24)<=R);){if(J===0)break e;J--,Z+=K[G++]<<R,R+=8}if(U&&!(240&U)){for(F=A,B=U,le=P;U=(j=E.lencode[le+((Z&(1<<F+B)-1)>>F)])>>>16&255,P=65535&j,!(F+(A=j>>>24)<=R);){if(J===0)break e;J--,Z+=K[G++]<<R,R+=8}Z>>>=F,R-=F,E.back+=F}if(Z>>>=A,R-=A,E.back+=A,E.length=P,U===0){E.mode=26;break}if(32&U){E.back=-1,E.mode=12;break}if(64&U){N.msg="invalid literal/length code",E.mode=30;break}E.extra=15&U,E.mode=22;case 22:if(E.extra){for(L=E.extra;R<L;){if(J===0)break e;J--,Z+=K[G++]<<R,R+=8}E.length+=Z&(1<<E.extra)-1,Z>>>=E.extra,R-=E.extra,E.back+=E.extra}E.was=E.length,E.mode=23;case 23:for(;U=(j=E.distcode[Z&(1<<E.distbits)-1])>>>16&255,P=65535&j,!((A=j>>>24)<=R);){if(J===0)break e;J--,Z+=K[G++]<<R,R+=8}if(!(240&U)){for(F=A,B=U,le=P;U=(j=E.distcode[le+((Z&(1<<F+B)-1)>>F)])>>>16&255,P=65535&j,!(F+(A=j>>>24)<=R);){if(J===0)break e;J--,Z+=K[G++]<<R,R+=8}Z>>>=F,R-=F,E.back+=F}if(Z>>>=A,R-=A,E.back+=A,64&U){N.msg="invalid distance code",E.mode=30;break}E.offset=P,E.extra=15&U,E.mode=24;case 24:if(E.extra){for(L=E.extra;R<L;){if(J===0)break e;J--,Z+=K[G++]<<R,R+=8}E.offset+=Z&(1<<E.extra)-1,Z>>>=E.extra,R-=E.extra,E.back+=E.extra}if(E.offset>E.dmax){N.msg="invalid distance too far back",E.mode=30;break}E.mode=25;case 25:if(ue===0)break e;if(se=te-ue,E.offset>se){if((se=E.offset-se)>E.whave&&E.sane){N.msg="invalid distance too far back",E.mode=30;break}X=se>E.wnext?(se-=E.wnext,E.wsize-se):E.wnext-se,se>E.length&&(se=E.length),O=E.window}else O=ie,X=ce-E.offset,se=E.length;for(ue<se&&(se=ue),ue-=se,E.length-=se;ie[ce++]=O[X++],--se;);E.length===0&&(E.mode=21);break;case 26:if(ue===0)break e;ie[ce++]=E.length,ue--,E.mode=21;break;case 27:if(E.wrap){for(;R<32;){if(J===0)break e;J--,Z|=K[G++]<<R,R+=8}if(te-=ue,N.total_out+=te,E.total+=te,te&&(N.adler=E.check=E.flags?a(E.check,ie,te,ce-te):s(E.check,ie,te,ce-te)),te=ue,(E.flags?Z:g(Z))!==E.check){N.msg="incorrect data check",E.mode=30;break}R=Z=0}E.mode=28;case 28:if(E.wrap&&E.flags){for(;R<32;){if(J===0)break e;J--,Z+=K[G++]<<R,R+=8}if(Z!==(4294967295&E.total)){N.msg="incorrect length check",E.mode=30;break}R=Z=0}E.mode=29;case 29:re=1;break e;case 30:re=-3;break e;case 31:return-4;case 32:default:return f}return N.next_out=ce,N.avail_out=ue,N.next_in=G,N.avail_in=J,E.hold=Z,E.bits=R,(E.wsize||te!==N.avail_out&&E.mode<30&&(E.mode<27||W!==4))&&oe(N,N.output,N.next_out,te-N.avail_out)?(E.mode=31,-4):(ee-=N.avail_in,te-=N.avail_out,N.total_in+=ee,N.total_out+=te,E.total+=te,E.wrap&&te&&(N.adler=E.check=E.flags?a(E.check,ie,te,N.next_out-te):s(E.check,ie,te,N.next_out-te)),N.data_type=E.bits+(E.last?64:0)+(E.mode===12?128:0)+(E.mode===20||E.mode===15?256:0),(ee==0&&te===0||W===4)&&re===p&&(re=-5),re)},o.inflateEnd=function(N){if(!N||!N.state)return f;var W=N.state;return W.window&&(W.window=null),N.state=null,p},o.inflateGetHeader=function(N,W){var E;return N&&N.state&&2&(E=N.state).wrap?((E.head=W).done=!1,p):f},o.inflateSetDictionary=function(N,W){var E,K=W.length;return N&&N.state?(E=N.state).wrap!==0&&E.mode!==11?f:E.mode===11&&s(1,W,K,0)!==E.check?-3:oe(N,W,K,K)?(E.mode=31,-4):(E.havedict=1,p):f},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,p,f,h,m,y,g){var x,k,b,T,D,M,I,C,V,oe=g.bits,N=0,W=0,E=0,K=0,ie=0,G=0,ce=0,J=0,ue=0,Z=0,R=null,ee=0,te=new i.Buf16(16),se=new i.Buf16(16),X=null,O=0;for(N=0;N<=15;N++)te[N]=0;for(W=0;W<f;W++)te[d[p+W]]++;for(ie=oe,K=15;1<=K&&te[K]===0;K--);if(K<ie&&(ie=K),K===0)return h[m++]=20971520,h[m++]=20971520,g.bits=1,0;for(E=1;E<K&&te[E]===0;E++);for(ie<E&&(ie=E),N=J=1;N<=15;N++)if(J<<=1,(J-=te[N])<0)return-1;if(0<J&&(u===0||K!==1))return-1;for(se[1]=0,N=1;N<15;N++)se[N+1]=se[N]+te[N];for(W=0;W<f;W++)d[p+W]!==0&&(y[se[d[p+W]]++]=W);if(M=u===0?(R=X=y,19):u===1?(R=s,ee-=257,X=a,O-=257,256):(R=l,X=c,-1),N=E,D=m,ce=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-ce,V=y[W]<M?(C=0,y[W]):y[W]>M?(C=X[O+y[W]],R[ee+y[W]]):(C=96,0),x=1<<N-ce,E=k=1<<G;h[D+(Z>>ce)+(k-=x)]=I<<24|C<<16|V|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===K)break;N=d[p+y[W]]}if(ie<N&&(Z&T)!==b){for(ce===0&&(ce=ie),D+=E,J=1<<(G=N-ce);G+ce<K&&!((J-=te[G+ce])<=0);)G++,J<<=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-ce<<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,p=d+1+u,f=30,h=19,m=2*p+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],C=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],V=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],oe=new Array(2*(p+2));l(oe);var N=new Array(2*f);l(N);var W=new Array(512);l(W);var E=new Array(256);l(E);var K=new Array(u);l(K);var ie,G,ce,J=new Array(f);function ue(j,z,de,fe,ae){this.static_tree=j,this.extra_bits=z,this.extra_base=de,this.elems=fe,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 R(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,de){j.bi_valid>g-de?(j.bi_buf|=z<<j.bi_valid&65535,ee(j,j.bi_buf),j.bi_buf=z>>g-j.bi_valid,j.bi_valid+=de-g):(j.bi_buf|=z<<j.bi_valid&65535,j.bi_valid+=de)}function se(j,z,de){te(j,de[2*z],de[2*z+1])}function X(j,z){for(var de=0;de|=1&j,j>>>=1,de<<=1,0<--z;);return de>>>1}function O(j,z,de){var fe,ae,he=new Array(y+1),we=0;for(fe=1;fe<=y;fe++)he[fe]=we=we+de[fe-1]<<1;for(ae=0;ae<=z;ae++){var me=j[2*ae+1];me!==0&&(j[2*ae]=X(he[me]++,me))}}function A(j){var z;for(z=0;z<p;z++)j.dyn_ltree[2*z]=0;for(z=0;z<f;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 U(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,de,fe){var ae=2*z,he=2*de;return j[ae]<j[he]||j[ae]===j[he]&&fe[z]<=fe[de]}function F(j,z,de){for(var fe=j.heap[de],ae=de<<1;ae<=j.heap_len&&(ae<j.heap_len&&P(z,j.heap[ae+1],j.heap[ae],j.depth)&&ae++,!P(z,fe,j.heap[ae],j.depth));)j.heap[de]=j.heap[ae],de=ae,ae<<=1;j.heap[de]=fe}function B(j,z,de){var fe,ae,he,we,me=0;if(j.last_lit!==0)for(;fe=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++,fe===0?se(j,ae,z):(se(j,(he=E[ae])+d+1,z),(we=M[he])!==0&&te(j,ae-=K[he],we),se(j,he=R(--fe),de),(we=I[he])!==0&&te(j,fe-=J[he],we)),me<j.last_lit;);se(j,k,z)}function le(j,z){var de,fe,ae,he=z.dyn_tree,we=z.stat_desc.static_tree,me=z.stat_desc.has_stree,xe=z.stat_desc.elems,Re=-1;for(j.heap_len=0,j.heap_max=m,de=0;de<xe;de++)he[2*de]!==0?(j.heap[++j.heap_len]=Re=de,j.depth[de]=0):he[2*de+1]=0;for(;j.heap_len<2;)he[2*(ae=j.heap[++j.heap_len]=Re<2?++Re:0)]=1,j.depth[ae]=0,j.opt_len--,me&&(j.static_len-=we[2*ae+1]);for(z.max_code=Re,de=j.heap_len>>1;1<=de;de--)F(j,he,de);for(ae=xe;de=j.heap[1],j.heap[1]=j.heap[j.heap_len--],F(j,he,1),fe=j.heap[1],j.heap[--j.heap_max]=de,j.heap[--j.heap_max]=fe,he[2*ae]=he[2*de]+he[2*fe],j.depth[ae]=(j.depth[de]>=j.depth[fe]?j.depth[de]:j.depth[fe])+1,he[2*de+1]=he[2*fe+1]=ae,j.heap[1]=ae++,F(j,he,1),2<=j.heap_len;);j.heap[--j.heap_max]=j.heap[1],function(Ee,rt){var v,$,_,Y,q,H,ne=rt.dyn_tree,ye=rt.max_code,ve=rt.stat_desc.static_tree,ke=rt.stat_desc.has_stree,Te=rt.stat_desc.extra_bits,Ne=rt.stat_desc.extra_base,Je=rt.stat_desc.max_length,st=0;for(Y=0;Y<=y;Y++)Ee.bl_count[Y]=0;for(ne[2*Ee.heap[Ee.heap_max]+1]=0,v=Ee.heap_max+1;v<m;v++)Je<(Y=ne[2*ne[2*($=Ee.heap[v])+1]+1]+1)&&(Y=Je,st++),ne[2*$+1]=Y,ye<$||(Ee.bl_count[Y]++,q=0,Ne<=$&&(q=Te[$-Ne]),H=ne[2*$],Ee.opt_len+=H*(Y+q),ke&&(Ee.static_len+=H*(ve[2*$+1]+q)));if(st!==0){do{for(Y=Je-1;Ee.bl_count[Y]===0;)Y--;Ee.bl_count[Y]--,Ee.bl_count[Y+1]+=2,Ee.bl_count[Je]--,st-=2}while(0<st);for(Y=Je;Y!==0;Y--)for($=Ee.bl_count[Y];$!==0;)ye<(_=Ee.heap[--v])||(ne[2*_+1]!==Y&&(Ee.opt_len+=(Y-ne[2*_+1])*ne[2*_],ne[2*_+1]=Y),$--)}}(j,z),O(he,Re,j.bl_count)}function S(j,z,de){var fe,ae,he=-1,we=z[1],me=0,xe=7,Re=4;for(we===0&&(xe=138,Re=3),z[2*(de+1)+1]=65535,fe=0;fe<=de;fe++)ae=we,we=z[2*(fe+1)+1],++me<xe&&ae===we||(me<Re?j.bl_tree[2*ae]+=me:ae!==0?(ae!==he&&j.bl_tree[2*ae]++,j.bl_tree[2*b]++):me<=10?j.bl_tree[2*T]++:j.bl_tree[2*D]++,he=ae,Re=(me=0)===we?(xe=138,3):ae===we?(xe=6,3):(xe=7,4))}function re(j,z,de){var fe,ae,he=-1,we=z[1],me=0,xe=7,Re=4;for(we===0&&(xe=138,Re=3),fe=0;fe<=de;fe++)if(ae=we,we=z[2*(fe+1)+1],!(++me<xe&&ae===we)){if(me<Re)for(;se(j,ae,j.bl_tree),--me!=0;);else ae!==0?(ae!==he&&(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));he=ae,Re=(me=0)===we?(xe=138,3):ae===we?(xe=6,3):(xe=7,4)}}l(J);var Q=!1;function L(j,z,de,fe){te(j,(c<<1)+(fe?1:0),3),function(ae,he,we,me){U(ae),ee(ae,we),ee(ae,~we),i.arraySet(ae.pending_buf,ae.window,he,we,ae.pending),ae.pending+=we}(j,z,de)}o._tr_init=function(j){Q||(function(){var z,de,fe,ae,he,we=new Array(y+1);for(ae=fe=0;ae<u-1;ae++)for(K[ae]=fe,z=0;z<1<<M[ae];z++)E[fe++]=ae;for(E[fe-1]=ae,ae=he=0;ae<16;ae++)for(J[ae]=he,z=0;z<1<<I[ae];z++)W[he++]=ae;for(he>>=7;ae<f;ae++)for(J[ae]=he<<7,z=0;z<1<<I[ae]-7;z++)W[256+he++]=ae;for(de=0;de<=y;de++)we[de]=0;for(z=0;z<=143;)oe[2*z+1]=8,z++,we[8]++;for(;z<=255;)oe[2*z+1]=9,z++,we[9]++;for(;z<=279;)oe[2*z+1]=7,z++,we[7]++;for(;z<=287;)oe[2*z+1]=8,z++,we[8]++;for(O(oe,p+1,we),z=0;z<f;z++)N[2*z+1]=5,N[2*z]=X(z,5);ie=new ue(oe,M,d+1,p,y),G=new ue(N,I,0,f,y),ce=new ue(new Array(0),C,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,ce),j.bi_buf=0,j.bi_valid=0,A(j)},o._tr_stored_block=L,o._tr_flush_block=function(j,z,de,fe){var ae,he,we=0;0<j.level?(j.strm.data_type===2&&(j.strm.data_type=function(me){var xe,Re=4093624447;for(xe=0;xe<=31;xe++,Re>>>=1)if(1&Re&&me.dyn_ltree[2*xe]!==0)return s;if(me.dyn_ltree[18]!==0||me.dyn_ltree[20]!==0||me.dyn_ltree[26]!==0)return a;for(xe=32;xe<d;xe++)if(me.dyn_ltree[2*xe]!==0)return a;return s}(j)),le(j,j.l_desc),le(j,j.d_desc),we=function(me){var xe;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),xe=h-1;3<=xe&&me.bl_tree[2*V[xe]+1]===0;xe--);return me.opt_len+=3*(xe+1)+5+5+4,xe}(j),ae=j.opt_len+3+7>>>3,(he=j.static_len+3+7>>>3)<=ae&&(ae=he)):ae=he=de+5,de+4<=ae&&z!==-1?L(j,z,de,fe):j.strategy===4||he===ae?(te(j,2+(fe?1:0),3),B(j,oe,N)):(te(j,4+(fe?1:0),3),function(me,xe,Re,Ee){var rt;for(te(me,xe-257,5),te(me,Re-1,5),te(me,Ee-4,4),rt=0;rt<Ee;rt++)te(me,me.bl_tree[2*V[rt]+1],3);re(me,me.dyn_ltree,xe-1),re(me,me.dyn_dtree,Re-1)}(j,j.l_desc.max_code+1,j.d_desc.max_code+1,we+1),B(j,j.dyn_ltree,j.dyn_dtree)),A(j),fe&&U(j)},o._tr_tally=function(j,z,de){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&de,j.last_lit++,z===0?j.dyn_ltree[2*de]++:(j.matches++,z--,j.dyn_ltree[2*(E[de]+d+1)]++,j.dyn_dtree[2*R(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,p=1,f={},h=!1,m=s.document,y=Object.getPrototypeOf&&Object.getPrototypeOf(s);y=y&&y.setTimeout?y:s,l={}.toString.call(s.process)==="[object process]"?function(b){Se.nextTick(function(){x(b)})}:function(){if(s.postMessage&&!s.importScripts){var b=!0,T=s.onmessage;return s.onmessage=function(){b=!1},s.postMessage("","*"),s.onmessage=T,b}}()?(d="setImmediate$"+Math.random()+"$",s.addEventListener?s.addEventListener("message",k,!1):s.attachEvent("onmessage",k),function(b){s.postMessage(d+b,"*")}):s.MessageChannel?((u=new MessageChannel).port1.onmessage=function(b){x(b.data)},function(b){u.port2.postMessage(b)}):m&&"onreadystatechange"in m.createElement("script")?(c=m.documentElement,function(b){var T=m.createElement("script");T.onreadystatechange=function(){x(b),T.onreadystatechange=null,c.removeChild(T),T=null},c.appendChild(T)}):function(b){setTimeout(x,0,b)},y.setImmediate=function(b){typeof b!="function"&&(b=new Function(""+b));for(var T=new Array(arguments.length-1),D=0;D<T.length;D++)T[D]=arguments[D+1];var M={callback:b,args:T};return f[p]=M,l(p),p++},y.clearImmediate=g}function g(b){delete f[b]}function x(b){if(h)setTimeout(x,0,b);else{var T=f[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)})})(p1);var f$=p1.exports;const Dd=zl(f$);let _d=class{constructor(e={}){this.debug=e.debug||!1,this.zip=new Dd,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),p=await c.async("base64");this.mediaFiles[c.name]=`data:image/${d};base64,${p}`;const f=new File([u],c.name,{type:u.type}),h=URL.createObjectURL(f);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(y=>this.getFileExtension(y)),o="[Content_Types].xml",i=await e.file(o).async("string");let s="";const a=SA(i),l=new Set;for(let y of r){if(a.includes(y)||l.has(y))continue;const g=`<Default Extension="${y}" ContentType="image/${y}"/>`;s+=g,l.add(y)}const c=JSON.parse(Yp.xml2json(i,null,2)).elements?.find(y=>y.name==="Types")||{},u=c.elements?.some(y=>y.name==="Override"&&y.attributes.PartName==="/word/comments.xml"),d=c.elements?.some(y=>y.name==="Override"&&y.attributes.PartName==="/word/commentsExtended.xml"),p=c.elements?.some(y=>y.name==="Override"&&y.attributes.PartName==="/word/commentsIds.xml"),f=c.elements?.some(y=>y.name==="Override"&&y.attributes.PartName==="/word/commentsExtensible.xml");e.files["word/comments.xml"]&&(u||(s+='<Override PartName="/word/comments.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml" />')),e.files["word/commentsExtended.xml"]&&(d||(s+='<Override PartName="/word/commentsExtended.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.commentsExtended+xml" />')),e.files["word/commentsIds.xml"]&&(p||(s+='<Override PartName="/word/commentsIds.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.commentsIds+xml" />')),e.files["word/commentsExtensible.xml"]&&(f||(s+='<Override PartName="/word/commentsExtensible.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.commentsExtensible+xml" />'));const h='<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types">',m=i.replace(h,`${h}${s}`);e.file(o,m)}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 Dd;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=mt.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 h$=Object.defineProperty,f1=t=>{throw TypeError(t)},m$=(t,e,n)=>e in t?h$(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Fe=(t,e,n)=>m$(t,typeof e!="symbol"?e+"":e,n),of=(t,e,n)=>e.has(t)||f1("Cannot "+n),Jn=(t,e,n)=>(of(t,e,"read from private field"),n?n.call(t):e.get(t)),Tr=(t,e,n)=>e.has(t)?f1("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),h1=(t,e,n,r)=>(of(t,e,"write to private field"),e.set(t,n),n),Oe=(t,e,n)=>(of(t,e,"access private method"),n);function Hs(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 Xl=(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,p)=>{if(d.marks){const f=d.marks.find(h=>h.type===e);f&&(c={from:p,to:p+d.nodeSize,attrs:f.attrs,contained:!a||!l||a===l},u.push(c))}}),n?u:c};function sf(t){const{state:e}=t,{selection:n}=e,r=Hs(e),o=n.$head.parent.attrs.marksAttrs,i=r.filter(f=>!["textStyle","link"].includes(f.type.name)).map(f=>({name:f.type.name,attrs:f.attrs})),s=r.filter(f=>f.type.name==="textStyle");if(i.push(...s.flatMap(Pg)),o){const f=o.filter(m=>!["textStyle","link"].includes(m.type)).map(m=>({name:m.type,attrs:m.attrs||{}})),h=o.filter(m=>m.type==="textStyle");i.push(...f),i.push(...h.flatMap(Pg))}const a=e.schema.marks.link,l=Xl(e,a);if(l){let{from:f,to:h,attrs:m}=l;n.from>=f&&n.to<=h&&i.push({name:"link",attrs:m})}const c=["paragraphSpacing"],u=g$(e);Object.keys(u).forEach(f=>{if(c.includes(f))return;const h={};h[f]=u[f],i.push({name:f,attrs:h})});const d=i.find(f=>f.name==="textColor"),p=i.find(f=>f.name==="textHighlight");return d&&i.push({name:"color",attrs:{color:d.attrs?.textColor}}),p&&i.push({name:"highlight",attrs:{color:p.attrs?.textHighlight}}),t.storage.formatCommands?.storedStyle&&i.push({name:"copyFormat",attrs:!0}),i}function Pg(t){const e=[],{attrs:n}=t;return Object.keys(n).forEach(r=>{n[r]&&e.push({name:r,attrs:{[r]:n[r]}})}),e}function g$(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 dl=200,xt=function(){};xt.prototype.append=function(t){return t.length?(t=xt.from(t),!this.length&&t||t.length<dl&&this.leafAppend(t)||this.length<dl&&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 y$(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 m1(t):xt.empty};var m1=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<=dl)return new e(this.values.concat(r.flatten()))},e.prototype.leafPrepend=function(r){if(this.length+r.length<=dl)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 m1([]);var y$=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 w$=500;let ys=class Po{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,p)=>{if(!d.step){o||(o=this.remapping(r,p+1),i=o.maps.length),i--,u.push(d);return}if(o){u.push(new pr(d.map));let f=d.step.map(o.slice(i)),h;f&&s.maybeStep(f).doc&&(h=s.mapping.maps[s.mapping.maps.length-1],c.push(new pr(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 Po(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]),p=new pr(e.mapping.maps[u],d,n),f;(f=l&&l.merge(p))&&(p=f,u?i.pop():a=a.slice(0,a.length-1)),i.push(p),n&&(s++,n=void 0),o||(l=p)}let c=s-r.depth;return c>v$&&(a=b$(a,c),s-=c),new Po(a.append(i),s)}remapping(e,n){let r=new ni;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 Po(this.items.append(e.map(n=>new pr(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(p=>{p.selection&&a--},o);let l=n;this.items.forEach(p=>{let f=i.getMirror(--l);if(f==null)return;s=Math.min(s,f);let h=i.maps[f];if(p.step){let m=e.steps[f].invert(e.docs[f]),y=p.selection&&p.selection.map(i.slice(l+1,f));y&&a++,r.push(new pr(h,m,y))}else r.push(new pr(h))},o);let c=[];for(let p=n;p<s;p++)c.push(new pr(i.maps[p]));let u=this.items.slice(0,o).append(c).append(r),d=new Po(u,a);return d.emptyItemCount()>w$&&(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 pr(c.invert(),l,u),p,f=o.length-1;(p=o.length&&o[f].merge(d))?o[f]=p:o.push(d)}}else s.map&&r--},this.items.length,0),new Po(xt.from(o.reverse()),i)}};ys.empty=new ys(xt.empty,0);function b$(t,e){let n;return t.forEach((r,o)=>{if(r.selection&&e--==0)return n=o,!1}),t.slice(n)}let pr=class g1{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 g1(n.getMap().invert(),n,this.selection)}}};class br{constructor(e,n,r,o,i){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=o,this.prevComposition=i}}const v$=20;function x$(t,e,n,r){let o=n.getMeta(nr),i;if(o)return o.historyState;n.getMeta(E$)&&(t=new br(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 br(t.done.addTransform(n,void 0,r,qa(e)),t.undone,zg(n.mapping.maps),t.prevTime,t.prevComposition):new br(t.done,t.undone.addTransform(n,void 0,r,qa(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||!k$(n,t.prevRanges)),c=s?bu(t.prevRanges,n.mapping):zg(n.mapping.maps);return new br(t.done.addTransform(n,l?e.selection.getBookmark():void 0,r,qa(e)),ys.empty,c,n.time,a??t.prevComposition)}else return(i=n.getMeta("rebased"))?new br(t.done.rebased(n,i),t.undone.rebased(n,i),bu(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new br(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),bu(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function k$(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 zg(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 bu(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 S$(t,e,n){let r=qa(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 br(n?a:i.remaining,n?i.remaining:a,null,0,-1);return i.transform.setSelection(s).setMeta(nr,{redo:n,historyState:l})}let vu=!1,jg=null;function qa(t){let e=t.plugins;if(jg!=e){vu=!1,jg=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){vu=!0;break}}return vu}const nr=new Ge("history"),E$=new Ge("closeHistory");function C$(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new He({key:nr,state:{init(){return new br(ys.empty,ys.empty,null,0,-1)},apply(e,n,r){return x$(n,r,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let r=n.inputType,o=r=="historyUndo"?w1:r=="historyRedo"?b1:null;return o?(n.preventDefault(),o(e.state,e.dispatch)):!1}}}})}function y1(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=S$(o,n,t);i&&r(i.scrollIntoView())}return!0}}const w1=y1(!1),b1=y1(!0);function A$(t){let e=nr.getState(t);return e?e.done.eventCount:0}function $$(t){let e=nr.getState(t);return e?e.undone.eventCount:0}function Ie(t,e,n={}){return typeof t.config[e]=="function"?t.config[e].bind({...n}):t.config[e]}class Ye{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=Ke(Ie(this,"addOptions",{name:this.name}))),this.storage=Ke(Ie(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(...e){return new Ye(...e)}}const v1=Ye.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addPmPlugins(){return[C$(this.options)]},addCommands(){return{undo:()=>({state:t,dispatch:e,tr:n})=>(n.setMeta("inputType","historyUndo"),w1(t,e)),redo:()=>({state:t,dispatch:e,tr:n})=>(n.setMeta("inputType","historyRedo"),b1(t,e))}},addShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Mod-Shift-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo()}}});class Ue{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=Ke(Ie(this,"addOptions",{name:this.name}))),this.storage=Ke(Ie(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(...e){return new Ue(...e)}}let tn=class x1{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=Ke(Ie(this,"addOptions",{name:this.name}))),this.storage=Ke(Ie(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(...e){return new x1(...e)}};function pt(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 lr(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 Ws(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}var pl,k1,S1;class Ce{static getAttributesFromExtensions(e){const n=[],r={default:null,rendered:!0,renderDOM:null,parseDOM:null,keepOnSplit:!0},o=Oe(this,pl,k1).call(this,e,r),i=Oe(this,pl,S1).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=lr(n,e.schema),o=Hs(e).find(i=>i.type.name===r.name);return o?{...o.attrs}:{}}static getNodeAttributes(e,n){const r=pt(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=Ws(typeof n=="string"?n:n.name,e.schema);return r==="node"?this.getNodeAttributes(e,n):r==="mark"?this.getMarkAttributes(e,n):{}}}pl=new WeakSet,k1=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=Ie(o,"addGlobalAttributes",i);if(!s)continue;const a=s();for(const l of a)r(l)}return n},S1=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=Ie(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},Tr(Ce,pl);function Nd(t){const e=Object.entries(t).filter(([n,r])=>n==="attrs"&&mA(r)?!1:r!=null);return Object.fromEntries(e)}var fl,E1,C1;const A1=class Id{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=>Ie(d,"topNode"))?.name,l=Ce.getAttributesFromExtensions(e),c=Oe(r=Id,fl,E1).call(r,i,l,n),u=Oe(o=Id,fl,C1).call(o,s,l,n);return new rv({topNode:a,nodes:c,marks:u})}};fl=new WeakSet,E1=function(t,e,n){const r=t.map(o=>{const i=e.filter(f=>f.type===o.name),s={name:o.name,options:o.options,storage:o.storage,editor:n},a=Object.fromEntries(i.map(f=>[f.name,{default:f?.attribute?.default}])),l=t.reduce((f,h)=>{const m=Ie(h,"extendNodeSchema",s);return{...f,...m?m(o):{}}},{}),c=Nd({content:Ke(Ie(o,"content",s)),group:Ke(Ie(o,"group",s)),marks:Ke(Ie(o,"marks",s)),inline:Ke(Ie(o,"inline",s)),atom:Ke(Ie(o,"atom",s)),selectable:Ke(Ie(o,"selectable",s)),draggable:Ke(Ie(o,"draggable",s)),code:Ke(Ie(o,"code",s)),defining:Ke(Ie(o,"defining",s)),isolating:Ke(Ie(o,"isolating",s)),attrs:a,...l}),u=Ke(Ie(o,"parseDOM",s));u&&(c.parseDOM=u.map(f=>Ce.insertExtensionAttrsToParseRule(f,i)));const d=Ie(o,"renderDOM",s);d&&(c.toDOM=f=>d({node:f,htmlAttributes:Ce.getAttributesToRender(f,i)}));const p=Ie(o,"renderText",s);return p&&(c.toText=p),[o.name,c]});return Object.fromEntries(r)},C1=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=Nd({group:Ke(Ie(o,"group",s)),inclusive:Ke(Ie(o,"inclusive",s)),excludes:Ke(Ie(o,"excludes",s)),spanning:Ke(Ie(o,"spanning",s)),code:Ke(Ie(o,"code",s)),attrs:a}),c=Ke(Ie(o,"parseDOM",s));c&&(l.parseDOM=c.map(d=>Ce.insertExtensionAttrsToParseRule(d,i)));const u=Ie(o,"renderDOM",s);return u&&(l.toDOM=d=>u({mark:d,htmlAttributes:Ce.getAttributesToRender(d,i)})),[o.name,l]});return Object.fromEntries(r)},Tr(A1,fl);let T$=A1;function af(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 $1=class T1{constructor(e){Fe(this,"editor"),Fe(this,"rawCommands"),this.editor=e.editor,this.rawCommands=this.editor.extensionService.commands}static create(...e){return new T1(...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(f=>f===!0)),d=Object.entries(i).map(([f,h])=>[f,(...m)=>{const y=this.createProps(c,n),g=h(...m)(y);return a.push(g),p}]),p={...Object.fromEntries(d),run:u};return p}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:af(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}};const O$=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},M$=t=>e=>t(e),D$=()=>({tr:t})=>(t.insertText(" ",t.selection.from,t.selection.to),!0),_$=()=>({tr:t,state:e})=>{let n=t.selection.from;const r=e.schema.nodes.tab.create();return t.insert(n,r),!0},N$=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),lf=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function I$(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const O1=(t,e,n)=>{let r=I$(t,n);if(!r)return!1;let o=D1(r);if(!o){let s=r.blockRange(),a=s&&Vs(s);return a==null?!1:(e&&e(t.tr.lift(s,a).scrollIntoView()),!0)}let i=o.nodeBefore;if(L1(t,o,e,-1))return!0;if(r.parent.content.size==0&&(li(i,"end")||_e.isSelectable(i)))for(let s=r.depth;;s--){let a=tf(t.doc,r.before(s),r.after(s),be.empty);if(a&&a.slice.size<a.to-a.from){if(e){let l=t.tr.step(a);l.setSelection(li(i,"end")?ze.findFrom(l.doc.resolve(l.mapping.map(o.pos,-1)),-1):_e.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 li(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 M1=(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=D1(r)}let s=i&&i.nodeBefore;return!s||!_e.isSelectable(s)?!1:(e&&e(t.tr.setSelection(_e.create(t.doc,i.pos-s.nodeSize)).scrollIntoView()),!0)};function D1(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 F$(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset<n.parent.content.size)?null:n}const _1=(t,e,n)=>{let r=F$(t,n);if(!r)return!1;let o=I1(r);if(!o)return!1;let i=o.nodeAfter;if(L1(t,o,e,1))return!0;if(r.parent.content.size==0&&(li(i,"start")||_e.isSelectable(i))){let s=tf(t.doc,r.before(),r.after(),be.empty);if(s&&s.slice.size<s.to-s.from){if(e){let a=t.tr.step(s);a.setSelection(li(i,"start")?ze.findFrom(a.doc.resolve(a.mapping.map(o.pos)),1):_e.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},N1=(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=I1(r)}let s=i&&i.nodeAfter;return!s||!_e.isSelectable(s)?!1:(e&&e(t.tr.setSelection(_e.create(t.doc,i.pos)).scrollIntoView()),!0)};function I1(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 R$=(t,e)=>{let n=t.selection,r=n instanceof _e,o;if(r){if(n.node.isTextblock||!Pr(t.doc,n.from))return!1;o=n.from}else if(o=gv(t.doc,n.from,-1),o==null)return!1;if(e){let i=t.tr.join(o);r&&i.setSelection(_e.create(i.doc,o-t.doc.resolve(o).nodeBefore.nodeSize)),e(i.scrollIntoView())}return!0},B$=(t,e)=>{let n=t.selection,r;if(n instanceof _e){if(n.node.isTextblock||!Pr(t.doc,n.to))return!1;r=n.to}else if(r=gv(t.doc,n.to,1),r==null)return!1;return e&&e(t.tr.join(r).scrollIntoView()),!0},F1=(t,e)=>{let{$head:n,$anchor:r}=t.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(e&&e(t.tr.insertText(`
|
|
40
40
|
`).scrollIntoView()),!0)};function cf(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 L$=(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=cf(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(ze.near(l.doc.resolve(a),1)),e(l.scrollIntoView())}return!0},R1=(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=cf(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},B1=(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&&Vs(r);return o==null?!1:(e&&e(t.tr.lift(r,o).scrollIntoView()),!0)};function P$(t){return(e,n)=>{let{$from:r,$to:o}=e.selection;if(e.selection instanceof _e&&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 f=r.depth;;f--)if(r.node(f).isBlock){l=r.end(f)==r.pos+(r.depth-f),c=r.start(f)==r.pos-(r.depth-f),a=cf(r.node(f-1).contentMatchAt(r.indexAfter(f-1))),i.unshift(l&&a?{type:a}:null),s=f;break}else{if(f==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),p=er(u.doc,d,i.length,i);if(p||(i[0]=a?{type:a}:null,p=er(u.doc,d,i.length,i)),!p)return!1;if(u.split(d,i.length,i),!l&&c&&r.node(s).type!=a){let f=u.mapping.map(r.before(s)),h=u.doc.resolve(f);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 z$=P$(),j$=(t,e)=>(e&&e(t.tr.setSelection(new _n(t.doc))),!0);function q$(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||Pr(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function L1(t,e,n,r){let o=e.nodeBefore,i=e.nodeAfter,s,a,l=o.type.spec.isolating||i.type.spec.isolating;if(!l&&q$(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 f=e.pos+i.nodeSize,h=ge.empty;for(let g=s.length-1;g>=0;g--)h=ge.from(s[g].create(null,h));h=ge.from(o.copy(h));let m=t.tr.step(new Zt(e.pos-1,f,e.pos,f,new be(h,1,0),s.length,!0)),y=m.doc.resolve(f+2*s.length);y.nodeAfter&&y.nodeAfter.type==o.type&&Pr(m.doc,y.pos)&&m.join(y.pos),n(m.scrollIntoView())}return!0}let u=i.type.spec.isolating||r>0&&l?null:ze.findFrom(e,1),d=u&&u.$from.blockRange(u.$to),p=d&&Vs(d);if(p!=null&&p>=e.depth)return n&&n(t.tr.lift(d,p).scrollIntoView()),!0;if(c&&li(i,"start",!0)&&li(o,"end")){let f=o,h=[];for(;h.push(f),!f.isTextblock;)f=f.lastChild;let m=i,y=1;for(;!m.isTextblock;m=m.firstChild)y++;if(f.canReplace(f.childCount,f.childCount,m.content)){if(n){let g=ge.empty;for(let k=h.length-1;k>=0;k--)g=ge.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 be(g,h.length,0),0,!0));n(x.scrollIntoView())}return!0}}return!1}function P1(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 V$=P1(-1),U$=P1(1);function qg(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 uf(...t){return function(e,n,r){for(let o=0;o<t.length;o++)if(t[o](e,n,r))return!0;return!1}}uf(lf,O1,M1);uf(lf,_1,N1);uf(F1,R1,B1,z$);typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function z1(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 Vg=(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)}},H$=({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=Ce.getSplittedAttributes(u,l.node().type.name,l.node().attrs);if(s instanceof _e&&s.node.isBlock)return!l.parentOffset||!er(a,l.pos)?!1:(o&&(t&&Vg(r,i.extensionService.splittableMarks),n.split(l.pos).scrollIntoView()),!0);if(!l.parent.isBlock)return!1;if(o){const p=c.parentOffset===c.parent.content.size;s instanceof je&&n.deleteSelection();const f=l.depth===0?null:z1(l.node(-1).contentMatchAt(l.indexAfter(-1)));let h=p&&f?[{type:f,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,f?[{type:f}]:void 0)&&(m=!0,h=f?[{type:f,attrs:d}]:void 0),m&&(n.split(n.mapping.map(l.pos),1,h),f&&!p&&!l.parentOffset&&l.parent.type!==f)){const y=n.mapping.map(l.before()),g=n.doc.resolve(y);l.node(-1).canReplaceWith(g.index(),g.index()+1,f)&&n.setNodeMarkup(n.mapping.map(l.before()),f)}t&&Vg(r,i.extensionService.splittableMarks),n.scrollIntoView()}return!0},W$=()=>({state:t,dispatch:e})=>B1(t,e),G$=()=>({state:t,dispatch:e})=>R1(t,e),K$=()=>({state:t,dispatch:e})=>F1(t,e),J$=()=>({state:t,dispatch:e})=>L$(t,e),j1=t=>{};function X$(t,e,n){const{selection:r}=e;let o=null;if(j1()&&(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),p=!!n.isInSet(l.marks)||!l.marks.some(f=>f.type.excludes(n));a=d&&p}return!a}),a})}const Y$=(t,e={})=>({tr:n,state:r,dispatch:o})=>{const{selection:i}=n,{empty:s,ranges:a}=i,l=lr(t,r.schema);if(o)if(s){const c=Ce.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,(p,f)=>{const h=Math.max(f,u),m=Math.min(f+p.nodeSize,d);p.marks.find(y=>y.type===l)?p.marks.forEach(y=>{l===y.type&&n.addMark(h,m,l.create({...y.attrs,...e}))}):n.addMark(h,m,l.create(e))})});return X$(r,n,l)};function Fd(t,e,n={}){return t.find(r=>r.type===e&&oi(r.attrs,n))}function Z$(t,e,n={}){return!!Fd(t,e,n)}function df(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=Fd([...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(Fd([...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&&Z$([...t.parent.child(a).marks],e,n);)l+=t.parent.child(a).nodeSize,a+=1;return{from:s,to:l}}const Q$=(t,e={})=>({tr:n,state:r,dispatch:o})=>{const{extendEmptyMarkRange:i=!1}=e,{selection:s}=n,a=lr(t,r.schema),{$from:l,empty:c,ranges:u}=s;if(!o)return!0;if(c&&i){let{from:d,to:p}=s;const f=l.marks().find(m=>m.type===a)?.attrs,h=df(l,a,f);h&&(d=h.from,p=h.to),n.removeMark(d,p,a)}else u.forEach(d=>{n.removeMark(d.$from.pos,d.$to.pos,a)});return n.removeStoredMark(a),!0},eT=()=>({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 hl(t,e,n={}){const{empty:r,ranges:o}=t.selection,i=e?lr(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter(u=>i?i.name===u.type.name:!0).find(u=>oi(u.attrs,n,{strict:!1}));let s=0;const a=[];if(o.forEach(({$from:u,$to:d})=>{const p=u.pos,f=d.pos;t.doc.nodesBetween(p,f,(h,m)=>{if(!h.isText&&!h.marks.length)return;const y=Math.max(p,m),g=Math.min(f,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=>oi(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 tT=(t,e={},n={})=>({state:r,commands:o})=>{const{extendEmptyMarkRange:i=!1}=n,s=lr(t,r.schema);return hl(r,s,e)?o.unsetMark(s,{extendEmptyMarkRange:i}):o.setMark(s,e)},nT=()=>({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)),p=c.resolve(u.map(l+a.nodeSize)),f=d.blockRange(p);if(!f)return;const h=Vs(f);if(a.type.isTextblock){const{defaultType:m}=d.parent.contentMatchAt(d.index());e.setNodeMarkup(f.start,m)}(h||h===0)&&e.lift(f,h)})}),!0},rT=(t,e={})=>({state:n,dispatch:r,chain:o})=>{const i=pt(t,n.schema);return i.isTextblock?o().command(({commands:s})=>qg(i,e)(n)?!0:s.clearNodes()).command(({state:s})=>qg(i,e)(s,r)).run():!1};function ml(t,e,n={}){const{from:r,to:o,empty:i}=t.selection,s=e?pt(e,t.schema):null,a=[];t.doc.nodesBetween(r,o,(u,d)=>{if(u.isText)return;const p=Math.max(r,d),f=Math.min(o,d+u.nodeSize);a.push({node:u,from:p,to:f})});const l=o-r,c=a.filter(u=>s?s.name===u.node.type.name:!0).filter(u=>oi(u.node.attrs,n,{strict:!1}));return i?!!c.length:c.reduce((u,d)=>u+d.to-d.from,0)>=l}const oT=(t,e,n={})=>({state:r,commands:o})=>{const i=pt(t,r.schema),s=pt(e,r.schema);return ml(r,i,n)?o.setNode(s):o.setNode(i,n)},iT=()=>({state:t,dispatch:e})=>j$(t,e),sT=()=>({state:t,dispatch:e})=>lf(t,e),aT=(t,e={})=>({tr:n,state:r,dispatch:o})=>{let i=null,s=null;const a=Ws(typeof t=="string"?t:t.name,r.schema);return a?(a==="node"&&(i=pt(t,r.schema)),a==="mark"&&(s=lr(t,r.schema)),o&&n.selection.ranges.forEach(l=>{const c=l.$from.pos,u=l.$to.pos;r.doc.nodesBetween(c,u,(d,p)=>{i&&i===d.type&&n.setNodeMarkup(p,void 0,{...d.attrs,...e}),s&&d.marks.length&&d.marks.forEach(f=>{if(s===f.type){const h=Math.max(p,c),m=Math.min(p+d.nodeSize,u);n.addMark(h,m,s.create({...f.attrs,...e}))}})})}),!0):!1},lT=(t,e)=>({tr:n,state:r,dispatch:o})=>{let i=null,s=null;const a=Ws(typeof t=="string"?t:t.name,r.schema);return a?(a==="node"&&(i=pt(t,r.schema)),a==="mark"&&(s=lr(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,Cg(c.attrs,e)),s&&c.marks.length&&c.marks.forEach(d=>{s===d.type&&n.addMark(u,u+c.nodeSize,s.create(Cg(d.attrs,e)))})})}),!0):!1},cT=()=>({state:t,dispatch:e})=>R$(t,e),uT=()=>({state:t,dispatch:e})=>B$(t,e),dT=()=>({state:t,dispatch:e})=>O1(t,e),pT=()=>({state:t,dispatch:e})=>_1(t,e),fT=()=>({state:t,dispatch:e})=>M1(t,e),hT=()=>({state:t,dispatch:e})=>N1(t,e),mT=()=>({state:t,dispatch:e})=>V$(t,e),gT=()=>({state:t,dispatch:e})=>U$(t,e),yT=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),q1=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&&q1(r)}return t};function la(t){const e=`<body>${t}</body>`,n=new window.DOMParser().parseFromString(e,"text/html").body;return q1(n)}function Rd(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 ge.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),Rd("",e,n)}if(o){if(n.errorOnInvalidContent){let s=!1,a="";const l=new rv({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?$r.fromSchema(l).parseSlice(la(t),n.parseOptions):$r.fromSchema(l).parse(la(t),n.parseOptions),n.errorOnInvalidContent&&s)throw new Error("[super-editor error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${a}`)})}const i=$r.fromSchema(e);return n.slice?i.parseSlice(la(t),n.parseOptions).content:i.parse(la(t),n.parseOptions)}return Rd("",e,n)}function wT(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(ze.near(t.doc.resolve(s),n))}const bT=t=>!("type"in t),vT=(t,e,n)=>({tr:r,dispatch:o,editor:i})=>{if(o){n={parseOptions:{},updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let s;try{s=Rd(e,i.schema,{parseOptions:{preserveWhitespace:"full",...n.parseOptions},errorOnInvalidContent:n.errorOnInvalidContent??i.options.enableContentCheck})}catch(p){return i.emit("contentError",{editor:i,error:p,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((bT(s)?s:[s]).forEach(p=>{p.check(),c=c?p.isText&&p.marks.length===0:!1,u=u?p.isBlock:!1}),a===l&&u){const{parent:p}=r.doc.resolve(a);p.isTextblock&&!p.type.spec.code&&!p.childCount&&(a-=1,l+=1)}let d;c?(Array.isArray(e)?d=e.map(p=>p.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&&wT(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},xT=()=>({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 kT(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 ST(a,s,t,e)?(r&&r(a.scrollIntoView()),!0):!1}}function ST(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 sl(l,l,e.depth),e.endIndex<e.parent.childCount&&(e=new sl(e.$from,s.resolve(e.$to.end(e.depth)),e.depth)),o=!0}let a=pv(i,n,r,e);return a?(t&&ET(t,e,a,o,n),!0):!1}function ET(t,e,n,r,o){let i=ge.empty;for(let u=n.length-1;u>=0;u--)i=ge.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 be(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,p=!0;u<d;u++,p=!1)!p&&er(t.doc,l,a)&&(t.split(l,a),l+=2*a),l+=c.child(u).nodeSize;return t}function CT(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?AT(e,n,t,i):$T(e,n,i):!0:!1}}function AT(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 be(ge.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new sl(o.doc.resolve(r.$from.pos),o.doc.resolve(s),r.depth));const a=Vs(r);if(a==null)return!1;o.lift(r,a);let l=o.doc.resolve(o.mapping.map(i,-1)-1);return Pr(o.doc,l.pos)&&l.nodeBefore.type==l.nodeAfter.type&&o.join(l.pos),e(o.scrollIntoView()),!0}function $T(t,e,n){let r=t.tr,o=n.parent;for(let f=n.end,h=n.endIndex-1,m=n.startIndex;h>m;h--)f-=o.child(h).nodeSize,r.delete(f-1,f+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?ge.empty:ge.from(o))))return!1;let d=i.pos,p=d+s.nodeSize;return r.step(new Zt(d-(a?1:0),p+(l?1:0),d+1,p-1,new be((a?ge.empty:ge.from(o.copy(ge.empty))).append(l?ge.empty:ge.from(o.copy(ge.empty))),a?0:1,l?0:1),a?0:1)),e(r.scrollIntoView()),!0}function TT(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=ge.from(c?t.create():null),d=new be(ge.from(t.create(null,ge.from(a.type.create(null,u)))),c?3:1,0),p=i.start,f=i.end;n(e.tr.step(new Zt(p-(c?3:1),f,p,f,d,1,!0)).scrollIntoView())}return!0}}const OT=(t,e={})=>({state:n,dispatch:r})=>{const o=pt(t,n.schema);return kT(o,e)(n,r)},Yl=(t,e)=>{for(let n=t.depth;n>0;n--){const r=t.node(n);if(e(r))return{pos:n>0?t.before(n):0,start:t.start(n),depth:n,node:r}}},Kt=t=>({$from:e})=>Yl(e,t),Bd=(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=Ke(Ie(n,"group",r));return typeof o!="string"?!1:o.split(" ").includes("list")},MT={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"}}]}]}]},DT={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"}}]}]}]},xu=(t,e)=>{const n=Kt(i=>i.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(r===void 0)return!0;const o=t.doc.nodeAt(r);return n.node.type===o?.type&&Pr(t.doc,n.pos)&&t.join(n.pos),!0},ku=(t,e)=>{const n=Kt(i=>i.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(n.start).after(n.depth);if(r===void 0)return!0;const o=t.doc.nodeAt(r);return n.node.type===o?.type&&Pr(t.doc,r)&&t.join(r),!0},_T=(t,e,n,r={})=>o=>{const{editor:i,tr:s,state:a,dispatch:l,chain:c,can:u,commands:d}=o,{extensions:p,splittableMarks:f}=i.extensionService,h=pt(t,a.schema),m=pt(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=Kt(V=>Bd(V.type.name,p))(y),M=i.converter?.numbering??null;if(b.depth>=1&&D&&b.depth-D.depth<=1){if(D.node.type===h){const{listId:V}=D.node.attrs;return i.converter&&(i.converter.numbering=IT(V,M)),d.liftListItem(m)}if(Bd(D.node.type.name,p)&&h.validContent(D.node.content)&&l)return c().command(()=>(s.setNodeMarkup(D.pos,h),!0)).command(()=>xu(s,h)).command(()=>ku(s,h)).run()}const I=({ensureMarks:V=!1})=>()=>{const oe=u().wrapInList(h,r);if(V){const N=T.filter(W=>f.includes(W.type.name));s.ensureMarks(N)}return oe?!0:d.clearNodes()},C=M?.definitions?V1(M.definitions):null;return i.converter&&(i.converter.numbering=NT(C,M,h)),r.listId=C,!n||!T||!l?c().command(I({ensureMarks:!1})).wrapInList(h,r).command(()=>xu(s,h)).command(()=>ku(s,h)).run():c().command(I({ensureMarks:!0})).wrapInList(h,r).command(()=>xu(s,h)).command(()=>ku(s,h)).run()},V1=t=>Math.max(...Object.keys(t).map(Number))+1,NT=(t,e,n)=>{const r=n.name==="orderedList"?MT:DT,o={...e},i=V1(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},IT=(t,e)=>{const{definitions:n,abstracts:r}=e,o=n[t].elements[0].attributes["w:val"];return delete n[t],delete r[o],e},FT=t=>e=>{const{tr:n,state:r,dispatch:o,editor:i}=e,s=pt(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=ge.empty;const g=a.index(-1)?1:a.index(-2)?2:3;for(let M=a.depth-g;M>=a.depth-3;M--)y=ge.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=Ce.getSplittedAttributes(d,a.node().type.name,a.node().attrs),b=s.contentMatch.defaultType?.createAndFill(k)||void 0;y=y.append(ge.from(s.createAndFill(null,b)||void 0));const T=a.before(a.depth-(g-1));n.replace(T,a.after(-x),new be(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 p=l.pos===a.end()?u.contentMatchAt(0).defaultType:null,f=Ce.getSplittedAttributes(d,u.type.name,u.attrs),h=Ce.getSplittedAttributes(d,a.node().type.name,a.node().attrs);n.delete(a.pos,l.pos);const m=p?[{type:s,attrs:f},{type:p,attrs:h}]:[{type:s,attrs:f}];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},RT=t=>({state:e,dispatch:n})=>{const r=pt(t,e.schema);return TT(r)(e,n)},BT=t=>({state:e,dispatch:n})=>{const r=pt(t,e.schema);return CT(r)(e,n)},LT=Object.freeze(Object.defineProperty({__proto__:null,clearNodes:nT,command:M$,createParagraphNear:G$,deleteSelection:sT,exitCode:J$,first:O$,insertContent:yT,insertContentAt:vT,insertTabChar:D$,insertTabNode:_$,joinBackward:dT,joinDown:uT,joinForward:pT,joinUp:cT,liftEmptyBlock:W$,liftListItem:BT,newlineInCode:K$,resetAttributes:lT,selectAll:iT,selectNodeBackward:fT,selectNodeForward:hT,selectTextblockEnd:gT,selectTextblockStart:mT,setMark:Y$,setMeta:N$,setNode:rT,sinkListItem:RT,splitBlock:H$,splitListItem:FT,toggleList:_T,toggleMark:tT,toggleNode:oT,undoInputRule:xT,unsetAllMarks:eT,unsetMark:Q$,updateAttributes:aT,wrapInList:OT},Symbol.toStringTag,{value:"Module"})),PT=Ye.create({name:"commands",addCommands(){return{...LT}}}),zT=t=>t.commands.first(({commands:e})=>[()=>e.newlineInCode(),()=>e.createParagraphNear(),()=>e.liftEmptyBlock(),()=>e.splitBlock()]),Ti=t=>t.commands.first(({commands:e,tr:n})=>[()=>e.undoInputRule(),()=>(n.setMeta("inputType","deleteContentBackward"),!1),()=>e.deleteSelection(),()=>e.joinBackward(),()=>e.selectNodeBackward()]),Ao=t=>t.commands.first(({commands:e})=>[()=>e.deleteSelection(),()=>e.joinForward(),()=>e.selectNodeForward()]),jT=Ye.create({name:"keymap",addShortcuts(){const t={Enter:()=>zT(this.editor),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:()=>Ti(this.editor),"Mod-Backspace":()=>Ti(this.editor),"Shift-Backspace":()=>Ti(this.editor),Delete:()=>Ao(this.editor),"Mod-Delete":()=>Ao(this.editor),"Mod-a":()=>this.editor.commands.selectAll(),Tab:()=>this.editor.commands.insertTabNode()},e={...t},n={...t,"Ctrl-h":()=>Ti(this.editor),"Alt-Backspace":()=>Ti(this.editor),"Ctrl-d":()=>Ao(this.editor),"Ctrl-Alt-Backspace":()=>Ao(this.editor),"Alt-Delete":()=>Ao(this.editor),"Alt-d":()=>Ao(this.editor),"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd(),"Ctrl-t":()=>this.editor.commands.insertTabChar()};return gA()||yA()?n:e}}),qT=Ye.create({name:"editable",addPmPlugins(){return[new He({key:new Ge("editable"),props:{editable:()=>this.editor.options.editable}})]}}),VT=Ye.create({name:"editorFocus",addPmPlugins(){const t=this.editor;return[new He({key:new Ge("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 U1(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 ws(t,e){return e.nodes[t]||e.marks[t]||null}function UT(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 HT(t,e,n){const r=[];return t===e?n.resolve(t).marks().forEach(o=>{const i=n.resolve(t-1),s=df(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 H1(t,e,n={}){if(!e)return ml(t,null,n)||hl(t,null,n);const r=Ws(e,t.schema);return r==="node"?ml(t,e,n):r==="mark"?hl(t,e,n):!1}function pf(t,e){const n=[];return t.descendants((r,o)=>{e(r)&&n.push({node:r,pos:o})}),n}function W1(t,e,n){const r=t.state.doc.content.size,o=cl(e,0,r),i=cl(n,0,r),s=t.coordsAtPos(o),a=t.coordsAtPos(i,-1),l=Math.min(s.top,a.top),c=Math.max(s.bottom,a.bottom),u=Math.min(s.left,a.left),d=Math.max(s.right,a.right),p=d-u,f=c-l,h={top:l,bottom:c,left:u,right:d,width:p,height:f,x:u,y:l};return{...h,toJSON:()=>h}}const ff=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},Zl=Object.freeze(Object.defineProperty({__proto__:null,chainableEditorState:af,cleanSchemaItem:Nd,createDocument:U1,defaultBlockAt:z1,findChildren:pf,findMark:Xl,findParentNode:Kt,findParentNodeClosestToPos:Yl,generateDocxListAttributes:UT,generateDocxRandomId:Xn,generateRandom32BitHex:nf,getActiveFormatting:sf,getExtensionConfigField:Ie,getMarkRange:df,getMarkType:lr,getMarksBetween:HT,getMarksFromSelection:Hs,getNodeType:pt,getSchemaTypeByName:ws,getSchemaTypeNameByName:Ws,isActive:H1,isInTable:ff,isList:Bd,isMarkActive:hl,isNodeActive:ml,isTextSelection:j1,posToDOMRect:W1},Symbol.toStringTag,{value:"Module"})),Yr=globalThis||void 0||self,Ct=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},ci=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let Ld=null;const Gn=function(t,e,n){let r=Ld||(Ld=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},WT=function(){Ld=null},mo=function(t,e,n,r){return n&&(Ug(t,e,n,r,-1)||Ug(t,e,n,r,1))},GT=/^(img|br|input|textarea|hr)$/i;function Ug(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||Gs(t)||GT.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 KT(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&&!Gs(t))e=Ct(t),t=t.parentNode;else return null}}function JT(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&&!Gs(t))e=Ct(t)+1,t=t.parentNode;else return null}}function XT(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 Gs(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 Ql=function(t){return t.focusNode&&mo(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function Jr(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function YT(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function ZT(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 Rn=typeof navigator<"u"?navigator:null,Hg=typeof document<"u"?document:null,zr=Rn&&Rn.userAgent||"",Pd=/Edge\/(\d+)/.exec(zr),G1=/MSIE \d/.exec(zr),zd=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(zr),Jt=!!(G1||zd||Pd),Or=G1?document.documentMode:zd?+zd[1]:Pd?+Pd[1]:0,xn=!Jt&&/gecko\/(\d+)/i.test(zr);xn&&+(/Firefox\/(\d+)/.exec(zr)||[0,0])[1];const jd=!Jt&&/Chrome\/(\d+)/.exec(zr),Dt=!!jd,K1=jd?+jd[1]:0,qt=!Jt&&!!Rn&&/Apple Computer/.test(Rn.vendor),ui=qt&&(/Mobile\/\w+/.test(zr)||!!Rn&&Rn.maxTouchPoints>2),fn=ui||(Rn?/Mac/.test(Rn.platform):!1),QT=Rn?/Win/.test(Rn.platform):!1,Qn=/Android \d/.test(zr),Ks=!!Hg&&"webkitFontSmoothing"in Hg.documentElement.style,e5=Ks?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function t5(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 n5(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 Wg(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=ci(s);continue}let a=s,l=a==i.body,c=l?t5(i):n5(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 f=a.scrollLeft,h=a.scrollTop;d&&(a.scrollTop+=d),u&&(a.scrollLeft+=u);let m=a.scrollLeft-f,y=a.scrollTop-h;e={left:e.left-m,top:e.top-y,right:e.right-m,bottom:e.bottom-y}}let p=l?"fixed":getComputedStyle(s).position;if(/^(fixed|sticky)$/.test(p))break;s=p=="absolute"?s.offsetParent:ci(s)}}function r5(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:J1(t.dom)}}function J1(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=ci(r));return e}function o5({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;X1(n,r==0?0:r-e)}function X1(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 $o=null;function i5(t){if(t.setActive)return t.setActive();if($o)return t.focus($o);let e=J1(t);t.focus($o==null?{get preventScroll(){return $o={preventScroll:!0},!0}}:void 0),$o||($o=!1,X1(e,0))}function Y1(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 p;if(u.nodeType==1)p=u.getClientRects();else if(u.nodeType==3)p=Gn(u).getClientRects();else continue;for(let f=0;f<p.length;f++){let h=p[f];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?s5(n,o):!n||r&&n.nodeType==1?{node:t,offset:i}:Y1(n,o)}function s5(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=mr(r,1);if(i.top!=i.bottom&&hf(e,i))return{node:t,offset:o+(e.left>=(i.left+i.right)/2?1:0)}}return{node:t,offset:0}}function hf(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function a5(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}function l5(t,e,n){let{node:r,offset:o}=Y1(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 c5(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 Z1(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(hf(e,c))return Z1(s,e,c)}}if((i=(i+1)%r)==o)break}return t}function u5(t,e){let n=t.dom.ownerDocument,r,o=0,i=ZT(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(!hf(e,c)||(s=Z1(t.dom,e,c),!s))return null}if(qt)for(let c=s;r&&c;c=ci(c))c.draggable&&(r=void 0);if(s=a5(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;Ks&&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=c5(t,r,o,e))}a==null&&(a=l5(t,s,e));let l=t.docView.nearestDesc(s,!0);return{pos:a,inside:l?l.posAtStart-l.border:-1}}function Gg(t){return t.top<t.bottom||t.left<t.right}function mr(t,e){let n=t.getClientRects();if(n.length){let r=n[e<0?0:n.length-1];if(Gg(r))return r}return Array.prototype.find.call(n,Gg)||t.getBoundingClientRect()}const d5=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function Q1(t,e,n){let{node:r,offset:o,atom:i}=t.docView.domFromPos(e,n<0?-1:1),s=Ks||xn;if(r.nodeType==3)if(s&&(d5.test(r.nodeValue)||(n<0?!o:o==r.nodeValue.length))){let a=mr(Gn(r,o,o),n);if(xn&&o&&/\s/.test(r.nodeValue[o-1])&&o<r.nodeValue.length){let l=mr(Gn(r,o-1,o-1),-1);if(l.top==a.top){let c=mr(Gn(r,o,o+1),-1);if(c.top!=a.top)return Oi(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++,Oi(mr(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 Su(a.getBoundingClientRect(),!1)}if(i==null&&o<hn(r)){let a=r.childNodes[o];if(a.nodeType==1)return Su(a.getBoundingClientRect(),!0)}return Su(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 Oi(mr(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 Oi(mr(l,-1),!0)}return Oi(mr(r.nodeType==3?Gn(r):r,-n),n>=0)}function Oi(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 Su(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 e2(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 p5(t,e,n){let r=e.selection,o=n=="up"?r.$from:r.$to;return e2(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=Q1(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 f5=/[\u0590-\u08ac]/;function h5(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?!f5.test(r.parent.textContent)||!a.modify?n=="left"||n=="backward"?i:s:e2(t,e,()=>{let{focusNode:l,focusOffset:c,anchorNode:u,anchorOffset:d}=t.domSelectionRange(),p=a.caretBidiLevel;a.modify("move",n,"character");let f=r.depth?t.docView.domAfterPos(r.before()):t.dom,{focusNode:h,focusOffset:m}=t.domSelectionRange(),y=h&&!f.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 p!=null&&(a.caretBidiLevel=p),y}):r.pos==r.start()||r.pos==r.end()}let Kg=null,Jg=null,Xg=!1;function m5(t,e,n){return Kg==e&&Jg==n?Xg:(Kg=e,Jg=n,Xg=n=="up"||n=="down"?p5(t,e,n):h5(t,e,n))}const mn=0,Yg=1,Zr=2,Bn=3;let Js=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 i2){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 t2&&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 p=this.children[d-1];if(p.size&&p.dom.parentNode==this.contentDOM&&!p.emptyChildAt(1)){o=Ct(p.dom)+1;break}e-=p.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 f=0,h=0;f<this.children.length;f++){let m=this.children[f],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:f,offset:h}=a;if(f.nodeType==3){if(d=!!(h&&f.nodeValue[h-1]==`
|
|
41
41
|
`),d&&h==f.nodeValue.length)for(let m=f,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=f.childNodes[h-1];d=m&&(m.nodeName=="BR"||m.contentEditable=="false")}}if(xn&&u.focusNode&&u.focusNode!=l.node&&u.focusNode.nodeType==1){let f=u.focusNode.childNodes[u.focusOffset];f&&f.contentEditable=="false"&&(o=!0)}if(!(o||d&&qt)&&mo(a.node,a.offset,u.anchorNode,u.anchorOffset)&&mo(l.node,l.offset,u.focusNode,u.focusOffset))return;let p=!1;if((c.extend||e==n)&&!d){c.collapse(a.node,a.offset);try{e!=n&&c.extend(l.node,l.offset),p=!0}catch{}}if(!p){if(e>n){let h=a;a=l,l=h}let f=document.createRange();f.setEnd(l.node,l.offset),f.setStart(a.node,a.offset),c.removeAllRanges(),c.addRange(f)}}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?Zr:Yg,e==a&&n==l&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=Bn:i.markDirty(e-a,n-a);return}else i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?Zr:Bn}r=s}this.dirty=Zr}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?Zr:Yg;n.dirty<r&&(n.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}isText(e){return!1}},t2=class extends Js{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 g5 extends Js{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 gl=class qd extends Js{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=xi.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new qd(e,n,s.dom,s.contentDOM||s.dom,s)}parseRule(){return this.dirty&Bn||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Bn&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=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=qd.create(this.parent,this.mark,!0,r),i=this.children,s=this.size;n<s&&(i=Ud(i,n,s,r)),e>0&&(i=Ud(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()}},Xo=class n2 extends Js{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}=xi.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 p=u;return u=l2(u,r,n),c?l=new y5(e,n,r,o,u,d||null,p,c,i,s+1):n.isText?new r2(e,n,r,o,u,p,i):new n2(e,n,r,o,u,d||null,p,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=()=>ge.empty)}return e}matchesNode(e,n,r){return this.dirty==mn&&e.eq(this.node)&&yl(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 b5(this,s&&s.node,e);k5(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?Xe.none:this.node.child(u).marks,r,e),l.placeWidget(c,e,o)},(c,u,d,p)=>{l.syncToMarks(c.marks,r,e);let f;l.findNodeMatch(c,u,d,p)||a&&e.state.selection.from>o&&e.state.selection.to<o+c.nodeSize&&(f=l.findIndexWithChild(i.node))>-1&&l.updateNodeAt(c,u,d,f,e)||l.updateNextNode(c,u,d,e,p,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==Zr)&&(s&&this.protectLocalComposition(e,s),s2(this.contentDOM,this.children,e),ui&&S5(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=E5(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 g5(this,i,n,o);e.input.compositionNodes.push(s),this.children=Ud(this.children,r,r+o.length,e,s)}update(e,n,r,o){return this.dirty==Bn||!e.sameMarkup(this.node)?!1:(this.updateInner(e,n,r,o),!0)}updateInner(e,n,r,o){this.updateOuterDeco(n),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(o,this.posAtStart),this.dirty=mn}updateOuterDeco(e){if(yl(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=a2(this.dom,this.nodeDOM,Vd(this.outerDeco,this.node,n),Vd(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 Zg(t,e,n,r,o){l2(r,e,t);let i=new Xo(void 0,t,e,n,r,r,r,o,0);return i.contentDOM&&i.updateChildren(o,0),i}let r2=class o2 extends Xo{constructor(e,n,r,o,i,s,a){super(e,n,r,o,i,null,s,a,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,n,r,o){return this.dirty==Bn||this.dirty!=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 o2(this.parent,o,this.outerDeco,this.innerDeco,i,i,r)}markDirty(e,n){super.markDirty(e,n),this.dom!=this.nodeDOM&&(e==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=Bn)}get domAtom(){return!1}isText(e){return this.node.text==e}},i2=class extends Js{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 y5 extends Xo{constructor(e,n,r,o,i,s,a,l,c,u){super(e,n,r,o,i,s,a,c,u),this.spec=l}update(e,n,r,o){if(this.dirty==Bn)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let i=this.spec.update(e,n,r);return i&&this.updateInner(e,n,r,o),i}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,n,r,o)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,n,r,o){this.spec.setSelection?this.spec.setSelection(e,n,r.root):super.setSelection(e,n,r,o)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function s2(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 gl){let l=r?r.previousSibling:t.lastChild;s2(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 Qi=function(t){t&&(this.nodeName=t)};Qi.prototype=Object.create(null);const Qr=[new Qi];function Vd(t,e,n){if(t.length==0)return Qr;let r=n?Qr[0]:new Qi,o=[r];for(let i=0;i<t.length;i++){let s=t[i].type.attrs;if(s){s.nodeName&&o.push(r=new Qi(s.nodeName));for(let a in s){let l=s[a];l!=null&&(n&&o.length==1&&o.push(r=new Qi(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 a2(t,e,n,r){if(n==Qr&&r==Qr)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=Qr[0]),o=l}w5(o,a||Qr[0],s)}return o}function w5(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 l2(t,e,n){return a2(t,t,Qr,Vd(e,n,t.nodeType!=1))}function yl(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 b5{constructor(e,n,r){this.lock=n,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=v5(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=gl.create(this.top,e[i],n,r);this.top.children.splice(this.index,0,l),this.top=l,this.changed=!0}this.index=0,i++}}findNodeMatch(e,n,r,o){let i=-1,s;if(o>=this.preMatch.index&&(s=this.preMatch.matches[o-this.preMatch.index]).parent==this.top&&s.matchesNode(e,n,r))i=this.top.children.indexOf(s,this.index);else for(let a=this.index,l=Math.min(this.top.children.length,a+5);a<l;a++){let c=this.top.children[a];if(c.matchesNode(e,n,r)&&!this.preMatch.matched.has(c)){i=a;break}}return i<0?!1:(this.destroyBetween(this.index,i),this.index++,!0)}updateNodeAt(e,n,r,o,i){let s=this.top.children[o];return s.dirty==Bn&&s.dom==s.contentDOM&&(s.dirty=Zr),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 Xo){let c=this.preMatch.matched.get(l);if(c!=null&&c!=i)return!1;let u=l.dom,d,p=this.isLocked(u)&&!(e.isText&&l.node&&l.node.isText&&l.nodeDOM.nodeValue==e.text&&l.dirty!=Bn&&yl(n,l.outerDeco));if(!p&&l.update(e,n,r,o))return this.destroyBetween(this.index,a),l.dom!=u&&(this.changed=!0),this.index++,!0;if(!p&&(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=Zr,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)||!yl(r,e.outerDeco)||!o.eq(e.innerDeco))return null;let a=Xo.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=Xo.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 t2(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 gl;)n=e,e=n.children[n.children.length-1];(!e||!(e instanceof r2)||/\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 i2(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 v5(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 gl)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 x5(t,e){return t.type.side-e.type.side}function k5(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(x5);for(let y=0;y<d.length;y++)n(d[y],c,!!l)}else n(u,c,!!l);let p,f;if(l)f=-1,p=l,l=null;else if(c<t.childCount)f=c,p=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+p.nodeSize;if(p.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=p.cut(y-i),p=p.cut(0,y-i),h=y,f=-1)}else for(;s<o.length&&o[s].to<h;)s++;let m=p.isInline&&!p.isLeaf?a.filter(y=>!y.inline):a.slice();r(p,m,e.forChild(i,p),f),i=h}}function S5(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 E5(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 Ud(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 mf(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(Ql(n)){for(l=s;o&&!o.node;)o=o.parent;let d=o.node;if(o&&d.isAtom&&_e.isSelectable(d)&&o.parent&&!(d.isInline&&XT(n.focusNode,n.focusOffset,o.dom))){let p=o.posBefore;c=new _e(s==p?a:r.resolve(p))}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let d=s,p=s;for(let f=0;f<n.rangeCount;f++){let h=n.getRangeAt(f);d=Math.min(d,t.docView.posFromDOM(h.startContainer,h.startOffset,1)),p=Math.max(p,t.docView.posFromDOM(h.endContainer,h.endOffset,-1))}if(d<0)return null;[l,s]=p==t.state.selection.anchor?[p,d]:[d,p],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=gf(t,u,a,d)}return c}function c2(t){return t.editable?t.hasFocus():d2(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function rr(t,e=!1){let n=t.state.selection;if(u2(t,n),!!c2(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&Dt){let r=t.domSelectionRange(),o=t.domObserver.currentSelection;if(r.anchorNode&&o.anchorNode&&mo(r.anchorNode,r.anchorOffset,o.anchorNode,o.anchorOffset)){t.input.mouseDown.delayedSelectionSync=!0,t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)A5(t);else{let{anchor:r,head:o}=n,i,s;ey&&!(n instanceof je)&&(n.$from.parent.inlineContent||(i=ty(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(s=ty(t,n.to))),t.docView.setSelection(r,o,t,e),ey&&(i&&ny(i),s&&ny(s)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&C5(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const ey=qt||Dt&&K1<63;function ty(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 Eu(o);if((!o||o.contentEditable=="false")&&(!i||i.contentEditable=="false")){if(o)return Eu(o);if(i)return Eu(i)}}function Eu(t){return t.contentEditable="true",qt&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function ny(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function C5(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(()=>{(!c2(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function A5(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&&Jt&&Or<=11&&(r.disabled=!0,r.disabled=!1)}function u2(t,e){if(e instanceof _e){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(ry(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else ry(t)}function ry(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function gf(t,e,n,r){return t.someProp("createSelectionBetween",o=>o(t,e,n))||je.between(e,n,r)}function oy(t){return t.editable&&!t.hasFocus()?!1:d2(t)}function d2(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 $5(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return mo(e.node,e.offset,n.anchorNode,n.anchorOffset)}function Hd(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&&ze.findFrom(i,e)}function vr(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function iy(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 vr(t,new je(r.$anchor,s))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let o=Hd(t.state,e);return o&&o instanceof _e?vr(t,o):!1}else if(!(fn&&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?_e.isSelectable(i)?vr(t,new _e(e<0?t.state.doc.resolve(o.pos-i.nodeSize):o)):Ks?vr(t,new je(t.state.doc.resolve(e<0?a:a+i.nodeSize))):!1:!1}}else return!1;else{if(r instanceof _e&&r.node.isInline)return vr(t,new je(e>0?r.$to:r.$from));{let o=Hd(t.state,e);return o?vr(t,o):!1}}}function wl(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function es(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function To(t,e){return e<0?T5(t):O5(t)}function T5(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<wl(n)&&es(n.childNodes[r],-1)&&(s=!0);;)if(r>0){if(n.nodeType!=1)break;{let a=n.childNodes[r-1];if(es(a,-1))o=n,i=--r;else if(a.nodeType==3)n=a,r=n.nodeValue.length;else break}}else{if(p2(n))break;{let a=n.previousSibling;for(;a&&es(a,-1);)o=n.parentNode,i=Ct(a),a=a.previousSibling;if(a)n=a,r=wl(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}s?Wd(t,n,r):o&&Wd(t,o,i)}function O5(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let o=wl(n),i,s;for(;;)if(r<o){if(n.nodeType!=1)break;let a=n.childNodes[r];if(es(a,1))i=n,s=++r;else break}else{if(p2(n))break;{let a=n.nextSibling;for(;a&&es(a,1);)i=a.parentNode,s=Ct(a)+1,a=a.nextSibling;if(a)n=a,r=0,o=wl(n);else{if(n=n.parentNode,n==t.dom)break;r=o=0}}}i&&Wd(t,i,s)}function p2(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function M5(t,e){for(;t&&e==t.childNodes.length&&!Gs(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 D5(t,e){for(;t&&!e&&!Gs(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 Wd(t,e,n){if(e.nodeType!=3){let i,s;(s=M5(e,n))?(e=s,n=0):(i=D5(e,n))&&(e=i,n=i.nodeValue.length)}let r=t.domSelection();if(!r)return;if(Ql(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 sy(t,e){let n=t.state.doc.resolve(e);if(!(Dt||QT)&&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 ay(t,e,n){let r=t.state.selection;if(r instanceof je&&!r.empty||n.indexOf("s")>-1||fn&&n.indexOf("m")>-1)return!1;let{$from:o,$to:i}=r;if(!o.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let s=Hd(t.state,e);if(s&&s instanceof _e)return vr(t,s)}if(!o.parent.inlineContent){let s=e<0?o:i,a=r instanceof _n?ze.near(s,e):ze.findFrom(s,e);return a?vr(t,a):!1}return!1}function ly(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 cy(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function _5(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;cy(t,r,"true"),setTimeout(()=>cy(t,r,"false"),20)}return!1}function N5(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function I5(t,e){let n=e.keyCode,r=N5(e);if(n==8||fn&&n==72&&r=="c")return ly(t,-1)||To(t,-1);if(n==46&&!e.shiftKey||fn&&n==68&&r=="c")return ly(t,1)||To(t,1);if(n==13||n==27)return!0;if(n==37||fn&&n==66&&r=="c"){let o=n==37?sy(t,t.state.selection.from)=="ltr"?-1:1:-1;return iy(t,o,r)||To(t,o)}else if(n==39||fn&&n==70&&r=="c"){let o=n==39?sy(t,t.state.selection.from)=="ltr"?1:-1:1;return iy(t,o,r)||To(t,o)}else{if(n==38||fn&&n==80&&r=="c")return ay(t,-1,r)||To(t,-1);if(n==40||fn&&n==78&&r=="c")return _5(t)||ay(t,1,r)||To(t,1);if(r==(fn?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function yf(t,e){t.someProp("transformCopied",f=>{e=f(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 f=r.firstChild;n.push(f.type.name,f.attrs!=f.type.defaultAttrs?f.attrs:null),r=f.content}let s=t.someProp("clipboardSerializer")||xi.fromSchema(t.state.schema),a=w2(),l=a.createElement("div");l.appendChild(s.serializeFragment(r,{document:a}));let c=l.firstChild,u,d=0;for(;c&&c.nodeType==1&&(u=y2[c.nodeName.toLowerCase()]);){for(let f=u.length-1;f>=0;f--){let h=a.createElement(u[f]);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 p=t.someProp("clipboardTextSerializer",f=>f(e,t))||e.content.textBetween(0,e.content.size,`
|
|
42
42
|
|
|
43
43
|
`);return{dom:l,text:p,slice:e}}function f2(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",p=>{e=p(e,i||r,t)}),i)return e?new be(ge.from(t.state.schema.text(e.replace(/\r\n?/g,`
|
|
44
44
|
`))),0,0):be.empty;let d=t.someProp("clipboardTextParser",p=>p(e,o,r,t));if(d)a=d;else{let p=o.marks(),{schema:f}=t.state,h=xi.fromSchema(f);s=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(m=>{let y=s.appendChild(document.createElement("p"));m&&y.appendChild(h.serializeNode(f.text(m,p)))})}}else t.someProp("transformPastedHTML",d=>{n=d(n,t)}),s=L5(n),Ks&&P5(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 p=s.firstChild;for(;p&&p.nodeType!=1;)p=p.nextSibling;if(!p)break;s=p}if(a||(a=(t.someProp("clipboardParser")||t.someProp("domParser")||$r.fromSchema(t.state.schema)).parseSlice(s,{preserveWhitespace:!!(l||u),context:o,ruleFromNode(d){return d.nodeName=="BR"&&!d.nextSibling&&d.parentNode&&!F5.test(d.parentNode.nodeName)?{ignore:!0}:null}})),u)a=z5(uy(a,+u[1],+u[2]),u[4]);else if(a=be.maxOpen(R5(a.content,o),!0),a.openStart||a.openEnd){let d=0,p=0;for(let f=a.content.firstChild;d<a.openStart&&!f.type.spec.isolating;d++,f=f.firstChild);for(let f=a.content.lastChild;p<a.openEnd&&!f.type.spec.isolating;p++,f=f.lastChild);a=uy(a,d,p)}return t.someProp("transformPasted",d=>{a=d(a,t)}),a}const F5=/^(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 R5(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&&m2(a,o,s,i[i.length-1],0))i[i.length-1]=l;else{i.length&&(i[i.length-1]=g2(i[i.length-1],o.length));let c=h2(s,a);i.push(c),r=r.matchType(c.type),o=a}}),i)return ge.from(i)}return t}function h2(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,ge.from(t));return t}function m2(t,e,n,r,o){if(o<t.length&&o<e.length&&t[o]==e[o]){let i=m2(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(ge.from(h2(n,t,o+1))))}}function g2(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,g2(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(ge.empty,!0);return t.copy(n.append(r))}function Gd(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=Gd(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(ge.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,s.copy(a))}function uy(t,e,n){return e<t.openStart&&(t=new be(Gd(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new be(Gd(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const y2={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 dy=null;function w2(){return dy||(dy=document.implementation.createHTMLDocument("title"))}let Cu=null;function B5(t){let e=window.trustedTypes;return e?(Cu||(Cu=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),Cu.createHTML(t)):t}function L5(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=w2().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),o;if((o=r&&y2[r[1].toLowerCase()])&&(t=o.map(i=>"<"+i+">").join("")+t+o.map(i=>"</"+i+">").reverse().join("")),n.innerHTML=B5(t),o)for(let i=0;i<o.length;i++)n=n.querySelector(o[i])||n;return n}function P5(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 z5(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=ge.from(l.create(r[a+1],o)),i++,s++}return new be(o,i,s)}const Vt={},Ut={},j5={touchstart:!0,touchmove:!0};class q5{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},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 V5(t){for(let e in Vt){let n=Vt[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{H5(t,r)&&!wf(t,r)&&(t.editable||!(r.type in Ut))&&n(t,r)},j5[e]?{passive:!0}:void 0)}qt&&t.dom.addEventListener("input",()=>null),Kd(t)}function Sr(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function U5(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 Kd(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>wf(t,r))})}function wf(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function H5(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 W5(t,e){!wf(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,!v2(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(Qn&&Dt&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),ui&&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,Jr(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||I5(t,n)?n.preventDefault():Sr(t,"key")};Ut.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};Ut.keypress=(t,e)=>{let n=e;if(v2(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||fn&&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 ec(t){return{left:t.clientX,top:t.clientY}}function G5(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function bf(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 Yo(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 K5(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&_e.isSelectable(r)?(Yo(t,new _e(n)),!0):!1}function J5(t,e){if(e==-1)return!1;let n=t.state.selection,r,o;n instanceof _e&&(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(_e.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?(Yo(t,_e.create(t.state.doc,o)),!0):!1}function X5(t,e,n,r,o){return bf(t,"handleClickOn",e,n,r)||t.someProp("handleClick",i=>i(t,e,r))||(o?J5(t,n):K5(t,n))}function Y5(t,e,n,r){return bf(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",o=>o(t,e,r))}function Z5(t,e,n,r){return bf(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",o=>o(t,e,r))||Q5(t,n,r)}function Q5(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?(Yo(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)Yo(t,je.create(r,a+1,a+1+s.content.size));else if(_e.isSelectable(s))Yo(t,_e.create(r,a));else continue;return!0}}function vf(t){return bl(t)}const b2=fn?"metaKey":"ctrlKey";Vt.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=vf(t),o=Date.now(),i="singleClick";o-t.input.lastClick.time<500&&G5(n,t.input.lastClick)&&!n[b2]&&t.input.lastClick.button==n.button&&(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,button:n.button};let s=t.posAtCoords(ec(n));s&&(i=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new eO(t,s,n,!!r)):(i=="doubleClick"?Y5:Z5)(t,s.pos,s.inside,n)?n.preventDefault():Sr(t,"pointer"))};class eO{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[b2],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 _e&&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)),Sr(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(ec(e))),this.updateAllowDefault(e),this.allowDefault||!n?Sr(this.view,"pointer"):X5(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)?(Yo(this.view,ze.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):Sr(this.view,"pointer")}move(e){this.updateAllowDefault(e),Sr(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(),vf(t),Sr(t,"pointer")};Vt.touchmove=t=>{t.input.lastTouch=Date.now(),Sr(t,"pointer")};Vt.contextmenu=t=>vf(t);function v2(t,e){return t.composing?!0:qt&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const tO=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(),bl(t,!0),t.markCursor=null;else if(bl(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}x2(t,tO)};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++,x2(t,20))};function x2(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>bl(t),e))}function k2(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=rO());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function nO(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=KT(e.focusNode,e.focusOffset),r=JT(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 rO(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function bl(t,e=!1){if(!(Qn&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),k2(t),e||t.docView&&t.docView.dirty){let n=mf(t),r=t.state.selection;return n&&!n.eq(r)?t.dispatch(t.state.tr.setSelection(n)):(t.markCursor||e)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?t.dispatch(t.state.tr.deleteSelection()):t.updateState(t.state),!0}return!1}}function oO(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 bs=Jt&&Or<15||ui&&e5<604;Vt.copy=Ut.cut=(t,e)=>{let n=e,r=t.state.selection,o=n.type=="cut";if(r.empty)return;let i=bs?null:n.clipboardData,s=r.content(),{dom:a,text:l}=yf(t,s);i?(n.preventDefault(),i.clearData(),i.setData("text/html",a.innerHTML),i.setData("text/plain",l)):oO(t,a),o&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function iO(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function sO(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?vs(t,r.value,null,o,e):vs(t,r.textContent,r.innerHTML,o,e)},50)}function vs(t,e,n,r,o){let i=f2(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",l=>l(t,o,i||be.empty)))return!0;if(!i)return!1;let s=iO(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 S2(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=bs?null:n.clipboardData,o=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&vs(t,S2(r),r.getData("text/html"),o,n)?n.preventDefault():sO(t,n)};let E2=class{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}};const aO=fn?"altKey":"ctrlKey";function C2(t,e){return t.someProp("dragCopies",r=>!r(e))??!e[aO]}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(ec(n)),s;if(!(i&&i.pos>=o.from&&i.pos<=(o instanceof _e?o.to-1:o.to))){if(r&&r.mightDrag)s=_e.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=_e.create(t.state.doc,d.posBefore))}}let a=(s||t.state.selection).content(),{dom:l,text:c,slice:u}=yf(t,a);(!n.dataTransfer.files.length||!Dt||K1>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(bs?"Text":"text/html",l.innerHTML),n.dataTransfer.effectAllowed="copyMove",bs||n.dataTransfer.setData("text/plain",c),t.dragging=new E2(u,C2(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(ec(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=f2(t,S2(n.dataTransfer),bs?null:n.dataTransfer.getData("text/html"),!1,i);let a=!!(r&&C2(t,n));if(t.someProp("handleDrop",h=>h(t,n,s||be.empty,a))){n.preventDefault();return}if(!s)return;n.preventDefault();let l=s?yv(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,p=c.doc;if(d?c.replaceRangeWith(u,u,s.content.firstChild):c.replaceRange(u,u,s),c.doc.eq(p))return;let f=c.doc.resolve(u);if(d&&_e.isSelectable(s.content.firstChild)&&f.nodeAfter&&f.nodeAfter.sameMarkup(s.content.firstChild))c.setSelection(new _e(f));else{let h=c.mapping.map(l);c.mapping.maps[c.mapping.maps.length-1].forEach((m,y,g,x)=>h=x),c.setSelection(gf(t,f,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,Jr(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 xs(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 py=class A2{constructor(e,n){this.toDOM=e,this.spec=n||io,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 Le(i-r,i-r,this)}valid(){return!0}eq(e){return this==e||e instanceof A2&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&xs(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}},ts=class Jd{constructor(e,n){this.attrs=e,this.spec=n||io}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 Le(i,s,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof Jd&&xs(this.attrs,e.attrs)&&xs(this.spec,e.spec)}static is(e){return e.type instanceof Jd}destroy(){}};class xf{constructor(e,n){this.attrs=e,this.spec=n||io}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 Le(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 xf&&xs(this.attrs,e.attrs)&&xs(this.spec,e.spec)}destroy(){}}class Le{constructor(e,n,r){this.from=e,this.to=n,this.type=r}copy(e,n){return new Le(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 Le(e,e,new py(n,r))}static inline(e,n,r,o){return new Le(e,n,new ts(r,o))}static node(e,n,r,o){return new Le(e,n,new xf(r,o))}get spec(){return this.type.spec}get inline(){return this.type instanceof ts}get widget(){return this.type instanceof py}}const zo=[],io={};class De{constructor(e,n){this.local=e.length?e:zo,this.children=n.length?n:zo}static create(e,n){return n.length?vl(n,e,0,io):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||io)}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?lO(this.children,s||[],e,n,r,o,i):s?new De(s.sort(so),zo):Ot}add(e,n){return n.length?this==Ot?De.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=O2(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,vl(u,a,c+1,io)),i+=3}});let s=T2(i?M2(n):n,-r);for(let a=0;a<s.length;a++)s[a].type.valid(e,s[a])||s.splice(a--,1);return new De(s.length?this.local.concat(s).sort(so):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 De(o,r):Ot}forChild(e,n){if(this==Ot)return this;if(n.isLeaf)return De.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 ts){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 De(o.sort(so),zo);return r?new $2([a,r]):a}return r||Ot}eq(e){if(this==e)return!0;if(!(e instanceof De)||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 kf(this.localsInner(e))}localsInner(e){if(this==Ot)return zo;if(e.inlineContent||!this.local.some(ts.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof ts||n.push(this.local[r]);return n}forEachSet(e){e(this)}}De.empty=new De([],[]);De.removeOverlap=kf;const Ot=De.empty;let $2=class jo{constructor(e){this.members=e}map(e,n){const r=this.members.map(o=>o.map(e,n,io));return jo.from(r)}forChild(e,n){if(n.isLeaf)return De.empty;let r=[];for(let o=0;o<this.members.length;o++){let i=this.members[o].forChild(e,n);i!=Ot&&(i instanceof jo?r=r.concat(i.members):r.push(i))}return jo.from(r)}eq(e){if(!(e instanceof jo)||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?kf(r?n:n.sort(so)):zo}static from(e){switch(e.length){case 0:return Ot;case 1:return e[0];default:return new jo(e.every(n=>n instanceof De)?e:e.reduce((n,r)=>n.concat(r instanceof De?r:r.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(e)}};function lO(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((p,f,h,m)=>{let y=m-h-(f-p);for(let g=0;g<a.length;g+=3){let x=a[g+1];if(x<0||p>x+u-d)continue;let k=a[g]+u-d;f>=k?a[g+1]=p<=k?-2:-1:p>=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 p=n.map(t[c+1]+i,-1),f=p-o,{index:h,offset:m}=r.content.findIndex(d),y=r.maybeChild(h);if(y&&m==d&&m+y.nodeSize==f){let g=a[c+2].mapInner(n,y,u+1,t[c]+i+1,s);g!=Ot?(a[c]=d,a[c+1]=f,a[c+2]=g):(a[c+1]=-2,l=!0)}else l=!0}if(l){let c=cO(a,t,e,n,o,i,s),u=vl(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,p=0;d<u.children.length;d+=3){let f=u.children[d];for(;p<a.length&&a[p]<f;)p+=3;a.splice(p,0,u.children[d],u.children[d+1],u.children[d+2])}}return new De(e.sort(so),a)}function T2(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 Le(o.from+e,o.to+e,o.type))}return n}function cO(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 O2(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 M2(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function vl(t,e,n,r){let o=[],i=!1;e.forEach((a,l)=>{let c=O2(t,a,l+n);if(c){i=!0;let u=vl(c,a,n+l+1,r);u!=Ot&&o.push(l,l+a.nodeSize,u)}});let s=T2(i?M2(t):t,-n).sort(so);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 De(s,o):Ot}function so(t,e){return t.from-e.from||t.to-e.to}function kf(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),fy(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),fy(e,o,r.copy(i.from,r.to)));break}}}return e}function fy(t,e,n){for(;e<t.length&&so(n,t[e])>0;)e++;t.splice(e,0,n)}function Au(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=Ot&&e.push(r)}),t.cursorWrapper&&e.push(De.create(t.state.doc,[t.cursorWrapper.deco])),$2.from(e)}const uO={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},dO=Jt&&Or<=11;class pO{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class fO{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new pO,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]);Jt&&Or<=11&&r.some(o=>o.type=="childList"&&o.removedNodes.length||o.type=="characterData"&&o.oldValue.length>o.target.nodeValue.length)?this.flushSoon():this.flush()}),dO&&(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,uO)),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(oy(this.view)){if(this.suppressingSelectionUpdates)return rr(this.view);if(Jt&&Or<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&mo(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=ci(i))n.add(i);for(let i=e.anchorNode;i;i=ci(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)&&oy(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,p]=u;d.parentNode&&d.parentNode.parentNode==p.parentNode?p.remove():d.remove()}else{let{focusNode:d}=this.currentSelection;for(let p of u){let f=p.parentNode;f&&f.nodeName=="LI"&&(!d||gO(e,d)!=f)&&p.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&&Ql(r)&&(c=mf(e))&&c.eq(ze.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),hO(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(Jt&&Or<=11&&e.addedNodes.length)for(let u=0;u<e.addedNodes.length;u++){let{previousSibling:d,nextSibling:p}=e.addedNodes[u];(!d||Array.prototype.indexOf.call(e.addedNodes,d)<0)&&(o=d),(!p||Array.prototype.indexOf.call(e.addedNodes,p)<0)&&(i=p)}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})}}let hy=new WeakMap,my=!1;function hO(t){if(!hy.has(t)&&(hy.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=xn,my)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."),my=!0}}function gy(t,e){let n=e.startContainer,r=e.startOffset,o=e.endContainer,i=e.endOffset,s=t.domAtPos(t.state.selection.anchor);return mo(s.node,s.offset,o,i)&&([n,r,o,i]=[o,i,n,r]),{anchorNode:n,anchorOffset:r,focusNode:o,focusOffset:i}}function mO(t,e){if(e.getComposedRanges){let o=e.getComposedRanges(t.root)[0];if(o)return gy(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?gy(t,n):null}function gO(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 yO(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}],Ql(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,p=t.someProp("domParser")||$r.fromSchema(t.state.schema),f=d.resolve(s),h=null,m=p.parse(r,{topNode:f.parent,topMatch:f.parent.contentMatchAt(f.index()),topOpen:!0,from:o,to:i,preserveWhitespace:f.parent.type.whitespace=="pre"?"full":!0,findPositions:c,ruleFromNode:wO,context:f});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 wO(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 bO=/^(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 vO(t,e,n,r,o){let i=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let C=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,V=mf(t,C);if(V&&!t.state.selection.eq(V)){if(Dt&&Qn&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",N=>N(t,Jr(13,"Enter"))))return;let oe=t.state.tr.setSelection(V);C=="pointer"?oe.setMeta("pointer",!0):C=="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=yO(t,e,n),u=t.state.doc,d=u.slice(c.from,c.to),p,f;t.input.lastKeyCode===8&&Date.now()-100<t.input.lastKeyCodeTime?(p=t.state.selection.to,f="end"):(p=t.state.selection.from,f="start"),t.input.lastKeyCode=null;let h=SO(d.content,c.doc.content,c.from,p,f);if(h&&t.input.domChangeCount++,(ui&&t.input.lastIOSEnter>Date.now()-225||Qn)&&o.some(C=>C.nodeType==1&&!bO.test(C.nodeName))&&(!h||h.endA>=h.endB)&&t.someProp("handleKeyDown",C=>C(t,Jr(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 C=yy(t,t.state.doc,c.sel);if(C&&!C.eq(t.state.selection)){let V=t.state.tr.setSelection(C);i&&V.setMeta("composition",i),t.dispatch(V)}}return}t.state.selection.from<t.state.selection.to&&h.start==h.endB&&t.state.selection instanceof 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)),Jt&&Or<=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((ui&&t.input.lastIOSEnter>Date.now()-225&&(!x||o.some(C=>C.nodeName=="DIV"||C.nodeName=="P"))||!x&&m.pos<c.doc.content.size&&(!m.sameParent(y)||!m.parent.inlineContent)&&!/\S/.test(c.doc.textBetween(m.pos,y.pos,"",""))&&(k=ze.findFrom(c.doc.resolve(m.pos+1),1,!0))&&k.head>m.pos)&&t.someProp("handleKeyDown",C=>C(t,Jr(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>h.start&&kO(u,h.start,h.endA,m,y)&&t.someProp("handleKeyDown",C=>C(t,Jr(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(C){return C(t,Jr(13,"Enter"))})},20));let b=h.start,T=h.endA,D,M,I;if(x){if(m.pos==y.pos)Jt&&Or<=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=xO(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 C=m.parent.textBetween(m.parentOffset,y.parentOffset);if(t.someProp("handleTextInput",V=>V(t,b,T,C)))return;D=t.state.tr.insertText(C,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 C=yy(t,D.doc,c.sel);C&&!(Dt&&t.composing&&C.empty&&(h.start!=h.endB||t.input.lastChromeDelete<Date.now()-100)&&(C.head==b||C.head==D.mapping.map(T)-1)||Jt&&C.empty&&C.head==b)&&D.setSelection(C)}M&&D.ensureMarks(M),i&&D.setMeta("composition",i),t.dispatch(D.scrollIntoView())}function yy(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:gf(t,e.resolve(n.anchor),e.resolve(n.head))}function xO(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(ge.from(c).eq(t))return{mark:a,type:s}}function kO(t,e,n,r,o){if(n-e<=o.pos-r.pos||$u(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($u(i,!0,!0));return!s.parent.isTextblock||s.pos>n||$u(s,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(s.parent.content)}function $u(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 SO(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&&wy(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&&wy(t.textBetween(i-1,i+1))&&(i+=l?1:-1),s=i+(s-a),a=i}return{start:i,endA:s,endB:a}}function wy(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 D2=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 q5,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(Sy),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=xy(this),vy(this),this.nodeViews=ky(this),this.docView=Zg(this.state.doc,by(this),Au(this),this.dom,this),this.domObserver=new fO(this,(r,o,i,s)=>vO(this,r,o,i,s)),this.domObserver.start(),V5(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&&Kd(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(Sy),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&&(k2(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 f=ky(this);CO(f,this.nodeViews)&&(this.nodeViews=f,i=!0)}(a||n.handleDOMEvents!=this._props.handleDOMEvents)&&Kd(this),this.editable=xy(this),vy(this);let l=Au(this),c=by(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 p=u=="preserve"&&s&&this.dom.style.overflowAnchor==null&&r5(this);if(s){this.domObserver.stop();let f=d&&(Jt||Dt)&&!this.composing&&!o.selection.empty&&!e.selection.empty&&EO(o.selection,e.selection);if(d){let h=Dt?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=nO(this)),(i||!this.docView.update(e.doc,c,l,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=Zg(e.doc,c,l,this.dom,this)),h&&!this.trackWrites&&(f=!0)}f||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&$5(this))?rr(this,f):(u2(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():p&&o5(p)}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 _e){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&Wg(this,n.getBoundingClientRect(),e)}else Wg(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 E2(e.slice,e.move,o<0?void 0:_e.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(Jt){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&&i5(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 u5(this,e)}coordsAtPos(e,n=1){return Q1(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 m5(this,n||this.state,e)}pasteHTML(e,n){return vs(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return vs(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return yf(this,e)}destroy(){this.docView&&(U5(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Au(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,WT())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return W5(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&&YT(this.dom.ownerDocument)==this.dom&&mO(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}};function by(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"),[Le.node(0,t.state.doc.content.size,e)]}function vy(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:Le.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function xy(t){return!t.someProp("editable",e=>e(t.state)===!1)}function EO(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 ky(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 CO(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 Sy(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 ks=Math.floor,AO=Math.abs,Mr=(t,e)=>t<e?t:e,di=(t,e)=>t>e?t:e,$O=t=>t!==0?t<0:1/t<0,TO=64,Ss=128,OO=1<<29,Ey=63,ns=127,MO=2147483647,DO=Number.isInteger||(t=>typeof t=="number"&&isFinite(t)&&ks(t)===t),_O=()=>new Set,NO=Array.isArray,IO=String.fromCharCode,FO=t=>t.toLowerCase(),RO=/^\s*/g,BO=t=>t.replace(RO,""),LO=/([A-Z])/g,Cy=(t,e)=>BO(t.replace(LO,n=>`${e}${FO(n)}`)),PO=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},Es=typeof TextEncoder<"u"?new TextEncoder:null,zO=t=>Es.encode(t),jO=Es?zO:PO;let Tu=typeof TextDecoder>"u"?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});Tu&&Tu.decode(new Uint8Array).length===1&&(Tu=null);class qO{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}}const VO=()=>new qO,UO=t=>{const e=VO();return t(e),WO(e)},HO=t=>{let e=t.cpos;for(let n=0;n<t.bufs.length;n++)e+=t.bufs[n].length;return e},WO=t=>{const e=new Uint8Array(HO(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},GO=(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(di(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},Cs=(t,e)=>{for(;e>ns;)Et(t,Ss|ns&e),e=ks(e/128);Et(t,ns&e)},KO=(t,e)=>{const n=$O(e);for(n&&(e=-e),Et(t,(e>Ey?Ss:0)|(n?TO:0)|Ey&e),e=ks(e/64);e>0;)Et(t,(e>ns?Ss:0)|ns&e),e=ks(e/128)},Xd=new Uint8Array(3e4),JO=Xd.length/3,XO=(t,e)=>{if(e.length<JO){const n=Es.encodeInto(e,Xd).written||0;Cs(t,n);for(let r=0;r<n;r++)Et(t,Xd[r])}else _2(t,jO(e))},YO=(t,e)=>{const n=unescape(encodeURIComponent(e)),r=n.length;Cs(t,r);for(let o=0;o<r;o++)Et(t,n.codePointAt(o))},Ay=Es&&Es.encodeInto?XO:YO,ZO=(t,e)=>{const n=t.cbuf.length,r=t.cpos,o=Mr(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(di(n*2,i)),t.cbuf.set(e.subarray(o)),t.cpos=i)},_2=(t,e)=>{Cs(t,e.byteLength),ZO(t,e)},Sf=(t,e)=>{GO(t,e);const n=new DataView(t.cbuf.buffer,t.cpos,e);return t.cpos+=e,n},QO=(t,e)=>Sf(t,4).setFloat32(0,e,!1),eM=(t,e)=>Sf(t,8).setFloat64(0,e,!1),tM=(t,e)=>Sf(t,8).setBigInt64(0,e,!1),$y=new DataView(new ArrayBuffer(4)),nM=t=>($y.setFloat32(0,t),$y.getFloat32(0)===t),Yd=(t,e)=>{switch(typeof e){case"string":Et(t,119),Ay(t,e);break;case"number":DO(e)&&AO(e)<=MO?(Et(t,125),KO(t,e)):nM(e)?(Et(t,124),QO(t,e)):(Et(t,123),eM(t,e));break;case"bigint":Et(t,122),tM(t,e);break;case"object":if(e===null)Et(t,126);else if(NO(e)){Et(t,117),Cs(t,e.length);for(let n=0;n<e.length;n++)Yd(t,e[n])}else if(e instanceof Uint8Array)Et(t,116),_2(t,e);else{Et(t,118);const n=Object.keys(e);Cs(t,n.length);for(let r=0;r<n.length;r++){const o=n[r];Ay(t,o),Yd(t,e[o])}}break;case"boolean":Et(t,e?120:121);break;default:Et(t,127)}},N2=t=>new Error(t),rM=()=>{throw N2("Method unimplemented")},I2=()=>{throw N2("Unexpected case")},Va=()=>new Map,F2=(t,e,n)=>{let r=t.get(e);return r===void 0&&t.set(e,r=n()),r},oM=Object.keys,iM=(t,e)=>{for(const n in t)if(!e(t[n],n))return!1;return!0},sM=(t,e)=>e.includes(t),aM=()=>{let t=!0;return(e,n)=>{if(t){t=!1;try{e()}finally{t=!0}}else n!==void 0&&n()}},lM=/[\uD800-\uDBFF]/,cM=/[\uDC00-\uDFFF]/,uM=(t,e)=>{let n=0,r=0;for(;n<t.length&&n<e.length&&t[n]===e[n];)n++;for(n>0&&lM.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&&cM.test(t[t.length-r])&&r--,{index:n,remove:t.length-n-r,insert:e.slice(n,e.length-r)}},dM=uM,ot=new Ge("y-sync"),Dr=new Ge("y-undo"),ca=new Ge("yjs-cursor"),pM=Math.random,fM=t=>t[ks(pM()*t.length)],hM=t=>t===void 0?null:t;class mM{constructor(){this.map=new Map}setItem(e,n){this.map.set(e,n)}getItem(e){return this.map.get(e)}}let R2=new mM,gM=!0;try{typeof localStorage<"u"&&localStorage&&(R2=localStorage,gM=!1)}catch{}const yM=R2,pi=typeof Se<"u"&&Se.release&&/node|io\.js/.test(Se.release.name)&&Object.prototype.toString.call(typeof Se<"u"?Se:0)==="[object process]",B2=typeof window<"u"&&typeof document<"u"&&!pi;let En;const wM=()=>{if(En===void 0)if(pi){En=Va();const t=Se.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=Va(),(location.search||"?").slice(1).split("&").forEach(t=>{if(t.length!==0){const[e,n]=t.split("=");En.set(`--${Cy(e,"-")}`,n),En.set(`-${Cy(e,"-")}`,n)}})):En=Va();return En},Zd=t=>wM().has(t),Qd=t=>hM(pi?Se.env[t.toUpperCase().replaceAll("-","_")]:yM.getItem(t)),L2=t=>Zd("--"+t)||Qd(t)!==null;L2("production");const bM=pi&&sM(Se.env.FORCE_COLOR,["true","1","2"]);bM||!Zd("--no-colors")&&!L2("no-color")&&(!pi||Se.stdout.isTTY)&&(!pi||Zd("--color")||Qd("COLORTERM")!==null||(Qd("TERM")||"").includes("color"));const vM=typeof document<"u"?document:{};typeof DOMParser<"u"&&new DOMParser;const xM=t=>class{constructor(e){this._=e}destroy(){t(this._)}},kM=xM(clearTimeout),Ef=(t,e)=>new kM(setTimeout(e,t)),Nn=(t,e)=>t>>>e|t<<32-e,SM=t=>Nn(t,2)^Nn(t,13)^Nn(t,22),EM=t=>Nn(t,6)^Nn(t,11)^Nn(t,25),CM=t=>Nn(t,7)^Nn(t,18)^t>>>3,AM=t=>Nn(t,17)^Nn(t,19)^t>>>10,$M=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]),TM=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]);class OM{constructor(){const e=new ArrayBuffer(320);this._H=new Uint32Array(e,0,8),this._H.set(TM),this._W=new Uint32Array(e,64,64)}_updateHash(){const e=this._H,n=this._W;for(let d=16;d<64;d++)n[d]=AM(n[d-2])+n[d-7]+CM(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,p,f;d<64;d++)p=u+EM(a)+(a&l^~a&c)+$M[d]+n[d]>>>0,f=SM(r)+(r&o^r&i^o&i)>>>0,u=c,c=l,l=a,a=s+p>>>0,s=i,i=o,o=r,r=p+f>>>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]|=Ss<<(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)]|=Ss<<(3-n%4)*8),this._W[14]=e.byteLength/OO,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 MM=t=>new OM().digest(t),DM=t=>{let e="";for(let n=0;n<t.byteLength;n++)e+=IO(t[n]);return btoa(e)},_M=t=>mt.from(t.buffer,t.byteOffset,t.byteLength).toString("base64"),NM=B2?DM:_M,IM=t=>UO(e=>Yd(e,t)),FM=t=>{for(let e=6;e<t.length;e++)t[e%6]=t[e%6]^t[e];return t.slice(0,6)},RM=t=>NM(FM(MM(IM(t)))),BM=()=>({mapping:new Map,isOMark:new Map}),xl=(t,e)=>e===void 0?!t.deleted:e.sv.has(t.id.client)&&e.sv.get(t.id.client)>t.id.clock&&!$e.isDeleted(e.ds,t.id),LM=[{light:"#ecd44433",dark:"#ecd444"}],PM=(t,e,n)=>{if(!t.has(n)){if(t.size<e.length){const r=_O();t.forEach(o=>r.add(o)),e=e.filter(o=>!r.has(o))}t.set(n,fM(e))}return t.get(n)},zM=(t,{colors:e=LM,colorMapping:n=new Map,permanentUserData:r=null,onFirstRender:o=()=>{},mapping:i}={})=>{let s=!1;const a=new qM(t,i),l=new He({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 p in d)u[p]=d[p]}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)&&Ef(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=Dr.getState(c.state),p=d&&d.undoManager;p&&p.stopCapturing()}a.mux(()=>{u.doc.transact(d=>{d.meta.set("addToHistory",u.addToHistory),a._prosemirrorChanged(c.state.doc)},ot)})}},destroy:()=>{a.destroy()}})});return l},jM=(t,e,n)=>{if(e!==null&&e.anchor!==null&&e.head!==null)if(e.type==="all")t.setSelection(new _n(t.doc));else if(e.type==="node"){const r=Zo(n.doc,n.type,e.anchor,n.mapping);t.setSelection(_e.create(t.doc,r))}else{const r=Zo(n.doc,n.type,e.anchor,n.mapping),o=Zo(n.doc,n.type,e.head,n.mapping);r!==null&&o!==null&&t.setSelection(je.between(t.doc.resolve(r),t.doc.resolve(o)))}},ep=(t,e)=>({type:e.selection.jsonID,anchor:Sl(e.selection.anchor,t.type,t.mapping),head:Sl(e.selection.head,t.type,t.mapping)});class qM{constructor(e,n=new Map){this.type=e,this.prosemirrorView=null,this.mux=aM(),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=ep(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()?(B2&&this._domSelectionInView===null&&(Ef(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=vM.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=$e.createSnapshot($e.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=>rs(r,this.prosemirrorView.state.schema,this)).filter(r=>r!==null),n=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new be(ge.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=>rs(o,this.prosemirrorView.state.schema,this)).filter(o=>o!==null),r=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new be(ge.from(n),0,0));if(e){const o=Mr(di(e.anchor,0),r.doc.content.size),i=Mr(di(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=$e.snapshot(this.doc)),e instanceof Uint8Array||n instanceof Uint8Array)if((!(e instanceof Uint8Array)||!(n instanceof Uint8Array))&&I2(),o=new $e.Doc({gc:!1}),$e.applyUpdateV2(o,n),n=$e.snapshot(o),$e.applyUpdateV2(o,e),e=$e.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=$e.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=>{$e.iterateDeletedStructs(s,d,p=>{})});const l=(d,p)=>{const f=d==="added"?a.getUserByClientId(p.client):a.getUserByDeletedId(p);return{user:f,type:d,color:PM(r.colorMapping,r.colors,f)}},c=$e.typeListToArraySnapshot(i,new $e.Snapshot(n.ds,e.sv)).map(d=>!d._item.deleted||xl(d._item,e)||xl(d._item,n)?rs(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 be(ge.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);$e.iterateDeletedStructs(n,n.deleteSet,a=>{if(a.constructor===$e.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=>P2(a,this.prosemirrorView.state.schema,this)).filter(a=>a!==null);let s=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new be(ge.from(i),0,0));jM(s,this.beforeTransactionSelection,this),s=s.setMeta(ot,{isChangeOrigin:!0,isUndoRedoOperation:n.origin instanceof $e.UndoManager}),this.beforeTransactionSelection!==null&&this._isLocalCursorInView()&&s.scrollIntoView(),this.prosemirrorView.dispatch(s)})}_prosemirrorChanged(e){this.doc.transact(()=>{np(this.doc,this.type,e,this),this.beforeTransactionSelection=ep(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 P2=(t,e,n,r,o,i)=>{const s=n.mapping.get(t);if(s===void 0){if(t instanceof $e.XmlElement)return rs(t,e,n,r,o,i);throw rM()}return s},rs=(t,e,n,r,o,i)=>{const s=[],a=l=>{if(l instanceof $e.XmlElement){const c=P2(l,e,n,r,o,i);c!==null&&s.push(c)}else{const c=l._item.right?.content?.type;c instanceof $e.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=VM(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):$e.typeListToArraySnapshot(t,new $e.Snapshot(o.ds,r.sv)).forEach(a);try{const l=t.getAttributes(r);r!==void 0&&(xl(t._item,r)?xl(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}},VM=(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,JM(c.attributes,e)))}}catch{return t.doc.transact(l=>{t._item.delete(l)},ot),null}return s},UM=(t,e)=>{const n=new $e.XmlText,r=t.map(o=>({insert:o.text,attributes:q2(o.marks,e)}));return n.applyDelta(r),e.mapping.set(n,t),n},HM=(t,e)=>{const n=new $e.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,tc(t).map(r=>tp(r,e))),e.mapping.set(n,t),n},tp=(t,e)=>t instanceof Array?UM(t,e):HM(t,e),Ty=t=>typeof t=="object"&&t!==null,Cf=(t,e)=>{const n=Object.keys(t).filter(o=>t[o]!==null);let r=n.length===(e==null?0: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||Ty(s)&&Ty(a)&&Cf(s,a)}return r},tc=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},z2=(t,e)=>{const n=t.toDelta();return n.length===e.length&&n.every((r,o)=>r.insert===e[o].text&&oM(r.attributes||{}).length===e[o].marks.length&&iM(r.attributes,(i,s)=>{const a=j2(s),l=e[o].marks;return Cf(i,l.find(c=>c.type.name===a)?.attrs)}))},As=(t,e)=>{if(t instanceof $e.XmlElement&&!(e instanceof Array)&&rp(t,e)){const n=tc(e);return t._length===n.length&&Cf(t.getAttributes(),e.attrs)&&t.toArray().every((r,o)=>As(r,n[o]))}return t instanceof $e.XmlText&&e instanceof Array&&z2(t,e)},kl=(t,e)=>t===e||t instanceof Array&&e instanceof Array&&t.length===e.length&&t.every((n,r)=>e[r]===n),Oy=(t,e,n)=>{const r=t.toArray(),o=tc(e),i=o.length,s=r.length,a=Mr(s,i);let l=0,c=0,u=!1;for(;l<a;l++){const d=r[l],p=o[l];if(kl(n.mapping.get(d),p))u=!0;else if(!As(d,p))break}for(;l+c<a;c++){const d=r[s-c-1],p=o[i-c-1];if(kl(n.mapping.get(d),p))u=!0;else if(!As(d,p))break}return{equalityFactor:l+c,foundMappedChild:u}},WM=t=>{let e="",n=t._start;const r={};for(;n!==null;)n.deleted||(n.countable&&n.content instanceof $e.ContentString?e+=n.content.str:n.content instanceof $e.ContentFormat&&(r[n.content.key]=null)),n=n.right;return{str:e,nAttrs:r}},GM=(t,e,n)=>{n.mapping.set(t,e);const{nAttrs:r,str:o}=WM(t),i=e.map(c=>({insert:c.text,attributes:Object.assign({},r,q2(c.marks,n))})),{insert:s,remove:a,index:l}=dM(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})))},KM=/(.*)(--[a-zA-Z0-9+/=]{8})$/,j2=t=>KM.exec(t)?.[1]??t,JM=(t,e)=>{const n=[];for(const r in t)n.push(e.mark(j2(r),t[r]));return n},q2=(t,e)=>{const n={};return t.forEach(r=>{if(r.type.name!=="ychange"){const o=F2(e.isOMark,r.type,()=>!r.type.excludes(r.type));n[o?`${r.type.name}--${RM(r.toJSON())}`:r.type.name]=r.attrs}}),n},np=(t,e,n,r)=>{if(e instanceof $e.XmlElement&&e.nodeName!==n.type.name)throw new Error("node name mismatch!");if(r.mapping.set(e,n),e instanceof $e.XmlElement){const d=e.getAttributes(),p=n.attrs;for(const f in p)p[f]!==null?d[f]!==p[f]&&f!=="ychange"&&e.setAttribute(f,p[f]):e.removeAttribute(f);for(const f in d)p[f]===void 0&&e.removeAttribute(f)}const o=tc(n),i=o.length,s=e.toArray(),a=s.length,l=Mr(i,a);let c=0,u=0;for(;c<l;c++){const d=s[c],p=o[c];if(!kl(r.mapping.get(d),p))if(As(d,p))r.mapping.set(d,p);else break}for(;u+c+1<l;u++){const d=s[a-u-1],p=o[i-u-1];if(!kl(r.mapping.get(d),p))if(As(d,p))r.mapping.set(d,p);else break}t.transact(()=>{for(;a-c-u>0&&i-c-u>0;){const p=s[c],f=o[c],h=s[a-u-1],m=o[i-u-1];if(p instanceof $e.XmlText&&f instanceof Array)z2(p,f)||GM(p,f,r),c+=1;else{let y=p instanceof $e.XmlElement&&rp(p,f),g=h instanceof $e.XmlElement&&rp(h,m);if(y&&g){const x=Oy(p,f,r),k=Oy(h,m,r);x.foundMappedChild&&!k.foundMappedChild?g=!1:!x.foundMappedChild&&k.foundMappedChild||x.equalityFactor<k.equalityFactor?y=!1:g=!1}y?(np(t,p,f,r),c+=1):g?(np(t,h,m,r),u+=1):(r.mapping.delete(e.get(c)),e.delete(c,1),e.insert(c,[tp(f,r)]),c+=1)}}const d=a-c-u;if(a===1&&i===0&&s[0]instanceof $e.XmlText?(r.mapping.delete(s[0]),s[0].delete(0,s[0].length)):d>0&&(e.slice(c,c+d).forEach(p=>r.mapping.delete(p)),e.delete(c,d)),c+u<i){const p=[];for(let f=c;f<i-u;f++)p.push(tp(o[f],r));e.insert(c,p)}},ot)},rp=(t,e)=>!(e instanceof Array)&&t.nodeName===e.type.name;let is=null;const XM=()=>{const t=is;is=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))})},YM=(t,e,n)=>{is||(is=new Map,Ef(0,XM)),F2(is,t,Va).set(e,n)},Sl=(t,e,n)=>{if(t===0)return $e.createRelativePositionFromTypeIndex(e,0,-1);let r=e._first===null?null:e._first.content.type;for(;r!==null&&e!==r;){if(r instanceof $e.XmlText){if(r._length>=t)return $e.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 $e.RelativePosition(r._item===null?null:r._item.id,r._item===null?$e.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 $e.RelativePosition(r._item===null?null:r._item.id,r._item===null?$e.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 I2();if(t===0&&r.constructor!==$e.XmlText&&r!==e)return ZM(r._item.parent,r._item)}return $e.createRelativePositionFromTypeIndex(e,e._length,-1)},ZM=(t,e)=>{let n=null,r=null;return t._item===null?r=$e.findRootTypeKey(t):n=$e.createID(t._item.id.client,t._item.id.clock),new $e.RelativePosition(n,r,e.id)},Zo=(t,e,n,r)=>{const o=$e.createAbsolutePositionFromRelativePosition(n,t);if(o===null||o.type!==e&&!$e.isParentOf(e,o.type._item))return null;let i=o.type,s=0;if(i.constructor===$e.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 $e.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 $e.XmlText?s+=c._length:s+=r.get(c).nodeSize),l=l.right}}i=a}return s-1},QM=(t,e)=>{const n=t.toArray().map(r=>rs(r,e,BM())).filter(r=>r!==null);return ge.fromArray(n)},eD=(t,e)=>e.topNodeType.create(null,QM(t,e)),tD=(t,e,n)=>t!==e,nD=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},rD=t=>({style:`background-color: ${t.color}70`,class:"ProseMirror-yjs-selection"}),oD=/^#[0-9a-fA-F]{6}$/,My=(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?De.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":oD.test(u.color)||console.warn("A user uses an unsupported color format",u),u.name==null&&(u.name=`User: ${c}`);let d=Zo(s,i.type,$e.createRelativePositionFromJSON(l.cursor.anchor),i.binding.mapping),p=Zo(s,i.type,$e.createRelativePositionFromJSON(l.cursor.head),i.binding.mapping);if(d!==null&&p!==null){const f=di(t.doc.content.size-1,0);d=Mr(d,f),p=Mr(p,f),a.push(Le.widget(p,()=>r(u,c),{key:c+"",side:10}));const h=Mr(d,p),m=di(d,p);a.push(Le.inline(h,m,o(u,c),{inclusiveEnd:!0,inclusiveStart:!1}))}}}),De.create(t.doc,a))},iD=(t,{awarenessStateFilter:e=tD,cursorBuilder:n=nD,selectionBuilder:r=rD,getSelection:o=s=>s.selection}={},i="cursor")=>new He({key:ca,state:{init(s,a){return My(a,t,e,n,r)},apply(s,a,l,c){const u=ot.getState(c),d=s.getMeta(ca);return u&&u.isChangeOrigin||d&&d.awarenessUpdated?My(c,t,e,n,r):a.map(s.mapping,s.doc)}},props:{decorations:s=>ca.getState(s)},view:s=>{const a=()=>{s.docView&&YM(s,ca,{awarenessUpdated:!0})},l=()=>{const c=ot.getState(s.state),u=t.getLocalState()||{};if(s.hasFocus()){const d=o(s.state),p=Sl(d.anchor,c.type,c.binding.mapping),f=Sl(d.head,c.type,c.binding.mapping);(u.cursor==null||!$e.compareRelativePositions($e.createRelativePositionFromJSON(u.cursor.anchor),p)||!$e.compareRelativePositions($e.createRelativePositionFromJSON(u.cursor.head),f))&&t.setLocalStateField(i,{anchor:p,head:f})}else u.cursor!=null&&Zo(c.doc,c.type,$e.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)}}}}),sD=t=>Dr.getState(t)?.undoManager?.undo()!=null,aD=t=>Dr.getState(t)?.undoManager?.redo()!=null,lD=new Set(["paragraph"]),cD=(t,e)=>!(t instanceof Ho.Item)||!(t.content instanceof Ho.ContentType)||!(t.content.type instanceof Ho.Text||t.content.type instanceof Ho.XmlElement&&e.has(t.content.type.nodeName))||t.content.type._length===0,uD=({protectedNodes:t=lD,trackedOrigins:e=[],undoManager:n=null}={})=>new He({key:Dr,state:{init:(r,o)=>{const i=ot.getState(o),s=n||new Ho.UndoManager(i.type,{trackedOrigins:new Set([ot].concat(e)),deleteFilter:a=>cD(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:ep(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=Dr.getState(r.state).undoManager;return i.on("stack-item-added",({stackItem:s})=>{const a=o.binding;a&&s.meta.set(a,Dr.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 dD{constructor(){Tr(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(){h1(this,Hn,new Map)}}Hn=new WeakMap;var Ir={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:"'"},El={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},pD=typeof navigator<"u"&&/Mac/.test(navigator.platform),fD=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var At=0;At<10;At++)Ir[48+At]=Ir[96+At]=String(At);for(var At=1;At<=24;At++)Ir[At+111]="F"+At;for(var At=65;At<=90;At++)Ir[At]=String.fromCharCode(At+32),El[At]=String.fromCharCode(At);for(var Ou in Ir)El.hasOwnProperty(Ou)||(El[Ou]=Ir[Ou]);function hD(t){var e=pD&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||fD&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?El:Ir)[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 mD=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),gD=typeof navigator<"u"&&/Win/.test(navigator.platform);function yD(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))mD?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 wD(t){let e=Object.create(null);for(let n in t)e[yD(n)]=t[n];return e}function Mu(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 bD(t){return new He({props:{handleKeyDown:Af(t)}})}function Af(t){let e=wD(t);return function(n,r){let o=hD(r),i,s=e[Mu(o,r)];if(s&&s(n.state,n.dispatch,n))return!0;if(o.length==1&&o!=" "){if(r.shiftKey){let a=e[Mu(o,r,!1)];if(a&&a(n.state,n.dispatch,n))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(gD&&r.ctrlKey&&r.altKey)&&(i=Ir[r.keyCode])&&i!=o){let a=e[Mu(i,r)];if(a&&a(n.state,n.dispatch,n))return!0}}return!1}}function vD(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function xD(t,e){const n=xi.fromSchema(e).serializeFragment(t),r=document.implementation.createHTMLDocument().createElement("div");return r.appendChild(n),r.innerHTML}const kD=(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 SD{constructor(e){Fe(this,"match"),Fe(this,"handler"),this.match=e.match,this.handler=e.handler}}const ED=(t,e)=>{if(Dv(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},Du=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=kD(l)+o;return i.forEach(d=>{if(c)return;const p=ED(u,d.match);if(!p)return;const f=a.state.tr,h=af(f,a.state),m={from:n-(p[0].length-o.length),to:r},{commands:y,chain:g,can:x}=new $1({editor:e,state:h});d.handler({state:h,range:m,match:p,commands:y,chain:g,can:x})===null||!f.steps.length||(f.setMeta(s,{transform:f,from:n,to:r,text:o}),a.dispatch(f),c=!0)}),c},CD=({editor:t,rules:e})=>{const n=new He({key:new Ge("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=xD(ge.from(l),i.schema));const{from:c}=a,u=c+l.length;Du({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 Du({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?Du({editor:t,from:i.pos,to:i.pos,text:`
|
|
45
|
-
`,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 AD(a,t)}return!1}},isInputRules:!0});return n},AD=(t,e,n)=>{const r=$D(t),o=document.createElement("div");o.innerHTML=r;const i=$r.fromSchema(e.schema).parse(o);o.remove();const{dispatch:s}=e.view;return s?(s(e.view.state.tr.replaceSelectionWith(i,!0)),!0):!1},$D=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 Cl,V2,Dy;const TD=class Hi{constructor(e,n,r){Tr(this,Cl),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=Hi.getResolvedExtensions([...e,...this.externalExtensions]),this.schema=T$.createSchemaByExtensions(this.extensions,r),Oe(this,Cl,V2).call(this)}static create(...e){return new Hi(...e)}static getResolvedExtensions(e){return Hi.sortByPriority(e)}static sortByPriority(e){return e.sort((n,r)=>{const o=Ie(n,"priority")||100,i=Ie(r,"priority")||100;return o>i?-1:o<i?1:0})}get attributes(){return Ce.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:ws(n.name,this.schema)},o=Ie(n,"addCommands",r);o&&(e={...e,...o()})}return e}get plugins(){const e=this.editor,n=Hi.sortByPriority([...this.extensions].reverse()),r=[],o=n.map(i=>{const s={name:i.name,options:i.options,storage:i.storage,editor:e,type:ws(i.name,this.schema)},a=[],l=Ie(i,"addShortcuts",s);let c={};if(l){const p=Object.entries(l()).map(([f,h])=>[f,(...m)=>h({editor:e,keymapArgs:m})]);c={...Object.fromEntries(p)}}a.push(bD(c));const u=Ie(i,"addInputRules",s);vD(i,e.options.enableInputRules)&&u&&r.push(...u());const d=Ie(i,"addPmPlugins",s);if(d){const p=d();a.push(...p)}return a}).flat();return[CD({editor:e,rules:r}),...o]}get nodeViews(){const{editor:e}=this,n=this.extensions.filter(r=>r.type==="node").filter(r=>!!Ie(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:pt(r.name,this.schema)},s=Ie(r,"addNodeView",i);if(!s)return[];const a=(l,c,u,d)=>{const p=Ce.getAttributesToRender(l,o);return s()({editor:e,node:l,getPos:u,decorations:d,htmlAttributes:p,extension:r})};return[r.name,a]});return Object.fromEntries(n)}};Cl=new WeakSet,V2=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:ws(t.name,this.schema)};t.type==="mark"&&(Ke(Ie(t,"keepOnSplit",e))??!0)&&this.splittableMarks.push(t.name),Oe(this,Cl,Dy).call(this,t)}},Dy=function(t){const e={name:t.name,options:t.options,storage:t.storage,editor:this.editor,type:ws(t.name,this.schema)},n=Ie(t,"onBeforeCreate",e),r=Ie(t,"onCreate",e),o=Ie(t,"onUpdate",e),i=Ie(t,"onSelectionUpdate",e),s=Ie(t,"onTransaction",e),a=Ie(t,"onFocus",e),l=Ie(t,"onBlur",e),c=Ie(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 OD=TD;const $f=({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 p=u.marks.find(f=>f.type.name===r&&Object.keys(o).every(h=>f.attrs[h]===o[h]));p&&!c&&(c={from:d,to:d+u.nodeSize,mark:p})}),c},U2=({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=$f({tr:t,from:e,to:n,markName:It,attrs:{authorEmail:r.email}}),s;i?s=i.mark.attrs.id:s=Lr();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},H2=({tr:t,from:e,to:n,user:r,date:o})=>{let i=$f({tr:t,from:e,to:n,markName:ut,attrs:{authorEmail:r.email}}),s;i?s=i.mark.attrs.id:s=Lr();const a=t.doc.type.schema.marks[ut].create({id:s,author:r.name,authorEmail:r.email,date:o}),l=new ni;let c=[];return t.doc.nodesBetween(e,n,(u,d)=>{if(!u.type.name.includes("table"))if(u.isInline&&u.marks.find(p=>p.type.name===It&&p.attrs.authorEmail===r.email)){const p=new $t(l.map(Math.max(e,d)),l.map(Math.min(n,d+u.nodeSize)),be.empty);t.maybeStep(p).failed||l.appendMap(p.getMap())}else u.isInline&&!u.marks.find(p=>p.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(p=>p.type===ut)&&["bulletList","orderedList"].includes(u.type.name)}),{deletionMark:a,deletionMap:l,nodes:c}},MD=(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}},W2=(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},G2=(t,e,n)=>{if(t){if(!e)throw new Error('Invalid "predicate" parameter')}else throw new Error('Invalid "node" parameter');return W2(t,n).filter(r=>e(r.node))},K2=(t,e)=>G2(t,n=>n.isInline,e),DD=Object.freeze(Object.defineProperty({__proto__:null,findChildren:G2,findInlineNodes:K2,findMarkPosition:MD,flatten:W2},Symbol.toStringTag,{value:"Module"})),Tf=(t,e=null)=>{const n=[],r=K2(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},gt=new Ge("TrackChangesBase"),_D=(t={})=>new He({key:gt,state:{init(e,n){return{isTrackChangesActive:!1,onlyOriginalShown:!1,onlyModifiedShown:!1,decorations:Oo(n,!1,!1)}},apply(e,n,r,o){const i=e.getMeta(gt);return i?i.type==="TRACK_CHANGES_ENABLE"?{...n,isTrackChangesActive:i.value===!0,decorations:Oo(o,n.onlyOriginalShown,n.onlyModifiedShown)}:i.type==="SHOW_ONLY_ORIGINAL"?{...n,onlyOriginalShown:i.value===!0,onlyModifiedShown:!1,decorations:Oo(o,i.value===!0,!1)}:i.type==="SHOW_ONLY_MODIFIED"?{...n,onlyOriginalShown:!1,onlyModifiedShown:i.value===!0,decorations:Oo(o,!1,i.value===!0)}:{...n,decorations:Oo(o,n.onlyOriginalShown,n.onlyModifiedShown)}:{...n,decorations:Oo(o,n.onlyOriginalShown,n.onlyModifiedShown)}}},props:{decorations(e){return this.getState(e)?.decorations}}}),Oo=(t,e,n)=>{if(!t.doc||!t.doc.nodeSize||n&&e)return De.empty;const r=[],o=Tf(t);return o.length?(o.forEach(({mark:i,from:s,to:a})=>{if(i.type.name===It)if(e){const l=Le.inline(s,a,{class:"track-insert-dec hidden"});r.push(l)}else if(n){const l=Le.inline(s,a,{class:"track-insert-dec normal"});r.push(l)}else{const l=Le.inline(s,a,{class:"track-insert-dec highlighted"});r.push(l)}if(i.type.name===ut)if(e){const l=Le.inline(s,a,{class:"track-delete-dec normal"});r.push(l)}else if(n){const l=Le.inline(s,a,{class:"track-delete-dec hidden"});r.push(l)}else{const l=Le.inline(s,a,{class:"track-delete-dec highlighted"});r.push(l);const c=Le.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=Le.inline(s,a,{class:"track-format-dec before"});r.push(l)}else if(n){const l=Le.inline(s,a,{class:"track-format-dec normal"});r.push(l)}else{const l=Le.inline(s,a,{class:"track-format-dec highlighted"});r.push(l)}}),De.create(t.doc,r)):De.empty},an="commentMark",_y=({commentId:t,state:e,tr:n,dispatch:r})=>{ND(t,e.doc).forEach(({from:o,to:i})=>{n.removeMark(o,i,e.schema.marks[an])}),r(n)},ND=(t,e)=>{const n=[];return e.descendants((r,o)=>{const{marks:i}=r,s=i.find(a=>a.type.name===an);if(s){const{attrs:a}=s,{commentId:l}=a;t===l&&n.push({from:o,to:o+r.nodeSize})}}),n},ID=(t,e,n,r=[])=>{const o=[],i=[],s=new Set;return t.descendants((a,l)=>{(a.marks?.filter(c=>c.type.name===an)).forEach(c=>{if(c){const{attrs:u={}}=c,{commentId:d}=u;if(d==="pending"||s.has(d))return;s.add(d);const p=Ny(c.attrs),f=n.nodes.commentRangeStart.create(p);o.push({pos:l,node:f});const h=n.nodes.commentRangeEnd.create(p);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=Ny(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},Ny=t=>{const{commentId:e,internal:n}=t;return{"w:id":e,internal:n}},FD=(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:p}=d,f={commentId:u,importedId:s.attrs["w:id"],internal:d.internal};e.addMark(p,a+1,n.marks[an].create(f)),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)})},RD=(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||{},p=[],f=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")p.push("Changed color");else{const g=f(h);m==null?p.push(`Set ${g} to ${y}`):p.push(`Changed ${g} from ${m} to ${y}`)}}}),p.length&&a.push(`Modified text style: ${p.join(", ")}`),a.length?a.join(". "):"No formatting changes."},BD=({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}`},_r=new Ge("paginationPlugin"),LD=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 Iy(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 Iy(t,s);e.footers[i].height=a,e.footers[i].sectionEditor=l,e.footers[i].sectionContainer=c}return e},Iy=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 $s({loadFromSchema:!0,mode:"text",editable:!1,element:r,content:e,extensions:Vf(),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})})})}):{},Of=[It,ut,vt],bt=new Ge("comments"),PD=Ye.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[an].create({commentId:a,internal:l})),n(e),!0},removeComment:({commentId:t,importedId:e})=>({tr:n,dispatch:r,state:o})=>{n.setMeta(bt,{event:"deleted"}),_y({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(p=>p.type.name===an);if(d){const{attrs:p}=d;p.commentId===t&&(s=l,a=c)}}),s?(n.addMark(a,a+s.nodeSize,this.editor.schema.marks[an].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"}),_y({commentId:t,state:r,tr:e,dispatch:n})}}},addPmPlugins(){const t=this.editor;let e,n;return t.options.isHeadless?[]:[new He({key:bt,state:{init(){return{activeThreadId:null,externalColor:"#B1124B",internalColor:"#078383",decorations:De.empty,allCommentPositions:{},allCommentIds:[],changedActiveThread:!1,trackedChanges:{}}},apply(r,o,i,s){const a=r.getMeta(_r)?.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(gt),d=o.trackedChanges;u&&(o.trackedChanges=jD(u,d,s,t));const p=l?.type==="setActiveComment";if(!r.docChanged&&r.selectionSet||p){const{selection:f}=r;let h=zD(s.doc,f);if(p&&(h=l.activeThreadId),n!==h){n=h;const m={type:za.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((f,h)=>{const{marks:m=[]}=f,y=m.filter(k=>k.type.name===an);let g=!1;y.forEach(k=>{const{attrs:b}=k,T=b.commentId||b.importedId,D=i.coordsAtPos(h);Fy({allCommentPositions:d,threadId:T,pos:h,currentBounds:D,node:f});const M=b.internal;g||(g=n===T);let I=BD({activeThreadId:n,threadId:T,isInternal:M,editor:t});const C=Le.inline(h,h+f.nodeSize,{style:`background-color: ${I};`,"data-thread-id":T,class:"sd-editor-comment-highlight"});g&&n!==T||u.push(C)});const x=J2({doc:l,from:h,to:h+f.nodeSize});if(x){const k=i.coordsAtPos(h),{id:b}=x.mark.attrs;Fy({allCommentPositions:d,threadId:b,pos:h,currentBounds:k,node:f})}});const p=De.create(l,u);if(!bt.getState(a).decorations.eq(p)){const f=a.tr.setMeta(bt,{decorations:p,allCommentPositions:d});i.dispatch(f)}t.emit("comment-positions",{allCommentPositions:d})}}}})]}}),Fy=({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)}},zD=(t,e)=>{if(!e)return;const{$from:n,$to:r}=e;if(n.pos!==r.pos||!t.nodeAt(n.pos))return;const o=J2({doc:t,from:n.pos,to:r.pos});if(o)return o.mark.attrs.id;const i=[];let s=!1;t.descendants((d,p)=>{if(s)return;const f=p+d.nodeSize;if(n.pos<p||n.pos>=f)return;const{marks:h=[]}=d;h.find(m=>m.type.name===an)&&i.push({node:d,pos:p,size:d.nodeSize}),p>n.pos&&(s=!0)});let a=null,l=null;i.forEach(({pos:d,node:p})=>{a||(a=n.pos-d);const f=n.pos-d;f>=0&&f<=a&&(l=p,a=f)});const{marks:c=[]}=l||{},u=c.find(d=>d.type.name===an);return u?.attrs?.commentId||u?.attrs?.importedId},J2=({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=>Of.includes(u.type.name));c&&!s&&(s={from:l,to:l+a.nodeSize,mark:c})}),s},jD=(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 p=d?.slice?.content?.content||[];p.length||n.doc.descendants((h,m)=>{if(h.marks.find(y=>y.type.name===vt))return p=[h],!1});const f=VD({documentId:r.options.documentId,event:u?"add":"update",marks:{insertedMark:o,deletionMark:i,formatMark:s},deletionNodes:a,nodes:p,newEditorState:n});return f&&r.emit("commentsUpdate",f),l},qD=({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=RD(n.attrs)),(o===ut||i)&&(l=e?.text??"",i)){let{id:c}=r.deletionMark.attrs;l=UD(t.doc,u=>{const{marks:d=[]}=u,p=d.filter(f=>Of.includes(f.type.name));if(!p.length)return!1;if(p.find(f=>f.attrs.id===c))return!0})?.node.text??""}return{deletionText:l,trackedChangeText:a}},VD=({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:p}=l,f=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=>Of.includes(I.type.name));if(M.length&&(M.find(I=>I.attrs.id===f)&&(y=b),y))return!1});const{deletionText:g,trackedChangeText:x}=qD({state:o,node:y||h,mark:s,marks:e,trackedChangeType:c,isDeletionInsertion:m,deletionNodes:n});if(!g&&!x)return;const k={event:za.ADD,type:"trackedChange",documentId:i,changeId:f,trackedChangeType:m?"both":c,trackedChangeText:x,deletedText:e.deletionMark?g:null,author:u,authorEmail:d,date:p};return t==="add"?k.event=za.ADD:t==="update"&&(k.event=za.UPDATE),k};function UD(t,e){let n=null;return t.descendants((r,o)=>{if(e(r)&&(n={node:r,pos:o}),n)return!1}),n}const X2=({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=Xl(t,u,!1),p=d?d.to:n.to,f=new $t(p,p,n.slice,n.structure),h=l.invert(e.docs[c]).map(o);o.appendMap(h.getMap());const m={};if(f){const y=t.apply(r).tr;if(y.maybeStep(f).failed)return;const g=f.getMap().map(f.to),x=U2({tr:y,from:f.from,to:g,user:s,date:a}),k=new $t(f.from,f.to,y.doc.slice(f.from,g));r.step(k);const b=o.maps.length-1;o.appendMap(k.getMap(),b),f.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}=H2({tr:r,from:n.from,to:n.to,user:s,date:a});m.deletionNodes=x,m.deletionMark=y,o.appendMapping(g)}r.setMeta(gt,m),r.setMeta(bt,{type:"force"})},HD=()=>{},WD=()=>{},Y2=({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(f=>f.type.name===ut))return!1;const d=c.marks.find(f=>[ut,vt].includes(f.type.name)),p=d?d.attrs.id:Lr();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(f=>f.type===n.mark.type)){const f=c.marks.find(y=>y.type.name===vt);let h=[],m=[];if(f?f.attrs.before.find(y=>y.type==="textStyle"?y.type===n.mark.type.name&&oi(y.attrs,n.mark.attrs):y.type===n.mark.type.name)?(m=[...f.attrs.before.filter(y=>y.type!==n.mark.type.name)],h=[...f.attrs.after]):(m=[...f.attrs.before],h=[...f.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:p,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(gt,l),r.setMeta(bt,{type:"force"})}else f&&r.removeMark(Math.max(n.from,u),Math.min(n.to,u+c.nodeSize),f)}})},Z2=({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 p=[],f=[];if(d?d.attrs.after.find(h=>h.type===n.mark.type.name)?(p=[...d.attrs.after.filter(h=>h.type!==n.mark.type.name)],f=[...d.attrs.before]):(p=[...d.attrs.after],f=[...d.attrs.before,{type:n.mark.type.name,attrs:{...n.mark.attrs}}]):(p=[],f=[{type:n.mark.type.name,attrs:{...n.mark.attrs}}]),p.length||f.length){const h=t.schema.marks[vt].create({id:Lr(),author:s.name,authorEmail:s.email,date:a,before:f,after:p});r.addMark(Math.max(n.from,u),Math.min(n.to,u+c.nodeSize),h),l.formatMark=h,l.step=n,r.setMeta(gt,l),r.setMeta(bt,{type:"force"})}else d&&r.removeMark(Math.max(n.from,u),Math.min(n.to,u+c.nodeSize),d)}})},Q2=({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 ni,a=Math.floor(Date.now()/6e5)*6e5,l=new Date(a).toISOString();if(t.steps.forEach((c,u)=>{const d=c.map(s),{doc:p}=i;d&&(d instanceof $t?(X2({state:e,tr:t,step:d,newTr:i,map:s,doc:p,user:n,date:l,originalStep:c,originalStepIndex:u}),console.debug("[track-changes]: replaceStep")):d instanceof qs?(Y2({state:e,tr:t,step:d,newTr:i,map:s,doc:p,user:n,date:l}),console.debug("[track-changes]: addMarkStep")):d instanceof vn?(Z2({state:e,tr:t,step:d,newTr:i,map:s,doc:p,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=Xl(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},GD=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:Jo(lt(a.line)),lineSpaceBefore:Jo(lt(a.lineSpaceBefore)),lineSpaceAfter:Jo(lt(a.lineSpaceAfter))};r.setNodeMarkup(i,void 0,{...s,spacing:{...a,...l}})}}),n(r),!0},KD={initial:GD},Ry=t=>{if(t==="initial"||t==="0.4.14")return Object.values(KD)},Mf=(t,e,n)=>{const{type:r}=t.attrs,o={html:JD,text:XD,checkbox:ZD,image:YD,link:e_,yesno:t_,date:QD}[r];return o?o(e,n):{}},JD=t=>({rawHtml:t}),XD=t=>({displayLabel:t}),YD=t=>({imageSrc:t}),ZD=t=>({displayLabel:t}),QD=(t,e)=>({displayLabel:i_(t,e.input_format)}),e_=t=>(t.startsWith("http")||(t=`http://${t}`),{linkUrl:t}),t_=t=>({displayLabel:{YES:"Yes",NO:"No"}[t[0].toUpperCase()]}),n_=({editor:t,tr:e,annotationValues:n})=>{const{state:r}=t,{doc:o}=r,i=[];return o.descendants((s,a)=>{s.type.name==="table"&&i.push({node:s,pos:a})}),i.reverse().forEach(s=>{r_({tableNode:s,annotationValues:n,tr:e,editor:t})}),e},r_=({tableNode:t,annotationValues:e,tr:n,editor:r})=>{let o=null,i=null;const{tableRow:s,tableCell:a,fieldAnnotation:l,paragraph:c}=r.schema.nodes;if(t.node.descendants((x,k)=>{if(o)return!0;if(x.type===s&&(i={node:x,pos:k}),x.type===l){const b=_u(x.attrs.fieldId,e);Array.isArray(b)&&(o=i)}}),!o)return;const{node:u,pos:d}=o,p=n.mapping.map(t.pos+d),f=p+u.nodeSize;let h=0;if(u.descendants((x,k)=>{if(x.type===l){const b=_u(x.attrs.fieldId,e);Array.isArray(b)&&(h=Math.max(h,b.length))}}),h<=1)return;const m=(x,k)=>{const b=x.content.content.map(T=>{if(T.type!==c)return T;const D=T.content.content.map(M=>{if(M.type!==l)return M;let I=_u(M.attrs.fieldId,e);Array.isArray(I)||(I=[I]);const C=I?.[k],V=Mf(M,C);return l.create({...M.attrs,...V,generatorIndex:k},M.content,M.marks)});return c.create(T.attrs,ge.from(D),T.marks)});return a.create(x.attrs,ge.from(b),x.marks)};for(let x=h-1;x>=0;x--){const k=n.mapping.map(f)+1,b=u.content.content.map(D=>m(D,x)),T=s.create(u.attrs,ge.from(b),u.marks);n.insert(k,ge.from(T))}const y=n.mapping.map(p),g=y+u.nodeSize;n.delete(y-1,g+1)},_u=(t,e)=>e.find(n=>n.input_id===t)?.input_value||null,o_=({annotationValues:t=[],hiddenFieldIds:e=[],schema:n,tr:r})=>{const o=[],i=n.nodes.fieldAnnotation;r.doc.descendants((a,l)=>{a.type===i&&o.push({node:a,pos:l,size:a.nodeSize})});const s=new Set;if(e.length)for(const{node:a,pos:l}of o)e.includes(a.attrs.fieldId)&&s.add(l);for(const{node:a,pos:l}of o){const{type:c,fieldType:u,fieldId:d}=a.attrs;if(s.has(l))continue;let p=null;const f=t.find(h=>h.input_id===d);if(!f){const h=t.filter(m=>m.input_field_type==="CHECKBOXINPUT");e:for(const m of h)for(const y of m.input_options)if(y.itemid===d){p=m.input_link_value[y.itemid]||" ";break e}}if(p=p||f?.input_value||null,!(Array.isArray(p)&&a.attrs.generatorIndex!=null))if((c==="checkbox"||u==="CHECKBOXINPUT")&&(!p||typeof p=="string"&&p.codePointAt(0)===9744)&&(p=" "),!p)s.add(l);else{const h=Mf(a,p,f);r=r.setNodeMarkup(l,void 0,{...a.attrs,...h})}}return Array.from(s).sort((a,l)=>l-a).forEach(a=>{const l=o.find(c=>c.pos===a);l&&(r=r.delete(a,a+l.node.nodeSize))}),r},i_=(t=null,e="")=>{const n=t?new Date(t):new Date;return isNaN(n.getTime())?t:e?dateFormat(n,e):n.toLocaleDateString("en-US",{month:"short",day:"2-digit",year:"numeric"})},Nu={getFieldAttrs:Mf,processTables:n_,annotateDocument:o_};var Wo,ex,Pe,tx,nx,op,Iu,rx,Ua,ip,Fu,Ru,sp,ap,By,Bu,Lu,Ha,Pu,Ly,Wi,Gi,Py,zy,ox,ix;const s_=class sx extends dD{constructor(e){super(),Tr(this,Pe),Tr(this,Wo),Fe(this,"extensionService"),Fe(this,"extensionStorage",{}),Fe(this,"schema"),Fe(this,"view"),Fe(this,"isFocused",!1),Tr(this,ex),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}),Oe(this,Pe,tx).call(this,e),Oe(this,Pe,rx).call(this,e),this.setOptions(e);let n={docx:()=>Oe(this,Pe,nx).call(this,this.options),text:()=>Oe(this,Pe,op).call(this,this.options),html:()=>Oe(this,Pe,op).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,Wo)?.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,Wo).chain()}can(){return Jn(this,Wo).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"?(Oe(this,Pe,ip).call(this,"TrackChangesBase"),this.commands.disableTrackChangesShowOriginal(),this.commands.enableTrackChanges(),this.setEditable(!0,!1)):n==="editing"&&(Oe(this,Pe,ip).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),Oe(this,Pe,Ua).call(this)};e.synced?Oe(this,Pe,Ua).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.ydoc)&&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=!0,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 nameOrPluginKey=="string"?`${nameOrPluginKey}$`:nameOrPluginKey.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 _d,o=await r.getDocxData(e,n),i=r.media;return[o,i,r.mediaFiles,r.fonts]}static getDocumentVersion(e){return Nr.getStoredSuperdocVersion(e)}static updateDocumentVersion(e,n){return Nr.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 Ce.getAttributes(this.state,e)}isActive(e,n){const r=typeof e=="string"?e:null,o=typeof e=="string"?n:e;return H1(this.state,r,o)}getJSON(){return this.state.doc.toJSON()}getHTML(){const e=document.createElement("div"),n=xi.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="external",comments:r=[]}={}){const o=Oe(this,Pe,ox).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"],p=this.converter.schemaToXml(d.elements[0]),f={"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(p),"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]);f["word/comments.xml"]=String(m),f["word/commentsExtended.xml"]=String(y),f["word/commentsExtensible.xml"]=String(g),f["word/commentsIds.xml"]=String(x)}const h=await new _d().updateZip({docx:this.options.content,updatedDocs:f,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(),Oe(this,Pe,ix).call(this),this.removeAllListeners()}static checkIfMigrationsNeeded(e){version||(version="initial");const n=Ry(version)||[];return console.debug("[checkVersionMigrations] Migrations needed:",version,n.length),n.length>0}processCollaborationMigrations(){if(console.debug("[checkVersionMigrations] Current editor version","0.11.50"),!this.options.ydoc)return;let e=this.options.ydoc.getMap("meta").get("version");e||(e="initial"),console.debug("[checkVersionMigrations] Document version",e);const n=Ry(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 sx.loadXmlData(newFile);this.setOptions({fileSource:newFile,content:n,media:r,mediaFiles:o,fonts:i,isNewFile:!0,shouldLoadComments:!0,replacedFile:!0}),Oe(this,Pe,sp).call(this),Oe(this,Pe,ap).call(this),this.initDefaultStyles(),this.options.ydoc&&this.options.collaborationProvider?this.initializeCollaborationData(!0):Oe(this,Pe,Ua).call(this),this.options.ydoc||(Oe(this,Pe,Gi).call(this),Oe(this,Pe,Wi).call(this))}getNodesOfType(e){const{findChildren:n}=Zl;return n(this.state.doc,r=>r.type.name===e)}replaceNodeWithHTML(e,n){const{tr:r}=this.state,{dispatch:o}=this.view;if(!e||!n)return;const i=e.pos,s=i+e.node.nodeSize,a=Oe(this,Pe,Ha).call(this,n);r.replaceWith(i,s,a),o(r)}prepareForAnnotations(e=[]){const{tr:n}=this.state,{dispatch:r}=this.view,o=Nu.processTables({editor:this,tr:n,annotationValues:e});this.view.dispatch(o)}annotate(e=[],n=[]){const{state:r,view:o,schema:i}=this;let s=r.tr;s=Nu.processTables({editor:this,tr:s,annotationValues:e}),s=Nu.annotateDocument({tr:s,schema:i,annotationValues:e,hiddenFieldIds:n}),s.docChanged&&o.dispatch(s.scrollIntoView())}};Wo=new WeakMap,ex=new WeakMap,Pe=new WeakSet,tx=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")},nx=function(t){Oe(this,Pe,Fu).call(this),Oe(this,Pe,Ru).call(this),Oe(this,Pe,Bu).call(this),Oe(this,Pe,sp).call(this),Oe(this,Pe,ap).call(this),this.options.isHeadless||Oe(this,Pe,By).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),Oe(this,Pe,Pu).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",Oe(this,Pe,Iu)),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",Oe(this,Pe,Ly)),this.on("paginationUpdate",this.options.onPaginationUpdate),this.on("comment-positions",this.options.onCommentLocationsUpdate),this.initializeCollaborationData(),this.options.ydoc||(Oe(this,Pe,Gi).call(this),Oe(this,Pe,Wi).call(this)),window.setTimeout(()=>{this.isDestroyed||this.emit("create",{editor:this})},0))},op=function(t){(!t.extensions||!t.extensions.length)&&(this.options.extensions=qf()),Oe(this,Pe,Fu).call(this),Oe(this,Pe,Ru).call(this),Oe(this,Pe,Bu).call(this),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("contentError",this.options.onContentError),Oe(this,Pe,Pu).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",Oe(this,Pe,Iu)),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)},Iu=function({editor:t,event:e}){this.toolbar?.setActiveEditor(t),this.options.onFocus({editor:t,event:e})},rx=function(t){t.isHeadless&&(typeof navigator>"u"&&(Yr.navigator={isHeadless:!0}),t.mockDocument&&(Yr.document=t.mockDocument,Yr.window=t.mockWindow))},Ua=function(){if(!this.options.isNewFile)return;this.options.isNewFile=!1;const t=Oe(this,Pe,Lu).call(this),e=this.state.tr.replaceWith(0,this.state.doc.content.size,t);this.view.dispatch(e),setTimeout(()=>{Oe(this,Pe,Gi).call(this),Oe(this,Pe,Wi).call(this)},50)},ip=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},Fu=function(){const t=["extension","node","mark"],e=[qT,PT,VT,jT],n=this.options.externalExtensions||[],r=[...e,...this.options.extensions].filter(o=>t.includes(o?.type));this.extensionService=OD.create(r,n,this)},Ru=function(){h1(this,Wo,$1.create({editor:this}))},sp=function(){this.options.converter?this.converter=this.options.converter:this.converter=new Nr({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})},ap=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())},By=function(){const t=this.converter.getDocumentFonts();if(t?.length){const e=document.createElement("style");e.textContent=t,document.head.appendChild(e)}},Bu=function(){this.schema=this.extensionService.schema},Lu=function(){let t;try{const{mode:e,fragment:n,isHeadless:r,content:o,loadFromSchema:i}=this.options;e==="docx"?(t=U1(this.converter,this.schema,this),t=Oe(this,Pe,zy).call(this,t),this.options.html&&(t=Oe(this,Pe,Ha).call(this,this.options.html)),n&&(t=eD(n,this.schema))):(e==="text"||e==="html")&&(i?t=this.schema.nodeFromJSON(o):o?t=Oe(this,Pe,Ha).call(this,o):t=this.schema.topNodeType.createAndFill())}catch(e){console.error(e),this.emit("contentError",{editor:this,error:e})}return t},Ha=function(t){let e=t;if(typeof t=="string"){const n=document.createElement("div");n.innerHTML=t,e=n,n.remove()}return $r.fromSchema(this.schema).parse(e)},Pu=function(){let t=Oe(this,Pe,Lu).call(this);const e={schema:this.schema};this.options.ydoc||(e.doc=t),this.view=new D2(this.options.element,{...this.options.editorProps,dispatchTransaction:Oe(this,Pe,Py).bind(this),state:Zi.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()},Ly=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||(Oe(this,Pe,Gi).call(this),Oe(this,Pe,Wi).call(this)))},Wi=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)},Gi=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 LD(this);this.storage.pagination.sectionData=t;const{state:e,dispatch:n}=this.view,r=e.tr.setMeta(_r,{isReadyToInit:!0});n(r)}},Py=function(t){if(this.view.isDestroyed)return;let e;try{const i=gt.getState(this.view.state)?.isTrackChangesActive??!1?Q2({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})},zy=function(t){const e=Zi.create({schema:this.schema,doc:t}),{tr:n,doc:r}=e;return FD(r,n,this.schema,this.converter),e.apply(n).doc},ox=function(t=[]){const e=Zi.create({schema:this.schema,doc:this.state.doc,plugins:this.state.plugins}),{tr:n,doc:r}=e;return ID(r,n,this.schema,t),e.apply(n).doc.toJSON()},ix=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 $s=s_;const ax=Ye.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()}}}),lx=Ye.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()}}}),cx=Ye.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=cl(n,o,i),r=r||s,e().setMark("textStyle",{fontSize:`${n}${r}`}).run()},unsetFontSize:()=>({chain:t})=>t().setMark("textStyle",{fontSize:null}).removeEmptyTextStyle().run()}}}),ux=Ye.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")}}}),dx=Ye.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)}}}),px=Ye.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:Wl(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)}}}),fx=Ye.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=Hs(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(p=>p.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 a_(t={}){return new He({view(e){return new l_(e,t)}})}class l_{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,o=this.editorView.dom,i=o.getBoundingClientRect(),s=i.width/o.offsetWidth,a=i.height/o.offsetHeight;if(n){let d=e.nodeBefore,p=e.nodeAfter;if(d||p){let f=this.editorView.nodeDOM(this.cursorPos-(d?d.nodeSize:0));if(f){let h=f.getBoundingClientRect(),m=d?h.bottom:h.top;d&&p&&(m=(m+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let y=this.width/2*a;r={left:h.left,right:h.right,top:m-y,bottom:m+y}}}}if(!r){let d=this.editorView.coordsAtPos(this.cursorPos),p=this.width/2*s;r={left:d.left-p,right:d.left+p,top:d.top,bottom:d.bottom}}let l=this.editorView.dom.offsetParent;this.element||(this.element=l.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 c,u;if(!l||l==document.body&&getComputedStyle(l).position=="static")c=-pageXOffset,u=-pageYOffset;else{let d=l.getBoundingClientRect(),p=d.width/l.offsetWidth,f=d.height/l.offsetHeight;c=d.left-l.scrollLeft*p,u=d.top-l.scrollTop*f}this.element.style.left=(r.left-c)/s+"px",this.element.style.top=(r.top-u)/a+"px",this.element.style.width=(r.right-r.left)/s+"px",this.element.style.height=(r.bottom-r.top)/a+"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=yv(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){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}const hx=Ye.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:2,class:void 0}},addPmPlugins(){return[a_(this.options)]}});let en=class gr extends ze{constructor(e){super(e,e)}map(e,n){let r=e.resolve(n.map(this.head));return gr.valid(r)?new gr(r):ze.near(r)}content(){return be.empty}eq(e){return e instanceof gr&&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 gr(e.resolve(n.pos))}getBookmark(){return new Df(this.anchor)}static valid(e){let n=e.parent;if(n.isTextblock||!c_(e)||!u_(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&&gr.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(gr.valid(l))return l}for(;;){let s=n>0?i.firstChild:i.lastChild;if(!s){if(i.isAtom&&!i.isText&&!_e.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(gr.valid(a))return a}return null}}};en.prototype.visible=!1;en.findFrom=en.findGapCursorFrom;ze.jsonID("gapcursor",en);class Df{constructor(e){this.pos=e}map(e){return new Df(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return en.valid(n)?new en(n):ze.near(n)}}function c_(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 u_(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 d_(){return new He({props:{decorations:m_,createSelectionBetween(t,e,n){return e.pos==n.pos&&en.valid(n)?new en(n):null},handleClick:f_,handleKeyDown:p_,handleDOMEvents:{beforeinput:h_}}})}const p_=Af({ArrowLeft:ua("horiz",-1),ArrowRight:ua("horiz",1),ArrowUp:ua("vert",-1),ArrowDown:ua("vert",1)});function ua(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=en.findGapCursorFrom(a,e,l);return c?(o&&o(r.tr.setSelection(new en(c))),!0):!1}}function f_(t,e,n){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!en.valid(r))return!1;let o=t.posAtCoords({left:n.clientX,top:n.clientY});return o&&o.inside>-1&&_e.isSelectable(t.state.doc.nodeAt(o.inside))?!1:(t.dispatch(t.state.tr.setSelection(new en(r))),!0)}function h_(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof en))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=ge.empty;for(let s=r.length-1;s>=0;s--)o=ge.from(r[s].createAndFill(null,o));let i=t.state.tr.replace(n.pos,n.pos,new be(o,0,0));return i.setSelection(je.near(i.doc.resolve(n.pos+1))),t.dispatch(i),!1}function m_(t){if(!(t.selection instanceof en))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",De.create(t.doc,[Le.widget(t.selection.head,e,{key:"gapcursor"})])}const g_=Ye.create({name:"gapCursor",addPmPlugins(){return[d_()]},extendNodeSchema(t){return{allowGapCursor:Ke(Ie(t,"allowGapCursor",{name:t.name,options:t.options,storage:t.storage}))??null}}}),y_=new Ge("collaboration"),w_=Ye.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=v_();x_(this.options.ydoc,this.editor),k_(this.options.ydoc,this.editor,this);const[e,n]=b_(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"),Dr.getState(e).undoManager.undoStack.length===0?!1:n?sD(e):!0),redo:()=>({tr:t,state:e,dispatch:n})=>(t.setMeta("preventDispatch",!0),t.setMeta("inputType","historyRedo"),Dr.getState(e).undoManager.redoStack.length===0?!1:n?aD(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()}}}),b_=(t,e)=>{const n=t.getXmlFragment("supereditor");return[zM(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]},v_=()=>uD(),x_=(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}))})},k_=(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)},S_=Ye.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?[iD(t.awareness,{cursorBuilder:E_})]:[]}}),E_=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},Qo="aiMark",da="aiAnimationMark",mx="aiLoaderNode",C_=tn.create({name:Qo,group:"ai",inclusive:!1,addOptions(){return{htmlAttributes:{class:"sd-ai-highlight"}}},addAttributes(){return{id:{default:null,rendered:!1}}},parseDOM(){return[{tag:Qo}]},renderDOM({htmlAttributes:t}){return[Qo,Ce.mergeAttributes(this.options.htmlAttributes,t)]}}),A_=tn.create({name:da,group:"ai",inclusive:!1,spanning:!1,excludes:da,addOptions(){return{htmlAttributes:{}}},addAttributes(){return{id:{default:null,rendered:!1},class:{default:null,rendered:!0},dataMarkId:{default:null,rendered:!0}}},parseDOM(){return[{tag:da}]},renderDOM({htmlAttributes:t}){return[da,Ce.mergeAttributes(this.options.htmlAttributes,t)]}}),$_="data:image/svg+xml,%3csvg%20fill='hsla(278,%2077.40%25,%2020.80%25,%200.65)'%20viewBox='0%200%2024%2024'%20xmlns='http://www.w3.org/2000/svg'%3e%3ccircle%20cx='4'%20cy='12'%20r='0'%3e%3canimate%20begin='0;spinner_z0Or.end'%20attributeName='r'%20calcMode='spline'%20dur='0.5s'%20keySplines='.36,.6,.31,1'%20values='0;3'%20fill='freeze'/%3e%3canimate%20begin='spinner_OLMs.end'%20attributeName='cx'%20calcMode='spline'%20dur='0.5s'%20keySplines='.36,.6,.31,1'%20values='4;12'%20fill='freeze'/%3e%3canimate%20begin='spinner_UHR2.end'%20attributeName='cx'%20calcMode='spline'%20dur='0.5s'%20keySplines='.36,.6,.31,1'%20values='12;20'%20fill='freeze'/%3e%3canimate%20id='spinner_lo66'%20begin='spinner_Aguh.end'%20attributeName='r'%20calcMode='spline'%20dur='0.5s'%20keySplines='.36,.6,.31,1'%20values='3;0'%20fill='freeze'/%3e%3canimate%20id='spinner_z0Or'%20begin='spinner_lo66.end'%20attributeName='cx'%20dur='0.001s'%20values='20;4'%20fill='freeze'/%3e%3c/circle%3e%3ccircle%20cx='4'%20cy='12'%20r='3'%3e%3canimate%20begin='0;spinner_z0Or.end'%20attributeName='cx'%20calcMode='spline'%20dur='0.5s'%20keySplines='.36,.6,.31,1'%20values='4;12'%20fill='freeze'/%3e%3canimate%20begin='spinner_OLMs.end'%20attributeName='cx'%20calcMode='spline'%20dur='0.5s'%20keySplines='.36,.6,.31,1'%20values='12;20'%20fill='freeze'/%3e%3canimate%20id='spinner_JsnR'%20begin='spinner_UHR2.end'%20attributeName='r'%20calcMode='spline'%20dur='0.5s'%20keySplines='.36,.6,.31,1'%20values='3;0'%20fill='freeze'/%3e%3canimate%20id='spinner_Aguh'%20begin='spinner_JsnR.end'%20attributeName='cx'%20dur='0.001s'%20values='20;4'%20fill='freeze'/%3e%3canimate%20begin='spinner_Aguh.end'%20attributeName='r'%20calcMode='spline'%20dur='0.5s'%20keySplines='.36,.6,.31,1'%20values='0;3'%20fill='freeze'/%3e%3c/circle%3e%3ccircle%20cx='12'%20cy='12'%20r='3'%3e%3canimate%20begin='0;spinner_z0Or.end'%20attributeName='cx'%20calcMode='spline'%20dur='0.5s'%20keySplines='.36,.6,.31,1'%20values='12;20'%20fill='freeze'/%3e%3canimate%20id='spinner_hSjk'%20begin='spinner_OLMs.end'%20attributeName='r'%20calcMode='spline'%20dur='0.5s'%20keySplines='.36,.6,.31,1'%20values='3;0'%20fill='freeze'/%3e%3canimate%20id='spinner_UHR2'%20begin='spinner_hSjk.end'%20attributeName='cx'%20dur='0.001s'%20values='20;4'%20fill='freeze'/%3e%3canimate%20begin='spinner_UHR2.end'%20attributeName='r'%20calcMode='spline'%20dur='0.5s'%20keySplines='.36,.6,.31,1'%20values='0;3'%20fill='freeze'/%3e%3canimate%20begin='spinner_Aguh.end'%20attributeName='cx'%20calcMode='spline'%20dur='0.5s'%20keySplines='.36,.6,.31,1'%20values='4;12'%20fill='freeze'/%3e%3c/circle%3e%3ccircle%20cx='20'%20cy='12'%20r='3'%3e%3canimate%20id='spinner_4v5M'%20begin='0;spinner_z0Or.end'%20attributeName='r'%20calcMode='spline'%20dur='0.5s'%20keySplines='.36,.6,.31,1'%20values='3;0'%20fill='freeze'/%3e%3canimate%20id='spinner_OLMs'%20begin='spinner_4v5M.end'%20attributeName='cx'%20dur='0.001s'%20values='20;4'%20fill='freeze'/%3e%3canimate%20begin='spinner_OLMs.end'%20attributeName='r'%20calcMode='spline'%20dur='0.5s'%20keySplines='.36,.6,.31,1'%20values='0;3'%20fill='freeze'/%3e%3canimate%20begin='spinner_UHR2.end'%20attributeName='cx'%20calcMode='spline'%20dur='0.5s'%20keySplines='.36,.6,.31,1'%20values='4;12'%20fill='freeze'/%3e%3canimate%20begin='spinner_Aguh.end'%20attributeName='cx'%20calcMode='spline'%20dur='0.5s'%20keySplines='.36,.6,.31,1'%20values='12;20'%20fill='freeze'/%3e%3c/circle%3e%3c/svg%3e",T_=Ue.create({name:mx,group:"inline",inline:!0,atom:!0,selectable:!1,draggable:!1,addOptions(){return{htmlAttributes:{class:"sd-ai-loader",contentEditable:"false"}}},parseDOM(){return[{tag:"span.sd-ai-loader"}]},renderDOM({htmlAttributes:t}){const e=document.createElement("span");Object.entries(Ce.mergeAttributes(this.options.htmlAttributes,t)).forEach(([r,o])=>e.setAttribute(r,o));const n=document.createElement("img");return n.src=$_,n.alt="loading...",n.width=100,n.height=50,e.appendChild(n),e}}),pa=new Ge("ai"),gx=Ye.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[Qo].create({id:"ai-highlight"})),e&&e(t),!0)},updateAiHighlightStyle:t=>({tr:e,dispatch:n})=>(e.setMeta(pa,{type:"updateStyle",className:t}),n&&n(e),!0),clearAiHighlightStyle:()=>({tr:t,dispatch:e})=>(t.setMeta(pa,{type:"updateStyle",className:null}),e&&e(t),!0),removeAiMark:(t=Qo)=>({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},removeAiNode:(t=mx)=>({tr:e,dispatch:n,state:r})=>{const{doc:o}=r,i=[];return o.descendants((s,a)=>{s.type.name===t&&i.push(a)}),i.length===0?!1:(i.sort((s,a)=>a-s),i.forEach(s=>{const a=o.nodeAt(s);a&&e.delete(s,s+a.nodeSize)}),n&&n(e),!0)}}},addPmPlugins(){const t=this.editor;return[new He({key:pa,state:{init(){return{decorations:De.empty,highlightColor:"#6366f1",customClass:null}},apply(e,n,r,o){const i=e.getMeta(pa);let s=n.customClass;if(i&&i.type==="updateStyle"&&(s=i.className),e.docChanged&&s==="sd-ai-highlight-pulse"){let c=!1;e.steps.forEach(u=>{u.slice&&u.slice.content.size>0&&(c=!0)}),c&&(s=null)}if(!e.docChanged&&!i)return n;const{decorations:a}=O_(t,o.doc,n.highlightColor,s)||{},l=De.create(o.doc,a);return{...n,decorations:l,customClass:s}}},props:{decorations(e){return this.getState(e).decorations}}})]}}),O_=(t,e,n,r=null)=>{const o=[];return e.descendants((i,s)=>{const{marks:a=[]}=i;if(a.find(l=>l.type.name===Qo)){const l={style:`background-color: ${n}33; border-radius: 4px; transition: background-color 250ms ease;`,class:"sd-ai-highlight-element"};r&&(l.class+=` ${r}`);const c=Le.inline(s,s+i.nodeSize,l);o.push(c)}}),{decorations:o}},yx=Ue.create({name:"doc",topNode:!0,content:"block+",parseDOM(){return[{tag:"doc"}]},renderDOM(){return["doc",0]},addAttributes(){return{attributes:{rendered:!1}}}}),wx=Ue.create({name:"text",group:"inline",inline:!0}),M_=Ue.create({name:"run",group:"inline",content:"text*",inline:!0,parseDOM(){return[{tag:"run"}]},renderDOM(){return["run",0]},addAttributes(){return{attributes:{rendered:!1}}}});function Al(t){return new SD({match:t.match,handler:({state:e,range:n,match:r,chain:o})=>{const i=Ke(t.getAttributes,null,r)||{},s=e.tr.delete(n.from,n.to),a=s.doc.resolve(n.from).blockRange(),l=a&&pv(a,t.type,i);if(!l)return null;if(s.wrap(a,l),t.keepMarks&&t.editor){const{selection:u,storedMarks:d}=e,{splittableMarks:p}=t.editor.extensionService,f=d||u.$to.parentOffset&&u.$from.marks();if(f){const h=f.filter(m=>p.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&&Pr(s.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(r,c))&&s.join(n.from-1)}})}const jy=/^\s*([-+*])\s$/,bx=Ue.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",Ce.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=Al({match:jy,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=Al({match:jy,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes("textStyle"),editor:this.editor})),[t]}});function D_(t={}){return new He({key:new Ge("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[p]=c;i.setNodeMarkup(p.pos,void 0,{...p.node.attrs,syncId:null}),a=!0;return}let[u]=c,d=u.node.attrs.order;c.forEach((p,f)=>{if(f===0)return;let{node:h,pos:m}=p,y=c[f-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 __(){return Math.floor(Math.random()*4294967295).toString()}function N_(t){return new He({key:new Ge("orderedListMarker"),appendTransaction:(e,n,r)=>{if(!(e.some(l=>l.docChanged)&&!n.doc.eq(r.doc)))return;let{doc:o,tr:i}=r,s=I_(r);if(!s.size)return;let a=!1;return Array.from(s).forEach(([l,c])=>{const u=c[0];let d=c,p=u.node.type.name==="bulletList";u.node.attrs.syncId;let f=u.node.childCount!==d.length;if(p){d.forEach(x=>R_(i,x)),a=!0;return}if(f){let x=F_({state:r,list:u});x.length&&(d=x)}let h=d[0],m=B_({state:r,listItems:d}),y=vx(),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&&qy(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 C=[...g.listLevel.slice(0,-1),g.listLevel.at(-1)+1];if(!(D===g.lvlText&&I===g.listNumberingType&&qy(M,C))){let{selection:V,storedMarks:oe}=r,N=oe||V.$to.parentOffset&&V.$from.marks();i.setNodeMarkup(T,void 0,{...b.attrs,listLevel:C,lvlText:g.lvlText,listNumberingType:g.listNumberingType}),N&&i.ensureMarks(N),a=!0}g={...g,listLevel:C}})}),i.setMeta("orderedListMarker",!0),a?i:null}})}function I_(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 F_({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 vx({lvlText:t="",listLevel:e=[],listNumberingType:n="decimal"}={}){return{lvlText:t,listLevel:e,listNumberingType:n}}function R_(t,e){let{pos:n,node:r}=e;t.setNodeMarkup(n,void 0,{...r.attrs,lvlText:null,listLevel:null,listNumberingType:null})}function qy(t,e){return t.length===e.length&&t.every((n,r)=>n===e[r])}function B_({state:t,listItems:e}){let{doc:n}=t,r=e[0],{lvlText:o,listLevel:i,listNumberingType:s}=r.node.attrs,a=vx({lvlText:"%1.",listLevel:[1],listNumberingType:"decimal"}),l=(n.resolve(r.pos).depth-1)/2;if(!(o&&i?.length&&s))({lvlText:o,listLevel:i,listNumberingType:s}=a);else{let c=l>0;c&&l>=3?{lvlText:o,listLevel:i,listNumberingType:s}=a:c&&l<3&&(i=[...i.slice(0,-1),1])}return{lvlText:o,listLevel:i,listNumberingType:s}}const Vy=/^(\d+)\.\s$/,xx=Ue.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: ${fA(e)};`}):{}}},attributes:{rendered:!1,keepOnSplit:!0}}},parseDOM(){return[{tag:"ol"}]},renderDOM({htmlAttributes:t}){const{start:e,...n}=t;return e===1?["ol",Ce.mergeAttributes(this.options.htmlAttributes,n),0]:["ol",Ce.mergeAttributes(this.options.htmlAttributes,t),0]},addCommands(){return{toggleOrderedList:()=>({commands:t})=>t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks),getCurrentList:()=>({state:t})=>Kt(e=>e.type.name===this.name)(t.selection),restartListNodes:(t,e)=>({tr:n,state:r})=>{let o=e;return t.map(i=>{const s={node:i,pos:o};return o+=i.nodeSize,s}).forEach(i=>{const{pos:s}=i,a=n.mapping.map(s);n.setNodeMarkup(a,void 0,{})}),!0},updateOrderedListStyleType:()=>({dispatch:t,state:e,tr:n})=>{let r=Kt(o=>o.type.name===this.name)(n.selection);if(!r)return!0;if(t){let o=(r.depth-1)/2,i=this.options.listStyleTypes,s=i[o%i.length],a=r.node.attrs["list-style-type"],l=n.doc.nodeAt(r.pos);a!==s&&l.eq(r.node)&&n.setNodeMarkup(r.pos,void 0,{...r.node.attrs,"list-style-type":s})}return!0},liftEmptyBlockAndContinueListOrder:()=>({editor:t,dispatch:e,state:n,tr:r,commands:o})=>{let i=Kt(d=>d.type.name===this.name)(n.selection);if(!i)return!1;let s=t.can().liftEmptyBlock(),a=i.depth===1,l=i.node.childCount===1,c=n.selection.$from.node(-1),u=i.node.lastChild.eq(c);if(!(s&&a&&!l&&!u))return!1;if(e){let d=i.pos;if(!o.liftEmptyBlock(n,e))return!1;let{$from:p}=r.selection,f=r.doc.nodeAt(d),h=p.after(),m=r.doc.nodeAt(h),y=f?.type.name===this.name,g=m?.type.name===this.name;if(y&&g){let x=f.attrs.order||1,k=f.childCount,b=f.attrs.syncId,T=k+x,D=b||__();r.setNodeMarkup(h,void 0,{...m.attrs,order:T,syncId:D}),b||r.setNodeMarkup(d,void 0,{...f.attrs,syncId:D})}}return!0}}},addShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList(),Enter:()=>this.editor.commands.liftEmptyBlockAndContinueListOrder()}},addPmPlugins(){return[N_(this.editor),D_()]},addInputRules(){let t=Al({match:Vy,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(t=Al({match:Vy,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes("textStyle")}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),L_=({listLevel:t,lvlText:e,listNumberingType:n})=>{const r=q_[n];return r?r(t,e):null},P_=(t,e)=>_f(t,e,String),kx=(t,e)=>_f(t,e,U_),z_=(t,e)=>kx(t,e).toLowerCase(),j_=(t,e)=>Sx(t,e).toLowerCase(),Sx=(t,e)=>_f(t,e,n=>H_(n)),q_={decimal:P_,lowerRoman:z_,upperRoman:kx,lowerLetter:j_,upperLetter:Sx},V_=(t,e)=>t.reduce((n,r,o)=>n.replace(`%${o+1}`,r),e),_f=(t,e,n)=>{const r=t.map(n);return V_(r,e)},U_=t=>{const e=[{value:1e3,numeral:"M"},{value:900,numeral:"CM"},{value:500,numeral:"D"},{value:400,numeral:"CD"},{value:100,numeral:"C"},{value:90,numeral:"XC"},{value:50,numeral:"L"},{value:40,numeral:"XL"},{value:10,numeral:"X"},{value:9,numeral:"IX"},{value:5,numeral:"V"},{value:4,numeral:"IV"},{value:1,numeral:"I"}];let n="";for(const{value:r,numeral:o}of e)for(;t>=r;)n+=o,t-=r;return n},H_=t=>{let e="";const n="ABCDEFGHIJKLMNOPQRSTUVWXYZ";for(;t>0;){let r=(t-1)%26;e=n[r]+e,t=Math.floor((t-1)/26)}return e};function W_(t={}){return new He({key:new Ge("styledListMarker"),state:{init(e,n){const r=[...Uy(n),...Hy(n)];return De.create(n.doc,r)},apply(e,n,r,o){if(!e.docChanged||e.getMeta("orderedListMarker"))return n;const i=e.getMeta("splitListItem"),s=[...Uy(o,i),...Hy(o)];return De.create(o.doc,s)}},props:{decorations(e){return this.getState(e)}}})}function Uy(t,e=[]){let{doc:n,storedMarks:r}=t,o=[];Array.isArray(r)&&e.push(...r);let i=pf(n,s=>s.type.name==="listItem");return i.length&&i.forEach(({node:s,pos:a})=>{let l=lr("textStyle",n.type.schema),c=[...e.filter(y=>y.type===l)];if(K_(s)&&e.length){const y=e.filter(g=>g.type===l);c.push(...y)}else{const y=G_(s,n,l);c.push(...y)}let u=null,d=null;c.forEach(y=>{let{attrs:g}=y;if(g.fontSize&&!u){let[x,k]=tr(g.fontSize);Number.isNaN(x)||(k=k??"pt",u=`${x}${k}`)}g.fontFamily&&!d&&(d=g.fontFamily)});let p={style:`--marker-font-size: ${u??"initial"}`},f={style:`--marker-font-family: ${d??"initial"}`},h=Ce.mergeAttributes(p,f),m=Le.node(a,a+s.nodeSize,h);o.push(m)}),o}function Hy(t){let{doc:e}=t,n=[],r=pf(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
|
+
`,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 AD(a,t)}return!1}},isInputRules:!0});return n},AD=(t,e,n)=>{const r=$D(t),o=document.createElement("div");o.innerHTML=r;const i=$r.fromSchema(e.schema).parse(o);o.remove();const{dispatch:s}=e.view;return s?(s(e.view.state.tr.replaceSelectionWith(i,!0)),!0):!1},$D=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 Cl,V2,Dy;const TD=class Hi{constructor(e,n,r){Tr(this,Cl),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=Hi.getResolvedExtensions([...e,...this.externalExtensions]),this.schema=T$.createSchemaByExtensions(this.extensions,r),Oe(this,Cl,V2).call(this)}static create(...e){return new Hi(...e)}static getResolvedExtensions(e){return Hi.sortByPriority(e)}static sortByPriority(e){return e.sort((n,r)=>{const o=Ie(n,"priority")||100,i=Ie(r,"priority")||100;return o>i?-1:o<i?1:0})}get attributes(){return Ce.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:ws(n.name,this.schema)},o=Ie(n,"addCommands",r);o&&(e={...e,...o()})}return e}get plugins(){const e=this.editor,n=Hi.sortByPriority([...this.extensions].reverse()),r=[],o=n.map(i=>{const s={name:i.name,options:i.options,storage:i.storage,editor:e,type:ws(i.name,this.schema)},a=[],l=Ie(i,"addShortcuts",s);let c={};if(l){const p=Object.entries(l()).map(([f,h])=>[f,(...m)=>h({editor:e,keymapArgs:m})]);c={...Object.fromEntries(p)}}a.push(bD(c));const u=Ie(i,"addInputRules",s);vD(i,e.options.enableInputRules)&&u&&r.push(...u());const d=Ie(i,"addPmPlugins",s);if(d){const p=d();a.push(...p)}return a}).flat();return[CD({editor:e,rules:r}),...o]}get nodeViews(){const{editor:e}=this,n=this.extensions.filter(r=>r.type==="node").filter(r=>!!Ie(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:pt(r.name,this.schema)},s=Ie(r,"addNodeView",i);if(!s)return[];const a=(l,c,u,d)=>{const p=Ce.getAttributesToRender(l,o);return s()({editor:e,node:l,getPos:u,decorations:d,htmlAttributes:p,extension:r})};return[r.name,a]});return Object.fromEntries(n)}};Cl=new WeakSet,V2=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:ws(t.name,this.schema)};t.type==="mark"&&(Ke(Ie(t,"keepOnSplit",e))??!0)&&this.splittableMarks.push(t.name),Oe(this,Cl,Dy).call(this,t)}},Dy=function(t){const e={name:t.name,options:t.options,storage:t.storage,editor:this.editor,type:ws(t.name,this.schema)},n=Ie(t,"onBeforeCreate",e),r=Ie(t,"onCreate",e),o=Ie(t,"onUpdate",e),i=Ie(t,"onSelectionUpdate",e),s=Ie(t,"onTransaction",e),a=Ie(t,"onFocus",e),l=Ie(t,"onBlur",e),c=Ie(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 OD=TD;const $f=({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 p=u.marks.find(f=>f.type.name===r&&Object.keys(o).every(h=>f.attrs[h]===o[h]));p&&!c&&(c={from:d,to:d+u.nodeSize,mark:p})}),c},U2=({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=$f({tr:t,from:e,to:n,markName:It,attrs:{authorEmail:r.email}}),s;i?s=i.mark.attrs.id:s=Lr();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},H2=({tr:t,from:e,to:n,user:r,date:o})=>{let i=$f({tr:t,from:e,to:n,markName:ut,attrs:{authorEmail:r.email}}),s;i?s=i.mark.attrs.id:s=Lr();const a=t.doc.type.schema.marks[ut].create({id:s,author:r.name,authorEmail:r.email,date:o}),l=new ni;let c=[];return t.doc.nodesBetween(e,n,(u,d)=>{if(!u.type.name.includes("table"))if(u.isInline&&u.marks.find(p=>p.type.name===It&&p.attrs.authorEmail===r.email)){const p=new $t(l.map(Math.max(e,d)),l.map(Math.min(n,d+u.nodeSize)),be.empty);t.maybeStep(p).failed||l.appendMap(p.getMap())}else u.isInline&&!u.marks.find(p=>p.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(p=>p.type===ut)&&["bulletList","orderedList"].includes(u.type.name)}),{deletionMark:a,deletionMap:l,nodes:c}},MD=(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}},W2=(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},G2=(t,e,n)=>{if(t){if(!e)throw new Error('Invalid "predicate" parameter')}else throw new Error('Invalid "node" parameter');return W2(t,n).filter(r=>e(r.node))},K2=(t,e)=>G2(t,n=>n.isInline,e),DD=Object.freeze(Object.defineProperty({__proto__:null,findChildren:G2,findInlineNodes:K2,findMarkPosition:MD,flatten:W2},Symbol.toStringTag,{value:"Module"})),Tf=(t,e=null)=>{const n=[],r=K2(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},gt=new Ge("TrackChangesBase"),_D=(t={})=>new He({key:gt,state:{init(e,n){return{isTrackChangesActive:!1,onlyOriginalShown:!1,onlyModifiedShown:!1,decorations:Oo(n,!1,!1)}},apply(e,n,r,o){const i=e.getMeta(gt);return i?i.type==="TRACK_CHANGES_ENABLE"?{...n,isTrackChangesActive:i.value===!0,decorations:Oo(o,n.onlyOriginalShown,n.onlyModifiedShown)}:i.type==="SHOW_ONLY_ORIGINAL"?{...n,onlyOriginalShown:i.value===!0,onlyModifiedShown:!1,decorations:Oo(o,i.value===!0,!1)}:i.type==="SHOW_ONLY_MODIFIED"?{...n,onlyOriginalShown:!1,onlyModifiedShown:i.value===!0,decorations:Oo(o,!1,i.value===!0)}:{...n,decorations:Oo(o,n.onlyOriginalShown,n.onlyModifiedShown)}:{...n,decorations:Oo(o,n.onlyOriginalShown,n.onlyModifiedShown)}}},props:{decorations(e){return this.getState(e)?.decorations}}}),Oo=(t,e,n)=>{if(!t.doc||!t.doc.nodeSize||n&&e)return De.empty;const r=[],o=Tf(t);return o.length?(o.forEach(({mark:i,from:s,to:a})=>{if(i.type.name===It)if(e){const l=Le.inline(s,a,{class:"track-insert-dec hidden"});r.push(l)}else if(n){const l=Le.inline(s,a,{class:"track-insert-dec normal"});r.push(l)}else{const l=Le.inline(s,a,{class:"track-insert-dec highlighted"});r.push(l)}if(i.type.name===ut)if(e){const l=Le.inline(s,a,{class:"track-delete-dec normal"});r.push(l)}else if(n){const l=Le.inline(s,a,{class:"track-delete-dec hidden"});r.push(l)}else{const l=Le.inline(s,a,{class:"track-delete-dec highlighted"});r.push(l);const c=Le.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=Le.inline(s,a,{class:"track-format-dec before"});r.push(l)}else if(n){const l=Le.inline(s,a,{class:"track-format-dec normal"});r.push(l)}else{const l=Le.inline(s,a,{class:"track-format-dec highlighted"});r.push(l)}}),De.create(t.doc,r)):De.empty},an="commentMark",_y=({commentId:t,state:e,tr:n,dispatch:r})=>{ND(t,e.doc).forEach(({from:o,to:i})=>{n.removeMark(o,i,e.schema.marks[an])}),r(n)},ND=(t,e)=>{const n=[];return e.descendants((r,o)=>{const{marks:i}=r,s=i.find(a=>a.type.name===an);if(s){const{attrs:a}=s,{commentId:l}=a;t===l&&n.push({from:o,to:o+r.nodeSize})}}),n},ID=(t,e,n,r=[])=>{const o=[],i=[],s=new Set;return t.descendants((a,l)=>{(a.marks?.filter(c=>c.type.name===an)).forEach(c=>{if(c){const{attrs:u={}}=c,{commentId:d}=u;if(d==="pending"||s.has(d))return;s.add(d);const p=Ny(c.attrs),f=n.nodes.commentRangeStart.create(p);o.push({pos:l,node:f});const h=n.nodes.commentRangeEnd.create(p);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=Ny(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},Ny=t=>{const{commentId:e,internal:n}=t;return{"w:id":e,internal:n}},FD=(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:p}=d,f={commentId:u,importedId:s.attrs["w:id"],internal:d.internal};e.addMark(p,a+1,n.marks[an].create(f)),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)})},RD=(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||{},p=[],f=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")p.push("Changed color");else{const g=f(h);m==null?p.push(`Set ${g} to ${y}`):p.push(`Changed ${g} from ${m} to ${y}`)}}}),p.length&&a.push(`Modified text style: ${p.join(", ")}`),a.length?a.join(". "):"No formatting changes."},BD=({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}`},_r=new Ge("paginationPlugin"),LD=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 Iy(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 Iy(t,s);e.footers[i].height=a,e.footers[i].sectionEditor=l,e.footers[i].sectionContainer=c}return e},Iy=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 $s({loadFromSchema:!0,mode:"text",editable:!1,element:r,content:e,extensions:Vf(),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})})})}):{},Of=[It,ut,vt],bt=new Ge("comments"),PD=Ye.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[an].create({commentId:a,internal:l})),n(e),!0},removeComment:({commentId:t,importedId:e})=>({tr:n,dispatch:r,state:o})=>{n.setMeta(bt,{event:"deleted"}),_y({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(p=>p.type.name===an);if(d){const{attrs:p}=d;p.commentId===t&&(s=l,a=c)}}),s?(n.addMark(a,a+s.nodeSize,this.editor.schema.marks[an].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"}),_y({commentId:t,state:r,tr:e,dispatch:n})}}},addPmPlugins(){const t=this.editor;let e,n;return t.options.isHeadless?[]:[new He({key:bt,state:{init(){return{activeThreadId:null,externalColor:"#B1124B",internalColor:"#078383",decorations:De.empty,allCommentPositions:{},allCommentIds:[],changedActiveThread:!1,trackedChanges:{}}},apply(r,o,i,s){const a=r.getMeta(_r)?.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(gt),d=o.trackedChanges;u&&(o.trackedChanges=jD(u,d,s,t));const p=l?.type==="setActiveComment";if(!r.docChanged&&r.selectionSet||p){const{selection:f}=r;let h=zD(s.doc,f);if(p&&(h=l.activeThreadId),n!==h){n=h;const m={type:za.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((f,h)=>{const{marks:m=[]}=f,y=m.filter(k=>k.type.name===an);let g=!1;y.forEach(k=>{const{attrs:b}=k,T=b.commentId||b.importedId,D=i.coordsAtPos(h);Fy({allCommentPositions:d,threadId:T,pos:h,currentBounds:D,node:f});const M=b.internal;g||(g=n===T);let I=BD({activeThreadId:n,threadId:T,isInternal:M,editor:t});const C=Le.inline(h,h+f.nodeSize,{style:`background-color: ${I};`,"data-thread-id":T,class:"sd-editor-comment-highlight"});g&&n!==T||u.push(C)});const x=J2({doc:l,from:h,to:h+f.nodeSize});if(x){const k=i.coordsAtPos(h),{id:b}=x.mark.attrs;Fy({allCommentPositions:d,threadId:b,pos:h,currentBounds:k,node:f})}});const p=De.create(l,u);if(!bt.getState(a).decorations.eq(p)){const f=a.tr.setMeta(bt,{decorations:p,allCommentPositions:d});i.dispatch(f)}t.emit("comment-positions",{allCommentPositions:d})}}}})]}}),Fy=({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)}},zD=(t,e)=>{if(!e)return;const{$from:n,$to:r}=e;if(n.pos!==r.pos||!t.nodeAt(n.pos))return;const o=J2({doc:t,from:n.pos,to:r.pos});if(o)return o.mark.attrs.id;const i=[];let s=!1;t.descendants((d,p)=>{if(s)return;const f=p+d.nodeSize;if(n.pos<p||n.pos>=f)return;const{marks:h=[]}=d;h.find(m=>m.type.name===an)&&i.push({node:d,pos:p,size:d.nodeSize}),p>n.pos&&(s=!0)});let a=null,l=null;i.forEach(({pos:d,node:p})=>{a||(a=n.pos-d);const f=n.pos-d;f>=0&&f<=a&&(l=p,a=f)});const{marks:c=[]}=l||{},u=c.find(d=>d.type.name===an);return u?.attrs?.commentId||u?.attrs?.importedId},J2=({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=>Of.includes(u.type.name));c&&!s&&(s={from:l,to:l+a.nodeSize,mark:c})}),s},jD=(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 p=d?.slice?.content?.content||[];p.length||n.doc.descendants((h,m)=>{if(h.marks.find(y=>y.type.name===vt))return p=[h],!1});const f=VD({documentId:r.options.documentId,event:u?"add":"update",marks:{insertedMark:o,deletionMark:i,formatMark:s},deletionNodes:a,nodes:p,newEditorState:n});return f&&r.emit("commentsUpdate",f),l},qD=({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=RD(n.attrs)),(o===ut||i)&&(l=e?.text??"",i)){let{id:c}=r.deletionMark.attrs;l=UD(t.doc,u=>{const{marks:d=[]}=u,p=d.filter(f=>Of.includes(f.type.name));if(!p.length)return!1;if(p.find(f=>f.attrs.id===c))return!0})?.node.text??""}return{deletionText:l,trackedChangeText:a}},VD=({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:p}=l,f=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=>Of.includes(I.type.name));if(M.length&&(M.find(I=>I.attrs.id===f)&&(y=b),y))return!1});const{deletionText:g,trackedChangeText:x}=qD({state:o,node:y||h,mark:s,marks:e,trackedChangeType:c,isDeletionInsertion:m,deletionNodes:n});if(!g&&!x)return;const k={event:za.ADD,type:"trackedChange",documentId:i,changeId:f,trackedChangeType:m?"both":c,trackedChangeText:x,deletedText:e.deletionMark?g:null,author:u,authorEmail:d,date:p};return t==="add"?k.event=za.ADD:t==="update"&&(k.event=za.UPDATE),k};function UD(t,e){let n=null;return t.descendants((r,o)=>{if(e(r)&&(n={node:r,pos:o}),n)return!1}),n}const X2=({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=Xl(t,u,!1),p=d?d.to:n.to,f=new $t(p,p,n.slice,n.structure),h=l.invert(e.docs[c]).map(o);o.appendMap(h.getMap());const m={};if(f){const y=t.apply(r).tr;if(y.maybeStep(f).failed)return;const g=f.getMap().map(f.to),x=U2({tr:y,from:f.from,to:g,user:s,date:a}),k=new $t(f.from,f.to,y.doc.slice(f.from,g));r.step(k);const b=o.maps.length-1;o.appendMap(k.getMap(),b),f.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}=H2({tr:r,from:n.from,to:n.to,user:s,date:a});m.deletionNodes=x,m.deletionMark=y,o.appendMapping(g)}r.setMeta(gt,m),r.setMeta(bt,{type:"force"})},HD=()=>{},WD=()=>{},Y2=({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(f=>f.type.name===ut))return!1;const d=c.marks.find(f=>[ut,vt].includes(f.type.name)),p=d?d.attrs.id:Lr();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(f=>f.type===n.mark.type)){const f=c.marks.find(y=>y.type.name===vt);let h=[],m=[];if(f?f.attrs.before.find(y=>y.type==="textStyle"?y.type===n.mark.type.name&&oi(y.attrs,n.mark.attrs):y.type===n.mark.type.name)?(m=[...f.attrs.before.filter(y=>y.type!==n.mark.type.name)],h=[...f.attrs.after]):(m=[...f.attrs.before],h=[...f.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:p,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(gt,l),r.setMeta(bt,{type:"force"})}else f&&r.removeMark(Math.max(n.from,u),Math.min(n.to,u+c.nodeSize),f)}})},Z2=({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 p=[],f=[];if(d?d.attrs.after.find(h=>h.type===n.mark.type.name)?(p=[...d.attrs.after.filter(h=>h.type!==n.mark.type.name)],f=[...d.attrs.before]):(p=[...d.attrs.after],f=[...d.attrs.before,{type:n.mark.type.name,attrs:{...n.mark.attrs}}]):(p=[],f=[{type:n.mark.type.name,attrs:{...n.mark.attrs}}]),p.length||f.length){const h=t.schema.marks[vt].create({id:Lr(),author:s.name,authorEmail:s.email,date:a,before:f,after:p});r.addMark(Math.max(n.from,u),Math.min(n.to,u+c.nodeSize),h),l.formatMark=h,l.step=n,r.setMeta(gt,l),r.setMeta(bt,{type:"force"})}else d&&r.removeMark(Math.max(n.from,u),Math.min(n.to,u+c.nodeSize),d)}})},Q2=({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 ni,a=Math.floor(Date.now()/6e5)*6e5,l=new Date(a).toISOString();if(t.steps.forEach((c,u)=>{const d=c.map(s),{doc:p}=i;d&&(d instanceof $t?(X2({state:e,tr:t,step:d,newTr:i,map:s,doc:p,user:n,date:l,originalStep:c,originalStepIndex:u}),console.debug("[track-changes]: replaceStep")):d instanceof qs?(Y2({state:e,tr:t,step:d,newTr:i,map:s,doc:p,user:n,date:l}),console.debug("[track-changes]: addMarkStep")):d instanceof vn?(Z2({state:e,tr:t,step:d,newTr:i,map:s,doc:p,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=Xl(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},GD=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:Jo(lt(a.line)),lineSpaceBefore:Jo(lt(a.lineSpaceBefore)),lineSpaceAfter:Jo(lt(a.lineSpaceAfter))};r.setNodeMarkup(i,void 0,{...s,spacing:{...a,...l}})}}),n(r),!0},KD={initial:GD},Ry=t=>{if(t==="initial"||t==="0.4.14")return Object.values(KD)},Mf=(t,e,n)=>{const{type:r}=t.attrs,o={html:JD,text:XD,checkbox:ZD,image:YD,link:e_,yesno:t_,date:QD}[r];return o?o(e,n):{}},JD=t=>({rawHtml:t}),XD=t=>({displayLabel:t}),YD=t=>({imageSrc:t}),ZD=t=>({displayLabel:t}),QD=(t,e)=>({displayLabel:i_(t,e.input_format)}),e_=t=>(t.startsWith("http")||(t=`http://${t}`),{linkUrl:t}),t_=t=>({displayLabel:{YES:"Yes",NO:"No"}[t[0].toUpperCase()]}),n_=({editor:t,tr:e,annotationValues:n})=>{const{state:r}=t,{doc:o}=r,i=[];return o.descendants((s,a)=>{s.type.name==="table"&&i.push({node:s,pos:a})}),i.reverse().forEach(s=>{r_({tableNode:s,annotationValues:n,tr:e,editor:t})}),e},r_=({tableNode:t,annotationValues:e,tr:n,editor:r})=>{let o=null,i=null;const{tableRow:s,tableCell:a,fieldAnnotation:l,paragraph:c}=r.schema.nodes;if(t.node.descendants((x,k)=>{if(o)return!0;if(x.type===s&&(i={node:x,pos:k}),x.type===l){const b=_u(x.attrs.fieldId,e);Array.isArray(b)&&(o=i)}}),!o)return;const{node:u,pos:d}=o,p=n.mapping.map(t.pos+d),f=p+u.nodeSize;let h=0;if(u.descendants((x,k)=>{if(x.type===l){const b=_u(x.attrs.fieldId,e);Array.isArray(b)&&(h=Math.max(h,b.length))}}),h<=1)return;const m=(x,k)=>{const b=x.content.content.map(T=>{if(T.type!==c)return T;const D=T.content.content.map(M=>{if(M.type!==l)return M;let I=_u(M.attrs.fieldId,e);Array.isArray(I)||(I=[I]);const C=I?.[k],V=Mf(M,C);return l.create({...M.attrs,...V,generatorIndex:k},M.content,M.marks)});return c.create(T.attrs,ge.from(D),T.marks)});return a.create(x.attrs,ge.from(b),x.marks)};for(let x=h-1;x>=0;x--){const k=n.mapping.map(f)+1,b=u.content.content.map(D=>m(D,x)),T=s.create(u.attrs,ge.from(b),u.marks);n.insert(k,ge.from(T))}const y=n.mapping.map(p),g=y+u.nodeSize;n.delete(y-1,g+1)},_u=(t,e)=>e.find(n=>n.input_id===t)?.input_value||null,o_=({annotationValues:t=[],hiddenFieldIds:e=[],schema:n,tr:r})=>{const o=[],i=n.nodes.fieldAnnotation;r.doc.descendants((a,l)=>{a.type===i&&o.push({node:a,pos:l,size:a.nodeSize})});const s=new Set;if(e.length)for(const{node:a,pos:l}of o)e.includes(a.attrs.fieldId)&&s.add(l);for(const{node:a,pos:l}of o){const{type:c,fieldType:u,fieldId:d}=a.attrs;if(s.has(l))continue;let p=null;const f=t.find(h=>h.input_id===d);if(!f){const h=t.filter(m=>m.input_field_type==="CHECKBOXINPUT");e:for(const m of h)for(const y of m.input_options)if(y.itemid===d){p=m.input_link_value[y.itemid]||" ";break e}}if(p=p||f?.input_value||null,!(Array.isArray(p)&&a.attrs.generatorIndex!=null))if((c==="checkbox"||u==="CHECKBOXINPUT")&&(!p||typeof p=="string"&&p.codePointAt(0)===9744)&&(p=" "),!p)s.add(l);else{const h=Mf(a,p,f);r=r.setNodeMarkup(l,void 0,{...a.attrs,...h})}}return Array.from(s).sort((a,l)=>l-a).forEach(a=>{const l=o.find(c=>c.pos===a);l&&(r=r.delete(a,a+l.node.nodeSize))}),r},i_=(t=null,e="")=>{const n=t?new Date(t):new Date;return isNaN(n.getTime())?t:e?dateFormat(n,e):n.toLocaleDateString("en-US",{month:"short",day:"2-digit",year:"numeric"})},Nu={getFieldAttrs:Mf,processTables:n_,annotateDocument:o_};var Wo,ex,Pe,tx,nx,op,Iu,rx,Ua,ip,Fu,Ru,sp,ap,By,Bu,Lu,Ha,Pu,Ly,Wi,Gi,Py,zy,ox,ix;const s_=class sx extends dD{constructor(e){super(),Tr(this,Pe),Tr(this,Wo),Fe(this,"extensionService"),Fe(this,"extensionStorage",{}),Fe(this,"schema"),Fe(this,"view"),Fe(this,"isFocused",!1),Tr(this,ex),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}),Oe(this,Pe,tx).call(this,e),Oe(this,Pe,rx).call(this,e),this.setOptions(e);let n={docx:()=>Oe(this,Pe,nx).call(this,this.options),text:()=>Oe(this,Pe,op).call(this,this.options),html:()=>Oe(this,Pe,op).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,Wo)?.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,Wo).chain()}can(){return Jn(this,Wo).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"?(Oe(this,Pe,ip).call(this,"TrackChangesBase"),this.commands.disableTrackChangesShowOriginal(),this.commands.enableTrackChanges(),this.setEditable(!0,!1)):n==="editing"&&(Oe(this,Pe,ip).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),Oe(this,Pe,Ua).call(this)};e.synced?Oe(this,Pe,Ua).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.ydoc)&&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=!0,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 nameOrPluginKey=="string"?`${nameOrPluginKey}$`:nameOrPluginKey.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 _d,o=await r.getDocxData(e,n),i=r.media;return[o,i,r.mediaFiles,r.fonts]}static getDocumentVersion(e){return Nr.getStoredSuperdocVersion(e)}static updateDocumentVersion(e,n){return Nr.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 Ce.getAttributes(this.state,e)}isActive(e,n){const r=typeof e=="string"?e:null,o=typeof e=="string"?n:e;return H1(this.state,r,o)}getJSON(){return this.state.doc.toJSON()}getHTML(){const e=document.createElement("div"),n=xi.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="external",comments:r=[]}={}){const o=Oe(this,Pe,ox).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"],p=this.converter.schemaToXml(d.elements[0]),f={"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(p),"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]);f["word/comments.xml"]=String(m),f["word/commentsExtended.xml"]=String(y),f["word/commentsExtensible.xml"]=String(g),f["word/commentsIds.xml"]=String(x)}const h=await new _d().updateZip({docx:this.options.content,updatedDocs:f,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(),Oe(this,Pe,ix).call(this),this.removeAllListeners()}static checkIfMigrationsNeeded(e){version||(version="initial");const n=Ry(version)||[];return console.debug("[checkVersionMigrations] Migrations needed:",version,n.length),n.length>0}processCollaborationMigrations(){if(console.debug("[checkVersionMigrations] Current editor version","0.11.52"),!this.options.ydoc)return;let e=this.options.ydoc.getMap("meta").get("version");e||(e="initial"),console.debug("[checkVersionMigrations] Document version",e);const n=Ry(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 sx.loadXmlData(newFile);this.setOptions({fileSource:newFile,content:n,media:r,mediaFiles:o,fonts:i,isNewFile:!0,shouldLoadComments:!0,replacedFile:!0}),Oe(this,Pe,sp).call(this),Oe(this,Pe,ap).call(this),this.initDefaultStyles(),this.options.ydoc&&this.options.collaborationProvider?this.initializeCollaborationData(!0):Oe(this,Pe,Ua).call(this),this.options.ydoc||(Oe(this,Pe,Gi).call(this),Oe(this,Pe,Wi).call(this))}getNodesOfType(e){const{findChildren:n}=Zl;return n(this.state.doc,r=>r.type.name===e)}replaceNodeWithHTML(e,n){const{tr:r}=this.state,{dispatch:o}=this.view;if(!e||!n)return;const i=e.pos,s=i+e.node.nodeSize,a=Oe(this,Pe,Ha).call(this,n);r.replaceWith(i,s,a),o(r)}prepareForAnnotations(e=[]){const{tr:n}=this.state,{dispatch:r}=this.view,o=Nu.processTables({editor:this,tr:n,annotationValues:e});this.view.dispatch(o)}annotate(e=[],n=[]){const{state:r,view:o,schema:i}=this;let s=r.tr;s=Nu.processTables({editor:this,tr:s,annotationValues:e}),s=Nu.annotateDocument({tr:s,schema:i,annotationValues:e,hiddenFieldIds:n}),s.docChanged&&o.dispatch(s.scrollIntoView())}};Wo=new WeakMap,ex=new WeakMap,Pe=new WeakSet,tx=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")},nx=function(t){Oe(this,Pe,Fu).call(this),Oe(this,Pe,Ru).call(this),Oe(this,Pe,Bu).call(this),Oe(this,Pe,sp).call(this),Oe(this,Pe,ap).call(this),this.options.isHeadless||Oe(this,Pe,By).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),Oe(this,Pe,Pu).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",Oe(this,Pe,Iu)),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",Oe(this,Pe,Ly)),this.on("paginationUpdate",this.options.onPaginationUpdate),this.on("comment-positions",this.options.onCommentLocationsUpdate),this.initializeCollaborationData(),this.options.ydoc||(Oe(this,Pe,Gi).call(this),Oe(this,Pe,Wi).call(this)),window.setTimeout(()=>{this.isDestroyed||this.emit("create",{editor:this})},0))},op=function(t){(!t.extensions||!t.extensions.length)&&(this.options.extensions=qf()),Oe(this,Pe,Fu).call(this),Oe(this,Pe,Ru).call(this),Oe(this,Pe,Bu).call(this),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("contentError",this.options.onContentError),Oe(this,Pe,Pu).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",Oe(this,Pe,Iu)),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)},Iu=function({editor:t,event:e}){this.toolbar?.setActiveEditor(t),this.options.onFocus({editor:t,event:e})},rx=function(t){t.isHeadless&&(typeof navigator>"u"&&(Yr.navigator={isHeadless:!0}),t.mockDocument&&(Yr.document=t.mockDocument,Yr.window=t.mockWindow))},Ua=function(){if(!this.options.isNewFile)return;this.options.isNewFile=!1;const t=Oe(this,Pe,Lu).call(this),e=this.state.tr.replaceWith(0,this.state.doc.content.size,t);this.view.dispatch(e),setTimeout(()=>{Oe(this,Pe,Gi).call(this),Oe(this,Pe,Wi).call(this)},50)},ip=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},Fu=function(){const t=["extension","node","mark"],e=[qT,PT,VT,jT],n=this.options.externalExtensions||[],r=[...e,...this.options.extensions].filter(o=>t.includes(o?.type));this.extensionService=OD.create(r,n,this)},Ru=function(){h1(this,Wo,$1.create({editor:this}))},sp=function(){this.options.converter?this.converter=this.options.converter:this.converter=new Nr({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})},ap=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())},By=function(){const t=this.converter.getDocumentFonts();if(t?.length){const e=document.createElement("style");e.textContent=t,document.head.appendChild(e)}},Bu=function(){this.schema=this.extensionService.schema},Lu=function(){let t;try{const{mode:e,fragment:n,isHeadless:r,content:o,loadFromSchema:i}=this.options;e==="docx"?(t=U1(this.converter,this.schema,this),t=Oe(this,Pe,zy).call(this,t),this.options.html&&(t=Oe(this,Pe,Ha).call(this,this.options.html)),n&&(t=eD(n,this.schema))):(e==="text"||e==="html")&&(i?t=this.schema.nodeFromJSON(o):o?t=Oe(this,Pe,Ha).call(this,o):t=this.schema.topNodeType.createAndFill())}catch(e){console.error(e),this.emit("contentError",{editor:this,error:e})}return t},Ha=function(t){let e=t;if(typeof t=="string"){const n=document.createElement("div");n.innerHTML=t,e=n,n.remove()}return $r.fromSchema(this.schema).parse(e)},Pu=function(){let t=Oe(this,Pe,Lu).call(this);const e={schema:this.schema};this.options.ydoc||(e.doc=t),this.view=new D2(this.options.element,{...this.options.editorProps,dispatchTransaction:Oe(this,Pe,Py).bind(this),state:Zi.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()},Ly=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||(Oe(this,Pe,Gi).call(this),Oe(this,Pe,Wi).call(this)))},Wi=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)},Gi=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 LD(this);this.storage.pagination.sectionData=t;const{state:e,dispatch:n}=this.view,r=e.tr.setMeta(_r,{isReadyToInit:!0});n(r)}},Py=function(t){if(this.view.isDestroyed)return;let e;try{const i=gt.getState(this.view.state)?.isTrackChangesActive??!1?Q2({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})},zy=function(t){const e=Zi.create({schema:this.schema,doc:t}),{tr:n,doc:r}=e;return FD(r,n,this.schema,this.converter),e.apply(n).doc},ox=function(t=[]){const e=Zi.create({schema:this.schema,doc:this.state.doc,plugins:this.state.plugins}),{tr:n,doc:r}=e;return ID(r,n,this.schema,t),e.apply(n).doc.toJSON()},ix=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 $s=s_;const ax=Ye.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()}}}),lx=Ye.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()}}}),cx=Ye.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=cl(n,o,i),r=r||s,e().setMark("textStyle",{fontSize:`${n}${r}`}).run()},unsetFontSize:()=>({chain:t})=>t().setMark("textStyle",{fontSize:null}).removeEmptyTextStyle().run()}}}),ux=Ye.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")}}}),dx=Ye.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)}}}),px=Ye.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:Wl(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)}}}),fx=Ye.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=Hs(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(p=>p.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 a_(t={}){return new He({view(e){return new l_(e,t)}})}class l_{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,o=this.editorView.dom,i=o.getBoundingClientRect(),s=i.width/o.offsetWidth,a=i.height/o.offsetHeight;if(n){let d=e.nodeBefore,p=e.nodeAfter;if(d||p){let f=this.editorView.nodeDOM(this.cursorPos-(d?d.nodeSize:0));if(f){let h=f.getBoundingClientRect(),m=d?h.bottom:h.top;d&&p&&(m=(m+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let y=this.width/2*a;r={left:h.left,right:h.right,top:m-y,bottom:m+y}}}}if(!r){let d=this.editorView.coordsAtPos(this.cursorPos),p=this.width/2*s;r={left:d.left-p,right:d.left+p,top:d.top,bottom:d.bottom}}let l=this.editorView.dom.offsetParent;this.element||(this.element=l.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 c,u;if(!l||l==document.body&&getComputedStyle(l).position=="static")c=-pageXOffset,u=-pageYOffset;else{let d=l.getBoundingClientRect(),p=d.width/l.offsetWidth,f=d.height/l.offsetHeight;c=d.left-l.scrollLeft*p,u=d.top-l.scrollTop*f}this.element.style.left=(r.left-c)/s+"px",this.element.style.top=(r.top-u)/a+"px",this.element.style.width=(r.right-r.left)/s+"px",this.element.style.height=(r.bottom-r.top)/a+"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=yv(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){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}const hx=Ye.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:2,class:void 0}},addPmPlugins(){return[a_(this.options)]}});let en=class gr extends ze{constructor(e){super(e,e)}map(e,n){let r=e.resolve(n.map(this.head));return gr.valid(r)?new gr(r):ze.near(r)}content(){return be.empty}eq(e){return e instanceof gr&&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 gr(e.resolve(n.pos))}getBookmark(){return new Df(this.anchor)}static valid(e){let n=e.parent;if(n.isTextblock||!c_(e)||!u_(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&&gr.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(gr.valid(l))return l}for(;;){let s=n>0?i.firstChild:i.lastChild;if(!s){if(i.isAtom&&!i.isText&&!_e.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(gr.valid(a))return a}return null}}};en.prototype.visible=!1;en.findFrom=en.findGapCursorFrom;ze.jsonID("gapcursor",en);class Df{constructor(e){this.pos=e}map(e){return new Df(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return en.valid(n)?new en(n):ze.near(n)}}function c_(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 u_(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 d_(){return new He({props:{decorations:m_,createSelectionBetween(t,e,n){return e.pos==n.pos&&en.valid(n)?new en(n):null},handleClick:f_,handleKeyDown:p_,handleDOMEvents:{beforeinput:h_}}})}const p_=Af({ArrowLeft:ua("horiz",-1),ArrowRight:ua("horiz",1),ArrowUp:ua("vert",-1),ArrowDown:ua("vert",1)});function ua(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=en.findGapCursorFrom(a,e,l);return c?(o&&o(r.tr.setSelection(new en(c))),!0):!1}}function f_(t,e,n){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!en.valid(r))return!1;let o=t.posAtCoords({left:n.clientX,top:n.clientY});return o&&o.inside>-1&&_e.isSelectable(t.state.doc.nodeAt(o.inside))?!1:(t.dispatch(t.state.tr.setSelection(new en(r))),!0)}function h_(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof en))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=ge.empty;for(let s=r.length-1;s>=0;s--)o=ge.from(r[s].createAndFill(null,o));let i=t.state.tr.replace(n.pos,n.pos,new be(o,0,0));return i.setSelection(je.near(i.doc.resolve(n.pos+1))),t.dispatch(i),!1}function m_(t){if(!(t.selection instanceof en))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",De.create(t.doc,[Le.widget(t.selection.head,e,{key:"gapcursor"})])}const g_=Ye.create({name:"gapCursor",addPmPlugins(){return[d_()]},extendNodeSchema(t){return{allowGapCursor:Ke(Ie(t,"allowGapCursor",{name:t.name,options:t.options,storage:t.storage}))??null}}}),y_=new Ge("collaboration"),w_=Ye.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=v_();x_(this.options.ydoc,this.editor),k_(this.options.ydoc,this.editor,this);const[e,n]=b_(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"),Dr.getState(e).undoManager.undoStack.length===0?!1:n?sD(e):!0),redo:()=>({tr:t,state:e,dispatch:n})=>(t.setMeta("preventDispatch",!0),t.setMeta("inputType","historyRedo"),Dr.getState(e).undoManager.redoStack.length===0?!1:n?aD(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()}}}),b_=(t,e)=>{const n=t.getXmlFragment("supereditor");return[zM(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]},v_=()=>uD(),x_=(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}))})},k_=(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)},S_=Ye.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?[iD(t.awareness,{cursorBuilder:E_})]:[]}}),E_=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},Qo="aiMark",da="aiAnimationMark",mx="aiLoaderNode",C_=tn.create({name:Qo,group:"ai",inclusive:!1,addOptions(){return{htmlAttributes:{class:"sd-ai-highlight"}}},addAttributes(){return{id:{default:null,rendered:!1}}},parseDOM(){return[{tag:Qo}]},renderDOM({htmlAttributes:t}){return[Qo,Ce.mergeAttributes(this.options.htmlAttributes,t)]}}),A_=tn.create({name:da,group:"ai",inclusive:!1,spanning:!1,excludes:da,addOptions(){return{htmlAttributes:{}}},addAttributes(){return{id:{default:null,rendered:!1},class:{default:null,rendered:!0},dataMarkId:{default:null,rendered:!0}}},parseDOM(){return[{tag:da}]},renderDOM({htmlAttributes:t}){return[da,Ce.mergeAttributes(this.options.htmlAttributes,t)]}}),$_="data:image/svg+xml,%3csvg%20fill='hsla(278,%2077.40%25,%2020.80%25,%200.65)'%20viewBox='0%200%2024%2024'%20xmlns='http://www.w3.org/2000/svg'%3e%3ccircle%20cx='4'%20cy='12'%20r='0'%3e%3canimate%20begin='0;spinner_z0Or.end'%20attributeName='r'%20calcMode='spline'%20dur='0.5s'%20keySplines='.36,.6,.31,1'%20values='0;3'%20fill='freeze'/%3e%3canimate%20begin='spinner_OLMs.end'%20attributeName='cx'%20calcMode='spline'%20dur='0.5s'%20keySplines='.36,.6,.31,1'%20values='4;12'%20fill='freeze'/%3e%3canimate%20begin='spinner_UHR2.end'%20attributeName='cx'%20calcMode='spline'%20dur='0.5s'%20keySplines='.36,.6,.31,1'%20values='12;20'%20fill='freeze'/%3e%3canimate%20id='spinner_lo66'%20begin='spinner_Aguh.end'%20attributeName='r'%20calcMode='spline'%20dur='0.5s'%20keySplines='.36,.6,.31,1'%20values='3;0'%20fill='freeze'/%3e%3canimate%20id='spinner_z0Or'%20begin='spinner_lo66.end'%20attributeName='cx'%20dur='0.001s'%20values='20;4'%20fill='freeze'/%3e%3c/circle%3e%3ccircle%20cx='4'%20cy='12'%20r='3'%3e%3canimate%20begin='0;spinner_z0Or.end'%20attributeName='cx'%20calcMode='spline'%20dur='0.5s'%20keySplines='.36,.6,.31,1'%20values='4;12'%20fill='freeze'/%3e%3canimate%20begin='spinner_OLMs.end'%20attributeName='cx'%20calcMode='spline'%20dur='0.5s'%20keySplines='.36,.6,.31,1'%20values='12;20'%20fill='freeze'/%3e%3canimate%20id='spinner_JsnR'%20begin='spinner_UHR2.end'%20attributeName='r'%20calcMode='spline'%20dur='0.5s'%20keySplines='.36,.6,.31,1'%20values='3;0'%20fill='freeze'/%3e%3canimate%20id='spinner_Aguh'%20begin='spinner_JsnR.end'%20attributeName='cx'%20dur='0.001s'%20values='20;4'%20fill='freeze'/%3e%3canimate%20begin='spinner_Aguh.end'%20attributeName='r'%20calcMode='spline'%20dur='0.5s'%20keySplines='.36,.6,.31,1'%20values='0;3'%20fill='freeze'/%3e%3c/circle%3e%3ccircle%20cx='12'%20cy='12'%20r='3'%3e%3canimate%20begin='0;spinner_z0Or.end'%20attributeName='cx'%20calcMode='spline'%20dur='0.5s'%20keySplines='.36,.6,.31,1'%20values='12;20'%20fill='freeze'/%3e%3canimate%20id='spinner_hSjk'%20begin='spinner_OLMs.end'%20attributeName='r'%20calcMode='spline'%20dur='0.5s'%20keySplines='.36,.6,.31,1'%20values='3;0'%20fill='freeze'/%3e%3canimate%20id='spinner_UHR2'%20begin='spinner_hSjk.end'%20attributeName='cx'%20dur='0.001s'%20values='20;4'%20fill='freeze'/%3e%3canimate%20begin='spinner_UHR2.end'%20attributeName='r'%20calcMode='spline'%20dur='0.5s'%20keySplines='.36,.6,.31,1'%20values='0;3'%20fill='freeze'/%3e%3canimate%20begin='spinner_Aguh.end'%20attributeName='cx'%20calcMode='spline'%20dur='0.5s'%20keySplines='.36,.6,.31,1'%20values='4;12'%20fill='freeze'/%3e%3c/circle%3e%3ccircle%20cx='20'%20cy='12'%20r='3'%3e%3canimate%20id='spinner_4v5M'%20begin='0;spinner_z0Or.end'%20attributeName='r'%20calcMode='spline'%20dur='0.5s'%20keySplines='.36,.6,.31,1'%20values='3;0'%20fill='freeze'/%3e%3canimate%20id='spinner_OLMs'%20begin='spinner_4v5M.end'%20attributeName='cx'%20dur='0.001s'%20values='20;4'%20fill='freeze'/%3e%3canimate%20begin='spinner_OLMs.end'%20attributeName='r'%20calcMode='spline'%20dur='0.5s'%20keySplines='.36,.6,.31,1'%20values='0;3'%20fill='freeze'/%3e%3canimate%20begin='spinner_UHR2.end'%20attributeName='cx'%20calcMode='spline'%20dur='0.5s'%20keySplines='.36,.6,.31,1'%20values='4;12'%20fill='freeze'/%3e%3canimate%20begin='spinner_Aguh.end'%20attributeName='cx'%20calcMode='spline'%20dur='0.5s'%20keySplines='.36,.6,.31,1'%20values='12;20'%20fill='freeze'/%3e%3c/circle%3e%3c/svg%3e",T_=Ue.create({name:mx,group:"inline",inline:!0,atom:!0,selectable:!1,draggable:!1,addOptions(){return{htmlAttributes:{class:"sd-ai-loader",contentEditable:"false"}}},parseDOM(){return[{tag:"span.sd-ai-loader"}]},renderDOM({htmlAttributes:t}){const e=document.createElement("span");Object.entries(Ce.mergeAttributes(this.options.htmlAttributes,t)).forEach(([r,o])=>e.setAttribute(r,o));const n=document.createElement("img");return n.src=$_,n.alt="loading...",n.width=100,n.height=50,e.appendChild(n),e}}),pa=new Ge("ai"),gx=Ye.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[Qo].create({id:"ai-highlight"})),e&&e(t),!0)},updateAiHighlightStyle:t=>({tr:e,dispatch:n})=>(e.setMeta(pa,{type:"updateStyle",className:t}),n&&n(e),!0),clearAiHighlightStyle:()=>({tr:t,dispatch:e})=>(t.setMeta(pa,{type:"updateStyle",className:null}),e&&e(t),!0),removeAiMark:(t=Qo)=>({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},removeAiNode:(t=mx)=>({tr:e,dispatch:n,state:r})=>{const{doc:o}=r,i=[];return o.descendants((s,a)=>{s.type.name===t&&i.push(a)}),i.length===0?!1:(i.sort((s,a)=>a-s),i.forEach(s=>{const a=o.nodeAt(s);a&&e.delete(s,s+a.nodeSize)}),n&&n(e),!0)}}},addPmPlugins(){const t=this.editor;return[new He({key:pa,state:{init(){return{decorations:De.empty,highlightColor:"#6366f1",customClass:null}},apply(e,n,r,o){const i=e.getMeta(pa);let s=n.customClass;if(i&&i.type==="updateStyle"&&(s=i.className),e.docChanged&&s==="sd-ai-highlight-pulse"){let c=!1;e.steps.forEach(u=>{u.slice&&u.slice.content.size>0&&(c=!0)}),c&&(s=null)}if(!e.docChanged&&!i)return n;const{decorations:a}=O_(t,o.doc,n.highlightColor,s)||{},l=De.create(o.doc,a);return{...n,decorations:l,customClass:s}}},props:{decorations(e){return this.getState(e).decorations}}})]}}),O_=(t,e,n,r=null)=>{const o=[];return e.descendants((i,s)=>{const{marks:a=[]}=i;if(a.find(l=>l.type.name===Qo)){const l={style:`background-color: ${n}33; border-radius: 4px; transition: background-color 250ms ease;`,class:"sd-ai-highlight-element"};r&&(l.class+=` ${r}`);const c=Le.inline(s,s+i.nodeSize,l);o.push(c)}}),{decorations:o}},yx=Ue.create({name:"doc",topNode:!0,content:"block+",parseDOM(){return[{tag:"doc"}]},renderDOM(){return["doc",0]},addAttributes(){return{attributes:{rendered:!1}}}}),wx=Ue.create({name:"text",group:"inline",inline:!0}),M_=Ue.create({name:"run",group:"inline",content:"text*",inline:!0,parseDOM(){return[{tag:"run"}]},renderDOM(){return["run",0]},addAttributes(){return{attributes:{rendered:!1}}}});function Al(t){return new SD({match:t.match,handler:({state:e,range:n,match:r,chain:o})=>{const i=Ke(t.getAttributes,null,r)||{},s=e.tr.delete(n.from,n.to),a=s.doc.resolve(n.from).blockRange(),l=a&&pv(a,t.type,i);if(!l)return null;if(s.wrap(a,l),t.keepMarks&&t.editor){const{selection:u,storedMarks:d}=e,{splittableMarks:p}=t.editor.extensionService,f=d||u.$to.parentOffset&&u.$from.marks();if(f){const h=f.filter(m=>p.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&&Pr(s.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(r,c))&&s.join(n.from-1)}})}const jy=/^\s*([-+*])\s$/,bx=Ue.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",Ce.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=Al({match:jy,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=Al({match:jy,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes("textStyle"),editor:this.editor})),[t]}});function D_(t={}){return new He({key:new Ge("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[p]=c;i.setNodeMarkup(p.pos,void 0,{...p.node.attrs,syncId:null}),a=!0;return}let[u]=c,d=u.node.attrs.order;c.forEach((p,f)=>{if(f===0)return;let{node:h,pos:m}=p,y=c[f-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 __(){return Math.floor(Math.random()*4294967295).toString()}function N_(t){return new He({key:new Ge("orderedListMarker"),appendTransaction:(e,n,r)=>{if(!(e.some(l=>l.docChanged)&&!n.doc.eq(r.doc)))return;let{doc:o,tr:i}=r,s=I_(r);if(!s.size)return;let a=!1;return Array.from(s).forEach(([l,c])=>{const u=c[0];let d=c,p=u.node.type.name==="bulletList";u.node.attrs.syncId;let f=u.node.childCount!==d.length;if(p){d.forEach(x=>R_(i,x)),a=!0;return}if(f){let x=F_({state:r,list:u});x.length&&(d=x)}let h=d[0],m=B_({state:r,listItems:d}),y=vx(),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&&qy(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 C=[...g.listLevel.slice(0,-1),g.listLevel.at(-1)+1];if(!(D===g.lvlText&&I===g.listNumberingType&&qy(M,C))){let{selection:V,storedMarks:oe}=r,N=oe||V.$to.parentOffset&&V.$from.marks();i.setNodeMarkup(T,void 0,{...b.attrs,listLevel:C,lvlText:g.lvlText,listNumberingType:g.listNumberingType}),N&&i.ensureMarks(N),a=!0}g={...g,listLevel:C}})}),i.setMeta("orderedListMarker",!0),a?i:null}})}function I_(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 F_({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 vx({lvlText:t="",listLevel:e=[],listNumberingType:n="decimal"}={}){return{lvlText:t,listLevel:e,listNumberingType:n}}function R_(t,e){let{pos:n,node:r}=e;t.setNodeMarkup(n,void 0,{...r.attrs,lvlText:null,listLevel:null,listNumberingType:null})}function qy(t,e){return t.length===e.length&&t.every((n,r)=>n===e[r])}function B_({state:t,listItems:e}){let{doc:n}=t,r=e[0],{lvlText:o,listLevel:i,listNumberingType:s}=r.node.attrs,a=vx({lvlText:"%1.",listLevel:[1],listNumberingType:"decimal"}),l=(n.resolve(r.pos).depth-1)/2;if(!(o&&i?.length&&s))({lvlText:o,listLevel:i,listNumberingType:s}=a);else{let c=l>0;c&&l>=3?{lvlText:o,listLevel:i,listNumberingType:s}=a:c&&l<3&&(i=[...i.slice(0,-1),1])}return{lvlText:o,listLevel:i,listNumberingType:s}}const Vy=/^(\d+)\.\s$/,xx=Ue.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: ${fA(e)};`}):{}}},attributes:{rendered:!1,keepOnSplit:!0}}},parseDOM(){return[{tag:"ol"}]},renderDOM({htmlAttributes:t}){const{start:e,...n}=t;return e===1?["ol",Ce.mergeAttributes(this.options.htmlAttributes,n),0]:["ol",Ce.mergeAttributes(this.options.htmlAttributes,t),0]},addCommands(){return{toggleOrderedList:()=>({commands:t})=>t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks),getCurrentList:()=>({state:t})=>Kt(e=>e.type.name===this.name)(t.selection),restartListNodes:(t,e)=>({tr:n,state:r})=>{let o=e;return t.map(i=>{const s={node:i,pos:o};return o+=i.nodeSize,s}).forEach(i=>{const{pos:s}=i,a=n.mapping.map(s);n.setNodeMarkup(a,void 0,{})}),!0},updateOrderedListStyleType:()=>({dispatch:t,state:e,tr:n})=>{let r=Kt(o=>o.type.name===this.name)(n.selection);if(!r)return!0;if(t){let o=(r.depth-1)/2,i=this.options.listStyleTypes,s=i[o%i.length],a=r.node.attrs["list-style-type"],l=n.doc.nodeAt(r.pos);a!==s&&l.eq(r.node)&&n.setNodeMarkup(r.pos,void 0,{...r.node.attrs,"list-style-type":s})}return!0},liftEmptyBlockAndContinueListOrder:()=>({editor:t,dispatch:e,state:n,tr:r,commands:o})=>{let i=Kt(d=>d.type.name===this.name)(n.selection);if(!i)return!1;let s=t.can().liftEmptyBlock(),a=i.depth===1,l=i.node.childCount===1,c=n.selection.$from.node(-1),u=i.node.lastChild.eq(c);if(!(s&&a&&!l&&!u))return!1;if(e){let d=i.pos;if(!o.liftEmptyBlock(n,e))return!1;let{$from:p}=r.selection,f=r.doc.nodeAt(d),h=p.after(),m=r.doc.nodeAt(h),y=f?.type.name===this.name,g=m?.type.name===this.name;if(y&&g){let x=f.attrs.order||1,k=f.childCount,b=f.attrs.syncId,T=k+x,D=b||__();r.setNodeMarkup(h,void 0,{...m.attrs,order:T,syncId:D}),b||r.setNodeMarkup(d,void 0,{...f.attrs,syncId:D})}}return!0}}},addShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList(),Enter:()=>this.editor.commands.liftEmptyBlockAndContinueListOrder()}},addPmPlugins(){return[N_(this.editor),D_()]},addInputRules(){let t=Al({match:Vy,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(t=Al({match:Vy,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes("textStyle")}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),L_=({listLevel:t,lvlText:e,listNumberingType:n})=>{const r=q_[n];return r?r(t,e):null},P_=(t,e)=>_f(t,e,String),kx=(t,e)=>_f(t,e,U_),z_=(t,e)=>kx(t,e).toLowerCase(),j_=(t,e)=>Sx(t,e).toLowerCase(),Sx=(t,e)=>_f(t,e,n=>H_(n)),q_={decimal:P_,lowerRoman:z_,upperRoman:kx,lowerLetter:j_,upperLetter:Sx},V_=(t,e)=>t.reduce((n,r,o)=>n.replace(`%${o+1}`,r),e),_f=(t,e,n)=>{const r=t.map(n);return V_(r,e)},U_=t=>{const e=[{value:1e3,numeral:"M"},{value:900,numeral:"CM"},{value:500,numeral:"D"},{value:400,numeral:"CD"},{value:100,numeral:"C"},{value:90,numeral:"XC"},{value:50,numeral:"L"},{value:40,numeral:"XL"},{value:10,numeral:"X"},{value:9,numeral:"IX"},{value:5,numeral:"V"},{value:4,numeral:"IV"},{value:1,numeral:"I"}];let n="";for(const{value:r,numeral:o}of e)for(;t>=r;)n+=o,t-=r;return n},H_=t=>{let e="";const n="ABCDEFGHIJKLMNOPQRSTUVWXYZ";for(;t>0;){let r=(t-1)%26;e=n[r]+e,t=Math.floor((t-1)/26)}return e};function W_(t={}){return new He({key:new Ge("styledListMarker"),state:{init(e,n){const r=[...Uy(n),...Hy(n)];return De.create(n.doc,r)},apply(e,n,r,o){if(!e.docChanged||e.getMeta("orderedListMarker"))return n;const i=e.getMeta("splitListItem"),s=[...Uy(o,i),...Hy(o)];return De.create(o.doc,s)}},props:{decorations(e){return this.getState(e)}}})}function Uy(t,e=[]){let{doc:n,storedMarks:r}=t,o=[];Array.isArray(r)&&e.push(...r);let i=pf(n,s=>s.type.name==="listItem");return i.length&&i.forEach(({node:s,pos:a})=>{let l=lr("textStyle",n.type.schema),c=[...e.filter(y=>y.type===l)];if(K_(s)&&e.length){const y=e.filter(g=>g.type===l);c.push(...y)}else{const y=G_(s,n,l);c.push(...y)}let u=null,d=null;c.forEach(y=>{let{attrs:g}=y;if(g.fontSize&&!u){let[x,k]=tr(g.fontSize);Number.isNaN(x)||(k=k??"pt",u=`${x}${k}`)}g.fontFamily&&!d&&(d=g.fontFamily)});let p={style:`--marker-font-size: ${u??"initial"}`},f={style:`--marker-font-family: ${d??"initial"}`},h=Ce.mergeAttributes(p,f),m=Le.node(a,a+s.nodeSize,h);o.push(m)}),o}function Hy(t){let{doc:e}=t,n=[],r=pf(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?Wl(u,""):""}
|