@eigenpal/docx-editor-agents 1.0.3 → 1.2.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.
Files changed (48) hide show
  1. package/LICENSE +13 -16
  2. package/dist/bridge.d.mts +1 -1
  3. package/dist/bridge.d.ts +1 -1
  4. package/dist/bridge.js +1 -1
  5. package/dist/bridge.mjs +1 -1
  6. package/dist/{chunk-NGMVN6QV.mjs → chunk-6KT5LOQB.mjs} +1 -1
  7. package/dist/chunk-B3LQVYMR.js +74 -0
  8. package/dist/{chunk-DDW6L3LZ.js → chunk-DIXFGAF5.js} +2 -2
  9. package/dist/chunk-EPRXZTIE.js +1 -0
  10. package/dist/{chunk-JQBSMHZA.mjs → chunk-HTU7NUTJ.mjs} +1 -1
  11. package/dist/chunk-L7LXQOTH.mjs +74 -0
  12. package/dist/chunk-MHUG23P6.js +5 -0
  13. package/dist/chunk-MK47WH2X.mjs +5 -0
  14. package/dist/{chunk-SCYZRJWI.js → chunk-NSFRE2VK.js} +1 -1
  15. package/dist/chunk-XDZHYYU6.mjs +1 -0
  16. package/dist/executor-SBR6X4JZ.mjs +1 -0
  17. package/dist/executor-ZTSOZMKE.js +1 -0
  18. package/dist/headless-6C4JSKYY.mjs +1 -0
  19. package/dist/headless-VGNLVFAJ.js +1 -0
  20. package/dist/index.d.mts +2 -2
  21. package/dist/index.d.ts +2 -2
  22. package/dist/index.js +1 -1
  23. package/dist/index.mjs +1 -1
  24. package/dist/mcp.d.mts +1 -1
  25. package/dist/mcp.d.ts +1 -1
  26. package/dist/react.d.mts +2 -2
  27. package/dist/react.d.ts +2 -2
  28. package/dist/react.js +1 -1
  29. package/dist/react.mjs +1 -1
  30. package/dist/{server-CGxgyhy-.d.mts → server-uM9UUIhk.d.mts} +190 -108
  31. package/dist/{server-CGxgyhy-.d.ts → server-uM9UUIhk.d.ts} +190 -108
  32. package/dist/server.d.mts +1 -1
  33. package/dist/server.d.ts +1 -1
  34. package/dist/server.js +1 -1
  35. package/dist/server.mjs +1 -1
  36. package/dist/vue.js +2 -2
  37. package/dist/vue.mjs +18 -20
  38. package/package.json +2 -2
  39. package/dist/chunk-7C5RGTQY.js +0 -71
  40. package/dist/chunk-MOAJJKKG.js +0 -5
  41. package/dist/chunk-NISW2GF6.js +0 -1
  42. package/dist/chunk-OHVUJUDE.mjs +0 -71
  43. package/dist/chunk-PSSPSJR4.mjs +0 -5
  44. package/dist/chunk-X4YGLGUM.mjs +0 -1
  45. package/dist/executor-QBMOTUCJ.js +0 -1
  46. package/dist/executor-RSQI3VOF.mjs +0 -1
  47. package/dist/headless-3IX5WQEZ.js +0 -1
  48. package/dist/headless-V7JUUMG6.mjs +0 -1
