@eigenpal/docx-editor-agents 1.4.0 → 1.5.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.
@@ -0,0 +1 @@
1
+ 'use strict';var chunkVPUAYS3Y_js=require('./chunk-VPUAYS3Y.js'),chunkHTMMNA3I_js=require('./chunk-HTMMNA3I.js');function y(n,e){let{paragraphIndex:t,author:o="AI",text:s,search:a}=e,r=chunkVPUAYS3Y_js.b(n,t),c=(n.comments??[]).map(m=>m.id),p=c.length>0?Math.max(...c)+1:1,i={id:p,author:o,date:new Date().toISOString(),content:[{type:"paragraph",content:[{type:"run",content:[{type:"text",text:s}]}],formatting:{}}]};if(n.comments||(n.comments=[]),n.comments.push(i),a){let m=chunkVPUAYS3Y_js.j(r,a,t);r.content.splice(m.endRunIndex+1,0,{type:"commentRangeEnd",id:p}),r.content.splice(m.startRunIndex,0,{type:"commentRangeStart",id:p});}else r.content.unshift({type:"commentRangeStart",id:p}),r.content.push({type:"commentRangeEnd",id:p});return p}function C(n,e,t){let o=n.comments??[];if(!o.find(p=>p.id===e))throw new chunkVPUAYS3Y_js.i(e);let a=o.map(p=>p.id),r=Math.max(...a)+1,c={id:r,author:t.author??"AI",date:new Date().toISOString(),parentId:e,content:[{type:"paragraph",content:[{type:"run",content:[{type:"text",text:t.text}]}],formatting:{}}]};return o.push(c),r}function N(n,e){let t=n.comments??[],o=t.find(r=>r.id===e);if(!o)throw new chunkVPUAYS3Y_js.i(e);let s=o.parentId!==void 0,a=new Set([e]);if(!s)for(let r of t)r.parentId===e&&a.add(r.id);n.comments=t.filter(r=>!a.has(r.id)),!s&&chunkVPUAYS3Y_js.c(n,r=>{for(let c=r.content.length-1;c>=0;c--){let p=r.content[c];(p.type==="commentRangeStart"||p.type==="commentRangeEnd")&&p.id===e&&r.content.splice(c,1);}});}function I(n,e,t){if(!W(n,e,"accept",t))throw new chunkVPUAYS3Y_js.h(typeof e=="number"?e:e.id)}function R(n,e,t){if(!W(n,e,"reject",t))throw new chunkVPUAYS3Y_js.h(typeof e=="number"?e:e.id)}function F(n,e,t){return G(n,"accept",e,t)}function M(n,e,t){return G(n,"reject",e,t)}function l(n,e,t){let o=0;for(let s=n.content.length-1;s>=0;s--){let a=n.content[s];chunkVPUAYS3Y_js.a(a)&&t(a)&&(J(n,s,a,e),o++);}return o}function W(n,e,t,o){if(typeof e!="number"&&e.noteType){let a=e.noteType==="footnote"?o?.footnotes:o?.endnotes,r=e.noteId!==void 0?a?.find(c=>c.id===e.noteId):void 0;return r?z(r,e.id,t):false}let s=typeof e=="number"?e:e.id;return q(n,s,t)}function G(n,e,t,o){let s=0;if(chunkVPUAYS3Y_js.c(n,a=>{s+=l(a,e,()=>true);}),t?.includeFootnotes&&o?.footnotes)for(let a of o.footnotes)chunkVPUAYS3Y_js.d(a,r=>{s+=l(r,e,()=>true);});if(t?.includeEndnotes&&o?.endnotes)for(let a of o.endnotes)chunkVPUAYS3Y_js.d(a,r=>{s+=l(r,e,()=>true);});return s}function q(n,e,t){let o=false;return chunkVPUAYS3Y_js.c(n,s=>{if(l(s,t,a=>a.info.id===e)>0&&(o=true),o)return false}),o}function z(n,e,t){let o=false;return chunkVPUAYS3Y_js.d(n,s=>{l(s,t,a=>a.info.id===e)>0&&(o=true);}),o}function J(n,e,t,o){if(t.type==="insertion"&&o==="accept"||t.type==="deletion"&&o==="reject"||t.type==="moveTo"&&o==="accept"||t.type==="moveFrom"&&o==="reject"){let a=t.content;n.content.splice(e,1,...a);}else n.content.splice(e,1);}function x(n,e){let{paragraphIndex:t,search:o,author:s="AI",replaceWith:a}=e,r=chunkVPUAYS3Y_js.b(n,t),{startIndex:c,endIndex:p}=chunkVPUAYS3Y_js.k(r,o,t),i=new Date().toISOString(),m=P(n),d=r.content.slice(c,p+1),v={type:"deletion",info:{id:m,author:s,date:i},content:d},b={type:"insertion",info:{id:m+1,author:s,date:i},content:[{type:"run",content:[{type:"text",text:a}]}]};r.content.splice(c,p-c+1,v,b);}function H(n,e){let{paragraphIndex:t,author:o="AI",insertText:s,position:a="after",search:r}=e,c=chunkVPUAYS3Y_js.b(n,t),p=new Date().toISOString(),m={type:"insertion",info:{id:P(n),author:o,date:p},content:[{type:"run",content:[{type:"text",text:s}]}]};if(r){let{startIndex:d,endIndex:v}=chunkVPUAYS3Y_js.k(c,r,t),b=a==="after"?v+1:d;c.content.splice(b,0,m);}else a==="before"?c.content.unshift(m):c.content.push(m);}function L(n,e){let{paragraphIndex:t,search:o,author:s="AI"}=e,a=chunkVPUAYS3Y_js.b(n,t),{startIndex:r,endIndex:c}=chunkVPUAYS3Y_js.k(a,o,t),p=new Date().toISOString(),i=P(n),m=a.content.slice(r,c+1),d={type:"deletion",info:{id:i,author:s,date:p},content:m};a.content.splice(r,c-r+1,d);}var S=new WeakMap;function P(n){let e=S.get(n);e===void 0&&(e=0,chunkVPUAYS3Y_js.c(n,o=>{for(let s of o.content)chunkVPUAYS3Y_js.a(s)&&(e=Math.max(e,s.info.id));}));let t=e+1;return S.set(n,t+1),t}function U(n,e,t="AI"){let o=[],s=0,a=0,r=0,c=0,p=0;for(let i of e.accept??[])try{I(n,i),s++;}catch(m){o.push({operation:"accept",id:i,error:m.message});}for(let i of e.reject??[])try{R(n,i),a++;}catch(m){o.push({operation:"reject",id:i,error:m.message});}for(let i of e.comments??[])try{y(n,{...i,author:i.author??t}),r++;}catch(m){o.push({operation:"comment",search:i.search,error:m.message});}for(let i of e.replies??[])try{C(n,i.commentId,{author:i.author??t,text:i.text}),c++;}catch(m){o.push({operation:"reply",id:i.commentId,error:m.message});}for(let i of e.proposals??[])try{x(n,{...i,author:i.author??t}),p++;}catch(m){o.push({operation:"proposal",search:i.search,error:m.message});}return {accepted:s,rejected:a,commentsAdded:r,repliesAdded:c,proposalsAdded:p,errors:o}}var X=class n{constructor(e,t="AI",o){let s=o??e.originalBuffer,{originalBuffer:a,...r}=e;this.doc=structuredClone(r),s&&(this.doc.originalBuffer=s),this.author=t;}static async fromBuffer(e,t="AI"){let o=await chunkHTMMNA3I_js.w(e,{preloadFonts:false});return new n(o,t,e)}get body(){return this.doc.package.document}resolveAuthor(e){return e??this.author}getContent(e){return chunkVPUAYS3Y_js.e(this.body,e)}getContentAsText(e){return chunkVPUAYS3Y_js.f(chunkVPUAYS3Y_js.e(this.body,e))}getChanges(e){return chunkVPUAYS3Y_js.l(this.body,e,{footnotes:this.doc.package.footnotes,endnotes:this.doc.package.endnotes})}getComments(e){return chunkVPUAYS3Y_js.m(this.body,e)}addComment(e,t){let o=typeof e=="number"?{paragraphIndex:e,text:t,author:this.author}:{...e,author:this.resolveAuthor(e.author)};return y(this.body,o)}replyTo(e,t){let o=typeof t=="string"?{text:t,author:this.author}:{...t,author:this.resolveAuthor(t.author)};return C(this.body,e,o)}removeComment(e){N(this.body,e);}replace(e,t,o){let s=typeof e=="number"?{paragraphIndex:e,search:t,replaceWith:o,author:this.author}:{...e,author:this.resolveAuthor(e.author)};x(this.body,s);}proposeReplacement(e){this.replace(e);}proposeInsertion(e){H(this.body,{...e,author:this.resolveAuthor(e.author)});}proposeDeletion(e){L(this.body,{...e,author:this.resolveAuthor(e.author)});}acceptChange(e){I(this.body,e,this.changeNotes());}rejectChange(e){R(this.body,e,this.changeNotes());}acceptAll(e){return F(this.body,e,this.changeNotes())}rejectAll(e){return M(this.body,e,this.changeNotes())}changeNotes(){return {footnotes:this.doc.package.footnotes,endnotes:this.doc.package.endnotes}}applyReview(e){return U(this.body,e,this.author)}toDocument(){return this.doc}async toBuffer(){if(!this.doc.originalBuffer)throw new Error("Cannot create buffer: no original DOCX buffer was provided. Use DocxReviewer.fromBuffer() or pass originalBuffer to the constructor.");let{repackDocx:e}=await import('./headless-HVIRJIN4.js');return e(this.doc)}};exports.a=X;
@@ -1,2 +1,2 @@
1
- 'use strict';var chunkXUAUDUJU_js=require('./chunk-XUAUDUJU.js');function y(n){return !n||n.length===0?"":n.map(i=>{let s=i;return s?.content?s.content.map(e=>e.content?.map(t=>t.text||"").join("")||"").join(""):""}).join(`
2
- `)}function u(n){let i=n.getEditorRef();if(i){let e=i.getDocument();if(e?.package?.document)return e.package.document}return n.getDocument()?.package?.document??null}function T(n,i="AI"){function s(e){return e??i}return {getContentAsText(e){let t=u(n);return t?chunkXUAUDUJU_js.e(chunkXUAUDUJU_js.d(t,e)):""},getContent(e){let t=u(n);return t?chunkXUAUDUJU_js.d(t,e):[]},getComments(e){let t=u(n);if(!t)return [];let r=chunkXUAUDUJU_js.m(t,e);if(r.length>0)return r;let l=n.getComments();if(l.length===0)return [];let a=new Map,g=[];for(let o of l)if(o.parentId){let c=a.get(o.parentId);c?c.push(o):a.set(o.parentId,[o]);}else g.push(o);let m=[];for(let o of g){if(e?.author&&o.author!==e.author||e?.done!==void 0&&(o.done??false)!==e.done)continue;let c=a.get(o.id)??[];m.push({id:o.id,author:o.author,date:o.date??null,text:y(o.content),anchoredText:"",paragraphIndex:-1,replies:c.map(p=>({id:p.id,author:p.author,date:p.date??null,text:y(p.content)})),done:o.done??false});}return m},getChanges(e){let t=u(n);return t?chunkXUAUDUJU_js.l(t,e):[]},findText(e,t){return n.findInDocument(e,t)},getSelection(){return n.getSelectionInfo()},addComment(e){return n.addComment({paraId:e.paraId,text:e.text,author:s(e.author),search:e.search})},replyTo(e,t){return n.replyToComment(e,t.text,s(t.author))},resolveComment(e){n.resolveComment(e);},proposeChange(e){return n.proposeChange({paraId:e.paraId,search:e.search,replaceWith:e.replaceWith,author:s(e.author)})},applyFormatting(e){return n.applyFormatting({paraId:e.paraId,search:e.search,marks:e.marks})},setParagraphStyle(e){return n.setParagraphStyle({paraId:e.paraId,styleId:e.styleId})},getPage(e){return n.getPageContent(e)},getPages(e){let t=n.getTotalPages(),r=Math.max(1,Math.min(e.from,t)),l=Math.max(r,Math.min(e.to,t)),a=[];for(let g=r;g<=l;g++){let m=n.getPageContent(g);m&&a.push(m);}return a},getTotalPages(){return n.getTotalPages()},getCurrentPage(){return n.getCurrentPage()},scrollTo(e){return n.scrollToParaId(e)},onContentChange(e){return n.onContentChange(()=>{let t=u(n),r=t?chunkXUAUDUJU_js.m(t):[],l=t?chunkXUAUDUJU_js.l(t):[];try{e({commentCount:r.length,changeCount:l.length,comments:r,changes:l});}catch(a){console.error("onContentChange listener threw:",a);}})},onSelectionChange(e){return n.onSelectionChange(()=>{try{e(n.getSelectionInfo());}catch(t){console.error("onSelectionChange listener threw:",t);}})}}}exports.a=T;
1
+ 'use strict';var chunkVPUAYS3Y_js=require('./chunk-VPUAYS3Y.js');function y(n){return !n||n.length===0?"":n.map(i=>{let s=i;return s?.content?s.content.map(e=>e.content?.map(t=>t.text||"").join("")||"").join(""):""}).join(`
2
+ `)}function u(n){let i=n.getEditorRef();if(i){let e=i.getDocument();if(e?.package?.document)return e.package.document}return n.getDocument()?.package?.document??null}function T(n,i="AI"){function s(e){return e??i}return {getContentAsText(e){let t=u(n);return t?chunkVPUAYS3Y_js.f(chunkVPUAYS3Y_js.e(t,e)):""},getContent(e){let t=u(n);return t?chunkVPUAYS3Y_js.e(t,e):[]},getComments(e){let t=u(n);if(!t)return [];let r=chunkVPUAYS3Y_js.m(t,e);if(r.length>0)return r;let l=n.getComments();if(l.length===0)return [];let a=new Map,g=[];for(let o of l)if(o.parentId){let c=a.get(o.parentId);c?c.push(o):a.set(o.parentId,[o]);}else g.push(o);let m=[];for(let o of g){if(e?.author&&o.author!==e.author||e?.done!==void 0&&(o.done??false)!==e.done)continue;let c=a.get(o.id)??[];m.push({id:o.id,author:o.author,date:o.date??null,text:y(o.content),anchoredText:"",paragraphIndex:-1,replies:c.map(p=>({id:p.id,author:p.author,date:p.date??null,text:y(p.content)})),done:o.done??false});}return m},getChanges(e){let t=u(n);return t?chunkVPUAYS3Y_js.l(t,e):[]},findText(e,t){return n.findInDocument(e,t)},getSelection(){return n.getSelectionInfo()},addComment(e){return n.addComment({paraId:e.paraId,text:e.text,author:s(e.author),search:e.search})},replyTo(e,t){return n.replyToComment(e,t.text,s(t.author))},resolveComment(e){n.resolveComment(e);},proposeChange(e){return n.proposeChange({paraId:e.paraId,search:e.search,replaceWith:e.replaceWith,author:s(e.author)})},applyFormatting(e){return n.applyFormatting({paraId:e.paraId,search:e.search,marks:e.marks})},setParagraphStyle(e){return n.setParagraphStyle({paraId:e.paraId,styleId:e.styleId})},getPage(e){return n.getPageContent(e)},getPages(e){let t=n.getTotalPages(),r=Math.max(1,Math.min(e.from,t)),l=Math.max(r,Math.min(e.to,t)),a=[];for(let g=r;g<=l;g++){let m=n.getPageContent(g);m&&a.push(m);}return a},getTotalPages(){return n.getTotalPages()},getCurrentPage(){return n.getCurrentPage()},scrollTo(e){return n.scrollToParaId(e)},onContentChange(e){return n.onContentChange(()=>{let t=u(n),r=t?chunkVPUAYS3Y_js.m(t):[],l=t?chunkVPUAYS3Y_js.l(t):[];try{e({commentCount:r.length,changeCount:l.length,comments:r,changes:l});}catch(a){console.error("onContentChange listener threw:",a);}})},onSelectionChange(e){return n.onSelectionChange(()=>{try{e(n.getSelectionInfo());}catch(t){console.error("onSelectionChange listener threw:",t);}})}}}exports.a=T;
@@ -0,0 +1,5 @@
1
+ 'use strict';var chunkHTMMNA3I_js=require('./chunk-HTMMNA3I.js'),chunkEPRXZTIE_js=require('./chunk-EPRXZTIE.js');function m(o){return o.type==="insertion"||o.type==="deletion"||o.type==="moveFrom"||o.type==="moveTo"}function b(o){let t=[];for(let r of o)r.type==="run"?t.push(chunkHTMMNA3I_js.H(r)):r.type==="hyperlink"&&t.push(chunkHTMMNA3I_js.I(r));return t.join("")}function v(o,t){let r=0;for(let n of o.content)if(n.type==="paragraph"){if(r===t)return n;r++;}else if(n.type==="table"){for(let a of n.rows)for(let e of a.cells)for(let i of e.content)if(i.type==="paragraph"){if(r===t)return i;r++;}}else r++;throw new Error(`Paragraph index ${t} out of bounds (max: ${r-1})`)}function L(o,t,r){let n=0;for(let a of o)if(a.type==="paragraph"){if(r(a,n)===false)return;n++;}else if(a.type==="table"){for(let e of a.rows)for(let i of e.cells)for(let s of i.content)if(s.type==="paragraph"){if(r(s,n)===false)return;n++;}}else t&&n++;}function F(o,t){L(o.content,true,t);}function k(o,t){L(o.content,false,t);}function me(o,t={}){let{fromIndex:r,toIndex:n,includeTrackedChanges:a=true,includeCommentAnchors:e=true}=t,i=[],s=0;for(let u of o.content)if(u.type==="paragraph")j(s,r,n)&&i.push(q(u,s,a,e)),s++;else if(u.type==="table"){j(s,r,n)&&i.push(ee(u,s,a,e));for(let l of u.rows)for(let c of l.cells)for(let f of c.content)f.type==="paragraph"&&s++;}else s++;return i}function j(o,t,r){return (t===void 0||o>=t)&&(r===void 0||o<=r)}function q(o,t,r,n){let a=H(o,r,n),e=o.formatting?.styleId,i=o.paraId;return chunkHTMMNA3I_js.U(e)?{type:"heading",index:t,paraId:i,level:chunkHTMMNA3I_js.V(e)??1,text:a}:o.listRendering?{type:"list-item",index:t,paraId:i,text:a,listLevel:o.listRendering.level??0,listType:o.listRendering.isBullet?"bullet":"number"}:{type:"paragraph",index:t,paraId:i,text:a}}function ee(o,t,r,n){let a=[],e=[];for(let i of o.rows){let s=[],u=[];for(let l of i.cells){let c=[],f;for(let d of l.content)d.type==="paragraph"&&(f===void 0&&(f=d.paraId),c.push(H(d,r,n)));s.push(c.join(`
2
+ `)),u.push(f);}a.push(s),e.push(u);}return {type:"table",index:t,rows:a,cellParaIds:e}}function xe(o){let t=[],r=n=>n.paraId?n.paraId:String(n.index);for(let n of o)switch(n.type){case "heading":t.push(`[${r(n)}] (h${n.level}) ${n.text}`);break;case "paragraph":t.push(`[${r(n)}] ${n.text}`);break;case "list-item":{let a=" ".repeat(n.listLevel),e=n.listType==="bullet"?"\u2022":"-";t.push(`[${r(n)}] ${a}${e} ${n.text}`);break}case "table":{let a=n.index;for(let e=0;e<n.rows.length;e++)for(let i=0;i<n.rows[e].length;i++){let u=n.rows[e][i].split(`
3
+ `),l=n.cellParaIds?.[e]?.[i];for(let c=0;c<u.length;c++){let f=c===0&&l?l:String(a);t.push(`[${f}] (table, row ${e+1}, col ${i+1}) ${u[c]}`),a++;}}break}}return t.join(`
4
+ `)}function H(o,t,r){let n=[],a=new Set;for(let e of o.content){if(e.type==="commentRangeStart"&&r){a.add(e.id),n.push(`[comment:${e.id}]`);continue}if(e.type==="commentRangeEnd"&&r){a.has(e.id)&&(a.delete(e.id),n.push("[/comment]"));continue}if(e.type==="run")n.push(chunkHTMMNA3I_js.H(e));else if(e.type==="hyperlink")n.push(chunkHTMMNA3I_js.I(e));else if(m(e)){let i=b(e.content);e.type==="insertion"||e.type==="moveTo"?t&&n.push(`[+${i}+]{by:${e.info.author}}`):t?n.push(`[-${i}-]{by:${e.info.author}}`):n.push(i);}}return n.join("")}var C=class extends Error{constructor(t,r){let n=r!==void 0?` in paragraph ${r}`:" in document";super(`Text not found${n}: "${t}"`),this.name="TextNotFoundError";}},N=class extends Error{constructor(t){super(`Tracked change not found: id=${t}`),this.name="ChangeNotFoundError";}},R=class extends Error{constructor(t){super(`Comment not found: id=${t}`),this.name="CommentNotFoundError";}};function X(o){let t=[],r=0;for(let n=0;n<o.content.length;n++){let a=o.content[n];if(a.type==="run"){let e=chunkHTMMNA3I_js.H(a);t.push({contentIndex:n,run:a,text:e,startPos:r}),r+=e.length;}else if(a.type==="hyperlink")for(let e=0;e<a.children.length;e++){let i=a.children[e];if(i.type==="run"){let s=chunkHTMMNA3I_js.H(i);t.push({contentIndex:n,run:i,text:s,startPos:r}),r+=s.length;}}else if(m(a)){if(a.type==="insertion"||a.type==="moveTo")continue;for(let e=0;e<a.content.length;e++){let i=a.content[e];if(i.type==="run"){let s=chunkHTMMNA3I_js.H(i);t.push({contentIndex:n,run:i,text:s,startPos:r}),r+=s.length;}else if(i.type==="hyperlink"){for(let s of i.children)if(s.type==="run"){let u=chunkHTMMNA3I_js.H(s);t.push({contentIndex:n,run:s,text:u,startPos:r}),r+=u.length;}}}}}return t}function w(o){return X(o).map(t=>t.text).join("")}function te(o,t,r){let n=X(o),a=n.map(c=>c.text).join(""),e=ne(a,t);if(!e)throw new C(t,r);let i=-1,s=0;for(let c=0;c<n.length;c++)if(e.start<n[c].startPos+n[c].text.length){i=c,s=e.start-n[c].startPos;break}let u=-1,l=0;for(let c=n.length-1;c>=0;c--)if(e.end>n[c].startPos){u=c,l=e.end-n[c].startPos;break}if(i===-1||u===-1)throw new C(t,r);return {startRunIndex:n[i].contentIndex,startOffset:s,endRunIndex:n[u].contentIndex,endOffset:l}}function Re(o,t,r){let n=te(o,t,r),{startRunIndex:a,endRunIndex:e}=n,{startOffset:i,endOffset:s}=n,u=o.content[e];if(u.type==="run"){let c=chunkHTMMNA3I_js.H(u);if(s<c.length){let f=z(c.slice(s),u);W(u,c.slice(0,s)),o.content.splice(e+1,0,f);}}let l=o.content[a];if(l.type==="run"&&i>0){let c=chunkHTMMNA3I_js.H(l),f=z(c.slice(0,i),l);W(l,c.slice(i)),o.content.splice(a,0,f),a++,e++;}return {startIndex:a,endIndex:e}}function z(o,t){return {type:"run",content:[{type:"text",text:o}],formatting:t.formatting?{...t.formatting}:void 0}}function W(o,t){let r=o.content.find(n=>n.type==="text");r&&(r.text=t);}function G(o){let t=[],r=[],n=true;for(let a=0;a<o.length;a++){let e=o[a];if(!"\u200B\u200C\u200D\uFEFF\xAD".includes(e)){if("\u201C\u201D\u201E\u201F".includes(e)&&(e='"'),"\u2018\u2019\u201A\u201B".includes(e)&&(e="'"),"\u2013\u2014\u2012\u2015".includes(e)&&(e="-"),e==="\u2026"){t.push(".",".","."),r.push(a,a,a),n=false;continue}if(/\s/.test(e)||e==="\xA0"){n||(t.push(" "),r.push(a),n=true);continue}t.push(e.toLowerCase()),r.push(a),n=false;}}return t.length>0&&t[t.length-1]===" "&&(t.pop(),r.pop()),{text:t.join(""),posMap:r}}function U(o,t,r,n){let a=o.posMap[t],e=o.posMap[t+r-1]+1;for(;e<n.length&&"\u200B\u200C\u200D\uFEFF\xAD".includes(n[e]);)e++;return {start:a,end:e}}function ne(o,t){if(!t||!o)return null;let r=o.indexOf(t);if(r!==-1)return {start:r,end:r+t.length};let n=G(o),a=G(t);if(!a.text)return null;let e=n.text.indexOf(a.text);if(e!==-1)return U(n,e,a.text.length,o);let i=a.text.split(" ");if(i.length>=3)for(let s=1;s<=Math.min(2,i.length-2);s++){let u=i.slice(0,-s).join(" "),l=n.text.indexOf(u);if(l!==-1)return U(n,l,u.length,o)}return null}function Fe(o,t,r){let n=new Map,a=(i,s,u)=>{let l=null;for(let c of i.content)if(m(c)){l===null&&(l=w(i));let f=b(c.content),d=c.info.id,x=`${u.noteType??"body"}:${u.noteId??""}:${d}`,h=n.get(x);h&&h.paragraphIndex===s?h.text+=f:n.set(x,{id:d,type:c.type,author:c.info.author,date:c.info.date??null,text:f,context:l,paragraphIndex:s,...u.noteId!==void 0?{noteId:u.noteId}:{},...u.noteType!==void 0?{noteType:u.noteType}:{}});}};if(F(o,(i,s)=>a(i,s,{})),t?.includeFootnotes&&r?.footnotes)for(let i of r.footnotes)k(i,(s,u)=>a(s,u,{noteId:i.id,noteType:"footnote"}));if(t?.includeEndnotes&&r?.endnotes)for(let i of r.endnotes)k(i,(s,u)=>a(s,u,{noteId:i.id,noteType:"endnote"}));return Array.from(n.values()).filter(i=>!(t?.author&&i.author!==t.author||t?.type&&i.type!==t.type))}function ke(o,t){let r=o.comments??[];if(r.length===0)return [];let n=oe(o),a=[],e=new Map;for(let s of r)if(s.parentId!==void 0){let u=e.get(s.parentId)??[];u.push(s),e.set(s.parentId,u);}else a.push(s);return a.map(s=>{let u=n.get(s.id),l=(e.get(s.id)??[]).map(c=>({id:c.id,author:c.author,date:c.date??null,text:J(c)}));return {id:s.id,author:s.author,date:s.date??null,text:J(s),anchoredText:u?.text??"",paragraphIndex:u?.paragraphIndex??-1,replies:l,done:s.done??false}}).filter(s=>!(t?.author&&s.author!==t.author||t?.done!==void 0&&s.done!==t.done))}function J(o){return o.content.map(t=>w(t)).join(`
5
+ `)}function oe(o){let t=new Map,r=new Map;return F(o,(n,a)=>{for(let e of n.content)if(e.type==="commentRangeStart")r.set(e.id,{paragraphIndex:a,parts:[]});else if(e.type==="commentRangeEnd"){let i=r.get(e.id);i&&(t.set(e.id,{text:i.parts.join(""),paragraphIndex:i.paragraphIndex}),r.delete(e.id));}else if(e.type==="run"){let i=chunkHTMMNA3I_js.H(e);for(let s of r.values())s.parts.push(i);}else if(e.type==="hyperlink"){let i=e.children.filter(s=>s.type==="run").map(chunkHTMMNA3I_js.H).join("");for(let s of r.values())s.parts.push(i);}else if(m(e)){if(e.type==="insertion"||e.type==="moveTo")continue;let i=b(e.content);for(let s of r.values())s.parts.push(i);}}),t}function re(o){let t=o.toDocument().package?.document;if(!t)return new Map;let r=new Map,n=0;for(let a of t.content)if(a.type==="paragraph"){let e=a.paraId;r.set(e??String(n),n),n++;}else if(a.type==="table")for(let e of a.rows)for(let i of e.cells)for(let s of i.content)s.type==="paragraph"&&n++;else n++;return r}function ae(o){let t=[],r=n=>{for(let a of n.content)a.type==="text"&&t.push(a.text??"");};for(let n of o.content)if(n.type==="run")r(n);else if(n.type==="hyperlink")for(let a of n.children)a.type==="run"&&r(a);else if(n.type==="deletion"||n.type==="moveFrom"){for(let a of n.content)if(a.type==="run")r(a);else if(a.type==="hyperlink")for(let e of a.children)e.type==="run"&&r(e);}return t.join("")}function B(o,t){let n={type:"run",content:[{type:"text",text:t,preserveSpace:/^\s|\s$/.test(t)}]};return o.formatting&&(n.formatting={...o.formatting}),o.propertyChanges&&(n.propertyChanges=[...o.propertyChanges]),n}function ie(o){return o.content.map(t=>t.type==="text"?t.text:"").join("")}function M(o,t,r,n,a){let e=ie(o);if(!e)return;let i=a.value,s=i+e.length;n.push({run:o,parent:t,index:r,text:e,start:i,end:s}),a.value=s;}function K(o,t,r){o.children.forEach((n,a)=>{n.type==="run"&&M(n,o.children,a,t,r);});}function D(o,t){let r=[],n={value:0};return o.content.forEach((a,e)=>{a.type==="run"?M(a,o.content,e,r,n):a.type==="hyperlink"?K(a,r,n):(a.type==="deletion"||a.type==="moveFrom"||t&&(a.type==="insertion"||a.type==="moveTo"))&&a.content.forEach((i,s)=>{i.type==="run"?M(i,a.content,s,r,n):i.type==="hyperlink"&&K(i,r,n);});}),r}function se(o,t){let r={...o??{}};t.bold!==void 0&&(r.bold=t.bold||void 0),t.italic!==void 0&&(r.italic=t.italic||void 0),t.underline!==void 0&&(t.underline?r.underline={style:typeof t.underline=="object"&&t.underline.style?t.underline.style:"single"}:delete r.underline),t.strike!==void 0&&(r.strike=t.strike||void 0),t.color!==void 0&&(t.color&&(t.color.rgb||t.color.themeColor)?r.color={rgb:t.color.rgb,themeColor:t.color.themeColor}:delete r.color),t.highlight!==void 0&&(t.highlight?r.highlight=chunkHTMMNA3I_js.va(t.highlight)||t.highlight:delete r.highlight),t.fontSize!==void 0&&(t.fontSize>0?r.fontSize=chunkEPRXZTIE_js.m(t.fontSize):delete r.fontSize),t.fontFamily!==void 0&&(t.fontFamily&&(t.fontFamily.ascii||t.fontFamily.hAnsi)?r.fontFamily={ascii:t.fontFamily.ascii,hAnsi:t.fontFamily.hAnsi??t.fontFamily.ascii}:delete r.fontFamily);for(let n of Object.keys(r))r[n]===void 0&&delete r[n];return Object.keys(r).length>0?r:void 0}function S(o,t){o.formatting=se(o.formatting,t);}function ue(o,t,r,n){let a=o.run.content.every(s=>s.type==="text");if(t<=0&&r>=o.text.length||!a){S(o.run,n);return}let e=[];t>0&&e.push(B(o.run,o.text.slice(0,t)));let i=B(o.run,o.text.slice(t,r));S(i,n),e.push(i),r<o.text.length&&e.push(B(o.run,o.text.slice(r))),o.parent.splice(o.index,1,...e);}function ce(o,t,r,n){let e=D(o,false).filter(i=>i.start<r&&i.end>t);if(e.length===0)return true;for(let i=e.length-1;i>=0;i--){let s=e[i];ue(s,Math.max(0,t-s.start),Math.min(s.text.length,r-s.start),n);}return true}function le(o,t){let r=D(o,true);for(let n of r)S(n.run,t);return true}function fe(o,t){if(!t)return null;let n=D(o,false).map(e=>e.text).join(""),a=n.indexOf(t);return a===-1||n.indexOf(t,a+1)!==-1?null:{from:a,to:a+t.length}}function pe(o,t){return o?!!o.styles?.some(r=>r.styleId===t&&r.type==="paragraph"):true}function De(o){let t=new Set,r=null;function n(){return r===null&&(r=re(o)),r}function a(){if(t.size===0)return;let e=o.getComments(),i=o.getChanges(),s={commentCount:e.length,changeCount:i.length,comments:e,changes:i};for(let u of t)try{u(s);}catch(l){console.error("reviewerBridge content listener threw:",l);}}return {getContentAsText(e){return o.getContentAsText(e)},getContent(e){return o.getContent(e)},getComments(e){return o.getComments(e)},getChanges(e){return o.getChanges(e)},findText(e,i){if(!e)return [];let s=i?.caseSensitive??false,u=i?.limit??20,l=s?e:e.toLowerCase(),c=o.toDocument().package?.document;if(!c)return [];let f=[],d=40,x=0;for(let h of c.content){if(f.length>=u)break;if(h.type==="table"){for(let Y of h.rows)for(let Z of Y.cells)for(let _ of Z.content)_.type==="paragraph"&&x++;continue}if(h.type!=="paragraph"){x++;continue}let E=h,Q=x++,y=ae(E),$=s?y:y.toLowerCase(),g=$.indexOf(l);if(g===-1||$.indexOf(l,g+1)!==-1)continue;let V=y.slice(g,g+e.length);f.push({paraId:E.paraId??String(Q),match:V,before:y.slice(Math.max(0,g-d),g),after:y.slice(g+e.length,g+e.length+d)});}return f},getSelection(){return null},addComment(e){let i=n().get(e.paraId);if(i===void 0)return null;try{let s=o.addComment({paragraphIndex:i,text:e.text,author:e.author,search:e.search});return a(),s}catch{return null}},replyTo(e,i){try{let s=o.replyTo(e,i);return a(),s}catch{return null}},resolveComment(e){let s=o.toDocument().package?.document?.comments?.find(u=>u.id===e);if(!s)throw new R(e);s.done=true,a();},proposeChange(e){let i=n().get(e.paraId);if(i===void 0)return false;let s=e.search==="",u=e.replaceWith==="";if(s&&u)return false;try{return s?o.proposeInsertion({paragraphIndex:i,insertText:e.replaceWith,author:e.author}):u?o.proposeDeletion({paragraphIndex:i,search:e.search,author:e.author}):o.replace({paragraphIndex:i,search:e.search,replaceWith:e.replaceWith,author:e.author}),a(),true}catch{return false}},scrollTo(e){return n().has(e)},applyFormatting(e){let i=n().get(e.paraId);if(i===void 0)return false;let s=o.toDocument().package?.document;if(!s)return false;try{let u=s?v(s,i):null;if(!u)return false;if(e.search){let l=fe(u,e.search);if(!l)return false;ce(u,l.from,l.to,e.marks);}else le(u,e.marks);return a(),true}catch{return false}},setParagraphStyle(e){let i=n().get(e.paraId);if(i===void 0)return false;let s=o.toDocument(),u=s.package?.document;if(!u||!pe(s.package?.styles,e.styleId))return false;try{let l=v(u,i);return l.formatting={...l.formatting??{},styleId:e.styleId},a(),true}catch{return false}},getPage(){return null},getPages(){return []},getTotalPages(){return 0},getCurrentPage(){return 0},onContentChange(e){return t.add(e),()=>{t.delete(e);}},onSelectionChange(){return ()=>{}}}}exports.a=m;exports.b=v;exports.c=F;exports.d=k;exports.e=me;exports.f=xe;exports.g=C;exports.h=N;exports.i=R;exports.j=te;exports.k=Re;exports.l=Fe;exports.m=ke;exports.n=De;
@@ -1 +1 @@
1
- export{ga as ContentControlBoundError,ea as ContentControlLockedError,da as ContentControlNotFoundError,fa as ContentControlTypeError,ja as ContentControlValueError,Qa as DEFAULT_AI_ACTIONS,x as DocumentAgent,oa as RepeatingSectionError,Sa as VERSION,pa as addRepeatingSectionItem,i as attemptSelectiveSave,Ha as blendColors,E as buildExtendedSelectionContext,h as buildPatchedDocumentXml,D as buildSelectionContext,B as buildSelectionContextFromContext,Ia as colorsEqual,Na as comparePositions,M as countCharacters,L as countWords,y as createAgent,z as createAgentFromDocument,Ka as createCollapsedRange,Ra as createCommand,ua as createDocumentWithText,f as createDocx,ta as createEmptyDocument,La as createRange,Ea as createRgbColor,Da as createThemeColor,Fa as darkenColor,j as detectVariables,k as detectVariablesDetailed,l as detectVariablesInBody,m as detectVariablesInParagraph,v as documentHasVariables,n as extractVariablesFromText,ca as findContentControl,ba as findContentControls,ka as formatSdtDate,r as formatVariable,Pa as getActionDescription,Oa as getActionLabel,A as getAgentContext,$ as getBlockIndexForParagraph,O as getBodyCharacterCount,K as getBodyText,N as getBodyWordCount,aa as getContentControlText,Ba as getContrastingColor,C as getDocumentSummary,ra as getDocumentWatermark,R as getFormattingAtPosition,T as getHyperlinkAtPosition,I as getHyperlinkText,_ as getParagraphAtIndex,G as getParagraphText,Z as getParagraphs,H as getRunText,F as getSelectionFormattingSummary,J as getTableText,Q as getTextAfter,P as getTextBefore,X as hasHyperlinks,W as hasImages,Y as hasTables,o as hasTemplateVariables,za as isBlack,U as isHeadingStyle,S as isPositionInHyperlink,Ma as isPositionInRange,ma as isRepeatingSection,na as isRepeatingSectionItem,p as isValidVariableName,Aa as isWhite,Ja as isZodSchema,Ga as lightenColor,va as mapHexToHighlightName,Ca as parseColorString,w as parseDocx,V as parseHeadingLevel,s as parseVariable,ia as removeContentControl,qa as removeRepeatingSectionItem,u as removeVariables,d as repackDocx,t as replaceVariables,wa as resolveColor,xa as resolveHighlightColor,ya as resolveShadingColor,q as sanitizeVariableName,b as serializeDocumentBody,c as serializeDocx,a as serializeSectionProperties,ha as setContentControlContent,la as setContentControlValue,sa as setDocumentWatermark,e as updateMultipleFiles,g as validatePatchSafety}from'./chunk-2OIX7TUX.mjs';export{j as createTemplateProcessor,g as getMissingVariables,e as getTemplateTags,h as previewTemplate,a as processTemplate,i as processTemplateAdvanced,c as processTemplateAsBlob,b as processTemplateDetailed,f as validateTemplate}from'./chunk-UILTIEBD.mjs';export{a as PluginRegistry,d as createPluginRegistrar,g as emuToPixels,i as emuToTwips,o as executeCommand,p as executeCommands,n as formatPx,l as halfPointsToPixels,h as pixelsToEmu,f as pixelsToTwips,b as pluginRegistry,m as pointsToHalfPoints,k as pointsToPixels,c as registerPlugins,j as twipsToEmu,e as twipsToPixels}from'./chunk-XDZHYYU6.mjs';
1
+ export{ga as ContentControlBoundError,ea as ContentControlLockedError,da as ContentControlNotFoundError,fa as ContentControlTypeError,ja as ContentControlValueError,Qa as DEFAULT_AI_ACTIONS,x as DocumentAgent,oa as RepeatingSectionError,Sa as VERSION,pa as addRepeatingSectionItem,i as attemptSelectiveSave,Ha as blendColors,E as buildExtendedSelectionContext,h as buildPatchedDocumentXml,D as buildSelectionContext,B as buildSelectionContextFromContext,Ia as colorsEqual,Na as comparePositions,M as countCharacters,L as countWords,y as createAgent,z as createAgentFromDocument,Ka as createCollapsedRange,Ra as createCommand,ua as createDocumentWithText,f as createDocx,ta as createEmptyDocument,La as createRange,Ea as createRgbColor,Da as createThemeColor,Fa as darkenColor,j as detectVariables,k as detectVariablesDetailed,l as detectVariablesInBody,m as detectVariablesInParagraph,v as documentHasVariables,n as extractVariablesFromText,ca as findContentControl,ba as findContentControls,ka as formatSdtDate,r as formatVariable,Pa as getActionDescription,Oa as getActionLabel,A as getAgentContext,$ as getBlockIndexForParagraph,O as getBodyCharacterCount,K as getBodyText,N as getBodyWordCount,aa as getContentControlText,Ba as getContrastingColor,C as getDocumentSummary,ra as getDocumentWatermark,R as getFormattingAtPosition,T as getHyperlinkAtPosition,I as getHyperlinkText,_ as getParagraphAtIndex,G as getParagraphText,Z as getParagraphs,H as getRunText,F as getSelectionFormattingSummary,J as getTableText,Q as getTextAfter,P as getTextBefore,X as hasHyperlinks,W as hasImages,Y as hasTables,o as hasTemplateVariables,za as isBlack,U as isHeadingStyle,S as isPositionInHyperlink,Ma as isPositionInRange,ma as isRepeatingSection,na as isRepeatingSectionItem,p as isValidVariableName,Aa as isWhite,Ja as isZodSchema,Ga as lightenColor,va as mapHexToHighlightName,Ca as parseColorString,w as parseDocx,V as parseHeadingLevel,s as parseVariable,ia as removeContentControl,qa as removeRepeatingSectionItem,u as removeVariables,d as repackDocx,t as replaceVariables,wa as resolveColor,xa as resolveHighlightColor,ya as resolveShadingColor,q as sanitizeVariableName,b as serializeDocumentBody,c as serializeDocx,a as serializeSectionProperties,ha as setContentControlContent,la as setContentControlValue,sa as setDocumentWatermark,e as updateMultipleFiles,g as validatePatchSafety}from'./chunk-3XKOKAHP.mjs';export{j as createTemplateProcessor,g as getMissingVariables,e as getTemplateTags,h as previewTemplate,a as processTemplate,i as processTemplateAdvanced,c as processTemplateAsBlob,b as processTemplateDetailed,f as validateTemplate}from'./chunk-UILTIEBD.mjs';export{a as PluginRegistry,d as createPluginRegistrar,g as emuToPixels,i as emuToTwips,o as executeCommand,p as executeCommands,n as formatPx,l as halfPointsToPixels,h as pixelsToEmu,f as pixelsToTwips,b as pluginRegistry,m as pointsToHalfPoints,k as pointsToPixels,c as registerPlugins,j as twipsToEmu,e as twipsToPixels}from'./chunk-XDZHYYU6.mjs';
@@ -0,0 +1 @@
1
+ 'use strict';var chunkHTMMNA3I_js=require('./chunk-HTMMNA3I.js'),chunk4QRVKNI4_js=require('./chunk-4QRVKNI4.js'),chunkEPRXZTIE_js=require('./chunk-EPRXZTIE.js');Object.defineProperty(exports,"ContentControlBoundError",{enumerable:true,get:function(){return chunkHTMMNA3I_js.ga}});Object.defineProperty(exports,"ContentControlLockedError",{enumerable:true,get:function(){return chunkHTMMNA3I_js.ea}});Object.defineProperty(exports,"ContentControlNotFoundError",{enumerable:true,get:function(){return chunkHTMMNA3I_js.da}});Object.defineProperty(exports,"ContentControlTypeError",{enumerable:true,get:function(){return chunkHTMMNA3I_js.fa}});Object.defineProperty(exports,"ContentControlValueError",{enumerable:true,get:function(){return chunkHTMMNA3I_js.ja}});Object.defineProperty(exports,"DEFAULT_AI_ACTIONS",{enumerable:true,get:function(){return chunkHTMMNA3I_js.Qa}});Object.defineProperty(exports,"DocumentAgent",{enumerable:true,get:function(){return chunkHTMMNA3I_js.x}});Object.defineProperty(exports,"RepeatingSectionError",{enumerable:true,get:function(){return chunkHTMMNA3I_js.oa}});Object.defineProperty(exports,"VERSION",{enumerable:true,get:function(){return chunkHTMMNA3I_js.Sa}});Object.defineProperty(exports,"addRepeatingSectionItem",{enumerable:true,get:function(){return chunkHTMMNA3I_js.pa}});Object.defineProperty(exports,"attemptSelectiveSave",{enumerable:true,get:function(){return chunkHTMMNA3I_js.i}});Object.defineProperty(exports,"blendColors",{enumerable:true,get:function(){return chunkHTMMNA3I_js.Ha}});Object.defineProperty(exports,"buildExtendedSelectionContext",{enumerable:true,get:function(){return chunkHTMMNA3I_js.E}});Object.defineProperty(exports,"buildPatchedDocumentXml",{enumerable:true,get:function(){return chunkHTMMNA3I_js.h}});Object.defineProperty(exports,"buildSelectionContext",{enumerable:true,get:function(){return chunkHTMMNA3I_js.D}});Object.defineProperty(exports,"buildSelectionContextFromContext",{enumerable:true,get:function(){return chunkHTMMNA3I_js.B}});Object.defineProperty(exports,"colorsEqual",{enumerable:true,get:function(){return chunkHTMMNA3I_js.Ia}});Object.defineProperty(exports,"comparePositions",{enumerable:true,get:function(){return chunkHTMMNA3I_js.Na}});Object.defineProperty(exports,"countCharacters",{enumerable:true,get:function(){return chunkHTMMNA3I_js.M}});Object.defineProperty(exports,"countWords",{enumerable:true,get:function(){return chunkHTMMNA3I_js.L}});Object.defineProperty(exports,"createAgent",{enumerable:true,get:function(){return chunkHTMMNA3I_js.y}});Object.defineProperty(exports,"createAgentFromDocument",{enumerable:true,get:function(){return chunkHTMMNA3I_js.z}});Object.defineProperty(exports,"createCollapsedRange",{enumerable:true,get:function(){return chunkHTMMNA3I_js.Ka}});Object.defineProperty(exports,"createCommand",{enumerable:true,get:function(){return chunkHTMMNA3I_js.Ra}});Object.defineProperty(exports,"createDocumentWithText",{enumerable:true,get:function(){return chunkHTMMNA3I_js.ua}});Object.defineProperty(exports,"createDocx",{enumerable:true,get:function(){return chunkHTMMNA3I_js.f}});Object.defineProperty(exports,"createEmptyDocument",{enumerable:true,get:function(){return chunkHTMMNA3I_js.ta}});Object.defineProperty(exports,"createRange",{enumerable:true,get:function(){return chunkHTMMNA3I_js.La}});Object.defineProperty(exports,"createRgbColor",{enumerable:true,get:function(){return chunkHTMMNA3I_js.Ea}});Object.defineProperty(exports,"createThemeColor",{enumerable:true,get:function(){return chunkHTMMNA3I_js.Da}});Object.defineProperty(exports,"darkenColor",{enumerable:true,get:function(){return chunkHTMMNA3I_js.Fa}});Object.defineProperty(exports,"detectVariables",{enumerable:true,get:function(){return chunkHTMMNA3I_js.j}});Object.defineProperty(exports,"detectVariablesDetailed",{enumerable:true,get:function(){return chunkHTMMNA3I_js.k}});Object.defineProperty(exports,"detectVariablesInBody",{enumerable:true,get:function(){return chunkHTMMNA3I_js.l}});Object.defineProperty(exports,"detectVariablesInParagraph",{enumerable:true,get:function(){return chunkHTMMNA3I_js.m}});Object.defineProperty(exports,"documentHasVariables",{enumerable:true,get:function(){return chunkHTMMNA3I_js.v}});Object.defineProperty(exports,"extractVariablesFromText",{enumerable:true,get:function(){return chunkHTMMNA3I_js.n}});Object.defineProperty(exports,"findContentControl",{enumerable:true,get:function(){return chunkHTMMNA3I_js.ca}});Object.defineProperty(exports,"findContentControls",{enumerable:true,get:function(){return chunkHTMMNA3I_js.ba}});Object.defineProperty(exports,"formatSdtDate",{enumerable:true,get:function(){return chunkHTMMNA3I_js.ka}});Object.defineProperty(exports,"formatVariable",{enumerable:true,get:function(){return chunkHTMMNA3I_js.r}});Object.defineProperty(exports,"getActionDescription",{enumerable:true,get:function(){return chunkHTMMNA3I_js.Pa}});Object.defineProperty(exports,"getActionLabel",{enumerable:true,get:function(){return chunkHTMMNA3I_js.Oa}});Object.defineProperty(exports,"getAgentContext",{enumerable:true,get:function(){return chunkHTMMNA3I_js.A}});Object.defineProperty(exports,"getBlockIndexForParagraph",{enumerable:true,get:function(){return chunkHTMMNA3I_js.$}});Object.defineProperty(exports,"getBodyCharacterCount",{enumerable:true,get:function(){return chunkHTMMNA3I_js.O}});Object.defineProperty(exports,"getBodyText",{enumerable:true,get:function(){return chunkHTMMNA3I_js.K}});Object.defineProperty(exports,"getBodyWordCount",{enumerable:true,get:function(){return chunkHTMMNA3I_js.N}});Object.defineProperty(exports,"getContentControlText",{enumerable:true,get:function(){return chunkHTMMNA3I_js.aa}});Object.defineProperty(exports,"getContrastingColor",{enumerable:true,get:function(){return chunkHTMMNA3I_js.Ba}});Object.defineProperty(exports,"getDocumentSummary",{enumerable:true,get:function(){return chunkHTMMNA3I_js.C}});Object.defineProperty(exports,"getDocumentWatermark",{enumerable:true,get:function(){return chunkHTMMNA3I_js.ra}});Object.defineProperty(exports,"getFormattingAtPosition",{enumerable:true,get:function(){return chunkHTMMNA3I_js.R}});Object.defineProperty(exports,"getHyperlinkAtPosition",{enumerable:true,get:function(){return chunkHTMMNA3I_js.T}});Object.defineProperty(exports,"getHyperlinkText",{enumerable:true,get:function(){return chunkHTMMNA3I_js.I}});Object.defineProperty(exports,"getParagraphAtIndex",{enumerable:true,get:function(){return chunkHTMMNA3I_js._}});Object.defineProperty(exports,"getParagraphText",{enumerable:true,get:function(){return chunkHTMMNA3I_js.G}});Object.defineProperty(exports,"getParagraphs",{enumerable:true,get:function(){return chunkHTMMNA3I_js.Z}});Object.defineProperty(exports,"getRunText",{enumerable:true,get:function(){return chunkHTMMNA3I_js.H}});Object.defineProperty(exports,"getSelectionFormattingSummary",{enumerable:true,get:function(){return chunkHTMMNA3I_js.F}});Object.defineProperty(exports,"getTableText",{enumerable:true,get:function(){return chunkHTMMNA3I_js.J}});Object.defineProperty(exports,"getTextAfter",{enumerable:true,get:function(){return chunkHTMMNA3I_js.Q}});Object.defineProperty(exports,"getTextBefore",{enumerable:true,get:function(){return chunkHTMMNA3I_js.P}});Object.defineProperty(exports,"hasHyperlinks",{enumerable:true,get:function(){return chunkHTMMNA3I_js.X}});Object.defineProperty(exports,"hasImages",{enumerable:true,get:function(){return chunkHTMMNA3I_js.W}});Object.defineProperty(exports,"hasTables",{enumerable:true,get:function(){return chunkHTMMNA3I_js.Y}});Object.defineProperty(exports,"hasTemplateVariables",{enumerable:true,get:function(){return chunkHTMMNA3I_js.o}});Object.defineProperty(exports,"isBlack",{enumerable:true,get:function(){return chunkHTMMNA3I_js.za}});Object.defineProperty(exports,"isHeadingStyle",{enumerable:true,get:function(){return chunkHTMMNA3I_js.U}});Object.defineProperty(exports,"isPositionInHyperlink",{enumerable:true,get:function(){return chunkHTMMNA3I_js.S}});Object.defineProperty(exports,"isPositionInRange",{enumerable:true,get:function(){return chunkHTMMNA3I_js.Ma}});Object.defineProperty(exports,"isRepeatingSection",{enumerable:true,get:function(){return chunkHTMMNA3I_js.ma}});Object.defineProperty(exports,"isRepeatingSectionItem",{enumerable:true,get:function(){return chunkHTMMNA3I_js.na}});Object.defineProperty(exports,"isValidVariableName",{enumerable:true,get:function(){return chunkHTMMNA3I_js.p}});Object.defineProperty(exports,"isWhite",{enumerable:true,get:function(){return chunkHTMMNA3I_js.Aa}});Object.defineProperty(exports,"isZodSchema",{enumerable:true,get:function(){return chunkHTMMNA3I_js.Ja}});Object.defineProperty(exports,"lightenColor",{enumerable:true,get:function(){return chunkHTMMNA3I_js.Ga}});Object.defineProperty(exports,"mapHexToHighlightName",{enumerable:true,get:function(){return chunkHTMMNA3I_js.va}});Object.defineProperty(exports,"parseColorString",{enumerable:true,get:function(){return chunkHTMMNA3I_js.Ca}});Object.defineProperty(exports,"parseDocx",{enumerable:true,get:function(){return chunkHTMMNA3I_js.w}});Object.defineProperty(exports,"parseHeadingLevel",{enumerable:true,get:function(){return chunkHTMMNA3I_js.V}});Object.defineProperty(exports,"parseVariable",{enumerable:true,get:function(){return chunkHTMMNA3I_js.s}});Object.defineProperty(exports,"removeContentControl",{enumerable:true,get:function(){return chunkHTMMNA3I_js.ia}});Object.defineProperty(exports,"removeRepeatingSectionItem",{enumerable:true,get:function(){return chunkHTMMNA3I_js.qa}});Object.defineProperty(exports,"removeVariables",{enumerable:true,get:function(){return chunkHTMMNA3I_js.u}});Object.defineProperty(exports,"repackDocx",{enumerable:true,get:function(){return chunkHTMMNA3I_js.d}});Object.defineProperty(exports,"replaceVariables",{enumerable:true,get:function(){return chunkHTMMNA3I_js.t}});Object.defineProperty(exports,"resolveColor",{enumerable:true,get:function(){return chunkHTMMNA3I_js.wa}});Object.defineProperty(exports,"resolveHighlightColor",{enumerable:true,get:function(){return chunkHTMMNA3I_js.xa}});Object.defineProperty(exports,"resolveShadingColor",{enumerable:true,get:function(){return chunkHTMMNA3I_js.ya}});Object.defineProperty(exports,"sanitizeVariableName",{enumerable:true,get:function(){return chunkHTMMNA3I_js.q}});Object.defineProperty(exports,"serializeDocumentBody",{enumerable:true,get:function(){return chunkHTMMNA3I_js.b}});Object.defineProperty(exports,"serializeDocx",{enumerable:true,get:function(){return chunkHTMMNA3I_js.c}});Object.defineProperty(exports,"serializeSectionProperties",{enumerable:true,get:function(){return chunkHTMMNA3I_js.a}});Object.defineProperty(exports,"setContentControlContent",{enumerable:true,get:function(){return chunkHTMMNA3I_js.ha}});Object.defineProperty(exports,"setContentControlValue",{enumerable:true,get:function(){return chunkHTMMNA3I_js.la}});Object.defineProperty(exports,"setDocumentWatermark",{enumerable:true,get:function(){return chunkHTMMNA3I_js.sa}});Object.defineProperty(exports,"updateMultipleFiles",{enumerable:true,get:function(){return chunkHTMMNA3I_js.e}});Object.defineProperty(exports,"validatePatchSafety",{enumerable:true,get:function(){return chunkHTMMNA3I_js.g}});Object.defineProperty(exports,"createTemplateProcessor",{enumerable:true,get:function(){return chunk4QRVKNI4_js.j}});Object.defineProperty(exports,"getMissingVariables",{enumerable:true,get:function(){return chunk4QRVKNI4_js.g}});Object.defineProperty(exports,"getTemplateTags",{enumerable:true,get:function(){return chunk4QRVKNI4_js.e}});Object.defineProperty(exports,"previewTemplate",{enumerable:true,get:function(){return chunk4QRVKNI4_js.h}});Object.defineProperty(exports,"processTemplate",{enumerable:true,get:function(){return chunk4QRVKNI4_js.a}});Object.defineProperty(exports,"processTemplateAdvanced",{enumerable:true,get:function(){return chunk4QRVKNI4_js.i}});Object.defineProperty(exports,"processTemplateAsBlob",{enumerable:true,get:function(){return chunk4QRVKNI4_js.c}});Object.defineProperty(exports,"processTemplateDetailed",{enumerable:true,get:function(){return chunk4QRVKNI4_js.b}});Object.defineProperty(exports,"validateTemplate",{enumerable:true,get:function(){return chunk4QRVKNI4_js.f}});Object.defineProperty(exports,"PluginRegistry",{enumerable:true,get:function(){return chunkEPRXZTIE_js.a}});Object.defineProperty(exports,"createPluginRegistrar",{enumerable:true,get:function(){return chunkEPRXZTIE_js.d}});Object.defineProperty(exports,"emuToPixels",{enumerable:true,get:function(){return chunkEPRXZTIE_js.g}});Object.defineProperty(exports,"emuToTwips",{enumerable:true,get:function(){return chunkEPRXZTIE_js.i}});Object.defineProperty(exports,"executeCommand",{enumerable:true,get:function(){return chunkEPRXZTIE_js.o}});Object.defineProperty(exports,"executeCommands",{enumerable:true,get:function(){return chunkEPRXZTIE_js.p}});Object.defineProperty(exports,"formatPx",{enumerable:true,get:function(){return chunkEPRXZTIE_js.n}});Object.defineProperty(exports,"halfPointsToPixels",{enumerable:true,get:function(){return chunkEPRXZTIE_js.l}});Object.defineProperty(exports,"pixelsToEmu",{enumerable:true,get:function(){return chunkEPRXZTIE_js.h}});Object.defineProperty(exports,"pixelsToTwips",{enumerable:true,get:function(){return chunkEPRXZTIE_js.f}});Object.defineProperty(exports,"pluginRegistry",{enumerable:true,get:function(){return chunkEPRXZTIE_js.b}});Object.defineProperty(exports,"pointsToHalfPoints",{enumerable:true,get:function(){return chunkEPRXZTIE_js.m}});Object.defineProperty(exports,"pointsToPixels",{enumerable:true,get:function(){return chunkEPRXZTIE_js.k}});Object.defineProperty(exports,"registerPlugins",{enumerable:true,get:function(){return chunkEPRXZTIE_js.c}});Object.defineProperty(exports,"twipsToEmu",{enumerable:true,get:function(){return chunkEPRXZTIE_js.j}});Object.defineProperty(exports,"twipsToPixels",{enumerable:true,get:function(){return chunkEPRXZTIE_js.e}});
package/dist/index.d.mts CHANGED
@@ -28,8 +28,8 @@
28
28
  * @packageDocumentation
