n8n-nodes-adeu 1.25.0 → 1.26.0
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.
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
'use strict';var n8nWorkflow=require('n8n-workflow'),Wo=require('vm');function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var Wo__namespace=/*#__PURE__*/_interopNamespace(Wo);var Os=Object.create;var sr=Object.defineProperty;var Ps=Object.getOwnPropertyDescriptor;var Ms=Object.getOwnPropertyNames;var Rs=Object.getPrototypeOf,Bs=Object.prototype.hasOwnProperty;var d=(e,t)=>sr(e,"name",{value:t,configurable:true});var Re=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Fs=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Ms(t))!Bs.call(e,o)&&o!==n&&sr(e,o,{get:()=>t[o],enumerable:!(r=Ps(t,o))||r.enumerable});return e};var ar=(e,t,n)=>(n=e!=null?Os(Rs(e)):{},Fs(sr(n,"default",{value:e,enumerable:true}),e));var ri=Re((lf,ni)=>{ni.exports={createRequire:d(function(){return function(){return {}}},"createRequire")};});var lt=Re(fe=>{function la(e,t,n){if(n===void 0&&(n=Array.prototype),e&&typeof n.find=="function")return n.find.call(e,t);for(var r=0;r<e.length;r++)if(ut(e,r)){var o=e[r];if(t.call(void 0,o,r,e))return o}}d(la,"find");function Et(e,t){return t===void 0&&(t=Object),t&&typeof t.getOwnPropertyDescriptors=="function"&&(e=t.create(null,t.getOwnPropertyDescriptors(e))),t&&typeof t.freeze=="function"?t.freeze(e):e}d(Et,"freeze");function ut(e,t){return Object.prototype.hasOwnProperty.call(e,t)}d(ut,"hasOwn");function ca(e,t){if(e===null||typeof e!="object")throw new TypeError("target is not an object");for(var n in t)ut(t,n)&&(e[n]=t[n]);return e}d(ca,"assign");var wi=Et({allowfullscreen:true,async:true,autofocus:true,autoplay:true,checked:true,controls:true,default:true,defer:true,disabled:true,formnovalidate:true,hidden:true,ismap:true,itemscope:true,loop:true,multiple:true,muted:true,nomodule:true,novalidate:true,open:true,playsinline:true,readonly:true,required:true,reversed:true,selected:true});function fa(e){return ut(wi,e.toLowerCase())}d(fa,"isHTMLBooleanAttribute");var vi=Et({area:true,base:true,br:true,col:true,embed:true,hr:true,img:true,input:true,link:true,meta:true,param:true,source:true,track:true,wbr:true});function da(e){return ut(vi,e.toLowerCase())}d(da,"isHTMLVoidElement");var Kt=Et({script:false,style:false,textarea:true,title:true});function ha(e){var t=e.toLowerCase();return ut(Kt,t)&&!Kt[t]}d(ha,"isHTMLRawTextElement");function pa(e){var t=e.toLowerCase();return ut(Kt,t)&&Kt[t]}d(pa,"isHTMLEscapableRawTextElement");function yi(e){return e===en.HTML}d(yi,"isHTMLMimeType");function ma(e){return yi(e)||e===en.XML_XHTML_APPLICATION}d(ma,"hasDefaultHTMLNamespace");var en=Et({HTML:"text/html",XML_APPLICATION:"application/xml",XML_TEXT:"text/xml",XML_XHTML_APPLICATION:"application/xhtml+xml",XML_SVG_IMAGE:"image/svg+xml"}),_a=Object.keys(en).map(function(e){return en[e]});function ga(e){return _a.indexOf(e)>-1}d(ga,"isValidMimeType");var wa=Et({HTML:"http://www.w3.org/1999/xhtml",SVG:"http://www.w3.org/2000/svg",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"});fe.assign=ca;fe.find=la;fe.freeze=Et;fe.HTML_BOOLEAN_ATTRIBUTES=wi;fe.HTML_RAW_TEXT_ELEMENTS=Kt;fe.HTML_VOID_ELEMENTS=vi;fe.hasDefaultHTMLNamespace=ma;fe.hasOwn=ut;fe.isHTMLBooleanAttribute=fa;fe.isHTMLRawTextElement=ha;fe.isHTMLEscapableRawTextElement=pa;fe.isHTMLMimeType=yi;fe.isHTMLVoidElement=da;fe.isValidMimeType=ga;fe.MIME_TYPE=en;fe.NAMESPACE=wa;});var sn=Re(on=>{var va=lt();function bi(e,t){e.prototype=Object.create(Error.prototype,{constructor:{value:e},name:{value:e.name,enumerable:true,writable:t}});}d(bi,"extendError");var nn=va.freeze({Error:"Error",IndexSizeError:"IndexSizeError",DomstringSizeError:"DomstringSizeError",HierarchyRequestError:"HierarchyRequestError",WrongDocumentError:"WrongDocumentError",InvalidCharacterError:"InvalidCharacterError",NoDataAllowedError:"NoDataAllowedError",NoModificationAllowedError:"NoModificationAllowedError",NotFoundError:"NotFoundError",NotSupportedError:"NotSupportedError",InUseAttributeError:"InUseAttributeError",InvalidStateError:"InvalidStateError",SyntaxError:"SyntaxError",InvalidModificationError:"InvalidModificationError",NamespaceError:"NamespaceError",InvalidAccessError:"InvalidAccessError",ValidationError:"ValidationError",TypeMismatchError:"TypeMismatchError",SecurityError:"SecurityError",NetworkError:"NetworkError",AbortError:"AbortError",URLMismatchError:"URLMismatchError",QuotaExceededError:"QuotaExceededError",TimeoutError:"TimeoutError",InvalidNodeTypeError:"InvalidNodeTypeError",DataCloneError:"DataCloneError",EncodingError:"EncodingError",NotReadableError:"NotReadableError",UnknownError:"UnknownError",ConstraintError:"ConstraintError",DataError:"DataError",TransactionInactiveError:"TransactionInactiveError",ReadOnlyError:"ReadOnlyError",VersionError:"VersionError",OperationError:"OperationError",NotAllowedError:"NotAllowedError",OptOutError:"OptOutError"}),Di=Object.keys(nn);function Ai(e){return typeof e=="number"&&e>=1&&e<=25}d(Ai,"isValidDomExceptionCode");function ya(e){return typeof e=="string"&&e.substring(e.length-nn.Error.length)===nn.Error}d(ya,"endsWithError");function rn(e,t){Ai(e)?(this.name=Di[e],this.message=t||""):(this.message=e,this.name=ya(t)?t:nn.Error),Error.captureStackTrace&&Error.captureStackTrace(this,rn);}d(rn,"DOMException");bi(rn,true);Object.defineProperties(rn.prototype,{code:{enumerable:true,get:d(function(){var e=Di.indexOf(this.name);return Ai(e)?e:0},"get")}});var Ni={INDEX_SIZE_ERR:1,DOMSTRING_SIZE_ERR:2,HIERARCHY_REQUEST_ERR:3,WRONG_DOCUMENT_ERR:4,INVALID_CHARACTER_ERR:5,NO_DATA_ALLOWED_ERR:6,NO_MODIFICATION_ALLOWED_ERR:7,NOT_FOUND_ERR:8,NOT_SUPPORTED_ERR:9,INUSE_ATTRIBUTE_ERR:10,INVALID_STATE_ERR:11,SYNTAX_ERR:12,INVALID_MODIFICATION_ERR:13,NAMESPACE_ERR:14,INVALID_ACCESS_ERR:15,VALIDATION_ERR:16,TYPE_MISMATCH_ERR:17,SECURITY_ERR:18,NETWORK_ERR:19,ABORT_ERR:20,URL_MISMATCH_ERR:21,QUOTA_EXCEEDED_ERR:22,TIMEOUT_ERR:23,INVALID_NODE_TYPE_ERR:24,DATA_CLONE_ERR:25},Er=Object.entries(Ni);for(tn=0;tn<Er.length;tn++)Ei=Er[tn][0],rn[Ei]=Er[tn][1];var Ei,tn;function br(e,t){this.message=e,this.locator=t,Error.captureStackTrace&&Error.captureStackTrace(this,br);}d(br,"ParseError");bi(br);on.DOMException=rn;on.DOMExceptionName=nn;on.ExceptionCode=Ni;on.ParseError=br;});var kr=Re(j=>{function Oi(e){try{typeof e!="function"&&(e=RegExp);var t=new e("\u{1D306}","u").exec("\u{1D306}");return !!t&&t[0].length===2}catch{}return false}d(Oi,"detectUnicodeSupport");var At=Oi();function Qe(e){if(e.source[0]!=="[")throw new Error(e+" can not be used with chars");return e.source.slice(1,e.source.lastIndexOf("]"))}d(Qe,"chars");function bt(e,t){if(e.source[0]!=="[")throw new Error("/"+e.source+"/ can not be used with chars_without");if(!t||typeof t!="string")throw new Error(JSON.stringify(t)+" is not a valid search");if(e.source.indexOf(t)===-1)throw new Error('"'+t+'" is not is /'+e.source+"/");if(t==="-"&&e.source.indexOf(t)!==1)throw new Error('"'+t+'" is not at the first postion of /'+e.source+"/");return new RegExp(e.source.replace(t,""),At?"u":"")}d(bt,"chars_without");function G(e){var t=this;return new RegExp(Array.prototype.slice.call(arguments).map(function(n){var r=typeof n=="string";if(r&&t===void 0&&n==="|")throw new Error("use regg instead of reg to wrap expressions with `|`!");return r?n:n.source}).join(""),At?"mu":"m")}d(G,"reg");function q(e){if(arguments.length===0)throw new Error("no parameters provided");return G.apply(q,["(?:"].concat(Array.prototype.slice.call(arguments),[")"]))}d(q,"regg");var Ea="\uFFFD",Je=/[-\x09\x0A\x0D\x20-\x2C\x2E-\uD7FF\uE000-\uFFFD]/;At&&(Je=G("[",Qe(Je),"\\u{10000}-\\u{10FFFF}","]"));var ba=new RegExp("[^"+Qe(Je)+"]",At?"u":""),Ar=/[\x20\x09\x0D\x0A]/,Da=Qe(Ar),K=G(Ar,"+"),re=G(Ar,"*"),an=/[:_a-zA-Z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/;At&&(an=G("[",Qe(an),"\\u{10000}-\\u{10FFFF}","]"));var Aa=Qe(an),Nr=G("[",Aa,Qe(/[-.0-9\xB7]/),Qe(/[\u0300-\u036F\u203F-\u2040]/),"]"),Te=G(an,Nr,"*"),xi=G(Nr,"+"),Na=G("&",Te,";"),xa=q(/&#[0-9]+;|&#x[0-9a-fA-F]+;/),un=q(Na,"|",xa),ln=G("%",Te,";"),xr=q(G('"',q(/[^%&"]/,"|",ln,"|",un),"*",'"'),"|",G("'",q(/[^%&']/,"|",ln,"|",un),"*","'")),Ca=q('"',q(/[^<&"]/,"|",un),"*",'"',"|","'",q(/[^<&']/,"|",un),"*","'"),Ta=bt(an,":"),ka=bt(Nr,":"),Ci=G(Ta,ka,"*"),cn=G(Ci,q(":",Ci),"?"),Sa=G("^",cn,"$"),Ia=G("(",cn,")"),Dt=q(/"[^"]*"|'[^']*'/),Oa=G(/^<\?/,"(",Te,")",q(K,"(",Je,"*?)"),"?",/\?>/),Ti=/[\x20\x0D\x0Aa-zA-Z0-9-'()+,./:=?;!*#@$_%]/,fn=q('"',Ti,'*"',"|","'",bt(Ti,"'"),"*'"),Pi="<!--",Mi="-->",Pa=G(Pi,q(bt(Je,"-"),"|",G("-",bt(Je,"-"))),"*",Mi),ki="#PCDATA",Ma=q(G(/\(/,re,ki,q(re,/\|/,re,cn),"*",re,/\)\*/),"|",G(/\(/,re,ki,re,/\)/)),Ra=/[?*+]?/,Ba=G(/\([^>]+\)/,Ra),Fa=q("EMPTY","|","ANY","|",Ma,"|",Ba),La="<!ELEMENT",$a=G(La,K,q(cn,"|",ln),K,q(Fa,"|",ln),re,">"),Ua=G("NOTATION",K,/\(/,re,Te,q(re,/\|/,re,Te),"*",re,/\)/),qa=G(/\(/,re,xi,q(re,/\|/,re,xi),"*",re,/\)/),ja=q(Ua,"|",qa),za=q(/CDATA|ID|IDREF|IDREFS|ENTITY|ENTITIES|NMTOKEN|NMTOKENS/,"|",ja),Wa=q(/#REQUIRED|#IMPLIED/,"|",q(q("#FIXED",K),"?",Ca)),Ha=q(K,Te,K,za,K,Wa),Va="<!ATTLIST",Ga=G(Va,K,Te,Ha,"*",re,">"),Dr="about:legacy-compat",Ya=q('"'+Dr+'"',"|","'"+Dr+"'"),Cr="SYSTEM",On="PUBLIC",Pn=q(q(Cr,K,Dt),"|",q(On,K,fn,K,Dt)),Xa=G("^",q(q(Cr,K,"(?<SystemLiteralOnly>",Dt,")"),"|",q(On,K,"(?<PubidLiteral>",fn,")",K,"(?<SystemLiteral>",Dt,")"))),Qa=G("^",fn,"$"),Ja=G("^",Dt,"$"),Za=q(K,"NDATA",K,Te),Ka=q(xr,"|",q(Pn,Za,"?")),Ri="<!ENTITY",eu=G(Ri,K,Te,K,Ka,re,">"),tu=q(xr,"|",Pn),nu=G(Ri,K,"%",K,Te,K,tu,re,">"),ru=q(eu,"|",nu),iu=G(On,K,fn),ou=G("<!NOTATION",K,Te,K,q(Pn,"|",iu),re,">"),Tr=G(re,"=",re),Si=/1[.]\d+/,su=G(K,"version",Tr,q("'",Si,"'","|",'"',Si,'"')),Ii=/[A-Za-z][-A-Za-z0-9._]*/,au=q(K,"encoding",Tr,q('"',Ii,'"',"|","'",Ii,"'")),uu=q(K,"standalone",Tr,q("'",q("yes","|","no"),"'","|",'"',q("yes","|","no"),'"')),lu=G(/^<\?xml/,su,au,"?",uu,"?",re,/\?>/),cu="<!DOCTYPE",fu="<![CDATA[",du="]]>",hu=/<!\[CDATA\[/,pu=/\]\]>/,mu=G(Je,"*?",pu),_u=G(hu,mu);j.chars=Qe;j.chars_without=bt;j.detectUnicodeSupport=Oi;j.reg=G;j.regg=q;j.ABOUT_LEGACY_COMPAT=Dr;j.ABOUT_LEGACY_COMPAT_SystemLiteral=Ya;j.AttlistDecl=Ga;j.CDATA_START=fu;j.CDATA_END=du;j.CDSect=_u;j.Char=Je;j.Comment=Pa;j.COMMENT_START=Pi;j.COMMENT_END=Mi;j.DOCTYPE_DECL_START=cu;j.elementdecl=$a;j.EntityDecl=ru;j.EntityValue=xr;j.ExternalID=Pn;j.ExternalID_match=Xa;j.Name=Te;j.NotationDecl=ou;j.Reference=un;j.PEReference=ln;j.PI=Oa;j.PUBLIC=On;j.PubidLiteral=fn;j.PubidLiteral_match=Qa;j.QName=cn;j.QName_exact=Sa;j.QName_group=Ia;j.S=K;j.SChar_s=Da;j.S_OPT=re;j.SYSTEM=Cr;j.SystemLiteral=Dt;j.SystemLiteral_match=Ja;j.InvalidChar=ba;j.UNICODE_REPLACEMENT_CHARACTER=Ea;j.UNICODE_SUPPORT=At;j.XMLDecl=lu;});var Fr=Re(se=>{var Ie=lt(),$e=Ie.find,gu=Ie.hasDefaultHTMLNamespace,xt=Ie.hasOwn,wu=Ie.isHTMLMimeType,vu=Ie.isHTMLRawTextElement,yu=Ie.isHTMLVoidElement,dn=Ie.MIME_TYPE,Ue=Ie.NAMESPACE,_e=Symbol(),ji=sn(),L=ji.DOMException,ke=ji.DOMExceptionName,de=kr();function ye(e){if(e!==_e)throw new TypeError("Illegal constructor")}d(ye,"checkSymbol");function Eu(e){return e!==""}d(Eu,"notEmptyString");function bu(e){return e?e.split(/[\t\n\f\r ]+/).filter(Eu):[]}d(bu,"splitOnASCIIWhitespace");function Du(e,t){return xt(e,t)||(e[t]=true),e}d(Du,"orderedSetReducer");function Bi(e){if(!e)return [];var t=bu(e);return Object.keys(t.reduce(Du,{}))}d(Bi,"toOrderedSet");function Au(e){return function(t){return e&&e.indexOf(t)!==-1}}d(Au,"arrayIncludes");function zi(e){if(!de.QName_exact.test(e))throw new L(L.INVALID_CHARACTER_ERR,'invalid character in qualified name "'+e+'"')}d(zi,"validateQualifiedName");function Ir(e,t){zi(t),e=e||null;var n=null,r=t;if(t.indexOf(":")>=0){var o=t.split(":");n=o[0],r=o[1];}if(n!==null&&e===null)throw new L(L.NAMESPACE_ERR,"prefix is non-null and namespace is null");if(n==="xml"&&e!==Ie.NAMESPACE.XML)throw new L(L.NAMESPACE_ERR,'prefix is "xml" and namespace is not the XML namespace');if((n==="xmlns"||t==="xmlns")&&e!==Ie.NAMESPACE.XMLNS)throw new L(L.NAMESPACE_ERR,'either qualifiedName or prefix is "xmlns" and namespace is not the XMLNS namespace');if(e===Ie.NAMESPACE.XMLNS&&n!=="xmlns"&&t!=="xmlns")throw new L(L.NAMESPACE_ERR,'namespace is the XMLNS namespace and neither qualifiedName nor prefix is "xmlns"');return [e,n,r]}d(Ir,"validateAndExtract");function kt(e,t){for(var n in e)xt(e,n)&&(t[n]=e[n]);}d(kt,"copy");function Ee(e,t){var n=e.prototype;if(!(n instanceof t)){let r=function(){};d(r,"t"),r.prototype=t.prototype,r=new r,kt(n,r),e.prototype=n=r;}n.constructor!=e&&(n.constructor=e);}d(Ee,"_extends");var be={},Se=be.ELEMENT_NODE=1,Ct=be.ATTRIBUTE_NODE=2,Bn=be.TEXT_NODE=3,Wi=be.CDATA_SECTION_NODE=4,Hi=be.ENTITY_REFERENCE_NODE=5,Nu=be.ENTITY_NODE=6,Or=be.PROCESSING_INSTRUCTION_NODE=7,Pr=be.COMMENT_NODE=8,Nt=be.DOCUMENT_NODE=9,Vi=be.DOCUMENT_TYPE_NODE=10,Ze=be.DOCUMENT_FRAGMENT_NODE=11,xu=be.NOTATION_NODE=12,oe=Ie.freeze({DOCUMENT_POSITION_DISCONNECTED:1,DOCUMENT_POSITION_PRECEDING:2,DOCUMENT_POSITION_FOLLOWING:4,DOCUMENT_POSITION_CONTAINS:8,DOCUMENT_POSITION_CONTAINED_BY:16,DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC:32});function Gi(e,t){if(t.length<e.length)return Gi(t,e);var n=null;for(var r in e){if(e[r]!==t[r])return n;n=e[r];}return n}d(Gi,"commonAncestor");function Fi(e){return e.guid||(e.guid=Math.random()),e.guid}d(Fi,"docGUID");function ae(){}d(ae,"NodeList");ae.prototype={length:0,item:d(function(e){return e>=0&&e<this.length?this[e]:null},"item"),toString:d(function(e){var t;typeof e=="function"?t={requireWellFormed:false,splitCDATASections:true,nodeFilter:e}:e?t={requireWellFormed:!!e.requireWellFormed,splitCDATASections:e.splitCDATASections!==false,nodeFilter:e.nodeFilter||null}:t={requireWellFormed:false,splitCDATASections:true,nodeFilter:null};for(var n=[],r=0;r<this.length;r++)Br(this[r],n,null,t);return n.join("")},"toString"),filter:d(function(e){return Array.prototype.filter.call(this,e)},"filter"),indexOf:d(function(e){return Array.prototype.indexOf.call(this,e)},"indexOf")};ae.prototype[Symbol.iterator]=function(){var e=this,t=0;return {next:d(function(){return t<e.length?{value:e[t++],done:false}:{done:true}},"next"),return:d(function(){return {done:true}},"return")}};function Le(e,t){this._node=e,this._refresh=t,Ln(this);}d(Le,"LiveNodeList");function Ln(e){var t=e._node._inc||e._node.ownerDocument._inc;if(e._inc!==t){var n=e._refresh(e._node);if(oo(e,"length",n.length),!e.$$length||n.length<e.$$length)for(var r=n.length;r in e;r++)xt(e,r)&&delete e[r];kt(n,e),e._inc=t;}}d(Ln,"_updateLiveList");Le.prototype.item=function(e){return Ln(this),this[e]||null};Ee(Le,ae);function Tt(){}d(Tt,"NamedNodeMap");function Yi(e,t){for(var n=0;n<e.length;){if(e[n]===t)return n;n++;}}d(Yi,"_findNodeIndex");function Cu(e,t,n,r){if(r?t[Yi(t,r)]=n:(t[t.length]=n,t.length++),e){n.ownerElement=e;var o=e.ownerDocument;o&&(r&&Ji(o,e,r),Tu(o,e,n));}}d(Cu,"_addNamedNode");function Li(e,t,n){var r=Yi(t,n);if(r>=0){for(var o=t.length-1;r<=o;)t[r]=t[++r];if(t.length=o,e){var i=e.ownerDocument;i&&Ji(i,e,n),n.ownerElement=null;}}}d(Li,"_removeNamedNode");Tt.prototype={length:0,item:ae.prototype.item,getNamedItem:d(function(e){this._ownerElement&&this._ownerElement._isInHTMLDocumentAndNamespace()&&(e=e.toLowerCase());for(var t=0;t<this.length;){var n=this[t];if(n.nodeName===e)return n;t++;}return null},"getNamedItem"),setNamedItem:d(function(e){var t=e.ownerElement;if(t&&t!==this._ownerElement)throw new L(L.INUSE_ATTRIBUTE_ERR);var n=this.getNamedItemNS(e.namespaceURI,e.localName);return n===e?e:(Cu(this._ownerElement,this,e,n),n)},"setNamedItem"),setNamedItemNS:d(function(e){return this.setNamedItem(e)},"setNamedItemNS"),removeNamedItem:d(function(e){var t=this.getNamedItem(e);if(!t)throw new L(L.NOT_FOUND_ERR,e);return Li(this._ownerElement,this,t),t},"removeNamedItem"),removeNamedItemNS:d(function(e,t){var n=this.getNamedItemNS(e,t);if(!n)throw new L(L.NOT_FOUND_ERR,e?e+" : "+t:t);return Li(this._ownerElement,this,n),n},"removeNamedItemNS"),getNamedItemNS:d(function(e,t){e||(e=null);for(var n=0;n<this.length;){var r=this[n];if(r.localName===t&&r.namespaceURI===e)return r;n++;}return null},"getNamedItemNS")};Tt.prototype[Symbol.iterator]=function(){var e=this,t=0;return {next:d(function(){return t<e.length?{value:e[t++],done:false}:{done:true}},"next"),return:d(function(){return {done:true}},"return")}};function Xi(){}d(Xi,"DOMImplementation");Xi.prototype={hasFeature:d(function(e,t){return true},"hasFeature"),createDocument:d(function(e,t,n){var r=dn.XML_APPLICATION;e===Ue.HTML?r=dn.XML_XHTML_APPLICATION:e===Ue.SVG&&(r=dn.XML_SVG_IMAGE);var o=new He(_e,{contentType:r});if(o.implementation=this,o.childNodes=new ae,o.doctype=n||null,n&&o.appendChild(n),t){var i=o.createElementNS(e,t);o.appendChild(i);}return o},"createDocument"),createDocumentType:d(function(e,t,n,r){zi(e);var o=new qn(_e);return o.name=e,o.nodeName=e,o.publicId=t||"",o.systemId=n||"",o.internalSubset=r||"",o.childNodes=new ae,o},"createDocumentType"),createHTMLDocument:d(function(e){var t=new He(_e,{contentType:dn.HTML});if(t.implementation=this,t.childNodes=new ae,e!==false){t.doctype=this.createDocumentType("html"),t.doctype.ownerDocument=t,t.appendChild(t.doctype);var n=t.createElement("html");t.appendChild(n);var r=t.createElement("head");if(n.appendChild(r),typeof e=="string"){var o=t.createElement("title");o.appendChild(t.createTextNode(e)),r.appendChild(o);}n.appendChild(t.createElement("body"));}return t},"createHTMLDocument")};function Y(e){ye(e);}d(Y,"Node");Y.prototype={firstChild:null,lastChild:null,previousSibling:null,nextSibling:null,parentNode:null,get parentElement(){return this.parentNode&&this.parentNode.nodeType===this.ELEMENT_NODE?this.parentNode:null},childNodes:null,ownerDocument:null,nodeValue:null,namespaceURI:null,prefix:null,localName:null,baseURI:"about:blank",get isConnected(){var e=this.getRootNode();return e&&e.nodeType===e.DOCUMENT_NODE},contains:d(function(e){if(!e)return false;var t=e;do{if(this===t)return true;t=t.parentNode;}while(t);return false},"contains"),getRootNode:d(function(e){var t=this;do{if(!t.parentNode)return t;t=t.parentNode;}while(t)},"getRootNode"),isEqualNode:d(function(e){if(!e)return false;for(var t=[{node:this,other:e}];t.length>0;){var n=t.pop(),r=n.node,o=n.other;if(r.nodeType!==o.nodeType)return false;switch(r.nodeType){case r.DOCUMENT_TYPE_NODE:if(r.name!==o.name||r.publicId!==o.publicId||r.systemId!==o.systemId)return false;break;case r.ELEMENT_NODE:if(r.namespaceURI!==o.namespaceURI||r.prefix!==o.prefix||r.localName!==o.localName||r.attributes.length!==o.attributes.length)return false;for(var i=0;i<r.attributes.length;i++){var s=r.attributes.item(i),l=o.getAttributeNodeNS(s.namespaceURI,s.localName);if(!l)return false;t.push({node:s,other:l});}break;case r.ATTRIBUTE_NODE:if(r.namespaceURI!==o.namespaceURI||r.localName!==o.localName||r.value!==o.value)return false;break;case r.PROCESSING_INSTRUCTION_NODE:if(r.target!==o.target||r.data!==o.data)return false;break;case r.TEXT_NODE:case r.CDATA_SECTION_NODE:case r.COMMENT_NODE:if(r.data!==o.data)return false;break}if(r.childNodes.length!==o.childNodes.length)return false;for(var i=r.childNodes.length-1;i>=0;i--)t.push({node:r.childNodes[i],other:o.childNodes[i]});}return true},"isEqualNode"),isSameNode:d(function(e){return this===e},"isSameNode"),insertBefore:d(function(e,t){return Fn(this,e,t)},"insertBefore"),replaceChild:d(function(e,t){Fn(this,e,t,to),t&&this.removeChild(t);},"replaceChild"),removeChild:d(function(e){return Ki(this,e)},"removeChild"),appendChild:d(function(e){return this.insertBefore(e,null)},"appendChild"),hasChildNodes:d(function(){return this.firstChild!=null},"hasChildNodes"),cloneNode:d(function(e){return io(this.ownerDocument||this,this,e)},"cloneNode"),normalize:d(function(){he(this,null,{enter:d(function(e){for(var t=e.firstChild;t;){var n=t.nextSibling;n!==null&&n.nodeType===Bn&&t.nodeType===Bn?(e.removeChild(n),t.appendData(n.data)):t=n;}return true},"enter")});},"normalize"),isSupported:d(function(e,t){return this.ownerDocument.implementation.hasFeature(e,t)},"isSupported"),lookupPrefix:d(function(e){for(var t=this;t;){var n=t._nsMap;if(n){for(var r in n)if(xt(n,r)&&n[r]===e)return r}t=t.nodeType==Ct?t.ownerDocument:t.parentNode;}return null},"lookupPrefix"),lookupNamespaceURI:d(function(e){for(var t=this;t;){var n=t._nsMap;if(n&&xt(n,e))return n[e];t=t.nodeType==Ct?t.ownerDocument:t.parentNode;}return null},"lookupNamespaceURI"),isDefaultNamespace:d(function(e){var t=this.lookupPrefix(e);return t==null},"isDefaultNamespace"),compareDocumentPosition:d(function(e){if(this===e)return 0;var t=e,n=this,r=null,o=null;if(t instanceof ct&&(r=t,t=r.ownerElement),n instanceof ct&&(o=n,n=o.ownerElement,r&&t&&n===t))for(var i=0,s;s=n.attributes[i];i++){if(s===r)return oe.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC+oe.DOCUMENT_POSITION_PRECEDING;if(s===o)return oe.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC+oe.DOCUMENT_POSITION_FOLLOWING}if(!t||!n||n.ownerDocument!==t.ownerDocument)return oe.DOCUMENT_POSITION_DISCONNECTED+oe.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC+(Fi(n.ownerDocument)>Fi(t.ownerDocument)?oe.DOCUMENT_POSITION_FOLLOWING:oe.DOCUMENT_POSITION_PRECEDING);if(o&&t===n)return oe.DOCUMENT_POSITION_CONTAINS+oe.DOCUMENT_POSITION_PRECEDING;if(r&&t===n)return oe.DOCUMENT_POSITION_CONTAINED_BY+oe.DOCUMENT_POSITION_FOLLOWING;for(var l=[],a=t.parentNode;a;){if(!o&&a===n)return oe.DOCUMENT_POSITION_CONTAINED_BY+oe.DOCUMENT_POSITION_FOLLOWING;l.push(a),a=a.parentNode;}l.reverse();for(var u=[],c=n.parentNode;c;){if(!r&&c===t)return oe.DOCUMENT_POSITION_CONTAINS+oe.DOCUMENT_POSITION_PRECEDING;u.push(c),c=c.parentNode;}u.reverse();var f=Gi(l,u);for(var h in f.childNodes){var p=f.childNodes[h];if(p===n)return oe.DOCUMENT_POSITION_FOLLOWING;if(p===t)return oe.DOCUMENT_POSITION_PRECEDING;if(u.indexOf(p)>=0)return oe.DOCUMENT_POSITION_FOLLOWING;if(l.indexOf(p)>=0)return oe.DOCUMENT_POSITION_PRECEDING}return 0},"compareDocumentPosition")};function Qi(e){return e=="<"&&"<"||e==">"&&">"||e=="&"&&"&"||e=='"'&&"""||"&#"+e.charCodeAt()+";"}d(Qi,"_xmlEncoder");kt(be,Y);kt(be,Y.prototype);kt(oe,Y);kt(oe,Y.prototype);function Rn(e,t){he(e,null,{enter:d(function(n){return t(n)?he.STOP:true},"enter")});}d(Rn,"_visitNode");function he(e,t,n){for(var r=[{node:e,context:t,phase:he.ENTER}];r.length>0;){var o=r.pop();if(o.phase===he.ENTER){var i=n.enter(o.node,o.context);if(i===he.STOP)return he.STOP;if(r.push({node:o.node,context:i,phase:he.EXIT}),i==null)continue;for(var s=o.node.lastChild;s;)r.push({node:s,context:i,phase:he.ENTER}),s=s.previousSibling;}else n.exit&&n.exit(o.node,o.context);}}d(he,"walkDOM");he.STOP=Symbol("walkDOM.STOP");he.ENTER=0;he.EXIT=1;function He(e,t){ye(e);var n=t||{};this.ownerDocument=this,this.contentType=n.contentType||dn.XML_APPLICATION,this.type=wu(this.contentType)?"html":"xml";}d(He,"Document");function Tu(e,t,n){e&&e._inc++;var r=n.namespaceURI;r===Ue.XMLNS&&(t._nsMap[n.prefix?n.localName:""]=n.value);}d(Tu,"_onAddAttribute");function Ji(e,t,n,r){e&&e._inc++;var o=n.namespaceURI;o===Ue.XMLNS&&delete t._nsMap[n.prefix?n.localName:""];}d(Ji,"_onRemoveAttribute");function Zi(e,t,n){if(e&&e._inc){e._inc++;var r=t.childNodes;if(n&&!n.nextSibling)r[r.length++]=n;else {for(var o=t.firstChild,i=0;o;)r[i++]=o,o=o.nextSibling;r.length=i,delete r[r.length];}}}d(Zi,"_onUpdateChild");function Ki(e,t){if(e!==t.parentNode)throw new L(L.NOT_FOUND_ERR,"child's parent is not parent");var n=t.previousSibling,r=t.nextSibling;return n?n.nextSibling=r:e.firstChild=r,r?r.previousSibling=n:e.lastChild=n,Zi(e.ownerDocument,e),t.parentNode=null,t.previousSibling=null,t.nextSibling=null,t}d(Ki,"_removeChild");function ku(e){return e&&(e.nodeType===Y.DOCUMENT_NODE||e.nodeType===Y.DOCUMENT_FRAGMENT_NODE||e.nodeType===Y.ELEMENT_NODE)}d(ku,"hasValidParentNodeType");function Su(e){return e&&(e.nodeType===Y.CDATA_SECTION_NODE||e.nodeType===Y.COMMENT_NODE||e.nodeType===Y.DOCUMENT_FRAGMENT_NODE||e.nodeType===Y.DOCUMENT_TYPE_NODE||e.nodeType===Y.ELEMENT_NODE||e.nodeType===Y.PROCESSING_INSTRUCTION_NODE||e.nodeType===Y.TEXT_NODE)}d(Su,"hasInsertableNodeType");function Ke(e){return e&&e.nodeType===Y.DOCUMENT_TYPE_NODE}d(Ke,"isDocTypeNode");function We(e){return e&&e.nodeType===Y.ELEMENT_NODE}d(We,"isElementNode");function eo(e){return e&&e.nodeType===Y.TEXT_NODE}d(eo,"isTextNode");function $i(e,t){var n=e.childNodes||[];if($e(n,We)||Ke(t))return false;var r=$e(n,Ke);return !(t&&r&&n.indexOf(r)>n.indexOf(t))}d($i,"isElementInsertionPossible");function Ui(e,t){var n=e.childNodes||[];function r(i){return We(i)&&i!==t}if(d(r,"hasElementChildThatIsNotChild"),$e(n,r))return false;var o=$e(n,Ke);return !(t&&o&&n.indexOf(o)>n.indexOf(t))}d(Ui,"isElementReplacementPossible");function Iu(e,t,n){if(!ku(e))throw new L(L.HIERARCHY_REQUEST_ERR,"Unexpected parent node type "+e.nodeType);if(n&&n.parentNode!==e)throw new L(L.NOT_FOUND_ERR,"child not in parent");if(!Su(t)||Ke(t)&&e.nodeType!==Y.DOCUMENT_NODE)throw new L(L.HIERARCHY_REQUEST_ERR,"Unexpected node type "+t.nodeType+" for parent node type "+e.nodeType)}d(Iu,"assertPreInsertionValidity1to5");function Ou(e,t,n){var r=e.childNodes||[],o=t.childNodes||[];if(t.nodeType===Y.DOCUMENT_FRAGMENT_NODE){var i=o.filter(We);if(i.length>1||$e(o,eo))throw new L(L.HIERARCHY_REQUEST_ERR,"More than one element or text in fragment");if(i.length===1&&!$i(e,n))throw new L(L.HIERARCHY_REQUEST_ERR,"Element in fragment can not be inserted before doctype")}if(We(t)&&!$i(e,n))throw new L(L.HIERARCHY_REQUEST_ERR,"Only one element can be added and only after doctype");if(Ke(t)){if($e(r,Ke))throw new L(L.HIERARCHY_REQUEST_ERR,"Only one doctype is allowed");var s=$e(r,We);if(n&&r.indexOf(s)<r.indexOf(n))throw new L(L.HIERARCHY_REQUEST_ERR,"Doctype can only be inserted before an element");if(!n&&s)throw new L(L.HIERARCHY_REQUEST_ERR,"Doctype can not be appended since element is present")}}d(Ou,"assertPreInsertionValidityInDocument");function to(e,t,n){var r=e.childNodes||[],o=t.childNodes||[];if(t.nodeType===Y.DOCUMENT_FRAGMENT_NODE){var i=o.filter(We);if(i.length>1||$e(o,eo))throw new L(L.HIERARCHY_REQUEST_ERR,"More than one element or text in fragment");if(i.length===1&&!Ui(e,n))throw new L(L.HIERARCHY_REQUEST_ERR,"Element in fragment can not be inserted before doctype")}if(We(t)&&!Ui(e,n))throw new L(L.HIERARCHY_REQUEST_ERR,"Only one element can be added and only after doctype");if(Ke(t)){let l=function(a){return Ke(a)&&a!==n};if(d(l,"hasDoctypeChildThatIsNotChild"),$e(r,l))throw new L(L.HIERARCHY_REQUEST_ERR,"Only one doctype is allowed");var s=$e(r,We);if(n&&r.indexOf(s)<r.indexOf(n))throw new L(L.HIERARCHY_REQUEST_ERR,"Doctype can only be inserted before an element")}}d(to,"assertPreReplacementValidityInDocument");function Fn(e,t,n,r){Iu(e,t,n),e.nodeType===Y.DOCUMENT_NODE&&(r||Ou)(e,t,n);var o=t.parentNode;if(o&&o.removeChild(t),t.nodeType===Ze){var i=t.firstChild;if(i==null)return t;var s=t.lastChild;}else i=s=t;var l=n?n.previousSibling:e.lastChild;i.previousSibling=l,s.nextSibling=n,l?l.nextSibling=i:e.firstChild=i,n==null?e.lastChild=s:n.previousSibling=s;do i.parentNode=e;while(i!==s&&(i=i.nextSibling));return Zi(e.ownerDocument||e,e,t),t.nodeType==Ze&&(t.firstChild=t.lastChild=null),t}d(Fn,"_insertBefore");He.prototype={implementation:null,nodeName:"#document",nodeType:Nt,doctype:null,documentElement:null,_inc:1,insertBefore:d(function(e,t){if(e.nodeType===Ze){for(var n=e.firstChild;n;){var r=n.nextSibling;this.insertBefore(n,t),n=r;}return e}return Fn(this,e,t),e.ownerDocument=this,this.documentElement===null&&e.nodeType===Se&&(this.documentElement=e),e},"insertBefore"),removeChild:d(function(e){var t=Ki(this,e);return t===this.documentElement&&(this.documentElement=null),t},"removeChild"),replaceChild:d(function(e,t){Fn(this,e,t,to),e.ownerDocument=this,t&&this.removeChild(t),We(e)&&(this.documentElement=e);},"replaceChild"),importNode:d(function(e,t){return Pu(this,e,t)},"importNode"),getElementById:d(function(e){var t=null;return Rn(this.documentElement,function(n){if(n.nodeType==Se&&n.getAttribute("id")==e)return t=n,true}),t},"getElementById"),createElement:d(function(e){var t=new Ve(_e);t.ownerDocument=this,this.type==="html"&&(e=e.toLowerCase()),gu(this.contentType)&&(t.namespaceURI=Ue.HTML),t.nodeName=e,t.tagName=e,t.localName=e,t.childNodes=new ae;var n=t.attributes=new Tt;return n._ownerElement=t,t},"createElement"),createDocumentFragment:d(function(){var e=new It(_e);return e.ownerDocument=this,e.childNodes=new ae,e},"createDocumentFragment"),createTextNode:d(function(e){var t=new hn(_e);return t.ownerDocument=this,t.childNodes=new ae,t.appendData(e),t},"createTextNode"),createComment:d(function(e){var t=new $n(_e);return t.ownerDocument=this,t.childNodes=new ae,t.appendData(e),t},"createComment"),createCDATASection:d(function(e){if(e.indexOf("]]>")!==-1)throw new L(L.INVALID_CHARACTER_ERR,'data contains "]]>"');var t=new Un(_e);return t.ownerDocument=this,t.childNodes=new ae,t.appendData(e),t},"createCDATASection"),createProcessingInstruction:d(function(e,t){var n=new zn(_e);return n.ownerDocument=this,n.childNodes=new ae,n.nodeName=n.target=e,n.nodeValue=n.data=t,n},"createProcessingInstruction"),createAttribute:d(function(e){if(!de.QName_exact.test(e))throw new L(L.INVALID_CHARACTER_ERR,'invalid character in name "'+e+'"');return this.type==="html"&&(e=e.toLowerCase()),this._createAttribute(e)},"createAttribute"),_createAttribute:d(function(e){var t=new ct(_e);return t.ownerDocument=this,t.childNodes=new ae,t.name=e,t.nodeName=e,t.localName=e,t.specified=true,t},"_createAttribute"),createEntityReference:d(function(e){if(!de.Name.test(e))throw new L(L.INVALID_CHARACTER_ERR,'not a valid xml name "'+e+'"');if(this.type==="html")throw new L("document is an html document",ke.NotSupportedError);var t=new jn(_e);return t.ownerDocument=this,t.childNodes=new ae,t.nodeName=e,t},"createEntityReference"),createElementNS:d(function(e,t){var n=Ir(e,t),r=new Ve(_e),o=r.attributes=new Tt;return r.childNodes=new ae,r.ownerDocument=this,r.nodeName=t,r.tagName=t,r.namespaceURI=n[0],r.prefix=n[1],r.localName=n[2],o._ownerElement=r,r},"createElementNS"),createAttributeNS:d(function(e,t){var n=Ir(e,t),r=new ct(_e);return r.ownerDocument=this,r.childNodes=new ae,r.nodeName=t,r.name=t,r.specified=true,r.namespaceURI=n[0],r.prefix=n[1],r.localName=n[2],r},"createAttributeNS")};Ee(He,Y);function Ve(e){ye(e),this._nsMap=Object.create(null);}d(Ve,"Element");Ve.prototype={nodeType:Se,attributes:null,getQualifiedName:d(function(){return this.prefix?this.prefix+":"+this.localName:this.localName},"getQualifiedName"),_isInHTMLDocumentAndNamespace:d(function(){return this.ownerDocument.type==="html"&&this.namespaceURI===Ue.HTML},"_isInHTMLDocumentAndNamespace"),hasAttributes:d(function(){return !!(this.attributes&&this.attributes.length)},"hasAttributes"),hasAttribute:d(function(e){return !!this.getAttributeNode(e)},"hasAttribute"),getAttribute:d(function(e){var t=this.getAttributeNode(e);return t?t.value:null},"getAttribute"),getAttributeNode:d(function(e){return this._isInHTMLDocumentAndNamespace()&&(e=e.toLowerCase()),this.attributes.getNamedItem(e)},"getAttributeNode"),setAttribute:d(function(e,t){this._isInHTMLDocumentAndNamespace()&&(e=e.toLowerCase());var n=this.getAttributeNode(e);n?n.value=n.nodeValue=""+t:(n=this.ownerDocument._createAttribute(e),n.value=n.nodeValue=""+t,this.setAttributeNode(n));},"setAttribute"),removeAttribute:d(function(e){var t=this.getAttributeNode(e);t&&this.removeAttributeNode(t);},"removeAttribute"),setAttributeNode:d(function(e){return this.attributes.setNamedItem(e)},"setAttributeNode"),setAttributeNodeNS:d(function(e){return this.attributes.setNamedItemNS(e)},"setAttributeNodeNS"),removeAttributeNode:d(function(e){return this.attributes.removeNamedItem(e.nodeName)},"removeAttributeNode"),removeAttributeNS:d(function(e,t){var n=this.getAttributeNodeNS(e,t);n&&this.removeAttributeNode(n);},"removeAttributeNS"),hasAttributeNS:d(function(e,t){return this.getAttributeNodeNS(e,t)!=null},"hasAttributeNS"),getAttributeNS:d(function(e,t){var n=this.getAttributeNodeNS(e,t);return n?n.value:null},"getAttributeNS"),setAttributeNS:d(function(e,t,n){var r=Ir(e,t),o=r[2],i=this.getAttributeNodeNS(e,o);i?i.value=i.nodeValue=""+n:(i=this.ownerDocument.createAttributeNS(e,t),i.value=i.nodeValue=""+n,this.setAttributeNode(i));},"setAttributeNS"),getAttributeNodeNS:d(function(e,t){return this.attributes.getNamedItemNS(e,t)},"getAttributeNodeNS"),getElementsByClassName:d(function(e){var t=Bi(e);return new Le(this,function(n){var r=[];return t.length>0&&Rn(n,function(o){if(o!==n&&o.nodeType===Se){var i=o.getAttribute("class");if(i){var s=e===i;if(!s){var l=Bi(i);s=t.every(Au(l));}s&&r.push(o);}}}),r})},"getElementsByClassName"),getElementsByTagName:d(function(e){var t=(this.nodeType===Nt?this:this.ownerDocument).type==="html",n=e.toLowerCase();return new Le(this,function(r){var o=[];return Rn(r,function(i){if(!(i===r||i.nodeType!==Se))if(e==="*")o.push(i);else {var s=i.getQualifiedName(),l=t&&i.namespaceURI===Ue.HTML?n:e;s===l&&o.push(i);}}),o})},"getElementsByTagName"),getElementsByTagNameNS:d(function(e,t){return new Le(this,function(n){var r=[];return Rn(n,function(o){o!==n&&o.nodeType===Se&&(e==="*"||o.namespaceURI===e)&&(t==="*"||o.localName==t)&&r.push(o);}),r})},"getElementsByTagNameNS")};He.prototype.getElementsByClassName=Ve.prototype.getElementsByClassName;He.prototype.getElementsByTagName=Ve.prototype.getElementsByTagName;He.prototype.getElementsByTagNameNS=Ve.prototype.getElementsByTagNameNS;Ee(Ve,Y);function ct(e){ye(e),this.namespaceURI=null,this.prefix=null,this.ownerElement=null;}d(ct,"Attr");ct.prototype.nodeType=Ct;Ee(ct,Y);function St(e){ye(e);}d(St,"CharacterData");St.prototype={data:"",substringData:d(function(e,t){return this.data.substring(e,e+t)},"substringData"),appendData:d(function(e){e=this.data+e,this.nodeValue=this.data=e,this.length=e.length;},"appendData"),insertData:d(function(e,t){this.replaceData(e,0,t);},"insertData"),deleteData:d(function(e,t){this.replaceData(e,t,"");},"deleteData"),replaceData:d(function(e,t,n){var r=this.data.substring(0,e),o=this.data.substring(e+t);n=r+n+o,this.nodeValue=this.data=n,this.length=n.length;},"replaceData")};Ee(St,Y);function hn(e){ye(e);}d(hn,"Text");hn.prototype={nodeName:"#text",nodeType:Bn,splitText:d(function(e){var t=this.data,n=t.substring(e);t=t.substring(0,e),this.data=this.nodeValue=t,this.length=t.length;var r=this.ownerDocument.createTextNode(n);return this.parentNode&&this.parentNode.insertBefore(r,this.nextSibling),r},"splitText")};Ee(hn,St);function $n(e){ye(e);}d($n,"Comment");$n.prototype={nodeName:"#comment",nodeType:Pr};Ee($n,St);function Un(e){ye(e);}d(Un,"CDATASection");Un.prototype={nodeName:"#cdata-section",nodeType:Wi};Ee(Un,hn);function qn(e){ye(e);}d(qn,"DocumentType");qn.prototype.nodeType=Vi;Ee(qn,Y);function Mr(e){ye(e);}d(Mr,"Notation");Mr.prototype.nodeType=xu;Ee(Mr,Y);function Rr(e){ye(e);}d(Rr,"Entity");Rr.prototype.nodeType=Nu;Ee(Rr,Y);function jn(e){ye(e);}d(jn,"EntityReference");jn.prototype.nodeType=Hi;Ee(jn,Y);function It(e){ye(e);}d(It,"DocumentFragment");It.prototype.nodeName="#document-fragment";It.prototype.nodeType=Ze;Ee(It,Y);function zn(e){ye(e);}d(zn,"ProcessingInstruction");zn.prototype.nodeType=Or;Ee(zn,St);function no(){}d(no,"XMLSerializer");no.prototype.serializeToString=function(e,t){return ro.call(e,t)};Y.prototype.toString=ro;function ro(e){var t;typeof e=="function"?t={requireWellFormed:false,splitCDATASections:true,nodeFilter:e}:e!=null?t={requireWellFormed:!!e.requireWellFormed,splitCDATASections:e.splitCDATASections!==false,nodeFilter:e.nodeFilter||null}:t={requireWellFormed:false,splitCDATASections:true,nodeFilter:null};var n=[],r=this.nodeType===Nt&&this.documentElement||this,o=r.prefix,i=r.namespaceURI;if(i&&o==null){var o=r.lookupPrefix(i);if(o==null)var s=[{namespace:i,prefix:null}];}return Br(this,n,s,t),n.join("")}d(ro,"nodeSerializeToString");function qi(e,t,n){var r=e.prefix||"",o=e.namespaceURI;if(!o||r==="xml"&&o===Ue.XML||o===Ue.XMLNS)return false;for(var i=n.length;i--;){var s=n[i];if(s.prefix===r)return s.namespace!==o}return true}d(qi,"needNamespaceDefine");function Mn(e,t,n){e.push(" ",t,'="',n.replace(/[<>&"\t\n\r]/g,Qi),'"');}d(Mn,"addSerializedAttribute");function Br(e,t,n,r){n||(n=[]);var o=r.nodeFilter,i=r.requireWellFormed,s=r.splitCDATASections,l=e.nodeType===Nt?e:e.ownerDocument,a=l.type==="html";he(e,{ns:n},{enter:d(function(u,c){var f=c.ns;if(o)if(u=o(u),u){if(typeof u=="string")return t.push(u),null}else return null;switch(u.nodeType){case Se:var h=u.attributes,p=h.length,_=u.tagName,m=_;if(!a&&!u.prefix&&u.namespaceURI){for(var g,v=0;v<h.length;v++)if(h.item(v).name==="xmlns"){g=h.item(v).value;break}if(!g)for(var E=f.length-1;E>=0;E--){var y=f[E];if(y.prefix===""&&y.namespace===u.namespaceURI){g=y.namespace;break}}if(g!==u.namespaceURI)for(var E=f.length-1;E>=0;E--){var y=f[E];if(y.namespace===u.namespaceURI){y.prefix&&(m=y.prefix+":"+_);break}}}t.push("<",m);for(var w=f.slice(),b=0;b<p;b++){var D=h.item(b);D.prefix=="xmlns"?w.push({prefix:D.localName,namespace:D.value}):D.nodeName=="xmlns"&&w.push({prefix:"",namespace:D.value});}for(var b=0;b<p;b++){var D=h.item(b);if(qi(D,a,w)){var A=D.prefix||"",x=D.namespaceURI;Mn(t,A?"xmlns:"+A:"xmlns",x),w.push({prefix:A,namespace:x});}var N=o?o(D):D;N&&(typeof N=="string"?t.push(N):Mn(t,N.name,N.value));}if(_===m&&qi(u,a,w)){var T=u.prefix||"",x=u.namespaceURI;Mn(t,T?"xmlns:"+T:"xmlns",x),w.push({prefix:T,namespace:x});}var k=!u.firstChild;if(k&&(a||u.namespaceURI===Ue.HTML)&&(k=yu(_)),k)return t.push("/>"),null;if(t.push(">"),a&&vu(_)){for(var P=u.firstChild;P;)P.data?t.push(P.data):Br(P,t,w.slice(),r),P=P.nextSibling;return t.push("</",m,">"),null}return {ns:w,tag:m};case Nt:case Ze:if(i&&u.nodeType===Nt&&u.documentElement==null)throw new L("The Document has no documentElement",ke.InvalidStateError);return {ns:f};case Ct:return Mn(t,u.name,u.value),null;case Bn:if(i&&de.InvalidChar.test(u.data))throw new L("The Text node data contains characters outside the XML Char production",ke.InvalidStateError);return t.push(u.data.replace(/[<&>]/g,Qi)),null;case Wi:if(i&&u.data.indexOf("]]>")!==-1)throw new L('The CDATASection data contains "]]>"',ke.InvalidStateError);return s?t.push(de.CDATA_START,u.data.replace(/]]>/g,"]]]]><![CDATA[>"),de.CDATA_END):t.push(de.CDATA_START,u.data,de.CDATA_END),null;case Pr:if(i){if(de.InvalidChar.test(u.data))throw new L("The comment node data contains characters outside the XML Char production",ke.InvalidStateError);if(u.data.indexOf("--")!==-1||u.data[u.data.length-1]==="-")throw new L('The comment node data contains "--" or ends with "-"',ke.InvalidStateError)}return t.push(de.COMMENT_START,u.data,de.COMMENT_END),null;case Vi:var O=u.publicId,C=u.systemId;if(i){if(O&&!de.PubidLiteral_match.test(O))throw new L("DocumentType publicId is not a valid PubidLiteral",ke.InvalidStateError);if(C&&C!=="."&&!de.SystemLiteral_match.test(C))throw new L("DocumentType systemId is not a valid SystemLiteral",ke.InvalidStateError);if(u.internalSubset&&u.internalSubset.indexOf("]>")!==-1)throw new L('DocumentType internalSubset contains "]>"',ke.InvalidStateError)}return t.push(de.DOCTYPE_DECL_START," ",u.name),O?(t.push(" ",de.PUBLIC," ",O),C&&C!=="."&&t.push(" ",C)):C&&C!=="."&&t.push(" ",de.SYSTEM," ",C),u.internalSubset&&t.push(" [",u.internalSubset,"]"),t.push(">"),null;case Or:if(i){if(u.target.indexOf(":")!==-1||u.target.toLowerCase()==="xml")throw new L("The ProcessingInstruction target is not well-formed",ke.InvalidStateError);if(de.InvalidChar.test(u.data))throw new L("The ProcessingInstruction data contains characters outside the XML Char production",ke.InvalidStateError);if(u.data.indexOf("?>")!==-1)throw new L('The ProcessingInstruction data contains "?>"',ke.InvalidStateError)}return t.push("<?",u.target," ",u.data,"?>"),null;case Hi:return t.push("&",u.nodeName,";"),null;default:return t.push("??",u.nodeName),null}},"enter"),exit:d(function(u,c){c&&c.tag&&t.push("</",c.tag,">");},"exit")});}d(Br,"serializeToString");function Pu(e,t,n){var r;return he(t,null,{enter:d(function(o,i){var s=o.cloneNode(false);s.ownerDocument=e,s.parentNode=null,i===null?r=s:i.appendChild(s);var l=o.nodeType===Ct||n;return l?s:null},"enter")}),r}d(Pu,"importNode");function io(e,t,n){var r;return he(t,null,{enter:d(function(o,i){var s=new o.constructor(_e);for(var l in o)if(xt(o,l)){var a=o[l];typeof a!="object"&&a!=s[l]&&(s[l]=a);}o.childNodes&&(s.childNodes=new ae),s.ownerDocument=e;var u=n;switch(s.nodeType){case Se:var c=o.attributes,f=s.attributes=new Tt,h=c.length;f._ownerElement=s;for(var p=0;p<h;p++)s.setAttributeNode(io(e,c.item(p),true));break;case Ct:u=true;}return i!==null?i.appendChild(s):r=s,u?s:null},"enter")}),r}d(io,"cloneNode");function oo(e,t,n){e[t]=n;}d(oo,"__set__");function Sr(e){for(var t=[],n=e.firstChild;n;)n.nodeType===Se&&t.push(n),n=n.nextSibling;return t}d(Sr,"childrenRefresh");try{Object.defineProperty&&(Object.defineProperty(Le.prototype,"length",{get:d(function(){return Ln(this),this.$$length},"get")}),Object.defineProperty(Y.prototype,"textContent",{get:d(function(){if(this.nodeType===Se||this.nodeType===Ze){var e=[];return he(this,null,{enter:d(function(t){if(t.nodeType===Se||t.nodeType===Ze)return !0;if(t.nodeType===Or||t.nodeType===Pr)return null;e.push(t.nodeValue);},"enter")}),e.join("")}return this.nodeValue},"get"),set:d(function(e){switch(this.nodeType){case Se:case Ze:for(;this.firstChild;)this.removeChild(this.firstChild);(e||String(e))&&this.appendChild(this.ownerDocument.createTextNode(e));break;default:this.data=e,this.value=e,this.nodeValue=e;}},"set")}),Object.defineProperty(Ve.prototype,"children",{get:d(function(){return new Le(this,Sr)},"get")}),Object.defineProperty(He.prototype,"children",{get:d(function(){return new Le(this,Sr)},"get")}),Object.defineProperty(It.prototype,"children",{get:d(function(){return new Le(this,Sr)},"get")}),oo=d(function(e,t,n){e["$$"+t]=n;},"__set__"));}catch{}se._updateLiveList=Ln;se.Attr=ct;se.CDATASection=Un;se.CharacterData=St;se.Comment=$n;se.Document=He;se.DocumentFragment=It;se.DocumentType=qn;se.DOMImplementation=Xi;se.Element=Ve;se.Entity=Rr;se.EntityReference=jn;se.LiveNodeList=Le;se.NamedNodeMap=Tt;se.Node=Y;se.NodeList=ae;se.Notation=Mr;se.Text=hn;se.ProcessingInstruction=zn;se.walkDOM=he;se.XMLSerializer=no;});var ao=Re(pn=>{var so=lt().freeze;pn.XML_ENTITIES=so({amp:"&",apos:"'",gt:">",lt:"<",quot:'"'});pn.HTML_ENTITIES=so({Aacute:"\xC1",aacute:"\xE1",Abreve:"\u0102",abreve:"\u0103",ac:"\u223E",acd:"\u223F",acE:"\u223E\u0333",Acirc:"\xC2",acirc:"\xE2",acute:"\xB4",Acy:"\u0410",acy:"\u0430",AElig:"\xC6",aelig:"\xE6",af:"\u2061",Afr:"\u{1D504}",afr:"\u{1D51E}",Agrave:"\xC0",agrave:"\xE0",alefsym:"\u2135",aleph:"\u2135",Alpha:"\u0391",alpha:"\u03B1",Amacr:"\u0100",amacr:"\u0101",amalg:"\u2A3F",AMP:"&",amp:"&",And:"\u2A53",and:"\u2227",andand:"\u2A55",andd:"\u2A5C",andslope:"\u2A58",andv:"\u2A5A",ang:"\u2220",ange:"\u29A4",angle:"\u2220",angmsd:"\u2221",angmsdaa:"\u29A8",angmsdab:"\u29A9",angmsdac:"\u29AA",angmsdad:"\u29AB",angmsdae:"\u29AC",angmsdaf:"\u29AD",angmsdag:"\u29AE",angmsdah:"\u29AF",angrt:"\u221F",angrtvb:"\u22BE",angrtvbd:"\u299D",angsph:"\u2222",angst:"\xC5",angzarr:"\u237C",Aogon:"\u0104",aogon:"\u0105",Aopf:"\u{1D538}",aopf:"\u{1D552}",ap:"\u2248",apacir:"\u2A6F",apE:"\u2A70",ape:"\u224A",apid:"\u224B",apos:"'",ApplyFunction:"\u2061",approx:"\u2248",approxeq:"\u224A",Aring:"\xC5",aring:"\xE5",Ascr:"\u{1D49C}",ascr:"\u{1D4B6}",Assign:"\u2254",ast:"*",asymp:"\u2248",asympeq:"\u224D",Atilde:"\xC3",atilde:"\xE3",Auml:"\xC4",auml:"\xE4",awconint:"\u2233",awint:"\u2A11",backcong:"\u224C",backepsilon:"\u03F6",backprime:"\u2035",backsim:"\u223D",backsimeq:"\u22CD",Backslash:"\u2216",Barv:"\u2AE7",barvee:"\u22BD",Barwed:"\u2306",barwed:"\u2305",barwedge:"\u2305",bbrk:"\u23B5",bbrktbrk:"\u23B6",bcong:"\u224C",Bcy:"\u0411",bcy:"\u0431",bdquo:"\u201E",becaus:"\u2235",Because:"\u2235",because:"\u2235",bemptyv:"\u29B0",bepsi:"\u03F6",bernou:"\u212C",Bernoullis:"\u212C",Beta:"\u0392",beta:"\u03B2",beth:"\u2136",between:"\u226C",Bfr:"\u{1D505}",bfr:"\u{1D51F}",bigcap:"\u22C2",bigcirc:"\u25EF",bigcup:"\u22C3",bigodot:"\u2A00",bigoplus:"\u2A01",bigotimes:"\u2A02",bigsqcup:"\u2A06",bigstar:"\u2605",bigtriangledown:"\u25BD",bigtriangleup:"\u25B3",biguplus:"\u2A04",bigvee:"\u22C1",bigwedge:"\u22C0",bkarow:"\u290D",blacklozenge:"\u29EB",blacksquare:"\u25AA",blacktriangle:"\u25B4",blacktriangledown:"\u25BE",blacktriangleleft:"\u25C2",blacktriangleright:"\u25B8",blank:"\u2423",blk12:"\u2592",blk14:"\u2591",blk34:"\u2593",block:"\u2588",bne:"=\u20E5",bnequiv:"\u2261\u20E5",bNot:"\u2AED",bnot:"\u2310",Bopf:"\u{1D539}",bopf:"\u{1D553}",bot:"\u22A5",bottom:"\u22A5",bowtie:"\u22C8",boxbox:"\u29C9",boxDL:"\u2557",boxDl:"\u2556",boxdL:"\u2555",boxdl:"\u2510",boxDR:"\u2554",boxDr:"\u2553",boxdR:"\u2552",boxdr:"\u250C",boxH:"\u2550",boxh:"\u2500",boxHD:"\u2566",boxHd:"\u2564",boxhD:"\u2565",boxhd:"\u252C",boxHU:"\u2569",boxHu:"\u2567",boxhU:"\u2568",boxhu:"\u2534",boxminus:"\u229F",boxplus:"\u229E",boxtimes:"\u22A0",boxUL:"\u255D",boxUl:"\u255C",boxuL:"\u255B",boxul:"\u2518",boxUR:"\u255A",boxUr:"\u2559",boxuR:"\u2558",boxur:"\u2514",boxV:"\u2551",boxv:"\u2502",boxVH:"\u256C",boxVh:"\u256B",boxvH:"\u256A",boxvh:"\u253C",boxVL:"\u2563",boxVl:"\u2562",boxvL:"\u2561",boxvl:"\u2524",boxVR:"\u2560",boxVr:"\u255F",boxvR:"\u255E",boxvr:"\u251C",bprime:"\u2035",Breve:"\u02D8",breve:"\u02D8",brvbar:"\xA6",Bscr:"\u212C",bscr:"\u{1D4B7}",bsemi:"\u204F",bsim:"\u223D",bsime:"\u22CD",bsol:"\\",bsolb:"\u29C5",bsolhsub:"\u27C8",bull:"\u2022",bullet:"\u2022",bump:"\u224E",bumpE:"\u2AAE",bumpe:"\u224F",Bumpeq:"\u224E",bumpeq:"\u224F",Cacute:"\u0106",cacute:"\u0107",Cap:"\u22D2",cap:"\u2229",capand:"\u2A44",capbrcup:"\u2A49",capcap:"\u2A4B",capcup:"\u2A47",capdot:"\u2A40",CapitalDifferentialD:"\u2145",caps:"\u2229\uFE00",caret:"\u2041",caron:"\u02C7",Cayleys:"\u212D",ccaps:"\u2A4D",Ccaron:"\u010C",ccaron:"\u010D",Ccedil:"\xC7",ccedil:"\xE7",Ccirc:"\u0108",ccirc:"\u0109",Cconint:"\u2230",ccups:"\u2A4C",ccupssm:"\u2A50",Cdot:"\u010A",cdot:"\u010B",cedil:"\xB8",Cedilla:"\xB8",cemptyv:"\u29B2",cent:"\xA2",CenterDot:"\xB7",centerdot:"\xB7",Cfr:"\u212D",cfr:"\u{1D520}",CHcy:"\u0427",chcy:"\u0447",check:"\u2713",checkmark:"\u2713",Chi:"\u03A7",chi:"\u03C7",cir:"\u25CB",circ:"\u02C6",circeq:"\u2257",circlearrowleft:"\u21BA",circlearrowright:"\u21BB",circledast:"\u229B",circledcirc:"\u229A",circleddash:"\u229D",CircleDot:"\u2299",circledR:"\xAE",circledS:"\u24C8",CircleMinus:"\u2296",CirclePlus:"\u2295",CircleTimes:"\u2297",cirE:"\u29C3",cire:"\u2257",cirfnint:"\u2A10",cirmid:"\u2AEF",cirscir:"\u29C2",ClockwiseContourIntegral:"\u2232",CloseCurlyDoubleQuote:"\u201D",CloseCurlyQuote:"\u2019",clubs:"\u2663",clubsuit:"\u2663",Colon:"\u2237",colon:":",Colone:"\u2A74",colone:"\u2254",coloneq:"\u2254",comma:",",commat:"@",comp:"\u2201",compfn:"\u2218",complement:"\u2201",complexes:"\u2102",cong:"\u2245",congdot:"\u2A6D",Congruent:"\u2261",Conint:"\u222F",conint:"\u222E",ContourIntegral:"\u222E",Copf:"\u2102",copf:"\u{1D554}",coprod:"\u2210",Coproduct:"\u2210",COPY:"\xA9",copy:"\xA9",copysr:"\u2117",CounterClockwiseContourIntegral:"\u2233",crarr:"\u21B5",Cross:"\u2A2F",cross:"\u2717",Cscr:"\u{1D49E}",cscr:"\u{1D4B8}",csub:"\u2ACF",csube:"\u2AD1",csup:"\u2AD0",csupe:"\u2AD2",ctdot:"\u22EF",cudarrl:"\u2938",cudarrr:"\u2935",cuepr:"\u22DE",cuesc:"\u22DF",cularr:"\u21B6",cularrp:"\u293D",Cup:"\u22D3",cup:"\u222A",cupbrcap:"\u2A48",CupCap:"\u224D",cupcap:"\u2A46",cupcup:"\u2A4A",cupdot:"\u228D",cupor:"\u2A45",cups:"\u222A\uFE00",curarr:"\u21B7",curarrm:"\u293C",curlyeqprec:"\u22DE",curlyeqsucc:"\u22DF",curlyvee:"\u22CE",curlywedge:"\u22CF",curren:"\xA4",curvearrowleft:"\u21B6",curvearrowright:"\u21B7",cuvee:"\u22CE",cuwed:"\u22CF",cwconint:"\u2232",cwint:"\u2231",cylcty:"\u232D",Dagger:"\u2021",dagger:"\u2020",daleth:"\u2138",Darr:"\u21A1",dArr:"\u21D3",darr:"\u2193",dash:"\u2010",Dashv:"\u2AE4",dashv:"\u22A3",dbkarow:"\u290F",dblac:"\u02DD",Dcaron:"\u010E",dcaron:"\u010F",Dcy:"\u0414",dcy:"\u0434",DD:"\u2145",dd:"\u2146",ddagger:"\u2021",ddarr:"\u21CA",DDotrahd:"\u2911",ddotseq:"\u2A77",deg:"\xB0",Del:"\u2207",Delta:"\u0394",delta:"\u03B4",demptyv:"\u29B1",dfisht:"\u297F",Dfr:"\u{1D507}",dfr:"\u{1D521}",dHar:"\u2965",dharl:"\u21C3",dharr:"\u21C2",DiacriticalAcute:"\xB4",DiacriticalDot:"\u02D9",DiacriticalDoubleAcute:"\u02DD",DiacriticalGrave:"`",DiacriticalTilde:"\u02DC",diam:"\u22C4",Diamond:"\u22C4",diamond:"\u22C4",diamondsuit:"\u2666",diams:"\u2666",die:"\xA8",DifferentialD:"\u2146",digamma:"\u03DD",disin:"\u22F2",div:"\xF7",divide:"\xF7",divideontimes:"\u22C7",divonx:"\u22C7",DJcy:"\u0402",djcy:"\u0452",dlcorn:"\u231E",dlcrop:"\u230D",dollar:"$",Dopf:"\u{1D53B}",dopf:"\u{1D555}",Dot:"\xA8",dot:"\u02D9",DotDot:"\u20DC",doteq:"\u2250",doteqdot:"\u2251",DotEqual:"\u2250",dotminus:"\u2238",dotplus:"\u2214",dotsquare:"\u22A1",doublebarwedge:"\u2306",DoubleContourIntegral:"\u222F",DoubleDot:"\xA8",DoubleDownArrow:"\u21D3",DoubleLeftArrow:"\u21D0",DoubleLeftRightArrow:"\u21D4",DoubleLeftTee:"\u2AE4",DoubleLongLeftArrow:"\u27F8",DoubleLongLeftRightArrow:"\u27FA",DoubleLongRightArrow:"\u27F9",DoubleRightArrow:"\u21D2",DoubleRightTee:"\u22A8",DoubleUpArrow:"\u21D1",DoubleUpDownArrow:"\u21D5",DoubleVerticalBar:"\u2225",DownArrow:"\u2193",Downarrow:"\u21D3",downarrow:"\u2193",DownArrowBar:"\u2913",DownArrowUpArrow:"\u21F5",DownBreve:"\u0311",downdownarrows:"\u21CA",downharpoonleft:"\u21C3",downharpoonright:"\u21C2",DownLeftRightVector:"\u2950",DownLeftTeeVector:"\u295E",DownLeftVector:"\u21BD",DownLeftVectorBar:"\u2956",DownRightTeeVector:"\u295F",DownRightVector:"\u21C1",DownRightVectorBar:"\u2957",DownTee:"\u22A4",DownTeeArrow:"\u21A7",drbkarow:"\u2910",drcorn:"\u231F",drcrop:"\u230C",Dscr:"\u{1D49F}",dscr:"\u{1D4B9}",DScy:"\u0405",dscy:"\u0455",dsol:"\u29F6",Dstrok:"\u0110",dstrok:"\u0111",dtdot:"\u22F1",dtri:"\u25BF",dtrif:"\u25BE",duarr:"\u21F5",duhar:"\u296F",dwangle:"\u29A6",DZcy:"\u040F",dzcy:"\u045F",dzigrarr:"\u27FF",Eacute:"\xC9",eacute:"\xE9",easter:"\u2A6E",Ecaron:"\u011A",ecaron:"\u011B",ecir:"\u2256",Ecirc:"\xCA",ecirc:"\xEA",ecolon:"\u2255",Ecy:"\u042D",ecy:"\u044D",eDDot:"\u2A77",Edot:"\u0116",eDot:"\u2251",edot:"\u0117",ee:"\u2147",efDot:"\u2252",Efr:"\u{1D508}",efr:"\u{1D522}",eg:"\u2A9A",Egrave:"\xC8",egrave:"\xE8",egs:"\u2A96",egsdot:"\u2A98",el:"\u2A99",Element:"\u2208",elinters:"\u23E7",ell:"\u2113",els:"\u2A95",elsdot:"\u2A97",Emacr:"\u0112",emacr:"\u0113",empty:"\u2205",emptyset:"\u2205",EmptySmallSquare:"\u25FB",emptyv:"\u2205",EmptyVerySmallSquare:"\u25AB",emsp:"\u2003",emsp13:"\u2004",emsp14:"\u2005",ENG:"\u014A",eng:"\u014B",ensp:"\u2002",Eogon:"\u0118",eogon:"\u0119",Eopf:"\u{1D53C}",eopf:"\u{1D556}",epar:"\u22D5",eparsl:"\u29E3",eplus:"\u2A71",epsi:"\u03B5",Epsilon:"\u0395",epsilon:"\u03B5",epsiv:"\u03F5",eqcirc:"\u2256",eqcolon:"\u2255",eqsim:"\u2242",eqslantgtr:"\u2A96",eqslantless:"\u2A95",Equal:"\u2A75",equals:"=",EqualTilde:"\u2242",equest:"\u225F",Equilibrium:"\u21CC",equiv:"\u2261",equivDD:"\u2A78",eqvparsl:"\u29E5",erarr:"\u2971",erDot:"\u2253",Escr:"\u2130",escr:"\u212F",esdot:"\u2250",Esim:"\u2A73",esim:"\u2242",Eta:"\u0397",eta:"\u03B7",ETH:"\xD0",eth:"\xF0",Euml:"\xCB",euml:"\xEB",euro:"\u20AC",excl:"!",exist:"\u2203",Exists:"\u2203",expectation:"\u2130",ExponentialE:"\u2147",exponentiale:"\u2147",fallingdotseq:"\u2252",Fcy:"\u0424",fcy:"\u0444",female:"\u2640",ffilig:"\uFB03",fflig:"\uFB00",ffllig:"\uFB04",Ffr:"\u{1D509}",ffr:"\u{1D523}",filig:"\uFB01",FilledSmallSquare:"\u25FC",FilledVerySmallSquare:"\u25AA",fjlig:"fj",flat:"\u266D",fllig:"\uFB02",fltns:"\u25B1",fnof:"\u0192",Fopf:"\u{1D53D}",fopf:"\u{1D557}",ForAll:"\u2200",forall:"\u2200",fork:"\u22D4",forkv:"\u2AD9",Fouriertrf:"\u2131",fpartint:"\u2A0D",frac12:"\xBD",frac13:"\u2153",frac14:"\xBC",frac15:"\u2155",frac16:"\u2159",frac18:"\u215B",frac23:"\u2154",frac25:"\u2156",frac34:"\xBE",frac35:"\u2157",frac38:"\u215C",frac45:"\u2158",frac56:"\u215A",frac58:"\u215D",frac78:"\u215E",frasl:"\u2044",frown:"\u2322",Fscr:"\u2131",fscr:"\u{1D4BB}",gacute:"\u01F5",Gamma:"\u0393",gamma:"\u03B3",Gammad:"\u03DC",gammad:"\u03DD",gap:"\u2A86",Gbreve:"\u011E",gbreve:"\u011F",Gcedil:"\u0122",Gcirc:"\u011C",gcirc:"\u011D",Gcy:"\u0413",gcy:"\u0433",Gdot:"\u0120",gdot:"\u0121",gE:"\u2267",ge:"\u2265",gEl:"\u2A8C",gel:"\u22DB",geq:"\u2265",geqq:"\u2267",geqslant:"\u2A7E",ges:"\u2A7E",gescc:"\u2AA9",gesdot:"\u2A80",gesdoto:"\u2A82",gesdotol:"\u2A84",gesl:"\u22DB\uFE00",gesles:"\u2A94",Gfr:"\u{1D50A}",gfr:"\u{1D524}",Gg:"\u22D9",gg:"\u226B",ggg:"\u22D9",gimel:"\u2137",GJcy:"\u0403",gjcy:"\u0453",gl:"\u2277",gla:"\u2AA5",glE:"\u2A92",glj:"\u2AA4",gnap:"\u2A8A",gnapprox:"\u2A8A",gnE:"\u2269",gne:"\u2A88",gneq:"\u2A88",gneqq:"\u2269",gnsim:"\u22E7",Gopf:"\u{1D53E}",gopf:"\u{1D558}",grave:"`",GreaterEqual:"\u2265",GreaterEqualLess:"\u22DB",GreaterFullEqual:"\u2267",GreaterGreater:"\u2AA2",GreaterLess:"\u2277",GreaterSlantEqual:"\u2A7E",GreaterTilde:"\u2273",Gscr:"\u{1D4A2}",gscr:"\u210A",gsim:"\u2273",gsime:"\u2A8E",gsiml:"\u2A90",Gt:"\u226B",GT:">",gt:">",gtcc:"\u2AA7",gtcir:"\u2A7A",gtdot:"\u22D7",gtlPar:"\u2995",gtquest:"\u2A7C",gtrapprox:"\u2A86",gtrarr:"\u2978",gtrdot:"\u22D7",gtreqless:"\u22DB",gtreqqless:"\u2A8C",gtrless:"\u2277",gtrsim:"\u2273",gvertneqq:"\u2269\uFE00",gvnE:"\u2269\uFE00",Hacek:"\u02C7",hairsp:"\u200A",half:"\xBD",hamilt:"\u210B",HARDcy:"\u042A",hardcy:"\u044A",hArr:"\u21D4",harr:"\u2194",harrcir:"\u2948",harrw:"\u21AD",Hat:"^",hbar:"\u210F",Hcirc:"\u0124",hcirc:"\u0125",hearts:"\u2665",heartsuit:"\u2665",hellip:"\u2026",hercon:"\u22B9",Hfr:"\u210C",hfr:"\u{1D525}",HilbertSpace:"\u210B",hksearow:"\u2925",hkswarow:"\u2926",hoarr:"\u21FF",homtht:"\u223B",hookleftarrow:"\u21A9",hookrightarrow:"\u21AA",Hopf:"\u210D",hopf:"\u{1D559}",horbar:"\u2015",HorizontalLine:"\u2500",Hscr:"\u210B",hscr:"\u{1D4BD}",hslash:"\u210F",Hstrok:"\u0126",hstrok:"\u0127",HumpDownHump:"\u224E",HumpEqual:"\u224F",hybull:"\u2043",hyphen:"\u2010",Iacute:"\xCD",iacute:"\xED",ic:"\u2063",Icirc:"\xCE",icirc:"\xEE",Icy:"\u0418",icy:"\u0438",Idot:"\u0130",IEcy:"\u0415",iecy:"\u0435",iexcl:"\xA1",iff:"\u21D4",Ifr:"\u2111",ifr:"\u{1D526}",Igrave:"\xCC",igrave:"\xEC",ii:"\u2148",iiiint:"\u2A0C",iiint:"\u222D",iinfin:"\u29DC",iiota:"\u2129",IJlig:"\u0132",ijlig:"\u0133",Im:"\u2111",Imacr:"\u012A",imacr:"\u012B",image:"\u2111",ImaginaryI:"\u2148",imagline:"\u2110",imagpart:"\u2111",imath:"\u0131",imof:"\u22B7",imped:"\u01B5",Implies:"\u21D2",in:"\u2208",incare:"\u2105",infin:"\u221E",infintie:"\u29DD",inodot:"\u0131",Int:"\u222C",int:"\u222B",intcal:"\u22BA",integers:"\u2124",Integral:"\u222B",intercal:"\u22BA",Intersection:"\u22C2",intlarhk:"\u2A17",intprod:"\u2A3C",InvisibleComma:"\u2063",InvisibleTimes:"\u2062",IOcy:"\u0401",iocy:"\u0451",Iogon:"\u012E",iogon:"\u012F",Iopf:"\u{1D540}",iopf:"\u{1D55A}",Iota:"\u0399",iota:"\u03B9",iprod:"\u2A3C",iquest:"\xBF",Iscr:"\u2110",iscr:"\u{1D4BE}",isin:"\u2208",isindot:"\u22F5",isinE:"\u22F9",isins:"\u22F4",isinsv:"\u22F3",isinv:"\u2208",it:"\u2062",Itilde:"\u0128",itilde:"\u0129",Iukcy:"\u0406",iukcy:"\u0456",Iuml:"\xCF",iuml:"\xEF",Jcirc:"\u0134",jcirc:"\u0135",Jcy:"\u0419",jcy:"\u0439",Jfr:"\u{1D50D}",jfr:"\u{1D527}",jmath:"\u0237",Jopf:"\u{1D541}",jopf:"\u{1D55B}",Jscr:"\u{1D4A5}",jscr:"\u{1D4BF}",Jsercy:"\u0408",jsercy:"\u0458",Jukcy:"\u0404",jukcy:"\u0454",Kappa:"\u039A",kappa:"\u03BA",kappav:"\u03F0",Kcedil:"\u0136",kcedil:"\u0137",Kcy:"\u041A",kcy:"\u043A",Kfr:"\u{1D50E}",kfr:"\u{1D528}",kgreen:"\u0138",KHcy:"\u0425",khcy:"\u0445",KJcy:"\u040C",kjcy:"\u045C",Kopf:"\u{1D542}",kopf:"\u{1D55C}",Kscr:"\u{1D4A6}",kscr:"\u{1D4C0}",lAarr:"\u21DA",Lacute:"\u0139",lacute:"\u013A",laemptyv:"\u29B4",lagran:"\u2112",Lambda:"\u039B",lambda:"\u03BB",Lang:"\u27EA",lang:"\u27E8",langd:"\u2991",langle:"\u27E8",lap:"\u2A85",Laplacetrf:"\u2112",laquo:"\xAB",Larr:"\u219E",lArr:"\u21D0",larr:"\u2190",larrb:"\u21E4",larrbfs:"\u291F",larrfs:"\u291D",larrhk:"\u21A9",larrlp:"\u21AB",larrpl:"\u2939",larrsim:"\u2973",larrtl:"\u21A2",lat:"\u2AAB",lAtail:"\u291B",latail:"\u2919",late:"\u2AAD",lates:"\u2AAD\uFE00",lBarr:"\u290E",lbarr:"\u290C",lbbrk:"\u2772",lbrace:"{",lbrack:"[",lbrke:"\u298B",lbrksld:"\u298F",lbrkslu:"\u298D",Lcaron:"\u013D",lcaron:"\u013E",Lcedil:"\u013B",lcedil:"\u013C",lceil:"\u2308",lcub:"{",Lcy:"\u041B",lcy:"\u043B",ldca:"\u2936",ldquo:"\u201C",ldquor:"\u201E",ldrdhar:"\u2967",ldrushar:"\u294B",ldsh:"\u21B2",lE:"\u2266",le:"\u2264",LeftAngleBracket:"\u27E8",LeftArrow:"\u2190",Leftarrow:"\u21D0",leftarrow:"\u2190",LeftArrowBar:"\u21E4",LeftArrowRightArrow:"\u21C6",leftarrowtail:"\u21A2",LeftCeiling:"\u2308",LeftDoubleBracket:"\u27E6",LeftDownTeeVector:"\u2961",LeftDownVector:"\u21C3",LeftDownVectorBar:"\u2959",LeftFloor:"\u230A",leftharpoondown:"\u21BD",leftharpoonup:"\u21BC",leftleftarrows:"\u21C7",LeftRightArrow:"\u2194",Leftrightarrow:"\u21D4",leftrightarrow:"\u2194",leftrightarrows:"\u21C6",leftrightharpoons:"\u21CB",leftrightsquigarrow:"\u21AD",LeftRightVector:"\u294E",LeftTee:"\u22A3",LeftTeeArrow:"\u21A4",LeftTeeVector:"\u295A",leftthreetimes:"\u22CB",LeftTriangle:"\u22B2",LeftTriangleBar:"\u29CF",LeftTriangleEqual:"\u22B4",LeftUpDownVector:"\u2951",LeftUpTeeVector:"\u2960",LeftUpVector:"\u21BF",LeftUpVectorBar:"\u2958",LeftVector:"\u21BC",LeftVectorBar:"\u2952",lEg:"\u2A8B",leg:"\u22DA",leq:"\u2264",leqq:"\u2266",leqslant:"\u2A7D",les:"\u2A7D",lescc:"\u2AA8",lesdot:"\u2A7F",lesdoto:"\u2A81",lesdotor:"\u2A83",lesg:"\u22DA\uFE00",lesges:"\u2A93",lessapprox:"\u2A85",lessdot:"\u22D6",lesseqgtr:"\u22DA",lesseqqgtr:"\u2A8B",LessEqualGreater:"\u22DA",LessFullEqual:"\u2266",LessGreater:"\u2276",lessgtr:"\u2276",LessLess:"\u2AA1",lesssim:"\u2272",LessSlantEqual:"\u2A7D",LessTilde:"\u2272",lfisht:"\u297C",lfloor:"\u230A",Lfr:"\u{1D50F}",lfr:"\u{1D529}",lg:"\u2276",lgE:"\u2A91",lHar:"\u2962",lhard:"\u21BD",lharu:"\u21BC",lharul:"\u296A",lhblk:"\u2584",LJcy:"\u0409",ljcy:"\u0459",Ll:"\u22D8",ll:"\u226A",llarr:"\u21C7",llcorner:"\u231E",Lleftarrow:"\u21DA",llhard:"\u296B",lltri:"\u25FA",Lmidot:"\u013F",lmidot:"\u0140",lmoust:"\u23B0",lmoustache:"\u23B0",lnap:"\u2A89",lnapprox:"\u2A89",lnE:"\u2268",lne:"\u2A87",lneq:"\u2A87",lneqq:"\u2268",lnsim:"\u22E6",loang:"\u27EC",loarr:"\u21FD",lobrk:"\u27E6",LongLeftArrow:"\u27F5",Longleftarrow:"\u27F8",longleftarrow:"\u27F5",LongLeftRightArrow:"\u27F7",Longleftrightarrow:"\u27FA",longleftrightarrow:"\u27F7",longmapsto:"\u27FC",LongRightArrow:"\u27F6",Longrightarrow:"\u27F9",longrightarrow:"\u27F6",looparrowleft:"\u21AB",looparrowright:"\u21AC",lopar:"\u2985",Lopf:"\u{1D543}",lopf:"\u{1D55D}",loplus:"\u2A2D",lotimes:"\u2A34",lowast:"\u2217",lowbar:"_",LowerLeftArrow:"\u2199",LowerRightArrow:"\u2198",loz:"\u25CA",lozenge:"\u25CA",lozf:"\u29EB",lpar:"(",lparlt:"\u2993",lrarr:"\u21C6",lrcorner:"\u231F",lrhar:"\u21CB",lrhard:"\u296D",lrm:"\u200E",lrtri:"\u22BF",lsaquo:"\u2039",Lscr:"\u2112",lscr:"\u{1D4C1}",Lsh:"\u21B0",lsh:"\u21B0",lsim:"\u2272",lsime:"\u2A8D",lsimg:"\u2A8F",lsqb:"[",lsquo:"\u2018",lsquor:"\u201A",Lstrok:"\u0141",lstrok:"\u0142",Lt:"\u226A",LT:"<",lt:"<",ltcc:"\u2AA6",ltcir:"\u2A79",ltdot:"\u22D6",lthree:"\u22CB",ltimes:"\u22C9",ltlarr:"\u2976",ltquest:"\u2A7B",ltri:"\u25C3",ltrie:"\u22B4",ltrif:"\u25C2",ltrPar:"\u2996",lurdshar:"\u294A",luruhar:"\u2966",lvertneqq:"\u2268\uFE00",lvnE:"\u2268\uFE00",macr:"\xAF",male:"\u2642",malt:"\u2720",maltese:"\u2720",Map:"\u2905",map:"\u21A6",mapsto:"\u21A6",mapstodown:"\u21A7",mapstoleft:"\u21A4",mapstoup:"\u21A5",marker:"\u25AE",mcomma:"\u2A29",Mcy:"\u041C",mcy:"\u043C",mdash:"\u2014",mDDot:"\u223A",measuredangle:"\u2221",MediumSpace:"\u205F",Mellintrf:"\u2133",Mfr:"\u{1D510}",mfr:"\u{1D52A}",mho:"\u2127",micro:"\xB5",mid:"\u2223",midast:"*",midcir:"\u2AF0",middot:"\xB7",minus:"\u2212",minusb:"\u229F",minusd:"\u2238",minusdu:"\u2A2A",MinusPlus:"\u2213",mlcp:"\u2ADB",mldr:"\u2026",mnplus:"\u2213",models:"\u22A7",Mopf:"\u{1D544}",mopf:"\u{1D55E}",mp:"\u2213",Mscr:"\u2133",mscr:"\u{1D4C2}",mstpos:"\u223E",Mu:"\u039C",mu:"\u03BC",multimap:"\u22B8",mumap:"\u22B8",nabla:"\u2207",Nacute:"\u0143",nacute:"\u0144",nang:"\u2220\u20D2",nap:"\u2249",napE:"\u2A70\u0338",napid:"\u224B\u0338",napos:"\u0149",napprox:"\u2249",natur:"\u266E",natural:"\u266E",naturals:"\u2115",nbsp:"\xA0",nbump:"\u224E\u0338",nbumpe:"\u224F\u0338",ncap:"\u2A43",Ncaron:"\u0147",ncaron:"\u0148",Ncedil:"\u0145",ncedil:"\u0146",ncong:"\u2247",ncongdot:"\u2A6D\u0338",ncup:"\u2A42",Ncy:"\u041D",ncy:"\u043D",ndash:"\u2013",ne:"\u2260",nearhk:"\u2924",neArr:"\u21D7",nearr:"\u2197",nearrow:"\u2197",nedot:"\u2250\u0338",NegativeMediumSpace:"\u200B",NegativeThickSpace:"\u200B",NegativeThinSpace:"\u200B",NegativeVeryThinSpace:"\u200B",nequiv:"\u2262",nesear:"\u2928",nesim:"\u2242\u0338",NestedGreaterGreater:"\u226B",NestedLessLess:"\u226A",NewLine:`
|
|
2
|
-
`,nexist:"\u2204",nexists:"\u2204",Nfr:"\u{1D511}",nfr:"\u{1D52B}",ngE:"\u2267\u0338",nge:"\u2271",ngeq:"\u2271",ngeqq:"\u2267\u0338",ngeqslant:"\u2A7E\u0338",nges:"\u2A7E\u0338",nGg:"\u22D9\u0338",ngsim:"\u2275",nGt:"\u226B\u20D2",ngt:"\u226F",ngtr:"\u226F",nGtv:"\u226B\u0338",nhArr:"\u21CE",nharr:"\u21AE",nhpar:"\u2AF2",ni:"\u220B",nis:"\u22FC",nisd:"\u22FA",niv:"\u220B",NJcy:"\u040A",njcy:"\u045A",nlArr:"\u21CD",nlarr:"\u219A",nldr:"\u2025",nlE:"\u2266\u0338",nle:"\u2270",nLeftarrow:"\u21CD",nleftarrow:"\u219A",nLeftrightarrow:"\u21CE",nleftrightarrow:"\u21AE",nleq:"\u2270",nleqq:"\u2266\u0338",nleqslant:"\u2A7D\u0338",nles:"\u2A7D\u0338",nless:"\u226E",nLl:"\u22D8\u0338",nlsim:"\u2274",nLt:"\u226A\u20D2",nlt:"\u226E",nltri:"\u22EA",nltrie:"\u22EC",nLtv:"\u226A\u0338",nmid:"\u2224",NoBreak:"\u2060",NonBreakingSpace:"\xA0",Nopf:"\u2115",nopf:"\u{1D55F}",Not:"\u2AEC",not:"\xAC",NotCongruent:"\u2262",NotCupCap:"\u226D",NotDoubleVerticalBar:"\u2226",NotElement:"\u2209",NotEqual:"\u2260",NotEqualTilde:"\u2242\u0338",NotExists:"\u2204",NotGreater:"\u226F",NotGreaterEqual:"\u2271",NotGreaterFullEqual:"\u2267\u0338",NotGreaterGreater:"\u226B\u0338",NotGreaterLess:"\u2279",NotGreaterSlantEqual:"\u2A7E\u0338",NotGreaterTilde:"\u2275",NotHumpDownHump:"\u224E\u0338",NotHumpEqual:"\u224F\u0338",notin:"\u2209",notindot:"\u22F5\u0338",notinE:"\u22F9\u0338",notinva:"\u2209",notinvb:"\u22F7",notinvc:"\u22F6",NotLeftTriangle:"\u22EA",NotLeftTriangleBar:"\u29CF\u0338",NotLeftTriangleEqual:"\u22EC",NotLess:"\u226E",NotLessEqual:"\u2270",NotLessGreater:"\u2278",NotLessLess:"\u226A\u0338",NotLessSlantEqual:"\u2A7D\u0338",NotLessTilde:"\u2274",NotNestedGreaterGreater:"\u2AA2\u0338",NotNestedLessLess:"\u2AA1\u0338",notni:"\u220C",notniva:"\u220C",notnivb:"\u22FE",notnivc:"\u22FD",NotPrecedes:"\u2280",NotPrecedesEqual:"\u2AAF\u0338",NotPrecedesSlantEqual:"\u22E0",NotReverseElement:"\u220C",NotRightTriangle:"\u22EB",NotRightTriangleBar:"\u29D0\u0338",NotRightTriangleEqual:"\u22ED",NotSquareSubset:"\u228F\u0338",NotSquareSubsetEqual:"\u22E2",NotSquareSuperset:"\u2290\u0338",NotSquareSupersetEqual:"\u22E3",NotSubset:"\u2282\u20D2",NotSubsetEqual:"\u2288",NotSucceeds:"\u2281",NotSucceedsEqual:"\u2AB0\u0338",NotSucceedsSlantEqual:"\u22E1",NotSucceedsTilde:"\u227F\u0338",NotSuperset:"\u2283\u20D2",NotSupersetEqual:"\u2289",NotTilde:"\u2241",NotTildeEqual:"\u2244",NotTildeFullEqual:"\u2247",NotTildeTilde:"\u2249",NotVerticalBar:"\u2224",npar:"\u2226",nparallel:"\u2226",nparsl:"\u2AFD\u20E5",npart:"\u2202\u0338",npolint:"\u2A14",npr:"\u2280",nprcue:"\u22E0",npre:"\u2AAF\u0338",nprec:"\u2280",npreceq:"\u2AAF\u0338",nrArr:"\u21CF",nrarr:"\u219B",nrarrc:"\u2933\u0338",nrarrw:"\u219D\u0338",nRightarrow:"\u21CF",nrightarrow:"\u219B",nrtri:"\u22EB",nrtrie:"\u22ED",nsc:"\u2281",nsccue:"\u22E1",nsce:"\u2AB0\u0338",Nscr:"\u{1D4A9}",nscr:"\u{1D4C3}",nshortmid:"\u2224",nshortparallel:"\u2226",nsim:"\u2241",nsime:"\u2244",nsimeq:"\u2244",nsmid:"\u2224",nspar:"\u2226",nsqsube:"\u22E2",nsqsupe:"\u22E3",nsub:"\u2284",nsubE:"\u2AC5\u0338",nsube:"\u2288",nsubset:"\u2282\u20D2",nsubseteq:"\u2288",nsubseteqq:"\u2AC5\u0338",nsucc:"\u2281",nsucceq:"\u2AB0\u0338",nsup:"\u2285",nsupE:"\u2AC6\u0338",nsupe:"\u2289",nsupset:"\u2283\u20D2",nsupseteq:"\u2289",nsupseteqq:"\u2AC6\u0338",ntgl:"\u2279",Ntilde:"\xD1",ntilde:"\xF1",ntlg:"\u2278",ntriangleleft:"\u22EA",ntrianglelefteq:"\u22EC",ntriangleright:"\u22EB",ntrianglerighteq:"\u22ED",Nu:"\u039D",nu:"\u03BD",num:"#",numero:"\u2116",numsp:"\u2007",nvap:"\u224D\u20D2",nVDash:"\u22AF",nVdash:"\u22AE",nvDash:"\u22AD",nvdash:"\u22AC",nvge:"\u2265\u20D2",nvgt:">\u20D2",nvHarr:"\u2904",nvinfin:"\u29DE",nvlArr:"\u2902",nvle:"\u2264\u20D2",nvlt:"<\u20D2",nvltrie:"\u22B4\u20D2",nvrArr:"\u2903",nvrtrie:"\u22B5\u20D2",nvsim:"\u223C\u20D2",nwarhk:"\u2923",nwArr:"\u21D6",nwarr:"\u2196",nwarrow:"\u2196",nwnear:"\u2927",Oacute:"\xD3",oacute:"\xF3",oast:"\u229B",ocir:"\u229A",Ocirc:"\xD4",ocirc:"\xF4",Ocy:"\u041E",ocy:"\u043E",odash:"\u229D",Odblac:"\u0150",odblac:"\u0151",odiv:"\u2A38",odot:"\u2299",odsold:"\u29BC",OElig:"\u0152",oelig:"\u0153",ofcir:"\u29BF",Ofr:"\u{1D512}",ofr:"\u{1D52C}",ogon:"\u02DB",Ograve:"\xD2",ograve:"\xF2",ogt:"\u29C1",ohbar:"\u29B5",ohm:"\u03A9",oint:"\u222E",olarr:"\u21BA",olcir:"\u29BE",olcross:"\u29BB",oline:"\u203E",olt:"\u29C0",Omacr:"\u014C",omacr:"\u014D",Omega:"\u03A9",omega:"\u03C9",Omicron:"\u039F",omicron:"\u03BF",omid:"\u29B6",ominus:"\u2296",Oopf:"\u{1D546}",oopf:"\u{1D560}",opar:"\u29B7",OpenCurlyDoubleQuote:"\u201C",OpenCurlyQuote:"\u2018",operp:"\u29B9",oplus:"\u2295",Or:"\u2A54",or:"\u2228",orarr:"\u21BB",ord:"\u2A5D",order:"\u2134",orderof:"\u2134",ordf:"\xAA",ordm:"\xBA",origof:"\u22B6",oror:"\u2A56",orslope:"\u2A57",orv:"\u2A5B",oS:"\u24C8",Oscr:"\u{1D4AA}",oscr:"\u2134",Oslash:"\xD8",oslash:"\xF8",osol:"\u2298",Otilde:"\xD5",otilde:"\xF5",Otimes:"\u2A37",otimes:"\u2297",otimesas:"\u2A36",Ouml:"\xD6",ouml:"\xF6",ovbar:"\u233D",OverBar:"\u203E",OverBrace:"\u23DE",OverBracket:"\u23B4",OverParenthesis:"\u23DC",par:"\u2225",para:"\xB6",parallel:"\u2225",parsim:"\u2AF3",parsl:"\u2AFD",part:"\u2202",PartialD:"\u2202",Pcy:"\u041F",pcy:"\u043F",percnt:"%",period:".",permil:"\u2030",perp:"\u22A5",pertenk:"\u2031",Pfr:"\u{1D513}",pfr:"\u{1D52D}",Phi:"\u03A6",phi:"\u03C6",phiv:"\u03D5",phmmat:"\u2133",phone:"\u260E",Pi:"\u03A0",pi:"\u03C0",pitchfork:"\u22D4",piv:"\u03D6",planck:"\u210F",planckh:"\u210E",plankv:"\u210F",plus:"+",plusacir:"\u2A23",plusb:"\u229E",pluscir:"\u2A22",plusdo:"\u2214",plusdu:"\u2A25",pluse:"\u2A72",PlusMinus:"\xB1",plusmn:"\xB1",plussim:"\u2A26",plustwo:"\u2A27",pm:"\xB1",Poincareplane:"\u210C",pointint:"\u2A15",Popf:"\u2119",popf:"\u{1D561}",pound:"\xA3",Pr:"\u2ABB",pr:"\u227A",prap:"\u2AB7",prcue:"\u227C",prE:"\u2AB3",pre:"\u2AAF",prec:"\u227A",precapprox:"\u2AB7",preccurlyeq:"\u227C",Precedes:"\u227A",PrecedesEqual:"\u2AAF",PrecedesSlantEqual:"\u227C",PrecedesTilde:"\u227E",preceq:"\u2AAF",precnapprox:"\u2AB9",precneqq:"\u2AB5",precnsim:"\u22E8",precsim:"\u227E",Prime:"\u2033",prime:"\u2032",primes:"\u2119",prnap:"\u2AB9",prnE:"\u2AB5",prnsim:"\u22E8",prod:"\u220F",Product:"\u220F",profalar:"\u232E",profline:"\u2312",profsurf:"\u2313",prop:"\u221D",Proportion:"\u2237",Proportional:"\u221D",propto:"\u221D",prsim:"\u227E",prurel:"\u22B0",Pscr:"\u{1D4AB}",pscr:"\u{1D4C5}",Psi:"\u03A8",psi:"\u03C8",puncsp:"\u2008",Qfr:"\u{1D514}",qfr:"\u{1D52E}",qint:"\u2A0C",Qopf:"\u211A",qopf:"\u{1D562}",qprime:"\u2057",Qscr:"\u{1D4AC}",qscr:"\u{1D4C6}",quaternions:"\u210D",quatint:"\u2A16",quest:"?",questeq:"\u225F",QUOT:'"',quot:'"',rAarr:"\u21DB",race:"\u223D\u0331",Racute:"\u0154",racute:"\u0155",radic:"\u221A",raemptyv:"\u29B3",Rang:"\u27EB",rang:"\u27E9",rangd:"\u2992",range:"\u29A5",rangle:"\u27E9",raquo:"\xBB",Rarr:"\u21A0",rArr:"\u21D2",rarr:"\u2192",rarrap:"\u2975",rarrb:"\u21E5",rarrbfs:"\u2920",rarrc:"\u2933",rarrfs:"\u291E",rarrhk:"\u21AA",rarrlp:"\u21AC",rarrpl:"\u2945",rarrsim:"\u2974",Rarrtl:"\u2916",rarrtl:"\u21A3",rarrw:"\u219D",rAtail:"\u291C",ratail:"\u291A",ratio:"\u2236",rationals:"\u211A",RBarr:"\u2910",rBarr:"\u290F",rbarr:"\u290D",rbbrk:"\u2773",rbrace:"}",rbrack:"]",rbrke:"\u298C",rbrksld:"\u298E",rbrkslu:"\u2990",Rcaron:"\u0158",rcaron:"\u0159",Rcedil:"\u0156",rcedil:"\u0157",rceil:"\u2309",rcub:"}",Rcy:"\u0420",rcy:"\u0440",rdca:"\u2937",rdldhar:"\u2969",rdquo:"\u201D",rdquor:"\u201D",rdsh:"\u21B3",Re:"\u211C",real:"\u211C",realine:"\u211B",realpart:"\u211C",reals:"\u211D",rect:"\u25AD",REG:"\xAE",reg:"\xAE",ReverseElement:"\u220B",ReverseEquilibrium:"\u21CB",ReverseUpEquilibrium:"\u296F",rfisht:"\u297D",rfloor:"\u230B",Rfr:"\u211C",rfr:"\u{1D52F}",rHar:"\u2964",rhard:"\u21C1",rharu:"\u21C0",rharul:"\u296C",Rho:"\u03A1",rho:"\u03C1",rhov:"\u03F1",RightAngleBracket:"\u27E9",RightArrow:"\u2192",Rightarrow:"\u21D2",rightarrow:"\u2192",RightArrowBar:"\u21E5",RightArrowLeftArrow:"\u21C4",rightarrowtail:"\u21A3",RightCeiling:"\u2309",RightDoubleBracket:"\u27E7",RightDownTeeVector:"\u295D",RightDownVector:"\u21C2",RightDownVectorBar:"\u2955",RightFloor:"\u230B",rightharpoondown:"\u21C1",rightharpoonup:"\u21C0",rightleftarrows:"\u21C4",rightleftharpoons:"\u21CC",rightrightarrows:"\u21C9",rightsquigarrow:"\u219D",RightTee:"\u22A2",RightTeeArrow:"\u21A6",RightTeeVector:"\u295B",rightthreetimes:"\u22CC",RightTriangle:"\u22B3",RightTriangleBar:"\u29D0",RightTriangleEqual:"\u22B5",RightUpDownVector:"\u294F",RightUpTeeVector:"\u295C",RightUpVector:"\u21BE",RightUpVectorBar:"\u2954",RightVector:"\u21C0",RightVectorBar:"\u2953",ring:"\u02DA",risingdotseq:"\u2253",rlarr:"\u21C4",rlhar:"\u21CC",rlm:"\u200F",rmoust:"\u23B1",rmoustache:"\u23B1",rnmid:"\u2AEE",roang:"\u27ED",roarr:"\u21FE",robrk:"\u27E7",ropar:"\u2986",Ropf:"\u211D",ropf:"\u{1D563}",roplus:"\u2A2E",rotimes:"\u2A35",RoundImplies:"\u2970",rpar:")",rpargt:"\u2994",rppolint:"\u2A12",rrarr:"\u21C9",Rrightarrow:"\u21DB",rsaquo:"\u203A",Rscr:"\u211B",rscr:"\u{1D4C7}",Rsh:"\u21B1",rsh:"\u21B1",rsqb:"]",rsquo:"\u2019",rsquor:"\u2019",rthree:"\u22CC",rtimes:"\u22CA",rtri:"\u25B9",rtrie:"\u22B5",rtrif:"\u25B8",rtriltri:"\u29CE",RuleDelayed:"\u29F4",ruluhar:"\u2968",rx:"\u211E",Sacute:"\u015A",sacute:"\u015B",sbquo:"\u201A",Sc:"\u2ABC",sc:"\u227B",scap:"\u2AB8",Scaron:"\u0160",scaron:"\u0161",sccue:"\u227D",scE:"\u2AB4",sce:"\u2AB0",Scedil:"\u015E",scedil:"\u015F",Scirc:"\u015C",scirc:"\u015D",scnap:"\u2ABA",scnE:"\u2AB6",scnsim:"\u22E9",scpolint:"\u2A13",scsim:"\u227F",Scy:"\u0421",scy:"\u0441",sdot:"\u22C5",sdotb:"\u22A1",sdote:"\u2A66",searhk:"\u2925",seArr:"\u21D8",searr:"\u2198",searrow:"\u2198",sect:"\xA7",semi:";",seswar:"\u2929",setminus:"\u2216",setmn:"\u2216",sext:"\u2736",Sfr:"\u{1D516}",sfr:"\u{1D530}",sfrown:"\u2322",sharp:"\u266F",SHCHcy:"\u0429",shchcy:"\u0449",SHcy:"\u0428",shcy:"\u0448",ShortDownArrow:"\u2193",ShortLeftArrow:"\u2190",shortmid:"\u2223",shortparallel:"\u2225",ShortRightArrow:"\u2192",ShortUpArrow:"\u2191",shy:"\xAD",Sigma:"\u03A3",sigma:"\u03C3",sigmaf:"\u03C2",sigmav:"\u03C2",sim:"\u223C",simdot:"\u2A6A",sime:"\u2243",simeq:"\u2243",simg:"\u2A9E",simgE:"\u2AA0",siml:"\u2A9D",simlE:"\u2A9F",simne:"\u2246",simplus:"\u2A24",simrarr:"\u2972",slarr:"\u2190",SmallCircle:"\u2218",smallsetminus:"\u2216",smashp:"\u2A33",smeparsl:"\u29E4",smid:"\u2223",smile:"\u2323",smt:"\u2AAA",smte:"\u2AAC",smtes:"\u2AAC\uFE00",SOFTcy:"\u042C",softcy:"\u044C",sol:"/",solb:"\u29C4",solbar:"\u233F",Sopf:"\u{1D54A}",sopf:"\u{1D564}",spades:"\u2660",spadesuit:"\u2660",spar:"\u2225",sqcap:"\u2293",sqcaps:"\u2293\uFE00",sqcup:"\u2294",sqcups:"\u2294\uFE00",Sqrt:"\u221A",sqsub:"\u228F",sqsube:"\u2291",sqsubset:"\u228F",sqsubseteq:"\u2291",sqsup:"\u2290",sqsupe:"\u2292",sqsupset:"\u2290",sqsupseteq:"\u2292",squ:"\u25A1",Square:"\u25A1",square:"\u25A1",SquareIntersection:"\u2293",SquareSubset:"\u228F",SquareSubsetEqual:"\u2291",SquareSuperset:"\u2290",SquareSupersetEqual:"\u2292",SquareUnion:"\u2294",squarf:"\u25AA",squf:"\u25AA",srarr:"\u2192",Sscr:"\u{1D4AE}",sscr:"\u{1D4C8}",ssetmn:"\u2216",ssmile:"\u2323",sstarf:"\u22C6",Star:"\u22C6",star:"\u2606",starf:"\u2605",straightepsilon:"\u03F5",straightphi:"\u03D5",strns:"\xAF",Sub:"\u22D0",sub:"\u2282",subdot:"\u2ABD",subE:"\u2AC5",sube:"\u2286",subedot:"\u2AC3",submult:"\u2AC1",subnE:"\u2ACB",subne:"\u228A",subplus:"\u2ABF",subrarr:"\u2979",Subset:"\u22D0",subset:"\u2282",subseteq:"\u2286",subseteqq:"\u2AC5",SubsetEqual:"\u2286",subsetneq:"\u228A",subsetneqq:"\u2ACB",subsim:"\u2AC7",subsub:"\u2AD5",subsup:"\u2AD3",succ:"\u227B",succapprox:"\u2AB8",succcurlyeq:"\u227D",Succeeds:"\u227B",SucceedsEqual:"\u2AB0",SucceedsSlantEqual:"\u227D",SucceedsTilde:"\u227F",succeq:"\u2AB0",succnapprox:"\u2ABA",succneqq:"\u2AB6",succnsim:"\u22E9",succsim:"\u227F",SuchThat:"\u220B",Sum:"\u2211",sum:"\u2211",sung:"\u266A",Sup:"\u22D1",sup:"\u2283",sup1:"\xB9",sup2:"\xB2",sup3:"\xB3",supdot:"\u2ABE",supdsub:"\u2AD8",supE:"\u2AC6",supe:"\u2287",supedot:"\u2AC4",Superset:"\u2283",SupersetEqual:"\u2287",suphsol:"\u27C9",suphsub:"\u2AD7",suplarr:"\u297B",supmult:"\u2AC2",supnE:"\u2ACC",supne:"\u228B",supplus:"\u2AC0",Supset:"\u22D1",supset:"\u2283",supseteq:"\u2287",supseteqq:"\u2AC6",supsetneq:"\u228B",supsetneqq:"\u2ACC",supsim:"\u2AC8",supsub:"\u2AD4",supsup:"\u2AD6",swarhk:"\u2926",swArr:"\u21D9",swarr:"\u2199",swarrow:"\u2199",swnwar:"\u292A",szlig:"\xDF",Tab:" ",target:"\u2316",Tau:"\u03A4",tau:"\u03C4",tbrk:"\u23B4",Tcaron:"\u0164",tcaron:"\u0165",Tcedil:"\u0162",tcedil:"\u0163",Tcy:"\u0422",tcy:"\u0442",tdot:"\u20DB",telrec:"\u2315",Tfr:"\u{1D517}",tfr:"\u{1D531}",there4:"\u2234",Therefore:"\u2234",therefore:"\u2234",Theta:"\u0398",theta:"\u03B8",thetasym:"\u03D1",thetav:"\u03D1",thickapprox:"\u2248",thicksim:"\u223C",ThickSpace:"\u205F\u200A",thinsp:"\u2009",ThinSpace:"\u2009",thkap:"\u2248",thksim:"\u223C",THORN:"\xDE",thorn:"\xFE",Tilde:"\u223C",tilde:"\u02DC",TildeEqual:"\u2243",TildeFullEqual:"\u2245",TildeTilde:"\u2248",times:"\xD7",timesb:"\u22A0",timesbar:"\u2A31",timesd:"\u2A30",tint:"\u222D",toea:"\u2928",top:"\u22A4",topbot:"\u2336",topcir:"\u2AF1",Topf:"\u{1D54B}",topf:"\u{1D565}",topfork:"\u2ADA",tosa:"\u2929",tprime:"\u2034",TRADE:"\u2122",trade:"\u2122",triangle:"\u25B5",triangledown:"\u25BF",triangleleft:"\u25C3",trianglelefteq:"\u22B4",triangleq:"\u225C",triangleright:"\u25B9",trianglerighteq:"\u22B5",tridot:"\u25EC",trie:"\u225C",triminus:"\u2A3A",TripleDot:"\u20DB",triplus:"\u2A39",trisb:"\u29CD",tritime:"\u2A3B",trpezium:"\u23E2",Tscr:"\u{1D4AF}",tscr:"\u{1D4C9}",TScy:"\u0426",tscy:"\u0446",TSHcy:"\u040B",tshcy:"\u045B",Tstrok:"\u0166",tstrok:"\u0167",twixt:"\u226C",twoheadleftarrow:"\u219E",twoheadrightarrow:"\u21A0",Uacute:"\xDA",uacute:"\xFA",Uarr:"\u219F",uArr:"\u21D1",uarr:"\u2191",Uarrocir:"\u2949",Ubrcy:"\u040E",ubrcy:"\u045E",Ubreve:"\u016C",ubreve:"\u016D",Ucirc:"\xDB",ucirc:"\xFB",Ucy:"\u0423",ucy:"\u0443",udarr:"\u21C5",Udblac:"\u0170",udblac:"\u0171",udhar:"\u296E",ufisht:"\u297E",Ufr:"\u{1D518}",ufr:"\u{1D532}",Ugrave:"\xD9",ugrave:"\xF9",uHar:"\u2963",uharl:"\u21BF",uharr:"\u21BE",uhblk:"\u2580",ulcorn:"\u231C",ulcorner:"\u231C",ulcrop:"\u230F",ultri:"\u25F8",Umacr:"\u016A",umacr:"\u016B",uml:"\xA8",UnderBar:"_",UnderBrace:"\u23DF",UnderBracket:"\u23B5",UnderParenthesis:"\u23DD",Union:"\u22C3",UnionPlus:"\u228E",Uogon:"\u0172",uogon:"\u0173",Uopf:"\u{1D54C}",uopf:"\u{1D566}",UpArrow:"\u2191",Uparrow:"\u21D1",uparrow:"\u2191",UpArrowBar:"\u2912",UpArrowDownArrow:"\u21C5",UpDownArrow:"\u2195",Updownarrow:"\u21D5",updownarrow:"\u2195",UpEquilibrium:"\u296E",upharpoonleft:"\u21BF",upharpoonright:"\u21BE",uplus:"\u228E",UpperLeftArrow:"\u2196",UpperRightArrow:"\u2197",Upsi:"\u03D2",upsi:"\u03C5",upsih:"\u03D2",Upsilon:"\u03A5",upsilon:"\u03C5",UpTee:"\u22A5",UpTeeArrow:"\u21A5",upuparrows:"\u21C8",urcorn:"\u231D",urcorner:"\u231D",urcrop:"\u230E",Uring:"\u016E",uring:"\u016F",urtri:"\u25F9",Uscr:"\u{1D4B0}",uscr:"\u{1D4CA}",utdot:"\u22F0",Utilde:"\u0168",utilde:"\u0169",utri:"\u25B5",utrif:"\u25B4",uuarr:"\u21C8",Uuml:"\xDC",uuml:"\xFC",uwangle:"\u29A7",vangrt:"\u299C",varepsilon:"\u03F5",varkappa:"\u03F0",varnothing:"\u2205",varphi:"\u03D5",varpi:"\u03D6",varpropto:"\u221D",vArr:"\u21D5",varr:"\u2195",varrho:"\u03F1",varsigma:"\u03C2",varsubsetneq:"\u228A\uFE00",varsubsetneqq:"\u2ACB\uFE00",varsupsetneq:"\u228B\uFE00",varsupsetneqq:"\u2ACC\uFE00",vartheta:"\u03D1",vartriangleleft:"\u22B2",vartriangleright:"\u22B3",Vbar:"\u2AEB",vBar:"\u2AE8",vBarv:"\u2AE9",Vcy:"\u0412",vcy:"\u0432",VDash:"\u22AB",Vdash:"\u22A9",vDash:"\u22A8",vdash:"\u22A2",Vdashl:"\u2AE6",Vee:"\u22C1",vee:"\u2228",veebar:"\u22BB",veeeq:"\u225A",vellip:"\u22EE",Verbar:"\u2016",verbar:"|",Vert:"\u2016",vert:"|",VerticalBar:"\u2223",VerticalLine:"|",VerticalSeparator:"\u2758",VerticalTilde:"\u2240",VeryThinSpace:"\u200A",Vfr:"\u{1D519}",vfr:"\u{1D533}",vltri:"\u22B2",vnsub:"\u2282\u20D2",vnsup:"\u2283\u20D2",Vopf:"\u{1D54D}",vopf:"\u{1D567}",vprop:"\u221D",vrtri:"\u22B3",Vscr:"\u{1D4B1}",vscr:"\u{1D4CB}",vsubnE:"\u2ACB\uFE00",vsubne:"\u228A\uFE00",vsupnE:"\u2ACC\uFE00",vsupne:"\u228B\uFE00",Vvdash:"\u22AA",vzigzag:"\u299A",Wcirc:"\u0174",wcirc:"\u0175",wedbar:"\u2A5F",Wedge:"\u22C0",wedge:"\u2227",wedgeq:"\u2259",weierp:"\u2118",Wfr:"\u{1D51A}",wfr:"\u{1D534}",Wopf:"\u{1D54E}",wopf:"\u{1D568}",wp:"\u2118",wr:"\u2240",wreath:"\u2240",Wscr:"\u{1D4B2}",wscr:"\u{1D4CC}",xcap:"\u22C2",xcirc:"\u25EF",xcup:"\u22C3",xdtri:"\u25BD",Xfr:"\u{1D51B}",xfr:"\u{1D535}",xhArr:"\u27FA",xharr:"\u27F7",Xi:"\u039E",xi:"\u03BE",xlArr:"\u27F8",xlarr:"\u27F5",xmap:"\u27FC",xnis:"\u22FB",xodot:"\u2A00",Xopf:"\u{1D54F}",xopf:"\u{1D569}",xoplus:"\u2A01",xotime:"\u2A02",xrArr:"\u27F9",xrarr:"\u27F6",Xscr:"\u{1D4B3}",xscr:"\u{1D4CD}",xsqcup:"\u2A06",xuplus:"\u2A04",xutri:"\u25B3",xvee:"\u22C1",xwedge:"\u22C0",Yacute:"\xDD",yacute:"\xFD",YAcy:"\u042F",yacy:"\u044F",Ycirc:"\u0176",ycirc:"\u0177",Ycy:"\u042B",ycy:"\u044B",yen:"\xA5",Yfr:"\u{1D51C}",yfr:"\u{1D536}",YIcy:"\u0407",yicy:"\u0457",Yopf:"\u{1D550}",yopf:"\u{1D56A}",Yscr:"\u{1D4B4}",yscr:"\u{1D4CE}",YUcy:"\u042E",yucy:"\u044E",Yuml:"\u0178",yuml:"\xFF",Zacute:"\u0179",zacute:"\u017A",Zcaron:"\u017D",zcaron:"\u017E",Zcy:"\u0417",zcy:"\u0437",Zdot:"\u017B",zdot:"\u017C",zeetrf:"\u2128",ZeroWidthSpace:"\u200B",Zeta:"\u0396",zeta:"\u03B6",Zfr:"\u2128",zfr:"\u{1D537}",ZHcy:"\u0416",zhcy:"\u0436",zigrarr:"\u21DD",Zopf:"\u2124",zopf:"\u{1D56B}",Zscr:"\u{1D4B5}",zscr:"\u{1D4CF}",zwj:"\u200D",zwnj:"\u200C"});pn.entityMap=pn.HTML_ENTITIES;});var vo=Re(Hn=>{var Rt=lt(),z=kr(),ho=sn(),Mu=Rt.isHTMLEscapableRawTextElement,Ru=Rt.isHTMLMimeType,Bu=Rt.isHTMLRawTextElement,wn=Rt.hasOwn,uo=Rt.NAMESPACE,lo=ho.ParseError,Fu=ho.DOMException,mn=0,et=1,Ot=2,_n=3,Pt=4,Mt=5,gn=6,Wn=7;function po(){}d(po,"XMLReader");po.prototype={parse:d(function(e,t,n){var r=this.domBuilder;r.startDocument(),mo(t,t=Object.create(null)),Lu(e,t,n,r,this.errorHandler),r.endDocument();},"parse")};var Lr=/&#?\w+;?/g;function Lu(e,t,n,r,o){var i=Ru(r.mimeType);e.indexOf(z.UNICODE_REPLACEMENT_CHARACTER)>=0&&o.warning("Unicode replacement character detected, source encoding issues?");function s(R){if(R>65535){R-=65536;var H=55296+(R>>10),Z=56320+(R&1023);return String.fromCharCode(H,Z)}else return String.fromCharCode(R)}d(s,"fixedFromCharCode");function l(R){var H=R[R.length-1]===";"?R:R+";";if(!i&&H!==R)return o.error("EntityRef: expecting ;"),R;var Z=z.Reference.exec(H);if(!Z||Z[0].length!==H.length)return o.error("entity not matching Reference production: "+R),R;var Q=H.slice(1,-1);return wn(n,Q)?n[Q]:Q.charAt(0)==="#"?s(parseInt(Q.substring(1).replace("x","0x"))):(o.error("entity not found:"+R),R)}d(l,"entityReplacer");function a(R){if(R>g){var H=e.substring(g,R).replace(Lr,l);h&&p(g),r.characters(H,0,R-g),g=R;}}d(a,"appendText");var u=0,c=0,f=/\r\n?|\n|$/g,h=r.locator;function p(R,H){for(;R>=c&&(H=f.exec(e));)u=c,c=H.index+H[0].length,h.lineNumber++;h.columnNumber=R-u+1;}d(p,"position");for(var _=[{currentNSMap:t}],m=[],g=0;;){try{var v=e.indexOf("<",g);if(v<0){if(!i&&m.length>0)return o.fatalError("unclosed xml tag(s): "+m.join(", "));if(!e.substring(g).match(/^\s*$/)){var E=r.doc,y=E.createTextNode(e.substring(g));if(E.documentElement)return o.error("Extra content at the end of the document");E.appendChild(y),r.currentElement=y;}return}if(v>g){var w=e.substring(g,v);!i&&m.length===0&&(w=w.replace(new RegExp(z.S_OPT.source,"g"),""),w&&o.error("Unexpected content outside root element: '"+w+"'")),a(v);}switch(e.charAt(v+1)){case "/":var C=e.indexOf(">",v+2),b=e.substring(v+2,C>0?C:void 0);if(!b)return o.fatalError("end tag name missing");var D=C>0&&z.reg("^",z.QName_group,z.S_OPT,"$").exec(b);if(!D)return o.fatalError('end tag name contains invalid characters: "'+b+'"');if(!r.currentElement&&!r.doc.documentElement)return;var A=m[m.length-1]||r.currentElement.tagName||r.doc.documentElement.tagName||"";if(A!==D[1]){var x=D[1].toLowerCase();if(!i||A.toLowerCase()!==x)return o.fatalError('Opening and ending tag mismatch: "'+A+'" != "'+b+'"')}var N=_.pop();m.pop();var T=N.localNSMap;if(r.endElement(N.uri,N.localName,A),T)for(var k in T)wn(T,k)&&r.endPrefixMapping(k);C++;break;case "?":h&&p(v),C=ju(e,v,r,o);break;case "!":h&&p(v),C=go(e,v,r,o,i);break;default:h&&p(v);var P=new wo,O=_[_.length-1].currentNSMap,C=$u(e,v,P,O,l,o,i),M=P.length;if(P.closed||(i&&Rt.isHTMLVoidElement(P.tagName)?P.closed=!0:m.push(P.tagName)),h&&M){for(var B=co(h,{}),$=0;$<M;$++){var U=P[$];p(U.offset),U.locator=co(h,{});}r.locator=B,fo(P,r,O)&&_.push(P),r.locator=h;}else fo(P,r,O)&&_.push(P);i&&!P.closed?C=Uu(e,C,P.tagName,l,r):C++;}}catch(R){if(R instanceof lo)throw R;if(R instanceof Fu)throw new lo(R.name+": "+R.message,r.locator,R);o.error("element parse error: "+R),C=-1;}C>g?g=C:a(Math.max(v,g)+1);}}d(Lu,"parse");function co(e,t){return t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber,t}d(co,"copyLocator");function $u(e,t,n,r,o,i,s){function l(p,_,m){if(wn(n.attributeNames,p))return i.fatalError("Attribute "+p+" redefined");if(!s&&_.indexOf("<")>=0)return i.fatalError("Unescaped '<' not allowed in attributes values");n.addValue(p,_.replace(/[\t\n\r]/g," ").replace(Lr,o),m);}d(l,"addAttribute");for(var a,u,c=++t,f=mn;;){var h=e.charAt(c);switch(h){case "=":if(f===et)a=e.slice(t,c),f=_n;else if(f===Ot)f=_n;else throw new Error("attribute equal must after attrName");break;case "'":case '"':if(f===_n||f===et)if(f===et&&(i.warning('attribute value must after "="'),a=e.slice(t,c)),t=c+1,c=e.indexOf(h,t),c>0)u=e.slice(t,c),l(a,u,t-1),f=Mt;else throw new Error("attribute value no end '"+h+"' match");else if(f==Pt)u=e.slice(t,c),l(a,u,t),i.warning('attribute "'+a+'" missed start quot('+h+")!!"),t=c+1,f=Mt;else throw new Error('attribute value must after "="');break;case "/":switch(f){case mn:n.setTagName(e.slice(t,c));case Mt:case gn:case Wn:f=Wn,n.closed=true;case Pt:case et:break;case Ot:n.closed=true;break;default:throw new Error("attribute invalid close char('/')")}break;case "":return i.error("unexpected end of input"),f==mn&&n.setTagName(e.slice(t,c)),c;case ">":switch(f){case mn:n.setTagName(e.slice(t,c));case Mt:case gn:case Wn:break;case Pt:case et:u=e.slice(t,c),u.slice(-1)==="/"&&(n.closed=true,u=u.slice(0,-1));case Ot:f===Ot&&(u=a),f==Pt?(i.warning('attribute "'+u+'" missed quot(")!'),l(a,u,t)):(s||i.warning('attribute "'+u+'" missed value!! "'+u+'" instead!!'),l(u,u,t));break;case _n:if(!s)return i.fatalError(`AttValue: ' or " expected`)}return c;case "\x80":h=" ";default:if(h<=" ")switch(f){case mn:n.setTagName(e.slice(t,c)),f=gn;break;case et:a=e.slice(t,c),f=Ot;break;case Pt:var u=e.slice(t,c);i.warning('attribute "'+u+'" missed quot(")!!'),l(a,u,t);case Mt:f=gn;break}else switch(f){case Ot:s||i.warning('attribute "'+a+'" missed value!! "'+a+'" instead2!!'),l(a,a,t),t=c,f=et;break;case Mt:i.warning('attribute space is required"'+a+'"!!');case gn:f=et,t=c;break;case _n:f=Pt,t=c;break;case Wn:throw new Error("elements closed character '/' and '>' must be connected to")}}c++;}}d($u,"parseElementStartPart");function fo(e,t,n){for(var r=e.tagName,o=null,f=e.length;f--;){var i=e[f],s=i.qName,l=i.value,h=s.indexOf(":");if(h>0)var a=i.prefix=s.slice(0,h),u=s.slice(h+1),c=a==="xmlns"&&u;else u=s,a=null,c=s==="xmlns"&&"";i.localName=u,c!==false&&(o==null&&(o=Object.create(null),mo(n,n=Object.create(null))),n[c]=o[c]=l,i.uri=uo.XMLNS,t.startPrefixMapping(c,l));}for(var f=e.length;f--;)i=e[f],i.prefix&&(i.prefix==="xml"&&(i.uri=uo.XML),i.prefix!=="xmlns"&&(i.uri=n[i.prefix]));var h=r.indexOf(":");h>0?(a=e.prefix=r.slice(0,h),u=e.localName=r.slice(h+1)):(a=null,u=e.localName=r);var p=e.uri=n[a||""];if(t.startElement(p,u,r,e),e.closed){if(t.endElement(p,u,r),o)for(a in o)wn(o,a)&&t.endPrefixMapping(a);}else return e.currentNSMap=n,e.localNSMap=o,true}d(fo,"appendElement");function Uu(e,t,n,r,o){var i=Mu(n);if(i||Bu(n)){var s=e.indexOf("</"+n+">",t),l=e.substring(t+1,s);return i&&(l=l.replace(Lr,r)),o.characters(l,0,l.length),s}return t+1}d(Uu,"parseHtmlSpecialContent");function mo(e,t){for(var n in e)wn(e,n)&&(t[n]=e[n]);}d(mo,"_copy");function _o(e,t){var n=t;function r(c){return c=c||0,e.charAt(n+c)}d(r,"char");function o(c){c=c||1,n+=c;}d(o,"skip");function i(){for(var c=0;n<e.length;){var f=r();if(f!==" "&&f!==`
|
|
3
|
-
`&&f!==" "&&f!=="\r")return c;c++,
|
|
1
|
+
'use strict';var n8nWorkflow=require('n8n-workflow'),zs=require('vm');function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var zs__namespace=/*#__PURE__*/_interopNamespace(zs);var Po=Object.create;var or=Object.defineProperty;var Mo=Object.getOwnPropertyDescriptor;var Ro=Object.getOwnPropertyNames;var Bo=Object.getPrototypeOf,Fo=Object.prototype.hasOwnProperty;var d=(e,t)=>or(e,"name",{value:t,configurable:true});var Re=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Lo=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of Ro(t))!Fo.call(e,s)&&s!==n&&or(e,s,{get:()=>t[s],enumerable:!(r=Mo(t,s))||r.enumerable});return e};var ar=(e,t,n)=>(n=e!=null?Po(Bo(e)):{},Lo(or(n,"default",{value:e,enumerable:true}),e));var ri=Re((ff,ni)=>{ni.exports={createRequire:d(function(){return function(){return {}}},"createRequire")};});var ct=Re(fe=>{function ca(e,t,n){if(n===void 0&&(n=Array.prototype),e&&typeof n.find=="function")return n.find.call(e,t);for(var r=0;r<e.length;r++)if(lt(e,r)){var s=e[r];if(t.call(void 0,s,r,e))return s}}d(ca,"find");function Et(e,t){return t===void 0&&(t=Object),t&&typeof t.getOwnPropertyDescriptors=="function"&&(e=t.create(null,t.getOwnPropertyDescriptors(e))),t&&typeof t.freeze=="function"?t.freeze(e):e}d(Et,"freeze");function lt(e,t){return Object.prototype.hasOwnProperty.call(e,t)}d(lt,"hasOwn");function fa(e,t){if(e===null||typeof e!="object")throw new TypeError("target is not an object");for(var n in t)lt(t,n)&&(e[n]=t[n]);return e}d(fa,"assign");var wi=Et({allowfullscreen:true,async:true,autofocus:true,autoplay:true,checked:true,controls:true,default:true,defer:true,disabled:true,formnovalidate:true,hidden:true,ismap:true,itemscope:true,loop:true,multiple:true,muted:true,nomodule:true,novalidate:true,open:true,playsinline:true,readonly:true,required:true,reversed:true,selected:true});function da(e){return lt(wi,e.toLowerCase())}d(da,"isHTMLBooleanAttribute");var vi=Et({area:true,base:true,br:true,col:true,embed:true,hr:true,img:true,input:true,link:true,meta:true,param:true,source:true,track:true,wbr:true});function ha(e){return lt(vi,e.toLowerCase())}d(ha,"isHTMLVoidElement");var Kt=Et({script:false,style:false,textarea:true,title:true});function pa(e){var t=e.toLowerCase();return lt(Kt,t)&&!Kt[t]}d(pa,"isHTMLRawTextElement");function ma(e){var t=e.toLowerCase();return lt(Kt,t)&&Kt[t]}d(ma,"isHTMLEscapableRawTextElement");function yi(e){return e===en.HTML}d(yi,"isHTMLMimeType");function _a(e){return yi(e)||e===en.XML_XHTML_APPLICATION}d(_a,"hasDefaultHTMLNamespace");var en=Et({HTML:"text/html",XML_APPLICATION:"application/xml",XML_TEXT:"text/xml",XML_XHTML_APPLICATION:"application/xhtml+xml",XML_SVG_IMAGE:"image/svg+xml"}),ga=Object.keys(en).map(function(e){return en[e]});function wa(e){return ga.indexOf(e)>-1}d(wa,"isValidMimeType");var va=Et({HTML:"http://www.w3.org/1999/xhtml",SVG:"http://www.w3.org/2000/svg",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"});fe.assign=fa;fe.find=ca;fe.freeze=Et;fe.HTML_BOOLEAN_ATTRIBUTES=wi;fe.HTML_RAW_TEXT_ELEMENTS=Kt;fe.HTML_VOID_ELEMENTS=vi;fe.hasDefaultHTMLNamespace=_a;fe.hasOwn=lt;fe.isHTMLBooleanAttribute=da;fe.isHTMLRawTextElement=pa;fe.isHTMLEscapableRawTextElement=ma;fe.isHTMLMimeType=yi;fe.isHTMLVoidElement=ha;fe.isValidMimeType=wa;fe.MIME_TYPE=en;fe.NAMESPACE=va;});var on=Re(sn=>{var ya=ct();function bi(e,t){e.prototype=Object.create(Error.prototype,{constructor:{value:e},name:{value:e.name,enumerable:true,writable:t}});}d(bi,"extendError");var nn=ya.freeze({Error:"Error",IndexSizeError:"IndexSizeError",DomstringSizeError:"DomstringSizeError",HierarchyRequestError:"HierarchyRequestError",WrongDocumentError:"WrongDocumentError",InvalidCharacterError:"InvalidCharacterError",NoDataAllowedError:"NoDataAllowedError",NoModificationAllowedError:"NoModificationAllowedError",NotFoundError:"NotFoundError",NotSupportedError:"NotSupportedError",InUseAttributeError:"InUseAttributeError",InvalidStateError:"InvalidStateError",SyntaxError:"SyntaxError",InvalidModificationError:"InvalidModificationError",NamespaceError:"NamespaceError",InvalidAccessError:"InvalidAccessError",ValidationError:"ValidationError",TypeMismatchError:"TypeMismatchError",SecurityError:"SecurityError",NetworkError:"NetworkError",AbortError:"AbortError",URLMismatchError:"URLMismatchError",QuotaExceededError:"QuotaExceededError",TimeoutError:"TimeoutError",InvalidNodeTypeError:"InvalidNodeTypeError",DataCloneError:"DataCloneError",EncodingError:"EncodingError",NotReadableError:"NotReadableError",UnknownError:"UnknownError",ConstraintError:"ConstraintError",DataError:"DataError",TransactionInactiveError:"TransactionInactiveError",ReadOnlyError:"ReadOnlyError",VersionError:"VersionError",OperationError:"OperationError",NotAllowedError:"NotAllowedError",OptOutError:"OptOutError"}),Di=Object.keys(nn);function Ai(e){return typeof e=="number"&&e>=1&&e<=25}d(Ai,"isValidDomExceptionCode");function Ea(e){return typeof e=="string"&&e.substring(e.length-nn.Error.length)===nn.Error}d(Ea,"endsWithError");function rn(e,t){Ai(e)?(this.name=Di[e],this.message=t||""):(this.message=e,this.name=Ea(t)?t:nn.Error),Error.captureStackTrace&&Error.captureStackTrace(this,rn);}d(rn,"DOMException");bi(rn,true);Object.defineProperties(rn.prototype,{code:{enumerable:true,get:d(function(){var e=Di.indexOf(this.name);return Ai(e)?e:0},"get")}});var Ni={INDEX_SIZE_ERR:1,DOMSTRING_SIZE_ERR:2,HIERARCHY_REQUEST_ERR:3,WRONG_DOCUMENT_ERR:4,INVALID_CHARACTER_ERR:5,NO_DATA_ALLOWED_ERR:6,NO_MODIFICATION_ALLOWED_ERR:7,NOT_FOUND_ERR:8,NOT_SUPPORTED_ERR:9,INUSE_ATTRIBUTE_ERR:10,INVALID_STATE_ERR:11,SYNTAX_ERR:12,INVALID_MODIFICATION_ERR:13,NAMESPACE_ERR:14,INVALID_ACCESS_ERR:15,VALIDATION_ERR:16,TYPE_MISMATCH_ERR:17,SECURITY_ERR:18,NETWORK_ERR:19,ABORT_ERR:20,URL_MISMATCH_ERR:21,QUOTA_EXCEEDED_ERR:22,TIMEOUT_ERR:23,INVALID_NODE_TYPE_ERR:24,DATA_CLONE_ERR:25},Er=Object.entries(Ni);for(tn=0;tn<Er.length;tn++)Ei=Er[tn][0],rn[Ei]=Er[tn][1];var Ei,tn;function br(e,t){this.message=e,this.locator=t,Error.captureStackTrace&&Error.captureStackTrace(this,br);}d(br,"ParseError");bi(br);sn.DOMException=rn;sn.DOMExceptionName=nn;sn.ExceptionCode=Ni;sn.ParseError=br;});var kr=Re(z=>{function Oi(e){try{typeof e!="function"&&(e=RegExp);var t=new e("\u{1D306}","u").exec("\u{1D306}");return !!t&&t[0].length===2}catch{}return false}d(Oi,"detectUnicodeSupport");var At=Oi();function Je(e){if(e.source[0]!=="[")throw new Error(e+" can not be used with chars");return e.source.slice(1,e.source.lastIndexOf("]"))}d(Je,"chars");function bt(e,t){if(e.source[0]!=="[")throw new Error("/"+e.source+"/ can not be used with chars_without");if(!t||typeof t!="string")throw new Error(JSON.stringify(t)+" is not a valid search");if(e.source.indexOf(t)===-1)throw new Error('"'+t+'" is not is /'+e.source+"/");if(t==="-"&&e.source.indexOf(t)!==1)throw new Error('"'+t+'" is not at the first postion of /'+e.source+"/");return new RegExp(e.source.replace(t,""),At?"u":"")}d(bt,"chars_without");function V(e){var t=this;return new RegExp(Array.prototype.slice.call(arguments).map(function(n){var r=typeof n=="string";if(r&&t===void 0&&n==="|")throw new Error("use regg instead of reg to wrap expressions with `|`!");return r?n:n.source}).join(""),At?"mu":"m")}d(V,"reg");function j(e){if(arguments.length===0)throw new Error("no parameters provided");return V.apply(j,["(?:"].concat(Array.prototype.slice.call(arguments),[")"]))}d(j,"regg");var ba="\uFFFD",Ze=/[-\x09\x0A\x0D\x20-\x2C\x2E-\uD7FF\uE000-\uFFFD]/;At&&(Ze=V("[",Je(Ze),"\\u{10000}-\\u{10FFFF}","]"));var Da=new RegExp("[^"+Je(Ze)+"]",At?"u":""),Ar=/[\x20\x09\x0D\x0A]/,Aa=Je(Ar),ee=V(Ar,"+"),ie=V(Ar,"*"),an=/[:_a-zA-Z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/;At&&(an=V("[",Je(an),"\\u{10000}-\\u{10FFFF}","]"));var Na=Je(an),Nr=V("[",Na,Je(/[-.0-9\xB7]/),Je(/[\u0300-\u036F\u203F-\u2040]/),"]"),Te=V(an,Nr,"*"),xi=V(Nr,"+"),xa=V("&",Te,";"),Ca=j(/&#[0-9]+;|&#x[0-9a-fA-F]+;/),un=j(xa,"|",Ca),ln=V("%",Te,";"),xr=j(V('"',j(/[^%&"]/,"|",ln,"|",un),"*",'"'),"|",V("'",j(/[^%&']/,"|",ln,"|",un),"*","'")),Ta=j('"',j(/[^<&"]/,"|",un),"*",'"',"|","'",j(/[^<&']/,"|",un),"*","'"),ka=bt(an,":"),Sa=bt(Nr,":"),Ci=V(ka,Sa,"*"),cn=V(Ci,j(":",Ci),"?"),Ia=V("^",cn,"$"),Oa=V("(",cn,")"),Dt=j(/"[^"]*"|'[^']*'/),Pa=V(/^<\?/,"(",Te,")",j(ee,"(",Ze,"*?)"),"?",/\?>/),Ti=/[\x20\x0D\x0Aa-zA-Z0-9-'()+,./:=?;!*#@$_%]/,fn=j('"',Ti,'*"',"|","'",bt(Ti,"'"),"*'"),Pi="<!--",Mi="-->",Ma=V(Pi,j(bt(Ze,"-"),"|",V("-",bt(Ze,"-"))),"*",Mi),ki="#PCDATA",Ra=j(V(/\(/,ie,ki,j(ie,/\|/,ie,cn),"*",ie,/\)\*/),"|",V(/\(/,ie,ki,ie,/\)/)),Ba=/[?*+]?/,Fa=V(/\([^>]+\)/,Ba),La=j("EMPTY","|","ANY","|",Ra,"|",Fa),$a="<!ELEMENT",Ua=V($a,ee,j(cn,"|",ln),ee,j(La,"|",ln),ie,">"),qa=V("NOTATION",ee,/\(/,ie,Te,j(ie,/\|/,ie,Te),"*",ie,/\)/),ja=V(/\(/,ie,xi,j(ie,/\|/,ie,xi),"*",ie,/\)/),za=j(qa,"|",ja),Wa=j(/CDATA|ID|IDREF|IDREFS|ENTITY|ENTITIES|NMTOKEN|NMTOKENS/,"|",za),Ha=j(/#REQUIRED|#IMPLIED/,"|",j(j("#FIXED",ee),"?",Ta)),Va=j(ee,Te,ee,Wa,ee,Ha),Ga="<!ATTLIST",Ya=V(Ga,ee,Te,Va,"*",ie,">"),Dr="about:legacy-compat",Xa=j('"'+Dr+'"',"|","'"+Dr+"'"),Cr="SYSTEM",On="PUBLIC",Pn=j(j(Cr,ee,Dt),"|",j(On,ee,fn,ee,Dt)),Qa=V("^",j(j(Cr,ee,"(?<SystemLiteralOnly>",Dt,")"),"|",j(On,ee,"(?<PubidLiteral>",fn,")",ee,"(?<SystemLiteral>",Dt,")"))),Ja=V("^",fn,"$"),Za=V("^",Dt,"$"),Ka=j(ee,"NDATA",ee,Te),eu=j(xr,"|",j(Pn,Ka,"?")),Ri="<!ENTITY",tu=V(Ri,ee,Te,ee,eu,ie,">"),nu=j(xr,"|",Pn),ru=V(Ri,ee,"%",ee,Te,ee,nu,ie,">"),iu=j(tu,"|",ru),su=V(On,ee,fn),ou=V("<!NOTATION",ee,Te,ee,j(Pn,"|",su),ie,">"),Tr=V(ie,"=",ie),Si=/1[.]\d+/,au=V(ee,"version",Tr,j("'",Si,"'","|",'"',Si,'"')),Ii=/[A-Za-z][-A-Za-z0-9._]*/,uu=j(ee,"encoding",Tr,j('"',Ii,'"',"|","'",Ii,"'")),lu=j(ee,"standalone",Tr,j("'",j("yes","|","no"),"'","|",'"',j("yes","|","no"),'"')),cu=V(/^<\?xml/,au,uu,"?",lu,"?",ie,/\?>/),fu="<!DOCTYPE",du="<![CDATA[",hu="]]>",pu=/<!\[CDATA\[/,mu=/\]\]>/,_u=V(Ze,"*?",mu),gu=V(pu,_u);z.chars=Je;z.chars_without=bt;z.detectUnicodeSupport=Oi;z.reg=V;z.regg=j;z.ABOUT_LEGACY_COMPAT=Dr;z.ABOUT_LEGACY_COMPAT_SystemLiteral=Xa;z.AttlistDecl=Ya;z.CDATA_START=du;z.CDATA_END=hu;z.CDSect=gu;z.Char=Ze;z.Comment=Ma;z.COMMENT_START=Pi;z.COMMENT_END=Mi;z.DOCTYPE_DECL_START=fu;z.elementdecl=Ua;z.EntityDecl=iu;z.EntityValue=xr;z.ExternalID=Pn;z.ExternalID_match=Qa;z.Name=Te;z.NotationDecl=ou;z.Reference=un;z.PEReference=ln;z.PI=Pa;z.PUBLIC=On;z.PubidLiteral=fn;z.PubidLiteral_match=Ja;z.QName=cn;z.QName_exact=Ia;z.QName_group=Oa;z.S=ee;z.SChar_s=Aa;z.S_OPT=ie;z.SYSTEM=Cr;z.SystemLiteral=Dt;z.SystemLiteral_match=Za;z.InvalidChar=Da;z.UNICODE_REPLACEMENT_CHARACTER=ba;z.UNICODE_SUPPORT=At;z.XMLDecl=cu;});var Fr=Re(ae=>{var Ie=ct(),$e=Ie.find,wu=Ie.hasDefaultHTMLNamespace,xt=Ie.hasOwn,vu=Ie.isHTMLMimeType,yu=Ie.isHTMLRawTextElement,Eu=Ie.isHTMLVoidElement,dn=Ie.MIME_TYPE,Ue=Ie.NAMESPACE,_e=Symbol(),ji=on(),L=ji.DOMException,ke=ji.DOMExceptionName,de=kr();function Ee(e){if(e!==_e)throw new TypeError("Illegal constructor")}d(Ee,"checkSymbol");function bu(e){return e!==""}d(bu,"notEmptyString");function Du(e){return e?e.split(/[\t\n\f\r ]+/).filter(bu):[]}d(Du,"splitOnASCIIWhitespace");function Au(e,t){return xt(e,t)||(e[t]=true),e}d(Au,"orderedSetReducer");function Bi(e){if(!e)return [];var t=Du(e);return Object.keys(t.reduce(Au,{}))}d(Bi,"toOrderedSet");function Nu(e){return function(t){return e&&e.indexOf(t)!==-1}}d(Nu,"arrayIncludes");function zi(e){if(!de.QName_exact.test(e))throw new L(L.INVALID_CHARACTER_ERR,'invalid character in qualified name "'+e+'"')}d(zi,"validateQualifiedName");function Ir(e,t){zi(t),e=e||null;var n=null,r=t;if(t.indexOf(":")>=0){var s=t.split(":");n=s[0],r=s[1];}if(n!==null&&e===null)throw new L(L.NAMESPACE_ERR,"prefix is non-null and namespace is null");if(n==="xml"&&e!==Ie.NAMESPACE.XML)throw new L(L.NAMESPACE_ERR,'prefix is "xml" and namespace is not the XML namespace');if((n==="xmlns"||t==="xmlns")&&e!==Ie.NAMESPACE.XMLNS)throw new L(L.NAMESPACE_ERR,'either qualifiedName or prefix is "xmlns" and namespace is not the XMLNS namespace');if(e===Ie.NAMESPACE.XMLNS&&n!=="xmlns"&&t!=="xmlns")throw new L(L.NAMESPACE_ERR,'namespace is the XMLNS namespace and neither qualifiedName nor prefix is "xmlns"');return [e,n,r]}d(Ir,"validateAndExtract");function kt(e,t){for(var n in e)xt(e,n)&&(t[n]=e[n]);}d(kt,"copy");function be(e,t){var n=e.prototype;if(!(n instanceof t)){let r=function(){};d(r,"t"),r.prototype=t.prototype,r=new r,kt(n,r),e.prototype=n=r;}n.constructor!=e&&(n.constructor=e);}d(be,"_extends");var De={},Se=De.ELEMENT_NODE=1,Ct=De.ATTRIBUTE_NODE=2,Bn=De.TEXT_NODE=3,Wi=De.CDATA_SECTION_NODE=4,Hi=De.ENTITY_REFERENCE_NODE=5,xu=De.ENTITY_NODE=6,Or=De.PROCESSING_INSTRUCTION_NODE=7,Pr=De.COMMENT_NODE=8,Nt=De.DOCUMENT_NODE=9,Vi=De.DOCUMENT_TYPE_NODE=10,Ke=De.DOCUMENT_FRAGMENT_NODE=11,Cu=De.NOTATION_NODE=12,oe=Ie.freeze({DOCUMENT_POSITION_DISCONNECTED:1,DOCUMENT_POSITION_PRECEDING:2,DOCUMENT_POSITION_FOLLOWING:4,DOCUMENT_POSITION_CONTAINS:8,DOCUMENT_POSITION_CONTAINED_BY:16,DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC:32});function Gi(e,t){if(t.length<e.length)return Gi(t,e);var n=null;for(var r in e){if(e[r]!==t[r])return n;n=e[r];}return n}d(Gi,"commonAncestor");function Fi(e){return e.guid||(e.guid=Math.random()),e.guid}d(Fi,"docGUID");function ue(){}d(ue,"NodeList");ue.prototype={length:0,item:d(function(e){return e>=0&&e<this.length?this[e]:null},"item"),toString:d(function(e){var t;typeof e=="function"?t={requireWellFormed:false,splitCDATASections:true,nodeFilter:e}:e?t={requireWellFormed:!!e.requireWellFormed,splitCDATASections:e.splitCDATASections!==false,nodeFilter:e.nodeFilter||null}:t={requireWellFormed:false,splitCDATASections:true,nodeFilter:null};for(var n=[],r=0;r<this.length;r++)Br(this[r],n,null,t);return n.join("")},"toString"),filter:d(function(e){return Array.prototype.filter.call(this,e)},"filter"),indexOf:d(function(e){return Array.prototype.indexOf.call(this,e)},"indexOf")};ue.prototype[Symbol.iterator]=function(){var e=this,t=0;return {next:d(function(){return t<e.length?{value:e[t++],done:false}:{done:true}},"next"),return:d(function(){return {done:true}},"return")}};function Le(e,t){this._node=e,this._refresh=t,Ln(this);}d(Le,"LiveNodeList");function Ln(e){var t=e._node._inc||e._node.ownerDocument._inc;if(e._inc!==t){var n=e._refresh(e._node);if(ss(e,"length",n.length),!e.$$length||n.length<e.$$length)for(var r=n.length;r in e;r++)xt(e,r)&&delete e[r];kt(n,e),e._inc=t;}}d(Ln,"_updateLiveList");Le.prototype.item=function(e){return Ln(this),this[e]||null};be(Le,ue);function Tt(){}d(Tt,"NamedNodeMap");function Yi(e,t){for(var n=0;n<e.length;){if(e[n]===t)return n;n++;}}d(Yi,"_findNodeIndex");function Tu(e,t,n,r){if(r?t[Yi(t,r)]=n:(t[t.length]=n,t.length++),e){n.ownerElement=e;var s=e.ownerDocument;s&&(r&&Ji(s,e,r),ku(s,e,n));}}d(Tu,"_addNamedNode");function Li(e,t,n){var r=Yi(t,n);if(r>=0){for(var s=t.length-1;r<=s;)t[r]=t[++r];if(t.length=s,e){var i=e.ownerDocument;i&&Ji(i,e,n),n.ownerElement=null;}}}d(Li,"_removeNamedNode");Tt.prototype={length:0,item:ue.prototype.item,getNamedItem:d(function(e){this._ownerElement&&this._ownerElement._isInHTMLDocumentAndNamespace()&&(e=e.toLowerCase());for(var t=0;t<this.length;){var n=this[t];if(n.nodeName===e)return n;t++;}return null},"getNamedItem"),setNamedItem:d(function(e){var t=e.ownerElement;if(t&&t!==this._ownerElement)throw new L(L.INUSE_ATTRIBUTE_ERR);var n=this.getNamedItemNS(e.namespaceURI,e.localName);return n===e?e:(Tu(this._ownerElement,this,e,n),n)},"setNamedItem"),setNamedItemNS:d(function(e){return this.setNamedItem(e)},"setNamedItemNS"),removeNamedItem:d(function(e){var t=this.getNamedItem(e);if(!t)throw new L(L.NOT_FOUND_ERR,e);return Li(this._ownerElement,this,t),t},"removeNamedItem"),removeNamedItemNS:d(function(e,t){var n=this.getNamedItemNS(e,t);if(!n)throw new L(L.NOT_FOUND_ERR,e?e+" : "+t:t);return Li(this._ownerElement,this,n),n},"removeNamedItemNS"),getNamedItemNS:d(function(e,t){e||(e=null);for(var n=0;n<this.length;){var r=this[n];if(r.localName===t&&r.namespaceURI===e)return r;n++;}return null},"getNamedItemNS")};Tt.prototype[Symbol.iterator]=function(){var e=this,t=0;return {next:d(function(){return t<e.length?{value:e[t++],done:false}:{done:true}},"next"),return:d(function(){return {done:true}},"return")}};function Xi(){}d(Xi,"DOMImplementation");Xi.prototype={hasFeature:d(function(e,t){return true},"hasFeature"),createDocument:d(function(e,t,n){var r=dn.XML_APPLICATION;e===Ue.HTML?r=dn.XML_XHTML_APPLICATION:e===Ue.SVG&&(r=dn.XML_SVG_IMAGE);var s=new Ve(_e,{contentType:r});if(s.implementation=this,s.childNodes=new ue,s.doctype=n||null,n&&s.appendChild(n),t){var i=s.createElementNS(e,t);s.appendChild(i);}return s},"createDocument"),createDocumentType:d(function(e,t,n,r){zi(e);var s=new qn(_e);return s.name=e,s.nodeName=e,s.publicId=t||"",s.systemId=n||"",s.internalSubset=r||"",s.childNodes=new ue,s},"createDocumentType"),createHTMLDocument:d(function(e){var t=new Ve(_e,{contentType:dn.HTML});if(t.implementation=this,t.childNodes=new ue,e!==false){t.doctype=this.createDocumentType("html"),t.doctype.ownerDocument=t,t.appendChild(t.doctype);var n=t.createElement("html");t.appendChild(n);var r=t.createElement("head");if(n.appendChild(r),typeof e=="string"){var s=t.createElement("title");s.appendChild(t.createTextNode(e)),r.appendChild(s);}n.appendChild(t.createElement("body"));}return t},"createHTMLDocument")};function Y(e){Ee(e);}d(Y,"Node");Y.prototype={firstChild:null,lastChild:null,previousSibling:null,nextSibling:null,parentNode:null,get parentElement(){return this.parentNode&&this.parentNode.nodeType===this.ELEMENT_NODE?this.parentNode:null},childNodes:null,ownerDocument:null,nodeValue:null,namespaceURI:null,prefix:null,localName:null,baseURI:"about:blank",get isConnected(){var e=this.getRootNode();return e&&e.nodeType===e.DOCUMENT_NODE},contains:d(function(e){if(!e)return false;var t=e;do{if(this===t)return true;t=t.parentNode;}while(t);return false},"contains"),getRootNode:d(function(e){var t=this;do{if(!t.parentNode)return t;t=t.parentNode;}while(t)},"getRootNode"),isEqualNode:d(function(e){if(!e)return false;for(var t=[{node:this,other:e}];t.length>0;){var n=t.pop(),r=n.node,s=n.other;if(r.nodeType!==s.nodeType)return false;switch(r.nodeType){case r.DOCUMENT_TYPE_NODE:if(r.name!==s.name||r.publicId!==s.publicId||r.systemId!==s.systemId)return false;break;case r.ELEMENT_NODE:if(r.namespaceURI!==s.namespaceURI||r.prefix!==s.prefix||r.localName!==s.localName||r.attributes.length!==s.attributes.length)return false;for(var i=0;i<r.attributes.length;i++){var o=r.attributes.item(i),l=s.getAttributeNodeNS(o.namespaceURI,o.localName);if(!l)return false;t.push({node:o,other:l});}break;case r.ATTRIBUTE_NODE:if(r.namespaceURI!==s.namespaceURI||r.localName!==s.localName||r.value!==s.value)return false;break;case r.PROCESSING_INSTRUCTION_NODE:if(r.target!==s.target||r.data!==s.data)return false;break;case r.TEXT_NODE:case r.CDATA_SECTION_NODE:case r.COMMENT_NODE:if(r.data!==s.data)return false;break}if(r.childNodes.length!==s.childNodes.length)return false;for(var i=r.childNodes.length-1;i>=0;i--)t.push({node:r.childNodes[i],other:s.childNodes[i]});}return true},"isEqualNode"),isSameNode:d(function(e){return this===e},"isSameNode"),insertBefore:d(function(e,t){return Fn(this,e,t)},"insertBefore"),replaceChild:d(function(e,t){Fn(this,e,t,ts),t&&this.removeChild(t);},"replaceChild"),removeChild:d(function(e){return Ki(this,e)},"removeChild"),appendChild:d(function(e){return this.insertBefore(e,null)},"appendChild"),hasChildNodes:d(function(){return this.firstChild!=null},"hasChildNodes"),cloneNode:d(function(e){return is(this.ownerDocument||this,this,e)},"cloneNode"),normalize:d(function(){he(this,null,{enter:d(function(e){for(var t=e.firstChild;t;){var n=t.nextSibling;n!==null&&n.nodeType===Bn&&t.nodeType===Bn?(e.removeChild(n),t.appendData(n.data)):t=n;}return true},"enter")});},"normalize"),isSupported:d(function(e,t){return this.ownerDocument.implementation.hasFeature(e,t)},"isSupported"),lookupPrefix:d(function(e){for(var t=this;t;){var n=t._nsMap;if(n){for(var r in n)if(xt(n,r)&&n[r]===e)return r}t=t.nodeType==Ct?t.ownerDocument:t.parentNode;}return null},"lookupPrefix"),lookupNamespaceURI:d(function(e){for(var t=this;t;){var n=t._nsMap;if(n&&xt(n,e))return n[e];t=t.nodeType==Ct?t.ownerDocument:t.parentNode;}return null},"lookupNamespaceURI"),isDefaultNamespace:d(function(e){var t=this.lookupPrefix(e);return t==null},"isDefaultNamespace"),compareDocumentPosition:d(function(e){if(this===e)return 0;var t=e,n=this,r=null,s=null;if(t instanceof ft&&(r=t,t=r.ownerElement),n instanceof ft&&(s=n,n=s.ownerElement,r&&t&&n===t))for(var i=0,o;o=n.attributes[i];i++){if(o===r)return oe.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC+oe.DOCUMENT_POSITION_PRECEDING;if(o===s)return oe.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC+oe.DOCUMENT_POSITION_FOLLOWING}if(!t||!n||n.ownerDocument!==t.ownerDocument)return oe.DOCUMENT_POSITION_DISCONNECTED+oe.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC+(Fi(n.ownerDocument)>Fi(t.ownerDocument)?oe.DOCUMENT_POSITION_FOLLOWING:oe.DOCUMENT_POSITION_PRECEDING);if(s&&t===n)return oe.DOCUMENT_POSITION_CONTAINS+oe.DOCUMENT_POSITION_PRECEDING;if(r&&t===n)return oe.DOCUMENT_POSITION_CONTAINED_BY+oe.DOCUMENT_POSITION_FOLLOWING;for(var l=[],u=t.parentNode;u;){if(!s&&u===n)return oe.DOCUMENT_POSITION_CONTAINED_BY+oe.DOCUMENT_POSITION_FOLLOWING;l.push(u),u=u.parentNode;}l.reverse();for(var a=[],c=n.parentNode;c;){if(!r&&c===t)return oe.DOCUMENT_POSITION_CONTAINS+oe.DOCUMENT_POSITION_PRECEDING;a.push(c),c=c.parentNode;}a.reverse();var f=Gi(l,a);for(var h in f.childNodes){var p=f.childNodes[h];if(p===n)return oe.DOCUMENT_POSITION_FOLLOWING;if(p===t)return oe.DOCUMENT_POSITION_PRECEDING;if(a.indexOf(p)>=0)return oe.DOCUMENT_POSITION_FOLLOWING;if(l.indexOf(p)>=0)return oe.DOCUMENT_POSITION_PRECEDING}return 0},"compareDocumentPosition")};function Qi(e){return e=="<"&&"<"||e==">"&&">"||e=="&"&&"&"||e=='"'&&"""||"&#"+e.charCodeAt()+";"}d(Qi,"_xmlEncoder");kt(De,Y);kt(De,Y.prototype);kt(oe,Y);kt(oe,Y.prototype);function Rn(e,t){he(e,null,{enter:d(function(n){return t(n)?he.STOP:true},"enter")});}d(Rn,"_visitNode");function he(e,t,n){for(var r=[{node:e,context:t,phase:he.ENTER}];r.length>0;){var s=r.pop();if(s.phase===he.ENTER){var i=n.enter(s.node,s.context);if(i===he.STOP)return he.STOP;if(r.push({node:s.node,context:i,phase:he.EXIT}),i==null)continue;for(var o=s.node.lastChild;o;)r.push({node:o,context:i,phase:he.ENTER}),o=o.previousSibling;}else n.exit&&n.exit(s.node,s.context);}}d(he,"walkDOM");he.STOP=Symbol("walkDOM.STOP");he.ENTER=0;he.EXIT=1;function Ve(e,t){Ee(e);var n=t||{};this.ownerDocument=this,this.contentType=n.contentType||dn.XML_APPLICATION,this.type=vu(this.contentType)?"html":"xml";}d(Ve,"Document");function ku(e,t,n){e&&e._inc++;var r=n.namespaceURI;r===Ue.XMLNS&&(t._nsMap[n.prefix?n.localName:""]=n.value);}d(ku,"_onAddAttribute");function Ji(e,t,n,r){e&&e._inc++;var s=n.namespaceURI;s===Ue.XMLNS&&delete t._nsMap[n.prefix?n.localName:""];}d(Ji,"_onRemoveAttribute");function Zi(e,t,n){if(e&&e._inc){e._inc++;var r=t.childNodes;if(n&&!n.nextSibling)r[r.length++]=n;else {for(var s=t.firstChild,i=0;s;)r[i++]=s,s=s.nextSibling;r.length=i,delete r[r.length];}}}d(Zi,"_onUpdateChild");function Ki(e,t){if(e!==t.parentNode)throw new L(L.NOT_FOUND_ERR,"child's parent is not parent");var n=t.previousSibling,r=t.nextSibling;return n?n.nextSibling=r:e.firstChild=r,r?r.previousSibling=n:e.lastChild=n,Zi(e.ownerDocument,e),t.parentNode=null,t.previousSibling=null,t.nextSibling=null,t}d(Ki,"_removeChild");function Su(e){return e&&(e.nodeType===Y.DOCUMENT_NODE||e.nodeType===Y.DOCUMENT_FRAGMENT_NODE||e.nodeType===Y.ELEMENT_NODE)}d(Su,"hasValidParentNodeType");function Iu(e){return e&&(e.nodeType===Y.CDATA_SECTION_NODE||e.nodeType===Y.COMMENT_NODE||e.nodeType===Y.DOCUMENT_FRAGMENT_NODE||e.nodeType===Y.DOCUMENT_TYPE_NODE||e.nodeType===Y.ELEMENT_NODE||e.nodeType===Y.PROCESSING_INSTRUCTION_NODE||e.nodeType===Y.TEXT_NODE)}d(Iu,"hasInsertableNodeType");function et(e){return e&&e.nodeType===Y.DOCUMENT_TYPE_NODE}d(et,"isDocTypeNode");function He(e){return e&&e.nodeType===Y.ELEMENT_NODE}d(He,"isElementNode");function es(e){return e&&e.nodeType===Y.TEXT_NODE}d(es,"isTextNode");function $i(e,t){var n=e.childNodes||[];if($e(n,He)||et(t))return false;var r=$e(n,et);return !(t&&r&&n.indexOf(r)>n.indexOf(t))}d($i,"isElementInsertionPossible");function Ui(e,t){var n=e.childNodes||[];function r(i){return He(i)&&i!==t}if(d(r,"hasElementChildThatIsNotChild"),$e(n,r))return false;var s=$e(n,et);return !(t&&s&&n.indexOf(s)>n.indexOf(t))}d(Ui,"isElementReplacementPossible");function Ou(e,t,n){if(!Su(e))throw new L(L.HIERARCHY_REQUEST_ERR,"Unexpected parent node type "+e.nodeType);if(n&&n.parentNode!==e)throw new L(L.NOT_FOUND_ERR,"child not in parent");if(!Iu(t)||et(t)&&e.nodeType!==Y.DOCUMENT_NODE)throw new L(L.HIERARCHY_REQUEST_ERR,"Unexpected node type "+t.nodeType+" for parent node type "+e.nodeType)}d(Ou,"assertPreInsertionValidity1to5");function Pu(e,t,n){var r=e.childNodes||[],s=t.childNodes||[];if(t.nodeType===Y.DOCUMENT_FRAGMENT_NODE){var i=s.filter(He);if(i.length>1||$e(s,es))throw new L(L.HIERARCHY_REQUEST_ERR,"More than one element or text in fragment");if(i.length===1&&!$i(e,n))throw new L(L.HIERARCHY_REQUEST_ERR,"Element in fragment can not be inserted before doctype")}if(He(t)&&!$i(e,n))throw new L(L.HIERARCHY_REQUEST_ERR,"Only one element can be added and only after doctype");if(et(t)){if($e(r,et))throw new L(L.HIERARCHY_REQUEST_ERR,"Only one doctype is allowed");var o=$e(r,He);if(n&&r.indexOf(o)<r.indexOf(n))throw new L(L.HIERARCHY_REQUEST_ERR,"Doctype can only be inserted before an element");if(!n&&o)throw new L(L.HIERARCHY_REQUEST_ERR,"Doctype can not be appended since element is present")}}d(Pu,"assertPreInsertionValidityInDocument");function ts(e,t,n){var r=e.childNodes||[],s=t.childNodes||[];if(t.nodeType===Y.DOCUMENT_FRAGMENT_NODE){var i=s.filter(He);if(i.length>1||$e(s,es))throw new L(L.HIERARCHY_REQUEST_ERR,"More than one element or text in fragment");if(i.length===1&&!Ui(e,n))throw new L(L.HIERARCHY_REQUEST_ERR,"Element in fragment can not be inserted before doctype")}if(He(t)&&!Ui(e,n))throw new L(L.HIERARCHY_REQUEST_ERR,"Only one element can be added and only after doctype");if(et(t)){let l=function(u){return et(u)&&u!==n};if(d(l,"hasDoctypeChildThatIsNotChild"),$e(r,l))throw new L(L.HIERARCHY_REQUEST_ERR,"Only one doctype is allowed");var o=$e(r,He);if(n&&r.indexOf(o)<r.indexOf(n))throw new L(L.HIERARCHY_REQUEST_ERR,"Doctype can only be inserted before an element")}}d(ts,"assertPreReplacementValidityInDocument");function Fn(e,t,n,r){Ou(e,t,n),e.nodeType===Y.DOCUMENT_NODE&&(r||Pu)(e,t,n);var s=t.parentNode;if(s&&s.removeChild(t),t.nodeType===Ke){var i=t.firstChild;if(i==null)return t;var o=t.lastChild;}else i=o=t;var l=n?n.previousSibling:e.lastChild;i.previousSibling=l,o.nextSibling=n,l?l.nextSibling=i:e.firstChild=i,n==null?e.lastChild=o:n.previousSibling=o;do i.parentNode=e;while(i!==o&&(i=i.nextSibling));return Zi(e.ownerDocument||e,e,t),t.nodeType==Ke&&(t.firstChild=t.lastChild=null),t}d(Fn,"_insertBefore");Ve.prototype={implementation:null,nodeName:"#document",nodeType:Nt,doctype:null,documentElement:null,_inc:1,insertBefore:d(function(e,t){if(e.nodeType===Ke){for(var n=e.firstChild;n;){var r=n.nextSibling;this.insertBefore(n,t),n=r;}return e}return Fn(this,e,t),e.ownerDocument=this,this.documentElement===null&&e.nodeType===Se&&(this.documentElement=e),e},"insertBefore"),removeChild:d(function(e){var t=Ki(this,e);return t===this.documentElement&&(this.documentElement=null),t},"removeChild"),replaceChild:d(function(e,t){Fn(this,e,t,ts),e.ownerDocument=this,t&&this.removeChild(t),He(e)&&(this.documentElement=e);},"replaceChild"),importNode:d(function(e,t){return Mu(this,e,t)},"importNode"),getElementById:d(function(e){var t=null;return Rn(this.documentElement,function(n){if(n.nodeType==Se&&n.getAttribute("id")==e)return t=n,true}),t},"getElementById"),createElement:d(function(e){var t=new Ge(_e);t.ownerDocument=this,this.type==="html"&&(e=e.toLowerCase()),wu(this.contentType)&&(t.namespaceURI=Ue.HTML),t.nodeName=e,t.tagName=e,t.localName=e,t.childNodes=new ue;var n=t.attributes=new Tt;return n._ownerElement=t,t},"createElement"),createDocumentFragment:d(function(){var e=new It(_e);return e.ownerDocument=this,e.childNodes=new ue,e},"createDocumentFragment"),createTextNode:d(function(e){var t=new hn(_e);return t.ownerDocument=this,t.childNodes=new ue,t.appendData(e),t},"createTextNode"),createComment:d(function(e){var t=new $n(_e);return t.ownerDocument=this,t.childNodes=new ue,t.appendData(e),t},"createComment"),createCDATASection:d(function(e){if(e.indexOf("]]>")!==-1)throw new L(L.INVALID_CHARACTER_ERR,'data contains "]]>"');var t=new Un(_e);return t.ownerDocument=this,t.childNodes=new ue,t.appendData(e),t},"createCDATASection"),createProcessingInstruction:d(function(e,t){var n=new zn(_e);return n.ownerDocument=this,n.childNodes=new ue,n.nodeName=n.target=e,n.nodeValue=n.data=t,n},"createProcessingInstruction"),createAttribute:d(function(e){if(!de.QName_exact.test(e))throw new L(L.INVALID_CHARACTER_ERR,'invalid character in name "'+e+'"');return this.type==="html"&&(e=e.toLowerCase()),this._createAttribute(e)},"createAttribute"),_createAttribute:d(function(e){var t=new ft(_e);return t.ownerDocument=this,t.childNodes=new ue,t.name=e,t.nodeName=e,t.localName=e,t.specified=true,t},"_createAttribute"),createEntityReference:d(function(e){if(!de.Name.test(e))throw new L(L.INVALID_CHARACTER_ERR,'not a valid xml name "'+e+'"');if(this.type==="html")throw new L("document is an html document",ke.NotSupportedError);var t=new jn(_e);return t.ownerDocument=this,t.childNodes=new ue,t.nodeName=e,t},"createEntityReference"),createElementNS:d(function(e,t){var n=Ir(e,t),r=new Ge(_e),s=r.attributes=new Tt;return r.childNodes=new ue,r.ownerDocument=this,r.nodeName=t,r.tagName=t,r.namespaceURI=n[0],r.prefix=n[1],r.localName=n[2],s._ownerElement=r,r},"createElementNS"),createAttributeNS:d(function(e,t){var n=Ir(e,t),r=new ft(_e);return r.ownerDocument=this,r.childNodes=new ue,r.nodeName=t,r.name=t,r.specified=true,r.namespaceURI=n[0],r.prefix=n[1],r.localName=n[2],r},"createAttributeNS")};be(Ve,Y);function Ge(e){Ee(e),this._nsMap=Object.create(null);}d(Ge,"Element");Ge.prototype={nodeType:Se,attributes:null,getQualifiedName:d(function(){return this.prefix?this.prefix+":"+this.localName:this.localName},"getQualifiedName"),_isInHTMLDocumentAndNamespace:d(function(){return this.ownerDocument.type==="html"&&this.namespaceURI===Ue.HTML},"_isInHTMLDocumentAndNamespace"),hasAttributes:d(function(){return !!(this.attributes&&this.attributes.length)},"hasAttributes"),hasAttribute:d(function(e){return !!this.getAttributeNode(e)},"hasAttribute"),getAttribute:d(function(e){var t=this.getAttributeNode(e);return t?t.value:null},"getAttribute"),getAttributeNode:d(function(e){return this._isInHTMLDocumentAndNamespace()&&(e=e.toLowerCase()),this.attributes.getNamedItem(e)},"getAttributeNode"),setAttribute:d(function(e,t){this._isInHTMLDocumentAndNamespace()&&(e=e.toLowerCase());var n=this.getAttributeNode(e);n?n.value=n.nodeValue=""+t:(n=this.ownerDocument._createAttribute(e),n.value=n.nodeValue=""+t,this.setAttributeNode(n));},"setAttribute"),removeAttribute:d(function(e){var t=this.getAttributeNode(e);t&&this.removeAttributeNode(t);},"removeAttribute"),setAttributeNode:d(function(e){return this.attributes.setNamedItem(e)},"setAttributeNode"),setAttributeNodeNS:d(function(e){return this.attributes.setNamedItemNS(e)},"setAttributeNodeNS"),removeAttributeNode:d(function(e){return this.attributes.removeNamedItem(e.nodeName)},"removeAttributeNode"),removeAttributeNS:d(function(e,t){var n=this.getAttributeNodeNS(e,t);n&&this.removeAttributeNode(n);},"removeAttributeNS"),hasAttributeNS:d(function(e,t){return this.getAttributeNodeNS(e,t)!=null},"hasAttributeNS"),getAttributeNS:d(function(e,t){var n=this.getAttributeNodeNS(e,t);return n?n.value:null},"getAttributeNS"),setAttributeNS:d(function(e,t,n){var r=Ir(e,t),s=r[2],i=this.getAttributeNodeNS(e,s);i?i.value=i.nodeValue=""+n:(i=this.ownerDocument.createAttributeNS(e,t),i.value=i.nodeValue=""+n,this.setAttributeNode(i));},"setAttributeNS"),getAttributeNodeNS:d(function(e,t){return this.attributes.getNamedItemNS(e,t)},"getAttributeNodeNS"),getElementsByClassName:d(function(e){var t=Bi(e);return new Le(this,function(n){var r=[];return t.length>0&&Rn(n,function(s){if(s!==n&&s.nodeType===Se){var i=s.getAttribute("class");if(i){var o=e===i;if(!o){var l=Bi(i);o=t.every(Nu(l));}o&&r.push(s);}}}),r})},"getElementsByClassName"),getElementsByTagName:d(function(e){var t=(this.nodeType===Nt?this:this.ownerDocument).type==="html",n=e.toLowerCase();return new Le(this,function(r){var s=[];return Rn(r,function(i){if(!(i===r||i.nodeType!==Se))if(e==="*")s.push(i);else {var o=i.getQualifiedName(),l=t&&i.namespaceURI===Ue.HTML?n:e;o===l&&s.push(i);}}),s})},"getElementsByTagName"),getElementsByTagNameNS:d(function(e,t){return new Le(this,function(n){var r=[];return Rn(n,function(s){s!==n&&s.nodeType===Se&&(e==="*"||s.namespaceURI===e)&&(t==="*"||s.localName==t)&&r.push(s);}),r})},"getElementsByTagNameNS")};Ve.prototype.getElementsByClassName=Ge.prototype.getElementsByClassName;Ve.prototype.getElementsByTagName=Ge.prototype.getElementsByTagName;Ve.prototype.getElementsByTagNameNS=Ge.prototype.getElementsByTagNameNS;be(Ge,Y);function ft(e){Ee(e),this.namespaceURI=null,this.prefix=null,this.ownerElement=null;}d(ft,"Attr");ft.prototype.nodeType=Ct;be(ft,Y);function St(e){Ee(e);}d(St,"CharacterData");St.prototype={data:"",substringData:d(function(e,t){return this.data.substring(e,e+t)},"substringData"),appendData:d(function(e){e=this.data+e,this.nodeValue=this.data=e,this.length=e.length;},"appendData"),insertData:d(function(e,t){this.replaceData(e,0,t);},"insertData"),deleteData:d(function(e,t){this.replaceData(e,t,"");},"deleteData"),replaceData:d(function(e,t,n){var r=this.data.substring(0,e),s=this.data.substring(e+t);n=r+n+s,this.nodeValue=this.data=n,this.length=n.length;},"replaceData")};be(St,Y);function hn(e){Ee(e);}d(hn,"Text");hn.prototype={nodeName:"#text",nodeType:Bn,splitText:d(function(e){var t=this.data,n=t.substring(e);t=t.substring(0,e),this.data=this.nodeValue=t,this.length=t.length;var r=this.ownerDocument.createTextNode(n);return this.parentNode&&this.parentNode.insertBefore(r,this.nextSibling),r},"splitText")};be(hn,St);function $n(e){Ee(e);}d($n,"Comment");$n.prototype={nodeName:"#comment",nodeType:Pr};be($n,St);function Un(e){Ee(e);}d(Un,"CDATASection");Un.prototype={nodeName:"#cdata-section",nodeType:Wi};be(Un,hn);function qn(e){Ee(e);}d(qn,"DocumentType");qn.prototype.nodeType=Vi;be(qn,Y);function Mr(e){Ee(e);}d(Mr,"Notation");Mr.prototype.nodeType=Cu;be(Mr,Y);function Rr(e){Ee(e);}d(Rr,"Entity");Rr.prototype.nodeType=xu;be(Rr,Y);function jn(e){Ee(e);}d(jn,"EntityReference");jn.prototype.nodeType=Hi;be(jn,Y);function It(e){Ee(e);}d(It,"DocumentFragment");It.prototype.nodeName="#document-fragment";It.prototype.nodeType=Ke;be(It,Y);function zn(e){Ee(e);}d(zn,"ProcessingInstruction");zn.prototype.nodeType=Or;be(zn,St);function ns(){}d(ns,"XMLSerializer");ns.prototype.serializeToString=function(e,t){return rs.call(e,t)};Y.prototype.toString=rs;function rs(e){var t;typeof e=="function"?t={requireWellFormed:false,splitCDATASections:true,nodeFilter:e}:e!=null?t={requireWellFormed:!!e.requireWellFormed,splitCDATASections:e.splitCDATASections!==false,nodeFilter:e.nodeFilter||null}:t={requireWellFormed:false,splitCDATASections:true,nodeFilter:null};var n=[],r=this.nodeType===Nt&&this.documentElement||this,s=r.prefix,i=r.namespaceURI;if(i&&s==null){var s=r.lookupPrefix(i);if(s==null)var o=[{namespace:i,prefix:null}];}return Br(this,n,o,t),n.join("")}d(rs,"nodeSerializeToString");function qi(e,t,n){var r=e.prefix||"",s=e.namespaceURI;if(!s||r==="xml"&&s===Ue.XML||s===Ue.XMLNS)return false;for(var i=n.length;i--;){var o=n[i];if(o.prefix===r)return o.namespace!==s}return true}d(qi,"needNamespaceDefine");function Mn(e,t,n){e.push(" ",t,'="',n.replace(/[<>&"\t\n\r]/g,Qi),'"');}d(Mn,"addSerializedAttribute");function Br(e,t,n,r){n||(n=[]);var s=r.nodeFilter,i=r.requireWellFormed,o=r.splitCDATASections,l=e.nodeType===Nt?e:e.ownerDocument,u=l.type==="html";he(e,{ns:n},{enter:d(function(a,c){var f=c.ns;if(s)if(a=s(a),a){if(typeof a=="string")return t.push(a),null}else return null;switch(a.nodeType){case Se:var h=a.attributes,p=h.length,_=a.tagName,m=_;if(!u&&!a.prefix&&a.namespaceURI){for(var g,v=0;v<h.length;v++)if(h.item(v).name==="xmlns"){g=h.item(v).value;break}if(!g)for(var D=f.length-1;D>=0;D--){var y=f[D];if(y.prefix===""&&y.namespace===a.namespaceURI){g=y.namespace;break}}if(g!==a.namespaceURI)for(var D=f.length-1;D>=0;D--){var y=f[D];if(y.namespace===a.namespaceURI){y.prefix&&(m=y.prefix+":"+_);break}}}t.push("<",m);for(var w=f.slice(),E=0;E<p;E++){var b=h.item(E);b.prefix=="xmlns"?w.push({prefix:b.localName,namespace:b.value}):b.nodeName=="xmlns"&&w.push({prefix:"",namespace:b.value});}for(var E=0;E<p;E++){var b=h.item(E);if(qi(b,u,w)){var A=b.prefix||"",N=b.namespaceURI;Mn(t,A?"xmlns:"+A:"xmlns",N),w.push({prefix:A,namespace:N});}var x=s?s(b):b;x&&(typeof x=="string"?t.push(x):Mn(t,x.name,x.value));}if(_===m&&qi(a,u,w)){var C=a.prefix||"",N=a.namespaceURI;Mn(t,C?"xmlns:"+C:"xmlns",N),w.push({prefix:C,namespace:N});}var P=!a.firstChild;if(P&&(u||a.namespaceURI===Ue.HTML)&&(P=Eu(_)),P)return t.push("/>"),null;if(t.push(">"),u&&yu(_)){for(var S=a.firstChild;S;)S.data?t.push(S.data):Br(S,t,w.slice(),r),S=S.nextSibling;return t.push("</",m,">"),null}return {ns:w,tag:m};case Nt:case Ke:if(i&&a.nodeType===Nt&&a.documentElement==null)throw new L("The Document has no documentElement",ke.InvalidStateError);return {ns:f};case Ct:return Mn(t,a.name,a.value),null;case Bn:if(i&&de.InvalidChar.test(a.data))throw new L("The Text node data contains characters outside the XML Char production",ke.InvalidStateError);return t.push(a.data.replace(/[<&>]/g,Qi)),null;case Wi:if(i&&a.data.indexOf("]]>")!==-1)throw new L('The CDATASection data contains "]]>"',ke.InvalidStateError);return o?t.push(de.CDATA_START,a.data.replace(/]]>/g,"]]]]><![CDATA[>"),de.CDATA_END):t.push(de.CDATA_START,a.data,de.CDATA_END),null;case Pr:if(i){if(de.InvalidChar.test(a.data))throw new L("The comment node data contains characters outside the XML Char production",ke.InvalidStateError);if(a.data.indexOf("--")!==-1||a.data[a.data.length-1]==="-")throw new L('The comment node data contains "--" or ends with "-"',ke.InvalidStateError)}return t.push(de.COMMENT_START,a.data,de.COMMENT_END),null;case Vi:var $=a.publicId,O=a.systemId;if(i){if($&&!de.PubidLiteral_match.test($))throw new L("DocumentType publicId is not a valid PubidLiteral",ke.InvalidStateError);if(O&&O!=="."&&!de.SystemLiteral_match.test(O))throw new L("DocumentType systemId is not a valid SystemLiteral",ke.InvalidStateError);if(a.internalSubset&&a.internalSubset.indexOf("]>")!==-1)throw new L('DocumentType internalSubset contains "]>"',ke.InvalidStateError)}return t.push(de.DOCTYPE_DECL_START," ",a.name),$?(t.push(" ",de.PUBLIC," ",$),O&&O!=="."&&t.push(" ",O)):O&&O!=="."&&t.push(" ",de.SYSTEM," ",O),a.internalSubset&&t.push(" [",a.internalSubset,"]"),t.push(">"),null;case Or:if(i){if(a.target.indexOf(":")!==-1||a.target.toLowerCase()==="xml")throw new L("The ProcessingInstruction target is not well-formed",ke.InvalidStateError);if(de.InvalidChar.test(a.data))throw new L("The ProcessingInstruction data contains characters outside the XML Char production",ke.InvalidStateError);if(a.data.indexOf("?>")!==-1)throw new L('The ProcessingInstruction data contains "?>"',ke.InvalidStateError)}return t.push("<?",a.target," ",a.data,"?>"),null;case Hi:return t.push("&",a.nodeName,";"),null;default:return t.push("??",a.nodeName),null}},"enter"),exit:d(function(a,c){c&&c.tag&&t.push("</",c.tag,">");},"exit")});}d(Br,"serializeToString");function Mu(e,t,n){var r;return he(t,null,{enter:d(function(s,i){var o=s.cloneNode(false);o.ownerDocument=e,o.parentNode=null,i===null?r=o:i.appendChild(o);var l=s.nodeType===Ct||n;return l?o:null},"enter")}),r}d(Mu,"importNode");function is(e,t,n){var r;return he(t,null,{enter:d(function(s,i){var o=new s.constructor(_e);for(var l in s)if(xt(s,l)){var u=s[l];typeof u!="object"&&u!=o[l]&&(o[l]=u);}s.childNodes&&(o.childNodes=new ue),o.ownerDocument=e;var a=n;switch(o.nodeType){case Se:var c=s.attributes,f=o.attributes=new Tt,h=c.length;f._ownerElement=o;for(var p=0;p<h;p++)o.setAttributeNode(is(e,c.item(p),true));break;case Ct:a=true;}return i!==null?i.appendChild(o):r=o,a?o:null},"enter")}),r}d(is,"cloneNode");function ss(e,t,n){e[t]=n;}d(ss,"__set__");function Sr(e){for(var t=[],n=e.firstChild;n;)n.nodeType===Se&&t.push(n),n=n.nextSibling;return t}d(Sr,"childrenRefresh");try{Object.defineProperty&&(Object.defineProperty(Le.prototype,"length",{get:d(function(){return Ln(this),this.$$length},"get")}),Object.defineProperty(Y.prototype,"textContent",{get:d(function(){if(this.nodeType===Se||this.nodeType===Ke){var e=[];return he(this,null,{enter:d(function(t){if(t.nodeType===Se||t.nodeType===Ke)return !0;if(t.nodeType===Or||t.nodeType===Pr)return null;e.push(t.nodeValue);},"enter")}),e.join("")}return this.nodeValue},"get"),set:d(function(e){switch(this.nodeType){case Se:case Ke:for(;this.firstChild;)this.removeChild(this.firstChild);(e||String(e))&&this.appendChild(this.ownerDocument.createTextNode(e));break;default:this.data=e,this.value=e,this.nodeValue=e;}},"set")}),Object.defineProperty(Ge.prototype,"children",{get:d(function(){return new Le(this,Sr)},"get")}),Object.defineProperty(Ve.prototype,"children",{get:d(function(){return new Le(this,Sr)},"get")}),Object.defineProperty(It.prototype,"children",{get:d(function(){return new Le(this,Sr)},"get")}),ss=d(function(e,t,n){e["$$"+t]=n;},"__set__"));}catch{}ae._updateLiveList=Ln;ae.Attr=ft;ae.CDATASection=Un;ae.CharacterData=St;ae.Comment=$n;ae.Document=Ve;ae.DocumentFragment=It;ae.DocumentType=qn;ae.DOMImplementation=Xi;ae.Element=Ge;ae.Entity=Rr;ae.EntityReference=jn;ae.LiveNodeList=Le;ae.NamedNodeMap=Tt;ae.Node=Y;ae.NodeList=ue;ae.Notation=Mr;ae.Text=hn;ae.ProcessingInstruction=zn;ae.walkDOM=he;ae.XMLSerializer=ns;});var as=Re(pn=>{var os=ct().freeze;pn.XML_ENTITIES=os({amp:"&",apos:"'",gt:">",lt:"<",quot:'"'});pn.HTML_ENTITIES=os({Aacute:"\xC1",aacute:"\xE1",Abreve:"\u0102",abreve:"\u0103",ac:"\u223E",acd:"\u223F",acE:"\u223E\u0333",Acirc:"\xC2",acirc:"\xE2",acute:"\xB4",Acy:"\u0410",acy:"\u0430",AElig:"\xC6",aelig:"\xE6",af:"\u2061",Afr:"\u{1D504}",afr:"\u{1D51E}",Agrave:"\xC0",agrave:"\xE0",alefsym:"\u2135",aleph:"\u2135",Alpha:"\u0391",alpha:"\u03B1",Amacr:"\u0100",amacr:"\u0101",amalg:"\u2A3F",AMP:"&",amp:"&",And:"\u2A53",and:"\u2227",andand:"\u2A55",andd:"\u2A5C",andslope:"\u2A58",andv:"\u2A5A",ang:"\u2220",ange:"\u29A4",angle:"\u2220",angmsd:"\u2221",angmsdaa:"\u29A8",angmsdab:"\u29A9",angmsdac:"\u29AA",angmsdad:"\u29AB",angmsdae:"\u29AC",angmsdaf:"\u29AD",angmsdag:"\u29AE",angmsdah:"\u29AF",angrt:"\u221F",angrtvb:"\u22BE",angrtvbd:"\u299D",angsph:"\u2222",angst:"\xC5",angzarr:"\u237C",Aogon:"\u0104",aogon:"\u0105",Aopf:"\u{1D538}",aopf:"\u{1D552}",ap:"\u2248",apacir:"\u2A6F",apE:"\u2A70",ape:"\u224A",apid:"\u224B",apos:"'",ApplyFunction:"\u2061",approx:"\u2248",approxeq:"\u224A",Aring:"\xC5",aring:"\xE5",Ascr:"\u{1D49C}",ascr:"\u{1D4B6}",Assign:"\u2254",ast:"*",asymp:"\u2248",asympeq:"\u224D",Atilde:"\xC3",atilde:"\xE3",Auml:"\xC4",auml:"\xE4",awconint:"\u2233",awint:"\u2A11",backcong:"\u224C",backepsilon:"\u03F6",backprime:"\u2035",backsim:"\u223D",backsimeq:"\u22CD",Backslash:"\u2216",Barv:"\u2AE7",barvee:"\u22BD",Barwed:"\u2306",barwed:"\u2305",barwedge:"\u2305",bbrk:"\u23B5",bbrktbrk:"\u23B6",bcong:"\u224C",Bcy:"\u0411",bcy:"\u0431",bdquo:"\u201E",becaus:"\u2235",Because:"\u2235",because:"\u2235",bemptyv:"\u29B0",bepsi:"\u03F6",bernou:"\u212C",Bernoullis:"\u212C",Beta:"\u0392",beta:"\u03B2",beth:"\u2136",between:"\u226C",Bfr:"\u{1D505}",bfr:"\u{1D51F}",bigcap:"\u22C2",bigcirc:"\u25EF",bigcup:"\u22C3",bigodot:"\u2A00",bigoplus:"\u2A01",bigotimes:"\u2A02",bigsqcup:"\u2A06",bigstar:"\u2605",bigtriangledown:"\u25BD",bigtriangleup:"\u25B3",biguplus:"\u2A04",bigvee:"\u22C1",bigwedge:"\u22C0",bkarow:"\u290D",blacklozenge:"\u29EB",blacksquare:"\u25AA",blacktriangle:"\u25B4",blacktriangledown:"\u25BE",blacktriangleleft:"\u25C2",blacktriangleright:"\u25B8",blank:"\u2423",blk12:"\u2592",blk14:"\u2591",blk34:"\u2593",block:"\u2588",bne:"=\u20E5",bnequiv:"\u2261\u20E5",bNot:"\u2AED",bnot:"\u2310",Bopf:"\u{1D539}",bopf:"\u{1D553}",bot:"\u22A5",bottom:"\u22A5",bowtie:"\u22C8",boxbox:"\u29C9",boxDL:"\u2557",boxDl:"\u2556",boxdL:"\u2555",boxdl:"\u2510",boxDR:"\u2554",boxDr:"\u2553",boxdR:"\u2552",boxdr:"\u250C",boxH:"\u2550",boxh:"\u2500",boxHD:"\u2566",boxHd:"\u2564",boxhD:"\u2565",boxhd:"\u252C",boxHU:"\u2569",boxHu:"\u2567",boxhU:"\u2568",boxhu:"\u2534",boxminus:"\u229F",boxplus:"\u229E",boxtimes:"\u22A0",boxUL:"\u255D",boxUl:"\u255C",boxuL:"\u255B",boxul:"\u2518",boxUR:"\u255A",boxUr:"\u2559",boxuR:"\u2558",boxur:"\u2514",boxV:"\u2551",boxv:"\u2502",boxVH:"\u256C",boxVh:"\u256B",boxvH:"\u256A",boxvh:"\u253C",boxVL:"\u2563",boxVl:"\u2562",boxvL:"\u2561",boxvl:"\u2524",boxVR:"\u2560",boxVr:"\u255F",boxvR:"\u255E",boxvr:"\u251C",bprime:"\u2035",Breve:"\u02D8",breve:"\u02D8",brvbar:"\xA6",Bscr:"\u212C",bscr:"\u{1D4B7}",bsemi:"\u204F",bsim:"\u223D",bsime:"\u22CD",bsol:"\\",bsolb:"\u29C5",bsolhsub:"\u27C8",bull:"\u2022",bullet:"\u2022",bump:"\u224E",bumpE:"\u2AAE",bumpe:"\u224F",Bumpeq:"\u224E",bumpeq:"\u224F",Cacute:"\u0106",cacute:"\u0107",Cap:"\u22D2",cap:"\u2229",capand:"\u2A44",capbrcup:"\u2A49",capcap:"\u2A4B",capcup:"\u2A47",capdot:"\u2A40",CapitalDifferentialD:"\u2145",caps:"\u2229\uFE00",caret:"\u2041",caron:"\u02C7",Cayleys:"\u212D",ccaps:"\u2A4D",Ccaron:"\u010C",ccaron:"\u010D",Ccedil:"\xC7",ccedil:"\xE7",Ccirc:"\u0108",ccirc:"\u0109",Cconint:"\u2230",ccups:"\u2A4C",ccupssm:"\u2A50",Cdot:"\u010A",cdot:"\u010B",cedil:"\xB8",Cedilla:"\xB8",cemptyv:"\u29B2",cent:"\xA2",CenterDot:"\xB7",centerdot:"\xB7",Cfr:"\u212D",cfr:"\u{1D520}",CHcy:"\u0427",chcy:"\u0447",check:"\u2713",checkmark:"\u2713",Chi:"\u03A7",chi:"\u03C7",cir:"\u25CB",circ:"\u02C6",circeq:"\u2257",circlearrowleft:"\u21BA",circlearrowright:"\u21BB",circledast:"\u229B",circledcirc:"\u229A",circleddash:"\u229D",CircleDot:"\u2299",circledR:"\xAE",circledS:"\u24C8",CircleMinus:"\u2296",CirclePlus:"\u2295",CircleTimes:"\u2297",cirE:"\u29C3",cire:"\u2257",cirfnint:"\u2A10",cirmid:"\u2AEF",cirscir:"\u29C2",ClockwiseContourIntegral:"\u2232",CloseCurlyDoubleQuote:"\u201D",CloseCurlyQuote:"\u2019",clubs:"\u2663",clubsuit:"\u2663",Colon:"\u2237",colon:":",Colone:"\u2A74",colone:"\u2254",coloneq:"\u2254",comma:",",commat:"@",comp:"\u2201",compfn:"\u2218",complement:"\u2201",complexes:"\u2102",cong:"\u2245",congdot:"\u2A6D",Congruent:"\u2261",Conint:"\u222F",conint:"\u222E",ContourIntegral:"\u222E",Copf:"\u2102",copf:"\u{1D554}",coprod:"\u2210",Coproduct:"\u2210",COPY:"\xA9",copy:"\xA9",copysr:"\u2117",CounterClockwiseContourIntegral:"\u2233",crarr:"\u21B5",Cross:"\u2A2F",cross:"\u2717",Cscr:"\u{1D49E}",cscr:"\u{1D4B8}",csub:"\u2ACF",csube:"\u2AD1",csup:"\u2AD0",csupe:"\u2AD2",ctdot:"\u22EF",cudarrl:"\u2938",cudarrr:"\u2935",cuepr:"\u22DE",cuesc:"\u22DF",cularr:"\u21B6",cularrp:"\u293D",Cup:"\u22D3",cup:"\u222A",cupbrcap:"\u2A48",CupCap:"\u224D",cupcap:"\u2A46",cupcup:"\u2A4A",cupdot:"\u228D",cupor:"\u2A45",cups:"\u222A\uFE00",curarr:"\u21B7",curarrm:"\u293C",curlyeqprec:"\u22DE",curlyeqsucc:"\u22DF",curlyvee:"\u22CE",curlywedge:"\u22CF",curren:"\xA4",curvearrowleft:"\u21B6",curvearrowright:"\u21B7",cuvee:"\u22CE",cuwed:"\u22CF",cwconint:"\u2232",cwint:"\u2231",cylcty:"\u232D",Dagger:"\u2021",dagger:"\u2020",daleth:"\u2138",Darr:"\u21A1",dArr:"\u21D3",darr:"\u2193",dash:"\u2010",Dashv:"\u2AE4",dashv:"\u22A3",dbkarow:"\u290F",dblac:"\u02DD",Dcaron:"\u010E",dcaron:"\u010F",Dcy:"\u0414",dcy:"\u0434",DD:"\u2145",dd:"\u2146",ddagger:"\u2021",ddarr:"\u21CA",DDotrahd:"\u2911",ddotseq:"\u2A77",deg:"\xB0",Del:"\u2207",Delta:"\u0394",delta:"\u03B4",demptyv:"\u29B1",dfisht:"\u297F",Dfr:"\u{1D507}",dfr:"\u{1D521}",dHar:"\u2965",dharl:"\u21C3",dharr:"\u21C2",DiacriticalAcute:"\xB4",DiacriticalDot:"\u02D9",DiacriticalDoubleAcute:"\u02DD",DiacriticalGrave:"`",DiacriticalTilde:"\u02DC",diam:"\u22C4",Diamond:"\u22C4",diamond:"\u22C4",diamondsuit:"\u2666",diams:"\u2666",die:"\xA8",DifferentialD:"\u2146",digamma:"\u03DD",disin:"\u22F2",div:"\xF7",divide:"\xF7",divideontimes:"\u22C7",divonx:"\u22C7",DJcy:"\u0402",djcy:"\u0452",dlcorn:"\u231E",dlcrop:"\u230D",dollar:"$",Dopf:"\u{1D53B}",dopf:"\u{1D555}",Dot:"\xA8",dot:"\u02D9",DotDot:"\u20DC",doteq:"\u2250",doteqdot:"\u2251",DotEqual:"\u2250",dotminus:"\u2238",dotplus:"\u2214",dotsquare:"\u22A1",doublebarwedge:"\u2306",DoubleContourIntegral:"\u222F",DoubleDot:"\xA8",DoubleDownArrow:"\u21D3",DoubleLeftArrow:"\u21D0",DoubleLeftRightArrow:"\u21D4",DoubleLeftTee:"\u2AE4",DoubleLongLeftArrow:"\u27F8",DoubleLongLeftRightArrow:"\u27FA",DoubleLongRightArrow:"\u27F9",DoubleRightArrow:"\u21D2",DoubleRightTee:"\u22A8",DoubleUpArrow:"\u21D1",DoubleUpDownArrow:"\u21D5",DoubleVerticalBar:"\u2225",DownArrow:"\u2193",Downarrow:"\u21D3",downarrow:"\u2193",DownArrowBar:"\u2913",DownArrowUpArrow:"\u21F5",DownBreve:"\u0311",downdownarrows:"\u21CA",downharpoonleft:"\u21C3",downharpoonright:"\u21C2",DownLeftRightVector:"\u2950",DownLeftTeeVector:"\u295E",DownLeftVector:"\u21BD",DownLeftVectorBar:"\u2956",DownRightTeeVector:"\u295F",DownRightVector:"\u21C1",DownRightVectorBar:"\u2957",DownTee:"\u22A4",DownTeeArrow:"\u21A7",drbkarow:"\u2910",drcorn:"\u231F",drcrop:"\u230C",Dscr:"\u{1D49F}",dscr:"\u{1D4B9}",DScy:"\u0405",dscy:"\u0455",dsol:"\u29F6",Dstrok:"\u0110",dstrok:"\u0111",dtdot:"\u22F1",dtri:"\u25BF",dtrif:"\u25BE",duarr:"\u21F5",duhar:"\u296F",dwangle:"\u29A6",DZcy:"\u040F",dzcy:"\u045F",dzigrarr:"\u27FF",Eacute:"\xC9",eacute:"\xE9",easter:"\u2A6E",Ecaron:"\u011A",ecaron:"\u011B",ecir:"\u2256",Ecirc:"\xCA",ecirc:"\xEA",ecolon:"\u2255",Ecy:"\u042D",ecy:"\u044D",eDDot:"\u2A77",Edot:"\u0116",eDot:"\u2251",edot:"\u0117",ee:"\u2147",efDot:"\u2252",Efr:"\u{1D508}",efr:"\u{1D522}",eg:"\u2A9A",Egrave:"\xC8",egrave:"\xE8",egs:"\u2A96",egsdot:"\u2A98",el:"\u2A99",Element:"\u2208",elinters:"\u23E7",ell:"\u2113",els:"\u2A95",elsdot:"\u2A97",Emacr:"\u0112",emacr:"\u0113",empty:"\u2205",emptyset:"\u2205",EmptySmallSquare:"\u25FB",emptyv:"\u2205",EmptyVerySmallSquare:"\u25AB",emsp:"\u2003",emsp13:"\u2004",emsp14:"\u2005",ENG:"\u014A",eng:"\u014B",ensp:"\u2002",Eogon:"\u0118",eogon:"\u0119",Eopf:"\u{1D53C}",eopf:"\u{1D556}",epar:"\u22D5",eparsl:"\u29E3",eplus:"\u2A71",epsi:"\u03B5",Epsilon:"\u0395",epsilon:"\u03B5",epsiv:"\u03F5",eqcirc:"\u2256",eqcolon:"\u2255",eqsim:"\u2242",eqslantgtr:"\u2A96",eqslantless:"\u2A95",Equal:"\u2A75",equals:"=",EqualTilde:"\u2242",equest:"\u225F",Equilibrium:"\u21CC",equiv:"\u2261",equivDD:"\u2A78",eqvparsl:"\u29E5",erarr:"\u2971",erDot:"\u2253",Escr:"\u2130",escr:"\u212F",esdot:"\u2250",Esim:"\u2A73",esim:"\u2242",Eta:"\u0397",eta:"\u03B7",ETH:"\xD0",eth:"\xF0",Euml:"\xCB",euml:"\xEB",euro:"\u20AC",excl:"!",exist:"\u2203",Exists:"\u2203",expectation:"\u2130",ExponentialE:"\u2147",exponentiale:"\u2147",fallingdotseq:"\u2252",Fcy:"\u0424",fcy:"\u0444",female:"\u2640",ffilig:"\uFB03",fflig:"\uFB00",ffllig:"\uFB04",Ffr:"\u{1D509}",ffr:"\u{1D523}",filig:"\uFB01",FilledSmallSquare:"\u25FC",FilledVerySmallSquare:"\u25AA",fjlig:"fj",flat:"\u266D",fllig:"\uFB02",fltns:"\u25B1",fnof:"\u0192",Fopf:"\u{1D53D}",fopf:"\u{1D557}",ForAll:"\u2200",forall:"\u2200",fork:"\u22D4",forkv:"\u2AD9",Fouriertrf:"\u2131",fpartint:"\u2A0D",frac12:"\xBD",frac13:"\u2153",frac14:"\xBC",frac15:"\u2155",frac16:"\u2159",frac18:"\u215B",frac23:"\u2154",frac25:"\u2156",frac34:"\xBE",frac35:"\u2157",frac38:"\u215C",frac45:"\u2158",frac56:"\u215A",frac58:"\u215D",frac78:"\u215E",frasl:"\u2044",frown:"\u2322",Fscr:"\u2131",fscr:"\u{1D4BB}",gacute:"\u01F5",Gamma:"\u0393",gamma:"\u03B3",Gammad:"\u03DC",gammad:"\u03DD",gap:"\u2A86",Gbreve:"\u011E",gbreve:"\u011F",Gcedil:"\u0122",Gcirc:"\u011C",gcirc:"\u011D",Gcy:"\u0413",gcy:"\u0433",Gdot:"\u0120",gdot:"\u0121",gE:"\u2267",ge:"\u2265",gEl:"\u2A8C",gel:"\u22DB",geq:"\u2265",geqq:"\u2267",geqslant:"\u2A7E",ges:"\u2A7E",gescc:"\u2AA9",gesdot:"\u2A80",gesdoto:"\u2A82",gesdotol:"\u2A84",gesl:"\u22DB\uFE00",gesles:"\u2A94",Gfr:"\u{1D50A}",gfr:"\u{1D524}",Gg:"\u22D9",gg:"\u226B",ggg:"\u22D9",gimel:"\u2137",GJcy:"\u0403",gjcy:"\u0453",gl:"\u2277",gla:"\u2AA5",glE:"\u2A92",glj:"\u2AA4",gnap:"\u2A8A",gnapprox:"\u2A8A",gnE:"\u2269",gne:"\u2A88",gneq:"\u2A88",gneqq:"\u2269",gnsim:"\u22E7",Gopf:"\u{1D53E}",gopf:"\u{1D558}",grave:"`",GreaterEqual:"\u2265",GreaterEqualLess:"\u22DB",GreaterFullEqual:"\u2267",GreaterGreater:"\u2AA2",GreaterLess:"\u2277",GreaterSlantEqual:"\u2A7E",GreaterTilde:"\u2273",Gscr:"\u{1D4A2}",gscr:"\u210A",gsim:"\u2273",gsime:"\u2A8E",gsiml:"\u2A90",Gt:"\u226B",GT:">",gt:">",gtcc:"\u2AA7",gtcir:"\u2A7A",gtdot:"\u22D7",gtlPar:"\u2995",gtquest:"\u2A7C",gtrapprox:"\u2A86",gtrarr:"\u2978",gtrdot:"\u22D7",gtreqless:"\u22DB",gtreqqless:"\u2A8C",gtrless:"\u2277",gtrsim:"\u2273",gvertneqq:"\u2269\uFE00",gvnE:"\u2269\uFE00",Hacek:"\u02C7",hairsp:"\u200A",half:"\xBD",hamilt:"\u210B",HARDcy:"\u042A",hardcy:"\u044A",hArr:"\u21D4",harr:"\u2194",harrcir:"\u2948",harrw:"\u21AD",Hat:"^",hbar:"\u210F",Hcirc:"\u0124",hcirc:"\u0125",hearts:"\u2665",heartsuit:"\u2665",hellip:"\u2026",hercon:"\u22B9",Hfr:"\u210C",hfr:"\u{1D525}",HilbertSpace:"\u210B",hksearow:"\u2925",hkswarow:"\u2926",hoarr:"\u21FF",homtht:"\u223B",hookleftarrow:"\u21A9",hookrightarrow:"\u21AA",Hopf:"\u210D",hopf:"\u{1D559}",horbar:"\u2015",HorizontalLine:"\u2500",Hscr:"\u210B",hscr:"\u{1D4BD}",hslash:"\u210F",Hstrok:"\u0126",hstrok:"\u0127",HumpDownHump:"\u224E",HumpEqual:"\u224F",hybull:"\u2043",hyphen:"\u2010",Iacute:"\xCD",iacute:"\xED",ic:"\u2063",Icirc:"\xCE",icirc:"\xEE",Icy:"\u0418",icy:"\u0438",Idot:"\u0130",IEcy:"\u0415",iecy:"\u0435",iexcl:"\xA1",iff:"\u21D4",Ifr:"\u2111",ifr:"\u{1D526}",Igrave:"\xCC",igrave:"\xEC",ii:"\u2148",iiiint:"\u2A0C",iiint:"\u222D",iinfin:"\u29DC",iiota:"\u2129",IJlig:"\u0132",ijlig:"\u0133",Im:"\u2111",Imacr:"\u012A",imacr:"\u012B",image:"\u2111",ImaginaryI:"\u2148",imagline:"\u2110",imagpart:"\u2111",imath:"\u0131",imof:"\u22B7",imped:"\u01B5",Implies:"\u21D2",in:"\u2208",incare:"\u2105",infin:"\u221E",infintie:"\u29DD",inodot:"\u0131",Int:"\u222C",int:"\u222B",intcal:"\u22BA",integers:"\u2124",Integral:"\u222B",intercal:"\u22BA",Intersection:"\u22C2",intlarhk:"\u2A17",intprod:"\u2A3C",InvisibleComma:"\u2063",InvisibleTimes:"\u2062",IOcy:"\u0401",iocy:"\u0451",Iogon:"\u012E",iogon:"\u012F",Iopf:"\u{1D540}",iopf:"\u{1D55A}",Iota:"\u0399",iota:"\u03B9",iprod:"\u2A3C",iquest:"\xBF",Iscr:"\u2110",iscr:"\u{1D4BE}",isin:"\u2208",isindot:"\u22F5",isinE:"\u22F9",isins:"\u22F4",isinsv:"\u22F3",isinv:"\u2208",it:"\u2062",Itilde:"\u0128",itilde:"\u0129",Iukcy:"\u0406",iukcy:"\u0456",Iuml:"\xCF",iuml:"\xEF",Jcirc:"\u0134",jcirc:"\u0135",Jcy:"\u0419",jcy:"\u0439",Jfr:"\u{1D50D}",jfr:"\u{1D527}",jmath:"\u0237",Jopf:"\u{1D541}",jopf:"\u{1D55B}",Jscr:"\u{1D4A5}",jscr:"\u{1D4BF}",Jsercy:"\u0408",jsercy:"\u0458",Jukcy:"\u0404",jukcy:"\u0454",Kappa:"\u039A",kappa:"\u03BA",kappav:"\u03F0",Kcedil:"\u0136",kcedil:"\u0137",Kcy:"\u041A",kcy:"\u043A",Kfr:"\u{1D50E}",kfr:"\u{1D528}",kgreen:"\u0138",KHcy:"\u0425",khcy:"\u0445",KJcy:"\u040C",kjcy:"\u045C",Kopf:"\u{1D542}",kopf:"\u{1D55C}",Kscr:"\u{1D4A6}",kscr:"\u{1D4C0}",lAarr:"\u21DA",Lacute:"\u0139",lacute:"\u013A",laemptyv:"\u29B4",lagran:"\u2112",Lambda:"\u039B",lambda:"\u03BB",Lang:"\u27EA",lang:"\u27E8",langd:"\u2991",langle:"\u27E8",lap:"\u2A85",Laplacetrf:"\u2112",laquo:"\xAB",Larr:"\u219E",lArr:"\u21D0",larr:"\u2190",larrb:"\u21E4",larrbfs:"\u291F",larrfs:"\u291D",larrhk:"\u21A9",larrlp:"\u21AB",larrpl:"\u2939",larrsim:"\u2973",larrtl:"\u21A2",lat:"\u2AAB",lAtail:"\u291B",latail:"\u2919",late:"\u2AAD",lates:"\u2AAD\uFE00",lBarr:"\u290E",lbarr:"\u290C",lbbrk:"\u2772",lbrace:"{",lbrack:"[",lbrke:"\u298B",lbrksld:"\u298F",lbrkslu:"\u298D",Lcaron:"\u013D",lcaron:"\u013E",Lcedil:"\u013B",lcedil:"\u013C",lceil:"\u2308",lcub:"{",Lcy:"\u041B",lcy:"\u043B",ldca:"\u2936",ldquo:"\u201C",ldquor:"\u201E",ldrdhar:"\u2967",ldrushar:"\u294B",ldsh:"\u21B2",lE:"\u2266",le:"\u2264",LeftAngleBracket:"\u27E8",LeftArrow:"\u2190",Leftarrow:"\u21D0",leftarrow:"\u2190",LeftArrowBar:"\u21E4",LeftArrowRightArrow:"\u21C6",leftarrowtail:"\u21A2",LeftCeiling:"\u2308",LeftDoubleBracket:"\u27E6",LeftDownTeeVector:"\u2961",LeftDownVector:"\u21C3",LeftDownVectorBar:"\u2959",LeftFloor:"\u230A",leftharpoondown:"\u21BD",leftharpoonup:"\u21BC",leftleftarrows:"\u21C7",LeftRightArrow:"\u2194",Leftrightarrow:"\u21D4",leftrightarrow:"\u2194",leftrightarrows:"\u21C6",leftrightharpoons:"\u21CB",leftrightsquigarrow:"\u21AD",LeftRightVector:"\u294E",LeftTee:"\u22A3",LeftTeeArrow:"\u21A4",LeftTeeVector:"\u295A",leftthreetimes:"\u22CB",LeftTriangle:"\u22B2",LeftTriangleBar:"\u29CF",LeftTriangleEqual:"\u22B4",LeftUpDownVector:"\u2951",LeftUpTeeVector:"\u2960",LeftUpVector:"\u21BF",LeftUpVectorBar:"\u2958",LeftVector:"\u21BC",LeftVectorBar:"\u2952",lEg:"\u2A8B",leg:"\u22DA",leq:"\u2264",leqq:"\u2266",leqslant:"\u2A7D",les:"\u2A7D",lescc:"\u2AA8",lesdot:"\u2A7F",lesdoto:"\u2A81",lesdotor:"\u2A83",lesg:"\u22DA\uFE00",lesges:"\u2A93",lessapprox:"\u2A85",lessdot:"\u22D6",lesseqgtr:"\u22DA",lesseqqgtr:"\u2A8B",LessEqualGreater:"\u22DA",LessFullEqual:"\u2266",LessGreater:"\u2276",lessgtr:"\u2276",LessLess:"\u2AA1",lesssim:"\u2272",LessSlantEqual:"\u2A7D",LessTilde:"\u2272",lfisht:"\u297C",lfloor:"\u230A",Lfr:"\u{1D50F}",lfr:"\u{1D529}",lg:"\u2276",lgE:"\u2A91",lHar:"\u2962",lhard:"\u21BD",lharu:"\u21BC",lharul:"\u296A",lhblk:"\u2584",LJcy:"\u0409",ljcy:"\u0459",Ll:"\u22D8",ll:"\u226A",llarr:"\u21C7",llcorner:"\u231E",Lleftarrow:"\u21DA",llhard:"\u296B",lltri:"\u25FA",Lmidot:"\u013F",lmidot:"\u0140",lmoust:"\u23B0",lmoustache:"\u23B0",lnap:"\u2A89",lnapprox:"\u2A89",lnE:"\u2268",lne:"\u2A87",lneq:"\u2A87",lneqq:"\u2268",lnsim:"\u22E6",loang:"\u27EC",loarr:"\u21FD",lobrk:"\u27E6",LongLeftArrow:"\u27F5",Longleftarrow:"\u27F8",longleftarrow:"\u27F5",LongLeftRightArrow:"\u27F7",Longleftrightarrow:"\u27FA",longleftrightarrow:"\u27F7",longmapsto:"\u27FC",LongRightArrow:"\u27F6",Longrightarrow:"\u27F9",longrightarrow:"\u27F6",looparrowleft:"\u21AB",looparrowright:"\u21AC",lopar:"\u2985",Lopf:"\u{1D543}",lopf:"\u{1D55D}",loplus:"\u2A2D",lotimes:"\u2A34",lowast:"\u2217",lowbar:"_",LowerLeftArrow:"\u2199",LowerRightArrow:"\u2198",loz:"\u25CA",lozenge:"\u25CA",lozf:"\u29EB",lpar:"(",lparlt:"\u2993",lrarr:"\u21C6",lrcorner:"\u231F",lrhar:"\u21CB",lrhard:"\u296D",lrm:"\u200E",lrtri:"\u22BF",lsaquo:"\u2039",Lscr:"\u2112",lscr:"\u{1D4C1}",Lsh:"\u21B0",lsh:"\u21B0",lsim:"\u2272",lsime:"\u2A8D",lsimg:"\u2A8F",lsqb:"[",lsquo:"\u2018",lsquor:"\u201A",Lstrok:"\u0141",lstrok:"\u0142",Lt:"\u226A",LT:"<",lt:"<",ltcc:"\u2AA6",ltcir:"\u2A79",ltdot:"\u22D6",lthree:"\u22CB",ltimes:"\u22C9",ltlarr:"\u2976",ltquest:"\u2A7B",ltri:"\u25C3",ltrie:"\u22B4",ltrif:"\u25C2",ltrPar:"\u2996",lurdshar:"\u294A",luruhar:"\u2966",lvertneqq:"\u2268\uFE00",lvnE:"\u2268\uFE00",macr:"\xAF",male:"\u2642",malt:"\u2720",maltese:"\u2720",Map:"\u2905",map:"\u21A6",mapsto:"\u21A6",mapstodown:"\u21A7",mapstoleft:"\u21A4",mapstoup:"\u21A5",marker:"\u25AE",mcomma:"\u2A29",Mcy:"\u041C",mcy:"\u043C",mdash:"\u2014",mDDot:"\u223A",measuredangle:"\u2221",MediumSpace:"\u205F",Mellintrf:"\u2133",Mfr:"\u{1D510}",mfr:"\u{1D52A}",mho:"\u2127",micro:"\xB5",mid:"\u2223",midast:"*",midcir:"\u2AF0",middot:"\xB7",minus:"\u2212",minusb:"\u229F",minusd:"\u2238",minusdu:"\u2A2A",MinusPlus:"\u2213",mlcp:"\u2ADB",mldr:"\u2026",mnplus:"\u2213",models:"\u22A7",Mopf:"\u{1D544}",mopf:"\u{1D55E}",mp:"\u2213",Mscr:"\u2133",mscr:"\u{1D4C2}",mstpos:"\u223E",Mu:"\u039C",mu:"\u03BC",multimap:"\u22B8",mumap:"\u22B8",nabla:"\u2207",Nacute:"\u0143",nacute:"\u0144",nang:"\u2220\u20D2",nap:"\u2249",napE:"\u2A70\u0338",napid:"\u224B\u0338",napos:"\u0149",napprox:"\u2249",natur:"\u266E",natural:"\u266E",naturals:"\u2115",nbsp:"\xA0",nbump:"\u224E\u0338",nbumpe:"\u224F\u0338",ncap:"\u2A43",Ncaron:"\u0147",ncaron:"\u0148",Ncedil:"\u0145",ncedil:"\u0146",ncong:"\u2247",ncongdot:"\u2A6D\u0338",ncup:"\u2A42",Ncy:"\u041D",ncy:"\u043D",ndash:"\u2013",ne:"\u2260",nearhk:"\u2924",neArr:"\u21D7",nearr:"\u2197",nearrow:"\u2197",nedot:"\u2250\u0338",NegativeMediumSpace:"\u200B",NegativeThickSpace:"\u200B",NegativeThinSpace:"\u200B",NegativeVeryThinSpace:"\u200B",nequiv:"\u2262",nesear:"\u2928",nesim:"\u2242\u0338",NestedGreaterGreater:"\u226B",NestedLessLess:"\u226A",NewLine:`
|
|
2
|
+
`,nexist:"\u2204",nexists:"\u2204",Nfr:"\u{1D511}",nfr:"\u{1D52B}",ngE:"\u2267\u0338",nge:"\u2271",ngeq:"\u2271",ngeqq:"\u2267\u0338",ngeqslant:"\u2A7E\u0338",nges:"\u2A7E\u0338",nGg:"\u22D9\u0338",ngsim:"\u2275",nGt:"\u226B\u20D2",ngt:"\u226F",ngtr:"\u226F",nGtv:"\u226B\u0338",nhArr:"\u21CE",nharr:"\u21AE",nhpar:"\u2AF2",ni:"\u220B",nis:"\u22FC",nisd:"\u22FA",niv:"\u220B",NJcy:"\u040A",njcy:"\u045A",nlArr:"\u21CD",nlarr:"\u219A",nldr:"\u2025",nlE:"\u2266\u0338",nle:"\u2270",nLeftarrow:"\u21CD",nleftarrow:"\u219A",nLeftrightarrow:"\u21CE",nleftrightarrow:"\u21AE",nleq:"\u2270",nleqq:"\u2266\u0338",nleqslant:"\u2A7D\u0338",nles:"\u2A7D\u0338",nless:"\u226E",nLl:"\u22D8\u0338",nlsim:"\u2274",nLt:"\u226A\u20D2",nlt:"\u226E",nltri:"\u22EA",nltrie:"\u22EC",nLtv:"\u226A\u0338",nmid:"\u2224",NoBreak:"\u2060",NonBreakingSpace:"\xA0",Nopf:"\u2115",nopf:"\u{1D55F}",Not:"\u2AEC",not:"\xAC",NotCongruent:"\u2262",NotCupCap:"\u226D",NotDoubleVerticalBar:"\u2226",NotElement:"\u2209",NotEqual:"\u2260",NotEqualTilde:"\u2242\u0338",NotExists:"\u2204",NotGreater:"\u226F",NotGreaterEqual:"\u2271",NotGreaterFullEqual:"\u2267\u0338",NotGreaterGreater:"\u226B\u0338",NotGreaterLess:"\u2279",NotGreaterSlantEqual:"\u2A7E\u0338",NotGreaterTilde:"\u2275",NotHumpDownHump:"\u224E\u0338",NotHumpEqual:"\u224F\u0338",notin:"\u2209",notindot:"\u22F5\u0338",notinE:"\u22F9\u0338",notinva:"\u2209",notinvb:"\u22F7",notinvc:"\u22F6",NotLeftTriangle:"\u22EA",NotLeftTriangleBar:"\u29CF\u0338",NotLeftTriangleEqual:"\u22EC",NotLess:"\u226E",NotLessEqual:"\u2270",NotLessGreater:"\u2278",NotLessLess:"\u226A\u0338",NotLessSlantEqual:"\u2A7D\u0338",NotLessTilde:"\u2274",NotNestedGreaterGreater:"\u2AA2\u0338",NotNestedLessLess:"\u2AA1\u0338",notni:"\u220C",notniva:"\u220C",notnivb:"\u22FE",notnivc:"\u22FD",NotPrecedes:"\u2280",NotPrecedesEqual:"\u2AAF\u0338",NotPrecedesSlantEqual:"\u22E0",NotReverseElement:"\u220C",NotRightTriangle:"\u22EB",NotRightTriangleBar:"\u29D0\u0338",NotRightTriangleEqual:"\u22ED",NotSquareSubset:"\u228F\u0338",NotSquareSubsetEqual:"\u22E2",NotSquareSuperset:"\u2290\u0338",NotSquareSupersetEqual:"\u22E3",NotSubset:"\u2282\u20D2",NotSubsetEqual:"\u2288",NotSucceeds:"\u2281",NotSucceedsEqual:"\u2AB0\u0338",NotSucceedsSlantEqual:"\u22E1",NotSucceedsTilde:"\u227F\u0338",NotSuperset:"\u2283\u20D2",NotSupersetEqual:"\u2289",NotTilde:"\u2241",NotTildeEqual:"\u2244",NotTildeFullEqual:"\u2247",NotTildeTilde:"\u2249",NotVerticalBar:"\u2224",npar:"\u2226",nparallel:"\u2226",nparsl:"\u2AFD\u20E5",npart:"\u2202\u0338",npolint:"\u2A14",npr:"\u2280",nprcue:"\u22E0",npre:"\u2AAF\u0338",nprec:"\u2280",npreceq:"\u2AAF\u0338",nrArr:"\u21CF",nrarr:"\u219B",nrarrc:"\u2933\u0338",nrarrw:"\u219D\u0338",nRightarrow:"\u21CF",nrightarrow:"\u219B",nrtri:"\u22EB",nrtrie:"\u22ED",nsc:"\u2281",nsccue:"\u22E1",nsce:"\u2AB0\u0338",Nscr:"\u{1D4A9}",nscr:"\u{1D4C3}",nshortmid:"\u2224",nshortparallel:"\u2226",nsim:"\u2241",nsime:"\u2244",nsimeq:"\u2244",nsmid:"\u2224",nspar:"\u2226",nsqsube:"\u22E2",nsqsupe:"\u22E3",nsub:"\u2284",nsubE:"\u2AC5\u0338",nsube:"\u2288",nsubset:"\u2282\u20D2",nsubseteq:"\u2288",nsubseteqq:"\u2AC5\u0338",nsucc:"\u2281",nsucceq:"\u2AB0\u0338",nsup:"\u2285",nsupE:"\u2AC6\u0338",nsupe:"\u2289",nsupset:"\u2283\u20D2",nsupseteq:"\u2289",nsupseteqq:"\u2AC6\u0338",ntgl:"\u2279",Ntilde:"\xD1",ntilde:"\xF1",ntlg:"\u2278",ntriangleleft:"\u22EA",ntrianglelefteq:"\u22EC",ntriangleright:"\u22EB",ntrianglerighteq:"\u22ED",Nu:"\u039D",nu:"\u03BD",num:"#",numero:"\u2116",numsp:"\u2007",nvap:"\u224D\u20D2",nVDash:"\u22AF",nVdash:"\u22AE",nvDash:"\u22AD",nvdash:"\u22AC",nvge:"\u2265\u20D2",nvgt:">\u20D2",nvHarr:"\u2904",nvinfin:"\u29DE",nvlArr:"\u2902",nvle:"\u2264\u20D2",nvlt:"<\u20D2",nvltrie:"\u22B4\u20D2",nvrArr:"\u2903",nvrtrie:"\u22B5\u20D2",nvsim:"\u223C\u20D2",nwarhk:"\u2923",nwArr:"\u21D6",nwarr:"\u2196",nwarrow:"\u2196",nwnear:"\u2927",Oacute:"\xD3",oacute:"\xF3",oast:"\u229B",ocir:"\u229A",Ocirc:"\xD4",ocirc:"\xF4",Ocy:"\u041E",ocy:"\u043E",odash:"\u229D",Odblac:"\u0150",odblac:"\u0151",odiv:"\u2A38",odot:"\u2299",odsold:"\u29BC",OElig:"\u0152",oelig:"\u0153",ofcir:"\u29BF",Ofr:"\u{1D512}",ofr:"\u{1D52C}",ogon:"\u02DB",Ograve:"\xD2",ograve:"\xF2",ogt:"\u29C1",ohbar:"\u29B5",ohm:"\u03A9",oint:"\u222E",olarr:"\u21BA",olcir:"\u29BE",olcross:"\u29BB",oline:"\u203E",olt:"\u29C0",Omacr:"\u014C",omacr:"\u014D",Omega:"\u03A9",omega:"\u03C9",Omicron:"\u039F",omicron:"\u03BF",omid:"\u29B6",ominus:"\u2296",Oopf:"\u{1D546}",oopf:"\u{1D560}",opar:"\u29B7",OpenCurlyDoubleQuote:"\u201C",OpenCurlyQuote:"\u2018",operp:"\u29B9",oplus:"\u2295",Or:"\u2A54",or:"\u2228",orarr:"\u21BB",ord:"\u2A5D",order:"\u2134",orderof:"\u2134",ordf:"\xAA",ordm:"\xBA",origof:"\u22B6",oror:"\u2A56",orslope:"\u2A57",orv:"\u2A5B",oS:"\u24C8",Oscr:"\u{1D4AA}",oscr:"\u2134",Oslash:"\xD8",oslash:"\xF8",osol:"\u2298",Otilde:"\xD5",otilde:"\xF5",Otimes:"\u2A37",otimes:"\u2297",otimesas:"\u2A36",Ouml:"\xD6",ouml:"\xF6",ovbar:"\u233D",OverBar:"\u203E",OverBrace:"\u23DE",OverBracket:"\u23B4",OverParenthesis:"\u23DC",par:"\u2225",para:"\xB6",parallel:"\u2225",parsim:"\u2AF3",parsl:"\u2AFD",part:"\u2202",PartialD:"\u2202",Pcy:"\u041F",pcy:"\u043F",percnt:"%",period:".",permil:"\u2030",perp:"\u22A5",pertenk:"\u2031",Pfr:"\u{1D513}",pfr:"\u{1D52D}",Phi:"\u03A6",phi:"\u03C6",phiv:"\u03D5",phmmat:"\u2133",phone:"\u260E",Pi:"\u03A0",pi:"\u03C0",pitchfork:"\u22D4",piv:"\u03D6",planck:"\u210F",planckh:"\u210E",plankv:"\u210F",plus:"+",plusacir:"\u2A23",plusb:"\u229E",pluscir:"\u2A22",plusdo:"\u2214",plusdu:"\u2A25",pluse:"\u2A72",PlusMinus:"\xB1",plusmn:"\xB1",plussim:"\u2A26",plustwo:"\u2A27",pm:"\xB1",Poincareplane:"\u210C",pointint:"\u2A15",Popf:"\u2119",popf:"\u{1D561}",pound:"\xA3",Pr:"\u2ABB",pr:"\u227A",prap:"\u2AB7",prcue:"\u227C",prE:"\u2AB3",pre:"\u2AAF",prec:"\u227A",precapprox:"\u2AB7",preccurlyeq:"\u227C",Precedes:"\u227A",PrecedesEqual:"\u2AAF",PrecedesSlantEqual:"\u227C",PrecedesTilde:"\u227E",preceq:"\u2AAF",precnapprox:"\u2AB9",precneqq:"\u2AB5",precnsim:"\u22E8",precsim:"\u227E",Prime:"\u2033",prime:"\u2032",primes:"\u2119",prnap:"\u2AB9",prnE:"\u2AB5",prnsim:"\u22E8",prod:"\u220F",Product:"\u220F",profalar:"\u232E",profline:"\u2312",profsurf:"\u2313",prop:"\u221D",Proportion:"\u2237",Proportional:"\u221D",propto:"\u221D",prsim:"\u227E",prurel:"\u22B0",Pscr:"\u{1D4AB}",pscr:"\u{1D4C5}",Psi:"\u03A8",psi:"\u03C8",puncsp:"\u2008",Qfr:"\u{1D514}",qfr:"\u{1D52E}",qint:"\u2A0C",Qopf:"\u211A",qopf:"\u{1D562}",qprime:"\u2057",Qscr:"\u{1D4AC}",qscr:"\u{1D4C6}",quaternions:"\u210D",quatint:"\u2A16",quest:"?",questeq:"\u225F",QUOT:'"',quot:'"',rAarr:"\u21DB",race:"\u223D\u0331",Racute:"\u0154",racute:"\u0155",radic:"\u221A",raemptyv:"\u29B3",Rang:"\u27EB",rang:"\u27E9",rangd:"\u2992",range:"\u29A5",rangle:"\u27E9",raquo:"\xBB",Rarr:"\u21A0",rArr:"\u21D2",rarr:"\u2192",rarrap:"\u2975",rarrb:"\u21E5",rarrbfs:"\u2920",rarrc:"\u2933",rarrfs:"\u291E",rarrhk:"\u21AA",rarrlp:"\u21AC",rarrpl:"\u2945",rarrsim:"\u2974",Rarrtl:"\u2916",rarrtl:"\u21A3",rarrw:"\u219D",rAtail:"\u291C",ratail:"\u291A",ratio:"\u2236",rationals:"\u211A",RBarr:"\u2910",rBarr:"\u290F",rbarr:"\u290D",rbbrk:"\u2773",rbrace:"}",rbrack:"]",rbrke:"\u298C",rbrksld:"\u298E",rbrkslu:"\u2990",Rcaron:"\u0158",rcaron:"\u0159",Rcedil:"\u0156",rcedil:"\u0157",rceil:"\u2309",rcub:"}",Rcy:"\u0420",rcy:"\u0440",rdca:"\u2937",rdldhar:"\u2969",rdquo:"\u201D",rdquor:"\u201D",rdsh:"\u21B3",Re:"\u211C",real:"\u211C",realine:"\u211B",realpart:"\u211C",reals:"\u211D",rect:"\u25AD",REG:"\xAE",reg:"\xAE",ReverseElement:"\u220B",ReverseEquilibrium:"\u21CB",ReverseUpEquilibrium:"\u296F",rfisht:"\u297D",rfloor:"\u230B",Rfr:"\u211C",rfr:"\u{1D52F}",rHar:"\u2964",rhard:"\u21C1",rharu:"\u21C0",rharul:"\u296C",Rho:"\u03A1",rho:"\u03C1",rhov:"\u03F1",RightAngleBracket:"\u27E9",RightArrow:"\u2192",Rightarrow:"\u21D2",rightarrow:"\u2192",RightArrowBar:"\u21E5",RightArrowLeftArrow:"\u21C4",rightarrowtail:"\u21A3",RightCeiling:"\u2309",RightDoubleBracket:"\u27E7",RightDownTeeVector:"\u295D",RightDownVector:"\u21C2",RightDownVectorBar:"\u2955",RightFloor:"\u230B",rightharpoondown:"\u21C1",rightharpoonup:"\u21C0",rightleftarrows:"\u21C4",rightleftharpoons:"\u21CC",rightrightarrows:"\u21C9",rightsquigarrow:"\u219D",RightTee:"\u22A2",RightTeeArrow:"\u21A6",RightTeeVector:"\u295B",rightthreetimes:"\u22CC",RightTriangle:"\u22B3",RightTriangleBar:"\u29D0",RightTriangleEqual:"\u22B5",RightUpDownVector:"\u294F",RightUpTeeVector:"\u295C",RightUpVector:"\u21BE",RightUpVectorBar:"\u2954",RightVector:"\u21C0",RightVectorBar:"\u2953",ring:"\u02DA",risingdotseq:"\u2253",rlarr:"\u21C4",rlhar:"\u21CC",rlm:"\u200F",rmoust:"\u23B1",rmoustache:"\u23B1",rnmid:"\u2AEE",roang:"\u27ED",roarr:"\u21FE",robrk:"\u27E7",ropar:"\u2986",Ropf:"\u211D",ropf:"\u{1D563}",roplus:"\u2A2E",rotimes:"\u2A35",RoundImplies:"\u2970",rpar:")",rpargt:"\u2994",rppolint:"\u2A12",rrarr:"\u21C9",Rrightarrow:"\u21DB",rsaquo:"\u203A",Rscr:"\u211B",rscr:"\u{1D4C7}",Rsh:"\u21B1",rsh:"\u21B1",rsqb:"]",rsquo:"\u2019",rsquor:"\u2019",rthree:"\u22CC",rtimes:"\u22CA",rtri:"\u25B9",rtrie:"\u22B5",rtrif:"\u25B8",rtriltri:"\u29CE",RuleDelayed:"\u29F4",ruluhar:"\u2968",rx:"\u211E",Sacute:"\u015A",sacute:"\u015B",sbquo:"\u201A",Sc:"\u2ABC",sc:"\u227B",scap:"\u2AB8",Scaron:"\u0160",scaron:"\u0161",sccue:"\u227D",scE:"\u2AB4",sce:"\u2AB0",Scedil:"\u015E",scedil:"\u015F",Scirc:"\u015C",scirc:"\u015D",scnap:"\u2ABA",scnE:"\u2AB6",scnsim:"\u22E9",scpolint:"\u2A13",scsim:"\u227F",Scy:"\u0421",scy:"\u0441",sdot:"\u22C5",sdotb:"\u22A1",sdote:"\u2A66",searhk:"\u2925",seArr:"\u21D8",searr:"\u2198",searrow:"\u2198",sect:"\xA7",semi:";",seswar:"\u2929",setminus:"\u2216",setmn:"\u2216",sext:"\u2736",Sfr:"\u{1D516}",sfr:"\u{1D530}",sfrown:"\u2322",sharp:"\u266F",SHCHcy:"\u0429",shchcy:"\u0449",SHcy:"\u0428",shcy:"\u0448",ShortDownArrow:"\u2193",ShortLeftArrow:"\u2190",shortmid:"\u2223",shortparallel:"\u2225",ShortRightArrow:"\u2192",ShortUpArrow:"\u2191",shy:"\xAD",Sigma:"\u03A3",sigma:"\u03C3",sigmaf:"\u03C2",sigmav:"\u03C2",sim:"\u223C",simdot:"\u2A6A",sime:"\u2243",simeq:"\u2243",simg:"\u2A9E",simgE:"\u2AA0",siml:"\u2A9D",simlE:"\u2A9F",simne:"\u2246",simplus:"\u2A24",simrarr:"\u2972",slarr:"\u2190",SmallCircle:"\u2218",smallsetminus:"\u2216",smashp:"\u2A33",smeparsl:"\u29E4",smid:"\u2223",smile:"\u2323",smt:"\u2AAA",smte:"\u2AAC",smtes:"\u2AAC\uFE00",SOFTcy:"\u042C",softcy:"\u044C",sol:"/",solb:"\u29C4",solbar:"\u233F",Sopf:"\u{1D54A}",sopf:"\u{1D564}",spades:"\u2660",spadesuit:"\u2660",spar:"\u2225",sqcap:"\u2293",sqcaps:"\u2293\uFE00",sqcup:"\u2294",sqcups:"\u2294\uFE00",Sqrt:"\u221A",sqsub:"\u228F",sqsube:"\u2291",sqsubset:"\u228F",sqsubseteq:"\u2291",sqsup:"\u2290",sqsupe:"\u2292",sqsupset:"\u2290",sqsupseteq:"\u2292",squ:"\u25A1",Square:"\u25A1",square:"\u25A1",SquareIntersection:"\u2293",SquareSubset:"\u228F",SquareSubsetEqual:"\u2291",SquareSuperset:"\u2290",SquareSupersetEqual:"\u2292",SquareUnion:"\u2294",squarf:"\u25AA",squf:"\u25AA",srarr:"\u2192",Sscr:"\u{1D4AE}",sscr:"\u{1D4C8}",ssetmn:"\u2216",ssmile:"\u2323",sstarf:"\u22C6",Star:"\u22C6",star:"\u2606",starf:"\u2605",straightepsilon:"\u03F5",straightphi:"\u03D5",strns:"\xAF",Sub:"\u22D0",sub:"\u2282",subdot:"\u2ABD",subE:"\u2AC5",sube:"\u2286",subedot:"\u2AC3",submult:"\u2AC1",subnE:"\u2ACB",subne:"\u228A",subplus:"\u2ABF",subrarr:"\u2979",Subset:"\u22D0",subset:"\u2282",subseteq:"\u2286",subseteqq:"\u2AC5",SubsetEqual:"\u2286",subsetneq:"\u228A",subsetneqq:"\u2ACB",subsim:"\u2AC7",subsub:"\u2AD5",subsup:"\u2AD3",succ:"\u227B",succapprox:"\u2AB8",succcurlyeq:"\u227D",Succeeds:"\u227B",SucceedsEqual:"\u2AB0",SucceedsSlantEqual:"\u227D",SucceedsTilde:"\u227F",succeq:"\u2AB0",succnapprox:"\u2ABA",succneqq:"\u2AB6",succnsim:"\u22E9",succsim:"\u227F",SuchThat:"\u220B",Sum:"\u2211",sum:"\u2211",sung:"\u266A",Sup:"\u22D1",sup:"\u2283",sup1:"\xB9",sup2:"\xB2",sup3:"\xB3",supdot:"\u2ABE",supdsub:"\u2AD8",supE:"\u2AC6",supe:"\u2287",supedot:"\u2AC4",Superset:"\u2283",SupersetEqual:"\u2287",suphsol:"\u27C9",suphsub:"\u2AD7",suplarr:"\u297B",supmult:"\u2AC2",supnE:"\u2ACC",supne:"\u228B",supplus:"\u2AC0",Supset:"\u22D1",supset:"\u2283",supseteq:"\u2287",supseteqq:"\u2AC6",supsetneq:"\u228B",supsetneqq:"\u2ACC",supsim:"\u2AC8",supsub:"\u2AD4",supsup:"\u2AD6",swarhk:"\u2926",swArr:"\u21D9",swarr:"\u2199",swarrow:"\u2199",swnwar:"\u292A",szlig:"\xDF",Tab:" ",target:"\u2316",Tau:"\u03A4",tau:"\u03C4",tbrk:"\u23B4",Tcaron:"\u0164",tcaron:"\u0165",Tcedil:"\u0162",tcedil:"\u0163",Tcy:"\u0422",tcy:"\u0442",tdot:"\u20DB",telrec:"\u2315",Tfr:"\u{1D517}",tfr:"\u{1D531}",there4:"\u2234",Therefore:"\u2234",therefore:"\u2234",Theta:"\u0398",theta:"\u03B8",thetasym:"\u03D1",thetav:"\u03D1",thickapprox:"\u2248",thicksim:"\u223C",ThickSpace:"\u205F\u200A",thinsp:"\u2009",ThinSpace:"\u2009",thkap:"\u2248",thksim:"\u223C",THORN:"\xDE",thorn:"\xFE",Tilde:"\u223C",tilde:"\u02DC",TildeEqual:"\u2243",TildeFullEqual:"\u2245",TildeTilde:"\u2248",times:"\xD7",timesb:"\u22A0",timesbar:"\u2A31",timesd:"\u2A30",tint:"\u222D",toea:"\u2928",top:"\u22A4",topbot:"\u2336",topcir:"\u2AF1",Topf:"\u{1D54B}",topf:"\u{1D565}",topfork:"\u2ADA",tosa:"\u2929",tprime:"\u2034",TRADE:"\u2122",trade:"\u2122",triangle:"\u25B5",triangledown:"\u25BF",triangleleft:"\u25C3",trianglelefteq:"\u22B4",triangleq:"\u225C",triangleright:"\u25B9",trianglerighteq:"\u22B5",tridot:"\u25EC",trie:"\u225C",triminus:"\u2A3A",TripleDot:"\u20DB",triplus:"\u2A39",trisb:"\u29CD",tritime:"\u2A3B",trpezium:"\u23E2",Tscr:"\u{1D4AF}",tscr:"\u{1D4C9}",TScy:"\u0426",tscy:"\u0446",TSHcy:"\u040B",tshcy:"\u045B",Tstrok:"\u0166",tstrok:"\u0167",twixt:"\u226C",twoheadleftarrow:"\u219E",twoheadrightarrow:"\u21A0",Uacute:"\xDA",uacute:"\xFA",Uarr:"\u219F",uArr:"\u21D1",uarr:"\u2191",Uarrocir:"\u2949",Ubrcy:"\u040E",ubrcy:"\u045E",Ubreve:"\u016C",ubreve:"\u016D",Ucirc:"\xDB",ucirc:"\xFB",Ucy:"\u0423",ucy:"\u0443",udarr:"\u21C5",Udblac:"\u0170",udblac:"\u0171",udhar:"\u296E",ufisht:"\u297E",Ufr:"\u{1D518}",ufr:"\u{1D532}",Ugrave:"\xD9",ugrave:"\xF9",uHar:"\u2963",uharl:"\u21BF",uharr:"\u21BE",uhblk:"\u2580",ulcorn:"\u231C",ulcorner:"\u231C",ulcrop:"\u230F",ultri:"\u25F8",Umacr:"\u016A",umacr:"\u016B",uml:"\xA8",UnderBar:"_",UnderBrace:"\u23DF",UnderBracket:"\u23B5",UnderParenthesis:"\u23DD",Union:"\u22C3",UnionPlus:"\u228E",Uogon:"\u0172",uogon:"\u0173",Uopf:"\u{1D54C}",uopf:"\u{1D566}",UpArrow:"\u2191",Uparrow:"\u21D1",uparrow:"\u2191",UpArrowBar:"\u2912",UpArrowDownArrow:"\u21C5",UpDownArrow:"\u2195",Updownarrow:"\u21D5",updownarrow:"\u2195",UpEquilibrium:"\u296E",upharpoonleft:"\u21BF",upharpoonright:"\u21BE",uplus:"\u228E",UpperLeftArrow:"\u2196",UpperRightArrow:"\u2197",Upsi:"\u03D2",upsi:"\u03C5",upsih:"\u03D2",Upsilon:"\u03A5",upsilon:"\u03C5",UpTee:"\u22A5",UpTeeArrow:"\u21A5",upuparrows:"\u21C8",urcorn:"\u231D",urcorner:"\u231D",urcrop:"\u230E",Uring:"\u016E",uring:"\u016F",urtri:"\u25F9",Uscr:"\u{1D4B0}",uscr:"\u{1D4CA}",utdot:"\u22F0",Utilde:"\u0168",utilde:"\u0169",utri:"\u25B5",utrif:"\u25B4",uuarr:"\u21C8",Uuml:"\xDC",uuml:"\xFC",uwangle:"\u29A7",vangrt:"\u299C",varepsilon:"\u03F5",varkappa:"\u03F0",varnothing:"\u2205",varphi:"\u03D5",varpi:"\u03D6",varpropto:"\u221D",vArr:"\u21D5",varr:"\u2195",varrho:"\u03F1",varsigma:"\u03C2",varsubsetneq:"\u228A\uFE00",varsubsetneqq:"\u2ACB\uFE00",varsupsetneq:"\u228B\uFE00",varsupsetneqq:"\u2ACC\uFE00",vartheta:"\u03D1",vartriangleleft:"\u22B2",vartriangleright:"\u22B3",Vbar:"\u2AEB",vBar:"\u2AE8",vBarv:"\u2AE9",Vcy:"\u0412",vcy:"\u0432",VDash:"\u22AB",Vdash:"\u22A9",vDash:"\u22A8",vdash:"\u22A2",Vdashl:"\u2AE6",Vee:"\u22C1",vee:"\u2228",veebar:"\u22BB",veeeq:"\u225A",vellip:"\u22EE",Verbar:"\u2016",verbar:"|",Vert:"\u2016",vert:"|",VerticalBar:"\u2223",VerticalLine:"|",VerticalSeparator:"\u2758",VerticalTilde:"\u2240",VeryThinSpace:"\u200A",Vfr:"\u{1D519}",vfr:"\u{1D533}",vltri:"\u22B2",vnsub:"\u2282\u20D2",vnsup:"\u2283\u20D2",Vopf:"\u{1D54D}",vopf:"\u{1D567}",vprop:"\u221D",vrtri:"\u22B3",Vscr:"\u{1D4B1}",vscr:"\u{1D4CB}",vsubnE:"\u2ACB\uFE00",vsubne:"\u228A\uFE00",vsupnE:"\u2ACC\uFE00",vsupne:"\u228B\uFE00",Vvdash:"\u22AA",vzigzag:"\u299A",Wcirc:"\u0174",wcirc:"\u0175",wedbar:"\u2A5F",Wedge:"\u22C0",wedge:"\u2227",wedgeq:"\u2259",weierp:"\u2118",Wfr:"\u{1D51A}",wfr:"\u{1D534}",Wopf:"\u{1D54E}",wopf:"\u{1D568}",wp:"\u2118",wr:"\u2240",wreath:"\u2240",Wscr:"\u{1D4B2}",wscr:"\u{1D4CC}",xcap:"\u22C2",xcirc:"\u25EF",xcup:"\u22C3",xdtri:"\u25BD",Xfr:"\u{1D51B}",xfr:"\u{1D535}",xhArr:"\u27FA",xharr:"\u27F7",Xi:"\u039E",xi:"\u03BE",xlArr:"\u27F8",xlarr:"\u27F5",xmap:"\u27FC",xnis:"\u22FB",xodot:"\u2A00",Xopf:"\u{1D54F}",xopf:"\u{1D569}",xoplus:"\u2A01",xotime:"\u2A02",xrArr:"\u27F9",xrarr:"\u27F6",Xscr:"\u{1D4B3}",xscr:"\u{1D4CD}",xsqcup:"\u2A06",xuplus:"\u2A04",xutri:"\u25B3",xvee:"\u22C1",xwedge:"\u22C0",Yacute:"\xDD",yacute:"\xFD",YAcy:"\u042F",yacy:"\u044F",Ycirc:"\u0176",ycirc:"\u0177",Ycy:"\u042B",ycy:"\u044B",yen:"\xA5",Yfr:"\u{1D51C}",yfr:"\u{1D536}",YIcy:"\u0407",yicy:"\u0457",Yopf:"\u{1D550}",yopf:"\u{1D56A}",Yscr:"\u{1D4B4}",yscr:"\u{1D4CE}",YUcy:"\u042E",yucy:"\u044E",Yuml:"\u0178",yuml:"\xFF",Zacute:"\u0179",zacute:"\u017A",Zcaron:"\u017D",zcaron:"\u017E",Zcy:"\u0417",zcy:"\u0437",Zdot:"\u017B",zdot:"\u017C",zeetrf:"\u2128",ZeroWidthSpace:"\u200B",Zeta:"\u0396",zeta:"\u03B6",Zfr:"\u2128",zfr:"\u{1D537}",ZHcy:"\u0416",zhcy:"\u0436",zigrarr:"\u21DD",Zopf:"\u2124",zopf:"\u{1D56B}",Zscr:"\u{1D4B5}",zscr:"\u{1D4CF}",zwj:"\u200D",zwnj:"\u200C"});pn.entityMap=pn.HTML_ENTITIES;});var ws=Re(Hn=>{var Rt=ct(),W=kr(),ds=on(),Ru=Rt.isHTMLEscapableRawTextElement,Bu=Rt.isHTMLMimeType,Fu=Rt.isHTMLRawTextElement,wn=Rt.hasOwn,us=Rt.NAMESPACE,ls=ds.ParseError,Lu=ds.DOMException,mn=0,tt=1,Ot=2,_n=3,Pt=4,Mt=5,gn=6,Wn=7;function hs(){}d(hs,"XMLReader");hs.prototype={parse:d(function(e,t,n){var r=this.domBuilder;r.startDocument(),ps(t,t=Object.create(null)),$u(e,t,n,r,this.errorHandler),r.endDocument();},"parse")};var Lr=/&#?\w+;?/g;function $u(e,t,n,r,s){var i=Bu(r.mimeType);e.indexOf(W.UNICODE_REPLACEMENT_CHARACTER)>=0&&s.warning("Unicode replacement character detected, source encoding issues?");function o(R){if(R>65535){R-=65536;var q=55296+(R>>10),Q=56320+(R&1023);return String.fromCharCode(q,Q)}else return String.fromCharCode(R)}d(o,"fixedFromCharCode");function l(R){var q=R[R.length-1]===";"?R:R+";";if(!i&&q!==R)return s.error("EntityRef: expecting ;"),R;var Q=W.Reference.exec(q);if(!Q||Q[0].length!==q.length)return s.error("entity not matching Reference production: "+R),R;var te=q.slice(1,-1);return wn(n,te)?n[te]:te.charAt(0)==="#"?o(parseInt(te.substring(1).replace("x","0x"))):(s.error("entity not found:"+R),R)}d(l,"entityReplacer");function u(R){if(R>g){var q=e.substring(g,R).replace(Lr,l);h&&p(g),r.characters(q,0,R-g),g=R;}}d(u,"appendText");var a=0,c=0,f=/\r\n?|\n|$/g,h=r.locator;function p(R,q){for(;R>=c&&(q=f.exec(e));)a=c,c=q.index+q[0].length,h.lineNumber++;h.columnNumber=R-a+1;}d(p,"position");for(var _=[{currentNSMap:t}],m=[],g=0;;){try{var v=e.indexOf("<",g);if(v<0){if(!i&&m.length>0)return s.fatalError("unclosed xml tag(s): "+m.join(", "));if(!e.substring(g).match(/^\s*$/)){var D=r.doc,y=D.createTextNode(e.substring(g));if(D.documentElement)return s.error("Extra content at the end of the document");D.appendChild(y),r.currentElement=y;}return}if(v>g){var w=e.substring(g,v);!i&&m.length===0&&(w=w.replace(new RegExp(W.S_OPT.source,"g"),""),w&&s.error("Unexpected content outside root element: '"+w+"'")),u(v);}switch(e.charAt(v+1)){case "/":var O=e.indexOf(">",v+2),E=e.substring(v+2,O>0?O:void 0);if(!E)return s.fatalError("end tag name missing");var b=O>0&&W.reg("^",W.QName_group,W.S_OPT,"$").exec(E);if(!b)return s.fatalError('end tag name contains invalid characters: "'+E+'"');if(!r.currentElement&&!r.doc.documentElement)return;var A=m[m.length-1]||r.currentElement.tagName||r.doc.documentElement.tagName||"";if(A!==b[1]){var N=b[1].toLowerCase();if(!i||A.toLowerCase()!==N)return s.fatalError('Opening and ending tag mismatch: "'+A+'" != "'+E+'"')}var x=_.pop();m.pop();var C=x.localNSMap;if(r.endElement(x.uri,x.localName,A),C)for(var P in C)wn(C,P)&&r.endPrefixMapping(P);O++;break;case "?":h&&p(v),O=zu(e,v,r,s);break;case "!":h&&p(v),O=_s(e,v,r,s,i);break;default:h&&p(v);var S=new gs,$=_[_.length-1].currentNSMap,O=Uu(e,v,S,$,l,s,i),T=S.length;if(S.closed||(i&&Rt.isHTMLVoidElement(S.tagName)?S.closed=!0:m.push(S.tagName)),h&&T){for(var M=cs(h,{}),B=0;B<T;B++){var U=S[B];p(U.offset),U.locator=cs(h,{});}r.locator=M,fs(S,r,$)&&_.push(S),r.locator=h;}else fs(S,r,$)&&_.push(S);i&&!S.closed?O=qu(e,O,S.tagName,l,r):O++;}}catch(R){if(R instanceof ls)throw R;if(R instanceof Lu)throw new ls(R.name+": "+R.message,r.locator,R);s.error("element parse error: "+R),O=-1;}O>g?g=O:u(Math.max(v,g)+1);}}d($u,"parse");function cs(e,t){return t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber,t}d(cs,"copyLocator");function Uu(e,t,n,r,s,i,o){function l(p,_,m){if(wn(n.attributeNames,p))return i.fatalError("Attribute "+p+" redefined");if(!o&&_.indexOf("<")>=0)return i.fatalError("Unescaped '<' not allowed in attributes values");n.addValue(p,_.replace(/[\t\n\r]/g," ").replace(Lr,s),m);}d(l,"addAttribute");for(var u,a,c=++t,f=mn;;){var h=e.charAt(c);switch(h){case "=":if(f===tt)u=e.slice(t,c),f=_n;else if(f===Ot)f=_n;else throw new Error("attribute equal must after attrName");break;case "'":case '"':if(f===_n||f===tt)if(f===tt&&(i.warning('attribute value must after "="'),u=e.slice(t,c)),t=c+1,c=e.indexOf(h,t),c>0)a=e.slice(t,c),l(u,a,t-1),f=Mt;else throw new Error("attribute value no end '"+h+"' match");else if(f==Pt)a=e.slice(t,c),l(u,a,t),i.warning('attribute "'+u+'" missed start quot('+h+")!!"),t=c+1,f=Mt;else throw new Error('attribute value must after "="');break;case "/":switch(f){case mn:n.setTagName(e.slice(t,c));case Mt:case gn:case Wn:f=Wn,n.closed=true;case Pt:case tt:break;case Ot:n.closed=true;break;default:throw new Error("attribute invalid close char('/')")}break;case "":return i.error("unexpected end of input"),f==mn&&n.setTagName(e.slice(t,c)),c;case ">":switch(f){case mn:n.setTagName(e.slice(t,c));case Mt:case gn:case Wn:break;case Pt:case tt:a=e.slice(t,c),a.slice(-1)==="/"&&(n.closed=true,a=a.slice(0,-1));case Ot:f===Ot&&(a=u),f==Pt?(i.warning('attribute "'+a+'" missed quot(")!'),l(u,a,t)):(o||i.warning('attribute "'+a+'" missed value!! "'+a+'" instead!!'),l(a,a,t));break;case _n:if(!o)return i.fatalError(`AttValue: ' or " expected`)}return c;case "\x80":h=" ";default:if(h<=" ")switch(f){case mn:n.setTagName(e.slice(t,c)),f=gn;break;case tt:u=e.slice(t,c),f=Ot;break;case Pt:var a=e.slice(t,c);i.warning('attribute "'+a+'" missed quot(")!!'),l(u,a,t);case Mt:f=gn;break}else switch(f){case Ot:o||i.warning('attribute "'+u+'" missed value!! "'+u+'" instead2!!'),l(u,u,t),t=c,f=tt;break;case Mt:i.warning('attribute space is required"'+u+'"!!');case gn:f=tt,t=c;break;case _n:f=Pt,t=c;break;case Wn:throw new Error("elements closed character '/' and '>' must be connected to")}}c++;}}d(Uu,"parseElementStartPart");function fs(e,t,n){for(var r=e.tagName,s=null,f=e.length;f--;){var i=e[f],o=i.qName,l=i.value,h=o.indexOf(":");if(h>0)var u=i.prefix=o.slice(0,h),a=o.slice(h+1),c=u==="xmlns"&&a;else a=o,u=null,c=o==="xmlns"&&"";i.localName=a,c!==false&&(s==null&&(s=Object.create(null),ps(n,n=Object.create(null))),n[c]=s[c]=l,i.uri=us.XMLNS,t.startPrefixMapping(c,l));}for(var f=e.length;f--;)i=e[f],i.prefix&&(i.prefix==="xml"&&(i.uri=us.XML),i.prefix!=="xmlns"&&(i.uri=n[i.prefix]));var h=r.indexOf(":");h>0?(u=e.prefix=r.slice(0,h),a=e.localName=r.slice(h+1)):(u=null,a=e.localName=r);var p=e.uri=n[u||""];if(t.startElement(p,a,r,e),e.closed){if(t.endElement(p,a,r),s)for(u in s)wn(s,u)&&t.endPrefixMapping(u);}else return e.currentNSMap=n,e.localNSMap=s,true}d(fs,"appendElement");function qu(e,t,n,r,s){var i=Ru(n);if(i||Fu(n)){var o=e.indexOf("</"+n+">",t),l=e.substring(t+1,o);return i&&(l=l.replace(Lr,r)),s.characters(l,0,l.length),o}return t+1}d(qu,"parseHtmlSpecialContent");function ps(e,t){for(var n in e)wn(e,n)&&(t[n]=e[n]);}d(ps,"_copy");function ms(e,t){var n=t;function r(c){return c=c||0,e.charAt(n+c)}d(r,"char");function s(c){c=c||1,n+=c;}d(s,"skip");function i(){for(var c=0;n<e.length;){var f=r();if(f!==" "&&f!==`
|
|
3
|
+
`&&f!==" "&&f!=="\r")return c;c++,s();}return -1}d(i,"skipBlanks");function o(){return e.substring(n)}d(o,"substringFromIndex");function l(c){return e.substring(n,n+c.length)===c}d(l,"substringStartsWith");function u(c){return e.substring(n,n+c.length).toUpperCase()===c.toUpperCase()}d(u,"substringStartsWithCaseInsensitive");function a(c){var f=W.reg("^",c),h=f.exec(o());return h?(s(h[0].length),h[0]):null}return d(a,"getMatch"),{char:r,getIndex:d(function(){return n},"getIndex"),getMatch:a,getSource:d(function(){return e},"getSource"),skip:s,skipBlanks:i,substringFromIndex:o,substringStartsWith:l,substringStartsWithCaseInsensitive:u}}d(ms,"parseUtils");function ju(e,t){function n(l,u){var a=W.PI.exec(l.substringFromIndex());return a?a[1].toLowerCase()==="xml"?u.fatalError("xml declaration is only allowed at the start of the document, but found at position "+l.getIndex()):(l.skip(a[0].length),a[0]):u.fatalError("processing instruction is not well-formed at position "+l.getIndex())}d(n,"parsePI");var r=e.getSource();if(e.char()==="["){e.skip(1);for(var s=e.getIndex();e.getIndex()<r.length;){if(e.skipBlanks(),e.char()==="]"){var i=r.substring(s,e.getIndex());return e.skip(1),i}var o=null;if(e.char()==="<"&&e.char(1)==="!")switch(e.char(2)){case "E":e.char(3)==="L"?o=e.getMatch(W.elementdecl):e.char(3)==="N"&&(o=e.getMatch(W.EntityDecl));break;case "A":o=e.getMatch(W.AttlistDecl);break;case "N":o=e.getMatch(W.NotationDecl);break;case "-":o=e.getMatch(W.Comment);break}else if(e.char()==="<"&&e.char(1)==="?")o=n(e,t);else if(e.char()==="%")o=e.getMatch(W.PEReference);else return t.fatalError("Error detected in Markup declaration");if(!o)return t.fatalError("Error in internal subset at position "+e.getIndex())}return t.fatalError("doctype internal subset is not well-formed, missing ]")}}d(ju,"parseDoctypeInternalSubset");function _s(e,t,n,r,s){var i=ms(e,t);switch(s?i.char(2).toUpperCase():i.char(2)){case "-":var o=i.getMatch(W.Comment);return o?(n.comment(o,W.COMMENT_START.length,o.length-W.COMMENT_START.length-W.COMMENT_END.length),i.getIndex()):r.fatalError("comment is not well-formed at position "+i.getIndex());case "[":var l=i.getMatch(W.CDSect);return l?!s&&!n.currentElement?r.fatalError("CDATA outside of element"):(n.startCDATA(),n.characters(l,W.CDATA_START.length,l.length-W.CDATA_START.length-W.CDATA_END.length),n.endCDATA(),i.getIndex()):r.fatalError("Invalid CDATA starting at position "+t);case "D":{if(n.doc&&n.doc.documentElement)return r.fatalError("Doctype not allowed inside or after documentElement at position "+i.getIndex());if(s?!i.substringStartsWithCaseInsensitive(W.DOCTYPE_DECL_START):!i.substringStartsWith(W.DOCTYPE_DECL_START))return r.fatalError("Expected "+W.DOCTYPE_DECL_START+" at position "+i.getIndex());if(i.skip(W.DOCTYPE_DECL_START.length),i.skipBlanks()<1)return r.fatalError("Expected whitespace after "+W.DOCTYPE_DECL_START+" at position "+i.getIndex());var u={name:void 0,publicId:void 0,systemId:void 0,internalSubset:void 0};if(u.name=i.getMatch(W.Name),!u.name)return r.fatalError("doctype name missing or contains unexpected characters at position "+i.getIndex());if(s&&u.name.toLowerCase()!=="html"&&r.warning("Unexpected DOCTYPE in HTML document at position "+i.getIndex()),i.skipBlanks(),i.substringStartsWith(W.PUBLIC)||i.substringStartsWith(W.SYSTEM)){var a=W.ExternalID_match.exec(i.substringFromIndex());if(!a)return r.fatalError("doctype external id is not well-formed at position "+i.getIndex());a.groups.SystemLiteralOnly!==void 0?u.systemId=a.groups.SystemLiteralOnly:(u.systemId=a.groups.SystemLiteral,u.publicId=a.groups.PubidLiteral),i.skip(a[0].length);}else if(s&&i.substringStartsWithCaseInsensitive(W.SYSTEM)){if(i.skip(W.SYSTEM.length),i.skipBlanks()<1)return r.fatalError("Expected whitespace after "+W.SYSTEM+" at position "+i.getIndex());if(u.systemId=i.getMatch(W.ABOUT_LEGACY_COMPAT_SystemLiteral),!u.systemId)return r.fatalError("Expected "+W.ABOUT_LEGACY_COMPAT+" in single or double quotes after "+W.SYSTEM+" at position "+i.getIndex())}return s&&u.systemId&&!W.ABOUT_LEGACY_COMPAT_SystemLiteral.test(u.systemId)&&r.warning("Unexpected doctype.systemId in HTML document at position "+i.getIndex()),s||(i.skipBlanks(),u.internalSubset=ju(i,r)),i.skipBlanks(),i.char()!==">"?r.fatalError("doctype not terminated with > at position "+i.getIndex()):(i.skip(1),n.startDTD(u.name,u.publicId,u.systemId,u.internalSubset),n.endDTD(),i.getIndex())}default:return r.fatalError('Not well-formed XML starting with "<!" at position '+t)}}d(_s,"parseDoctypeCommentOrCData");function zu(e,t,n,r){var s=e.substring(t).match(W.PI);if(!s)return r.fatalError("Invalid processing instruction starting at position "+t);if(s[1].toLowerCase()==="xml"){if(t>0)return r.fatalError("processing instruction at position "+t+" is an xml declaration which is only at the start of the document");if(!W.XMLDecl.test(e.substring(t)))return r.fatalError("xml declaration is not well-formed")}return n.processingInstruction(s[1],s[2]),t+s[0].length}d(zu,"parseProcessingInstruction");function gs(){this.attributeNames=Object.create(null);}d(gs,"ElementAttributes");gs.prototype={setTagName:d(function(e){if(!W.QName_exact.test(e))throw new Error("invalid tagName:"+e);this.tagName=e;},"setTagName"),addValue:d(function(e,t,n){if(!W.QName_exact.test(e))throw new Error("invalid attribute:"+e);this.attributeNames[e]=this.length,this[this.length++]={qName:e,value:t,offset:n};},"addValue"),length:0,getLocalName:d(function(e){return this[e].localName},"getLocalName"),getLocator:d(function(e){return this[e].locator},"getLocator"),getQName:d(function(e){return this[e].qName},"getQName"),getURI:d(function(e){return this[e].uri},"getURI"),getValue:d(function(e){return this[e].value},"getValue")};Hn.XMLReader=hs;Hn.parseUtils=ms;Hn.parseDoctypeCommentOrCData=_s;});var Ns=Re(Ft=>{var dt=ct(),Wu=Fr(),Hu=on(),vs=as(),Vu=ws(),Gu=Wu.DOMImplementation,Yu=dt.hasDefaultHTMLNamespace,Xu=dt.isHTMLMimeType,Qu=dt.isValidMimeType,bs=dt.MIME_TYPE,$r=dt.NAMESPACE,ys=Hu.ParseError,Ju=Vu.XMLReader;function Ds(e){return e.replace(/\r[\n\u0085]/g,`
|
|
4
4
|
`).replace(/[\r\u0085\u2028\u2029]/g,`
|
|
5
|
-
`)}d(
|
|
6
|
-
`,c),f==-1&&(f=a.length-1);var p=a.substring(c,f+1);(r.hasOwnProperty?r.hasOwnProperty(p):r[p]!==void 0)?u+=String.fromCharCode(r[p]):(h==i&&(p=a.substring(c),f=a.length),u+=String.fromCharCode(h),r[p]=h,n[h++]=p),c=f+1;}return u}d(o,"diff_linesToCharsMunge_");var i=4e4,s=o(e);i=65535;var l=o(t);return {chars1:s,chars2:l,lineArray:n}};S.prototype.diff_charsToLines_=function(e,t){for(var n=0;n<e.length;n++){for(var r=e[n][1],o=[],i=0;i<r.length;i++)o[i]=t[r.charCodeAt(i)];e[n][1]=o.join("");}};S.prototype.diff_commonPrefix=function(e,t){if(!e||!t||e.charAt(0)!=t.charAt(0))return 0;for(var n=0,r=Math.min(e.length,t.length),o=r,i=0;n<o;)e.substring(i,o)==t.substring(i,o)?(n=o,i=n):r=o,o=Math.floor((r-n)/2+n);return o};S.prototype.diff_commonSuffix=function(e,t){if(!e||!t||e.charAt(e.length-1)!=t.charAt(t.length-1))return 0;for(var n=0,r=Math.min(e.length,t.length),o=r,i=0;n<o;)e.substring(e.length-o,e.length-i)==t.substring(t.length-o,t.length-i)?(n=o,i=n):r=o,o=Math.floor((r-n)/2+n);return o};S.prototype.diff_commonOverlap_=function(e,t){var n=e.length,r=t.length;if(n==0||r==0)return 0;n>r?e=e.substring(n-r):n<r&&(t=t.substring(0,n));var o=Math.min(n,r);if(e==t)return o;for(var i=0,s=1;;){var l=e.substring(o-s),a=t.indexOf(l);if(a==-1)return i;s+=a,(a==0||e.substring(o-s)==t.substring(0,s))&&(i=s,s++);}};S.prototype.diff_halfMatch_=function(e,t){if(this.Diff_Timeout<=0)return null;var n=e.length>t.length?e:t,r=e.length>t.length?t:e;if(n.length<4||r.length*2<n.length)return null;var o=this;function i(_,m,g){for(var v=_.substring(g,g+Math.floor(_.length/4)),E=-1,y="",w,b,D,A;(E=m.indexOf(v,E+1))!=-1;){var x=o.diff_commonPrefix(_.substring(g),m.substring(E)),N=o.diff_commonSuffix(_.substring(0,g),m.substring(0,E));y.length<N+x&&(y=m.substring(E-N,E)+m.substring(E,E+x),w=_.substring(0,g-N),b=_.substring(g+x),D=m.substring(0,E-N),A=m.substring(E+x));}return y.length*2>=_.length?[w,b,D,A,y]:null}d(i,"diff_halfMatchI_");var s=i(n,r,Math.ceil(n.length/4)),l=i(n,r,Math.ceil(n.length/2)),a;if(!s&&!l)return null;l?s?a=s[4].length>l[4].length?s:l:a=l:a=s;var u,c,f,h;e.length>t.length?(u=a[0],c=a[1],f=a[2],h=a[3]):(f=a[0],h=a[1],u=a[2],c=a[3]);var p=a[4];return [u,c,f,h,p]};S.prototype.diff_cleanupSemantic=function(e){for(var t=false,n=[],r=0,o=null,i=0,s=0,l=0,a=0,u=0;i<e.length;)e[i][0]==W?(n[r++]=i,s=a,l=u,a=0,u=0,o=e[i][1]):(e[i][0]==ne?a+=e[i][1].length:u+=e[i][1].length,o&&o.length<=Math.max(s,l)&&o.length<=Math.max(a,u)&&(e.splice(n[r-1],0,new S.Diff(ee,o)),e[n[r-1]+1][0]=ne,r--,r--,i=r>0?n[r-1]:-1,s=0,l=0,a=0,u=0,o=null,t=true)),i++;for(t&&this.diff_cleanupMerge(e),this.diff_cleanupSemanticLossless(e),i=1;i<e.length;){if(e[i-1][0]==ee&&e[i][0]==ne){var c=e[i-1][1],f=e[i][1],h=this.diff_commonOverlap_(c,f),p=this.diff_commonOverlap_(f,c);h>=p?(h>=c.length/2||h>=f.length/2)&&(e.splice(i,0,new S.Diff(W,f.substring(0,h))),e[i-1][1]=c.substring(0,c.length-h),e[i+1][1]=f.substring(h),i++):(p>=c.length/2||p>=f.length/2)&&(e.splice(i,0,new S.Diff(W,c.substring(0,p))),e[i-1][0]=ne,e[i-1][1]=f.substring(0,f.length-p),e[i+1][0]=ee,e[i+1][1]=c.substring(p),i++),i++;}i++;}};S.prototype.diff_cleanupSemanticLossless=function(e){function t(p,_){if(!p||!_)return 6;var m=p.charAt(p.length-1),g=_.charAt(0),v=m.match(S.nonAlphaNumericRegex_),E=g.match(S.nonAlphaNumericRegex_),y=v&&m.match(S.whitespaceRegex_),w=E&&g.match(S.whitespaceRegex_),b=y&&m.match(S.linebreakRegex_),D=w&&g.match(S.linebreakRegex_),A=b&&p.match(S.blanklineEndRegex_),x=D&&_.match(S.blanklineStartRegex_);return A||x?5:b||D?4:v&&!y&&w?3:y||w?2:v||E?1:0}d(t,"diff_cleanupSemanticScore_");for(var n=1;n<e.length-1;){if(e[n-1][0]==W&&e[n+1][0]==W){var r=e[n-1][1],o=e[n][1],i=e[n+1][1],s=this.diff_commonSuffix(r,o);if(s){var l=o.substring(o.length-s);r=r.substring(0,r.length-s),o=l+o.substring(0,o.length-s),i=l+i;}for(var a=r,u=o,c=i,f=t(r,o)+t(o,i);o.charAt(0)===i.charAt(0);){r+=o.charAt(0),o=o.substring(1)+i.charAt(0),i=i.substring(1);var h=t(r,o)+t(o,i);h>=f&&(f=h,a=r,u=o,c=i);}e[n-1][1]!=a&&(a?e[n-1][1]=a:(e.splice(n-1,1),n--),e[n][1]=u,c?e[n+1][1]=c:(e.splice(n+1,1),n--));}n++;}};S.nonAlphaNumericRegex_=/[^a-zA-Z0-9]/;S.whitespaceRegex_=/\s/;S.linebreakRegex_=/[\r\n]/;S.blanklineEndRegex_=/\n\r?\n$/;S.blanklineStartRegex_=/^\r?\n\r?\n/;S.prototype.diff_cleanupEfficiency=function(e){for(var t=false,n=[],r=0,o=null,i=0,s=false,l=false,a=false,u=false;i<e.length;)e[i][0]==W?(e[i][1].length<this.Diff_EditCost&&(a||u)?(n[r++]=i,s=a,l=u,o=e[i][1]):(r=0,o=null),a=u=false):(e[i][0]==ee?u=true:a=true,o&&(s&&l&&a&&u||o.length<this.Diff_EditCost/2&&s+l+a+u==3)&&(e.splice(n[r-1],0,new S.Diff(ee,o)),e[n[r-1]+1][0]=ne,r--,o=null,s&&l?(a=u=true,r=0):(r--,i=r>0?n[r-1]:-1,a=u=false),t=true)),i++;t&&this.diff_cleanupMerge(e);};S.prototype.diff_cleanupMerge=function(e){e.push(new S.Diff(W,""));for(var t=0,n=0,r=0,o="",i="",s;t<e.length;)switch(e[t][0]){case ne:r++,i+=e[t][1],t++;break;case ee:n++,o+=e[t][1],t++;break;case W:n+r>1?(n!==0&&r!==0&&(s=this.diff_commonPrefix(i,o),s!==0&&(t-n-r>0&&e[t-n-r-1][0]==W?e[t-n-r-1][1]+=i.substring(0,s):(e.splice(0,0,new S.Diff(W,i.substring(0,s))),t++),i=i.substring(s),o=o.substring(s)),s=this.diff_commonSuffix(i,o),s!==0&&(e[t][1]=i.substring(i.length-s)+e[t][1],i=i.substring(0,i.length-s),o=o.substring(0,o.length-s))),t-=n+r,e.splice(t,n+r),o.length&&(e.splice(t,0,new S.Diff(ee,o)),t++),i.length&&(e.splice(t,0,new S.Diff(ne,i)),t++),t++):t!==0&&e[t-1][0]==W?(e[t-1][1]+=e[t][1],e.splice(t,1)):t++,r=0,n=0,o="",i="";break}e[e.length-1][1]===""&&e.pop();var l=false;for(t=1;t<e.length-1;)e[t-1][0]==W&&e[t+1][0]==W&&(e[t][1].substring(e[t][1].length-e[t-1][1].length)==e[t-1][1]?(e[t][1]=e[t-1][1]+e[t][1].substring(0,e[t][1].length-e[t-1][1].length),e[t+1][1]=e[t-1][1]+e[t+1][1],e.splice(t-1,1),l=true):e[t][1].substring(0,e[t+1][1].length)==e[t+1][1]&&(e[t-1][1]+=e[t+1][1],e[t][1]=e[t][1].substring(e[t+1][1].length)+e[t+1][1],e.splice(t+1,1),l=true)),t++;l&&this.diff_cleanupMerge(e);};S.prototype.diff_xIndex=function(e,t){var n=0,r=0,o=0,i=0,s;for(s=0;s<e.length&&(e[s][0]!==ne&&(n+=e[s][1].length),e[s][0]!==ee&&(r+=e[s][1].length),!(n>t));s++)o=n,i=r;return e.length!=s&&e[s][0]===ee?i:i+(t-o)};S.prototype.diff_prettyHtml=function(e){for(var t=[],n=/&/g,r=/</g,o=/>/g,i=/\n/g,s=0;s<e.length;s++){var l=e[s][0],a=e[s][1],u=a.replace(n,"&").replace(r,"<").replace(o,">").replace(i,"¶<br>");switch(l){case ne:t[s]='<ins style="background:#e6ffe6;">'+u+"</ins>";break;case ee:t[s]='<del style="background:#ffe6e6;">'+u+"</del>";break;case W:t[s]="<span>"+u+"</span>";break}}return t.join("")};S.prototype.diff_text1=function(e){for(var t=[],n=0;n<e.length;n++)e[n][0]!==ne&&(t[n]=e[n][1]);return t.join("")};S.prototype.diff_text2=function(e){for(var t=[],n=0;n<e.length;n++)e[n][0]!==ee&&(t[n]=e[n][1]);return t.join("")};S.prototype.diff_levenshtein=function(e){for(var t=0,n=0,r=0,o=0;o<e.length;o++){var i=e[o][0],s=e[o][1];switch(i){case ne:n+=s.length;break;case ee:r+=s.length;break;case W:t+=Math.max(n,r),n=0,r=0;break}}return t+=Math.max(n,r),t};S.prototype.diff_toDelta=function(e){for(var t=[],n=0;n<e.length;n++)switch(e[n][0]){case ne:t[n]="+"+encodeURI(e[n][1]);break;case ee:t[n]="-"+e[n][1].length;break;case W:t[n]="="+e[n][1].length;break}return t.join(" ").replace(/%20/g," ")};S.prototype.diff_fromDelta=function(e,t){for(var n=[],r=0,o=0,i=t.split(/\t/g),s=0;s<i.length;s++){var l=i[s].substring(1);switch(i[s].charAt(0)){case "+":try{n[r++]=new S.Diff(ne,decodeURI(l));}catch{throw new Error("Illegal escape in diff_fromDelta: "+l)}break;case "-":case "=":var a=parseInt(l,10);if(isNaN(a)||a<0)throw new Error("Invalid number in diff_fromDelta: "+l);var u=e.substring(o,o+=a);i[s].charAt(0)=="="?n[r++]=new S.Diff(W,u):n[r++]=new S.Diff(ee,u);break;default:if(i[s])throw new Error("Invalid diff operation in diff_fromDelta: "+i[s])}}if(o!=e.length)throw new Error("Delta length ("+o+") does not equal source text length ("+e.length+").");return n};S.prototype.match_main=function(e,t,n){if(e==null||t==null||n==null)throw new Error("Null input. (match_main)");return n=Math.max(0,Math.min(n,e.length)),e==t?0:e.length?e.substring(n,n+t.length)==t?n:this.match_bitap_(e,t,n):-1};S.prototype.match_bitap_=function(e,t,n){if(t.length>this.Match_MaxBits)throw new Error("Pattern too long for this browser.");var r=this.match_alphabet_(t),o=this;function i(w,b){var D=w/t.length,A=Math.abs(n-b);return o.Match_Distance?D+A/o.Match_Distance:A?1:D}d(i,"match_bitapScore_");var s=this.Match_Threshold,l=e.indexOf(t,n);l!=-1&&(s=Math.min(i(0,l),s),l=e.lastIndexOf(t,n+t.length),l!=-1&&(s=Math.min(i(0,l),s)));var a=1<<t.length-1;l=-1;for(var u,c,f=t.length+e.length,h,p=0;p<t.length;p++){for(u=0,c=f;u<c;)i(p,n+c)<=s?u=c:f=c,c=Math.floor((f-u)/2+u);f=c;var _=Math.max(1,n-c+1),m=Math.min(n+c,e.length)+t.length,g=Array(m+2);g[m+1]=(1<<p)-1;for(var v=m;v>=_;v--){var E=r[e.charAt(v-1)];if(p===0?g[v]=(g[v+1]<<1|1)&E:g[v]=(g[v+1]<<1|1)&E|((h[v+1]|h[v])<<1|1)|h[v+1],g[v]&a){var y=i(p,v-1);if(y<=s)if(s=y,l=v-1,l>n)_=Math.max(1,2*n-l);else break}}if(i(p+1,n)>s)break;h=g;}return l};S.prototype.match_alphabet_=function(e){for(var t={},n=0;n<e.length;n++)t[e.charAt(n)]=0;for(var n=0;n<e.length;n++)t[e.charAt(n)]|=1<<e.length-n-1;return t};S.prototype.patch_addContext_=function(e,t){if(t.length!=0){if(e.start2===null)throw Error("patch not initialized");for(var n=t.substring(e.start2,e.start2+e.length1),r=0;t.indexOf(n)!=t.lastIndexOf(n)&&n.length<this.Match_MaxBits-this.Patch_Margin-this.Patch_Margin;)r+=this.Patch_Margin,n=t.substring(e.start2-r,e.start2+e.length1+r);r+=this.Patch_Margin;var o=t.substring(e.start2-r,e.start2);o&&e.diffs.unshift(new S.Diff(W,o));var i=t.substring(e.start2+e.length1,e.start2+e.length1+r);i&&e.diffs.push(new S.Diff(W,i)),e.start1-=o.length,e.start2-=o.length,e.length1+=o.length+i.length,e.length2+=o.length+i.length;}};S.prototype.patch_make=function(e,t,n){var r,o;if(typeof e=="string"&&typeof t=="string"&&typeof n>"u")r=e,o=this.diff_main(r,t,true),o.length>2&&(this.diff_cleanupSemantic(o),this.diff_cleanupEfficiency(o));else if(e&&typeof e=="object"&&typeof t>"u"&&typeof n>"u")o=e,r=this.diff_text1(o);else if(typeof e=="string"&&t&&typeof t=="object"&&typeof n>"u")r=e,o=t;else if(typeof e=="string"&&typeof t=="string"&&n&&typeof n=="object")r=e,o=n;else throw new Error("Unknown call format to patch_make.");if(o.length===0)return [];for(var i=[],s=new S.patch_obj,l=0,a=0,u=0,c=r,f=r,h=0;h<o.length;h++){var p=o[h][0],_=o[h][1];switch(!l&&p!==W&&(s.start1=a,s.start2=u),p){case ne:s.diffs[l++]=o[h],s.length2+=_.length,f=f.substring(0,u)+_+f.substring(u);break;case ee:s.length1+=_.length,s.diffs[l++]=o[h],f=f.substring(0,u)+f.substring(u+_.length);break;case W:_.length<=2*this.Patch_Margin&&l&&o.length!=h+1?(s.diffs[l++]=o[h],s.length1+=_.length,s.length2+=_.length):_.length>=2*this.Patch_Margin&&l&&(this.patch_addContext_(s,c),i.push(s),s=new S.patch_obj,l=0,c=f,a=u);break}p!==ne&&(a+=_.length),p!==ee&&(u+=_.length);}return l&&(this.patch_addContext_(s,c),i.push(s)),i};S.prototype.patch_deepCopy=function(e){for(var t=[],n=0;n<e.length;n++){var r=e[n],o=new S.patch_obj;o.diffs=[];for(var i=0;i<r.diffs.length;i++)o.diffs[i]=new S.Diff(r.diffs[i][0],r.diffs[i][1]);o.start1=r.start1,o.start2=r.start2,o.length1=r.length1,o.length2=r.length2,t[n]=o;}return t};S.prototype.patch_apply=function(e,t){if(e.length==0)return [t,[]];e=this.patch_deepCopy(e);var n=this.patch_addPadding(e);t=n+t+n,this.patch_splitMax(e);for(var r=0,o=[],i=0;i<e.length;i++){var s=e[i].start2+r,l=this.diff_text1(e[i].diffs),a,u=-1;if(l.length>this.Match_MaxBits?(a=this.match_main(t,l.substring(0,this.Match_MaxBits),s),a!=-1&&(u=this.match_main(t,l.substring(l.length-this.Match_MaxBits),s+l.length-this.Match_MaxBits),(u==-1||a>=u)&&(a=-1))):a=this.match_main(t,l,s),a==-1)o[i]=false,r-=e[i].length2-e[i].length1;else {o[i]=true,r=a-s;var c;if(u==-1?c=t.substring(a,a+l.length):c=t.substring(a,u+this.Match_MaxBits),l==c)t=t.substring(0,a)+this.diff_text2(e[i].diffs)+t.substring(a+l.length);else {var f=this.diff_main(l,c,false);if(l.length>this.Match_MaxBits&&this.diff_levenshtein(f)/l.length>this.Patch_DeleteThreshold)o[i]=false;else {this.diff_cleanupSemanticLossless(f);for(var h=0,p,_=0;_<e[i].diffs.length;_++){var m=e[i].diffs[_];m[0]!==W&&(p=this.diff_xIndex(f,h)),m[0]===ne?t=t.substring(0,a+p)+m[1]+t.substring(a+p):m[0]===ee&&(t=t.substring(0,a+p)+t.substring(a+this.diff_xIndex(f,h+m[1].length))),m[0]!==ee&&(h+=m[1].length);}}}}}return t=t.substring(n.length,t.length-n.length),[t,o]};S.prototype.patch_addPadding=function(e){for(var t=this.Patch_Margin,n="",r=1;r<=t;r++)n+=String.fromCharCode(r);for(var r=0;r<e.length;r++)e[r].start1+=t,e[r].start2+=t;var o=e[0],i=o.diffs;if(i.length==0||i[0][0]!=W)i.unshift(new S.Diff(W,n)),o.start1-=t,o.start2-=t,o.length1+=t,o.length2+=t;else if(t>i[0][1].length){var s=t-i[0][1].length;i[0][1]=n.substring(i[0][1].length)+i[0][1],o.start1-=s,o.start2-=s,o.length1+=s,o.length2+=s;}if(o=e[e.length-1],i=o.diffs,i.length==0||i[i.length-1][0]!=W)i.push(new S.Diff(W,n)),o.length1+=t,o.length2+=t;else if(t>i[i.length-1][1].length){var s=t-i[i.length-1][1].length;i[i.length-1][1]+=n.substring(0,s),o.length1+=s,o.length2+=s;}return n};S.prototype.patch_splitMax=function(e){for(var t=this.Match_MaxBits,n=0;n<e.length;n++)if(!(e[n].length1<=t)){var r=e[n];e.splice(n--,1);for(var o=r.start1,i=r.start2,s="";r.diffs.length!==0;){var l=new S.patch_obj,a=true;for(l.start1=o-s.length,l.start2=i-s.length,s!==""&&(l.length1=l.length2=s.length,l.diffs.push(new S.Diff(W,s)));r.diffs.length!==0&&l.length1<t-this.Patch_Margin;){var u=r.diffs[0][0],c=r.diffs[0][1];u===ne?(l.length2+=c.length,i+=c.length,l.diffs.push(r.diffs.shift()),a=false):u===ee&&l.diffs.length==1&&l.diffs[0][0]==W&&c.length>2*t?(l.length1+=c.length,o+=c.length,a=false,l.diffs.push(new S.Diff(u,c)),r.diffs.shift()):(c=c.substring(0,t-l.length1-this.Patch_Margin),l.length1+=c.length,o+=c.length,u===W?(l.length2+=c.length,i+=c.length):a=false,l.diffs.push(new S.Diff(u,c)),c==r.diffs[0][1]?r.diffs.shift():r.diffs[0][1]=r.diffs[0][1].substring(c.length));}s=this.diff_text2(l.diffs),s=s.substring(s.length-this.Patch_Margin);var f=this.diff_text1(r.diffs).substring(0,this.Patch_Margin);f!==""&&(l.length1+=f.length,l.length2+=f.length,l.diffs.length!==0&&l.diffs[l.diffs.length-1][0]===W?l.diffs[l.diffs.length-1][1]+=f:l.diffs.push(new S.Diff(W,f))),a||e.splice(++n,0,l);}}};S.prototype.patch_toText=function(e){for(var t=[],n=0;n<e.length;n++)t[n]=e[n];return t.join("")};S.prototype.patch_fromText=function(e){var t=[];if(!e)return t;for(var n=e.split(`
|
|
7
|
-
`),r=0,
|
|
8
|
-
`],r,
|
|
9
|
-
`;}return n.join("").replace(/%20/g," ")};$t.exports=
|
|
10
|
-
`):n,
|
|
11
|
-
`+i;return
|
|
12
|
-
`+i):
|
|
13
|
-
`+i):(
|
|
14
|
-
`+i),new n8nWorkflow.NodeApiError(this.getNode(),{message:i,errors:o},{message:l,description:a,itemIndex:t})}return s.includes("invalid docx")||s.includes("missing word/document.xml")?new n8nWorkflow.NodeApiError(this.getNode(),{message:n},{message:"The document could not be opened.",description:"Verify the input binary is a valid .docx file (not .doc, .pdf, or another format).",itemIndex:t}):new n8nWorkflow.NodeApiError(this.getNode(),{message:n},{message:"Adeu engine error.",description:n,itemIndex:t})}d(Zr,"mapAdeuErrorToNodeApiError");function $s(e){if(!e||typeof e!="object")return false;let t=e;return typeof t.id=="string"&&typeof t.fileName=="string"&&typeof t.mimeType=="string"}d($s,"isStashedBinaryEntry");var ei=[{displayName:"Static Data Key",name:"staticDataKey",type:"string",default:"adeu_last_redlined",required:true,placeholder:"e.g. adeu_last_redlined",description:"Key in workflow global static data to read the stashed binary metadata from (string). When the Apply Edits operation runs as an AI Agent tool, n8n's tool wrapper strips the binary from its output before any downstream node can see it. To work around that, Apply Edits writes the binary's storage id into workflow static data under 'adeu_last_redlined'. This operation reads that entry back, fetches the original buffer via getBinaryStream, and attaches a fresh IBinaryData onto the outgoing item. Leave the default unless you've customized the stash key on the Apply Edits side.",displayOptions:{show:{resource:["document"],operation:["hydrateToolOutput"]}}},{displayName:"Output Binary Property",name:"outputBinaryPropertyName",type:"string",default:"data",required:true,placeholder:"e.g. data",description:"Name of the binary property on the outgoing item that will hold the hydrated .docx (string, e.g. 'data'). Downstream nodes (e.g. Write Binary File, Gmail send) should be configured to read from this property name.",displayOptions:{show:{resource:["document"],operation:["hydrateToolOutput"]}}},{displayName:"On Missing",name:"onMissing",type:"options",default:"emit_empty",description:"What to do when no stashed binary entry is found under the configured key. 'Emit Empty' is the typical AI Agent path: emits an item with json.hydrated=false and no binary, so a downstream If node can gate any write step on whether the LLM actually called Apply Edits this turn. 'Throw' is for deterministic pipelines where the stash MUST be present and a missing entry indicates a workflow bug.",options:[{name:"Emit Empty",value:"emit_empty",description:"Emit a single item with json.hydrated=false and no binary. Downstream If on json.hydrated gates the write."},{name:"Throw",value:"throw",description:"Throw a NodeOperationError. Use when a missing stash indicates a workflow bug."}],displayOptions:{show:{resource:["document"],operation:["hydrateToolOutput"]}}},{displayName:"Clear After Read",name:"clearAfterRead",type:"boolean",default:true,description:"Whether to delete the static data entry after a successful hydration so it does not leak across workflow runs. Set false if you want to inspect or re-read the entry from a later node in the same run.",displayOptions:{show:{resource:["document"],operation:["hydrateToolOutput"]}}},{displayName:"Output Path Template",name:"outputPathTemplate",type:"string",default:"",placeholder:"e.g. C:\\Users\\Uzair\\.n8n-files\\{baseName}_{timestamp}.docx",description:"Optional template to compute the final write path on disk, returned on the output JSON as 'outputPath'. If set, you can configure downstream Write nodes to simply read '{{ $json.outputPath }}' with zero escaping risks. Supports these placeholders: '{baseName}' (filename with extension stripped), '{timestamp}' (current ISO 8601 timestamp with colons and dots replaced by dashes for Windows file compatibility), '{fileName}' (the stashed filename including extension), and '{ext}' (e.g., '.docx').",displayOptions:{show:{resource:["document"],operation:["hydrateToolOutput"]}}}];async function ti(e){let t=this.getNodeParameter("staticDataKey",e),n=this.getNodeParameter("outputBinaryPropertyName",e),r=this.getNodeParameter("onMissing",e),o=this.getNodeParameter("clearAfterRead",e),i=this.getWorkflowStaticData("global"),s=i[t];if(!$s(s)){if(r==="throw")throw new n8nWorkflow.NodeOperationError(this.getNode(),`No stashed binary found under static data key "${t}".`,{description:"The Apply Edits operation writes a stash entry into workflow static data only when it runs as an AI Agent tool and produces a binary. Verify that Apply Edits was actually called by the agent this turn, that it ran successfully, and that the key matches the one used on the writing side.",itemIndex:e});return [{json:{hydrated:false},pairedItem:{item:e}}]}let{id:l,fileName:a,mimeType:u}=s,c;try{let m=await this.helpers.getBinaryStream(l);c=await this.helpers.binaryToBuffer(m);}catch(m){throw new n8nWorkflow.NodeOperationError(this.getNode(),`Failed to load stashed binary (id=${l}) from external storage.`,{description:`The stash entry under "${t}" points at binary id "${l}", but the underlying data could not be loaded. This usually means the binary has been garbage-collected (n8n's execution data retention may be too short) or external storage is unavailable. Underlying error: ${m.message}`,itemIndex:e})}let f=u||at,h=await this.helpers.prepareBinaryData(c,a,f);o&&delete i[t];let p=this.getNodeParameter("outputPathTemplate",e,""),_;if(p.trim()!==""){let m=a.replace(/\.docx$/i,""),g=a.match(/\.docx$/i)?.[0]??".docx",v=new Date().toISOString().replace(/[:.]/g,"-").replace(/Z$/,"");_=p.replaceAll("{baseName}",m).replaceAll("{timestamp}",v).replaceAll("{fileName}",a).replaceAll("{ext}",g);}return [{json:{hydrated:true,fileName:a,sourceBinaryId:l,mimeType:f,..._!==void 0?{outputPath:_}:{}},binary:{[n]:h},pairedItem:{item:e}}]}d(ti,"executeHydrateToolOutput");var li=ar(ri());var Us=(0, li.createRequire)("/"),vt,qs,js;try{vt=Us("worker_threads"),qs=vt.Worker,js=vt.isMarkedAsUntransferable;}catch{}var ie=Uint8Array,Ne=Uint16Array,vr=Int32Array,kn=new ie([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,0,0,0]),Sn=new ie([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,0,0]),hr=new ie([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),ci=d(function(e,t){for(var n=new Ne(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];for(var o=new vr(n[30]),r=1;r<30;++r)for(var i=n[r];i<n[r+1];++i)o[i]=i-n[r]<<5|r;return {b:n,r:o}},"freb"),vt=ci(kn,2),fi=vt.b,pr=vt.r;fi[28]=258,pr[258]=28;var di=ci(Sn,0),zs=di.b,ii=di.r,mr=new Ne(32768);for(J=0;J<32768;++J)je=(J&43690)>>1|(J&21845)<<1,je=(je&52428)>>2|(je&13107)<<2,je=(je&61680)>>4|(je&3855)<<4,mr[J]=((je&65280)>>8|(je&255)<<8)>>1;var je,J,Fe=d((function(e,t,n){for(var r=e.length,o=0,i=new Ne(t);o<r;++o)e[o]&&++i[e[o]-1];var s=new Ne(t);for(o=1;o<t;++o)s[o]=s[o-1]+i[o-1]<<1;var l;if(n){l=new Ne(1<<t);var a=15-t;for(o=0;o<r;++o)if(e[o])for(var u=o<<4|e[o],c=t-e[o],f=s[e[o]-1]++<<c,h=f|(1<<c)-1;f<=h;++f)l[mr[f]>>a]=u;}else for(l=new Ne(r),o=0;o<r;++o)e[o]&&(l[o]=mr[s[e[o]-1]++]>>15-e[o]);return l}),"hMap"),Xe=new ie(288);for(J=0;J<144;++J)Xe[J]=8;var J;for(J=144;J<256;++J)Xe[J]=9;var J;for(J=256;J<280;++J)Xe[J]=7;var J;for(J=280;J<288;++J)Xe[J]=8;var J,Jt=new ie(32);for(J=0;J<32;++J)Jt[J]=5;var J,Ws=Fe(Xe,9,0),Hs=Fe(Xe,9,1),Vs=Fe(Jt,5,0),Gs=Fe(Jt,5,1),lr=d(function(e){for(var t=e[0],n=1;n<e.length;++n)e[n]>t&&(t=e[n]);return t},"max"),Me=d(function(e,t,n){var r=t/8|0;return (e[r]|e[r+1]<<8)>>(t&7)&n},"bits"),cr=d(function(e,t){var n=t/8|0;return (e[n]|e[n+1]<<8|e[n+2]<<16)>>(t&7)},"bits16"),yr=d(function(e){return (e+7)/8|0},"shft"),Zt=d(function(e,t,n){return (t==null||t<0)&&(t=0),(n==null||n>e.length)&&(n=e.length),new ie(e.subarray(t,n))},"slc");var Ys=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],pe=d(function(e,t,n){var r=new Error(t||Ys[e]);if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,pe),!n)throw r;return r},"err"),Xs=d(function(e,t,n,r){var o=e.length,i=r?r.length:0;if(!o||t.f&&!t.l)return n||new ie(0);var s=!n,l=s||t.i!=2,a=t.i;s&&(n=new ie(o*3));var u=d(function(Gt){var Yt=n.length;if(Gt>Yt){var wt=new ie(Math.max(Yt*2,Gt));wt.set(n),n=wt;}},"cbuf"),c=t.f||0,f=t.p||0,h=t.b||0,p=t.l,_=t.d,m=t.m,g=t.n,v=o*8;do{if(!p){c=Me(e,f,1);var E=Me(e,f+1,3);if(f+=3,E)if(E==1)p=Hs,_=Gs,m=9,g=5;else if(E==2){var D=Me(e,f,31)+257,A=Me(e,f+10,15)+4,x=D+Me(e,f+5,31)+1;f+=14;for(var N=new ie(x),T=new ie(19),k=0;k<A;++k)T[hr[k]]=Me(e,f+k*3,7);f+=A*3;for(var P=lr(T),O=(1<<P)-1,C=Fe(T,P,1),k=0;k<x;){var M=C[Me(e,f,O)];f+=M&15;var y=M>>4;if(y<16)N[k++]=y;else {var B=0,$=0;for(y==16?($=3+Me(e,f,3),f+=2,B=N[k-1]):y==17?($=3+Me(e,f,7),f+=3):y==18&&($=11+Me(e,f,127),f+=7);$--;)N[k++]=B;}}var U=N.subarray(0,D),R=N.subarray(D);m=lr(U),g=lr(R),p=Fe(U,m,1),_=Fe(R,g,1);}else pe(1);else {var y=yr(f)+4,w=e[y-4]|e[y-3]<<8,b=y+w;if(b>o){a&&pe(0);break}l&&u(h+w),n.set(e.subarray(y,b),h),t.b=h+=w,t.p=f=b*8,t.f=c;continue}if(f>v){a&&pe(0);break}}l&&u(h+131072);for(var H=(1<<m)-1,Z=(1<<g)-1,Q=f;;Q=f){var B=p[cr(e,f)&H],V=B>>4;if(f+=B&15,f>v){a&&pe(0);break}if(B||pe(2),V<256)n[h++]=V;else if(V==256){Q=f,p=null;break}else {var le=V-254;if(V>264){var k=V-257,te=kn[k];le=Me(e,f,(1<<te)-1)+fi[k],f+=te;}var Ae=_[cr(e,f)&Z],_t=Ae>>4;Ae||pe(3),f+=Ae&15;var R=zs[_t];if(_t>3){var te=Sn[_t];R+=cr(e,f)&(1<<te)-1,f+=te;}if(f>v){a&&pe(0);break}l&&u(h+131072);var gt=h+le;if(h<R){var Nn=i-R,xn=Math.min(R,gt);for(Nn+h<0&&pe(3);h<xn;++h)n[h]=r[Nn+h];}for(;h<gt;++h)n[h]=n[h-R];}}t.l=p,t.p=Q,t.b=h,t.f=c,p&&(c=1,t.m=m,t.d=_,t.n=g);}while(!c);return h!=n.length&&s?Zt(n,0,h):n.subarray(0,h)},"inflt"),ze=d(function(e,t,n){n<<=t&7;var r=t/8|0;e[r]|=n,e[r+1]|=n>>8;},"wbits"),Xt=d(function(e,t,n){n<<=t&7;var r=t/8|0;e[r]|=n,e[r+1]|=n>>8,e[r+2]|=n>>16;},"wbits16"),fr=d(function(e,t){for(var n=[],r=0;r<e.length;++r)e[r]&&n.push({s:r,f:e[r]});var o=n.length,i=n.slice();if(!o)return {t:pi,l:0};if(o==1){var s=new ie(n[0].s+1);return s[n[0].s]=1,{t:s,l:1}}n.sort(function(b,D){return b.f-D.f}),n.push({s:-1,f:25001});var l=n[0],a=n[1],u=0,c=1,f=2;for(n[0]={s:-1,f:l.f+a.f,l,r:a};c!=o-1;)l=n[n[u].f<n[f].f?u++:f++],a=n[u!=c&&n[u].f<n[f].f?u++:f++],n[c++]={s:-1,f:l.f+a.f,l,r:a};for(var h=i[0].s,r=1;r<o;++r)i[r].s>h&&(h=i[r].s);var p=new Ne(h+1),_=_r(n[c-1],p,0);if(_>t){var r=0,m=0,g=_-t,v=1<<g;for(i.sort(function(D,A){return p[A.s]-p[D.s]||D.f-A.f});r<o;++r){var E=i[r].s;if(p[E]>t)m+=v-(1<<_-p[E]),p[E]=t;else break}for(m>>=g;m>0;){var y=i[r].s;p[y]<t?m-=1<<t-p[y]++-1:++r;}for(;r>=0&&m;--r){var w=i[r].s;p[w]==t&&(--p[w],++m);}_=t;}return {t:new ie(p),l:_}},"hTree"),_r=d(function(e,t,n){return e.s==-1?Math.max(_r(e.l,t,n+1),_r(e.r,t,n+1)):t[e.s]=n},"ln"),oi=d(function(e){for(var t=e.length;t&&!e[--t];);for(var n=new Ne(++t),r=0,o=e[0],i=1,s=d(function(a){n[r++]=a;},"w"),l=1;l<=t;++l)if(e[l]==o&&l!=t)++i;else {if(!o&&i>2){for(;i>138;i-=138)s(32754);i>2&&(s(i>10?i-11<<5|28690:i-3<<5|12305),i=0);}else if(i>3){for(s(o),--i;i>6;i-=6)s(8304);i>2&&(s(i-3<<5|8208),i=0);}for(;i--;)s(o);i=1,o=e[l];}return {c:n.subarray(0,r),n:t}},"lc"),Qt=d(function(e,t){for(var n=0,r=0;r<t.length;++r)n+=e[r]*t[r];return n},"clen"),hi=d(function(e,t,n){var r=n.length,o=yr(t+2);e[o]=r&255,e[o+1]=r>>8,e[o+2]=e[o]^255,e[o+3]=e[o+1]^255;for(var i=0;i<r;++i)e[o+i+4]=n[i];return (o+4+r)*8},"wfblk"),si=d(function(e,t,n,r,o,i,s,l,a,u,c){ze(t,c++,n),++o[256];for(var f=fr(o,15),h=f.t,p=f.l,_=fr(i,15),m=_.t,g=_.l,v=oi(h),E=v.c,y=v.n,w=oi(m),b=w.c,D=w.n,A=new Ne(19),x=0;x<E.length;++x)++A[E[x]&31];for(var x=0;x<b.length;++x)++A[b[x]&31];for(var N=fr(A,7),T=N.t,k=N.l,P=19;P>4&&!T[hr[P-1]];--P);var O=u+5<<3,C=Qt(o,Xe)+Qt(i,Jt)+s,M=Qt(o,h)+Qt(i,m)+s+14+3*P+Qt(A,T)+2*A[16]+3*A[17]+7*A[18];if(a>=0&&O<=C&&O<=M)return hi(t,c,e.subarray(a,a+u));var B,$,U,R;if(ze(t,c,1+(M<C)),c+=2,M<C){B=Fe(h,p,0),$=h,U=Fe(m,g,0),R=m;var H=Fe(T,k,0);ze(t,c,y-257),ze(t,c+5,D-1),ze(t,c+10,P-4),c+=14;for(var x=0;x<P;++x)ze(t,c+3*x,T[hr[x]]);c+=3*P;for(var Z=[E,b],Q=0;Q<2;++Q)for(var V=Z[Q],x=0;x<V.length;++x){var le=V[x]&31;ze(t,c,H[le]),c+=T[le],le>15&&(ze(t,c,V[x]>>5&127),c+=V[x]>>12);}}else B=Ws,$=Xe,U=Vs,R=Jt;for(var x=0;x<l;++x){var te=r[x];if(te>255){var le=te>>18&31;Xt(t,c,B[le+257]),c+=$[le+257],le>7&&(ze(t,c,te>>23&31),c+=kn[le]);var Ae=te&31;Xt(t,c,U[Ae]),c+=R[Ae],Ae>3&&(Xt(t,c,te>>5&8191),c+=Sn[Ae]);}else Xt(t,c,B[te]),c+=$[te];}return Xt(t,c,B[256]),c+$[256]},"wblk"),Qs=new vr([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),pi=new ie(0),Js=d(function(e,t,n,r,o,i){var s=i.z||e.length,l=new ie(r+s+5*(1+Math.ceil(s/7e3))+o),a=l.subarray(r,l.length-o),u=i.l,c=(i.r||0)&7;if(t){c&&(a[0]=i.r>>3);for(var f=Qs[t-1],h=f>>13,p=f&8191,_=(1<<n)-1,m=i.p||new Ne(32768),g=i.h||new Ne(_+1),v=Math.ceil(n/3),E=2*v,y=d(function(or){return (e[or]^e[or+1]<<v^e[or+2]<<E)&_},"hsh"),w=new vr(25e3),b=new Ne(288),D=new Ne(32),A=0,x=0,N=i.i||0,T=0,k=i.w||0,P=0;N+2<s;++N){var O=y(N),C=N&32767,M=g[O];if(m[C]=M,g[O]=C,k<=N){var B=s-N;if((A>7e3||T>24576)&&(B>423||!u)){c=si(e,a,0,w,b,D,x,T,P,N-P,c),T=A=x=0,P=N;for(var $=0;$<286;++$)b[$]=0;for(var $=0;$<30;++$)D[$]=0;}var U=2,R=0,H=p,Z=C-M&32767;if(B>2&&O==y(N-Z))for(var Q=Math.min(h,B)-1,V=Math.min(32767,N),le=Math.min(258,B);Z<=V&&--H&&C!=M;){if(e[N+U]==e[N+U-Z]){for(var te=0;te<le&&e[N+te]==e[N+te-Z];++te);if(te>U){if(U=te,R=Z,te>Q)break;for(var Ae=Math.min(Z,te-2),_t=0,$=0;$<Ae;++$){var gt=N-Z+$&32767,Nn=m[gt],xn=gt-Nn&32767;xn>_t&&(_t=xn,M=gt);}}}C=M,M=m[C],Z+=C-M&32767;}if(R){w[T++]=268435456|pr[U]<<18|ii[R];var Gt=pr[U]&31,Yt=ii[R]&31;x+=kn[Gt]+Sn[Yt],++b[257+Gt],++D[Yt],k=N+U,++A;}else w[T++]=e[N],++b[e[N]];}}for(N=Math.max(N,k);N<s;++N)w[T++]=e[N],++b[e[N]];c=si(e,a,u,w,b,D,x,T,P,N-P,c),u||(i.r=c&7|a[c/8|0]<<3,c-=7,i.h=g,i.p=m,i.i=N,i.w=k);}else {for(var N=i.w||0;N<s+u;N+=65535){var wt=N+65535;wt>=s&&(a[c/8|0]=u,wt=s),c=hi(a,c+1,e.subarray(N,wt));}i.i=s;}return Zt(l,0,r+yr(c)+o)},"dflt"),Zs=(function(){for(var e=new Int32Array(256),t=0;t<256;++t){for(var n=t,r=9;--r;)n=(n&1&&-306674912)^n>>>1;e[t]=n;}return e})(),Ks=d(function(){var e=-1;return {p:d(function(t){for(var n=e,r=0;r<t.length;++r)n=Zs[n&255^t[r]]^n>>>8;e=n;},"p"),d:d(function(){return ~e},"d")}},"crc");var ea=d(function(e,t,n,r,o){if(!o&&(o={l:1},t.dictionary)){var i=t.dictionary.subarray(-32768),s=new ie(i.length+e.length);s.set(i),s.set(e,i.length),e=s,o.w=i.length;}return Js(e,t.level==null?6:t.level,t.mem==null?o.l?Math.ceil(Math.max(8,Math.min(13,Math.log(e.length)))*1.5):20:12+t.mem,n,r,o)},"dopt"),mi=d(function(e,t){var n={};for(var r in e)n[r]=e[r];for(var r in t)n[r]=t[r];return n},"mrg");var Be=d(function(e,t){return e[t]|e[t+1]<<8},"b2"),Ce=d(function(e,t){return (e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0},"b4"),dr=d(function(e,t){return Ce(e,t)+Ce(e,t+4)*4294967296},"b8"),ce=d(function(e,t,n){for(;n;++t)e[t]=n,n>>>=8;},"wbytes");function ta(e,t){return ea(e,t||{},0,0)}d(ta,"deflateSync");function na(e,t){return Xs(e,{i:2},t&&t.out,t&&t.dictionary)}d(na,"inflateSync");var _i=d(function(e,t,n,r){for(var o in e){var i=e[o],s=t+o,l=r;Array.isArray(i)&&(l=mi(r,i[1]),i=i[0]),ArrayBuffer.isView(i)?n[s]=[i,l]:(n[s+="/"]=[new ie(0),l],_i(i,s,n,r));}},"fltn"),ai=typeof TextEncoder<"u"&&new TextEncoder,gr=typeof TextDecoder<"u"&&new TextDecoder,ra=0;try{gr.decode(pi,{stream:!0}),ra=1;}catch{}var ia=d(function(e){for(var t="",n=0;;){var r=e[n++],o=(r>127)+(r>223)+(r>239);if(n+o>e.length)return {s:t,r:Zt(e,n-1)};o?o==3?(r=((r&15)<<18|(e[n++]&63)<<12|(e[n++]&63)<<6|e[n++]&63)-65536,t+=String.fromCharCode(55296|r>>10,56320|r&1023)):o&1?t+=String.fromCharCode((r&31)<<6|e[n++]&63):t+=String.fromCharCode((r&15)<<12|(e[n++]&63)<<6|e[n++]&63):t+=String.fromCharCode(r);}},"dutf8");function Tn(e,t){if(t){for(var n=new ie(e.length),r=0;r<e.length;++r)n[r]=e.charCodeAt(r);return n}if(ai)return ai.encode(e);for(var o=e.length,i=new ie(e.length+(e.length>>1)),s=0,l=d(function(c){i[s++]=c;},"w"),r=0;r<o;++r){if(s+5>i.length){var a=new ie(s+8+(o-r<<1));a.set(i),i=a;}var u=e.charCodeAt(r);u<128||t?l(u):u<2048?(l(192|u>>6),l(128|u&63)):u>55295&&u<57344?(u=65536+(u&1047552)|e.charCodeAt(++r)&1023,l(240|u>>18),l(128|u>>12&63),l(128|u>>6&63),l(128|u&63)):(l(224|u>>12),l(128|u>>6&63),l(128|u&63));}return Zt(i,0,s)}d(Tn,"strToU8");function yt(e,t){if(t){for(var n="",r=0;r<e.length;r+=16384)n+=String.fromCharCode.apply(null,e.subarray(r,r+16384));return n}else {if(gr)return gr.decode(e);var o=ia(e),i=o.s,n=o.r;return n.length&&pe(8),i}}d(yt,"strFromU8");var oa=d(function(e,t){return t+30+Be(e,t+26)+Be(e,t+28)},"slzh"),sa=d(function(e,t,n){var r=Be(e,t+28),o=Be(e,t+30),i=yt(e.subarray(t+46,t+46+r),!(Be(e,t+8)&2048)),s=t+46+r,l=aa(e,s,o,n,Ce(e,t+20),Ce(e,t+24),Ce(e,t+42)),a=l[0],u=l[1],c=l[2];return [Be(e,t+10),a,u,i,s+o+Be(e,t+32),c]},"zh"),aa=d(function(e,t,n,r,o,i,s){var l=o==4294967295,a=i==4294967295,u=s==4294967295,c=t+n,f=l+a+u;if(r&&f){for(;t+4<c;t+=4+Be(e,t+2))if(Be(e,t)==1)return [l?dr(e,t+4+8*a):o,a?dr(e,t+4):i,u?dr(e,t+4+8*(a+l)):s,1];r<2&&pe(13);}return [o,i,s,0]},"z64hs"),wr=d(function(e){var t=0;if(e)for(var n in e){var r=e[n].length;r>65535&&pe(9),t+=r+4;}return t},"exfl"),ui=d(function(e,t,n,r,o,i,s,l){var a=r.length,u=n.extra,c=l&&l.length,f=wr(u);ce(e,t,s!=null?33639248:67324752),t+=4,s!=null&&(e[t++]=20,e[t++]=n.os),e[t]=20,t+=2,e[t++]=n.flag<<1|(i<0&&8),e[t++]=o&&8,e[t++]=n.compression&255,e[t++]=n.compression>>8;var h=new Date(n.mtime==null?Date.now():n.mtime),p=h.getFullYear()-1980;if((p<0||p>119)&&pe(10),ce(e,t,p<<25|h.getMonth()+1<<21|h.getDate()<<16|h.getHours()<<11|h.getMinutes()<<5|h.getSeconds()>>1),t+=4,i!=-1&&(ce(e,t,n.crc),ce(e,t+4,i<0?-i-2:i),ce(e,t+8,n.size)),ce(e,t+12,a),ce(e,t+14,f),t+=16,s!=null&&(ce(e,t,c),ce(e,t+6,n.attrs),ce(e,t+10,s),t+=14),e.set(r,t),t+=a,f)for(var _ in u){var m=u[_],g=m.length;ce(e,t,+_),ce(e,t+2,g),e.set(m,t+4),t+=4+g;}return c&&(e.set(l,t),t+=c),t},"wzh"),ua=d(function(e,t,n,r,o){ce(e,t,101010256),ce(e,t+8,n),ce(e,t+10,n),ce(e,t+12,r),ce(e,t+16,o);},"wzf");function gi(e,t){t||(t={});var n={},r=[];_i(e,"",n,t);var o=0,i=0;for(var s in n){var l=n[s],a=l[0],u=l[1],c=u.level==0?0:8,f=Tn(s),h=f.length,p=u.comment,_=p&&Tn(p),m=_&&_.length,g=wr(u.extra);h>65535&&pe(11);var v=c?ta(a,u):a,E=v.length,y=Ks();y.p(a),r.push(mi(u,{size:a.length,crc:y.d(),c:v,f,m:_,u:h!=s.length||_&&p.length!=m,o,compression:c})),o+=30+h+g+E,i+=76+2*(h+g)+(m||0)+E;}for(var w=new ie(i+22),b=o,D=i-o,A=0;A<r.length;++A){var f=r[A];ui(w,f.o,f,f.f,f.u,f.c.length);var x=30+f.f.length+wr(f.extra);w.set(f.c,f.o+x),ui(w,o,f,f.f,f.u,f.c.length,f.o,f.m),o+=16+x+(f.m?f.m.length:0);}return ua(w,o,r.length,D,b),w}d(gi,"zipSync");function In(e,t){for(var n={},r=e.length-22;Ce(e,r)!=101010256;--r)(!r||e.length-r>65558)&&pe(13);var o=Be(e,r+8);if(!o)return {};var i=Ce(e,r+16),s=Ce(e,r-20)==117853008;if(s){var l=Ce(e,r-12);s=Ce(e,l)==101075792,s&&(o=Ce(e,l+32),i=Ce(e,l+48));}for(var a=t&&t.filter,u=0;u<o;++u){var c=sa(e,i,s),f=c[0],h=c[1],p=c[2],_=c[3],m=c[4],g=c[5],v=oa(e,g);i=m,(!a||a({name:_,size:h,originalSize:p,compression:f}))&&(f?f==8?n[_]=na(e.subarray(v,v+h),{out:new ie(p)}):pe(14,"unknown compression type "+f):n[_]=Zt(e,v,v+h));}return n}d(In,"unzipSync");var tr=ar(Co()),rs=ar(To());function F(e,t){for(let n=0;n<e.childNodes.length;n++){let r=e.childNodes[n];if(r.nodeType===1&&r.tagName===t)return r}return null}d(F,"findChild");function Ku(e,t){let n=[];for(let r=0;r<e.childNodes.length;r++){let o=e.childNodes[r];o.nodeType===1&&o.tagName===t&&n.push(o);}return n}d(Ku,"findChildren");function I(e,t){return Array.from(e.getElementsByTagName(t))}d(I,"findAllDescendants");function Kn(e){return e.startsWith("\uFEFF")&&(e=e.slice(1)),new tr.DOMParser().parseFromString(e,"text/xml")}d(Kn,"parseXml");function ko(e){let t=new tr.XMLSerializer().serializeToString(e),r=/<([a-zA-Z0-9_:]+)(\s+[^>]+?)(>|\/>)/.exec(t);if(r&&!r[1].startsWith("?")){let o=r.index,i=t.substring(0,o);if(!i.includes("<")||i.trim().startsWith("<?xml")&&(i.match(/</g)||[]).length===1){let l=r[0],a=`<${r[1]}`,u=r[2],c=r[3],f=/([a-zA-Z0-9_:]+)\s*=\s*(["'])(.*?)\2/g,h=[],p;for(;(p=f.exec(u))!==null;)h.push(p[0].trim());h.sort((m,g)=>{let v=m.split("=")[0].trim(),E=g.split("=")[0].trim(),y=v.startsWith("xmlns"),w=E.startsWith("xmlns");return y&&!w?-1:!y&&w?1:v<E?-1:v>E?1:0});let _=h.length>0?`${a} ${h.join(" ")}${c}`:`${a}${c}`;t=t.substring(0,o)+_+t.substring(o+l.length);}}return t}d(ko,"serializeXml");var Jn=class{static{d(this,"Relationship");}constructor(e,t,n,r){this.id=e,this.type=t,this.target=n,this.isExternal=r;}id;type;target;isExternal},jo=class{static{d(this,"Part");}constructor(e,t,n,r){this.partname=e,this.blob=t,this.contentType=r,this._element=n;}partname;blob;contentType;rels=new Map;_element;package;addRelationship(e,t,n,r=false){if(this.rels.set(e,new Jn(e,t,n,r)),this.partname.endsWith(".rels")){let o=this._element.ownerDocument;if(o){let i=o.createElementNS("http://schemas.openxmlformats.org/package/2006/relationships","Relationship");i.setAttribute("Id",e),i.setAttribute("Type",t),i.setAttribute("Target",n),r&&i.setAttribute("TargetMode","External"),this._element.appendChild(i);}}}},el=class{static{d(this,"DocxPackage");}constructor(e){this.unzipped=e;}unzipped;parts=[];mainDocumentPart;getPartByPath(e){let t=e.startsWith("/")?e.substring(1):e;return this.parts.find(n=>n.partname===t||n.partname==="/"+t)}nextPartname(e){let t=1;for(;;){let n=e.replace("%d",t===1?"":t.toString());if(!this.getPartByPath(n))return n;t++;}}addPart(e,t,n){let r=Kn(n),o=new jo(e,n,r.documentElement,t);o.package=this,this.parts.push(o);let i=this.getPartByPath("[Content_Types].xml");if(i){let s=i._element.ownerDocument;if(s){let l=s.createElement("Override");l.setAttribute("PartName",e),l.setAttribute("ContentType",t),i._element.appendChild(l);}}return o}getOrCreateRelsPart(e){let t=e.split("/"),n=t.pop(),r=t.join("/")+"/_rels/"+n+".rels",o=this.getPartByPath(r);return o||(o=this.addPart(r,"application/vnd.openxmlformats-package.relationships+xml",`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
15
|
-
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"></Relationships>`)),
|
|
16
|
-
`+n),this.pkg.unzipped[t.partname.substring(1)]=Tn(n);}return Buffer.from(gi(this.pkg.unzipped))}},ve=class{static{d(this,"Paragraph");}constructor(e,t){this._element=e,this._parent=t;}_element;_parent;get text(){let e="",t=this._element.getElementsByTagName("w:t");for(let n=0;n<t.length;n++)e+=t[n].textContent||"";return e}},rt=class{static{d(this,"Run");}constructor(e,t){this._element=e,this._parent=t;}_element;_parent},tl=class{static{d(this,"Cell");}constructor(e,t){this._element=e,this._parent=t;}_element;_parent},nl=class{static{d(this,"Row");}constructor(e,t){this._element=e,this._parent=t;let n=this._element.getElementsByTagName("w:tc");for(let r=0;r<n.length;r++)this.cells.push(new tl(n[r],this));}_element;_parent;cells=[]},it=class{static{d(this,"Table");}constructor(e,t){this._element=e,this._parent=t;let n=this._element.getElementsByTagName("w:tr");for(let r=0;r<n.length;r++)this.rows.push(new nl(n[r],this));}_element;_parent;rows=[]},So=class{static{d(this,"NotesPart");}constructor(e,t){this.part=e,this.note_type=t,this._element=e._element;}part;note_type;_element},rl=class{static{d(this,"FootnoteItem");}constructor(e,t,n){this._element=e,this._parent=t,this.note_type=n,this.id=e.getAttribute("w:id")||"",this.part=t.part;}_element;_parent;note_type;id;part},ge={w:"http://schemas.openxmlformats.org/wordprocessingml/2006/main",w14:"http://schemas.microsoft.com/office/word/2010/wordml",w15:"http://schemas.microsoft.com/office/word/2012/wordml",w16cid:"http://schemas.microsoft.com/office/word/2016/wordml/cid",w16cex:"http://schemas.microsoft.com/office/word/2018/wordml/cex",mc:"http://schemas.openxmlformats.org/markup-compatibility/2006"},xe={COMMENTS:"application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml",EXTENDED:"application/vnd.openxmlformats-officedocument.wordprocessingml.commentsExtended+xml",IDS:"application/vnd.openxmlformats-officedocument.wordprocessingml.commentsIds+xml",EXTENSIBLE:"application/vnd.openxmlformats-officedocument.wordprocessingml.commentsExtensible+xml"},tt={COMMENTS:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments",EXTENDED:"http://schemas.microsoft.com/office/2011/relationships/commentsExtended",IDS:"http://schemas.microsoft.com/office/2016/09/relationships/commentsIds",EXTENSIBLE:"http://schemas.microsoft.com/office/2018/08/relationships/commentsExtensible"},jt=class{static{d(this,"CommentsManager");}constructor(e){this.doc=e;}doc;_commentsPart=null;_extendedPart=null;_idsPart=null;_extensiblePart=null;_nextId=null;get commentsPart(){return this._commentsPart||(this._commentsPart=this._getOrCreateCommentsPart(),this._ensureNamespaces()),this._commentsPart}get extendedPart(){return this._extendedPart||(this._extendedPart=this._getOrCreateExtendedPart()),this._extendedPart}get idsPart(){return this._idsPart||(this._idsPart=this._getOrCreateIdsPart()),this._idsPart}get extensiblePart(){return this._extensiblePart||(this._extensiblePart=this._getOrCreateExtensiblePart()),this._extensiblePart}get nextId(){return this._nextId===null&&(this._nextId=this._getNextCommentId()),this._nextId}set nextId(e){this._nextId=e;}_getExistingPartByType(e){return this.doc.pkg.parts.find(t=>t.contentType===e)||null}_linkPart(e,t){for(let n of this.doc.part.rels.values())if(!n.isExternal&&n.target===e.partname.split("/").pop())return e;return this.doc.relateTo(e,t),e}_getOrCreateCommentsPart(){let e=this._getExistingPartByType(xe.COMMENTS);if(e)return this._linkPart(e,tt.COMMENTS);let t=this.doc.pkg.nextPartname("/word/comments%d.xml"),n=`<w:comments xmlns:w="${ge.w}" xmlns:w14="${ge.w14}" xmlns:w15="${ge.w15}" xmlns:w16cid="${ge.w16cid}" xmlns:w16cex="${ge.w16cex}" xmlns:mc="${ge.mc}" mc:Ignorable="w14 w15 w16cid w16cex"></w:comments>`;return e=this.doc.pkg.addPart(t,xe.COMMENTS,n),this.doc.relateTo(e,tt.COMMENTS),e}_getOrCreateExtendedPart(){let e=this._getExistingPartByType(xe.EXTENDED);if(e)return this._linkPart(e,tt.EXTENDED);let t=this.doc.pkg.nextPartname("/word/commentsExtended%d.xml"),n=`<w15:commentsEx xmlns:w15="${ge.w15}"></w15:commentsEx>`;return e=this.doc.pkg.addPart(t,xe.EXTENDED,n),this.doc.relateTo(e,tt.EXTENDED),e}_getOrCreateIdsPart(){let e=this._getExistingPartByType(xe.IDS);if(e)return this._linkPart(e,tt.IDS);let t=this.doc.pkg.nextPartname("/word/commentsIds%d.xml"),n=`<w16cid:commentsIds xmlns:w16cid="${ge.w16cid}"></w16cid:commentsIds>`;return e=this.doc.pkg.addPart(t,xe.IDS,n),this.doc.relateTo(e,tt.IDS),e}_getOrCreateExtensiblePart(){let e=this._getExistingPartByType(xe.EXTENSIBLE);if(e)return this._linkPart(e,tt.EXTENSIBLE);let t=this.doc.pkg.nextPartname("/word/commentsExtensible%d.xml"),n=`<w16cex:commentsExtensible xmlns:w16cex="${ge.w16cex}"></w16cex:commentsExtensible>`;return e=this.doc.pkg.addPart(t,xe.EXTENSIBLE,n),this.doc.relateTo(e,tt.EXTENSIBLE),e}_ensureNamespaces(){let e=this._commentsPart?._element;if(!e)return;let t=[["xmlns:w",ge.w],["xmlns:w14",ge.w14],["xmlns:w15",ge.w15],["xmlns:w16cid",ge.w16cid],["xmlns:w16cex",ge.w16cex],["xmlns:mc",ge.mc]];for(let[n,r]of t)e.getAttribute(n)||e.setAttribute(n,r);}_getNextCommentId(){let e=[0],t=this._getExistingPartByType(xe.COMMENTS);if(t){let n=I(t._element,"w:comment");for(let r of n){let o=r.getAttribute("w:id");o&&e.push(parseInt(o,10)||0);}}return Math.max(...e)+1}_generateHexId(){return Math.floor(Math.random()*4294967295).toString(16).toUpperCase().padStart(8,"0")}_getInitials(e){return e?e.split(" ").filter(Boolean).map(t=>t[0]).join("").toUpperCase():""}_findParaIdForComment(e){if(!this._commentsPart)return null;for(let t of I(this._commentsPart._element,"w:comment"))if(t.getAttribute("w:id")===e)for(let n of I(t,"w:p")){let r=n.getAttribute("w14:paraId");if(r)return r}return null}_findThreadRootParaId(e){let t=this._findParaIdForComment(e),n=this._getExistingPartByType(xe.EXTENDED);if(!t||!n)return t;for(let r=0;r<n._element.childNodes.length;r++){let o=n._element.childNodes[r];if(o.nodeType===1&&o.getAttribute("w15:paraId")===t){let i=o.getAttribute("w15:paraIdParent");if(i)return i}}return t}addComment(e,t,n=null){let r=this.nextId.toString();this.nextId++;let o=new Date().toISOString().replace(/\.\d{3}Z$/,"Z"),i=this.commentsPart._element.ownerDocument,s=i.createElement("w:comment");s.setAttribute("w:id",r),s.setAttribute("w:author",e),s.setAttribute("w:date",o);let l=this._getInitials(e);l&&s.setAttribute("w:initials",l);let a=this._getExistingPartByType(xe.EXTENDED);n&&!a&&s.setAttribute("w15:p",n);let u=this._generateHexId(),c=this._generateHexId(),f=i.createElement("w:p");f.setAttribute("w14:paraId",u),f.setAttribute("w14:textId","77777777"),f.setAttribute("w:rsidR",c),f.setAttribute("w:rsidRDefault",c),f.setAttribute("w:rsidP",c);let h=i.createElement("w:pPr"),p=i.createElement("w:pStyle");p.setAttribute("w:val","CommentText"),h.appendChild(p),f.appendChild(h);let _=i.createElement("w:r"),m=i.createElement("w:rPr"),g=i.createElement("w:rStyle");g.setAttribute("w:val","CommentReference"),m.appendChild(g),_.appendChild(m),_.appendChild(i.createElement("w:annotationRef")),f.appendChild(_);let v=i.createElement("w:r"),E=i.createElement("w:t");if(E.textContent=t,v.appendChild(E),f.appendChild(v),s.appendChild(f),this.commentsPart._element.appendChild(s),this.extendedPart){let y=n?this._findThreadRootParaId(n):null,b=this.extendedPart._element.ownerDocument.createElement("w15:commentEx");b.setAttribute("w15:paraId",u),y&&b.setAttribute("w15:paraIdParent",y),b.setAttribute("w15:done","0"),this.extendedPart._element.appendChild(b);}if(this.idsPart){let w=this.idsPart._element.ownerDocument.createElement("w16cid:commentId");w.setAttribute("w16cid:paraId",u),w.setAttribute("w16cid:durableId",this._generateHexId()),this.idsPart._element.appendChild(w);}if(this.extensiblePart){let y=null;for(let w=0;w<this.idsPart._element.childNodes.length;w++){let b=this.idsPart._element.childNodes[w];if(b.nodeType===1&&b.getAttribute("w16cid:paraId")===u){y=b.getAttribute("w16cid:durableId");break}}if(y){let b=this.extensiblePart._element.ownerDocument.createElement("w16cex:commentExtensible");b.setAttribute("w16cex:durableId",y),b.setAttribute("w16cex:dateUtc",o),this.extensiblePart._element.appendChild(b);}}return r}deleteComment(e){if(!this.commentsPart)return;let t=null;for(let r of I(this.commentsPart._element,"w:comment"))if(r.getAttribute("w:id")===e){t=r;break}if(!t)return;let n=null;for(let r of I(t,"w:p")){let o=r.getAttribute("w14:paraId");if(o){n=o;break}}if(n){let r=[];if(this.extendedPart)for(let i=0;i<this.extendedPart._element.childNodes.length;i++){let s=this.extendedPart._element.childNodes[i];if(s.nodeType===1&&s.getAttribute("w15:paraIdParent")===n){let l=s.getAttribute("w15:paraId");if(l){for(let a of I(this.commentsPart._element,"w:comment"))for(let u of I(a,"w:p"))if(u.getAttribute("w14:paraId")===l){let c=a.getAttribute("w:id");c&&r.push(c);break}}}}for(let i of r)this.deleteComment(i);let o=null;if(this.idsPart){let i=[];for(let s=0;s<this.idsPart._element.childNodes.length;s++){let l=this.idsPart._element.childNodes[s];l.nodeType===1&&l.getAttribute("w16cid:paraId")===n&&(o=l.getAttribute("w16cid:durableId"),i.push(l));}i.forEach(s=>this.idsPart._element.removeChild(s));}if(this.extendedPart){let i=[];for(let s=0;s<this.extendedPart._element.childNodes.length;s++){let l=this.extendedPart._element.childNodes[s];l.nodeType===1&&l.getAttribute("w15:paraId")===n&&i.push(l);}i.forEach(s=>this.extendedPart._element.removeChild(s));}if(o&&this.extensiblePart){let i=[];for(let s=0;s<this.extensiblePart._element.childNodes.length;s++){let l=this.extensiblePart._element.childNodes[s];l.nodeType===1&&l.getAttribute("w16cex:durableId")===o&&i.push(l);}i.forEach(s=>this.extensiblePart._element.removeChild(s));}}t.parentNode&&t.parentNode.removeChild(t);}};function bn(e){({part:e.mainDocumentPart,relateTo:d(()=>{},"relateTo")});let r={},o=e.parts.find(a=>a.contentType===xe.COMMENTS);if(!o)return r;let i={},s=I(o._element,"w:comment");for(let a of s){let u=a.getAttribute("w:id");if(!u)continue;let c=a.getAttribute("w:author")||"Unknown",f=a.getAttribute("w:date")||"",h=false,p=a.getAttribute("w15:done");(p==="1"||p==="true"||p==="on")&&(h=true);let _=a.getAttribute("w15:p")||null,m=I(a,"w:p");for(let E of m){let y=E.getAttribute("w14:paraId");y&&(i[y]=u);}let g=[];for(let E of m){let y=I(E,"w:t");for(let w of y)w.textContent&&g.push(w.textContent);g.push(`
|
|
17
|
-
`);}let v=g.join("").trim();r[
|
|
5
|
+
`)}d(Ds,"normalizeLineEndings");function As(e){if(e=e||{},e.locator===void 0&&(e.locator=true),this.assign=e.assign||dt.assign,this.domHandler=e.domHandler||Gn,this.onError=e.onError||e.errorHandler,e.errorHandler&&typeof e.errorHandler!="function")throw new TypeError("errorHandler object is no longer supported, switch to onError!");e.errorHandler&&e.errorHandler("warning","The `errorHandler` option has been deprecated, use `onError` instead!",this),this.normalizeLineEndings=e.normalizeLineEndings||Ds,this.locator=!!e.locator,this.xmlns=this.assign(Object.create(null),e.xmlns);}d(As,"DOMParser");As.prototype.parseFromString=function(e,t){if(!Qu(t))throw new TypeError('DOMParser.parseFromString: the provided mimeType "'+t+'" is not valid.');var n=this.assign(Object.create(null),this.xmlns),r=vs.XML_ENTITIES,s=n[""]||null;Yu(t)?(r=vs.HTML_ENTITIES,s=$r.HTML):t===bs.XML_SVG_IMAGE&&(s=$r.SVG),n[""]=s,n.xml=n.xml||$r.XML;var i=new this.domHandler({mimeType:t,defaultNamespace:s,onError:this.onError}),o=this.locator?{}:void 0;this.locator&&i.setDocumentLocator(o);var l=new Ju;l.errorHandler=i,l.domBuilder=i;var u=!dt.isHTMLMimeType(t);return u&&typeof e!="string"&&l.errorHandler.fatalError("source is not a string"),l.parse(this.normalizeLineEndings(String(e)),n,r),i.doc.documentElement||l.errorHandler.fatalError("missing root element"),i.doc};function Gn(e){var t=e||{};this.mimeType=t.mimeType||bs.XML_APPLICATION,this.defaultNamespace=t.defaultNamespace||null,this.cdata=false,this.currentElement=void 0,this.doc=void 0,this.locator=void 0,this.onError=t.onError;}d(Gn,"DOMHandler");function Bt(e,t){t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber;}d(Bt,"position");Gn.prototype={startDocument:d(function(){var e=new Gu;this.doc=Xu(this.mimeType)?e.createHTMLDocument(false):e.createDocument(this.defaultNamespace,"");},"startDocument"),startElement:d(function(e,t,n,r){var s=this.doc,i=s.createElementNS(e,n||t),o=r.length;Vn(this,i),this.currentElement=i,this.locator&&Bt(this.locator,i);for(var l=0;l<o;l++){var e=r.getURI(l),u=r.getValue(l),n=r.getQName(l),a=s.createAttributeNS(e,n);this.locator&&Bt(r.getLocator(l),a),a.value=a.nodeValue=u,i.setAttributeNode(a);}},"startElement"),endElement:d(function(e,t,n){this.currentElement=this.currentElement.parentNode;},"endElement"),startPrefixMapping:d(function(e,t){},"startPrefixMapping"),endPrefixMapping:d(function(e){},"endPrefixMapping"),processingInstruction:d(function(e,t){var n=this.doc.createProcessingInstruction(e,t);this.locator&&Bt(this.locator,n),Vn(this,n);},"processingInstruction"),ignorableWhitespace:d(function(e,t,n){},"ignorableWhitespace"),characters:d(function(e,t,n){if(e=Es.apply(this,arguments),e){if(this.cdata)var r=this.doc.createCDATASection(e);else var r=this.doc.createTextNode(e);this.currentElement?this.currentElement.appendChild(r):/^\s*$/.test(e)&&this.doc.appendChild(r),this.locator&&Bt(this.locator,r);}},"characters"),skippedEntity:d(function(e){},"skippedEntity"),endDocument:d(function(){this.doc.normalize();},"endDocument"),setDocumentLocator:d(function(e){e&&(e.lineNumber=0),this.locator=e;},"setDocumentLocator"),comment:d(function(e,t,n){e=Es.apply(this,arguments);var r=this.doc.createComment(e);this.locator&&Bt(this.locator,r),Vn(this,r);},"comment"),startCDATA:d(function(){this.cdata=true;},"startCDATA"),endCDATA:d(function(){this.cdata=false;},"endCDATA"),startDTD:d(function(e,t,n,r){var s=this.doc.implementation;if(s&&s.createDocumentType){var i=s.createDocumentType(e,t,n,r);this.locator&&Bt(this.locator,i),Vn(this,i),this.doc.doctype=i;}},"startDTD"),reportError:d(function(e,t){if(typeof this.onError=="function")try{this.onError(e,t,this);}catch(n){throw new ys("Reporting "+e+' "'+t+'" caused '+n,this.locator)}},"reportError"),warning:d(function(e){this.reportError("warning",e);},"warning"),error:d(function(e){this.reportError("error",e);},"error"),fatalError:d(function(e){throw this.reportError("fatalError",e),new ys(e,this.locator)},"fatalError")};function Es(e,t,n){return typeof e=="string"?e.substr(t,n):e.length>=t+n||t?new java.lang.String(e,t,n)+"":e}d(Es,"_toString");"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(e){Gn.prototype[e]=function(){return null};});function Vn(e,t){e.currentElement?e.currentElement.appendChild(t):e.doc.appendChild(t);}d(Vn,"appendElement");function Zu(e){if(e==="error")throw "onErrorStopParsing"}d(Zu,"onErrorStopParsing");function Ku(){throw "onWarningStopParsing"}d(Ku,"onWarningStopParsing");Ft.__DOMHandler=Gn;Ft.DOMParser=As;Ft.normalizeLineEndings=Ds;Ft.onErrorStopParsing=Zu;Ft.onWarningStopParsing=Ku;});var xs=Re(X=>{var Lt=ct();X.assign=Lt.assign;X.hasDefaultHTMLNamespace=Lt.hasDefaultHTMLNamespace;X.isHTMLMimeType=Lt.isHTMLMimeType;X.isValidMimeType=Lt.isValidMimeType;X.MIME_TYPE=Lt.MIME_TYPE;X.NAMESPACE=Lt.NAMESPACE;var Yn=on();X.DOMException=Yn.DOMException;X.DOMExceptionName=Yn.DOMExceptionName;X.ExceptionCode=Yn.ExceptionCode;X.ParseError=Yn.ParseError;var le=Fr();X.Attr=le.Attr;X.CDATASection=le.CDATASection;X.CharacterData=le.CharacterData;X.Comment=le.Comment;X.Document=le.Document;X.DocumentFragment=le.DocumentFragment;X.DocumentType=le.DocumentType;X.DOMImplementation=le.DOMImplementation;X.Element=le.Element;X.Entity=le.Entity;X.EntityReference=le.EntityReference;X.LiveNodeList=le.LiveNodeList;X.NamedNodeMap=le.NamedNodeMap;X.Node=le.Node;X.NodeList=le.NodeList;X.Notation=le.Notation;X.ProcessingInstruction=le.ProcessingInstruction;X.Text=le.Text;X.XMLSerializer=le.XMLSerializer;var Xn=Ns();X.DOMParser=Xn.DOMParser;X.normalizeLineEndings=Xn.normalizeLineEndings;X.onErrorStopParsing=Xn.onErrorStopParsing;X.onWarningStopParsing=Xn.onWarningStopParsing;});var Cs=Re((kf,$t)=>{var k=d(function(){this.Diff_Timeout=1,this.Diff_EditCost=4,this.Match_Threshold=.5,this.Match_Distance=1e3,this.Patch_DeleteThreshold=.5,this.Patch_Margin=4,this.Match_MaxBits=32;},"diff_match_patch"),ne=-1,re=1,H=0;k.Diff=function(e,t){return [e,t]};k.prototype.diff_main=function(e,t,n,r){typeof r>"u"&&(this.Diff_Timeout<=0?r=Number.MAX_VALUE:r=new Date().getTime()+this.Diff_Timeout*1e3);var s=r;if(e==null||t==null)throw new Error("Null input. (diff_main)");if(e==t)return e?[new k.Diff(H,e)]:[];typeof n>"u"&&(n=true);var i=n,o=this.diff_commonPrefix(e,t),l=e.substring(0,o);e=e.substring(o),t=t.substring(o),o=this.diff_commonSuffix(e,t);var u=e.substring(e.length-o);e=e.substring(0,e.length-o),t=t.substring(0,t.length-o);var a=this.diff_compute_(e,t,i,s);return l&&a.unshift(new k.Diff(H,l)),u&&a.push(new k.Diff(H,u)),this.diff_cleanupMerge(a),a};k.prototype.diff_compute_=function(e,t,n,r){var s;if(!e)return [new k.Diff(re,t)];if(!t)return [new k.Diff(ne,e)];var i=e.length>t.length?e:t,o=e.length>t.length?t:e,l=i.indexOf(o);if(l!=-1)return s=[new k.Diff(re,i.substring(0,l)),new k.Diff(H,o),new k.Diff(re,i.substring(l+o.length))],e.length>t.length&&(s[0][0]=s[2][0]=ne),s;if(o.length==1)return [new k.Diff(ne,e),new k.Diff(re,t)];var u=this.diff_halfMatch_(e,t);if(u){var a=u[0],c=u[1],f=u[2],h=u[3],p=u[4],_=this.diff_main(a,f,n,r),m=this.diff_main(c,h,n,r);return _.concat([new k.Diff(H,p)],m)}return n&&e.length>100&&t.length>100?this.diff_lineMode_(e,t,r):this.diff_bisect_(e,t,r)};k.prototype.diff_lineMode_=function(e,t,n){var r=this.diff_linesToChars_(e,t);e=r.chars1,t=r.chars2;var s=r.lineArray,i=this.diff_main(e,t,false,n);this.diff_charsToLines_(i,s),this.diff_cleanupSemantic(i),i.push(new k.Diff(H,""));for(var o=0,l=0,u=0,a="",c="";o<i.length;){switch(i[o][0]){case re:u++,c+=i[o][1];break;case ne:l++,a+=i[o][1];break;case H:if(l>=1&&u>=1){i.splice(o-l-u,l+u),o=o-l-u;for(var f=this.diff_main(a,c,false,n),h=f.length-1;h>=0;h--)i.splice(o,0,f[h]);o=o+f.length;}u=0,l=0,a="",c="";break}o++;}return i.pop(),i};k.prototype.diff_bisect_=function(e,t,n){for(var r=e.length,s=t.length,i=Math.ceil((r+s)/2),o=i,l=2*i,u=new Array(l),a=new Array(l),c=0;c<l;c++)u[c]=-1,a[c]=-1;u[o+1]=0,a[o+1]=0;for(var f=r-s,h=f%2!=0,p=0,_=0,m=0,g=0,v=0;v<i&&!(new Date().getTime()>n);v++){for(var D=-v+p;D<=v-_;D+=2){var y=o+D,w;D==-v||D!=v&&u[y-1]<u[y+1]?w=u[y+1]:w=u[y-1]+1;for(var E=w-D;w<r&&E<s&&e.charAt(w)==t.charAt(E);)w++,E++;if(u[y]=w,w>r)_+=2;else if(E>s)p+=2;else if(h){var b=o+f-D;if(b>=0&&b<l&&a[b]!=-1){var A=r-a[b];if(w>=A)return this.diff_bisectSplit_(e,t,w,E,n)}}}for(var N=-v+m;N<=v-g;N+=2){var b=o+N,A;N==-v||N!=v&&a[b-1]<a[b+1]?A=a[b+1]:A=a[b-1]+1;for(var x=A-N;A<r&&x<s&&e.charAt(r-A-1)==t.charAt(s-x-1);)A++,x++;if(a[b]=A,A>r)g+=2;else if(x>s)m+=2;else if(!h){var y=o+f-N;if(y>=0&&y<l&&u[y]!=-1){var w=u[y],E=o+w-y;if(A=r-A,w>=A)return this.diff_bisectSplit_(e,t,w,E,n)}}}}return [new k.Diff(ne,e),new k.Diff(re,t)]};k.prototype.diff_bisectSplit_=function(e,t,n,r,s){var i=e.substring(0,n),o=t.substring(0,r),l=e.substring(n),u=t.substring(r),a=this.diff_main(i,o,false,s),c=this.diff_main(l,u,false,s);return a.concat(c)};k.prototype.diff_linesToChars_=function(e,t){var n=[],r={};n[0]="";function s(u){for(var a="",c=0,f=-1,h=n.length;f<u.length-1;){f=u.indexOf(`
|
|
6
|
+
`,c),f==-1&&(f=u.length-1);var p=u.substring(c,f+1);(r.hasOwnProperty?r.hasOwnProperty(p):r[p]!==void 0)?a+=String.fromCharCode(r[p]):(h==i&&(p=u.substring(c),f=u.length),a+=String.fromCharCode(h),r[p]=h,n[h++]=p),c=f+1;}return a}d(s,"diff_linesToCharsMunge_");var i=4e4,o=s(e);i=65535;var l=s(t);return {chars1:o,chars2:l,lineArray:n}};k.prototype.diff_charsToLines_=function(e,t){for(var n=0;n<e.length;n++){for(var r=e[n][1],s=[],i=0;i<r.length;i++)s[i]=t[r.charCodeAt(i)];e[n][1]=s.join("");}};k.prototype.diff_commonPrefix=function(e,t){if(!e||!t||e.charAt(0)!=t.charAt(0))return 0;for(var n=0,r=Math.min(e.length,t.length),s=r,i=0;n<s;)e.substring(i,s)==t.substring(i,s)?(n=s,i=n):r=s,s=Math.floor((r-n)/2+n);return s};k.prototype.diff_commonSuffix=function(e,t){if(!e||!t||e.charAt(e.length-1)!=t.charAt(t.length-1))return 0;for(var n=0,r=Math.min(e.length,t.length),s=r,i=0;n<s;)e.substring(e.length-s,e.length-i)==t.substring(t.length-s,t.length-i)?(n=s,i=n):r=s,s=Math.floor((r-n)/2+n);return s};k.prototype.diff_commonOverlap_=function(e,t){var n=e.length,r=t.length;if(n==0||r==0)return 0;n>r?e=e.substring(n-r):n<r&&(t=t.substring(0,n));var s=Math.min(n,r);if(e==t)return s;for(var i=0,o=1;;){var l=e.substring(s-o),u=t.indexOf(l);if(u==-1)return i;o+=u,(u==0||e.substring(s-o)==t.substring(0,o))&&(i=o,o++);}};k.prototype.diff_halfMatch_=function(e,t){if(this.Diff_Timeout<=0)return null;var n=e.length>t.length?e:t,r=e.length>t.length?t:e;if(n.length<4||r.length*2<n.length)return null;var s=this;function i(_,m,g){for(var v=_.substring(g,g+Math.floor(_.length/4)),D=-1,y="",w,E,b,A;(D=m.indexOf(v,D+1))!=-1;){var N=s.diff_commonPrefix(_.substring(g),m.substring(D)),x=s.diff_commonSuffix(_.substring(0,g),m.substring(0,D));y.length<x+N&&(y=m.substring(D-x,D)+m.substring(D,D+N),w=_.substring(0,g-x),E=_.substring(g+N),b=m.substring(0,D-x),A=m.substring(D+N));}return y.length*2>=_.length?[w,E,b,A,y]:null}d(i,"diff_halfMatchI_");var o=i(n,r,Math.ceil(n.length/4)),l=i(n,r,Math.ceil(n.length/2)),u;if(!o&&!l)return null;l?o?u=o[4].length>l[4].length?o:l:u=l:u=o;var a,c,f,h;e.length>t.length?(a=u[0],c=u[1],f=u[2],h=u[3]):(f=u[0],h=u[1],a=u[2],c=u[3]);var p=u[4];return [a,c,f,h,p]};k.prototype.diff_cleanupSemantic=function(e){for(var t=false,n=[],r=0,s=null,i=0,o=0,l=0,u=0,a=0;i<e.length;)e[i][0]==H?(n[r++]=i,o=u,l=a,u=0,a=0,s=e[i][1]):(e[i][0]==re?u+=e[i][1].length:a+=e[i][1].length,s&&s.length<=Math.max(o,l)&&s.length<=Math.max(u,a)&&(e.splice(n[r-1],0,new k.Diff(ne,s)),e[n[r-1]+1][0]=re,r--,r--,i=r>0?n[r-1]:-1,o=0,l=0,u=0,a=0,s=null,t=true)),i++;for(t&&this.diff_cleanupMerge(e),this.diff_cleanupSemanticLossless(e),i=1;i<e.length;){if(e[i-1][0]==ne&&e[i][0]==re){var c=e[i-1][1],f=e[i][1],h=this.diff_commonOverlap_(c,f),p=this.diff_commonOverlap_(f,c);h>=p?(h>=c.length/2||h>=f.length/2)&&(e.splice(i,0,new k.Diff(H,f.substring(0,h))),e[i-1][1]=c.substring(0,c.length-h),e[i+1][1]=f.substring(h),i++):(p>=c.length/2||p>=f.length/2)&&(e.splice(i,0,new k.Diff(H,c.substring(0,p))),e[i-1][0]=re,e[i-1][1]=f.substring(0,f.length-p),e[i+1][0]=ne,e[i+1][1]=c.substring(p),i++),i++;}i++;}};k.prototype.diff_cleanupSemanticLossless=function(e){function t(p,_){if(!p||!_)return 6;var m=p.charAt(p.length-1),g=_.charAt(0),v=m.match(k.nonAlphaNumericRegex_),D=g.match(k.nonAlphaNumericRegex_),y=v&&m.match(k.whitespaceRegex_),w=D&&g.match(k.whitespaceRegex_),E=y&&m.match(k.linebreakRegex_),b=w&&g.match(k.linebreakRegex_),A=E&&p.match(k.blanklineEndRegex_),N=b&&_.match(k.blanklineStartRegex_);return A||N?5:E||b?4:v&&!y&&w?3:y||w?2:v||D?1:0}d(t,"diff_cleanupSemanticScore_");for(var n=1;n<e.length-1;){if(e[n-1][0]==H&&e[n+1][0]==H){var r=e[n-1][1],s=e[n][1],i=e[n+1][1],o=this.diff_commonSuffix(r,s);if(o){var l=s.substring(s.length-o);r=r.substring(0,r.length-o),s=l+s.substring(0,s.length-o),i=l+i;}for(var u=r,a=s,c=i,f=t(r,s)+t(s,i);s.charAt(0)===i.charAt(0);){r+=s.charAt(0),s=s.substring(1)+i.charAt(0),i=i.substring(1);var h=t(r,s)+t(s,i);h>=f&&(f=h,u=r,a=s,c=i);}e[n-1][1]!=u&&(u?e[n-1][1]=u:(e.splice(n-1,1),n--),e[n][1]=a,c?e[n+1][1]=c:(e.splice(n+1,1),n--));}n++;}};k.nonAlphaNumericRegex_=/[^a-zA-Z0-9]/;k.whitespaceRegex_=/\s/;k.linebreakRegex_=/[\r\n]/;k.blanklineEndRegex_=/\n\r?\n$/;k.blanklineStartRegex_=/^\r?\n\r?\n/;k.prototype.diff_cleanupEfficiency=function(e){for(var t=false,n=[],r=0,s=null,i=0,o=false,l=false,u=false,a=false;i<e.length;)e[i][0]==H?(e[i][1].length<this.Diff_EditCost&&(u||a)?(n[r++]=i,o=u,l=a,s=e[i][1]):(r=0,s=null),u=a=false):(e[i][0]==ne?a=true:u=true,s&&(o&&l&&u&&a||s.length<this.Diff_EditCost/2&&o+l+u+a==3)&&(e.splice(n[r-1],0,new k.Diff(ne,s)),e[n[r-1]+1][0]=re,r--,s=null,o&&l?(u=a=true,r=0):(r--,i=r>0?n[r-1]:-1,u=a=false),t=true)),i++;t&&this.diff_cleanupMerge(e);};k.prototype.diff_cleanupMerge=function(e){e.push(new k.Diff(H,""));for(var t=0,n=0,r=0,s="",i="",o;t<e.length;)switch(e[t][0]){case re:r++,i+=e[t][1],t++;break;case ne:n++,s+=e[t][1],t++;break;case H:n+r>1?(n!==0&&r!==0&&(o=this.diff_commonPrefix(i,s),o!==0&&(t-n-r>0&&e[t-n-r-1][0]==H?e[t-n-r-1][1]+=i.substring(0,o):(e.splice(0,0,new k.Diff(H,i.substring(0,o))),t++),i=i.substring(o),s=s.substring(o)),o=this.diff_commonSuffix(i,s),o!==0&&(e[t][1]=i.substring(i.length-o)+e[t][1],i=i.substring(0,i.length-o),s=s.substring(0,s.length-o))),t-=n+r,e.splice(t,n+r),s.length&&(e.splice(t,0,new k.Diff(ne,s)),t++),i.length&&(e.splice(t,0,new k.Diff(re,i)),t++),t++):t!==0&&e[t-1][0]==H?(e[t-1][1]+=e[t][1],e.splice(t,1)):t++,r=0,n=0,s="",i="";break}e[e.length-1][1]===""&&e.pop();var l=false;for(t=1;t<e.length-1;)e[t-1][0]==H&&e[t+1][0]==H&&(e[t][1].substring(e[t][1].length-e[t-1][1].length)==e[t-1][1]?(e[t][1]=e[t-1][1]+e[t][1].substring(0,e[t][1].length-e[t-1][1].length),e[t+1][1]=e[t-1][1]+e[t+1][1],e.splice(t-1,1),l=true):e[t][1].substring(0,e[t+1][1].length)==e[t+1][1]&&(e[t-1][1]+=e[t+1][1],e[t][1]=e[t][1].substring(e[t+1][1].length)+e[t+1][1],e.splice(t+1,1),l=true)),t++;l&&this.diff_cleanupMerge(e);};k.prototype.diff_xIndex=function(e,t){var n=0,r=0,s=0,i=0,o;for(o=0;o<e.length&&(e[o][0]!==re&&(n+=e[o][1].length),e[o][0]!==ne&&(r+=e[o][1].length),!(n>t));o++)s=n,i=r;return e.length!=o&&e[o][0]===ne?i:i+(t-s)};k.prototype.diff_prettyHtml=function(e){for(var t=[],n=/&/g,r=/</g,s=/>/g,i=/\n/g,o=0;o<e.length;o++){var l=e[o][0],u=e[o][1],a=u.replace(n,"&").replace(r,"<").replace(s,">").replace(i,"¶<br>");switch(l){case re:t[o]='<ins style="background:#e6ffe6;">'+a+"</ins>";break;case ne:t[o]='<del style="background:#ffe6e6;">'+a+"</del>";break;case H:t[o]="<span>"+a+"</span>";break}}return t.join("")};k.prototype.diff_text1=function(e){for(var t=[],n=0;n<e.length;n++)e[n][0]!==re&&(t[n]=e[n][1]);return t.join("")};k.prototype.diff_text2=function(e){for(var t=[],n=0;n<e.length;n++)e[n][0]!==ne&&(t[n]=e[n][1]);return t.join("")};k.prototype.diff_levenshtein=function(e){for(var t=0,n=0,r=0,s=0;s<e.length;s++){var i=e[s][0],o=e[s][1];switch(i){case re:n+=o.length;break;case ne:r+=o.length;break;case H:t+=Math.max(n,r),n=0,r=0;break}}return t+=Math.max(n,r),t};k.prototype.diff_toDelta=function(e){for(var t=[],n=0;n<e.length;n++)switch(e[n][0]){case re:t[n]="+"+encodeURI(e[n][1]);break;case ne:t[n]="-"+e[n][1].length;break;case H:t[n]="="+e[n][1].length;break}return t.join(" ").replace(/%20/g," ")};k.prototype.diff_fromDelta=function(e,t){for(var n=[],r=0,s=0,i=t.split(/\t/g),o=0;o<i.length;o++){var l=i[o].substring(1);switch(i[o].charAt(0)){case "+":try{n[r++]=new k.Diff(re,decodeURI(l));}catch{throw new Error("Illegal escape in diff_fromDelta: "+l)}break;case "-":case "=":var u=parseInt(l,10);if(isNaN(u)||u<0)throw new Error("Invalid number in diff_fromDelta: "+l);var a=e.substring(s,s+=u);i[o].charAt(0)=="="?n[r++]=new k.Diff(H,a):n[r++]=new k.Diff(ne,a);break;default:if(i[o])throw new Error("Invalid diff operation in diff_fromDelta: "+i[o])}}if(s!=e.length)throw new Error("Delta length ("+s+") does not equal source text length ("+e.length+").");return n};k.prototype.match_main=function(e,t,n){if(e==null||t==null||n==null)throw new Error("Null input. (match_main)");return n=Math.max(0,Math.min(n,e.length)),e==t?0:e.length?e.substring(n,n+t.length)==t?n:this.match_bitap_(e,t,n):-1};k.prototype.match_bitap_=function(e,t,n){if(t.length>this.Match_MaxBits)throw new Error("Pattern too long for this browser.");var r=this.match_alphabet_(t),s=this;function i(w,E){var b=w/t.length,A=Math.abs(n-E);return s.Match_Distance?b+A/s.Match_Distance:A?1:b}d(i,"match_bitapScore_");var o=this.Match_Threshold,l=e.indexOf(t,n);l!=-1&&(o=Math.min(i(0,l),o),l=e.lastIndexOf(t,n+t.length),l!=-1&&(o=Math.min(i(0,l),o)));var u=1<<t.length-1;l=-1;for(var a,c,f=t.length+e.length,h,p=0;p<t.length;p++){for(a=0,c=f;a<c;)i(p,n+c)<=o?a=c:f=c,c=Math.floor((f-a)/2+a);f=c;var _=Math.max(1,n-c+1),m=Math.min(n+c,e.length)+t.length,g=Array(m+2);g[m+1]=(1<<p)-1;for(var v=m;v>=_;v--){var D=r[e.charAt(v-1)];if(p===0?g[v]=(g[v+1]<<1|1)&D:g[v]=(g[v+1]<<1|1)&D|((h[v+1]|h[v])<<1|1)|h[v+1],g[v]&u){var y=i(p,v-1);if(y<=o)if(o=y,l=v-1,l>n)_=Math.max(1,2*n-l);else break}}if(i(p+1,n)>o)break;h=g;}return l};k.prototype.match_alphabet_=function(e){for(var t={},n=0;n<e.length;n++)t[e.charAt(n)]=0;for(var n=0;n<e.length;n++)t[e.charAt(n)]|=1<<e.length-n-1;return t};k.prototype.patch_addContext_=function(e,t){if(t.length!=0){if(e.start2===null)throw Error("patch not initialized");for(var n=t.substring(e.start2,e.start2+e.length1),r=0;t.indexOf(n)!=t.lastIndexOf(n)&&n.length<this.Match_MaxBits-this.Patch_Margin-this.Patch_Margin;)r+=this.Patch_Margin,n=t.substring(e.start2-r,e.start2+e.length1+r);r+=this.Patch_Margin;var s=t.substring(e.start2-r,e.start2);s&&e.diffs.unshift(new k.Diff(H,s));var i=t.substring(e.start2+e.length1,e.start2+e.length1+r);i&&e.diffs.push(new k.Diff(H,i)),e.start1-=s.length,e.start2-=s.length,e.length1+=s.length+i.length,e.length2+=s.length+i.length;}};k.prototype.patch_make=function(e,t,n){var r,s;if(typeof e=="string"&&typeof t=="string"&&typeof n>"u")r=e,s=this.diff_main(r,t,true),s.length>2&&(this.diff_cleanupSemantic(s),this.diff_cleanupEfficiency(s));else if(e&&typeof e=="object"&&typeof t>"u"&&typeof n>"u")s=e,r=this.diff_text1(s);else if(typeof e=="string"&&t&&typeof t=="object"&&typeof n>"u")r=e,s=t;else if(typeof e=="string"&&typeof t=="string"&&n&&typeof n=="object")r=e,s=n;else throw new Error("Unknown call format to patch_make.");if(s.length===0)return [];for(var i=[],o=new k.patch_obj,l=0,u=0,a=0,c=r,f=r,h=0;h<s.length;h++){var p=s[h][0],_=s[h][1];switch(!l&&p!==H&&(o.start1=u,o.start2=a),p){case re:o.diffs[l++]=s[h],o.length2+=_.length,f=f.substring(0,a)+_+f.substring(a);break;case ne:o.length1+=_.length,o.diffs[l++]=s[h],f=f.substring(0,a)+f.substring(a+_.length);break;case H:_.length<=2*this.Patch_Margin&&l&&s.length!=h+1?(o.diffs[l++]=s[h],o.length1+=_.length,o.length2+=_.length):_.length>=2*this.Patch_Margin&&l&&(this.patch_addContext_(o,c),i.push(o),o=new k.patch_obj,l=0,c=f,u=a);break}p!==re&&(u+=_.length),p!==ne&&(a+=_.length);}return l&&(this.patch_addContext_(o,c),i.push(o)),i};k.prototype.patch_deepCopy=function(e){for(var t=[],n=0;n<e.length;n++){var r=e[n],s=new k.patch_obj;s.diffs=[];for(var i=0;i<r.diffs.length;i++)s.diffs[i]=new k.Diff(r.diffs[i][0],r.diffs[i][1]);s.start1=r.start1,s.start2=r.start2,s.length1=r.length1,s.length2=r.length2,t[n]=s;}return t};k.prototype.patch_apply=function(e,t){if(e.length==0)return [t,[]];e=this.patch_deepCopy(e);var n=this.patch_addPadding(e);t=n+t+n,this.patch_splitMax(e);for(var r=0,s=[],i=0;i<e.length;i++){var o=e[i].start2+r,l=this.diff_text1(e[i].diffs),u,a=-1;if(l.length>this.Match_MaxBits?(u=this.match_main(t,l.substring(0,this.Match_MaxBits),o),u!=-1&&(a=this.match_main(t,l.substring(l.length-this.Match_MaxBits),o+l.length-this.Match_MaxBits),(a==-1||u>=a)&&(u=-1))):u=this.match_main(t,l,o),u==-1)s[i]=false,r-=e[i].length2-e[i].length1;else {s[i]=true,r=u-o;var c;if(a==-1?c=t.substring(u,u+l.length):c=t.substring(u,a+this.Match_MaxBits),l==c)t=t.substring(0,u)+this.diff_text2(e[i].diffs)+t.substring(u+l.length);else {var f=this.diff_main(l,c,false);if(l.length>this.Match_MaxBits&&this.diff_levenshtein(f)/l.length>this.Patch_DeleteThreshold)s[i]=false;else {this.diff_cleanupSemanticLossless(f);for(var h=0,p,_=0;_<e[i].diffs.length;_++){var m=e[i].diffs[_];m[0]!==H&&(p=this.diff_xIndex(f,h)),m[0]===re?t=t.substring(0,u+p)+m[1]+t.substring(u+p):m[0]===ne&&(t=t.substring(0,u+p)+t.substring(u+this.diff_xIndex(f,h+m[1].length))),m[0]!==ne&&(h+=m[1].length);}}}}}return t=t.substring(n.length,t.length-n.length),[t,s]};k.prototype.patch_addPadding=function(e){for(var t=this.Patch_Margin,n="",r=1;r<=t;r++)n+=String.fromCharCode(r);for(var r=0;r<e.length;r++)e[r].start1+=t,e[r].start2+=t;var s=e[0],i=s.diffs;if(i.length==0||i[0][0]!=H)i.unshift(new k.Diff(H,n)),s.start1-=t,s.start2-=t,s.length1+=t,s.length2+=t;else if(t>i[0][1].length){var o=t-i[0][1].length;i[0][1]=n.substring(i[0][1].length)+i[0][1],s.start1-=o,s.start2-=o,s.length1+=o,s.length2+=o;}if(s=e[e.length-1],i=s.diffs,i.length==0||i[i.length-1][0]!=H)i.push(new k.Diff(H,n)),s.length1+=t,s.length2+=t;else if(t>i[i.length-1][1].length){var o=t-i[i.length-1][1].length;i[i.length-1][1]+=n.substring(0,o),s.length1+=o,s.length2+=o;}return n};k.prototype.patch_splitMax=function(e){for(var t=this.Match_MaxBits,n=0;n<e.length;n++)if(!(e[n].length1<=t)){var r=e[n];e.splice(n--,1);for(var s=r.start1,i=r.start2,o="";r.diffs.length!==0;){var l=new k.patch_obj,u=true;for(l.start1=s-o.length,l.start2=i-o.length,o!==""&&(l.length1=l.length2=o.length,l.diffs.push(new k.Diff(H,o)));r.diffs.length!==0&&l.length1<t-this.Patch_Margin;){var a=r.diffs[0][0],c=r.diffs[0][1];a===re?(l.length2+=c.length,i+=c.length,l.diffs.push(r.diffs.shift()),u=false):a===ne&&l.diffs.length==1&&l.diffs[0][0]==H&&c.length>2*t?(l.length1+=c.length,s+=c.length,u=false,l.diffs.push(new k.Diff(a,c)),r.diffs.shift()):(c=c.substring(0,t-l.length1-this.Patch_Margin),l.length1+=c.length,s+=c.length,a===H?(l.length2+=c.length,i+=c.length):u=false,l.diffs.push(new k.Diff(a,c)),c==r.diffs[0][1]?r.diffs.shift():r.diffs[0][1]=r.diffs[0][1].substring(c.length));}o=this.diff_text2(l.diffs),o=o.substring(o.length-this.Patch_Margin);var f=this.diff_text1(r.diffs).substring(0,this.Patch_Margin);f!==""&&(l.length1+=f.length,l.length2+=f.length,l.diffs.length!==0&&l.diffs[l.diffs.length-1][0]===H?l.diffs[l.diffs.length-1][1]+=f:l.diffs.push(new k.Diff(H,f))),u||e.splice(++n,0,l);}}};k.prototype.patch_toText=function(e){for(var t=[],n=0;n<e.length;n++)t[n]=e[n];return t.join("")};k.prototype.patch_fromText=function(e){var t=[];if(!e)return t;for(var n=e.split(`
|
|
7
|
+
`),r=0,s=/^@@ -(\d+),?(\d*) \+(\d+),?(\d*) @@$/;r<n.length;){var i=n[r].match(s);if(!i)throw new Error("Invalid patch string: "+n[r]);var o=new k.patch_obj;for(t.push(o),o.start1=parseInt(i[1],10),i[2]===""?(o.start1--,o.length1=1):i[2]=="0"?o.length1=0:(o.start1--,o.length1=parseInt(i[2],10)),o.start2=parseInt(i[3],10),i[4]===""?(o.start2--,o.length2=1):i[4]=="0"?o.length2=0:(o.start2--,o.length2=parseInt(i[4],10)),r++;r<n.length;){var l=n[r].charAt(0);try{var u=decodeURI(n[r].substring(1));}catch{throw new Error("Illegal escape in patch_fromText: "+u)}if(l=="-")o.diffs.push(new k.Diff(ne,u));else if(l=="+")o.diffs.push(new k.Diff(re,u));else if(l==" ")o.diffs.push(new k.Diff(H,u));else {if(l=="@")break;if(l!=="")throw new Error('Invalid patch mode "'+l+'" in: '+u)}r++;}}return t};k.patch_obj=function(){this.diffs=[],this.start1=null,this.start2=null,this.length1=0,this.length2=0;};k.patch_obj.prototype.toString=function(){var e,t;this.length1===0?e=this.start1+",0":this.length1==1?e=this.start1+1:e=this.start1+1+","+this.length1,this.length2===0?t=this.start2+",0":this.length2==1?t=this.start2+1:t=this.start2+1+","+this.length2;for(var n=["@@ -"+e+" +"+t+` @@
|
|
8
|
+
`],r,s=0;s<this.diffs.length;s++){switch(this.diffs[s][0]){case re:r="+";break;case ne:r="-";break;case H:r=" ";break}n[s+1]=r+encodeURI(this.diffs[s][1])+`
|
|
9
|
+
`;}return n.join("").replace(/%20/g," ")};$t.exports=k;$t.exports.diff_match_patch=k;$t.exports.DIFF_DELETE=ne;$t.exports.DIFF_INSERT=re;$t.exports.DIFF_EQUAL=H;});var ut="application/vnd.openxmlformats-officedocument.wordprocessingml.document";function Qr(e,t){return t.split(".").reduce((n,r)=>{if(n&&typeof n=="object")return n[r]},e)}d(Qr,"getNestedProperty");async function $o(e,t){let n=this.getInputData()[e];if(!n.binary||!n.binary[t])throw new n8nWorkflow.NodeOperationError(this.getNode(),`No binary data found on property "${t}"`,{description:"Verify that the upstream node produced binary data and that the property name matches.",itemIndex:e});let r=n.binary[t],s=await this.helpers.getBinaryDataBuffer(e,t),i=r.fileName??"document.docx";return {buffer:s,fileName:i}}d($o,"getDocxBuffer");async function Pe(e,t){if(t.mode==="fromInput")return $o.call(this,e,t.binaryPropertyName);let{sourceNodeName:n,binaryPropertyName:r}=t,s="sourceBinaryId"in t?t.sourceBinaryId:void 0;if(s&&s.trim()!=="")try{let f=await this.helpers.getBinaryStream(s);return {buffer:await this.helpers.binaryToBuffer(f),fileName:"document.docx"}}catch(f){throw new n8nWorkflow.NodeApiError(this.getNode(),{message:f.message},{message:`Failed to load document from Binary ID '${s}'.`,description:`The binary with ID '${s}' could not be loaded. This usually means the binary has expired, been garbage-collected, or the ID is incorrect.`,itemIndex:e})}if(!n||n.trim()==="")throw new n8nWorkflow.NodeApiError(this.getNode(),{message:"Source Node Name is empty"},{message:"Source Node Name is required when Document Source is 'From Another Node'.",description:"Set 'Source Node Name' to the exact name of the node in this workflow whose output holds the .docx binary (e.g. the trigger node). Node names are case-sensitive and must match the node label in the canvas exactly.",itemIndex:e});let i=n.replace(/'/g,"\\'"),o=`{{ $('${i}').first().binary.${r} }}`,l;try{l=this.evaluateExpression(o,e);}catch(f){throw new n8nWorkflow.NodeApiError(this.getNode(),{message:f.message},{message:`Failed to resolve binary from source node '${n}'.`,description:`Could not evaluate '${o}'. Verify the source node name is exactly correct (case-sensitive, including spaces and punctuation). Underlying error: ${f.message}`,itemIndex:e})}if(l==null||typeof l!="object"){let f=`{{ $('${i}').first().json }}`,h;try{h=this.evaluateExpression(f,e);}catch{h=void 0;}if(h==null)throw new n8nWorkflow.NodeApiError(this.getNode(),{message:"Source node produced no output"},{message:`Source node '${n}' has no output.`,description:`The expression '${o}' resolved to undefined and the node appears not to have executed in this run. Verify that '${n}' is upstream of this Adeu node, that its name matches exactly (case-sensitive), and that it has run successfully.`,itemIndex:e});let p="";try{let _=this.evaluateExpression(`{{ Object.keys($('${i}').first().binary || {}) }}`,e);Array.isArray(_)&&_.length>0?p=` Available binary properties on '${n}': `+_.map(m=>`'${m}'`).join(", ")+".":Array.isArray(_)&&_.length===0&&(p=` Source node '${n}' has no binary properties at all.`);}catch{}throw new n8nWorkflow.NodeApiError(this.getNode(),{message:"Binary property not found"},{message:`Source node '${n}' has no binary on property '${r}'.`,description:`The expression '${o}' resolved to undefined.${p} Update 'Binary Property Name' to match an existing property, or change the source node so it outputs the .docx on the expected property.`,itemIndex:e})}let u=l,a;try{if(u.id){let f=await this.helpers.getBinaryStream(u.id);a=await this.helpers.binaryToBuffer(f);}else if(u.data)a=Buffer.from(u.data,"base64");else throw new Error("Resolved binary metadata has neither an 'id' nor 'data' field.")}catch(f){throw new n8nWorkflow.NodeApiError(this.getNode(),{message:f.message},{message:`Failed to read binary content from source node '${n}'.`,description:`The binary metadata was found on property '${r}', but its contents could not be loaded. Underlying error: ${f.message}`,itemIndex:e})}let c=u.fileName??"document.docx";return {buffer:a,fileName:c}}d(Pe,"getDocxBufferFromSource");function Cn(e,t){let n=e.lastIndexOf(".");return `${n===-1?e:e.substring(0,n)}_${t}.docx`}d(Cn,"buildOutputFileName");function Jr(e,t,n){if(e==null||e==="")throw new n8nWorkflow.NodeOperationError(this.getNode(),`Parameter "${n}" is empty`,{description:`Provide a JSON value for "${n}".`,itemIndex:t});if(typeof e=="object")return e;let r=e.trim();r.startsWith("```")&&(r=r.replace(/^```[a-zA-Z]*\n?/,""),r=r.replace(/\n?```$/,"")),r=r.trim();try{return JSON.parse(r)}catch(s){throw new n8nWorkflow.NodeOperationError(this.getNode(),`Parameter "${n}" is not valid JSON`,{description:s.message,itemIndex:t})}}d(Jr,"parseJsonParameter");function Zr(e,t){let n=e.message??"Unknown error",r=e.name??"",s=e.errors,i=Array.isArray(s)?s.join(`
|
|
10
|
+
`):n,o=i.toLowerCase();if(r==="BatchValidationError"){let l="Batch validation failed.",u=`Review the listed failures:
|
|
11
|
+
`+i;return o.includes("target text not found")?(l="An edit could not be applied: target text not found.",u="Verify the exact `target_text` string \u2014 including punctuation and whitespace \u2014 against the document. Check the individual failures:\n"+i):o.includes("ambiguous match")?(l="An edit matched multiple locations in the document.",u="Provide more surrounding context in `target_text` to uniquely identify the location:\n"+i):o.includes("read-only")||o.includes("readonly")?(l="An edit targeted a read-only structural element.",u=`Cross-references, footnotes, hyperlinks, and the Structural Appendix cannot be modified via text replacement:
|
|
12
|
+
`+i):o.includes("comment range from another author")?(l="A match_mode='all' edit would sweep through another author's comment range.",u=`Bulk replacements are blocked from running through foreign comment ranges. Target the commented text deliberately with match_mode 'strict' or 'first', or scope the edit outside of it:
|
|
13
|
+
`+i):(o.includes("another author")||o.includes("nested"))&&(l="An edit overlaps with a pending tracked change by another author.",u=`Accept or reject the conflicting change first, or scope your edit outside of it:
|
|
14
|
+
`+i),new n8nWorkflow.NodeApiError(this.getNode(),{message:i,errors:s},{message:l,description:u,itemIndex:t})}return o.includes("invalid docx")||o.includes("missing word/document.xml")?new n8nWorkflow.NodeApiError(this.getNode(),{message:n},{message:"The document could not be opened.",description:"Verify the input binary is a valid .docx file (not .doc, .pdf, or another format).",itemIndex:t}):new n8nWorkflow.NodeApiError(this.getNode(),{message:n},{message:"Adeu engine error.",description:n,itemIndex:t})}d(Zr,"mapAdeuErrorToNodeApiError");function Uo(e){if(!e||typeof e!="object")return false;let t=e;return typeof t.id=="string"&&typeof t.fileName=="string"&&typeof t.mimeType=="string"}d(Uo,"isStashedBinaryEntry");var ei=[{displayName:"Static Data Key",name:"staticDataKey",type:"string",default:"adeu_last_redlined",required:true,placeholder:"e.g. adeu_last_redlined",description:"Key in workflow global static data to read the stashed binary metadata from (string). When the Apply Edits operation runs as an AI Agent tool, n8n's tool wrapper strips the binary from its output before any downstream node can see it. To work around that, Apply Edits writes the binary's storage id into workflow static data under 'adeu_last_redlined'. This operation reads that entry back, fetches the original buffer via getBinaryStream, and attaches a fresh IBinaryData onto the outgoing item. Leave the default unless you've customized the stash key on the Apply Edits side.",displayOptions:{show:{resource:["document"],operation:["hydrateToolOutput"]}}},{displayName:"Output Binary Property",name:"outputBinaryPropertyName",type:"string",default:"data",required:true,placeholder:"e.g. data",description:"Name of the binary property on the outgoing item that will hold the hydrated .docx (string, e.g. 'data'). Downstream nodes (e.g. Write Binary File, Gmail send) should be configured to read from this property name.",displayOptions:{show:{resource:["document"],operation:["hydrateToolOutput"]}}},{displayName:"On Missing",name:"onMissing",type:"options",default:"emit_empty",description:"What to do when no stashed binary entry is found under the configured key. 'Emit Empty' is the typical AI Agent path: emits an item with json.hydrated=false and no binary, so a downstream If node can gate any write step on whether the LLM actually called Apply Edits this turn. 'Throw' is for deterministic pipelines where the stash MUST be present and a missing entry indicates a workflow bug.",options:[{name:"Emit Empty",value:"emit_empty",description:"Emit a single item with json.hydrated=false and no binary. Downstream If on json.hydrated gates the write."},{name:"Throw",value:"throw",description:"Throw a NodeOperationError. Use when a missing stash indicates a workflow bug."}],displayOptions:{show:{resource:["document"],operation:["hydrateToolOutput"]}}},{displayName:"Clear After Read",name:"clearAfterRead",type:"boolean",default:true,description:"Whether to delete the static data entry after a successful hydration so it does not leak across workflow runs. Set false if you want to inspect or re-read the entry from a later node in the same run.",displayOptions:{show:{resource:["document"],operation:["hydrateToolOutput"]}}},{displayName:"Output Path Template",name:"outputPathTemplate",type:"string",default:"",placeholder:"e.g. C:\\Users\\Uzair\\.n8n-files\\{baseName}_{timestamp}.docx",description:"Optional template to compute the final write path on disk, returned on the output JSON as 'outputPath'. If set, you can configure downstream Write nodes to simply read '{{ $json.outputPath }}' with zero escaping risks. Supports these placeholders: '{baseName}' (filename with extension stripped), '{timestamp}' (current ISO 8601 timestamp with colons and dots replaced by dashes for Windows file compatibility), '{fileName}' (the stashed filename including extension), and '{ext}' (e.g., '.docx').",displayOptions:{show:{resource:["document"],operation:["hydrateToolOutput"]}}}];async function ti(e){let t=this.getNodeParameter("staticDataKey",e),n=this.getNodeParameter("outputBinaryPropertyName",e),r=this.getNodeParameter("onMissing",e),s=this.getNodeParameter("clearAfterRead",e),i=this.getWorkflowStaticData("global"),o=i[t];if(!Uo(o)){if(r==="throw")throw new n8nWorkflow.NodeOperationError(this.getNode(),`No stashed binary found under static data key "${t}".`,{description:"The Apply Edits operation writes a stash entry into workflow static data only when it runs as an AI Agent tool and produces a binary. Verify that Apply Edits was actually called by the agent this turn, that it ran successfully, and that the key matches the one used on the writing side.",itemIndex:e});return [{json:{hydrated:false},pairedItem:{item:e}}]}let{id:l,fileName:u,mimeType:a}=o,c;try{let m=await this.helpers.getBinaryStream(l);c=await this.helpers.binaryToBuffer(m);}catch(m){throw new n8nWorkflow.NodeOperationError(this.getNode(),`Failed to load stashed binary (id=${l}) from external storage.`,{description:`The stash entry under "${t}" points at binary id "${l}", but the underlying data could not be loaded. This usually means the binary has been garbage-collected (n8n's execution data retention may be too short) or external storage is unavailable. Underlying error: ${m.message}`,itemIndex:e})}let f=a||ut,h=await this.helpers.prepareBinaryData(c,u,f);s&&delete i[t];let p=this.getNodeParameter("outputPathTemplate",e,""),_;if(p.trim()!==""){let m=u.replace(/\.docx$/i,""),g=u.match(/\.docx$/i)?.[0]??".docx",v=new Date().toISOString().replace(/[:.]/g,"-").replace(/Z$/,"");_=p.replaceAll("{baseName}",m).replaceAll("{timestamp}",v).replaceAll("{fileName}",u).replaceAll("{ext}",g);}return [{json:{hydrated:true,fileName:u,sourceBinaryId:l,mimeType:f,..._!==void 0?{outputPath:_}:{}},binary:{[n]:h},pairedItem:{item:e}}]}d(ti,"executeHydrateToolOutput");var li=ar(ri());var qo=(0, li.createRequire)("/"),vt,jo,zo;try{vt=qo("worker_threads"),jo=vt.Worker,zo=vt.isMarkedAsUntransferable;}catch{}var se=Uint8Array,Ne=Uint16Array,vr=Int32Array,kn=new se([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,0,0,0]),Sn=new se([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,0,0]),hr=new se([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),ci=d(function(e,t){for(var n=new Ne(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];for(var s=new vr(n[30]),r=1;r<30;++r)for(var i=n[r];i<n[r+1];++i)s[i]=i-n[r]<<5|r;return {b:n,r:s}},"freb"),vt=ci(kn,2),fi=vt.b,pr=vt.r;fi[28]=258,pr[258]=28;var di=ci(Sn,0),Wo=di.b,ii=di.r,mr=new Ne(32768);for(Z=0;Z<32768;++Z)ze=(Z&43690)>>1|(Z&21845)<<1,ze=(ze&52428)>>2|(ze&13107)<<2,ze=(ze&61680)>>4|(ze&3855)<<4,mr[Z]=((ze&65280)>>8|(ze&255)<<8)>>1;var ze,Z,Fe=d((function(e,t,n){for(var r=e.length,s=0,i=new Ne(t);s<r;++s)e[s]&&++i[e[s]-1];var o=new Ne(t);for(s=1;s<t;++s)o[s]=o[s-1]+i[s-1]<<1;var l;if(n){l=new Ne(1<<t);var u=15-t;for(s=0;s<r;++s)if(e[s])for(var a=s<<4|e[s],c=t-e[s],f=o[e[s]-1]++<<c,h=f|(1<<c)-1;f<=h;++f)l[mr[f]>>u]=a;}else for(l=new Ne(r),s=0;s<r;++s)e[s]&&(l[s]=mr[o[e[s]-1]++]>>15-e[s]);return l}),"hMap"),Qe=new se(288);for(Z=0;Z<144;++Z)Qe[Z]=8;var Z;for(Z=144;Z<256;++Z)Qe[Z]=9;var Z;for(Z=256;Z<280;++Z)Qe[Z]=7;var Z;for(Z=280;Z<288;++Z)Qe[Z]=8;var Z,Jt=new se(32);for(Z=0;Z<32;++Z)Jt[Z]=5;var Z,Ho=Fe(Qe,9,0),Vo=Fe(Qe,9,1),Go=Fe(Jt,5,0),Yo=Fe(Jt,5,1),lr=d(function(e){for(var t=e[0],n=1;n<e.length;++n)e[n]>t&&(t=e[n]);return t},"max"),Me=d(function(e,t,n){var r=t/8|0;return (e[r]|e[r+1]<<8)>>(t&7)&n},"bits"),cr=d(function(e,t){var n=t/8|0;return (e[n]|e[n+1]<<8|e[n+2]<<16)>>(t&7)},"bits16"),yr=d(function(e){return (e+7)/8|0},"shft"),Zt=d(function(e,t,n){return (t==null||t<0)&&(t=0),(n==null||n>e.length)&&(n=e.length),new se(e.subarray(t,n))},"slc");var Xo=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],pe=d(function(e,t,n){var r=new Error(t||Xo[e]);if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,pe),!n)throw r;return r},"err"),Qo=d(function(e,t,n,r){var s=e.length,i=r?r.length:0;if(!s||t.f&&!t.l)return n||new se(0);var o=!n,l=o||t.i!=2,u=t.i;o&&(n=new se(s*3));var a=d(function(Gt){var Yt=n.length;if(Gt>Yt){var wt=new se(Math.max(Yt*2,Gt));wt.set(n),n=wt;}},"cbuf"),c=t.f||0,f=t.p||0,h=t.b||0,p=t.l,_=t.d,m=t.m,g=t.n,v=s*8;do{if(!p){c=Me(e,f,1);var D=Me(e,f+1,3);if(f+=3,D)if(D==1)p=Vo,_=Yo,m=9,g=5;else if(D==2){var b=Me(e,f,31)+257,A=Me(e,f+10,15)+4,N=b+Me(e,f+5,31)+1;f+=14;for(var x=new se(N),C=new se(19),P=0;P<A;++P)C[hr[P]]=Me(e,f+P*3,7);f+=A*3;for(var S=lr(C),$=(1<<S)-1,O=Fe(C,S,1),P=0;P<N;){var T=O[Me(e,f,$)];f+=T&15;var y=T>>4;if(y<16)x[P++]=y;else {var M=0,B=0;for(y==16?(B=3+Me(e,f,3),f+=2,M=x[P-1]):y==17?(B=3+Me(e,f,7),f+=3):y==18&&(B=11+Me(e,f,127),f+=7);B--;)x[P++]=M;}}var U=x.subarray(0,b),R=x.subarray(b);m=lr(U),g=lr(R),p=Fe(U,m,1),_=Fe(R,g,1);}else pe(1);else {var y=yr(f)+4,w=e[y-4]|e[y-3]<<8,E=y+w;if(E>s){u&&pe(0);break}l&&a(h+w),n.set(e.subarray(y,E),h),t.b=h+=w,t.p=f=E*8,t.f=c;continue}if(f>v){u&&pe(0);break}}l&&a(h+131072);for(var q=(1<<m)-1,Q=(1<<g)-1,te=f;;te=f){var M=p[cr(e,f)&q],J=M>>4;if(f+=M&15,f>v){u&&pe(0);break}if(M||pe(2),J<256)n[h++]=J;else if(J==256){te=f,p=null;break}else {var K=J-254;if(J>264){var P=J-257,G=kn[P];K=Me(e,f,(1<<G)-1)+fi[P],f+=G;}var ye=_[cr(e,f)&Q],qe=ye>>4;ye||pe(3),f+=ye&15;var R=Wo[qe];if(qe>3){var G=Sn[qe];R+=cr(e,f)&(1<<G)-1,f+=G;}if(f>v){u&&pe(0);break}l&&a(h+131072);var gt=h+K;if(h<R){var Nn=i-R,xn=Math.min(R,gt);for(Nn+h<0&&pe(3);h<xn;++h)n[h]=r[Nn+h];}for(;h<gt;++h)n[h]=n[h-R];}}t.l=p,t.p=te,t.b=h,t.f=c,p&&(c=1,t.m=m,t.d=_,t.n=g);}while(!c);return h!=n.length&&o?Zt(n,0,h):n.subarray(0,h)},"inflt"),We=d(function(e,t,n){n<<=t&7;var r=t/8|0;e[r]|=n,e[r+1]|=n>>8;},"wbits"),Xt=d(function(e,t,n){n<<=t&7;var r=t/8|0;e[r]|=n,e[r+1]|=n>>8,e[r+2]|=n>>16;},"wbits16"),fr=d(function(e,t){for(var n=[],r=0;r<e.length;++r)e[r]&&n.push({s:r,f:e[r]});var s=n.length,i=n.slice();if(!s)return {t:pi,l:0};if(s==1){var o=new se(n[0].s+1);return o[n[0].s]=1,{t:o,l:1}}n.sort(function(E,b){return E.f-b.f}),n.push({s:-1,f:25001});var l=n[0],u=n[1],a=0,c=1,f=2;for(n[0]={s:-1,f:l.f+u.f,l,r:u};c!=s-1;)l=n[n[a].f<n[f].f?a++:f++],u=n[a!=c&&n[a].f<n[f].f?a++:f++],n[c++]={s:-1,f:l.f+u.f,l,r:u};for(var h=i[0].s,r=1;r<s;++r)i[r].s>h&&(h=i[r].s);var p=new Ne(h+1),_=_r(n[c-1],p,0);if(_>t){var r=0,m=0,g=_-t,v=1<<g;for(i.sort(function(b,A){return p[A.s]-p[b.s]||b.f-A.f});r<s;++r){var D=i[r].s;if(p[D]>t)m+=v-(1<<_-p[D]),p[D]=t;else break}for(m>>=g;m>0;){var y=i[r].s;p[y]<t?m-=1<<t-p[y]++-1:++r;}for(;r>=0&&m;--r){var w=i[r].s;p[w]==t&&(--p[w],++m);}_=t;}return {t:new se(p),l:_}},"hTree"),_r=d(function(e,t,n){return e.s==-1?Math.max(_r(e.l,t,n+1),_r(e.r,t,n+1)):t[e.s]=n},"ln"),si=d(function(e){for(var t=e.length;t&&!e[--t];);for(var n=new Ne(++t),r=0,s=e[0],i=1,o=d(function(u){n[r++]=u;},"w"),l=1;l<=t;++l)if(e[l]==s&&l!=t)++i;else {if(!s&&i>2){for(;i>138;i-=138)o(32754);i>2&&(o(i>10?i-11<<5|28690:i-3<<5|12305),i=0);}else if(i>3){for(o(s),--i;i>6;i-=6)o(8304);i>2&&(o(i-3<<5|8208),i=0);}for(;i--;)o(s);i=1,s=e[l];}return {c:n.subarray(0,r),n:t}},"lc"),Qt=d(function(e,t){for(var n=0,r=0;r<t.length;++r)n+=e[r]*t[r];return n},"clen"),hi=d(function(e,t,n){var r=n.length,s=yr(t+2);e[s]=r&255,e[s+1]=r>>8,e[s+2]=e[s]^255,e[s+3]=e[s+1]^255;for(var i=0;i<r;++i)e[s+i+4]=n[i];return (s+4+r)*8},"wfblk"),oi=d(function(e,t,n,r,s,i,o,l,u,a,c){We(t,c++,n),++s[256];for(var f=fr(s,15),h=f.t,p=f.l,_=fr(i,15),m=_.t,g=_.l,v=si(h),D=v.c,y=v.n,w=si(m),E=w.c,b=w.n,A=new Ne(19),N=0;N<D.length;++N)++A[D[N]&31];for(var N=0;N<E.length;++N)++A[E[N]&31];for(var x=fr(A,7),C=x.t,P=x.l,S=19;S>4&&!C[hr[S-1]];--S);var $=a+5<<3,O=Qt(s,Qe)+Qt(i,Jt)+o,T=Qt(s,h)+Qt(i,m)+o+14+3*S+Qt(A,C)+2*A[16]+3*A[17]+7*A[18];if(u>=0&&$<=O&&$<=T)return hi(t,c,e.subarray(u,u+a));var M,B,U,R;if(We(t,c,1+(T<O)),c+=2,T<O){M=Fe(h,p,0),B=h,U=Fe(m,g,0),R=m;var q=Fe(C,P,0);We(t,c,y-257),We(t,c+5,b-1),We(t,c+10,S-4),c+=14;for(var N=0;N<S;++N)We(t,c+3*N,C[hr[N]]);c+=3*S;for(var Q=[D,E],te=0;te<2;++te)for(var J=Q[te],N=0;N<J.length;++N){var K=J[N]&31;We(t,c,q[K]),c+=C[K],K>15&&(We(t,c,J[N]>>5&127),c+=J[N]>>12);}}else M=Ho,B=Qe,U=Go,R=Jt;for(var N=0;N<l;++N){var G=r[N];if(G>255){var K=G>>18&31;Xt(t,c,M[K+257]),c+=B[K+257],K>7&&(We(t,c,G>>23&31),c+=kn[K]);var ye=G&31;Xt(t,c,U[ye]),c+=R[ye],ye>3&&(Xt(t,c,G>>5&8191),c+=Sn[ye]);}else Xt(t,c,M[G]),c+=B[G];}return Xt(t,c,M[256]),c+B[256]},"wblk"),Jo=new vr([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),pi=new se(0),Zo=d(function(e,t,n,r,s,i){var o=i.z||e.length,l=new se(r+o+5*(1+Math.ceil(o/7e3))+s),u=l.subarray(r,l.length-s),a=i.l,c=(i.r||0)&7;if(t){c&&(u[0]=i.r>>3);for(var f=Jo[t-1],h=f>>13,p=f&8191,_=(1<<n)-1,m=i.p||new Ne(32768),g=i.h||new Ne(_+1),v=Math.ceil(n/3),D=2*v,y=d(function(sr){return (e[sr]^e[sr+1]<<v^e[sr+2]<<D)&_},"hsh"),w=new vr(25e3),E=new Ne(288),b=new Ne(32),A=0,N=0,x=i.i||0,C=0,P=i.w||0,S=0;x+2<o;++x){var $=y(x),O=x&32767,T=g[$];if(m[O]=T,g[$]=O,P<=x){var M=o-x;if((A>7e3||C>24576)&&(M>423||!a)){c=oi(e,u,0,w,E,b,N,C,S,x-S,c),C=A=N=0,S=x;for(var B=0;B<286;++B)E[B]=0;for(var B=0;B<30;++B)b[B]=0;}var U=2,R=0,q=p,Q=O-T&32767;if(M>2&&$==y(x-Q))for(var te=Math.min(h,M)-1,J=Math.min(32767,x),K=Math.min(258,M);Q<=J&&--q&&O!=T;){if(e[x+U]==e[x+U-Q]){for(var G=0;G<K&&e[x+G]==e[x+G-Q];++G);if(G>U){if(U=G,R=Q,G>te)break;for(var ye=Math.min(Q,G-2),qe=0,B=0;B<ye;++B){var gt=x-Q+B&32767,Nn=m[gt],xn=gt-Nn&32767;xn>qe&&(qe=xn,T=gt);}}}O=T,T=m[O],Q+=O-T&32767;}if(R){w[C++]=268435456|pr[U]<<18|ii[R];var Gt=pr[U]&31,Yt=ii[R]&31;N+=kn[Gt]+Sn[Yt],++E[257+Gt],++b[Yt],P=x+U,++A;}else w[C++]=e[x],++E[e[x]];}}for(x=Math.max(x,P);x<o;++x)w[C++]=e[x],++E[e[x]];c=oi(e,u,a,w,E,b,N,C,S,x-S,c),a||(i.r=c&7|u[c/8|0]<<3,c-=7,i.h=g,i.p=m,i.i=x,i.w=P);}else {for(var x=i.w||0;x<o+a;x+=65535){var wt=x+65535;wt>=o&&(u[c/8|0]=a,wt=o),c=hi(u,c+1,e.subarray(x,wt));}i.i=o;}return Zt(l,0,r+yr(c)+s)},"dflt"),Ko=(function(){for(var e=new Int32Array(256),t=0;t<256;++t){for(var n=t,r=9;--r;)n=(n&1&&-306674912)^n>>>1;e[t]=n;}return e})(),ea=d(function(){var e=-1;return {p:d(function(t){for(var n=e,r=0;r<t.length;++r)n=Ko[n&255^t[r]]^n>>>8;e=n;},"p"),d:d(function(){return ~e},"d")}},"crc");var ta=d(function(e,t,n,r,s){if(!s&&(s={l:1},t.dictionary)){var i=t.dictionary.subarray(-32768),o=new se(i.length+e.length);o.set(i),o.set(e,i.length),e=o,s.w=i.length;}return Zo(e,t.level==null?6:t.level,t.mem==null?s.l?Math.ceil(Math.max(8,Math.min(13,Math.log(e.length)))*1.5):20:12+t.mem,n,r,s)},"dopt"),mi=d(function(e,t){var n={};for(var r in e)n[r]=e[r];for(var r in t)n[r]=t[r];return n},"mrg");var Be=d(function(e,t){return e[t]|e[t+1]<<8},"b2"),Ce=d(function(e,t){return (e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0},"b4"),dr=d(function(e,t){return Ce(e,t)+Ce(e,t+4)*4294967296},"b8"),ce=d(function(e,t,n){for(;n;++t)e[t]=n,n>>>=8;},"wbytes");function na(e,t){return ta(e,t||{},0,0)}d(na,"deflateSync");function ra(e,t){return Qo(e,{i:2},t&&t.out,t&&t.dictionary)}d(ra,"inflateSync");var _i=d(function(e,t,n,r){for(var s in e){var i=e[s],o=t+s,l=r;Array.isArray(i)&&(l=mi(r,i[1]),i=i[0]),ArrayBuffer.isView(i)?n[o]=[i,l]:(n[o+="/"]=[new se(0),l],_i(i,o,n,r));}},"fltn"),ai=typeof TextEncoder<"u"&&new TextEncoder,gr=typeof TextDecoder<"u"&&new TextDecoder,ia=0;try{gr.decode(pi,{stream:!0}),ia=1;}catch{}var sa=d(function(e){for(var t="",n=0;;){var r=e[n++],s=(r>127)+(r>223)+(r>239);if(n+s>e.length)return {s:t,r:Zt(e,n-1)};s?s==3?(r=((r&15)<<18|(e[n++]&63)<<12|(e[n++]&63)<<6|e[n++]&63)-65536,t+=String.fromCharCode(55296|r>>10,56320|r&1023)):s&1?t+=String.fromCharCode((r&31)<<6|e[n++]&63):t+=String.fromCharCode((r&15)<<12|(e[n++]&63)<<6|e[n++]&63):t+=String.fromCharCode(r);}},"dutf8");function Tn(e,t){if(t){for(var n=new se(e.length),r=0;r<e.length;++r)n[r]=e.charCodeAt(r);return n}if(ai)return ai.encode(e);for(var s=e.length,i=new se(e.length+(e.length>>1)),o=0,l=d(function(c){i[o++]=c;},"w"),r=0;r<s;++r){if(o+5>i.length){var u=new se(o+8+(s-r<<1));u.set(i),i=u;}var a=e.charCodeAt(r);a<128||t?l(a):a<2048?(l(192|a>>6),l(128|a&63)):a>55295&&a<57344?(a=65536+(a&1047552)|e.charCodeAt(++r)&1023,l(240|a>>18),l(128|a>>12&63),l(128|a>>6&63),l(128|a&63)):(l(224|a>>12),l(128|a>>6&63),l(128|a&63));}return Zt(i,0,o)}d(Tn,"strToU8");function yt(e,t){if(t){for(var n="",r=0;r<e.length;r+=16384)n+=String.fromCharCode.apply(null,e.subarray(r,r+16384));return n}else {if(gr)return gr.decode(e);var s=sa(e),i=s.s,n=s.r;return n.length&&pe(8),i}}d(yt,"strFromU8");var oa=d(function(e,t){return t+30+Be(e,t+26)+Be(e,t+28)},"slzh"),aa=d(function(e,t,n){var r=Be(e,t+28),s=Be(e,t+30),i=yt(e.subarray(t+46,t+46+r),!(Be(e,t+8)&2048)),o=t+46+r,l=ua(e,o,s,n,Ce(e,t+20),Ce(e,t+24),Ce(e,t+42)),u=l[0],a=l[1],c=l[2];return [Be(e,t+10),u,a,i,o+s+Be(e,t+32),c]},"zh"),ua=d(function(e,t,n,r,s,i,o){var l=s==4294967295,u=i==4294967295,a=o==4294967295,c=t+n,f=l+u+a;if(r&&f){for(;t+4<c;t+=4+Be(e,t+2))if(Be(e,t)==1)return [l?dr(e,t+4+8*u):s,u?dr(e,t+4):i,a?dr(e,t+4+8*(u+l)):o,1];r<2&&pe(13);}return [s,i,o,0]},"z64hs"),wr=d(function(e){var t=0;if(e)for(var n in e){var r=e[n].length;r>65535&&pe(9),t+=r+4;}return t},"exfl"),ui=d(function(e,t,n,r,s,i,o,l){var u=r.length,a=n.extra,c=l&&l.length,f=wr(a);ce(e,t,o!=null?33639248:67324752),t+=4,o!=null&&(e[t++]=20,e[t++]=n.os),e[t]=20,t+=2,e[t++]=n.flag<<1|(i<0&&8),e[t++]=s&&8,e[t++]=n.compression&255,e[t++]=n.compression>>8;var h=new Date(n.mtime==null?Date.now():n.mtime),p=h.getFullYear()-1980;if((p<0||p>119)&&pe(10),ce(e,t,p<<25|h.getMonth()+1<<21|h.getDate()<<16|h.getHours()<<11|h.getMinutes()<<5|h.getSeconds()>>1),t+=4,i!=-1&&(ce(e,t,n.crc),ce(e,t+4,i<0?-i-2:i),ce(e,t+8,n.size)),ce(e,t+12,u),ce(e,t+14,f),t+=16,o!=null&&(ce(e,t,c),ce(e,t+6,n.attrs),ce(e,t+10,o),t+=14),e.set(r,t),t+=u,f)for(var _ in a){var m=a[_],g=m.length;ce(e,t,+_),ce(e,t+2,g),e.set(m,t+4),t+=4+g;}return c&&(e.set(l,t),t+=c),t},"wzh"),la=d(function(e,t,n,r,s){ce(e,t,101010256),ce(e,t+8,n),ce(e,t+10,n),ce(e,t+12,r),ce(e,t+16,s);},"wzf");function gi(e,t){t||(t={});var n={},r=[];_i(e,"",n,t);var s=0,i=0;for(var o in n){var l=n[o],u=l[0],a=l[1],c=a.level==0?0:8,f=Tn(o),h=f.length,p=a.comment,_=p&&Tn(p),m=_&&_.length,g=wr(a.extra);h>65535&&pe(11);var v=c?na(u,a):u,D=v.length,y=ea();y.p(u),r.push(mi(a,{size:u.length,crc:y.d(),c:v,f,m:_,u:h!=o.length||_&&p.length!=m,o:s,compression:c})),s+=30+h+g+D,i+=76+2*(h+g)+(m||0)+D;}for(var w=new se(i+22),E=s,b=i-s,A=0;A<r.length;++A){var f=r[A];ui(w,f.o,f,f.f,f.u,f.c.length);var N=30+f.f.length+wr(f.extra);w.set(f.c,f.o+N),ui(w,s,f,f.f,f.u,f.c.length,f.o,f.m),s+=16+N+(f.m?f.m.length:0);}return la(w,s,r.length,b,E),w}d(gi,"zipSync");function In(e,t){for(var n={},r=e.length-22;Ce(e,r)!=101010256;--r)(!r||e.length-r>65558)&&pe(13);var s=Be(e,r+8);if(!s)return {};var i=Ce(e,r+16),o=Ce(e,r-20)==117853008;if(o){var l=Ce(e,r-12);o=Ce(e,l)==101075792,o&&(s=Ce(e,l+32),i=Ce(e,l+48));}for(var u=t&&t.filter,a=0;a<s;++a){var c=aa(e,i,o),f=c[0],h=c[1],p=c[2],_=c[3],m=c[4],g=c[5],v=oa(e,g);i=m,(!u||u({name:_,size:h,originalSize:p,compression:f}))&&(f?f==8?n[_]=ra(e.subarray(v,v+h),{out:new se(p)}):pe(14,"unknown compression type "+f):n[_]=Zt(e,v,v+h));}return n}d(In,"unzipSync");var tr=ar(xs());var ro=ar(Cs());function F(e,t){for(let n=0;n<e.childNodes.length;n++){let r=e.childNodes[n];if(r.nodeType===1&&r.tagName===t)return r}return null}d(F,"findChild");function el(e,t){let n=[];for(let r=0;r<e.childNodes.length;r++){let s=e.childNodes[r];s.nodeType===1&&s.tagName===t&&n.push(s);}return n}d(el,"findChildren");function I(e,t){return Array.from(e.getElementsByTagName(t))}d(I,"findAllDescendants");function Kn(e){return e.startsWith("\uFEFF")&&(e=e.slice(1)),new tr.DOMParser().parseFromString(e,"text/xml")}d(Kn,"parseXml");function Ts(e){let t=new tr.XMLSerializer().serializeToString(e),r=/<([a-zA-Z0-9_:]+)(\s+[^>]+?)(>|\/>)/.exec(t);if(r&&!r[1].startsWith("?")){let s=r.index,i=t.substring(0,s);if(!i.includes("<")||i.trim().startsWith("<?xml")&&(i.match(/</g)||[]).length===1){let l=r[0],u=`<${r[1]}`,a=r[2],c=r[3],f=/([a-zA-Z0-9_:]+)\s*=\s*(["'])(.*?)\2/g,h=[],p;for(;(p=f.exec(a))!==null;)h.push(p[0].trim());h.sort((m,g)=>{let v=m.split("=")[0].trim(),D=g.split("=")[0].trim(),y=v.startsWith("xmlns"),w=D.startsWith("xmlns");return y&&!w?-1:!y&&w?1:v<D?-1:v>D?1:0});let _=h.length>0?`${u} ${h.join(" ")}${c}`:`${u}${c}`;t=t.substring(0,s)+_+t.substring(s+l.length);}}return t}d(Ts,"serializeXml");var Jn=class{static{d(this,"Relationship");}constructor(e,t,n,r){this.id=e,this.type=t,this.target=n,this.isExternal=r;}id;type;target;isExternal},qs=class{static{d(this,"Part");}constructor(e,t,n,r){this.partname=e,this.blob=t,this.contentType=r,this._element=n;}partname;blob;contentType;rels=new Map;_element;package;addRelationship(e,t,n,r=false){if(this.rels.set(e,new Jn(e,t,n,r)),this.partname.endsWith(".rels")){let s=this._element.ownerDocument;if(s){let i=s.createElementNS("http://schemas.openxmlformats.org/package/2006/relationships","Relationship");i.setAttribute("Id",e),i.setAttribute("Type",t),i.setAttribute("Target",n),r&&i.setAttribute("TargetMode","External"),this._element.appendChild(i);}}}},tl=class{static{d(this,"DocxPackage");}constructor(e){this.unzipped=e;}unzipped;parts=[];mainDocumentPart;getPartByPath(e){let t=e.startsWith("/")?e.substring(1):e;return this.parts.find(n=>n.partname===t||n.partname==="/"+t)}nextPartname(e){let t=1;for(;;){let n=e.replace("%d",t===1?"":t.toString());if(!this.getPartByPath(n))return n;t++;}}addPart(e,t,n){let r=Kn(n),s=new qs(e,n,r.documentElement,t);s.package=this,this.parts.push(s);let i=this.getPartByPath("[Content_Types].xml");if(i){let o=i._element.ownerDocument;if(o){let l=o.createElement("Override");l.setAttribute("PartName",e),l.setAttribute("ContentType",t),i._element.appendChild(l);}}return s}getOrCreateRelsPart(e){let t=e.split("/"),n=t.pop(),r=t.join("/")+"/_rels/"+n+".rels",s=this.getPartByPath(r);return s||(s=this.addPart(r,"application/vnd.openxmlformats-package.relationships+xml",`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
15
|
+
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"></Relationships>`)),s}},mt=class js{static{d(this,"_DocumentObject");}constructor(t,n){this.pkg=t,this.part=n;}pkg;part;settings={oddAndEvenPagesHeaderFooter:false};sections=[];get element(){return F(this.part._element,"w:body")||this.part._element}static async load(t){let n=t instanceof Uint8Array?t:new Uint8Array(t),r=In(n),s=new tl(r),i=r["[Content_Types].xml"],o={};if(i){let a=Kn(yt(i)),c=I(a.documentElement,"Override");for(let f of c)o[f.getAttribute("PartName")||""]=f.getAttribute("ContentType")||"";}for(let[a,c]of Object.entries(r))if(a.endsWith(".xml")||a.endsWith(".rels")){let f=yt(c),h=Kn(f),p=o["/"+a]||"application/xml",_=new qs("/"+a,f,h.documentElement,p);_.package=s,s.parts.push(_);}let l=s.getPartByPath("word/document.xml");if(!l)throw new Error("Invalid DOCX: Missing word/document.xml");s.mainDocumentPart=l;let u=s.getPartByPath("word/_rels/document.xml.rels");if(u){let a=I(u._element,"Relationship");for(let c of a){let f=c.getAttribute("Id"),h=c.getAttribute("Target"),p=c.getAttribute("Type"),_=c.getAttribute("TargetMode");f&&h&&p&&l.rels.set(f,new Jn(f,p,h,_==="External"));}}return new js(s,l)}relateTo(t,n){let r=1;for(;this.part.rels.has(`rId${r}`);)r++;let s=`rId${r}`,i=t.partname.split("/").pop();this.part.rels.set(s,new Jn(s,n,i,false)),this.pkg.getOrCreateRelsPart(this.part.partname).addRelationship(s,n,i,false);}relateToExternal(t,n){let r=1;for(;this.part.rels.has(`rId${r}`);)r++;let s=`rId${r}`;return this.part.rels.set(s,new Jn(s,n,t,true)),this.pkg.getOrCreateRelsPart(this.part.partname).addRelationship(s,n,t,true),s}async save(){for(let t of this.pkg.parts){let n=Ts(t._element.ownerDocument||t._element);n.includes("w16du:")&&!n.includes("xmlns:w16du=")&&(t._element.setAttribute("xmlns:w16du","http://schemas.microsoft.com/office/word/2023/wordml/word16du"),n=Ts(t._element.ownerDocument||t._element)),n.startsWith("<?xml")||(n=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
16
|
+
`+n),this.pkg.unzipped[t.partname.substring(1)]=Tn(n);}return Buffer.from(gi(this.pkg.unzipped))}},ve=class{static{d(this,"Paragraph");}constructor(e,t){this._element=e,this._parent=t;}_element;_parent;get text(){let e="",t=this._element.getElementsByTagName("w:t");for(let n=0;n<t.length;n++)e+=t[n].textContent||"";return e}},it=class{static{d(this,"Run");}constructor(e,t){this._element=e,this._parent=t;}_element;_parent},nl=class{static{d(this,"Cell");}constructor(e,t){this._element=e,this._parent=t;}_element;_parent},rl=class{static{d(this,"Row");}constructor(e,t){this._element=e,this._parent=t;let n=this._element.getElementsByTagName("w:tc");for(let r=0;r<n.length;r++)this.cells.push(new nl(n[r],this));}_element;_parent;cells=[]},st=class{static{d(this,"Table");}constructor(e,t){this._element=e,this._parent=t;let n=this._element.getElementsByTagName("w:tr");for(let r=0;r<n.length;r++)this.rows.push(new rl(n[r],this));}_element;_parent;rows=[]},ks=class{static{d(this,"NotesPart");}constructor(e,t){this.part=e,this.note_type=t,this._element=e._element;}part;note_type;_element},il=class{static{d(this,"FootnoteItem");}constructor(e,t,n){this._element=e,this._parent=t,this.note_type=n,this.id=e.getAttribute("w:id")||"",this.part=t.part;}_element;_parent;note_type;id;part},ge={w:"http://schemas.openxmlformats.org/wordprocessingml/2006/main",w14:"http://schemas.microsoft.com/office/word/2010/wordml",w15:"http://schemas.microsoft.com/office/word/2012/wordml",w16cid:"http://schemas.microsoft.com/office/word/2016/wordml/cid",w16cex:"http://schemas.microsoft.com/office/word/2018/wordml/cex",mc:"http://schemas.openxmlformats.org/markup-compatibility/2006"},xe={COMMENTS:"application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml",EXTENDED:"application/vnd.openxmlformats-officedocument.wordprocessingml.commentsExtended+xml",IDS:"application/vnd.openxmlformats-officedocument.wordprocessingml.commentsIds+xml",EXTENSIBLE:"application/vnd.openxmlformats-officedocument.wordprocessingml.commentsExtensible+xml"},nt={COMMENTS:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments",EXTENDED:"http://schemas.microsoft.com/office/2011/relationships/commentsExtended",IDS:"http://schemas.microsoft.com/office/2016/09/relationships/commentsIds",EXTENSIBLE:"http://schemas.microsoft.com/office/2018/08/relationships/commentsExtensible"},jt=class{static{d(this,"CommentsManager");}constructor(e){this.doc=e;}doc;_commentsPart=null;_extendedPart=null;_idsPart=null;_extensiblePart=null;_nextId=null;get commentsPart(){return this._commentsPart||(this._commentsPart=this._getOrCreateCommentsPart(),this._ensureNamespaces()),this._commentsPart}get extendedPart(){return this._extendedPart||(this._extendedPart=this._getOrCreateExtendedPart()),this._extendedPart}get idsPart(){return this._idsPart||(this._idsPart=this._getOrCreateIdsPart()),this._idsPart}get extensiblePart(){return this._extensiblePart||(this._extensiblePart=this._getOrCreateExtensiblePart()),this._extensiblePart}get nextId(){return this._nextId===null&&(this._nextId=this._getNextCommentId()),this._nextId}set nextId(e){this._nextId=e;}_getExistingPartByType(e){return this.doc.pkg.parts.find(t=>t.contentType===e)||null}_linkPart(e,t){for(let n of this.doc.part.rels.values())if(!n.isExternal&&n.target===e.partname.split("/").pop())return e;return this.doc.relateTo(e,t),e}_getOrCreateCommentsPart(){let e=this._getExistingPartByType(xe.COMMENTS);if(e)return this._linkPart(e,nt.COMMENTS);let t=this.doc.pkg.nextPartname("/word/comments%d.xml"),n=`<w:comments xmlns:w="${ge.w}" xmlns:w14="${ge.w14}" xmlns:w15="${ge.w15}" xmlns:w16cid="${ge.w16cid}" xmlns:w16cex="${ge.w16cex}" xmlns:mc="${ge.mc}" mc:Ignorable="w14 w15 w16cid w16cex"></w:comments>`;return e=this.doc.pkg.addPart(t,xe.COMMENTS,n),this.doc.relateTo(e,nt.COMMENTS),e}_getOrCreateExtendedPart(){let e=this._getExistingPartByType(xe.EXTENDED);if(e)return this._linkPart(e,nt.EXTENDED);let t=this.doc.pkg.nextPartname("/word/commentsExtended%d.xml"),n=`<w15:commentsEx xmlns:w15="${ge.w15}"></w15:commentsEx>`;return e=this.doc.pkg.addPart(t,xe.EXTENDED,n),this.doc.relateTo(e,nt.EXTENDED),e}_getOrCreateIdsPart(){let e=this._getExistingPartByType(xe.IDS);if(e)return this._linkPart(e,nt.IDS);let t=this.doc.pkg.nextPartname("/word/commentsIds%d.xml"),n=`<w16cid:commentsIds xmlns:w16cid="${ge.w16cid}"></w16cid:commentsIds>`;return e=this.doc.pkg.addPart(t,xe.IDS,n),this.doc.relateTo(e,nt.IDS),e}_getOrCreateExtensiblePart(){let e=this._getExistingPartByType(xe.EXTENSIBLE);if(e)return this._linkPart(e,nt.EXTENSIBLE);let t=this.doc.pkg.nextPartname("/word/commentsExtensible%d.xml"),n=`<w16cex:commentsExtensible xmlns:w16cex="${ge.w16cex}"></w16cex:commentsExtensible>`;return e=this.doc.pkg.addPart(t,xe.EXTENSIBLE,n),this.doc.relateTo(e,nt.EXTENSIBLE),e}_ensureNamespaces(){let e=this._commentsPart?._element;if(!e)return;let t=[["xmlns:w",ge.w],["xmlns:w14",ge.w14],["xmlns:w15",ge.w15],["xmlns:w16cid",ge.w16cid],["xmlns:w16cex",ge.w16cex],["xmlns:mc",ge.mc]];for(let[n,r]of t)e.getAttribute(n)||e.setAttribute(n,r);}_getNextCommentId(){let e=[0],t=this._getExistingPartByType(xe.COMMENTS);if(t){let n=I(t._element,"w:comment");for(let r of n){let s=r.getAttribute("w:id");s&&e.push(parseInt(s,10)||0);}}return Math.max(...e)+1}_generateHexId(){return Math.floor(Math.random()*4294967295).toString(16).toUpperCase().padStart(8,"0")}_getInitials(e){return e?e.split(" ").filter(Boolean).map(t=>t[0]).join("").toUpperCase():""}_findParaIdForComment(e){if(!this._commentsPart)return null;for(let t of I(this._commentsPart._element,"w:comment"))if(t.getAttribute("w:id")===e)for(let n of I(t,"w:p")){let r=n.getAttribute("w14:paraId");if(r)return r}return null}_findThreadRootParaId(e){let t=this._findParaIdForComment(e),n=this._getExistingPartByType(xe.EXTENDED);if(!t||!n)return t;for(let r=0;r<n._element.childNodes.length;r++){let s=n._element.childNodes[r];if(s.nodeType===1&&s.getAttribute("w15:paraId")===t){let i=s.getAttribute("w15:paraIdParent");if(i)return i}}return t}addComment(e,t,n=null){let r=this.nextId.toString();this.nextId++;let s=new Date().toISOString().replace(/\.\d{3}Z$/,"Z"),i=this.commentsPart._element.ownerDocument,o=i.createElement("w:comment");o.setAttribute("w:id",r),o.setAttribute("w:author",e),o.setAttribute("w:date",s);let l=this._getInitials(e);l&&o.setAttribute("w:initials",l);let u=this._getExistingPartByType(xe.EXTENDED);n&&!u&&o.setAttribute("w15:p",n);let a=this._generateHexId(),c=this._generateHexId(),f=i.createElement("w:p");f.setAttribute("w14:paraId",a),f.setAttribute("w14:textId","77777777"),f.setAttribute("w:rsidR",c),f.setAttribute("w:rsidRDefault",c),f.setAttribute("w:rsidP",c);let h=i.createElement("w:pPr"),p=i.createElement("w:pStyle");p.setAttribute("w:val","CommentText"),h.appendChild(p),f.appendChild(h);let _=i.createElement("w:r"),m=i.createElement("w:rPr"),g=i.createElement("w:rStyle");g.setAttribute("w:val","CommentReference"),m.appendChild(g),_.appendChild(m),_.appendChild(i.createElement("w:annotationRef")),f.appendChild(_);let v=i.createElement("w:r"),D=i.createElement("w:t");if(D.textContent=t,v.appendChild(D),f.appendChild(v),o.appendChild(f),this.commentsPart._element.appendChild(o),this.extendedPart){let y=n?this._findThreadRootParaId(n):null,E=this.extendedPart._element.ownerDocument.createElement("w15:commentEx");E.setAttribute("w15:paraId",a),y&&E.setAttribute("w15:paraIdParent",y),E.setAttribute("w15:done","0"),this.extendedPart._element.appendChild(E);}if(this.idsPart){let w=this.idsPart._element.ownerDocument.createElement("w16cid:commentId");w.setAttribute("w16cid:paraId",a),w.setAttribute("w16cid:durableId",this._generateHexId()),this.idsPart._element.appendChild(w);}if(this.extensiblePart){let y=null;for(let w=0;w<this.idsPart._element.childNodes.length;w++){let E=this.idsPart._element.childNodes[w];if(E.nodeType===1&&E.getAttribute("w16cid:paraId")===a){y=E.getAttribute("w16cid:durableId");break}}if(y){let E=this.extensiblePart._element.ownerDocument.createElement("w16cex:commentExtensible");E.setAttribute("w16cex:durableId",y),E.setAttribute("w16cex:dateUtc",s),this.extensiblePart._element.appendChild(E);}}return r}deleteComment(e){if(!this.commentsPart)return;let t=null;for(let r of I(this.commentsPart._element,"w:comment"))if(r.getAttribute("w:id")===e){t=r;break}if(!t)return;let n=null;for(let r of I(t,"w:p")){let s=r.getAttribute("w14:paraId");if(s){n=s;break}}if(n){let r=[];if(this.extendedPart)for(let i=0;i<this.extendedPart._element.childNodes.length;i++){let o=this.extendedPart._element.childNodes[i];if(o.nodeType===1&&o.getAttribute("w15:paraIdParent")===n){let l=o.getAttribute("w15:paraId");if(l){for(let u of I(this.commentsPart._element,"w:comment"))for(let a of I(u,"w:p"))if(a.getAttribute("w14:paraId")===l){let c=u.getAttribute("w:id");c&&r.push(c);break}}}}for(let i of r)this.deleteComment(i);let s=null;if(this.idsPart){let i=[];for(let o=0;o<this.idsPart._element.childNodes.length;o++){let l=this.idsPart._element.childNodes[o];l.nodeType===1&&l.getAttribute("w16cid:paraId")===n&&(s=l.getAttribute("w16cid:durableId"),i.push(l));}i.forEach(o=>this.idsPart._element.removeChild(o));}if(this.extendedPart){let i=[];for(let o=0;o<this.extendedPart._element.childNodes.length;o++){let l=this.extendedPart._element.childNodes[o];l.nodeType===1&&l.getAttribute("w15:paraId")===n&&i.push(l);}i.forEach(o=>this.extendedPart._element.removeChild(o));}if(s&&this.extensiblePart){let i=[];for(let o=0;o<this.extensiblePart._element.childNodes.length;o++){let l=this.extensiblePart._element.childNodes[o];l.nodeType===1&&l.getAttribute("w16cex:durableId")===s&&i.push(l);}i.forEach(o=>this.extensiblePart._element.removeChild(o));}}t.parentNode&&t.parentNode.removeChild(t);}};function bn(e){({part:e.mainDocumentPart,relateTo:d(()=>{},"relateTo")});let r={},s=e.parts.find(u=>u.contentType===xe.COMMENTS);if(!s)return r;let i={},o=I(s._element,"w:comment");for(let u of o){let a=u.getAttribute("w:id");if(!a)continue;let c=u.getAttribute("w:author")||"Unknown",f=u.getAttribute("w:date")||"",h=false,p=u.getAttribute("w15:done");(p==="1"||p==="true"||p==="on")&&(h=true);let _=u.getAttribute("w15:p")||null,m=I(u,"w:p");for(let D of m){let y=D.getAttribute("w14:paraId");y&&(i[y]=a);}let g=[];for(let D of m){let y=I(D,"w:t");for(let w of y)w.textContent&&g.push(w.textContent);g.push(`
|
|
17
|
+
`);}let v=g.join("").trim();r[a]={author:c,text:v,date:f,resolved:h,parent_id:_};}let l=e.parts.find(u=>u.contentType===xe.EXTENDED);if(l){let u=l._element.childNodes;for(let a=0;a<u.length;a++){let c=u[a];if(c.nodeType!==1)continue;let f=c.getAttribute("w15:paraId"),h=c.getAttribute("w15:paraIdParent"),p=c.getAttribute("w15:done");if(f){let _=i[f];if(_&&r[_]){if(h){let m=i[h];m&&(r[_].parent_id=m);}(p==="1"||p==="true"||p==="on")&&(r[_].resolved=true);}}}}return r}d(bn,"extract_comments_data");var Ws=2e3,zt=class extends Error{static{d(this,"RegexTimeoutError");}pattern;constructor(e){super(`Regular expression exceeded the ${Ws/1e3}s matching time budget (catastrophic backtracking). Simplify the pattern \u2014 nested quantifiers like (a+)+ are the usual cause \u2014 or use a literal target instead.`),this.name="RegexTimeoutError",this.pattern=e;}};function Hs(e,t,n){try{return zs__namespace.runInNewContext(t,n,{timeout:Ws})}catch(r){throw r&&r.code==="ERR_SCRIPT_EXECUTION_TIMEOUT"?new zt(e):r}}d(Hs,"runBudgeted");function sl(e,t,n=""){let r=n.includes("g")?n:n+"g",s=new RegExp(e,r);return Hs(e,`{
|
|
18
18
|
const out = [];
|
|
19
19
|
let m;
|
|
20
20
|
while ((m = re.exec(text)) !== null) {
|
|
@@ -22,54 +22,54 @@
|
|
|
22
22
|
if (m.index === re.lastIndex) re.lastIndex++;
|
|
23
23
|
}
|
|
24
24
|
out;
|
|
25
|
-
}`,{re:
|
|
25
|
+
}`,{re:s,text:t}).map(o=>({start:o.start,end:o.end}))}d(sl,"userFindAllMatches");function ol(e,t,n=""){let r=new RegExp(e,n.replace("g","")),s=Hs(e,`{
|
|
26
26
|
const m = re.exec(text);
|
|
27
27
|
m ? { start: m.index, end: m.index + m[0].length } : null;
|
|
28
|
-
}`,{re:r,text:t});return
|
|
28
|
+
}`,{re:r,text:t});return s?{start:s.start,end:s.end}:null}d(ol,"userSearch");var al="w:p",Vs="w:r",Gs="w:t",ul="w:delText",ll="w:tab",cl="w:br",fl="w:cr",zr="w:rPr",dl="w:rPrChange",hl="w:commentReference",pl="w:footnoteReference",ml="w:endnoteReference",_l="w:fldChar",gl="w:fldCharType",wl="w:instrText",vl="w:ins",yl="w:del",rt="w:id",Ur="w:author",qr="w:date",El="w:commentRangeStart",bl="w:commentRangeEnd",Dl="w:hyperlink",Al="r:id",Nl="w:fldSimple",xl="w:instr",Cl="w:bookmarkStart",Tl="w:name",kl="w:sdt",Sl="w:smartTag",Il="w:sdtContent",Ys="w:b",Ol="w:i",Oe="w:val",Xs="w:pPr",Qs="w:pStyle",Js="w:outlineLvl",Pl="w:numPr",Ml="w:numId",Rl="w:ilvl",Bl="w:drawing",Fl="w:object",Ll="w:pict",$l="wp:docPr",Ul="v:imagedata",ql="o:title",jl=/Heading[ ]?([1-6])(?![0-9])/;function zl(e){let t=e,n=new Set;for(;t&&!n.has(t);){if(n.add(t),t.package)return t.package;if(t.pkg)return t.pkg;if(t.part&&(t.part.package||t.part.pkg))return t.part.package||t.part.pkg;t=t._parent||t.part||null;}return null}d(zl,"_resolve_package");function Dn(e){let t=e.package||e.pkg||(e.part?e.part.pkg:null);if(t&&t._adeu_style_cache)return t._adeu_style_cache;let n={},r=null,s={},i=t?.getPartByPath("word/styles.xml");if(!i){let a=[n,null];return t&&(t._adeu_style_cache=a),a}let o=I(i._element,"w:style");for(let a of o){let c=a.getAttribute("w:styleId");if(!c)continue;let f=a.getAttribute("w:type"),h=a.getAttribute("w:default")==="1"||a.getAttribute("w:default")==="true";f==="paragraph"&&h&&(r=c);let p=F(a,"w:name"),_=p?p.getAttribute("w:val"):c;_&&typeof _=="string"&&(_.toLowerCase().startsWith("heading")?_=_.replace(/^heading/i,"Heading"):_.toLowerCase()==="title"&&(_="Title"));let m=F(a,"w:basedOn"),g=m?m.getAttribute("w:val"):null,v=null,D=null,y=null,w=F(a,"w:pPr");if(w){let A=F(w,"w:outlineLvl");if(A){let x=A.getAttribute("w:val");x&&/^\d+$/.test(x)&&(v=parseInt(x,10));}let N=F(w,"w:numPr");if(N){let x=F(N,"w:numId");if(x){let P=x.getAttribute("w:val");P&&P!=="0"&&(D=P);}let C=F(N,"w:ilvl");if(C){let P=C.getAttribute("w:val");P&&/^\d+$/.test(P)&&(y=parseInt(P,10));}}}let E=null,b=F(a,"w:rPr");if(b){let A=F(b,"w:b");if(A){let N=A.getAttribute("w:val");E=N!=="0"&&N!=="false"&&N!=="off";}}s[c]={name:_,based_on:g,outline_level:v,bold:E,num_id:D,num_ilvl:y};}let l=d((a,c)=>{if(n[a])return n[a];if(c.has(a)||!s[a])return {name:a,outline_level:null,bold:false,num_id:null,num_ilvl:null};c.add(a);let f=s[a],h=f.based_on,p=f.outline_level,_=f.bold!==null?f.bold:false,m=f.num_id,g=f.num_ilvl;if(h){let D=l(h,c);p===null&&(p=D.outline_level),f.bold===null&&(_=D.bold),m===null&&(m=D.num_id??null),g===null&&(g=D.num_ilvl??null);}let v={name:f.name,outline_level:p,bold:_,num_id:m,num_ilvl:g};return n[a]=v,v},"resolve_style");for(let a in s)l(a,new Set);let u=[n,r];return t&&(t._adeu_style_cache=u),u}d(Dn,"_get_style_cache");function Wl(e){let t=zl(e);if(!t)return {};if(t._adeu_numbering_cache)return t._adeu_numbering_cache;let n={},r=null;try{let s=(t.parts||[]).find(i=>String(i.partname).endsWith("/numbering.xml"));s&&(r=s._element);}catch{r=null;}if(r){let s={};for(let i of I(r,"w:abstractNum")){let o=i.getAttribute("w:abstractNumId");if(o===null)continue;let l={};for(let u of I(i,"w:lvl")){let a=u.getAttribute("w:ilvl"),c=F(u,"w:numFmt");if(a!==null&&/^-?\d+$/.test(a)&&c){let f=c.getAttribute("w:val");f&&(l[parseInt(a,10)]=f);}}s[o]=l;}for(let i of I(r,"w:num")){let o=i.getAttribute("w:numId"),l=F(i,"w:abstractNumId");if(o===null||!l)continue;let u=l.getAttribute("w:val");u!==null&&s[u]!==void 0&&(n[o]=s[u]);}}return t._adeu_numbering_cache=n,n}d(Wl,"_get_numbering_cache");function Hl(e,t,n){let r=null;if(t!=null){let s=Wl(e)[t];if(s&&Object.keys(s).length>0&&(r=s[n]!==void 0?s[n]:null,r===null)){for(let i=n;i>=0;i--)if(s[i]!==void 0){r=s[i];break}}}return r!==null&&r!=="bullet"?"1. ":"* "}d(Hl,"get_list_marker");function Zs(e){if(!e)return null;let t=e.match(jl);return t?parseInt(t[1],10):null}d(Zs,"_detect_heading_level_from_name");function Wr(e,t,n){t||([t,n]=Dn(e._parent.part||e._parent));let r=F(e._element,Xs);if(r){let l=F(r,Js);if(l){let u=l.getAttribute(Oe);if(u&&/^\d+$/.test(u)){let a=parseInt(u,10);if(a>=0&&a<=8)return true}}}let s=n;if(r){let l=F(r,Qs);l&&(s=l.getAttribute(Oe)||n);}let i=s&&t?t[s]:null;if(i&&i.outline_level!==null&&i.outline_level>=0&&i.outline_level<=8)return true;let o=i?i.name:s;return o&&typeof o=="string"&&o.toLowerCase().startsWith("heading")&&(o=o.replace(/^heading/i,"Heading")),!!(o?.startsWith("Heading")||o==="Title"||o&&o!=="Normal"&&Zs(o)!==null)}d(Wr,"is_native_heading");function ot(e,t,n){t||([t,n]=Dn(e._parent.part||e._parent));let r=F(e._element,Xs);if(r){let c=F(r,Js);if(c){let f=c.getAttribute(Oe);if(f&&/^\d+$/.test(f)){let h=parseInt(f,10);if(h>=0&&h<=8)return "#".repeat(h+1)+" "}}}let s=n;if(r){let c=F(r,Qs);c&&(s=c.getAttribute(Oe)||n);}let i=s&&t?t[s]:null;if(i&&i.outline_level!==null&&i.outline_level>=0&&i.outline_level<=8)return "#".repeat(i.outline_level+1)+" ";let o=i?i.name:s;if(o&&typeof o=="string"&&o.toLowerCase().startsWith("heading")&&(o=o.replace(/^heading/i,"Heading")),o?.startsWith("Heading")){let c=o.replace("Heading","").trim();if(/^\d+$/.test(c))return "#".repeat(parseInt(c,10))+" "}if(o==="Title")return "# ";let l=null,u=null,a=false;if(r){let c=F(r,Pl);if(c){let f=F(c,Ml);if(f){let h=f.getAttribute(Oe);if(h==="0")a=true;else if(h){l=h;let p=F(c,Rl);if(p){let _=p.getAttribute(Oe);_!==null&&/^\d+$/.test(_)&&(u=parseInt(_,10));}}}}}if(l===null&&!a&&i){let c=i.num_id;c&&(l=c,u===null&&(u=i.num_ilvl!==void 0?i.num_ilvl:null));}if(l!==null){let c=u!==null?u:0,f=Hl(e._parent?e._parent.part||e._parent:null,l,c);return " ".repeat(c)+f}if(o&&o!=="Normal"){let c=Zs(o);if(c!==null)return "#".repeat(c)+" "}if(!o||o==="Normal"){let c=e.text.trim();if(c&&c.length<100&&c===c.toUpperCase()){let f=false;if(i?.bold)f=true;else {let h=I(e._element,Vs);for(let p of h)if(I(p,Gs).map(g=>g.textContent||"").join("").trim()){let g=F(p,zr);if(g){let v=F(g,Ys);v&&v.getAttribute(Oe)!=="0"&&v.getAttribute(Oe)!=="false"&&(f=true);}break}}if(f)return "## "}}return ""}d(ot,"get_paragraph_prefix");function Ks(e,t,n){let r=ot(e,t,n);if(!r)return false;let s=r.trimEnd();return s.length>0&&s==="#".repeat(s.length)}d(Ks,"is_heading_paragraph");function eo(e,t=null){let n="",r="",s=F(e._element,zr),i=false,o=false;if(s){let l=F(s,Ys);l&&l.getAttribute(Oe)!=="0"&&l.getAttribute(Oe)!=="false"&&(i=true);let u=F(s,Ol);u&&u.getAttribute(Oe)!=="0"&&u.getAttribute(Oe)!=="false"&&(o=true);}if(t===null){let l=e._parent;t=l instanceof ve?Wr(l):false;}return i&&!t&&(n+="**",r="**"+r),o&&(n+="_",r="_"+r),[n,r]}d(eo,"get_run_style_markers");function to(e){let t=e.trim();if(!t)return ["","",e];let n=e.length-e.trimStart().length;return [e.substring(0,n),e.substring(n,n+t.length),e.substring(n+t.length)]}d(to,"split_boundary_whitespace");function Vl(e,t,n){if(!t&&!n)return e;if(!e)return "";let r=d(i=>{let[o,l,u]=to(i);return l?`${o}${t}${l}${n}${u}`:i},"wrap");return e.includes(`
|
|
29
29
|
`)?e.split(`
|
|
30
|
-
`).map(
|
|
31
|
-
`)
|
|
32
|
-
`);}return t}d(
|
|
30
|
+
`).map(i=>i?r(i):"").join(`
|
|
31
|
+
`):r(e)}d(Vl,"apply_formatting_to_segments");function pt(e){let t="";for(let n=0;n<e._element.childNodes.length;n++){let r=e._element.childNodes[n];if(r.nodeType===1)if(r.tagName===Gs||r.tagName===ul){let s=r.textContent||"";t+=s.replace(/\t/g," ");}else r.tagName===ll?t+=" ":(r.tagName===cl||r.tagName===fl)&&(t+=`
|
|
32
|
+
`);}return t}d(pt,"get_run_text");function*at(e){let t=e._element||e.element||e;if(e.constructor.name==="NotesPart"){let n=e.note_type==="fn"?"w:footnote":"w:endnote",r=I(t,n);for(let s of r){if(s.getAttribute("w:type")==="separator"||s.getAttribute("w:type")==="continuationSeparator")continue;let i=s.getAttribute("w:id");i!==null&&/^\s*[-+]?\d+\s*$/.test(i)&&parseInt(i,10)<=0||(yield new il(s,e,e.note_type));}return}for(let n=0;n<t.childNodes.length;n++){let r=t.childNodes[n];r.nodeType===1&&(r.tagName===al?yield new ve(r,e):r.tagName==="w:tbl"&&(yield new st(r,e)));}}d(at,"iter_block_items");function*Gl(e){for(let[t]of Hr(e))yield t;}d(Gl,"iter_document_parts");function*Hr(e){let t=e.pkg.parts.filter(i=>i.contentType==="application/vnd.openxmlformats-officedocument.wordprocessingml.header+xml");for(let i of t)yield [i,"header"];yield [e,"body"];let n=e.pkg.parts.filter(i=>i.contentType==="application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml");for(let i of n)yield [i,"footer"];let r=e.pkg.getPartByPath("word/footnotes.xml"),s=e.pkg.getPartByPath("word/endnotes.xml");r&&(yield [new ks(r,"fn"),"footnotes"]),s&&(yield [new ks(s,"en"),"endnotes"]);}d(Hr,"iter_document_parts_with_kind");function Yl(e){if(!e)return false;let t=e.toUpperCase().trim().split(/\s+/);return t.length>0&&(t[0]==="PAGE"||t[0]==="NUMPAGES")}d(Yl,"_is_page_instr");function no(e){return e?e.part?e.part:e.pkg&&e.pkg.mainDocumentPart?e.pkg.mainDocumentPart:e._parent?no(e._parent):null:null}d(no,"_get_part");function*nr(e){let t=false,n="",r=false;function*s(o){let l=null,u=F(o,zr);if(u){let a=F(u,dl);a&&(l=a.getAttribute(rt),yield {type:"fmt_start",id:l,author:a.getAttribute(Ur)||void 0,date:a.getAttribute(qr)||void 0});}for(let a=0;a<o.childNodes.length;a++){let c=o.childNodes[a];if(c.nodeType!==1)continue;let f=c.tagName;if(f===Bl||f===Fl){let h=I(c,$l)[0]||null,p="",_="0";h&&(p=h.getAttribute("descr")||h.getAttribute("title")||"",_=h.getAttribute("id")||"0"),yield {type:"image",id:_,date:p};}else if(f===Ll){let h=I(c,Ul)[0]||null;h&&(yield {type:"image",id:"vml",date:h.getAttribute(ql)||""});}else if(f===hl){let h=c.getAttribute(rt);h&&(yield {type:"ref",id:h});}else if(f===pl){let h=c.getAttribute(rt);h&&(yield {type:"footnote",id:h});}else if(f===ml){let h=c.getAttribute(rt);h&&(yield {type:"endnote",id:h});}else if(f===_l){let h=c.getAttribute(gl);if(h==="begin")t=true,n="";else if(h==="separate")if(Yl(n))r=true;else {let p=n.trim().split(/\s+/);p.length>1&&p[0]==="REF"&&(yield {type:"xref_start",id:p[1]});}else if(h==="end"){if(!r){let p=n.trim().split(/\s+/);p.length>1&&p[0]==="REF"&&(yield {type:"xref_end",id:p[1]});}t=false,n="",r=false;}}else f===wl&&t&&!r&&(n+=c.textContent||"");}r||(yield new it(o,e)),l!==null&&(yield {type:"fmt_end",id:l});}d(s,"process_run_element");function*i(o){for(let l=0;l<o.childNodes.length;l++){let u=o.childNodes[l];if(u.nodeType!==1)continue;let a=u.tagName;if(a===Vs)yield*s(u);else if(a===vl){let c=u.getAttribute(rt);yield {type:"ins_start",id:c,author:u.getAttribute(Ur)||void 0,date:u.getAttribute(qr)||void 0},yield*i(u),yield {type:"ins_end",id:c};}else if(a===yl){let c=u.getAttribute(rt);yield {type:"del_start",id:c,author:u.getAttribute(Ur)||void 0,date:u.getAttribute(qr)||void 0},yield*i(u),yield {type:"del_end",id:c};}else if(a===El)yield {type:"start",id:u.getAttribute(rt)};else if(a===bl)yield {type:"end",id:u.getAttribute(rt)};else if(a===Dl){let c=u.getAttribute(Al)||u.getAttribute("id"),f="",h=no(e._parent);if(c&&h){let p=h.rels.get(c);p&&p.isExternal&&(f=p.target);}f&&(yield {type:"hyperlink_start",id:c,date:f}),yield*i(u),f&&(yield {type:"hyperlink_end",id:c,date:f});}else if(a===Nl){let f=(u.getAttribute(xl)||"").trim().split(/\s+/),h=f.length>1&&f[0]==="REF"?f[1]:"";h&&(yield {type:"xref_start",id:h}),yield*i(u),h&&(yield {type:"xref_end",id:h});}else if(a===Cl){let c=u.getAttribute(Tl);c&&(!c.startsWith("_")||c.startsWith("_Ref"))&&(yield {type:"bookmark",id:c});}else (a===kl||a===Sl||a===Il)&&(yield*i(u));}}d(i,"traverse_node"),yield*i(e._element);}d(nr,"iter_paragraph_content");var Xl=new Set(["**","__","*","_"]),Ye=class{static{d(this,"DocumentMapper");}doc;clean_view;original_view;comments_map;full_text="";spans=[];appendix_start_index=-1;part_ranges=[];_current_part_index=0;_text_chunks=[];_plain_projection=null;constructor(e,t=false,n=false){this.doc=e,this.clean_view=t,this.original_view=n,this.comments_map=bn(e.pkg),this._build_map();}_build_map(){let e=0;this.spans=[],this._text_chunks=[],this.full_text="",this._plain_projection=null,this.part_ranges=[],this._current_part_index=0;let t=0;for(let[n,r]of Hr(this.doc)){this._current_part_index=t;let s=e;e=this._map_blocks(n,e),this.part_ranges.push([s,e,r]),this.spans.length>0&&this.spans[this.spans.length-1].text!==`
|
|
33
33
|
|
|
34
34
|
`&&(this._add_virtual_text(`
|
|
35
35
|
|
|
36
36
|
`,e,null),e+=2),t++;}for(;this.spans.length>0&&this.spans[this.spans.length-1].text===`
|
|
37
37
|
|
|
38
|
-
`;)this.spans.pop(),this._text_chunks.pop();this.full_text=this._text_chunks.join(""),this.appendix_start_index=-1;}_nonempty_part_ranges(){let e=[];for(let t=0;t<this.part_ranges.length;t++){let[n,r,
|
|
38
|
+
`;)this.spans.pop(),this._text_chunks.pop();this.full_text=this._text_chunks.join(""),this.appendix_start_index=-1;}_nonempty_part_ranges(){let e=[];for(let t=0;t<this.part_ranges.length;t++){let[n,r,s]=this.part_ranges[t];r>n&&e.push([t,n,r,s]);}return e}part_kind_of(e){return e>=0&&e<this.part_ranges.length?this.part_ranges[e][2]:null}part_kind_at(e){for(let[,t,n,r]of this._nonempty_part_ranges())if(t<=e&&e<=n)return r;return null}part_boundary_at(e){let t=this._nonempty_part_ranges();for(let n=1;n<t.length;n++){let[r,,s]=t[n-1],[i,o]=t[n];if(s<e&&e<=o)return [r,i]}return null}_map_blocks(e,t){let n=t,r=e.constructor.name,s=e.part||e,[i,o]=Dn(s);if(r==="NotesPart"){let c=`---
|
|
39
39
|
${e.note_type==="fn"?"## Footnotes":"## Endnotes"}`;this._add_virtual_text(c,n,null),n+=c.length,this._add_virtual_text(`
|
|
40
40
|
|
|
41
|
-
`,n,null),n+=2;}let l=true,
|
|
41
|
+
`,n,null),n+=2;}let l=true,u=null;for(let a of at(e))if(a.constructor.name==="FootnoteItem")n=this._map_blocks(a,n);else if(a instanceof ve){if(!l){let h=u instanceof ve?u:null;this._add_virtual_text(`
|
|
42
42
|
|
|
43
|
-
`,n,h),n+=2;}let f=ot(
|
|
43
|
+
`,n,h),n+=2;}let f=ot(a,i,o);l&&r==="FootnoteItem"&&(f=`[^${e.note_type}-${e.id}]: `+f),f&&(this._add_virtual_text(f,n,a),n+=f.length),n=this._map_paragraph_content(a,n,i,o),l=false,u=a;}else if(a instanceof st){if(!l){let f=u instanceof ve?u:null;this._add_virtual_text(`
|
|
44
44
|
|
|
45
|
-
`,n,f),n+=2;}n=this._map_table(
|
|
46
|
-
`,n,null),n+=1),l&&!this.clean_view&&!this.original_view?(this._add_virtual_text("{++ ",n,null),n+=4):
|
|
47
|
-
`)&&(
|
|
48
|
-
`);for(let
|
|
49
|
-
`,
|
|
50
|
-
`)}_add_virtual_text(e,t,n,r=null,
|
|
45
|
+
`,n,f),n+=2;}n=this._map_table(a,n),l=false,u=a;}return n}_map_table(e,t){let n=t,r=0;for(let s of e.rows){let i=s._element,o=F(i,"w:trPr"),l=o?F(o,"w:ins"):null,u=o?F(o,"w:del"):null;if(this.clean_view&&u||this.original_view&&l)continue;r>0&&(this._add_virtual_text(`
|
|
46
|
+
`,n,null),n+=1),l&&!this.clean_view&&!this.original_view?(this._add_virtual_text("{++ ",n,null),n+=4):u&&!this.clean_view&&!this.original_view&&(this._add_virtual_text("{-- ",n,null),n+=4);let a=new Set,c=0;for(let f of s.cells){if(a.has(f))continue;a.add(f),c>0&&(this._add_virtual_text(" | ",n,null),n+=3);if(n=this._map_blocks(f,n),!this.clean_view&&!this.original_view){let p=f._element.getElementsByTagName("w:p")[0],_=p?p.getAttribute("w14:paraId"):null;if(_&&p){let m=new ve(p,f);this._add_virtual_text("",n,m);let g=`{#cell:${_}}`;this._add_virtual_text(g,n,m),n+=g.length;}}c+=1;}if(l&&!this.clean_view&&!this.original_view){let f=` |Chg:${l.getAttribute("w:id")}++}`;this._add_virtual_text(f,n,null),n+=f.length;}else if(u&&!this.clean_view&&!this.original_view){let f=` |Chg:${u.getAttribute("w:id")}--}`;this._add_virtual_text(f,n,null),n+=f.length;}r+=1;}return n}_strip_markdown_formatting(e){let t=e;return t=t.replace(/^#+\s*/gm,""),t=t.replace(/\*\*(\w[\w\s]*\w|\w{2,})\*\*/g,"$1"),t=t.replace(/__(\w[\w\s]*\w|\w{2,})__/g,"$1"),t=t.replace(/(?<!\w)_(\w[\w\s]*\w|\w{2,})_(?!\w)/g,"$1"),t=t.replace(/(?<!\w)\*(\w[\w\s]*\w|\w{2,})\*(?!\w)/g,"$1"),t}_map_paragraph_content(e,t,n,r){let s=t,i={start:s,end:s,text:"",run:null,paragraph:e,part_index:this._current_part_index};this.spans.push(i);let o=new Set,l={},u={},a={},c=[],f=["",""],h=["",""],p=null,_=[],m=d(()=>{if(_.length===0)return;let[w,E]=f;w&&(this._add_virtual_text(w,s,e),s+=w.length);for(let[b,A,N,x,C,P,S]of _){if(b==="virtual")this._add_virtual_text(A,s,e,p);else {let $={start:s,end:s+A.length,text:A,run:N,paragraph:e,ins_id:C||void 0,del_id:P||void 0,hyperlink_id:p||void 0,comment_ids:S.length>0?S:void 0,part_index:this._current_part_index,run_offset:x};this.spans.push($),this._text_chunks.push(A);}s+=A.length;}E&&(this._add_virtual_text(E,s,e),s+=E.length),_=[];},"flush_pending_runs"),g=Array.from(nr(e)),v=Ks(e,n,r),D=Wr(e,n,r),y=v;for(let w=0;w<g.length;w++){let E=g[w];if(E instanceof it){let[b,A]=eo(E,D),N=[],x=pt(E);if(y){if(x===""||/^\s*$/.test(x))continue;y=false;}let C=0,P=d(T=>{let[M,B,U]=to(T);if(!B){N.push(["real",T,E,C]),C+=T.length;return}M&&(N.push(["real",M,E,C]),C+=M.length),b&&N.push(["virtual",b,null,0]),N.push(["real",B,E,C]),C+=B.length,A&&N.push(["virtual",A,null,0]),U&&(N.push(["real",U,E,C]),C+=U.length);},"append_wrapped");if(x.includes(`
|
|
47
|
+
`)&&(b||A)){let T=x.split(`
|
|
48
|
+
`);for(let M=0;M<T.length;M++)M>0&&(N.push(["real",`
|
|
49
|
+
`,E,C]),C+=1),T[M]&&P(T[M]);}else (b||A)&&x?P(x):(b&&N.push(["virtual",b,null,0]),x&&N.push(["real",x,E,0]),A&&N.push(["virtual",A,null,0]));this.clean_view&&Object.keys(u).length>0,this.original_view&&Object.keys(l).length>0;let S=N.map(T=>T[1]).join(""),$=Object.keys(l).pop()||null,O=Object.keys(u).pop()||null;if(S&&!(this.clean_view&&O)&&!(this.original_view&&$)){let T=this.clean_view||this.original_view?["",""]:this._get_wrappers($,O,o,a),M=[b,A];if(_.length>0&&T[0]===f[0]&&T[1]===f[1]){let B=false;M[0]===h[0]&&M[1]===h[1]&&h[0]!==""&&_[_.length-1][0]==="virtual"&&_[_.length-1][1]===h[1]&&(_.pop(),B=true);let U=Array.from(o);for(let[R,q,Q,te]of N){if(B&&R==="virtual"&&q===M[0]){B=false;continue}_.push([R,q,Q,te,$,O,U]);}h=M;}else {m(),f=T,h=M;let B=Array.from(o);for(let[U,R,q,Q]of N)_.push([U,R,q,Q,$,O,B]);}}if(!this.clean_view&&!this.original_view){(Object.keys(l).length>0||Object.keys(u).length>0||o.size>0||Object.keys(a).length>0)&&c.push([{...l},{...u},new Set(o),{...a}]);let M=false;if($!==null||O!==null||Object.keys(a).length>0||o.size>0){let U=w+1,R=false,q=Object.keys(l).length,Q=Object.keys(u).length,te=Object.keys(a).length,J=new Set(o);for(;U<g.length;){let K=g[U];if(K instanceof it){if(!pt(K)){U++;continue}(q>0||Q>0||te>0||J.size>0)&&(R=true);break}else {let G=K;G.type==="ins_start"?q++:G.type==="ins_end"?q=Math.max(0,q-1):G.type==="del_start"?Q++:G.type==="del_end"?Q=Math.max(0,Q-1):G.type==="fmt_start"?te++:G.type==="fmt_end"?te=Math.max(0,te-1):G.type==="start"?J.add(G.id):G.type==="end"&&J.delete(G.id);}U++;}R&&(M=true);}if(!M&&c.length>0){let U=this._build_merged_meta_block(c);if(U){m(),f=["",""],h=["",""];let R=`{>>${U}<<}`;this._add_virtual_text(R,s,e),s+=R.length;}c=[];}}}else {let b=E;if(y=false,m(),f=["",""],h=["",""],b.type==="start")o.add(b.id);else if(b.type==="end")o.delete(b.id);else if(b.type==="ins_start")l[b.id]=b;else if(b.type==="ins_end")delete l[b.id];else if(b.type==="del_start")u[b.id]=b;else if(b.type==="del_end")delete u[b.id];else if(b.type==="fmt_start")a[b.id]=b;else if(b.type==="fmt_end")delete a[b.id];else if(b.type==="image"){if(!(this.clean_view&&Object.keys(u).length>0||this.original_view&&Object.keys(l).length>0)){let x=`![${(b.date||"image").replace(/\]/g,")").replace(/\n/g," ")}](docx-image:${b.id})`;this._add_virtual_text(x,s,e,null,true),s+=x.length;}}else if(b.type==="footnote"||b.type==="endnote"){m(),f=["",""],h=["",""];let N=`[^${b.type==="footnote"?"fn":"en"}-${b.id}]`;this._add_virtual_text(N,s,e),s+=N.length;}else if(b.type==="hyperlink_start")m(),f=["",""],h=["",""],this._add_virtual_text("[",s,e,b.id),s+=1,p=b.id;else if(b.type==="hyperlink_end"){m(),f=["",""],h=["",""];let A=`](${b.date})`;this._add_virtual_text(A,s,e,b.id),s+=A.length,p=null;}else if(b.type==="xref_start")m(),f=["",""],h=["",""],this._add_virtual_text("[~",s,e),s+=2;else if(b.type==="xref_end"){m(),f=["",""],h=["",""];let A=`~](#${b.id})`;this._add_virtual_text(A,s,e),s+=A.length;}else if(b.type==="bookmark"){m(),f=["",""],h=["",""];let A=`{#${b.id}}`;this._add_virtual_text(A,s,e),s+=A.length;}}}if(m(),c.length>0){let w=this._build_merged_meta_block(c);if(w){let E=`{>>${w}<<}`;this._add_virtual_text(E,s,e),s+=E.length;}}return s}_get_wrappers(e,t,n,r){return t?["{--","--}"]:e?["{++","++}"]:n.size>0||Object.keys(r).length>0?["{==","==}"]:["",""]}_build_merged_meta_block(e){let t=[],n=[],r=new Set;for(let[s,i,o,l]of e){for(let[a,c]of Object.entries(s)){let f=`Chg:${a}`;if(!r.has(f)){let h=c.author||"Unknown";t.push(`[${f} insert] ${h}`),r.add(f);}}for(let[a,c]of Object.entries(i)){let f=`Chg:${a}`;if(!r.has(f)){let h=c.author||"Unknown";t.push(`[${f} delete] ${h}`),r.add(f);}}for(let[a,c]of Object.entries(l)){let f=`Chg:${a}`;if(!r.has(f)){let h=c.author||"Unknown";t.push(`[${f} format] ${h}`),r.add(f);}}let u=Array.from(o).sort();for(let a of u){if(!this.comments_map[a])continue;let c=`Com:${a}`;if(!r.has(c)){let f=this.comments_map[a],h=`[${c}] ${f.author}`;f.date&&(h+=` @ ${f.date}`),f.resolved&&(h+="(RESOLVED)"),n.push(`${h}: ${f.text}`),r.add(c);}}}return [...t,...n].join(`
|
|
50
|
+
`)}_add_virtual_text(e,t,n,r=null,s=false){let i={start:t,end:t+e.length,text:e,run:null,paragraph:n,hyperlink_id:r||void 0,part_index:this._current_part_index,is_image_marker:s||void 0};this.spans.push(i),this._text_chunks.push(e);}_replace_smart_quotes(e){return e.replace(/“/g,'"').replace(/”/g,'"').replace(/‘/g,"'").replace(/’/g,"'")}_make_fuzzy_regex(e){e=this._strip_markdown_formatting(e),e=this._replace_smart_quotes(e);let t=[],n=/(\[_+\])|(\s+)|(['"])|([.,;:\/\-\[\](){}+=$?*!|#^<>\\%&@~`_])/g,r=0,s,i=d(l=>l.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"escapeRegExp");for(;(s=n.exec(e))!==null;){let l=e.substring(r,s.index);l&&t.push(i(l));let u=s[1],a=s[2],c=s[3],f=s[4];u?t.push("\\[_+\\]"):a?(t.push("(?:\\*\\*|__|\\*|_)?"),t.push("\\s+"),t.push("(?:\\*\\*|__|\\*|_)?")):c?c==="'"?t.push("[\u2018\u2019']"):t.push('["\u201C\u201D]'):f&&(t.push("(?:\\*\\*|__|\\*|_)?"),t.push(i(f)),t.push("(?:\\*\\*|__|\\*|_)?")),r=n.lastIndex;}let o=e.substring(r);return o&&t.push(i(o)),t.join("")}_get_plain_projection(){if(this._plain_projection===null){let e=[],t=[];for(let n of this.spans)if(!(n.run===null&&n.paragraph!==null&&Xl.has(n.text))){e.push(n.text);for(let r=n.start;r<n.end;r++)t.push(r);}this._plain_projection=[e.join(""),t];}return this._plain_projection}_find_plain_projection_matches(e){let[t,n]=this._get_plain_projection();if(t.length===this.full_text.length)return [];let r=this._replace_smart_quotes(this._strip_markdown_formatting(e));if(!r)return [];let s=this._replace_smart_quotes(t),i=[],o=0;for(;;){let l=s.indexOf(r,o);if(l===-1)break;let u=l+r.length,a=n[l],c=n[u-1]+1;i.push([a,c-a]),o=u;}return i}find_match_index(e,t=false){if(t){try{let l=ol(e,this.full_text);if(l)return [l.start,l.end-l.start]}catch(l){if(l instanceof zt)throw l}return [-1,0]}let n=this.full_text.indexOf(e);if(n!==-1)return [n,e.length];let r=this._replace_smart_quotes(this.full_text),s=this._replace_smart_quotes(e);if(n=r.indexOf(s),n!==-1)return [n,e.length];let i=this._strip_markdown_formatting(e);if(this.full_text.includes(i))return n=this.full_text.indexOf(i),[n,i.length];let o=this._find_plain_projection_matches(e);if(o.length>0)return o[0];try{let u=new RegExp(this._make_fuzzy_regex(e)).exec(this.full_text);if(u)return [u.index,u[0].length]}catch{}return [-1,0]}find_all_match_indices(e,t=false){if(!e)return [];if(t){try{let u=sl(e,this.full_text);if(u.length>0)return u.map(a=>[a.start,a.end-a.start])}catch(u){if(u instanceof zt)throw u}return []}let n=d((u,a)=>{let c=[];if(!a)return c;let f=0;for(;;){let h=u.indexOf(a,f);if(h===-1)break;c.push([h,a.length]),f=h+a.length;}return c},"findAllLiteral"),r=n(this.full_text,e);if(r.length>0)return r;let s=this._replace_smart_quotes(this.full_text),i=this._replace_smart_quotes(e);if(r=n(s,i),r.length>0)return r;let o=this._strip_markdown_formatting(e);if(r=n(this.full_text,o),r.length>0)return r;let l=this._find_plain_projection_matches(e);if(l.length>0)return l;try{let u=new RegExp(this._make_fuzzy_regex(e),"g"),a=[...this.full_text.matchAll(u)];if(a.length>0)return a.map(c=>[c.index,c[0].length])}catch{}return []}find_target_runs(e){let[t,n]=this.find_match_index(e);return t===-1?[]:this._resolve_runs_at_range(t,t+n)}find_target_runs_by_index(e,t,n=true){return this._resolve_runs_at_range(e,e+t,n)}get_virtual_spans_in_range(e,t){let n=e+t;return this.spans.filter(r=>r.run===null&&r.text===`
|
|
51
51
|
|
|
52
|
-
`&&r.start>=e&&r.end<=n)}_resolve_runs_at_range(e,t,n=true){let r=this.spans.filter(
|
|
52
|
+
`&&r.start>=e&&r.end<=n)}_resolve_runs_at_range(e,t,n=true){let r=this.spans.filter(g=>g.end>e&&g.start<t);if(r.length===0)return [];let s=r.filter(g=>g.run!==null);if(s.length===0)return [];let i=[];for(let g of s)i.some(v=>v===g.run)||i.push(g.run);let o=false,l=s[0],u=0,a=e-l.start+(l.run_offset||0);if(a>0){let g=i[0],[,v]=this._split_run_at_index(g,a);for(let D=0;D<i.length;D++)i[D]===g&&(i[D]=v);o=true,u=a;}let c=s[s.length-1],f=l.run===c.run,h=i[i.length-1],_=Math.min(c.end,t)-c.start+(c.run_offset||0);f&&u>0&&(_-=u);let m=pt(h);if(_>0&&_<m.length){let[g]=this._split_run_at_index(h,_);i[i.length-1]=g,o=true;}return o&&n&&this._build_map(),i}get_insertion_anchor(e,t=true){let n=this.spans.filter(i=>i.end===e);if(n.length>0){for(let i=n.length-1;i>=0;i--)if(n[i].run)return [n[i].run,n[i].paragraph];for(let i=n.length-1;i>=0;i--){let o=n[i].paragraph;if(o){for(let l=this.spans.length-1;l>=0;l--){let u=this.spans[l];if(u.end<=e&&u.run!==null&&u.paragraph===o)return [u.run,u.paragraph]}return [null,o]}}}let r=this.spans.filter(i=>i.start<e&&e<i.end);if(r.length>0){let i=r[0];if(i.run===null)return i.paragraph===null?this.get_insertion_anchor(i.end,t):[null,i.paragraph];{let o=e-i.start+(i.run_offset||0),[l]=this._split_run_at_index(i.run,o);return t&&this._build_map(),[l,i.paragraph]}}if(e===0&&this.spans.length>0){for(let i of this.spans)if(i.run)return [i.run,i.paragraph];for(let i of this.spans)if(i.paragraph)return [null,i.paragraph];return [null,null]}let s=this.spans.filter(i=>i.end<e);if(s.length>0){for(let i=s.length-1;i>=0;i--)if(s[i].run)return [s[i].run,s[i].paragraph];for(let i=s.length-1;i>=0;i--)if(s[i].paragraph)return [null,s[i].paragraph]}return [null,null]}_split_run_at_index(e,t){let n=pt(e),r=n.substring(0,t),s=n.substring(t);this._set_run_text_elements(e._element,r);let i=e._element.cloneNode(true);this._set_run_text_elements(i,s),e._element.parentNode&&e._element.parentNode.insertBefore(i,e._element.nextSibling);let o=new it(i,e._parent);return [e,o]}_set_run_text_elements(e,t){let n=[];for(let s=0;s<e.childNodes.length;s++){let i=e.childNodes[s];i.nodeType===1&&["w:t","w:delText","w:br","w:cr","w:tab"].includes(i.tagName)&&n.push(i);}for(let s of n)e.removeChild(s);let r=e.ownerDocument;if(r){let s=r.createElement("w:t");s.textContent=t,t.trim()!==t&&s.setAttribute("xml:space","preserve"),e.appendChild(s);}}get_context_at_range(e,t){let n=this.spans.filter(r=>r.run&&r.end>e&&r.start<t);return n.length>0?n[0]:null}};function Ss(e){let t=0,n=0,r=e.length,s=d(i=>/[a-zA-Z0-9]/.test(i),"isAlnum");for(;n<r;){if(e[n]==="_"){let i=false;(n>0&&e[n-1]==="_"||n<r-1&&e[n+1]==="_")&&(i=true);let o=false;n>0&&s(e[n-1])&&n<r-1&&s(e[n+1])&&(o=true),!i&&!o&&t++;}n++;}return t}d(Ss,"_count_standalone_underscores");function Zn(e,t){if(!e||!t)return [0,0];let n=d(a=>/\s/.test(a),"isSpace"),r=0,s=Math.min(e.length,t.length);for(;r<s&&e[r]===t[r];)r++;if(r<e.length&&r<t.length)for(;r>0;){let a=!n(e[r-1])&&!n(e[r]),c=!n(t[r-1])&&!n(t[r]);if(a||c)r--;else break}for(;r>0;){if(r<e.length){let m=e.substring(r-1,r+1);if(m==="**"||m==="__"){r--;continue}}let a=e.substring(0,r),c=(a.match(/\*\*/g)||[]).length,f=(a.match(/__/g)||[]).length,h=Ss(a);if(c%2!==0){r=a.lastIndexOf("**");continue}if(f%2!==0){r=a.lastIndexOf("__");continue}if(h%2!==0){let m=a.length-1,g=d(v=>/[a-zA-Z0-9]/.test(v),"isAlnum");for(;m>=0;){if(a[m]==="_"&&(m===0||a[m-1]!=="_")&&(m===a.length-1||a[m+1]!=="_")&&!(m>0&&g(a[m-1])&&m<a.length-1&&g(a[m+1]))){r=m;break}m--;}continue}let p=r,_=false;for(;p>0;){let m=e[p-1];if(m==="#"){for(r=p-1;r>0&&e[r-1]!==`
|
|
53
53
|
`;)r--;_=true;break}if(m===`
|
|
54
|
-
`)break;p--;}if(!_)break}let i=0,
|
|
55
|
-
`)}d(
|
|
56
|
-
`,t)+1,r=e.substring(0,n).trimEnd(),
|
|
54
|
+
`)break;p--;}if(!_)break}let i=0,o=e.length-r,l=t.length-r,u=Math.min(o,l);for(;i<u&&e[e.length-1-i]===t[t.length-1-i];)i++;if(i>0)for(;i>0;){let a=false;i<e.length&&(a=!n(e[e.length-1-i])&&!n(e[e.length-i]));let c=false;if(i<t.length&&(c=!n(t[t.length-1-i])&&!n(t[t.length-i])),a||c)i--;else break}for(;i>0;){let a=e.length-i;if(a>0){let _=e.substring(a-1,a+1);if(_==="**"||_==="__"){i--;continue}}let c=e.substring(e.length-i),f=(c.match(/\*\*/g)||[]).length,h=(c.match(/__/g)||[]).length,p=Ss(c);if(f%2!==0){i-=c.indexOf("**")+2;continue}if(h%2!==0){i-=c.indexOf("__")+2;continue}if(p%2!==0){let _=0,m=d(g=>/[a-zA-Z0-9]/.test(g),"isAlnum");for(;_<c.length;){if(c[_]==="_"&&(_===0||c[_-1]!=="_")&&(_===c.length-1||c[_+1]!=="_")&&!(_>0&&m(c[_-1])&&_<c.length-1&&m(c[_+1]))){i-=_+1;break}_++;}continue}break}i>0&&/^\s+$/.test(e.substring(e.length-i))&&(i=0);for(let a of ["**","__","_"]){let c=a.length,f=e.substring(r,e.length-i),h=t.substring(r,t.length-i);f.startsWith(a)&&h.startsWith(a)&&f.endsWith(a)&&h.endsWith(a)&&f.length>=2*c&&h.length>=2*c&&(r+=c,i+=c);}return [r,i]}d(Zn,"trim_common_context");function Ql(e,t){let n=[],r={},s=/(\s+|[\p{L}\p{N}_]+|[^\p{L}\p{N}_\s])/gu,i=d(o=>{let l=o.split(s).filter(Boolean),u="";for(let a of l)if(a in r)u+=String.fromCharCode(r[a]);else {let c=n.length;r[a]=c,n.push(a),u+=String.fromCharCode(c);}return u},"encode_text");return [i(e),i(t),n]}d(Ql,"_words_to_chars");function io(e,t){let n=new ro.default.diff_match_patch;n.Diff_Timeout=2;let[r,s,i]=Ql(e,t),o=n.diff_main(r,s,false);n.diff_cleanupSemantic(o);for(let c=0;c<o.length;c++){let f=o[c][1],h="";for(let p=0;p<f.length;p++)h+=i[f.charCodeAt(p)];o[c][1]=h;}let l=[],u=0,a=null;for(let[c,f]of o)if(c===0){if(a){let[h,p]=a;l.push({type:"modify",target_text:p,new_text:"",comment:"Diff: Text deleted",_match_start_index:h}),a=null;}u+=f.length;}else if(c===-1)a=[u,f],u+=f.length;else if(c===1)if(a){let[h,p]=a;l.push({type:"modify",target_text:p,new_text:f,comment:"Diff: Replacement",_match_start_index:h}),a=null;}else l.push({type:"modify",target_text:"",new_text:f,comment:"Diff: Text inserted",_match_start_index:u});if(a){let[c,f]=a;l.push({type:"modify",target_text:f,new_text:"",comment:"Diff: Text deleted",_match_start_index:c});}return l}d(io,"generate_edits_from_text");function so(e,t,n="Original",r="Modified"){let s=io(e,t),i=[`--- ${n}`,`+++ ${r}`,""],o=40;for(let l of s){let u=l._match_start_index||0,a=l.target_text||"",c=l.new_text||"",[f,h]=Zn(a,c),p=a.length-h,_=c.length-h,m=a.substring(f,p),g=c.substring(f,_),v=u+f,D=v+m.length,y=Math.max(0,v-o),w=e.substring(y,v);y>0&&(w="..."+w);let E=Math.min(e.length,D+o),b=e.substring(D,E);E<e.length&&(b=b+"..."),w=w.replace(/\n/g," ").replace(/\r/g,""),b=b.replace(/\n/g," ").replace(/\r/g,""),i.push("@@ Word Patch @@"),i.push(` ${w}`),m&&i.push(`- ${m}`),g&&i.push(`+ ${g}`),i.push(` ${b}`),i.push("");}return i.join(`
|
|
55
|
+
`)}d(so,"create_word_patch_diff");var Is=19e3,Jl="<!-- READONLY_BOUNDARY_START -->",Os={"{++":"++}","{--":"--}","{==":"==}","{>>":"<<}"},Zl=/\bChg:(\d+)\b/g;function Wt(e){if(!e)return ["",""];let t=e.indexOf(Jl);if(t===-1)return [e,""];let n=e.lastIndexOf(`
|
|
56
|
+
`,t)+1,r=e.substring(0,n).trimEnd(),s=e.substring(n);return [r,s]}d(Wt,"split_structural_appendix");function Ht(e,t=""){if(!e){let a=t?t.trim():"";return {pages:[{page:1,total_pages:1,has_next:false,has_prev:false,tracked_change_count:Ps(a),page_content:a}],total_pages:1,body_pages:[""],body_page_offsets:[0]}}let n=Kl(e),[r,s]=nc(n),i;if(t&&t.trim()){let u=t.trim();i=r.map(a=>a?`${a}
|
|
57
57
|
|
|
58
|
-
${
|
|
59
|
-
`&&
|
|
60
|
-
`&&Object.values(t).every(
|
|
61
|
-
`;)
|
|
58
|
+
${u}`:u);}else i=[...r];let o=i.length;return {pages:i.map((u,a)=>({page:a+1,total_pages:o,has_next:a+1<o,has_prev:a+1>1,tracked_change_count:Ps(u),page_content:u})),total_pages:o,body_pages:r,body_page_offsets:s}}d(Ht,"paginate");function Kl(e){let t=ec(e);return tc(t)}d(Kl,"_tokenize_into_atomic_blocks");function ec(e){let t={"++}":0,"--}":0,"==}":0,"<<}":0},n=[],r=0,s=0,i=e.length;for(;s<i;){let o=false;for(let[u,a]of Object.entries(Os))if(e.startsWith(u,s)){t[a]++,s+=u.length,o=true;break}if(o)continue;let l=false;for(let u of Object.values(Os))if(e.startsWith(u,s)){t[u]>0&&t[u]--,s+=u.length,l=true;break}if(!l){if(e[s]===`
|
|
59
|
+
`&&s+1<i&&e[s+1]===`
|
|
60
|
+
`&&Object.values(t).every(u=>u===0)){let u=e.substring(r,s);u&&n.push([u,r]);let a=s;for(;a<i&&e[a]===`
|
|
61
|
+
`;)a++;s=a,r=s;continue}s++;}}if(r<i){let o=e.substring(r,i);o&&n.push([o,r]);}return n}d(ec,"_split_on_safe_paragraph_breaks");function tc(e){if(!e.length)return e;let t=[],n=0;for(;n<e.length;){let[r,s]=e[n],i=r.trimStart();if(!(i.startsWith("## Footnotes")||i.startsWith("## Endnotes"))){t.push([r,s]),n++;continue}let l=r,u=n+1;for(;u<e.length;){let[a]=e[u],c=a.trimStart();if(c.startsWith("[^fn-")||c.startsWith("[^en-"))l=`${l}
|
|
62
62
|
|
|
63
|
-
${
|
|
63
|
+
${a}`,u++;else break}t.push([l,s]),n=u;}return t}d(tc,"_merge_footnote_sections");function nc(e){if(!e.length)return [[""],[0]];let t=[],n=[],r=[],s=0,i=-1,o=d(()=>{r.length>0&&(t.push(r.join(`
|
|
64
64
|
|
|
65
|
-
`)),n.push(i)),r=[],
|
|
66
|
-
`)}d(
|
|
65
|
+
`)),n.push(i)),r=[],s=0,i=-1;},"flush_current");for(let[l,u]of e){let a=l.length,c=a+(r.length>0?2:0);if(r.length>0&&s+c>Is&&o(),r.length===0&&a>Is){t.push(l),n.push(u);continue}r.length===0&&(i=u),r.push(l),s+=s>0?c:a;}return o(),t.length?[t,n]:[[""],[0]]}d(nc,"_assemble_pages");function Ps(e){let t=[...e.matchAll(Zl)];return new Set(t.map(r=>r[1])).size}d(Ps,"_count_tracked_changes");var rc=5,Ms=50;function ic(e,t,n,r){let s=r.length;if(s<2)throw new Error(`format_ambiguity_error requires at least 2 matches, got ${s}`);let i=r.slice(0,rc),o=s-i.length,l=[`- Edit ${e} Failed: Ambiguous match. Target text appears ${s} times. First ${i.length} occurrences:`];for(let u=0;u<i.length;u++){let[a,c]=i[u],f=Math.max(0,a-Ms),h=Math.min(n.length,c+Ms),p=n.substring(f,a).replace(/\n/g," "),_=n.substring(c,h).replace(/\n/g," "),m=n.substring(a,c).replace(/\n/g," ");m.length>50&&(m=m.substring(0,25)+"..."+m.substring(m.length-20));let g=f>0?"...":"",v=h<n.length?"...":"";l.push(` ${u+1}. "${g}${p}[${m}]${_}${v}"`);}return o>0&&l.push(` ... and ${o} more occurrence(s) not shown.`),l.push(" To resolve, re-send this edit using ONE of these strategies:"),l.push(' 1. RECOMMENDED: Provide more surrounding context in your target_text to uniquely identify a single location (keep the default "match_mode": "strict").'),l.push(` 2. Set "match_mode": "all" to modify ALL ${s} occurrences \u2014 only after verifying from the occurrence list above that EVERY occurrence should change.`),l.push(' 3. Set "match_mode": "first" to modify only the FIRST occurrence \u2014 only after verifying the first occurrence above is the one you intend to change.'),l.join(`
|
|
66
|
+
`)}d(ic,"format_ambiguity_error");var Xe=500,vn=200;function Ae(e,t){if(e==null||e.length<=t)return e;let n=Math.max(1,Math.floor(t*2/3)),r=Math.max(1,t-n),s=e.length-n-r;return `${e.slice(0,n)}\u2026 [${s.toLocaleString("en-US")} chars omitted] \u2026${e.slice(-r)}`}d(Ae,"truncate_middle");var Ut=30;function ht(e){let t=e.nextSibling;for(;t;){if(t.nodeType===1)return t;t=t.nextSibling;}return null}d(ht,"getNextElement");function Qn(e){let t=e.previousSibling;for(;t;){if(t.nodeType===1)return t;t=t.previousSibling;}return null}d(Qn,"getPreviousElement");function qt(e,t){t.parentNode&&t.parentNode.insertBefore(e,t.nextSibling);}d(qt,"insertAfter");function Rs(e){let t=[...e.pkg.parts],n={...e.pkg.unzipped},r=new Map,s=new Map;for(let i of t)r.set(i,new Map(i.rels)),i._element&&s.set(i,i._element.cloneNode(true));return {parts:t,unzipped:n,rels:r,elements:s}}d(Rs,"takeSnapshot");function Bs(e,t){e.pkg.parts=[...t.parts];for(let n of Object.keys(e.pkg.unzipped))delete e.pkg.unzipped[n];for(let[n,r]of Object.entries(t.unzipped))e.pkg.unzipped[n]=r;for(let n of t.parts){n.rels=new Map(t.rels.get(n));let r=t.elements.get(n);if(r&&n._element){let s=n._element.ownerDocument;s&&s.documentElement&&s.replaceChild(r,s.documentElement),n._element=r;}}}d(Bs,"restoreSnapshot");function sc(e,t){if(!e||!t)return [e,t];let n=e.match(/^(#+)\s+/),r=t.match(/^(#+)\s+/);if(n&&r&&n[1]===r[1]){let s=n[1],i=e.substring(s.length).trimStart(),o=t.substring(s.length).trimStart();return [i,o]}return [e,t]}d(sc,"stripMatchingHeadingHashes");var yn=class extends Error{static{d(this,"BatchValidationError");}errors;constructor(e){super(`Batch validation failed:
|
|
67
67
|
`+e.join(`
|
|
68
|
-
`)),this.name="BatchValidationError",this.errors=e;}};function
|
|
69
|
-
Note: ${e} earlier edit(s) in this batch were already applied. Batches apply sequentially \u2014 each edit must target the document text as it reads AFTER the preceding edits (e.g. target the replacement text an earlier edit introduced, not the original wording).`}d(
|
|
70
|
-
Did you mean the literal "${r}"? It appears in the document (\u2026${l}\u2026). If you used a regex, drop the ^/$ anchors \u2014 they match the start/end of the entire document, not a line.`}return ""}static _PREVIEW_WRAPPER_PAIRS=[["{--","--}"],["{++","++}"],["{==","==}"],["{>>","<<}"]];static _tidy_preview_context(t,n){t=t.replace(/\{>>[\s\S]*?<<\}/g,"");for(let[r,
|
|
71
|
-
`),l=[],a=999;for(let u=s.length-1;u>=0;u--){let f=s[u].match(/^(#{1,6})\s+(.*)/);if(f){let h=f[1].length;if(h<a){let p=f[2].replace(/\*\*|__|[*_]/g,"").replace(/\{#[^}]+\}/g,"").trim();if(p.length>80&&(p=p.substring(0,80)+"..."),l.unshift(p),a=h,h===1)break}}}return [l.join(" > "),o]}accept_all_revisions(){let t=[this.doc.element];for(let o of this.doc.pkg.parts)o!==this.doc.part&&o.contentType.includes("wordprocessingml")&&o.contentType.endsWith("+xml")&&t.push(o._element);for(let o of t){let i=I(o,"w:ins");for(let a of i){this._clean_wrapping_comments(a);let u=a.parentNode;if(u){if(u.tagName==="w:trPr"){u.removeChild(a);continue}for(;a.firstChild;)u.insertBefore(a.firstChild,a);u.removeChild(a);}}let s=I(o,"w:p");for(let a of s){let u=F(a,"w:pPr");if(u){let c=F(u,"w:rPr"),f=c?F(c,"w:del"):null;if(c&&f){let h=false;for(let p of ["w:t","w:tab","w:br"]){for(let _ of I(a,p)){if(p==="w:t"&&!_.textContent)continue;let m=false,g=_.parentNode;for(;g&&g!==a;){if(g.tagName==="w:del"){m=true;break}g=g.parentNode;}if(!m){h=true;break}}if(h)break}h?c.removeChild(f):(this._clean_wrapping_comments(a),this._delete_comments_in_element(a),a.parentNode&&a.parentNode.removeChild(a));}}}let l=I(o,"w:del");for(let a of l){this._clean_wrapping_comments(a),this._delete_comments_in_element(a);let u=a.parentNode;if(u)if(u.tagName==="w:trPr"){let c=u.parentNode;c&&c.parentNode&&c.parentNode.removeChild(c);}else u.removeChild(a);}}for(let o of t){for(let s of ["w:commentRangeStart","w:commentRangeEnd"])for(let l of I(o,s))l.parentNode?.removeChild(l);let i=I(o,"w:commentReference");for(let s of i){let l=s.parentNode;l&&((l.tagName==="w:r"||l.tagName.endsWith(":r"))&&Array.from(l.childNodes).filter(u=>u.nodeType===1&&u.tagName!=="w:rPr"&&u.tagName!=="rPr").length<=1?l.parentNode?.removeChild(l):l.removeChild(s));}}let n=this.doc.pkg,r=new Set;for(let o of n.parts)if(o.partname.toLowerCase().includes("comments")){r.add(o.partname);let i=o.partname.startsWith("/")?o.partname:"/"+o.partname,s=o.partname.startsWith("/")?o.partname.substring(1):o.partname;r.add(i),r.add(s);}if(r.size>0){for(let i of n.parts)if(i.partname.endsWith(".rels")){let s=I(i._element,"Relationship"),l=[];for(let a of s)if((a.getAttribute("Target")||"").toLowerCase().includes("comments")){l.push(a);let c=i.partname.replace("/_rels/","/").replace(".rels",""),f=n.getPartByPath(c);if(f){let h=a.getAttribute("Id");h&&f.rels.delete(h);}}for(let a of l)a.parentNode?.removeChild(a);}let o=n.getPartByPath("[Content_Types].xml");if(o){let i=I(o._element,"Override"),s=[];for(let l of i){let a=l.getAttribute("PartName")||"";(r.has(a)||a.toLowerCase().includes("comments"))&&s.push(l);}for(let l of s)l.parentNode?.removeChild(l);}n.parts=n.parts.filter(i=>!i.partname.toLowerCase().includes("comments"));for(let i of Object.keys(n.unzipped))i.toLowerCase().includes("comments")&&delete n.unzipped[i];}}reject_all_revisions(){let t=[this.doc.element];for(let n of this.doc.pkg.parts)n!==this.doc.part&&n.contentType.includes("wordprocessingml")&&n.contentType.endsWith("+xml")&&t.push(n._element);for(let n of t){let r=I(n,"w:ins");for(let s of r){let l=s.parentNode;if(l)if(this._clean_wrapping_comments(s),this._delete_comments_in_element(s),l.tagName==="w:trPr"){let a=l.parentNode;a&&a.parentNode&&a.parentNode.removeChild(a);}else l.removeChild(s);}let o=I(n,"w:p");for(let s of o){let l=F(s,"w:pPr");if(l){let a=F(l,"w:rPr"),u=a?F(a,"w:del"):null;a&&u&&a.removeChild(u);}}let i=I(n,"w:del");for(let s of i){let l=s.parentNode;if(!l)continue;if(this._clean_wrapping_comments(s),l.tagName==="w:trPr"){l.removeChild(s);continue}let a=Array.from(s.getElementsByTagName("w:delText"));for(let u of a){let c=s.ownerDocument.createElement("w:t");c.textContent=u.textContent,u.hasAttribute("xml:space")&&c.setAttribute("xml:space","preserve"),u.parentNode?.replaceChild(c,u);}for(;s.firstChild;)l.insertBefore(s.firstChild,s);l.removeChild(s);}}}_getNextId(){return this.current_id++,this.current_id.toString()}_create_track_change_tag(t,n="",r=null){let i=this.doc.part._element.ownerDocument.createElement(t),s=r!==null?r:this._getNextId();return i.setAttribute("w:id",s),i.setAttribute("w:author",n||this.author),i.setAttribute("w:date",this.timestamp),i.setAttribute("w16du:dateUtc",this.timestamp),i}_set_text_content(t,n){t.textContent=n,n.trim()!==n&&t.setAttribute("xml:space","preserve");}_comment_anchor_in_main_story(t){let n=t;for(;n.parentNode&&n.parentNode.nodeType===1;)n=n.parentNode;return n.tagName==="w:document"}_skip_comment_outside_main_story(t,n){if(this._comment_anchor_in_main_story(t))return false;let r=t;for(;r.parentNode&&r.parentNode.nodeType===1;)r=r.parentNode;let o={"w:ftr":"footer","w:hdr":"header","w:footnotes":"footnote","w:endnotes":"endnote"}[r.tagName]||"non-body",i=`- Warning: the comment "${n.substring(0,60)}" was NOT attached: Word does not support comments inside a ${o} part, and writing one produces a document other applications cannot open. The tracked change itself was applied.`;return this.skipped_details.push(i),true}_attach_comment(t,n,r,o){if(!o||!t||!n||!r||this._skip_comment_outside_main_story(t,o))return;let i=this.comments_manager.addComment(this.author,o),s=t.ownerDocument,l=s.createElement("w:commentRangeStart");l.setAttribute("w:id",i);let a=s.createElement("w:commentRangeEnd");a.setAttribute("w:id",i);let u=s.createElement("w:r"),c=s.createElement("w:rPr"),f=s.createElement("w:rStyle");f.setAttribute("w:val","CommentReference"),c.appendChild(f),u.appendChild(c);let h=s.createElement("w:commentReference");h.setAttribute("w:id",i),u.appendChild(h),t.insertBefore(l,n);let p=r.nextSibling;p?(t.insertBefore(a,p),t.insertBefore(u,a.nextSibling)):(t.appendChild(a),t.appendChild(u));}_attach_comment_spanning(t,n,r,o,i){if(!i||!t||!r||this._skip_comment_outside_main_story(t,i)||this._skip_comment_outside_main_story(r,i))return;let s=this.comments_manager.addComment(this.author,i),l=t.ownerDocument,a=r.ownerDocument,u=l.createElement("w:commentRangeStart");u.setAttribute("w:id",s);let c=a.createElement("w:commentRangeEnd");c.setAttribute("w:id",s);let f=a.createElement("w:r"),h=a.createElement("w:rPr"),p=a.createElement("w:rStyle");p.setAttribute("w:val","CommentReference"),h.appendChild(p),f.appendChild(h);let _=a.createElement("w:commentReference");_.setAttribute("w:id",s),f.appendChild(_),t.insertBefore(u,n);let m=o.nextSibling;m?(r.insertBefore(c,m),r.insertBefore(f,c.nextSibling)):(r.appendChild(c),r.appendChild(f));}_track_insert_multiline(t,n,r,o,i=null){if(!t)return {first_node:null,last_p:null,last_ins:null,used_block_mode:false};let s=this.doc.part._element.ownerDocument,l=t.split(/[\r\n]+/),a=null;if(r!==null)a=r._element;else if(n!==null){let A=n._element;for(;A&&A.tagName!=="w:p";)A=A.parentNode;a=A;}let u=[],c=i&&i.parentNode?i:n!==null&&n._element.parentNode?n._element:null;if(a!==null&&c!==null){let A=c;for(;A&&A.parentNode!==a;)if(A=A.parentNode,A===a){A=null;break}if(A){let x=new Set(["w:r","w:ins","w:del"]),N=A.nextSibling;for(;N;)N.nodeType===1&&x.has(N.tagName)&&u.push(N),N=N.nextSibling;}}for(;l.length>1&&l[l.length-1]===""&&u.length===0;)l.pop();if(l.length===0)return {first_node:null,last_p:null,last_ins:null,used_block_mode:false};let[f,h]=this._parse_markdown_style(l[0]),_=h!==null&&a!==null,m=null,g=null;_||(g=this._build_tracked_ins_for_line((f===l[0],l[0]),n,o,s),m=g);let v=_?l:l.slice(1);if(v.length===0)return {first_node:m,last_p:null,last_ins:g,used_block_mode:false};if(!a)return {first_node:m,last_p:null,last_ins:g,used_block_mode:false};let E=a.parentNode;if(!E)return {first_node:m,last_p:null,last_ins:g,used_block_mode:false};let y=d((A,x)=>{E.insertBefore(A,x.nextSibling);},"insertAfterEl"),w=null,b=null,D=a;for(let A=0;A<v.length;A++){let x=v[A],[N,T]=this._parse_markdown_style(x),k=s.createElement("w:p");if(T)this._set_paragraph_style(k,T);else {let B=F(a,"w:pPr");B&&k.appendChild(B.cloneNode(true));}let P=F(k,"w:pPr");P||(P=s.createElement("w:pPr"),k.insertBefore(P,k.firstChild));let O=F(P,"w:rPr");O||(O=s.createElement("w:rPr"),P.appendChild(O));let C=this._create_track_change_tag("w:ins","",o);O.appendChild(C);let M=this._build_tracked_ins_for_line(N,n,o,s);M&&k.appendChild(M),y(k,D),D=k,w=k,b=M,m||(m=k);}if(!_&&w&&u.length>0)for(let A of u)A.parentNode?.removeChild(A),w.appendChild(A);return {first_node:m,last_p:w,last_ins:b,used_block_mode:_}}_build_tracked_ins_for_line(t,n,r,o){if(!t&&t!=="")return null;let i=this._create_track_change_tag("w:ins","",r),s=this._parse_inline_markdown(t);if(s.length===0)return null;for(let[l,a]of s){let u=o.createElement("w:r");if(n&&n._element){let f=F(n._element,"w:rPr");if(f){let h=f.cloneNode(true);for(let p of ["w:vanish","w:strike","w:dstrike","w:i","w:iCs","w:b","w:bCs"]){let _=F(h,p);_&&h.removeChild(_);}u.appendChild(h);}}this._apply_run_props(u,a,false);let c=o.createElement("w:t");this._set_text_content(c,l),u.appendChild(c),i.appendChild(u);}return i}_parse_markdown_style(t){let n=t.trimStart();if(n.startsWith("#")){let o=0,i=n;for(;i.startsWith("#");)o++,i=i.substring(1);if(i.startsWith(" "))return [i.trim(),`Heading ${o}`]}if(n.startsWith("* ")||n.startsWith("- "))return [n.substring(2).trim(),"List Paragraph"];let r=n.match(/^1\.\s+/);return r?[n.substring(r[0].length).trim(),"List Number"]:[t,null]}_parse_inline_markdown(t,n={}){if(!t)return [];let r=/(\*\*.*?\*\*)|(_.*?_)/,o=t.match(r);if(!o)return [[t,n]];let i=o.index,s=o[0],l=i+s.length,a=s.startsWith("**"),u=a?s.substring(2,s.length-2):s.substring(1,s.length-1),c=t.substring(0,i),f=t.substring(l),h=[];c&&h.push([c,n]);let p={...n};return a?p.bold=true:p.italic=true,h.push(...this._parse_inline_markdown(u,p)),h.push(...this._parse_inline_markdown(f,n)),h}_apply_run_props(t,n,r=false){if(!n){if(!r)return;n={};}let o=F(t,"w:rPr");if(!o&&(n.bold||n.italic||r)&&(o=t.ownerDocument.createElement("w:rPr"),t.appendChild(o)),o){let i=t.ownerDocument;if(n.bold){let s=F(o,"w:b");s||(s=i.createElement("w:b"),o.appendChild(s)),s.setAttribute("w:val","1");}else if(r){let s=F(o,"w:b");s&&o.removeChild(s);}if(n.italic){let s=F(o,"w:i");s||(s=i.createElement("w:i"),o.appendChild(s)),s.setAttribute("w:val","1");}else if(r){let s=F(o,"w:i");s&&o.removeChild(s);}}}_set_paragraph_style(t,n){let r=t.ownerDocument,o=F(t,"w:pPr");o&&t.removeChild(o);let i=r.createElement("w:pPr"),s=r.createElement("w:pStyle"),l=n.replace(/\s+/g,"");s.setAttribute("w:val",l),i.appendChild(s),t.insertBefore(i,t.firstChild);}_anchor_reply_comment(t,n){let r=this.doc.part._element.ownerDocument,o=I(this.doc.element,"w:commentRangeStart").filter(g=>g.getAttribute("w:id")===t);if(o.length===0)return;let i=o[0],s=r.createElement("w:commentRangeStart");s.setAttribute("w:id",n),qt(s,i);let l=I(this.doc.element,"w:commentRangeEnd").filter(g=>g.getAttribute("w:id")===t);if(l.length===0)return;let a=l[0],u=I(this.doc.element,"w:commentReference").filter(g=>g.getAttribute("w:id")===t),c=a;if(u.length>0){let g=u[0];g.parentNode&&g.parentNode.tagName==="w:r"&&(c=g.parentNode);}let f=r.createElement("w:commentRangeEnd");f.setAttribute("w:id",n),qt(f,c);let h=r.createElement("w:r"),p=r.createElement("w:rPr"),_=r.createElement("w:rStyle");_.setAttribute("w:val","CommentReference"),p.appendChild(_),h.appendChild(p);let m=r.createElement("w:commentReference");m.setAttribute("w:id",n),h.appendChild(m),qt(h,f);}_get_comment_author(t){let n=this.doc.pkg.parts.find(o=>o.contentType==="application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml");if(!n)return null;let r=I(n._element,"w:comment");for(let o of r)if(o.getAttribute("w:id")===t)return o.getAttribute("w:author");return null}_clean_wrapping_comments(t){let n=t;for(;;){let u=Qn(n);if(u&&(u.tagName==="w:ins"||u.tagName==="w:del"))n=u;else break}let r=t;for(;;){let u=dt(r);if(u&&(u.tagName==="w:ins"||u.tagName==="w:del"))r=u;else break}let o=[],i=Qn(n);for(;i;)if(i.tagName==="w:commentRangeStart")o.push(i),i=Qn(i);else if(i.tagName==="w:rPr"||i.tagName==="w:pPr")i=Qn(i);else break;let s=[],l=dt(r);for(;l;)if(l.tagName==="w:commentRangeEnd")s.push(l),l=dt(l);else if(l.tagName==="w:r"&&I(l,"w:commentReference").length>0)s.push(l),l=dt(l);else if(l.tagName==="w:commentReference")s.push(l),l=dt(l);else break;let a=new Set;for(let u of s)if(u.tagName==="w:commentRangeEnd"){let c=u.getAttribute("w:id");c&&a.add(c);}else {let c=I(u,"w:commentReference")[0];if(!c&&u.tagName==="w:commentReference"&&(c=u),c){let f=c.getAttribute("w:id");f&&a.add(f);}}for(let u of o){let c=u.getAttribute("w:id");if(c&&a.has(c)){let f=this._get_comment_author(c);f!==null&&f===this.author&&this.comments_manager.deleteComment(c),u.parentNode&&u.parentNode.removeChild(u);for(let p of s){let _=null;if(p.tagName==="w:commentRangeEnd")_=p.getAttribute("w:id");else {let m=I(p,"w:commentReference")[0];!m&&p.tagName==="w:commentReference"&&(m=p),m&&(_=m.getAttribute("w:id"));}_===c&&p.parentNode&&p.parentNode.removeChild(p);}}}}_delete_comments_in_element(t){let n=I(t,"w:commentReference");for(let r of n){let o=r.getAttribute("w:id");if(o){this.comments_manager.deleteComment(o);for(let i of ["w:commentRangeStart","w:commentRangeEnd"]){let s=I(this.doc.element,i);for(let l of s)l.getAttribute("w:id")===o&&l.parentNode&&l.parentNode.removeChild(l);}}}}validate_edits(t,n=0){let r=[];this.mapper.full_text||this.mapper._build_map(),r.push(...uc(t,n));for(let o=0;o<t.length;o++){let i=t[o];if(typeof i!="object"||i===null){r.push(`- Edit ${o+1+n} Failed: Invalid change format. Expected a JSON object, but received a primitive ${typeof i}. Do not pass raw strings.`);continue}if(!i.target_text||i._match_start_index!==void 0&&i._match_start_index!==null||i._resolved_start_idx!==void 0&&i._resolved_start_idx!==null)continue;let s=i.regex||false,l=i.match_mode||"strict",a=this.mapper.find_all_match_indices(i.target_text,s),u=this.mapper.full_text,c=this.mapper;a.length===0&&(this.clean_mapper||(this.clean_mapper=new Ge(this.doc,true)),a=this.clean_mapper.find_all_match_indices(i.target_text,s),a.length>0&&(u=this.clean_mapper.full_text,c=this.clean_mapper)),u===this.mapper.full_text&&a.length>0&&(a=a.filter(([_,m])=>{let g=this.mapper.spans.filter(v=>v.run!==null&&v.end>_&&v.start<_+m);return g.length===0?true:g.some(v=>!v.del_id)}));let f=false,h=new Set;if(a.length===0){this.original_mapper||(this.original_mapper=new Ge(this.doc,false,true));let p=this.original_mapper.find_all_match_indices(i.target_text,s);if(p.length>0){f=true;for(let[_,m]of p){let g=this.original_mapper.spans.filter(v=>v.end>_&&v.start<_+m);for(let v of g)if(v.run!==null){let E=v.run._element;for(;E;){if(E.nodeType===1&&E.tagName==="w:del"){let y=E.getAttribute("w:author");y&&h.add(y);break}E=E.parentNode;}}}}}if(a.length===0)if(f){let p=h.size>0?`by ${Array.from(h).sort().join(", ")}`:"by an existing revision";r.push(`- Edit ${o+1+n} Failed: Target text matches text inside a tracked deletion ${p}. Reject/accept that change first or target the active replacement text instead.`);}else {let p=this._nearest_match_hint(i.target_text,s);r.push(`- Edit ${o+1+n} Failed: Target text not found in document:
|
|
72
|
-
"${
|
|
68
|
+
`)),this.name="BatchValidationError",this.errors=e;}};function Fs(e){return `
|
|
69
|
+
Note: ${e} earlier edit(s) in this batch were already applied. Batches apply sequentially \u2014 each edit must target the document text as it reads AFTER the preceding edits (e.g. target the replacement text an earlier edit introduced, not the original wording).`}d(Fs,"sequential_context_hint");var oc="Not applied: the batch is transactional and other edits failed validation (see their errors). Fix or remove those edits and re-run.",ac=/[\x00-\x08\x0b\x0c\x0e-\x1f]/g;function uc(e){if(!e)return null;let t=e.match(ac);return t?Array.from(new Set(t.map(r=>`0x${r.charCodeAt(0).toString(16).padStart(2,"0")}`))).sort().join(", "):null}d(uc,"describe_illegal_control_chars");function lc(e,t=0){let n=[];for(let r=0;r<e.length;r++){let s=e[r],i=s.target_text||"",o=s.new_text||"",l=[["target_text",i],["new_text",o]];s.comment&&l.push(["comment",s.comment]),(s.cells||[]).forEach((u,a)=>{l.push([`cells[${a}]`,u||""]);});for(let[u,a]of l){let c=uc(a);c&&n.push(`- Edit ${r+1+t} Failed: \`${u}\` contains control character(s) (${c}) that cannot be stored in a DOCX. Remove them and re-submit.`);}if((o.includes("{++")||o.includes("{--")||o.includes("{>>")||o.includes("{=="))&&n.push(`- Edit ${r+1+t} Failed: Do not manually write CriticMarkup tags ({++, {--, {>>, {==) in \`new_text\`. The engine handles redlining automatically. To add a comment, use the \`comment\` parameter.`),i.includes("[^")||o.includes("[^")){let u=(i.match(/\[\^(?:fn|en)-[^\]]+\]/g)||[]).sort(),a=(o.match(/\[\^(?:fn|en)-[^\]]+\]/g)||[]).sort();JSON.stringify(u)!==JSON.stringify(a)&&(a.length>u.length||a.some(c=>a.filter(f=>f===c).length>u.filter(f=>f===c).length)?n.push(`- Edit ${r+1+t} Failed: Cannot insert footnote/endnote markers via text replace. Markers like \`[^fn-N]\` are read-only projections. Use Word's References menu.`):n.push(`- Edit ${r+1+t} Failed: Cannot delete footnote/endnote references via text replace. The marker corresponds to a structural XML element.`));}if(i.includes("](")||o.includes("](")){let u=(i.match(/\[(?!~)[^\]]+\]\([^)]+\)/g)||[]).sort(),a=(o.match(/\[(?!~)[^\]]+\]\([^)]+\)/g)||[]).sort();u.length!==a.length?a.length>u.length?n.push(`- Edit ${r+1+t} Failed: Cannot insert hyperlinks via text replace. Use a dedicated structural operation.`):n.push(`- Edit ${r+1+t} Failed: Cannot delete hyperlinks via text replace. The marker corresponds to a structural XML element.`):u.length>1&&JSON.stringify(u)!==JSON.stringify(a)&&n.push(`- Edit ${r+1+t} Failed: Can only edit or retarget one hyperlink per text replacement. Please split into multiple edits.`);}if(i.includes("[~")||o.includes("[~")){let u=i.match(/\[~[^~]+~\]\(#[^\)]+\)/g)||[],a=o.match(/\[~[^~]+~\]\(#[^\)]+\)/g)||[];u.length!==a.length?a.length>u.length?n.push(`- Edit ${r+1+t} Failed: Cannot insert cross-references via text replace. Markers are read-only projections.`):n.push(`- Edit ${r+1+t} Failed: Cannot delete cross-references via text replace. The marker corresponds to a structural XML element.`):JSON.stringify(u)!==JSON.stringify(a)&&n.push(`- Edit ${r+1+t} Failed: Modifying or retargeting cross-reference markers is disallowed to prevent dependency corruption.`);}if(i.includes("docx-image:")||o.includes("docx-image:")){let u=(i.match(/!\[[^\]]*\]\(docx-image:[^)]*\)/g)||[]).sort(),a=(o.match(/!\[[^\]]*\]\(docx-image:[^)]*\)/g)||[]).sort();JSON.stringify(u)!==JSON.stringify(a)&&n.push(`- Edit ${r+1+t} Failed: image markers () are read-only projections of embedded images. They cannot be inserted, altered, or removed via text replacement \u2014 edit the text around the image instead.`);}if(i.includes("{#")||o.includes("{#")){let u=i.match(/\{#[^\}]+\}/g)||[],a=o.match(/\{#[^\}]+\}/g)||[];for(let c of a)if(a.filter(f=>f===c).length>u.filter(f=>f===c).length){n.push(`- Edit ${r+1+t} Failed: Cannot modify or insert internal anchor markers (\`{#...}\`). These represent structural XML bookmarks.`);break}}if(s.type==="modify"&&o){let u=o.split(/[\r\n]+/);for(let a of u){let c=a.trimStart();if(c.startsWith("#######")){let f=c.length-c.replace(/^#+/,"").length;if(c.substring(f).startsWith(" ")||c.substring(f)===""){n.push(`- Edit ${r+1+t} Failed: Heading level ${f} is not supported (maximum is 6).`);break}}}}(i.includes("READONLY_BOUNDARY_START")||o.includes("READONLY_BOUNDARY_START")||i.includes("# Document Structure (Read-Only)")||o.includes("# Document Structure (Read-Only)")||i.includes("Document Structure (Read-Only)")||o.includes("Document Structure (Read-Only)"))&&n.push(`- Edit ${r+1+t} Failed: Modification targets the read-only boundary (Structural Appendix). This section cannot be edited.`);}return n}d(lc,"validate_edit_strings");var Vr=class me{static{d(this,"_RedlineEngine");}doc;author;timestamp;current_id;mapper;comments_manager;clean_mapper=null;original_mapper=null;skipped_details=[];constructor(t,n="Adeu AI (TS)"){this.doc=t,this.author=n,this.timestamp=new Date().toISOString().replace(/\.\d{3}Z$/,"Z");let r="http://schemas.microsoft.com/office/word/2023/wordml/word16du";for(let s of this.doc.pkg.parts)s===this.doc.part&&(s._element.hasAttribute("xmlns:w16du")||s._element.setAttribute("xmlns:w16du",r));this.current_id=this._scan_existing_ids(),this.mapper=new Ye(this.doc),this.comments_manager=new jt(this.doc);}_check_punctuation_warning(t){return !t||t.length>20||t.includes(" ")?null:t.includes("_")||t.includes("-")?`Warning: target_text '${t}' contains tokenization-splitting punctuation ('_' or '-'). This can trigger mid-word splits in the diff engine. Consider using a longer plain-prose anchor.`:null}_word_diff_sub_edits(t,n,r,s=null,i=false,o=null){let l=[];try{l=io(t,n);}catch{l=[];}let u=d(f=>{let h=f.trim();return h.length>0&&/^[*_]+$/.test(h)},"_marker_only");if(l=l.filter(f=>!((!f.target_text||u(f.target_text))&&(!f.new_text||u(f.new_text))&&(f.target_text||f.new_text))),!l||l.length===0){let f={type:"modify",target_text:t,new_text:n,comment:s};return f._resolved_start_idx=r,f._match_start_index=r,f._active_mapper_ref=o,i&&(f._is_table_edit=true),t===n?f._internal_op="COMMENT_ONLY":!t&&n?f._internal_op="INSERTION":t&&!n?f._internal_op="DELETION":t&&n?f._internal_op="MODIFICATION":f._internal_op="COMMENT_ONLY",[f]}let a=[],c=false;for(let f of l){let h=r+(f._match_start_index||0),p=s!==null&&!c;p&&(c=true);let _={type:"modify",target_text:f.target_text,new_text:f.new_text,comment:p?s:null};_._resolved_start_idx=h,_._match_start_index=h,_._active_mapper_ref=o,i&&(_._is_table_edit=true);let m=f.target_text,g=f.new_text;!m&&g?_._internal_op="INSERTION":m&&!g?_._internal_op="DELETION":m&&g?_._internal_op="MODIFICATION":_._internal_op="COMMENT_ONLY",a.push(_);}return a}_nearest_match_hint(t,n){if(!t)return "";let r=t;if(n&&(r=r.replace(/^\^/,"").replace(/\$$/,""),r=r.replace(/^\\s\*/,"").replace(/\\s\*$/,""),r=r.replace(/\\([.^$*+?()[\]{}|\\/])/g,"$1")),r=r.trim(),(!r||r===t)&&!n)return "";let s=this.mapper.full_text.indexOf(r);if(s!==-1){let i=Math.max(0,s-15),o=Math.min(this.mapper.full_text.length,s+r.length+15),l=this.mapper.full_text.substring(i,o).replace(/\n/g," ");return `
|
|
70
|
+
Did you mean the literal "${r}"? It appears in the document (\u2026${l}\u2026). If you used a regex, drop the ^/$ anchors \u2014 they match the start/end of the entire document, not a line.`}return ""}static _PREVIEW_WRAPPER_PAIRS=[["{--","--}"],["{++","++}"],["{==","==}"],["{>>","<<}"]];static _tidy_preview_context(t,n){t=t.replace(/\{>>[\s\S]*?<<\}/g,"");for(let[r,s]of me._PREVIEW_WRAPPER_PAIRS)if(n==="before"){let i=0,o=0,l=0;for(;l<t.length;)t.startsWith(r,l)?(i+=1,l+=r.length):t.startsWith(s,l)?(i===0?o=l+s.length:i-=1,l+=s.length):l+=1;t=t.substring(o);}else {let i=[],o=0;for(;o<t.length;)t.startsWith(r,o)?(i.push(o),o+=r.length):t.startsWith(s,o)?(i.length>0&&i.pop(),o+=s.length):o+=1;i.length>0&&(t=t.substring(0,i[0]));}return n==="before"?t=t.replace(/^[-+=<>]{0,2}\}/,""):t=t.replace(/\{[-+=<>]{0,2}$/,""),t}_capture_preview_context(t){if(t.type!=="modify")return;let n=t._resolved_start_idx;if(n==null)return;let s=(t._active_mapper_ref||this.mapper).full_text;if(!s)return;let i=(t.target_text||"").length,o=s.substring(Math.max(0,n-Ut),n),l=s.substring(n+i,n+i+Ut);t._preview_context=[me._tidy_preview_context(o,"before"),me._tidy_preview_context(l,"after")];}_capture_parent_preview_context(t){if(!t||t.type!=="modify"||t._preview_context||!t._preview_span)return;let[n,r]=t._preview_span,i=(t._preview_mapper_ref||this.mapper).full_text;if(!i)return;let o=i.substring(Math.max(0,n-Ut),n),l=i.substring(n+r,n+r+Ut);t._preview_context=[me._tidy_preview_context(o,"before"),me._tidy_preview_context(l,"after")];}_build_full_match_preview(t){let[n,r]=t._preview_context,s=t._preview_matched_text||"",i=t._preview_new_text!==void 0&&t._preview_new_text!==null?t._preview_new_text:t.new_text||"",[o,l]=this._parse_markdown_style(s),[u,a]=this._parse_markdown_style(i);l&&l.startsWith("Heading")&&(n=n+s.substring(0,s.length-o.length),s=o),a&&a.startsWith("Heading")&&(i=u);let[c,f]=Zn(s,i),h=s.substring(c,s.length-f),p=i.substring(c,i.length-f);n=n+s.substring(0,c),f&&(r=s.substring(s.length-f)+r),h=Ae(h,vn),p=Ae(p,vn);let _;if(!h&&!p){let g=Ae(s,vn),v=g?`{==${g}==}`:"";_=`${n.substring(0,n.length-s.length)}${v}${r}`;}else {let g=h?`{--${h}--}`:"",v=p?`{++${p}++}`:"";_=`${n}${g}${v}${r}`;}let m=_;return m=m.replace(/\{>>[\s\S]*?<<\}/g,""),m=m.replace(/\{--[\s\S]*?--\}/g,""),m=m.replace(/\{\+\+([\s\S]*?)\+\+\}/g,"$1"),[_,m]}static _report_new_text(t){return t&&t.type==="insert_row"&&Array.isArray(t.cells)?t.cells.join(" | "):t&&t.new_text||""}_build_edit_context_previews(t){if(t.type!=="modify")return [null,null];if(t._preview_span&&t._preview_context)return this._build_full_match_preview(t);t._resolved_proxy_edit&&(t=t._resolved_proxy_edit);let n=t._resolved_start_idx;if(n==null)return [null,null];let r=t.target_text||"",s=t.new_text||"",[i,o]=this._parse_markdown_style(r);if(o&&o.startsWith("Heading")){let v=r.length-i.length;n+=v,r=i;}let[l,u]=this._parse_markdown_style(s);u&&u.startsWith("Heading")&&(s=l);let a=r.length,c,f;if(t._preview_context)[c,f]=t._preview_context;else {let D=(t._active_mapper_ref||this.mapper).full_text;if(!D)return [null,null];c=me._tidy_preview_context(D.substring(Math.max(0,n-Ut),n),"before"),f=me._tidy_preview_context(D.substring(n+a,n+a+Ut),"after");}let h=Ae(r,vn),p=Ae(s,vn),_=p?`{++${p}++}`:"",m=`${c}{--${h}--}${_}${f}`,g=m;return g=g.replace(/\{>>.*?<<\}/gs,""),g=g.replace(/\{--.*?--\}/gs,""),g=g.replace(/\{\+\+(.*?)\+\+\}/gs,"$1"),[m,g]}_scan_existing_ids(){let t=0;for(let n of ["w:ins","w:del"]){let r=I(this.doc.element,n);for(let s of r){let i=parseInt(s.getAttribute("w:id")||"0",10);!isNaN(i)&&i>t&&(t=i);}}return t}_get_heading_path_and_page(t,n,r){let s=1;for(let a=0;a<r.length&&t>=r[a];a++)s=a+1;let o=n.substring(0,t).split(`
|
|
71
|
+
`),l=[],u=999;for(let a=o.length-1;a>=0;a--){let f=o[a].match(/^(#{1,6})\s+(.*)/);if(f){let h=f[1].length;if(h<u){let p=f[2].replace(/\*\*|__|[*_]/g,"").replace(/\{#[^}]+\}/g,"").trim();if(p.length>80&&(p=p.substring(0,80)+"..."),l.unshift(p),u=h,h===1)break}}}return [l.join(" > "),s]}accept_all_revisions(){let t=[this.doc.element];for(let s of this.doc.pkg.parts)s!==this.doc.part&&s.contentType.includes("wordprocessingml")&&s.contentType.endsWith("+xml")&&t.push(s._element);for(let s of t){let i=I(s,"w:ins");for(let u of i){this._clean_wrapping_comments(u);let a=u.parentNode;if(a){if(a.tagName==="w:trPr"){a.removeChild(u);continue}for(;u.firstChild;)a.insertBefore(u.firstChild,u);a.removeChild(u);}}let o=I(s,"w:p");for(let u of o){let a=F(u,"w:pPr");if(a){let c=F(a,"w:rPr"),f=c?F(c,"w:del"):null;if(c&&f){let h=false;for(let p of ["w:t","w:tab","w:br"]){for(let _ of I(u,p)){if(p==="w:t"&&!_.textContent)continue;let m=false,g=_.parentNode;for(;g&&g!==u;){if(g.tagName==="w:del"){m=true;break}g=g.parentNode;}if(!m){h=true;break}}if(h)break}h?c.removeChild(f):(this._clean_wrapping_comments(u),this._delete_comments_in_element(u),u.parentNode&&u.parentNode.removeChild(u));}}}let l=I(s,"w:del");for(let u of l){this._clean_wrapping_comments(u),this._delete_comments_in_element(u);let a=u.parentNode;if(a)if(a.tagName==="w:trPr"){let c=a.parentNode;c&&c.parentNode&&c.parentNode.removeChild(c);}else a.removeChild(u);}}for(let s of t){for(let o of ["w:commentRangeStart","w:commentRangeEnd"])for(let l of I(s,o))l.parentNode?.removeChild(l);let i=I(s,"w:commentReference");for(let o of i){let l=o.parentNode;l&&((l.tagName==="w:r"||l.tagName.endsWith(":r"))&&Array.from(l.childNodes).filter(a=>a.nodeType===1&&a.tagName!=="w:rPr"&&a.tagName!=="rPr").length<=1?l.parentNode?.removeChild(l):l.removeChild(o));}}let n=this.doc.pkg,r=new Set;for(let s of n.parts)if(s.partname.toLowerCase().includes("comments")){r.add(s.partname);let i=s.partname.startsWith("/")?s.partname:"/"+s.partname,o=s.partname.startsWith("/")?s.partname.substring(1):s.partname;r.add(i),r.add(o);}if(r.size>0){for(let i of n.parts)if(i.partname.endsWith(".rels")){let o=I(i._element,"Relationship"),l=[];for(let u of o)if((u.getAttribute("Target")||"").toLowerCase().includes("comments")){l.push(u);let c=i.partname.replace("/_rels/","/").replace(".rels",""),f=n.getPartByPath(c);if(f){let h=u.getAttribute("Id");h&&f.rels.delete(h);}}for(let u of l)u.parentNode?.removeChild(u);}let s=n.getPartByPath("[Content_Types].xml");if(s){let i=I(s._element,"Override"),o=[];for(let l of i){let u=l.getAttribute("PartName")||"";(r.has(u)||u.toLowerCase().includes("comments"))&&o.push(l);}for(let l of o)l.parentNode?.removeChild(l);}n.parts=n.parts.filter(i=>!i.partname.toLowerCase().includes("comments"));for(let i of Object.keys(n.unzipped))i.toLowerCase().includes("comments")&&delete n.unzipped[i];}}reject_all_revisions(){let t=[this.doc.element];for(let n of this.doc.pkg.parts)n!==this.doc.part&&n.contentType.includes("wordprocessingml")&&n.contentType.endsWith("+xml")&&t.push(n._element);for(let n of t){let r=I(n,"w:ins");for(let o of r){let l=o.parentNode;if(l)if(this._clean_wrapping_comments(o),this._delete_comments_in_element(o),l.tagName==="w:trPr"){let u=l.parentNode;u&&u.parentNode&&u.parentNode.removeChild(u);}else l.removeChild(o);}let s=I(n,"w:p");for(let o of s){let l=F(o,"w:pPr");if(l){let u=F(l,"w:rPr"),a=u?F(u,"w:del"):null;u&&a&&u.removeChild(a);}}let i=I(n,"w:del");for(let o of i){let l=o.parentNode;if(!l)continue;if(this._clean_wrapping_comments(o),l.tagName==="w:trPr"){l.removeChild(o);continue}let u=Array.from(o.getElementsByTagName("w:delText"));for(let a of u){let c=o.ownerDocument.createElement("w:t");c.textContent=a.textContent,a.hasAttribute("xml:space")&&c.setAttribute("xml:space","preserve"),a.parentNode?.replaceChild(c,a);}for(;o.firstChild;)l.insertBefore(o.firstChild,o);l.removeChild(o);}}}_getNextId(){return this.current_id++,this.current_id.toString()}_create_track_change_tag(t,n="",r=null){let i=this.doc.part._element.ownerDocument.createElement(t),o=r!==null?r:this._getNextId();return i.setAttribute("w:id",o),i.setAttribute("w:author",n||this.author),i.setAttribute("w:date",this.timestamp),i.setAttribute("w16du:dateUtc",this.timestamp),i}_set_text_content(t,n){t.textContent=n,n.trim()!==n&&t.setAttribute("xml:space","preserve");}_comment_anchor_in_main_story(t){let n=t;for(;n.parentNode&&n.parentNode.nodeType===1;)n=n.parentNode;return n.tagName==="w:document"}_skip_comment_outside_main_story(t,n){if(this._comment_anchor_in_main_story(t))return false;let r=t;for(;r.parentNode&&r.parentNode.nodeType===1;)r=r.parentNode;let s={"w:ftr":"footer","w:hdr":"header","w:footnotes":"footnote","w:endnotes":"endnote"}[r.tagName]||"non-body",i=`- Warning: the comment "${n.substring(0,60)}" was NOT attached: Word does not support comments inside a ${s} part, and writing one produces a document other applications cannot open. The tracked change itself was applied.`;return this.skipped_details.push(i),true}_attach_comment(t,n,r,s){if(!s||!t||!n||!r||this._skip_comment_outside_main_story(t,s))return;let i=this.comments_manager.addComment(this.author,s),o=t.ownerDocument,l=o.createElement("w:commentRangeStart");l.setAttribute("w:id",i);let u=o.createElement("w:commentRangeEnd");u.setAttribute("w:id",i);let a=o.createElement("w:r"),c=o.createElement("w:rPr"),f=o.createElement("w:rStyle");f.setAttribute("w:val","CommentReference"),c.appendChild(f),a.appendChild(c);let h=o.createElement("w:commentReference");h.setAttribute("w:id",i),a.appendChild(h),t.insertBefore(l,n);let p=r.nextSibling;p?(t.insertBefore(u,p),t.insertBefore(a,u.nextSibling)):(t.appendChild(u),t.appendChild(a));}_attach_comment_spanning(t,n,r,s,i){if(!i||!t||!r||this._skip_comment_outside_main_story(t,i)||this._skip_comment_outside_main_story(r,i))return;let o=this.comments_manager.addComment(this.author,i),l=t.ownerDocument,u=r.ownerDocument,a=l.createElement("w:commentRangeStart");a.setAttribute("w:id",o);let c=u.createElement("w:commentRangeEnd");c.setAttribute("w:id",o);let f=u.createElement("w:r"),h=u.createElement("w:rPr"),p=u.createElement("w:rStyle");p.setAttribute("w:val","CommentReference"),h.appendChild(p),f.appendChild(h);let _=u.createElement("w:commentReference");_.setAttribute("w:id",o),f.appendChild(_),t.insertBefore(a,n);let m=s.nextSibling;m?(r.insertBefore(c,m),r.insertBefore(f,c.nextSibling)):(r.appendChild(c),r.appendChild(f));}_track_insert_multiline(t,n,r,s,i=null,o=false){if(!t)return {first_node:null,last_p:null,last_ins:null,used_block_mode:false};let l=this.doc.part._element.ownerDocument,u=t.split(/[\r\n]+/),a=null;if(r!==null)a=r._element;else if(n!==null){let N=n._element;for(;N&&N.tagName!=="w:p";)N=N.parentNode;a=N;}let c=[],f=i&&i.parentNode?i:n!==null&&n._element.parentNode?n._element:null;if(a!==null&&f!==null){let N=f;for(;N&&N.parentNode!==a;)if(N=N.parentNode,N===a){N=null;break}if(N){let x=new Set(["w:r","w:ins","w:del"]),C=N.nextSibling;for(;C;)C.nodeType===1&&x.has(C.tagName)&&c.push(C),C=C.nextSibling;}}for(;u.length>1&&u[u.length-1]===""&&c.length===0;)u.pop();if(u.length===0)return {first_node:null,last_p:null,last_ins:null,used_block_mode:false};let[h,p]=this._parse_markdown_style(u[0]),m=p!==null&&a!==null,g=null,v=null;m||(v=this._build_tracked_ins_for_line((h===u[0],u[0]),n,s,l,o),g=v);let D=m?u:u.slice(1);if(D.length===0)return {first_node:g,last_p:null,last_ins:v,used_block_mode:false};if(!a)return {first_node:g,last_p:null,last_ins:v,used_block_mode:false};let y=a.parentNode;if(!y)return {first_node:g,last_p:null,last_ins:v,used_block_mode:false};let w=d((N,x)=>{y.insertBefore(N,x.nextSibling);},"insertAfterEl"),E=null,b=null,A=a;for(let N=0;N<D.length;N++){let x=D[N],[C,P]=this._parse_markdown_style(x),S=l.createElement("w:p");if(P)this._set_paragraph_style(S,P);else {let B=F(a,"w:pPr");B&&S.appendChild(B.cloneNode(true));}let $=F(S,"w:pPr");$||($=l.createElement("w:pPr"),S.insertBefore($,S.firstChild));let O=F($,"w:rPr");O||(O=l.createElement("w:rPr"),$.appendChild(O));let T=this._create_track_change_tag("w:ins","",s);O.appendChild(T);let M=this._build_tracked_ins_for_line(C,n,s,l,o);M&&S.appendChild(M),w(S,A),A=S,E=S,b=M,g||(g=S);}if(!m&&E&&c.length>0)for(let N of c)N.parentNode?.removeChild(N),E.appendChild(N);return {first_node:g,last_p:E,last_ins:b,used_block_mode:m}}_build_tracked_ins_for_line(t,n,r,s,i=false){if(!t&&t!=="")return null;let o=this._create_track_change_tag("w:ins","",r),l=this._parse_inline_markdown(t);if(l.length===0)return null;for(let[u,a]of l){let c=s.createElement("w:r");if(n&&n._element){let h=F(n._element,"w:rPr");if(h){let p=h.cloneNode(true),_=["w:vanish","w:strike","w:dstrike","w:i","w:iCs"];i&&_.push("w:b","w:bCs");for(let m of _){let g=F(p,m);g&&p.removeChild(g);}c.appendChild(p);}}this._apply_run_props(c,a,false);let f=s.createElement("w:t");this._set_text_content(f,u),c.appendChild(f),o.appendChild(c);}return o}_parse_markdown_style(t){let n=t.trimStart();if(n.startsWith("#")){let s=0,i=n;for(;i.startsWith("#");)s++,i=i.substring(1);if(i.startsWith(" "))return [i.trim(),`Heading ${s}`]}if(n.startsWith("* ")||n.startsWith("- "))return [n.substring(2).trim(),"List Paragraph"];let r=n.match(/^1\.\s+/);return r?[n.substring(r[0].length).trim(),"List Number"]:[t,null]}_edit_declares_emphasis(t){for(let n of [t?.target_text,t?.new_text]){if(!n||!n.includes("**")&&!n.includes("_"))continue;if(this._parse_inline_markdown(n).some(([,s])=>s&&Object.keys(s).length>0))return true}return false}_parse_inline_markdown(t,n={}){if(!t)return [];let r=/(\*\*.*?\*\*)|(_.*?_)/,s=t.match(r);if(!s)return [[t,n]];let i=s.index,o=s[0],l=i+o.length,u=o.startsWith("**"),a=u?o.substring(2,o.length-2):o.substring(1,o.length-1),c=t.substring(0,i),f=t.substring(l),h=[];c&&h.push([c,n]);let p={...n};return u?p.bold=true:p.italic=true,h.push(...this._parse_inline_markdown(a,p)),h.push(...this._parse_inline_markdown(f,n)),h}_apply_run_props(t,n,r=false){if(!n){if(!r)return;n={};}let s=F(t,"w:rPr");if(!s&&(n.bold||n.italic||r)&&(s=t.ownerDocument.createElement("w:rPr"),t.appendChild(s)),s){let i=t.ownerDocument;if(n.bold){let o=F(s,"w:b");o||(o=i.createElement("w:b"),s.appendChild(o)),o.setAttribute("w:val","1");}else if(r){let o=F(s,"w:b");o&&s.removeChild(o);}if(n.italic){let o=F(s,"w:i");o||(o=i.createElement("w:i"),s.appendChild(o)),o.setAttribute("w:val","1");}else if(r){let o=F(s,"w:i");o&&s.removeChild(o);}}}_set_paragraph_style(t,n){let r=t.ownerDocument,s=F(t,"w:pPr");s&&t.removeChild(s);let i=r.createElement("w:pPr"),o=r.createElement("w:pStyle"),l=n.replace(/\s+/g,"");o.setAttribute("w:val",l),i.appendChild(o),t.insertBefore(i,t.firstChild);}_anchor_reply_comment(t,n){let r=this.doc.part._element.ownerDocument,s=I(this.doc.element,"w:commentRangeStart").filter(g=>g.getAttribute("w:id")===t);if(s.length===0)return;let i=s[0],o=r.createElement("w:commentRangeStart");o.setAttribute("w:id",n),qt(o,i);let l=I(this.doc.element,"w:commentRangeEnd").filter(g=>g.getAttribute("w:id")===t);if(l.length===0)return;let u=l[0],a=I(this.doc.element,"w:commentReference").filter(g=>g.getAttribute("w:id")===t),c=u;if(a.length>0){let g=a[0];g.parentNode&&g.parentNode.tagName==="w:r"&&(c=g.parentNode);}let f=r.createElement("w:commentRangeEnd");f.setAttribute("w:id",n),qt(f,c);let h=r.createElement("w:r"),p=r.createElement("w:rPr"),_=r.createElement("w:rStyle");_.setAttribute("w:val","CommentReference"),p.appendChild(_),h.appendChild(p);let m=r.createElement("w:commentReference");m.setAttribute("w:id",n),h.appendChild(m),qt(h,f);}_get_comment_author(t){let n=this.doc.pkg.parts.find(s=>s.contentType==="application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml");if(!n)return null;let r=I(n._element,"w:comment");for(let s of r)if(s.getAttribute("w:id")===t)return s.getAttribute("w:author");return null}_clean_wrapping_comments(t){let n=t;for(;;){let a=Qn(n);if(a&&(a.tagName==="w:ins"||a.tagName==="w:del"))n=a;else break}let r=t;for(;;){let a=ht(r);if(a&&(a.tagName==="w:ins"||a.tagName==="w:del"))r=a;else break}let s=[],i=Qn(n);for(;i;)if(i.tagName==="w:commentRangeStart")s.push(i),i=Qn(i);else if(i.tagName==="w:rPr"||i.tagName==="w:pPr")i=Qn(i);else break;let o=[],l=ht(r);for(;l;)if(l.tagName==="w:commentRangeEnd")o.push(l),l=ht(l);else if(l.tagName==="w:r"&&I(l,"w:commentReference").length>0)o.push(l),l=ht(l);else if(l.tagName==="w:commentReference")o.push(l),l=ht(l);else break;let u=new Set;for(let a of o)if(a.tagName==="w:commentRangeEnd"){let c=a.getAttribute("w:id");c&&u.add(c);}else {let c=I(a,"w:commentReference")[0];if(!c&&a.tagName==="w:commentReference"&&(c=a),c){let f=c.getAttribute("w:id");f&&u.add(f);}}for(let a of s){let c=a.getAttribute("w:id");if(c&&u.has(c)){let f=this._get_comment_author(c);f!==null&&f===this.author&&this.comments_manager.deleteComment(c),a.parentNode&&a.parentNode.removeChild(a);for(let p of o){let _=null;if(p.tagName==="w:commentRangeEnd")_=p.getAttribute("w:id");else {let m=I(p,"w:commentReference")[0];!m&&p.tagName==="w:commentReference"&&(m=p),m&&(_=m.getAttribute("w:id"));}_===c&&p.parentNode&&p.parentNode.removeChild(p);}}}}_delete_comments_in_element(t){let n=I(t,"w:commentReference");for(let r of n){let s=r.getAttribute("w:id");if(s){this.comments_manager.deleteComment(s);for(let i of ["w:commentRangeStart","w:commentRangeEnd"]){let o=I(this.doc.element,i);for(let l of o)l.getAttribute("w:id")===s&&l.parentNode&&l.parentNode.removeChild(l);}}}}validate_edits(t,n=0){let r=[];this.mapper.full_text||this.mapper._build_map(),r.push(...lc(t,n));for(let s=0;s<t.length;s++){let i=t[s];if(typeof i!="object"||i===null){r.push(`- Edit ${s+1+n} Failed: Invalid change format. Expected a JSON object, but received a primitive ${typeof i}. Do not pass raw strings.`);continue}if(!i.target_text||i._match_start_index!==void 0&&i._match_start_index!==null||i._resolved_start_idx!==void 0&&i._resolved_start_idx!==null)continue;let o=i.regex||false,l=i.match_mode||"strict";if(o)try{new RegExp(i.target_text);}catch(p){r.push(`- Edit ${s+1+n} Failed: target_text is not a valid regular expression (${p?.message??p}). Fix the pattern, or set "regex": false to match the text literally.`);continue}let u=this.mapper.find_all_match_indices(i.target_text,o),a=this.mapper.full_text,c=this.mapper;u.length===0&&(this.clean_mapper||(this.clean_mapper=new Ye(this.doc,true)),u=this.clean_mapper.find_all_match_indices(i.target_text,o),u.length>0&&(a=this.clean_mapper.full_text,c=this.clean_mapper)),a===this.mapper.full_text&&u.length>0&&(u=u.filter(([_,m])=>{let g=this.mapper.spans.filter(v=>v.run!==null&&v.end>_&&v.start<_+m);return g.length===0?true:g.some(v=>!v.del_id)}));let f=false,h=new Set;if(u.length===0){this.original_mapper||(this.original_mapper=new Ye(this.doc,false,true));let p=this.original_mapper.find_all_match_indices(i.target_text,o);if(p.length>0){f=true;for(let[_,m]of p){let g=this.original_mapper.spans.filter(v=>v.end>_&&v.start<_+m);for(let v of g)if(v.run!==null){let D=v.run._element;for(;D;){if(D.nodeType===1&&D.tagName==="w:del"){let y=D.getAttribute("w:author");y&&h.add(y);break}D=D.parentNode;}}}}}if(u.length===0)if(f){let p=h.size>0?`by ${Array.from(h).sort().join(", ")}`:"by an existing revision";r.push(`- Edit ${s+1+n} Failed: Target text matches text inside a tracked deletion ${p}. Reject/accept that change first or target the active replacement text instead.`);}else {let p=this._nearest_match_hint(i.target_text,o);r.push(`- Edit ${s+1+n} Failed: Target text not found in document:
|
|
72
|
+
"${Ae(i.target_text,Xe)}"${p}`);}else if(u.length>1&&l==="strict")if(i.target_text.includes("|"))u=u.slice(0,1);else {let p=u.map(([_,m])=>[_,_+m]);r.push(ic(s+1+n,i.target_text,a,p));}if(u.length===1){let[p,_]=u[0],m=a.substring(p,p+_),[g,v]=Zn(m,i.new_text||""),D=m.length-v,y=m.substring(g,D),w=(i.new_text||"").substring(g,(i.new_text||"").length-v),b=c.part_ranges.filter(x=>x[1]>x[0]).length>1?Array.from(new Set(c.spans.filter(x=>x.run!==null&&x.end>p&&x.start<p+_).map(x=>x.part_index))).sort((x,C)=>x-C):[];if(b.length>1){let x=b.map(C=>c.part_kind_of(C)||"?").join(" \u2192 ");r.push(`- Edit ${s+1+n} Failed: target_text spans a structural document-part boundary (${x}). Headers, body, footers and footnotes are separate Word parts \u2014 an edit cannot cross between them. Anchor the edit on text within a single part (split it into one edit per part if both sides must change).`);}let A=p+g,N=p+_-v;if(N>A&&c.spans.filter(C=>C.end>A&&C.start<N&&(C.run!==null||C.text.trim()!=="")).some(C=>C.is_image_marker)&&r.push(`- Edit ${s+1+n} Failed: the target overlaps a read-only image marker (). Images cannot be edited or removed via text replacement \u2014 target the text around the image instead.`),i.comment&&(i.new_text||"")===(i.target_text||"")){let x=c.part_kind_at(p);x!==null&&x!=="body"&&r.push(`- Edit ${s+1+n} Failed: comments cannot be anchored inside a ${x} part \u2014 Word only supports comments in the main document body. Comment on the related body text instead.`);}if(me._introduces_table_row_text(c,p,_,y,w)&&r.push(`- Edit ${s+1+n} Failed: new_text introduces a pipe-delimited row line inside a table. Text replacement cannot create table rows \u2014 use the structured 'insert_row' operation instead (e.g. {"type": "insert_row", "target_text": "<anchor row text>", "cells": ["...", "..."]}).`),y.includes(`
|
|
73
73
|
|
|
74
74
|
`)&&!(m.split(`
|
|
75
75
|
|
|
@@ -77,50 +77,50 @@ ${u}`,a++;else break}t.push([l,o]),n=a;}return t}d(ec,"_merge_footnote_sections"
|
|
|
77
77
|
|
|
78
78
|
`).length))if(w.includes(`
|
|
79
79
|
|
|
80
|
-
`)){let
|
|
80
|
+
`)){let C=m.split(`
|
|
81
81
|
|
|
82
|
-
`);
|
|
82
|
+
`);C.length>=2&&C[0].trim()!==""&&C[C.length-1].trim()!==""&&r.push(`- Edit ${s+1+n} Failed: target_text spans a paragraph boundary with body text on both sides. The paragraph break is a structural element, not literal text, so it cannot be replaced as a single span without corrupting the document. Split this into one edit per paragraph.`);}else {let C=y.split(`
|
|
83
83
|
|
|
84
|
-
`);
|
|
85
|
-
`)||!i.includes(" | "))return false;let
|
|
86
|
-
`).filter(
|
|
87
|
-
`).filter(
|
|
88
|
-
`),critic_markup:null,clean_text:null};continue}this.apply_edits([v],u);if(v._applied_status){f++;let b=this._build_edit_context_previews(v);m[E]={status:"applied",target_text:De(v.target_text||"",Ye),new_text:De(me._report_new_text(v),Ye),warning:null,error:null,critic_markup:b[0],clean_text:b[1],pages:v._pages||[],heading_path:v._heading_path||"",occurrences_modified:v._occurrences_modified||0,match_mode:v.match_mode||"strict"},this.mapper=new Ge(this.doc),this.clean_mapper=null;}else {h++;let b=this.skipped_details.length>0?this.skipped_details[this.skipped_details.length-1]:"Failed to apply edit",D=this._check_punctuation_warning(v.target_text||"");m[E]={status:"failed",target_text:De(v.target_text||"",Ye),new_text:De(me._report_new_text(v),Ye),warning:D,error:b,critic_markup:null,clean_text:null};}}if(g.size>0){f=0,h=o.length;for(let v=0;v<m.length;v++){let E=m[v];!E||g.has(v)||E.status==="applied"&&(m[v]={status:"failed",target_text:E.target_text,new_text:E.new_text,warning:null,error:oc,critic_markup:null,clean_text:null});}}c.push(...m);}else {let m=Bo(this.doc),g=this.current_id;try{let v=[],E=0;for(let{edit:y,i:w}of _){let b;try{b=this.validate_edits([y],w);}catch(D){if(!(D instanceof zt))throw D;b=[`- Edit ${w+1} Failed: ${D.message}`];}if(b.length>0){if(E>0){let D=Lo(E);b=b.map(A=>A+D);}v.push(...b);}else this.apply_edits([y],u),y._applied_status&&E++,this.mapper=new Ge(this.doc),this.clean_mapper=null;}if(v.length>0)throw new yn(v)}catch(v){throw Fo(this.doc,m),this.current_id=g,this.mapper=new Ge(this.doc),this.comments_manager=new jt(this.doc),this.clean_mapper=null,v}f=o.filter(v=>v._applied_status).length,h=o.length-f;for(let v of o){let E=v._applied_status||false,y=v._error_msg||null,w=null,b=null,D=null;if(E){let A=this._build_edit_context_previews(v);w=A[0],b=A[1];}else D=this._check_punctuation_warning(v.target_text||"");c.push({status:E?"applied":"failed",target_text:De(v.target_text||"",Ye),new_text:De(me._report_new_text(v),Ye),warning:D,error:y,critic_markup:w,clean_text:b,pages:v._pages||[],heading_path:v._heading_path||"",occurrences_modified:v._occurrences_modified||0,match_mode:v.match_mode||"strict"});}}}return {actions_applied:i,actions_skipped:s,edits_applied:f,edits_skipped:h,skipped_details:this.skipped_details,edits:c,engine:"node",version:"1.18.2"}}apply_edits(t,n=[]){let r=0,o=0;if(!n||n.length===0){let[a]=Wt(this.mapper.full_text);n=Ht(a,"").body_page_offsets;}let i=[];for(let a of t){if(typeof a!="object"||a===null){o++;continue}a._applied_status=false,a._error_msg=null;}for(let a of t)if(!(typeof a!="object"||a===null))if(a._resolved_start_idx!==void 0&&a._resolved_start_idx!==null)i.push([a,a.new_text||null]);else if(a._match_start_index!==void 0&&a._match_start_index!==null)a._resolved_start_idx=a._match_start_index,i.push([a,a.new_text||null]);else if(a.type==="insert_row"||a.type==="delete_row"){let u=this.mapper.find_all_match_indices(a.target_text),c=this.mapper;if(u.length===0&&(this.clean_mapper||(this.clean_mapper=new Ge(this.doc,true)),u=this.clean_mapper.find_all_match_indices(a.target_text),c=this.clean_mapper),u.length>0)a._resolved_start_idx=u[0][0],a._active_mapper_ref=c,i.push([a,null]);else {o++,a._applied_status=false;let h=`- Failed to locate row target: '${(a.target_text||"").trim().substring(0,40)}...'`;this.skipped_details.push(h),a._error_msg=h;}}else {let u;try{u=this._pre_resolve_heuristic_edit(a);}catch(c){if(!(c instanceof zt))throw c;o++,a._applied_status=false;let f=`- Failed to apply edit targeting: '${(a.target_text||"").substring(0,40)}...' (${c.message})`;this.skipped_details.push(f),a._error_msg=f;continue}if(u)if(Array.isArray(u))for(let c of u)c._resolved_start_idx=c._match_start_index,c._parent_edit_ref=a,(a._resolved_start_idx===void 0||a._resolved_start_idx===null)&&(a._resolved_start_idx=c._resolved_start_idx),a._resolved_proxy_edit||(a._resolved_proxy_edit=c),i.push([c,c.new_text]);else u._resolved_start_idx=u._match_start_index,u._parent_edit_ref=a,a._resolved_start_idx=u._resolved_start_idx,a._resolved_proxy_edit=u,i.push([u,u.new_text]);else {o++,a._applied_status=false;let h=`- Failed to apply edit targeting: '${(a.target_text||"insertion").trim().substring(0,40)}...'`;this.skipped_details.push(h),a._error_msg=h;}}i.sort((a,u)=>(u[0]._resolved_start_idx||0)-(a[0]._resolved_start_idx||0));for(let[a]of i)this._capture_preview_context(a),a._parent_edit_ref&&this._capture_parent_preview_context(a._parent_edit_ref);let s=[],l=new Set;for(let[a,u]of i){let c=a._resolved_start_idx||0,f=a.type==="insert_row"?c:c+(a.target_text?a.target_text.length:0);if(s.some(([_,m])=>c<m&&f>_)){o++;let g=`- Skipped overlapping edit targeting: '${(a.target_text||"insertion").trim().substring(0,40)}...'`;this.skipped_details.push(g),a._applied_status=false,a._error_msg=g;let v=a._parent_edit_ref;v&&(v._applied_status=false,v._error_msg=g);continue}let p=false;if(a.type==="modify"){let _=a._split_group_id!==void 0&&a._split_group_id!==null;p=this._apply_single_edit_indexed(a,u,_);}else (a.type==="insert_row"||a.type==="delete_row")&&(p=this._apply_table_edit(a,false));if(p){let _=a._split_group_id,m=_==null||!l.has(_);m&&_!==void 0&&_!==null&&l.add(_),m&&r++,s.push([c,f]),a._applied_status=true;let g=a._parent_edit_ref;if(g){g._applied_status=true,m&&(g._occurrences_modified=(g._occurrences_modified||0)+1);let[v,E]=this._get_heading_path_and_page(c,this.mapper.full_text,n),y=g._pages||[];y.includes(E)||y.unshift(E),g._pages=y,g._heading_path=v;}else {m&&(a._occurrences_modified=(a._occurrences_modified||0)+1);let[v,E]=this._get_heading_path_and_page(c,this.mapper.full_text,n),y=a._pages||[];y.includes(E)||y.unshift(E),a._pages=y,a._heading_path=v;}}else {o++;let g=`- Failed to apply edit targeting: '${(a.target_text||"insertion").trim().substring(0,40)}...'`;this.skipped_details.push(g),a._applied_status=false,a._error_msg=g;let v=a._parent_edit_ref;v&&(v._applied_status||(v._applied_status=false,v._error_msg=g));}}return [r,o]}apply_review_actions(t){let n=0,r=0;for(let o of t){let i=o.type;if(i==="reply"){let f=o.target_id.replace("Com:",""),h=this.comments_manager.addComment(this.author,o.text,f);this._anchor_reply_comment(f,h),n++;continue}let s=o.target_id.replace("Chg:",""),l=I(this.doc.element,"w:ins").filter(f=>f.getAttribute("w:id")===s),a=I(this.doc.element,"w:del").filter(f=>f.getAttribute("w:id")===s),u=[...l,...a];if(u.length===0){r++,this.skipped_details.push(`- Failed to apply action: Target ID ${o.target_id} not found.`);continue}let c=Array.from(new Set(u.map(f=>f.getAttribute("w:author")||"Unknown"))).sort();if(c.length>1){r++,this.skipped_details.push(`- Failed to apply action: ${i} on Chg:${s} is ambiguous. The document contains ${u.length} tracked-change elements sharing w:id=${s} from different authors (${c.join(", ")}) \u2014 duplicate revision IDs produced outside this engine (e.g. by a document merge or copy-paste). Acting on this ID would resolve all of them at once. Resolve these changes individually in Word, or apply the intended outcome as an explicit text edit instead.`);continue}for(let f of u){let h=f.tagName==="w:ins",_=(f.parentNode?f.parentNode.tagName:"")==="w:trPr";if(i==="accept")if(h)if(this._clean_wrapping_comments(f),_)f.parentNode?.removeChild(f);else {for(;f.firstChild;)f.parentNode?.insertBefore(f.firstChild,f);f.parentNode?.removeChild(f);}else if(this._clean_wrapping_comments(f),this._delete_comments_in_element(f),_){let m=f.parentNode?.parentNode;m?.parentNode?.removeChild(m);}else f.parentNode?.removeChild(f);else if(i==="reject")if(h)if(this._clean_wrapping_comments(f),this._delete_comments_in_element(f),_){let m=f.parentNode?.parentNode;m?.parentNode?.removeChild(m);}else f.parentNode?.removeChild(f);else if(this._clean_wrapping_comments(f),_)f.parentNode?.removeChild(f);else {let m=Array.from(f.getElementsByTagName("w:delText"));for(let g of m){let v=g.ownerDocument.createElement("w:t");v.textContent=g.textContent,g.hasAttribute("xml:space")&&v.setAttribute("xml:space","preserve"),g.parentNode?.replaceChild(v,g);}for(;f.firstChild;)f.parentNode?.insertBefore(f.firstChild,f);f.parentNode?.removeChild(f);}}n++;}return [n,r]}_apply_table_edit(t,n){let r=t._resolved_start_idx!==void 0&&t._resolved_start_idx!==null?t._resolved_start_idx:t._match_start_index||0,o=t._active_mapper_ref||this.mapper,[i,s]=o.get_insertion_anchor(r,n),l=null;if(i?l=i._element:s&&(l=s._element),!l)return false;let a=l;for(;a&&a.tagName!=="w:tr";)a=a.parentNode;if(!a)return false;if(t.type==="delete_row"){let u=F(a,"w:trPr");return u||(u=a.ownerDocument.createElement("w:trPr"),a.insertBefore(u,a.firstChild)),u.appendChild(this._create_track_change_tag("w:del")),true}else if(t.type==="insert_row"){let u=a.ownerDocument.createElement("w:tr"),c=a.ownerDocument.createElement("w:trPr");u.appendChild(c),c.appendChild(this._create_track_change_tag("w:ins"));let f=I(a,"w:tc").filter(p=>p.parentNode===a).length,h=Array.isArray(t.cells)?[...t.cells]:[];if(f>0){for(;h.length<f;)h.push("");h=h.slice(0,f);}for(let p of h){let _=a.ownerDocument.createElement("w:tc"),m=a.ownerDocument.createElement("w:p"),g=a.ownerDocument.createElement("w:r"),v=a.ownerDocument.createElement("w:t");v.textContent=p,p.trim()!==p&&v.setAttribute("xml:space","preserve"),g.appendChild(v),m.appendChild(g),_.appendChild(m),u.appendChild(_);}return t.position==="above"?a.parentNode?.insertBefore(u,a):qt(u,a),true}return false}_pre_resolve_heuristic_edit(t){if(!t.target_text)return null;let n=t.regex||false,r=t.match_mode||"strict",o=this.mapper.find_all_match_indices(t.target_text,n),i=false;if(o.length===0)if(this.clean_mapper||(this.clean_mapper=new Ge(this.doc,true)),o=this.clean_mapper.find_all_match_indices(t.target_text,n),o.length>0)i=true;else return null;let s=i?this.clean_mapper:this.mapper,l=[];for(let[u,c]of o){let f=s.spans.filter(h=>h.run!==null&&h.end>u&&h.start<u+c);(f.length===0||f.some(h=>!h.del_id))&&l.push([u,c]);}if(l.length===0)return null;(r==="strict"||r==="first")&&(l=l.slice(0,1));let a=[];for(let[u,c]of l){let f=s.full_text.substring(u,u+c),h=t.new_text||"";if(/^\{#cell:[^}]+\}$/.test(f.trim())){let T=h;T=T.split(f.trim()).join(""),T?a.push({type:"modify",target_text:"",new_text:T,comment:t.comment,_match_start_index:u,_internal_op:"INSERTION",_active_mapper_ref:s}):t.comment&&a.push({type:"modify",target_text:"",new_text:"",comment:t.comment,_match_start_index:u,_internal_op:"COMMENT_ONLY",_active_mapper_ref:s});continue}if(n&&h)try{h=f.replace(new RegExp(t.target_text),h);}catch{}t._preview_span||(t._preview_span=[u,c],t._preview_matched_text=f,t._preview_new_text=h,t._preview_mapper_ref=s);let[p,_]=this._parse_markdown_style(t.target_text),[m,g]=this._parse_markdown_style(h);if(_!==g){let[T]=this._parse_markdown_style(f),k=T,P=m,O=k===P?"STYLE_ONLY":"STYLE_AND_TEXT",C=f.indexOf(T),M=u+(C!==-1?C:0),B=g!==null?g:"Normal";a.push({type:"modify",target_text:k,new_text:P,comment:t.comment,_match_start_index:M,_internal_op:O,_new_style:B,_active_mapper_ref:s});continue}if(f===h||t.target_text===h){a.push({type:"modify",target_text:f,new_text:f,comment:t.comment,_match_start_index:u,_internal_op:"COMMENT_ONLY",_active_mapper_ref:s});continue}let v=false;if(s&&(v=s.spans.some(T=>T.text===" | "&&(T.run===null||T.run===void 0)&&T.start<u+c&&T.end>u)),v){let T=f.split("|"),k=h.split("|");if(T.length!==k.length)throw new yn([`Target text spans ${T.length} table cells, but replacement provides ${k.length}. To modify text without altering table structure (rows or columns), ensure the replacement contains the exact same number of '|' separators (e.g., replace with 'CellC | ' to empty the second cell).`]);if(T.length>1){let P=[],O=0,C=0;for(let M=0;M<T.length;M++)if(T[M].trim()!==k[M].trim()){C=M;break}for(let M=0;M<T.length;M++){let B=T[M],$=k[M],U=B.trim(),R=$.trim(),H=u+O+(U?B.indexOf(U):0),Z=t.comment!==null&&t.comment!==void 0&&M===C;if(U!==R||Z){let Q=this._word_diff_sub_edits(U,R,H,Z?t.comment:null,true,s);for(let V of Q)V._original_target_text=t.target_text,V._split_group_id=u,P.push(V);}O+=B.length+1;}for(let M of P)a.push(M);continue}}let E=false;t.target_text&&(t.target_text.includes("**")||t.target_text.includes("_"))&&(E=true),h&&(h.includes("**")||h.includes("_"))&&(E=true);let y="",w="",b="",D=u;if(h.startsWith(f))y="INSERTION",b=h.substring(f.length),D=u+c;else {let[T,k]=Zn(f,h),P=f.length-k,O=h.length-k;w=f.substring(T,P),b=h.substring(T,O),D=u+T;}if(E){if(!w&&b)y="INSERTION";else if(w&&!b)y="DELETION";else if(w&&b)y="MODIFICATION";else {a.push({type:"modify",target_text:w,new_text:b,comment:t.comment,_match_start_index:D,_internal_op:"COMMENT_ONLY",_active_mapper_ref:s});continue}a.push({type:"modify",target_text:w,new_text:b,comment:t.comment,_resolved_start_idx:D,_match_start_index:D,_internal_op:y,_active_mapper_ref:s});continue}let A=f.split(`
|
|
84
|
+
`);C.length>=2&&C[0].trim()!==""&&C[C.length-1].trim()!==""&&r.push(`- Edit ${s+1+n} Failed: target_text spans a paragraph boundary with body text on both sides. The paragraph break is a structural element, not literal text, so it cannot be replaced as a single span without corrupting the document. Split this into one edit per paragraph.`);}}for(let[p,_]of u){let m=c.spans.filter(y=>y.end>p&&y.start<p+_),g=new Set,v=new Set,D=false;for(let y of m){if(y.run===null)continue;let w=false;if(y.ins_id){let E=I(this.doc.element,"w:ins").filter(b=>b.getAttribute("w:id")===y.ins_id);if(E.length>0){let b=E[0].getAttribute("w:author");b&&b!==this.author&&(g.add(b),w=true);}}w||(D=true);}for(let y of m)if(y.comment_ids)for(let w of y.comment_ids){let E=this.mapper.comments_map[w];E&&E.author&&E.author!==this.author&&v.add(E.author);}if(g.size>0&&!((l==="strict"||l==="first")&&!D)){r.push(`- Edit ${s+1+n} Failed: Modification targets an active insertion from another author (${Array.from(g).join(", ")}). Accept that change first or scope your edit outside of it.`);continue}v.size>0&&l==="all"&&r.push(`- Edit ${s+1+n} Failed: match_mode="all" would sweep through a comment range from another author (${Array.from(v).join(", ")}). Target the commented text deliberately with match_mode "strict" or "first", or scope your edit outside of it.`);}if((i.type==="insert_row"||i.type==="delete_row")&&u.length>0){let[p,_]=u[0],m=me._column_count_at(c,p,_);m===null?r.push(`- Edit ${s+1+n} Failed: ${i.type} target text was found, but it is not inside a table row. Anchor the operation on text that appears within the table.`):i.type==="insert_row"&&Array.isArray(i.cells)&&i.cells.length>m&&r.push(`- Edit ${s+1+n} Failed: insert_row provides ${i.cells.length} cells but the target table has ${m} column(s). The extra cell(s) would be dropped. Provide at most ${m} cells \u2014 rows given fewer cells are padded with empty ones.`);}}return r}static _introduces_table_row_text(t,n,r,s,i){if(!i.includes(`
|
|
85
|
+
`)||!i.includes(" | "))return false;let o=i.split(`
|
|
86
|
+
`).filter(u=>u.includes(" | ")).length,l=s.split(`
|
|
87
|
+
`).filter(u=>u.includes(" | ")).length;return o<=l?false:me._column_count_at(t,n,Math.max(r,1))!==null}static _column_count_at(t,n,r){for(let s of t.spans){if(s.run===null||s.end<=n||s.start>=n+r)continue;let i=s.run._element;for(;i;){if(i.nodeType===1&&i.tagName==="w:tr")return I(i,"w:tc").filter(o=>o.parentNode===i).length;i=i.parentNode;}}return null}validate_review_actions(t){let n=[];for(let r=0;r<t.length;r++){let s=t[r],i=s.type;if(i==="reply"){let o=s.target_id.replace("Com:",""),l=false,u=this.doc.pkg.parts.find(a=>a.contentType==="application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml");u&&(l=I(u._element,"w:comment").some(c=>c.getAttribute("w:id")===o)),l||n.push(`- Action ${r+1} Failed: Target comment ID ${s.target_id} not found.`);}else if(i==="accept"||i==="reject"){let o=s.target_id.replace("Chg:",""),l=I(this.doc.element,"w:ins").filter(a=>a.getAttribute("w:id")===o),u=I(this.doc.element,"w:del").filter(a=>a.getAttribute("w:id")===o);l.length===0&&u.length===0&&n.push(`- Action ${r+1} Failed: Target ID ${s.target_id} not found.`);}}return n}process_batch(t,n=false){if(Array.isArray(t)&&(t=t.map(r=>{if(typeof r=="string")try{let s=JSON.parse(r);return s!==null&&typeof s=="object"?s:r}catch{return r}return r})),n){let r=Rs(this.doc),s=this.current_id;try{return this._process_batch_internal(t,!0)}finally{Bs(this.doc,r),this.current_id=s,this.mapper=new Ye(this.doc),this.comments_manager=new jt(this.doc),this.clean_mapper=null;}}else return this._process_batch_internal(t,false)}_process_batch_internal(t,n=false){for(let p of t)if(p&&typeof p=="object"&&p.type==="modify"&&p.target_text&&p.new_text){let[_,m]=sc(p.target_text,p.new_text);p.target_text=_,p.new_text=m;}this.skipped_details=[];let r=t.filter(p=>p!==null&&typeof p=="object"&&["accept","reject","reply"].includes(p.type)),s=t.filter(p=>p===null||typeof p!="object"||!["accept","reject","reply"].includes(p.type));if(n){if(r.length>0){let p=this.validate_review_actions(r);if(p.length>0)throw new yn(p)}}else {let p=r.length>0?this.validate_review_actions(r):[],m=s.length>0&&p.length>0?this.validate_edits(s):[],g=[...p,...m];if(g.length>0)throw new yn(g)}let i=0,o=0;if(r.length>0){let p=this.apply_review_actions(r);if(i=p[0],o=p[1],o>0)throw new yn(this.skipped_details);i>0&&(this.mapper._build_map(),this.clean_mapper&&this.clean_mapper._build_map());}let[l]=Wt(this.mapper.full_text),a=Ht(l,"").body_page_offsets,c=[],f=0,h=0;if(s.length>0){let p=d(m=>m._resolved_start_idx!==void 0&&m._resolved_start_idx!==null?m._resolved_start_idx:m._match_start_index!==void 0&&m._match_start_index!==null?m._match_start_index:null,"pinned_idx"),_=s.map((m,g)=>({edit:m,i:g})).sort((m,g)=>{let v=p(m.edit),D=p(g.edit);return v===null&&D===null?m.i-g.i:v===null?1:D===null?-1:D-v||m.i-g.i});if(n){let m=new Array(s.length),g=new Set;for(let{edit:v,i:D}of _){let y;try{y=this.validate_edits([v],D);}catch(E){if(!(E instanceof zt))throw E;y=[`- Edit ${D+1} Failed: ${E.message}`];}if(y.length>0){if(f>0){let b=Fs(f);y=y.map(A=>A+b);}g.add(D),h++;let E=this._check_punctuation_warning(v.target_text||"");m[D]={status:"failed",target_text:Ae(v.target_text||"",Xe),new_text:Ae(me._report_new_text(v),Xe),warning:E,error:y.join(`
|
|
88
|
+
`),critic_markup:null,clean_text:null};continue}this.apply_edits([v],a);if(v._applied_status){f++;let E=this._build_edit_context_previews(v);m[D]={status:"applied",target_text:Ae(v.target_text||"",Xe),new_text:Ae(me._report_new_text(v),Xe),warning:null,error:null,critic_markup:E[0],clean_text:E[1],pages:v._pages||[],heading_path:v._heading_path||"",occurrences_modified:v._occurrences_modified||0,match_mode:v.match_mode||"strict"},this.mapper=new Ye(this.doc),this.clean_mapper=null;}else {h++;let E=this.skipped_details.length>0?this.skipped_details[this.skipped_details.length-1]:"Failed to apply edit",b=this._check_punctuation_warning(v.target_text||"");m[D]={status:"failed",target_text:Ae(v.target_text||"",Xe),new_text:Ae(me._report_new_text(v),Xe),warning:b,error:E,critic_markup:null,clean_text:null};}}if(g.size>0){f=0,h=s.length;for(let v=0;v<m.length;v++){let D=m[v];!D||g.has(v)||D.status==="applied"&&(m[v]={status:"failed",target_text:D.target_text,new_text:D.new_text,warning:null,error:oc,critic_markup:null,clean_text:null});}}c.push(...m);}else {let m=Rs(this.doc),g=this.current_id;try{let v=[],D=0;for(let{edit:y,i:w}of _){let E;try{E=this.validate_edits([y],w);}catch(b){if(!(b instanceof zt))throw b;E=[`- Edit ${w+1} Failed: ${b.message}`];}if(E.length>0){if(D>0){let b=Fs(D);E=E.map(A=>A+b);}v.push(...E);}else this.apply_edits([y],a),y._applied_status&&D++,this.mapper=new Ye(this.doc),this.clean_mapper=null;}if(v.length>0)throw new yn(v)}catch(v){throw Bs(this.doc,m),this.current_id=g,this.mapper=new Ye(this.doc),this.comments_manager=new jt(this.doc),this.clean_mapper=null,v}f=s.filter(v=>v._applied_status).length,h=s.length-f;for(let v of s){let D=v._applied_status||false,y=v._error_msg||null,w=null,E=null,b=null;if(D){let A=this._build_edit_context_previews(v);w=A[0],E=A[1];}else b=this._check_punctuation_warning(v.target_text||"");c.push({status:D?"applied":"failed",target_text:Ae(v.target_text||"",Xe),new_text:Ae(me._report_new_text(v),Xe),warning:b,error:y,critic_markup:w,clean_text:E,pages:v._pages||[],heading_path:v._heading_path||"",occurrences_modified:v._occurrences_modified||0,match_mode:v.match_mode||"strict"});}}}return {actions_applied:i,actions_skipped:o,edits_applied:f,edits_skipped:h,occurrences_modified:c.reduce((p,_)=>p+(_.occurrences_modified||0),0),skipped_details:this.skipped_details,edits:c,engine:"node",version:"1.18.2"}}apply_edits(t,n=[]){if(!n||n.length===0){let[c]=Wt(this.mapper.full_text);n=Ht(c,"").body_page_offsets;}let i=[];for(let c of t){if(typeof c!="object"||c===null){continue}c._applied_status=false,c._error_msg=null,c._any_sub_failure=false;}for(let c of t)if(!(typeof c!="object"||c===null))if(c._resolved_start_idx!==void 0&&c._resolved_start_idx!==null)i.push([c,c.new_text||null]);else if(c._match_start_index!==void 0&&c._match_start_index!==null)c._resolved_start_idx=c._match_start_index,i.push([c,c.new_text||null]);else if(c.type==="insert_row"||c.type==="delete_row"){let f=this.mapper.find_all_match_indices(c.target_text),h=this.mapper;if(f.length===0&&(this.clean_mapper||(this.clean_mapper=new Ye(this.doc,true)),f=this.clean_mapper.find_all_match_indices(c.target_text),h=this.clean_mapper),f.length>0)c._resolved_start_idx=f[0][0],c._active_mapper_ref=h,i.push([c,null]);else {c._applied_status=false;let _=`- Failed to locate row target: '${(c.target_text||"").trim().substring(0,40)}...'`;this.skipped_details.push(_),c._error_msg=_;}}else {let f;try{f=this._pre_resolve_heuristic_edit(c);}catch(h){if(!(h instanceof zt))throw h;c._applied_status=false;let p=`- Failed to apply edit targeting: '${(c.target_text||"").substring(0,40)}...' (${h.message})`;this.skipped_details.push(p),c._error_msg=p;continue}if(f)if(Array.isArray(f))for(let h of f)h._resolved_start_idx=h._match_start_index,h._parent_edit_ref=c,(c._resolved_start_idx===void 0||c._resolved_start_idx===null)&&(c._resolved_start_idx=h._resolved_start_idx),c._resolved_proxy_edit||(c._resolved_proxy_edit=h),i.push([h,h.new_text]);else f._resolved_start_idx=f._match_start_index,f._parent_edit_ref=c,c._resolved_start_idx=f._resolved_start_idx,c._resolved_proxy_edit=f,i.push([f,f.new_text]);else {c._applied_status=false;let _=`- Failed to apply edit targeting: '${(c.target_text||"insertion").trim().substring(0,40)}...'`;this.skipped_details.push(_),c._error_msg=_;}}i.sort((c,f)=>(f[0]._resolved_start_idx||0)-(c[0]._resolved_start_idx||0));for(let[c]of i)this._capture_preview_context(c),c._parent_edit_ref&&this._capture_parent_preview_context(c._parent_edit_ref);let o=[],l=new Set;for(let[c,f]of i){let h=c._resolved_start_idx||0,p=c.type==="insert_row"?h:h+(c.target_text?c.target_text.length:0);if(o.some(([g,v])=>h<v&&p>g)){let D=`- Skipped overlapping edit targeting: '${(c.target_text||"insertion").trim().substring(0,40)}...'`;this.skipped_details.push(D),c._applied_status=false,c._error_msg=D,c._any_sub_failure=true;let y=c._parent_edit_ref;y&&(y._applied_status=false,y._error_msg=D,y._any_sub_failure=true);continue}let m=false;if(c.type==="modify"?m=this._apply_single_edit_indexed(c,f,false):(c.type==="insert_row"||c.type==="delete_row")&&(m=this._apply_table_edit(c,false)),m){let g=c._split_group_id,v=g==null||!l.has(g);v&&g!==void 0&&g!==null&&l.add(g),o.push([h,p]),c._applied_status=true;let D=c._parent_edit_ref;if(D){D._applied_status=true,v&&(D._occurrences_modified=(D._occurrences_modified||0)+1);let[y,w]=this._get_heading_path_and_page(h,this.mapper.full_text,n),E=D._pages||[];E.includes(w)||E.unshift(w),D._pages=E,D._heading_path=y;}else {v&&(c._occurrences_modified=(c._occurrences_modified||0)+1);let[y,w]=this._get_heading_path_and_page(h,this.mapper.full_text,n),E=c._pages||[];E.includes(w)||E.unshift(w),c._pages=E,c._heading_path=y;}}else {let D=`- Failed to apply edit targeting: '${(c.target_text||"insertion").trim().substring(0,40)}...'`;this.skipped_details.push(D),c._applied_status=false,c._error_msg=D,c._any_sub_failure=true;let y=c._parent_edit_ref;y&&(y._any_sub_failure=true,y._applied_status||(y._applied_status=false,y._error_msg=D));}}let u=0,a=0;for(let c of t){if(typeof c!="object"||c===null){a++;continue}c._applied_status&&!c._any_sub_failure?u++:a++;}return [u,a]}apply_review_actions(t){let n=0,r=0;for(let s of t){let i=s.type;if(i==="reply"){let f=s.target_id.replace("Com:",""),h=this.comments_manager.addComment(this.author,s.text,f);this._anchor_reply_comment(f,h),n++;continue}let o=s.target_id.replace("Chg:",""),l=I(this.doc.element,"w:ins").filter(f=>f.getAttribute("w:id")===o),u=I(this.doc.element,"w:del").filter(f=>f.getAttribute("w:id")===o),a=[...l,...u];if(a.length===0){r++,this.skipped_details.push(`- Failed to apply action: Target ID ${s.target_id} not found.`);continue}let c=Array.from(new Set(a.map(f=>f.getAttribute("w:author")||"Unknown"))).sort();if(c.length>1){r++,this.skipped_details.push(`- Failed to apply action: ${i} on Chg:${o} is ambiguous. The document contains ${a.length} tracked-change elements sharing w:id=${o} from different authors (${c.join(", ")}) \u2014 duplicate revision IDs produced outside this engine (e.g. by a document merge or copy-paste). Acting on this ID would resolve all of them at once. Resolve these changes individually in Word, or apply the intended outcome as an explicit text edit instead.`);continue}for(let f of a){let h=f.tagName==="w:ins",_=(f.parentNode?f.parentNode.tagName:"")==="w:trPr";if(i==="accept")if(h)if(this._clean_wrapping_comments(f),_)f.parentNode?.removeChild(f);else {for(;f.firstChild;)f.parentNode?.insertBefore(f.firstChild,f);f.parentNode?.removeChild(f);}else if(this._clean_wrapping_comments(f),this._delete_comments_in_element(f),_){let m=f.parentNode?.parentNode;m?.parentNode?.removeChild(m);}else f.parentNode?.removeChild(f);else if(i==="reject")if(h)if(this._clean_wrapping_comments(f),this._delete_comments_in_element(f),_){let m=f.parentNode?.parentNode;m?.parentNode?.removeChild(m);}else f.parentNode?.removeChild(f);else if(this._clean_wrapping_comments(f),_)f.parentNode?.removeChild(f);else {let m=Array.from(f.getElementsByTagName("w:delText"));for(let g of m){let v=g.ownerDocument.createElement("w:t");v.textContent=g.textContent,g.hasAttribute("xml:space")&&v.setAttribute("xml:space","preserve"),g.parentNode?.replaceChild(v,g);}for(;f.firstChild;)f.parentNode?.insertBefore(f.firstChild,f);f.parentNode?.removeChild(f);}}n++;}return [n,r]}_apply_table_edit(t,n){let r=t._resolved_start_idx!==void 0&&t._resolved_start_idx!==null?t._resolved_start_idx:t._match_start_index||0,s=t._active_mapper_ref||this.mapper,[i,o]=s.get_insertion_anchor(r,n),l=null;if(i?l=i._element:o&&(l=o._element),!l)return false;let u=l;for(;u&&u.tagName!=="w:tr";)u=u.parentNode;if(!u)return false;if(t.type==="delete_row"){let a=F(u,"w:trPr");return a||(a=u.ownerDocument.createElement("w:trPr"),u.insertBefore(a,u.firstChild)),a.appendChild(this._create_track_change_tag("w:del")),true}else if(t.type==="insert_row"){let a=u.ownerDocument.createElement("w:tr"),c=u.ownerDocument.createElement("w:trPr");a.appendChild(c),c.appendChild(this._create_track_change_tag("w:ins"));let f=I(u,"w:tc").filter(p=>p.parentNode===u).length,h=Array.isArray(t.cells)?[...t.cells]:[];if(f>0){for(;h.length<f;)h.push("");h=h.slice(0,f);}for(let p of h){let _=u.ownerDocument.createElement("w:tc"),m=u.ownerDocument.createElement("w:p"),g=u.ownerDocument.createElement("w:r"),v=u.ownerDocument.createElement("w:t");v.textContent=p,p.trim()!==p&&v.setAttribute("xml:space","preserve"),g.appendChild(v),m.appendChild(g),_.appendChild(m),a.appendChild(_);}return t.position==="above"?u.parentNode?.insertBefore(a,u):qt(a,u),true}return false}_pre_resolve_heuristic_edit(t){if(!t.target_text)return null;let n=t.regex||false,r=t.match_mode||"strict",s=this.mapper.find_all_match_indices(t.target_text,n),i=false;if(s.length===0)if(this.clean_mapper||(this.clean_mapper=new Ye(this.doc,true)),s=this.clean_mapper.find_all_match_indices(t.target_text,n),s.length>0)i=true;else return null;let o=i?this.clean_mapper:this.mapper,l=[];for(let[a,c]of s){let f=o.spans.filter(h=>h.run!==null&&h.end>a&&h.start<a+c);(f.length===0||f.some(h=>!h.del_id))&&l.push([a,c]);}if(l.length===0)return null;(r==="strict"||r==="first")&&(l=l.slice(0,1));let u=[];for(let[a,c]of l){let f=o.full_text.substring(a,a+c),h=t.new_text||"";if(/^\{#cell:[^}]+\}$/.test(f.trim())){let C=h;C=C.split(f.trim()).join(""),C?u.push({type:"modify",target_text:"",new_text:C,comment:t.comment,_match_start_index:a,_internal_op:"INSERTION",_active_mapper_ref:o}):t.comment&&u.push({type:"modify",target_text:"",new_text:"",comment:t.comment,_match_start_index:a,_internal_op:"COMMENT_ONLY",_active_mapper_ref:o});continue}if(n&&h)try{h=f.replace(new RegExp(t.target_text),h);}catch{}t._preview_span||(t._preview_span=[a,c],t._preview_matched_text=f,t._preview_new_text=h,t._preview_mapper_ref=o);let[p,_]=this._parse_markdown_style(t.target_text),[m,g]=this._parse_markdown_style(h);if(_!==g){let[C]=this._parse_markdown_style(f),P=C,S=m,$=P===S?"STYLE_ONLY":"STYLE_AND_TEXT",O=f.indexOf(C),T=a+(O!==-1?O:0),M=g!==null?g:"Normal";u.push({type:"modify",target_text:P,new_text:S,comment:t.comment,_match_start_index:T,_internal_op:$,_new_style:M,_active_mapper_ref:o});continue}if(f===h||t.target_text===h){u.push({type:"modify",target_text:f,new_text:f,comment:t.comment,_match_start_index:a,_internal_op:"COMMENT_ONLY",_active_mapper_ref:o});continue}let v=false;if(o&&(v=o.spans.some(C=>C.text===" | "&&(C.run===null||C.run===void 0)&&C.start<a+c&&C.end>a)),v){let C=f.split("|"),P=h.split("|");if(C.length!==P.length)throw new yn([`Target text spans ${C.length} table cells, but replacement provides ${P.length}. To modify text without altering table structure (rows or columns), ensure the replacement contains the exact same number of '|' separators (e.g., replace with 'CellC | ' to empty the second cell).`]);if(C.length>1){let S=[],$=0,O=0;for(let T=0;T<C.length;T++)if(C[T].trim()!==P[T].trim()){O=T;break}for(let T=0;T<C.length;T++){let M=C[T],B=P[T],U=M.trim(),R=B.trim(),q=a+$+(U?M.indexOf(U):0),Q=t.comment!==null&&t.comment!==void 0&&T===O;if(U!==R||Q){let te=this._word_diff_sub_edits(U,R,q,Q?t.comment:null,true,o);for(let J of te)J._original_target_text=t.target_text,J._split_group_id=a,S.push(J);}$+=M.length+1;}for(let T of S)u.push(T);continue}}let D=false;t.target_text&&(t.target_text.includes("**")||t.target_text.includes("_"))&&(D=true),h&&(h.includes("**")||h.includes("_"))&&(D=true);let y="",w="",E="",b=a;if(h.startsWith(f))y="INSERTION",E=h.substring(f.length),b=a+c;else {let[C,P]=Zn(f,h),S=f.length-P,$=h.length-P;w=f.substring(C,S),E=h.substring(C,$),b=a+C;}if(D){if(!w&&E)y="INSERTION";else if(w&&!E)y="DELETION";else if(w&&E)y="MODIFICATION";else {u.push({type:"modify",target_text:w,new_text:E,comment:t.comment,_match_start_index:b,_internal_op:"COMMENT_ONLY",_active_mapper_ref:o});continue}u.push({type:"modify",target_text:w,new_text:E,comment:t.comment,_resolved_start_idx:b,_match_start_index:b,_internal_op:y,_active_mapper_ref:o});continue}let A=f.split(`
|
|
89
89
|
|
|
90
|
-
`),
|
|
90
|
+
`),N=h.split(`
|
|
91
91
|
|
|
92
92
|
`);if(f.includes(`
|
|
93
93
|
|
|
94
|
-
`)&&A.length===
|
|
95
|
-
`)||(
|
|
94
|
+
`)&&A.length===N.length){let C=[],P=a,S=false;for(let $=0;$<A.length;$++){let O=A[$],T=N[$];if(O!==T){let M=t.comment&&!S?t.comment:null,B=this._word_diff_sub_edits(O,T,P,M,false,o);B.some(U=>U.comment!==null&&U.comment!==void 0)&&(S=true);for(let U of B)U._split_group_id=a,C.push(U);}P+=O.length+2;}if(C.length>0){for(let $ of C)u.push($);continue}}if(!w&&E){u.push({type:"modify",target_text:"",new_text:E,comment:t.comment,_resolved_start_idx:b,_match_start_index:b,_internal_op:"INSERTION",_active_mapper_ref:o});continue}let x=this._word_diff_sub_edits(f,h,a,t.comment,false,o);for(let C of x)C._split_group_id=a,u.push(C);}return u.length===0?null:r==="all"||u.length>1?u:u[0]}_insert_and_split_ins(t,n,r,s=false){let i=t.parentNode;if(!i)return;let o=t.cloneNode(false),l=t.cloneNode(false),u=false;for(let a of Array.from(t.childNodes))t.removeChild(a),s&&a===n&&(u=true),u?l.appendChild(a):(o.appendChild(a),a===n&&(u=true));o.childNodes.length>0&&i.insertBefore(o,t),i.insertBefore(r,t),l.childNodes.length>0&&i.insertBefore(l,t),i.removeChild(t);}_apply_single_edit_indexed(t,n,r){let s=t._internal_op,i=t._active_mapper_ref||this.mapper,o=t._resolved_start_idx!==void 0&&t._resolved_start_idx!==null?t._resolved_start_idx:t._match_start_index||0,l=t.target_text?t.target_text.length:0;s==null&&(!t.target_text&&t.new_text?s="INSERTION":t.target_text&&!t.new_text?s="DELETION":s="MODIFICATION");let u=this._edit_declares_emphasis(t);if(s==="STYLE_ONLY"||s==="STYLE_AND_TEXT"){let[y,w]=i.get_insertion_anchor(o,r),E=null;if(w)E=w._element;else if(y){let b=y._element;for(;b&&b.tagName!=="w:p";)b=b.parentNode;E=b;}if(E&&t._new_style&&this._set_paragraph_style(E,t._new_style),s==="STYLE_ONLY"){if(t.comment){let b=i.find_target_runs_by_index(o,l,r);if(b.length>0){let A=b[0]._element,N=b[b.length-1]._element,x=A;for(;x&&x.tagName!=="w:p";)x=x.parentNode;let C=N;for(;C&&C.tagName!=="w:p";)C=C.parentNode;if(x&&C){let P=d((O,T)=>{let M=O;for(;M.parentNode&&M.parentNode!==T;)M=M.parentNode;return M},"ascend_to_paragraph_child"),S=P(A,x),$=P(N,C);x===C?this._attach_comment(x,S,$,t.comment):this._attach_comment_spanning(x,S,C,$,t.comment);}}}return true}t.target_text&&t.new_text?s="MODIFICATION":!t.target_text&&t.new_text?s="INSERTION":t.target_text&&!t.new_text?s="DELETION":s="COMMENT_ONLY";}let a=["DELETION","MODIFICATION"].includes(s)?this._getNextId():null,c=["INSERTION","MODIFICATION"].includes(s)?this._getNextId():null;if(s==="COMMENT_ONLY"){let y=i.find_target_runs_by_index(o,l,r);if(y.length===0)return false;if(!t.comment)return true;let w=y[0]._element,E=y[y.length-1]._element,b=w;for(;b&&b.tagName!=="w:p";)b=b.parentNode;let A=E;for(;A&&A.tagName!=="w:p";)A=A.parentNode;if(!b||!A)return false;let N=d((P,S)=>{let $=P;for(;$.parentNode&&$.parentNode!==S;)$=$.parentNode;return $},"ascend_to_paragraph_child"),x=N(w,b),C=N(E,A);return b===A?this._attach_comment(b,x,C,t.comment):this._attach_comment_spanning(b,x,A,C,t.comment),true}if(s==="INSERTION"){let y=t.new_text||"",w=null,E=typeof i.part_boundary_at=="function"?i.part_boundary_at(o):null,b=!t.target_text&&(t._parent_edit_ref===void 0||t._parent_edit_ref===null);if(E!==null&&b){let[O,T]=E,M=i.part_kind_of(O),B=i.part_kind_of(T);if(M==="body"&&B!=="body"){let U=i.spans.filter(R=>R.run!==null&&R.part_index===O);U.length>0&&(w=U[U.length-1]);}}let A,N;if(w!==null?(A=w.run,N=w.paragraph,y.startsWith(`
|
|
95
|
+
`)||(y=`
|
|
96
96
|
|
|
97
|
-
`+E)):[D,A]=i.get_insertion_anchor(s,r),!D&&!A||me._introduces_table_row_text(i,s,1,"",E))return false;let x=E,N=y===null&&/\n\s*$/.test(x),T=null;{let O=i.spans.filter(C=>C.paragraph!==null&&C.start===s);O.length>0&&O[0].paragraph&&(T=O[0].paragraph._element);}if(N&&T&&T.parentNode){let O=T.parentNode,C=this.doc.part._element.ownerDocument,M=x.split(/[\r\n]+/).filter(R=>R!==""),B=null,$=null,U=null;for(let R of M){let[H,Z]=this._parse_markdown_style(R),Q=C.createElement("w:p");if(Z)this._set_paragraph_style(Q,Z);else {let Ae=F(T,"w:pPr");Ae&&Q.appendChild(Ae.cloneNode(true));}let V=F(Q,"w:pPr");V||(V=C.createElement("w:pPr"),Q.insertBefore(V,Q.firstChild));let le=F(V,"w:rPr");le||(le=C.createElement("w:rPr"),V.appendChild(le)),le.appendChild(this._create_track_change_tag("w:ins","",u));let te=this._build_tracked_ins_for_line(H,D,u,C);te&&Q.appendChild(te),O.insertBefore(Q,T),B||(B=Q),$=Q,U=te;}if(B){if(t.comment&&$&&U){let R=d((Z,Q)=>{let V=Z;for(;V.parentNode&&V.parentNode!==Q;)V=V.parentNode;return V},"ascend"),H=I(B,"w:ins")[0]||B;this._attach_comment_spanning(B,R(H,B),$,R(U,$),t.comment);}return true}}let k=this._track_insert_multiline(E,D,A,u);if(!k.first_node)return false;if(k.first_node.tagName==="w:ins"){if(D){let O=D._element,C=O.parentNode;C&&C.tagName==="w:del"&&(O=C,C=O.parentNode);let M=s===0;C&&C.tagName==="w:ins"?this._insert_and_split_ins(C,O,k.first_node,M):M&&C?C.insertBefore(k.first_node,O):qt(k.first_node,O);}else if(A){let O=A._element,C=O.firstChild;for(;C&&C.tagName==="w:pPr";)C=C.nextSibling;O.insertBefore(k.first_node,C);}}if(t.comment){let O=d((C,M)=>{let B=C;for(;B.parentNode&&B.parentNode!==M;)B=B.parentNode;return B},"ascend_to_paragraph_child");if(k.last_p&&k.last_ins){let C=k.first_node;for(;C&&C.tagName!=="w:p";)C=C.parentNode;if(C){let M=k.first_node;k.first_node.tagName==="w:p"&&(M=I(k.first_node,"w:ins")[0]||k.first_node);let B=O(M,C),$=O(k.last_ins,k.last_p);this._attach_comment_spanning(C,B,k.last_p,$,t.comment);}}else {let C=k.first_node;for(;C&&C.tagName!=="w:p";)C=C.parentNode;if(C){let M=k.first_node;k.first_node.tagName==="w:p"&&(M=I(k.first_node,"w:ins")[0]||k.first_node);let B=O(M,C);this._attach_comment(C,B,B,t.comment);}}}return true}if((o==="DELETION"||o==="MODIFICATION")&&l&&i.part_ranges.filter(E=>E[1]>E[0]).length>1){let E=new Set;for(let y of i.spans)y.run!==null&&y.end>s&&y.start<s+l&&E.add(y.part_index);if(E.size>1)return false}let c=i.find_target_runs_by_index(s,l,r),f=i.get_virtual_spans_in_range(s,l);if(c.length===0&&f.length===0)return false;let h=new Set;for(let E of c){let y=E._element.parentNode;for(;y&&y.tagName!=="w:p";)y=y.parentNode;y&&h.add(y);}let p=null,_=null;for(let E of c){let y=this._create_track_change_tag("w:del","",a),w=E._element.cloneNode(true);Array.from(w.getElementsByTagName("w:t")).forEach(D=>{let A=w.ownerDocument.createElement("w:delText");A.textContent=D.textContent,D.hasAttribute("xml:space")&&A.setAttribute("xml:space","preserve"),w.replaceChild(A,D);}),y.appendChild(w),E._element.parentNode?.replaceChild(y,E._element),p===null&&(p=y),_=y;}let m=null,g=null,v=null;if(o==="MODIFICATION"&&t.new_text&&_){let E=_;for(;E&&E.tagName!=="w:p";)E=E.parentNode;let y=E?new ve(E,null):null,w=c.length>0?c[c.length-1]:null,b=this._track_insert_multiline(t.new_text,w,y,u,_);if(b.first_node){if(b.first_node.tagName==="w:ins"){let A=_.parentNode;A&&A.tagName==="w:ins"?this._insert_and_split_ins(A,_,b.first_node):qt(b.first_node,_),m=b.first_node;}else m=b.last_ins;g=b.last_p,v=b.last_ins;}}if(o==="DELETION"||o==="MODIFICATION"){if(o==="MODIFICATION"&&c.length===0&&f.length>0&&t.new_text){let E=f[0];if(E.paragraph){let y=E.paragraph._element,w=I(y,"w:r"),b=w.length>0?new rt(w[w.length-1],E.paragraph):null,D=this._track_insert_multiline(t.new_text,b,E.paragraph,u);D.first_node&&y.appendChild(D.first_node);}}for(let E of [...f].reverse())if(E.paragraph){let y=E.paragraph._element,w=dt(y);for(;w&&w.tagName!=="w:p";)w=dt(w);if(w&&w.tagName==="w:p"){let b=F(y,"w:pPr");b||(b=y.ownerDocument.createElement("w:pPr"),y.insertBefore(b,y.firstChild));let D=F(b,"w:rPr");D||(D=y.ownerDocument.createElement("w:rPr"),b.appendChild(D));let A=this._create_track_change_tag("w:del");D.appendChild(A);let x=Array.from(w.childNodes);for(let N of x)N.nodeType===1&&N.tagName==="w:pPr"||y.appendChild(N);w.parentNode&&w.parentNode.removeChild(w);}}}if(t.comment&&p!==null){let E,y;if(g&&v)E=v,y=g;else {let x=m!==null?m:_;for(E=x,y=x;y&&y.tagName!=="w:p";)y=y.parentNode;}let w=p;for(;w&&w.tagName!=="w:p";)w=w.parentNode;if(!w||!y)return true;let b=d((x,N)=>{let T=x;for(;T.parentNode&&T.parentNode!==N;)T=T.parentNode;return T},"ascend_to_paragraph_child"),D=b(p,w),A=b(E,y);w===y?this._attach_comment(w,D,A,t.comment):this._attach_comment_spanning(w,D,y,A,t.comment);}for(let E of h){let y=false;for(let w of ["w:t","w:tab","w:br"]){let b=I(E,w);for(let D of b){let A=false,x=D.parentNode;for(;x&&x!==E.parentNode;){if(x.tagName==="w:del"){A=true;break}x=x.parentNode;}if(!A){if(w==="w:t"&&!D.textContent)continue;y=true;break}}if(y)break}if(!y){let w=F(E,"w:pPr");w||(w=E.ownerDocument.createElement("w:pPr"),E.insertBefore(w,E.firstChild));let b=F(w,"w:rPr");if(b||(b=E.ownerDocument.createElement("w:rPr"),w.appendChild(b)),!F(b,"w:del")){let D=this._create_track_change_tag("w:del");b.appendChild(D);}}}return true}};function we(e,t){let n=[],r=e.getElementsByTagName("*");for(let o=0;o<r.length;o++){let i=r[o].tagName;(i===t||i.endsWith(":"+t))&&n.push(r[o]);}return n}d(we,"findDescendantsByLocalName");function lc(e){let t=0;function n(s,l){let a=s?s.toString():"",u=l?l.toString():"";return a===u}d(n,"areRunsIdentical");function r(s){let l=["w:t","w:tab","w:br","w:cr","w:delText","w:rPr"];for(let a=0;a<s.childNodes.length;a++){let u=s.childNodes[a];if(u.nodeType===1){let c=u.tagName;if(!l.includes(c))return true}}return false}d(r,"hasSpecialContent");function o(s){let l=Array.from(s.childNodes).filter(u=>u.nodeType===1),a=0;for(;a<l.length-1;){let u=l[a],c=l[a+1];if(u.tagName==="w:r"&&c.tagName==="w:r"&&!r(u)&&!r(c)){let f=F(u,"w:rPr"),h=F(c,"w:rPr");if(n(f,h)){let p=null;for(let m=0;m<u.childNodes.length;m++){let g=u.childNodes[m];g.nodeType===1&&(g.tagName==="w:t"||g.tagName==="w:delText")&&(p=g);}let _=Array.from(c.childNodes).filter(m=>m.nodeType===1);for(let m of _)if(m.tagName!=="w:rPr")if((m.tagName==="w:t"||m.tagName==="w:delText")&&p&&p.tagName===m.tagName){let g=p.textContent||"",v=m.textContent||"",E=g+v;p.textContent=E,E.trim()!==E&&p.setAttribute("xml:space","preserve");}else u.appendChild(m),(m.tagName==="w:t"||m.tagName==="w:delText")&&(p=m);s.removeChild(c),l.splice(a+1,1),t++;continue}}["w:ins","w:del","w:hyperlink","w:sdt","w:smartTag","w:fldSimple","w:sdtContent"].includes(u.tagName)&&o(u),a++;}if(l.length>0){let u=l[l.length-1];["w:ins","w:del","w:hyperlink","w:sdt","w:smartTag","w:fldSimple","w:sdtContent"].includes(u.tagName)&&o(u);}}d(o,"coalesceContainer");let i=I(e.element,"w:p");for(let s of i)o(s);return t?[`Adjacent identical runs coalesced: ${t}`]:[]}d(lc,"coalesce_runs");function cc(e){let t=0,n=["w:rsidR","w:rsidRPr","w:rsidRDefault","w:rsidP","w:rsidDel","w:rsidSect","w:rsidTr"],r=e.element.getElementsByTagName("*");for(let i=0;i<r.length;i++)for(let s of n)r[i].hasAttribute(s)&&(r[i].removeAttribute(s),t++);let o=I(e.element,"w:rsids");for(let i of o)i.parentNode&&(i.parentNode.removeChild(i),t++);return t?[`rsid attributes: ${t} removed`]:[]}d(cc,"strip_rsid");function fc(e){let t=0,n=["w14:paraId","w14:textId"],r=e.element.getElementsByTagName("*");for(let o=0;o<r.length;o++)for(let i of n)r[o].hasAttribute(i)&&(r[o].removeAttribute(i),t++);return t?[`Paragraph/text IDs: ${t} removed`]:[]}d(fc,"strip_para_ids");function dc(e){let t=I(e.element,"w:proofErr");return t.forEach(n=>n.parentNode?.removeChild(n)),t.length?[`Spell check markers: ${t.length} removed`]:[]}d(dc,"strip_proof_errors");function hc(e){let t=0;for(let n of ["w:rPr","w:pPr"]){let r=I(e.element,n);for(let o of r)(o.childNodes.length===0||o.childNodes.length===1&&o.childNodes[0].nodeType===3&&!o.childNodes[0].textContent?.trim())&&(o.parentNode?.removeChild(o),t++);}return t?[`Empty property elements: ${t} removed`]:[]}d(hc,"strip_empty_properties");function pc(e){let t=0,n=I(e.element,"w:rPr");for(let r of n)if(F(r,"w:vanish")||F(r,"w:webHidden")){let o=r.parentNode;o&&o.tagName==="w:r"&&o.parentNode&&(o.parentNode.removeChild(o),t++);}return t?[`Hidden text runs: ${t} removed`]:[]}d(pc,"strip_hidden_text");function $o(e){let t=I(e.element,"w:ins").length,n=I(e.element,"w:del").length,r=I(e.element,"w:rPrChange").length+I(e.element,"w:pPrChange").length+I(e.element,"w:sectPrChange").length;return [t,n,r]}d($o,"count_tracked_changes");function mc(e){let t=new Set;for(let n of ["w:ins","w:del","w:rPrChange","w:pPrChange","w:sectPrChange"])for(let r of I(e.element,n)){let o=r.getAttribute("w:author");o&&t.add(o);}return t}d(mc,"get_track_change_authors");function Uo(e){let t=[],n=I(e,"w:t");for(let o of n)o.textContent&&t.push(o.textContent);let r=I(e,"w:delText");for(let o of r)o.textContent&&t.push(o.textContent);return t.join("")}d(Uo,"_getElementText");function Vt(e,t=60){let n=e.replace(/\n/g," ").trim();return n.length<=t?n:n.substring(0,t-3)+"..."}d(Vt,"_truncate");function _c(e){let t=[],n=I(e.element,"w:ins"),r=I(e.element,"w:del");for(let s of n){let l=Uo(s).trim();l&&t.push(` Accepted insertion: "${Vt(l,60)}"`);}for(let s of r){let l=Uo(s).trim();l&&t.push(` Accepted deletion of: "${Vt(l,60)}"`);}new Vr(e).accept_all_revisions();for(let s of ["w:rPrChange","w:pPrChange","w:sectPrChange"])for(let l of I(e.element,s))l.parentNode?.removeChild(l);let i=n.length+r.length;return i?[`Tracked changes auto-accepted: ${i}`].concat(t):[]}d(_c,"accept_all_tracked_changes");function gc(e){let t=bn(e.pkg),n=[],r=0,o=0;for(let[i,s]of Object.entries(t))s.resolved?o++:r++,n.push({id:i,...s});return {total:n.length,open:r,resolved:o,comments:n}}d(gc,"get_comments_summary");function wc(e){let t=bn(e.pkg),n=Object.keys(t);if(n.length===0)return [];let r=[],o=new jt(e);for(let[a,u]of Object.entries(t)){let c=u.resolved?"[Resolved]":"[Open]";r.push(` ${c} "${Vt(u.text||"",60)}" (${u.author||"Unknown"})`),o.deleteComment(a);}for(let a of ["w:commentRangeStart","w:commentRangeEnd"])for(let u of I(e.element,a))u.parentNode?.removeChild(u);let i=I(e.element,"w:commentReference");for(let a of i){let u=a.parentNode;u&&((u.tagName==="w:r"||u.tagName.endsWith(":r"))&&Array.from(u.childNodes).filter(f=>f.nodeType===1&&f.tagName!=="w:rPr"&&f.tagName!=="rPr").length<=1?u.parentNode?.removeChild(u):u.removeChild(a));}let s=Object.values(t).filter(a=>a.resolved).length,l=Object.values(t).filter(a=>!a.resolved).length;return [`Comments removed: ${n.length} (${s} resolved, ${l} open)`].concat(r)}d(wc,"remove_all_comments");function vc(e){let t=e.pkg,n=new Set;for(let o of t.parts)if(o.partname.toLowerCase().includes("comments")){n.add(o.partname);let i=o.partname.startsWith("/")?o.partname:"/"+o.partname,s=o.partname.startsWith("/")?o.partname.substring(1):o.partname;n.add(i),n.add(s);}if(n.size===0)return;for(let o of t.parts)if(o.partname.endsWith(".rels")){let i=I(o._element,"Relationship"),s=[];for(let l of i)if((l.getAttribute("Target")||"").toLowerCase().includes("comments")){s.push(l);let u=o.partname.replace("/_rels/","/").replace(".rels",""),c=t.getPartByPath(u);if(c){let f=l.getAttribute("Id");f&&c.rels.delete(f);}}for(let l of s)l.parentNode?.removeChild(l);}let r=t.getPartByPath("[Content_Types].xml");if(r){let o=I(r._element,"Override"),i=[];for(let s of o){let l=s.getAttribute("PartName")||"";(n.has(l)||l.toLowerCase().includes("comments"))&&i.push(s);}for(let s of i)s.parentNode?.removeChild(s);}t.parts=t.parts.filter(o=>!o.partname.toLowerCase().includes("comments"));for(let o of Object.keys(t.unzipped))o.toLowerCase().includes("comments")&&delete t.unzipped[o];}d(vc,"eject_comment_parts");function yc(e,t){let n=new jt(e);if(!n.commentsPart)return [];let r=new Set,o=I(n.commentsPart._element,"w:comment");for(let i of o){let s=i.getAttribute("w:author");if(s&&(r.add(s),i.setAttribute("w:author",t)),i.hasAttribute("w:initials")){let l=t.split(" ").filter(Boolean).map(a=>a[0]).join("").toUpperCase();i.setAttribute("w:initials",l);}}return r.size?[`Comment authors replaced: ${Array.from(r).sort().join(", ")} \u2192 "${t}"`]:[]}d(yc,"replace_comment_authors");function Ec(e,t){let n=new Set;for(let r of ["w:ins","w:del","w:rPrChange","w:pPrChange"])for(let o of I(e.element,r)){let i=o.getAttribute("w:author");i&&(n.add(i),o.setAttribute("w:author",t));}return n.size?[`Track change authors replaced: ${Array.from(n).sort().join(", ")} \u2192 "${t}"`]:[]}d(Ec,"replace_change_authors");function bc(e){let t=0,n="2025-01-01T00:00:00Z";for(let r of ["w:ins","w:del","w:rPrChange","w:pPrChange"])for(let o of I(e.element,r))o.hasAttribute("w:date")&&(o.setAttribute("w:date",n),t++);return t?[`Track change timestamps: ${t} normalized`]:[]}d(bc,"normalize_change_dates");function Dc(e){let t=[],n=e.pkg.getPartByPath("docProps/core.xml");if(n){we(n._element,"creator").forEach(u=>{u.textContent&&(t.push(`Author: ${u.textContent}`),u.textContent="");}),we(n._element,"lastModifiedBy").forEach(u=>{u.textContent&&(t.push(`Last modified by: ${u.textContent}`),u.textContent="");}),we(n._element,"title").forEach(u=>{u.textContent&&t.push(`Title kept (review manually): "${u.textContent}"`);});let l=[["category","Category"],["keywords","Keywords"],["subject","Subject"],["contentStatus","Content status"],["description","Description/comments"],["identifier","Identifier"],["language","Language"],["version","Version"]];for(let[u,c]of l)we(n._element,u).forEach(f=>{f.textContent&&(t.push(`${c}: ${f.textContent}`),f.textContent="");});we(n._element,"revision").forEach(u=>{u.textContent&&parseInt(u.textContent)>1&&(t.push(`Revision count: ${u.textContent} \u2192 1`),u.textContent="1");});}let r=e.pkg.getPartByPath("docProps/app.xml");if(r){let o=r._element,i=["TotalTime","Words","Characters","Paragraphs","Lines","CharactersWithSpaces"];for(let l of i)we(o,l).forEach(a=>{a.textContent&&a.textContent!=="0"&&(l==="TotalTime"&&t.push(`Total editing time: ${a.textContent} minutes`),a.textContent="0");});let s=["Template","Manager","Company"];for(let l of s)we(o,l).forEach(a=>{a.textContent&&(t.push(`${l}: ${a.textContent}`),a.textContent="");});}return t.length?["Metadata scrubbed:",...t.map(o=>` ${o}`)]:[]}d(Dc,"scrub_doc_properties");function Ac(e){let t=false,n="1970-01-01T00:00:00Z",r=e.pkg.getPartByPath("docProps/core.xml");if(r)for(let o of ["created","modified","lastPrinted"])we(r._element,o).forEach(i=>{i.textContent&&i.textContent!==n&&(i.textContent=n,t=true);});return t?["Timestamps normalized to epoch"]:[]}d(Ac,"scrub_timestamps");function ss(e,t,n){let r=e.pkg,o=d(s=>s.startsWith("/")?s.substring(1):s,"normalized");for(let s of r.parts){if(!s.partname.endsWith(".rels"))continue;let l=[];for(let a of I(s._element,"Relationship")){let u=a.getAttribute("Target")||"";if(n(u)){l.push(a);let c=s.partname.replace("/_rels/","/").replace(".rels",""),f=r.getPartByPath(c);if(f){let h=a.getAttribute("Id");h&&f.rels.delete(h);}}}l.forEach(a=>a.parentNode?.removeChild(a));}let i=r.getPartByPath("[Content_Types].xml");if(i){let s=[];for(let l of I(i._element,"Override")){let a=l.getAttribute("PartName")||"";t(o(a))&&s.push(l);}s.forEach(l=>l.parentNode?.removeChild(l));}r.parts=r.parts.filter(s=>!t(o(s.partname)));for(let s of Object.keys(r.unzipped))t(o(s))&&delete r.unzipped[s];}d(ss,"ejectPackageMembers");function Nc(e){let t=d(o=>o.startsWith("customXml/"),"isCustomXml"),n=e.pkg.parts.filter(o=>t(o.partname.startsWith("/")?o.partname.substring(1):o.partname)),r=Object.keys(e.pkg.unzipped).filter(t);if(n.length===0&&r.length===0)return [];ss(e,t,o=>o.includes("customXml"));for(let o of I(e.element,"w:sdtPr"))Ku(o,"w:dataBinding").forEach(i=>o.removeChild(i));return [`Custom XML parts: ${Math.max(n.length,r.length)} removed`]}d(Nc,"strip_custom_xml");var jr="docProps/custom.xml";function xc(e){let t=e.pkg.getPartByPath(jr),n=Object.keys(e.pkg.unzipped).includes(jr);if(!t&&!n)return [];let r=[];if(t)for(let i of we(t._element,"property")){let s=i.getAttribute("name")||"(unnamed)",l=(i.textContent||"").trim();r.push(` Custom property removed: ${s} = "${Vt(l,60)}"`);}return ss(e,i=>i===jr,i=>i.includes("docProps/custom.xml")),[`Custom document properties: ${Math.max(r.length,1)} removed (docProps/custom.xml)`].concat(r)}d(xc,"strip_custom_properties");function Cc(e){let t=0;for(let n of we(e.element,"docPr")){let r=n.getAttribute("descr");if(r){let o=r.length<10,i=r.includes(".")&&r.length<60;(o||i)&&(n.removeAttribute("descr"),t++);}}return t?[`Image alt text: ${t} auto-generated descriptions removed`]:[]}d(Cc,"strip_image_alt_text");function Tc(e){let t=[],n=new Set;for(let r of e.pkg.parts){let o=String(r.partname),i;if(o.startsWith("/word/header"))i="header";else if(o.startsWith("/word/footer"))i="footer";else if(o==="/word/document.xml")i="body";else continue;let s;try{s=we(r._element,"textpath");}catch{continue}for(let l of s){let a=(l.getAttribute("string")||"").trim(),u=`${i}${a}`;if(n.has(u))continue;n.add(u);let c=a?`"${Vt(a,60)}"`:"(no text)";t.push(`Watermark-like text object in ${i}: ${c} \u2014 NOT removed. It remains in the document package and may render in other applications; review and remove it in Word if it must not reach the counterparty.`);}}return t}d(Tc,"detect_watermarks");function kc(e){let t=["sharepoint.com","onedrive.com",".internal","intranet","localhost","10.","192.168.","172.16."],n=[],r=e.pkg.getOrCreateRelsPart(e.part.partname);for(let o of I(r._element,"Relationship"))if(o.getAttribute("TargetMode")==="External"){let i=o.getAttribute("Target")||"";for(let s of t)if(i.toLowerCase().includes(s.toLowerCase())){n.push(`Hyperlink targets internal URL: ${Vt(i,80)}`);break}}return n}d(kc,"audit_hyperlinks");function Sc(e,t,n=2){if(e===t)return 0;if(Math.abs(e.length-t.length)>n)return n+1;if(e.length===0)return t.length<=n?t.length:n+1;if(t.length===0)return e.length<=n?e.length:n+1;if(e.length>t.length){let o=e;e=t,t=o;}let r=Array.from({length:e.length+1},(o,i)=>i);for(let o=1;o<=t.length;o++){let i=[o],s=o;for(let l=1;l<=e.length;l++){let a=e[l-1]===t[o-1]?0:1,u=Math.min(r[l]+1,i[l-1]+1,r[l-1]+a);i.push(u),u<s&&(s=u);}if(s>n)return n+1;r=i;}return r[e.length]<=n?r[e.length]:n+1}d(Sc,"boundedLevenshtein");function Ic(e){let t="",n=I(e._element,"w:r");for(let r of n)t+=ht(new rt(r,e));return t}d(Ic,"_get_paragraph_text");var Gr="[A-Z][A-Za-z0-9\\s\\-&'\u2019]{1,60}",Oc=new RegExp(`^(?:[\\d.\\-()a-zA-Z]+\\s*)?["\u201C](${Gr})["\u201D]`,"d"),Pc=new RegExp(`(?<=[.;:!?])\\s+(?:[\\d.\\-()a-zA-Z]+\\s+)?["\u201C](${Gr})["\u201D]`,"dg"),Mc=new RegExp(`\\([^)]*?["\u201C](${Gr})["\u201D][^)]*?\\)`,"dg");function Rc(e){let t=[],n=Oc.exec(e);n&&n.indices&&n.indices[1]&&t.push([n.indices[1][0],n[1].trim()]);for(let i of e.matchAll(Pc)){let s=i.indices;s&&s[1]&&t.push([s[1][0],i[1].trim()]);}for(let i of e.matchAll(Mc)){let s=i.indices;s&&s[1]&&t.push([s[1][0],i[1].trim()]);}let r=[],o=new Set;t.sort((i,s)=>i[0]-s[0]);for(let[i,s]of t)o.has(i)||(o.add(i),r.push(s));return r}d(Rc,"extract_terms_from_paragraph");function Bc(e,t){let n={},r=new Set,o={},i=[];for(let m of st(e)){if(!(m instanceof ve))continue;let g=Ic(m).trim();if(!g)continue;for(let y of Rc(g))n[y]?r.add(y):n[y]={count:0};let v=g.length>60?g.substring(0,60)+"...":g,E=I(m._element,"*");for(let y of E){if(y.tagName==="w:bookmarkStart"){let b=y.getAttribute("w:name");b&&(!b.startsWith("_")||b.startsWith("_Ref"))&&(o[b]||(o[b]={anchored_to:v,referenced_from:[]}));}let w=null;if(y.tagName==="w:fldSimple"){let D=(y.getAttribute("w:instr")||"").trim().split(/\s+/);D.length>1&&D[0]==="REF"&&(w=D[1]);}else if(y.tagName==="w:instrText"){let D=(y.textContent||"").trim().split(/\s+/);D.length>1&&D[0]==="REF"&&(w=D[1]);}w&&i.push([w,v]);}}for(let[m,g]of i)o[m]&&o[m].referenced_from.push(g);let s=[],l=Object.keys(n);if(l.length>0){let m=l.sort((y,w)=>w.length-y.length),g=d(y=>y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"escapeRegExp"),v=m.map(g).join("|"),E=new RegExp(`(?<!["\u201C])\\b(${v})\\b(?![\u201D"])`,"g");for(let y of t.matchAll(E)){let w=y[1];n[w]&&n[w].count++;}for(let y of l)n[y].count===0&&(delete n[y],r.has(y)||s.push(`[Warning] Unused Definition: '${y}' is defined but never used.`));}for(let m of r)s.push(`[Error] Duplicate Definition: '${m}' is defined multiple times.`);let a=new Set(["The","This","That","Such","A","An","Any","All","Some","No","Every","Each","As","In","Of","For","To","On","By","With"]),u=/\b[A-Z][a-zA-Z]*(?:\s+[A-Z][a-zA-Z]*)*\b/g,c=new Set(t.match(u)||[]),f=new Set(Object.keys(n)),h={};for(let m of f){let g=m[0].toLowerCase();h[g]||(h[g]=[]),h[g].push(m);}let p={};for(let m of c){let g=m.trim(),v=g.split(/\s+/);for(;v.length>0;){let w=v[0],b=w.charAt(0).toUpperCase()+w.slice(1).toLowerCase();if(a.has(b))v.shift();else break}if(g=v.join(" "),g.length<4||f.has(g))continue;let E=g[0].toLowerCase(),y=h[E]||[];if(g.length>5)for(let[w,b]of Object.entries(h))w!==E&&(y=y.concat(b));for(let w of y){if(Math.abs(g.length-w.length)>2||g===w+"s"||g===w+"es"||w===g+"s"||w===g+"es")continue;let b=Sc(g,w,2);b===0||b>2||w.length<=5&&(b>1||g[0].toLowerCase()!==w[0].toLowerCase())||(p[w]||(p[w]=[]),p[w].includes(g)||p[w].push(g));}}for(let[m,g]of Object.entries(p)){g.sort();let v=g.map(E=>`'${E}'`).join(", ");s.push(`[Info] Possible Typos for '${m}': Found ${v}`);}function _(m){return m.startsWith("[Error]")?0:m.startsWith("[Warning]")?1:2}return d(_,"diag_sort_key"),s.sort((m,g)=>{let v=_(m),E=_(g);return v!==E?v-E:m.localeCompare(g)}),[n,s,o]}d(Bc,"extract_all_domain_metadata");function Fc(e){let t=[],n=e.pkg.getPartByPath("word/settings.xml");if(!n)return t;let r=d(s=>{if(!s.hasAttribute("w:val"))return true;let l=(s.getAttribute("w:val")||"").toLowerCase();return l!=="0"&&l!=="false"&&l!=="off"},"isTruthy"),o=we(n._element,"removePersonalInformation");o.length>0&&r(o[0])&&t.push("[Warning] Privacy flag `removePersonalInformation` is enabled in word/settings.xml. Microsoft Word will strip the `w:author`, `w:initials`, and `w:date` attributes from every tracked change and comment the next time this document is opened and saved. Edits made by this agent will lose attribution, breaking audit trails and any multi-turn workflow that relies on identifying prior edits.");let i=we(n._element,"removeDateAndTime");return i.length>0&&r(i[0])&&t.push("[Warning] Privacy flag `removeDateAndTime` is enabled in word/settings.xml. Microsoft Word will strip the `w:date` attribute from every tracked change and comment the next time this document is opened and saved. Timestamps on this agent's edits will be lost on the next Word save."),t}d(Fc,"extract_document_settings_warnings");function Lc(e,t){let[n,r,o]=Bc(e,t),i=Fc(e),s=[`
|
|
97
|
+
`+y)):[A,N]=i.get_insertion_anchor(o,r),!A&&!N||me._introduces_table_row_text(i,o,1,"",y))return false;let x=y,C=w===null&&/\n\s*$/.test(x),P=null;{let O=i.spans.filter(T=>T.paragraph!==null&&T.start===o);O.length>0&&O[0].paragraph&&(P=O[0].paragraph._element);}if(C&&P&&P.parentNode){let O=P.parentNode,T=this.doc.part._element.ownerDocument,M=x.split(/[\r\n]+/).filter(q=>q!==""),B=null,U=null,R=null;for(let q of M){let[Q,te]=this._parse_markdown_style(q),J=T.createElement("w:p");if(te)this._set_paragraph_style(J,te);else {let qe=F(P,"w:pPr");qe&&J.appendChild(qe.cloneNode(true));}let K=F(J,"w:pPr");K||(K=T.createElement("w:pPr"),J.insertBefore(K,J.firstChild));let G=F(K,"w:rPr");G||(G=T.createElement("w:rPr"),K.appendChild(G)),G.appendChild(this._create_track_change_tag("w:ins","",c));let ye=this._build_tracked_ins_for_line(Q,A,c,T,u);ye&&J.appendChild(ye),O.insertBefore(J,P),B||(B=J),U=J,R=ye;}if(B){if(t.comment&&U&&R){let q=d((te,J)=>{let K=te;for(;K.parentNode&&K.parentNode!==J;)K=K.parentNode;return K},"ascend"),Q=I(B,"w:ins")[0]||B;this._attach_comment_spanning(B,q(Q,B),U,q(R,U),t.comment);}return true}}let S=this._track_insert_multiline(y,A,N,c,null,u);if(!S.first_node)return false;if(S.first_node.tagName==="w:ins"){if(A){let O=A._element,T=O.parentNode;T&&T.tagName==="w:del"&&(O=T,T=O.parentNode);let M=o===0;T&&T.tagName==="w:ins"?this._insert_and_split_ins(T,O,S.first_node,M):M&&T?T.insertBefore(S.first_node,O):qt(S.first_node,O);}else if(N){let O=N._element,T=O.firstChild;for(;T&&T.tagName==="w:pPr";)T=T.nextSibling;O.insertBefore(S.first_node,T);}}if(t.comment){let O=d((T,M)=>{let B=T;for(;B.parentNode&&B.parentNode!==M;)B=B.parentNode;return B},"ascend_to_paragraph_child");if(S.last_p&&S.last_ins){let T=S.first_node;for(;T&&T.tagName!=="w:p";)T=T.parentNode;if(T){let M=S.first_node;S.first_node.tagName==="w:p"&&(M=I(S.first_node,"w:ins")[0]||S.first_node);let B=O(M,T),U=O(S.last_ins,S.last_p);this._attach_comment_spanning(T,B,S.last_p,U,t.comment);}}else {let T=S.first_node;for(;T&&T.tagName!=="w:p";)T=T.parentNode;if(T){let M=S.first_node;S.first_node.tagName==="w:p"&&(M=I(S.first_node,"w:ins")[0]||S.first_node);let B=O(M,T);this._attach_comment(T,B,B,t.comment);}}}return true}if((s==="DELETION"||s==="MODIFICATION")&&l&&i.part_ranges.filter(y=>y[1]>y[0]).length>1){let y=new Set;for(let w of i.spans)w.run!==null&&w.end>o&&w.start<o+l&&y.add(w.part_index);if(y.size>1)return false}let f=i.find_target_runs_by_index(o,l,r),h=i.get_virtual_spans_in_range(o,l);if(f.length===0&&h.length===0)return false;let p=new Set;for(let y of f){let w=y._element.parentNode;for(;w&&w.tagName!=="w:p";)w=w.parentNode;w&&p.add(w);}let _=null,m=null;for(let y of f){let w=this._create_track_change_tag("w:del","",a),E=y._element.cloneNode(true);Array.from(E.getElementsByTagName("w:t")).forEach(A=>{let N=E.ownerDocument.createElement("w:delText");N.textContent=A.textContent,A.hasAttribute("xml:space")&&N.setAttribute("xml:space","preserve"),E.replaceChild(N,A);}),w.appendChild(E),y._element.parentNode?.replaceChild(w,y._element),_===null&&(_=w),m=w;}let g=null,v=null,D=null;if(s==="MODIFICATION"&&t.new_text&&m){let y=m;for(;y&&y.tagName!=="w:p";)y=y.parentNode;let w=y?new ve(y,null):null,E=f.length>0?f[f.length-1]:null,b=this._track_insert_multiline(t.new_text,E,w,c,m,u);if(b.first_node){if(b.first_node.tagName==="w:ins"){let N=m.parentNode;N&&N.tagName==="w:ins"?this._insert_and_split_ins(N,m,b.first_node):qt(b.first_node,m),g=b.first_node;}else g=b.last_ins;v=b.last_p,D=b.last_ins;}}if(s==="DELETION"||s==="MODIFICATION"){if(s==="MODIFICATION"&&f.length===0&&h.length>0&&t.new_text){let y=h[0];if(y.paragraph){let w=y.paragraph._element,E=I(w,"w:r"),b=E.length>0?new it(E[E.length-1],y.paragraph):null,A=this._track_insert_multiline(t.new_text,b,y.paragraph,c,null,u);A.first_node&&w.appendChild(A.first_node);}}for(let y of [...h].reverse())if(y.paragraph){let w=y.paragraph._element,E=ht(w);for(;E&&E.tagName!=="w:p";)E=ht(E);if(E&&E.tagName==="w:p"){let b=F(w,"w:pPr");b||(b=w.ownerDocument.createElement("w:pPr"),w.insertBefore(b,w.firstChild));let A=F(b,"w:rPr");A||(A=w.ownerDocument.createElement("w:rPr"),b.appendChild(A));let N=this._create_track_change_tag("w:del");A.appendChild(N);let x=Array.from(E.childNodes);for(let C of x)C.nodeType===1&&C.tagName==="w:pPr"||w.appendChild(C);E.parentNode&&E.parentNode.removeChild(E);}}}if(t.comment&&_!==null){let y,w;if(v&&D)y=D,w=v;else {let x=g!==null?g:m;for(y=x,w=x;w&&w.tagName!=="w:p";)w=w.parentNode;}let E=_;for(;E&&E.tagName!=="w:p";)E=E.parentNode;if(!E||!w)return true;let b=d((x,C)=>{let P=x;for(;P.parentNode&&P.parentNode!==C;)P=P.parentNode;return P},"ascend_to_paragraph_child"),A=b(_,E),N=b(y,w);E===w?this._attach_comment(E,A,N,t.comment):this._attach_comment_spanning(E,A,w,N,t.comment);}for(let y of p){let w=false;for(let E of ["w:t","w:tab","w:br"]){let b=I(y,E);for(let A of b){let N=false,x=A.parentNode;for(;x&&x!==y.parentNode;){if(x.tagName==="w:del"){N=true;break}x=x.parentNode;}if(!N){if(E==="w:t"&&!A.textContent)continue;w=true;break}}if(w)break}if(!w){let E=F(y,"w:pPr");E||(E=y.ownerDocument.createElement("w:pPr"),y.insertBefore(E,y.firstChild));let b=F(E,"w:rPr");if(b||(b=y.ownerDocument.createElement("w:rPr"),E.appendChild(b)),!F(b,"w:del")){let A=this._create_track_change_tag("w:del");b.appendChild(A);}}}return true}};function we(e,t){let n=[],r=e.getElementsByTagName("*");for(let s=0;s<r.length;s++){let i=r[s].tagName;(i===t||i.endsWith(":"+t))&&n.push(r[s]);}return n}d(we,"findDescendantsByLocalName");function cc(e){let t=0;function n(o,l){let u=o?o.toString():"",a=l?l.toString():"";return u===a}d(n,"areRunsIdentical");function r(o){let l=["w:t","w:tab","w:br","w:cr","w:delText","w:rPr"];for(let u=0;u<o.childNodes.length;u++){let a=o.childNodes[u];if(a.nodeType===1){let c=a.tagName;if(!l.includes(c))return true}}return false}d(r,"hasSpecialContent");function s(o){let l=Array.from(o.childNodes).filter(a=>a.nodeType===1),u=0;for(;u<l.length-1;){let a=l[u],c=l[u+1];if(a.tagName==="w:r"&&c.tagName==="w:r"&&!r(a)&&!r(c)){let f=F(a,"w:rPr"),h=F(c,"w:rPr");if(n(f,h)){let p=null;for(let m=0;m<a.childNodes.length;m++){let g=a.childNodes[m];g.nodeType===1&&(g.tagName==="w:t"||g.tagName==="w:delText")&&(p=g);}let _=Array.from(c.childNodes).filter(m=>m.nodeType===1);for(let m of _)if(m.tagName!=="w:rPr")if((m.tagName==="w:t"||m.tagName==="w:delText")&&p&&p.tagName===m.tagName){let g=p.textContent||"",v=m.textContent||"",D=g+v;p.textContent=D,D.trim()!==D&&p.setAttribute("xml:space","preserve");}else a.appendChild(m),(m.tagName==="w:t"||m.tagName==="w:delText")&&(p=m);o.removeChild(c),l.splice(u+1,1),t++;continue}}["w:ins","w:del","w:hyperlink","w:sdt","w:smartTag","w:fldSimple","w:sdtContent"].includes(a.tagName)&&s(a),u++;}if(l.length>0){let a=l[l.length-1];["w:ins","w:del","w:hyperlink","w:sdt","w:smartTag","w:fldSimple","w:sdtContent"].includes(a.tagName)&&s(a);}}d(s,"coalesceContainer");let i=I(e.element,"w:p");for(let o of i)s(o);return t?[`Adjacent identical runs coalesced: ${t}`]:[]}d(cc,"coalesce_runs");function fc(e){let t=0,n=["w:rsidR","w:rsidRPr","w:rsidRDefault","w:rsidP","w:rsidDel","w:rsidSect","w:rsidTr"],r=e.element.getElementsByTagName("*");for(let i=0;i<r.length;i++)for(let o of n)r[i].hasAttribute(o)&&(r[i].removeAttribute(o),t++);let s=I(e.element,"w:rsids");for(let i of s)i.parentNode&&(i.parentNode.removeChild(i),t++);return t?[`rsid attributes: ${t} removed`]:[]}d(fc,"strip_rsid");function dc(e){let t=0,n=["w14:paraId","w14:textId"],r=e.element.getElementsByTagName("*");for(let s=0;s<r.length;s++)for(let i of n)r[s].hasAttribute(i)&&(r[s].removeAttribute(i),t++);return t?[`Paragraph/text IDs: ${t} removed`]:[]}d(dc,"strip_para_ids");function hc(e){let t=I(e.element,"w:proofErr");return t.forEach(n=>n.parentNode?.removeChild(n)),t.length?[`Spell check markers: ${t.length} removed`]:[]}d(hc,"strip_proof_errors");function pc(e){let t=0;for(let n of ["w:rPr","w:pPr"]){let r=I(e.element,n);for(let s of r)(s.childNodes.length===0||s.childNodes.length===1&&s.childNodes[0].nodeType===3&&!s.childNodes[0].textContent?.trim())&&(s.parentNode?.removeChild(s),t++);}return t?[`Empty property elements: ${t} removed`]:[]}d(pc,"strip_empty_properties");function mc(e){let t=0,n=I(e.element,"w:rPr");for(let r of n)if(F(r,"w:vanish")||F(r,"w:webHidden")){let s=r.parentNode;s&&s.tagName==="w:r"&&s.parentNode&&(s.parentNode.removeChild(s),t++);}return t?[`Hidden text runs: ${t} removed`]:[]}d(mc,"strip_hidden_text");function Ls(e){let t=I(e.element,"w:ins").length,n=I(e.element,"w:del").length,r=I(e.element,"w:rPrChange").length+I(e.element,"w:pPrChange").length+I(e.element,"w:sectPrChange").length;return [t,n,r]}d(Ls,"count_tracked_changes");function _c(e){let t=new Set;for(let n of ["w:ins","w:del","w:rPrChange","w:pPrChange","w:sectPrChange"])for(let r of I(e.element,n)){let s=r.getAttribute("w:author");s&&t.add(s);}return t}d(_c,"get_track_change_authors");function $s(e){let t=[],n=I(e,"w:t");for(let s of n)s.textContent&&t.push(s.textContent);let r=I(e,"w:delText");for(let s of r)s.textContent&&t.push(s.textContent);return t.join("")}d($s,"_getElementText");function Vt(e,t=60){let n=e.replace(/\n/g," ").trim();return n.length<=t?n:n.substring(0,t-3)+"..."}d(Vt,"_truncate");function gc(e){let t=[],n=I(e.element,"w:ins"),r=I(e.element,"w:del");for(let o of n){let l=$s(o).trim();l&&t.push(` Accepted insertion: "${Vt(l,60)}"`);}for(let o of r){let l=$s(o).trim();l&&t.push(` Accepted deletion of: "${Vt(l,60)}"`);}new Vr(e).accept_all_revisions();for(let o of ["w:rPrChange","w:pPrChange","w:sectPrChange"])for(let l of I(e.element,o))l.parentNode?.removeChild(l);let i=n.length+r.length;return i?[`Tracked changes auto-accepted: ${i}`].concat(t):[]}d(gc,"accept_all_tracked_changes");function wc(e){let t=bn(e.pkg),n=[],r=0,s=0;for(let[i,o]of Object.entries(t))o.resolved?s++:r++,n.push({id:i,...o});return {total:n.length,open:r,resolved:s,comments:n}}d(wc,"get_comments_summary");function vc(e){let t=bn(e.pkg),n=Object.keys(t);if(n.length===0)return [];let r=[],s=new jt(e);for(let[u,a]of Object.entries(t)){let c=a.resolved?"[Resolved]":"[Open]";r.push(` ${c} "${Vt(a.text||"",60)}" (${a.author||"Unknown"})`),s.deleteComment(u);}for(let u of ["w:commentRangeStart","w:commentRangeEnd"])for(let a of I(e.element,u))a.parentNode?.removeChild(a);let i=I(e.element,"w:commentReference");for(let u of i){let a=u.parentNode;a&&((a.tagName==="w:r"||a.tagName.endsWith(":r"))&&Array.from(a.childNodes).filter(f=>f.nodeType===1&&f.tagName!=="w:rPr"&&f.tagName!=="rPr").length<=1?a.parentNode?.removeChild(a):a.removeChild(u));}let o=Object.values(t).filter(u=>u.resolved).length,l=Object.values(t).filter(u=>!u.resolved).length;return [`Comments removed: ${n.length} (${o} resolved, ${l} open)`].concat(r)}d(vc,"remove_all_comments");function yc(e){let t=e.pkg,n=new Set;for(let s of t.parts)if(s.partname.toLowerCase().includes("comments")){n.add(s.partname);let i=s.partname.startsWith("/")?s.partname:"/"+s.partname,o=s.partname.startsWith("/")?s.partname.substring(1):s.partname;n.add(i),n.add(o);}if(n.size===0)return;for(let s of t.parts)if(s.partname.endsWith(".rels")){let i=I(s._element,"Relationship"),o=[];for(let l of i)if((l.getAttribute("Target")||"").toLowerCase().includes("comments")){o.push(l);let a=s.partname.replace("/_rels/","/").replace(".rels",""),c=t.getPartByPath(a);if(c){let f=l.getAttribute("Id");f&&c.rels.delete(f);}}for(let l of o)l.parentNode?.removeChild(l);}let r=t.getPartByPath("[Content_Types].xml");if(r){let s=I(r._element,"Override"),i=[];for(let o of s){let l=o.getAttribute("PartName")||"";(n.has(l)||l.toLowerCase().includes("comments"))&&i.push(o);}for(let o of i)o.parentNode?.removeChild(o);}t.parts=t.parts.filter(s=>!s.partname.toLowerCase().includes("comments"));for(let s of Object.keys(t.unzipped))s.toLowerCase().includes("comments")&&delete t.unzipped[s];}d(yc,"eject_comment_parts");function Ec(e,t){let n=new jt(e);if(!n.commentsPart)return [];let r=new Set,s=I(n.commentsPart._element,"w:comment");for(let i of s){let o=i.getAttribute("w:author");if(o&&(r.add(o),i.setAttribute("w:author",t)),i.hasAttribute("w:initials")){let l=t.split(" ").filter(Boolean).map(u=>u[0]).join("").toUpperCase();i.setAttribute("w:initials",l);}}return r.size?[`Comment authors replaced: ${Array.from(r).sort().join(", ")} \u2192 "${t}"`]:[]}d(Ec,"replace_comment_authors");function bc(e,t){let n=new Set;for(let r of ["w:ins","w:del","w:rPrChange","w:pPrChange"])for(let s of I(e.element,r)){let i=s.getAttribute("w:author");i&&(n.add(i),s.setAttribute("w:author",t));}return n.size?[`Track change authors replaced: ${Array.from(n).sort().join(", ")} \u2192 "${t}"`]:[]}d(bc,"replace_change_authors");function Dc(e){let t=0,n="2025-01-01T00:00:00Z";for(let r of ["w:ins","w:del","w:rPrChange","w:pPrChange"])for(let s of I(e.element,r))s.hasAttribute("w:date")&&(s.setAttribute("w:date",n),t++);return t?[`Track change timestamps: ${t} normalized`]:[]}d(Dc,"normalize_change_dates");function Ac(e){let t=0,n="2025-01-01T00:00:00Z";for(let r of e.pkg.parts)if(r.contentType.includes("comments")){for(let s of I(r._element,"w:comment"))s.hasAttribute("w:date")&&(s.setAttribute("w:date",n),t++);for(let s of I(r._element,"w16cex:commentExtensible"))s.hasAttribute("w16cex:dateUtc")&&(s.setAttribute("w16cex:dateUtc",n),t++);}return t?[`Comment timestamps: ${t} normalized`]:[]}d(Ac,"normalize_comment_dates");function Nc(e){let t=[],n=e.pkg.getPartByPath("docProps/core.xml");if(n){we(n._element,"creator").forEach(a=>{a.textContent&&(t.push(`Author: ${a.textContent}`),a.textContent="");}),we(n._element,"lastModifiedBy").forEach(a=>{a.textContent&&(t.push(`Last modified by: ${a.textContent}`),a.textContent="");}),we(n._element,"title").forEach(a=>{a.textContent&&t.push(`Title kept (review manually): "${a.textContent}"`);});let l=[["category","Category"],["keywords","Keywords"],["subject","Subject"],["contentStatus","Content status"],["description","Description/comments"],["identifier","Identifier"],["language","Language"],["version","Version"]];for(let[a,c]of l)we(n._element,a).forEach(f=>{f.textContent&&(t.push(`${c}: ${f.textContent}`),f.textContent="");});we(n._element,"revision").forEach(a=>{a.textContent&&parseInt(a.textContent)>1&&(t.push(`Revision count: ${a.textContent} \u2192 1`),a.textContent="1");});}let r=e.pkg.getPartByPath("docProps/app.xml");if(r){let s=r._element,i=["TotalTime","Words","Characters","Paragraphs","Lines","CharactersWithSpaces"];for(let l of i)we(s,l).forEach(u=>{u.textContent&&u.textContent!=="0"&&(l==="TotalTime"&&t.push(`Total editing time: ${u.textContent} minutes`),u.textContent="0");});let o=["Template","Manager","Company"];for(let l of o)we(s,l).forEach(u=>{u.textContent&&(t.push(`${l}: ${u.textContent}`),u.textContent="");});}return t.length?["Metadata scrubbed:",...t.map(s=>` ${s}`)]:[]}d(Nc,"scrub_doc_properties");function xc(e){let t=false,n="1970-01-01T00:00:00Z",r=e.pkg.getPartByPath("docProps/core.xml");if(r)for(let s of ["created","modified","lastPrinted"])we(r._element,s).forEach(i=>{i.textContent&&i.textContent!==n&&(i.textContent=n,t=true);});return t?["Timestamps normalized to epoch"]:[]}d(xc,"scrub_timestamps");function oo(e,t,n){let r=e.pkg,s=d(o=>o.startsWith("/")?o.substring(1):o,"normalized");for(let o of r.parts){if(!o.partname.endsWith(".rels"))continue;let l=[];for(let u of I(o._element,"Relationship")){let a=u.getAttribute("Target")||"";if(n(a)){l.push(u);let c=o.partname.replace("/_rels/","/").replace(".rels",""),f=r.getPartByPath(c);if(f){let h=u.getAttribute("Id");h&&f.rels.delete(h);}}}l.forEach(u=>u.parentNode?.removeChild(u));}let i=r.getPartByPath("[Content_Types].xml");if(i){let o=[];for(let l of I(i._element,"Override")){let u=l.getAttribute("PartName")||"";t(s(u))&&o.push(l);}o.forEach(l=>l.parentNode?.removeChild(l));}r.parts=r.parts.filter(o=>!t(s(o.partname)));for(let o of Object.keys(r.unzipped))t(s(o))&&delete r.unzipped[o];}d(oo,"ejectPackageMembers");function Cc(e){let t=d(s=>s.startsWith("customXml/"),"isCustomXml"),n=e.pkg.parts.filter(s=>t(s.partname.startsWith("/")?s.partname.substring(1):s.partname)),r=Object.keys(e.pkg.unzipped).filter(t);if(n.length===0&&r.length===0)return [];oo(e,t,s=>s.includes("customXml"));for(let s of I(e.element,"w:sdtPr"))el(s,"w:dataBinding").forEach(i=>s.removeChild(i));return [`Custom XML parts: ${Math.max(n.length,r.length)} removed`]}d(Cc,"strip_custom_xml");var jr="docProps/custom.xml";function Tc(e){let t=e.pkg.getPartByPath(jr),n=Object.keys(e.pkg.unzipped).includes(jr);if(!t&&!n)return [];let r=[];if(t)for(let i of we(t._element,"property")){let o=i.getAttribute("name")||"(unnamed)",l=(i.textContent||"").trim();r.push(` Custom property removed: ${o} = "${Vt(l,60)}"`);}return oo(e,i=>i===jr,i=>i.includes("docProps/custom.xml")),[`Custom document properties: ${Math.max(r.length,1)} removed (docProps/custom.xml)`].concat(r)}d(Tc,"strip_custom_properties");function kc(e){let t=0;for(let n of we(e.element,"docPr")){let r=n.getAttribute("descr");if(r){let s=r.length<10,i=r.includes(".")&&r.length<60;(s||i)&&(n.removeAttribute("descr"),t++);}}return t?[`Image alt text: ${t} auto-generated descriptions removed`]:[]}d(kc,"strip_image_alt_text");function Sc(e){let t=[],n=new Set;for(let r of e.pkg.parts){let s=String(r.partname),i;if(s.startsWith("/word/header"))i="header";else if(s.startsWith("/word/footer"))i="footer";else if(s==="/word/document.xml")i="body";else continue;let o;try{o=we(r._element,"textpath");}catch{continue}for(let l of o){let u=(l.getAttribute("string")||"").trim(),a=`${i}${u}`;if(n.has(a))continue;n.add(a);let c=u?`"${Vt(u,60)}"`:"(no text)";t.push(`Watermark-like text object in ${i}: ${c} \u2014 NOT removed. It remains in the document package and may render in other applications; review and remove it in Word if it must not reach the counterparty.`);}}return t}d(Sc,"detect_watermarks");function Ic(e){let t=["sharepoint.com","onedrive.com",".internal","intranet","localhost","10.","192.168.","172.16."],n=[],r=e.pkg.getOrCreateRelsPart(e.part.partname);for(let s of I(r._element,"Relationship"))if(s.getAttribute("TargetMode")==="External"){let i=s.getAttribute("Target")||"";for(let o of t)if(i.toLowerCase().includes(o.toLowerCase())){n.push(`Hyperlink targets internal URL: ${Vt(i,80)}`);break}}return n}d(Ic,"audit_hyperlinks");function Oc(e,t,n=2){if(e===t)return 0;if(Math.abs(e.length-t.length)>n)return n+1;if(e.length===0)return t.length<=n?t.length:n+1;if(t.length===0)return e.length<=n?e.length:n+1;if(e.length>t.length){let s=e;e=t,t=s;}let r=Array.from({length:e.length+1},(s,i)=>i);for(let s=1;s<=t.length;s++){let i=[s],o=s;for(let l=1;l<=e.length;l++){let u=e[l-1]===t[s-1]?0:1,a=Math.min(r[l]+1,i[l-1]+1,r[l-1]+u);i.push(a),a<o&&(o=a);}if(o>n)return n+1;r=i;}return r[e.length]<=n?r[e.length]:n+1}d(Oc,"boundedLevenshtein");function Pc(e){let t="",n=I(e._element,"w:r");for(let r of n)t+=pt(new it(r,e));return t}d(Pc,"_get_paragraph_text");var Gr="[A-Z][A-Za-z0-9\\s\\-&'\u2019]{1,60}",Mc=new RegExp(`^(?:[\\d.\\-()a-zA-Z]+\\s*)?["\u201C](${Gr})["\u201D]`,"d"),Rc=new RegExp(`(?<=[.;:!?])\\s+(?:[\\d.\\-()a-zA-Z]+\\s+)?["\u201C](${Gr})["\u201D]`,"dg"),Bc=new RegExp(`\\([^)]*?["\u201C](${Gr})["\u201D][^)]*?\\)`,"dg");function Fc(e){let t=[],n=Mc.exec(e);n&&n.indices&&n.indices[1]&&t.push([n.indices[1][0],n[1].trim()]);for(let i of e.matchAll(Rc)){let o=i.indices;o&&o[1]&&t.push([o[1][0],i[1].trim()]);}for(let i of e.matchAll(Bc)){let o=i.indices;o&&o[1]&&t.push([o[1][0],i[1].trim()]);}let r=[],s=new Set;t.sort((i,o)=>i[0]-o[0]);for(let[i,o]of t)s.has(i)||(s.add(i),r.push(o));return r}d(Fc,"extract_terms_from_paragraph");function Lc(e,t){let n={},r=new Set,s={},i=[];for(let m of at(e)){if(!(m instanceof ve))continue;let g=Pc(m).trim();if(!g)continue;for(let y of Fc(g))n[y]?r.add(y):n[y]={count:0};let v=g.length>60?g.substring(0,60)+"...":g,D=I(m._element,"*");for(let y of D){if(y.tagName==="w:bookmarkStart"){let E=y.getAttribute("w:name");E&&(!E.startsWith("_")||E.startsWith("_Ref"))&&(s[E]||(s[E]={anchored_to:v,referenced_from:[]}));}let w=null;if(y.tagName==="w:fldSimple"){let b=(y.getAttribute("w:instr")||"").trim().split(/\s+/);b.length>1&&b[0]==="REF"&&(w=b[1]);}else if(y.tagName==="w:instrText"){let b=(y.textContent||"").trim().split(/\s+/);b.length>1&&b[0]==="REF"&&(w=b[1]);}w&&i.push([w,v]);}}for(let[m,g]of i)s[m]&&s[m].referenced_from.push(g);let o=[],l=Object.keys(n);if(l.length>0){let m=l.sort((y,w)=>w.length-y.length),g=d(y=>y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"escapeRegExp"),v=m.map(g).join("|"),D=new RegExp(`(?<!["\u201C])\\b(${v})\\b(?![\u201D"])`,"g");for(let y of t.matchAll(D)){let w=y[1];n[w]&&n[w].count++;}for(let y of l)n[y].count===0&&(delete n[y],r.has(y)||o.push(`[Warning] Unused Definition: '${y}' is defined but never used.`));}for(let m of r)o.push(`[Error] Duplicate Definition: '${m}' is defined multiple times.`);let u=new Set(["The","This","That","Such","A","An","Any","All","Some","No","Every","Each","As","In","Of","For","To","On","By","With"]),a=/\b[A-Z][a-zA-Z]*(?:\s+[A-Z][a-zA-Z]*)*\b/g,c=new Set(t.match(a)||[]),f=new Set(Object.keys(n)),h={};for(let m of f){let g=m[0].toLowerCase();h[g]||(h[g]=[]),h[g].push(m);}let p={};for(let m of c){let g=m.trim(),v=g.split(/\s+/);for(;v.length>0;){let w=v[0],E=w.charAt(0).toUpperCase()+w.slice(1).toLowerCase();if(u.has(E))v.shift();else break}if(g=v.join(" "),g.length<4||f.has(g))continue;let D=g[0].toLowerCase(),y=h[D]||[];if(g.length>5)for(let[w,E]of Object.entries(h))w!==D&&(y=y.concat(E));for(let w of y){if(Math.abs(g.length-w.length)>2||g===w+"s"||g===w+"es"||w===g+"s"||w===g+"es")continue;let E=Oc(g,w,2);E===0||E>2||w.length<=5&&(E>1||g[0].toLowerCase()!==w[0].toLowerCase())||(p[w]||(p[w]=[]),p[w].includes(g)||p[w].push(g));}}for(let[m,g]of Object.entries(p)){g.sort();let v=g.map(D=>`'${D}'`).join(", ");o.push(`[Info] Possible Typos for '${m}': Found ${v}`);}function _(m){return m.startsWith("[Error]")?0:m.startsWith("[Warning]")?1:2}return d(_,"diag_sort_key"),o.sort((m,g)=>{let v=_(m),D=_(g);return v!==D?v-D:m.localeCompare(g)}),[n,o,s]}d(Lc,"extract_all_domain_metadata");function $c(e){let t=[],n=e.pkg.getPartByPath("word/settings.xml");if(!n)return t;let r=d(o=>{if(!o.hasAttribute("w:val"))return true;let l=(o.getAttribute("w:val")||"").toLowerCase();return l!=="0"&&l!=="false"&&l!=="off"},"isTruthy"),s=we(n._element,"removePersonalInformation");s.length>0&&r(s[0])&&t.push("[Warning] Privacy flag `removePersonalInformation` is enabled in word/settings.xml. Microsoft Word will strip the `w:author`, `w:initials`, and `w:date` attributes from every tracked change and comment the next time this document is opened and saved. Edits made by this agent will lose attribution, breaking audit trails and any multi-turn workflow that relies on identifying prior edits.");let i=we(n._element,"removeDateAndTime");return i.length>0&&r(i[0])&&t.push("[Warning] Privacy flag `removeDateAndTime` is enabled in word/settings.xml. Microsoft Word will strip the `w:date` attribute from every tracked change and comment the next time this document is opened and saved. Timestamps on this agent's edits will be lost on the next Word save."),t}d($c,"extract_document_settings_warnings");function Uc(e,t){let[n,r,s]=Lc(e,t),i=$c(e),o=[`
|
|
98
98
|
|
|
99
|
-
---`,"","<!-- READONLY_BOUNDARY_START -->","# Document Structure (Read-Only)","The content below is metadata describing the document's reference structure. Do not include this section in any tracked changes or edits \u2014 it is for your context only and will be discarded on write."],l=false;if(i.length>0){l=true,
|
|
100
|
-
## Document Settings`);for(let
|
|
101
|
-
## Defined Terms`);for(let[a
|
|
102
|
-
## Semantic Diagnostics`);for(let
|
|
103
|
-
## Named Anchors`);for(let[a
|
|
104
|
-
`):""}d(
|
|
99
|
+
---`,"","<!-- READONLY_BOUNDARY_START -->","# Document Structure (Read-Only)","The content below is metadata describing the document's reference structure. Do not include this section in any tracked changes or edits \u2014 it is for your context only and will be discarded on write."],l=false;if(i.length>0){l=true,o.push(`
|
|
100
|
+
## Document Settings`);for(let u of i)o.push(`- ${u}`);}if(Object.keys(n).length>0){l=true,o.push(`
|
|
101
|
+
## Defined Terms`);for(let[u,a]of Object.entries(n))o.push(`- "${u}" \u2014 used ${a.count} times.`);}if(r.length>0){l=true,o.push(`
|
|
102
|
+
## Semantic Diagnostics`);for(let u of r)o.push(`- ${u}`);}if(Object.keys(s).length>0){l=true,o.push(`
|
|
103
|
+
## Named Anchors`);for(let[u,a]of Object.entries(s)){o.push(`- ${u} \u2192 Anchored to: "${a.anchored_to}"`);for(let c of a.referenced_from)o.push(` - Referenced from: "${c}"`);}}return l?o.join(`
|
|
104
|
+
`):""}d(Uc,"build_structural_appendix");async function _t(e,t=false,n=true){let r=await mt.load(e);return Yr(r,t,n)}d(_t,"extractTextFromBuffer");function Yr(e,t=false,n=true,r=false,s=false){let i=bn(e.pkg),o=[],l=new Map,u=s?{part_ranges:[],tables:[]}:null,a=0;for(let[f,h]of Hr(e)){let p=o.length>0?a+2:a,_=Xr(f,i,t,p,r?l:void 0,u?u.tables:void 0);_&&(o.length>0&&(a+=2),o.push(_),u&&u.part_ranges.push([a,a+_.length,h]),a+=_.length);}let c=o.join(`
|
|
105
105
|
|
|
106
|
-
`);if(n){let f=
|
|
107
|
-
${e.note_type==="fn"?"## Footnotes":"## Endnotes"}`;
|
|
106
|
+
`);if(n){let f=Uc(e,c);f&&(c+=f);}return r?{text:c,paragraph_offsets:l}:u?{text:c,structure:u}:c}d(Yr,"_extractTextFromDoc");function Xr(e,t,n,r,s,i){let o=e.part||e,[l,u]=Dn(o),a=[],c=r,f=true,h=true;if(e.constructor&&e.constructor.name==="NotesPart"){let _=`---
|
|
107
|
+
${e.note_type==="fn"?"## Footnotes":"## Endnotes"}`;a.push(_),c+=_.length,f=false;}for(let p of at(e)){f||(c+=2);let _=c;if(p.constructor.name==="FootnoteItem"){let m=Xr(p,t,n,_,s);m?(a.push(m),c=_+m.length,f=false):f||(c-=2);}else if(p instanceof ve){let m=ot(p,l,u);h&&e.constructor.name==="FootnoteItem"&&(m=`[^${e.note_type}-${e.id}]: `+m);let g=An(p,t,n,l,u),v=m+g;a.push(v),s&&s.set(p._element,[_,v.length]),c=_+v.length,h=false,f=false;}else if(p instanceof st){let m=i?{start:_,end:_,rows:[]}:null,g=rr(p,t,n,_,s,m);g?(a.push(g),c=_+g.length,f=false,m&&i&&(m.end=_+g.length,i.push(m))):f||(c-=2),h=false;}}return a.join(`
|
|
108
108
|
|
|
109
|
-
`)}d(Xr,"_extract_blocks");function rr(e,t,n,r,
|
|
110
|
-
`)}d(rr,"extract_table");function An(e,t,n,r,
|
|
111
|
-
`)}d(
|
|
112
|
-
${i}`);}let
|
|
109
|
+
`)}d(Xr,"_extract_blocks");function rr(e,t,n,r,s,i){let o=[],l=0,u=r;for(let a of e.rows){let c=[],f=new Set,h=F(a._element,"w:trPr"),p=h?F(h,"w:ins"):null,_=h?F(h,"w:del"):null;if(n&&_)continue;let m=u+(l>0?1:0),v=m+(!n&&p||!n&&_?4:0),D=true;for(let w of a.cells){if(f.has(w))continue;f.add(w),D||(v+=3);let E=Xr(w,t,n,v,s);if(!n){let b=w._element.getElementsByTagName("w:p")[0],A=b?b.getAttribute("w14:paraId"):null;if(A){let N=`{#cell:${A}}`;E=E+N;}}c.push(E),v+=E.length,D=false;}let y=c.join(" | ");n||(p?y=`{++ ${y} |Chg:${p.getAttribute("w:id")}++}`:_&&(y=`{-- ${y} |Chg:${_.getAttribute("w:id")}--}`)),o.push(y),u=m+y.length,i&&i.rows.push({start:m,end:u,cells:[...c]}),l++;}return o.join(`
|
|
110
|
+
`)}d(rr,"extract_table");function An(e,t,n,r,s){let i=[],o={},l={},u=new Set,a={},c=[],f="",h=["",""],p=["",""],_=Array.from(nr(e)),m=Ks(e,r,s),g=Wr(e,r,s),v=m;for(let D=0;D<_.length;D++){let y=_[D];if(y instanceof it){let[w,E]=eo(y,g),b=pt(y);if(n&&Object.keys(l).length>0)continue;if(v){if(!b||!b.trim())continue;v=false;}let A=Vl(b,w,E);if(A){let N=n?["",""]:qc(o,l,u,a),x=[w,E];if(f&&N[0]===h[0]&&N[1]===h[1]){let C=x[0].replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),P=x[0]!==""||x[1]!==""?A.match(new RegExp("^(\\s*)"+C)):null;x[0]===p[0]&&x[1]===p[1]&&p[0]!==""&&f.endsWith(p[1])&&P!==null?f=f.slice(0,-p[1].length)+P[1]+A.slice(P[0].length):f+=A,p=x;}else f&&i.push(`${h[0]}${f}${h[1]}`),f=A,h=N,p=x;if(!n){(Object.keys(o).length>0||Object.keys(l).length>0||u.size>0||Object.keys(a).length>0)&&c.push([{...o},{...l},new Set(u),{...a}]);let P=false;if(Object.keys(o).length>0||Object.keys(l).length>0||Object.keys(a).length>0||u.size>0){let $=D+1,O=false,T=Object.keys(o).length,M=Object.keys(l).length,B=Object.keys(a).length,U=new Set(u);for(;$<_.length;){let R=_[$];if(R instanceof it){if(!pt(R)){$++;continue}(T>0||M>0||B>0||U.size>0)&&(O=true);break}else {let q=R;q.type==="ins_start"?T++:q.type==="ins_end"?T=Math.max(0,T-1):q.type==="del_start"?M++:q.type==="del_end"?M=Math.max(0,M-1):q.type==="fmt_start"?B++:q.type==="fmt_end"?B=Math.max(0,B-1):q.type==="start"?U.add(q.id):q.type==="end"&&U.delete(q.id);}$++;}O&&(P=true);}if(!P&&c.length>0){let $=Us(c,t);$&&(f&&(i.push(`${h[0]}${f}${h[1]}`),f="",h=["",""],p=["",""]),i.push(`{>>${$}<<}`)),c.length=0;}}}}else {let w=y;if(v=false,["ins_start","ins_end","del_start","del_end","fmt_start","fmt_end"].includes(w.type)||f&&(i.push(`${h[0]}${f}${h[1]}`),f="",h=["",""],p=["",""]),w.type==="start")u.add(w.id);else if(w.type==="end")u.delete(w.id);else if(w.type==="ins_start")o[w.id]=w;else if(w.type==="ins_end")delete o[w.id];else if(w.type==="del_start")l[w.id]=w;else if(w.type==="del_end")delete l[w.id];else if(w.type==="fmt_start")a[w.id]=w;else if(w.type==="fmt_end")delete a[w.id];else if(w.type==="image"){if(!(n&&Object.keys(l).length>0)){let E=(w.date||"image").replace(/\]/g,")").replace(/\n/g," ");i.push(``);}}else w.type==="footnote"||w.type==="endnote"?(f&&(i.push(`${h[0]}${f}${h[1]}`),f="",h=["",""],p=["",""]),i.push(`[^${w.type==="footnote"?"fn":"en"}-${w.id}]`)):w.type==="hyperlink_start"?(f&&(i.push(`${h[0]}${f}${h[1]}`),f="",h=["",""],p=["",""]),i.push("[")):w.type==="hyperlink_end"?(f&&(i.push(`${h[0]}${f}${h[1]}`),f="",h=["",""],p=["",""]),i.push(`](${w.date})`)):w.type==="xref_start"?(f&&(i.push(`${h[0]}${f}${h[1]}`),f="",h=["",""],p=["",""]),i.push("[~")):w.type==="xref_end"?(f&&(i.push(`${h[0]}${f}${h[1]}`),f="",h=["",""],p=["",""]),i.push(`~](#${w.id})`)):w.type==="bookmark"&&(f&&(i.push(`${h[0]}${f}${h[1]}`),f="",h=["",""],p=["",""]),i.push(`{#${w.id}}`));}}if(f&&i.push(`${h[0]}${f}${h[1]}`),c.length>0){let D=Us(c,t);D&&i.push(`{>>${D}<<}`);}return i.join("")}d(An,"build_paragraph_text");function qc(e,t,n,r){return Object.keys(t).length>0?["{--","--}"]:Object.keys(e).length>0?["{++","++}"]:n.size>0||Object.keys(r).length>0?["{==","==}"]:["",""]}d(qc,"_get_wrappers");function Us(e,t){let n=[],r=[],s=new Set;for(let[o,l,u,a]of e){let c=d(function(p){if(!t[p])return;let _=`Com:${p}`;if(s.has(_))return;let m=t[p],g=`[${_}] ${m.author}`;if(m.date&&(g+=` @ ${m.date}`),m.resolved&&(g+="(RESOLVED)"),r.push(`${g}: ${m.text}`),s.add(_),f[p]){let v=f[p].sort((D,y)=>(t[D]?.date||"").localeCompare(t[y]?.date||""));for(let D of v)c(D);}},"render_comment2");for(let[p,_]of Object.entries(o)){let m=`Chg:${p}`;s.has(m)||(n.push(`[${m} insert] ${_.author||"Unknown"}`),s.add(m));}for(let[p,_]of Object.entries(l)){let m=`Chg:${p}`;s.has(m)||(n.push(`[${m} delete] ${_.author||"Unknown"}`),s.add(m));}for(let[p,_]of Object.entries(a)){let m=`Chg:${p}`;s.has(m)||(n.push(`[${m} format] ${_.author||"Unknown"}`),s.add(m));}let f={};for(let[p,_]of Object.entries(t)){let m=_.parent_id;m&&(f[m]||(f[m]=[]),f[m].push(p));}let h=Array.from(u).sort();for(let p of h)c(p);}return [...n,...r].join(`
|
|
111
|
+
`)}d(Us,"_build_merged_meta_block");var ao=/^(#{1,6}) /,uo=3;function lo(e,t,n,r,s=null){if(n.length!==r.length)throw new Error("body_pages and body_page_offsets length mismatch");if(s)return Xc(e,t,r,s);let i=bn(e.pkg),o=zc(e,i),l=[];for(let a=0;a<o.length;a++){let c=o[a];c.is_paragraph&&En(c.item)&&Vc(c.item,i)&&l.push(a);}if(l.length===0)return [];let u=[];for(let a=0;a<l.length;a++){let c=l[a],f=o[c],h=f.item,p=er(h),_=po(h,i),m=ir(h),g=Gc(o,l,a,p),v=o.slice(c+1,g),D=jc(o,c+1,g),y=Yc(v),w=go(f.start_offset,r);u.push({level:p,text:_,page:w,style:m,has_table:D,footnote_ids:y});}return u}d(lo,"extract_outline");function jc(e,t,n){for(let r=t;r<n;r++){let s=e[r];if(s.is_paragraph&&En(s.item))return false;if(s.is_table)return true}return false}d(jc,"_direct_has_table");function zc(e,t){let n=Array.from(Gl(e)),r=0,s=null;for(let u of n){if(u===e){s=u;break}let a=ho(u,t);a&&(r>0&&(r+=2),r+=a.length);}s?r>0&&(r+=2):(s=e,r=0);let i=[],o=r,l=true;for(let u of at(s))if(u instanceof ve){let a=ot(u),c=An(u,t,false),f=(a+c).length;l||(o+=2),i.push({item:u,is_paragraph:true,is_table:false,start_offset:o,projected_length:f}),o+=f,l=false;}else if(u instanceof st){let a=rr(u,t,false,0),c=a?a.length:0;l||(o+=2);let f=o;i.push({item:u,is_paragraph:false,is_table:true,start_offset:f,projected_length:c}),fo(u,f,i,t),o+=c,l=false;}return i}d(zc,"_walk_doc_body");function co(e,t,n,r){let s=t._element,i=n,o=0;for(let l of e.rows){o>0&&(i+=1);let u=new Set,a=0;for(let c of l.cells){if(u.has(c))continue;u.add(c),a>0&&(i+=3);let[f,h]=Wc(c,s,i,r);if(h)return f;i=f,a++;}o++;}return n}d(co,"_compute_inner_block_offset");function Wc(e,t,n,r){let s=n,i=true;for(let o of at(e)){if(i||(s+=2),o instanceof ve){if(o._element===t)return [s,true];let l=ot(o),u=An(o,r,false);s+=(l+u).length;}else if(o instanceof st){let l=co(o,new ve(t,null),s,r);if(l!==s&&Hc(t,o._element))return [l,true];let u=rr(o,r,false,0);s+=u?u.length:0;}i=false;}return [s,false]}d(Wc,"_walk_cell_for_offset");function Hc(e,t){let n=e.parentNode;for(;n;){if(n===t)return true;n=n.parentNode;}return false}d(Hc,"_element_is_descendant");function fo(e,t,n,r){let s=new Set;for(let i of e.rows)for(let o of i.cells)if(!s.has(o)){s.add(o);for(let l of at(o))if(l instanceof ve){let u=En(l)?co(e,l,t,r):t;n.push({item:l,is_paragraph:true,is_table:false,start_offset:u,projected_length:0});}else l instanceof st&&(n.push({item:l,is_paragraph:false,is_table:true,start_offset:t,projected_length:0}),fo(l,t,n,r));}}d(fo,"_record_table_inner_blocks_lite");function ho(e,t){let n=[],r=e.constructor.name;if(r==="NotesPart"){let i=e.note_type==="fn"?"## Footnotes":"## Endnotes";n.push(`---
|
|
112
|
+
${i}`);}let s=true;for(let i of at(e))if(i.constructor.name==="FootnoteItem"){let o=ho(i,t);o&&n.push(o);}else if(i instanceof ve){let o=ot(i);s&&r==="FootnoteItem"&&(o=`[^${e.note_type}-${e.id}]: ${o}`);let l=An(i,t,false);n.push(o+l),s=false;}else if(i instanceof st){let o=rr(i,t,false,0);o&&n.push(o),s=false;}return n.join(`
|
|
113
113
|
|
|
114
|
-
`)}d(
|
|
114
|
+
`)}d(ho,"_project_part");function En(e){return ao.test(ot(e))}d(En,"_is_heading");function Vc(e,t){if(ir(e)!=="(heuristic)")return true;let r=po(e,t);return r?(r.match(/\w+/g)||[]).length>=uo:false}d(Vc,"_heading_passes_quality_filter");function er(e){let t=ao.exec(ot(e));return t?Math.min(t[1].length,6):1}d(er,"_heading_level");function po(e,t){let n=An(e,t,false),r=mo(n);return r=_o(r),r.trim()}d(po,"_heading_text");function mo(e){return e?(e=e.replace(/\{--[\s\S]*?--\}/g,""),e=e.replace(/\{>>[\s\S]*?<<\}/g,""),e=e.replace(/\{\+\+([\s\S]*?)\+\+\}/g,"$1"),e=e.replace(/\{==([\s\S]*?)==\}/g,"$1"),e):""}d(mo,"_strip_critic_markup");function _o(e){return e?(e=e.replace(/\*\*(.+?)\*\*/g,"$1"),e=e.replace(/__(.+?)__/g,"$1"),e=e.replace(/(?<!\w)_(\S(?:.*?\S)?)_(?!\w)/g,"$1"),e):""}d(_o,"_strip_inline_formatting");function ir(e){let[t,n]=Dn(e._parent.part||e._parent),r=F(e._element,"w:pPr"),s=n;if(r){let a=F(r,"w:pStyle");a&&(s=a.getAttribute("w:val")||n);}let i=null,o=false;if(r){let a=F(r,"w:outlineLvl");a&&/^\d+$/.test(a.getAttribute("w:val")||"")&&(i=parseInt(a.getAttribute("w:val"),10));}i===null&&s&&t&&t[s]&&(i=t[s].outline_level,o=true);let u=s&&t&&t[s]?t[s].name:s;return u&&typeof u=="string"&&(u.toLowerCase().startsWith("heading")?u=u.replace(/^heading/i,"Heading"):u.toLowerCase()==="title"&&(u="Title")),o&&i!==null&&(u&&(u.startsWith("Heading")||u==="Title")||(i=null)),i!==null&&i>=0&&i<=8?u&&(u.startsWith("Heading")||u==="Title")?u:"(outline_level)":u&&(u.startsWith("Heading")||u==="Title")||u&&/Heading[ ]?([1-6])(?![0-9])/.test(u)?u:"(heuristic)"}d(ir,"_determine_heading_style");function Gc(e,t,n,r){for(let s=n+1;s<t.length;s++){let i=t[s];if(er(e[i].item)<=r)return i}return e.length}d(Gc,"_find_owned_end");function Yc(e){let t=new Set,n=[];for(let r of e)if(r.is_paragraph)for(let s of nr(r.item)){if(!("type"in s))continue;let i="";if(s.type==="footnote")i=`fn-${s.id}`;else if(s.type==="endnote")i=`en-${s.id}`;else continue;t.has(i)||(t.add(i),n.push(i));}return n}d(Yc,"_collect_footnote_ids");function go(e,t){if(!t||t.length===0)return 1;let n=1;for(let r=0;r<t.length&&e>=t[r];r++)n=r+1;return n}d(go,"_offset_to_page");function Xc(e,t,n,r){let s=[],i=new Set;function o(a){for(let c of at(a))if(c.constructor.name==="FootnoteItem")o(c);else if(c instanceof ve)s.push(["p",c]);else if(c instanceof st){s.push(["t",c]);for(let h of c.rows)for(let p of h.cells)i.has(p._element)||(i.add(p._element),o(p));}}d(o,"walk"),o(e);let l=[];for(let a=0;a<s.length;a++){let[c,f]=s[a];if(c!=="p")continue;let h=false;r instanceof Map?h=r.has(f._element):h=f._element in r,h&&En(f)&&Qc(f,t,r)&&l.push(a);}if(l.length===0)return [];let u=[];for(let a=0;a<l.length;a++){let c=l[a],f=s[c][1],h=er(f),p=wo(f,t,r),_=ir(f),m=c;for(let E=a+1;E<l.length;E++){let b=l[E],A=s[b][1];if(er(A)<=h){m=b;break}}m===c&&(m=s.length);let g=s.slice(c+1,m),v=false;for(let[E,b]of g){if(E==="p"&&En(b))break;if(E==="t"){v=true;break}}let D=Jc(g),y;r instanceof Map?y=r.get(f._element):y=r[f._element];let w=1;if(y!==void 0){let[E]=y;w=go(E,n);}u.push({level:h,text:p,page:w,style:_,has_table:v,footnote_ids:D});}return u}d(Xc,"_extract_outline_fast");function Qc(e,t,n){if(ir(e)!=="(heuristic)")return true;let s=wo(e,t,n);return s?(s.match(/\w+/g)||[]).length>=uo:false}d(Qc,"_heading_passes_quality_filter_fast");function wo(e,t,n){let r;if(n instanceof Map?r=n.get(e._element):r=n[e._element],r===void 0)return "";let[s,i]=r,o=t.substring(s,s+i),l=mo(o);return l=_o(l),l=l.replace(/^#+\s+/,""),l.trim()}d(wo,"_heading_text_fast");function Jc(e){let t=new Set,n=[];for(let[r,s]of e)if(r==="p")for(let i of nr(s)){if(!("type"in i))continue;let o="";if(i.type==="footnote")o=`fn-${i.id}`;else if(i.type==="endnote")o=`en-${i.id}`;else continue;t.has(o)||(t.add(o),n.push(o));}return n}d(Jc,"_collect_footnote_ids_fast");var Zc=class{static{d(this,"SanitizeReport");}filename;mode;author;tracked_changes_found=0;tracked_changes_accepted=0;tracked_changes_kept=0;change_lines=[];comments_removed=0;comments_kept=0;removed_comment_lines=[];kept_comment_lines=[];metadata_lines=[];structural_lines=[];warnings=[];status="clean";blocked_reason=null;constructor(e,t="full",n=null){this.filename=e,this.mode=t,this.author=n;}add_transform_lines(e){for(let t of e){let n=t.toLowerCase();n.includes("tracked change")||n.includes("insertion")||n.includes("deletion")||n.includes("accepted")?this.change_lines.push(t):n.includes("comment")||n.includes("[open]")||n.includes("[resolved]")?n.includes("kept")||n.includes("visible")?this.kept_comment_lines.push(t):this.removed_comment_lines.push(t):n.includes("author")||n.includes("template")||n.includes("company")||n.includes("manager")||n.includes("metadata")||n.includes("timestamp")||n.includes("custom xml")||n.includes("custom propert")||n.includes("identifier")||n.includes("language")||n.includes("version")||n.includes("last modified by")||n.includes("revision count")||n.includes("last printed")?this.metadata_lines.push(t):n.includes("hyperlink")||n.includes("warning")?this.warnings.push(t):this.structural_lines.push(t);}}render(){let e="\u2550".repeat(50),t=[e,`Finalization Report: ${this.filename}`],n=[];if(this.mode==="keep-markup"&&n.push("--keep-markup"),this.author&&n.push(`--author "${this.author}"`),this.tracked_changes_accepted>0&&n.push("--accept-all"),n.length>0&&t.push(n.join(" ")),t.push(e),this.status==="blocked")return t.push(""),t.push(`BLOCKED: ${this.blocked_reason}`),t.push(e),t.join(`
|
|
115
115
|
`);if(this.mode==="keep-markup"&&(this.tracked_changes_kept>0||this.comments_kept>0)){if(t.push(""),t.push("VISIBLE TO COUNTERPARTY"),this.tracked_changes_kept>0&&t.push(` Tracked changes: ${this.tracked_changes_kept}`),this.comments_kept>0){t.push(` Open comments: ${this.comments_kept}`);for(let r of this.kept_comment_lines)t.push(` ${r}`);}this.author&&t.push(` Author on all markup: "${this.author}"`);}if(this.change_lines.length>0){t.push(""),t.push("TRACKED CHANGES");for(let r of this.change_lines)t.push(` ${r}`);}if(this.removed_comment_lines.length>0){t.push(""),t.push("COMMENTS (stripped)");for(let r of this.removed_comment_lines)t.push(` ${r}`);}if(this.metadata_lines.length>0){t.push(""),t.push("METADATA");for(let r of this.metadata_lines)t.push(` ${r}`);}if(this.structural_lines.length>0){t.push(""),t.push("STRUCTURAL & PROTECTION");for(let r of this.structural_lines)t.push(` ${r}`);}if(this.warnings.length>0){t.push(""),t.push("WARNINGS");for(let r of this.warnings)t.push(` \u26A0 ${r}`);}return t.push(""),t.push(e),this.warnings.length>0?t.push(`Result: CLEAN WITH WARNINGS (${this.warnings.length} warning${this.warnings.length>1?"s":""})`):t.push(`Result: CLEAN (${this.tracked_changes_found} changes resolved, ${this.comments_removed} comments removed)`),t.push(e),t.join(`
|
|
116
|
-
`)}};async function
|
|
116
|
+
`)}};async function vo(e,t){let n=new Zc(t.filename,t.sanitize_mode||"full",t.author||null);if(t.sanitize_mode==="full"){let i=Ls(e),o=i[0]+i[1]+i[2];if(n.tracked_changes_found=o,o>0&&!t.accept_all)return n.status="blocked",n.blocked_reason=`Document contains ${o} unresolved tracked changes (${i[0]} insertions, ${i[1]} deletions, ${i[2]} formatting). Review in Word first, or set accept_all=true.`,{reportText:n.render()};if(o>0){let u=_c(e);u.size>1&&n.warnings.push(`Multiple authors detected in tracked changes: ${Array.from(u).sort().join(", ")}. Review per-change list before sending.`),n.add_transform_lines(gc(e)),n.tracked_changes_accepted=o;}let l=wc(e);n.comments_removed=l.total,n.add_transform_lines(vc(e)),yc(e);}else if(t.sanitize_mode==="keep-markup"){let i=Ls(e);n.tracked_changes_found=i[0]+i[1]+i[2],n.tracked_changes_kept=n.tracked_changes_found,t.author&&(n.add_transform_lines(Ec(e,t.author)),n.add_transform_lines(bc(e,t.author)));}n.add_transform_lines(fc(e)),n.add_transform_lines(dc(e)),n.add_transform_lines(hc(e)),n.add_transform_lines(pc(e)),n.add_transform_lines(mc(e)),n.add_transform_lines(cc(e)),n.add_transform_lines(Nc(e)),n.add_transform_lines(xc(e)),n.add_transform_lines(Cc(e)),n.add_transform_lines(Tc(e)),n.add_transform_lines(kc(e));let r=Ic(e);for(let i of r)n.warnings.push(i);for(let i of Sc(e))n.warnings.push(i);if(n.add_transform_lines(Dc(e)),n.add_transform_lines(Ac(e)),t.protection_mode==="read_only"||t.protection_mode==="encrypt"){t.protection_mode==="encrypt"&&n.warnings.push("Encryption mode (AES compound wrappers) is strictly unsupported in the zero-dependency Node engine. Falling back to native Word Read-Only lock.");let i=e.pkg.getPartByPath("word/settings.xml");if(i){let o=i._element.ownerDocument,l=we(i._element,"documentProtection")[0];l||(l=o.createElement("w:documentProtection"),i._element.appendChild(l)),l.setAttribute("w:edit","readOnly"),l.setAttribute("w:enforcement","1"),n.structural_lines.push("Document locked (Read-Only enforcement injected into settings.xml)");}}t.export_pdf&&n.warnings.push("PDF export requires the Python/Word COM environment and is skipped in this zero-dependency Node agent.");for(let i of e.pkg.parts)if((i===e.part||i.contentType.includes("wordprocessingml")&&i.contentType.endsWith("+xml"))&&i._element.hasAttribute("xmlns:w16du")){let o=false;if(Array.from(i._element.attributes||[]).some(l=>l.name.startsWith("w16du:")&&l.name!=="xmlns:w16du")&&(o=true),!o){let l=I(i._element,"*");for(let u of l)if(u.tagName.startsWith("w16du:")||Array.from(u.attributes||[]).some(a=>a.name.startsWith("w16du:"))){o=true;break}}o||i._element.removeAttribute("xmlns:w16du");}n.warnings.length>0&&(n.status="clean_with_warnings");let s=await e.save();return ef(s),{reportText:n.render(),outBuffer:s}}d(vo,"finalize_document");var Kc=[["creator","author (dc:creator)"],["lastModifiedBy","last modified by (cp:lastModifiedBy)"],["identifier","identifier (dc:identifier)"],["description","description (dc:description)"],["keywords","keywords (cp:keywords)"],["category","category (cp:category)"],["subject","subject (dc:subject)"],["contentStatus","content status (cp:contentStatus)"],["language","language (dc:language)"],["version","version (cp:version)"]];function ef(e){let t=In(new Uint8Array(e)),n=Object.keys(t),r=[];if(n.includes("docProps/custom.xml")&&r.push("docProps/custom.xml (custom document properties) is still in the package"),n.some(s=>s.startsWith("customXml/"))&&r.push("customXml/* parts are still in the package"),n.includes("docProps/core.xml")){let s=Kn(yt(t["docProps/core.xml"]));for(let[i,o]of Kc)for(let l of we(s.documentElement,i))(l.textContent||"").trim()&&r.push(`core property ${o} still contains a value`);}if(r.length>0)throw new Error(`Sanitize integrity check failed \u2014 the saved package still contains metadata this run claims to remove:
|
|
117
117
|
- `+r.join(`
|
|
118
118
|
- `)+`
|
|
119
|
-
Refusing to report a clean document.`)}d(
|
|
119
|
+
Refusing to report a clean document.`)}d(ef,"verifySanitizedPackage");var yo=[{displayName:"Input Binary Property",name:"binaryPropertyName",type:"string",default:"data",required:true,placeholder:"e.g. data",description:"Name of the binary property holding the .docx file (string, e.g. 'data'). In 'From Connected Input' mode this reads from the current item; in 'From Another Node' mode this specifies which property on the source node's output to read. Must be a valid .docx (not .doc, .pdf, or another format).",displayOptions:{show:{resource:["document"],operation:["extractMarkdown"]}}},{displayName:"Clean View",name:"cleanView",type:"boolean",default:false,description:"Whether to project the document as if all pending tracked changes were accepted (simulates Accept All). When false (default), all tracked changes are surfaced inline as CriticMarkup ({++ins++}, {--del--}, {>>comment<<}) so an AI can review and resolve them. Use false to review counterparty edits; use true to generate net-new redlines against a clean baseline.",displayOptions:{show:{resource:["document"],operation:["extractMarkdown"]}}},{displayName:"Page",name:"page",type:"number",default:0,typeOptions:{minValue:0},description:"Optional 1-based page number to return only one page of the projected document (integer, default 0). When 0 (default), the full Markdown body plus the Structural Appendix is returned in the 'markdown' field and pagination metadata is omitted. When >= 1, only that page is returned in the 'markdown' field and the JSON output includes pagination metadata: page, total_pages, has_next, has_prev, tracked_change_count. Pages are ~19,000-character chunks of the projected body with the Structural Appendix appended to each page. Use the extractOutline operation first to discover how many pages exist and what each page contains. If the requested page exceeds total_pages, an error is thrown.",displayOptions:{show:{resource:["document"],operation:["extractMarkdown"]}}}];async function Eo(e){let t=this.getNodeParameter("binaryPropertyName",e),n=this.getNodeParameter("cleanView",e),r=this.getNodeParameter("page",e,0),i=this.getNodeParameter("documentSource",e,"fromInput")==="fromNode"?{mode:"fromNode",sourceNodeName:this.getNodeParameter("sourceNodeName",e,""),binaryPropertyName:t,sourceBinaryId:this.getNodeParameter("sourceBinaryId",e,"")}:{mode:"fromInput",binaryPropertyName:t},{buffer:o,fileName:l}=await Pe.call(this,e,i),u=await _t(o,n);if(!r||r===0)return [{json:{fileName:l,cleanView:n,markdown:u},pairedItem:{item:e}}];let[a,c]=Wt(u),f=Ht(a,c);if(r>f.total_pages)throw new n8nWorkflow.NodeOperationError(this.getNode(),`Requested page ${r} exceeds total_pages (${f.total_pages}). Call extractOutline to discover the page count first.`,{itemIndex:e});let h=f.pages[r-1];return [{json:{fileName:l,cleanView:n,markdown:h.page_content,page:h.page,total_pages:h.total_pages,has_next:h.has_next,has_prev:h.has_prev,tracked_change_count:h.tracked_change_count},pairedItem:{item:e}}]}d(Eo,"executeExtractMarkdown");var bo=[{displayName:"Input Binary Property",name:"binaryPropertyName",type:"string",default:"data",required:true,placeholder:"e.g. data",description:"Name of the binary property holding the .docx file (string, e.g. 'data'). In 'From Connected Input' mode this reads from the current item; in 'From Another Node' mode this specifies which property on the source node's output to read. Must be a valid .docx.",displayOptions:{show:{resource:["document"],operation:["extractOutline"]}}}];async function Do(e){let t=this.getNodeParameter("binaryPropertyName",e),r=this.getNodeParameter("documentSource",e,"fromInput")==="fromNode"?{mode:"fromNode",sourceNodeName:this.getNodeParameter("sourceNodeName",e,""),binaryPropertyName:t,sourceBinaryId:this.getNodeParameter("sourceBinaryId",e,"")}:{mode:"fromInput",binaryPropertyName:t},{buffer:s,fileName:i}=await Pe.call(this,e,r),o=await mt.load(s),l=Yr(o,false,true,true),[u]=Wt(l.text),a=Ht(u,""),c=lo(o,u,a.body_pages,a.body_page_offsets,l.paragraph_offsets);return [{json:{fileName:i,total_pages:a.total_pages,outline:c.map(f=>({level:f.level,text:f.text,page:f.page,style:f.style,has_table:f.has_table,footnote_ids:f.footnote_ids}))},pairedItem:{item:e}}]}d(Do,"executeExtractOutline");var Ao=[{displayName:"Reasoning",name:"reasoning",type:"string",default:"",typeOptions:{rows:2},description:"Why these edits are being made. State your reasoning BEFORE the changes \u2014 what you intend to change and why \u2014 then produce the Changes (JSON) array. This field is captured for auditability and is NOT forwarded into the redline engine; its only purpose is to make the AI reason first, which improves edit quality. Safe to leave empty in deterministic (non-AI) pipelines.",displayOptions:{show:{resource:["document"],operation:["applyEdits"]}}},{displayName:"Input Binary Property",name:"binaryPropertyName",type:"string",default:"data",required:true,placeholder:"e.g. data",description:"Name of the binary property holding the .docx file (string, e.g. 'data'). In 'From Connected Input' mode this reads from the current item; in 'From Another Node' mode this specifies which property on the source node's output to read. The file must be a valid .docx.",displayOptions:{show:{resource:["document"],operation:["applyEdits"]}}},{displayName:"Output Binary Property",name:"outputBinaryPropertyName",type:"string",default:"data",required:true,placeholder:"e.g. data",description:"Name of the binary property on the outgoing item that will hold the redlined .docx file (string, e.g. 'data'). If equal to the input property name, the original binary is overwritten on the outgoing item.",displayOptions:{show:{resource:["document"],operation:["applyEdits"]}}},{displayName:"Author",name:"author",type:"string",default:"Adeu AI",placeholder:"e.g. AI Reviewer",description:"Author name attached to all tracked changes and comments produced by this operation (string, e.g. 'AI Reviewer'). Shows up in Word's review pane as the author of every redline and comment created in this batch.",displayOptions:{show:{resource:["document"],operation:["applyEdits"]}}},{displayName:"Edits Source",name:"editsSource",type:"options",noDataExpression:true,default:"fromInputJson",description:"Where to read the list of DocumentChange objects from. Use 'Define Below' to read the array from the Changes (JSON) field on this node \u2014 this is the typical AI Agent path, since the LLM generates the array as a tool call argument that lands on that field via $fromAI(). Use 'From Input JSON' to read the array from a property on the upstream item's JSON, for deterministic pipelines where a non-AI node (HTTP Request, Code, etc.) has pre-populated it.",options:[{name:"Define Below",value:"defineBelow",description:"Read the array from the Changes (JSON) field on this node. Use for AI Agent workflows \u2014 the LLM populates that field via $fromAI() as a tool call argument."},{name:"From Input JSON",value:"fromInputJson",description:"Read the array from a property on the upstream item's JSON. Use for deterministic pipelines where a non-AI node has pre-populated the changes array."}],displayOptions:{show:{resource:["document"],operation:["applyEdits"]}}},{displayName:"JSON Path on Input Item",name:"editsJsonPath",type:"string",default:"changes",required:true,placeholder:"e.g. data.changes",description:"Property path on the input item JSON whose value is the array of DocumentChange objects (string, dot-notation supported, e.g. 'changes' or 'data.changes'). Must resolve to an array; throws an error otherwise.",displayOptions:{show:{resource:["document"],operation:["applyEdits"],editsSource:["fromInputJson"]}}},{displayName:"Changes (JSON)",name:"editsJson",type:"string",default:`[
|
|
120
120
|
{
|
|
121
121
|
"type": "modify",
|
|
122
122
|
"target_text": "State of New York",
|
|
123
123
|
"new_text": "State of Delaware",
|
|
124
124
|
"comment": "Standardizing governing law."
|
|
125
125
|
}
|
|
126
|
-
]`,required:true,description:`JSON-encoded string containing an array of DocumentChange objects. Each object has a 'type' field discriminator and type-specific fields. type='modify': requires target_text (string, copied EXACTLY from the source including punctuation, spacing, and case) and new_text (string); optional comment (string). Optional match_mode (one of 'strict' | 'first' | 'all', default 'strict'): 'strict' fails on ambiguous matches; 'first' silently anchors to the first occurrence; 'all' applies the same replacement to every occurrence in linear document order. Optional regex (boolean, default false): when true, target_text is interpreted as an ES2022 RegExp pattern and new_text may reference capture groups via $1, $2, etc. Combine with match_mode='all' for global regex replacements. Never include CriticMarkup tags like {++ ++} or {-- --} in new_text \u2014 the engine applies tracking automatically. Never target text already inside another author's pending tracked change. type='accept': requires target_id (string like 'Chg:12' from the Markdown projection); optional comment. type='reject': requires target_id (string like 'Chg:12'); optional comment. type='reply': requires target_id (string like 'Com:45') and text (string). type='insert_row': requires target_text (string anchoring a table cell), position ('above' or 'below'), and cells (array of strings, one per column). type='delete_row': requires target_text (string anchoring the row to delete). The whole batch is validated atomically: if any single edit fails (target text not found, ambiguous match under match_mode='strict', read-only target, overlapping another author's change), the entire batch is rejected and the document is left untouched. Example: '[{"type":"modify","target_text":"within thirty (30) days","new_text":"within forty-five (45) days","comment":"Per playbook.","match_mode":"all"}]'. Markdown code fences (\`\`\`json ... \`\`\`) wrapping the value are stripped automatically.`,typeOptions:{rows:10},displayOptions:{show:{resource:["document"],operation:["applyEdits"],editsSource:["defineBelow"]}}},{displayName:"Return Markdown Output",name:"returnMarkdown",type:"boolean",default:true,description:"Whether to auto-extract the post-edit document as Markdown (with CriticMarkup) and include it in the outgoing JSON under the 'markdown' field. Useful for feeding the updated state back into a downstream AI Agent for review or further edits. Adds extraction overhead per call. Has no effect when Dry Run is enabled \u2014 dry runs do not produce a post-edit buffer; inspect the per-edit 'critic_markup' / 'clean_text' previews on the returned 'edits' array instead.",displayOptions:{show:{resource:["document"],operation:["applyEdits"]}}},{displayName:"Dry Run",name:"dryRun",type:"boolean",default:false,description:"Whether to preview edits without writing them to the document. When true, the engine validates every edit, simulates the application in-memory, and returns a detailed 'edits' report (per-edit status, CriticMarkup context preview, clean text preview, warnings, and errors) \u2014 but the document is NOT modified, no redlined binary is produced, and no static-data stash is written. The incoming binary passes through unchanged on the outgoing item. Use as a self-correction primitive: when an anchor's uniqueness or wording is uncertain, dry-run first, inspect each edit's 'critic_markup' preview, then re-call with Dry Run disabled to commit. Default false (commit edits normally). Important: invalid edits in a dry run do NOT throw a BatchValidationError \u2014 they return as failed entries in the 'edits' array. Wet runs still throw atomically on the first validation failure.",displayOptions:{show:{resource:["document"],operation:["applyEdits"]}}}];async function As(e){let t=this.getNodeParameter("binaryPropertyName",e),n=this.getNodeParameter("outputBinaryPropertyName",e),r=this.getNodeParameter("author",e),o=this.getNodeParameter("editsSource",e),i=this.getNodeParameter("returnMarkdown",e),s=this.getNodeParameter("dryRun",e,false),l=this.getNodeParameter("reasoning",e,""),a;if(o==="fromInputJson"){let A=this.getNodeParameter("editsJsonPath",e),x=this.getInputData()[e].json;if(a=Qr(x,A),a===void 0)throw new Error(`No property "${A}" found on the input item JSON. Verify the upstream node produced it, or switch "Edits Source" to "Define Below".`)}else {let A=this.getNodeParameter("editsJson",e);a=Jr.call(this,A,e,"Changes (JSON)");}if(!Array.isArray(a))throw new Error("Changes must be an array of DocumentChange objects.");let c=this.getNodeParameter("documentSource",e,"fromInput")==="fromNode"?{mode:"fromNode",sourceNodeName:this.getNodeParameter("sourceNodeName",e,""),binaryPropertyName:t,sourceBinaryId:this.getNodeParameter("sourceBinaryId",e,"")}:{mode:"fromInput",binaryPropertyName:t},{buffer:f,fileName:h}=await Pe.call(this,e,c),p=await pt.load(f),m=new Vr(p,r).process_batch(a,s),g=this.getInputData()[e].binary??{};if(s)return [{json:{fileName:h,author:r,dryRun:true,stats:m,...l!==""?{reasoning:l}:{}},binary:g,pairedItem:{item:e}}];let v=await p.save(),E=Cn(h,"redlined"),y=await this.helpers.prepareBinaryData(v,E,at),w=typeof this.isToolExecution=="function"&&this.isToolExecution(),b;if(w&&y.id){let A=this.getWorkflowStaticData("global");A.adeu_last_redlined={id:y.id,fileName:E,mimeType:at,timestamp:Date.now()},b=y.id;}let D;return i&&(D=await mt(v,false)),[{json:{fileName:E,author:r,dryRun:false,stats:m,...l!==""?{reasoning:l}:{},...D!==void 0?{markdown:D}:{},...b!==void 0?{redlinedBinaryId:b}:{}},binary:{...g,[n]:y},pairedItem:{item:e}}]}d(As,"executeApplyEdits");var Ns=[{displayName:"Original Document Source",name:"originalDocumentSource",type:"options",default:"fromInput",description:"Where to read the original (baseline) .docx file from. 'From Connected Input' reads from the current item; 'From Another Node' reads from a named upstream node \u2014 required when this node is called as an AI Agent tool.",options:[{name:"From Connected Input",value:"fromInput"},{name:"From Another Node",value:"fromNode"}],displayOptions:{show:{resource:["document"],operation:["generateDiff"]}}},{displayName:"Original Source Node Name",name:"originalSourceNodeName",type:"string",default:"",required:true,placeholder:"e.g. Download Original",description:"Exact name of the node whose output binary holds the original (baseline) .docx (string, case-sensitive). Must match the node label in the canvas exactly.",displayOptions:{show:{resource:["document"],operation:["generateDiff"],originalDocumentSource:["fromNode"]}}},{displayName:"Original Binary Property",name:"originalBinaryPropertyName",type:"string",default:"data",required:true,placeholder:"e.g. data",description:"Name of the binary property holding the original (baseline) .docx file (string, e.g. 'data'). In 'From Connected Input' mode this reads from the current item; in 'From Another Node' mode this specifies which property on the source node's output to read.",displayOptions:{show:{resource:["document"],operation:["generateDiff"]}}},{displayName:"Modified Document Source",name:"modifiedDocumentSource",type:"options",default:"fromInput",description:"Where to read the modified (compared-to) .docx file from. 'From Connected Input' reads from the current item; 'From Another Node' reads from a named upstream node \u2014 required when this node is called as an AI Agent tool.",options:[{name:"From Connected Input",value:"fromInput"},{name:"From Another Node",value:"fromNode"}],displayOptions:{show:{resource:["document"],operation:["generateDiff"]}}},{displayName:"Modified Source Node Name",name:"modifiedSourceNodeName",type:"string",default:"",required:true,placeholder:"e.g. Apply Edits",description:"Exact name of the node whose output binary holds the modified (compared-to) .docx (string, case-sensitive). Must match the node label in the canvas exactly.",displayOptions:{show:{resource:["document"],operation:["generateDiff"],modifiedDocumentSource:["fromNode"]}}},{displayName:"Modified Binary Property",name:"modifiedBinaryPropertyName",type:"string",default:"data2",required:true,placeholder:"e.g. data2",description:"Name of the binary property holding the modified (compared-to) .docx file (string, e.g. 'data2'). In 'From Connected Input' mode this reads from the current item and must be different from the original property; in 'From Another Node' mode this specifies which property on the source node's output to read.",displayOptions:{show:{resource:["document"],operation:["generateDiff"]}}},{displayName:"Clean View",name:"cleanView",type:"boolean",default:true,description:"Whether to compare the Accept All clean view of both documents. When true (default, recommended), diffs reflect the final content as if all tracked changes were accepted. When false, diffs the raw CriticMarkup-projected text including pending change markers \u2014 useful for auditing tracked-change differences themselves.",displayOptions:{show:{resource:["document"],operation:["generateDiff"]}}}];async function xs(e){let t=this.getNodeParameter("originalBinaryPropertyName",e),n=this.getNodeParameter("modifiedBinaryPropertyName",e),r=this.getNodeParameter("cleanView",e),o=this.getNodeParameter("originalDocumentSource",e,"fromInput"),i=this.getNodeParameter("modifiedDocumentSource",e,"fromInput"),s=o==="fromNode"?{mode:"fromNode",sourceNodeName:this.getNodeParameter("originalSourceNodeName",e,""),binaryPropertyName:t}:{mode:"fromInput",binaryPropertyName:t},l=i==="fromNode"?{mode:"fromNode",sourceNodeName:this.getNodeParameter("modifiedSourceNodeName",e,""),binaryPropertyName:n}:{mode:"fromInput",binaryPropertyName:n},{buffer:a,fileName:u}=await Pe.call(this,e,s),{buffer:c,fileName:f}=await Pe.call(this,e,l),h=await mt(a,r),p=await mt(c,r),_=os(h,p,u,f);return [{json:{originalFileName:u,modifiedFileName:f,cleanView:r,diff:_},pairedItem:{item:e}}]}d(xs,"executeGenerateDiff");var Cs=[{displayName:"Reasoning",name:"reasoning",type:"string",default:"",typeOptions:{rows:2},description:"Why the document is being finalized now \u2014 e.g. what state it's in and why it's ready for distribution. State your reasoning BEFORE choosing the sanitize mode and options. This field is captured for auditability and is NOT forwarded into the finalize engine; its only purpose is to make the AI reason first. Safe to leave empty in deterministic (non-AI) pipelines.",displayOptions:{show:{resource:["document"],operation:["finalizeDocument"]}}},{displayName:"Input Binary Property",name:"binaryPropertyName",type:"string",default:"data",required:true,placeholder:"e.g. data",description:"Name of the binary property holding the .docx file (string, e.g. 'data'). In 'From Connected Input' mode this reads from the current item; in 'From Another Node' mode this specifies which property on the source node's output to read. The file must be a valid .docx.",displayOptions:{show:{resource:["document"],operation:["finalizeDocument"]}}},{displayName:"Output Binary Property",name:"outputBinaryPropertyName",type:"string",default:"data",required:true,placeholder:"e.g. data",description:"Name of the binary property on the outgoing item that will hold the finalized .docx file (string, e.g. 'data'). If equal to the input property name, the original binary is overwritten on the outgoing item.",displayOptions:{show:{resource:["document"],operation:["finalizeDocument"]}}},{displayName:"Sanitize Mode",name:"sanitizeMode",type:"options",default:"full",description:"How aggressively to sanitize the document before distribution. One of: 'baseline' (minimal metadata cleanup only), 'full' (strip metadata AND require all tracked changes resolved or auto-accepted), 'keep-markup' (strip metadata but preserve visible tracked changes and comments, optionally with author rewrite).",options:[{name:"Baseline",value:"baseline",description:"Minimal sanitization: strip RSID attributes, paragraph IDs, and proof errors only. Leaves tracked changes, comments, authors, and other metadata untouched."},{name:"Full",value:"full",description:"Strip metadata (authors, RSIDs, paragraph IDs, proof errors) and require all tracked changes and comments to be resolved. If pending tracked changes exist and 'Accept All Tracked Changes' is false, the operation is blocked and an error is thrown."},{name:"Keep Markup",value:"keep-markup",description:"Strip metadata but preserve all visible tracked changes and comments. Use 'Author Override' to rewrite the author name on every preserved redline and comment (e.g. replace 'AI Reviewer' with your firm name)."}],displayOptions:{show:{resource:["document"],operation:["finalizeDocument"]}}},{displayName:"Accept All Tracked Changes",name:"acceptAll",type:"boolean",default:false,description:"Whether to auto-accept all pending tracked changes before sanitization. Only applies when Sanitize Mode is 'full'. When false (default), the operation throws an error if any pending tracked changes exist, forcing the caller to resolve them first. If multiple distinct authors are detected in pending changes, a warning is included in the report to alert you of potential silent smuggles.",displayOptions:{show:{resource:["document"],operation:["finalizeDocument"],sanitizeMode:["full"]}}},{displayName:"Author Override",name:"authorOverride",type:"string",default:"",placeholder:"e.g. My Firm",description:"Only applies when Sanitize Mode is 'keep-markup'. Optional string. When set, replaces the author name on every preserved tracked change and comment with this value (e.g. 'My Law Firm'). Leave empty to keep original authors intact.",displayOptions:{show:{resource:["document"],operation:["finalizeDocument"],sanitizeMode:["keep-markup"]}}},{displayName:"Protection Mode",name:"protectionMode",type:"options",default:"none",description:"Optionally lock the finalized document. 'none' (default) leaves the document unlocked. 'read_only' injects a native Word read-only enforcement flag into settings.xml \u2014 Word users see a read-only banner and cannot edit without explicitly unlocking. AES encryption is not supported in this engine.",options:[{name:"None",value:"none"},{name:"Read Only",value:"read_only"}],displayOptions:{show:{resource:["document"],operation:["finalizeDocument"]}}}];async function Ts(e){let t=this.getNodeParameter("binaryPropertyName",e),n=this.getNodeParameter("outputBinaryPropertyName",e),r=this.getNodeParameter("sanitizeMode",e),o=false;r==="full"&&(o=this.getNodeParameter("acceptAll",e));let i=null;if(r==="keep-markup"){let y=this.getNodeParameter("authorOverride",e);i=y.trim()===""?null:y;}let l=this.getNodeParameter("protectionMode",e)==="read_only"?"read_only":null,a=this.getNodeParameter("reasoning",e,""),c=this.getNodeParameter("documentSource",e,"fromInput")==="fromNode"?{mode:"fromNode",sourceNodeName:this.getNodeParameter("sourceNodeName",e,""),binaryPropertyName:t,sourceBinaryId:this.getNodeParameter("sourceBinaryId",e,"")}:{mode:"fromInput",binaryPropertyName:t},{buffer:f,fileName:h}=await Pe.call(this,e,c),p=await pt.load(f),{reportText:_,outBuffer:m}=await ws(p,{filename:h,sanitize_mode:r,accept_all:o,protection_mode:l,author:i});if(!m)throw new Error(_);let g=Cn(h,"finalized"),v=await this.helpers.prepareBinaryData(m,g,at),E=this.getInputData()[e].binary??{};return [{json:{fileName:g,sanitizeMode:r,report:_,...a!==""?{reasoning:a}:{}},binary:{...E,[n]:v},pairedItem:{item:e}}]}d(Ts,"executeFinalizeDocument");var ks=[{displayName:"Operation",name:"operation",type:"options",noDataExpression:true,displayOptions:{show:{resource:["document"]}},options:[{name:"Apply Edits",value:"applyEdits",action:"Apply tracked changes to document",description:"Apply a JSON array of DocumentChange objects (modify, accept, reject, reply, insert_row, delete_row) as native Word tracked changes and comments. modify edits support match_mode ('strict'|'first'|'all') and regex (boolean) for targeted multi-occurrence writes. The whole batch is pre-validated atomically: if any single edit is invalid, the entire batch is rejected and the document is left untouched. Supports a Dry Run mode for previewing edits \u2014 when enabled, the engine returns a per-edit report (status, CriticMarkup preview, errors, warnings) without modifying the document or producing a redlined binary."},{name:"Extract Markdown",value:"extractMarkdown",action:"Extract markdown from document",description:"Project the .docx into LLM-friendly Markdown with CriticMarkup ({++ins++}, {--del--}, {>>comment<<}) plus a Semantic Appendix listing defined terms, cross-references, and potential typos. Each tracked change is tagged with a stable id (Chg:N, Com:N) for use in Apply Edits. Supports an optional Page parameter to fetch only one page of a large document (paired with Extract Outline for navigation)."},{name:"Extract Outline",value:"extractOutline",action:"Extract a structural outline (table of contents) of the document",description:"Return a token-cheap structural map of the .docx: a JSON array of headings with their level (1-6), text, page number, paragraph style, whether the section directly contains a table, and any footnote/endnote IDs scoped to that section. Also returns total_pages. Use this as a navigation primitive for large documents \u2014 call it first to discover structure, then call Extract Markdown with a specific Page to drill into the relevant section."},{name:"Finalize",value:"finalizeDocument",action:"Sanitize metadata and lock the document for distribution",description:"Strip author names, internal IDs, RSIDs, and proof errors; optionally auto-accept all pending tracked changes; optionally lock the document read-only. Use before sending to counterparties or signers."},{name:"Generate Diff",value:"generateDiff",action:"Generate diff between documents",description:"Produce a sub-word level @@ Word Patch @@ diff between two .docx files. Reads the document text via the same Markdown projection used by Extract Markdown, so the diff respects CriticMarkup and Clean View settings."},{name:"Hydrate Tool Output",value:"hydrateToolOutput",action:"Hydrate a redlined binary stashed by Apply Edits as a tool",description:"Read a binary's storage id from workflow static data (where Apply Edits stashes it when run as an AI Agent tool) and re-attach the binary to a main-flow item. Necessary because n8n's AI Agent tool wrapper strips binaries from tool outputs, so the redlined .docx produced by an apply_edits tool call cannot reach downstream nodes directly. Place this node downstream of the AI Agent on the main connection, then route its output into Write Binary File, Gmail (attachment), Slack (file upload), etc."}],default:"extractMarkdown"},{displayName:"Document Source",name:"documentSource",type:"options",default:"fromInput",description:"Where to read the .docx file from. 'From Connected Input' reads the binary on the current input item \u2014 use this in deterministic pipelines (e.g. Gmail Trigger \u2192 Adeu \u2192 Gmail Reply). 'From Another Node' fetches the binary from a named upstream node by name \u2014 use this when the Adeu node is called as an AI Agent tool, since the Agent cannot pass binary data through JSON arguments.",options:[{name:"From Connected Input",value:"fromInput",description:"Read the binary from the current item's binary attachment. Default behavior for deterministic workflows."},{name:"From Another Node",value:"fromNode",description:"Read the binary from a named upstream node. Required when this node is used as an AI Agent tool."}],displayOptions:{show:{resource:["document"],operation:["applyEdits","extractMarkdown","extractOutline","finalizeDocument"]}}},{displayName:"Source Node Name",name:"sourceNodeName",type:"string",default:"",required:true,placeholder:"e.g. Gmail Trigger",description:"Exact name of the node in this workflow whose output binary holds the .docx file (string, case-sensitive). Must match the node's label in the canvas exactly, including spaces and punctuation. The referenced node must have already executed in this run and produced binary output on the property named in 'Input Binary Property'.",displayOptions:{show:{resource:["document"],operation:["applyEdits","extractMarkdown","extractOutline","finalizeDocument"],documentSource:["fromNode"]}}},{displayName:"Source Binary ID",name:"sourceBinaryId",type:"string",default:"",placeholder:"e.g. filesystem-v2:...",description:"Optional. When set (such as by an AI Agent during a multi-turn conversation), the node will load the document directly from this binary storage ID instead of reading from the source node. Leave empty on the first call to default to the baseline source node.",displayOptions:{show:{resource:["document"],operation:["applyEdits","extractMarkdown","extractOutline","finalizeDocument"],documentSource:["fromNode"]}}},...vs,...Es,...Ds,...Ns,...Cs,...ei];var Is=class{static{d(this,"Adeu");}description={displayName:"Adeu",name:"adeu",icon:"file:adeu.svg",group:["transform"],version:1,subtitle:'={{$parameter["operation"]}}',description:"Operate on Microsoft Word (.docx) files: extract LLM-friendly Markdown with CriticMarkup, navigate large documents via a structural outline, apply tracked changes and comments, generate sub-word diffs, and sanitize/finalize documents. Five operations on the Document resource: (1) Extract Markdown \u2014 project a .docx into Markdown plus a Semantic Appendix; toggle Clean View to simulate Accept All; pass an optional Page number to fetch only one page of a large document. (2) Extract Outline \u2014 return a token-cheap structural map (headings with level, page number, paragraph style, has_table, footnote IDs) plus total_pages. Pair with Extract Markdown to navigate large documents. (3) Apply Edits \u2014 apply a JSON array of DocumentChange objects as native Word tracked changes; modify edits support match_mode ('strict'|'first'|'all') and regex (boolean); the entire batch is pre-validated atomically and rejected if any single edit is invalid. Supports a Dry Run flag that previews edits without committing them. (4) Generate Diff \u2014 produce a @@ Word Patch @@ sub-word level diff between two .docx files. (5) Finalize Document \u2014 strip metadata, optionally accept all pending markup, and optionally lock the file read-only. DocumentChange schema (used by Apply Edits): each object has a 'type' field discriminator. type='modify' requires target_text (string, copied EXACTLY from the source including punctuation, spacing, and case) and new_text (string); optional comment (string); optional match_mode ('strict'|'first'|'all', default 'strict'); optional regex (boolean, default false \u2014 when true, target_text is an ES2022 RegExp pattern and new_text may reference $1, $2 capture groups). type='accept' or type='reject' requires target_id (string like 'Chg:12' from the Markdown projection); optional 'comment'. type='reply' requires target_id (string like 'Com:45') and text (string). type='insert_row' requires target_text (string), position ('above' or 'below'), and cells (array of strings). type='delete_row' requires target_text (string). Never wrap new_text in CriticMarkup tags like {++ ++} or {-- --}; the engine applies tracking automatically. Never target text already wrapped in another author's pending tracked change; accept or reject their change first by target_id. Binary handling for AI Agents: this tool cannot receive .docx files through JSON arguments because JSON cannot carry binary data. To process a document, set 'Document Source' to 'From Another Node' and 'Source Node Name' to the exact name of the workflow node that produced the .docx binary (typically the trigger node, e.g. 'Gmail Trigger', 'When clicking Test workflow', or an HTTP Request node configured to download a file). Node names are case-sensitive and must match the canvas label exactly. For the Generate Diff operation, set both 'Original Source Node Name' and 'Modified Source Node Name' independently.",defaults:{name:"Adeu"},usableAsTool:true,inputs:[n8nWorkflow.NodeConnectionTypes.Main],outputs:[n8nWorkflow.NodeConnectionTypes.Main],credentials:[],properties:[{displayName:"Resource",name:"resource",type:"options",noDataExpression:true,options:[{name:"Document",value:"document"}],default:"document"},...ks]};async execute(){let t=this.getInputData(),n=[],r=this.getNodeParameter("resource",0),o=this.getNodeParameter("operation",0);for(let i=0;i<t.length;i++)try{let s;if(r==="document")switch(o){case "extractMarkdown":s=await ys.call(this,i);break;case "extractOutline":s=await bs.call(this,i);break;case "applyEdits":s=await As.call(this,i);break;case "generateDiff":s=await xs.call(this,i);break;case "finalizeDocument":s=await Ts.call(this,i);break;case "hydrateToolOutput":s=await ti.call(this,i);break;default:throw new Error(`Unsupported operation: ${o}`)}else throw new Error(`Unsupported resource: ${r}`);n.push(...s);}catch(s){if(this.continueOnFail()){n.push({json:{error:s.message},pairedItem:{item:i}});continue}let l=s;throw l.name==="NodeOperationError"||l.name==="NodeApiError"?l:Zr.call(this,l,i)}return [n]}};exports.Adeu=Is;
|
|
126
|
+
]`,required:true,description:`JSON-encoded string containing an array of DocumentChange objects. Each object has a 'type' field discriminator and type-specific fields. type='modify': requires target_text (string, copied EXACTLY from the source including punctuation, spacing, and case) and new_text (string); optional comment (string). Optional match_mode (one of 'strict' | 'first' | 'all', default 'strict'): 'strict' fails on ambiguous matches; 'first' silently anchors to the first occurrence; 'all' applies the same replacement to every occurrence in linear document order. Optional regex (boolean, default false): when true, target_text is interpreted as an ES2022 RegExp pattern and new_text may reference capture groups via $1, $2, etc. Combine with match_mode='all' for global regex replacements. Never include CriticMarkup tags like {++ ++} or {-- --} in new_text \u2014 the engine applies tracking automatically. Never target text already inside another author's pending tracked change. type='accept': requires target_id (string like 'Chg:12' from the Markdown projection); optional comment. type='reject': requires target_id (string like 'Chg:12'); optional comment. type='reply': requires target_id (string like 'Com:45') and text (string). type='insert_row': requires target_text (string anchoring a table cell), position ('above' or 'below'), and cells (array of strings, one per column). type='delete_row': requires target_text (string anchoring the row to delete). The whole batch is validated atomically: if any single edit fails (target text not found, ambiguous match under match_mode='strict', read-only target, overlapping another author's change), the entire batch is rejected and the document is left untouched. Example: '[{"type":"modify","target_text":"within thirty (30) days","new_text":"within forty-five (45) days","comment":"Per playbook.","match_mode":"all"}]'. Markdown code fences (\`\`\`json ... \`\`\`) wrapping the value are stripped automatically.`,typeOptions:{rows:10},displayOptions:{show:{resource:["document"],operation:["applyEdits"],editsSource:["defineBelow"]}}},{displayName:"Return Markdown Output",name:"returnMarkdown",type:"boolean",default:true,description:"Whether to auto-extract the post-edit document as Markdown (with CriticMarkup) and include it in the outgoing JSON under the 'markdown' field. Useful for feeding the updated state back into a downstream AI Agent for review or further edits. Adds extraction overhead per call. Has no effect when Dry Run is enabled \u2014 dry runs do not produce a post-edit buffer; inspect the per-edit 'critic_markup' / 'clean_text' previews on the returned 'edits' array instead.",displayOptions:{show:{resource:["document"],operation:["applyEdits"]}}},{displayName:"Dry Run",name:"dryRun",type:"boolean",default:false,description:"Whether to preview edits without writing them to the document. When true, the engine validates every edit, simulates the application in-memory, and returns a detailed 'edits' report (per-edit status, CriticMarkup context preview, clean text preview, warnings, and errors) \u2014 but the document is NOT modified, no redlined binary is produced, and no static-data stash is written. The incoming binary passes through unchanged on the outgoing item. Use as a self-correction primitive: when an anchor's uniqueness or wording is uncertain, dry-run first, inspect each edit's 'critic_markup' preview, then re-call with Dry Run disabled to commit. Default false (commit edits normally). Important: invalid edits in a dry run do NOT throw a BatchValidationError \u2014 they return as failed entries in the 'edits' array. Wet runs still throw atomically on the first validation failure.",displayOptions:{show:{resource:["document"],operation:["applyEdits"]}}}];async function No(e){let t=this.getNodeParameter("binaryPropertyName",e),n=this.getNodeParameter("outputBinaryPropertyName",e),r=this.getNodeParameter("author",e),s=this.getNodeParameter("editsSource",e),i=this.getNodeParameter("returnMarkdown",e),o=this.getNodeParameter("dryRun",e,false),l=this.getNodeParameter("reasoning",e,""),u;if(s==="fromInputJson"){let A=this.getNodeParameter("editsJsonPath",e),N=this.getInputData()[e].json;if(u=Qr(N,A),u===void 0)throw new Error(`No property "${A}" found on the input item JSON. Verify the upstream node produced it, or switch "Edits Source" to "Define Below".`)}else {let A=this.getNodeParameter("editsJson",e);u=Jr.call(this,A,e,"Changes (JSON)");}if(!Array.isArray(u))throw new Error("Changes must be an array of DocumentChange objects.");let c=this.getNodeParameter("documentSource",e,"fromInput")==="fromNode"?{mode:"fromNode",sourceNodeName:this.getNodeParameter("sourceNodeName",e,""),binaryPropertyName:t,sourceBinaryId:this.getNodeParameter("sourceBinaryId",e,"")}:{mode:"fromInput",binaryPropertyName:t},{buffer:f,fileName:h}=await Pe.call(this,e,c),p=await mt.load(f),m=new Vr(p,r).process_batch(u,o),g=this.getInputData()[e].binary??{};if(o)return [{json:{fileName:h,author:r,dryRun:true,stats:m,...l!==""?{reasoning:l}:{}},binary:g,pairedItem:{item:e}}];let v=await p.save(),D=Cn(h,"redlined"),y=await this.helpers.prepareBinaryData(v,D,ut),w=typeof this.isToolExecution=="function"&&this.isToolExecution(),E;if(w&&y.id){let A=this.getWorkflowStaticData("global");A.adeu_last_redlined={id:y.id,fileName:D,mimeType:ut,timestamp:Date.now()},E=y.id;}let b;return i&&(b=await _t(v,false)),[{json:{fileName:D,author:r,dryRun:false,stats:m,...l!==""?{reasoning:l}:{},...b!==void 0?{markdown:b}:{},...E!==void 0?{redlinedBinaryId:E}:{}},binary:{...g,[n]:y},pairedItem:{item:e}}]}d(No,"executeApplyEdits");var xo=[{displayName:"Original Document Source",name:"originalDocumentSource",type:"options",default:"fromInput",description:"Where to read the original (baseline) .docx file from. 'From Connected Input' reads from the current item; 'From Another Node' reads from a named upstream node \u2014 required when this node is called as an AI Agent tool.",options:[{name:"From Connected Input",value:"fromInput"},{name:"From Another Node",value:"fromNode"}],displayOptions:{show:{resource:["document"],operation:["generateDiff"]}}},{displayName:"Original Source Node Name",name:"originalSourceNodeName",type:"string",default:"",required:true,placeholder:"e.g. Download Original",description:"Exact name of the node whose output binary holds the original (baseline) .docx (string, case-sensitive). Must match the node label in the canvas exactly.",displayOptions:{show:{resource:["document"],operation:["generateDiff"],originalDocumentSource:["fromNode"]}}},{displayName:"Original Binary Property",name:"originalBinaryPropertyName",type:"string",default:"data",required:true,placeholder:"e.g. data",description:"Name of the binary property holding the original (baseline) .docx file (string, e.g. 'data'). In 'From Connected Input' mode this reads from the current item; in 'From Another Node' mode this specifies which property on the source node's output to read.",displayOptions:{show:{resource:["document"],operation:["generateDiff"]}}},{displayName:"Modified Document Source",name:"modifiedDocumentSource",type:"options",default:"fromInput",description:"Where to read the modified (compared-to) .docx file from. 'From Connected Input' reads from the current item; 'From Another Node' reads from a named upstream node \u2014 required when this node is called as an AI Agent tool.",options:[{name:"From Connected Input",value:"fromInput"},{name:"From Another Node",value:"fromNode"}],displayOptions:{show:{resource:["document"],operation:["generateDiff"]}}},{displayName:"Modified Source Node Name",name:"modifiedSourceNodeName",type:"string",default:"",required:true,placeholder:"e.g. Apply Edits",description:"Exact name of the node whose output binary holds the modified (compared-to) .docx (string, case-sensitive). Must match the node label in the canvas exactly.",displayOptions:{show:{resource:["document"],operation:["generateDiff"],modifiedDocumentSource:["fromNode"]}}},{displayName:"Modified Binary Property",name:"modifiedBinaryPropertyName",type:"string",default:"data2",required:true,placeholder:"e.g. data2",description:"Name of the binary property holding the modified (compared-to) .docx file (string, e.g. 'data2'). In 'From Connected Input' mode this reads from the current item and must be different from the original property; in 'From Another Node' mode this specifies which property on the source node's output to read.",displayOptions:{show:{resource:["document"],operation:["generateDiff"]}}},{displayName:"Clean View",name:"cleanView",type:"boolean",default:true,description:"Whether to compare the Accept All clean view of both documents. When true (default, recommended), diffs reflect the final content as if all tracked changes were accepted. When false, diffs the raw CriticMarkup-projected text including pending change markers \u2014 useful for auditing tracked-change differences themselves.",displayOptions:{show:{resource:["document"],operation:["generateDiff"]}}}];async function Co(e){let t=this.getNodeParameter("originalBinaryPropertyName",e),n=this.getNodeParameter("modifiedBinaryPropertyName",e),r=this.getNodeParameter("cleanView",e),s=this.getNodeParameter("originalDocumentSource",e,"fromInput"),i=this.getNodeParameter("modifiedDocumentSource",e,"fromInput"),o=s==="fromNode"?{mode:"fromNode",sourceNodeName:this.getNodeParameter("originalSourceNodeName",e,""),binaryPropertyName:t}:{mode:"fromInput",binaryPropertyName:t},l=i==="fromNode"?{mode:"fromNode",sourceNodeName:this.getNodeParameter("modifiedSourceNodeName",e,""),binaryPropertyName:n}:{mode:"fromInput",binaryPropertyName:n},{buffer:u,fileName:a}=await Pe.call(this,e,o),{buffer:c,fileName:f}=await Pe.call(this,e,l),h=await _t(u,r),p=await _t(c,r),_=so(h,p,a,f);return [{json:{originalFileName:a,modifiedFileName:f,cleanView:r,diff:_},pairedItem:{item:e}}]}d(Co,"executeGenerateDiff");var To=[{displayName:"Reasoning",name:"reasoning",type:"string",default:"",typeOptions:{rows:2},description:"Why the document is being finalized now \u2014 e.g. what state it's in and why it's ready for distribution. State your reasoning BEFORE choosing the sanitize mode and options. This field is captured for auditability and is NOT forwarded into the finalize engine; its only purpose is to make the AI reason first. Safe to leave empty in deterministic (non-AI) pipelines.",displayOptions:{show:{resource:["document"],operation:["finalizeDocument"]}}},{displayName:"Input Binary Property",name:"binaryPropertyName",type:"string",default:"data",required:true,placeholder:"e.g. data",description:"Name of the binary property holding the .docx file (string, e.g. 'data'). In 'From Connected Input' mode this reads from the current item; in 'From Another Node' mode this specifies which property on the source node's output to read. The file must be a valid .docx.",displayOptions:{show:{resource:["document"],operation:["finalizeDocument"]}}},{displayName:"Output Binary Property",name:"outputBinaryPropertyName",type:"string",default:"data",required:true,placeholder:"e.g. data",description:"Name of the binary property on the outgoing item that will hold the finalized .docx file (string, e.g. 'data'). If equal to the input property name, the original binary is overwritten on the outgoing item.",displayOptions:{show:{resource:["document"],operation:["finalizeDocument"]}}},{displayName:"Sanitize Mode",name:"sanitizeMode",type:"options",default:"full",description:"How aggressively to sanitize the document before distribution. One of: 'baseline' (minimal metadata cleanup only), 'full' (strip metadata AND require all tracked changes resolved or auto-accepted), 'keep-markup' (strip metadata but preserve visible tracked changes and comments, optionally with author rewrite).",options:[{name:"Baseline",value:"baseline",description:"Minimal sanitization: strip RSID attributes, paragraph IDs, and proof errors only. Leaves tracked changes, comments, authors, and other metadata untouched."},{name:"Full",value:"full",description:"Strip metadata (authors, RSIDs, paragraph IDs, proof errors) and require all tracked changes and comments to be resolved. If pending tracked changes exist and 'Accept All Tracked Changes' is false, the operation is blocked and an error is thrown."},{name:"Keep Markup",value:"keep-markup",description:"Strip metadata but preserve all visible tracked changes and comments. Use 'Author Override' to rewrite the author name on every preserved redline and comment (e.g. replace 'AI Reviewer' with your firm name)."}],displayOptions:{show:{resource:["document"],operation:["finalizeDocument"]}}},{displayName:"Accept All Tracked Changes",name:"acceptAll",type:"boolean",default:false,description:"Whether to auto-accept all pending tracked changes before sanitization. Only applies when Sanitize Mode is 'full'. When false (default), the operation throws an error if any pending tracked changes exist, forcing the caller to resolve them first. If multiple distinct authors are detected in pending changes, a warning is included in the report to alert you of potential silent smuggles.",displayOptions:{show:{resource:["document"],operation:["finalizeDocument"],sanitizeMode:["full"]}}},{displayName:"Author Override",name:"authorOverride",type:"string",default:"",placeholder:"e.g. My Firm",description:"Only applies when Sanitize Mode is 'keep-markup'. Optional string. When set, replaces the author name on every preserved tracked change and comment with this value (e.g. 'My Law Firm'). Leave empty to keep original authors intact.",displayOptions:{show:{resource:["document"],operation:["finalizeDocument"],sanitizeMode:["keep-markup"]}}},{displayName:"Protection Mode",name:"protectionMode",type:"options",default:"none",description:"Optionally lock the finalized document. 'none' (default) leaves the document unlocked. 'read_only' injects a native Word read-only enforcement flag into settings.xml \u2014 Word users see a read-only banner and cannot edit without explicitly unlocking. AES encryption is not supported in this engine.",options:[{name:"None",value:"none"},{name:"Read Only",value:"read_only"}],displayOptions:{show:{resource:["document"],operation:["finalizeDocument"]}}}];async function ko(e){let t=this.getNodeParameter("binaryPropertyName",e),n=this.getNodeParameter("outputBinaryPropertyName",e),r=this.getNodeParameter("sanitizeMode",e),s=false;r==="full"&&(s=this.getNodeParameter("acceptAll",e));let i=null;if(r==="keep-markup"){let y=this.getNodeParameter("authorOverride",e);i=y.trim()===""?null:y;}let l=this.getNodeParameter("protectionMode",e)==="read_only"?"read_only":null,u=this.getNodeParameter("reasoning",e,""),c=this.getNodeParameter("documentSource",e,"fromInput")==="fromNode"?{mode:"fromNode",sourceNodeName:this.getNodeParameter("sourceNodeName",e,""),binaryPropertyName:t,sourceBinaryId:this.getNodeParameter("sourceBinaryId",e,"")}:{mode:"fromInput",binaryPropertyName:t},{buffer:f,fileName:h}=await Pe.call(this,e,c),p=await mt.load(f),{reportText:_,outBuffer:m}=await vo(p,{filename:h,sanitize_mode:r,accept_all:s,protection_mode:l,author:i});if(!m)throw new Error(_);let g=Cn(h,"finalized"),v=await this.helpers.prepareBinaryData(m,g,ut),D=this.getInputData()[e].binary??{};return [{json:{fileName:g,sanitizeMode:r,report:_,...u!==""?{reasoning:u}:{}},binary:{...D,[n]:v},pairedItem:{item:e}}]}d(ko,"executeFinalizeDocument");var So=[{displayName:"Operation",name:"operation",type:"options",noDataExpression:true,displayOptions:{show:{resource:["document"]}},options:[{name:"Apply Edits",value:"applyEdits",action:"Apply tracked changes to document",description:"Apply a JSON array of DocumentChange objects (modify, accept, reject, reply, insert_row, delete_row) as native Word tracked changes and comments. modify edits support match_mode ('strict'|'first'|'all') and regex (boolean) for targeted multi-occurrence writes. The whole batch is pre-validated atomically: if any single edit is invalid, the entire batch is rejected and the document is left untouched. Supports a Dry Run mode for previewing edits \u2014 when enabled, the engine returns a per-edit report (status, CriticMarkup preview, errors, warnings) without modifying the document or producing a redlined binary."},{name:"Extract Markdown",value:"extractMarkdown",action:"Extract markdown from document",description:"Project the .docx into LLM-friendly Markdown with CriticMarkup ({++ins++}, {--del--}, {>>comment<<}) plus a Semantic Appendix listing defined terms, cross-references, and potential typos. Each tracked change is tagged with a stable id (Chg:N, Com:N) for use in Apply Edits. Supports an optional Page parameter to fetch only one page of a large document (paired with Extract Outline for navigation)."},{name:"Extract Outline",value:"extractOutline",action:"Extract a structural outline (table of contents) of the document",description:"Return a token-cheap structural map of the .docx: a JSON array of headings with their level (1-6), text, page number, paragraph style, whether the section directly contains a table, and any footnote/endnote IDs scoped to that section. Also returns total_pages. Use this as a navigation primitive for large documents \u2014 call it first to discover structure, then call Extract Markdown with a specific Page to drill into the relevant section."},{name:"Finalize",value:"finalizeDocument",action:"Sanitize metadata and lock the document for distribution",description:"Strip author names, internal IDs, RSIDs, and proof errors; optionally auto-accept all pending tracked changes; optionally lock the document read-only. Use before sending to counterparties or signers."},{name:"Generate Diff",value:"generateDiff",action:"Generate diff between documents",description:"Produce a sub-word level @@ Word Patch @@ diff between two .docx files. Reads the document text via the same Markdown projection used by Extract Markdown, so the diff respects CriticMarkup and Clean View settings."},{name:"Hydrate Tool Output",value:"hydrateToolOutput",action:"Hydrate a redlined binary stashed by Apply Edits as a tool",description:"Read a binary's storage id from workflow static data (where Apply Edits stashes it when run as an AI Agent tool) and re-attach the binary to a main-flow item. Necessary because n8n's AI Agent tool wrapper strips binaries from tool outputs, so the redlined .docx produced by an apply_edits tool call cannot reach downstream nodes directly. Place this node downstream of the AI Agent on the main connection, then route its output into Write Binary File, Gmail (attachment), Slack (file upload), etc."}],default:"extractMarkdown"},{displayName:"Document Source",name:"documentSource",type:"options",default:"fromInput",description:"Where to read the .docx file from. 'From Connected Input' reads the binary on the current input item \u2014 use this in deterministic pipelines (e.g. Gmail Trigger \u2192 Adeu \u2192 Gmail Reply). 'From Another Node' fetches the binary from a named upstream node by name \u2014 use this when the Adeu node is called as an AI Agent tool, since the Agent cannot pass binary data through JSON arguments.",options:[{name:"From Connected Input",value:"fromInput",description:"Read the binary from the current item's binary attachment. Default behavior for deterministic workflows."},{name:"From Another Node",value:"fromNode",description:"Read the binary from a named upstream node. Required when this node is used as an AI Agent tool."}],displayOptions:{show:{resource:["document"],operation:["applyEdits","extractMarkdown","extractOutline","finalizeDocument"]}}},{displayName:"Source Node Name",name:"sourceNodeName",type:"string",default:"",required:true,placeholder:"e.g. Gmail Trigger",description:"Exact name of the node in this workflow whose output binary holds the .docx file (string, case-sensitive). Must match the node's label in the canvas exactly, including spaces and punctuation. The referenced node must have already executed in this run and produced binary output on the property named in 'Input Binary Property'.",displayOptions:{show:{resource:["document"],operation:["applyEdits","extractMarkdown","extractOutline","finalizeDocument"],documentSource:["fromNode"]}}},{displayName:"Source Binary ID",name:"sourceBinaryId",type:"string",default:"",placeholder:"e.g. filesystem-v2:...",description:"Optional. When set (such as by an AI Agent during a multi-turn conversation), the node will load the document directly from this binary storage ID instead of reading from the source node. Leave empty on the first call to default to the baseline source node.",displayOptions:{show:{resource:["document"],operation:["applyEdits","extractMarkdown","extractOutline","finalizeDocument"],documentSource:["fromNode"]}}},...yo,...bo,...Ao,...xo,...To,...ei];var Oo=class{static{d(this,"Adeu");}description={displayName:"Adeu",name:"adeu",icon:"file:adeu.svg",group:["transform"],version:1,subtitle:'={{$parameter["operation"]}}',description:"Operate on Microsoft Word (.docx) files: extract LLM-friendly Markdown with CriticMarkup, navigate large documents via a structural outline, apply tracked changes and comments, generate sub-word diffs, and sanitize/finalize documents. Five operations on the Document resource: (1) Extract Markdown \u2014 project a .docx into Markdown plus a Semantic Appendix; toggle Clean View to simulate Accept All; pass an optional Page number to fetch only one page of a large document. (2) Extract Outline \u2014 return a token-cheap structural map (headings with level, page number, paragraph style, has_table, footnote IDs) plus total_pages. Pair with Extract Markdown to navigate large documents. (3) Apply Edits \u2014 apply a JSON array of DocumentChange objects as native Word tracked changes; modify edits support match_mode ('strict'|'first'|'all') and regex (boolean); the entire batch is pre-validated atomically and rejected if any single edit is invalid. Supports a Dry Run flag that previews edits without committing them. (4) Generate Diff \u2014 produce a @@ Word Patch @@ sub-word level diff between two .docx files. (5) Finalize Document \u2014 strip metadata, optionally accept all pending markup, and optionally lock the file read-only. DocumentChange schema (used by Apply Edits): each object has a 'type' field discriminator. type='modify' requires target_text (string, copied EXACTLY from the source including punctuation, spacing, and case) and new_text (string); optional comment (string); optional match_mode ('strict'|'first'|'all', default 'strict'); optional regex (boolean, default false \u2014 when true, target_text is an ES2022 RegExp pattern and new_text may reference $1, $2 capture groups). type='accept' or type='reject' requires target_id (string like 'Chg:12' from the Markdown projection); optional 'comment'. type='reply' requires target_id (string like 'Com:45') and text (string). type='insert_row' requires target_text (string), position ('above' or 'below'), and cells (array of strings). type='delete_row' requires target_text (string). Never wrap new_text in CriticMarkup tags like {++ ++} or {-- --}; the engine applies tracking automatically. Never target text already wrapped in another author's pending tracked change; accept or reject their change first by target_id. Binary handling for AI Agents: this tool cannot receive .docx files through JSON arguments because JSON cannot carry binary data. To process a document, set 'Document Source' to 'From Another Node' and 'Source Node Name' to the exact name of the workflow node that produced the .docx binary (typically the trigger node, e.g. 'Gmail Trigger', 'When clicking Test workflow', or an HTTP Request node configured to download a file). Node names are case-sensitive and must match the canvas label exactly. For the Generate Diff operation, set both 'Original Source Node Name' and 'Modified Source Node Name' independently.",defaults:{name:"Adeu"},usableAsTool:true,inputs:[n8nWorkflow.NodeConnectionTypes.Main],outputs:[n8nWorkflow.NodeConnectionTypes.Main],credentials:[],properties:[{displayName:"Resource",name:"resource",type:"options",noDataExpression:true,options:[{name:"Document",value:"document"}],default:"document"},...So]};async execute(){let t=this.getInputData(),n=[],r=this.getNodeParameter("resource",0),s=this.getNodeParameter("operation",0);for(let i=0;i<t.length;i++)try{let o;if(r==="document")switch(s){case "extractMarkdown":o=await Eo.call(this,i);break;case "extractOutline":o=await Do.call(this,i);break;case "applyEdits":o=await No.call(this,i);break;case "generateDiff":o=await Co.call(this,i);break;case "finalizeDocument":o=await ko.call(this,i);break;case "hydrateToolOutput":o=await ti.call(this,i);break;default:throw new Error(`Unsupported operation: ${s}`)}else throw new Error(`Unsupported resource: ${r}`);n.push(...o);}catch(o){if(this.continueOnFail()){n.push({json:{error:o.message},pairedItem:{item:i}});continue}let l=o;throw l.name==="NodeOperationError"||l.name==="NodeApiError"?l:Zr.call(this,l,i)}return [n]}};exports.Adeu=Oo;
|