@@ -0,0 +1,5 @@
1
+ 'use strict';var chunkB3LQVYMR_js=require('./chunk-B3LQVYMR.js'),chunkEPRXZTIE_js=require('./chunk-EPRXZTIE.js');function h(o){return o.type==="insertion"||o.type==="deletion"||o.type==="moveFrom"||o.type==="moveTo"}function x(o){let t=[];for(let r of o)r.type==="run"?t.push(chunkB3LQVYMR_js.H(r)):r.type==="hyperlink"&&t.push(chunkB3LQVYMR_js.I(r));return t.join("")}function I(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 i of n.rows)for(let e of i.cells)for(let a of e.content)if(a.type==="paragraph"){if(r===t)return a;r++;}}else r++;throw new Error(`Paragraph index ${t} out of bounds (max: ${r-1})`)}function P(o,t){let r=0;for(let n of o.content)if(n.type==="paragraph"){if(t(n,r)===false)return;r++;}else if(n.type==="table"){for(let i of n.rows)for(let e of i.cells)for(let a of e.content)if(a.type==="paragraph"){if(t(a,r)===false)return;r++;}}else r++;}function ce(o,t={}){let{fromIndex:r,toIndex:n,includeTrackedChanges:i=true,includeCommentAnchors:e=true}=t,a=[],s=0;for(let u of o.content)if(u.type==="paragraph")E(s,r,n)&&a.push(J(u,s,i,e)),s++;else if(u.type==="table"){E(s,r,n)&&a.push(K(u,s,i,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 a}function E(o,t,r){return (t===void 0||o>=t)&&(r===void 0||o<=r)}function J(o,t,r,n){let i=O(o,r,n),e=o.formatting?.styleId,a=o.paraId;return chunkB3LQVYMR_js.U(e)?{type:"heading",index:t,paraId:a,level:chunkB3LQVYMR_js.V(e)??1,text:i}:o.listRendering?{type:"list-item",index:t,paraId:a,text:i,listLevel:o.listRendering.level??0,listType:o.listRendering.isBullet?"bullet":"number"}:{type:"paragraph",index:t,paraId:a,text:i}}function K(o,t,r,n){let i=[],e=[];for(let a of o.rows){let s=[],u=[];for(let l of a.cells){let c=[],f;for(let g of l.content)g.type==="paragraph"&&(f===void 0&&(f=g.paraId),c.push(O(g,r,n)));s.push(c.join(`
2
+ `)),u.push(f);}i.push(s),e.push(u);}return {type:"table",index:t,rows:i,cellParaIds:e}}function le(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 i=" ".repeat(n.listLevel),e=n.listType==="bullet"?"\u2022":"-";t.push(`[${r(n)}] ${i}${e} ${n.text}`);break}case "table":{let i=n.index;for(let e=0;e<n.rows.length;e++)for(let a=0;a<n.rows[e].length;a++){let u=n.rows[e][a].split(`
3
+ `),l=n.cellParaIds?.[e]?.[a];for(let c=0;c<u.length;c++){let f=c===0&&l?l:String(i);t.push(`[${f}] (table, row ${e+1}, col ${a+1}) ${u[c]}`),i++;}}break}}return t.join(`
4
+ `)}function O(o,t,r){let n=[],i=new Set;for(let e of o.content){if(e.type==="commentRangeStart"&&r){i.add(e.id),n.push(`[comment:${e.id}]`);continue}if(e.type==="commentRangeEnd"&&r){i.has(e.id)&&(i.delete(e.id),n.push("[/comment]"));continue}if(e.type==="run")n.push(chunkB3LQVYMR_js.H(e));else if(e.type==="hyperlink")n.push(chunkB3LQVYMR_js.I(e));else if(h(e)){let a=x(e.content);e.type==="insertion"||e.type==="moveTo"?t&&n.push(`[+${a}+]{by:${e.info.author}}`):t?n.push(`[-${a}-]{by:${e.info.author}}`):n.push(a);}}return n.join("")}var y=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";}},A=class extends Error{constructor(t){super(`Tracked change not found: id=${t}`),this.name="ChangeNotFoundError";}},L=class extends Error{constructor(t){super(`Comment not found: id=${t}`),this.name="CommentNotFoundError";}};function W(o){let t=[],r=0;for(let n=0;n<o.content.length;n++){let i=o.content[n];if(i.type==="run"){let e=chunkB3LQVYMR_js.H(i);t.push({contentIndex:n,run:i,text:e,startPos:r}),r+=e.length;}else if(i.type==="hyperlink")for(let e=0;e<i.children.length;e++){let a=i.children[e];if(a.type==="run"){let s=chunkB3LQVYMR_js.H(a);t.push({contentIndex:n,run:a,text:s,startPos:r}),r+=s.length;}}else if(h(i)){if(i.type==="insertion"||i.type==="moveTo")continue;for(let e=0;e<i.content.length;e++){let a=i.content[e];if(a.type==="run"){let s=chunkB3LQVYMR_js.H(a);t.push({contentIndex:n,run:a,text:s,startPos:r}),r+=s.length;}else if(a.type==="hyperlink"){for(let s of a.children)if(s.type==="run"){let u=chunkB3LQVYMR_js.H(s);t.push({contentIndex:n,run:s,text:u,startPos:r}),r+=u.length;}}}}}return t}function v(o){return W(o).map(t=>t.text).join("")}function Q(o,t,r){let n=W(o),i=n.map(c=>c.text).join(""),e=V(i,t);if(!e)throw new y(t,r);let a=-1,s=0;for(let c=0;c<n.length;c++)if(e.start<n[c].startPos+n[c].text.length){a=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(a===-1||u===-1)throw new y(t,r);return {startRunIndex:n[a].contentIndex,startOffset:s,endRunIndex:n[u].contentIndex,endOffset:l}}function ge(o,t,r){let n=Q(o,t,r),{startRunIndex:i,endRunIndex:e}=n,{startOffset:a,endOffset:s}=n,u=o.content[e];if(u.type==="run"){let c=chunkB3LQVYMR_js.H(u);if(s<c.length){let f=j(c.slice(s),u);H(u,c.slice(0,s)),o.content.splice(e+1,0,f);}}let l=o.content[i];if(l.type==="run"&&a>0){let c=chunkB3LQVYMR_js.H(l),f=j(c.slice(0,a),l);H(l,c.slice(a)),o.content.splice(i,0,f),i++,e++;}return {startIndex:i,endIndex:e}}function j(o,t){return {type:"run",content:[{type:"text",text:o}],formatting:t.formatting?{...t.formatting}:void 0}}function H(o,t){let r=o.content.find(n=>n.type==="text");r&&(r.text=t);}function z(o){let t=[],r=[],n=true;for(let i=0;i<o.length;i++){let e=o[i];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(i,i,i),n=false;continue}if(/\s/.test(e)||e==="\xA0"){n||(t.push(" "),r.push(i),n=true);continue}t.push(e.toLowerCase()),r.push(i),n=false;}}return t.length>0&&t[t.length-1]===" "&&(t.pop(),r.pop()),{text:t.join(""),posMap:r}}function N(o,t,r,n){let i=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:i,end:e}}function V(o,t){if(!t||!o)return null;let r=o.indexOf(t);if(r!==-1)return {start:r,end:r+t.length};let n=z(o),i=z(t);if(!i.text)return null;let e=n.text.indexOf(i.text);if(e!==-1)return N(n,e,i.text.length,o);let a=i.text.split(" ");if(a.length>=3)for(let s=1;s<=Math.min(2,a.length-2);s++){let u=a.slice(0,-s).join(" "),l=n.text.indexOf(u);if(l!==-1)return N(n,l,u.length,o)}return null}function be(o,t){let r=new Map;return P(o,(i,e)=>{let a=null;for(let s of i.content)if(h(s)){a===null&&(a=v(i));let u=x(s.content),l=s.info.id,c=r.get(l);c&&c.paragraphIndex===e?c.text+=u:r.set(l,{id:l,type:s.type,author:s.info.author,date:s.info.date??null,text:u,context:a,paragraphIndex:e});}}),Array.from(r.values()).filter(i=>!(t?.author&&i.author!==t.author||t?.type&&i.type!==t.type))}function Ce(o,t){let r=o.comments??[];if(r.length===0)return [];let n=Y(o),i=[],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 i.push(s);return i.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:G(c)}));return {id:s.id,author:s.author,date:s.date??null,text:G(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 G(o){return o.content.map(t=>v(t)).join(`
5
+ `)}function Y(o){let t=new Map,r=new Map;return P(o,(n,i)=>{for(let e of n.content)if(e.type==="commentRangeStart")r.set(e.id,{paragraphIndex:i,parts:[]});else if(e.type==="commentRangeEnd"){let a=r.get(e.id);a&&(t.set(e.id,{text:a.parts.join(""),paragraphIndex:a.paragraphIndex}),r.delete(e.id));}else if(e.type==="run"){let a=chunkB3LQVYMR_js.H(e);for(let s of r.values())s.parts.push(a);}else if(e.type==="hyperlink"){let a=e.children.filter(s=>s.type==="run").map(chunkB3LQVYMR_js.H).join("");for(let s of r.values())s.parts.push(a);}else if(h(e)){if(e.type==="insertion"||e.type==="moveTo")continue;let a=x(e.content);for(let s of r.values())s.parts.push(a);}}),t}function Z(o){let t=o.toDocument().package?.document;if(!t)return new Map;let r=new Map,n=0;for(let i of t.content)if(i.type==="paragraph"){let e=i.paraId;e&&r.set(e,n),n++;}else if(i.type==="table")for(let e of i.rows)for(let a of e.cells)for(let s of a.content)s.type==="paragraph"&&n++;else n++;return r}function _(o){let t=[],r=n=>{for(let i of n.content)i.type==="text"&&t.push(i.text??"");};for(let n of o.content)if(n.type==="run")r(n);else if(n.type==="hyperlink")for(let i of n.children)i.type==="run"&&r(i);else if(n.type==="deletion"||n.type==="moveFrom"){for(let i of n.content)if(i.type==="run")r(i);else if(i.type==="hyperlink")for(let e of i.children)e.type==="run"&&r(e);}return t.join("")}function F(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 q(o){return o.content.map(t=>t.type==="text"?t.text:"").join("")}function k(o,t,r,n,i){let e=q(o);if(!e)return;let a=i.value,s=a+e.length;n.push({run:o,parent:t,index:r,text:e,start:a,end:s}),i.value=s;}function U(o,t,r){o.children.forEach((n,i)=>{n.type==="run"&&k(n,o.children,i,t,r);});}function M(o,t){let r=[],n={value:0};return o.content.forEach((i,e)=>{i.type==="run"?k(i,o.content,e,r,n):i.type==="hyperlink"?U(i,r,n):(i.type==="deletion"||i.type==="moveFrom"||t&&(i.type==="insertion"||i.type==="moveTo"))&&i.content.forEach((a,s)=>{a.type==="run"?k(a,i.content,s,r,n):a.type==="hyperlink"&&U(a,r,n);});}),r}function ee(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=chunkB3LQVYMR_js.ta(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 w(o,t){o.formatting=ee(o.formatting,t);}function te(o,t,r,n){let i=o.run.content.every(s=>s.type==="text");if(t<=0&&r>=o.text.length||!i){w(o.run,n);return}let e=[];t>0&&e.push(F(o.run,o.text.slice(0,t)));let a=F(o.run,o.text.slice(t,r));w(a,n),e.push(a),r<o.text.length&&e.push(F(o.run,o.text.slice(r))),o.parent.splice(o.index,1,...e);}function ne(o,t,r,n){let e=M(o,false).filter(a=>a.start<r&&a.end>t);if(e.length===0)return true;for(let a=e.length-1;a>=0;a--){let s=e[a];te(s,Math.max(0,t-s.start),Math.min(s.text.length,r-s.start),n);}return true}function re(o,t){let r=M(o,true);for(let n of r)w(n.run,t);return true}function oe(o,t){if(!t)return null;let n=M(o,false).map(e=>e.text).join(""),i=n.indexOf(t);return i===-1||n.indexOf(t,i+1)!==-1?null:{from:i,to:i+t.length}}function ie(o,t){return o?!!o.styles?.some(r=>r.styleId===t&&r.type==="paragraph"):true}function Pe(o){let t=new Set,r=null;function n(){return r===null&&(r=Z(o)),r}function i(){if(t.size===0)return;let e=o.getComments(),a=o.getChanges(),s={commentCount:e.length,changeCount:a.length,comments:e,changes:a};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,a){if(!e)return [];let s=a?.caseSensitive??false,u=a?.limit??20,l=s?e:e.toLowerCase(),c=o.toDocument().package?.document;if(!c)return [];let f=[],g=40;for(let B of c.content){if(f.length>=u)break;if(B.type!=="paragraph")continue;let C=B;if(!C.paraId)continue;let m=_(C),S=s?m:m.toLowerCase(),d=S.indexOf(l);if(d===-1||S.indexOf(l,d+1)!==-1)continue;let X=m.slice(d,d+e.length);f.push({paraId:C.paraId,match:X,before:m.slice(Math.max(0,d-g),d),after:m.slice(d+e.length,d+e.length+g)});}return f},getSelection(){return null},addComment(e){let a=n().get(e.paraId);if(a===void 0)return null;try{let s=o.addComment({paragraphIndex:a,text:e.text,author:e.author,search:e.search});return i(),s}catch{return null}},replyTo(e,a){try{let s=o.replyTo(e,a);return i(),s}catch{return null}},resolveComment(e){let s=o.toDocument().package?.document?.comments?.find(u=>u.id===e);s&&(s.done=true,i());},proposeChange(e){let a=n().get(e.paraId);if(a===void 0)return false;let s=e.search==="",u=e.replaceWith==="";if(s&&u)return false;try{return s?o.proposeInsertion({paragraphIndex:a,insertText:e.replaceWith,author:e.author}):u?o.proposeDeletion({paragraphIndex:a,search:e.search,author:e.author}):o.replace({paragraphIndex:a,search:e.search,replaceWith:e.replaceWith,author:e.author}),i(),true}catch{return false}},scrollTo(e){return n().has(e)},applyFormatting(e){let a=n().get(e.paraId);if(a===void 0)return false;let s=o.toDocument().package?.document;if(!s)return false;try{let u=s?I(s,a):null;if(!u)return false;if(e.search){let l=oe(u,e.search);if(!l)return false;ne(u,l.from,l.to,e.marks);}else re(u,e.marks);return i(),true}catch{return false}},setParagraphStyle(e){let a=n().get(e.paraId);if(a===void 0)return false;let s=o.toDocument(),u=s.package?.document;if(!u||!ie(s.package?.styles,e.styleId))return false;try{let l=I(u,a);return l.formatting={...l.formatting??{},styleId:e.styleId},i(),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=h;exports.b=I;exports.c=P;exports.d=ce;exports.e=le;exports.f=y;exports.g=A;exports.h=L;exports.i=Q;exports.j=ge;exports.k=be;exports.l=Ce;exports.m=Pe;
@@ -0,0 +1,5 @@
1
+ import {U as U$1,V as V$1,H as H$1,I as I$1,ta}from'./chunk-L7LXQOTH.mjs';import {m}from'./chunk-XDZHYYU6.mjs';function h(o){return o.type==="insertion"||o.type==="deletion"||o.type==="moveFrom"||o.type==="moveTo"}function x(o){let t=[];for(let r of o)r.type==="run"?t.push(H$1(r)):r.type==="hyperlink"&&t.push(I$1(r));return t.join("")}function I(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 i of n.rows)for(let e of i.cells)for(let a of e.content)if(a.type==="paragraph"){if(r===t)return a;r++;}}else r++;throw new Error(`Paragraph index ${t} out of bounds (max: ${r-1})`)}function P(o,t){let r=0;for(let n of o.content)if(n.type==="paragraph"){if(t(n,r)===false)return;r++;}else if(n.type==="table"){for(let i of n.rows)for(let e of i.cells)for(let a of e.content)if(a.type==="paragraph"){if(t(a,r)===false)return;r++;}}else r++;}function ce(o,t={}){let{fromIndex:r,toIndex:n,includeTrackedChanges:i=true,includeCommentAnchors:e=true}=t,a=[],s=0;for(let u of o.content)if(u.type==="paragraph")E(s,r,n)&&a.push(J(u,s,i,e)),s++;else if(u.type==="table"){E(s,r,n)&&a.push(K(u,s,i,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 a}function E(o,t,r){return (t===void 0||o>=t)&&(r===void 0||o<=r)}function J(o,t,r,n){let i=O(o,r,n),e=o.formatting?.styleId,a=o.paraId;return U$1(e)?{type:"heading",index:t,paraId:a,level:V$1(e)??1,text:i}:o.listRendering?{type:"list-item",index:t,paraId:a,text:i,listLevel:o.listRendering.level??0,listType:o.listRendering.isBullet?"bullet":"number"}:{type:"paragraph",index:t,paraId:a,text:i}}function K(o,t,r,n){let i=[],e=[];for(let a of o.rows){let s=[],u=[];for(let l of a.cells){let c=[],f;for(let g of l.content)g.type==="paragraph"&&(f===void 0&&(f=g.paraId),c.push(O(g,r,n)));s.push(c.join(`
2
+ `)),u.push(f);}i.push(s),e.push(u);}return {type:"table",index:t,rows:i,cellParaIds:e}}function le(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 i=" ".repeat(n.listLevel),e=n.listType==="bullet"?"\u2022":"-";t.push(`[${r(n)}] ${i}${e} ${n.text}`);break}case "table":{let i=n.index;for(let e=0;e<n.rows.length;e++)for(let a=0;a<n.rows[e].length;a++){let u=n.rows[e][a].split(`
3
+ `),l=n.cellParaIds?.[e]?.[a];for(let c=0;c<u.length;c++){let f=c===0&&l?l:String(i);t.push(`[${f}] (table, row ${e+1}, col ${a+1}) ${u[c]}`),i++;}}break}}return t.join(`
4
+ `)}function O(o,t,r){let n=[],i=new Set;for(let e of o.content){if(e.type==="commentRangeStart"&&r){i.add(e.id),n.push(`[comment:${e.id}]`);continue}if(e.type==="commentRangeEnd"&&r){i.has(e.id)&&(i.delete(e.id),n.push("[/comment]"));continue}if(e.type==="run")n.push(H$1(e));else if(e.type==="hyperlink")n.push(I$1(e));else if(h(e)){let a=x(e.content);e.type==="insertion"||e.type==="moveTo"?t&&n.push(`[+${a}+]{by:${e.info.author}}`):t?n.push(`[-${a}-]{by:${e.info.author}}`):n.push(a);}}return n.join("")}var y=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";}},A=class extends Error{constructor(t){super(`Tracked change not found: id=${t}`),this.name="ChangeNotFoundError";}},L=class extends Error{constructor(t){super(`Comment not found: id=${t}`),this.name="CommentNotFoundError";}};function W(o){let t=[],r=0;for(let n=0;n<o.content.length;n++){let i=o.content[n];if(i.type==="run"){let e=H$1(i);t.push({contentIndex:n,run:i,text:e,startPos:r}),r+=e.length;}else if(i.type==="hyperlink")for(let e=0;e<i.children.length;e++){let a=i.children[e];if(a.type==="run"){let s=H$1(a);t.push({contentIndex:n,run:a,text:s,startPos:r}),r+=s.length;}}else if(h(i)){if(i.type==="insertion"||i.type==="moveTo")continue;for(let e=0;e<i.content.length;e++){let a=i.content[e];if(a.type==="run"){let s=H$1(a);t.push({contentIndex:n,run:a,text:s,startPos:r}),r+=s.length;}else if(a.type==="hyperlink"){for(let s of a.children)if(s.type==="run"){let u=H$1(s);t.push({contentIndex:n,run:s,text:u,startPos:r}),r+=u.length;}}}}}return t}function v(o){return W(o).map(t=>t.text).join("")}function Q(o,t,r){let n=W(o),i=n.map(c=>c.text).join(""),e=V(i,t);if(!e)throw new y(t,r);let a=-1,s=0;for(let c=0;c<n.length;c++)if(e.start<n[c].startPos+n[c].text.length){a=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(a===-1||u===-1)throw new y(t,r);return {startRunIndex:n[a].contentIndex,startOffset:s,endRunIndex:n[u].contentIndex,endOffset:l}}function ge(o,t,r){let n=Q(o,t,r),{startRunIndex:i,endRunIndex:e}=n,{startOffset:a,endOffset:s}=n,u=o.content[e];if(u.type==="run"){let c=H$1(u);if(s<c.length){let f=j(c.slice(s),u);H(u,c.slice(0,s)),o.content.splice(e+1,0,f);}}let l=o.content[i];if(l.type==="run"&&a>0){let c=H$1(l),f=j(c.slice(0,a),l);H(l,c.slice(a)),o.content.splice(i,0,f),i++,e++;}return {startIndex:i,endIndex:e}}function j(o,t){return {type:"run",content:[{type:"text",text:o}],formatting:t.formatting?{...t.formatting}:void 0}}function H(o,t){let r=o.content.find(n=>n.type==="text");r&&(r.text=t);}function z(o){let t=[],r=[],n=true;for(let i=0;i<o.length;i++){let e=o[i];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(i,i,i),n=false;continue}if(/\s/.test(e)||e==="\xA0"){n||(t.push(" "),r.push(i),n=true);continue}t.push(e.toLowerCase()),r.push(i),n=false;}}return t.length>0&&t[t.length-1]===" "&&(t.pop(),r.pop()),{text:t.join(""),posMap:r}}function N(o,t,r,n){let i=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:i,end:e}}function V(o,t){if(!t||!o)return null;let r=o.indexOf(t);if(r!==-1)return {start:r,end:r+t.length};let n=z(o),i=z(t);if(!i.text)return null;let e=n.text.indexOf(i.text);if(e!==-1)return N(n,e,i.text.length,o);let a=i.text.split(" ");if(a.length>=3)for(let s=1;s<=Math.min(2,a.length-2);s++){let u=a.slice(0,-s).join(" "),l=n.text.indexOf(u);if(l!==-1)return N(n,l,u.length,o)}return null}function be(o,t){let r=new Map;return P(o,(i,e)=>{let a=null;for(let s of i.content)if(h(s)){a===null&&(a=v(i));let u=x(s.content),l=s.info.id,c=r.get(l);c&&c.paragraphIndex===e?c.text+=u:r.set(l,{id:l,type:s.type,author:s.info.author,date:s.info.date??null,text:u,context:a,paragraphIndex:e});}}),Array.from(r.values()).filter(i=>!(t?.author&&i.author!==t.author||t?.type&&i.type!==t.type))}function Ce(o,t){let r=o.comments??[];if(r.length===0)return [];let n=Y(o),i=[],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 i.push(s);return i.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:G(c)}));return {id:s.id,author:s.author,date:s.date??null,text:G(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 G(o){return o.content.map(t=>v(t)).join(`
5
+ `)}function Y(o){let t=new Map,r=new Map;return P(o,(n,i)=>{for(let e of n.content)if(e.type==="commentRangeStart")r.set(e.id,{paragraphIndex:i,parts:[]});else if(e.type==="commentRangeEnd"){let a=r.get(e.id);a&&(t.set(e.id,{text:a.parts.join(""),paragraphIndex:a.paragraphIndex}),r.delete(e.id));}else if(e.type==="run"){let a=H$1(e);for(let s of r.values())s.parts.push(a);}else if(e.type==="hyperlink"){let a=e.children.filter(s=>s.type==="run").map(H$1).join("");for(let s of r.values())s.parts.push(a);}else if(h(e)){if(e.type==="insertion"||e.type==="moveTo")continue;let a=x(e.content);for(let s of r.values())s.parts.push(a);}}),t}function Z(o){let t=o.toDocument().package?.document;if(!t)return new Map;let r=new Map,n=0;for(let i of t.content)if(i.type==="paragraph"){let e=i.paraId;e&&r.set(e,n),n++;}else if(i.type==="table")for(let e of i.rows)for(let a of e.cells)for(let s of a.content)s.type==="paragraph"&&n++;else n++;return r}function _(o){let t=[],r=n=>{for(let i of n.content)i.type==="text"&&t.push(i.text??"");};for(let n of o.content)if(n.type==="run")r(n);else if(n.type==="hyperlink")for(let i of n.children)i.type==="run"&&r(i);else if(n.type==="deletion"||n.type==="moveFrom"){for(let i of n.content)if(i.type==="run")r(i);else if(i.type==="hyperlink")for(let e of i.children)e.type==="run"&&r(e);}return t.join("")}function F(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 q(o){return o.content.map(t=>t.type==="text"?t.text:"").join("")}function k(o,t,r,n,i){let e=q(o);if(!e)return;let a=i.value,s=a+e.length;n.push({run:o,parent:t,index:r,text:e,start:a,end:s}),i.value=s;}function U(o,t,r){o.children.forEach((n,i)=>{n.type==="run"&&k(n,o.children,i,t,r);});}function M(o,t){let r=[],n={value:0};return o.content.forEach((i,e)=>{i.type==="run"?k(i,o.content,e,r,n):i.type==="hyperlink"?U(i,r,n):(i.type==="deletion"||i.type==="moveFrom"||t&&(i.type==="insertion"||i.type==="moveTo"))&&i.content.forEach((a,s)=>{a.type==="run"?k(a,i.content,s,r,n):a.type==="hyperlink"&&U(a,r,n);});}),r}function ee(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=ta(t.highlight)||t.highlight:delete r.highlight),t.fontSize!==void 0&&(t.fontSize>0?r.fontSize=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 w(o,t){o.formatting=ee(o.formatting,t);}function te(o,t,r,n){let i=o.run.content.every(s=>s.type==="text");if(t<=0&&r>=o.text.length||!i){w(o.run,n);return}let e=[];t>0&&e.push(F(o.run,o.text.slice(0,t)));let a=F(o.run,o.text.slice(t,r));w(a,n),e.push(a),r<o.text.length&&e.push(F(o.run,o.text.slice(r))),o.parent.splice(o.index,1,...e);}function ne(o,t,r,n){let e=M(o,false).filter(a=>a.start<r&&a.end>t);if(e.length===0)return true;for(let a=e.length-1;a>=0;a--){let s=e[a];te(s,Math.max(0,t-s.start),Math.min(s.text.length,r-s.start),n);}return true}function re(o,t){let r=M(o,true);for(let n of r)w(n.run,t);return true}function oe(o,t){if(!t)return null;let n=M(o,false).map(e=>e.text).join(""),i=n.indexOf(t);return i===-1||n.indexOf(t,i+1)!==-1?null:{from:i,to:i+t.length}}function ie(o,t){return o?!!o.styles?.some(r=>r.styleId===t&&r.type==="paragraph"):true}function Pe(o){let t=new Set,r=null;function n(){return r===null&&(r=Z(o)),r}function i(){if(t.size===0)return;let e=o.getComments(),a=o.getChanges(),s={commentCount:e.length,changeCount:a.length,comments:e,changes:a};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,a){if(!e)return [];let s=a?.caseSensitive??false,u=a?.limit??20,l=s?e:e.toLowerCase(),c=o.toDocument().package?.document;if(!c)return [];let f=[],g=40;for(let B of c.content){if(f.length>=u)break;if(B.type!=="paragraph")continue;let C=B;if(!C.paraId)continue;let m=_(C),S=s?m:m.toLowerCase(),d=S.indexOf(l);if(d===-1||S.indexOf(l,d+1)!==-1)continue;let X=m.slice(d,d+e.length);f.push({paraId:C.paraId,match:X,before:m.slice(Math.max(0,d-g),d),after:m.slice(d+e.length,d+e.length+g)});}return f},getSelection(){return null},addComment(e){let a=n().get(e.paraId);if(a===void 0)return null;try{let s=o.addComment({paragraphIndex:a,text:e.text,author:e.author,search:e.search});return i(),s}catch{return null}},replyTo(e,a){try{let s=o.replyTo(e,a);return i(),s}catch{return null}},resolveComment(e){let s=o.toDocument().package?.document?.comments?.find(u=>u.id===e);s&&(s.done=true,i());},proposeChange(e){let a=n().get(e.paraId);if(a===void 0)return false;let s=e.search==="",u=e.replaceWith==="";if(s&&u)return false;try{return s?o.proposeInsertion({paragraphIndex:a,insertText:e.replaceWith,author:e.author}):u?o.proposeDeletion({paragraphIndex:a,search:e.search,author:e.author}):o.replace({paragraphIndex:a,search:e.search,replaceWith:e.replaceWith,author:e.author}),i(),true}catch{return false}},scrollTo(e){return n().has(e)},applyFormatting(e){let a=n().get(e.paraId);if(a===void 0)return false;let s=o.toDocument().package?.document;if(!s)return false;try{let u=s?I(s,a):null;if(!u)return false;if(e.search){let l=oe(u,e.search);if(!l)return false;ne(u,l.from,l.to,e.marks);}else re(u,e.marks);return i(),true}catch{return false}},setParagraphStyle(e){let a=n().get(e.paraId);if(a===void 0)return false;let s=o.toDocument(),u=s.package?.document;if(!u||!ie(s.package?.styles,e.styleId))return false;try{let l=I(u,a);return l.formatting={...l.formatting??{},styleId:e.styleId},i(),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 ()=>{}}}}export{h as a,I as b,P as c,ce as d,le as e,y as f,A as g,L as h,Q as i,ge as j,be as k,Ce as l,Pe as m};
@@ -1 +1 @@
1
- 'use strict';var chunkMOAJJKKG_js=require('./chunk-MOAJJKKG.js'),chunk7C5RGTQY_js=require('./chunk-7C5RGTQY.js');function g(o,e){let{paragraphIndex:t,author:n="AI",text:s,search:a}=e,r=chunkMOAJJKKG_js.b(o,t),i=(o.comments??[]).map(m=>m.id),p=i.length>0?Math.max(...i)+1:1,c={id:p,author:n,date:new Date().toISOString(),content:[{type:"paragraph",content:[{type:"run",content:[{type:"text",text:s}]}],formatting:{}}]};if(o.comments||(o.comments=[]),o.comments.push(c),a){let m=chunkMOAJJKKG_js.i(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 y(o,e,t){let n=o.comments??[];if(!n.find(p=>p.id===e))throw new chunkMOAJJKKG_js.h(e);let a=n.map(p=>p.id),r=Math.max(...a)+1,i={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 n.push(i),r}function E(o,e){let t=o.comments??[],n=t.find(r=>r.id===e);if(!n)throw new chunkMOAJJKKG_js.h(e);let s=n.parentId!==void 0,a=new Set([e]);if(!s)for(let r of t)r.parentId===e&&a.add(r.id);o.comments=t.filter(r=>!a.has(r.id)),!s&&chunkMOAJJKKG_js.c(o,r=>{for(let i=r.content.length-1;i>=0;i--){let p=r.content[i];(p.type==="commentRangeStart"||p.type==="commentRangeEnd")&&p.id===e&&r.content.splice(i,1);}});}function C(o,e){if(!W(o,e,"accept"))throw new chunkMOAJJKKG_js.g(e)}function I(o,e){if(!W(o,e,"reject"))throw new chunkMOAJJKKG_js.g(e)}function k(o){return M(o,"accept")}function F(o){return M(o,"reject")}function M(o,e){let t=0;return chunkMOAJJKKG_js.c(o,n=>{for(let s=n.content.length-1;s>=0;s--){let a=n.content[s];chunkMOAJJKKG_js.a(a)&&(G(n,s,a,e),t++);}}),t}function W(o,e,t){let n=false;return chunkMOAJJKKG_js.c(o,s=>{for(let a=s.content.length-1;a>=0;a--){let r=s.content[a];chunkMOAJJKKG_js.a(r)&&r.info.id===e&&(G(s,a,r,t),n=true);}if(n)return false}),n}function G(o,e,t,n){if(t.type==="insertion"&&n==="accept"||t.type==="deletion"&&n==="reject"||t.type==="moveTo"&&n==="accept"||t.type==="moveFrom"&&n==="reject"){let a=t.content;o.content.splice(e,1,...a);}else o.content.splice(e,1);}function x(o,e){let{paragraphIndex:t,search:n,author:s="AI",replaceWith:a}=e,r=chunkMOAJJKKG_js.b(o,t),{startIndex:i,endIndex:p}=chunkMOAJJKKG_js.j(r,n,t),c=new Date().toISOString(),m=w(o),h=r.content.slice(i,p+1),R={type:"deletion",info:{id:m,author:s,date:c},content:h},v={type:"insertion",info:{id:m+1,author:s,date:c},content:[{type:"run",content:[{type:"text",text:a}]}]};r.content.splice(i,p-i+1,R,v);}function H(o,e){let{paragraphIndex:t,author:n="AI",insertText:s,position:a="after",search:r}=e,i=chunkMOAJJKKG_js.b(o,t),p=new Date().toISOString(),m={type:"insertion",info:{id:w(o),author:n,date:p},content:[{type:"run",content:[{type:"text",text:s}]}]};if(r){let{startIndex:h,endIndex:R}=chunkMOAJJKKG_js.j(i,r,t),v=a==="after"?R+1:h;i.content.splice(v,0,m);}else a==="before"?i.content.unshift(m):i.content.push(m);}function L(o,e){let{paragraphIndex:t,search:n,author:s="AI"}=e,a=chunkMOAJJKKG_js.b(o,t),{startIndex:r,endIndex:i}=chunkMOAJJKKG_js.j(a,n,t),p=new Date().toISOString(),c=w(o),m=a.content.slice(r,i+1),h={type:"deletion",info:{id:c,author:s,date:p},content:m};a.content.splice(r,i-r+1,h);}var S=new WeakMap;function w(o){let e=S.get(o);e===void 0&&(e=0,chunkMOAJJKKG_js.c(o,n=>{for(let s of n.content)chunkMOAJJKKG_js.a(s)&&(e=Math.max(e,s.info.id));}));let t=e+1;return S.set(o,t+1),t}function N(o,e,t="AI"){let n=[],s=0,a=0,r=0,i=0,p=0;for(let c of e.accept??[])try{C(o,c),s++;}catch(m){n.push({operation:"accept",id:c,error:m.message});}for(let c of e.reject??[])try{I(o,c),a++;}catch(m){n.push({operation:"reject",id:c,error:m.message});}for(let c of e.comments??[])try{g(o,{...c,author:c.author??t}),r++;}catch(m){n.push({operation:"comment",search:c.search,error:m.message});}for(let c of e.replies??[])try{y(o,c.commentId,{author:c.author??t,text:c.text}),i++;}catch(m){n.push({operation:"reply",id:c.commentId,error:m.message});}for(let c of e.proposals??[])try{x(o,{...c,author:c.author??t}),p++;}catch(m){n.push({operation:"proposal",search:c.search,error:m.message});}return {accepted:s,rejected:a,commentsAdded:r,repliesAdded:i,proposalsAdded:p,errors:n}}var U=class o{constructor(e,t="AI",n){let s=n??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 n=await chunk7C5RGTQY_js.w(e,{preloadFonts:false});return new o(n,t,e)}get body(){return this.doc.package.document}resolveAuthor(e){return e??this.author}getContent(e){return chunkMOAJJKKG_js.d(this.body,e)}getContentAsText(e){return chunkMOAJJKKG_js.e(chunkMOAJJKKG_js.d(this.body,e))}getChanges(e){return chunkMOAJJKKG_js.k(this.body,e)}getComments(e){return chunkMOAJJKKG_js.l(this.body,e)}addComment(e,t){let n=typeof e=="number"?{paragraphIndex:e,text:t,author:this.author}:{...e,author:this.resolveAuthor(e.author)};return g(this.body,n)}replyTo(e,t){let n=typeof t=="string"?{text:t,author:this.author}:{...t,author:this.resolveAuthor(t.author)};return y(this.body,e,n)}removeComment(e){E(this.body,e);}replace(e,t,n){let s=typeof e=="number"?{paragraphIndex:e,search:t,replaceWith:n,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){C(this.body,e);}rejectChange(e){I(this.body,e);}acceptAll(){return k(this.body)}rejectAll(){return F(this.body)}applyReview(e){return N(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-3IX5WQEZ.js');return e(this.doc)}};exports.a=U;
1
+ 'use strict';var chunkMHUG23P6_js=require('./chunk-MHUG23P6.js'),chunkB3LQVYMR_js=require('./chunk-B3LQVYMR.js');function g(o,e){let{paragraphIndex:t,author:n="AI",text:s,search:a}=e,r=chunkMHUG23P6_js.b(o,t),i=(o.comments??[]).map(m=>m.id),p=i.length>0?Math.max(...i)+1:1,c={id:p,author:n,date:new Date().toISOString(),content:[{type:"paragraph",content:[{type:"run",content:[{type:"text",text:s}]}],formatting:{}}]};if(o.comments||(o.comments=[]),o.comments.push(c),a){let m=chunkMHUG23P6_js.i(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 y(o,e,t){let n=o.comments??[];if(!n.find(p=>p.id===e))throw new chunkMHUG23P6_js.h(e);let a=n.map(p=>p.id),r=Math.max(...a)+1,i={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 n.push(i),r}function E(o,e){let t=o.comments??[],n=t.find(r=>r.id===e);if(!n)throw new chunkMHUG23P6_js.h(e);let s=n.parentId!==void 0,a=new Set([e]);if(!s)for(let r of t)r.parentId===e&&a.add(r.id);o.comments=t.filter(r=>!a.has(r.id)),!s&&chunkMHUG23P6_js.c(o,r=>{for(let i=r.content.length-1;i>=0;i--){let p=r.content[i];(p.type==="commentRangeStart"||p.type==="commentRangeEnd")&&p.id===e&&r.content.splice(i,1);}});}function C(o,e){if(!W(o,e,"accept"))throw new chunkMHUG23P6_js.g(e)}function I(o,e){if(!W(o,e,"reject"))throw new chunkMHUG23P6_js.g(e)}function k(o){return M(o,"accept")}function F(o){return M(o,"reject")}function M(o,e){let t=0;return chunkMHUG23P6_js.c(o,n=>{for(let s=n.content.length-1;s>=0;s--){let a=n.content[s];chunkMHUG23P6_js.a(a)&&(G(n,s,a,e),t++);}}),t}function W(o,e,t){let n=false;return chunkMHUG23P6_js.c(o,s=>{for(let a=s.content.length-1;a>=0;a--){let r=s.content[a];chunkMHUG23P6_js.a(r)&&r.info.id===e&&(G(s,a,r,t),n=true);}if(n)return false}),n}function G(o,e,t,n){if(t.type==="insertion"&&n==="accept"||t.type==="deletion"&&n==="reject"||t.type==="moveTo"&&n==="accept"||t.type==="moveFrom"&&n==="reject"){let a=t.content;o.content.splice(e,1,...a);}else o.content.splice(e,1);}function x(o,e){let{paragraphIndex:t,search:n,author:s="AI",replaceWith:a}=e,r=chunkMHUG23P6_js.b(o,t),{startIndex:i,endIndex:p}=chunkMHUG23P6_js.j(r,n,t),c=new Date().toISOString(),m=w(o),h=r.content.slice(i,p+1),R={type:"deletion",info:{id:m,author:s,date:c},content:h},v={type:"insertion",info:{id:m+1,author:s,date:c},content:[{type:"run",content:[{type:"text",text:a}]}]};r.content.splice(i,p-i+1,R,v);}function H(o,e){let{paragraphIndex:t,author:n="AI",insertText:s,position:a="after",search:r}=e,i=chunkMHUG23P6_js.b(o,t),p=new Date().toISOString(),m={type:"insertion",info:{id:w(o),author:n,date:p},content:[{type:"run",content:[{type:"text",text:s}]}]};if(r){let{startIndex:h,endIndex:R}=chunkMHUG23P6_js.j(i,r,t),v=a==="after"?R+1:h;i.content.splice(v,0,m);}else a==="before"?i.content.unshift(m):i.content.push(m);}function L(o,e){let{paragraphIndex:t,search:n,author:s="AI"}=e,a=chunkMHUG23P6_js.b(o,t),{startIndex:r,endIndex:i}=chunkMHUG23P6_js.j(a,n,t),p=new Date().toISOString(),c=w(o),m=a.content.slice(r,i+1),h={type:"deletion",info:{id:c,author:s,date:p},content:m};a.content.splice(r,i-r+1,h);}var S=new WeakMap;function w(o){let e=S.get(o);e===void 0&&(e=0,chunkMHUG23P6_js.c(o,n=>{for(let s of n.content)chunkMHUG23P6_js.a(s)&&(e=Math.max(e,s.info.id));}));let t=e+1;return S.set(o,t+1),t}function N(o,e,t="AI"){let n=[],s=0,a=0,r=0,i=0,p=0;for(let c of e.accept??[])try{C(o,c),s++;}catch(m){n.push({operation:"accept",id:c,error:m.message});}for(let c of e.reject??[])try{I(o,c),a++;}catch(m){n.push({operation:"reject",id:c,error:m.message});}for(let c of e.comments??[])try{g(o,{...c,author:c.author??t}),r++;}catch(m){n.push({operation:"comment",search:c.search,error:m.message});}for(let c of e.replies??[])try{y(o,c.commentId,{author:c.author??t,text:c.text}),i++;}catch(m){n.push({operation:"reply",id:c.commentId,error:m.message});}for(let c of e.proposals??[])try{x(o,{...c,author:c.author??t}),p++;}catch(m){n.push({operation:"proposal",search:c.search,error:m.message});}return {accepted:s,rejected:a,commentsAdded:r,repliesAdded:i,proposalsAdded:p,errors:n}}var U=class o{constructor(e,t="AI",n){let s=n??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 n=await chunkB3LQVYMR_js.w(e,{preloadFonts:false});return new o(n,t,e)}get body(){return this.doc.package.document}resolveAuthor(e){return e??this.author}getContent(e){return chunkMHUG23P6_js.d(this.body,e)}getContentAsText(e){return chunkMHUG23P6_js.e(chunkMHUG23P6_js.d(this.body,e))}getChanges(e){return chunkMHUG23P6_js.k(this.body,e)}getComments(e){return chunkMHUG23P6_js.l(this.body,e)}addComment(e,t){let n=typeof e=="number"?{paragraphIndex:e,text:t,author:this.author}:{...e,author:this.resolveAuthor(e.author)};return g(this.body,n)}replyTo(e,t){let n=typeof t=="string"?{text:t,author:this.author}:{...t,author:this.resolveAuthor(t.author)};return y(this.body,e,n)}removeComment(e){E(this.body,e);}replace(e,t,n){let s=typeof e=="number"?{paragraphIndex:e,search:t,replaceWith:n,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){C(this.body,e);}rejectChange(e){I(this.body,e);}acceptAll(){return k(this.body)}rejectAll(){return F(this.body)}applyReview(e){return N(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-VGNLVFAJ.js');return e(this.doc)}};exports.a=U;
@@ -0,0 +1 @@
1
+ var D=class{constructor(){this.plugins=new Map;this.commandHandlers=new Map;this.eventListeners=new Set;this.initialized=new Set;}register(e,o){let n=[];if(!e.id)return {success:false,error:"Plugin must have an id"};if(this.plugins.has(e.id))return {success:false,error:`Plugin '${e.id}' is already registered`};if(e.dependencies){for(let t of e.dependencies)if(!this.plugins.has(t))return {success:false,error:`Plugin '${e.id}' requires '${t}' which is not registered`}}if(e.commandHandlers)for(let[t,s]of Object.entries(e.commandHandlers)){if(this.commandHandlers.has(t)){let i=this.commandHandlers.get(t);n.push(`Command '${t}' from '${e.id}' overrides handler from '${i.pluginId}'`);}this.commandHandlers.set(t,{pluginId:e.id,handler:s});}if(this.plugins.set(e.id,e),e.initialize&&!this.initialized.has(e.id))try{let t=e.initialize();t instanceof Promise?t.then(()=>{this.initialized.add(e.id);}).catch(s=>{this.emit({type:"error",pluginId:e.id,error:s});}):this.initialized.add(e.id);}catch(t){this.emit({type:"error",pluginId:e.id,error:t});}return o?.debug&&console.log(`[PluginRegistry] Registered plugin: ${e.id}`),this.emit({type:"registered",plugin:e}),{success:true,plugin:e,warnings:n.length>0?n:void 0}}unregister(e){let o=this.plugins.get(e);if(!o)return false;for(let[n,t]of this.plugins)if(t.dependencies?.includes(e))return console.warn(`Cannot unregister '${e}': '${n}' depends on it`),false;for(let[n,{pluginId:t}]of this.commandHandlers)t===e&&this.commandHandlers.delete(n);if(o.destroy)try{let n=o.destroy();n instanceof Promise&&n.catch(t=>{this.emit({type:"error",pluginId:e,error:t});});}catch(n){this.emit({type:"error",pluginId:e,error:n});}return this.plugins.delete(e),this.initialized.delete(e),this.emit({type:"unregistered",pluginId:e}),true}get(e){return this.plugins.get(e)}getAll(){return Array.from(this.plugins.values())}has(e){return this.plugins.has(e)}get size(){return this.plugins.size}getCommandHandler(e){return this.commandHandlers.get(e)?.handler}getCommandTypes(){return Array.from(this.commandHandlers.keys())}hasCommandHandler(e){return this.commandHandlers.has(e)}getMcpTools(){let e=[];for(let o of this.plugins.values())o.mcpTools&&e.push(...o.mcpTools);return e}getMcpToolsForPlugin(e){return this.plugins.get(e)?.mcpTools||[]}getMcpTool(e){for(let o of this.plugins.values())if(o.mcpTools){let n=o.mcpTools.find(t=>t.name===e);if(n)return n}}addEventListener(e){this.eventListeners.add(e);}removeEventListener(e){this.eventListeners.delete(e);}emit(e){for(let o of this.eventListeners)try{o(e);}catch(n){console.error("[PluginRegistry] Event listener error:",n);}}clear(){for(let e of this.plugins.values())if(e.destroy)try{e.destroy();}catch{}this.plugins.clear(),this.commandHandlers.clear(),this.initialized.clear();}getDebugInfo(){return {plugins:Array.from(this.plugins.keys()),commandTypes:Array.from(this.commandHandlers.keys()),mcpTools:this.getMcpTools().map(e=>e.name),initialized:Array.from(this.initialized)}}},C=new D;function U(r,e){return r.map(o=>C.register(o,e))}function W(r){return e=>C.register(e,r)}function h(r){return JSON.parse(JSON.stringify(r))}function g(r,e){let o=0;for(let n=0;n<r.content.length;n++)if(r.content[n].type==="paragraph"){if(o===e)return n;o++;}return -1}function y(r){let e="";for(let o of r.content)if(o.type==="run")for(let n of o.content)n.type==="text"&&(e+=n.text);else if(o.type==="hyperlink"){for(let n of o.children)if(n.type==="run")for(let t of n.content)t.type==="text"&&(e+=t.text);}return e}function T(r,e){return {type:"run",formatting:e,content:[{type:"text",text:r}]}}function I(r,e,o,n){let t=[],s=0,i=false;for(let a of r.content)if(a.type==="run"){let p=a.content.filter(l=>l.type==="text").map(l=>l.text).join(""),c=s,u=s+p.length;if(!i&&e>=c&&e<=u){let l=e-c;l>0&&t.push({...a,content:[{type:"text",text:p.slice(0,l)}]}),t.push(T(o,n||a.formatting)),l<p.length&&t.push({...a,content:[{type:"text",text:p.slice(l)}]}),i=true;}else t.push(a);s=u;}else t.push(a);return i||t.push(T(o,n)),t}function d(r,e,o){let n=[],t=0;for(let s of r.content)if(s.type==="run"){let i=s.content.filter(c=>c.type==="text").map(c=>c.text).join(""),a=t,p=t+i.length;if(p<=e||a>=o)n.push(s);else {let c="";a<e&&(c+=i.slice(0,e-a)),p>o&&(c+=i.slice(o-a)),c.length>0&&n.push({...s,content:[{type:"text",text:c}]});}t=p;}else n.push(s);return n}function w(r,e,o,n){let t=[],s=0;for(let i of r.content)if(i.type==="run"){let a=i.content.filter(u=>u.type==="text").map(u=>u.text).join(""),p=s,c=s+a.length;if(c<=e||p>=o)t.push(i);else if(p>=e&&c<=o)t.push({...i,formatting:{...i.formatting,...n}});else {let u=Math.max(e,p),l=Math.min(o,c);p<u&&t.push({...i,content:[{type:"text",text:a.slice(0,u-p)}]}),t.push({...i,formatting:{...i.formatting,...n},content:[{type:"text",text:a.slice(u-p,l-p)}]}),c>l&&t.push({...i,content:[{type:"text",text:a.slice(l-p)}]});}s=c;}else t.push(i);return t}function R(r,e){let o=h(r),n=o.package.document,t=g(n,e.position.paragraphIndex);if(t===-1)throw new Error(`Paragraph index ${e.position.paragraphIndex} not found`);let s=n.content[t];return s.content=I(s,e.position.offset,e.text,e.formatting),o}function _(r,e){let o=h(r),n=o.package.document,{start:t,end:s}=e.range;if(t.paragraphIndex===s.paragraphIndex){let i=g(n,t.paragraphIndex);if(i===-1)throw new Error(`Paragraph index ${t.paragraphIndex} not found`);let a=n.content[i];a.content=d(a,t.offset,s.offset),a.content=I(a,t.offset,e.text,e.formatting);}else {let i=g(n,t.paragraphIndex),a=n.content[i],p=y(a);a.content=d(a,t.offset,p.length),a.content=I(a,t.offset,e.text,e.formatting);let c=[];for(let u=t.paragraphIndex+1;u<=s.paragraphIndex;u++)c.push(g(n,u));for(let u=c.length-1;u>=0;u--)c[u]!==-1&&n.content.splice(c[u],1);}return o}function v(r,e){let o=h(r),n=o.package.document,{start:t,end:s}=e.range;if(t.paragraphIndex===s.paragraphIndex){let i=g(n,t.paragraphIndex);if(i===-1)throw new Error(`Paragraph index ${t.paragraphIndex} not found`);let a=n.content[i];a.content=d(a,t.offset,s.offset);}else {let i=g(n,t.paragraphIndex),a=n.content[i],p=y(a);a.content=d(a,t.offset,p.length);let c=g(n,s.paragraphIndex),u=n.content[c];u.content=d(u,0,s.offset),a.content.push(...u.content);let l=[];for(let f=t.paragraphIndex+1;f<=s.paragraphIndex;f++)l.push(g(n,f));for(let f=l.length-1;f>=0;f--)l[f]!==-1&&n.content.splice(l[f],1);}return o}function S(r,e){let o=h(r),n=o.package.document,{start:t,end:s}=e.range;if(t.paragraphIndex===s.paragraphIndex){let i=g(n,t.paragraphIndex);if(i===-1)throw new Error(`Paragraph index ${t.paragraphIndex} not found`);let a=n.content[i];a.content=w(a,t.offset,s.offset,e.formatting);}else for(let i=t.paragraphIndex;i<=s.paragraphIndex;i++){let a=g(n,i);if(a===-1)continue;let p=n.content[a],c=y(p),u=0,l=c.length;i===t.paragraphIndex&&(u=t.offset),i===s.paragraphIndex&&(l=s.offset),p.content=w(p,u,l,e.formatting);}return o}function N(r,e){let o=h(r),n=o.package.document,t=g(n,e.paragraphIndex);if(t===-1)throw new Error(`Paragraph index ${e.paragraphIndex} not found`);let s=n.content[t];if(s.formatting={...s.formatting,...e.formatting},"numPr"in e.formatting){let i=e.formatting.numPr;if(i&&i.numId!==void 0&&i.numId!==0){let a=i.ilvl??0,p=i.numId===1,c=p?"\u2022":"1.";if(o.package.numbering){let u=o.package.numbering.nums.find(l=>l.numId===i.numId);if(u){let l=o.package.numbering.abstractNums.find(f=>f.abstractNumId===u.abstractNumId);if(l){let f=l.levels.find(m=>m.ilvl===a);f&&(c=f.lvlText||c);}}}s.listRendering={level:a,numId:i.numId,marker:c,isBullet:p};}else delete s.listRendering;}return o}function A(r,e){let o=h(r),n=o.package.document,t=g(n,e.paragraphIndex);if(t===-1)throw new Error(`Paragraph index ${e.paragraphIndex} not found`);let s=n.content[t];return s.formatting={...s.formatting,styleId:e.styleId},o}function Q(r){return r/1440*96}function Y(r){return r/96*1440}function Z(r){return r==null||isNaN(r)?0:Math.round(r*96/914400)}function E(r){return Math.round(r/96*914400)}function ee(r){return Math.round(r/914400*1440)}function te(r){return Math.round(r/1440*914400)}function ne(r){return r/72*96}function re(r){return r/144*96}function oe(r){return r*2}function X(r,e=2){let o=Math.pow(10,e);return Math.round(r*o)/o}function ae(r){return `${X(r)}px`}function M(r,e){let o=h(r),n=o.package.document,t=[];for(let a=0;a<e.rows;a++){let p=[];for(let c=0;c<e.columns;c++){let u=e.data?.[a]?.[c]||"";p.push({type:"tableCell",content:[{type:"paragraph",content:u?[T(u)]:[]}]});}t.push({type:"tableRow",formatting:a===0&&e.hasHeader?{header:true}:void 0,cells:p});}let s={type:"table",rows:t},i=g(n,e.position.paragraphIndex);return i===-1?n.content.push(s):n.content.splice(i+1,0,s),o}function $(r,e){let o=h(r),n=o.package.document,t=g(n,e.position.paragraphIndex);if(t===-1)throw new Error(`Paragraph index ${e.position.paragraphIndex} not found`);let s=n.content[t],a={type:"run",content:[{type:"drawing",image:{type:"image",rId:`rId_img_${Date.now()}`,src:e.src,alt:e.alt,size:{width:E(e.width||100),height:E(e.height||100)},wrap:{type:"inline"}}}]},p=I(s,e.position.offset,"",void 0),c=false,u=0;for(let l=0;l<p.length;l++){let f=p[l];if(f.type==="run"){let m=f.content.filter(x=>x.type==="text").map(x=>x.text).join("");if(u+=m.length,!c&&u>=e.position.offset){p.splice(l+1,0,a),c=true;break}}}return c||p.push(a),s.content=p,o}function B(r,e){let o=h(r),n=o.package.document,{start:t,end:s}=e.range;if(t.paragraphIndex!==s.paragraphIndex)throw new Error("Hyperlinks cannot span multiple paragraphs");let i=g(n,t.paragraphIndex);if(i===-1)throw new Error(`Paragraph index ${t.paragraphIndex} not found`);let a=n.content[i],p=y(a),c=e.displayText||p.slice(t.offset,s.offset);a.content=d(a,t.offset,s.offset);let u={type:"hyperlink",href:e.url,tooltip:e.tooltip,children:[T(c)]},l=false,f=0,m=[];for(let x of a.content)if(x.type==="run"){let b=x.content.filter(P=>P.type==="text").map(P=>P.text).join(""),H=f+b.length;if(!l&&f<=t.offset&&t.offset<=H){let P=t.offset-f;P>0&&m.push({...x,content:[{type:"text",text:b.slice(0,P)}]}),m.push(u),P<b.length&&m.push({...x,content:[{type:"text",text:b.slice(P)}]}),l=true;}else m.push(x);f=H;}else m.push(x);return l||m.push(u),a.content=m,o}function F(r,e){let o=h(r),n=o.package.document,{start:t}=e.range,s=g(n,t.paragraphIndex);if(s===-1)throw new Error(`Paragraph index ${t.paragraphIndex} not found`);let i=n.content[s],a=[];for(let p of i.content)if(p.type==="hyperlink")for(let c of p.children)c.type==="run"&&a.push(c);else a.push(p);return i.content=a,o}function k(r,e){let o=h(r),n=o.package.document,t=g(n,e.position.paragraphIndex);if(t===-1)throw new Error(`Paragraph index ${e.position.paragraphIndex} not found`);let s=n.content[t],i=y(s),a=d({content:[...s.content]},e.position.offset,i.length),p=d({content:[...s.content]},0,e.position.offset);s.content=a;let c={type:"paragraph",formatting:s.formatting,content:p};return n.content.splice(t+1,0,c),o}function L(r,e){let o=h(r),n=o.package.document,t=g(n,e.paragraphIndex);if(t===-1)throw new Error(`Paragraph index ${e.paragraphIndex} not found`);let s=n.content[t],i=[];for(let a=1;a<=e.count;a++){let p=g(n,e.paragraphIndex+a);if(p!==-1){let c=n.content[p];s.content.push(...c.content),i.push(p);}}for(let a=i.length-1;a>=0;a--)n.content.splice(i[a],1);return o}function V(r,e){return k(r,{position:e.position})}function z(r,e){let o=h(r);return o.templateVariables||(o.templateVariables=[]),o.templateVariables.includes(e.name)||o.templateVariables.push(e.name),o}function O(r,e){let o=h(r),n=o.package.document;function t(a){for(let p of a.content)if(p.type==="text")for(let[c,u]of Object.entries(e.values)){let l=new RegExp(`\\{${c}\\}`,"g");p.text=p.text.replace(l,u);}}function s(a){for(let p of a.content)if(p.type==="run")t(p);else if(p.type==="hyperlink")for(let c of p.children)c.type==="run"&&t(c);}function i(a){if(a.type==="paragraph")s(a);else if(a.type==="table")for(let p of a.rows)for(let c of p.cells)for(let u of c.content)i(u);}for(let a of n.content)i(a);return o}function j(r,e){let o=C.getCommandHandler(e.type);if(o)return o(r,e);switch(e.type){case "insertText":return R(r,e);case "replaceText":return _(r,e);case "deleteText":return v(r,e);case "formatText":return S(r,e);case "formatParagraph":return N(r,e);case "applyStyle":return A(r,e);case "insertTable":return M(r,e);case "insertImage":return $(r,e);case "insertHyperlink":return B(r,e);case "removeHyperlink":return F(r,e);case "insertParagraphBreak":return k(r,e);case "mergeParagraphs":return L(r,e);case "splitParagraph":return V(r,e);case "setVariable":return z(r,e);case "applyVariables":return O(r,e);default:{let n=e;throw new Error(`Unknown command type: ${n.type}`)}}}function ye(r,e){return e.reduce((o,n)=>j(o,n),r)}export{D as a,C as b,U as c,W as d,Q as e,Y as f,Z as g,E as h,ee as i,te as j,ne as k,re as l,oe as m,ae as n,j as o,ye as p};
@@ -0,0 +1 @@
1
+ export{o as executeCommand,p as executeCommands}from'./chunk-XDZHYYU6.mjs';
@@ -0,0 +1 @@
1
+ 'use strict';var chunkEPRXZTIE_js=require('./chunk-EPRXZTIE.js');Object.defineProperty(exports,"executeCommand",{enumerable:true,get:function(){return chunkEPRXZTIE_js.o}});Object.defineProperty(exports,"executeCommands",{enumerable:true,get:function(){return chunkEPRXZTIE_js.p}});
@@ -0,0 +1 @@
1
+ export{ga as ContentControlBoundError,ea as ContentControlLockedError,da as ContentControlNotFoundError,fa as ContentControlTypeError,ja as ContentControlValueError,Oa as DEFAULT_AI_ACTIONS,x as DocumentAgent,oa as RepeatingSectionError,Qa as VERSION,pa as addRepeatingSectionItem,i as attemptSelectiveSave,Fa as blendColors,E as buildExtendedSelectionContext,h as buildPatchedDocumentXml,D as buildSelectionContext,B as buildSelectionContextFromContext,Ga as colorsEqual,La as comparePositions,M as countCharacters,L as countWords,y as createAgent,z as createAgentFromDocument,Ia as createCollapsedRange,Pa as createCommand,sa as createDocumentWithText,f as createDocx,ra as createEmptyDocument,Ja as createRange,Ca as createRgbColor,Ba as createThemeColor,Da 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,Na as getActionDescription,Ma as getActionLabel,A as getAgentContext,$ as getBlockIndexForParagraph,O as getBodyCharacterCount,K as getBodyText,N as getBodyWordCount,aa as getContentControlText,za as getContrastingColor,C as getDocumentSummary,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,xa as isBlack,U as isHeadingStyle,S as isPositionInHyperlink,Ka as isPositionInRange,ma as isRepeatingSection,na as isRepeatingSectionItem,p as isValidVariableName,ya as isWhite,Ha as isZodSchema,Ea as lightenColor,ta as mapHexToHighlightName,Aa 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,ua as resolveColor,va as resolveHighlightColor,wa as resolveShadingColor,q as sanitizeVariableName,b as serializeDocumentBody,c as serializeDocx,a as serializeSectionProperties,ha as setContentControlContent,la as setContentControlValue,e as updateMultipleFiles,g as validatePatchSafety}from'./chunk-L7LXQOTH.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 chunkB3LQVYMR_js=require('./chunk-B3LQVYMR.js'),chunk4QRVKNI4_js=require('./chunk-4QRVKNI4.js'),chunkEPRXZTIE_js=require('./chunk-EPRXZTIE.js');Object.defineProperty(exports,"ContentControlBoundError",{enumerable:true,get:function(){return chunkB3LQVYMR_js.ga}});Object.defineProperty(exports,"ContentControlLockedError",{enumerable:true,get:function(){return chunkB3LQVYMR_js.ea}});Object.defineProperty(exports,"ContentControlNotFoundError",{enumerable:true,get:function(){return chunkB3LQVYMR_js.da}});Object.defineProperty(exports,"ContentControlTypeError",{enumerable:true,get:function(){return chunkB3LQVYMR_js.fa}});Object.defineProperty(exports,"ContentControlValueError",{enumerable:true,get:function(){return chunkB3LQVYMR_js.ja}});Object.defineProperty(exports,"DEFAULT_AI_ACTIONS",{enumerable:true,get:function(){return chunkB3LQVYMR_js.Oa}});Object.defineProperty(exports,"DocumentAgent",{enumerable:true,get:function(){return chunkB3LQVYMR_js.x}});Object.defineProperty(exports,"RepeatingSectionError",{enumerable:true,get:function(){return chunkB3LQVYMR_js.oa}});Object.defineProperty(exports,"VERSION",{enumerable:true,get:function(){return chunkB3LQVYMR_js.Qa}});Object.defineProperty(exports,"addRepeatingSectionItem",{enumerable:true,get:function(){return chunkB3LQVYMR_js.pa}});Object.defineProperty(exports,"attemptSelectiveSave",{enumerable:true,get:function(){return chunkB3LQVYMR_js.i}});Object.defineProperty(exports,"blendColors",{enumerable:true,get:function(){return chunkB3LQVYMR_js.Fa}});Object.defineProperty(exports,"buildExtendedSelectionContext",{enumerable:true,get:function(){return chunkB3LQVYMR_js.E}});Object.defineProperty(exports,"buildPatchedDocumentXml",{enumerable:true,get:function(){return chunkB3LQVYMR_js.h}});Object.defineProperty(exports,"buildSelectionContext",{enumerable:true,get:function(){return chunkB3LQVYMR_js.D}});Object.defineProperty(exports,"buildSelectionContextFromContext",{enumerable:true,get:function(){return chunkB3LQVYMR_js.B}});Object.defineProperty(exports,"colorsEqual",{enumerable:true,get:function(){return chunkB3LQVYMR_js.Ga}});Object.defineProperty(exports,"comparePositions",{enumerable:true,get:function(){return chunkB3LQVYMR_js.La}});Object.defineProperty(exports,"countCharacters",{enumerable:true,get:function(){return chunkB3LQVYMR_js.M}});Object.defineProperty(exports,"countWords",{enumerable:true,get:function(){return chunkB3LQVYMR_js.L}});Object.defineProperty(exports,"createAgent",{enumerable:true,get:function(){return chunkB3LQVYMR_js.y}});Object.defineProperty(exports,"createAgentFromDocument",{enumerable:true,get:function(){return chunkB3LQVYMR_js.z}});Object.defineProperty(exports,"createCollapsedRange",{enumerable:true,get:function(){return chunkB3LQVYMR_js.Ia}});Object.defineProperty(exports,"createCommand",{enumerable:true,get:function(){return chunkB3LQVYMR_js.Pa}});Object.defineProperty(exports,"createDocumentWithText",{enumerable:true,get:function(){return chunkB3LQVYMR_js.sa}});Object.defineProperty(exports,"createDocx",{enumerable:true,get:function(){return chunkB3LQVYMR_js.f}});Object.defineProperty(exports,"createEmptyDocument",{enumerable:true,get:function(){return chunkB3LQVYMR_js.ra}});Object.defineProperty(exports,"createRange",{enumerable:true,get:function(){return chunkB3LQVYMR_js.Ja}});Object.defineProperty(exports,"createRgbColor",{enumerable:true,get:function(){return chunkB3LQVYMR_js.Ca}});Object.defineProperty(exports,"createThemeColor",{enumerable:true,get:function(){return chunkB3LQVYMR_js.Ba}});Object.defineProperty(exports,"darkenColor",{enumerable:true,get:function(){return chunkB3LQVYMR_js.Da}});Object.defineProperty(exports,"detectVariables",{enumerable:true,get:function(){return chunkB3LQVYMR_js.j}});Object.defineProperty(exports,"detectVariablesDetailed",{enumerable:true,get:function(){return chunkB3LQVYMR_js.k}});Object.defineProperty(exports,"detectVariablesInBody",{enumerable:true,get:function(){return chunkB3LQVYMR_js.l}});Object.defineProperty(exports,"detectVariablesInParagraph",{enumerable:true,get:function(){return chunkB3LQVYMR_js.m}});Object.defineProperty(exports,"documentHasVariables",{enumerable:true,get:function(){return chunkB3LQVYMR_js.v}});Object.defineProperty(exports,"extractVariablesFromText",{enumerable:true,get:function(){return chunkB3LQVYMR_js.n}});Object.defineProperty(exports,"findContentControl",{enumerable:true,get:function(){return chunkB3LQVYMR_js.ca}});Object.defineProperty(exports,"findContentControls",{enumerable:true,get:function(){return chunkB3LQVYMR_js.ba}});Object.defineProperty(exports,"formatSdtDate",{enumerable:true,get:function(){return chunkB3LQVYMR_js.ka}});Object.defineProperty(exports,"formatVariable",{enumerable:true,get:function(){return chunkB3LQVYMR_js.r}});Object.defineProperty(exports,"getActionDescription",{enumerable:true,get:function(){return chunkB3LQVYMR_js.Na}});Object.defineProperty(exports,"getActionLabel",{enumerable:true,get:function(){return chunkB3LQVYMR_js.Ma}});Object.defineProperty(exports,"getAgentContext",{enumerable:true,get:function(){return chunkB3LQVYMR_js.A}});Object.defineProperty(exports,"getBlockIndexForParagraph",{enumerable:true,get:function(){return chunkB3LQVYMR_js.$}});Object.defineProperty(exports,"getBodyCharacterCount",{enumerable:true,get:function(){return chunkB3LQVYMR_js.O}});Object.defineProperty(exports,"getBodyText",{enumerable:true,get:function(){return chunkB3LQVYMR_js.K}});Object.defineProperty(exports,"getBodyWordCount",{enumerable:true,get:function(){return chunkB3LQVYMR_js.N}});Object.defineProperty(exports,"getContentControlText",{enumerable:true,get:function(){return chunkB3LQVYMR_js.aa}});Object.defineProperty(exports,"getContrastingColor",{enumerable:true,get:function(){return chunkB3LQVYMR_js.za}});Object.defineProperty(exports,"getDocumentSummary",{enumerable:true,get:function(){return chunkB3LQVYMR_js.C}});Object.defineProperty(exports,"getFormattingAtPosition",{enumerable:true,get:function(){return chunkB3LQVYMR_js.R}});Object.defineProperty(exports,"getHyperlinkAtPosition",{enumerable:true,get:function(){return chunkB3LQVYMR_js.T}});Object.defineProperty(exports,"getHyperlinkText",{enumerable:true,get:function(){return chunkB3LQVYMR_js.I}});Object.defineProperty(exports,"getParagraphAtIndex",{enumerable:true,get:function(){return chunkB3LQVYMR_js._}});Object.defineProperty(exports,"getParagraphText",{enumerable:true,get:function(){return chunkB3LQVYMR_js.G}});Object.defineProperty(exports,"getParagraphs",{enumerable:true,get:function(){return chunkB3LQVYMR_js.Z}});Object.defineProperty(exports,"getRunText",{enumerable:true,get:function(){return chunkB3LQVYMR_js.H}});Object.defineProperty(exports,"getSelectionFormattingSummary",{enumerable:true,get:function(){return chunkB3LQVYMR_js.F}});Object.defineProperty(exports,"getTableText",{enumerable:true,get:function(){return chunkB3LQVYMR_js.J}});Object.defineProperty(exports,"getTextAfter",{enumerable:true,get:function(){return chunkB3LQVYMR_js.Q}});Object.defineProperty(exports,"getTextBefore",{enumerable:true,get:function(){return chunkB3LQVYMR_js.P}});Object.defineProperty(exports,"hasHyperlinks",{enumerable:true,get:function(){return chunkB3LQVYMR_js.X}});Object.defineProperty(exports,"hasImages",{enumerable:true,get:function(){return chunkB3LQVYMR_js.W}});Object.defineProperty(exports,"hasTables",{enumerable:true,get:function(){return chunkB3LQVYMR_js.Y}});Object.defineProperty(exports,"hasTemplateVariables",{enumerable:true,get:function(){return chunkB3LQVYMR_js.o}});Object.defineProperty(exports,"isBlack",{enumerable:true,get:function(){return chunkB3LQVYMR_js.xa}});Object.defineProperty(exports,"isHeadingStyle",{enumerable:true,get:function(){return chunkB3LQVYMR_js.U}});Object.defineProperty(exports,"isPositionInHyperlink",{enumerable:true,get:function(){return chunkB3LQVYMR_js.S}});Object.defineProperty(exports,"isPositionInRange",{enumerable:true,get:function(){return chunkB3LQVYMR_js.Ka}});Object.defineProperty(exports,"isRepeatingSection",{enumerable:true,get:function(){return chunkB3LQVYMR_js.ma}});Object.defineProperty(exports,"isRepeatingSectionItem",{enumerable:true,get:function(){return chunkB3LQVYMR_js.na}});Object.defineProperty(exports,"isValidVariableName",{enumerable:true,get:function(){return chunkB3LQVYMR_js.p}});Object.defineProperty(exports,"isWhite",{enumerable:true,get:function(){return chunkB3LQVYMR_js.ya}});Object.defineProperty(exports,"isZodSchema",{enumerable:true,get:function(){return chunkB3LQVYMR_js.Ha}});Object.defineProperty(exports,"lightenColor",{enumerable:true,get:function(){return chunkB3LQVYMR_js.Ea}});Object.defineProperty(exports,"mapHexToHighlightName",{enumerable:true,get:function(){return chunkB3LQVYMR_js.ta}});Object.defineProperty(exports,"parseColorString",{enumerable:true,get:function(){return chunkB3LQVYMR_js.Aa}});Object.defineProperty(exports,"parseDocx",{enumerable:true,get:function(){return chunkB3LQVYMR_js.w}});Object.defineProperty(exports,"parseHeadingLevel",{enumerable:true,get:function(){return chunkB3LQVYMR_js.V}});Object.defineProperty(exports,"parseVariable",{enumerable:true,get:function(){return chunkB3LQVYMR_js.s}});Object.defineProperty(exports,"removeContentControl",{enumerable:true,get:function(){return chunkB3LQVYMR_js.ia}});Object.defineProperty(exports,"removeRepeatingSectionItem",{enumerable:true,get:function(){return chunkB3LQVYMR_js.qa}});Object.defineProperty(exports,"removeVariables",{enumerable:true,get:function(){return chunkB3LQVYMR_js.u}});Object.defineProperty(exports,"repackDocx",{enumerable:true,get:function(){return chunkB3LQVYMR_js.d}});Object.defineProperty(exports,"replaceVariables",{enumerable:true,get:function(){return chunkB3LQVYMR_js.t}});Object.defineProperty(exports,"resolveColor",{enumerable:true,get:function(){return chunkB3LQVYMR_js.ua}});Object.defineProperty(exports,"resolveHighlightColor",{enumerable:true,get:function(){return chunkB3LQVYMR_js.va}});Object.defineProperty(exports,"resolveShadingColor",{enumerable:true,get:function(){return chunkB3LQVYMR_js.wa}});Object.defineProperty(exports,"sanitizeVariableName",{enumerable:true,get:function(){return chunkB3LQVYMR_js.q}});Object.defineProperty(exports,"serializeDocumentBody",{enumerable:true,get:function(){return chunkB3LQVYMR_js.b}});Object.defineProperty(exports,"serializeDocx",{enumerable:true,get:function(){return chunkB3LQVYMR_js.c}});Object.defineProperty(exports,"serializeSectionProperties",{enumerable:true,get:function(){return chunkB3LQVYMR_js.a}});Object.defineProperty(exports,"setContentControlContent",{enumerable:true,get:function(){return chunkB3LQVYMR_js.ha}});Object.defineProperty(exports,"setContentControlValue",{enumerable:true,get:function(){return chunkB3LQVYMR_js.la}});Object.defineProperty(exports,"updateMultipleFiles",{enumerable:true,get:function(){return chunkB3LQVYMR_js.e}});Object.defineProperty(exports,"validatePatchSafety",{enumerable:true,get:function(){return chunkB3LQVYMR_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-CGxgyhy-.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-CGxgyhy-.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-uM9UUIhk.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-uM9UUIhk.mjs';
33
33
 
34
34
  /**
35
35
  * Error classes for @eigenpal/docx-editor-agents
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-CGxgyhy-.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-CGxgyhy-.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-uM9UUIhk.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-uM9UUIhk.js';
33
33
 
34
34
  /**
35
35
  * Error classes for @eigenpal/docx-editor-agents
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- 'use strict';var chunkSCYZRJWI_js=require('./chunk-SCYZRJWI.js'),chunkMOAJJKKG_js=require('./chunk-MOAJJKKG.js'),chunkRI5S75JY_js=require('./chunk-RI5S75JY.js');Object.defineProperty(exports,"DocxReviewer",{enumerable:true,get:function(){return chunkSCYZRJWI_js.a}});Object.defineProperty(exports,"ChangeNotFoundError",{enumerable:true,get:function(){return chunkMOAJJKKG_js.g}});Object.defineProperty(exports,"CommentNotFoundError",{enumerable:true,get:function(){return chunkMOAJJKKG_js.h}});Object.defineProperty(exports,"TextNotFoundError",{enumerable:true,get:function(){return chunkMOAJJKKG_js.f}});Object.defineProperty(exports,"createReviewerBridge",{enumerable:true,get:function(){return chunkMOAJJKKG_js.m}});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 chunkNSFRE2VK_js=require('./chunk-NSFRE2VK.js'),chunkMHUG23P6_js=require('./chunk-MHUG23P6.js'),chunkRI5S75JY_js=require('./chunk-RI5S75JY.js');Object.defineProperty(exports,"DocxReviewer",{enumerable:true,get:function(){return chunkNSFRE2VK_js.a}});Object.defineProperty(exports,"ChangeNotFoundError",{enumerable:true,get:function(){return chunkMHUG23P6_js.g}});Object.defineProperty(exports,"CommentNotFoundError",{enumerable:true,get:function(){return chunkMHUG23P6_js.h}});Object.defineProperty(exports,"TextNotFoundError",{enumerable:true,get:function(){return chunkMHUG23P6_js.f}});Object.defineProperty(exports,"createReviewerBridge",{enumerable:true,get:function(){return chunkMHUG23P6_js.m}});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-NGMVN6QV.mjs';export{g as ChangeNotFoundError,h as CommentNotFoundError,f as TextNotFoundError,m as createReviewerBridge}from'./chunk-PSSPSJR4.mjs';export{a as agentTools,b as executeToolCall,d as getToolSchemas}from'./chunk-24MVJKCP.mjs';
1
+ export{a as DocxReviewer}from'./chunk-6KT5LOQB.mjs';export{g as ChangeNotFoundError,h as CommentNotFoundError,f as TextNotFoundError,m as createReviewerBridge}from'./chunk-MK47WH2X.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-CGxgyhy-.mjs';
20
+ import { E as EditorBridge } from './server-uM9UUIhk.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-CGxgyhy-.js';
20
+ import { E as EditorBridge } from './server-uM9UUIhk.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-CGxgyhy-.mjs';
22
- export { t as getToolDisplayName } from './server-CGxgyhy-.mjs';
21
+ import { r as EditorRefLike, k as AgentToolResult, q as getToolSchemas, j as AgentToolDefinition, s as AgentContextSnapshot } from './server-uM9UUIhk.mjs';
22
+ export { t as getToolDisplayName } from './server-uM9UUIhk.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-CGxgyhy-.js';
22
- export { t as getToolDisplayName } from './server-CGxgyhy-.js';
21
+ import { r as EditorRefLike, k as AgentToolResult, q as getToolSchemas, j as AgentToolDefinition, s as AgentContextSnapshot } from './server-uM9UUIhk.js';
22
+ export { t as getToolDisplayName } from './server-uM9UUIhk.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 chunkDDW6L3LZ_js=require('./chunk-DDW6L3LZ.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?chunkDDW6L3LZ_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=chunkDDW6L3LZ_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=chunkDDW6L3LZ_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 chunkDIXFGAF5_js=require('./chunk-DIXFGAF5.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?chunkDIXFGAF5_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=chunkDIXFGAF5_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=chunkDIXFGAF5_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-JQBSMHZA.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-HTU7NUTJ.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; }