29
29
  * @public
30
30
  */
31
- import { G as GetContentOptions, C as ContentBlock, a as CommentFilter, R as ReviewComment, b as ChangeFilter, c as ReviewChange, F as FoundMatch, S as SelectionInfo, A as AddCommentByParaIdOptions, d as ReplyOptions, P as ProposeChangeOptions, e as ApplyFormattingOptions, f as SetParagraphStyleOptions, g as PageContent, h as ContentChangeEvent, i as SelectionChangeEvent } from './server-BaVhdHCd.mjs';
32
- export { j as AgentToolDefinition, k as AgentToolResult, B as BatchError, l as BatchResult, m as BatchReviewOptions, D as DocxReviewer, n as agentTools, o as createReviewerBridge, p as executeToolCall, q as getToolSchemas } from './server-BaVhdHCd.mjs';
31
+ import { G as GetContentOptions, C as ContentBlock, a as CommentFilter, R as ReviewComment, b as ChangeFilter, c as ReviewChange, F as FoundMatch, S as SelectionInfo, A as AddCommentByParaIdOptions, d as ReplyOptions, P as ProposeChangeOptions, e as ApplyFormattingOptions, f as SetParagraphStyleOptions, g as PageContent, h as ContentChangeEvent, i as SelectionChangeEvent } from './server-D1vJRNf0.mjs';
32
+ export { j as AgentToolDefinition, k as AgentToolResult, B as BatchError, l as BatchResult, m as BatchReviewOptions, D as DocxReviewer, n as agentTools, o as createReviewerBridge, p as executeToolCall, q as getToolSchemas } from './server-D1vJRNf0.mjs';
33
33
 
