n8n-nodes-adeu 3.0.0 → 3.0.1
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.
|
@@ -82,7 +82,7 @@ ${l}`:l);}else o=[...r];let s=o.length;return {pages:o.map((l,u)=>({page:u+1,tot
|
|
|
82
82
|
${u}`,l++;else break}e.push([a,i]),n=l;}return e}g(vl,"_merge_footnote_sections");function bl(t){if(!t.length)return [[""],[0]];let e=[],n=[],r=[],i=0,o=-1,s=g(()=>{r.length>0&&(e.push(r.join(`
|
|
83
83
|
|
|
84
84
|
`)),n.push(o)),r=[],i=0,o=-1;},"flush_current");for(let[a,l,u]of t){let c=a.length,d=c+(r.length>0?2:0);if(r.length>0&&i+d>Qr&&s(),r.length===0&&c>Qr){e.push(a),n.push(l);continue}r.length===0&&(o=l),r.push(a),i+=i>0?d:c,u&&s();}return s(),e.length?[e,n]:[[""],[0]]}g(bl,"_assemble_pages");function Zr(t){let e=[...t.matchAll(gl)];return new Set(e.map(r=>r[1])).size}g(Zr,"_count_tracked_changes");var xl=5,Kr=50;function Nl(t,e,n,r){let i=r.length;if(i<2)throw new Error(`format_ambiguity_error requires at least 2 matches, got ${i}`);let o=r.slice(0,xl),s=i-o.length,a=[`- Edit ${t} Failed: Ambiguous match. Target text appears ${i} times. First ${o.length} occurrences:`];for(let l=0;l<o.length;l++){let[u,c]=o[l],d=Math.max(0,u-Kr),f=Math.min(n.length,c+Kr),h=n.substring(d,u).replace(/\n/g," "),_=n.substring(c,f).replace(/\n/g," "),p=n.substring(u,c).replace(/\n/g," ");p.length>50&&(p=p.substring(0,25)+"..."+p.substring(p.length-20));let m=d>0?"...":"",w=f<n.length?"...":"";a.push(` ${l+1}. "${m}${h}[${p}]${_}${w}"`);}return s>0&&a.push(` ... and ${s} 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(`
|
|
85
|
-
`)}g(Nl,"format_ambiguity_error");var kl="3.0.0";function K(t,e){let n=[],r=t.getElementsByTagName("*");for(let i=0;i<r.length;i++){let o=r[i].tagName;(o===e||o.endsWith(":"+e))&&n.push(r[i]);}return n}g(K,"findDescendantsByLocalName");function El(t){let e=0;function n(s,a){let l=s?s.toString():"",u=a?a.toString():"";return l===u}g(n,"areRunsIdentical");function r(s){let a=["w:t","w:tab","w:br","w:cr","w:delText","w:rPr"];for(let l=0;l<s.childNodes.length;l++){let u=s.childNodes[l];if(u.nodeType===1){let c=u.tagName;if(!a.includes(c))return true}}return false}g(r,"hasSpecialContent");function i(s){let a=Array.from(s.childNodes).filter(u=>u.nodeType===1),l=0;for(;l<a.length-1;){let u=a[l],c=a[l+1];if(u.tagName==="w:r"&&c.tagName==="w:r"&&!r(u)&&!r(c)){let d=O(u,"w:rPr"),f=O(c,"w:rPr");if(n(d,f)){let h=null;for(let p=0;p<u.childNodes.length;p++){let m=u.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||"",v=m+w;h.textContent=v,v.trim()!==v&&h.setAttribute("xml:space","preserve");}else u.appendChild(p),(p.tagName==="w:t"||p.tagName==="w:delText")&&(h=p);s.removeChild(c),a.splice(l+1,1),e++;continue}}["w:ins","w:del","w:hyperlink","w:sdt","w:smartTag","w:fldSimple","w:sdtContent"].includes(u.tagName)&&i(u),l++;}if(a.length>0){let u=a[a.length-1];["w:ins","w:del","w:hyperlink","w:sdt","w:smartTag","w:fldSimple","w:sdtContent"].includes(u.tagName)&&i(u);}}g(i,"coalesceContainer");let o=R(t.element,"w:p");for(let s of o)i(s);return e?[`Adjacent identical runs coalesced: ${e}`]:[]}g(El,"coalesce_runs");function Al(t){let e=0,n=["w:rsidR","w:rsidRPr","w:rsidRDefault","w:rsidP","w:rsidDel","w:rsidSect","w:rsidTr"],r=t.element.getElementsByTagName("*");for(let o=0;o<r.length;o++)for(let s of n)r[o].hasAttribute(s)&&(r[o].removeAttribute(s),e++);let i=R(t.element,"w:rsids");for(let o of i)o.parentNode&&(o.parentNode.removeChild(o),e++);return e?[`rsid attributes: ${e} removed`]:[]}g(Al,"strip_rsid");function Cl(t){let e=0,n=["w14:paraId","w14:textId"],r=t.element.getElementsByTagName("*");for(let i=0;i<r.length;i++)for(let o of n)r[i].hasAttribute(o)&&(r[i].removeAttribute(o),e++);return e?[`Paragraph/text IDs: ${e} removed`]:[]}g(Cl,"strip_para_ids");function Pl(t){let e=R(t.element,"w:proofErr");return e.forEach(n=>n.parentNode?.removeChild(n)),e.length?[`Spell check markers: ${e.length} removed`]:[]}g(Pl,"strip_proof_errors");function Tl(t){let e=0;for(let n of ["w:rPr","w:pPr"]){let r=R(t.element,n);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(Tl,"strip_empty_properties");function $l(t){let e=0,n=R(t.element,"w:rPr");for(let r of n)if(O(r,"w:vanish")||O(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($l,"strip_hidden_text");function ei(t){let e=R(t.element,"w:ins").length,n=R(t.element,"w:del").length,r=R(t.element,"w:rPrChange").length+R(t.element,"w:pPrChange").length+R(t.element,"w:sectPrChange").length;return [e,n,r]}g(ei,"count_tracked_changes");function Sl(t){let e=new Set;for(let n of ["w:ins","w:del","w:rPrChange","w:pPrChange","w:sectPrChange"])for(let r of R(t.element,n)){let i=r.getAttribute("w:author");i&&e.add(i);}return e}g(Sl,"get_track_change_authors");function ti(t){let e=[],n=R(t,"w:t");for(let i of n)i.textContent&&e.push(i.textContent);let r=R(t,"w:delText");for(let i of r)i.textContent&&e.push(i.textContent);return e.join("")}g(ti,"_getElementText");function Be(t,e=60){let n=t.replace(/\n/g," ").trim();return n.length<=e?n:n.substring(0,e-3)+"..."}g(Be,"_truncate");function ni(t){let e=t.parentNode;if(e&&e.tagName==="w:rPr"){let n=e.parentNode;if(n&&n.tagName==="w:pPr")return "(paragraph mark)"}return e&&e.tagName==="w:trPr"?"(table row)":"(no visible text)"}g(ni,"_describe_textless_revision");function Il(t){let e=[],n=R(t.element,"w:ins"),r=R(t.element,"w:del");for(let s of n){let a=ti(s).trim();a?e.push(` Accepted insertion: "${Be(a,60)}"`):e.push(` Accepted insertion: ${ni(s)}`);}for(let s of r){let a=ti(s).trim();a?e.push(` Accepted deletion of: "${Be(a,60)}"`):e.push(` Accepted deletion of: ${ni(s)}`);}new dn(t).accept_all_revisions();for(let s of ["w:rPrChange","w:pPrChange","w:sectPrChange"])for(let a of R(t.element,s))a.parentNode?.removeChild(a);let o=n.length+r.length;return o?[`Tracked changes auto-accepted: ${o}`].concat(e):[]}g(Il,"accept_all_tracked_changes");function jt(t){let e=Me(t.pkg),n=[],r=0,i=0;for(let[o,s]of Object.entries(e))s.resolved?i++:r++,n.push({id:o,...s});return {total:n.length,open:r,resolved:i,comments:n}}g(jt,"get_comments_summary");function Ol(t){let e=Me(t.pkg),n=Object.keys(e);if(n.length===0)return [];let r=[],i=new Et(t);for(let[l,u]of Object.entries(e)){let c=u.resolved?"[Resolved]":"[Open]";r.push(` ${c} "${Be(u.text||"",60)}" (${u.author||"Unknown"})`),i.deleteComment(l);}for(let l of ["w:commentRangeStart","w:commentRangeEnd"])for(let u of R(t.element,l))u.parentNode?.removeChild(u);let o=R(t.element,"w:commentReference");for(let l of o){let u=l.parentNode;u&&((u.tagName==="w:r"||u.tagName.endsWith(":r"))&&Array.from(u.childNodes).filter(d=>d.nodeType===1&&d.tagName!=="w:rPr"&&d.tagName!=="rPr").length<=1?u.parentNode?.removeChild(u):u.removeChild(l));}let s=Object.values(e).filter(l=>l.resolved).length,a=Object.values(e).filter(l=>!l.resolved).length;return [`Comments removed: ${n.length} (${s} resolved, ${a} open)`].concat(r)}g(Ol,"remove_all_comments");function Dl(t){let e=t.pkg,n=new Set;for(let i of e.parts)if(i.partname.toLowerCase().includes("comments")){n.add(i.partname);let o=i.partname.startsWith("/")?i.partname:"/"+i.partname,s=i.partname.startsWith("/")?i.partname.substring(1):i.partname;n.add(o),n.add(s);}if(n.size===0)return;for(let i of e.parts)if(i.partname.endsWith(".rels")){let o=R(i._element,"Relationship"),s=[];for(let a of o)if((a.getAttribute("Target")||"").toLowerCase().includes("comments")){s.push(a);let u=i.partname.replace("/_rels/","/").replace(".rels",""),c=e.getPartByPath(u);if(c){let d=a.getAttribute("Id");d&&c.rels.delete(d);}}for(let a of s)a.parentNode?.removeChild(a);}let r=e.getPartByPath("[Content_Types].xml");if(r){let i=R(r._element,"Override"),o=[];for(let s of i){let a=s.getAttribute("PartName")||"";(n.has(a)||a.toLowerCase().includes("comments"))&&o.push(s);}for(let s of o)s.parentNode?.removeChild(s);}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(Dl,"eject_comment_parts");function Rl(t,e){let n=new Et(t);if(!n.commentsPart)return [];let r=new Set,i=R(n.commentsPart._element,"w:comment");for(let o of i){let s=o.getAttribute("w:author");if(s&&(r.add(s),o.setAttribute("w:author",e)),o.hasAttribute("w:initials")){let a=e.split(" ").filter(Boolean).map(l=>l[0]).join("").toUpperCase();o.setAttribute("w:initials",a);}}return r.size?[`Comment authors replaced: ${Array.from(r).sort().join(", ")} \u2192 "${e}"`]:[]}g(Rl,"replace_comment_authors");function Ml(t,e){let n=new Set;for(let r of ["w:ins","w:del","w:rPrChange","w:pPrChange"])for(let i of R(t.element,r)){let o=i.getAttribute("w:author");o&&(n.add(o),i.setAttribute("w:author",e));}return n.size?[`Track change authors replaced: ${Array.from(n).sort().join(", ")} \u2192 "${e}"`]:[]}g(Ml,"replace_change_authors");function jl(t){let e=0,n="2025-01-01T00:00:00Z";for(let r of ["w:ins","w:del","w:rPrChange","w:pPrChange"])for(let i of R(t.element,r))i.hasAttribute("w:date")&&(i.setAttribute("w:date",n),e++);return e?[`Track change timestamps: ${e} normalized`]:[]}g(jl,"normalize_change_dates");function Bl(t){let e=0,n="2025-01-01T00:00:00Z";for(let r of t.pkg.parts)if(r.contentType.includes("comments")){for(let i of R(r._element,"w:comment"))i.hasAttribute("w:date")&&(i.setAttribute("w:date",n),e++);for(let i of R(r._element,"w16cex:commentExtensible"))i.hasAttribute("w16cex:dateUtc")&&(i.setAttribute("w16cex:dateUtc",n),e++);}return e?[`Comment timestamps: ${e} normalized`]:[]}g(Bl,"normalize_comment_dates");function Fl(t){let e=[],n=t.pkg.getPartByPath("docProps/core.xml");if(n){K(n._element,"creator").forEach(u=>{u.textContent&&(e.push(`Author: ${u.textContent}`),u.textContent="");}),K(n._element,"lastModifiedBy").forEach(u=>{u.textContent&&(e.push(`Last modified by: ${u.textContent}`),u.textContent="");}),K(n._element,"title").forEach(u=>{u.textContent&&e.push(`Title kept (review manually): "${u.textContent}"`);});let a=[["category","Category"],["keywords","Keywords"],["subject","Subject"],["contentStatus","Content status"],["description","Description/comments"],["identifier","Identifier"],["language","Language"],["version","Version"]];for(let[u,c]of a)K(n._element,u).forEach(d=>{d.textContent&&(e.push(`${c}: ${d.textContent}`),d.textContent="");});K(n._element,"revision").forEach(u=>{u.textContent&&parseInt(u.textContent)>1&&(e.push(`Revision count: ${u.textContent} \u2192 1`),u.textContent="1");});}let r=t.pkg.getPartByPath("docProps/app.xml");if(r){let i=r._element,o=["TotalTime","Words","Characters","Paragraphs","Lines","CharactersWithSpaces"];for(let a of o)K(i,a).forEach(l=>{l.textContent&&l.textContent!=="0"&&(a==="TotalTime"&&e.push(`Total editing time: ${l.textContent} minutes`),l.textContent="0");});let s=["Template","Manager","Company"];for(let a of s)K(i,a).forEach(l=>{l.textContent&&(e.push(`${a}: ${l.textContent}`),l.textContent="");});}return e.length?["Metadata scrubbed:",...e.map(i=>` ${i}`)]:[]}g(Fl,"scrub_doc_properties");function Wl(t){let e=false,n="1970-01-01T00:00:00Z",r=t.pkg.getPartByPath("docProps/core.xml");if(r)for(let i of ["created","modified","lastPrinted"])K(r._element,i).forEach(o=>{o.textContent&&o.textContent!==n&&(o.textContent=n,e=true);});return e?["Timestamps normalized to epoch"]:[]}g(Wl,"scrub_timestamps");function po(t,e,n){let r=t.pkg,i=g(s=>s.startsWith("/")?s.substring(1):s,"normalized");for(let s of r.parts){if(!s.partname.endsWith(".rels"))continue;let a=[];for(let l of R(s._element,"Relationship")){let u=l.getAttribute("Target")||"";if(n(u)){a.push(l);let c=s.partname.replace("/_rels/","/").replace(".rels",""),d=r.getPartByPath(c);if(d){let f=l.getAttribute("Id");f&&d.rels.delete(f);}}}a.forEach(l=>l.parentNode?.removeChild(l));}let o=r.getPartByPath("[Content_Types].xml");if(o){let s=[];for(let a of R(o._element,"Override")){let l=a.getAttribute("PartName")||"";e(i(l))&&s.push(a);}s.forEach(a=>a.parentNode?.removeChild(a));}r.parts=r.parts.filter(s=>!e(i(s.partname)));for(let s of Object.keys(r.unzipped))e(i(s))&&delete r.unzipped[s];}g(po,"ejectPackageMembers");function Ll(t){let e=g(i=>i.startsWith("customXml/"),"isCustomXml"),n=t.pkg.parts.filter(i=>e(i.partname.startsWith("/")?i.partname.substring(1):i.partname)),r=Object.keys(t.pkg.unzipped).filter(e);if(n.length===0&&r.length===0)return [];po(t,e,i=>i.includes("customXml"));for(let i of R(t.element,"w:sdtPr"))Vn(i,"w:dataBinding").forEach(o=>i.removeChild(o));return [`Custom XML parts: ${Math.max(n.length,r.length)} removed`]}g(Ll,"strip_custom_xml");var Dn="docProps/custom.xml";function zl(t){let e=t.pkg.getPartByPath(Dn),n=Object.keys(t.pkg.unzipped).includes(Dn);if(!e&&!n)return [];let r=[];if(e)for(let o of K(e._element,"property")){let s=o.getAttribute("name")||"(unnamed)",a=(o.textContent||"").trim();r.push(` Custom property removed: ${s} = "${Be(a,60)}"`);}return po(t,o=>o===Dn,o=>o.includes("docProps/custom.xml")),[`Custom document properties: ${Math.max(r.length,1)} removed (docProps/custom.xml)`].concat(r)}g(zl,"strip_custom_properties");function Ul(t){let e=t.pkg.getPartByPath("word/settings.xml");if(!e)return [];let n=[],r=false;for(let o of K(e._element,"docVars")){for(let s of Array.from(o.childNodes)){let a=s,l=a.tagName||"";(l==="docVar"||l.endsWith(":docVar"))&&n.push(a.getAttribute("w:name")||a.getAttribute("name")||"(unnamed)");}o.parentNode?.removeChild(o),r=true;}for(let o of K(e._element,"docVar"))n.push(o.getAttribute("w:name")||o.getAttribute("name")||"(unnamed)"),o.parentNode?.removeChild(o),r=true;if(!r)return [];let i=Array.from(new Set(n)).sort().join(", ")||"(unnamed)";return [`Document variables: ${n.length} removed (${i})`]}g(Ul,"strip_document_variables");function Hl(t){let e=0;for(let n of K(t.element,"docPr")){let r=n.getAttribute("descr");if(r){let i=r.length<10,o=r.includes(".")&&r.length<60;(i||o)&&(n.removeAttribute("descr"),e++);}}return e?[`Image alt text: ${e} auto-generated descriptions removed`]:[]}g(Hl,"strip_image_alt_text");function Xl(t){let e=[],n=new Set;for(let r of t.pkg.parts){let i=String(r.partname),o;if(i.startsWith("/word/header"))o="header";else if(i.startsWith("/word/footer"))o="footer";else if(i==="/word/document.xml")o="body";else continue;let s;try{s=K(r._element,"textpath");}catch{continue}for(let a of s){let l=(a.getAttribute("string")||"").trim(),u=`${o}${l}`;if(n.has(u))continue;n.add(u);let c=l?`"${Be(l,60)}"`:"(no text)";e.push(`Watermark-like text object in ${o}: ${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(Xl,"detect_watermarks");function ql(t){let e=["sharepoint.com","onedrive.com",".internal","intranet","localhost","10.","192.168.","172.16."],n=[],r=t.pkg.getOrCreateRelsPart(t.part.partname);for(let i of R(r._element,"Relationship"))if(i.getAttribute("TargetMode")==="External"){let o=i.getAttribute("Target")||"";for(let s of e)if(o.toLowerCase().includes(s.toLowerCase())){n.push(`Hyperlink targets internal URL: ${Be(o,80)}`);break}}return n}g(ql,"audit_hyperlinks");var Gl="word/settings.xml",Jl=new Set(["readOnly","forms","comments","trackedChanges"]),Yl={readOnly:"read-only",forms:"fill-in-forms",comments:"comments-only",trackedChanges:"tracked-changes-only"},yt=Object.freeze({edit:null,enforced:false});function sn(t){return t.edit!==null&&t.enforced}g(sn,"isProtectionActive");function cr(t){return t.edit===null?"unprotected":`${Yl[t.edit]??t.edit}, ${t.enforced?"enforced":"not enforced"}`}g(cr,"describeProtection");function Ql(t){return t==null?true:!["0","false","off"].includes(t.toLowerCase())}g(Ql,"isTruthy");function _o(t){let e=null;try{let o=t?.pkg?.getPartByPath?.(Gl);if(!o?._element)return yt;e=K(o._element,"documentProtection")[0]??null;}catch{return yt}if(!e)return yt;let n=null,r=null,i=e.attributes;if(i)for(let o=0;o<i.length;o++){let s=i[o],a=(s.name??"").split(":").pop()??"";a==="edit"?n=s.value:a==="enforcement"&&(r=s.value);}return n===null||!Jl.has(n)?yt:{edit:n,enforced:Ql(r)}}g(_o,"readDocumentProtection");var an="ignore_control_locks",bt="ignore_document_protection",ur="allow_untracked_writes",Je=Object.freeze({ignore_control_locks:false,ignore_document_protection:false,allow_untracked_writes:false});function Vl(t){return t.ignore_control_locks||t.ignore_document_protection||t.allow_untracked_writes}g(Vl,"anyOverrideUsed");function he(t){let e=[`CC:${t.ordinal}`];return t.alias&&e.push(`"${t.alias}"`),t.tag&&e.push(`(tag: ${t.tag})`),e.join(" ")}g(he,"describeControl");function fe(t,e){let n=`- Edit ${t} Failed: ${e.subject} ${e.rule} ${Zl(e.alternative)}`;return e.override&&(n+=` Pass ${e.override}=true to override deliberately.`),n.split(/\s+/).join(" ")}g(fe,"gateError");function Zl(t){let e=t.replace(/\s+$/,"");return /[.!?:]$/.test(e)?e:`${e}.`}g(Zl,"endSentence");function Kl(t){return t.find(e=>e.contentLocked)??null}g(Kl,"lockedAncestor");function ec(t,e,n=Je){if(n.ignore_control_locks)return null;let r=Kl(e);return r?fe(t,{subject:`edit targets content inside ${he(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:an}):null}g(ec,"checkContentLock");function tc(t,e,n=Je){if(n.ignore_control_locks)return null;let r=e.find(i=>i.cls==="group");return !r||e.some(i=>i.cls!=="group")?null:fe(t,{subject:`edit targets text inside ${he(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:an})}g(tc,"checkGroupRegion");function nc(t,e,n,r=Je){if(r.ignore_control_locks||!n)return null;let i=e.find(o=>o.deleteLocked);return i?fe(t,{subject:`edit would remove ${he(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:an}):null}g(nc,"checkDeleteLock");function rc(t,e,n={}){let r=n.overrides??Je;if(!sn(e)||r.ignore_document_protection)return null;let i=cr(e);return e.edit==="readOnly"?fe(t,{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:bt}):e.edit==="comments"?n.isCommentOnly?null:fe(t,{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:bt}):e.edit==="forms"?(n.controls??[]).some(s=>s.cls!=="group")?null:fe(t,{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:bt}):null}g(rc,"checkProtectionBlocksEdit");function ic(t,e,n,r=Je){if(!sn(n)||r.ignore_document_protection||e!=="accept"&&e!=="reject"||n.edit!=="trackedChanges"&&n.edit!=="readOnly")return null;let i=n.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 ${t} Failed: the document is protected (${cr(n)}). ${i} Remove the restriction in Word (Review -> Restrict Editing -> Stop Protection) or pass ${bt}=true to override deliberately.`}g(ic,"checkProtectionBlocksReview");function oc(t,e,n=Je){return !sn(e)||e.edit!=="forms"||n.allow_untracked_writes?null:fe(t,{subject:`the document is protected (${cr(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:ur})}g(oc,"checkUntrackedWrite");function sc(t,e,n){let r=(e||"").trim();if(!r)return null;for(let i of n){if(!i.showingPlaceholder)continue;let o=(i.placeholderText||"").trim();if(!(!o||!o.includes(r)))return fe(t,{subject:`target_text is the placeholder text of ${he(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(sc,"checkPlaceholderTarget");var vt=["[ ]","[x]"];function ac(t,e,n,r){let i=e.find(s=>s.cls==="checkbox");if(!i)return null;let o=vt;return o.includes(n.trim())&&o.includes(r.trim())?null:fe(t,{subject:`edit targets ${he(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(ac,"checkCheckboxEdit");function lc(t,e){let n=e.find(i=>i.bound);if(!n)return null;let r=n.bindingXpath?` (bound to ${n.bindingXpath})`:"";return fe(t,{subject:`edit targets the content of ${he(n)}, 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(lc,"checkBoundControl");function ri(t,e,n){let r=new Set(e),i=new Set(n);return t.filter(o=>r.has(o)!==i.has(o))}g(ri,"crossedControlWalls");function cc(t,e){if(e.length===0)return null;let n=e.map(he).join(", ");return fe(t,{subject:`edit merges paragraphs across the boundary of ${n}.`,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(cc,"checkBlockMergeAcrossControl");function uc(t){return `segmented at the boundary of ${t.map(he).join(", ")}: only the text outside the control was changed`}g(uc,"segmentationNote");function dc(t,e){if(!Vl(t))return null;let n=[];if(t.ignore_control_locks){let r=e.length>0?` (${e.map(he).join(", ")} edited inside locked controls)`:"";n.push(`${an}${r}`);}return t.ignore_document_protection&&n.push(bt),t.allow_untracked_writes&&n.push(ur),"Overrides: "+n.join(", ")}g(dc,"overridesNote");function fc(t,e,n=2){if(t===e)return 0;if(Math.abs(t.length-e.length)>n)return n+1;if(t.length===0)return e.length<=n?e.length:n+1;if(e.length===0)return t.length<=n?t.length:n+1;if(t.length>e.length){let i=t;t=e,e=i;}let r=Array.from({length:t.length+1},(i,o)=>o);for(let i=1;i<=e.length;i++){let o=[i],s=i;for(let a=1;a<=t.length;a++){let l=t[a-1]===e[i-1]?0:1,u=Math.min(r[a]+1,o[a-1]+1,r[a-1]+l);o.push(u),u<s&&(s=u);}if(s>n)return n+1;r=o;}return r[t.length]<=n?r[t.length]:n+1}g(fc,"boundedLevenshtein");function hc(t){let e="",n=R(t._element,"w:r");for(let r of n)e+=Pe(new Re(r,t));return e}g(hc,"_get_paragraph_text");var dr="[A-Z][A-Za-z0-9\\s\\-&'\u2019]{1,60}",pc=new RegExp(`^(?:[\\d.\\-()a-zA-Z]+\\s*)?["\u201C](${dr})["\u201D]`,"d"),_c=new RegExp(`(?<=[.;:!?])\\s+(?:[\\d.\\-()a-zA-Z]+\\s+)?["\u201C](${dr})["\u201D]`,"dg"),mc=new RegExp(`\\([^)]*?["\u201C](${dr})["\u201D][^)]*?\\)`,"dg");function gc(t){let e=[],n=pc.exec(t);n&&n.indices&&n.indices[1]&&e.push([n.indices[1][0],n[1].trim()]);for(let o of t.matchAll(_c)){let s=o.indices;s&&s[1]&&e.push([s[1][0],o[1].trim()]);}for(let o of t.matchAll(mc)){let s=o.indices;s&&s[1]&&e.push([s[1][0],o[1].trim()]);}let r=[],i=new Set;e.sort((o,s)=>o[0]-s[0]);for(let[o,s]of e)i.has(o)||(i.add(o),r.push(s));return r}g(gc,"extract_terms_from_paragraph");function wc(t,e){let n={},r=new Set,i={},o=[];for(let p of Le(t)){if(!(p instanceof ne))continue;let m=hc(p).trim();if(!m)continue;for(let b of gc(m))n[b]?r.add(b):n[b]={count:0};let w=m.length>60?m.substring(0,60)+"...":m,v=R(p._element,"*");for(let b of v){if(b.tagName==="w:bookmarkStart"){let x=b.getAttribute("w:name");x&&(!x.startsWith("_")||x.startsWith("_Ref"))&&(i[x]||(i[x]={anchored_to:w,referenced_from:[]}));}let y=null;if(b.tagName==="w:fldSimple"){let k=(b.getAttribute("w:instr")||"").trim().split(/\s+/);k.length>1&&k[0]==="REF"&&(y=k[1]);}else if(b.tagName==="w:instrText"){let k=(b.textContent||"").trim().split(/\s+/);k.length>1&&k[0]==="REF"&&(y=k[1]);}y&&o.push([y,w]);}}for(let[p,m]of o)i[p]&&i[p].referenced_from.push(m);let s=[],a=Object.keys(n);if(a.length>0){let p=a.sort((b,y)=>y.length-b.length),m=g(b=>b.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"escapeRegExp"),w=p.map(m).join("|"),v=new RegExp(`(?<!["\u201C])\\b(${w})\\b(?![\u201D"])`,"g");for(let b of e.matchAll(v)){let y=b[1];n[y]&&n[y].count++;}for(let b of a)n[b].count===0&&(delete n[b],r.has(b)||s.push(`[Warning] Unused Definition: '${b}' is defined but never used.`));}for(let p of r)s.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"]),u=/\b[A-Z][a-zA-Z]*(?:\s+[A-Z][a-zA-Z]*)*\b/g,c=new Set(e.match(u)||[]),d=new Set(Object.keys(n)),f={};for(let p of d){let m=p[0].toLowerCase();f[m]||(f[m]=[]),f[m].push(p);}let h={};for(let p of c){let m=p.trim(),w=m.split(/\s+/);for(;w.length>0;){let y=w[0],x=y.charAt(0).toUpperCase()+y.slice(1).toLowerCase();if(l.has(x))w.shift();else break}if(m=w.join(" "),m.length<4||d.has(m))continue;let v=m[0].toLowerCase(),b=f[v]||[];if(m.length>5)for(let[y,x]of Object.entries(f))y!==v&&(b=b.concat(x));for(let y of b){if(Math.abs(m.length-y.length)>2||m===y+"s"||m===y+"es"||y===m+"s"||y===m+"es")continue;let x=fc(m,y,2);x===0||x>2||y.length<=5&&(x>1||m[0].toLowerCase()!==y[0].toLowerCase())||(h[y]||(h[y]=[]),h[y].includes(m)||h[y].push(m));}}for(let[p,m]of Object.entries(h)){m.sort();let w=m.map(v=>`'${v}'`).join(", ");s.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"),s.sort((p,m)=>{let w=_(p),v=_(m);return w!==v?w-v:p.localeCompare(m)}),[n,s,i]}g(wc,"extract_all_domain_metadata");function yc(t){let e=[],n=t.pkg.getPartByPath("word/settings.xml");if(!n)return e;let r=g(s=>{if(!s.hasAttribute("w:val"))return true;let a=(s.getAttribute("w:val")||"").toLowerCase();return a!=="0"&&a!=="false"&&a!=="off"},"isTruthy2"),i=K(n._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 o=K(n._element,"removeDateAndTime");return o.length>0&&r(o[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(yc,"extract_document_settings_warnings");function vc(t,e){try{let n=Hc(t),r=_o(t);return Gc(n,r,'Read with mode="fields" for the full field ledger.')}catch{return []}}g(vc,"content_controls_appendix_section");function bc(t,e){let[n,r,i]=wc(t,e),o=yc(t),s=[`
|
|
85
|
+
`)}g(Nl,"format_ambiguity_error");var kl="3.0.1";function K(t,e){let n=[],r=t.getElementsByTagName("*");for(let i=0;i<r.length;i++){let o=r[i].tagName;(o===e||o.endsWith(":"+e))&&n.push(r[i]);}return n}g(K,"findDescendantsByLocalName");function El(t){let e=0;function n(s,a){let l=s?s.toString():"",u=a?a.toString():"";return l===u}g(n,"areRunsIdentical");function r(s){let a=["w:t","w:tab","w:br","w:cr","w:delText","w:rPr"];for(let l=0;l<s.childNodes.length;l++){let u=s.childNodes[l];if(u.nodeType===1){let c=u.tagName;if(!a.includes(c))return true}}return false}g(r,"hasSpecialContent");function i(s){let a=Array.from(s.childNodes).filter(u=>u.nodeType===1),l=0;for(;l<a.length-1;){let u=a[l],c=a[l+1];if(u.tagName==="w:r"&&c.tagName==="w:r"&&!r(u)&&!r(c)){let d=O(u,"w:rPr"),f=O(c,"w:rPr");if(n(d,f)){let h=null;for(let p=0;p<u.childNodes.length;p++){let m=u.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||"",v=m+w;h.textContent=v,v.trim()!==v&&h.setAttribute("xml:space","preserve");}else u.appendChild(p),(p.tagName==="w:t"||p.tagName==="w:delText")&&(h=p);s.removeChild(c),a.splice(l+1,1),e++;continue}}["w:ins","w:del","w:hyperlink","w:sdt","w:smartTag","w:fldSimple","w:sdtContent"].includes(u.tagName)&&i(u),l++;}if(a.length>0){let u=a[a.length-1];["w:ins","w:del","w:hyperlink","w:sdt","w:smartTag","w:fldSimple","w:sdtContent"].includes(u.tagName)&&i(u);}}g(i,"coalesceContainer");let o=R(t.element,"w:p");for(let s of o)i(s);return e?[`Adjacent identical runs coalesced: ${e}`]:[]}g(El,"coalesce_runs");function Al(t){let e=0,n=["w:rsidR","w:rsidRPr","w:rsidRDefault","w:rsidP","w:rsidDel","w:rsidSect","w:rsidTr"],r=t.element.getElementsByTagName("*");for(let o=0;o<r.length;o++)for(let s of n)r[o].hasAttribute(s)&&(r[o].removeAttribute(s),e++);let i=R(t.element,"w:rsids");for(let o of i)o.parentNode&&(o.parentNode.removeChild(o),e++);return e?[`rsid attributes: ${e} removed`]:[]}g(Al,"strip_rsid");function Cl(t){let e=0,n=["w14:paraId","w14:textId"],r=t.element.getElementsByTagName("*");for(let i=0;i<r.length;i++)for(let o of n)r[i].hasAttribute(o)&&(r[i].removeAttribute(o),e++);return e?[`Paragraph/text IDs: ${e} removed`]:[]}g(Cl,"strip_para_ids");function Pl(t){let e=R(t.element,"w:proofErr");return e.forEach(n=>n.parentNode?.removeChild(n)),e.length?[`Spell check markers: ${e.length} removed`]:[]}g(Pl,"strip_proof_errors");function Tl(t){let e=0;for(let n of ["w:rPr","w:pPr"]){let r=R(t.element,n);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(Tl,"strip_empty_properties");function $l(t){let e=0,n=R(t.element,"w:rPr");for(let r of n)if(O(r,"w:vanish")||O(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($l,"strip_hidden_text");function ei(t){let e=R(t.element,"w:ins").length,n=R(t.element,"w:del").length,r=R(t.element,"w:rPrChange").length+R(t.element,"w:pPrChange").length+R(t.element,"w:sectPrChange").length;return [e,n,r]}g(ei,"count_tracked_changes");function Sl(t){let e=new Set;for(let n of ["w:ins","w:del","w:rPrChange","w:pPrChange","w:sectPrChange"])for(let r of R(t.element,n)){let i=r.getAttribute("w:author");i&&e.add(i);}return e}g(Sl,"get_track_change_authors");function ti(t){let e=[],n=R(t,"w:t");for(let i of n)i.textContent&&e.push(i.textContent);let r=R(t,"w:delText");for(let i of r)i.textContent&&e.push(i.textContent);return e.join("")}g(ti,"_getElementText");function Be(t,e=60){let n=t.replace(/\n/g," ").trim();return n.length<=e?n:n.substring(0,e-3)+"..."}g(Be,"_truncate");function ni(t){let e=t.parentNode;if(e&&e.tagName==="w:rPr"){let n=e.parentNode;if(n&&n.tagName==="w:pPr")return "(paragraph mark)"}return e&&e.tagName==="w:trPr"?"(table row)":"(no visible text)"}g(ni,"_describe_textless_revision");function Il(t){let e=[],n=R(t.element,"w:ins"),r=R(t.element,"w:del");for(let s of n){let a=ti(s).trim();a?e.push(` Accepted insertion: "${Be(a,60)}"`):e.push(` Accepted insertion: ${ni(s)}`);}for(let s of r){let a=ti(s).trim();a?e.push(` Accepted deletion of: "${Be(a,60)}"`):e.push(` Accepted deletion of: ${ni(s)}`);}new dn(t).accept_all_revisions();for(let s of ["w:rPrChange","w:pPrChange","w:sectPrChange"])for(let a of R(t.element,s))a.parentNode?.removeChild(a);let o=n.length+r.length;return o?[`Tracked changes auto-accepted: ${o}`].concat(e):[]}g(Il,"accept_all_tracked_changes");function jt(t){let e=Me(t.pkg),n=[],r=0,i=0;for(let[o,s]of Object.entries(e))s.resolved?i++:r++,n.push({id:o,...s});return {total:n.length,open:r,resolved:i,comments:n}}g(jt,"get_comments_summary");function Ol(t){let e=Me(t.pkg),n=Object.keys(e);if(n.length===0)return [];let r=[],i=new Et(t);for(let[l,u]of Object.entries(e)){let c=u.resolved?"[Resolved]":"[Open]";r.push(` ${c} "${Be(u.text||"",60)}" (${u.author||"Unknown"})`),i.deleteComment(l);}for(let l of ["w:commentRangeStart","w:commentRangeEnd"])for(let u of R(t.element,l))u.parentNode?.removeChild(u);let o=R(t.element,"w:commentReference");for(let l of o){let u=l.parentNode;u&&((u.tagName==="w:r"||u.tagName.endsWith(":r"))&&Array.from(u.childNodes).filter(d=>d.nodeType===1&&d.tagName!=="w:rPr"&&d.tagName!=="rPr").length<=1?u.parentNode?.removeChild(u):u.removeChild(l));}let s=Object.values(e).filter(l=>l.resolved).length,a=Object.values(e).filter(l=>!l.resolved).length;return [`Comments removed: ${n.length} (${s} resolved, ${a} open)`].concat(r)}g(Ol,"remove_all_comments");function Dl(t){let e=t.pkg,n=new Set;for(let i of e.parts)if(i.partname.toLowerCase().includes("comments")){n.add(i.partname);let o=i.partname.startsWith("/")?i.partname:"/"+i.partname,s=i.partname.startsWith("/")?i.partname.substring(1):i.partname;n.add(o),n.add(s);}if(n.size===0)return;for(let i of e.parts)if(i.partname.endsWith(".rels")){let o=R(i._element,"Relationship"),s=[];for(let a of o)if((a.getAttribute("Target")||"").toLowerCase().includes("comments")){s.push(a);let u=i.partname.replace("/_rels/","/").replace(".rels",""),c=e.getPartByPath(u);if(c){let d=a.getAttribute("Id");d&&c.rels.delete(d);}}for(let a of s)a.parentNode?.removeChild(a);}let r=e.getPartByPath("[Content_Types].xml");if(r){let i=R(r._element,"Override"),o=[];for(let s of i){let a=s.getAttribute("PartName")||"";(n.has(a)||a.toLowerCase().includes("comments"))&&o.push(s);}for(let s of o)s.parentNode?.removeChild(s);}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(Dl,"eject_comment_parts");function Rl(t,e){let n=new Et(t);if(!n.commentsPart)return [];let r=new Set,i=R(n.commentsPart._element,"w:comment");for(let o of i){let s=o.getAttribute("w:author");if(s&&(r.add(s),o.setAttribute("w:author",e)),o.hasAttribute("w:initials")){let a=e.split(" ").filter(Boolean).map(l=>l[0]).join("").toUpperCase();o.setAttribute("w:initials",a);}}return r.size?[`Comment authors replaced: ${Array.from(r).sort().join(", ")} \u2192 "${e}"`]:[]}g(Rl,"replace_comment_authors");function Ml(t,e){let n=new Set;for(let r of ["w:ins","w:del","w:rPrChange","w:pPrChange"])for(let i of R(t.element,r)){let o=i.getAttribute("w:author");o&&(n.add(o),i.setAttribute("w:author",e));}return n.size?[`Track change authors replaced: ${Array.from(n).sort().join(", ")} \u2192 "${e}"`]:[]}g(Ml,"replace_change_authors");function jl(t){let e=0,n="2025-01-01T00:00:00Z";for(let r of ["w:ins","w:del","w:rPrChange","w:pPrChange"])for(let i of R(t.element,r))i.hasAttribute("w:date")&&(i.setAttribute("w:date",n),e++);return e?[`Track change timestamps: ${e} normalized`]:[]}g(jl,"normalize_change_dates");function Bl(t){let e=0,n="2025-01-01T00:00:00Z";for(let r of t.pkg.parts)if(r.contentType.includes("comments")){for(let i of R(r._element,"w:comment"))i.hasAttribute("w:date")&&(i.setAttribute("w:date",n),e++);for(let i of R(r._element,"w16cex:commentExtensible"))i.hasAttribute("w16cex:dateUtc")&&(i.setAttribute("w16cex:dateUtc",n),e++);}return e?[`Comment timestamps: ${e} normalized`]:[]}g(Bl,"normalize_comment_dates");function Fl(t){let e=[],n=t.pkg.getPartByPath("docProps/core.xml");if(n){K(n._element,"creator").forEach(u=>{u.textContent&&(e.push(`Author: ${u.textContent}`),u.textContent="");}),K(n._element,"lastModifiedBy").forEach(u=>{u.textContent&&(e.push(`Last modified by: ${u.textContent}`),u.textContent="");}),K(n._element,"title").forEach(u=>{u.textContent&&e.push(`Title kept (review manually): "${u.textContent}"`);});let a=[["category","Category"],["keywords","Keywords"],["subject","Subject"],["contentStatus","Content status"],["description","Description/comments"],["identifier","Identifier"],["language","Language"],["version","Version"]];for(let[u,c]of a)K(n._element,u).forEach(d=>{d.textContent&&(e.push(`${c}: ${d.textContent}`),d.textContent="");});K(n._element,"revision").forEach(u=>{u.textContent&&parseInt(u.textContent)>1&&(e.push(`Revision count: ${u.textContent} \u2192 1`),u.textContent="1");});}let r=t.pkg.getPartByPath("docProps/app.xml");if(r){let i=r._element,o=["TotalTime","Words","Characters","Paragraphs","Lines","CharactersWithSpaces"];for(let a of o)K(i,a).forEach(l=>{l.textContent&&l.textContent!=="0"&&(a==="TotalTime"&&e.push(`Total editing time: ${l.textContent} minutes`),l.textContent="0");});let s=["Template","Manager","Company"];for(let a of s)K(i,a).forEach(l=>{l.textContent&&(e.push(`${a}: ${l.textContent}`),l.textContent="");});}return e.length?["Metadata scrubbed:",...e.map(i=>` ${i}`)]:[]}g(Fl,"scrub_doc_properties");function Wl(t){let e=false,n="1970-01-01T00:00:00Z",r=t.pkg.getPartByPath("docProps/core.xml");if(r)for(let i of ["created","modified","lastPrinted"])K(r._element,i).forEach(o=>{o.textContent&&o.textContent!==n&&(o.textContent=n,e=true);});return e?["Timestamps normalized to epoch"]:[]}g(Wl,"scrub_timestamps");function po(t,e,n){let r=t.pkg,i=g(s=>s.startsWith("/")?s.substring(1):s,"normalized");for(let s of r.parts){if(!s.partname.endsWith(".rels"))continue;let a=[];for(let l of R(s._element,"Relationship")){let u=l.getAttribute("Target")||"";if(n(u)){a.push(l);let c=s.partname.replace("/_rels/","/").replace(".rels",""),d=r.getPartByPath(c);if(d){let f=l.getAttribute("Id");f&&d.rels.delete(f);}}}a.forEach(l=>l.parentNode?.removeChild(l));}let o=r.getPartByPath("[Content_Types].xml");if(o){let s=[];for(let a of R(o._element,"Override")){let l=a.getAttribute("PartName")||"";e(i(l))&&s.push(a);}s.forEach(a=>a.parentNode?.removeChild(a));}r.parts=r.parts.filter(s=>!e(i(s.partname)));for(let s of Object.keys(r.unzipped))e(i(s))&&delete r.unzipped[s];}g(po,"ejectPackageMembers");function Ll(t){let e=g(i=>i.startsWith("customXml/"),"isCustomXml"),n=t.pkg.parts.filter(i=>e(i.partname.startsWith("/")?i.partname.substring(1):i.partname)),r=Object.keys(t.pkg.unzipped).filter(e);if(n.length===0&&r.length===0)return [];po(t,e,i=>i.includes("customXml"));for(let i of R(t.element,"w:sdtPr"))Vn(i,"w:dataBinding").forEach(o=>i.removeChild(o));return [`Custom XML parts: ${Math.max(n.length,r.length)} removed`]}g(Ll,"strip_custom_xml");var Dn="docProps/custom.xml";function zl(t){let e=t.pkg.getPartByPath(Dn),n=Object.keys(t.pkg.unzipped).includes(Dn);if(!e&&!n)return [];let r=[];if(e)for(let o of K(e._element,"property")){let s=o.getAttribute("name")||"(unnamed)",a=(o.textContent||"").trim();r.push(` Custom property removed: ${s} = "${Be(a,60)}"`);}return po(t,o=>o===Dn,o=>o.includes("docProps/custom.xml")),[`Custom document properties: ${Math.max(r.length,1)} removed (docProps/custom.xml)`].concat(r)}g(zl,"strip_custom_properties");function Ul(t){let e=t.pkg.getPartByPath("word/settings.xml");if(!e)return [];let n=[],r=false;for(let o of K(e._element,"docVars")){for(let s of Array.from(o.childNodes)){let a=s,l=a.tagName||"";(l==="docVar"||l.endsWith(":docVar"))&&n.push(a.getAttribute("w:name")||a.getAttribute("name")||"(unnamed)");}o.parentNode?.removeChild(o),r=true;}for(let o of K(e._element,"docVar"))n.push(o.getAttribute("w:name")||o.getAttribute("name")||"(unnamed)"),o.parentNode?.removeChild(o),r=true;if(!r)return [];let i=Array.from(new Set(n)).sort().join(", ")||"(unnamed)";return [`Document variables: ${n.length} removed (${i})`]}g(Ul,"strip_document_variables");function Hl(t){let e=0;for(let n of K(t.element,"docPr")){let r=n.getAttribute("descr");if(r){let i=r.length<10,o=r.includes(".")&&r.length<60;(i||o)&&(n.removeAttribute("descr"),e++);}}return e?[`Image alt text: ${e} auto-generated descriptions removed`]:[]}g(Hl,"strip_image_alt_text");function Xl(t){let e=[],n=new Set;for(let r of t.pkg.parts){let i=String(r.partname),o;if(i.startsWith("/word/header"))o="header";else if(i.startsWith("/word/footer"))o="footer";else if(i==="/word/document.xml")o="body";else continue;let s;try{s=K(r._element,"textpath");}catch{continue}for(let a of s){let l=(a.getAttribute("string")||"").trim(),u=`${o}${l}`;if(n.has(u))continue;n.add(u);let c=l?`"${Be(l,60)}"`:"(no text)";e.push(`Watermark-like text object in ${o}: ${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(Xl,"detect_watermarks");function ql(t){let e=["sharepoint.com","onedrive.com",".internal","intranet","localhost","10.","192.168.","172.16."],n=[],r=t.pkg.getOrCreateRelsPart(t.part.partname);for(let i of R(r._element,"Relationship"))if(i.getAttribute("TargetMode")==="External"){let o=i.getAttribute("Target")||"";for(let s of e)if(o.toLowerCase().includes(s.toLowerCase())){n.push(`Hyperlink targets internal URL: ${Be(o,80)}`);break}}return n}g(ql,"audit_hyperlinks");var Gl="word/settings.xml",Jl=new Set(["readOnly","forms","comments","trackedChanges"]),Yl={readOnly:"read-only",forms:"fill-in-forms",comments:"comments-only",trackedChanges:"tracked-changes-only"},yt=Object.freeze({edit:null,enforced:false});function sn(t){return t.edit!==null&&t.enforced}g(sn,"isProtectionActive");function cr(t){return t.edit===null?"unprotected":`${Yl[t.edit]??t.edit}, ${t.enforced?"enforced":"not enforced"}`}g(cr,"describeProtection");function Ql(t){return t==null?true:!["0","false","off"].includes(t.toLowerCase())}g(Ql,"isTruthy");function _o(t){let e=null;try{let o=t?.pkg?.getPartByPath?.(Gl);if(!o?._element)return yt;e=K(o._element,"documentProtection")[0]??null;}catch{return yt}if(!e)return yt;let n=null,r=null,i=e.attributes;if(i)for(let o=0;o<i.length;o++){let s=i[o],a=(s.name??"").split(":").pop()??"";a==="edit"?n=s.value:a==="enforcement"&&(r=s.value);}return n===null||!Jl.has(n)?yt:{edit:n,enforced:Ql(r)}}g(_o,"readDocumentProtection");var an="ignore_control_locks",bt="ignore_document_protection",ur="allow_untracked_writes",Je=Object.freeze({ignore_control_locks:false,ignore_document_protection:false,allow_untracked_writes:false});function Vl(t){return t.ignore_control_locks||t.ignore_document_protection||t.allow_untracked_writes}g(Vl,"anyOverrideUsed");function he(t){let e=[`CC:${t.ordinal}`];return t.alias&&e.push(`"${t.alias}"`),t.tag&&e.push(`(tag: ${t.tag})`),e.join(" ")}g(he,"describeControl");function fe(t,e){let n=`- Edit ${t} Failed: ${e.subject} ${e.rule} ${Zl(e.alternative)}`;return e.override&&(n+=` Pass ${e.override}=true to override deliberately.`),n.split(/\s+/).join(" ")}g(fe,"gateError");function Zl(t){let e=t.replace(/\s+$/,"");return /[.!?:]$/.test(e)?e:`${e}.`}g(Zl,"endSentence");function Kl(t){return t.find(e=>e.contentLocked)??null}g(Kl,"lockedAncestor");function ec(t,e,n=Je){if(n.ignore_control_locks)return null;let r=Kl(e);return r?fe(t,{subject:`edit targets content inside ${he(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:an}):null}g(ec,"checkContentLock");function tc(t,e,n=Je){if(n.ignore_control_locks)return null;let r=e.find(i=>i.cls==="group");return !r||e.some(i=>i.cls!=="group")?null:fe(t,{subject:`edit targets text inside ${he(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:an})}g(tc,"checkGroupRegion");function nc(t,e,n,r=Je){if(r.ignore_control_locks||!n)return null;let i=e.find(o=>o.deleteLocked);return i?fe(t,{subject:`edit would remove ${he(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:an}):null}g(nc,"checkDeleteLock");function rc(t,e,n={}){let r=n.overrides??Je;if(!sn(e)||r.ignore_document_protection)return null;let i=cr(e);return e.edit==="readOnly"?fe(t,{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:bt}):e.edit==="comments"?n.isCommentOnly?null:fe(t,{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:bt}):e.edit==="forms"?(n.controls??[]).some(s=>s.cls!=="group")?null:fe(t,{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:bt}):null}g(rc,"checkProtectionBlocksEdit");function ic(t,e,n,r=Je){if(!sn(n)||r.ignore_document_protection||e!=="accept"&&e!=="reject"||n.edit!=="trackedChanges"&&n.edit!=="readOnly")return null;let i=n.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 ${t} Failed: the document is protected (${cr(n)}). ${i} Remove the restriction in Word (Review -> Restrict Editing -> Stop Protection) or pass ${bt}=true to override deliberately.`}g(ic,"checkProtectionBlocksReview");function oc(t,e,n=Je){return !sn(e)||e.edit!=="forms"||n.allow_untracked_writes?null:fe(t,{subject:`the document is protected (${cr(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:ur})}g(oc,"checkUntrackedWrite");function sc(t,e,n){let r=(e||"").trim();if(!r)return null;for(let i of n){if(!i.showingPlaceholder)continue;let o=(i.placeholderText||"").trim();if(!(!o||!o.includes(r)))return fe(t,{subject:`target_text is the placeholder text of ${he(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(sc,"checkPlaceholderTarget");var vt=["[ ]","[x]"];function ac(t,e,n,r){let i=e.find(s=>s.cls==="checkbox");if(!i)return null;let o=vt;return o.includes(n.trim())&&o.includes(r.trim())?null:fe(t,{subject:`edit targets ${he(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(ac,"checkCheckboxEdit");function lc(t,e){let n=e.find(i=>i.bound);if(!n)return null;let r=n.bindingXpath?` (bound to ${n.bindingXpath})`:"";return fe(t,{subject:`edit targets the content of ${he(n)}, 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(lc,"checkBoundControl");function ri(t,e,n){let r=new Set(e),i=new Set(n);return t.filter(o=>r.has(o)!==i.has(o))}g(ri,"crossedControlWalls");function cc(t,e){if(e.length===0)return null;let n=e.map(he).join(", ");return fe(t,{subject:`edit merges paragraphs across the boundary of ${n}.`,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(cc,"checkBlockMergeAcrossControl");function uc(t){return `segmented at the boundary of ${t.map(he).join(", ")}: only the text outside the control was changed`}g(uc,"segmentationNote");function dc(t,e){if(!Vl(t))return null;let n=[];if(t.ignore_control_locks){let r=e.length>0?` (${e.map(he).join(", ")} edited inside locked controls)`:"";n.push(`${an}${r}`);}return t.ignore_document_protection&&n.push(bt),t.allow_untracked_writes&&n.push(ur),"Overrides: "+n.join(", ")}g(dc,"overridesNote");function fc(t,e,n=2){if(t===e)return 0;if(Math.abs(t.length-e.length)>n)return n+1;if(t.length===0)return e.length<=n?e.length:n+1;if(e.length===0)return t.length<=n?t.length:n+1;if(t.length>e.length){let i=t;t=e,e=i;}let r=Array.from({length:t.length+1},(i,o)=>o);for(let i=1;i<=e.length;i++){let o=[i],s=i;for(let a=1;a<=t.length;a++){let l=t[a-1]===e[i-1]?0:1,u=Math.min(r[a]+1,o[a-1]+1,r[a-1]+l);o.push(u),u<s&&(s=u);}if(s>n)return n+1;r=o;}return r[t.length]<=n?r[t.length]:n+1}g(fc,"boundedLevenshtein");function hc(t){let e="",n=R(t._element,"w:r");for(let r of n)e+=Pe(new Re(r,t));return e}g(hc,"_get_paragraph_text");var dr="[A-Z][A-Za-z0-9\\s\\-&'\u2019]{1,60}",pc=new RegExp(`^(?:[\\d.\\-()a-zA-Z]+\\s*)?["\u201C](${dr})["\u201D]`,"d"),_c=new RegExp(`(?<=[.;:!?])\\s+(?:[\\d.\\-()a-zA-Z]+\\s+)?["\u201C](${dr})["\u201D]`,"dg"),mc=new RegExp(`\\([^)]*?["\u201C](${dr})["\u201D][^)]*?\\)`,"dg");function gc(t){let e=[],n=pc.exec(t);n&&n.indices&&n.indices[1]&&e.push([n.indices[1][0],n[1].trim()]);for(let o of t.matchAll(_c)){let s=o.indices;s&&s[1]&&e.push([s[1][0],o[1].trim()]);}for(let o of t.matchAll(mc)){let s=o.indices;s&&s[1]&&e.push([s[1][0],o[1].trim()]);}let r=[],i=new Set;e.sort((o,s)=>o[0]-s[0]);for(let[o,s]of e)i.has(o)||(i.add(o),r.push(s));return r}g(gc,"extract_terms_from_paragraph");function wc(t,e){let n={},r=new Set,i={},o=[];for(let p of Le(t)){if(!(p instanceof ne))continue;let m=hc(p).trim();if(!m)continue;for(let b of gc(m))n[b]?r.add(b):n[b]={count:0};let w=m.length>60?m.substring(0,60)+"...":m,v=R(p._element,"*");for(let b of v){if(b.tagName==="w:bookmarkStart"){let x=b.getAttribute("w:name");x&&(!x.startsWith("_")||x.startsWith("_Ref"))&&(i[x]||(i[x]={anchored_to:w,referenced_from:[]}));}let y=null;if(b.tagName==="w:fldSimple"){let k=(b.getAttribute("w:instr")||"").trim().split(/\s+/);k.length>1&&k[0]==="REF"&&(y=k[1]);}else if(b.tagName==="w:instrText"){let k=(b.textContent||"").trim().split(/\s+/);k.length>1&&k[0]==="REF"&&(y=k[1]);}y&&o.push([y,w]);}}for(let[p,m]of o)i[p]&&i[p].referenced_from.push(m);let s=[],a=Object.keys(n);if(a.length>0){let p=a.sort((b,y)=>y.length-b.length),m=g(b=>b.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"escapeRegExp"),w=p.map(m).join("|"),v=new RegExp(`(?<!["\u201C])\\b(${w})\\b(?![\u201D"])`,"g");for(let b of e.matchAll(v)){let y=b[1];n[y]&&n[y].count++;}for(let b of a)n[b].count===0&&(delete n[b],r.has(b)||s.push(`[Warning] Unused Definition: '${b}' is defined but never used.`));}for(let p of r)s.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"]),u=/\b[A-Z][a-zA-Z]*(?:\s+[A-Z][a-zA-Z]*)*\b/g,c=new Set(e.match(u)||[]),d=new Set(Object.keys(n)),f={};for(let p of d){let m=p[0].toLowerCase();f[m]||(f[m]=[]),f[m].push(p);}let h={};for(let p of c){let m=p.trim(),w=m.split(/\s+/);for(;w.length>0;){let y=w[0],x=y.charAt(0).toUpperCase()+y.slice(1).toLowerCase();if(l.has(x))w.shift();else break}if(m=w.join(" "),m.length<4||d.has(m))continue;let v=m[0].toLowerCase(),b=f[v]||[];if(m.length>5)for(let[y,x]of Object.entries(f))y!==v&&(b=b.concat(x));for(let y of b){if(Math.abs(m.length-y.length)>2||m===y+"s"||m===y+"es"||y===m+"s"||y===m+"es")continue;let x=fc(m,y,2);x===0||x>2||y.length<=5&&(x>1||m[0].toLowerCase()!==y[0].toLowerCase())||(h[y]||(h[y]=[]),h[y].includes(m)||h[y].push(m));}}for(let[p,m]of Object.entries(h)){m.sort();let w=m.map(v=>`'${v}'`).join(", ");s.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"),s.sort((p,m)=>{let w=_(p),v=_(m);return w!==v?w-v:p.localeCompare(m)}),[n,s,i]}g(wc,"extract_all_domain_metadata");function yc(t){let e=[],n=t.pkg.getPartByPath("word/settings.xml");if(!n)return e;let r=g(s=>{if(!s.hasAttribute("w:val"))return true;let a=(s.getAttribute("w:val")||"").toLowerCase();return a!=="0"&&a!=="false"&&a!=="off"},"isTruthy2"),i=K(n._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 o=K(n._element,"removeDateAndTime");return o.length>0&&r(o[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(yc,"extract_document_settings_warnings");function vc(t,e){try{let n=Hc(t),r=_o(t);return Gc(n,r,'Read with mode="fields" for the full field ledger.')}catch{return []}}g(vc,"content_controls_appendix_section");function bc(t,e){let[n,r,i]=wc(t,e),o=yc(t),s=[`
|
|
86
86
|
|
|
87
87
|
---`,"","<!-- 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(o.length>0){a=true,s.push(`
|
|
88
88
|
## Document Settings`);for(let u of o)s.push(`- ${u}`);}let l=vc(t);if(l.length>0&&(a=true,s.push(""),s.push(...l)),Object.keys(n).length>0){a=true,s.push(`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "n8n-nodes-adeu",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.1",
|
|
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,15 +49,15 @@
|
|
|
49
49
|
"n8n-workflow": "*"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
|
-
"@adeu/core": "^3.0.
|
|
52
|
+
"@adeu/core": "^3.0.1",
|
|
53
53
|
"@n8n/eslint-plugin-community-nodes": "^0.29.0",
|
|
54
54
|
"@types/node": "^26.2.0",
|
|
55
55
|
"@typescript-eslint/parser": "^8.67.0",
|
|
56
56
|
"copyfiles": "^2.4.1",
|
|
57
|
-
"eslint": "^10.8.
|
|
58
|
-
"n8n-workflow": "^2.
|
|
57
|
+
"eslint": "^10.8.1",
|
|
58
|
+
"n8n-workflow": "^2.36.2",
|
|
59
59
|
"tsup": "^8.5.1",
|
|
60
60
|
"typescript": "~6.0.3",
|
|
61
|
-
"vitest": "^4.1.
|
|
61
|
+
"vitest": "^4.1.11"
|
|
62
62
|
}
|
|
63
63
|
}
|