n8n-nodes-adeu 3.2.2 → 4.0.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.
|
@@ -93,7 +93,7 @@ ${l}`:l);}else s=[...r];let o=s.length;return {pages:s.map((l,d)=>({page:d+1,tot
|
|
|
93
93
|
${d}`,l++;else break}e.push([a,i]),t=l;}return e}g(ic,"_merge_footnote_sections");function sc(n){if(!n.length)return [[""],[0]];let e=[],t=[],r=[],i=0,s=-1,o=g(()=>{r.length>0&&(e.push(r.join(`
|
|
94
94
|
|
|
95
95
|
`)),t.push(s)),r=[],i=0,s=-1;},"flush_current");for(let[a,l,d]of n){let c=a.length,u=c+(r.length>0?2:0);if(r.length>0&&i+u>vi&&o(),r.length===0&&c>vi){e.push(a),t.push(l);continue}r.length===0&&(s=l),r.push(a),i+=i>0?u:c,d&&o();}return o(),e.length?[e,t]:[[""],[0]]}g(sc,"_assemble_pages");function xi(n){let e=[...n.matchAll(tc)];return new Set(e.map(r=>r[1])).size}g(xi,"_count_tracked_changes");var oc=5,Ni=50;function ac(n,e,t,r){let i=r.length;if(i<2)throw new Error(`format_ambiguity_error requires at least 2 matches, got ${i}`);let s=r.slice(0,oc),o=i-s.length,a=[`- Edit ${n} Failed: Ambiguous match. Target text appears ${i} times. First ${s.length} occurrences:`];for(let l=0;l<s.length;l++){let[d,c]=s[l],u=Math.max(0,d-Ni),f=Math.min(t.length,c+Ni),h=t.substring(u,d).replace(/\n/g," "),_=t.substring(c,f).replace(/\n/g," "),p=t.substring(d,c).replace(/\n/g," ");p.length>50&&(p=p.substring(0,25)+"..."+p.substring(p.length-20));let m=u>0?"...":"",w=f<t.length?"...":"";a.push(` ${l+1}. "${m}${h}[${p}]${_}${w}"`);}return o>0&&a.push(` ... and ${o} more occurrence(s) not shown.`),a.push(" To resolve, re-send this edit using ONE of these strategies:"),a.push(' 1. RECOMMENDED: Provide more surrounding context in your target_text to uniquely identify a single location (keep the default "match_mode": "strict").'),a.push(` 2. Set "match_mode": "all" to modify ALL ${i} occurrences \u2014 only after verifying from the occurrence list above that EVERY occurrence should change.`),a.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.'),a.join(`
|
|
96
|
-
`)}g(ac,"format_ambiguity_error");var lc="3.2.2";function ne(n,e){let t=[],r=n.getElementsByTagName("*");for(let i=0;i<r.length;i++){let s=r[i].tagName;(s===e||s.endsWith(":"+e))&&t.push(r[i]);}return t}g(ne,"findDescendantsByLocalName");function cc(n){let e=0;function t(o,a){let l=o?o.toString():"",d=a?a.toString():"";return l===d}g(t,"areRunsIdentical");function r(o){let a=["w:t","w:tab","w:br","w:cr","w:delText","w:rPr"];for(let l=0;l<o.childNodes.length;l++){let d=o.childNodes[l];if(d.nodeType===1){let c=d.tagName;if(!a.includes(c))return true}}return false}g(r,"hasSpecialContent");function i(o){let a=Array.from(o.childNodes).filter(d=>d.nodeType===1),l=0;for(;l<a.length-1;){let d=a[l],c=a[l+1];if(d.tagName==="w:r"&&c.tagName==="w:r"&&!r(d)&&!r(c)){let u=S(d,"w:rPr"),f=S(c,"w:rPr");if(t(u,f)){let h=null;for(let p=0;p<d.childNodes.length;p++){let m=d.childNodes[p];m.nodeType===1&&(m.tagName==="w:t"||m.tagName==="w:delText")&&(h=m);}let _=Array.from(c.childNodes).filter(p=>p.nodeType===1);for(let p of _)if(p.tagName!=="w:rPr")if((p.tagName==="w:t"||p.tagName==="w:delText")&&h&&h.tagName===p.tagName){let m=h.textContent||"",w=p.textContent||"",y=m+w;h.textContent=y,y.trim()!==y&&h.setAttribute("xml:space","preserve");}else d.appendChild(p),(p.tagName==="w:t"||p.tagName==="w:delText")&&(h=p);o.removeChild(c),a.splice(l+1,1),e++;continue}}["w:ins","w:del","w:hyperlink","w:sdt","w:smartTag","w:fldSimple","w:sdtContent"].includes(d.tagName)&&i(d),l++;}if(a.length>0){let d=a[a.length-1];["w:ins","w:del","w:hyperlink","w:sdt","w:smartTag","w:fldSimple","w:sdtContent"].includes(d.tagName)&&i(d);}}g(i,"coalesceContainer");let s=R(n.element,"w:p");for(let o of s)i(o);return e?[`Adjacent identical runs coalesced: ${e}`]:[]}g(cc,"coalesce_runs");function dc(n){let e=0,t=["w:rsidR","w:rsidRPr","w:rsidRDefault","w:rsidP","w:rsidDel","w:rsidSect","w:rsidTr"],r=n.element.getElementsByTagName("*");for(let s=0;s<r.length;s++)for(let o of t)r[s].hasAttribute(o)&&(r[s].removeAttribute(o),e++);let i=R(n.element,"w:rsids");for(let s of i)s.parentNode&&(s.parentNode.removeChild(s),e++);return e?[`rsid attributes: ${e} removed`]:[]}g(dc,"strip_rsid");function uc(n){let e=0,t=["w14:paraId","w14:textId"],r=n.element.getElementsByTagName("*");for(let i=0;i<r.length;i++)for(let s of t)r[i].hasAttribute(s)&&(r[i].removeAttribute(s),e++);return e?[`Paragraph/text IDs: ${e} removed`]:[]}g(uc,"strip_para_ids");function fc(n){let e=R(n.element,"w:proofErr");return e.forEach(t=>t.parentNode?.removeChild(t)),e.length?[`Spell check markers: ${e.length} removed`]:[]}g(fc,"strip_proof_errors");function hc(n){let e=0;for(let t of ["w:rPr","w:pPr"]){let r=R(n.element,t);for(let i of r)(i.childNodes.length===0||i.childNodes.length===1&&i.childNodes[0].nodeType===3&&!i.childNodes[0].textContent?.trim())&&(i.parentNode?.removeChild(i),e++);}return e?[`Empty property elements: ${e} removed`]:[]}g(hc,"strip_empty_properties");function pc(n){let e=0,t=R(n.element,"w:rPr");for(let r of t)if(S(r,"w:vanish")||S(r,"w:webHidden")){let i=r.parentNode;i&&i.tagName==="w:r"&&i.parentNode&&(i.parentNode.removeChild(i),e++);}return e?[`Hidden text runs: ${e} removed`]:[]}g(pc,"strip_hidden_text");function ki(n){let e=R(n.element,"w:ins").length,t=R(n.element,"w:del").length,r=R(n.element,"w:rPrChange").length+R(n.element,"w:pPrChange").length+R(n.element,"w:sectPrChange").length;return [e,t,r]}g(ki,"count_tracked_changes");function _c(n){let e=new Set;for(let t of ["w:ins","w:del","w:rPrChange","w:pPrChange","w:sectPrChange"])for(let r of R(n.element,t)){let i=r.getAttribute("w:author");i&&e.add(i);}return e}g(_c,"get_track_change_authors");function Ci(n){let e=[],t=R(n,"w:t");for(let i of t)i.textContent&&e.push(i.textContent);let r=R(n,"w:delText");for(let i of r)i.textContent&&e.push(i.textContent);return e.join("")}g(Ci,"_getElementText");function He(n,e=60){let t=n.replace(/\n/g," ").trim();return t.length<=e?t:t.substring(0,e-3)+"..."}g(He,"_truncate");function Ei(n){let e=n.parentNode;if(e&&e.tagName==="w:rPr"){let t=e.parentNode;if(t&&t.tagName==="w:pPr")return "(paragraph mark)"}return e&&e.tagName==="w:trPr"?"(table row)":"(no visible text)"}g(Ei,"_describe_textless_revision");function mc(n){let e=[],t=R(n.element,"w:ins"),r=R(n.element,"w:del");for(let o of t){let a=Ci(o).trim();a?e.push(` Accepted insertion: "${He(a,60)}"`):e.push(` Accepted insertion: ${Ei(o)}`);}for(let o of r){let a=Ci(o).trim();a?e.push(` Accepted deletion of: "${He(a,60)}"`):e.push(` Accepted deletion of: ${Ei(o)}`);}new Ft(n).accept_all_revisions();for(let o of ["w:rPrChange","w:pPrChange","w:sectPrChange"])for(let a of R(n.element,o))a.parentNode?.removeChild(a);let s=t.length+r.length;return s?[`Tracked changes auto-accepted: ${s}`].concat(e):[]}g(mc,"accept_all_tracked_changes");function Jt(n){let e=We(n.pkg),t=[],r=0,i=0;for(let[s,o]of Object.entries(e))o.resolved?i++:r++,t.push({id:s,...o});return {total:t.length,open:r,resolved:i,comments:t}}g(Jt,"get_comments_summary");function gc(n){let e=We(n.pkg),t=Object.keys(e);if(t.length===0)return [];let r=[],i=new Dt(n);for(let[l,d]of Object.entries(e)){let c=d.resolved?"[Resolved]":"[Open]";r.push(` ${c} "${He(d.text||"",60)}" (${d.author||"Unknown"})`),i.deleteComment(l);}for(let l of ["w:commentRangeStart","w:commentRangeEnd"])for(let d of R(n.element,l))d.parentNode?.removeChild(d);let s=R(n.element,"w:commentReference");for(let l of s){let d=l.parentNode;d&&((d.tagName==="w:r"||d.tagName.endsWith(":r"))&&Array.from(d.childNodes).filter(u=>u.nodeType===1&&u.tagName!=="w:rPr"&&u.tagName!=="rPr").length<=1?d.parentNode?.removeChild(d):d.removeChild(l));}let o=Object.values(e).filter(l=>l.resolved).length,a=Object.values(e).filter(l=>!l.resolved).length;return [`Comments removed: ${t.length} (${o} resolved, ${a} open)`].concat(r)}g(gc,"remove_all_comments");function wc(n){let e=n.pkg,t=new Set;for(let i of e.parts)if(i.partname.toLowerCase().includes("comments")){t.add(i.partname);let s=i.partname.startsWith("/")?i.partname:"/"+i.partname,o=i.partname.startsWith("/")?i.partname.substring(1):i.partname;t.add(s),t.add(o);}if(t.size===0)return;for(let i of e.parts)if(i.partname.endsWith(".rels")){let s=R(i._element,"Relationship"),o=[];for(let a of s)if((a.getAttribute("Target")||"").toLowerCase().includes("comments")){o.push(a);let d=i.partname.replace("/_rels/","/").replace(".rels",""),c=e.getPartByPath(d);if(c){let u=a.getAttribute("Id");u&&c.rels.delete(u);}}for(let a of o)a.parentNode?.removeChild(a);}let r=e.getPartByPath("[Content_Types].xml");if(r){let i=R(r._element,"Override"),s=[];for(let o of i){let a=o.getAttribute("PartName")||"";(t.has(a)||a.toLowerCase().includes("comments"))&&s.push(o);}for(let o of s)o.parentNode?.removeChild(o);}e.parts=e.parts.filter(i=>!i.partname.toLowerCase().includes("comments"));for(let i of Object.keys(e.unzipped))i.toLowerCase().includes("comments")&&delete e.unzipped[i];}g(wc,"eject_comment_parts");function yc(n,e){let t=new Dt(n);if(!t.commentsPart)return [];let r=new Set,i=R(t.commentsPart._element,"w:comment");for(let s of i){let o=s.getAttribute("w:author");if(o&&(r.add(o),s.setAttribute("w:author",e)),s.hasAttribute("w:initials")){let a=e.split(" ").filter(Boolean).map(l=>l[0]).join("").toUpperCase();s.setAttribute("w:initials",a);}}return r.size?[`Comment authors replaced: ${Array.from(r).sort().join(", ")} \u2192 "${e}"`]:[]}g(yc,"replace_comment_authors");function vc(n,e){let t=new Set;for(let r of ["w:ins","w:del","w:rPrChange","w:pPrChange"])for(let i of R(n.element,r)){let s=i.getAttribute("w:author");s&&(t.add(s),i.setAttribute("w:author",e));}return t.size?[`Track change authors replaced: ${Array.from(t).sort().join(", ")} \u2192 "${e}"`]:[]}g(vc,"replace_change_authors");function bc(n){let e=0,t="2025-01-01T00:00:00Z";for(let r of ["w:ins","w:del","w:rPrChange","w:pPrChange"])for(let i of R(n.element,r))i.hasAttribute("w:date")&&(i.setAttribute("w:date",t),e++);return e?[`Track change timestamps: ${e} normalized`]:[]}g(bc,"normalize_change_dates");function xc(n){let e=0,t="2025-01-01T00:00:00Z";for(let r of n.pkg.parts)if(r.contentType.includes("comments")){for(let i of R(r._element,"w:comment"))i.hasAttribute("w:date")&&(i.setAttribute("w:date",t),e++);for(let i of R(r._element,"w16cex:commentExtensible"))i.hasAttribute("w16cex:dateUtc")&&(i.setAttribute("w16cex:dateUtc",t),e++);}return e?[`Comment timestamps: ${e} normalized`]:[]}g(xc,"normalize_comment_dates");function Nc(n){let e=[],t=n.pkg.getPartByPath("docProps/core.xml");if(t){ne(t._element,"creator").forEach(d=>{d.textContent&&(e.push(`Author: ${d.textContent}`),d.textContent="");}),ne(t._element,"lastModifiedBy").forEach(d=>{d.textContent&&(e.push(`Last modified by: ${d.textContent}`),d.textContent="");}),ne(t._element,"title").forEach(d=>{d.textContent&&e.push(`Title kept (review manually): "${d.textContent}"`);});let a=[["category","Category"],["keywords","Keywords"],["subject","Subject"],["contentStatus","Content status"],["description","Description/comments"],["identifier","Identifier"],["language","Language"],["version","Version"]];for(let[d,c]of a)ne(t._element,d).forEach(u=>{u.textContent&&(e.push(`${c}: ${u.textContent}`),u.textContent="");});ne(t._element,"revision").forEach(d=>{d.textContent&&parseInt(d.textContent)>1&&(e.push(`Revision count: ${d.textContent} \u2192 1`),d.textContent="1");});}let r=n.pkg.getPartByPath("docProps/app.xml");if(r){let i=r._element,s=["TotalTime","Words","Characters","Paragraphs","Lines","CharactersWithSpaces"];for(let a of s)ne(i,a).forEach(l=>{l.textContent&&l.textContent!=="0"&&(a==="TotalTime"&&e.push(`Total editing time: ${l.textContent} minutes`),l.textContent="0");});let o=["Template","Manager","Company"];for(let a of o)ne(i,a).forEach(l=>{l.textContent&&(e.push(`${a}: ${l.textContent}`),l.textContent="");});}return e.length?["Metadata scrubbed:",...e.map(i=>` ${i}`)]:[]}g(Nc,"scrub_doc_properties");function kc(n){let e=false,t="1970-01-01T00:00:00Z",r=n.pkg.getPartByPath("docProps/core.xml");if(r)for(let i of ["created","modified","lastPrinted"])ne(r._element,i).forEach(s=>{s.textContent&&s.textContent!==t&&(s.textContent=t,e=true);});return e?["Timestamps normalized to epoch"]:[]}g(kc,"scrub_timestamps");function Us(n,e,t){let r=n.pkg,i=g(o=>o.startsWith("/")?o.substring(1):o,"normalized");for(let o of r.parts){if(!o.partname.endsWith(".rels"))continue;let a=[];for(let l of R(o._element,"Relationship")){let d=l.getAttribute("Target")||"";if(t(d)){a.push(l);let c=o.partname.replace("/_rels/","/").replace(".rels",""),u=r.getPartByPath(c);if(u){let f=l.getAttribute("Id");f&&u.rels.delete(f);}}}a.forEach(l=>l.parentNode?.removeChild(l));}let s=r.getPartByPath("[Content_Types].xml");if(s){let o=[];for(let a of R(s._element,"Override")){let l=a.getAttribute("PartName")||"";e(i(l))&&o.push(a);}o.forEach(a=>a.parentNode?.removeChild(a));}r.parts=r.parts.filter(o=>!e(i(o.partname)));for(let o of Object.keys(r.unzipped))e(i(o))&&delete r.unzipped[o];}g(Us,"ejectPackageMembers");function Cc(n){let e=g(i=>i.startsWith("customXml/"),"isCustomXml"),t=n.pkg.parts.filter(i=>e(i.partname.startsWith("/")?i.partname.substring(1):i.partname)),r=Object.keys(n.pkg.unzipped).filter(e);if(t.length===0&&r.length===0)return [];Us(n,e,i=>i.includes("customXml"));for(let i of R(n.element,"w:sdtPr"))pn(i,"w:dataBinding").forEach(s=>i.removeChild(s));return [`Custom XML parts: ${Math.max(t.length,r.length)} removed`]}g(Cc,"strip_custom_xml");var Qn="docProps/custom.xml";function Ec(n){let e=n.pkg.getPartByPath(Qn),t=Object.keys(n.pkg.unzipped).includes(Qn);if(!e&&!t)return [];let r=[];if(e)for(let s of ne(e._element,"property")){let o=s.getAttribute("name")||"(unnamed)",a=(s.textContent||"").trim();r.push(` Custom property removed: ${o} = "${He(a,60)}"`);}return Us(n,s=>s===Qn,s=>s.includes("docProps/custom.xml")),[`Custom document properties: ${Math.max(r.length,1)} removed (docProps/custom.xml)`].concat(r)}g(Ec,"strip_custom_properties");function Ac(n){let e=n.pkg.getPartByPath("word/settings.xml");if(!e)return [];let t=[],r=false;for(let s of ne(e._element,"docVars")){for(let o of Array.from(s.childNodes)){let a=o,l=a.tagName||"";(l==="docVar"||l.endsWith(":docVar"))&&t.push(a.getAttribute("w:name")||a.getAttribute("name")||"(unnamed)");}s.parentNode?.removeChild(s),r=true;}for(let s of ne(e._element,"docVar"))t.push(s.getAttribute("w:name")||s.getAttribute("name")||"(unnamed)"),s.parentNode?.removeChild(s),r=true;if(!r)return [];let i=Array.from(new Set(t)).sort().join(", ")||"(unnamed)";return [`Document variables: ${t.length} removed (${i})`]}g(Ac,"strip_document_variables");function Pc(n){let e=0;for(let t of ne(n.element,"docPr")){let r=t.getAttribute("descr");if(r){let i=r.length<10,s=r.includes(".")&&r.length<60;(i||s)&&(t.removeAttribute("descr"),e++);}}return e?[`Image alt text: ${e} auto-generated descriptions removed`]:[]}g(Pc,"strip_image_alt_text");function Tc(n){let e=[],t=new Set;for(let r of n.pkg.parts){let i=String(r.partname),s;if(i.startsWith("/word/header"))s="header";else if(i.startsWith("/word/footer"))s="footer";else if(i==="/word/document.xml")s="body";else continue;let o;try{o=ne(r._element,"textpath");}catch{continue}for(let a of o){let l=(a.getAttribute("string")||"").trim(),d=`${s}${l}`;if(t.has(d))continue;t.add(d);let c=l?`"${He(l,60)}"`:"(no text)";e.push(`Watermark-like text object in ${s}: ${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 e}g(Tc,"detect_watermarks");function Sc(n){let e=["sharepoint.com","onedrive.com",".internal","intranet","localhost","10.","192.168.","172.16."],t=[],r=n.pkg.getOrCreateRelsPart(n.part.partname);for(let i of R(r._element,"Relationship"))if(i.getAttribute("TargetMode")==="External"){let s=i.getAttribute("Target")||"";for(let o of e)if(s.toLowerCase().includes(o.toLowerCase())){t.push(`Hyperlink targets internal URL: ${He(s,80)}`);break}}return t}g(Sc,"audit_hyperlinks");var $c="word/settings.xml",Ic=new Set(["readOnly","forms","comments","trackedChanges"]),Oc={readOnly:"read-only",forms:"fill-in-forms",comments:"comments-only",trackedChanges:"tracked-changes-only"},Et=Object.freeze({edit:null,enforced:false});function xn(n){return n.edit!==null&&n.enforced}g(xn,"isProtectionActive");function Pr(n){return n.edit===null?"unprotected":`${Oc[n.edit]??n.edit}, ${n.enforced?"enforced":"not enforced"}`}g(Pr,"describeProtection");function Dc(n){return n==null?true:!["0","false","off"].includes(n.toLowerCase())}g(Dc,"isTruthy");function Nn(n){let e=null;try{let s=n?.pkg?.getPartByPath?.($c);if(!s?._element)return Et;e=ne(s._element,"documentProtection")[0]??null;}catch{return Et}if(!e)return Et;let t=null,r=null,i=e.attributes;if(i)for(let s=0;s<i.length;s++){let o=i[s],a=(o.name??"").split(":").pop()??"";a==="edit"?t=o.value:a==="enforcement"&&(r=o.value);}return t===null||!Ic.has(t)?Et:{edit:t,enforced:Dc(r)}}g(Nn,"readDocumentProtection");var kn="ignore_control_locks",St="ignore_document_protection",Tr="allow_untracked_writes",st=Object.freeze({ignore_control_locks:false,ignore_document_protection:false,allow_untracked_writes:false});function Rc(n){return n.ignore_control_locks||n.ignore_document_protection||n.allow_untracked_writes}g(Rc,"anyOverrideUsed");function ye(n){let e=[`CC:${n.ordinal}`];return n.alias&&e.push(`"${n.alias}"`),n.tag&&e.push(`(tag: ${n.tag})`),e.join(" ")}g(ye,"describeControl");function we(n,e){let t=`- Edit ${n} Failed: ${e.subject} ${e.rule} ${Mc(e.alternative)}`;return e.override&&(t+=` Pass ${e.override}=true to override deliberately.`),t.split(/\s+/).join(" ")}g(we,"gateError");function Mc(n){let e=n.replace(/\s+$/,"");return /[.!?:]$/.test(e)?e:`${e}.`}g(Mc,"endSentence");function jc(n){return n.find(e=>e.contentLocked)??null}g(jc,"lockedAncestor");function Bc(n,e,t=st){if(t.ignore_control_locks)return null;let r=jc(e);return r?we(n,{subject:`edit targets content inside ${ye(r)}, which is content-locked (sdtContentLocked).`,rule:"Word refuses edits inside locked controls, so this edit would silently fail to appear in the document.",alternative:"Remove the lock in Word (Developer -> Properties)",override:kn}):null}g(Bc,"checkContentLock");function Fc(n,e,t=st){if(t.ignore_control_locks)return null;let r=e.find(i=>i.cls==="group");return !r||e.some(i=>i.cls!=="group")?null:we(n,{subject:`edit targets text inside ${ye(r)}, which is a group (a locked region).`,rule:"Word treats a group's own text as fixed boilerplate and only permits edits to the fields nested inside it.",alternative:"Target one of the nested controls instead",override:kn})}g(Fc,"checkGroupRegion");function Lc(n,e,t,r=st){if(r.ignore_control_locks||!t)return null;let i=e.find(s=>s.deleteLocked);return i?we(n,{subject:`edit would remove ${ye(i)} itself, which is delete-locked (sdtLocked).`,rule:"Word refuses to delete a locked control, and hoisting its content out would dissolve the wrapper.",alternative:"Delete the control's CONTENT instead (the wrapper stays, leaving an empty field)",override:kn}):null}g(Lc,"checkDeleteLock");function Wc(n,e,t={}){let r=t.overrides??st;if(!xn(e)||r.ignore_document_protection)return null;let i=Pr(e);return e.edit==="readOnly"?we(n,{subject:`the document is protected (${i}).`,rule:"Word blocks every modification while read-only protection is enforced.",alternative:"Remove the restriction in Word (Review -> Restrict Editing -> Stop Protection)",override:St}):e.edit==="comments"?t.isCommentOnly?null:we(n,{subject:`the document is protected (${i}).`,rule:"Word permits only comments while comments-only protection is enforced; text mutations are blocked.",alternative:"Attach a comment instead (set new_text equal to target_text and supply comment)",override:St}):e.edit==="forms"?(t.controls??[]).some(o=>o.cls!=="group")?null:we(n,{subject:`the document is protected (${i}).`,rule:"Word permits only form-field fills while fill-in-forms protection is enforced; body text outside a content control is locked.",alternative:"Target the content of a form field instead",override:St}):null}g(Wc,"checkProtectionBlocksEdit");function zc(n,e,t,r=st){if(!xn(t)||r.ignore_document_protection||e!=="accept"&&e!=="reject"||t.edit!=="trackedChanges"&&t.edit!=="readOnly")return null;let i=t.edit==="readOnly"?"Word blocks every modification while read-only protection is enforced.":"Resolving revisions is exactly what this protection forbids, so Word refuses Accept and Reject.";return `- Action ${n} Failed: the document is protected (${Pr(t)}). ${i} Remove the restriction in Word (Review -> Restrict Editing -> Stop Protection) or pass ${St}=true to override deliberately.`}g(zc,"checkProtectionBlocksReview");function Uc(n,e,t=st){return !xn(e)||e.edit!=="forms"||t.allow_untracked_writes?null:we(n,{subject:`the document is protected (${Pr(e)}).`,rule:"Word records fills in a forms-protected document as UNTRACKED changes, so Adeu cannot honour its guarantee that every write is a tracked change.",alternative:"Remove the protection to write tracked changes normally",override:Tr})}g(Uc,"checkUntrackedWrite");function Hc(n,e,t){let r=(e||"").trim();if(!r)return null;for(let i of t){if(!i.showingPlaceholder)continue;let s=(i.placeholderText||"").trim();if(!(!s||!s.includes(r)))return we(n,{subject:`target_text is the placeholder text of ${ye(i)}, which is EMPTY.`,rule:"Placeholder text is a ghost prompt, not content: Word discards it as soon as the field is filled, so an edit to it would be silently lost.",alternative:`Fill the field with set_field, or insert at its empty pair {#cc:${i.ordinal}}{#/cc:${i.ordinal}}`})}return null}g(Hc,"checkPlaceholderTarget");var At=["[ ]","[x]"];function Xc(n,e,t,r){let i=e.find(o=>o.cls==="checkbox");if(!i)return null;let s=At;return s.includes(t.trim())&&s.includes(r.trim())?null:we(n,{subject:`edit targets ${ye(i)}, which is a checkbox.`,rule:"Its [x] / [ ] projection reflects the w14:checked state rather than editable text, so replacing it with other text would leave the checkbox state unchanged.",alternative:"Toggle it by replacing [x] with [ ] (or the reverse), or use set_field"})}g(Xc,"checkCheckboxEdit");function qc(n,e){let t=e.find(i=>i.bound);if(!t)return null;let r=t.bindingXpath?` (bound to ${t.bindingXpath})`:"";return we(n,{subject:`edit targets the content of ${ye(t)}, which is data-bound${r}.`,rule:"Its text is a projection of an XML data store, and Word re-reads that store when the document opens, so an edit that skips the store is reverted.",alternative:"Use set_field, which writes the control and its bound store together"})}g(qc,"checkBoundControl");function Ai(n,e,t){let r=new Set(e),i=new Set(t);return n.filter(s=>r.has(s)!==i.has(s))}g(Ai,"crossedControlWalls");function Yc(n,e){if(e.length===0)return null;let t=e.map(ye).join(", ");return we(n,{subject:`edit merges paragraphs across the boundary of ${t}.`,rule:"Content may not be hoisted into or out of a content control by a merge: the wrapper would gain or lose text that was never scoped to it.",alternative:"Split this into two edits, one on each side of the control boundary"})}g(Yc,"checkBlockMergeAcrossControl");function Gc(n){return `segmented at the boundary of ${n.map(ye).join(", ")}: only the text outside the control was changed`}g(Gc,"segmentationNote");function Jc(n,e){if(!Rc(n))return null;let t=[];if(n.ignore_control_locks){let r=e.length>0?` (${e.map(ye).join(", ")} edited inside locked controls)`:"";t.push(`${kn}${r}`);}return n.ignore_document_protection&&t.push(St),n.allow_untracked_writes&&t.push(Tr),"Overrides: "+t.join(", ")}g(Jc,"overridesNote");function Vc(n,e,t=2){if(n===e)return 0;if(Math.abs(n.length-e.length)>t)return t+1;if(n.length===0)return e.length<=t?e.length:t+1;if(e.length===0)return n.length<=t?n.length:t+1;if(n.length>e.length){let i=n;n=e,e=i;}let r=Array.from({length:n.length+1},(i,s)=>s);for(let i=1;i<=e.length;i++){let s=[i],o=i;for(let a=1;a<=n.length;a++){let l=n[a-1]===e[i-1]?0:1,d=Math.min(r[a]+1,s[a-1]+1,r[a-1]+l);s.push(d),d<o&&(o=d);}if(o>t)return t+1;r=s;}return r[n.length]<=t?r[n.length]:t+1}g(Vc,"boundedLevenshtein");function Qc(n){let e="",t=R(n._element,"w:r");for(let r of t){let i=false,s=r.parentNode;for(;s&&s.nodeType===1;){if(s.tagName==="w:del"){i=true;break}s=s.parentNode;}i||(e+=Oe(new Le(r,n)));}return e}g(Qc,"_get_paragraph_text");var Sr="[A-Z][A-Za-z0-9\\s\\-&'\u2019]{1,60}",Zc=new RegExp(`^(?:[\\d.\\-()a-zA-Z]+\\s*)?["\u201C](${Sr})["\u201D]`,"d"),Kc=new RegExp(`(?<=[.;:!?])\\s+(?:[\\d.\\-()a-zA-Z]+\\s+)?["\u201C](${Sr})["\u201D]`,"dg"),ed=new RegExp(`\\([^)]*?["\u201C](${Sr})["\u201D][^)]*?\\)`,"dg");function td(n){let e=[],t=Zc.exec(n);t&&t.indices&&t.indices[1]&&n.slice(t[0].length).trim()&&e.push([t.indices[1][0],t[1].trim()]);for(let s of n.matchAll(Kc)){let o=s.indices;o&&o[1]&&e.push([o[1][0],s[1].trim()]);}for(let s of n.matchAll(ed)){let o=s.indices;o&&o[1]&&e.push([o[1][0],s[1].trim()]);}let r=[],i=new Set;e.sort((s,o)=>s[0]-o[0]);for(let[s,o]of e)i.has(s)||(i.add(s),r.push(o));return r}g(td,"extract_terms_from_paragraph");function nd(n,e){let t=Object.create(null),r=new Set,i=Object.create(null),s=[];for(let p of qe(n)){if(!(p instanceof ie))continue;let m=Qc(p).trim();if(!m)continue;for(let b of td(m))t[b]?r.add(b):t[b]={count:0};let w=m.length>60?m.substring(0,60)+"...":m,y=R(p._element,"*");for(let b of y){if(b.tagName==="w:bookmarkStart"){let N=b.getAttribute("w:name");N&&(!N.startsWith("_")||N.startsWith("_Ref"))&&(i[N]||(i[N]={anchored_to:w,referenced_from:[]}));}let v=null;if(b.tagName==="w:fldSimple"){let k=(b.getAttribute("w:instr")||"").trim().split(/\s+/);k.length>1&&k[0]==="REF"&&(v=k[1]);}else if(b.tagName==="w:instrText"){let k=(b.textContent||"").trim().split(/\s+/);k.length>1&&k[0]==="REF"&&(v=k[1]);}v&&s.push([v,w]);}}for(let[p,m]of s)i[p]&&i[p].referenced_from.push(m);let o=[],a=Object.keys(t);if(a.length>0){let p=a.sort((b,v)=>v.length-b.length),m=g(b=>b.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"escapeRegExp"),w=p.map(m).join("|"),y=new RegExp(`(?<!["\u201C])\\b(${w})\\b(?![\u201D"])`,"g");for(let b of e.matchAll(y)){let v=b[1];t[v]&&t[v].count++;}for(let b of a)t[b].count===0&&(delete t[b],r.has(b)||o.push(`[Warning] Unused Definition: '${b}' is defined but never used.`));}for(let p of r)o.push(`[Error] Duplicate Definition: '${p}' is defined multiple times.`);let l=new Set(["The","This","That","Such","A","An","Any","All","Some","No","Every","Each","As","In","Of","For","To","On","By","With"]),d=/\b[A-Z][a-zA-Z]*(?:\s+[A-Z][a-zA-Z]*)*\b/g,c=new Set(e.match(d)||[]),u=new Set(Object.keys(t)),f={};for(let p of u){let m=p[0].toLowerCase();f[m]||(f[m]=[]),f[m].push(p);}let h=Object.create(null);for(let p of c){let m=p.trim(),w=m.split(/\s+/);for(;w.length>0;){let v=w[0],N=v.charAt(0).toUpperCase()+v.slice(1).toLowerCase();if(l.has(N))w.shift();else break}if(m=w.join(" "),m.length<4||u.has(m))continue;let y=m[0].toLowerCase(),b=f[y]||[];if(m.length>5)for(let[v,N]of Object.entries(f))v!==y&&(b=b.concat(N));for(let v of b){if(Math.abs(m.length-v.length)>2||m===v+"s"||m===v+"es"||v===m+"s"||v===m+"es")continue;let N=Vc(m,v,2);N===0||N>2||v.length<=5&&(N>1||m[0].toLowerCase()!==v[0].toLowerCase())||(h[v]||(h[v]=[]),h[v].includes(m)||h[v].push(m));}}for(let[p,m]of Object.entries(h)){m.sort();let w=m.map(y=>`'${y}'`).join(", ");o.push(`[Info] Possible Typos for '${p}': Found ${w}`);}function _(p){return p.startsWith("[Error]")?0:p.startsWith("[Warning]")?1:2}return g(_,"diag_sort_key"),o.sort((p,m)=>{let w=_(p),y=_(m);return w!==y?w-y:p.localeCompare(m)}),[t,o,i]}g(nd,"extract_all_domain_metadata");function rd(n){let e=[],t=n.pkg.getPartByPath("word/settings.xml");if(!t)return e;let r=g(o=>{if(!o.hasAttribute("w:val"))return true;let a=(o.getAttribute("w:val")||"").toLowerCase();return a!=="0"&&a!=="false"&&a!=="off"},"isTruthy2"),i=ne(t._element,"removePersonalInformation");i.length>0&&r(i[0])&&e.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 s=ne(t._element,"removeDateAndTime");return s.length>0&&r(s[0])&&e.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."),e}g(rd,"extract_document_settings_warnings");function id(n,e){try{let t=Od(n),r=Nn(n);return jd(t,r,'Read with mode="fields" for the full field ledger.')}catch{return []}}g(id,"content_controls_appendix_section");function sd(n,e){let[t,r,i]=nd(n,e),s=rd(n),o=[`
|
|
96
|
+
`)}g(ac,"format_ambiguity_error");var lc="4.0.0";function ne(n,e){let t=[],r=n.getElementsByTagName("*");for(let i=0;i<r.length;i++){let s=r[i].tagName;(s===e||s.endsWith(":"+e))&&t.push(r[i]);}return t}g(ne,"findDescendantsByLocalName");function cc(n){let e=0;function t(o,a){let l=o?o.toString():"",d=a?a.toString():"";return l===d}g(t,"areRunsIdentical");function r(o){let a=["w:t","w:tab","w:br","w:cr","w:delText","w:rPr"];for(let l=0;l<o.childNodes.length;l++){let d=o.childNodes[l];if(d.nodeType===1){let c=d.tagName;if(!a.includes(c))return true}}return false}g(r,"hasSpecialContent");function i(o){let a=Array.from(o.childNodes).filter(d=>d.nodeType===1),l=0;for(;l<a.length-1;){let d=a[l],c=a[l+1];if(d.tagName==="w:r"&&c.tagName==="w:r"&&!r(d)&&!r(c)){let u=S(d,"w:rPr"),f=S(c,"w:rPr");if(t(u,f)){let h=null;for(let p=0;p<d.childNodes.length;p++){let m=d.childNodes[p];m.nodeType===1&&(m.tagName==="w:t"||m.tagName==="w:delText")&&(h=m);}let _=Array.from(c.childNodes).filter(p=>p.nodeType===1);for(let p of _)if(p.tagName!=="w:rPr")if((p.tagName==="w:t"||p.tagName==="w:delText")&&h&&h.tagName===p.tagName){let m=h.textContent||"",w=p.textContent||"",y=m+w;h.textContent=y,y.trim()!==y&&h.setAttribute("xml:space","preserve");}else d.appendChild(p),(p.tagName==="w:t"||p.tagName==="w:delText")&&(h=p);o.removeChild(c),a.splice(l+1,1),e++;continue}}["w:ins","w:del","w:hyperlink","w:sdt","w:smartTag","w:fldSimple","w:sdtContent"].includes(d.tagName)&&i(d),l++;}if(a.length>0){let d=a[a.length-1];["w:ins","w:del","w:hyperlink","w:sdt","w:smartTag","w:fldSimple","w:sdtContent"].includes(d.tagName)&&i(d);}}g(i,"coalesceContainer");let s=R(n.element,"w:p");for(let o of s)i(o);return e?[`Adjacent identical runs coalesced: ${e}`]:[]}g(cc,"coalesce_runs");function dc(n){let e=0,t=["w:rsidR","w:rsidRPr","w:rsidRDefault","w:rsidP","w:rsidDel","w:rsidSect","w:rsidTr"],r=n.element.getElementsByTagName("*");for(let s=0;s<r.length;s++)for(let o of t)r[s].hasAttribute(o)&&(r[s].removeAttribute(o),e++);let i=R(n.element,"w:rsids");for(let s of i)s.parentNode&&(s.parentNode.removeChild(s),e++);return e?[`rsid attributes: ${e} removed`]:[]}g(dc,"strip_rsid");function uc(n){let e=0,t=["w14:paraId","w14:textId"],r=n.element.getElementsByTagName("*");for(let i=0;i<r.length;i++)for(let s of t)r[i].hasAttribute(s)&&(r[i].removeAttribute(s),e++);return e?[`Paragraph/text IDs: ${e} removed`]:[]}g(uc,"strip_para_ids");function fc(n){let e=R(n.element,"w:proofErr");return e.forEach(t=>t.parentNode?.removeChild(t)),e.length?[`Spell check markers: ${e.length} removed`]:[]}g(fc,"strip_proof_errors");function hc(n){let e=0;for(let t of ["w:rPr","w:pPr"]){let r=R(n.element,t);for(let i of r)(i.childNodes.length===0||i.childNodes.length===1&&i.childNodes[0].nodeType===3&&!i.childNodes[0].textContent?.trim())&&(i.parentNode?.removeChild(i),e++);}return e?[`Empty property elements: ${e} removed`]:[]}g(hc,"strip_empty_properties");function pc(n){let e=0,t=R(n.element,"w:rPr");for(let r of t)if(S(r,"w:vanish")||S(r,"w:webHidden")){let i=r.parentNode;i&&i.tagName==="w:r"&&i.parentNode&&(i.parentNode.removeChild(i),e++);}return e?[`Hidden text runs: ${e} removed`]:[]}g(pc,"strip_hidden_text");function ki(n){let e=R(n.element,"w:ins").length,t=R(n.element,"w:del").length,r=R(n.element,"w:rPrChange").length+R(n.element,"w:pPrChange").length+R(n.element,"w:sectPrChange").length;return [e,t,r]}g(ki,"count_tracked_changes");function _c(n){let e=new Set;for(let t of ["w:ins","w:del","w:rPrChange","w:pPrChange","w:sectPrChange"])for(let r of R(n.element,t)){let i=r.getAttribute("w:author");i&&e.add(i);}return e}g(_c,"get_track_change_authors");function Ci(n){let e=[],t=R(n,"w:t");for(let i of t)i.textContent&&e.push(i.textContent);let r=R(n,"w:delText");for(let i of r)i.textContent&&e.push(i.textContent);return e.join("")}g(Ci,"_getElementText");function He(n,e=60){let t=n.replace(/\n/g," ").trim();return t.length<=e?t:t.substring(0,e-3)+"..."}g(He,"_truncate");function Ei(n){let e=n.parentNode;if(e&&e.tagName==="w:rPr"){let t=e.parentNode;if(t&&t.tagName==="w:pPr")return "(paragraph mark)"}return e&&e.tagName==="w:trPr"?"(table row)":"(no visible text)"}g(Ei,"_describe_textless_revision");function mc(n){let e=[],t=R(n.element,"w:ins"),r=R(n.element,"w:del");for(let o of t){let a=Ci(o).trim();a?e.push(` Accepted insertion: "${He(a,60)}"`):e.push(` Accepted insertion: ${Ei(o)}`);}for(let o of r){let a=Ci(o).trim();a?e.push(` Accepted deletion of: "${He(a,60)}"`):e.push(` Accepted deletion of: ${Ei(o)}`);}new Ft(n).accept_all_revisions();for(let o of ["w:rPrChange","w:pPrChange","w:sectPrChange"])for(let a of R(n.element,o))a.parentNode?.removeChild(a);let s=t.length+r.length;return s?[`Tracked changes auto-accepted: ${s}`].concat(e):[]}g(mc,"accept_all_tracked_changes");function Jt(n){let e=We(n.pkg),t=[],r=0,i=0;for(let[s,o]of Object.entries(e))o.resolved?i++:r++,t.push({id:s,...o});return {total:t.length,open:r,resolved:i,comments:t}}g(Jt,"get_comments_summary");function gc(n){let e=We(n.pkg),t=Object.keys(e);if(t.length===0)return [];let r=[],i=new Dt(n);for(let[l,d]of Object.entries(e)){let c=d.resolved?"[Resolved]":"[Open]";r.push(` ${c} "${He(d.text||"",60)}" (${d.author||"Unknown"})`),i.deleteComment(l);}for(let l of ["w:commentRangeStart","w:commentRangeEnd"])for(let d of R(n.element,l))d.parentNode?.removeChild(d);let s=R(n.element,"w:commentReference");for(let l of s){let d=l.parentNode;d&&((d.tagName==="w:r"||d.tagName.endsWith(":r"))&&Array.from(d.childNodes).filter(u=>u.nodeType===1&&u.tagName!=="w:rPr"&&u.tagName!=="rPr").length<=1?d.parentNode?.removeChild(d):d.removeChild(l));}let o=Object.values(e).filter(l=>l.resolved).length,a=Object.values(e).filter(l=>!l.resolved).length;return [`Comments removed: ${t.length} (${o} resolved, ${a} open)`].concat(r)}g(gc,"remove_all_comments");function wc(n){let e=n.pkg,t=new Set;for(let i of e.parts)if(i.partname.toLowerCase().includes("comments")){t.add(i.partname);let s=i.partname.startsWith("/")?i.partname:"/"+i.partname,o=i.partname.startsWith("/")?i.partname.substring(1):i.partname;t.add(s),t.add(o);}if(t.size===0)return;for(let i of e.parts)if(i.partname.endsWith(".rels")){let s=R(i._element,"Relationship"),o=[];for(let a of s)if((a.getAttribute("Target")||"").toLowerCase().includes("comments")){o.push(a);let d=i.partname.replace("/_rels/","/").replace(".rels",""),c=e.getPartByPath(d);if(c){let u=a.getAttribute("Id");u&&c.rels.delete(u);}}for(let a of o)a.parentNode?.removeChild(a);}let r=e.getPartByPath("[Content_Types].xml");if(r){let i=R(r._element,"Override"),s=[];for(let o of i){let a=o.getAttribute("PartName")||"";(t.has(a)||a.toLowerCase().includes("comments"))&&s.push(o);}for(let o of s)o.parentNode?.removeChild(o);}e.parts=e.parts.filter(i=>!i.partname.toLowerCase().includes("comments"));for(let i of Object.keys(e.unzipped))i.toLowerCase().includes("comments")&&delete e.unzipped[i];}g(wc,"eject_comment_parts");function yc(n,e){let t=new Dt(n);if(!t.commentsPart)return [];let r=new Set,i=R(t.commentsPart._element,"w:comment");for(let s of i){let o=s.getAttribute("w:author");if(o&&(r.add(o),s.setAttribute("w:author",e)),s.hasAttribute("w:initials")){let a=e.split(" ").filter(Boolean).map(l=>l[0]).join("").toUpperCase();s.setAttribute("w:initials",a);}}return r.size?[`Comment authors replaced: ${Array.from(r).sort().join(", ")} \u2192 "${e}"`]:[]}g(yc,"replace_comment_authors");function vc(n,e){let t=new Set;for(let r of ["w:ins","w:del","w:rPrChange","w:pPrChange"])for(let i of R(n.element,r)){let s=i.getAttribute("w:author");s&&(t.add(s),i.setAttribute("w:author",e));}return t.size?[`Track change authors replaced: ${Array.from(t).sort().join(", ")} \u2192 "${e}"`]:[]}g(vc,"replace_change_authors");function bc(n){let e=0,t="2025-01-01T00:00:00Z";for(let r of ["w:ins","w:del","w:rPrChange","w:pPrChange"])for(let i of R(n.element,r))i.hasAttribute("w:date")&&(i.setAttribute("w:date",t),e++);return e?[`Track change timestamps: ${e} normalized`]:[]}g(bc,"normalize_change_dates");function xc(n){let e=0,t="2025-01-01T00:00:00Z";for(let r of n.pkg.parts)if(r.contentType.includes("comments")){for(let i of R(r._element,"w:comment"))i.hasAttribute("w:date")&&(i.setAttribute("w:date",t),e++);for(let i of R(r._element,"w16cex:commentExtensible"))i.hasAttribute("w16cex:dateUtc")&&(i.setAttribute("w16cex:dateUtc",t),e++);}return e?[`Comment timestamps: ${e} normalized`]:[]}g(xc,"normalize_comment_dates");function Nc(n){let e=[],t=n.pkg.getPartByPath("docProps/core.xml");if(t){ne(t._element,"creator").forEach(d=>{d.textContent&&(e.push(`Author: ${d.textContent}`),d.textContent="");}),ne(t._element,"lastModifiedBy").forEach(d=>{d.textContent&&(e.push(`Last modified by: ${d.textContent}`),d.textContent="");}),ne(t._element,"title").forEach(d=>{d.textContent&&e.push(`Title kept (review manually): "${d.textContent}"`);});let a=[["category","Category"],["keywords","Keywords"],["subject","Subject"],["contentStatus","Content status"],["description","Description/comments"],["identifier","Identifier"],["language","Language"],["version","Version"]];for(let[d,c]of a)ne(t._element,d).forEach(u=>{u.textContent&&(e.push(`${c}: ${u.textContent}`),u.textContent="");});ne(t._element,"revision").forEach(d=>{d.textContent&&parseInt(d.textContent)>1&&(e.push(`Revision count: ${d.textContent} \u2192 1`),d.textContent="1");});}let r=n.pkg.getPartByPath("docProps/app.xml");if(r){let i=r._element,s=["TotalTime","Words","Characters","Paragraphs","Lines","CharactersWithSpaces"];for(let a of s)ne(i,a).forEach(l=>{l.textContent&&l.textContent!=="0"&&(a==="TotalTime"&&e.push(`Total editing time: ${l.textContent} minutes`),l.textContent="0");});let o=["Template","Manager","Company"];for(let a of o)ne(i,a).forEach(l=>{l.textContent&&(e.push(`${a}: ${l.textContent}`),l.textContent="");});}return e.length?["Metadata scrubbed:",...e.map(i=>` ${i}`)]:[]}g(Nc,"scrub_doc_properties");function kc(n){let e=false,t="1970-01-01T00:00:00Z",r=n.pkg.getPartByPath("docProps/core.xml");if(r)for(let i of ["created","modified","lastPrinted"])ne(r._element,i).forEach(s=>{s.textContent&&s.textContent!==t&&(s.textContent=t,e=true);});return e?["Timestamps normalized to epoch"]:[]}g(kc,"scrub_timestamps");function Us(n,e,t){let r=n.pkg,i=g(o=>o.startsWith("/")?o.substring(1):o,"normalized");for(let o of r.parts){if(!o.partname.endsWith(".rels"))continue;let a=[];for(let l of R(o._element,"Relationship")){let d=l.getAttribute("Target")||"";if(t(d)){a.push(l);let c=o.partname.replace("/_rels/","/").replace(".rels",""),u=r.getPartByPath(c);if(u){let f=l.getAttribute("Id");f&&u.rels.delete(f);}}}a.forEach(l=>l.parentNode?.removeChild(l));}let s=r.getPartByPath("[Content_Types].xml");if(s){let o=[];for(let a of R(s._element,"Override")){let l=a.getAttribute("PartName")||"";e(i(l))&&o.push(a);}o.forEach(a=>a.parentNode?.removeChild(a));}r.parts=r.parts.filter(o=>!e(i(o.partname)));for(let o of Object.keys(r.unzipped))e(i(o))&&delete r.unzipped[o];}g(Us,"ejectPackageMembers");function Cc(n){let e=g(i=>i.startsWith("customXml/"),"isCustomXml"),t=n.pkg.parts.filter(i=>e(i.partname.startsWith("/")?i.partname.substring(1):i.partname)),r=Object.keys(n.pkg.unzipped).filter(e);if(t.length===0&&r.length===0)return [];Us(n,e,i=>i.includes("customXml"));for(let i of R(n.element,"w:sdtPr"))pn(i,"w:dataBinding").forEach(s=>i.removeChild(s));return [`Custom XML parts: ${Math.max(t.length,r.length)} removed`]}g(Cc,"strip_custom_xml");var Qn="docProps/custom.xml";function Ec(n){let e=n.pkg.getPartByPath(Qn),t=Object.keys(n.pkg.unzipped).includes(Qn);if(!e&&!t)return [];let r=[];if(e)for(let s of ne(e._element,"property")){let o=s.getAttribute("name")||"(unnamed)",a=(s.textContent||"").trim();r.push(` Custom property removed: ${o} = "${He(a,60)}"`);}return Us(n,s=>s===Qn,s=>s.includes("docProps/custom.xml")),[`Custom document properties: ${Math.max(r.length,1)} removed (docProps/custom.xml)`].concat(r)}g(Ec,"strip_custom_properties");function Ac(n){let e=n.pkg.getPartByPath("word/settings.xml");if(!e)return [];let t=[],r=false;for(let s of ne(e._element,"docVars")){for(let o of Array.from(s.childNodes)){let a=o,l=a.tagName||"";(l==="docVar"||l.endsWith(":docVar"))&&t.push(a.getAttribute("w:name")||a.getAttribute("name")||"(unnamed)");}s.parentNode?.removeChild(s),r=true;}for(let s of ne(e._element,"docVar"))t.push(s.getAttribute("w:name")||s.getAttribute("name")||"(unnamed)"),s.parentNode?.removeChild(s),r=true;if(!r)return [];let i=Array.from(new Set(t)).sort().join(", ")||"(unnamed)";return [`Document variables: ${t.length} removed (${i})`]}g(Ac,"strip_document_variables");function Pc(n){let e=0;for(let t of ne(n.element,"docPr")){let r=t.getAttribute("descr");if(r){let i=r.length<10,s=r.includes(".")&&r.length<60;(i||s)&&(t.removeAttribute("descr"),e++);}}return e?[`Image alt text: ${e} auto-generated descriptions removed`]:[]}g(Pc,"strip_image_alt_text");function Tc(n){let e=[],t=new Set;for(let r of n.pkg.parts){let i=String(r.partname),s;if(i.startsWith("/word/header"))s="header";else if(i.startsWith("/word/footer"))s="footer";else if(i==="/word/document.xml")s="body";else continue;let o;try{o=ne(r._element,"textpath");}catch{continue}for(let a of o){let l=(a.getAttribute("string")||"").trim(),d=`${s}${l}`;if(t.has(d))continue;t.add(d);let c=l?`"${He(l,60)}"`:"(no text)";e.push(`Watermark-like text object in ${s}: ${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 e}g(Tc,"detect_watermarks");function Sc(n){let e=["sharepoint.com","onedrive.com",".internal","intranet","localhost","10.","192.168.","172.16."],t=[],r=n.pkg.getOrCreateRelsPart(n.part.partname);for(let i of R(r._element,"Relationship"))if(i.getAttribute("TargetMode")==="External"){let s=i.getAttribute("Target")||"";for(let o of e)if(s.toLowerCase().includes(o.toLowerCase())){t.push(`Hyperlink targets internal URL: ${He(s,80)}`);break}}return t}g(Sc,"audit_hyperlinks");var $c="word/settings.xml",Ic=new Set(["readOnly","forms","comments","trackedChanges"]),Oc={readOnly:"read-only",forms:"fill-in-forms",comments:"comments-only",trackedChanges:"tracked-changes-only"},Et=Object.freeze({edit:null,enforced:false});function xn(n){return n.edit!==null&&n.enforced}g(xn,"isProtectionActive");function Pr(n){return n.edit===null?"unprotected":`${Oc[n.edit]??n.edit}, ${n.enforced?"enforced":"not enforced"}`}g(Pr,"describeProtection");function Dc(n){return n==null?true:!["0","false","off"].includes(n.toLowerCase())}g(Dc,"isTruthy");function Nn(n){let e=null;try{let s=n?.pkg?.getPartByPath?.($c);if(!s?._element)return Et;e=ne(s._element,"documentProtection")[0]??null;}catch{return Et}if(!e)return Et;let t=null,r=null,i=e.attributes;if(i)for(let s=0;s<i.length;s++){let o=i[s],a=(o.name??"").split(":").pop()??"";a==="edit"?t=o.value:a==="enforcement"&&(r=o.value);}return t===null||!Ic.has(t)?Et:{edit:t,enforced:Dc(r)}}g(Nn,"readDocumentProtection");var kn="ignore_control_locks",St="ignore_document_protection",Tr="allow_untracked_writes",st=Object.freeze({ignore_control_locks:false,ignore_document_protection:false,allow_untracked_writes:false});function Rc(n){return n.ignore_control_locks||n.ignore_document_protection||n.allow_untracked_writes}g(Rc,"anyOverrideUsed");function ye(n){let e=[`CC:${n.ordinal}`];return n.alias&&e.push(`"${n.alias}"`),n.tag&&e.push(`(tag: ${n.tag})`),e.join(" ")}g(ye,"describeControl");function we(n,e){let t=`- Edit ${n} Failed: ${e.subject} ${e.rule} ${Mc(e.alternative)}`;return e.override&&(t+=` Pass ${e.override}=true to override deliberately.`),t.split(/\s+/).join(" ")}g(we,"gateError");function Mc(n){let e=n.replace(/\s+$/,"");return /[.!?:]$/.test(e)?e:`${e}.`}g(Mc,"endSentence");function jc(n){return n.find(e=>e.contentLocked)??null}g(jc,"lockedAncestor");function Bc(n,e,t=st){if(t.ignore_control_locks)return null;let r=jc(e);return r?we(n,{subject:`edit targets content inside ${ye(r)}, which is content-locked (sdtContentLocked).`,rule:"Word refuses edits inside locked controls, so this edit would silently fail to appear in the document.",alternative:"Remove the lock in Word (Developer -> Properties)",override:kn}):null}g(Bc,"checkContentLock");function Fc(n,e,t=st){if(t.ignore_control_locks)return null;let r=e.find(i=>i.cls==="group");return !r||e.some(i=>i.cls!=="group")?null:we(n,{subject:`edit targets text inside ${ye(r)}, which is a group (a locked region).`,rule:"Word treats a group's own text as fixed boilerplate and only permits edits to the fields nested inside it.",alternative:"Target one of the nested controls instead",override:kn})}g(Fc,"checkGroupRegion");function Lc(n,e,t,r=st){if(r.ignore_control_locks||!t)return null;let i=e.find(s=>s.deleteLocked);return i?we(n,{subject:`edit would remove ${ye(i)} itself, which is delete-locked (sdtLocked).`,rule:"Word refuses to delete a locked control, and hoisting its content out would dissolve the wrapper.",alternative:"Delete the control's CONTENT instead (the wrapper stays, leaving an empty field)",override:kn}):null}g(Lc,"checkDeleteLock");function Wc(n,e,t={}){let r=t.overrides??st;if(!xn(e)||r.ignore_document_protection)return null;let i=Pr(e);return e.edit==="readOnly"?we(n,{subject:`the document is protected (${i}).`,rule:"Word blocks every modification while read-only protection is enforced.",alternative:"Remove the restriction in Word (Review -> Restrict Editing -> Stop Protection)",override:St}):e.edit==="comments"?t.isCommentOnly?null:we(n,{subject:`the document is protected (${i}).`,rule:"Word permits only comments while comments-only protection is enforced; text mutations are blocked.",alternative:"Attach a comment instead (set new_text equal to target_text and supply comment)",override:St}):e.edit==="forms"?(t.controls??[]).some(o=>o.cls!=="group")?null:we(n,{subject:`the document is protected (${i}).`,rule:"Word permits only form-field fills while fill-in-forms protection is enforced; body text outside a content control is locked.",alternative:"Target the content of a form field instead",override:St}):null}g(Wc,"checkProtectionBlocksEdit");function zc(n,e,t,r=st){if(!xn(t)||r.ignore_document_protection||e!=="accept"&&e!=="reject"||t.edit!=="trackedChanges"&&t.edit!=="readOnly")return null;let i=t.edit==="readOnly"?"Word blocks every modification while read-only protection is enforced.":"Resolving revisions is exactly what this protection forbids, so Word refuses Accept and Reject.";return `- Action ${n} Failed: the document is protected (${Pr(t)}). ${i} Remove the restriction in Word (Review -> Restrict Editing -> Stop Protection) or pass ${St}=true to override deliberately.`}g(zc,"checkProtectionBlocksReview");function Uc(n,e,t=st){return !xn(e)||e.edit!=="forms"||t.allow_untracked_writes?null:we(n,{subject:`the document is protected (${Pr(e)}).`,rule:"Word records fills in a forms-protected document as UNTRACKED changes, so Adeu cannot honour its guarantee that every write is a tracked change.",alternative:"Remove the protection to write tracked changes normally",override:Tr})}g(Uc,"checkUntrackedWrite");function Hc(n,e,t){let r=(e||"").trim();if(!r)return null;for(let i of t){if(!i.showingPlaceholder)continue;let s=(i.placeholderText||"").trim();if(!(!s||!s.includes(r)))return we(n,{subject:`target_text is the placeholder text of ${ye(i)}, which is EMPTY.`,rule:"Placeholder text is a ghost prompt, not content: Word discards it as soon as the field is filled, so an edit to it would be silently lost.",alternative:`Fill the field with set_field, or insert at its empty pair {#cc:${i.ordinal}}{#/cc:${i.ordinal}}`})}return null}g(Hc,"checkPlaceholderTarget");var At=["[ ]","[x]"];function Xc(n,e,t,r){let i=e.find(o=>o.cls==="checkbox");if(!i)return null;let s=At;return s.includes(t.trim())&&s.includes(r.trim())?null:we(n,{subject:`edit targets ${ye(i)}, which is a checkbox.`,rule:"Its [x] / [ ] projection reflects the w14:checked state rather than editable text, so replacing it with other text would leave the checkbox state unchanged.",alternative:"Toggle it by replacing [x] with [ ] (or the reverse), or use set_field"})}g(Xc,"checkCheckboxEdit");function qc(n,e){let t=e.find(i=>i.bound);if(!t)return null;let r=t.bindingXpath?` (bound to ${t.bindingXpath})`:"";return we(n,{subject:`edit targets the content of ${ye(t)}, which is data-bound${r}.`,rule:"Its text is a projection of an XML data store, and Word re-reads that store when the document opens, so an edit that skips the store is reverted.",alternative:"Use set_field, which writes the control and its bound store together"})}g(qc,"checkBoundControl");function Ai(n,e,t){let r=new Set(e),i=new Set(t);return n.filter(s=>r.has(s)!==i.has(s))}g(Ai,"crossedControlWalls");function Yc(n,e){if(e.length===0)return null;let t=e.map(ye).join(", ");return we(n,{subject:`edit merges paragraphs across the boundary of ${t}.`,rule:"Content may not be hoisted into or out of a content control by a merge: the wrapper would gain or lose text that was never scoped to it.",alternative:"Split this into two edits, one on each side of the control boundary"})}g(Yc,"checkBlockMergeAcrossControl");function Gc(n){return `segmented at the boundary of ${n.map(ye).join(", ")}: only the text outside the control was changed`}g(Gc,"segmentationNote");function Jc(n,e){if(!Rc(n))return null;let t=[];if(n.ignore_control_locks){let r=e.length>0?` (${e.map(ye).join(", ")} edited inside locked controls)`:"";t.push(`${kn}${r}`);}return n.ignore_document_protection&&t.push(St),n.allow_untracked_writes&&t.push(Tr),"Overrides: "+t.join(", ")}g(Jc,"overridesNote");function Vc(n,e,t=2){if(n===e)return 0;if(Math.abs(n.length-e.length)>t)return t+1;if(n.length===0)return e.length<=t?e.length:t+1;if(e.length===0)return n.length<=t?n.length:t+1;if(n.length>e.length){let i=n;n=e,e=i;}let r=Array.from({length:n.length+1},(i,s)=>s);for(let i=1;i<=e.length;i++){let s=[i],o=i;for(let a=1;a<=n.length;a++){let l=n[a-1]===e[i-1]?0:1,d=Math.min(r[a]+1,s[a-1]+1,r[a-1]+l);s.push(d),d<o&&(o=d);}if(o>t)return t+1;r=s;}return r[n.length]<=t?r[n.length]:t+1}g(Vc,"boundedLevenshtein");function Qc(n){let e="",t=R(n._element,"w:r");for(let r of t){let i=false,s=r.parentNode;for(;s&&s.nodeType===1;){if(s.tagName==="w:del"){i=true;break}s=s.parentNode;}i||(e+=Oe(new Le(r,n)));}return e}g(Qc,"_get_paragraph_text");var Sr="[A-Z][A-Za-z0-9\\s\\-&'\u2019]{1,60}",Zc=new RegExp(`^(?:[\\d.\\-()a-zA-Z]+\\s*)?["\u201C](${Sr})["\u201D]`,"d"),Kc=new RegExp(`(?<=[.;:!?])\\s+(?:[\\d.\\-()a-zA-Z]+\\s+)?["\u201C](${Sr})["\u201D]`,"dg"),ed=new RegExp(`\\([^)]*?["\u201C](${Sr})["\u201D][^)]*?\\)`,"dg");function td(n){let e=[],t=Zc.exec(n);t&&t.indices&&t.indices[1]&&n.slice(t[0].length).trim()&&e.push([t.indices[1][0],t[1].trim()]);for(let s of n.matchAll(Kc)){let o=s.indices;o&&o[1]&&e.push([o[1][0],s[1].trim()]);}for(let s of n.matchAll(ed)){let o=s.indices;o&&o[1]&&e.push([o[1][0],s[1].trim()]);}let r=[],i=new Set;e.sort((s,o)=>s[0]-o[0]);for(let[s,o]of e)i.has(s)||(i.add(s),r.push(o));return r}g(td,"extract_terms_from_paragraph");function nd(n,e){let t=Object.create(null),r=new Set,i=Object.create(null),s=[];for(let p of qe(n)){if(!(p instanceof ie))continue;let m=Qc(p).trim();if(!m)continue;for(let b of td(m))t[b]?r.add(b):t[b]={count:0};let w=m.length>60?m.substring(0,60)+"...":m,y=R(p._element,"*");for(let b of y){if(b.tagName==="w:bookmarkStart"){let N=b.getAttribute("w:name");N&&(!N.startsWith("_")||N.startsWith("_Ref"))&&(i[N]||(i[N]={anchored_to:w,referenced_from:[]}));}let v=null;if(b.tagName==="w:fldSimple"){let k=(b.getAttribute("w:instr")||"").trim().split(/\s+/);k.length>1&&k[0]==="REF"&&(v=k[1]);}else if(b.tagName==="w:instrText"){let k=(b.textContent||"").trim().split(/\s+/);k.length>1&&k[0]==="REF"&&(v=k[1]);}v&&s.push([v,w]);}}for(let[p,m]of s)i[p]&&i[p].referenced_from.push(m);let o=[],a=Object.keys(t);if(a.length>0){let p=a.sort((b,v)=>v.length-b.length),m=g(b=>b.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"escapeRegExp"),w=p.map(m).join("|"),y=new RegExp(`(?<!["\u201C])\\b(${w})\\b(?![\u201D"])`,"g");for(let b of e.matchAll(y)){let v=b[1];t[v]&&t[v].count++;}for(let b of a)t[b].count===0&&(delete t[b],r.has(b)||o.push(`[Warning] Unused Definition: '${b}' is defined but never used.`));}for(let p of r)o.push(`[Error] Duplicate Definition: '${p}' is defined multiple times.`);let l=new Set(["The","This","That","Such","A","An","Any","All","Some","No","Every","Each","As","In","Of","For","To","On","By","With"]),d=/\b[A-Z][a-zA-Z]*(?:\s+[A-Z][a-zA-Z]*)*\b/g,c=new Set(e.match(d)||[]),u=new Set(Object.keys(t)),f={};for(let p of u){let m=p[0].toLowerCase();f[m]||(f[m]=[]),f[m].push(p);}let h=Object.create(null);for(let p of c){let m=p.trim(),w=m.split(/\s+/);for(;w.length>0;){let v=w[0],N=v.charAt(0).toUpperCase()+v.slice(1).toLowerCase();if(l.has(N))w.shift();else break}if(m=w.join(" "),m.length<4||u.has(m))continue;let y=m[0].toLowerCase(),b=f[y]||[];if(m.length>5)for(let[v,N]of Object.entries(f))v!==y&&(b=b.concat(N));for(let v of b){if(Math.abs(m.length-v.length)>2||m===v+"s"||m===v+"es"||v===m+"s"||v===m+"es")continue;let N=Vc(m,v,2);N===0||N>2||v.length<=5&&(N>1||m[0].toLowerCase()!==v[0].toLowerCase())||(h[v]||(h[v]=[]),h[v].includes(m)||h[v].push(m));}}for(let[p,m]of Object.entries(h)){m.sort();let w=m.map(y=>`'${y}'`).join(", ");o.push(`[Info] Possible Typos for '${p}': Found ${w}`);}function _(p){return p.startsWith("[Error]")?0:p.startsWith("[Warning]")?1:2}return g(_,"diag_sort_key"),o.sort((p,m)=>{let w=_(p),y=_(m);return w!==y?w-y:p.localeCompare(m)}),[t,o,i]}g(nd,"extract_all_domain_metadata");function rd(n){let e=[],t=n.pkg.getPartByPath("word/settings.xml");if(!t)return e;let r=g(o=>{if(!o.hasAttribute("w:val"))return true;let a=(o.getAttribute("w:val")||"").toLowerCase();return a!=="0"&&a!=="false"&&a!=="off"},"isTruthy2"),i=ne(t._element,"removePersonalInformation");i.length>0&&r(i[0])&&e.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 s=ne(t._element,"removeDateAndTime");return s.length>0&&r(s[0])&&e.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."),e}g(rd,"extract_document_settings_warnings");function id(n,e){try{let t=Od(n),r=Nn(n);return jd(t,r,'Read with mode="fields" for the full field ledger.')}catch{return []}}g(id,"content_controls_appendix_section");function sd(n,e){let[t,r,i]=nd(n,e),s=rd(n),o=[`
|
|
97
97
|
|
|
98
98
|
---`,"","<!-- 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."],a=false;if(s.length>0){a=true,o.push(`
|
|
99
99
|
## Document Settings`);for(let d of s)o.push(`- ${d}`);}let l=id(n);if(l.length>0&&(a=true,o.push(""),o.push(...l)),Object.keys(t).length>0){a=true,o.push(`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "n8n-nodes-adeu",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0",
|
|
4
4
|
"description": "n8n community node for Adeu — apply AI-driven tracked changes, generate diffs, and sanitize Microsoft Word (.docx) documents.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"n8n-community-node-package",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"n8n-workflow": "*"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
|
-
"@adeu/core": "^
|
|
52
|
+
"@adeu/core": "^4.0.0",
|
|
53
53
|
"@n8n/eslint-plugin-community-nodes": "^0.36.0",
|
|
54
54
|
"@types/node": "^26.6.5",
|
|
55
55
|
"@typescript-eslint/parser": "^8.71.2",
|