n8n-nodes-adeu 1.13.0 → 1.14.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.
@@ -52,7 +52,7 @@ ${e.note_type==="fn"?"## Footnotes":"## Endnotes"}`;this._add_virtual_text(f,r,n
52
52
 
53
53
  `);_.length>=2&&_[0].trim()!==""&&_[_.length-1].trim()!==""&&t.push(`- Edit ${r+1} Failed: target_text spans a paragraph boundary with body text on both sides. The paragraph break is a structural element, not literal text, so it cannot be replaced as a single span without corrupting the document. Split this into one edit per paragraph.`);}else {let _=g.split(`
54
54
 
55
- `);_.length>=2&&_[0].trim()!==""&&_[_.length-1].trim()!==""&&t.push(`- Edit ${r+1} Failed: target_text spans a paragraph boundary with body text on both sides. The paragraph break is a structural element, not literal text, so it cannot be replaced as a single span without corrupting the document. Split this into one edit per paragraph.`);}}for(let[s,f]of o){let c=this.mapper.spans.filter(p=>p.end>s&&p.start<s+f),d=new Set;for(let p of c)if(p.ins_id){let m=S(this.doc.element,"w:ins").filter(g=>g.getAttribute("w:id")===p.ins_id);if(m.length>0){let g=m[0].getAttribute("w:author");g&&g!==this.author&&d.add(g);}}d.size>0&&t.push(`- Edit ${r+1} Failed: Modification targets an active insertion from another author (${Array.from(d).join(", ")}). Accept that change first or scope your edit outside of it.`);}}return t}validate_review_actions(e){let t=[];for(let r=0;r<e.length;r++){let n=e[r],o=n.type;if(o==="reply"){let i=n.target_id.replace("Com:",""),a=false,u=this.doc.pkg.parts.find(l=>l.contentType==="application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml");u&&(a=S(u._element,"w:comment").some(s=>s.getAttribute("w:id")===i)),a||t.push(`- Action ${r+1} Failed: Target comment ID ${n.target_id} not found.`);}else if(o==="accept"||o==="reject"){let i=n.target_id.replace("Chg:",""),a=S(this.doc.element,"w:ins").filter(l=>l.getAttribute("w:id")===i),u=S(this.doc.element,"w:del").filter(l=>l.getAttribute("w:id")===i);a.length===0&&u.length===0&&t.push(`- Action ${r+1} Failed: Target ID ${n.target_id} not found.`);}}return t}process_batch(e,t=false){if(t){let r=new Map;for(let n of this.doc.pkg.parts)n._element&&r.set(n,n._element.cloneNode(true));try{return this._process_batch_internal(e,!0)}finally{for(let[n,o]of r.entries()){let i=n._element.ownerDocument;i&&i.documentElement&&i.replaceChild(o,i.documentElement),n._element=o;}this.mapper=new kt(this.doc),this.comments_manager=new ir(this.doc),this.clean_mapper=null;}}else return this._process_batch_internal(e,false)}_process_batch_internal(e,t=false){this.skipped_details=[];let r=e.filter(s=>["accept","reject","reply"].includes(s.type)),n=e.filter(s=>!["accept","reject","reply"].includes(s.type));if(t){if(r.length>0){let s=this.validate_review_actions(r);if(s.length>0)throw new Pr(s)}}else {let s=[];if(r.length>0&&s.push(...this.validate_review_actions(r)),n.length>0&&s.push(...this.validate_edits(n)),s.length>0)throw new Pr(s)}let o=0,i=0;if(r.length>0){let s=this.apply_review_actions(r);if(o=s[0],i=s[1],i>0)throw new Pr(this.skipped_details);o>0&&(this.mapper._build_map(),this.clean_mapper&&this.clean_mapper._build_map());}let a=[],u=0,l=0;if(n.length>0)if(t)for(let s of n){let f=this.validate_edits([s]),c=this._check_punctuation_warning(s.target_text||"");if(f.length>0){l++,a.push({status:"failed",target_text:s.target_text||"",new_text:s.new_text||"",warning:c,error:f[0],critic_markup:null,clean_text:null});continue}if(this.apply_edits([s])[0]>0){u++;let m=this._build_edit_context_previews(s);a.push({status:"applied",target_text:s.target_text||"",new_text:s.new_text||"",warning:c,error:null,critic_markup:m[0],clean_text:m[1]});}else {l++;let m=this.skipped_details.length>0?this.skipped_details[this.skipped_details.length-1]:"Failed to apply edit";a.push({status:"failed",target_text:s.target_text||"",new_text:s.new_text||"",warning:c,error:m,critic_markup:null,clean_text:null});}}else {let s=this.validate_edits(n);if(s.length>0)throw new Pr(s);let f=n.map(d=>JSON.parse(JSON.stringify(d))),c=this.apply_edits(f);u=c[0],l=c[1];for(let d of f){let p=d._applied_status||false,m=d._error_msg||null,g=this._check_punctuation_warning(d.target_text||""),b=null,_=null;if(p){let v=this._build_edit_context_previews(d);b=v[0],_=v[1];}a.push({status:p?"applied":"failed",target_text:d.target_text||"",new_text:d.new_text||"",warning:g,error:m,critic_markup:b,clean_text:_});}}return {actions_applied:o,actions_skipped:i,edits_applied:u,edits_skipped:l,skipped_details:this.skipped_details,edits:a,engine:"node",version:"1.10.0"}}apply_edits(e){let t=0,r=0,n=[];for(let i of e)i._applied_status=false,i._error_msg=null;for(let i of e)if(i._resolved_start_idx!==void 0&&i._resolved_start_idx!==null)n.push([i,i.new_text||null]);else if(i._match_start_index!==void 0&&i._match_start_index!==null)i._resolved_start_idx=i._match_start_index,n.push([i,i.new_text||null]);else if(i.type==="insert_row"||i.type==="delete_row"){let a=this.mapper.find_all_match_indices(i.target_text);if(a.length===0&&(this.clean_mapper||(this.clean_mapper=new kt(this.doc,true)),a=this.clean_mapper.find_all_match_indices(i.target_text)),a.length>0)i._resolved_start_idx=a[0][0],n.push([i,null]);else {r++,i._applied_status=false;let l=`- Failed to locate row target: '${(i.target_text||"").trim().substring(0,40)}...'`;this.skipped_details.push(l),i._error_msg=l;}}else {let a=this._pre_resolve_heuristic_edit(i);if(a)if(Array.isArray(a))for(let u of a)u._resolved_start_idx=u._match_start_index,u._parent_edit_ref=i,(i._resolved_start_idx===void 0||i._resolved_start_idx===null)&&(i._resolved_start_idx=u._resolved_start_idx),i._resolved_proxy_edit||(i._resolved_proxy_edit=u),n.push([u,u.new_text]);else a._resolved_start_idx=a._match_start_index,a._parent_edit_ref=i,i._resolved_start_idx=a._resolved_start_idx,i._resolved_proxy_edit=a,n.push([a,a.new_text]);else {r++,i._applied_status=false;let s=`- Failed to apply edit targeting: '${(i.target_text||"insertion").trim().substring(0,40)}...'`;this.skipped_details.push(s),i._error_msg=s;}}n.sort((i,a)=>(a[0]._resolved_start_idx||0)-(i[0]._resolved_start_idx||0));let o=[];for(let[i,a]of n){let u=i._resolved_start_idx||0,l=u+(i.target_text?i.target_text.length:0);if(o.some(([c,d])=>u<d&&l>c)){r++;let p=`- Skipped overlapping edit targeting: '${(i.target_text||"insertion").trim().substring(0,40)}...'`;this.skipped_details.push(p),i._applied_status=false,i._error_msg=p;let m=i._parent_edit_ref;m&&(m._applied_status=false,m._error_msg=p);continue}let f=false;if(i.type==="modify"?f=this._apply_single_edit_indexed(i,a,false):(i.type==="insert_row"||i.type==="delete_row")&&(f=this._apply_table_edit(i,false)),f){t++,o.push([u,l]),i._applied_status=true;let c=i._parent_edit_ref;c&&(c._applied_status=true);}else {r++;let p=`- Failed to apply edit targeting: '${(i.target_text||"insertion").trim().substring(0,40)}...'`;this.skipped_details.push(p),i._applied_status=false,i._error_msg=p;let m=i._parent_edit_ref;m&&(m._applied_status||(m._applied_status=false,m._error_msg=p));}}return [t,r]}apply_review_actions(e){let t=0,r=0;for(let n of e){let o=n.type;if(o==="reply"){let s=n.target_id.replace("Com:",""),f=this.comments_manager.addComment(this.author,n.text,s);this._anchor_reply_comment(s,f),t++;continue}let i=n.target_id.replace("Chg:",""),a=S(this.doc.element,"w:ins").filter(s=>s.getAttribute("w:id")===i),u=S(this.doc.element,"w:del").filter(s=>s.getAttribute("w:id")===i),l=[...a,...u];if(l.length===0){r++,this.skipped_details.push(`- Failed to apply action: Target ID ${n.target_id} not found.`);continue}for(let s of l){let f=s.tagName==="w:ins",d=(s.parentNode?s.parentNode.tagName:"")==="w:trPr";if(o==="accept")if(f)if(this._clean_wrapping_comments(s),d)s.parentNode?.removeChild(s);else {for(;s.firstChild;)s.parentNode?.insertBefore(s.firstChild,s);s.parentNode?.removeChild(s);}else if(this._clean_wrapping_comments(s),this._delete_comments_in_element(s),d){let p=s.parentNode?.parentNode;p?.parentNode?.removeChild(p);}else s.parentNode?.removeChild(s);else if(o==="reject")if(f)if(this._clean_wrapping_comments(s),this._delete_comments_in_element(s),d){let p=s.parentNode?.parentNode;p?.parentNode?.removeChild(p);}else s.parentNode?.removeChild(s);else if(this._clean_wrapping_comments(s),d)s.parentNode?.removeChild(s);else {let p=Array.from(s.getElementsByTagName("w:delText"));for(let m of p){let g=m.ownerDocument.createElement("w:t");g.textContent=m.textContent,m.hasAttribute("xml:space")&&g.setAttribute("xml:space","preserve"),m.parentNode?.replaceChild(g,m);}for(;s.firstChild;)s.parentNode?.insertBefore(s.firstChild,s);s.parentNode?.removeChild(s);}}t++;}return [t,r]}_apply_table_edit(e,t){let r=e._resolved_start_idx!==void 0&&e._resolved_start_idx!==null?e._resolved_start_idx:e._match_start_index||0,[n,o]=this.mapper.get_insertion_anchor(r,t),i=null;if(n?i=n._element:o&&(i=o._element),!i)return false;let a=i;for(;a&&a.tagName!=="w:tr";)a=a.parentNode;if(!a)return false;if(e.type==="delete_row"){let u=O(a,"w:trPr");return u||(u=a.ownerDocument.createElement("w:trPr"),a.insertBefore(u,a.firstChild)),u.appendChild(this._create_track_change_tag("w:del")),true}else if(e.type==="insert_row"){let u=a.ownerDocument.createElement("w:tr"),l=a.ownerDocument.createElement("w:trPr");u.appendChild(l),l.appendChild(this._create_track_change_tag("w:ins"));for(let s of e.cells){let f=a.ownerDocument.createElement("w:tc"),c=a.ownerDocument.createElement("w:p"),d=a.ownerDocument.createElement("w:r"),p=a.ownerDocument.createElement("w:t");p.textContent=s,s.trim()!==s&&p.setAttribute("xml:space","preserve"),d.appendChild(p),c.appendChild(d),f.appendChild(c),u.appendChild(f);}return e.position==="above"?a.parentNode?.insertBefore(u,a):Pt(u,a),true}return false}_first_live_match(e){let t=this.mapper.find_all_match_indices(e);if(t.length<=1)return this.mapper.find_match_index(e);for(let[r,n]of t){let o=this.mapper.spans.filter(i=>i.run!==null&&i.end>r&&i.start<r+n);if(o.length===0)return [r,n];if(o.some(i=>!i.del_id))return [r,n]}return this.mapper.find_match_index(e)}_pre_resolve_heuristic_edit(e){if(!e.target_text)return null;let[t,r]=this._first_live_match(e.target_text),n=false;if(t===-1)if(this.clean_mapper||(this.clean_mapper=new kt(this.doc,true)),[t,r]=this.clean_mapper.find_match_index(e.target_text),t!==-1)n=true;else return null;let o=n?this.clean_mapper:this.mapper,i=e.new_text||"",a=this.mapper.full_text.substring(t,t+r);if(a===i||e.target_text===i)return {type:"modify",target_text:a,new_text:a,comment:e.comment,_match_start_index:t,_internal_op:"COMMENT_ONLY",_active_mapper_ref:o};let u="",l="",s="",f=t;if(i.startsWith(a))u="INSERTION",s=i.substring(a.length),f=t+r;else {let[c,d]=bn(a,i),p=a.length-d,m=i.length-d;l=a.substring(c,p),s=i.substring(c,m),f=t+c,!l&&s?u="INSERTION":l&&!s?u="DELETION":l&&s?u="MODIFICATION":u="COMMENT_ONLY";}return {type:"modify",target_text:l,new_text:s,comment:e.comment,_match_start_index:f,_internal_op:u,_active_mapper_ref:o}}_apply_single_edit_indexed(e,t,r){let n=e._internal_op,o=e._active_mapper_ref||this.mapper,i=e._resolved_start_idx!==void 0&&e._resolved_start_idx!==null?e._resolved_start_idx:e._match_start_index||0,a=e.target_text?e.target_text.length:0,u=["DELETION","MODIFICATION"].includes(n)?this._getNextId():null,l=["INSERTION","MODIFICATION"].includes(n)?this._getNextId():null;if(n==="COMMENT_ONLY"){let _=o.find_target_runs_by_index(i,a,r);if(_.length===0)return false;if(!e.comment)return true;let v=_[0]._element,E=_[_.length-1]._element,w=v;for(;w&&w.tagName!=="w:p";)w=w.parentNode;let D=E;for(;D&&D.tagName!=="w:p";)D=D.parentNode;if(!w||!D)return false;let y=h((N,B)=>{let x=N;for(;x.parentNode&&x.parentNode!==B;)x=x.parentNode;return x},"ascend_to_paragraph_child"),A=y(v,w),C=y(E,D);return w===D?this._attach_comment(w,A,C,e.comment):this._attach_comment_spanning(w,A,D,C,e.comment),true}if(n==="INSERTION"){let[_,v]=o.get_insertion_anchor(i,r);if(!_&&!v)return false;let E=e.new_text||"",w=/\n\s*$/.test(E),D=null;{let C=o.spans.filter(N=>N.paragraph!==null&&N.start===i);C.length>0&&C[0].paragraph&&(D=C[0].paragraph._element);}if(w&&D&&D.parentNode){let C=D.parentNode,N=this.doc.part._element.ownerDocument,B=E.split(/[\r\n]+/).filter(P=>P!==""),x=null,M=null,z=null;for(let P of B){let[G,$]=this._parse_markdown_style(P),R=N.createElement("w:p");if($)this._set_paragraph_style(R,$);else {let K=O(D,"w:pPr");K&&R.appendChild(K.cloneNode(true));}let j=O(R,"w:pPr");j||(j=N.createElement("w:pPr"),R.insertBefore(j,R.firstChild));let I=O(j,"w:rPr");I||(I=N.createElement("w:rPr"),j.appendChild(I)),I.appendChild(this._create_track_change_tag("w:ins","",l));let Q=this._build_tracked_ins_for_line(G,_,l,N);Q&&R.appendChild(Q),C.insertBefore(R,D),x||(x=R),M=R,z=Q;}if(x){if(e.comment&&M&&z){let P=h(($,R)=>{let j=$;for(;j.parentNode&&j.parentNode!==R;)j=j.parentNode;return j},"ascend"),G=S(x,"w:ins")[0]||x;this._attach_comment_spanning(x,P(G,x),M,P(z,M),e.comment);}return true}}let y=this._track_insert_multiline(e.new_text||"",_,v,l);if(!y.first_node)return false;if(y.first_node.tagName==="w:ins"&&(_?Pt(y.first_node,_._element):v&&v._element.appendChild(y.first_node)),e.comment){let C=h((N,B)=>{let x=N;for(;x.parentNode&&x.parentNode!==B;)x=x.parentNode;return x},"ascend_to_paragraph_child");if(y.last_p&&y.last_ins){let N=y.first_node;for(;N&&N.tagName!=="w:p";)N=N.parentNode;if(N){let B=y.first_node;y.first_node.tagName==="w:p"&&(B=S(y.first_node,"w:ins")[0]||y.first_node);let x=C(B,N),M=C(y.last_ins,y.last_p);this._attach_comment_spanning(N,x,y.last_p,M,e.comment);}}else {let N=y.first_node;for(;N&&N.tagName!=="w:p";)N=N.parentNode;if(N){let B=y.first_node;y.first_node.tagName==="w:p"&&(B=S(y.first_node,"w:ins")[0]||y.first_node);let x=C(B,N);this._attach_comment(N,x,x,e.comment);}}}return true}let s=o.find_target_runs_by_index(i,a,r),f=o.get_virtual_spans_in_range(i,a);if(s.length===0&&f.length===0)return false;let c=new Set;for(let _ of s){let v=_._element.parentNode;for(;v&&v.tagName!=="w:p";)v=v.parentNode;v&&c.add(v);}let d=null,p=null;for(let _ of s){let v=this._create_track_change_tag("w:del","",u),E=_._element.cloneNode(true);Array.from(E.getElementsByTagName("w:t")).forEach(D=>{let y=E.ownerDocument.createElement("w:delText");y.textContent=D.textContent,D.hasAttribute("xml:space")&&y.setAttribute("xml:space","preserve"),E.replaceChild(y,D);}),v.appendChild(E),_._element.parentNode?.replaceChild(v,_._element),d===null&&(d=v),p=v;}let m=null,g=null,b=null;if(n==="MODIFICATION"&&e.new_text&&p){let _=p;for(;_&&_.tagName!=="w:p";)_=_.parentNode;let v=_?new Ze(_,null):null,E=s.length>0?s[s.length-1]:null,w=this._track_insert_multiline(e.new_text,E,v,l);w.first_node&&(w.first_node.tagName==="w:ins"?(Pt(w.first_node,p),m=w.first_node):m=w.last_ins,g=w.last_p,b=w.last_ins);}if(n==="DELETION"||n==="MODIFICATION"){if(n==="MODIFICATION"&&s.length===0&&f.length>0&&e.new_text){let _=f[0];if(_.paragraph){let v=_.paragraph._element,E=S(v,"w:r"),w=E.length>0?new Ke(E[E.length-1],_.paragraph):null,D=this._track_insert_multiline(e.new_text,w,_.paragraph,l);D.first_node&&v.appendChild(D.first_node);}}for(let _ of [...f].reverse())if(_.paragraph){let v=_.paragraph._element,E=ot(v);for(;E&&E.tagName!=="w:p";)E=ot(E);if(E&&E.tagName==="w:p"){let w=O(v,"w:pPr");w||(w=v.ownerDocument.createElement("w:pPr"),v.insertBefore(w,v.firstChild));let D=O(w,"w:rPr");D||(D=v.ownerDocument.createElement("w:rPr"),w.appendChild(D));let y=this._create_track_change_tag("w:del");D.appendChild(y);let A=Array.from(E.childNodes);for(let C of A)C.nodeType===1&&C.tagName==="w:pPr"||v.appendChild(C);E.parentNode&&E.parentNode.removeChild(E);}}}if(e.comment&&d!==null){let _,v;if(g&&b)_=b,v=g;else {let A=m!==null?m:p;for(_=A,v=A;v&&v.tagName!=="w:p";)v=v.parentNode;}let E=d;for(;E&&E.tagName!=="w:p";)E=E.parentNode;if(!E||!v)return true;let w=h((A,C)=>{let N=A;for(;N.parentNode&&N.parentNode!==C;)N=N.parentNode;return N},"ascend_to_paragraph_child"),D=w(d,E),y=w(_,v);E===v?this._attach_comment(E,D,y,e.comment):this._attach_comment_spanning(E,D,v,y,e.comment);}for(let _ of c){let v=false;for(let E of ["w:t","w:tab","w:br"]){let w=S(_,E);for(let D of w){let y=false,A=D.parentNode;for(;A&&A!==_.parentNode;){if(A.tagName==="w:del"){y=true;break}A=A.parentNode;}if(!y){if(E==="w:t"&&!D.textContent)continue;v=true;break}}if(v)break}if(!v){let E=O(_,"w:pPr");E||(E=_.ownerDocument.createElement("w:pPr"),_.insertBefore(E,_.firstChild));let w=O(E,"w:rPr");if(w||(w=_.ownerDocument.createElement("w:rPr"),E.appendChild(w)),!O(w,"w:del")){let D=this._create_track_change_tag("w:del");w.appendChild(D);}}}return true}};function tl(e,t,r=2){if(e===t)return 0;if(Math.abs(e.length-t.length)>r)return r+1;if(e.length===0)return t.length<=r?t.length:r+1;if(t.length===0)return e.length<=r?e.length:r+1;if(e.length>t.length){let o=e;e=t,t=o;}let n=Array.from({length:e.length+1},(o,i)=>i);for(let o=1;o<=t.length;o++){let i=[o],a=o;for(let u=1;u<=e.length;u++){let l=e[u-1]===t[o-1]?0:1,s=Math.min(n[u]+1,i[u-1]+1,n[u-1]+l);i.push(s),s<a&&(a=s);}if(a>r)return r+1;n=i;}return n[e.length]<=r?n[e.length]:r+1}h(tl,"boundedLevenshtein");function rl(e){let t="",r=S(e._element,"w:r");for(let n of r)t+=at(new Ke(n,e));return t}h(rl,"_get_paragraph_text");function nl(e,t){let r={},n=new Set,o={},i=[],a=/^(?:[\d.\-()a-zA-Z]+\s*)?["“]([A-Z][A-Za-z0-9\s\-&'’]{1,60})["”]/,u=/\([^)]*?["“]([A-Z][A-Za-z0-9\s\-&'’]{1,60})["”][^)]*?\)/g;for(let _ of xn(e)){if(!(_ instanceof Ze))continue;let v=rl(_).trim();if(!v)continue;let E=[],w=v.match(a);w&&E.push(w[1].trim());let D=v.matchAll(u);for(let C of D)E.push(C[1].trim());for(let C of E)r[C]?n.add(C):r[C]={count:0};let y=v.length>60?v.substring(0,60)+"...":v,A=S(_._element,"*");for(let C of A){if(C.tagName==="w:bookmarkStart"){let B=C.getAttribute("w:name");B&&(!B.startsWith("_")||B.startsWith("_Ref"))&&(o[B]||(o[B]={anchored_to:y,referenced_from:[]}));}let N=null;if(C.tagName==="w:fldSimple"){let x=(C.getAttribute("w:instr")||"").trim().split(/\s+/);x.length>1&&x[0]==="REF"&&(N=x[1]);}else if(C.tagName==="w:instrText"){let x=(C.textContent||"").trim().split(/\s+/);x.length>1&&x[0]==="REF"&&(N=x[1]);}N&&i.push([N,y]);}}for(let[_,v]of i)o[_]&&o[_].referenced_from.push(v);let l=[],s=Object.keys(r);if(s.length>0){let _=s.sort((D,y)=>y.length-D.length),v=h(D=>D.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"escapeRegExp"),E=_.map(v).join("|"),w=new RegExp(`(?<!["\u201C])\\b(${E})\\b(?![\u201D"])`,"g");for(let D of t.matchAll(w)){let y=D[1];r[y]&&r[y].count++;}for(let D of s)r[D].count===0&&(delete r[D],n.delete(D));}for(let _ of n)l.push(`[Error] Duplicate Definition: '${_}' is defined multiple times.`);let f=new Set(["The","This","That","Such","A","An","Any","All","Some","No","Every","Each","As","In","Of","For","To","On","By","With"]),c=/\b[A-Z][a-zA-Z]*(?:\s+[A-Z][a-zA-Z]*)*\b/g,d=new Set(t.match(c)||[]),p=new Set(Object.keys(r)),m={};for(let _ of p){let v=_[0].toLowerCase();m[v]||(m[v]=[]),m[v].push(_);}let g={};for(let _ of d){let v=_.trim(),E=v.split(/\s+/);for(;E.length>0;){let y=E[0],A=y.charAt(0).toUpperCase()+y.slice(1).toLowerCase();if(f.has(A))E.shift();else break}if(v=E.join(" "),v.length<4||p.has(v))continue;let w=v[0].toLowerCase(),D=m[w]||[];if(v.length>5)for(let[y,A]of Object.entries(m))y!==w&&(D=D.concat(A));for(let y of D){if(Math.abs(v.length-y.length)>2||v===y+"s"||v===y+"es"||y===v+"s"||y===v+"es")continue;let A=tl(v,y,2);A===0||A>2||y.length<=5&&(A>1||v[0].toLowerCase()!==y[0].toLowerCase())||(g[y]||(g[y]=[]),g[y].includes(v)||g[y].push(v));}}for(let[_,v]of Object.entries(g)){v.sort();let E=v.map(w=>`'${w}'`).join(", ");l.push(`[Info] Possible Typos for '${_}': Found ${E}`);}function b(_){return _.startsWith("[Error]")?0:_.startsWith("[Warning]")?1:2}return h(b,"diag_sort_key"),l.sort((_,v)=>{let E=b(_),w=b(v);return E!==w?E-w:_.localeCompare(v)}),[r,l,o]}h(nl,"extract_all_domain_metadata");function il(e,t){let[r,n,o]=nl(e,t),i=[`
55
+ `);_.length>=2&&_[0].trim()!==""&&_[_.length-1].trim()!==""&&t.push(`- Edit ${r+1} Failed: target_text spans a paragraph boundary with body text on both sides. The paragraph break is a structural element, not literal text, so it cannot be replaced as a single span without corrupting the document. Split this into one edit per paragraph.`);}}for(let[s,f]of o){let c=this.mapper.spans.filter(p=>p.end>s&&p.start<s+f),d=new Set;for(let p of c)if(p.ins_id){let m=S(this.doc.element,"w:ins").filter(g=>g.getAttribute("w:id")===p.ins_id);if(m.length>0){let g=m[0].getAttribute("w:author");g&&g!==this.author&&d.add(g);}}d.size>0&&t.push(`- Edit ${r+1} Failed: Modification targets an active insertion from another author (${Array.from(d).join(", ")}). Accept that change first or scope your edit outside of it.`);}}return t}validate_review_actions(e){let t=[];for(let r=0;r<e.length;r++){let n=e[r],o=n.type;if(o==="reply"){let i=n.target_id.replace("Com:",""),a=false,u=this.doc.pkg.parts.find(l=>l.contentType==="application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml");u&&(a=S(u._element,"w:comment").some(s=>s.getAttribute("w:id")===i)),a||t.push(`- Action ${r+1} Failed: Target comment ID ${n.target_id} not found.`);}else if(o==="accept"||o==="reject"){let i=n.target_id.replace("Chg:",""),a=S(this.doc.element,"w:ins").filter(l=>l.getAttribute("w:id")===i),u=S(this.doc.element,"w:del").filter(l=>l.getAttribute("w:id")===i);a.length===0&&u.length===0&&t.push(`- Action ${r+1} Failed: Target ID ${n.target_id} not found.`);}}return t}process_batch(e,t=false){if(Array.isArray(e)&&(e=e.map(r=>{if(typeof r=="string")try{let n=JSON.parse(r);return n!==null&&typeof n=="object"?n:r}catch{return r}return r})),t){let r=new Map;for(let n of this.doc.pkg.parts)n._element&&r.set(n,n._element.cloneNode(true));try{return this._process_batch_internal(e,!0)}finally{for(let[n,o]of r.entries()){let i=n._element.ownerDocument;i&&i.documentElement&&i.replaceChild(o,i.documentElement),n._element=o;}this.mapper=new kt(this.doc),this.comments_manager=new ir(this.doc),this.clean_mapper=null;}}else return this._process_batch_internal(e,false)}_process_batch_internal(e,t=false){this.skipped_details=[];let r=e.filter(s=>["accept","reject","reply"].includes(s.type)),n=e.filter(s=>!["accept","reject","reply"].includes(s.type));if(t){if(r.length>0){let s=this.validate_review_actions(r);if(s.length>0)throw new Pr(s)}}else {let s=[];if(r.length>0&&s.push(...this.validate_review_actions(r)),n.length>0&&s.push(...this.validate_edits(n)),s.length>0)throw new Pr(s)}let o=0,i=0;if(r.length>0){let s=this.apply_review_actions(r);if(o=s[0],i=s[1],i>0)throw new Pr(this.skipped_details);o>0&&(this.mapper._build_map(),this.clean_mapper&&this.clean_mapper._build_map());}let a=[],u=0,l=0;if(n.length>0)if(t)for(let s of n){let f=this.validate_edits([s]),c=this._check_punctuation_warning(s.target_text||"");if(f.length>0){l++,a.push({status:"failed",target_text:s.target_text||"",new_text:s.new_text||"",warning:c,error:f[0],critic_markup:null,clean_text:null});continue}if(this.apply_edits([s])[0]>0){u++;let m=this._build_edit_context_previews(s);a.push({status:"applied",target_text:s.target_text||"",new_text:s.new_text||"",warning:c,error:null,critic_markup:m[0],clean_text:m[1]});}else {l++;let m=this.skipped_details.length>0?this.skipped_details[this.skipped_details.length-1]:"Failed to apply edit";a.push({status:"failed",target_text:s.target_text||"",new_text:s.new_text||"",warning:c,error:m,critic_markup:null,clean_text:null});}}else {let s=this.validate_edits(n);if(s.length>0)throw new Pr(s);let f=n.map(d=>JSON.parse(JSON.stringify(d))),c=this.apply_edits(f);u=c[0],l=c[1];for(let d of f){let p=d._applied_status||false,m=d._error_msg||null,g=this._check_punctuation_warning(d.target_text||""),b=null,_=null;if(p){let v=this._build_edit_context_previews(d);b=v[0],_=v[1];}a.push({status:p?"applied":"failed",target_text:d.target_text||"",new_text:d.new_text||"",warning:g,error:m,critic_markup:b,clean_text:_});}}return {actions_applied:o,actions_skipped:i,edits_applied:u,edits_skipped:l,skipped_details:this.skipped_details,edits:a,engine:"node",version:"1.10.0"}}apply_edits(e){let t=0,r=0,n=[];for(let i of e)i._applied_status=false,i._error_msg=null;for(let i of e)if(i._resolved_start_idx!==void 0&&i._resolved_start_idx!==null)n.push([i,i.new_text||null]);else if(i._match_start_index!==void 0&&i._match_start_index!==null)i._resolved_start_idx=i._match_start_index,n.push([i,i.new_text||null]);else if(i.type==="insert_row"||i.type==="delete_row"){let a=this.mapper.find_all_match_indices(i.target_text);if(a.length===0&&(this.clean_mapper||(this.clean_mapper=new kt(this.doc,true)),a=this.clean_mapper.find_all_match_indices(i.target_text)),a.length>0)i._resolved_start_idx=a[0][0],n.push([i,null]);else {r++,i._applied_status=false;let l=`- Failed to locate row target: '${(i.target_text||"").trim().substring(0,40)}...'`;this.skipped_details.push(l),i._error_msg=l;}}else {let a=this._pre_resolve_heuristic_edit(i);if(a)if(Array.isArray(a))for(let u of a)u._resolved_start_idx=u._match_start_index,u._parent_edit_ref=i,(i._resolved_start_idx===void 0||i._resolved_start_idx===null)&&(i._resolved_start_idx=u._resolved_start_idx),i._resolved_proxy_edit||(i._resolved_proxy_edit=u),n.push([u,u.new_text]);else a._resolved_start_idx=a._match_start_index,a._parent_edit_ref=i,i._resolved_start_idx=a._resolved_start_idx,i._resolved_proxy_edit=a,n.push([a,a.new_text]);else {r++,i._applied_status=false;let s=`- Failed to apply edit targeting: '${(i.target_text||"insertion").trim().substring(0,40)}...'`;this.skipped_details.push(s),i._error_msg=s;}}n.sort((i,a)=>(a[0]._resolved_start_idx||0)-(i[0]._resolved_start_idx||0));let o=[];for(let[i,a]of n){let u=i._resolved_start_idx||0,l=u+(i.target_text?i.target_text.length:0);if(o.some(([c,d])=>u<d&&l>c)){r++;let p=`- Skipped overlapping edit targeting: '${(i.target_text||"insertion").trim().substring(0,40)}...'`;this.skipped_details.push(p),i._applied_status=false,i._error_msg=p;let m=i._parent_edit_ref;m&&(m._applied_status=false,m._error_msg=p);continue}let f=false;if(i.type==="modify"?f=this._apply_single_edit_indexed(i,a,false):(i.type==="insert_row"||i.type==="delete_row")&&(f=this._apply_table_edit(i,false)),f){t++,o.push([u,l]),i._applied_status=true;let c=i._parent_edit_ref;c&&(c._applied_status=true);}else {r++;let p=`- Failed to apply edit targeting: '${(i.target_text||"insertion").trim().substring(0,40)}...'`;this.skipped_details.push(p),i._applied_status=false,i._error_msg=p;let m=i._parent_edit_ref;m&&(m._applied_status||(m._applied_status=false,m._error_msg=p));}}return [t,r]}apply_review_actions(e){let t=0,r=0;for(let n of e){let o=n.type;if(o==="reply"){let s=n.target_id.replace("Com:",""),f=this.comments_manager.addComment(this.author,n.text,s);this._anchor_reply_comment(s,f),t++;continue}let i=n.target_id.replace("Chg:",""),a=S(this.doc.element,"w:ins").filter(s=>s.getAttribute("w:id")===i),u=S(this.doc.element,"w:del").filter(s=>s.getAttribute("w:id")===i),l=[...a,...u];if(l.length===0){r++,this.skipped_details.push(`- Failed to apply action: Target ID ${n.target_id} not found.`);continue}for(let s of l){let f=s.tagName==="w:ins",d=(s.parentNode?s.parentNode.tagName:"")==="w:trPr";if(o==="accept")if(f)if(this._clean_wrapping_comments(s),d)s.parentNode?.removeChild(s);else {for(;s.firstChild;)s.parentNode?.insertBefore(s.firstChild,s);s.parentNode?.removeChild(s);}else if(this._clean_wrapping_comments(s),this._delete_comments_in_element(s),d){let p=s.parentNode?.parentNode;p?.parentNode?.removeChild(p);}else s.parentNode?.removeChild(s);else if(o==="reject")if(f)if(this._clean_wrapping_comments(s),this._delete_comments_in_element(s),d){let p=s.parentNode?.parentNode;p?.parentNode?.removeChild(p);}else s.parentNode?.removeChild(s);else if(this._clean_wrapping_comments(s),d)s.parentNode?.removeChild(s);else {let p=Array.from(s.getElementsByTagName("w:delText"));for(let m of p){let g=m.ownerDocument.createElement("w:t");g.textContent=m.textContent,m.hasAttribute("xml:space")&&g.setAttribute("xml:space","preserve"),m.parentNode?.replaceChild(g,m);}for(;s.firstChild;)s.parentNode?.insertBefore(s.firstChild,s);s.parentNode?.removeChild(s);}}t++;}return [t,r]}_apply_table_edit(e,t){let r=e._resolved_start_idx!==void 0&&e._resolved_start_idx!==null?e._resolved_start_idx:e._match_start_index||0,[n,o]=this.mapper.get_insertion_anchor(r,t),i=null;if(n?i=n._element:o&&(i=o._element),!i)return false;let a=i;for(;a&&a.tagName!=="w:tr";)a=a.parentNode;if(!a)return false;if(e.type==="delete_row"){let u=O(a,"w:trPr");return u||(u=a.ownerDocument.createElement("w:trPr"),a.insertBefore(u,a.firstChild)),u.appendChild(this._create_track_change_tag("w:del")),true}else if(e.type==="insert_row"){let u=a.ownerDocument.createElement("w:tr"),l=a.ownerDocument.createElement("w:trPr");u.appendChild(l),l.appendChild(this._create_track_change_tag("w:ins"));for(let s of e.cells){let f=a.ownerDocument.createElement("w:tc"),c=a.ownerDocument.createElement("w:p"),d=a.ownerDocument.createElement("w:r"),p=a.ownerDocument.createElement("w:t");p.textContent=s,s.trim()!==s&&p.setAttribute("xml:space","preserve"),d.appendChild(p),c.appendChild(d),f.appendChild(c),u.appendChild(f);}return e.position==="above"?a.parentNode?.insertBefore(u,a):Pt(u,a),true}return false}_first_live_match(e){let t=this.mapper.find_all_match_indices(e);if(t.length<=1)return this.mapper.find_match_index(e);for(let[r,n]of t){let o=this.mapper.spans.filter(i=>i.run!==null&&i.end>r&&i.start<r+n);if(o.length===0)return [r,n];if(o.some(i=>!i.del_id))return [r,n]}return this.mapper.find_match_index(e)}_pre_resolve_heuristic_edit(e){if(!e.target_text)return null;let[t,r]=this._first_live_match(e.target_text),n=false;if(t===-1)if(this.clean_mapper||(this.clean_mapper=new kt(this.doc,true)),[t,r]=this.clean_mapper.find_match_index(e.target_text),t!==-1)n=true;else return null;let o=n?this.clean_mapper:this.mapper,i=e.new_text||"",a=this.mapper.full_text.substring(t,t+r);if(a===i||e.target_text===i)return {type:"modify",target_text:a,new_text:a,comment:e.comment,_match_start_index:t,_internal_op:"COMMENT_ONLY",_active_mapper_ref:o};let u="",l="",s="",f=t;if(i.startsWith(a))u="INSERTION",s=i.substring(a.length),f=t+r;else {let[c,d]=bn(a,i),p=a.length-d,m=i.length-d;l=a.substring(c,p),s=i.substring(c,m),f=t+c,!l&&s?u="INSERTION":l&&!s?u="DELETION":l&&s?u="MODIFICATION":u="COMMENT_ONLY";}return {type:"modify",target_text:l,new_text:s,comment:e.comment,_match_start_index:f,_internal_op:u,_active_mapper_ref:o}}_apply_single_edit_indexed(e,t,r){let n=e._internal_op,o=e._active_mapper_ref||this.mapper,i=e._resolved_start_idx!==void 0&&e._resolved_start_idx!==null?e._resolved_start_idx:e._match_start_index||0,a=e.target_text?e.target_text.length:0,u=["DELETION","MODIFICATION"].includes(n)?this._getNextId():null,l=["INSERTION","MODIFICATION"].includes(n)?this._getNextId():null;if(n==="COMMENT_ONLY"){let _=o.find_target_runs_by_index(i,a,r);if(_.length===0)return false;if(!e.comment)return true;let v=_[0]._element,E=_[_.length-1]._element,w=v;for(;w&&w.tagName!=="w:p";)w=w.parentNode;let D=E;for(;D&&D.tagName!=="w:p";)D=D.parentNode;if(!w||!D)return false;let y=h((N,B)=>{let x=N;for(;x.parentNode&&x.parentNode!==B;)x=x.parentNode;return x},"ascend_to_paragraph_child"),A=y(v,w),C=y(E,D);return w===D?this._attach_comment(w,A,C,e.comment):this._attach_comment_spanning(w,A,D,C,e.comment),true}if(n==="INSERTION"){let[_,v]=o.get_insertion_anchor(i,r);if(!_&&!v)return false;let E=e.new_text||"",w=/\n\s*$/.test(E),D=null;{let C=o.spans.filter(N=>N.paragraph!==null&&N.start===i);C.length>0&&C[0].paragraph&&(D=C[0].paragraph._element);}if(w&&D&&D.parentNode){let C=D.parentNode,N=this.doc.part._element.ownerDocument,B=E.split(/[\r\n]+/).filter(P=>P!==""),x=null,M=null,z=null;for(let P of B){let[G,$]=this._parse_markdown_style(P),R=N.createElement("w:p");if($)this._set_paragraph_style(R,$);else {let K=O(D,"w:pPr");K&&R.appendChild(K.cloneNode(true));}let j=O(R,"w:pPr");j||(j=N.createElement("w:pPr"),R.insertBefore(j,R.firstChild));let I=O(j,"w:rPr");I||(I=N.createElement("w:rPr"),j.appendChild(I)),I.appendChild(this._create_track_change_tag("w:ins","",l));let Q=this._build_tracked_ins_for_line(G,_,l,N);Q&&R.appendChild(Q),C.insertBefore(R,D),x||(x=R),M=R,z=Q;}if(x){if(e.comment&&M&&z){let P=h(($,R)=>{let j=$;for(;j.parentNode&&j.parentNode!==R;)j=j.parentNode;return j},"ascend"),G=S(x,"w:ins")[0]||x;this._attach_comment_spanning(x,P(G,x),M,P(z,M),e.comment);}return true}}let y=this._track_insert_multiline(e.new_text||"",_,v,l);if(!y.first_node)return false;if(y.first_node.tagName==="w:ins"&&(_?Pt(y.first_node,_._element):v&&v._element.appendChild(y.first_node)),e.comment){let C=h((N,B)=>{let x=N;for(;x.parentNode&&x.parentNode!==B;)x=x.parentNode;return x},"ascend_to_paragraph_child");if(y.last_p&&y.last_ins){let N=y.first_node;for(;N&&N.tagName!=="w:p";)N=N.parentNode;if(N){let B=y.first_node;y.first_node.tagName==="w:p"&&(B=S(y.first_node,"w:ins")[0]||y.first_node);let x=C(B,N),M=C(y.last_ins,y.last_p);this._attach_comment_spanning(N,x,y.last_p,M,e.comment);}}else {let N=y.first_node;for(;N&&N.tagName!=="w:p";)N=N.parentNode;if(N){let B=y.first_node;y.first_node.tagName==="w:p"&&(B=S(y.first_node,"w:ins")[0]||y.first_node);let x=C(B,N);this._attach_comment(N,x,x,e.comment);}}}return true}let s=o.find_target_runs_by_index(i,a,r),f=o.get_virtual_spans_in_range(i,a);if(s.length===0&&f.length===0)return false;let c=new Set;for(let _ of s){let v=_._element.parentNode;for(;v&&v.tagName!=="w:p";)v=v.parentNode;v&&c.add(v);}let d=null,p=null;for(let _ of s){let v=this._create_track_change_tag("w:del","",u),E=_._element.cloneNode(true);Array.from(E.getElementsByTagName("w:t")).forEach(D=>{let y=E.ownerDocument.createElement("w:delText");y.textContent=D.textContent,D.hasAttribute("xml:space")&&y.setAttribute("xml:space","preserve"),E.replaceChild(y,D);}),v.appendChild(E),_._element.parentNode?.replaceChild(v,_._element),d===null&&(d=v),p=v;}let m=null,g=null,b=null;if(n==="MODIFICATION"&&e.new_text&&p){let _=p;for(;_&&_.tagName!=="w:p";)_=_.parentNode;let v=_?new Ze(_,null):null,E=s.length>0?s[s.length-1]:null,w=this._track_insert_multiline(e.new_text,E,v,l);w.first_node&&(w.first_node.tagName==="w:ins"?(Pt(w.first_node,p),m=w.first_node):m=w.last_ins,g=w.last_p,b=w.last_ins);}if(n==="DELETION"||n==="MODIFICATION"){if(n==="MODIFICATION"&&s.length===0&&f.length>0&&e.new_text){let _=f[0];if(_.paragraph){let v=_.paragraph._element,E=S(v,"w:r"),w=E.length>0?new Ke(E[E.length-1],_.paragraph):null,D=this._track_insert_multiline(e.new_text,w,_.paragraph,l);D.first_node&&v.appendChild(D.first_node);}}for(let _ of [...f].reverse())if(_.paragraph){let v=_.paragraph._element,E=ot(v);for(;E&&E.tagName!=="w:p";)E=ot(E);if(E&&E.tagName==="w:p"){let w=O(v,"w:pPr");w||(w=v.ownerDocument.createElement("w:pPr"),v.insertBefore(w,v.firstChild));let D=O(w,"w:rPr");D||(D=v.ownerDocument.createElement("w:rPr"),w.appendChild(D));let y=this._create_track_change_tag("w:del");D.appendChild(y);let A=Array.from(E.childNodes);for(let C of A)C.nodeType===1&&C.tagName==="w:pPr"||v.appendChild(C);E.parentNode&&E.parentNode.removeChild(E);}}}if(e.comment&&d!==null){let _,v;if(g&&b)_=b,v=g;else {let A=m!==null?m:p;for(_=A,v=A;v&&v.tagName!=="w:p";)v=v.parentNode;}let E=d;for(;E&&E.tagName!=="w:p";)E=E.parentNode;if(!E||!v)return true;let w=h((A,C)=>{let N=A;for(;N.parentNode&&N.parentNode!==C;)N=N.parentNode;return N},"ascend_to_paragraph_child"),D=w(d,E),y=w(_,v);E===v?this._attach_comment(E,D,y,e.comment):this._attach_comment_spanning(E,D,v,y,e.comment);}for(let _ of c){let v=false;for(let E of ["w:t","w:tab","w:br"]){let w=S(_,E);for(let D of w){let y=false,A=D.parentNode;for(;A&&A!==_.parentNode;){if(A.tagName==="w:del"){y=true;break}A=A.parentNode;}if(!y){if(E==="w:t"&&!D.textContent)continue;v=true;break}}if(v)break}if(!v){let E=O(_,"w:pPr");E||(E=_.ownerDocument.createElement("w:pPr"),_.insertBefore(E,_.firstChild));let w=O(E,"w:rPr");if(w||(w=_.ownerDocument.createElement("w:rPr"),E.appendChild(w)),!O(w,"w:del")){let D=this._create_track_change_tag("w:del");w.appendChild(D);}}}return true}};function tl(e,t,r=2){if(e===t)return 0;if(Math.abs(e.length-t.length)>r)return r+1;if(e.length===0)return t.length<=r?t.length:r+1;if(t.length===0)return e.length<=r?e.length:r+1;if(e.length>t.length){let o=e;e=t,t=o;}let n=Array.from({length:e.length+1},(o,i)=>i);for(let o=1;o<=t.length;o++){let i=[o],a=o;for(let u=1;u<=e.length;u++){let l=e[u-1]===t[o-1]?0:1,s=Math.min(n[u]+1,i[u-1]+1,n[u-1]+l);i.push(s),s<a&&(a=s);}if(a>r)return r+1;n=i;}return n[e.length]<=r?n[e.length]:r+1}h(tl,"boundedLevenshtein");function rl(e){let t="",r=S(e._element,"w:r");for(let n of r)t+=at(new Ke(n,e));return t}h(rl,"_get_paragraph_text");function nl(e,t){let r={},n=new Set,o={},i=[],a=/^(?:[\d.\-()a-zA-Z]+\s*)?["“]([A-Z][A-Za-z0-9\s\-&'’]{1,60})["”]/,u=/\([^)]*?["“]([A-Z][A-Za-z0-9\s\-&'’]{1,60})["”][^)]*?\)/g;for(let _ of xn(e)){if(!(_ instanceof Ze))continue;let v=rl(_).trim();if(!v)continue;let E=[],w=v.match(a);w&&E.push(w[1].trim());let D=v.matchAll(u);for(let C of D)E.push(C[1].trim());for(let C of E)r[C]?n.add(C):r[C]={count:0};let y=v.length>60?v.substring(0,60)+"...":v,A=S(_._element,"*");for(let C of A){if(C.tagName==="w:bookmarkStart"){let B=C.getAttribute("w:name");B&&(!B.startsWith("_")||B.startsWith("_Ref"))&&(o[B]||(o[B]={anchored_to:y,referenced_from:[]}));}let N=null;if(C.tagName==="w:fldSimple"){let x=(C.getAttribute("w:instr")||"").trim().split(/\s+/);x.length>1&&x[0]==="REF"&&(N=x[1]);}else if(C.tagName==="w:instrText"){let x=(C.textContent||"").trim().split(/\s+/);x.length>1&&x[0]==="REF"&&(N=x[1]);}N&&i.push([N,y]);}}for(let[_,v]of i)o[_]&&o[_].referenced_from.push(v);let l=[],s=Object.keys(r);if(s.length>0){let _=s.sort((D,y)=>y.length-D.length),v=h(D=>D.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"escapeRegExp"),E=_.map(v).join("|"),w=new RegExp(`(?<!["\u201C])\\b(${E})\\b(?![\u201D"])`,"g");for(let D of t.matchAll(w)){let y=D[1];r[y]&&r[y].count++;}for(let D of s)r[D].count===0&&(delete r[D],n.delete(D));}for(let _ of n)l.push(`[Error] Duplicate Definition: '${_}' is defined multiple times.`);let f=new Set(["The","This","That","Such","A","An","Any","All","Some","No","Every","Each","As","In","Of","For","To","On","By","With"]),c=/\b[A-Z][a-zA-Z]*(?:\s+[A-Z][a-zA-Z]*)*\b/g,d=new Set(t.match(c)||[]),p=new Set(Object.keys(r)),m={};for(let _ of p){let v=_[0].toLowerCase();m[v]||(m[v]=[]),m[v].push(_);}let g={};for(let _ of d){let v=_.trim(),E=v.split(/\s+/);for(;E.length>0;){let y=E[0],A=y.charAt(0).toUpperCase()+y.slice(1).toLowerCase();if(f.has(A))E.shift();else break}if(v=E.join(" "),v.length<4||p.has(v))continue;let w=v[0].toLowerCase(),D=m[w]||[];if(v.length>5)for(let[y,A]of Object.entries(m))y!==w&&(D=D.concat(A));for(let y of D){if(Math.abs(v.length-y.length)>2||v===y+"s"||v===y+"es"||y===v+"s"||y===v+"es")continue;let A=tl(v,y,2);A===0||A>2||y.length<=5&&(A>1||v[0].toLowerCase()!==y[0].toLowerCase())||(g[y]||(g[y]=[]),g[y].includes(v)||g[y].push(v));}}for(let[_,v]of Object.entries(g)){v.sort();let E=v.map(w=>`'${w}'`).join(", ");l.push(`[Info] Possible Typos for '${_}': Found ${E}`);}function b(_){return _.startsWith("[Error]")?0:_.startsWith("[Warning]")?1:2}return h(b,"diag_sort_key"),l.sort((_,v)=>{let E=b(_),w=b(v);return E!==w?E-w:_.localeCompare(v)}),[r,l,o]}h(nl,"extract_all_domain_metadata");function il(e,t){let[r,n,o]=nl(e,t),i=[`
56
56
 
57
57
  ---`,"","<!-- 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(Object.keys(r).length>0){a=true,i.push(`
58
58
  ## Defined Terms`);for(let[u,l]of Object.entries(r))i.push(`- "${u}" \u2014 used ${l.count} times.`);}if(n.length>0){a=true,i.push(`
@@ -1 +1 @@
1
- {"inputs":{"nodes/Adeu/GenericFunctions.ts":{"bytes":14305,"imports":[{"path":"n8n-workflow","kind":"import-statement","external":true},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"nodes/Adeu/descriptions/hydrateToolOutput.operation.ts":{"bytes":8420,"imports":[{"path":"n8n-workflow","kind":"import-statement","external":true},{"path":"nodes/Adeu/GenericFunctions.ts","kind":"import-statement","original":"../GenericFunctions"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"shims/module.js":{"bytes":224,"imports":[{"path":"<runtime>","kind":"import-statement","external":true}],"format":"cjs"},"../../node_modules/fflate/esm/index.mjs":{"bytes":91765,"imports":[{"path":"shims/module.js","kind":"import-statement","original":"module"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"../../node_modules/@xmldom/xmldom/lib/conventions.js":{"bytes":13399,"imports":[{"path":"<runtime>","kind":"import-statement","external":true}],"format":"cjs"},"../../node_modules/@xmldom/xmldom/lib/errors.js":{"bytes":6675,"imports":[{"path":"../../node_modules/@xmldom/xmldom/lib/conventions.js","kind":"require-call","original":"./conventions"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"cjs"},"../../node_modules/@xmldom/xmldom/lib/grammar.js":{"bytes":22988,"imports":[{"path":"<runtime>","kind":"import-statement","external":true}],"format":"cjs"},"../../node_modules/@xmldom/xmldom/lib/dom.js":{"bytes":124722,"imports":[{"path":"../../node_modules/@xmldom/xmldom/lib/conventions.js","kind":"require-call","original":"./conventions"},{"path":"../../node_modules/@xmldom/xmldom/lib/errors.js","kind":"require-call","original":"./errors"},{"path":"../../node_modules/@xmldom/xmldom/lib/grammar.js","kind":"require-call","original":"./grammar"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"cjs"},"../../node_modules/@xmldom/xmldom/lib/entities.js":{"bytes":44533,"imports":[{"path":"../../node_modules/@xmldom/xmldom/lib/conventions.js","kind":"require-call","original":"./conventions"}],"format":"cjs"},"../../node_modules/@xmldom/xmldom/lib/sax.js":{"bytes":29094,"imports":[{"path":"../../node_modules/@xmldom/xmldom/lib/conventions.js","kind":"require-call","original":"./conventions"},{"path":"../../node_modules/@xmldom/xmldom/lib/grammar.js","kind":"require-call","original":"./grammar"},{"path":"../../node_modules/@xmldom/xmldom/lib/errors.js","kind":"require-call","original":"./errors"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"cjs"},"../../node_modules/@xmldom/xmldom/lib/dom-parser.js":{"bytes":19949,"imports":[{"path":"../../node_modules/@xmldom/xmldom/lib/conventions.js","kind":"require-call","original":"./conventions"},{"path":"../../node_modules/@xmldom/xmldom/lib/dom.js","kind":"require-call","original":"./dom"},{"path":"../../node_modules/@xmldom/xmldom/lib/errors.js","kind":"require-call","original":"./errors"},{"path":"../../node_modules/@xmldom/xmldom/lib/entities.js","kind":"require-call","original":"./entities"},{"path":"../../node_modules/@xmldom/xmldom/lib/sax.js","kind":"require-call","original":"./sax"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"cjs"},"../../node_modules/@xmldom/xmldom/lib/index.js":{"bytes":1595,"imports":[{"path":"../../node_modules/@xmldom/xmldom/lib/conventions.js","kind":"require-call","original":"./conventions"},{"path":"../../node_modules/@xmldom/xmldom/lib/errors.js","kind":"require-call","original":"./errors"},{"path":"../../node_modules/@xmldom/xmldom/lib/dom.js","kind":"require-call","original":"./dom"},{"path":"../../node_modules/@xmldom/xmldom/lib/dom-parser.js","kind":"require-call","original":"./dom-parser"}],"format":"cjs"},"../../node_modules/diff-match-patch/index.js":{"bytes":78052,"imports":[{"path":"<runtime>","kind":"import-statement","external":true}],"format":"cjs"},"../core/dist/index.js":{"bytes":239864,"imports":[{"path":"../../node_modules/fflate/esm/index.mjs","kind":"import-statement","original":"fflate"},{"path":"../../node_modules/@xmldom/xmldom/lib/index.js","kind":"import-statement","original":"@xmldom/xmldom"},{"path":"../../node_modules/diff-match-patch/index.js","kind":"import-statement","original":"diff-match-patch"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"nodes/Adeu/descriptions/extractMarkdown.operation.ts":{"bytes":2793,"imports":[{"path":"../core/dist/index.js","kind":"import-statement","original":"@adeu/core"},{"path":"nodes/Adeu/GenericFunctions.ts","kind":"import-statement","original":"../GenericFunctions"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"nodes/Adeu/descriptions/applyEdits.operation.ts":{"bytes":13053,"imports":[{"path":"../core/dist/index.js","kind":"import-statement","original":"@adeu/core"},{"path":"nodes/Adeu/GenericFunctions.ts","kind":"import-statement","original":"../GenericFunctions"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"nodes/Adeu/descriptions/generateDiff.operation.ts":{"bytes":6988,"imports":[{"path":"../core/dist/index.js","kind":"import-statement","original":"@adeu/core"},{"path":"nodes/Adeu/GenericFunctions.ts","kind":"import-statement","original":"../GenericFunctions"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"nodes/Adeu/descriptions/finalizeDocument.operation.ts":{"bytes":7710,"imports":[{"path":"../core/dist/index.js","kind":"import-statement","original":"@adeu/core"},{"path":"nodes/Adeu/GenericFunctions.ts","kind":"import-statement","original":"../GenericFunctions"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"nodes/Adeu/descriptions/index.ts":{"bytes":6044,"imports":[{"path":"nodes/Adeu/descriptions/extractMarkdown.operation.ts","kind":"import-statement","original":"./extractMarkdown.operation"},{"path":"nodes/Adeu/descriptions/applyEdits.operation.ts","kind":"import-statement","original":"./applyEdits.operation"},{"path":"nodes/Adeu/descriptions/generateDiff.operation.ts","kind":"import-statement","original":"./generateDiff.operation"},{"path":"nodes/Adeu/descriptions/finalizeDocument.operation.ts","kind":"import-statement","original":"./finalizeDocument.operation"},{"path":"nodes/Adeu/descriptions/hydrateToolOutput.operation.ts","kind":"import-statement","original":"./hydrateToolOutput.operation"}],"format":"esm"},"nodes/Adeu/Adeu.node.ts":{"bytes":5930,"imports":[{"path":"n8n-workflow","kind":"import-statement","external":true},{"path":"nodes/Adeu/descriptions/hydrateToolOutput.operation.ts","kind":"import-statement","original":"./descriptions/hydrateToolOutput.operation"},{"path":"nodes/Adeu/descriptions/index.ts","kind":"import-statement","original":"./descriptions"},{"path":"nodes/Adeu/descriptions/extractMarkdown.operation.ts","kind":"import-statement","original":"./descriptions/extractMarkdown.operation"},{"path":"nodes/Adeu/descriptions/applyEdits.operation.ts","kind":"import-statement","original":"./descriptions/applyEdits.operation"},{"path":"nodes/Adeu/descriptions/generateDiff.operation.ts","kind":"import-statement","original":"./descriptions/generateDiff.operation"},{"path":"nodes/Adeu/descriptions/finalizeDocument.operation.ts","kind":"import-statement","original":"./descriptions/finalizeDocument.operation"},{"path":"nodes/Adeu/GenericFunctions.ts","kind":"import-statement","original":"./GenericFunctions"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"}},"outputs":{"dist/nodes/Adeu/Adeu.node.js":{"imports":[{"path":"n8n-workflow","kind":"import-statement","external":true},{"path":"n8n-workflow","kind":"import-statement","external":true},{"path":"n8n-workflow","kind":"import-statement","external":true}],"exports":["Adeu"],"entryPoint":"nodes/Adeu/Adeu.node.ts","inputs":{"shims/module.js":{"bytesInOutput":121},"../../node_modules/@xmldom/xmldom/lib/conventions.js":{"bytesInOutput":2426},"../../node_modules/@xmldom/xmldom/lib/errors.js":{"bytesInOutput":2862},"../../node_modules/@xmldom/xmldom/lib/grammar.js":{"bytesInOutput":4480},"../../node_modules/@xmldom/xmldom/lib/dom.js":{"bytesInOutput":31528},"../../node_modules/@xmldom/xmldom/lib/entities.js":{"bytesInOutput":35900},"../../node_modules/@xmldom/xmldom/lib/sax.js":{"bytesInOutput":12549},"../../node_modules/@xmldom/xmldom/lib/dom-parser.js":{"bytesInOutput":5025},"../../node_modules/@xmldom/xmldom/lib/index.js":{"bytesInOutput":1094},"../../node_modules/diff-match-patch/index.js":{"bytesInOutput":19270},"nodes/Adeu/Adeu.node.ts":{"bytesInOutput":3743},"nodes/Adeu/descriptions/hydrateToolOutput.operation.ts":{"bytesInOutput":5292},"nodes/Adeu/GenericFunctions.ts":{"bytesInOutput":6014},"../../node_modules/fflate/esm/index.mjs":{"bytesInOutput":13375},"../core/dist/index.js":{"bytesInOutput":99393},"nodes/Adeu/descriptions/extractMarkdown.operation.ts":{"bytesInOutput":1587},"nodes/Adeu/descriptions/applyEdits.operation.ts":{"bytesInOutput":8088},"nodes/Adeu/descriptions/generateDiff.operation.ts":{"bytesInOutput":4279},"nodes/Adeu/descriptions/finalizeDocument.operation.ts":{"bytesInOutput":4878},"nodes/Adeu/descriptions/index.ts":{"bytesInOutput":4579}},"bytes":267093}}}
1
+ {"inputs":{"nodes/Adeu/GenericFunctions.ts":{"bytes":14305,"imports":[{"path":"n8n-workflow","kind":"import-statement","external":true},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"nodes/Adeu/descriptions/hydrateToolOutput.operation.ts":{"bytes":8420,"imports":[{"path":"n8n-workflow","kind":"import-statement","external":true},{"path":"nodes/Adeu/GenericFunctions.ts","kind":"import-statement","original":"../GenericFunctions"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"shims/module.js":{"bytes":224,"imports":[{"path":"<runtime>","kind":"import-statement","external":true}],"format":"cjs"},"../../node_modules/fflate/esm/index.mjs":{"bytes":91765,"imports":[{"path":"shims/module.js","kind":"import-statement","original":"module"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"../../node_modules/@xmldom/xmldom/lib/conventions.js":{"bytes":13399,"imports":[{"path":"<runtime>","kind":"import-statement","external":true}],"format":"cjs"},"../../node_modules/@xmldom/xmldom/lib/errors.js":{"bytes":6675,"imports":[{"path":"../../node_modules/@xmldom/xmldom/lib/conventions.js","kind":"require-call","original":"./conventions"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"cjs"},"../../node_modules/@xmldom/xmldom/lib/grammar.js":{"bytes":22988,"imports":[{"path":"<runtime>","kind":"import-statement","external":true}],"format":"cjs"},"../../node_modules/@xmldom/xmldom/lib/dom.js":{"bytes":124722,"imports":[{"path":"../../node_modules/@xmldom/xmldom/lib/conventions.js","kind":"require-call","original":"./conventions"},{"path":"../../node_modules/@xmldom/xmldom/lib/errors.js","kind":"require-call","original":"./errors"},{"path":"../../node_modules/@xmldom/xmldom/lib/grammar.js","kind":"require-call","original":"./grammar"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"cjs"},"../../node_modules/@xmldom/xmldom/lib/entities.js":{"bytes":44533,"imports":[{"path":"../../node_modules/@xmldom/xmldom/lib/conventions.js","kind":"require-call","original":"./conventions"}],"format":"cjs"},"../../node_modules/@xmldom/xmldom/lib/sax.js":{"bytes":29094,"imports":[{"path":"../../node_modules/@xmldom/xmldom/lib/conventions.js","kind":"require-call","original":"./conventions"},{"path":"../../node_modules/@xmldom/xmldom/lib/grammar.js","kind":"require-call","original":"./grammar"},{"path":"../../node_modules/@xmldom/xmldom/lib/errors.js","kind":"require-call","original":"./errors"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"cjs"},"../../node_modules/@xmldom/xmldom/lib/dom-parser.js":{"bytes":19949,"imports":[{"path":"../../node_modules/@xmldom/xmldom/lib/conventions.js","kind":"require-call","original":"./conventions"},{"path":"../../node_modules/@xmldom/xmldom/lib/dom.js","kind":"require-call","original":"./dom"},{"path":"../../node_modules/@xmldom/xmldom/lib/errors.js","kind":"require-call","original":"./errors"},{"path":"../../node_modules/@xmldom/xmldom/lib/entities.js","kind":"require-call","original":"./entities"},{"path":"../../node_modules/@xmldom/xmldom/lib/sax.js","kind":"require-call","original":"./sax"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"cjs"},"../../node_modules/@xmldom/xmldom/lib/index.js":{"bytes":1595,"imports":[{"path":"../../node_modules/@xmldom/xmldom/lib/conventions.js","kind":"require-call","original":"./conventions"},{"path":"../../node_modules/@xmldom/xmldom/lib/errors.js","kind":"require-call","original":"./errors"},{"path":"../../node_modules/@xmldom/xmldom/lib/dom.js","kind":"require-call","original":"./dom"},{"path":"../../node_modules/@xmldom/xmldom/lib/dom-parser.js","kind":"require-call","original":"./dom-parser"}],"format":"cjs"},"../../node_modules/diff-match-patch/index.js":{"bytes":78052,"imports":[{"path":"<runtime>","kind":"import-statement","external":true}],"format":"cjs"},"../core/dist/index.js":{"bytes":240276,"imports":[{"path":"../../node_modules/fflate/esm/index.mjs","kind":"import-statement","original":"fflate"},{"path":"../../node_modules/@xmldom/xmldom/lib/index.js","kind":"import-statement","original":"@xmldom/xmldom"},{"path":"../../node_modules/diff-match-patch/index.js","kind":"import-statement","original":"diff-match-patch"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"nodes/Adeu/descriptions/extractMarkdown.operation.ts":{"bytes":2793,"imports":[{"path":"../core/dist/index.js","kind":"import-statement","original":"@adeu/core"},{"path":"nodes/Adeu/GenericFunctions.ts","kind":"import-statement","original":"../GenericFunctions"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"nodes/Adeu/descriptions/applyEdits.operation.ts":{"bytes":13053,"imports":[{"path":"../core/dist/index.js","kind":"import-statement","original":"@adeu/core"},{"path":"nodes/Adeu/GenericFunctions.ts","kind":"import-statement","original":"../GenericFunctions"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"nodes/Adeu/descriptions/generateDiff.operation.ts":{"bytes":6988,"imports":[{"path":"../core/dist/index.js","kind":"import-statement","original":"@adeu/core"},{"path":"nodes/Adeu/GenericFunctions.ts","kind":"import-statement","original":"../GenericFunctions"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"nodes/Adeu/descriptions/finalizeDocument.operation.ts":{"bytes":7710,"imports":[{"path":"../core/dist/index.js","kind":"import-statement","original":"@adeu/core"},{"path":"nodes/Adeu/GenericFunctions.ts","kind":"import-statement","original":"../GenericFunctions"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"nodes/Adeu/descriptions/index.ts":{"bytes":6044,"imports":[{"path":"nodes/Adeu/descriptions/extractMarkdown.operation.ts","kind":"import-statement","original":"./extractMarkdown.operation"},{"path":"nodes/Adeu/descriptions/applyEdits.operation.ts","kind":"import-statement","original":"./applyEdits.operation"},{"path":"nodes/Adeu/descriptions/generateDiff.operation.ts","kind":"import-statement","original":"./generateDiff.operation"},{"path":"nodes/Adeu/descriptions/finalizeDocument.operation.ts","kind":"import-statement","original":"./finalizeDocument.operation"},{"path":"nodes/Adeu/descriptions/hydrateToolOutput.operation.ts","kind":"import-statement","original":"./hydrateToolOutput.operation"}],"format":"esm"},"nodes/Adeu/Adeu.node.ts":{"bytes":5930,"imports":[{"path":"n8n-workflow","kind":"import-statement","external":true},{"path":"nodes/Adeu/descriptions/hydrateToolOutput.operation.ts","kind":"import-statement","original":"./descriptions/hydrateToolOutput.operation"},{"path":"nodes/Adeu/descriptions/index.ts","kind":"import-statement","original":"./descriptions"},{"path":"nodes/Adeu/descriptions/extractMarkdown.operation.ts","kind":"import-statement","original":"./descriptions/extractMarkdown.operation"},{"path":"nodes/Adeu/descriptions/applyEdits.operation.ts","kind":"import-statement","original":"./descriptions/applyEdits.operation"},{"path":"nodes/Adeu/descriptions/generateDiff.operation.ts","kind":"import-statement","original":"./descriptions/generateDiff.operation"},{"path":"nodes/Adeu/descriptions/finalizeDocument.operation.ts","kind":"import-statement","original":"./descriptions/finalizeDocument.operation"},{"path":"nodes/Adeu/GenericFunctions.ts","kind":"import-statement","original":"./GenericFunctions"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"}},"outputs":{"dist/nodes/Adeu/Adeu.node.js":{"imports":[{"path":"n8n-workflow","kind":"import-statement","external":true},{"path":"n8n-workflow","kind":"import-statement","external":true},{"path":"n8n-workflow","kind":"import-statement","external":true}],"exports":["Adeu"],"entryPoint":"nodes/Adeu/Adeu.node.ts","inputs":{"shims/module.js":{"bytesInOutput":121},"../../node_modules/@xmldom/xmldom/lib/conventions.js":{"bytesInOutput":2426},"../../node_modules/@xmldom/xmldom/lib/errors.js":{"bytesInOutput":2862},"../../node_modules/@xmldom/xmldom/lib/grammar.js":{"bytesInOutput":4480},"../../node_modules/@xmldom/xmldom/lib/dom.js":{"bytesInOutput":31528},"../../node_modules/@xmldom/xmldom/lib/entities.js":{"bytesInOutput":35900},"../../node_modules/@xmldom/xmldom/lib/sax.js":{"bytesInOutput":12549},"../../node_modules/@xmldom/xmldom/lib/dom-parser.js":{"bytesInOutput":5025},"../../node_modules/@xmldom/xmldom/lib/index.js":{"bytesInOutput":1094},"../../node_modules/diff-match-patch/index.js":{"bytesInOutput":19270},"nodes/Adeu/Adeu.node.ts":{"bytesInOutput":3743},"nodes/Adeu/descriptions/hydrateToolOutput.operation.ts":{"bytesInOutput":5292},"nodes/Adeu/GenericFunctions.ts":{"bytesInOutput":6014},"../../node_modules/fflate/esm/index.mjs":{"bytesInOutput":13375},"../core/dist/index.js":{"bytesInOutput":99537},"nodes/Adeu/descriptions/extractMarkdown.operation.ts":{"bytesInOutput":1587},"nodes/Adeu/descriptions/applyEdits.operation.ts":{"bytesInOutput":8088},"nodes/Adeu/descriptions/generateDiff.operation.ts":{"bytesInOutput":4279},"nodes/Adeu/descriptions/finalizeDocument.operation.ts":{"bytesInOutput":4878},"nodes/Adeu/descriptions/index.ts":{"bytesInOutput":4579}},"bytes":267237}}}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n8n-nodes-adeu",
3
- "version": "1.13.0",
3
+ "version": "1.14.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": "^1.13.0",
52
+ "@adeu/core": "^1.14.0",
53
53
  "@n8n/eslint-plugin-community-nodes": "^0.16.0",
54
54
  "@types/node": "^25.9.1",
55
55
  "@typescript-eslint/parser": "^8.59.4",