@eigenpal/docx-editor-agents 0.4.2 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bridge.d.mts +1 -1
- package/dist/bridge.d.ts +1 -1
- package/dist/bridge.js +1 -1
- package/dist/bridge.mjs +1 -1
- package/dist/chunk-6NWAUIGY.js +1 -0
- package/dist/{chunk-6QGKIBSG.js → chunk-A6ANAWKH.js} +1 -1
- package/dist/{chunk-JS757ZB5.mjs → chunk-BDHS4WRJ.mjs} +1 -1
- package/dist/chunk-CPJV53R6.mjs +5 -0
- package/dist/chunk-G46D3GDJ.js +71 -0
- package/dist/{chunk-7SW3TY3Y.js → chunk-LVRKZUG4.js} +3 -3
- package/dist/{chunk-P6EQWTU6.js → chunk-N2TKFYHU.js} +2 -2
- package/dist/{chunk-VN4NZFMM.mjs → chunk-QALBLABE.mjs} +1 -1
- package/dist/chunk-U7BWZ7DG.mjs +1 -0
- package/dist/chunk-XZHZXQO5.mjs +71 -0
- package/dist/executor-OYRPTNBR.mjs +1 -0
- package/dist/executor-SJAFSXKL.js +1 -0
- package/dist/headless-FE3K7ABO.js +1 -0
- package/dist/headless-JRF2KBID.mjs +1 -0
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/dist/mcp.d.mts +1 -1
- package/dist/mcp.d.ts +1 -1
- package/dist/react.d.mts +2 -2
- package/dist/react.d.ts +2 -2
- package/dist/react.js +1 -1
- package/dist/react.mjs +1 -1
- package/dist/{server-BSfB_XXk.d.mts → server-DH5eszkm.d.mts} +54 -5
- package/dist/{server-BSfB_XXk.d.ts → server-DH5eszkm.d.ts} +54 -5
- package/dist/server.d.mts +1 -1
- package/dist/server.d.ts +1 -1
- package/dist/server.js +1 -1
- package/dist/server.mjs +1 -1
- package/package.json +2 -1
- package/dist/chunk-2AF2FRMM.js +0 -1
- package/dist/chunk-G32OWQRD.mjs +0 -5
- package/dist/chunk-N2D5VYS3.mjs +0 -71
- package/dist/chunk-X57U3ESM.mjs +0 -1
- package/dist/chunk-YGNXQ76O.js +0 -71
- package/dist/executor-O3426NM3.mjs +0 -1
- package/dist/executor-WY7D4C5O.js +0 -1
- package/dist/headless-HPEK5EWV.js +0 -1
- package/dist/headless-QDD422CM.mjs +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{n as executeCommand,o as executeCommands}from'./chunk-U7BWZ7DG.mjs';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var chunk6NWAUIGY_js=require('./chunk-6NWAUIGY.js');Object.defineProperty(exports,"executeCommand",{enumerable:true,get:function(){return chunk6NWAUIGY_js.n}});Object.defineProperty(exports,"executeCommands",{enumerable:true,get:function(){return chunk6NWAUIGY_js.o}});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var chunkG46D3GDJ_js=require('./chunk-G46D3GDJ.js'),chunk4QRVKNI4_js=require('./chunk-4QRVKNI4.js'),chunk6NWAUIGY_js=require('./chunk-6NWAUIGY.js');Object.defineProperty(exports,"DEFAULT_AI_ACTIONS",{enumerable:true,get:function(){return chunkG46D3GDJ_js.wa}});Object.defineProperty(exports,"DocumentAgent",{enumerable:true,get:function(){return chunkG46D3GDJ_js.x}});Object.defineProperty(exports,"VERSION",{enumerable:true,get:function(){return chunkG46D3GDJ_js.ya}});Object.defineProperty(exports,"attemptSelectiveSave",{enumerable:true,get:function(){return chunkG46D3GDJ_js.i}});Object.defineProperty(exports,"blendColors",{enumerable:true,get:function(){return chunkG46D3GDJ_js.na}});Object.defineProperty(exports,"buildExtendedSelectionContext",{enumerable:true,get:function(){return chunkG46D3GDJ_js.E}});Object.defineProperty(exports,"buildPatchedDocumentXml",{enumerable:true,get:function(){return chunkG46D3GDJ_js.h}});Object.defineProperty(exports,"buildSelectionContext",{enumerable:true,get:function(){return chunkG46D3GDJ_js.D}});Object.defineProperty(exports,"buildSelectionContextFromContext",{enumerable:true,get:function(){return chunkG46D3GDJ_js.B}});Object.defineProperty(exports,"colorsEqual",{enumerable:true,get:function(){return chunkG46D3GDJ_js.oa}});Object.defineProperty(exports,"comparePositions",{enumerable:true,get:function(){return chunkG46D3GDJ_js.ta}});Object.defineProperty(exports,"countCharacters",{enumerable:true,get:function(){return chunkG46D3GDJ_js.M}});Object.defineProperty(exports,"countWords",{enumerable:true,get:function(){return chunkG46D3GDJ_js.L}});Object.defineProperty(exports,"createAgent",{enumerable:true,get:function(){return chunkG46D3GDJ_js.y}});Object.defineProperty(exports,"createAgentFromDocument",{enumerable:true,get:function(){return chunkG46D3GDJ_js.z}});Object.defineProperty(exports,"createCollapsedRange",{enumerable:true,get:function(){return chunkG46D3GDJ_js.qa}});Object.defineProperty(exports,"createCommand",{enumerable:true,get:function(){return chunkG46D3GDJ_js.xa}});Object.defineProperty(exports,"createDocumentWithText",{enumerable:true,get:function(){return chunkG46D3GDJ_js.ba}});Object.defineProperty(exports,"createDocx",{enumerable:true,get:function(){return chunkG46D3GDJ_js.f}});Object.defineProperty(exports,"createEmptyDocument",{enumerable:true,get:function(){return chunkG46D3GDJ_js.aa}});Object.defineProperty(exports,"createRange",{enumerable:true,get:function(){return chunkG46D3GDJ_js.ra}});Object.defineProperty(exports,"createRgbColor",{enumerable:true,get:function(){return chunkG46D3GDJ_js.ka}});Object.defineProperty(exports,"createThemeColor",{enumerable:true,get:function(){return chunkG46D3GDJ_js.ja}});Object.defineProperty(exports,"darkenColor",{enumerable:true,get:function(){return chunkG46D3GDJ_js.la}});Object.defineProperty(exports,"detectVariables",{enumerable:true,get:function(){return chunkG46D3GDJ_js.j}});Object.defineProperty(exports,"detectVariablesDetailed",{enumerable:true,get:function(){return chunkG46D3GDJ_js.k}});Object.defineProperty(exports,"detectVariablesInBody",{enumerable:true,get:function(){return chunkG46D3GDJ_js.l}});Object.defineProperty(exports,"detectVariablesInParagraph",{enumerable:true,get:function(){return chunkG46D3GDJ_js.m}});Object.defineProperty(exports,"documentHasVariables",{enumerable:true,get:function(){return chunkG46D3GDJ_js.v}});Object.defineProperty(exports,"extractVariablesFromText",{enumerable:true,get:function(){return chunkG46D3GDJ_js.n}});Object.defineProperty(exports,"formatVariable",{enumerable:true,get:function(){return chunkG46D3GDJ_js.r}});Object.defineProperty(exports,"getActionDescription",{enumerable:true,get:function(){return chunkG46D3GDJ_js.va}});Object.defineProperty(exports,"getActionLabel",{enumerable:true,get:function(){return chunkG46D3GDJ_js.ua}});Object.defineProperty(exports,"getAgentContext",{enumerable:true,get:function(){return chunkG46D3GDJ_js.A}});Object.defineProperty(exports,"getBlockIndexForParagraph",{enumerable:true,get:function(){return chunkG46D3GDJ_js.$}});Object.defineProperty(exports,"getBodyCharacterCount",{enumerable:true,get:function(){return chunkG46D3GDJ_js.O}});Object.defineProperty(exports,"getBodyText",{enumerable:true,get:function(){return chunkG46D3GDJ_js.K}});Object.defineProperty(exports,"getBodyWordCount",{enumerable:true,get:function(){return chunkG46D3GDJ_js.N}});Object.defineProperty(exports,"getContrastingColor",{enumerable:true,get:function(){return chunkG46D3GDJ_js.ha}});Object.defineProperty(exports,"getDocumentSummary",{enumerable:true,get:function(){return chunkG46D3GDJ_js.C}});Object.defineProperty(exports,"getFormattingAtPosition",{enumerable:true,get:function(){return chunkG46D3GDJ_js.R}});Object.defineProperty(exports,"getHyperlinkAtPosition",{enumerable:true,get:function(){return chunkG46D3GDJ_js.T}});Object.defineProperty(exports,"getHyperlinkText",{enumerable:true,get:function(){return chunkG46D3GDJ_js.I}});Object.defineProperty(exports,"getParagraphAtIndex",{enumerable:true,get:function(){return chunkG46D3GDJ_js._}});Object.defineProperty(exports,"getParagraphText",{enumerable:true,get:function(){return chunkG46D3GDJ_js.G}});Object.defineProperty(exports,"getParagraphs",{enumerable:true,get:function(){return chunkG46D3GDJ_js.Z}});Object.defineProperty(exports,"getRunText",{enumerable:true,get:function(){return chunkG46D3GDJ_js.H}});Object.defineProperty(exports,"getSelectionFormattingSummary",{enumerable:true,get:function(){return chunkG46D3GDJ_js.F}});Object.defineProperty(exports,"getTableText",{enumerable:true,get:function(){return chunkG46D3GDJ_js.J}});Object.defineProperty(exports,"getTextAfter",{enumerable:true,get:function(){return chunkG46D3GDJ_js.Q}});Object.defineProperty(exports,"getTextBefore",{enumerable:true,get:function(){return chunkG46D3GDJ_js.P}});Object.defineProperty(exports,"hasHyperlinks",{enumerable:true,get:function(){return chunkG46D3GDJ_js.X}});Object.defineProperty(exports,"hasImages",{enumerable:true,get:function(){return chunkG46D3GDJ_js.W}});Object.defineProperty(exports,"hasTables",{enumerable:true,get:function(){return chunkG46D3GDJ_js.Y}});Object.defineProperty(exports,"hasTemplateVariables",{enumerable:true,get:function(){return chunkG46D3GDJ_js.o}});Object.defineProperty(exports,"isBlack",{enumerable:true,get:function(){return chunkG46D3GDJ_js.fa}});Object.defineProperty(exports,"isHeadingStyle",{enumerable:true,get:function(){return chunkG46D3GDJ_js.U}});Object.defineProperty(exports,"isPositionInHyperlink",{enumerable:true,get:function(){return chunkG46D3GDJ_js.S}});Object.defineProperty(exports,"isPositionInRange",{enumerable:true,get:function(){return chunkG46D3GDJ_js.sa}});Object.defineProperty(exports,"isValidVariableName",{enumerable:true,get:function(){return chunkG46D3GDJ_js.p}});Object.defineProperty(exports,"isWhite",{enumerable:true,get:function(){return chunkG46D3GDJ_js.ga}});Object.defineProperty(exports,"isZodSchema",{enumerable:true,get:function(){return chunkG46D3GDJ_js.pa}});Object.defineProperty(exports,"lightenColor",{enumerable:true,get:function(){return chunkG46D3GDJ_js.ma}});Object.defineProperty(exports,"parseColorString",{enumerable:true,get:function(){return chunkG46D3GDJ_js.ia}});Object.defineProperty(exports,"parseDocx",{enumerable:true,get:function(){return chunkG46D3GDJ_js.w}});Object.defineProperty(exports,"parseHeadingLevel",{enumerable:true,get:function(){return chunkG46D3GDJ_js.V}});Object.defineProperty(exports,"parseVariable",{enumerable:true,get:function(){return chunkG46D3GDJ_js.s}});Object.defineProperty(exports,"removeVariables",{enumerable:true,get:function(){return chunkG46D3GDJ_js.u}});Object.defineProperty(exports,"repackDocx",{enumerable:true,get:function(){return chunkG46D3GDJ_js.d}});Object.defineProperty(exports,"replaceVariables",{enumerable:true,get:function(){return chunkG46D3GDJ_js.t}});Object.defineProperty(exports,"resolveColor",{enumerable:true,get:function(){return chunkG46D3GDJ_js.ca}});Object.defineProperty(exports,"resolveHighlightColor",{enumerable:true,get:function(){return chunkG46D3GDJ_js.da}});Object.defineProperty(exports,"resolveShadingColor",{enumerable:true,get:function(){return chunkG46D3GDJ_js.ea}});Object.defineProperty(exports,"sanitizeVariableName",{enumerable:true,get:function(){return chunkG46D3GDJ_js.q}});Object.defineProperty(exports,"serializeDocumentBody",{enumerable:true,get:function(){return chunkG46D3GDJ_js.b}});Object.defineProperty(exports,"serializeDocx",{enumerable:true,get:function(){return chunkG46D3GDJ_js.c}});Object.defineProperty(exports,"serializeSectionProperties",{enumerable:true,get:function(){return chunkG46D3GDJ_js.a}});Object.defineProperty(exports,"updateMultipleFiles",{enumerable:true,get:function(){return chunkG46D3GDJ_js.e}});Object.defineProperty(exports,"validatePatchSafety",{enumerable:true,get:function(){return chunkG46D3GDJ_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 chunk6NWAUIGY_js.a}});Object.defineProperty(exports,"createPluginRegistrar",{enumerable:true,get:function(){return chunk6NWAUIGY_js.d}});Object.defineProperty(exports,"emuToPixels",{enumerable:true,get:function(){return chunk6NWAUIGY_js.g}});Object.defineProperty(exports,"emuToTwips",{enumerable:true,get:function(){return chunk6NWAUIGY_js.i}});Object.defineProperty(exports,"executeCommand",{enumerable:true,get:function(){return chunk6NWAUIGY_js.n}});Object.defineProperty(exports,"executeCommands",{enumerable:true,get:function(){return chunk6NWAUIGY_js.o}});Object.defineProperty(exports,"formatPx",{enumerable:true,get:function(){return chunk6NWAUIGY_js.m}});Object.defineProperty(exports,"halfPointsToPixels",{enumerable:true,get:function(){return chunk6NWAUIGY_js.l}});Object.defineProperty(exports,"pixelsToEmu",{enumerable:true,get:function(){return chunk6NWAUIGY_js.h}});Object.defineProperty(exports,"pixelsToTwips",{enumerable:true,get:function(){return chunk6NWAUIGY_js.f}});Object.defineProperty(exports,"pluginRegistry",{enumerable:true,get:function(){return chunk6NWAUIGY_js.b}});Object.defineProperty(exports,"pointsToPixels",{enumerable:true,get:function(){return chunk6NWAUIGY_js.k}});Object.defineProperty(exports,"registerPlugins",{enumerable:true,get:function(){return chunk6NWAUIGY_js.c}});Object.defineProperty(exports,"twipsToEmu",{enumerable:true,get:function(){return chunk6NWAUIGY_js.j}});Object.defineProperty(exports,"twipsToPixels",{enumerable:true,get:function(){return chunk6NWAUIGY_js.e}});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{wa as DEFAULT_AI_ACTIONS,x as DocumentAgent,ya as VERSION,i as attemptSelectiveSave,na as blendColors,E as buildExtendedSelectionContext,h as buildPatchedDocumentXml,D as buildSelectionContext,B as buildSelectionContextFromContext,oa as colorsEqual,ta as comparePositions,M as countCharacters,L as countWords,y as createAgent,z as createAgentFromDocument,qa as createCollapsedRange,xa as createCommand,ba as createDocumentWithText,f as createDocx,aa as createEmptyDocument,ra as createRange,ka as createRgbColor,ja as createThemeColor,la as darkenColor,j as detectVariables,k as detectVariablesDetailed,l as detectVariablesInBody,m as detectVariablesInParagraph,v as documentHasVariables,n as extractVariablesFromText,r as formatVariable,va as getActionDescription,ua as getActionLabel,A as getAgentContext,$ as getBlockIndexForParagraph,O as getBodyCharacterCount,K as getBodyText,N as getBodyWordCount,ha 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,fa as isBlack,U as isHeadingStyle,S as isPositionInHyperlink,sa as isPositionInRange,p as isValidVariableName,ga as isWhite,pa as isZodSchema,ma as lightenColor,ia as parseColorString,w as parseDocx,V as parseHeadingLevel,s as parseVariable,u as removeVariables,d as repackDocx,t as replaceVariables,ca as resolveColor,da as resolveHighlightColor,ea as resolveShadingColor,q as sanitizeVariableName,b as serializeDocumentBody,c as serializeDocx,a as serializeSectionProperties,e as updateMultipleFiles,g as validatePatchSafety}from'./chunk-XZHZXQO5.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,n as executeCommand,o as executeCommands,m as formatPx,l as halfPointsToPixels,h as pixelsToEmu,f as pixelsToTwips,b as pluginRegistry,k as pointsToPixels,c as registerPlugins,j as twipsToEmu,e as twipsToPixels}from'./chunk-U7BWZ7DG.mjs';
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { G as GetContentOptions, C as ContentBlock, e as CommentFilter, R as ReviewComment, f as ChangeFilter, h as ReviewChange, F as FoundMatch, S as SelectionInfo, i as AddCommentByParaIdOptions, j as ReplyOptions, P as ProposeChangeOptions, k as ApplyFormattingOptions, l as SetParagraphStyleOptions, m as PageContent, n as ContentChangeEvent, o as SelectionChangeEvent } from './server-
|
|
2
|
-
export { A as AgentToolDefinition, a as AgentToolResult, B as BatchError, p as BatchResult, q as BatchReviewOptions, D as DocxReviewer, r as agentTools, s as createReviewerBridge, t as executeToolCall, g as getToolSchemas } from './server-
|
|
1
|
+
import { G as GetContentOptions, C as ContentBlock, e as CommentFilter, R as ReviewComment, f as ChangeFilter, h as ReviewChange, F as FoundMatch, S as SelectionInfo, i as AddCommentByParaIdOptions, j as ReplyOptions, P as ProposeChangeOptions, k as ApplyFormattingOptions, l as SetParagraphStyleOptions, m as PageContent, n as ContentChangeEvent, o as SelectionChangeEvent } from './server-DH5eszkm.mjs';
|
|
2
|
+
export { A as AgentToolDefinition, a as AgentToolResult, B as BatchError, p as BatchResult, q as BatchReviewOptions, D as DocxReviewer, r as agentTools, s as createReviewerBridge, t as executeToolCall, g as getToolSchemas } from './server-DH5eszkm.mjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Error classes for @eigenpal/docx-editor-agents
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { G as GetContentOptions, C as ContentBlock, e as CommentFilter, R as ReviewComment, f as ChangeFilter, h as ReviewChange, F as FoundMatch, S as SelectionInfo, i as AddCommentByParaIdOptions, j as ReplyOptions, P as ProposeChangeOptions, k as ApplyFormattingOptions, l as SetParagraphStyleOptions, m as PageContent, n as ContentChangeEvent, o as SelectionChangeEvent } from './server-
|
|
2
|
-
export { A as AgentToolDefinition, a as AgentToolResult, B as BatchError, p as BatchResult, q as BatchReviewOptions, D as DocxReviewer, r as agentTools, s as createReviewerBridge, t as executeToolCall, g as getToolSchemas } from './server-
|
|
1
|
+
import { G as GetContentOptions, C as ContentBlock, e as CommentFilter, R as ReviewComment, f as ChangeFilter, h as ReviewChange, F as FoundMatch, S as SelectionInfo, i as AddCommentByParaIdOptions, j as ReplyOptions, P as ProposeChangeOptions, k as ApplyFormattingOptions, l as SetParagraphStyleOptions, m as PageContent, n as ContentChangeEvent, o as SelectionChangeEvent } from './server-DH5eszkm.js';
|
|
2
|
+
export { A as AgentToolDefinition, a as AgentToolResult, B as BatchError, p as BatchResult, q as BatchReviewOptions, D as DocxReviewer, r as agentTools, s as createReviewerBridge, t as executeToolCall, g as getToolSchemas } from './server-DH5eszkm.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Error classes for @eigenpal/docx-editor-agents
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var chunkA6ANAWKH_js=require('./chunk-A6ANAWKH.js'),chunkLVRKZUG4_js=require('./chunk-LVRKZUG4.js'),chunkRI5S75JY_js=require('./chunk-RI5S75JY.js');Object.defineProperty(exports,"DocxReviewer",{enumerable:true,get:function(){return chunkA6ANAWKH_js.a}});Object.defineProperty(exports,"ChangeNotFoundError",{enumerable:true,get:function(){return chunkLVRKZUG4_js.g}});Object.defineProperty(exports,"CommentNotFoundError",{enumerable:true,get:function(){return chunkLVRKZUG4_js.h}});Object.defineProperty(exports,"TextNotFoundError",{enumerable:true,get:function(){return chunkLVRKZUG4_js.f}});Object.defineProperty(exports,"createReviewerBridge",{enumerable:true,get:function(){return chunkLVRKZUG4_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-
|
|
1
|
+
export{a as DocxReviewer}from'./chunk-BDHS4WRJ.mjs';export{g as ChangeNotFoundError,h as CommentNotFoundError,f as TextNotFoundError,m as createReviewerBridge}from'./chunk-CPJV53R6.mjs';export{a as agentTools,b as executeToolCall,d as getToolSchemas}from'./chunk-24MVJKCP.mjs';
|
package/dist/mcp.d.mts
CHANGED
package/dist/mcp.d.ts
CHANGED
package/dist/react.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { E as EditorRefLike, A as AgentToolDefinition, g as getToolSchemas, a as AgentToolResult, b as AgentContextSnapshot } from './server-
|
|
2
|
-
export { U as UseAgentChatOptions, c as UseAgentChatReturn, d as getToolDisplayName, u as useAgentChat } from './server-
|
|
1
|
+
import { E as EditorRefLike, A as AgentToolDefinition, g as getToolSchemas, a as AgentToolResult, b as AgentContextSnapshot } from './server-DH5eszkm.mjs';
|
|
2
|
+
export { U as UseAgentChatOptions, c as UseAgentChatReturn, d as getToolDisplayName, u as useAgentChat } from './server-DH5eszkm.mjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* useDocxAgentTools — wires the toolkit to a live DocxEditor for BYO chat
|
package/dist/react.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { E as EditorRefLike, A as AgentToolDefinition, g as getToolSchemas, a as AgentToolResult, b as AgentContextSnapshot } from './server-
|
|
2
|
-
export { U as UseAgentChatOptions, c as UseAgentChatReturn, d as getToolDisplayName, u as useAgentChat } from './server-
|
|
1
|
+
import { E as EditorRefLike, A as AgentToolDefinition, g as getToolSchemas, a as AgentToolResult, b as AgentContextSnapshot } from './server-DH5eszkm.js';
|
|
2
|
+
export { U as UseAgentChatOptions, c as UseAgentChatReturn, d as getToolDisplayName, u as useAgentChat } from './server-DH5eszkm.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* useDocxAgentTools — wires the toolkit to a live DocxEditor for BYO chat
|
package/dist/react.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var chunkN2TKFYHU_js=require('./chunk-N2TKFYHU.js'),chunkRI5S75JY_js=require('./chunk-RI5S75JY.js'),react=require('react');function S(T){let{editorRef:i,author:l="AI",tools:n,include:r,exclude:s}=T,m=!!n&&Object.keys(n).length>0,c=react.useCallback(t=>!(r&&!r.includes(t)||s&&s.includes(t)),[r,s]),A=react.useMemo(()=>{let t=r||s?chunkRI5S75JY_js.a.filter(e=>c(e.name)):chunkRI5S75JY_js.a;if(!m)return t.map(e=>({type:"function",function:{name:e.name,description:e.description,parameters:e.inputSchema}}));let o=new Map(t.map(e=>[e.name,e]));for(let[e,a]of Object.entries(n))o.set(e,a);return Array.from(o.values()).map(e=>({type:"function",function:{name:e.name,description:e.description,parameters:e.inputSchema}}))},[n,m,r,s,c]),y=react.useCallback((t,o)=>{let e=i.current;if(!e)return {success:false,error:"Editor not ready."};let a=chunkN2TKFYHU_js.b(e,l),d=n?.[t];if(d)try{return d.handler(o,a)}catch(u){return {success:false,error:u instanceof Error?u.message:String(u)}}return c(t)?chunkRI5S75JY_js.b(t,o,a):{success:false,error:`Tool '${t}' is not enabled.`}},[i,l,n,c]),h=react.useCallback(()=>{let t=i.current;if(!t)return {selection:null,currentPage:0,totalPages:0};let o=chunkN2TKFYHU_js.b(t,l);return {selection:o.getSelection(),currentPage:o.getCurrentPage(),totalPages:o.getTotalPages()}},[i,l]);return {tools:A,executeToolCall:y,getContext:h}}Object.defineProperty(exports,"useAgentChat",{enumerable:true,get:function(){return chunkN2TKFYHU_js.a}});Object.defineProperty(exports,"getToolDisplayName",{enumerable:true,get:function(){return chunkRI5S75JY_js.c}});exports.useDocxAgentTools=S;
|
package/dist/react.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import {b}from'./chunk-
|
|
1
|
+
import {b}from'./chunk-QALBLABE.mjs';export{a as useAgentChat}from'./chunk-QALBLABE.mjs';import {a,b as b$1}from'./chunk-24MVJKCP.mjs';export{c as getToolDisplayName}from'./chunk-24MVJKCP.mjs';import {useCallback,useMemo}from'react';function S(T){let{editorRef:i,author:l="AI",tools:n,include:r,exclude:s}=T,m=!!n&&Object.keys(n).length>0,c=useCallback(t=>!(r&&!r.includes(t)||s&&s.includes(t)),[r,s]),A=useMemo(()=>{let t=r||s?a.filter(e=>c(e.name)):a;if(!m)return t.map(e=>({type:"function",function:{name:e.name,description:e.description,parameters:e.inputSchema}}));let o=new Map(t.map(e=>[e.name,e]));for(let[e,a]of Object.entries(n))o.set(e,a);return Array.from(o.values()).map(e=>({type:"function",function:{name:e.name,description:e.description,parameters:e.inputSchema}}))},[n,m,r,s,c]),y=useCallback((t,o)=>{let e=i.current;if(!e)return {success:false,error:"Editor not ready."};let a=b(e,l),d=n?.[t];if(d)try{return d.handler(o,a)}catch(u){return {success:false,error:u instanceof Error?u.message:String(u)}}return c(t)?b$1(t,o,a):{success:false,error:`Tool '${t}' is not enabled.`}},[i,l,n,c]),h=useCallback(()=>{let t=i.current;if(!t)return {selection:null,currentPage:0,totalPages:0};let o=b(t,l);return {selection:o.getSelection(),currentPage:o.getCurrentPage(),totalPages:o.getTotalPages()}},[i,l]);return {tools:A,executeToolCall:y,getContext:h}}export{S as useDocxAgentTools};
|
|
@@ -564,6 +564,16 @@ interface NumberingDefinitions {
|
|
|
564
564
|
nums: NumberingInstance[];
|
|
565
565
|
}
|
|
566
566
|
|
|
567
|
+
/**
|
|
568
|
+
* OOXML image wrap-type taxonomy.
|
|
569
|
+
*
|
|
570
|
+
* `wp:inline` flows in the line. `wp:anchor` covers all positioned variants:
|
|
571
|
+
* - `square` / `tight` / `through` — text wraps around the image
|
|
572
|
+
* - `topAndBottom` — text breaks above and below
|
|
573
|
+
* - `behind` / `inFront` (`wp:wrapNone`) — image paints out of flow
|
|
574
|
+
*/
|
|
575
|
+
type WrapType = 'inline' | 'square' | 'tight' | 'through' | 'topAndBottom' | 'behind' | 'inFront';
|
|
576
|
+
|
|
567
577
|
/**
|
|
568
578
|
* Document Content Model
|
|
569
579
|
*
|
|
@@ -777,7 +787,7 @@ interface ImageSize {
|
|
|
777
787
|
* Image wrap type for floating images
|
|
778
788
|
*/
|
|
779
789
|
interface ImageWrap {
|
|
780
|
-
type:
|
|
790
|
+
type: WrapType;
|
|
781
791
|
/** Wrap text direction */
|
|
782
792
|
wrapText?: 'bothSides' | 'left' | 'right' | 'largest';
|
|
783
793
|
/** Distance from text */
|
|
@@ -823,6 +833,19 @@ interface ImagePadding {
|
|
|
823
833
|
left?: number;
|
|
824
834
|
right?: number;
|
|
825
835
|
}
|
|
836
|
+
/**
|
|
837
|
+
* Image crop, expressed as fractions of the source image to trim from each
|
|
838
|
+
* edge. OOXML's `<a:srcRect l="10000" t="0" r="5000" b="0"/>` uses units of
|
|
839
|
+
* 1/100000 (so 10000 → 0.1 → 10% trimmed from the left). We store the
|
|
840
|
+
* normalised fraction so both the renderer and the saver can read it
|
|
841
|
+
* directly without re-parsing units.
|
|
842
|
+
*/
|
|
843
|
+
interface ImageCrop {
|
|
844
|
+
left?: number;
|
|
845
|
+
top?: number;
|
|
846
|
+
right?: number;
|
|
847
|
+
bottom?: number;
|
|
848
|
+
}
|
|
826
849
|
/**
|
|
827
850
|
* Embedded image (w:drawing)
|
|
828
851
|
*/
|
|
@@ -854,8 +877,25 @@ interface Image {
|
|
|
854
877
|
transform?: ImageTransform;
|
|
855
878
|
/** Padding around image */
|
|
856
879
|
padding?: ImagePadding;
|
|
880
|
+
/** Source-image crop (fractional, OOXML `a:srcRect`). */
|
|
881
|
+
crop?: ImageCrop;
|
|
882
|
+
/** Opacity in [0, 1] (OOXML `a:alphaModFix amt`). Undefined = fully opaque. */
|
|
883
|
+
opacity?: number;
|
|
857
884
|
/** Whether this is a decorative image */
|
|
858
885
|
decorative?: boolean;
|
|
886
|
+
/**
|
|
887
|
+
* `wp:anchor layoutInCell` — when true (default), an anchored image inside
|
|
888
|
+
* a table cell is constrained to the cell. When false, the image escapes
|
|
889
|
+
* the cell into the page area. Round-tripped on save.
|
|
890
|
+
*/
|
|
891
|
+
layoutInCell?: boolean;
|
|
892
|
+
/**
|
|
893
|
+
* `wp:anchor allowOverlap` — when true (default), anchored objects may
|
|
894
|
+
* overlap; when false, Word repositions them to avoid collisions. We
|
|
895
|
+
* don't currently reposition; we round-trip the flag so saving preserves
|
|
896
|
+
* the author's intent.
|
|
897
|
+
*/
|
|
898
|
+
allowOverlap?: boolean;
|
|
859
899
|
/** Hyperlink URL for clickable image */
|
|
860
900
|
hlinkHref?: string;
|
|
861
901
|
/** Image outline/border */
|
|
@@ -1352,8 +1392,14 @@ interface Footnote {
|
|
|
1352
1392
|
id: number;
|
|
1353
1393
|
/** Special footnote type */
|
|
1354
1394
|
noteType?: 'normal' | 'separator' | 'continuationSeparator' | 'continuationNotice';
|
|
1355
|
-
/**
|
|
1356
|
-
|
|
1395
|
+
/**
|
|
1396
|
+
* Content. Per ECMA-376 §17.11.10 footnotes can hold the same blocks as
|
|
1397
|
+
* the body — paragraphs and tables. The parser previously only collected
|
|
1398
|
+
* <w:p> children which silently dropped any <w:tbl> inside a footnote;
|
|
1399
|
+
* widened to match HeaderFooter / TableCell shape so the body pipeline
|
|
1400
|
+
* (toProseDoc → toFlowBlocks) can render them uniformly.
|
|
1401
|
+
*/
|
|
1402
|
+
content: (Paragraph | Table)[];
|
|
1357
1403
|
}
|
|
1358
1404
|
/**
|
|
1359
1405
|
* Endnote (w:endnote)
|
|
@@ -1364,8 +1410,11 @@ interface Endnote {
|
|
|
1364
1410
|
id: number;
|
|
1365
1411
|
/** Special endnote type */
|
|
1366
1412
|
noteType?: 'normal' | 'separator' | 'continuationSeparator' | 'continuationNotice';
|
|
1367
|
-
/**
|
|
1368
|
-
|
|
1413
|
+
/**
|
|
1414
|
+
* Content. Per ECMA-376 §17.11.4 endnotes can hold the same blocks as
|
|
1415
|
+
* the body — paragraphs and tables. See note on `Footnote.content`.
|
|
1416
|
+
*/
|
|
1417
|
+
content: (Paragraph | Table)[];
|
|
1369
1418
|
}
|
|
1370
1419
|
/**
|
|
1371
1420
|
* Page orientation
|
|
@@ -564,6 +564,16 @@ interface NumberingDefinitions {
|
|
|
564
564
|
nums: NumberingInstance[];
|
|
565
565
|
}
|
|
566
566
|
|
|
567
|
+
/**
|
|
568
|
+
* OOXML image wrap-type taxonomy.
|
|
569
|
+
*
|
|
570
|
+
* `wp:inline` flows in the line. `wp:anchor` covers all positioned variants:
|
|
571
|
+
* - `square` / `tight` / `through` — text wraps around the image
|
|
572
|
+
* - `topAndBottom` — text breaks above and below
|
|
573
|
+
* - `behind` / `inFront` (`wp:wrapNone`) — image paints out of flow
|
|
574
|
+
*/
|
|
575
|
+
type WrapType = 'inline' | 'square' | 'tight' | 'through' | 'topAndBottom' | 'behind' | 'inFront';
|
|
576
|
+
|
|
567
577
|
/**
|
|
568
578
|
* Document Content Model
|
|
569
579
|
*
|
|
@@ -777,7 +787,7 @@ interface ImageSize {
|
|
|
777
787
|
* Image wrap type for floating images
|
|
778
788
|
*/
|
|
779
789
|
interface ImageWrap {
|
|
780
|
-
type:
|
|
790
|
+
type: WrapType;
|
|
781
791
|
/** Wrap text direction */
|
|
782
792
|
wrapText?: 'bothSides' | 'left' | 'right' | 'largest';
|
|
783
793
|
/** Distance from text */
|
|
@@ -823,6 +833,19 @@ interface ImagePadding {
|
|
|
823
833
|
left?: number;
|
|
824
834
|
right?: number;
|
|
825
835
|
}
|
|
836
|
+
/**
|
|
837
|
+
* Image crop, expressed as fractions of the source image to trim from each
|
|
838
|
+
* edge. OOXML's `<a:srcRect l="10000" t="0" r="5000" b="0"/>` uses units of
|
|
839
|
+
* 1/100000 (so 10000 → 0.1 → 10% trimmed from the left). We store the
|
|
840
|
+
* normalised fraction so both the renderer and the saver can read it
|
|
841
|
+
* directly without re-parsing units.
|
|
842
|
+
*/
|
|
843
|
+
interface ImageCrop {
|
|
844
|
+
left?: number;
|
|
845
|
+
top?: number;
|
|
846
|
+
right?: number;
|
|
847
|
+
bottom?: number;
|
|
848
|
+
}
|
|
826
849
|
/**
|
|
827
850
|
* Embedded image (w:drawing)
|
|
828
851
|
*/
|
|
@@ -854,8 +877,25 @@ interface Image {
|
|
|
854
877
|
transform?: ImageTransform;
|
|
855
878
|
/** Padding around image */
|
|
856
879
|
padding?: ImagePadding;
|
|
880
|
+
/** Source-image crop (fractional, OOXML `a:srcRect`). */
|
|
881
|
+
crop?: ImageCrop;
|
|
882
|
+
/** Opacity in [0, 1] (OOXML `a:alphaModFix amt`). Undefined = fully opaque. */
|
|
883
|
+
opacity?: number;
|
|
857
884
|
/** Whether this is a decorative image */
|
|
858
885
|
decorative?: boolean;
|
|
886
|
+
/**
|
|
887
|
+
* `wp:anchor layoutInCell` — when true (default), an anchored image inside
|
|
888
|
+
* a table cell is constrained to the cell. When false, the image escapes
|
|
889
|
+
* the cell into the page area. Round-tripped on save.
|
|
890
|
+
*/
|
|
891
|
+
layoutInCell?: boolean;
|
|
892
|
+
/**
|
|
893
|
+
* `wp:anchor allowOverlap` — when true (default), anchored objects may
|
|
894
|
+
* overlap; when false, Word repositions them to avoid collisions. We
|
|
895
|
+
* don't currently reposition; we round-trip the flag so saving preserves
|
|
896
|
+
* the author's intent.
|
|
897
|
+
*/
|
|
898
|
+
allowOverlap?: boolean;
|
|
859
899
|
/** Hyperlink URL for clickable image */
|
|
860
900
|
hlinkHref?: string;
|
|
861
901
|
/** Image outline/border */
|
|
@@ -1352,8 +1392,14 @@ interface Footnote {
|
|
|
1352
1392
|
id: number;
|
|
1353
1393
|
/** Special footnote type */
|
|
1354
1394
|
noteType?: 'normal' | 'separator' | 'continuationSeparator' | 'continuationNotice';
|
|
1355
|
-
/**
|
|
1356
|
-
|
|
1395
|
+
/**
|
|
1396
|
+
* Content. Per ECMA-376 §17.11.10 footnotes can hold the same blocks as
|
|
1397
|
+
* the body — paragraphs and tables. The parser previously only collected
|
|
1398
|
+
* <w:p> children which silently dropped any <w:tbl> inside a footnote;
|
|
1399
|
+
* widened to match HeaderFooter / TableCell shape so the body pipeline
|
|
1400
|
+
* (toProseDoc → toFlowBlocks) can render them uniformly.
|
|
1401
|
+
*/
|
|
1402
|
+
content: (Paragraph | Table)[];
|
|
1357
1403
|
}
|
|
1358
1404
|
/**
|
|
1359
1405
|
* Endnote (w:endnote)
|
|
@@ -1364,8 +1410,11 @@ interface Endnote {
|
|
|
1364
1410
|
id: number;
|
|
1365
1411
|
/** Special endnote type */
|
|
1366
1412
|
noteType?: 'normal' | 'separator' | 'continuationSeparator' | 'continuationNotice';
|
|
1367
|
-
/**
|
|
1368
|
-
|
|
1413
|
+
/**
|
|
1414
|
+
* Content. Per ECMA-376 §17.11.4 endnotes can hold the same blocks as
|
|
1415
|
+
* the body — paragraphs and tables. See note on `Footnote.content`.
|
|
1416
|
+
*/
|
|
1417
|
+
content: (Paragraph | Table)[];
|
|
1369
1418
|
}
|
|
1370
1419
|
/**
|
|
1371
1420
|
* Page orientation
|
package/dist/server.d.mts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { b as AgentContextSnapshot, A as AgentToolDefinition, a as AgentToolResult, D as DocxReviewer, v as EditorBridge, S as SelectionInfo, s as createReviewerBridge, r as docxAgentTools, t as executeToolCall, d as getToolDisplayName, g as getToolSchemas } from './server-
|
|
1
|
+
export { b as AgentContextSnapshot, A as AgentToolDefinition, a as AgentToolResult, D as DocxReviewer, v as EditorBridge, S as SelectionInfo, s as createReviewerBridge, r as docxAgentTools, t as executeToolCall, d as getToolDisplayName, g as getToolSchemas } from './server-DH5eszkm.mjs';
|
package/dist/server.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { b as AgentContextSnapshot, A as AgentToolDefinition, a as AgentToolResult, D as DocxReviewer, v as EditorBridge, S as SelectionInfo, s as createReviewerBridge, r as docxAgentTools, t as executeToolCall, d as getToolDisplayName, g as getToolSchemas } from './server-
|
|
1
|
+
export { b as AgentContextSnapshot, A as AgentToolDefinition, a as AgentToolResult, D as DocxReviewer, v as EditorBridge, S as SelectionInfo, s as createReviewerBridge, r as docxAgentTools, t as executeToolCall, d as getToolDisplayName, g as getToolSchemas } from './server-DH5eszkm.js';
|
package/dist/server.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var chunkA6ANAWKH_js=require('./chunk-A6ANAWKH.js'),chunkLVRKZUG4_js=require('./chunk-LVRKZUG4.js'),chunkRI5S75JY_js=require('./chunk-RI5S75JY.js');Object.defineProperty(exports,"DocxReviewer",{enumerable:true,get:function(){return chunkA6ANAWKH_js.a}});Object.defineProperty(exports,"createReviewerBridge",{enumerable:true,get:function(){return chunkLVRKZUG4_js.m}});Object.defineProperty(exports,"docxAgentTools",{enumerable:true,get:function(){return chunkRI5S75JY_js.a}});Object.defineProperty(exports,"executeToolCall",{enumerable:true,get:function(){return chunkRI5S75JY_js.b}});Object.defineProperty(exports,"getToolDisplayName",{enumerable:true,get:function(){return chunkRI5S75JY_js.c}});Object.defineProperty(exports,"getToolSchemas",{enumerable:true,get:function(){return chunkRI5S75JY_js.d}});
|
package/dist/server.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{a as DocxReviewer}from'./chunk-
|
|
1
|
+
export{a as DocxReviewer}from'./chunk-BDHS4WRJ.mjs';export{m as createReviewerBridge}from'./chunk-CPJV53R6.mjs';export{a as docxAgentTools,b as executeToolCall,c as getToolDisplayName,d as getToolSchemas}from'./chunk-24MVJKCP.mjs';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eigenpal/docx-editor-agents",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "Agent-friendly API for DOCX document review — read, comment, propose changes, accept/reject tracked changes",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -101,6 +101,7 @@
|
|
|
101
101
|
],
|
|
102
102
|
"author": "EigenPal",
|
|
103
103
|
"license": "AGPL-3.0-or-later",
|
|
104
|
+
"homepage": "https://docx-editor.dev/",
|
|
104
105
|
"repository": {
|
|
105
106
|
"type": "git",
|
|
106
107
|
"url": "https://github.com/eigenpal/docx-editor.git",
|
package/dist/chunk-2AF2FRMM.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
'use strict';var w=class{constructor(){this.plugins=new Map;this.commandHandlers=new Map;this.eventListeners=new Set;this.initialized=new Set;}register(e,r){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,o]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:o});}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(o=>{this.emit({type:"error",pluginId:e.id,error:o});}):this.initialized.add(e.id);}catch(t){this.emit({type:"error",pluginId:e.id,error:t});}return r?.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 r=this.plugins.get(e);if(!r)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(r.destroy)try{let n=r.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 r of this.plugins.values())r.mcpTools&&e.push(...r.mcpTools);return e}getMcpToolsForPlugin(e){return this.plugins.get(e)?.mcpTools||[]}getMcpTool(e){for(let r of this.plugins.values())if(r.mcpTools){let n=r.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 r of this.eventListeners)try{r(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)}}},b=new w;function _(s,e){return s.map(r=>b.register(r,e))}function J(s){return e=>b.register(e,s)}function R(s,e){let r=b.getCommandHandler(e.type);if(r)return r(s,e);switch(e.type){case "insertText":return E(s,e);case "replaceText":return H(s,e);case "deleteText":return $(s,e);case "formatText":return S(s,e);case "formatParagraph":return A(s,e);case "applyStyle":return M(s,e);case "insertTable":return B(s,e);case "insertImage":return V(s,e);case "insertHyperlink":return z(s,e);case "removeHyperlink":return F(s,e);case "insertParagraphBreak":return v(s,e);case "mergeParagraphs":return L(s,e);case "splitParagraph":return O(s,e);case "setVariable":return j(s,e);case "applyVariables":return N(s,e);default:let n=e;throw new Error(`Unknown command type: ${n.type}`)}}function G(s,e){return e.reduce((r,n)=>R(r,n),s)}function h(s){return JSON.parse(JSON.stringify(s))}function f(s,e){let r=0;for(let n=0;n<s.content.length;n++)if(s.content[n].type==="paragraph"){if(r===e)return n;r++;}return -1}function P(s){let e="";for(let r of s.content)if(r.type==="run")for(let n of r.content)n.type==="text"&&(e+=n.text);else if(r.type==="hyperlink"){for(let n of r.children)if(n.type==="run")for(let t of n.content)t.type==="text"&&(e+=t.text);}return e}function C(s,e){return {type:"run",formatting:e,content:[{type:"text",text:s}]}}function T(s,e,r,n){let t=[],o=0,i=false;for(let a of s.content)if(a.type==="run"){let c=a.content.filter(u=>u.type==="text").map(u=>u.text).join(""),p=o,l=o+c.length;if(!i&&e>=p&&e<=l){let u=e-p;u>0&&t.push({...a,content:[{type:"text",text:c.slice(0,u)}]}),t.push(C(r,n||a.formatting)),u<c.length&&t.push({...a,content:[{type:"text",text:c.slice(u)}]}),i=true;}else t.push(a);o=l;}else t.push(a);return i||t.push(C(r,n)),t}function y(s,e,r){let n=[],t=0;for(let o of s.content)if(o.type==="run"){let i=o.content.filter(p=>p.type==="text").map(p=>p.text).join(""),a=t,c=t+i.length;if(c<=e||a>=r)n.push(o);else {let p="";a<e&&(p+=i.slice(0,e-a)),c>r&&(p+=i.slice(r-a)),p.length>0&&n.push({...o,content:[{type:"text",text:p}]});}t=c;}else n.push(o);return n}function D(s,e,r,n){let t=[],o=0;for(let i of s.content)if(i.type==="run"){let a=i.content.filter(l=>l.type==="text").map(l=>l.text).join(""),c=o,p=o+a.length;if(p<=e||c>=r)t.push(i);else if(c>=e&&p<=r)t.push({...i,formatting:{...i.formatting,...n}});else {let l=Math.max(e,c),u=Math.min(r,p);c<l&&t.push({...i,content:[{type:"text",text:a.slice(0,l-c)}]}),t.push({...i,formatting:{...i.formatting,...n},content:[{type:"text",text:a.slice(l-c,u-c)}]}),p>u&&t.push({...i,content:[{type:"text",text:a.slice(u-c)}]});}o=p;}else t.push(i);return t}function E(s,e){let r=h(s),n=r.package.document,t=f(n,e.position.paragraphIndex);if(t===-1)throw new Error(`Paragraph index ${e.position.paragraphIndex} not found`);let o=n.content[t];return o.content=T(o,e.position.offset,e.text,e.formatting),r}function H(s,e){let r=h(s),n=r.package.document,{start:t,end:o}=e.range;if(t.paragraphIndex===o.paragraphIndex){let i=f(n,t.paragraphIndex);if(i===-1)throw new Error(`Paragraph index ${t.paragraphIndex} not found`);let a=n.content[i];a.content=y(a,t.offset,o.offset),a.content=T(a,t.offset,e.text,e.formatting);}else {let i=f(n,t.paragraphIndex),a=n.content[i],c=P(a);a.content=y(a,t.offset,c.length),a.content=T(a,t.offset,e.text,e.formatting);let p=[];for(let l=t.paragraphIndex+1;l<=o.paragraphIndex;l++)p.push(f(n,l));for(let l=p.length-1;l>=0;l--)p[l]!==-1&&n.content.splice(p[l],1);}return r}function $(s,e){let r=h(s),n=r.package.document,{start:t,end:o}=e.range;if(t.paragraphIndex===o.paragraphIndex){let i=f(n,t.paragraphIndex);if(i===-1)throw new Error(`Paragraph index ${t.paragraphIndex} not found`);let a=n.content[i];a.content=y(a,t.offset,o.offset);}else {let i=f(n,t.paragraphIndex),a=n.content[i],c=P(a);a.content=y(a,t.offset,c.length);let p=f(n,o.paragraphIndex),l=n.content[p];l.content=y(l,0,o.offset),a.content.push(...l.content);let u=[];for(let g=t.paragraphIndex+1;g<=o.paragraphIndex;g++)u.push(f(n,g));for(let g=u.length-1;g>=0;g--)u[g]!==-1&&n.content.splice(u[g],1);}return r}function S(s,e){let r=h(s),n=r.package.document,{start:t,end:o}=e.range;if(t.paragraphIndex===o.paragraphIndex){let i=f(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,o.offset,e.formatting);}else for(let i=t.paragraphIndex;i<=o.paragraphIndex;i++){let a=f(n,i);if(a===-1)continue;let c=n.content[a],p=P(c),l=0,u=p.length;i===t.paragraphIndex&&(l=t.offset),i===o.paragraphIndex&&(u=o.offset),c.content=D(c,l,u,e.formatting);}return r}function A(s,e){let r=h(s),n=r.package.document,t=f(n,e.paragraphIndex);if(t===-1)throw new Error(`Paragraph index ${e.paragraphIndex} not found`);let o=n.content[t];if(o.formatting={...o.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,c=i.numId===1,p=c?"\u2022":"1.";if(r.package.numbering){let l=r.package.numbering.nums.find(u=>u.numId===i.numId);if(l){let u=r.package.numbering.abstractNums.find(g=>g.abstractNumId===l.abstractNumId);if(u){let g=u.levels.find(d=>d.ilvl===a);g&&(p=g.lvlText||p);}}}o.listRendering={level:a,numId:i.numId,marker:p,isBullet:c};}else delete o.listRendering;}return r}function M(s,e){let r=h(s),n=r.package.document,t=f(n,e.paragraphIndex);if(t===-1)throw new Error(`Paragraph index ${e.paragraphIndex} not found`);let o=n.content[t];return o.formatting={...o.formatting,styleId:e.styleId},r}function B(s,e){let r=h(s),n=r.package.document,t=[];for(let a=0;a<e.rows;a++){let c=[];for(let p=0;p<e.columns;p++){let l=e.data?.[a]?.[p]||"";c.push({type:"tableCell",content:[{type:"paragraph",content:l?[C(l)]:[]}]});}t.push({type:"tableRow",formatting:a===0&&e.hasHeader?{header:true}:void 0,cells:c});}let o={type:"table",rows:t},i=f(n,e.position.paragraphIndex);return i===-1?n.content.push(o):n.content.splice(i+1,0,o),r}function V(s,e){let r=h(s),n=r.package.document,t=f(n,e.position.paragraphIndex);if(t===-1)throw new Error(`Paragraph index ${e.position.paragraphIndex} not found`);let o=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.width||100)*914400,height:(e.height||100)*914400},wrap:{type:"inline"}}}]},c=T(o,e.position.offset,"",void 0),p=false,l=0;for(let u=0;u<c.length;u++){let g=c[u];if(g.type==="run"){let d=g.content.filter(m=>m.type==="text").map(m=>m.text).join("");if(l+=d.length,!p&&l>=e.position.offset){c.splice(u+1,0,a),p=true;break}}}return p||c.push(a),o.content=c,r}function z(s,e){let r=h(s),n=r.package.document,{start:t,end:o}=e.range;if(t.paragraphIndex!==o.paragraphIndex)throw new Error("Hyperlinks cannot span multiple paragraphs");let i=f(n,t.paragraphIndex);if(i===-1)throw new Error(`Paragraph index ${t.paragraphIndex} not found`);let a=n.content[i],c=P(a),p=e.displayText||c.slice(t.offset,o.offset);a.content=y(a,t.offset,o.offset);let l={type:"hyperlink",href:e.url,tooltip:e.tooltip,children:[C(p)]},u=false,g=0,d=[];for(let m of a.content)if(m.type==="run"){let I=m.content.filter(x=>x.type==="text").map(x=>x.text).join(""),k=g+I.length;if(!u&&g<=t.offset&&t.offset<=k){let x=t.offset-g;x>0&&d.push({...m,content:[{type:"text",text:I.slice(0,x)}]}),d.push(l),x<I.length&&d.push({...m,content:[{type:"text",text:I.slice(x)}]}),u=true;}else d.push(m);g=k;}else d.push(m);return u||d.push(l),a.content=d,r}function F(s,e){let r=h(s),n=r.package.document,{start:t}=e.range,o=f(n,t.paragraphIndex);if(o===-1)throw new Error(`Paragraph index ${t.paragraphIndex} not found`);let i=n.content[o],a=[];for(let c of i.content)if(c.type==="hyperlink")for(let p of c.children)p.type==="run"&&a.push(p);else a.push(c);return i.content=a,r}function v(s,e){let r=h(s),n=r.package.document,t=f(n,e.position.paragraphIndex);if(t===-1)throw new Error(`Paragraph index ${e.position.paragraphIndex} not found`);let o=n.content[t],i=P(o),a=y({content:[...o.content]},e.position.offset,i.length),c=y({content:[...o.content]},0,e.position.offset);o.content=a;let p={type:"paragraph",formatting:o.formatting,content:c};return n.content.splice(t+1,0,p),r}function L(s,e){let r=h(s),n=r.package.document,t=f(n,e.paragraphIndex);if(t===-1)throw new Error(`Paragraph index ${e.paragraphIndex} not found`);let o=n.content[t],i=[];for(let a=1;a<=e.count;a++){let c=f(n,e.paragraphIndex+a);if(c!==-1){let p=n.content[c];o.content.push(...p.content),i.push(c);}}for(let a=i.length-1;a>=0;a--)n.content.splice(i[a],1);return r}function O(s,e){return v(s,{position:e.position})}function j(s,e){let r=h(s);return r.templateVariables||(r.templateVariables=[]),r.templateVariables.includes(e.name)||r.templateVariables.push(e.name),r}function N(s,e){let r=h(s),n=r.package.document;function t(a){for(let c of a.content)if(c.type==="text")for(let[p,l]of Object.entries(e.values)){let u=new RegExp(`\\{${p}\\}`,"g");c.text=c.text.replace(u,l);}}function o(a){for(let c of a.content)if(c.type==="run")t(c);else if(c.type==="hyperlink")for(let p of c.children)p.type==="run"&&t(p);}function i(a){if(a.type==="paragraph")o(a);else if(a.type==="table")for(let c of a.rows)for(let p of c.cells)for(let l of p.content)i(l);}for(let a of n.content)i(a);return r}exports.a=w;exports.b=b;exports.c=_;exports.d=J;exports.e=R;exports.f=G;
|
package/dist/chunk-G32OWQRD.mjs
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import {ba,ca,Q,R as R$1}from'./chunk-N2D5VYS3.mjs';function h(s){return s.type==="insertion"||s.type==="deletion"||s.type==="moveFrom"||s.type==="moveTo"}function x(s){let n=[];for(let o of s)o.type==="run"?n.push(Q(o)):o.type==="hyperlink"&&n.push(R$1(o));return n.join("")}function K(s,n){let o=0;for(let t of s.content)if(t.type==="paragraph"){if(o===n)return t;o++;}else if(t.type==="table"){for(let r of t.rows)for(let e of r.cells)for(let a of e.content)if(a.type==="paragraph"){if(o===n)return a;o++;}}else o++;throw new Error(`Paragraph index ${n} out of bounds (max: ${o-1})`)}function R(s,n){let o=0;for(let t of s.content)if(t.type==="paragraph"){if(n(t,o)===false)return;o++;}else if(t.type==="table"){for(let r of t.rows)for(let e of r.cells)for(let a of e.content)if(a.type==="paragraph"){if(n(a,o)===false)return;o++;}}else o++;}function V(s,n={}){let{fromIndex:o,toIndex:t,includeTrackedChanges:r=true,includeCommentAnchors:e=true}=n,a=[],i=0;for(let c of s.content)if(c.type==="paragraph")w(i,o,t)&&a.push(L(c,i,r,e)),i++;else if(c.type==="table"){w(i,o,t)&&a.push(H(c,i,r,e));for(let l of c.rows)for(let u of l.cells)for(let p of u.content)p.type==="paragraph"&&i++;}else i++;return a}function w(s,n,o){return (n===void 0||s>=n)&&(o===void 0||s<=o)}function L(s,n,o,t){let r=B(s,o,t),e=s.formatting?.styleId,a=s.paraId;return ba(e)?{type:"heading",index:n,paraId:a,level:ca(e)??1,text:r}:s.listRendering?{type:"list-item",index:n,paraId:a,text:r,listLevel:s.listRendering.level??0,listType:s.listRendering.isBullet?"bullet":"number"}:{type:"paragraph",index:n,paraId:a,text:r}}function H(s,n,o,t){let r=[],e=[];for(let a of s.rows){let i=[],c=[];for(let l of a.cells){let u=[],p;for(let g of l.content)g.type==="paragraph"&&(p===void 0&&(p=g.paraId),u.push(B(g,o,t)));i.push(u.join(`
|
|
2
|
-
`)),c.push(p);}r.push(i),e.push(c);}return {type:"table",index:n,rows:r,cellParaIds:e}}function Y(s){let n=[],o=t=>t.paraId?t.paraId:String(t.index);for(let t of s)switch(t.type){case "heading":n.push(`[${o(t)}] (h${t.level}) ${t.text}`);break;case "paragraph":n.push(`[${o(t)}] ${t.text}`);break;case "list-item":{let r=" ".repeat(t.listLevel),e=t.listType==="bullet"?"\u2022":"-";n.push(`[${o(t)}] ${r}${e} ${t.text}`);break}case "table":{let r=t.index;for(let e=0;e<t.rows.length;e++)for(let a=0;a<t.rows[e].length;a++){let c=t.rows[e][a].split(`
|
|
3
|
-
`),l=t.cellParaIds?.[e]?.[a];for(let u=0;u<c.length;u++){let p=u===0&&l?l:String(r);n.push(`[${p}] (table, row ${e+1}, col ${a+1}) ${c[u]}`),r++;}}break}}return n.join(`
|
|
4
|
-
`)}function B(s,n,o){let t=[],r=new Set;for(let e of s.content){if(e.type==="commentRangeStart"&&o){r.add(e.id),t.push(`[comment:${e.id}]`);continue}if(e.type==="commentRangeEnd"&&o){r.has(e.id)&&(r.delete(e.id),t.push("[/comment]"));continue}if(e.type==="run")t.push(Q(e));else if(e.type==="hyperlink")t.push(R$1(e));else if(h(e)){let a=x(e.content);e.type==="insertion"||e.type==="moveTo"?n&&t.push(`[+${a}+]{by:${e.info.author}}`):n?t.push(`[-${a}-]{by:${e.info.author}}`):t.push(a);}}return t.join("")}var y=class extends Error{constructor(n,o){let t=o!==void 0?` in paragraph ${o}`:" in document";super(`Text not found${t}: "${n}"`),this.name="TextNotFoundError";}},M=class extends Error{constructor(n){super(`Tracked change not found: id=${n}`),this.name="ChangeNotFoundError";}},F=class extends Error{constructor(n){super(`Comment not found: id=${n}`),this.name="CommentNotFoundError";}};function E(s){let n=[],o=0;for(let t=0;t<s.content.length;t++){let r=s.content[t];if(r.type==="run"){let e=Q(r);n.push({contentIndex:t,run:r,text:e,startPos:o}),o+=e.length;}else if(r.type==="hyperlink")for(let e=0;e<r.children.length;e++){let a=r.children[e];if(a.type==="run"){let i=Q(a);n.push({contentIndex:t,run:a,text:i,startPos:o}),o+=i.length;}}else if(h(r)){if(r.type==="insertion"||r.type==="moveTo")continue;for(let e=0;e<r.content.length;e++){let a=r.content[e];if(a.type==="run"){let i=Q(a);n.push({contentIndex:t,run:a,text:i,startPos:o}),o+=i.length;}else if(a.type==="hyperlink"){for(let i of a.children)if(i.type==="run"){let c=Q(i);n.push({contentIndex:t,run:i,text:c,startPos:o}),o+=c.length;}}}}}return n}function k(s){return E(s).map(n=>n.text).join("")}function G(s,n,o){let t=E(s),r=t.map(u=>u.text).join(""),e=W(r,n);if(!e)throw new y(n,o);let a=-1,i=0;for(let u=0;u<t.length;u++)if(e.start<t[u].startPos+t[u].text.length){a=u,i=e.start-t[u].startPos;break}let c=-1,l=0;for(let u=t.length-1;u>=0;u--)if(e.end>t[u].startPos){c=u,l=e.end-t[u].startPos;break}if(a===-1||c===-1)throw new y(n,o);return {startRunIndex:t[a].contentIndex,startOffset:i,endRunIndex:t[c].contentIndex,endOffset:l}}function te(s,n,o){let t=G(s,n,o),{startRunIndex:r,endRunIndex:e}=t,{startOffset:a,endOffset:i}=t,c=s.content[e];if(c.type==="run"){let u=Q(c);if(i<u.length){let p=D(u.slice(i),c);$(c,u.slice(0,i)),s.content.splice(e+1,0,p);}}let l=s.content[r];if(l.type==="run"&&a>0){let u=Q(l),p=D(u.slice(0,a),l);$(l,u.slice(a)),s.content.splice(r,0,p),r++,e++;}return {startIndex:r,endIndex:e}}function D(s,n){return {type:"run",content:[{type:"text",text:s}],formatting:n.formatting?{...n.formatting}:void 0}}function $(s,n){let o=s.content.find(t=>t.type==="text");o&&(o.text=n);}function O(s){let n=[],o=[],t=true;for(let r=0;r<s.length;r++){let e=s[r];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"){n.push(".",".","."),o.push(r,r,r),t=false;continue}if(/\s/.test(e)||e==="\xA0"){t||(n.push(" "),o.push(r),t=true);continue}n.push(e.toLowerCase()),o.push(r),t=false;}}return n.length>0&&n[n.length-1]===" "&&(n.pop(),o.pop()),{text:n.join(""),posMap:o}}function S(s,n,o,t){let r=s.posMap[n],e=s.posMap[n+o-1]+1;for(;e<t.length&&"\u200B\u200C\u200D\uFEFF\xAD".includes(t[e]);)e++;return {start:r,end:e}}function W(s,n){if(!n||!s)return null;let o=s.indexOf(n);if(o!==-1)return {start:o,end:o+n.length};let t=O(s),r=O(n);if(!r.text)return null;let e=t.text.indexOf(r.text);if(e!==-1)return S(t,e,r.text.length,s);let a=r.text.split(" ");if(a.length>=3)for(let i=1;i<=Math.min(2,a.length-2);i++){let c=a.slice(0,-i).join(" "),l=t.text.indexOf(c);if(l!==-1)return S(t,l,c.length,s)}return null}function se(s,n){let o=new Map;return R(s,(r,e)=>{let a=null;for(let i of r.content)if(h(i)){a===null&&(a=k(r));let c=x(i.content),l=i.info.id,u=o.get(l);u&&u.paragraphIndex===e?u.text+=c:o.set(l,{id:l,type:i.type,author:i.info.author,date:i.info.date??null,text:c,context:a,paragraphIndex:e});}}),Array.from(o.values()).filter(r=>!(n?.author&&r.author!==n.author||n?.type&&r.type!==n.type))}function ae(s,n){let o=s.comments??[];if(o.length===0)return [];let t=z(s),r=[],e=new Map;for(let i of o)if(i.parentId!==void 0){let c=e.get(i.parentId)??[];c.push(i),e.set(i.parentId,c);}else r.push(i);return r.map(i=>{let c=t.get(i.id),l=(e.get(i.id)??[]).map(u=>({id:u.id,author:u.author,date:u.date??null,text:A(u)}));return {id:i.id,author:i.author,date:i.date??null,text:A(i),anchoredText:c?.text??"",paragraphIndex:c?.paragraphIndex??-1,replies:l,done:i.done??false}}).filter(i=>!(n?.author&&i.author!==n.author||n?.done!==void 0&&i.done!==n.done))}function A(s){return s.content.map(n=>k(n)).join(`
|
|
5
|
-
`)}function z(s){let n=new Map,o=new Map;return R(s,(t,r)=>{for(let e of t.content)if(e.type==="commentRangeStart")o.set(e.id,{paragraphIndex:r,parts:[]});else if(e.type==="commentRangeEnd"){let a=o.get(e.id);a&&(n.set(e.id,{text:a.parts.join(""),paragraphIndex:a.paragraphIndex}),o.delete(e.id));}else if(e.type==="run"){let a=Q(e);for(let i of o.values())i.parts.push(a);}else if(e.type==="hyperlink"){let a=e.children.filter(i=>i.type==="run").map(Q).join("");for(let i of o.values())i.parts.push(a);}else if(h(e)){if(e.type==="insertion"||e.type==="moveTo")continue;let a=x(e.content);for(let i of o.values())i.parts.push(a);}}),n}function N(s){let n=s.toDocument().package?.document;if(!n)return new Map;let o=new Map,t=0;for(let r of n.content)if(r.type==="paragraph"){let e=r.paraId;e&&o.set(e,t),t++;}else if(r.type==="table")for(let e of r.rows)for(let a of e.cells)for(let i of a.content)i.type==="paragraph"&&t++;else t++;return o}function X(s){let n=[],o=t=>{for(let r of t.content)r.type==="text"&&n.push(r.text??"");};for(let t of s.content)if(t.type==="run")o(t);else if(t.type==="hyperlink")for(let r of t.children)r.type==="run"&&o(r);else if(t.type==="deletion"||t.type==="moveFrom"){for(let r of t.content)if(r.type==="run")o(r);else if(r.type==="hyperlink")for(let e of r.children)e.type==="run"&&o(e);}return n.join("")}function ce(s){let n=new Set,o=null;function t(){return o===null&&(o=N(s)),o}function r(){if(n.size===0)return;let e=s.getComments(),a=s.getChanges(),i={commentCount:e.length,changeCount:a.length,comments:e,changes:a};for(let c of n)try{c(i);}catch(l){console.error("reviewerBridge content listener threw:",l);}}return {getContentAsText(e){return s.getContentAsText(e)},getContent(e){return s.getContent(e)},getComments(e){return s.getComments(e)},getChanges(e){return s.getChanges(e)},findText(e,a){if(!e)return [];let i=a?.caseSensitive??false,c=a?.limit??20,l=i?e:e.toLowerCase(),u=s.toDocument().package?.document;if(!u)return [];let p=[],g=40;for(let P of u.content){if(p.length>=c)break;if(P.type!=="paragraph")continue;let C=P;if(!C.paraId)continue;let m=X(C),v=i?m:m.toLowerCase(),d=v.indexOf(l);if(d===-1||v.indexOf(l,d+1)!==-1)continue;let j=m.slice(d,d+e.length);p.push({paraId:C.paraId,match:j,before:m.slice(Math.max(0,d-g),d),after:m.slice(d+e.length,d+e.length+g)});}return p},getSelection(){return null},addComment(e){let a=t().get(e.paraId);if(a===void 0)return null;try{let i=s.addComment({paragraphIndex:a,text:e.text,author:e.author,search:e.search});return r(),i}catch{return null}},replyTo(e,a){try{let i=s.replyTo(e,a);return r(),i}catch{return null}},resolveComment(e){let i=s.toDocument().package?.document?.comments?.find(c=>c.id===e);i&&(i.done=true,r());},proposeChange(e){let a=t().get(e.paraId);if(a===void 0)return false;let i=e.search==="",c=e.replaceWith==="";if(i&&c)return false;try{return i?s.proposeInsertion({paragraphIndex:a,insertText:e.replaceWith,author:e.author}):c?s.proposeDeletion({paragraphIndex:a,search:e.search,author:e.author}):s.replace({paragraphIndex:a,search:e.search,replaceWith:e.replaceWith,author:e.author}),r(),true}catch{return false}},scrollTo(e){return t().has(e)},applyFormatting(){return false},setParagraphStyle(){return false},getPage(){return null},getPages(){return []},getTotalPages(){return 0},getCurrentPage(){return 0},onContentChange(e){return n.add(e),()=>{n.delete(e);}},onSelectionChange(){return ()=>{}}}}export{h as a,K as b,R as c,V as d,Y as e,y as f,M as g,F as h,G as i,te as j,se as k,ae as l,ce as m};
|