34
34
  /**
35
35
  * Error classes for @eigenpal/docx-editor-agents
@@ -40,17 +40,6 @@ declare class TextNotFoundError extends Error {
40
40
  declare class ChangeNotFoundError extends Error {
41
41
  constructor(id: number);
42
42
  }
43
- /**
44
- * Thrown when accept/reject resolves a tracked change to a footnote or endnote
45
- * body. accept/reject operate on the document body only, and a tracked-change
46
- * `w:id` is unique only within its part (document.xml / footnotes.xml /
47
- * endnotes.xml), so a note change cannot be mutated through this reviewer yet.
48
- * Fails closed rather than silently no-op'ing or mis-reporting the change as
49
- * not-found.
50
- */
51
- declare class NoteChangeNotEditableError extends Error {
52
- constructor(id: number, noteType: 'footnote' | 'endnote', noteId: number);
53
- }
54
43
  declare class CommentNotFoundError extends Error {
55
44
  constructor(id: number);
56
45
  }
@@ -185,4 +174,4 @@ interface WordCompatBridge {
185
174
  onSelectionChange(listener: (event: SelectionChangeEvent) => void): () => void;
186
175
  }
187
176
 
188
- export { ChangeNotFoundError, CommentNotFoundError, ContentBlock, GetContentOptions, NoteChangeNotEditableError, ReviewChange, ReviewComment, TextNotFoundError, type WordCompatBridge };
177
+ export { ChangeNotFoundError, CommentNotFoundError, ContentBlock, GetContentOptions, ReviewChange, ReviewComment, TextNotFoundError, type WordCompatBridge };
package/dist/index.d.ts CHANGED
@@ -28,8 +28,8 @@
28
28
  * @packageDocumentation
