@eigenpal/docx-editor-agents 1.5.0 → 1.6.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/README.md +1 -1
- package/dist/ai-sdk/server.js +1 -1
- package/dist/ai-sdk/server.mjs +1 -1
- 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-HTMMNA3I.js → chunk-4C2IJ7OV.js} +20 -20
- package/dist/{chunk-XDZHYYU6.mjs → chunk-6RMDMHUK.mjs} +1 -1
- package/dist/{chunk-RI5S75JY.js → chunk-AO5SO6ZS.js} +4 -4
- package/dist/chunk-B56JZP3K.js +2 -0
- package/dist/{chunk-BFGKTTP7.mjs → chunk-CGBO6ID5.mjs} +1 -1
- package/dist/chunk-ICDWMZPG.mjs +75 -0
- package/dist/{chunk-HSVOT6AW.mjs → chunk-J773ZJGL.mjs} +5 -5
- package/dist/{chunk-EPRXZTIE.js → chunk-MMJQ47Q7.js} +1 -1
- package/dist/{chunk-24MVJKCP.mjs → chunk-MSKW7E36.mjs} +4 -4
- package/dist/{chunk-RYT33AHF.js → chunk-VAQTAQZG.js} +1 -1
- package/dist/chunk-WDPSOX2B.mjs +2 -0
- package/dist/{chunk-VPUAYS3Y.js → chunk-YU3OJ2DE.js} +5 -5
- package/dist/executor-3N3ESB3N.mjs +1 -0
- package/dist/executor-KLVHM2GK.js +1 -0
- package/dist/headless-BS5JJGVC.js +1 -0
- package/dist/{headless-6HFY6GHX.mjs → headless-GFPWSIA3.mjs} +1 -1
- package/dist/index.d.mts +3 -2
- package/dist/index.d.ts +3 -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/mcp.js +3 -3
- package/dist/mcp.mjs +3 -3
- package/dist/react.d.mts +8 -8
- package/dist/react.d.ts +8 -8
- package/dist/react.js +2 -2
- package/dist/react.mjs +1 -1
- package/dist/{server-D1vJRNf0.d.mts → server-DP8QoY84.d.mts} +22 -0
- package/dist/{server-D1vJRNf0.d.ts → server-DP8QoY84.d.ts} +22 -0
- 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/dist/vue.js +6 -6
- package/dist/vue.mjs +226 -179
- package/package.json +1 -1
- package/dist/chunk-3XKOKAHP.mjs +0 -75
- package/dist/chunk-4I6U7BWX.mjs +0 -2
- package/dist/chunk-UTMAYI7M.js +0 -2
- package/dist/executor-SBR6X4JZ.mjs +0 -1
- package/dist/executor-ZTSOZMKE.js +0 -1
- package/dist/headless-HVIRJIN4.js +0 -1
package/dist/react.d.mts
CHANGED
|
@@ -18,9 +18,9 @@
|
|
|
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-
|
|
22
|
-
export { t as getToolDisplayName } from './server-
|
|
23
|
-
import * as
|
|
21
|
+
import { r as EditorRefLike, k as AgentToolResult, q as getToolSchemas, j as AgentToolDefinition, s as AgentContextSnapshot } from './server-DP8QoY84.mjs';
|
|
22
|
+
export { t as getToolDisplayName } from './server-DP8QoY84.mjs';
|
|
23
|
+
import * as react from 'react';
|
|
24
24
|
import { ReactNode, CSSProperties } from 'react';
|
|
25
25
|
import { A as AgentMessage, a as AgentToolCall } from './agent-types-C8RvQB7n.mjs';
|
|
26
26
|
|
|
@@ -162,7 +162,7 @@ interface AgentPanelProps {
|
|
|
162
162
|
*/
|
|
163
163
|
closed?: boolean;
|
|
164
164
|
}
|
|
165
|
-
declare function AgentPanel({ title, icon, closeLabel, resizeHandleLabel, width: controlledWidth, defaultWidth, minWidth, maxWidth, onWidthChange, onClose, children, className, closed, }: AgentPanelProps):
|
|
165
|
+
declare function AgentPanel({ title, icon, closeLabel, resizeHandleLabel, width: controlledWidth, defaultWidth, minWidth, maxWidth, onWidthChange, onClose, children, className, closed, }: AgentPanelProps): react.JSX.Element;
|
|
166
166
|
|
|
167
167
|
interface AgentChatLogProps {
|
|
168
168
|
messages: AgentMessage[];
|
|
@@ -225,8 +225,8 @@ interface AgentTimelineProps {
|
|
|
225
225
|
* assistant text bubble. Auto-collapses when the turn finishes; click the
|
|
226
226
|
* summary row to re-expand.
|
|
227
227
|
*/
|
|
228
|
-
declare function AgentTimeline({ toolCalls, streaming, maxVisibleCalls, humanizeName, workingLabel, summaryLabel, earlierLabel, }: AgentTimelineProps):
|
|
229
|
-
declare function AgentChatLog({ messages, loading, error, emptyState, autoScroll, humanizeToolName, maxVisibleCalls, className, style, thinkingLabel, workingLabel, summaryLabel, earlierLabel, }: AgentChatLogProps):
|
|
228
|
+
declare function AgentTimeline({ toolCalls, streaming, maxVisibleCalls, humanizeName, workingLabel, summaryLabel, earlierLabel, }: AgentTimelineProps): react.JSX.Element | null;
|
|
229
|
+
declare function AgentChatLog({ messages, loading, error, emptyState, autoScroll, humanizeToolName, maxVisibleCalls, className, style, thinkingLabel, workingLabel, summaryLabel, earlierLabel, }: AgentChatLogProps): react.JSX.Element;
|
|
230
230
|
interface AgentComposerProps {
|
|
231
231
|
value: string;
|
|
232
232
|
onChange: (next: string) => void;
|
|
@@ -239,12 +239,12 @@ interface AgentComposerProps {
|
|
|
239
239
|
footnote?: ReactNode;
|
|
240
240
|
className?: string;
|
|
241
241
|
}
|
|
242
|
-
declare function AgentComposer({ value, onChange, onSubmit, disabled, placeholder, sendLabel, footnote, className, }: AgentComposerProps):
|
|
242
|
+
declare function AgentComposer({ value, onChange, onSubmit, disabled, placeholder, sendLabel, footnote, className, }: AgentComposerProps): react.JSX.Element;
|
|
243
243
|
interface AgentSuggestionChipProps {
|
|
244
244
|
label: string;
|
|
245
245
|
onClick: () => void;
|
|
246
246
|
disabled?: boolean;
|
|
247
247
|
}
|
|
248
|
-
declare function AgentSuggestionChip({ label, onClick, disabled }: AgentSuggestionChipProps):
|
|
248
|
+
declare function AgentSuggestionChip({ label, onClick, disabled }: AgentSuggestionChipProps): react.JSX.Element;
|
|
249
249
|
|
|
250
250
|
export { AgentChatLog, type AgentChatLogProps, AgentComposer, type AgentComposerProps, AgentContextSnapshot, AgentMessage, AgentPanel, type AgentPanelProps, AgentSuggestionChip, type AgentSuggestionChipProps, AgentTimeline, type AgentTimelineProps, AgentToolCall, AgentToolDefinition, AgentToolResult, EditorRefLike, type UseAgentChatOptions, type UseAgentChatReturn, type UseDocxAgentToolsOptions, type UseDocxAgentToolsReturn, useAgentChat, useDocxAgentTools };
|
package/dist/react.d.ts
CHANGED
|
@@ -18,9 +18,9 @@
|
|
|
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-
|
|
22
|
-
export { t as getToolDisplayName } from './server-
|
|
23
|
-
import * as
|
|
21
|
+
import { r as EditorRefLike, k as AgentToolResult, q as getToolSchemas, j as AgentToolDefinition, s as AgentContextSnapshot } from './server-DP8QoY84.js';
|
|
22
|
+
export { t as getToolDisplayName } from './server-DP8QoY84.js';
|
|
23
|
+
import * as react from 'react';
|
|
24
24
|
import { ReactNode, CSSProperties } from 'react';
|
|
25
25
|
import { A as AgentMessage, a as AgentToolCall } from './agent-types-C8RvQB7n.js';
|
|
26
26
|
|
|
@@ -162,7 +162,7 @@ interface AgentPanelProps {
|
|
|
162
162
|
*/
|
|
163
163
|
closed?: boolean;
|
|
164
164
|
}
|
|
165
|
-
declare function AgentPanel({ title, icon, closeLabel, resizeHandleLabel, width: controlledWidth, defaultWidth, minWidth, maxWidth, onWidthChange, onClose, children, className, closed, }: AgentPanelProps):
|
|
165
|
+
declare function AgentPanel({ title, icon, closeLabel, resizeHandleLabel, width: controlledWidth, defaultWidth, minWidth, maxWidth, onWidthChange, onClose, children, className, closed, }: AgentPanelProps): react.JSX.Element;
|
|
166
166
|
|
|
167
167
|
interface AgentChatLogProps {
|
|
168
168
|
messages: AgentMessage[];
|
|
@@ -225,8 +225,8 @@ interface AgentTimelineProps {
|
|
|
225
225
|
* assistant text bubble. Auto-collapses when the turn finishes; click the
|
|
226
226
|
* summary row to re-expand.
|
|
227
227
|
*/
|
|
228
|
-
declare function AgentTimeline({ toolCalls, streaming, maxVisibleCalls, humanizeName, workingLabel, summaryLabel, earlierLabel, }: AgentTimelineProps):
|
|
229
|
-
declare function AgentChatLog({ messages, loading, error, emptyState, autoScroll, humanizeToolName, maxVisibleCalls, className, style, thinkingLabel, workingLabel, summaryLabel, earlierLabel, }: AgentChatLogProps):
|
|
228
|
+
declare function AgentTimeline({ toolCalls, streaming, maxVisibleCalls, humanizeName, workingLabel, summaryLabel, earlierLabel, }: AgentTimelineProps): react.JSX.Element | null;
|
|
229
|
+
declare function AgentChatLog({ messages, loading, error, emptyState, autoScroll, humanizeToolName, maxVisibleCalls, className, style, thinkingLabel, workingLabel, summaryLabel, earlierLabel, }: AgentChatLogProps): react.JSX.Element;
|
|
230
230
|
interface AgentComposerProps {
|
|
231
231
|
value: string;
|
|
232
232
|
onChange: (next: string) => void;
|
|
@@ -239,12 +239,12 @@ interface AgentComposerProps {
|
|
|
239
239
|
footnote?: ReactNode;
|
|
240
240
|
className?: string;
|
|
241
241
|
}
|
|
242
|
-
declare function AgentComposer({ value, onChange, onSubmit, disabled, placeholder, sendLabel, footnote, className, }: AgentComposerProps):
|
|
242
|
+
declare function AgentComposer({ value, onChange, onSubmit, disabled, placeholder, sendLabel, footnote, className, }: AgentComposerProps): react.JSX.Element;
|
|
243
243
|
interface AgentSuggestionChipProps {
|
|
244
244
|
label: string;
|
|
245
245
|
onClick: () => void;
|
|
246
246
|
disabled?: boolean;
|
|
247
247
|
}
|
|
248
|
-
declare function AgentSuggestionChip({ label, onClick, disabled }: AgentSuggestionChipProps):
|
|
248
|
+
declare function AgentSuggestionChip({ label, onClick, disabled }: AgentSuggestionChipProps): react.JSX.Element;
|
|
249
249
|
|
|
250
250
|
export { AgentChatLog, type AgentChatLogProps, AgentComposer, type AgentComposerProps, AgentContextSnapshot, AgentMessage, AgentPanel, type AgentPanelProps, AgentSuggestionChip, type AgentSuggestionChipProps, AgentTimeline, type AgentTimelineProps, AgentToolCall, AgentToolDefinition, AgentToolResult, EditorRefLike, type UseAgentChatOptions, type UseAgentChatReturn, type UseDocxAgentToolsOptions, type UseDocxAgentToolsReturn, useAgentChat, useDocxAgentTools };
|
package/dist/react.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var chunkB56JZP3K_js=require('./chunk-B56JZP3K.js'),chunkAO5SO6ZS_js=require('./chunk-AO5SO6ZS.js'),react=require('react'),jsxRuntime=require('react/jsx-runtime');var te=chunkAO5SO6ZS_js.d();function ne(e){let{editorRef:t,author:l="AI"}=e,c=react.useMemo(()=>({get:()=>t.current?chunkB56JZP3K_js.a(t.current,l):null}),[t,l]);return {executeToolCall:react.useCallback((d,p)=>{let r=c.get();return r?chunkAO5SO6ZS_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?chunkAO5SO6ZS_js.a.filter(n=>r(n.name)):chunkAO5SO6ZS_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=chunkB56JZP3K_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)?chunkAO5SO6ZS_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=chunkB56JZP3K_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; }
|
|
@@ -6,4 +6,4 @@
|
|
|
6
6
|
@keyframes epAgentSpin {
|
|
7
7
|
to { transform: rotate(360deg); }
|
|
8
8
|
}
|
|
9
|
-
`;function Te(){react.useEffect(()=>{if(typeof document>"u"||document.getElementById(j))return;let e=document.createElement("style");e.id=j,e.textContent=Ce,document.head.appendChild(e);},[]);}var ke=3;function K({toolCalls:e,streaming:t,maxVisibleCalls:l=ke,humanizeName:c=V,workingLabel:u=ye,summaryLabel:d=Ae,earlierLabel:p=Se}){let[r,f]=react.useState(null),g=r??!!t;if(e.length===0)return null;let x=t?u(e.length):d(e.length),i=e.slice(-l),o=Math.max(0,e.length-i.length);return jsxRuntime.jsxs("div",{style:s.timelineWrap,"data-testid":"agent-timeline",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>f(!g),"aria-expanded":g,style:s.timelineHeader,"data-testid":"agent-timeline-toggle",children:[jsxRuntime.jsxs("span",{style:s.timelineSummary,children:[t?jsxRuntime.jsx(X,{}):jsxRuntime.jsx(ve,{}),x]}),jsxRuntime.jsx("span",{style:{...s.timelineChevron,transform:g?"rotate(180deg)":"rotate(0deg)"},"aria-hidden":"true",children:"\u25BE"})]}),g&&jsxRuntime.jsxs("ol",{style:s.timelineList,children:[o>0&&jsxRuntime.jsx("li",{style:s.timelineMore,"data-testid":"agent-timeline-earlier",children:p(o)}),i.map(n=>jsxRuntime.jsxs("li",{style:s.timelineItem,children:[n.status==="running"?jsxRuntime.jsx(X,{size:10,compact:true}):jsxRuntime.jsx("span",{style:{...s.timelineDot,background:n.status==="error"?"#d93025":"#1e8e3e"},"aria-hidden":"true"}),jsxRuntime.jsxs("span",{style:s.timelineCall,children:[jsxRuntime.jsx("span",{style:s.timelineCallName,children:c(n.name)}),n.error&&jsxRuntime.jsx("span",{style:s.timelineError,children:n.error})]})]},n.id))]})]})}function X({size:e=12,compact:t=false}={}){return jsxRuntime.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",style:{marginRight:t?0:6,animation:"epAgentSpin 0.8s linear infinite",flexShrink:0},"aria-hidden":"true",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"9",stroke:"#dadce0",strokeWidth:"3",fill:"none"}),jsxRuntime.jsx("path",{d:"M21 12a9 9 0 0 0-9-9",stroke:"#0b57d0",strokeWidth:"3",strokeLinecap:"round"})]})}function ve(){return jsxRuntime.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",style:{marginRight:6},children:jsxRuntime.jsx("path",{d:"M5 13l4 4L19 7",stroke:"#1e8e3e",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function we({messages:e,loading:t,error:l,emptyState:c,autoScroll:u=true,humanizeToolName:d,maxVisibleCalls:p,className:r,style:f,thinkingLabel:g=xe,workingLabel:x,summaryLabel:i,earlierLabel:o}){Te();let n=react.useRef(null),C=e[e.length-1],k=C?.toolCalls?.length??0,T=C?.status==="streaming";react.useEffect(()=>{u&&n.current?.scrollIntoView({behavior:T||t?"auto":"smooth",block:"end"});},[e.length,k,t,T,u]);let L=e.length===0&&!t&&!l;return jsxRuntime.jsxs("div",{className:`ep-agent-chat-log${r?` ${r}`:""}`,style:{flex:1,overflow:"auto",padding:"16px 14px 8px",display:"flex",flexDirection:"column",gap:10,...f},children:[L&&c,e.map(h=>{let E=h.role==="assistant"&&h.toolCalls&&h.toolCalls.length>0,v=h.text.length>0;return jsxRuntime.jsxs("div",{style:s.messageGroup,"data-role":h.role,children:[E&&jsxRuntime.jsx(K,{toolCalls:h.toolCalls,streaming:h.status==="streaming",humanizeName:d,maxVisibleCalls:p,workingLabel:x,summaryLabel:i,earlierLabel:o}),v&&jsxRuntime.jsx("div",{style:h.role==="user"?s.userBubble:s.assistantBubble,children:h.text})]},h.id)}),t&&jsxRuntime.jsxs("div",{style:s.thinkingBubble,"aria-label":g,children:[jsxRuntime.jsx("span",{style:{...s.dot,animationDelay:"0s"}}),jsxRuntime.jsx("span",{style:{...s.dot,animationDelay:"0.15s"}}),jsxRuntime.jsx("span",{style:{...s.dot,animationDelay:"0.3s"}})]}),l&&jsxRuntime.jsx("div",{style:s.errorBubble,role:"alert",children:l}),jsxRuntime.jsx("div",{ref:n})]})}function Re({value:e,onChange:t,onSubmit:l,disabled:c,placeholder:u=he,sendLabel:d=be,footnote:p,className:r}){let f=u,g=e.trim().length>0&&!c;return jsxRuntime.jsxs("form",{onSubmit:i=>{i.preventDefault(),g&&l();},className:`ep-agent-composer${r?` ${r}`:""}`,style:s.composerWrap,children:[jsxRuntime.jsxs("div",{style:s.composerShell,children:[jsxRuntime.jsx("input",{style:s.composerInput,value:e,onChange:i=>t(i.target.value),placeholder:f,disabled:c}),jsxRuntime.jsx("button",{type:"submit","aria-label":d,disabled:!g,style:{...s.sendBtn,opacity:g?1:.35,cursor:g?"pointer":"not-allowed"},children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:jsxRuntime.jsx("path",{d:"M12 19V5M5 12l7-7 7 7",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]}),p&&jsxRuntime.jsx("div",{style:s.footnote,children:p})]})}function Le({label:e,onClick:t,disabled:l}){return jsxRuntime.jsx("button",{type:"button",style:s.chip,onClick:t,disabled:l,children:e})}var s={messageGroup:{display:"flex",flexDirection:"column",gap:6,width:"100%"},userBubble:{background:"#0b57d0",color:"#fff",padding:"10px 14px",borderRadius:"20px 20px 4px 20px",fontSize:13.5,lineHeight:1.5,alignSelf:"flex-end",maxWidth:"88%",whiteSpace:"pre-wrap",wordBreak:"break-word",fontFamily:"'Google Sans', 'Google Sans Text', system-ui, -apple-system, sans-serif"},assistantBubble:{background:"#f0f4f9",color:"#1f1f1f",padding:"12px 16px",borderRadius:"20px 20px 20px 4px",fontSize:13.5,lineHeight:1.55,alignSelf:"flex-start",maxWidth:"92%",whiteSpace:"pre-wrap",wordBreak:"break-word",fontFamily:"'Google Sans', 'Google Sans Text', system-ui, -apple-system, sans-serif"},thinkingBubble:{background:"#f0f4f9",padding:"12px 16px",borderRadius:"20px 20px 20px 4px",alignSelf:"flex-start",display:"flex",gap:4,alignItems:"center"},dot:{width:6,height:6,borderRadius:"50%",background:"#5f6368",display:"inline-block",animation:"epAgentDot 1.4s infinite ease-in-out"},errorBubble:{background:"#fce8e6",color:"#b3261e",padding:"10px 14px",borderRadius:16,fontSize:12.5,alignSelf:"flex-start",maxWidth:"92%",whiteSpace:"pre-wrap",fontFamily:"'Google Sans Text', system-ui, sans-serif"},composerWrap:{padding:"8px 12px 14px",background:"#fff",flex:"0 0 auto"},composerShell:{display:"flex",alignItems:"center",gap:4,padding:"6px 6px 6px 18px",background:"#fff",border:"1px solid #c4c7c5",borderRadius:28,boxShadow:"0 1px 2px rgba(60,64,67,0.04)",transition:"border-color 0.15s, box-shadow 0.15s",fontFamily:"'Google Sans Text', system-ui, sans-serif"},composerInput:{flex:1,padding:"8px 0",fontSize:14,border:"none",outline:"none",background:"transparent",fontFamily:"inherit",color:"#1f1f1f"},sendBtn:{width:36,height:36,borderRadius:"50%",border:"none",background:"#0b57d0",color:"#fff",flexShrink:0,display:"inline-flex",alignItems:"center",justifyContent:"center",transition:"background 0.15s, opacity 0.15s, transform 0.15s"},footnote:{fontSize:11,color:"#5f6368",textAlign:"center",marginTop:10,fontFamily:"'Google Sans Text', system-ui, sans-serif"},chip:{textAlign:"left",background:"#fff",border:"1px solid #dadce0",borderRadius:18,padding:"10px 14px",fontSize:13,color:"#1f1f1f",cursor:"pointer",fontFamily:"'Google Sans Text', system-ui, sans-serif",lineHeight:1.4,transition:"background 0.15s, border-color 0.15s, box-shadow 0.15s",width:"100%"},timelineWrap:{alignSelf:"flex-start",maxWidth:"92%",background:"#fff",border:"1px solid #e1e3e6",borderRadius:12,overflow:"hidden",fontFamily:"'Google Sans Text', system-ui, sans-serif"},timelineHeader:{display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%",padding:"8px 12px",background:"transparent",border:"none",cursor:"pointer",fontSize:12.5,color:"#1f1f1f",fontFamily:"inherit"},timelineSummary:{display:"inline-flex",alignItems:"center",fontWeight:500},timelineChevron:{fontSize:12,color:"#5f6368",transition:"transform 0.15s ease",marginLeft:8},timelineList:{listStyle:"none",margin:0,padding:"4px 12px 10px 12px",display:"flex",flexDirection:"column",gap:6,borderTop:"1px solid #ececf0"},timelineItem:{display:"flex",alignItems:"center",gap:8,fontSize:12,color:"#444746"},timelineDot:{width:6,height:6,borderRadius:"50%",flexShrink:0},timelineCall:{display:"inline-flex",flexDirection:"column",minWidth:0},timelineCallName:{color:"#1f1f1f"},timelineError:{color:"#d93025",fontSize:11},timelineMore:{fontSize:11,color:"#5f6368",fontStyle:"italic",paddingLeft:14}};Object.defineProperty(exports,"getToolDisplayName",{enumerable:true,get:function(){return
|
|
9
|
+
`;function Te(){react.useEffect(()=>{if(typeof document>"u"||document.getElementById(j))return;let e=document.createElement("style");e.id=j,e.textContent=Ce,document.head.appendChild(e);},[]);}var ke=3;function K({toolCalls:e,streaming:t,maxVisibleCalls:l=ke,humanizeName:c=V,workingLabel:u=ye,summaryLabel:d=Ae,earlierLabel:p=Se}){let[r,f]=react.useState(null),g=r??!!t;if(e.length===0)return null;let x=t?u(e.length):d(e.length),i=e.slice(-l),o=Math.max(0,e.length-i.length);return jsxRuntime.jsxs("div",{style:s.timelineWrap,"data-testid":"agent-timeline",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>f(!g),"aria-expanded":g,style:s.timelineHeader,"data-testid":"agent-timeline-toggle",children:[jsxRuntime.jsxs("span",{style:s.timelineSummary,children:[t?jsxRuntime.jsx(X,{}):jsxRuntime.jsx(ve,{}),x]}),jsxRuntime.jsx("span",{style:{...s.timelineChevron,transform:g?"rotate(180deg)":"rotate(0deg)"},"aria-hidden":"true",children:"\u25BE"})]}),g&&jsxRuntime.jsxs("ol",{style:s.timelineList,children:[o>0&&jsxRuntime.jsx("li",{style:s.timelineMore,"data-testid":"agent-timeline-earlier",children:p(o)}),i.map(n=>jsxRuntime.jsxs("li",{style:s.timelineItem,children:[n.status==="running"?jsxRuntime.jsx(X,{size:10,compact:true}):jsxRuntime.jsx("span",{style:{...s.timelineDot,background:n.status==="error"?"#d93025":"#1e8e3e"},"aria-hidden":"true"}),jsxRuntime.jsxs("span",{style:s.timelineCall,children:[jsxRuntime.jsx("span",{style:s.timelineCallName,children:c(n.name)}),n.error&&jsxRuntime.jsx("span",{style:s.timelineError,children:n.error})]})]},n.id))]})]})}function X({size:e=12,compact:t=false}={}){return jsxRuntime.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",style:{marginRight:t?0:6,animation:"epAgentSpin 0.8s linear infinite",flexShrink:0},"aria-hidden":"true",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"9",stroke:"#dadce0",strokeWidth:"3",fill:"none"}),jsxRuntime.jsx("path",{d:"M21 12a9 9 0 0 0-9-9",stroke:"#0b57d0",strokeWidth:"3",strokeLinecap:"round"})]})}function ve(){return jsxRuntime.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",style:{marginRight:6},children:jsxRuntime.jsx("path",{d:"M5 13l4 4L19 7",stroke:"#1e8e3e",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function we({messages:e,loading:t,error:l,emptyState:c,autoScroll:u=true,humanizeToolName:d,maxVisibleCalls:p,className:r,style:f,thinkingLabel:g=xe,workingLabel:x,summaryLabel:i,earlierLabel:o}){Te();let n=react.useRef(null),C=e[e.length-1],k=C?.toolCalls?.length??0,T=C?.status==="streaming";react.useEffect(()=>{u&&n.current?.scrollIntoView({behavior:T||t?"auto":"smooth",block:"end"});},[e.length,k,t,T,u]);let L=e.length===0&&!t&&!l;return jsxRuntime.jsxs("div",{className:`ep-agent-chat-log${r?` ${r}`:""}`,style:{flex:1,overflow:"auto",padding:"16px 14px 8px",display:"flex",flexDirection:"column",gap:10,...f},children:[L&&c,e.map(h=>{let E=h.role==="assistant"&&h.toolCalls&&h.toolCalls.length>0,v=h.text.length>0;return jsxRuntime.jsxs("div",{style:s.messageGroup,"data-role":h.role,children:[E&&jsxRuntime.jsx(K,{toolCalls:h.toolCalls,streaming:h.status==="streaming",humanizeName:d,maxVisibleCalls:p,workingLabel:x,summaryLabel:i,earlierLabel:o}),v&&jsxRuntime.jsx("div",{style:h.role==="user"?s.userBubble:s.assistantBubble,children:h.text})]},h.id)}),t&&jsxRuntime.jsxs("div",{style:s.thinkingBubble,"aria-label":g,children:[jsxRuntime.jsx("span",{style:{...s.dot,animationDelay:"0s"}}),jsxRuntime.jsx("span",{style:{...s.dot,animationDelay:"0.15s"}}),jsxRuntime.jsx("span",{style:{...s.dot,animationDelay:"0.3s"}})]}),l&&jsxRuntime.jsx("div",{style:s.errorBubble,role:"alert",children:l}),jsxRuntime.jsx("div",{ref:n})]})}function Re({value:e,onChange:t,onSubmit:l,disabled:c,placeholder:u=he,sendLabel:d=be,footnote:p,className:r}){let f=u,g=e.trim().length>0&&!c;return jsxRuntime.jsxs("form",{onSubmit:i=>{i.preventDefault(),g&&l();},className:`ep-agent-composer${r?` ${r}`:""}`,style:s.composerWrap,children:[jsxRuntime.jsxs("div",{style:s.composerShell,children:[jsxRuntime.jsx("input",{style:s.composerInput,value:e,onChange:i=>t(i.target.value),placeholder:f,disabled:c}),jsxRuntime.jsx("button",{type:"submit","aria-label":d,disabled:!g,style:{...s.sendBtn,opacity:g?1:.35,cursor:g?"pointer":"not-allowed"},children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:jsxRuntime.jsx("path",{d:"M12 19V5M5 12l7-7 7 7",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]}),p&&jsxRuntime.jsx("div",{style:s.footnote,children:p})]})}function Le({label:e,onClick:t,disabled:l}){return jsxRuntime.jsx("button",{type:"button",style:s.chip,onClick:t,disabled:l,children:e})}var s={messageGroup:{display:"flex",flexDirection:"column",gap:6,width:"100%"},userBubble:{background:"#0b57d0",color:"#fff",padding:"10px 14px",borderRadius:"20px 20px 4px 20px",fontSize:13.5,lineHeight:1.5,alignSelf:"flex-end",maxWidth:"88%",whiteSpace:"pre-wrap",wordBreak:"break-word",fontFamily:"'Google Sans', 'Google Sans Text', system-ui, -apple-system, sans-serif"},assistantBubble:{background:"#f0f4f9",color:"#1f1f1f",padding:"12px 16px",borderRadius:"20px 20px 20px 4px",fontSize:13.5,lineHeight:1.55,alignSelf:"flex-start",maxWidth:"92%",whiteSpace:"pre-wrap",wordBreak:"break-word",fontFamily:"'Google Sans', 'Google Sans Text', system-ui, -apple-system, sans-serif"},thinkingBubble:{background:"#f0f4f9",padding:"12px 16px",borderRadius:"20px 20px 20px 4px",alignSelf:"flex-start",display:"flex",gap:4,alignItems:"center"},dot:{width:6,height:6,borderRadius:"50%",background:"#5f6368",display:"inline-block",animation:"epAgentDot 1.4s infinite ease-in-out"},errorBubble:{background:"#fce8e6",color:"#b3261e",padding:"10px 14px",borderRadius:16,fontSize:12.5,alignSelf:"flex-start",maxWidth:"92%",whiteSpace:"pre-wrap",fontFamily:"'Google Sans Text', system-ui, sans-serif"},composerWrap:{padding:"8px 12px 14px",background:"#fff",flex:"0 0 auto"},composerShell:{display:"flex",alignItems:"center",gap:4,padding:"6px 6px 6px 18px",background:"#fff",border:"1px solid #c4c7c5",borderRadius:28,boxShadow:"0 1px 2px rgba(60,64,67,0.04)",transition:"border-color 0.15s, box-shadow 0.15s",fontFamily:"'Google Sans Text', system-ui, sans-serif"},composerInput:{flex:1,padding:"8px 0",fontSize:14,border:"none",outline:"none",background:"transparent",fontFamily:"inherit",color:"#1f1f1f"},sendBtn:{width:36,height:36,borderRadius:"50%",border:"none",background:"#0b57d0",color:"#fff",flexShrink:0,display:"inline-flex",alignItems:"center",justifyContent:"center",transition:"background 0.15s, opacity 0.15s, transform 0.15s"},footnote:{fontSize:11,color:"#5f6368",textAlign:"center",marginTop:10,fontFamily:"'Google Sans Text', system-ui, sans-serif"},chip:{textAlign:"left",background:"#fff",border:"1px solid #dadce0",borderRadius:18,padding:"10px 14px",fontSize:13,color:"#1f1f1f",cursor:"pointer",fontFamily:"'Google Sans Text', system-ui, sans-serif",lineHeight:1.4,transition:"background 0.15s, border-color 0.15s, box-shadow 0.15s",width:"100%"},timelineWrap:{alignSelf:"flex-start",maxWidth:"92%",background:"#fff",border:"1px solid #e1e3e6",borderRadius:12,overflow:"hidden",fontFamily:"'Google Sans Text', system-ui, sans-serif"},timelineHeader:{display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%",padding:"8px 12px",background:"transparent",border:"none",cursor:"pointer",fontSize:12.5,color:"#1f1f1f",fontFamily:"inherit"},timelineSummary:{display:"inline-flex",alignItems:"center",fontWeight:500},timelineChevron:{fontSize:12,color:"#5f6368",transition:"transform 0.15s ease",marginLeft:8},timelineList:{listStyle:"none",margin:0,padding:"4px 12px 10px 12px",display:"flex",flexDirection:"column",gap:6,borderTop:"1px solid #ececf0"},timelineItem:{display:"flex",alignItems:"center",gap:8,fontSize:12,color:"#444746"},timelineDot:{width:6,height:6,borderRadius:"50%",flexShrink:0},timelineCall:{display:"inline-flex",flexDirection:"column",minWidth:0},timelineCallName:{color:"#1f1f1f"},timelineError:{color:"#d93025",fontSize:11},timelineMore:{fontSize:11,color:"#5f6368",fontStyle:"italic",paddingLeft:14}};Object.defineProperty(exports,"getToolDisplayName",{enumerable:true,get:function(){return chunkAO5SO6ZS_js.c}});exports.AgentChatLog=we;exports.AgentComposer=Re;exports.AgentPanel=pe;exports.AgentSuggestionChip=Le;exports.AgentTimeline=K;exports.useAgentChat=ne;exports.useDocxAgentTools=re;
|
package/dist/react.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {a}from'./chunk-
|
|
1
|
+
import {a}from'./chunk-WDPSOX2B.mjs';import {d,b,a as a$1}from'./chunk-MSKW7E36.mjs';export{c as getToolDisplayName}from'./chunk-MSKW7E36.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; }
|
|
@@ -2512,6 +2512,17 @@ interface SetParagraphStyleOptions {
|
|
|
2512
2512
|
paraId: string;
|
|
2513
2513
|
styleId: string;
|
|
2514
2514
|
}
|
|
2515
|
+
/** Kind of break `insertBreak` inserts after a paragraph. */
|
|
2516
|
+
type BreakType = 'page' | 'sectionNextPage' | 'sectionContinuous';
|
|
2517
|
+
/**
|
|
2518
|
+
* Insert a page or section break after the paragraph identified by `paraId`.
|
|
2519
|
+
* `page` adds a page break; `sectionNextPage` starts a new section on a new
|
|
2520
|
+
* page; `sectionContinuous` starts a new section on the same page.
|
|
2521
|
+
*/
|
|
2522
|
+
interface InsertBreakOptions {
|
|
2523
|
+
paraId: string;
|
|
2524
|
+
type: BreakType;
|
|
2525
|
+
}
|
|
2515
2526
|
/** A single paragraph anchored on a page (returned by `getPage` / `getPages`). */
|
|
2516
2527
|
interface PageParagraph {
|
|
2517
2528
|
paraId: string;
|
|
@@ -2790,6 +2801,11 @@ interface EditorRefLike {
|
|
|
2790
2801
|
paraId: string;
|
|
2791
2802
|
styleId: string;
|
|
2792
2803
|
}): boolean;
|
|
2804
|
+
/** Insert a page or section break after the paragraph. Returns false if paraId is unknown. */
|
|
2805
|
+
insertBreak(options: {
|
|
2806
|
+
paraId: string;
|
|
2807
|
+
type: 'page' | 'sectionNextPage' | 'sectionContinuous';
|
|
2808
|
+
}): boolean;
|
|
2793
2809
|
/** Read a single page's paragraphs (1-indexed). Returns null if the page does not exist. */
|
|
2794
2810
|
getPageContent(pageNumber: number): PageContent | null;
|
|
2795
2811
|
/** Total number of pages currently rendered. */
|
|
@@ -2841,6 +2857,12 @@ interface EditorBridge {
|
|
|
2841
2857
|
* Direct edit, not a tracked change.
|
|
2842
2858
|
*/
|
|
2843
2859
|
setParagraphStyle(options: SetParagraphStyleOptions): boolean;
|
|
2860
|
+
/**
|
|
2861
|
+
* Insert a page or section break after a paragraph, by paraId. `page` adds a
|
|
2862
|
+
* page break; `sectionNextPage` / `sectionContinuous` start a new section on
|
|
2863
|
+
* a new page / the same page. Direct edit, not a tracked change.
|
|
2864
|
+
*/
|
|
2865
|
+
insertBreak(options: InsertBreakOptions): boolean;
|
|
2844
2866
|
/** Read a single page (1-indexed). Returns null if the page does not exist. */
|
|
2845
2867
|
getPage(pageNumber: number): PageContent | null;
|
|
2846
2868
|
/** Read a range of pages (1-indexed, inclusive). Out-of-range pages are skipped. */
|
|
@@ -2512,6 +2512,17 @@ interface SetParagraphStyleOptions {
|
|
|
2512
2512
|
paraId: string;
|
|
2513
2513
|
styleId: string;
|
|
2514
2514
|
}
|
|
2515
|
+
/** Kind of break `insertBreak` inserts after a paragraph. */
|
|
2516
|
+
type BreakType = 'page' | 'sectionNextPage' | 'sectionContinuous';
|
|
2517
|
+
/**
|
|
2518
|
+
* Insert a page or section break after the paragraph identified by `paraId`.
|
|
2519
|
+
* `page` adds a page break; `sectionNextPage` starts a new section on a new
|
|
2520
|
+
* page; `sectionContinuous` starts a new section on the same page.
|
|
2521
|
+
*/
|
|
2522
|
+
interface InsertBreakOptions {
|
|
2523
|
+
paraId: string;
|
|
2524
|
+
type: BreakType;
|
|
2525
|
+
}
|
|
2515
2526
|
/** A single paragraph anchored on a page (returned by `getPage` / `getPages`). */
|
|
2516
2527
|
interface PageParagraph {
|
|
2517
2528
|
paraId: string;
|
|
@@ -2790,6 +2801,11 @@ interface EditorRefLike {
|
|
|
2790
2801
|
paraId: string;
|
|
2791
2802
|
styleId: string;
|
|
2792
2803
|
}): boolean;
|
|
2804
|
+
/** Insert a page or section break after the paragraph. Returns false if paraId is unknown. */
|
|
2805
|
+
insertBreak(options: {
|
|
2806
|
+
paraId: string;
|
|
2807
|
+
type: 'page' | 'sectionNextPage' | 'sectionContinuous';
|
|
2808
|
+
}): boolean;
|
|
2793
2809
|
/** Read a single page's paragraphs (1-indexed). Returns null if the page does not exist. */
|
|
2794
2810
|
getPageContent(pageNumber: number): PageContent | null;
|
|
2795
2811
|
/** Total number of pages currently rendered. */
|
|
@@ -2841,6 +2857,12 @@ interface EditorBridge {
|
|
|
2841
2857
|
* Direct edit, not a tracked change.
|
|
2842
2858
|
*/
|
|
2843
2859
|
setParagraphStyle(options: SetParagraphStyleOptions): boolean;
|
|
2860
|
+
/**
|
|
2861
|
+
* Insert a page or section break after a paragraph, by paraId. `page` adds a
|
|
2862
|
+
* page break; `sectionNextPage` / `sectionContinuous` start a new section on
|
|
2863
|
+
* a new page / the same page. Direct edit, not a tracked change.
|
|
2864
|
+
*/
|
|
2865
|
+
insertBreak(options: InsertBreakOptions): boolean;
|
|
2844
2866
|
/** Read a single page (1-indexed). Returns null if the page does not exist. */
|
|
2845
2867
|
getPage(pageNumber: number): PageContent | null;
|
|
2846
2868
|
/** Read a range of pages (1-indexed, inclusive). Out-of-range pages are skipped. */
|
package/dist/server.d.mts
CHANGED
|
@@ -31,4 +31,4 @@
|
|
|
31
31
|
* @packageDocumentation
|
|
32
32
|
* @public
|
|
33
33
|
*/
|
|
34
|
-
export { s as AgentContextSnapshot, j as AgentToolDefinition, k as AgentToolResult, D as DocxReviewer, E as EditorBridge, S as SelectionInfo, o as createReviewerBridge, n as docxAgentTools, p as executeToolCall, t as getToolDisplayName, q as getToolSchemas } from './server-
|
|
34
|
+
export { s as AgentContextSnapshot, j as AgentToolDefinition, k as AgentToolResult, D as DocxReviewer, E as EditorBridge, S as SelectionInfo, o as createReviewerBridge, n as docxAgentTools, p as executeToolCall, t as getToolDisplayName, q as getToolSchemas } from './server-DP8QoY84.mjs';
|
package/dist/server.d.ts
CHANGED
|
@@ -31,4 +31,4 @@
|
|
|
31
31
|
* @packageDocumentation
|
|
32
32
|
* @public
|
|
33
33
|
*/
|
|
34
|
-
export { s as AgentContextSnapshot, j as AgentToolDefinition, k as AgentToolResult, D as DocxReviewer, E as EditorBridge, S as SelectionInfo, o as createReviewerBridge, n as docxAgentTools, p as executeToolCall, t as getToolDisplayName, q as getToolSchemas } from './server-
|
|
34
|
+
export { s as AgentContextSnapshot, j as AgentToolDefinition, k as AgentToolResult, D as DocxReviewer, E as EditorBridge, S as SelectionInfo, o as createReviewerBridge, n as docxAgentTools, p as executeToolCall, t as getToolDisplayName, q as getToolSchemas } from './server-DP8QoY84.js';
|
package/dist/server.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var chunkVAQTAQZG_js=require('./chunk-VAQTAQZG.js'),chunkYU3OJ2DE_js=require('./chunk-YU3OJ2DE.js'),chunkAO5SO6ZS_js=require('./chunk-AO5SO6ZS.js');Object.defineProperty(exports,"DocxReviewer",{enumerable:true,get:function(){return chunkVAQTAQZG_js.a}});Object.defineProperty(exports,"createReviewerBridge",{enumerable:true,get:function(){return chunkYU3OJ2DE_js.n}});Object.defineProperty(exports,"docxAgentTools",{enumerable:true,get:function(){return chunkAO5SO6ZS_js.a}});Object.defineProperty(exports,"executeToolCall",{enumerable:true,get:function(){return chunkAO5SO6ZS_js.b}});Object.defineProperty(exports,"getToolDisplayName",{enumerable:true,get:function(){return chunkAO5SO6ZS_js.c}});Object.defineProperty(exports,"getToolSchemas",{enumerable:true,get:function(){return chunkAO5SO6ZS_js.d}});
|
package/dist/server.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{a as DocxReviewer}from'./chunk-
|
|
1
|
+
export{a as DocxReviewer}from'./chunk-CGBO6ID5.mjs';export{n as createReviewerBridge}from'./chunk-J773ZJGL.mjs';export{a as docxAgentTools,b as executeToolCall,c as getToolDisplayName,d as getToolSchemas}from'./chunk-MSKW7E36.mjs';
|
package/dist/vue.js
CHANGED
|
@@ -6,15 +6,15 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require
|
|
|
6
6
|
@keyframes epAgentSpin {
|
|
7
7
|
to { transform: rotate(360deg); }
|
|
8
8
|
}
|
|
9
|
-
`,document.head.appendChild(e)}let s={flex:1,overflow:`auto`,padding:`16px 14px 8px`,display:`flex`,flexDirection:`column`,gap:`10px`},c={messageGroup:{display:`flex`,flexDirection:`column`,gap:`6px`,width:`100%`},userBubble:{background:`#0b57d0`,color:`#fff`,padding:`10px 14px`,borderRadius:`20px 20px 4px 20px`,fontSize:`13.5px`,lineHeight:1.5,alignSelf:`flex-end`,maxWidth:`88%`,whiteSpace:`pre-wrap`,wordBreak:`break-word`,fontFamily:`'Google Sans', 'Google Sans Text', system-ui, -apple-system, sans-serif`},assistantBubble:{background:`#f0f4f9`,color:`#1f1f1f`,padding:`12px 16px`,borderRadius:`20px 20px 20px 4px`,fontSize:`13.5px`,lineHeight:1.55,alignSelf:`flex-start`,maxWidth:`92%`,whiteSpace:`pre-wrap`,wordBreak:`break-word`,fontFamily:`'Google Sans', 'Google Sans Text', system-ui, -apple-system, sans-serif`},thinkingBubble:{background:`#f0f4f9`,padding:`12px 16px`,borderRadius:`20px 20px 20px 4px`,alignSelf:`flex-start`,display:`flex`,gap:`4px`,alignItems:`center`},dot:{width:`6px`,height:`6px`,borderRadius:`50%`,background:`#5f6368`,display:`inline-block`,animation:`epAgentDot 1.4s infinite ease-in-out`},errorBubble:{background:`#fce8e6`,color:`#b3261e`,padding:`10px 14px`,borderRadius:`16px`,fontSize:`12.5px`,alignSelf:`flex-start`,maxWidth:`92%`,whiteSpace:`pre-wrap`,fontFamily:`'Google Sans Text', system-ui, sans-serif`}};return(n,a)=>((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{class:(0,e.normalizeClass)([`ep-agent-chat-log`,t.className]),style:s,role:`log`,"aria-live":`polite`,"aria-atomic":`false`},[i.value?(0,e.renderSlot)(n.$slots,`empty`,{key:0}):(0,e.createCommentVNode)(``,!0),((0,e.openBlock)(!0),(0,e.createElementBlock)(e.Fragment,null,(0,e.renderList)(t.messages,n=>((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{key:n.id,style:(0,e.normalizeStyle)(c.messageGroup),"data-role":n.role},[n.role===`assistant`&&n.toolCalls&&n.toolCalls.length>0?((0,e.openBlock)(),(0,e.createBlock)(p,{key:0,"tool-calls":n.toolCalls,streaming:n.status===`streaming`,"humanize-name":t.humanizeToolName,"max-visible-calls":t.maxVisibleCalls,"working-label":t.workingLabel,"summary-label":t.summaryLabel,"earlier-label":t.earlierLabel},null,8,[`tool-calls`,`streaming`,`humanize-name`,`max-visible-calls`,`working-label`,`summary-label`,`earlier-label`])):(0,e.createCommentVNode)(``,!0),n.text.length>0?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{key:1,style:(0,e.normalizeStyle)(n.role===`user`?c.userBubble:c.assistantBubble)},(0,e.toDisplayString)(n.text),5)):(0,e.createCommentVNode)(``,!0)],12,m))),128)),t.loading?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{key:1,style:(0,e.normalizeStyle)(c.thinkingBubble),"aria-label":t.thinkingLabel},[(0,e.createElementVNode)(`span`,{style:(0,e.normalizeStyle)({...c.dot,animationDelay:`0s`})},null,4),(0,e.createElementVNode)(`span`,{style:(0,e.normalizeStyle)({...c.dot,animationDelay:`0.15s`})},null,4),(0,e.createElementVNode)(`span`,{style:(0,e.normalizeStyle)({...c.dot,animationDelay:`0.3s`})},null,4)],12,h)):(0,e.createCommentVNode)(``,!0),t.error?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{key:2,style:(0,e.normalizeStyle)(c.errorBubble),role:`alert`},(0,e.toDisplayString)(t.error),5)):(0,e.createCommentVNode)(``,!0),(0,e.createElementVNode)(`div`,{ref_key:`endEl`,ref:r},null,512)],2))}}),v=[`value`,`placeholder`,`disabled`],y=[`aria-label`,`disabled`],b=(0,e.defineComponent)({__name:`AgentComposer`,props:{modelValue:{},disabled:{type:Boolean,default:!1},placeholder:{default:()=>n.agentPanel.composerPlaceholder},sendLabel:{default:()=>n.agentPanel.send},className:{default:``}},emits:[`update:modelValue`,`submit`],setup(t,{emit:n}){let r=t,i=n,a=(0,e.computed)(()=>r.modelValue.trim().length>0&&!r.disabled);function o(){a.value&&i(`submit`)}let s=(0,e.computed)(()=>({width:`36px`,height:`36px`,borderRadius:`50%`,border:`none`,background:`#0b57d0`,color:`#fff`,flexShrink:0,display:`inline-flex`,alignItems:`center`,justifyContent:`center`,transition:`background 0.15s, opacity 0.15s, transform 0.15s`,opacity:a.value?1:.35,cursor:a.value?`pointer`:`not-allowed`})),c={composerWrap:{padding:`8px 12px 14px`,background:`#fff`,flex:`0 0 auto`},composerShell:{display:`flex`,alignItems:`center`,gap:`4px`,padding:`6px 6px 6px 18px`,background:`#fff`,border:`1px solid #c4c7c5`,borderRadius:`28px`,boxShadow:`0 1px 2px rgba(60,64,67,0.04)`,transition:`border-color 0.15s, box-shadow 0.15s`,fontFamily:`'Google Sans Text', system-ui, sans-serif`},composerInput:{flex:1,padding:`8px 0`,fontSize:`14px`,border:`none`,outline:`none`,background:`transparent`,fontFamily:`inherit`,color:`#1f1f1f`},footnote:{fontSize:`11px`,color:`#5f6368`,textAlign:`center`,marginTop:`10px`,fontFamily:`'Google Sans Text', system-ui, sans-serif`}};return(n,r)=>((0,e.openBlock)(),(0,e.createElementBlock)(`form`,{class:(0,e.normalizeClass)([`ep-agent-composer`,t.className]),style:(0,e.normalizeStyle)(c.composerWrap),onSubmit:(0,e.withModifiers)(o,[`prevent`])},[(0,e.createElementVNode)(`div`,{style:(0,e.normalizeStyle)(c.composerShell)},[(0,e.createElementVNode)(`input`,{style:(0,e.normalizeStyle)(c.composerInput),value:t.modelValue,placeholder:t.placeholder,disabled:t.disabled,onInput:r[0]||=e=>i(`update:modelValue`,e.target.value)},null,44,v),(0,e.createElementVNode)(`button`,{type:`submit`,"aria-label":t.sendLabel,disabled:!a.value,style:(0,e.normalizeStyle)(s.value)},[...r[1]||=[(0,e.createElementVNode)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,"aria-hidden":`true`},[(0,e.createElementVNode)(`path`,{d:`M12 19V5M5 12l7-7 7 7`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`})],-1)]],12,y)],4),n.$slots.footnote?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{key:0,style:(0,e.normalizeStyle)(c.footnote)},[(0,e.renderSlot)(n.$slots,`footnote`)],4)):(0,e.createCommentVNode)(``,!0)],38))}}),x=[`disabled`],S=(0,e.defineComponent)({__name:`AgentSuggestionChip`,props:{label:{},disabled:{type:Boolean}},emits:[`click`],setup(t,{emit:n}){let r=n,i={textAlign:`left`,background:`#fff`,border:`1px solid #dadce0`,borderRadius:`18px`,padding:`10px 14px`,fontSize:`13px`,color:`#1f1f1f`,cursor:`pointer`,fontFamily:`'Google Sans Text', system-ui, sans-serif`,lineHeight:1.4,transition:`background 0.15s, border-color 0.15s, box-shadow 0.15s`,width:`100%`};return(n,a)=>((0,e.openBlock)(),(0,e.createElementBlock)(`button`,{type:`button`,style:i,disabled:t.disabled,onClick:a[0]||=e=>r(`click`)},(0,e.toDisplayString)(t.label),9,x))}}),C=[`aria-label`],w={class:`ai-ctx-menu__header`,"aria-hidden":`true`},T=[`onMousedown`],E=[`innerHTML`],D={class:`ai-ctx-menu__label`},O={key:0,class:`ai-ctx-menu__custom`},k=[`placeholder`],A=(0,e.defineComponent)({__name:`AIContextMenu`,props:{isOpen:{type:Boolean},position:{},selectedText:{},showCustomPrompt:{type:Boolean,default:!0},labels:{default:()=>({})}},emits:[`close`,`action`],setup(t,{emit:r}){let i=t,a=r,o=(0,e.ref)(``),s=(0,e.ref)([]);(0,e.watch)(()=>i.isOpen,t=>{t&&(0,e.nextTick)(()=>s.value[0]?.focus())},{immediate:!0});let c=[{id:`rewrite`,icon:`✍`},{id:`expand`,icon:`↔`},{id:`summarize`,icon:`📝`},{id:`fixGrammar`,icon:`✔`},{id:`makeFormal`,icon:`👔`},{id:`makeCasual`,icon:`😊`},{id:`translate`,icon:`🌐`},{id:`explain`,icon:`💡`}],l=(0,e.computed)(()=>i.labels?.header??n.aiActions.header),u=(0,e.computed)(()=>i.labels?.customPlaceholder??n.aiActions.customPlaceholder);function d(e){return i.labels?.[e]||(n.aiActions[e]??e)}let f=(0,e.computed)(()=>{let e=i.position.x,t=i.position.y;return typeof window<`u`&&(e+220+10>window.innerWidth&&(e=window.innerWidth-220-10),t+360+10>window.innerHeight&&(t=window.innerHeight-360-10)),{position:`fixed`,left:`${e}px`,top:`${t}px`,zIndex:500}});function p(e){a(`action`,e,e===`custom`?o.value:void 0),o.value=``,a(`close`)}return(n,r)=>((0,e.openBlock)(),(0,e.createBlock)(e.Teleport,{to:`body`},[t.isOpen?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{key:0,class:`ai-ctx-backdrop`,onMousedown:r[0]||=e=>a(`close`),onContextmenu:r[1]||=(0,e.withModifiers)(e=>a(`close`),[`prevent`])},null,32)):(0,e.createCommentVNode)(``,!0),t.isOpen?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{key:1,class:`ai-ctx-menu`,"aria-label":l.value,style:(0,e.normalizeStyle)(f.value),tabindex:`-1`,onContextmenu:r[4]||=(0,e.withModifiers)(()=>{},[`prevent`]),onKeydown:r[5]||=(0,e.withKeys)((0,e.withModifiers)(e=>a(`close`),[`stop`]),[`esc`])},[(0,e.createElementVNode)(`div`,w,(0,e.toDisplayString)(l.value),1),((0,e.openBlock)(),(0,e.createElementBlock)(e.Fragment,null,(0,e.renderList)(c,t=>(0,e.createElementVNode)(`button`,{key:t.id,ref_for:!0,ref_key:`itemRefs`,ref:s,class:`ai-ctx-menu__item`,onMousedown:(0,e.withModifiers)(e=>p(t.id),[`prevent`])},[(0,e.createElementVNode)(`span`,{class:`ai-ctx-menu__icon`,innerHTML:t.icon},null,8,E),(0,e.createElementVNode)(`span`,D,(0,e.toDisplayString)(d(t.id)),1)],40,T)),64)),r[6]||=(0,e.createElementVNode)(`div`,{class:`ai-ctx-menu__divider`},null,-1),t.showCustomPrompt?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,O,[(0,e.withDirectives)((0,e.createElementVNode)(`input`,{"onUpdate:modelValue":r[2]||=e=>o.value=e,class:`ai-ctx-menu__input`,placeholder:u.value,onKeydown:r[3]||=(0,e.withKeys)((0,e.withModifiers)(e=>p(`custom`),[`prevent`]),[`enter`])},null,40,k),[[e.vModelText,o.value]])])):(0,e.createCommentVNode)(``,!0)],44,C)):(0,e.createCommentVNode)(``,!0)]))}}),j=(e,t)=>{let n=e.__vccOpts||e;for(let[e,r]of t)n[e]=r;return n},M=j(A,[[`__scopeId`,`data-v-c30da7a7`]]),ee=[`aria-label`],te={class:`ai-preview__header`},ne={class:`ai-preview__title`},re=[`aria-label`],ie={key:0,class:`ai-preview__loading`},ae={key:1,class:`ai-preview__error`},oe={key:2,class:`ai-preview__content`},se={key:0,class:`ai-preview__diff`},ce={class:`ai-preview__diff-label`},le={class:`ai-preview__diff-text ai-preview__diff-text--old`},ue={class:`ai-preview__diff-label`},de={class:`ai-preview__diff-text ai-preview__diff-text--new`},fe={key:1,class:`ai-preview__result`},pe={key:3,class:`ai-preview__footer`},me=j((0,e.defineComponent)({__name:`AIResponsePreview`,props:{isVisible:{type:Boolean},originalText:{},responseText:{},action:{},isLoading:{type:Boolean},error:{default:void 0},allowEdit:{type:Boolean,default:!0},showDiff:{type:Boolean,default:!0},showRetry:{type:Boolean,default:!0},labels:{default:()=>({})}},emits:[`accept`,`reject`,`retry`],setup(t,{emit:r}){let i=t,a=r,o=(0,e.ref)(!1),s=(0,e.ref)(``),c=(0,e.computed)(()=>({loading:i.labels?.loading??n.aiPreview.loading,original:i.labels?.original??n.aiPreview.original,suggested:i.labels?.suggested??n.aiPreview.suggested,edit:i.labels?.edit??n.aiPreview.edit,discard:i.labels?.discard??n.aiPreview.discard,accept:i.labels?.accept??n.aiPreview.accept,retry:i.labels?.retry??n.aiPreview.retry,close:i.labels?.close??n.aiPreview.close})),l=(0,e.computed)(()=>i.labels?.actionTitles?.[i.action]||(n.aiPreview.labels[i.action]??n.aiPreview.defaultTitle));(0,e.watch)(()=>i.responseText,e=>{s.value=e,o.value=!1});function u(){a(`accept`,o.value?s.value:i.responseText)}return(n,r)=>t.isVisible?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{key:0,class:`ai-preview`,role:`region`,"aria-label":l.value,tabindex:`-1`,onKeydown:r[5]||=(0,e.withKeys)((0,e.withModifiers)(e=>a(`reject`),[`stop`]),[`esc`])},[(0,e.createElementVNode)(`div`,te,[(0,e.createElementVNode)(`span`,ne,(0,e.toDisplayString)(l.value),1),(0,e.createElementVNode)(`button`,{class:`ai-preview__close`,"aria-label":c.value.close,onClick:r[0]||=e=>a(`reject`)},` ✕ `,8,re)]),t.isLoading?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,ie,[r[6]||=(0,e.createElementVNode)(`span`,{class:`ai-preview__spinner`},null,-1),(0,e.createElementVNode)(`span`,null,(0,e.toDisplayString)(c.value.loading),1)])):t.error?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,ae,[(0,e.createElementVNode)(`span`,null,(0,e.toDisplayString)(t.error),1),t.showRetry?((0,e.openBlock)(),(0,e.createElementBlock)(`button`,{key:0,class:`ai-preview__retry`,onMousedown:r[1]||=(0,e.withModifiers)(e=>a(`retry`),[`prevent`])},(0,e.toDisplayString)(c.value.retry),33)):(0,e.createCommentVNode)(``,!0)])):((0,e.openBlock)(),(0,e.createElementBlock)(`div`,oe,[t.showDiff?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,se,[(0,e.createElementVNode)(`div`,ce,(0,e.toDisplayString)(c.value.original),1),(0,e.createElementVNode)(`div`,le,(0,e.toDisplayString)(t.originalText),1),(0,e.createElementVNode)(`div`,ue,(0,e.toDisplayString)(c.value.suggested),1),(0,e.createElementVNode)(`div`,de,(0,e.toDisplayString)(t.responseText),1)])):((0,e.openBlock)(),(0,e.createElementBlock)(`div`,fe,(0,e.toDisplayString)(t.responseText),1)),t.allowEdit&&o.value?(0,e.withDirectives)(((0,e.openBlock)(),(0,e.createElementBlock)(`textarea`,{key:2,"onUpdate:modelValue":r[2]||=e=>s.value=e,class:`ai-preview__textarea`,rows:`4`},null,512)),[[e.vModelText,s.value]]):(0,e.createCommentVNode)(``,!0)])),!t.isLoading&&!t.error?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,pe,[t.allowEdit&&!o.value?((0,e.openBlock)(),(0,e.createElementBlock)(`button`,{key:0,class:`ai-preview__btn`,onMousedown:r[3]||=(0,e.withModifiers)(e=>o.value=!0,[`prevent`])},(0,e.toDisplayString)(c.value.edit),33)):(0,e.createCommentVNode)(``,!0),(0,e.createElementVNode)(`button`,{class:`ai-preview__btn`,onMousedown:r[4]||=(0,e.withModifiers)(e=>a(`reject`),[`prevent`])},(0,e.toDisplayString)(c.value.discard),33),(0,e.createElementVNode)(`button`,{class:`ai-preview__btn ai-preview__btn--primary`,onMousedown:(0,e.withModifiers)(u,[`prevent`])},(0,e.toDisplayString)(c.value.accept),33)])):(0,e.createCommentVNode)(``,!0)],40,ee)):(0,e.createCommentVNode)(``,!0)}}),[[`__scopeId`,`data-v-1226b741`]]),N=[`single`,`words`,`double`,`thick`,`dotted`,`dottedHeavy`,`dash`,`dashedHeavy`,`dashLong`,`dashLongHeavy`,`dotDash`,`dashDotHeavy`,`dotDotDash`,`dashDotDotHeavy`,`wave`,`wavyHeavy`,`wavyDouble`,`none`],P=[`black`,`blue`,`cyan`,`darkBlue`,`darkCyan`,`darkGray`,`darkGreen`,`darkMagenta`,`darkRed`,`darkYellow`,`green`,`lightGray`,`magenta`,`red`,`white`,`yellow`,`none`],F=[{name:`read_document`,displayName:`Reading document`,description:'Read the document content. Returns lines tagged with a stable paragraph id, e.g. "[2A1F3B] First paragraph". Use the bracketed id as `paraId` when commenting or suggesting changes — it survives edits, unlike ordinal indices. Returns the vanilla document (the doc as it exists right now, before any tracked suggestions are accepted): pending insertions are HIDDEN, pending deletions are shown as plain text (still part of the document until accepted), and comment markers are stripped. Use read_changes / read_comments to inspect what is pending.',inputSchema:{type:`object`,properties:{fromIndex:{type:`number`,description:`Start ordinal index (inclusive). Optional.`},toIndex:{type:`number`,description:`End ordinal index (inclusive). Optional.`}}},handler:(e,t)=>({success:!0,data:t.getContentAsText({fromIndex:e.fromIndex,toIndex:e.toIndex,includeTrackedChanges:!1,includeCommentAnchors:!1})})},{name:`read_selection`,displayName:`Reading selection`,description:`Read the user's current cursor or selection. Returns the selected text, the paragraph it lives in, and that paragraph's \`paraId\`. Use this when the user asks "fix this" or "review what I have selected".`,inputSchema:{type:`object`,properties:{}},handler:(e,t)=>{let n=t.getSelection();return n?{success:!0,data:n}:{success:!1,error:`No selection (editor not focused).`}}},{name:`read_page`,displayName:`Reading page`,description:`Read the contents of one rendered page (1-indexed). Returns paragraphs on the page, each tagged with its stable paraId. Use this when the user asks "summarize page 3" or "comment on what's on this page".`,inputSchema:{type:`object`,properties:{pageNumber:{type:`number`,description:`1-indexed page number.`}},required:[`pageNumber`]},handler:(e,t)=>{let n=t.getPage(e.pageNumber);if(!n){let n=t.getTotalPages();return n===0?{success:!1,error:`No pages rendered (headless mode or empty document).`}:{success:!1,error:`Page ${e.pageNumber} does not exist (document has ${n} page${n===1?``:`s`}).`}}return{success:!0,data:n.text||`(empty page)`}}},{name:`read_pages`,displayName:`Reading pages`,description:`Read a contiguous range of rendered pages (1-indexed, inclusive). Returns paragraphs across the range, each tagged with paraId. Cheaper than calling read_page repeatedly — single round-trip.`,inputSchema:{type:`object`,properties:{from:{type:`number`,description:`1-indexed start page (inclusive).`},to:{type:`number`,description:`1-indexed end page (inclusive).`}},required:[`from`,`to`]},handler:(e,t)=>{let n=t.getPages({from:e.from,to:e.to});if(n.length===0){let n=t.getTotalPages();return n===0?{success:!1,error:`No pages rendered (headless mode or empty document).`}:{success:!1,error:`No pages in range ${e.from}–${e.to} (document has ${n} page${n===1?``:`s`}).`}}return{success:!0,data:n.map(e=>`--- Page ${e.pageNumber} ---\n${e.text||`(empty page)`}`).join(`
|
|
9
|
+
`,document.head.appendChild(e)}let s={flex:1,overflow:`auto`,padding:`16px 14px 8px`,display:`flex`,flexDirection:`column`,gap:`10px`},c={messageGroup:{display:`flex`,flexDirection:`column`,gap:`6px`,width:`100%`},userBubble:{background:`#0b57d0`,color:`#fff`,padding:`10px 14px`,borderRadius:`20px 20px 4px 20px`,fontSize:`13.5px`,lineHeight:1.5,alignSelf:`flex-end`,maxWidth:`88%`,whiteSpace:`pre-wrap`,wordBreak:`break-word`,fontFamily:`'Google Sans', 'Google Sans Text', system-ui, -apple-system, sans-serif`},assistantBubble:{background:`#f0f4f9`,color:`#1f1f1f`,padding:`12px 16px`,borderRadius:`20px 20px 20px 4px`,fontSize:`13.5px`,lineHeight:1.55,alignSelf:`flex-start`,maxWidth:`92%`,whiteSpace:`pre-wrap`,wordBreak:`break-word`,fontFamily:`'Google Sans', 'Google Sans Text', system-ui, -apple-system, sans-serif`},thinkingBubble:{background:`#f0f4f9`,padding:`12px 16px`,borderRadius:`20px 20px 20px 4px`,alignSelf:`flex-start`,display:`flex`,gap:`4px`,alignItems:`center`},dot:{width:`6px`,height:`6px`,borderRadius:`50%`,background:`#5f6368`,display:`inline-block`,animation:`epAgentDot 1.4s infinite ease-in-out`},errorBubble:{background:`#fce8e6`,color:`#b3261e`,padding:`10px 14px`,borderRadius:`16px`,fontSize:`12.5px`,alignSelf:`flex-start`,maxWidth:`92%`,whiteSpace:`pre-wrap`,fontFamily:`'Google Sans Text', system-ui, sans-serif`}};return(n,a)=>((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{class:(0,e.normalizeClass)([`ep-agent-chat-log`,t.className]),style:s,role:`log`,"aria-live":`polite`,"aria-atomic":`false`},[i.value?(0,e.renderSlot)(n.$slots,`empty`,{key:0}):(0,e.createCommentVNode)(``,!0),((0,e.openBlock)(!0),(0,e.createElementBlock)(e.Fragment,null,(0,e.renderList)(t.messages,n=>((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{key:n.id,style:(0,e.normalizeStyle)(c.messageGroup),"data-role":n.role},[n.role===`assistant`&&n.toolCalls&&n.toolCalls.length>0?((0,e.openBlock)(),(0,e.createBlock)(p,{key:0,"tool-calls":n.toolCalls,streaming:n.status===`streaming`,"humanize-name":t.humanizeToolName,"max-visible-calls":t.maxVisibleCalls,"working-label":t.workingLabel,"summary-label":t.summaryLabel,"earlier-label":t.earlierLabel},null,8,[`tool-calls`,`streaming`,`humanize-name`,`max-visible-calls`,`working-label`,`summary-label`,`earlier-label`])):(0,e.createCommentVNode)(``,!0),n.text.length>0?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{key:1,style:(0,e.normalizeStyle)(n.role===`user`?c.userBubble:c.assistantBubble)},(0,e.toDisplayString)(n.text),5)):(0,e.createCommentVNode)(``,!0)],12,m))),128)),t.loading?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{key:1,style:(0,e.normalizeStyle)(c.thinkingBubble),"aria-label":t.thinkingLabel},[(0,e.createElementVNode)(`span`,{style:(0,e.normalizeStyle)({...c.dot,animationDelay:`0s`})},null,4),(0,e.createElementVNode)(`span`,{style:(0,e.normalizeStyle)({...c.dot,animationDelay:`0.15s`})},null,4),(0,e.createElementVNode)(`span`,{style:(0,e.normalizeStyle)({...c.dot,animationDelay:`0.3s`})},null,4)],12,h)):(0,e.createCommentVNode)(``,!0),t.error?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{key:2,style:(0,e.normalizeStyle)(c.errorBubble),role:`alert`},(0,e.toDisplayString)(t.error),5)):(0,e.createCommentVNode)(``,!0),(0,e.createElementVNode)(`div`,{ref_key:`endEl`,ref:r},null,512)],2))}}),v=[`value`,`placeholder`,`disabled`],y=[`aria-label`,`disabled`],b=(0,e.defineComponent)({__name:`AgentComposer`,props:{modelValue:{},disabled:{type:Boolean,default:!1},placeholder:{default:()=>n.agentPanel.composerPlaceholder},sendLabel:{default:()=>n.agentPanel.send},className:{default:``}},emits:[`update:modelValue`,`submit`],setup(t,{emit:n}){let r=t,i=n,a=(0,e.computed)(()=>r.modelValue.trim().length>0&&!r.disabled);function o(){a.value&&i(`submit`)}let s=(0,e.computed)(()=>({width:`36px`,height:`36px`,borderRadius:`50%`,border:`none`,background:`#0b57d0`,color:`#fff`,flexShrink:0,display:`inline-flex`,alignItems:`center`,justifyContent:`center`,transition:`background 0.15s, opacity 0.15s, transform 0.15s`,opacity:a.value?1:.35,cursor:a.value?`pointer`:`not-allowed`})),c={composerWrap:{padding:`8px 12px 14px`,background:`#fff`,flex:`0 0 auto`},composerShell:{display:`flex`,alignItems:`center`,gap:`4px`,padding:`6px 6px 6px 18px`,background:`#fff`,border:`1px solid #c4c7c5`,borderRadius:`28px`,boxShadow:`0 1px 2px rgba(60,64,67,0.04)`,transition:`border-color 0.15s, box-shadow 0.15s`,fontFamily:`'Google Sans Text', system-ui, sans-serif`},composerInput:{flex:1,padding:`8px 0`,fontSize:`14px`,border:`none`,outline:`none`,background:`transparent`,fontFamily:`inherit`,color:`#1f1f1f`},footnote:{fontSize:`11px`,color:`#5f6368`,textAlign:`center`,marginTop:`10px`,fontFamily:`'Google Sans Text', system-ui, sans-serif`}};return(n,r)=>((0,e.openBlock)(),(0,e.createElementBlock)(`form`,{class:(0,e.normalizeClass)([`ep-agent-composer`,t.className]),style:(0,e.normalizeStyle)(c.composerWrap),onSubmit:(0,e.withModifiers)(o,[`prevent`])},[(0,e.createElementVNode)(`div`,{style:(0,e.normalizeStyle)(c.composerShell)},[(0,e.createElementVNode)(`input`,{style:(0,e.normalizeStyle)(c.composerInput),value:t.modelValue,placeholder:t.placeholder,disabled:t.disabled,onInput:r[0]||=e=>i(`update:modelValue`,e.target.value)},null,44,v),(0,e.createElementVNode)(`button`,{type:`submit`,"aria-label":t.sendLabel,disabled:!a.value,style:(0,e.normalizeStyle)(s.value)},[...r[1]||=[(0,e.createElementVNode)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,"aria-hidden":`true`},[(0,e.createElementVNode)(`path`,{d:`M12 19V5M5 12l7-7 7 7`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`})],-1)]],12,y)],4),n.$slots.footnote?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{key:0,style:(0,e.normalizeStyle)(c.footnote)},[(0,e.renderSlot)(n.$slots,`footnote`)],4)):(0,e.createCommentVNode)(``,!0)],38))}}),x=[`disabled`],S=(0,e.defineComponent)({__name:`AgentSuggestionChip`,props:{label:{},disabled:{type:Boolean}},emits:[`click`],setup(t,{emit:n}){let r=n,i={textAlign:`left`,background:`#fff`,border:`1px solid #dadce0`,borderRadius:`18px`,padding:`10px 14px`,fontSize:`13px`,color:`#1f1f1f`,cursor:`pointer`,fontFamily:`'Google Sans Text', system-ui, sans-serif`,lineHeight:1.4,transition:`background 0.15s, border-color 0.15s, box-shadow 0.15s`,width:`100%`};return(n,a)=>((0,e.openBlock)(),(0,e.createElementBlock)(`button`,{type:`button`,style:i,disabled:t.disabled,onClick:a[0]||=e=>r(`click`)},(0,e.toDisplayString)(t.label),9,x))}}),C=[`aria-label`],w={class:`ai-ctx-menu__header`,"aria-hidden":`true`},T=[`onMousedown`],E=[`innerHTML`],D={class:`ai-ctx-menu__label`},O={key:0,class:`ai-ctx-menu__custom`},k=[`placeholder`],ee=(0,e.defineComponent)({__name:`AIContextMenu`,props:{isOpen:{type:Boolean},position:{},selectedText:{},showCustomPrompt:{type:Boolean,default:!0},labels:{default:()=>({})}},emits:[`close`,`action`],setup(t,{emit:r}){let i=t,a=r,o=(0,e.ref)(``),s=(0,e.ref)([]);(0,e.watch)(()=>i.isOpen,t=>{t&&(0,e.nextTick)(()=>s.value[0]?.focus())},{immediate:!0});let c=[{id:`rewrite`,icon:`✍`},{id:`expand`,icon:`↔`},{id:`summarize`,icon:`📝`},{id:`fixGrammar`,icon:`✔`},{id:`makeFormal`,icon:`👔`},{id:`makeCasual`,icon:`😊`},{id:`translate`,icon:`🌐`},{id:`explain`,icon:`💡`}],l=(0,e.computed)(()=>i.labels?.header??n.aiActions.header),u=(0,e.computed)(()=>i.labels?.customPlaceholder??n.aiActions.customPlaceholder);function d(e){return i.labels?.[e]||(n.aiActions[e]??e)}let f=(0,e.computed)(()=>{let e=i.position.x,t=i.position.y;return typeof window<`u`&&(e+220+10>window.innerWidth&&(e=window.innerWidth-220-10),t+360+10>window.innerHeight&&(t=window.innerHeight-360-10)),{position:`fixed`,left:`${e}px`,top:`${t}px`,zIndex:500}});function p(e){a(`action`,e,e===`custom`?o.value:void 0),o.value=``,a(`close`)}return(n,r)=>((0,e.openBlock)(),(0,e.createBlock)(e.Teleport,{to:`body`},[t.isOpen?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{key:0,class:`ai-ctx-backdrop`,onMousedown:r[0]||=e=>a(`close`),onContextmenu:r[1]||=(0,e.withModifiers)(e=>a(`close`),[`prevent`])},null,32)):(0,e.createCommentVNode)(``,!0),t.isOpen?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{key:1,class:`ai-ctx-menu`,"aria-label":l.value,style:(0,e.normalizeStyle)(f.value),tabindex:`-1`,onContextmenu:r[4]||=(0,e.withModifiers)(()=>{},[`prevent`]),onKeydown:r[5]||=(0,e.withKeys)((0,e.withModifiers)(e=>a(`close`),[`stop`]),[`esc`])},[(0,e.createElementVNode)(`div`,w,(0,e.toDisplayString)(l.value),1),((0,e.openBlock)(),(0,e.createElementBlock)(e.Fragment,null,(0,e.renderList)(c,t=>(0,e.createElementVNode)(`button`,{key:t.id,ref_for:!0,ref_key:`itemRefs`,ref:s,class:`ai-ctx-menu__item`,onMousedown:(0,e.withModifiers)(e=>p(t.id),[`prevent`])},[(0,e.createElementVNode)(`span`,{class:`ai-ctx-menu__icon`,innerHTML:t.icon},null,8,E),(0,e.createElementVNode)(`span`,D,(0,e.toDisplayString)(d(t.id)),1)],40,T)),64)),r[6]||=(0,e.createElementVNode)(`div`,{class:`ai-ctx-menu__divider`},null,-1),t.showCustomPrompt?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,O,[(0,e.withDirectives)((0,e.createElementVNode)(`input`,{"onUpdate:modelValue":r[2]||=e=>o.value=e,class:`ai-ctx-menu__input`,placeholder:u.value,onKeydown:r[3]||=(0,e.withKeys)((0,e.withModifiers)(e=>p(`custom`),[`prevent`]),[`enter`])},null,40,k),[[e.vModelText,o.value]])])):(0,e.createCommentVNode)(``,!0)],44,C)):(0,e.createCommentVNode)(``,!0)]))}}),A=(e,t)=>{let n=e.__vccOpts||e;for(let[e,r]of t)n[e]=r;return n},j=A(ee,[[`__scopeId`,`data-v-c30da7a7`]]),te=[`aria-label`],ne={class:`ai-preview__header`},re={class:`ai-preview__title`},ie=[`aria-label`],ae={key:0,class:`ai-preview__loading`},oe={key:1,class:`ai-preview__error`},se={key:2,class:`ai-preview__content`},ce={key:0,class:`ai-preview__diff`},le={class:`ai-preview__diff-label`},ue={class:`ai-preview__diff-text ai-preview__diff-text--old`},de={class:`ai-preview__diff-label`},fe={class:`ai-preview__diff-text ai-preview__diff-text--new`},pe={key:1,class:`ai-preview__result`},me={key:3,class:`ai-preview__footer`},he=A((0,e.defineComponent)({__name:`AIResponsePreview`,props:{isVisible:{type:Boolean},originalText:{},responseText:{},action:{},isLoading:{type:Boolean},error:{default:void 0},allowEdit:{type:Boolean,default:!0},showDiff:{type:Boolean,default:!0},showRetry:{type:Boolean,default:!0},labels:{default:()=>({})}},emits:[`accept`,`reject`,`retry`],setup(t,{emit:r}){let i=t,a=r,o=(0,e.ref)(!1),s=(0,e.ref)(``),c=(0,e.computed)(()=>({loading:i.labels?.loading??n.aiPreview.loading,original:i.labels?.original??n.aiPreview.original,suggested:i.labels?.suggested??n.aiPreview.suggested,edit:i.labels?.edit??n.aiPreview.edit,discard:i.labels?.discard??n.aiPreview.discard,accept:i.labels?.accept??n.aiPreview.accept,retry:i.labels?.retry??n.aiPreview.retry,close:i.labels?.close??n.aiPreview.close})),l=(0,e.computed)(()=>i.labels?.actionTitles?.[i.action]||(n.aiPreview.labels[i.action]??n.aiPreview.defaultTitle));(0,e.watch)(()=>i.responseText,e=>{s.value=e,o.value=!1});function u(){a(`accept`,o.value?s.value:i.responseText)}return(n,r)=>t.isVisible?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{key:0,class:`ai-preview`,role:`region`,"aria-label":l.value,tabindex:`-1`,onKeydown:r[5]||=(0,e.withKeys)((0,e.withModifiers)(e=>a(`reject`),[`stop`]),[`esc`])},[(0,e.createElementVNode)(`div`,ne,[(0,e.createElementVNode)(`span`,re,(0,e.toDisplayString)(l.value),1),(0,e.createElementVNode)(`button`,{class:`ai-preview__close`,"aria-label":c.value.close,onClick:r[0]||=e=>a(`reject`)},` ✕ `,8,ie)]),t.isLoading?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,ae,[r[6]||=(0,e.createElementVNode)(`span`,{class:`ai-preview__spinner`},null,-1),(0,e.createElementVNode)(`span`,null,(0,e.toDisplayString)(c.value.loading),1)])):t.error?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,oe,[(0,e.createElementVNode)(`span`,null,(0,e.toDisplayString)(t.error),1),t.showRetry?((0,e.openBlock)(),(0,e.createElementBlock)(`button`,{key:0,class:`ai-preview__retry`,onMousedown:r[1]||=(0,e.withModifiers)(e=>a(`retry`),[`prevent`])},(0,e.toDisplayString)(c.value.retry),33)):(0,e.createCommentVNode)(``,!0)])):((0,e.openBlock)(),(0,e.createElementBlock)(`div`,se,[t.showDiff?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,ce,[(0,e.createElementVNode)(`div`,le,(0,e.toDisplayString)(c.value.original),1),(0,e.createElementVNode)(`div`,ue,(0,e.toDisplayString)(t.originalText),1),(0,e.createElementVNode)(`div`,de,(0,e.toDisplayString)(c.value.suggested),1),(0,e.createElementVNode)(`div`,fe,(0,e.toDisplayString)(t.responseText),1)])):((0,e.openBlock)(),(0,e.createElementBlock)(`div`,pe,(0,e.toDisplayString)(t.responseText),1)),t.allowEdit&&o.value?(0,e.withDirectives)(((0,e.openBlock)(),(0,e.createElementBlock)(`textarea`,{key:2,"onUpdate:modelValue":r[2]||=e=>s.value=e,class:`ai-preview__textarea`,rows:`4`},null,512)),[[e.vModelText,s.value]]):(0,e.createCommentVNode)(``,!0)])),!t.isLoading&&!t.error?((0,e.openBlock)(),(0,e.createElementBlock)(`div`,me,[t.allowEdit&&!o.value?((0,e.openBlock)(),(0,e.createElementBlock)(`button`,{key:0,class:`ai-preview__btn`,onMousedown:r[3]||=(0,e.withModifiers)(e=>o.value=!0,[`prevent`])},(0,e.toDisplayString)(c.value.edit),33)):(0,e.createCommentVNode)(``,!0),(0,e.createElementVNode)(`button`,{class:`ai-preview__btn`,onMousedown:r[4]||=(0,e.withModifiers)(e=>a(`reject`),[`prevent`])},(0,e.toDisplayString)(c.value.discard),33),(0,e.createElementVNode)(`button`,{class:`ai-preview__btn ai-preview__btn--primary`,onMousedown:(0,e.withModifiers)(u,[`prevent`])},(0,e.toDisplayString)(c.value.accept),33)])):(0,e.createCommentVNode)(``,!0)],40,te)):(0,e.createCommentVNode)(``,!0)}}),[[`__scopeId`,`data-v-1226b741`]]),M=[`single`,`words`,`double`,`thick`,`dotted`,`dottedHeavy`,`dash`,`dashedHeavy`,`dashLong`,`dashLongHeavy`,`dotDash`,`dashDotHeavy`,`dotDotDash`,`dashDotDotHeavy`,`wave`,`wavyHeavy`,`wavyDouble`,`none`],N=[`black`,`blue`,`cyan`,`darkBlue`,`darkCyan`,`darkGray`,`darkGreen`,`darkMagenta`,`darkRed`,`darkYellow`,`green`,`lightGray`,`magenta`,`red`,`white`,`yellow`,`none`],P={name:`apply_formatting`,displayName:`Applying formatting`,description:'Apply character formatting (bold, italic, underline, strike, color, highlight, font size, font family) to a paragraph or to a unique phrase within it. Pass `search` to scope the change to part of the paragraph; omit it to format the whole paragraph. Direct edit — does not create a tracked change. Pass `false` to clear a mark; omit a key to leave it untouched. Color uses `{rgb: "FF0000"}` (no hash) or `{themeColor: "accent1"}`. Font size is in points. Font family takes `{ascii, hAnsi}`.',inputSchema:{type:`object`,properties:{paraId:{type:`string`,description:`Paragraph id from read_document / find_text.`},search:{type:`string`,description:`Optional: format only this exact phrase within the paragraph (must be unique).`},marks:{type:`object`,description:`Marks to set or clear. Omit a key to leave it untouched.`,properties:{bold:{type:`boolean`},italic:{type:`boolean`},underline:{description:`true → single underline; false → clear; or { style: "single"|"double"|"thick"|"dotted"|"dottedHeavy"|"dash"|"dashedHeavy"|"dashLong"|"dashLongHeavy"|"dotDash"|"dashDotHeavy"|"dotDotDash"|"dashDotDotHeavy"|"wave"|"wavyHeavy"|"wavyDouble"|"words"|"none" }. Other values are rejected.`},strike:{type:`boolean`},color:{type:`object`,description:`Either {rgb: "RRGGBB"} (no hash) or {themeColor: "accent1"|"text1"|...}.`,properties:{rgb:{type:`string`},themeColor:{type:`string`}}},highlight:{type:`string`,enum:[...N],description:`Highlight color — must be one of the Word-supported names: `+N.join(`, `)+`. Pass "none" to clear. Hex values are rejected (Word does not accept hex for <w:highlight>).`},fontSize:{type:`number`,description:`Size in points (e.g. 12, 14, 24).`},fontFamily:{type:`object`,properties:{ascii:{type:`string`},hAnsi:{type:`string`}}}}}},required:[`paraId`,`marks`]},handler:(e,t)=>{if(!e.marks||Object.keys(e.marks).length===0)return{success:!1,error:`No marks provided. Specify at least one of bold/italic/etc.`};let n=typeof e.marks.underline==`object`&&e.marks.underline!==null?e.marks.underline.style:void 0;if(n&&!M.includes(n))return{success:!1,error:`Invalid underline.style "${n}". Must be one of: ${M.join(`, `)}.`};let r=typeof e.marks.highlight==`string`?e.marks.highlight:void 0;if(r&&!N.includes(r))return{success:!1,error:`Invalid highlight "${r}". Must be one of: ${N.join(`, `)}. Hex values are not supported by Word's highlight attribute.`};let i=r===`none`?{...e.marks,highlight:``}:e.marks;return t.applyFormatting({paraId:e.paraId,search:e.search,marks:i})?{success:!0,data:`Formatting applied to ${e.search?`"${e.search}" in ${e.paraId}`:e.paraId}.`}:{success:!1,error:"Could not apply formatting. The paraId may not exist, or `search` is missing / ambiguous."}}},F={name:`set_paragraph_style`,displayName:`Setting paragraph style`,description:`Apply a paragraph style by id (e.g. "Heading1", "Heading2", "Title", "Quote", "Normal"). The styleId must exist in the document's style definitions — unknown ids are no-ops. Direct edit, not a tracked change.`,inputSchema:{type:`object`,properties:{paraId:{type:`string`,description:`Paragraph id from read_document / find_text.`},styleId:{type:`string`,description:`Style id (e.g. "Heading1", "Title", "Quote", "Normal").`}},required:[`paraId`,`styleId`]},handler:(e,t)=>t.setParagraphStyle({paraId:e.paraId,styleId:e.styleId})?{success:!0,data:`Style "${e.styleId}" applied to ${e.paraId}.`}:{success:!1,error:`Could not set style. paraId "${e.paraId}" not found, or styleId "${e.styleId}" is not defined.`}},I=[`page`,`sectionNextPage`,`sectionContinuous`],L={page:`Page break`,sectionNextPage:`Section break (next page)`,sectionContinuous:`Section break (continuous)`},R=[{name:`read_document`,displayName:`Reading document`,description:'Read the document content. Returns lines tagged with a stable paragraph id, e.g. "[2A1F3B] First paragraph". Use the bracketed id as `paraId` when commenting or suggesting changes — it survives edits, unlike ordinal indices. Returns the vanilla document (the doc as it exists right now, before any tracked suggestions are accepted): pending insertions are HIDDEN, pending deletions are shown as plain text (still part of the document until accepted), and comment markers are stripped. Use read_changes / read_comments to inspect what is pending.',inputSchema:{type:`object`,properties:{fromIndex:{type:`number`,description:`Start ordinal index (inclusive). Optional.`},toIndex:{type:`number`,description:`End ordinal index (inclusive). Optional.`}}},handler:(e,t)=>({success:!0,data:t.getContentAsText({fromIndex:e.fromIndex,toIndex:e.toIndex,includeTrackedChanges:!1,includeCommentAnchors:!1})})},{name:`read_selection`,displayName:`Reading selection`,description:`Read the user's current cursor or selection. Returns the selected text, the paragraph it lives in, and that paragraph's \`paraId\`. Use this when the user asks "fix this" or "review what I have selected".`,inputSchema:{type:`object`,properties:{}},handler:(e,t)=>{let n=t.getSelection();return n?{success:!0,data:n}:{success:!1,error:`No selection (editor not focused).`}}},{name:`read_page`,displayName:`Reading page`,description:`Read the contents of one rendered page (1-indexed). Returns paragraphs on the page, each tagged with its stable paraId. Use this when the user asks "summarize page 3" or "comment on what's on this page".`,inputSchema:{type:`object`,properties:{pageNumber:{type:`number`,description:`1-indexed page number.`}},required:[`pageNumber`]},handler:(e,t)=>{let n=t.getPage(e.pageNumber);if(!n){let n=t.getTotalPages();return n===0?{success:!1,error:`No pages rendered (headless mode or empty document).`}:{success:!1,error:`Page ${e.pageNumber} does not exist (document has ${n} page${n===1?``:`s`}).`}}return{success:!0,data:n.text||`(empty page)`}}},{name:`read_pages`,displayName:`Reading pages`,description:`Read a contiguous range of rendered pages (1-indexed, inclusive). Returns paragraphs across the range, each tagged with paraId. Cheaper than calling read_page repeatedly — single round-trip.`,inputSchema:{type:`object`,properties:{from:{type:`number`,description:`1-indexed start page (inclusive).`},to:{type:`number`,description:`1-indexed end page (inclusive).`}},required:[`from`,`to`]},handler:(e,t)=>{let n=t.getPages({from:e.from,to:e.to});if(n.length===0){let n=t.getTotalPages();return n===0?{success:!1,error:`No pages rendered (headless mode or empty document).`}:{success:!1,error:`No pages in range ${e.from}–${e.to} (document has ${n} page${n===1?``:`s`}).`}}return{success:!0,data:n.map(e=>`--- Page ${e.pageNumber} ---\n${e.text||`(empty page)`}`).join(`
|
|
10
10
|
|
|
11
11
|
`)}}},{name:`find_text`,displayName:`Finding text`,description:"Locate paragraphs containing `query`. Returns up to `limit` handles, each with `paraId`, the matched substring, and surrounding context. Pass any returned `paraId` (and the `match` as `search`) to add_comment / suggest_change.",inputSchema:{type:`object`,properties:{query:{type:`string`,description:`Text to find (substring match).`},caseSensitive:{type:`boolean`,description:`Default: false.`},limit:{type:`number`,description:`Max paragraphs to return. Default: 20.`}},required:[`query`]},handler:(e,t)=>{let n=t.findText(e.query,{caseSensitive:e.caseSensitive,limit:e.limit});return n.length===0?{success:!0,data:`No matches.`}:{success:!0,data:n}}},{name:`read_comments`,displayName:`Reading comments`,description:`List all comments in the document with their paragraph anchors.`,inputSchema:{type:`object`,properties:{}},handler:(e,t)=>{let n=t.getComments();return n.length===0?{success:!0,data:`No comments.`}:{success:!0,data:n.map(e=>`[Comment #${e.id}] ${e.author}: "${e.text}"`+(e.anchoredText?` (anchored to: "${e.anchoredText}")`:``)+(e.replies.length>0?`
|
|
12
12
|
`+e.replies.map(e=>` Reply by ${e.author}: "${e.text}"`).join(`
|
|
13
13
|
`):``)).join(`
|
|
14
14
|
`)}}},{name:`read_changes`,displayName:`Reading changes`,description:`List tracked changes (insertions / deletions) currently in the document.`,inputSchema:{type:`object`,properties:{}},handler:(e,t)=>{let n=t.getChanges();return n.length===0?{success:!0,data:`No tracked changes.`}:{success:!0,data:n.map(e=>`[Change #${e.id}] ${e.type} by ${e.author}: "${e.text}"`).join(`
|
|
15
|
-
`)}}},{name:`add_comment`,displayName:`Adding comment`,description:`Attach a comment to a paragraph, optionally anchored to a unique phrase within it. The user sees it instantly in the comments sidebar.`,inputSchema:{type:`object`,properties:{paraId:{type:`string`,description:`Paragraph id from read_document / find_text.`},text:{type:`string`,description:`Comment body.`},search:{type:`string`,description:`Optional: anchor to this exact phrase within the paragraph. Must be unique.`}},required:[`paraId`,`text`]},handler:(e,t)=>{let n=t.addComment({paraId:e.paraId,text:e.text,search:e.search});return n===null?{success:!1,error:"Could not add comment. The paraId may not exist, or `search` is missing / ambiguous."}:{success:!0,data:`Comment ${n} added on ${e.paraId}.`}}},{name:`suggest_change`,displayName:`Suggesting change`,description:"Suggest a tracked change. Three modes: (1) replacement — `search` non-empty, `replaceWith` non-empty; (2) deletion — `search` non-empty, `replaceWith` empty; (3) insertion at paragraph end — `search` empty, `replaceWith` non-empty. The user can accept or reject in the editor UI.",inputSchema:{type:`object`,properties:{paraId:{type:`string`,description:`Paragraph id from read_document / find_text.`},search:{type:`string`,description:`Phrase to find (must be unique). Empty string = insert at paragraph end.`},replaceWith:{type:`string`,description:`Replacement text. Empty string = delete the matched phrase.`}},required:[`paraId`,`search`,`replaceWith`]},handler:(e,t)=>t.proposeChange({paraId:e.paraId,search:e.search,replaceWith:e.replaceWith})?e.search?e.replaceWith?{success:!0,data:`Replacement proposed: "${e.search}" → "${e.replaceWith}" on ${e.paraId}.`}:{success:!0,data:`Deletion proposed: "${e.search}" on ${e.paraId}.`}:{success:!0,data:`Insertion proposed on ${e.paraId}.`}:{success:!1,error:`Could not propose change. Possible causes: paraId not found; search missing or ambiguous; or the target overlaps an existing tracked change.`}},{name:`
|
|
16
|
-
`)),o.push(a)}i.push(e),a.push(o)}return{type:`table`,index:t,rows:i,cellParaIds:a}}function
|
|
15
|
+
`)}}},{name:`add_comment`,displayName:`Adding comment`,description:`Attach a comment to a paragraph, optionally anchored to a unique phrase within it. The user sees it instantly in the comments sidebar.`,inputSchema:{type:`object`,properties:{paraId:{type:`string`,description:`Paragraph id from read_document / find_text.`},text:{type:`string`,description:`Comment body.`},search:{type:`string`,description:`Optional: anchor to this exact phrase within the paragraph. Must be unique.`}},required:[`paraId`,`text`]},handler:(e,t)=>{let n=t.addComment({paraId:e.paraId,text:e.text,search:e.search});return n===null?{success:!1,error:"Could not add comment. The paraId may not exist, or `search` is missing / ambiguous."}:{success:!0,data:`Comment ${n} added on ${e.paraId}.`}}},{name:`suggest_change`,displayName:`Suggesting change`,description:"Suggest a tracked change. Three modes: (1) replacement — `search` non-empty, `replaceWith` non-empty; (2) deletion — `search` non-empty, `replaceWith` empty; (3) insertion at paragraph end — `search` empty, `replaceWith` non-empty. The user can accept or reject in the editor UI.",inputSchema:{type:`object`,properties:{paraId:{type:`string`,description:`Paragraph id from read_document / find_text.`},search:{type:`string`,description:`Phrase to find (must be unique). Empty string = insert at paragraph end.`},replaceWith:{type:`string`,description:`Replacement text. Empty string = delete the matched phrase.`}},required:[`paraId`,`search`,`replaceWith`]},handler:(e,t)=>t.proposeChange({paraId:e.paraId,search:e.search,replaceWith:e.replaceWith})?e.search?e.replaceWith?{success:!0,data:`Replacement proposed: "${e.search}" → "${e.replaceWith}" on ${e.paraId}.`}:{success:!0,data:`Deletion proposed: "${e.search}" on ${e.paraId}.`}:{success:!0,data:`Insertion proposed on ${e.paraId}.`}:{success:!1,error:`Could not propose change. Possible causes: paraId not found; search missing or ambiguous; or the target overlaps an existing tracked change.`}},P,F,{name:`insert_break`,displayName:`Inserting break`,description:'Insert a break after a paragraph (located by paraId). `type: "page"` adds a page break so following content starts on a new page. `type: "sectionNextPage"` starts a new document section on a new page. `type: "sectionContinuous"` starts a new section on the same page (use this to change column layout or margins from that point onward). The target paragraph becomes the end of its page/section and the next paragraph begins the new one. Direct edit — not a tracked change.',inputSchema:{type:`object`,properties:{paraId:{type:`string`,description:`Paragraph id from read_document / find_text. The break is inserted after this paragraph.`},type:{type:`string`,enum:[...I],description:`Break kind: "page" (page break), "sectionNextPage" (new section, new page), or "sectionContinuous" (new section, same page).`}},required:[`paraId`,`type`]},handler:(e,t)=>I.includes(e.type)?t.insertBreak({paraId:e.paraId,type:e.type})?{success:!0,data:`${L[e.type]} inserted after ${e.paraId}.`}:{success:!1,error:`Could not insert break. paraId "${e.paraId}" not found.`}:{success:!1,error:`Invalid break type "${e.type}". Must be one of: ${I.join(`, `)}.`}},{name:`reply_comment`,displayName:`Replying to comment`,description:`Reply to an existing comment by id. Threaded under the original.`,inputSchema:{type:`object`,properties:{commentId:{type:`number`,description:`Comment id from read_comments.`},text:{type:`string`,description:`Reply body.`}},required:[`commentId`,`text`]},handler:(e,t)=>{let n=t.replyTo(e.commentId,{text:e.text});return n===null?{success:!1,error:`Comment #${e.commentId} not found.`}:{success:!0,data:`Reply ${n} added to comment ${e.commentId}.`}}},{name:`resolve_comment`,displayName:`Resolving comment`,description:`Mark a comment as resolved (done).`,inputSchema:{type:`object`,properties:{commentId:{type:`number`,description:`Comment id from read_comments.`}},required:[`commentId`]},handler:(e,t)=>(t.resolveComment(e.commentId),{success:!0,data:`Comment ${e.commentId} resolved.`})},{name:`scroll`,displayName:`Scrolling`,description:`Scroll the editor to a paragraph by paraId. Does not move the user's cursor.`,inputSchema:{type:`object`,properties:{paraId:{type:`string`,description:`Paragraph id from read_document / find_text.`}},required:[`paraId`]},handler:(e,t)=>t.scrollTo(e.paraId)?{success:!0,data:`Scrolled to ${e.paraId}.`}:{success:!1,error:`paraId ${e.paraId} not found.`}}];function ge(e,t,n){let r=R.find(t=>t.name===e);if(!r)return{success:!1,error:`Unknown tool: ${e}`};try{return r.handler(t,n)}catch(e){return{success:!1,error:e instanceof Error?e.message:String(e)}}}function _e(e){let t=R.find(t=>t.name===e);if(t?.displayName)return t.displayName;let n=e.replace(/_/g,` `);return n.charAt(0).toUpperCase()+n.slice(1)}function ve(){return R.map(e=>({type:`function`,function:{name:e.name,description:e.description,parameters:e.inputSchema}}))}function z(e){return e.type===`insertion`||e.type===`deletion`||e.type===`moveFrom`||e.type===`moveTo`}function B(e){let n=[];for(let r of e)r.type===`run`?n.push((0,t.getRunText)(r)):r.type===`hyperlink`&&n.push((0,t.getHyperlinkText)(r));return n.join(``)}function V(e,t,n){let r=0;for(let i of e)if(i.type===`paragraph`){if(n(i,r)===!1)return;r++}else if(i.type===`table`){for(let e of i.rows)for(let t of e.cells)for(let e of t.content)if(e.type===`paragraph`){if(n(e,r)===!1)return;r++}}else t&&r++}function H(e,t){V(e.content,!0,t)}function U(e,t){V(e.content,!1,t)}function W(e,t={}){let{fromIndex:n,toIndex:r,includeTrackedChanges:i=!0,includeCommentAnchors:a=!0}=t,o=[],s=0;for(let t of e.content)if(t.type===`paragraph`)G(s,n,r)&&o.push(ye(t,s,i,a)),s++;else if(t.type===`table`){G(s,n,r)&&o.push(be(t,s,i,a));for(let e of t.rows)for(let t of e.cells)for(let e of t.content)e.type===`paragraph`&&s++}else s++;return o}function G(e,t,n){return(t===void 0||e>=t)&&(n===void 0||e<=n)}function ye(e,n,r,i){let a=K(e,r,i),o=e.formatting?.styleId,s=e.paraId;return(0,t.isHeadingStyle)(o)?{type:`heading`,index:n,paraId:s,level:(0,t.parseHeadingLevel)(o)??1,text:a}:e.listRendering?{type:`list-item`,index:n,paraId:s,text:a,listLevel:e.listRendering.level??0,listType:e.listRendering.isBullet?`bullet`:`number`}:{type:`paragraph`,index:n,paraId:s,text:a}}function be(e,t,n,r){let i=[],a=[];for(let t of e.rows){let e=[],o=[];for(let i of t.cells){let t=[],a;for(let e of i.content)e.type===`paragraph`&&(a===void 0&&(a=e.paraId),t.push(K(e,n,r)));e.push(t.join(`
|
|
16
|
+
`)),o.push(a)}i.push(e),a.push(o)}return{type:`table`,index:t,rows:i,cellParaIds:a}}function xe(e){let t=[],n=e=>e.paraId?e.paraId:String(e.index);for(let r of e)switch(r.type){case`heading`:t.push(`[${n(r)}] (h${r.level}) ${r.text}`);break;case`paragraph`:t.push(`[${n(r)}] ${r.text}`);break;case`list-item`:{let e=` `.repeat(r.listLevel),i=r.listType===`bullet`?`•`:`-`;t.push(`[${n(r)}] ${e}${i} ${r.text}`);break}case`table`:{let e=r.index;for(let n=0;n<r.rows.length;n++)for(let i=0;i<r.rows[n].length;i++){let a=r.rows[n][i].split(`
|
|
17
17
|
`),o=r.cellParaIds?.[n]?.[i];for(let r=0;r<a.length;r++){let s=r===0&&o?o:String(e);t.push(`[${s}] (table, row ${n+1}, col ${i+1}) ${a[r]}`),e++}}break}}return t.join(`
|
|
18
|
-
`)}function K(e,n,r){let i=[],a=new Set;for(let o of e.content){if(o.type===`commentRangeStart`&&r){a.add(o.id),i.push(`[comment:${o.id}]`);continue}if(o.type===`commentRangeEnd`&&r){a.has(o.id)&&(a.delete(o.id),i.push(`[/comment]`));continue}if(o.type===`run`)i.push((0,t.getRunText)(o));else if(o.type===`hyperlink`)i.push((0,t.getHyperlinkText)(o));else if(z(o)){let e=B(o.content);o.type===`insertion`||o.type===`moveTo`?n&&i.push(`[+${e}+]{by:${o.info.author}}`):n?i.push(`[-${e}-]{by:${o.info.author}}`):i.push(e)}}return i.join(``)}function
|
|
19
|
-
`)}function
|
|
20
|
-
`)}function
|
|
18
|
+
`)}function K(e,n,r){let i=[],a=new Set;for(let o of e.content){if(o.type===`commentRangeStart`&&r){a.add(o.id),i.push(`[comment:${o.id}]`);continue}if(o.type===`commentRangeEnd`&&r){a.has(o.id)&&(a.delete(o.id),i.push(`[/comment]`));continue}if(o.type===`run`)i.push((0,t.getRunText)(o));else if(o.type===`hyperlink`)i.push((0,t.getHyperlinkText)(o));else if(z(o)){let e=B(o.content);o.type===`insertion`||o.type===`moveTo`?n&&i.push(`[+${e}+]{by:${o.info.author}}`):n?i.push(`[-${e}-]{by:${o.info.author}}`):i.push(e)}}return i.join(``)}function Se(e){let n=[],r=0;for(let i=0;i<e.content.length;i++){let a=e.content[i];if(a.type===`run`){let e=(0,t.getRunText)(a);n.push({contentIndex:i,run:a,text:e,startPos:r}),r+=e.length}else if(a.type===`hyperlink`)for(let e=0;e<a.children.length;e++){let o=a.children[e];if(o.type===`run`){let e=(0,t.getRunText)(o);n.push({contentIndex:i,run:o,text:e,startPos:r}),r+=e.length}}else if(z(a)){if(a.type===`insertion`||a.type===`moveTo`)continue;for(let e=0;e<a.content.length;e++){let o=a.content[e];if(o.type===`run`){let e=(0,t.getRunText)(o);n.push({contentIndex:i,run:o,text:e,startPos:r}),r+=e.length}else if(o.type===`hyperlink`){for(let e of o.children)if(e.type===`run`){let a=(0,t.getRunText)(e);n.push({contentIndex:i,run:e,text:a,startPos:r}),r+=a.length}}}}}return n}function q(e){return Se(e).map(e=>e.text).join(``)}function J(e,t,n){let r=new Map,i=(e,t,n)=>{let i=null;for(let a of e.content)if(z(a)){i===null&&(i=q(e));let o=B(a.content),s=a.info.id,c=`${n.noteType??`body`}:${n.noteId??``}:${s}`,l=r.get(c);l&&l.paragraphIndex===t?l.text+=o:r.set(c,{id:s,type:a.type,author:a.info.author,date:a.info.date??null,text:o,context:i,paragraphIndex:t,...n.noteId===void 0?{}:{noteId:n.noteId},...n.noteType===void 0?{}:{noteType:n.noteType}})}};if(H(e,(e,t)=>i(e,t,{})),t?.includeFootnotes&&n?.footnotes)for(let e of n.footnotes)U(e,(t,n)=>i(t,n,{noteId:e.id,noteType:`footnote`}));if(t?.includeEndnotes&&n?.endnotes)for(let e of n.endnotes)U(e,(t,n)=>i(t,n,{noteId:e.id,noteType:`endnote`}));return Array.from(r.values()).filter(e=>!(t?.author&&e.author!==t.author||t?.type&&e.type!==t.type))}function Y(e,t){let n=e.comments??[];if(n.length===0)return[];let r=Ce(e),i=[],a=new Map;for(let e of n)if(e.parentId!==void 0){let t=a.get(e.parentId)??[];t.push(e),a.set(e.parentId,t)}else i.push(e);return i.map(e=>{let t=r.get(e.id),n=(a.get(e.id)??[]).map(e=>({id:e.id,author:e.author,date:e.date??null,text:X(e)}));return{id:e.id,author:e.author,date:e.date??null,text:X(e),anchoredText:t?.text??``,paragraphIndex:t?.paragraphIndex??-1,replies:n,done:e.done??!1}}).filter(e=>!(t?.author&&e.author!==t.author||t?.done!==void 0&&e.done!==t.done))}function X(e){return e.content.map(e=>q(e)).join(`
|
|
19
|
+
`)}function Ce(e){let n=new Map,r=new Map;return H(e,(e,i)=>{for(let a of e.content)if(a.type===`commentRangeStart`)r.set(a.id,{paragraphIndex:i,parts:[]});else if(a.type===`commentRangeEnd`){let e=r.get(a.id);e&&(n.set(a.id,{text:e.parts.join(``),paragraphIndex:e.paragraphIndex}),r.delete(a.id))}else if(a.type===`run`){let e=(0,t.getRunText)(a);for(let t of r.values())t.parts.push(e)}else if(a.type===`hyperlink`){let e=a.children.filter(e=>e.type===`run`).map(t.getRunText).join(``);for(let t of r.values())t.parts.push(e)}else if(z(a)){if(a.type===`insertion`||a.type===`moveTo`)continue;let e=B(a.content);for(let t of r.values())t.parts.push(e)}}),n}function Z(e){return!e||e.length===0?``:e.map(e=>{let t=e;return t?.content?t.content.map(e=>e.content?.map(e=>e.text||``).join(``)||``).join(``):``}).join(`
|
|
20
|
+
`)}function Q(e){let t=e.getEditorRef();if(t){let e=t.getDocument();if(e?.package?.document)return e.package.document}return e.getDocument()?.package?.document??null}function $(e,t=`AI`){function n(e){return e??t}return{getContentAsText(t){let n=Q(e);return n?xe(W(n,t)):``},getContent(t){let n=Q(e);return n?W(n,t):[]},getComments(t){let n=Q(e);if(!n)return[];let r=Y(n,t);if(r.length>0)return r;let i=e.getComments();if(i.length===0)return[];let a=new Map,o=[];for(let e of i)if(e.parentId){let t=a.get(e.parentId);t?t.push(e):a.set(e.parentId,[e])}else o.push(e);let s=[];for(let e of o){if(t?.author&&e.author!==t.author||t?.done!==void 0&&(e.done??!1)!==t.done)continue;let n=a.get(e.id)??[];s.push({id:e.id,author:e.author,date:e.date??null,text:Z(e.content),anchoredText:``,paragraphIndex:-1,replies:n.map(e=>({id:e.id,author:e.author,date:e.date??null,text:Z(e.content)})),done:e.done??!1})}return s},getChanges(t){let n=Q(e);return n?J(n,t):[]},findText(t,n){return e.findInDocument(t,n)},getSelection(){return e.getSelectionInfo()},addComment(t){return e.addComment({paraId:t.paraId,text:t.text,author:n(t.author),search:t.search})},replyTo(t,r){return e.replyToComment(t,r.text,n(r.author))},resolveComment(t){e.resolveComment(t)},proposeChange(t){return e.proposeChange({paraId:t.paraId,search:t.search,replaceWith:t.replaceWith,author:n(t.author)})},applyFormatting(t){return e.applyFormatting({paraId:t.paraId,search:t.search,marks:t.marks})},setParagraphStyle(t){return e.setParagraphStyle({paraId:t.paraId,styleId:t.styleId})},insertBreak(t){return e.insertBreak({paraId:t.paraId,type:t.type})},getPage(t){return e.getPageContent(t)},getPages(t){let n=e.getTotalPages(),r=Math.max(1,Math.min(t.from,n)),i=Math.max(r,Math.min(t.to,n)),a=[];for(let t=r;t<=i;t++){let n=e.getPageContent(t);n&&a.push(n)}return a},getTotalPages(){return e.getTotalPages()},getCurrentPage(){return e.getCurrentPage()},scrollTo(t){return e.scrollToParaId(t)},onContentChange(t){return e.onContentChange(()=>{let n=Q(e),r=n?Y(n):[],i=n?J(n):[];try{t({commentCount:r.length,changeCount:i.length,comments:r,changes:i})}catch(e){console.error(`onContentChange listener threw:`,e)}})},onSelectionChange(t){return e.onSelectionChange(()=>{try{t(e.getSelectionInfo())}catch(e){console.error(`onSelectionChange listener threw:`,e)}})}}}var we=ve();function Te(t){let{editorRef:n,author:r=`AI`}=t,i=(0,e.computed)(()=>n.value?$(n.value,(0,e.unref)(r)):null);function a(e,t){let n=i.value;return n?ge(e,t,n):{success:!1,error:`Editor not ready`}}return{executeToolCall:a,toolSchemas:we}}exports.AIContextMenu=j,exports.AIResponsePreview=he,exports.AgentChatLog=_,exports.AgentComposer=b,exports.AgentPanel=s,exports.AgentSuggestionChip=S,exports.AgentTimeline=p,exports.getToolDisplayName=_e,exports.useAgentBridge=Te;
|