29
29
  * @public
30
30
  */
31
- import { G as GetContentOptions, C as ContentBlock, a as CommentFilter, R as ReviewComment, b as ChangeFilter, c as ReviewChange, F as FoundMatch, S as SelectionInfo, A as AddCommentByParaIdOptions, d as ReplyOptions, P as ProposeChangeOptions, e as ApplyFormattingOptions, f as SetParagraphStyleOptions, g as PageContent, h as ContentChangeEvent, i as SelectionChangeEvent } from './server-BaVhdHCd.js';
32
- export { j as AgentToolDefinition, k as AgentToolResult, B as BatchError, l as BatchResult, m as BatchReviewOptions, D as DocxReviewer, n as agentTools, o as createReviewerBridge, p as executeToolCall, q as getToolSchemas } from './server-BaVhdHCd.js';
31
+ import { G as GetContentOptions, C as ContentBlock, a as CommentFilter, R as ReviewComment, b as ChangeFilter, c as ReviewChange, F as FoundMatch, S as SelectionInfo, A as AddCommentByParaIdOptions, d as ReplyOptions, P as ProposeChangeOptions, e as ApplyFormattingOptions, f as SetParagraphStyleOptions, g as PageContent, h as ContentChangeEvent, i as SelectionChangeEvent } from './server-D1vJRNf0.js';
32
+ export { j as AgentToolDefinition, k as AgentToolResult, B as BatchError, l as BatchResult, m as BatchReviewOptions, D as DocxReviewer, n as agentTools, o as createReviewerBridge, p as executeToolCall, q as getToolSchemas } from './server-D1vJRNf0.js';
33
33
 
34
34
  /**
35
35
  * Error classes for @eigenpal/docx-editor-agents
@@ -40,17 +40,6 @@ declare class TextNotFoundError extends Error {
40
40
  declare class ChangeNotFoundError extends Error {
41
41
  constructor(id: number);
42
42
  }
43
- /**
44
- * Thrown when accept/reject resolves a tracked change to a footnote or endnote
45
- * body. accept/reject operate on the document body only, and a tracked-change
46
- * `w:id` is unique only within its part (document.xml / footnotes.xml /
47
- * endnotes.xml), so a note change cannot be mutated through this reviewer yet.
48
- * Fails closed rather than silently no-op'ing or mis-reporting the change as
49
- * not-found.
50
- */
51
- declare class NoteChangeNotEditableError extends Error {
52
- constructor(id: number, noteType: 'footnote' | 'endnote', noteId: number);
53
- }
54
43
  declare class CommentNotFoundError extends Error {
55
44
  constructor(id: number);
56
45
  }
@@ -185,4 +174,4 @@ interface WordCompatBridge {
185
174
  onSelectionChange(listener: (event: SelectionChangeEvent) => void): () => void;
186
175
  }
187
176
 
188
- export { ChangeNotFoundError, CommentNotFoundError, ContentBlock, GetContentOptions, NoteChangeNotEditableError, ReviewChange, ReviewComment, TextNotFoundError, type WordCompatBridge };
177
+ export { ChangeNotFoundError, CommentNotFoundError, ContentBlock, GetContentOptions, ReviewChange, ReviewComment, TextNotFoundError, type WordCompatBridge };
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- 'use strict';var chunkLX3NJWKV_js=require('./chunk-LX3NJWKV.js'),chunkXUAUDUJU_js=require('./chunk-XUAUDUJU.js'),chunkRI5S75JY_js=require('./chunk-RI5S75JY.js');Object.defineProperty(exports,"DocxReviewer",{enumerable:true,get:function(){return chunkLX3NJWKV_js.a}});Object.defineProperty(exports,"ChangeNotFoundError",{enumerable:true,get:function(){return chunkXUAUDUJU_js.g}});Object.defineProperty(exports,"CommentNotFoundError",{enumerable:true,get:function(){return chunkXUAUDUJU_js.i}});Object.defineProperty(exports,"NoteChangeNotEditableError",{enumerable:true,get:function(){return chunkXUAUDUJU_js.h}});Object.defineProperty(exports,"TextNotFoundError",{enumerable:true,get:function(){return chunkXUAUDUJU_js.f}});Object.defineProperty(exports,"createReviewerBridge",{enumerable:true,get:function(){return chunkXUAUDUJU_js.n}});Object.defineProperty(exports,"agentTools",{enumerable:true,get:function(){return chunkRI5S75JY_js.a}});Object.defineProperty(exports,"executeToolCall",{enumerable:true,get:function(){return chunkRI5S75JY_js.b}});Object.defineProperty(exports,"getToolSchemas",{enumerable:true,get:function(){return chunkRI5S75JY_js.d}});
1
+ 'use strict';var chunkRYT33AHF_js=require('./chunk-RYT33AHF.js'),chunkVPUAYS3Y_js=require('./chunk-VPUAYS3Y.js'),chunkRI5S75JY_js=require('./chunk-RI5S75JY.js');Object.defineProperty(exports,"DocxReviewer",{enumerable:true,get:function(){return chunkRYT33AHF_js.a}});Object.defineProperty(exports,"ChangeNotFoundError",{enumerable:true,get:function(){return chunkVPUAYS3Y_js.h}});Object.defineProperty(exports,"CommentNotFoundError",{enumerable:true,get:function(){return chunkVPUAYS3Y_js.i}});Object.defineProperty(exports,"TextNotFoundError",{enumerable:true,get:function(){return chunkVPUAYS3Y_js.g}});Object.defineProperty(exports,"createReviewerBridge",{enumerable:true,get:function(){return chunkVPUAYS3Y_js.n}});Object.defineProperty(exports,"agentTools",{enumerable:true,get:function(){return chunkRI5S75JY_js.a}});Object.defineProperty(exports,"executeToolCall",{enumerable:true,get:function(){return chunkRI5S75JY_js.b}});Object.defineProperty(exports,"getToolSchemas",{enumerable:true,get:function(){return chunkRI5S75JY_js.d}});
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- export{a as DocxReviewer}from'./chunk-NFAEIOLC.mjs';export{g as ChangeNotFoundError,i as CommentNotFoundError,h as NoteChangeNotEditableError,f as TextNotFoundError,n as createReviewerBridge}from'./chunk-P4DRISTP.mjs';export{a as agentTools,b as executeToolCall,d as getToolSchemas}from'./chunk-24MVJKCP.mjs';
1
+ export{a as DocxReviewer}from'./chunk-BFGKTTP7.mjs';export{h as ChangeNotFoundError,i as CommentNotFoundError,g as TextNotFoundError,n as createReviewerBridge}from'./chunk-HSVOT6AW.mjs';export{a as agentTools,b as executeToolCall,d as getToolSchemas}from'./chunk-24MVJKCP.mjs';
package/dist/mcp.d.mts CHANGED
@@ -17,7 +17,7 @@
17
17
  * @packageDocumentation
18
18
  * @public
19
19
  */
20
- import { E as EditorBridge } from './server-BaVhdHCd.mjs';
20
+ import { E as EditorBridge } from './server-D1vJRNf0.mjs';
21
21
 
22
22
  /**
23
23
  * MCP wire protocol (subset) — JSON-RPC 2.0 framing + the message types we
package/dist/mcp.d.ts CHANGED
@@ -17,7 +17,7 @@
17
17
  * @packageDocumentation
18
18
  * @public
19
19
  */
20
- import { E as EditorBridge } from './server-BaVhdHCd.js';
20
+ import { E as EditorBridge } from './server-D1vJRNf0.js';
21
21
 
22
22
  /**
23
23
  * MCP wire protocol (subset) — JSON-RPC 2.0 framing + the message types we
package/dist/react.d.mts CHANGED
@@ -18,8 +18,8 @@
18
18
  * @packageDocumentation
19
19
  * @public
20
20
  */
21
- import { r as EditorRefLike, k as AgentToolResult, q as getToolSchemas, j as AgentToolDefinition, s as AgentContextSnapshot } from './server-BaVhdHCd.mjs';
22
- export { t as getToolDisplayName } from './server-BaVhdHCd.mjs';
21
+ import { r as EditorRefLike, k as AgentToolResult, q as getToolSchemas, j as AgentToolDefinition, s as AgentContextSnapshot } from './server-D1vJRNf0.mjs';
22
+ export { t as getToolDisplayName } from './server-D1vJRNf0.mjs';
23
23
  import * as react_jsx_runtime from 'react/jsx-runtime';
24
24
  import { ReactNode, CSSProperties } from 'react';
25
25
  import { A as AgentMessage, a as AgentToolCall } from './agent-types-C8RvQB7n.mjs';
package/dist/react.d.ts CHANGED
@@ -18,8 +18,8 @@
18
18
  * @packageDocumentation
19
19
  * @public
20
20
  */
21
- import { r as EditorRefLike, k as AgentToolResult, q as getToolSchemas, j as AgentToolDefinition, s as AgentContextSnapshot } from './server-BaVhdHCd.js';
22
- export { t as getToolDisplayName } from './server-BaVhdHCd.js';
21
+ import { r as EditorRefLike, k as AgentToolResult, q as getToolSchemas, j as AgentToolDefinition, s as AgentContextSnapshot } from './server-D1vJRNf0.js';
22
+ export { t as getToolDisplayName } from './server-D1vJRNf0.js';
23
23
  import * as react_jsx_runtime from 'react/jsx-runtime';
24
24
  import { ReactNode, CSSProperties } from 'react';
25
25
  import { A as AgentMessage, a as AgentToolCall } from './agent-types-C8RvQB7n.js';
package/dist/react.js CHANGED
@@ -1,4 +1,4 @@
1
- 'use strict';var chunk7PTBNHAH_js=require('./chunk-7PTBNHAH.js'),chunkRI5S75JY_js=require('./chunk-RI5S75JY.js'),react=require('react'),jsxRuntime=require('react/jsx-runtime');var te=chunkRI5S75JY_js.d();function ne(e){let{editorRef:t,author:l="AI"}=e,c=react.useMemo(()=>({get:()=>t.current?chunk7PTBNHAH_js.a(t.current,l):null}),[t,l]);return {executeToolCall:react.useCallback((d,p)=>{let r=c.get();return r?chunkRI5S75JY_js.b(d,p,r):{success:false,error:"Editor not ready"}},[c]),toolSchemas:te}}function re(e){let{editorRef:t,author:l="AI",tools:c,include:u,exclude:d}=e,p=!!c&&Object.keys(c).length>0,r=react.useCallback(i=>!(u&&!u.includes(i)||d&&d.includes(i)),[u,d]),f=react.useMemo(()=>{let i=u||d?chunkRI5S75JY_js.a.filter(n=>r(n.name)):chunkRI5S75JY_js.a;if(!p)return i.map(n=>({type:"function",function:{name:n.name,description:n.description,parameters:n.inputSchema}}));let o=new Map(i.map(n=>[n.name,n]));for(let[n,C]of Object.entries(c))o.set(n,C);return Array.from(o.values()).map(n=>({type:"function",function:{name:n.name,description:n.description,parameters:n.inputSchema}}))},[c,p,u,d,r]),g=react.useCallback((i,o)=>{let n=t.current;if(!n)return {success:false,error:"Editor not ready."};let C=chunk7PTBNHAH_js.a(n,l),k=c?.[i];if(k)try{return k.handler(o,C)}catch(T){return {success:false,error:T instanceof Error?T.message:String(T)}}return r(i)?chunkRI5S75JY_js.b(i,o,C):{success:false,error:`Tool '${i}' is not enabled.`}},[t,l,c,r]),x=react.useCallback(()=>{let i=t.current;if(!i)return {selection:null,currentPage:0,totalPages:0};let o=chunk7PTBNHAH_js.a(i,l);return {selection:o.getSelection(),currentPage:o.getCurrentPage(),totalPages:o.getTotalPages()}},[t,l]);return {tools:f,executeToolCall:g,getContext:x}}var y={agentPanel:{defaultTitle:"Assistant",close:"Close panel",resizeHandle:"Resize agent panel",thinking:"Assistant is thinking",composerPlaceholder:"Ask the assistant\u2026",send:"Send",timeline:{working:"Working\u2026 {count, plural, one {# step} other {# steps}}",summary:"{count, plural, one {# step} other {# steps}}",earlier:"+ {count, plural, one {# earlier step} other {# earlier steps}}"}}};var _="eigenpal:docx-editor:agentPanelWidth";function ae({size:e=22}){return jsxRuntime.jsx("svg",{viewBox:"0 -960 960 960",width:e,height:e,fill:"currentColor","aria-hidden":"true",children:jsxRuntime.jsx("path",{d:"m760-600-50-110-110-50 110-50 50-110 50 110 110 50-110 50-50 110Zm0 560-50-110-110-50 110-50 50-110 50 110 110 50-110 50-50 110ZM360-160 260-380 40-480l220-100 100-220 100 220 220 100-220 100-100 220Zm0-194 40-86 86-40-86-40-40-86-40 86-86 40 86 40 40 86Zm0-126Z"})})}function le({size:e=18}){return jsxRuntime.jsx("svg",{viewBox:"0 -960 960 960",width:e,height:e,fill:"currentColor","aria-hidden":"true",children:jsxRuntime.jsx("path",{d:"m256-200-56-56 224-224-224-224 56-56 224 224 224-224 56 56-224 224 224 224-56 56-224-224-224 224Z"})})}var ce=360,ue=280,de=600;function pe({title:e=y.agentPanel.defaultTitle,icon:t,closeLabel:l=y.agentPanel.close,resizeHandleLabel:c=y.agentPanel.resizeHandle,width:u,defaultWidth:d=ce,minWidth:p=ue,maxWidth:r=de,onWidthChange:f,onClose:g,children:x,className:i,closed:o=false}){let n=u!==void 0,[C,k]=react.useState(false),T=react.useRef(o);react.useEffect(()=>{if(T.current!==o){T.current=o,k(true);let m=window.setTimeout(()=>k(false),260);return ()=>window.clearTimeout(m)}},[o]);let[L,h]=react.useState(()=>{if(n)return u;if(typeof window>"u")return d;try{let m=window.localStorage.getItem(_);if(m){let S=Number(m);if(Number.isFinite(S)&&S>=p&&S<=r)return S}}catch{}return d}),E=n?u:L,v=react.useRef(null),B=react.useRef({minWidth:p,maxWidth:r,isControlled:n,onWidthChange:f});B.current={minWidth:p,maxWidth:r,isControlled:n,onWidthChange:f};let w=react.useRef(null);if(!w.current){let m=P=>{let D=v.current;if(!D)return;let I=B.current,q=D.startX-P.clientX,N=Math.min(I.maxWidth,Math.max(I.minWidth,D.startWidth+q));D.lastWidth=N,I.isControlled||h(N),I.onWidthChange?.(N);},S=()=>{let P=v.current;if(P&&(v.current=null,document.removeEventListener("pointermove",m),document.removeEventListener("pointerup",S),!B.current.isControlled))try{window.localStorage.setItem(_,String(P.lastWidth));}catch{}};w.current={move:m,up:S};}let Y=react.useCallback(m=>{m.preventDefault();let S=n?u:L;v.current={startX:m.clientX,startWidth:S,lastWidth:S},document.addEventListener("pointermove",w.current.move),document.addEventListener("pointerup",w.current.up);},[]);return react.useEffect(()=>()=>{let m=w.current;m&&(document.removeEventListener("pointermove",m.move),document.removeEventListener("pointerup",m.up));},[]),jsxRuntime.jsxs("div",{className:`ep-agent-panel${i?` ${i}`:""}`,style:{width:o?0:E,flex:o?"0 0 0px":`0 0 ${E}px`,height:"calc(100% - 16px)",margin:o?"8px 0 8px 0":"8px 8px 8px 12px",display:"flex",flexDirection:"column",background:"#ffffff",border:o?"1px solid transparent":"1px solid #e3e3e3",borderRadius:16,boxShadow:o?"none":"0 1px 2px rgba(60,64,67,0.05), 0 4px 12px rgba(60,64,67,0.08)",opacity:o?0:1,pointerEvents:o?"none":"auto",position:"relative",boxSizing:"border-box",minWidth:o?0:p,overflow:"hidden",fontFamily:"'Google Sans', 'Google Sans Text', system-ui, -apple-system, sans-serif",transition:C?"flex-basis 220ms cubic-bezier(0.4, 0, 0.2, 1), width 220ms cubic-bezier(0.4, 0, 0.2, 1), margin 220ms cubic-bezier(0.4, 0, 0.2, 1), opacity 180ms ease, box-shadow 220ms ease, border-color 220ms ease":"opacity 180ms ease, box-shadow 220ms ease, border-color 220ms ease"},"aria-hidden":o,"data-testid":"agent-panel","data-state":o?"closed":"open",role:"complementary","aria-label":e,children:[jsxRuntime.jsx("div",{role:"separator","aria-orientation":"vertical","aria-label":c,onPointerDown:Y,style:{position:"absolute",left:-3,top:0,bottom:0,width:6,cursor:"col-resize",touchAction:"none",zIndex:1},"data-testid":"agent-panel-resize-handle"}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"14px 16px 10px",flex:"0 0 auto",background:"#ffffff"},children:[jsxRuntime.jsx("span",{style:{display:"inline-flex",alignItems:"center",color:"#0b57d0"},children:t??jsxRuntime.jsx(ae,{size:22})}),jsxRuntime.jsx("span",{style:{flex:1,fontSize:15,fontWeight:500,color:"#1f1f1f",letterSpacing:.1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e}),g&&jsxRuntime.jsx("button",{type:"button",onClick:g,"aria-label":l,title:l,"data-testid":"agent-panel-close",style:{border:"none",background:"transparent",padding:6,cursor:"pointer",display:"inline-flex",alignItems:"center",justifyContent:"center",color:"#444746",borderRadius:999,transition:"background 0.15s"},onMouseEnter:m=>{m.currentTarget.style.background="#f1f3f4";},onMouseLeave:m=>{m.currentTarget.style.background="transparent";},children:jsxRuntime.jsx(le,{size:18})})]}),jsxRuntime.jsx("div",{style:{flex:1,minHeight:0,overflow:"hidden",display:"flex",flexDirection:"column"},children:x})]})}function ge(e){let t={},l=/(=\d+|\w+)\s*\{([^}]*)\}/g,c;for(;(c=l.exec(e))!==null;)t[c[1]]=c[2];return t}function F(e,t,l="en"){return t?e.replace(/\{(\w+),\s*plural,\s*((?:[^{}]|\{[^{}]*\})*)\}/g,(u,d,p)=>{let r=Number(t[d]);if(isNaN(r))return u;let f=ge(p),g=f[`=${r}`];if(g!==void 0)return g.replace(/#/g,String(r));let x;try{x=new Intl.PluralRules(l).select(r);}catch{x=r===1?"one":"other";}return (f[x]??f.other??"").replace(/#/g,String(r))}).replace(/\{(\w+)\}/g,(u,d)=>{let p=t[d];return p!==void 0?String(p):`{${d}}`}):e}function V(e){let t=e.replace(/_/g," ");return t.charAt(0).toUpperCase()+t.slice(1)}var xe=y.agentPanel.thinking,he=y.agentPanel.composerPlaceholder,be=y.agentPanel.send,ye=e=>F(y.agentPanel.timeline.working,{count:e}),Ae=e=>F(y.agentPanel.timeline.summary,{count:e}),Se=e=>F(y.agentPanel.timeline.earlier,{count:e}),j="ep-agent-chat-keyframes",Ce=`
1
+ 'use strict';var chunkUTMAYI7M_js=require('./chunk-UTMAYI7M.js'),chunkRI5S75JY_js=require('./chunk-RI5S75JY.js'),react=require('react'),jsxRuntime=require('react/jsx-runtime');var te=chunkRI5S75JY_js.d();function ne(e){let{editorRef:t,author:l="AI"}=e,c=react.useMemo(()=>({get:()=>t.current?chunkUTMAYI7M_js.a(t.current,l):null}),[t,l]);return {executeToolCall:react.useCallback((d,p)=>{let r=c.get();return r?chunkRI5S75JY_js.b(d,p,r):{success:false,error:"Editor not ready"}},[c]),toolSchemas:te}}function re(e){let{editorRef:t,author:l="AI",tools:c,include:u,exclude:d}=e,p=!!c&&Object.keys(c).length>0,r=react.useCallback(i=>!(u&&!u.includes(i)||d&&d.includes(i)),[u,d]),f=react.useMemo(()=>{let i=u||d?chunkRI5S75JY_js.a.filter(n=>r(n.name)):chunkRI5S75JY_js.a;if(!p)return i.map(n=>({type:"function",function:{name:n.name,description:n.description,parameters:n.inputSchema}}));let o=new Map(i.map(n=>[n.name,n]));for(let[n,C]of Object.entries(c))o.set(n,C);return Array.from(o.values()).map(n=>({type:"function",function:{name:n.name,description:n.description,parameters:n.inputSchema}}))},[c,p,u,d,r]),g=react.useCallback((i,o)=>{let n=t.current;if(!n)return {success:false,error:"Editor not ready."};let C=chunkUTMAYI7M_js.a(n,l),k=c?.[i];if(k)try{return k.handler(o,C)}catch(T){return {success:false,error:T instanceof Error?T.message:String(T)}}return r(i)?chunkRI5S75JY_js.b(i,o,C):{success:false,error:`Tool '${i}' is not enabled.`}},[t,l,c,r]),x=react.useCallback(()=>{let i=t.current;if(!i)return {selection:null,currentPage:0,totalPages:0};let o=chunkUTMAYI7M_js.a(i,l);return {selection:o.getSelection(),currentPage:o.getCurrentPage(),totalPages:o.getTotalPages()}},[t,l]);return {tools:f,executeToolCall:g,getContext:x}}var y={agentPanel:{defaultTitle:"Assistant",close:"Close panel",resizeHandle:"Resize agent panel",thinking:"Assistant is thinking",composerPlaceholder:"Ask the assistant\u2026",send:"Send",timeline:{working:"Working\u2026 {count, plural, one {# step} other {# steps}}",summary:"{count, plural, one {# step} other {# steps}}",earlier:"+ {count, plural, one {# earlier step} other {# earlier steps}}"}}};var _="eigenpal:docx-editor:agentPanelWidth";function ae({size:e=22}){return jsxRuntime.jsx("svg",{viewBox:"0 -960 960 960",width:e,height:e,fill:"currentColor","aria-hidden":"true",children:jsxRuntime.jsx("path",{d:"m760-600-50-110-110-50 110-50 50-110 50 110 110 50-110 50-50 110Zm0 560-50-110-110-50 110-50 50-110 50 110 110 50-110 50-50 110ZM360-160 260-380 40-480l220-100 100-220 100 220 220 100-220 100-100 220Zm0-194 40-86 86-40-86-40-40-86-40 86-86 40 86 40 40 86Zm0-126Z"})})}function le({size:e=18}){return jsxRuntime.jsx("svg",{viewBox:"0 -960 960 960",width:e,height:e,fill:"currentColor","aria-hidden":"true",children:jsxRuntime.jsx("path",{d:"m256-200-56-56 224-224-224-224 56-56 224 224 224-224 56 56-224 224 224 224-56 56-224-224-224 224Z"})})}var ce=360,ue=280,de=600;function pe({title:e=y.agentPanel.defaultTitle,icon:t,closeLabel:l=y.agentPanel.close,resizeHandleLabel:c=y.agentPanel.resizeHandle,width:u,defaultWidth:d=ce,minWidth:p=ue,maxWidth:r=de,onWidthChange:f,onClose:g,children:x,className:i,closed:o=false}){let n=u!==void 0,[C,k]=react.useState(false),T=react.useRef(o);react.useEffect(()=>{if(T.current!==o){T.current=o,k(true);let m=window.setTimeout(()=>k(false),260);return ()=>window.clearTimeout(m)}},[o]);let[L,h]=react.useState(()=>{if(n)return u;if(typeof window>"u")return d;try{let m=window.localStorage.getItem(_);if(m){let S=Number(m);if(Number.isFinite(S)&&S>=p&&S<=r)return S}}catch{}return d}),E=n?u:L,v=react.useRef(null),B=react.useRef({minWidth:p,maxWidth:r,isControlled:n,onWidthChange:f});B.current={minWidth:p,maxWidth:r,isControlled:n,onWidthChange:f};let w=react.useRef(null);if(!w.current){let m=P=>{let D=v.current;if(!D)return;let I=B.current,q=D.startX-P.clientX,N=Math.min(I.maxWidth,Math.max(I.minWidth,D.startWidth+q));D.lastWidth=N,I.isControlled||h(N),I.onWidthChange?.(N);},S=()=>{let P=v.current;if(P&&(v.current=null,document.removeEventListener("pointermove",m),document.removeEventListener("pointerup",S),!B.current.isControlled))try{window.localStorage.setItem(_,String(P.lastWidth));}catch{}};w.current={move:m,up:S};}let Y=react.useCallback(m=>{m.preventDefault();let S=n?u:L;v.current={startX:m.clientX,startWidth:S,lastWidth:S},document.addEventListener("pointermove",w.current.move),document.addEventListener("pointerup",w.current.up);},[]);return react.useEffect(()=>()=>{let m=w.current;m&&(document.removeEventListener("pointermove",m.move),document.removeEventListener("pointerup",m.up));},[]),jsxRuntime.jsxs("div",{className:`ep-agent-panel${i?` ${i}`:""}`,style:{width:o?0:E,flex:o?"0 0 0px":`0 0 ${E}px`,height:"calc(100% - 16px)",margin:o?"8px 0 8px 0":"8px 8px 8px 12px",display:"flex",flexDirection:"column",background:"#ffffff",border:o?"1px solid transparent":"1px solid #e3e3e3",borderRadius:16,boxShadow:o?"none":"0 1px 2px rgba(60,64,67,0.05), 0 4px 12px rgba(60,64,67,0.08)",opacity:o?0:1,pointerEvents:o?"none":"auto",position:"relative",boxSizing:"border-box",minWidth:o?0:p,overflow:"hidden",fontFamily:"'Google Sans', 'Google Sans Text', system-ui, -apple-system, sans-serif",transition:C?"flex-basis 220ms cubic-bezier(0.4, 0, 0.2, 1), width 220ms cubic-bezier(0.4, 0, 0.2, 1), margin 220ms cubic-bezier(0.4, 0, 0.2, 1), opacity 180ms ease, box-shadow 220ms ease, border-color 220ms ease":"opacity 180ms ease, box-shadow 220ms ease, border-color 220ms ease"},"aria-hidden":o,"data-testid":"agent-panel","data-state":o?"closed":"open",role:"complementary","aria-label":e,children:[jsxRuntime.jsx("div",{role:"separator","aria-orientation":"vertical","aria-label":c,onPointerDown:Y,style:{position:"absolute",left:-3,top:0,bottom:0,width:6,cursor:"col-resize",touchAction:"none",zIndex:1},"data-testid":"agent-panel-resize-handle"}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"14px 16px 10px",flex:"0 0 auto",background:"#ffffff"},children:[jsxRuntime.jsx("span",{style:{display:"inline-flex",alignItems:"center",color:"#0b57d0"},children:t??jsxRuntime.jsx(ae,{size:22})}),jsxRuntime.jsx("span",{style:{flex:1,fontSize:15,fontWeight:500,color:"#1f1f1f",letterSpacing:.1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e}),g&&jsxRuntime.jsx("button",{type:"button",onClick:g,"aria-label":l,title:l,"data-testid":"agent-panel-close",style:{border:"none",background:"transparent",padding:6,cursor:"pointer",display:"inline-flex",alignItems:"center",justifyContent:"center",color:"#444746",borderRadius:999,transition:"background 0.15s"},onMouseEnter:m=>{m.currentTarget.style.background="#f1f3f4";},onMouseLeave:m=>{m.currentTarget.style.background="transparent";},children:jsxRuntime.jsx(le,{size:18})})]}),jsxRuntime.jsx("div",{style:{flex:1,minHeight:0,overflow:"hidden",display:"flex",flexDirection:"column"},children:x})]})}function ge(e){let t={},l=/(=\d+|\w+)\s*\{([^}]*)\}/g,c;for(;(c=l.exec(e))!==null;)t[c[1]]=c[2];return t}function F(e,t,l="en"){return t?e.replace(/\{(\w+),\s*plural,\s*((?:[^{}]|\{[^{}]*\})*)\}/g,(u,d,p)=>{let r=Number(t[d]);if(isNaN(r))return u;let f=ge(p),g=f[`=${r}`];if(g!==void 0)return g.replace(/#/g,String(r));let x;try{x=new Intl.PluralRules(l).select(r);}catch{x=r===1?"one":"other";}return (f[x]??f.other??"").replace(/#/g,String(r))}).replace(/\{(\w+)\}/g,(u,d)=>{let p=t[d];return p!==void 0?String(p):`{${d}}`}):e}function V(e){let t=e.replace(/_/g," ");return t.charAt(0).toUpperCase()+t.slice(1)}var xe=y.agentPanel.thinking,he=y.agentPanel.composerPlaceholder,be=y.agentPanel.send,ye=e=>F(y.agentPanel.timeline.working,{count:e}),Ae=e=>F(y.agentPanel.timeline.summary,{count:e}),Se=e=>F(y.agentPanel.timeline.earlier,{count:e}),j="ep-agent-chat-keyframes",Ce=`
2
2
  @keyframes epAgentDot {
3
3
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
4
4
  40% { transform: scale(1); opacity: 1; }
package/dist/react.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import {a}from'./chunk-YQIAKHOL.mjs';import {d,b,a as a$1}from'./chunk-24MVJKCP.mjs';export{c as getToolDisplayName}from'./chunk-24MVJKCP.mjs';import {useMemo,useCallback,useState,useRef,useEffect}from'react';import {jsxs,jsx}from'react/jsx-runtime';var te=d();function ne(e){let{editorRef:t,author:l="AI"}=e,c=useMemo(()=>({get:()=>t.current?a(t.current,l):null}),[t,l]);return {executeToolCall:useCallback((d,p)=>{let r=c.get();return r?b(d,p,r):{success:false,error:"Editor not ready"}},[c]),toolSchemas:te}}function re(e){let{editorRef:t,author:l="AI",tools:c,include:u,exclude:d}=e,p=!!c&&Object.keys(c).length>0,r=useCallback(i=>!(u&&!u.includes(i)||d&&d.includes(i)),[u,d]),f=useMemo(()=>{let i=u||d?a$1.filter(n=>r(n.name)):a$1;if(!p)return i.map(n=>({type:"function",function:{name:n.name,description:n.description,parameters:n.inputSchema}}));let o=new Map(i.map(n=>[n.name,n]));for(let[n,C]of Object.entries(c))o.set(n,C);return Array.from(o.values()).map(n=>({type:"function",function:{name:n.name,description:n.description,parameters:n.inputSchema}}))},[c,p,u,d,r]),g=useCallback((i,o)=>{let n=t.current;if(!n)return {success:false,error:"Editor not ready."};let C=a(n,l),k=c?.[i];if(k)try{return k.handler(o,C)}catch(T){return {success:false,error:T instanceof Error?T.message:String(T)}}return r(i)?b(i,o,C):{success:false,error:`Tool '${i}' is not enabled.`}},[t,l,c,r]),x=useCallback(()=>{let i=t.current;if(!i)return {selection:null,currentPage:0,totalPages:0};let o=a(i,l);return {selection:o.getSelection(),currentPage:o.getCurrentPage(),totalPages:o.getTotalPages()}},[t,l]);return {tools:f,executeToolCall:g,getContext:x}}var y={agentPanel:{defaultTitle:"Assistant",close:"Close panel",resizeHandle:"Resize agent panel",thinking:"Assistant is thinking",composerPlaceholder:"Ask the assistant\u2026",send:"Send",timeline:{working:"Working\u2026 {count, plural, one {# step} other {# steps}}",summary:"{count, plural, one {# step} other {# steps}}",earlier:"+ {count, plural, one {# earlier step} other {# earlier steps}}"}}};var _="eigenpal:docx-editor:agentPanelWidth";function ae({size:e=22}){return jsx("svg",{viewBox:"0 -960 960 960",width:e,height:e,fill:"currentColor","aria-hidden":"true",children:jsx("path",{d:"m760-600-50-110-110-50 110-50 50-110 50 110 110 50-110 50-50 110Zm0 560-50-110-110-50 110-50 50-110 50 110 110 50-110 50-50 110ZM360-160 260-380 40-480l220-100 100-220 100 220 220 100-220 100-100 220Zm0-194 40-86 86-40-86-40-40-86-40 86-86 40 86 40 40 86Zm0-126Z"})})}function le({size:e=18}){return jsx("svg",{viewBox:"0 -960 960 960",width:e,height:e,fill:"currentColor","aria-hidden":"true",children:jsx("path",{d:"m256-200-56-56 224-224-224-224 56-56 224 224 224-224 56 56-224 224 224 224-56 56-224-224-224 224Z"})})}var ce=360,ue=280,de=600;function pe({title:e=y.agentPanel.defaultTitle,icon:t,closeLabel:l=y.agentPanel.close,resizeHandleLabel:c=y.agentPanel.resizeHandle,width:u,defaultWidth:d=ce,minWidth:p=ue,maxWidth:r=de,onWidthChange:f,onClose:g,children:x,className:i,closed:o=false}){let n=u!==void 0,[C,k]=useState(false),T=useRef(o);useEffect(()=>{if(T.current!==o){T.current=o,k(true);let m=window.setTimeout(()=>k(false),260);return ()=>window.clearTimeout(m)}},[o]);let[L,h]=useState(()=>{if(n)return u;if(typeof window>"u")return d;try{let m=window.localStorage.getItem(_);if(m){let S=Number(m);if(Number.isFinite(S)&&S>=p&&S<=r)return S}}catch{}return d}),E=n?u:L,v=useRef(null),B=useRef({minWidth:p,maxWidth:r,isControlled:n,onWidthChange:f});B.current={minWidth:p,maxWidth:r,isControlled:n,onWidthChange:f};let w=useRef(null);if(!w.current){let m=P=>{let D=v.current;if(!D)return;let I=B.current,q=D.startX-P.clientX,N=Math.min(I.maxWidth,Math.max(I.minWidth,D.startWidth+q));D.lastWidth=N,I.isControlled||h(N),I.onWidthChange?.(N);},S=()=>{let P=v.current;if(P&&(v.current=null,document.removeEventListener("pointermove",m),document.removeEventListener("pointerup",S),!B.current.isControlled))try{window.localStorage.setItem(_,String(P.lastWidth));}catch{}};w.current={move:m,up:S};}let Y=useCallback(m=>{m.preventDefault();let S=n?u:L;v.current={startX:m.clientX,startWidth:S,lastWidth:S},document.addEventListener("pointermove",w.current.move),document.addEventListener("pointerup",w.current.up);},[]);return useEffect(()=>()=>{let m=w.current;m&&(document.removeEventListener("pointermove",m.move),document.removeEventListener("pointerup",m.up));},[]),jsxs("div",{className:`ep-agent-panel${i?` ${i}`:""}`,style:{width:o?0:E,flex:o?"0 0 0px":`0 0 ${E}px`,height:"calc(100% - 16px)",margin:o?"8px 0 8px 0":"8px 8px 8px 12px",display:"flex",flexDirection:"column",background:"#ffffff",border:o?"1px solid transparent":"1px solid #e3e3e3",borderRadius:16,boxShadow:o?"none":"0 1px 2px rgba(60,64,67,0.05), 0 4px 12px rgba(60,64,67,0.08)",opacity:o?0:1,pointerEvents:o?"none":"auto",position:"relative",boxSizing:"border-box",minWidth:o?0:p,overflow:"hidden",fontFamily:"'Google Sans', 'Google Sans Text', system-ui, -apple-system, sans-serif",transition:C?"flex-basis 220ms cubic-bezier(0.4, 0, 0.2, 1), width 220ms cubic-bezier(0.4, 0, 0.2, 1), margin 220ms cubic-bezier(0.4, 0, 0.2, 1), opacity 180ms ease, box-shadow 220ms ease, border-color 220ms ease":"opacity 180ms ease, box-shadow 220ms ease, border-color 220ms ease"},"aria-hidden":o,"data-testid":"agent-panel","data-state":o?"closed":"open",role:"complementary","aria-label":e,children:[jsx("div",{role:"separator","aria-orientation":"vertical","aria-label":c,onPointerDown:Y,style:{position:"absolute",left:-3,top:0,bottom:0,width:6,cursor:"col-resize",touchAction:"none",zIndex:1},"data-testid":"agent-panel-resize-handle"}),jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"14px 16px 10px",flex:"0 0 auto",background:"#ffffff"},children:[jsx("span",{style:{display:"inline-flex",alignItems:"center",color:"#0b57d0"},children:t??jsx(ae,{size:22})}),jsx("span",{style:{flex:1,fontSize:15,fontWeight:500,color:"#1f1f1f",letterSpacing:.1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e}),g&&jsx("button",{type:"button",onClick:g,"aria-label":l,title:l,"data-testid":"agent-panel-close",style:{border:"none",background:"transparent",padding:6,cursor:"pointer",display:"inline-flex",alignItems:"center",justifyContent:"center",color:"#444746",borderRadius:999,transition:"background 0.15s"},onMouseEnter:m=>{m.currentTarget.style.background="#f1f3f4";},onMouseLeave:m=>{m.currentTarget.style.background="transparent";},children:jsx(le,{size:18})})]}),jsx("div",{style:{flex:1,minHeight:0,overflow:"hidden",display:"flex",flexDirection:"column"},children:x})]})}function ge(e){let t={},l=/(=\d+|\w+)\s*\{([^}]*)\}/g,c;for(;(c=l.exec(e))!==null;)t[c[1]]=c[2];return t}function F(e,t,l="en"){return t?e.replace(/\{(\w+),\s*plural,\s*((?:[^{}]|\{[^{}]*\})*)\}/g,(u,d,p)=>{let r=Number(t[d]);if(isNaN(r))return u;let f=ge(p),g=f[`=${r}`];if(g!==void 0)return g.replace(/#/g,String(r));let x;try{x=new Intl.PluralRules(l).select(r);}catch{x=r===1?"one":"other";}return (f[x]??f.other??"").replace(/#/g,String(r))}).replace(/\{(\w+)\}/g,(u,d)=>{let p=t[d];return p!==void 0?String(p):`{${d}}`}):e}function V(e){let t=e.replace(/_/g," ");return t.charAt(0).toUpperCase()+t.slice(1)}var xe=y.agentPanel.thinking,he=y.agentPanel.composerPlaceholder,be=y.agentPanel.send,ye=e=>F(y.agentPanel.timeline.working,{count:e}),Ae=e=>F(y.agentPanel.timeline.summary,{count:e}),Se=e=>F(y.agentPanel.timeline.earlier,{count:e}),j="ep-agent-chat-keyframes",Ce=`
1
+ import {a}from'./chunk-4I6U7BWX.mjs';import {d,b,a as a$1}from'./chunk-24MVJKCP.mjs';export{c as getToolDisplayName}from'./chunk-24MVJKCP.mjs';import {useMemo,useCallback,useState,useRef,useEffect}from'react';import {jsxs,jsx}from'react/jsx-runtime';var te=d();function ne(e){let{editorRef:t,author:l="AI"}=e,c=useMemo(()=>({get:()=>t.current?a(t.current,l):null}),[t,l]);return {executeToolCall:useCallback((d,p)=>{let r=c.get();return r?b(d,p,r):{success:false,error:"Editor not ready"}},[c]),toolSchemas:te}}function re(e){let{editorRef:t,author:l="AI",tools:c,include:u,exclude:d}=e,p=!!c&&Object.keys(c).length>0,r=useCallback(i=>!(u&&!u.includes(i)||d&&d.includes(i)),[u,d]),f=useMemo(()=>{let i=u||d?a$1.filter(n=>r(n.name)):a$1;if(!p)return i.map(n=>({type:"function",function:{name:n.name,description:n.description,parameters:n.inputSchema}}));let o=new Map(i.map(n=>[n.name,n]));for(let[n,C]of Object.entries(c))o.set(n,C);return Array.from(o.values()).map(n=>({type:"function",function:{name:n.name,description:n.description,parameters:n.inputSchema}}))},[c,p,u,d,r]),g=useCallback((i,o)=>{let n=t.current;if(!n)return {success:false,error:"Editor not ready."};let C=a(n,l),k=c?.[i];if(k)try{return k.handler(o,C)}catch(T){return {success:false,error:T instanceof Error?T.message:String(T)}}return r(i)?b(i,o,C):{success:false,error:`Tool '${i}' is not enabled.`}},[t,l,c,r]),x=useCallback(()=>{let i=t.current;if(!i)return {selection:null,currentPage:0,totalPages:0};let o=a(i,l);return {selection:o.getSelection(),currentPage:o.getCurrentPage(),totalPages:o.getTotalPages()}},[t,l]);return {tools:f,executeToolCall:g,getContext:x}}var y={agentPanel:{defaultTitle:"Assistant",close:"Close panel",resizeHandle:"Resize agent panel",thinking:"Assistant is thinking",composerPlaceholder:"Ask the assistant\u2026",send:"Send",timeline:{working:"Working\u2026 {count, plural, one {# step} other {# steps}}",summary:"{count, plural, one {# step} other {# steps}}",earlier:"+ {count, plural, one {# earlier step} other {# earlier steps}}"}}};var _="eigenpal:docx-editor:agentPanelWidth";function ae({size:e=22}){return jsx("svg",{viewBox:"0 -960 960 960",width:e,height:e,fill:"currentColor","aria-hidden":"true",children:jsx("path",{d:"m760-600-50-110-110-50 110-50 50-110 50 110 110 50-110 50-50 110Zm0 560-50-110-110-50 110-50 50-110 50 110 110 50-110 50-50 110ZM360-160 260-380 40-480l220-100 100-220 100 220 220 100-220 100-100 220Zm0-194 40-86 86-40-86-40-40-86-40 86-86 40 86 40 40 86Zm0-126Z"})})}function le({size:e=18}){return jsx("svg",{viewBox:"0 -960 960 960",width:e,height:e,fill:"currentColor","aria-hidden":"true",children:jsx("path",{d:"m256-200-56-56 224-224-224-224 56-56 224 224 224-224 56 56-224 224 224 224-56 56-224-224-224 224Z"})})}var ce=360,ue=280,de=600;function pe({title:e=y.agentPanel.defaultTitle,icon:t,closeLabel:l=y.agentPanel.close,resizeHandleLabel:c=y.agentPanel.resizeHandle,width:u,defaultWidth:d=ce,minWidth:p=ue,maxWidth:r=de,onWidthChange:f,onClose:g,children:x,className:i,closed:o=false}){let n=u!==void 0,[C,k]=useState(false),T=useRef(o);useEffect(()=>{if(T.current!==o){T.current=o,k(true);let m=window.setTimeout(()=>k(false),260);return ()=>window.clearTimeout(m)}},[o]);let[L,h]=useState(()=>{if(n)return u;if(typeof window>"u")return d;try{let m=window.localStorage.getItem(_);if(m){let S=Number(m);if(Number.isFinite(S)&&S>=p&&S<=r)return S}}catch{}return d}),E=n?u:L,v=useRef(null),B=useRef({minWidth:p,maxWidth:r,isControlled:n,onWidthChange:f});B.current={minWidth:p,maxWidth:r,isControlled:n,onWidthChange:f};let w=useRef(null);if(!w.current){let m=P=>{let D=v.current;if(!D)return;let I=B.current,q=D.startX-P.clientX,N=Math.min(I.maxWidth,Math.max(I.minWidth,D.startWidth+q));D.lastWidth=N,I.isControlled||h(N),I.onWidthChange?.(N);},S=()=>{let P=v.current;if(P&&(v.current=null,document.removeEventListener("pointermove",m),document.removeEventListener("pointerup",S),!B.current.isControlled))try{window.localStorage.setItem(_,String(P.lastWidth));}catch{}};w.current={move:m,up:S};}let Y=useCallback(m=>{m.preventDefault();let S=n?u:L;v.current={startX:m.clientX,startWidth:S,lastWidth:S},document.addEventListener("pointermove",w.current.move),document.addEventListener("pointerup",w.current.up);},[]);return useEffect(()=>()=>{let m=w.current;m&&(document.removeEventListener("pointermove",m.move),document.removeEventListener("pointerup",m.up));},[]),jsxs("div",{className:`ep-agent-panel${i?` ${i}`:""}`,style:{width:o?0:E,flex:o?"0 0 0px":`0 0 ${E}px`,height:"calc(100% - 16px)",margin:o?"8px 0 8px 0":"8px 8px 8px 12px",display:"flex",flexDirection:"column",background:"#ffffff",border:o?"1px solid transparent":"1px solid #e3e3e3",borderRadius:16,boxShadow:o?"none":"0 1px 2px rgba(60,64,67,0.05), 0 4px 12px rgba(60,64,67,0.08)",opacity:o?0:1,pointerEvents:o?"none":"auto",position:"relative",boxSizing:"border-box",minWidth:o?0:p,overflow:"hidden",fontFamily:"'Google Sans', 'Google Sans Text', system-ui, -apple-system, sans-serif",transition:C?"flex-basis 220ms cubic-bezier(0.4, 0, 0.2, 1), width 220ms cubic-bezier(0.4, 0, 0.2, 1), margin 220ms cubic-bezier(0.4, 0, 0.2, 1), opacity 180ms ease, box-shadow 220ms ease, border-color 220ms ease":"opacity 180ms ease, box-shadow 220ms ease, border-color 220ms ease"},"aria-hidden":o,"data-testid":"agent-panel","data-state":o?"closed":"open",role:"complementary","aria-label":e,children:[jsx("div",{role:"separator","aria-orientation":"vertical","aria-label":c,onPointerDown:Y,style:{position:"absolute",left:-3,top:0,bottom:0,width:6,cursor:"col-resize",touchAction:"none",zIndex:1},"data-testid":"agent-panel-resize-handle"}),jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"14px 16px 10px",flex:"0 0 auto",background:"#ffffff"},children:[jsx("span",{style:{display:"inline-flex",alignItems:"center",color:"#0b57d0"},children:t??jsx(ae,{size:22})}),jsx("span",{style:{flex:1,fontSize:15,fontWeight:500,color:"#1f1f1f",letterSpacing:.1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e}),g&&jsx("button",{type:"button",onClick:g,"aria-label":l,title:l,"data-testid":"agent-panel-close",style:{border:"none",background:"transparent",padding:6,cursor:"pointer",display:"inline-flex",alignItems:"center",justifyContent:"center",color:"#444746",borderRadius:999,transition:"background 0.15s"},onMouseEnter:m=>{m.currentTarget.style.background="#f1f3f4";},onMouseLeave:m=>{m.currentTarget.style.background="transparent";},children:jsx(le,{size:18})})]}),jsx("div",{style:{flex:1,minHeight:0,overflow:"hidden",display:"flex",flexDirection:"column"},children:x})]})}function ge(e){let t={},l=/(=\d+|\w+)\s*\{([^}]*)\}/g,c;for(;(c=l.exec(e))!==null;)t[c[1]]=c[2];return t}function F(e,t,l="en"){return t?e.replace(/\{(\w+),\s*plural,\s*((?:[^{}]|\{[^{}]*\})*)\}/g,(u,d,p)=>{let r=Number(t[d]);if(isNaN(r))return u;let f=ge(p),g=f[`=${r}`];if(g!==void 0)return g.replace(/#/g,String(r));let x;try{x=new Intl.PluralRules(l).select(r);}catch{x=r===1?"one":"other";}return (f[x]??f.other??"").replace(/#/g,String(r))}).replace(/\{(\w+)\}/g,(u,d)=>{let p=t[d];return p!==void 0?String(p):`{${d}}`}):e}function V(e){let t=e.replace(/_/g," ");return t.charAt(0).toUpperCase()+t.slice(1)}var xe=y.agentPanel.thinking,he=y.agentPanel.composerPlaceholder,be=y.agentPanel.send,ye=e=>F(y.agentPanel.timeline.working,{count:e}),Ae=e=>F(y.agentPanel.timeline.summary,{count:e}),Se=e=>F(y.agentPanel.timeline.earlier,{count:e}),j="ep-agent-chat-keyframes",Ce=`
2
2
  @keyframes epAgentDot {
3
3
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
4
4
  40% { transform: scale(1); opacity: 1; }
@@ -278,6 +278,19 @@ interface ParagraphFormatting {
278
278
  /** List level (0-8) (w:ilvl) */
279
279
  ilvl?: number;
280
280
  };
281
+ /**
282
+ * When `numPr` was resolved from the paragraph STYLE's pPr rather than the
283
+ * paragraph's own `<w:numPr>`, this records the style-sourced value. The
284
+ * serializer omits `numPr` while it still equals this value — writing it as
285
+ * direct formatting would flip Word's indent precedence (a directly
286
+ * referenced level's indents beat the style's; a style-referenced level's
287
+ * do not) and break the document on save/reload. Cleared the moment the
288
+ * user changes the numbering (values diverge).
289
+ */
290
+ numPrFromStyle?: {
291
+ numId?: number;
292
+ ilvl?: number;
293
+ };
281
294
  /** Outline level 0-9 (w:outlineLvl) */
282
295
  outlineLevel?: number;
283
296
  /** Paragraph style ID (w:pStyle) */
@@ -483,7 +496,7 @@ interface TableCellFormatting {
483
496
  /**
484
497
  * Number format type
485
498
  */
486
- type NumberFormat = 'decimal' | 'upperRoman' | 'lowerRoman' | 'upperLetter' | 'lowerLetter' | 'ordinal' | 'cardinalText' | 'ordinalText' | 'hex' | 'chicago' | 'ideographDigital' | 'japaneseCounting' | 'aiueo' | 'iroha' | 'decimalFullWidth' | 'decimalHalfWidth' | 'japaneseLegal' | 'japaneseDigitalTenThousand' | 'decimalEnclosedCircle' | 'decimalFullWidth2' | 'aiueoFullWidth' | 'irohaFullWidth' | 'decimalZero' | 'bullet' | 'ganada' | 'chosung' | 'decimalEnclosedFullstop' | 'decimalEnclosedParen' | 'decimalEnclosedCircleChinese' | 'ideographEnclosedCircle' | 'ideographTraditional' | 'ideographZodiac' | 'ideographZodiacTraditional' | 'taiwaneseCounting' | 'ideographLegalTraditional' | 'taiwaneseCountingThousand' | 'taiwaneseDigital' | 'chineseCounting' | 'chineseLegalSimplified' | 'chineseCountingThousand' | 'koreanDigital' | 'koreanCounting' | 'koreanLegal' | 'koreanDigital2' | 'vietnameseCounting' | 'russianLower' | 'russianUpper' | 'none' | 'numberInDash' | 'hebrew1' | 'hebrew2' | 'arabicAlpha' | 'arabicAbjad' | 'hindiVowels' | 'hindiConsonants' | 'hindiNumbers' | 'hindiCounting' | 'thaiLetters' | 'thaiNumbers' | 'thaiCounting';
499
+ type NumberFormat = 'decimal' | 'upperRoman' | 'lowerRoman' | 'upperLetter' | 'lowerLetter' | 'ordinal' | 'cardinalText' | 'ordinalText' | 'hex' | 'chicago' | 'ideographDigital' | 'japaneseCounting' | 'aiueo' | 'iroha' | 'decimalFullWidth' | 'decimalHalfWidth' | 'japaneseLegal' | 'japaneseDigitalTenThousand' | 'decimalEnclosedCircle' | 'decimalFullWidth2' | 'aiueoFullWidth' | 'irohaFullWidth' | 'decimalZero' | 'decimalZero3' | 'decimalZero4' | 'decimalZero5' | 'bullet' | 'ganada' | 'chosung' | 'decimalEnclosedFullstop' | 'decimalEnclosedParen' | 'decimalEnclosedCircleChinese' | 'ideographEnclosedCircle' | 'ideographTraditional' | 'ideographZodiac' | 'ideographZodiacTraditional' | 'taiwaneseCounting' | 'ideographLegalTraditional' | 'taiwaneseCountingThousand' | 'taiwaneseDigital' | 'chineseCounting' | 'chineseLegalSimplified' | 'chineseCountingThousand' | 'koreanDigital' | 'koreanCounting' | 'koreanLegal' | 'koreanDigital2' | 'vietnameseCounting' | 'russianLower' | 'russianUpper' | 'none' | 'numberInDash' | 'hebrew1' | 'hebrew2' | 'arabicAlpha' | 'arabicAbjad' | 'hindiVowels' | 'hindiConsonants' | 'hindiNumbers' | 'hindiCounting' | 'thaiLetters' | 'thaiNumbers' | 'thaiCounting';
487
500
  /**
488
501
  * Multi-level suffix (what follows the number)
489
502
  */
@@ -2343,12 +2356,10 @@ interface ReviewChange {
2343
2356
  */
2344
2357
  paragraphIndex: number;
2345
2358
  /**
2346
- * Set when the change lives inside a footnote or endnote. Such changes are
2347
- * surfaced for discovery only accept/reject operate on the body, so an id
2348
- * that resolves *only* to a note change throws `NoteChangeNotEditableError`
2349
- * (an id also present on a body change resolves to the body change). The
2350
- * raw `id` is not namespaced across parts, so pair it with `noteId` /
2351
- * `noteType` to identify the change.
2359
+ * Set when the change lives inside a footnote or endnote. The raw `id` is not
2360
+ * namespaced across parts, so pair it with `noteId` / `noteType` to identify
2361
+ * the change, and pass the whole `ReviewChange` back to `acceptChange` /
2362
+ * `rejectChange` to resolve it inside that note.
2352
2363
  */
2353
2364
  noteId?: number;
2354
2365
  /** Which note store the change came from. Absent for body changes. */
@@ -2378,6 +2389,11 @@ interface ChangeFilter {
2378
2389
  /** Also report tracked changes inside endnote bodies. Default: false. */
2379
2390
  includeEndnotes?: boolean;
2380
2391
  }
2392
+ /**
2393
+ * Options for `acceptAll` / `rejectAll`. Opt in to also resolve tracked changes
2394
+ * inside footnote/endnote bodies; mirrors the discovery flags on {@link ChangeFilter}.
2395
+ */
2396
+ type AcceptChangesOptions = Pick<ChangeFilter, 'includeFootnotes' | 'includeEndnotes'>;
2381
2397
  interface CommentFilter {
2382
2398
  author?: string;
2383
2399
  done?: boolean;
@@ -2605,10 +2621,11 @@ declare class DocxReviewer {
2605
2621
  * parts, so the same `id` can appear on a body change and a note change. Use
2606
2622
  * `noteType` / `noteId` to disambiguate.
2607
2623
  *
2608
- * Note changes are surfaced for discovery only. `acceptChange` /
2609
- * `rejectChange` operate on the document body, so an id that resolves *only*
2610
- * to a note change throws {@link NoteChangeNotEditableError} rather than
2611
- * mutating it (an id shared with a body change resolves to the body change).
2624
+ * A returned change with `noteId`/`noteType` set can be accepted or rejected
2625
+ * by passing the whole {@link ReviewChange} back to {@link acceptChange} /
2626
+ * {@link rejectChange} (which resolves it inside its footnote/endnote), or in
2627
+ * bulk via {@link acceptAll} / {@link rejectAll} with the matching `include*`
2628
+ * option; the result persists on {@link toBuffer}.
2612
2629
  */
2613
2630
  getChanges(filter?: ChangeFilter): ReviewChange[];
2614
2631
  /** Get all comments with their replies. */
@@ -2658,42 +2675,28 @@ declare class DocxReviewer {
2658
2675
  /** Delete text as a tracked change. */
2659
2676
  proposeDeletion(options: ProposeDeletionOptions): void;
2660
2677
  /**
2661
- * Guard the body-only accept/reject path against in-note changes.
2678
+ * Accept a tracked change. Pass a revision id to accept a change in the
2679
+ * document body, or pass a {@link ReviewChange} from {@link getChanges} to
2680
+ * accept it wherever it lives — a change carrying `noteId`/`noteType` is
2681
+ * resolved inside that footnote/endnote and persists on {@link toBuffer}.
2662
2682
  *
2663
- * A tracked-change `w:id` is unique only within its part, so the same id can
2664
- * appear in the body and in a footnote/endnote. When the id resolves to a
2665
- * body change we let the body-only impl handle it (body wins; the note, if
2666
- * any, is left untouched). When the id resolves ONLY to a note change we fail
2667
- * closed with {@link NoteChangeNotEditableError} rather than mis-reporting it
2668
- * as not-found — accept/reject cannot yet mutate note bodies.
2683
+ * A bare numeric id targets the body only: a `w:id` is unique only within its
2684
+ * part, so the same id can appear on a body change and a note change. To
2685
+ * resolve a note change pass the whole {@link ReviewChange} (its
2686
+ * `noteId`/`noteType` locate it); a bare id resolves to the body change, if any.
2669
2687
  */
2670
- private assertNotNoteOnly;
2688
+ acceptChange(target: number | ReviewChange): void;
2689
+ /** Reject a tracked change. See {@link acceptChange} for body-vs-note targeting. */
2690
+ rejectChange(target: number | ReviewChange): void;
2671
2691
  /**
2672
- * Accept a tracked change by its revision ID. Operates on the document body
2673
- * only.
2674
- *
2675
- * The public `id` is a `w:id`, which is unique only within its part, so the
2676
- * same id may appear in the body and in a footnote/endnote. Resolution is
2677
- * body-first: if a body change carries this id it is accepted and any
2678
- * same-id note change is left untouched. If the id resolves *only* to a note
2679
- * change, this throws {@link NoteChangeNotEditableError} (note bodies are not
2680
- * yet mutable here). If it resolves to nothing, it throws
2681
- * {@link ChangeNotFoundError}.
2682
- */
2683
- acceptChange(id: number): void;
2684
- /**
2685
- * Reject a tracked change by its revision ID. Operates on the document body
2686
- * only.
2687
- *
2688
- * Same resolution rules as {@link acceptChange}: body-first, throws
2689
- * {@link NoteChangeNotEditableError} for a note-only id, and
2690
- * {@link ChangeNotFoundError} when the id matches nothing.
2692
+ * Accept all tracked changes in the body. Pass `{ includeFootnotes,
2693
+ * includeEndnotes }` to also accept changes inside note bodies. Returns count.
2691
2694
  */
2692
- rejectChange(id: number): void;
2693
- /** Accept all tracked changes. Returns count accepted. */
2694
- acceptAll(): number;
2695
- /** Reject all tracked changes. Returns count rejected. */
2696
- rejectAll(): number;
2695
+ acceptAll(opts?: AcceptChangesOptions): number;
2696
+ /** Reject all tracked changes. See {@link acceptAll} for the note opt-in. */
2697
+ rejectAll(opts?: AcceptChangesOptions): number;
2698
+ /** The package's note stores, passed to change ops so note changes resolve. */
2699
+ private changeNotes;
2697
2700
  /**
2698
2701
  * Apply multiple review operations in one call.
2699
2702
  * Uses the reviewer's default author. Individual failures are collected, not thrown.