@eigenpal/docx-js-editor 0.0.26 → 0.0.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (94) hide show
  1. package/README.md +6 -5
  2. package/dist/{ClipboardManager-Bbo5MM_U.d.cts → ClipboardManager-BzgQ-SOi.d.cts} +1 -1
  3. package/dist/{ClipboardManager-CR843H7H.d.ts → ClipboardManager-D0D4aUKE.d.ts} +1 -1
  4. package/dist/{DocumentAgent-cHf96hwL.d.cts → DocumentAgent-B9FUoSVS.d.cts} +1 -1
  5. package/dist/{DocumentAgent-lHtXgMFN.d.ts → DocumentAgent-CRCXiBT7.d.ts} +1 -1
  6. package/dist/{agentApi-DmDuQm0e.d.cts → agentApi-BVHzyk2l.d.cts} +11 -1
  7. package/dist/{agentApi-DmDuQm0e.d.ts → agentApi-BVHzyk2l.d.ts} +11 -1
  8. package/dist/chunk-2FYTKTQL.cjs +111 -0
  9. package/dist/chunk-2KHL5RSD.js +4 -0
  10. package/dist/chunk-3YHC2RAO.js +258 -0
  11. package/dist/chunk-63YB7DGI.js +59 -0
  12. package/dist/chunk-7OCUAFPO.cjs +258 -0
  13. package/dist/chunk-HE3SUXOQ.cjs +4 -0
  14. package/dist/{chunk-6TUCNECX.js → chunk-HRUPO723.js} +1 -1
  15. package/dist/{chunk-5ILXHRJS.cjs → chunk-JMR5HNJP.cjs} +3 -3
  16. package/dist/chunk-JO2CKU4O.js +1 -0
  17. package/dist/{chunk-KL2RYY6G.cjs → chunk-MSV5LTHM.cjs} +2 -2
  18. package/dist/chunk-NLYEW36R.js +26 -0
  19. package/dist/chunk-OJ7NJK46.cjs +1 -0
  20. package/dist/{chunk-CLDB6TL7.js → chunk-PRBTINOW.js} +20 -19
  21. package/dist/chunk-PVV7DV3L.cjs +59 -0
  22. package/dist/{chunk-JIKVCUR6.js → chunk-TOGKKPIW.js} +1 -1
  23. package/dist/chunk-VPDOOMUJ.cjs +26 -0
  24. package/dist/chunk-XGL3EGKF.js +111 -0
  25. package/dist/{chunk-B7TICMXD.cjs → chunk-XKBIFFAS.cjs} +20 -19
  26. package/dist/{clipboard-CU-zASXS.d.ts → clipboard-B7N7Kx2X.d.ts} +1 -1
  27. package/dist/{clipboard-DBabJ6mU.d.cts → clipboard-Cm7udEnb.d.cts} +1 -1
  28. package/dist/{colorResolver-yl7Xh_Qg.d.cts → colorResolver-Bu7uJqpw.d.cts} +2 -2
  29. package/dist/{colorResolver-BTTqW66Q.d.ts → colorResolver-Dlmk3itT.d.ts} +2 -2
  30. package/dist/core-plugins-reexport.cjs +1 -1
  31. package/dist/core-plugins-reexport.d.cts +4 -4
  32. package/dist/core-plugins-reexport.d.ts +4 -4
  33. package/dist/core-plugins-reexport.js +1 -1
  34. package/dist/core-reexport.cjs +1 -1
  35. package/dist/core-reexport.d.cts +10 -10
  36. package/dist/core-reexport.d.ts +10 -10
  37. package/dist/core-reexport.js +1 -1
  38. package/dist/{fontLoader-DQJOS1sb.d.ts → fontLoader-BI9ZoACv.d.ts} +1 -1
  39. package/dist/{fontLoader-Daq8y8C2.d.cts → fontLoader-X8ocGzeD.d.cts} +1 -1
  40. package/dist/headless-reexport.cjs +2 -2
  41. package/dist/headless-reexport.d.cts +7 -7
  42. package/dist/headless-reexport.d.ts +7 -7
  43. package/dist/headless-reexport.js +1 -1
  44. package/dist/index.cjs +2 -2
  45. package/dist/index.d.cts +11 -11
  46. package/dist/index.d.ts +11 -11
  47. package/dist/index.js +1 -1
  48. package/dist/lib-SPXD4LFI.cjs +1 -0
  49. package/dist/lib-U35UU4OU.js +1 -0
  50. package/dist/mcp-reexport.cjs +3 -3
  51. package/dist/mcp-reexport.d.cts +2 -2
  52. package/dist/mcp-reexport.d.ts +2 -2
  53. package/dist/mcp-reexport.js +1 -1
  54. package/dist/{processTemplate-3HN7Q3KT.js → processTemplate-CGIQEJ26.js} +1 -1
  55. package/dist/processTemplate-FOYV6BC5.cjs +1 -0
  56. package/dist/{react-CFPWe7nV.d.ts → react-BgZObIoP.d.ts} +10 -4
  57. package/dist/{react-CKqhN17E.d.cts → react-D9JDP3cV.d.cts} +10 -4
  58. package/dist/react.cjs +1 -1
  59. package/dist/react.d.cts +5 -5
  60. package/dist/react.d.ts +5 -5
  61. package/dist/react.js +1 -1
  62. package/dist/{registry-CXGC344v.d.cts → registry-Bxb5ZI1z.d.cts} +1 -1
  63. package/dist/{registry-C2DPl-QW.d.ts → registry-CgWNVTk9.d.ts} +1 -1
  64. package/dist/selectionRects-BMXJJCPJ.cjs +1 -0
  65. package/dist/selectionRects-TWK7CAC3.js +1 -0
  66. package/dist/styles.css +1 -1
  67. package/dist/{types-COQvtZji.d.cts → types-D03hsi5t.d.cts} +1 -1
  68. package/dist/{types-BpokDLqL.d.ts → types-igZ1x_e4.d.ts} +1 -1
  69. package/dist/ui.cjs +1 -1
  70. package/dist/ui.d.cts +4 -4
  71. package/dist/ui.d.ts +4 -4
  72. package/dist/ui.js +1 -1
  73. package/dist/{variableDetector-BYzE_RXw.d.ts → variableDetector-CkYvLv62.d.ts} +1 -1
  74. package/dist/{variableDetector-C8ST_dnq.d.cts → variableDetector-iGl52A6q.d.cts} +1 -1
  75. package/package.json +1 -1
  76. package/dist/chunk-3X3LTNK4.js +0 -26
  77. package/dist/chunk-4CUGBNL2.cjs +0 -1
  78. package/dist/chunk-5GFXHUMP.js +0 -1
  79. package/dist/chunk-FUK46DWH.js +0 -111
  80. package/dist/chunk-MUIREXKH.js +0 -3
  81. package/dist/chunk-OWMG5MW5.cjs +0 -3
  82. package/dist/chunk-PGEORVCG.js +0 -59
  83. package/dist/chunk-PIVLDW7B.cjs +0 -26
  84. package/dist/chunk-PUVSVHHB.cjs +0 -59
  85. package/dist/chunk-S36T7OK5.cjs +0 -258
  86. package/dist/chunk-Y62HOQL2.cjs +0 -111
  87. package/dist/chunk-YYBSUBRG.js +0 -258
  88. package/dist/lib-GD2QD2JK.js +0 -1
  89. package/dist/lib-HOLGQI5K.cjs +0 -1
  90. package/dist/processTemplate-BXZKWRQD.cjs +0 -1
  91. package/dist/selectionRects-7QU337P5.cjs +0 -1
  92. package/dist/selectionRects-V5RC2BYX.js +0 -1
  93. /package/dist/{chunk-USRMBYI6.js → chunk-IFPN3NT3.js} +0 -0
  94. /package/dist/{chunk-XQNCLN4T.cjs → chunk-QDNL7NWN.cjs} +0 -0
package/README.md CHANGED
@@ -8,17 +8,18 @@
8
8
  <a href="https://www.npmjs.com/package/@eigenpal/docx-js-editor"><img src="https://img.shields.io/npm/v/@eigenpal/docx-js-editor.svg?style=flat-square&color=00C853" alt="npm version" /></a>
9
9
  <a href="https://www.npmjs.com/package/@eigenpal/docx-js-editor"><img src="https://img.shields.io/npm/dm/@eigenpal/docx-js-editor.svg?style=flat-square&color=00C853" alt="npm downloads" /></a>
10
10
  <a href="https://github.com/eigenpal/docx-js-editor/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square&color=00C853" alt="license" /></a>
11
- <a href="https://demo.docx-editor.dev/"><img src="https://img.shields.io/badge/Live_Demo-00C853?style=flat-square&logo=vercel&logoColor=white" alt="Live Demo" /></a>
11
+ <a href="https://docx-editor.dev/editor"><img src="https://img.shields.io/badge/Live_Demo-00C853?style=flat-square&logo=vercel&logoColor=white" alt="Live Demo" /></a>
12
+ <a href="https://www.docx-editor.dev/docs"><img src="https://img.shields.io/badge/Docs-00C853?style=flat-square&logo=readthedocs&logoColor=white" alt="Documentation" /></a>
12
13
  </p>
13
14
 
14
15
  # @eigenpal/docx-js-editor
15
16
 
16
- Open-source WYSIWYG DOCX editor for the browser. No server required. **[Live demo](https://demo.docx-editor.dev/)**
17
+ Open-source WYSIWYG DOCX editor for the browser. No server required. **[Live demo](https://docx-editor.dev/editor)** | **[Documentation](https://www.docx-editor.dev/docs)**
17
18
 
18
19
  For AI agents: see the [Agent Reference](https://raw.githubusercontent.com/eigenpal/docx-editor/main/AGENTS_README.md) for comprehensive API docs, code examples, and integration patterns.
19
20
 
20
21
  <p align="center">
21
- <a href="https://demo.docx-editor.dev/">
22
+ <a href="https://docx-editor.dev/editor">
22
23
  <img src="https://raw.githubusercontent.com/eigenpal/docx-js-editor/main/assets/editor.png" alt="DOCX JS Editor screenshot" width="700" />
23
24
  </a>
24
25
  </p>
@@ -65,7 +66,7 @@ import { DocxEditor, PluginHost, templatePlugin } from '@eigenpal/docx-js-editor
65
66
  </PluginHost>;
66
67
  ```
67
68
 
68
- See [docs/PLUGINS.md](https://github.com/eigenpal/docx-js-editor/blob/main/docs/PLUGINS.md) for the full plugin API.
69
+ See the [plugin documentation](https://www.docx-editor.dev/docs/plugins) for the full plugin API.
69
70
 
70
71
  ## Development
71
72
 
@@ -78,7 +79,7 @@ bun run typecheck
78
79
 
79
80
  Examples: [Vite](https://github.com/eigenpal/docx-js-editor/tree/main/examples/vite) | [Next.js](https://github.com/eigenpal/docx-js-editor/tree/main/examples/nextjs) | [Remix](https://github.com/eigenpal/docx-js-editor/tree/main/examples/remix) | [Astro](https://github.com/eigenpal/docx-js-editor/tree/main/examples/astro) | [Vue](https://github.com/eigenpal/docx-js-editor/tree/main/examples/vue)
80
81
 
81
- **[Props & Ref Methods](https://github.com/eigenpal/docx-js-editor/blob/main/docs/PROPS.md)** | **[Plugins](https://github.com/eigenpal/docx-js-editor/blob/main/docs/PLUGINS.md)** | **[Architecture](https://github.com/eigenpal/docx-js-editor/blob/main/docs/ARCHITECTURE.md)**
82
+ **[Documentation](https://www.docx-editor.dev/docs)** | **[Props & Ref Methods](https://www.docx-editor.dev/docs/props)** | **[Plugins](https://www.docx-editor.dev/docs/plugins)** | **[Architecture](https://www.docx-editor.dev/docs/architecture)**
82
83
 
83
84
  ## License
84
85
 
@@ -1,7 +1,7 @@
1
1
  import { Plugin } from 'prosemirror-state';
2
2
  import { EditorView } from 'prosemirror-view';
3
3
  import { Node } from 'prosemirror-model';
4
- import { D as Document, e as Table, b as Run } from './agentApi-DmDuQm0e.cjs';
4
+ import { D as Document, e as Table, b as Run } from './agentApi-BVHzyk2l.cjs';
5
5
 
6
6
  /**
7
7
  * Framework-Agnostic Plugin Interface for the DOCX Editor
@@ -1,7 +1,7 @@
1
1
  import { Plugin } from 'prosemirror-state';
2
2
  import { EditorView } from 'prosemirror-view';
3
3
  import { Node } from 'prosemirror-model';
4
- import { D as Document, e as Table, b as Run } from './agentApi-DmDuQm0e.js';
4
+ import { D as Document, e as Table, b as Run } from './agentApi-BVHzyk2l.js';
5
5
 
6
6
  /**
7
7
  * Framework-Agnostic Plugin Interface for the DOCX Editor
@@ -1,4 +1,4 @@
1
- import { D as Document, T as TextFormatting, O as StyleInfo, h as AgentContext, P as Position, R as Range, w as ParagraphFormatting, A as AgentCommand } from './agentApi-DmDuQm0e.cjs';
1
+ import { D as Document, T as TextFormatting, _ as StyleInfo, h as AgentContext, P as Position, R as Range, K as ParagraphFormatting, A as AgentCommand } from './agentApi-BVHzyk2l.cjs';
2
2
 
3
3
  /**
4
4
  * Selective Save Module
@@ -1,4 +1,4 @@
1
- import { D as Document, T as TextFormatting, O as StyleInfo, h as AgentContext, P as Position, R as Range, w as ParagraphFormatting, A as AgentCommand } from './agentApi-DmDuQm0e.js';
1
+ import { D as Document, T as TextFormatting, _ as StyleInfo, h as AgentContext, P as Position, R as Range, K as ParagraphFormatting, A as AgentCommand } from './agentApi-BVHzyk2l.js';
2
2
 
3
3
  /**
4
4
  * Selective Save Module
@@ -520,6 +520,12 @@ interface ListRendering {
520
520
  isBullet: boolean;
521
521
  /** Number format type (decimal, lowerRoman, upperRoman, etc.) */
522
522
  numFmt?: NumberFormat;
523
+ /** Whether the list marker is hidden (w:vanish on level rPr) */
524
+ markerHidden?: boolean;
525
+ /** Marker font family from numbering level rPr (ascii name) */
526
+ markerFontFamily?: string;
527
+ /** Marker font size from numbering level rPr, in points */
528
+ markerFontSize?: number;
523
529
  }
524
530
  /**
525
531
  * Complete numbering definitions
@@ -1139,6 +1145,10 @@ interface MoveToRangeEnd {
1139
1145
  type: 'moveToRangeEnd';
1140
1146
  id: number;
1141
1147
  }
1148
+ /**
1149
+ * Run-level tracked wrappers represented in WordprocessingML.
1150
+ */
1151
+ type TrackedRunChange = Insertion | Deletion | MoveFrom | MoveTo;
1142
1152
  /**
1143
1153
  * Run property change (w:rPrChange)
1144
1154
  */
@@ -2226,4 +2236,4 @@ declare const DEFAULT_AI_ACTIONS: AIAction[];
2226
2236
  */
2227
2237
  declare function createCommand<T extends AgentCommand>(command: Omit<T, 'id'>): T;
2228
2238
 
2229
- export { createRange as $, type AgentCommand as A, type BreakContent as B, type SectionProperties as C, type Document as D, type Endnote as E, type Footnote as F, type SelectionContext as G, type Hyperlink as H, type Image as I, type SetVariableCommand as J, type Style as K, type ListLevel as L, type StyleDefinitions as M, type NumberingDefinitions as N, type StyleInfo as O, type Position as P, type SuggestedAction as Q, type Range as R, type SectionInfo as S, type TextFormatting as T, type TableCell as U, type TableRow as V, type TextContent as W, type Theme as X, comparePositions as Y, createCollapsedRange as Z, createCommand as _, type Paragraph as a, getActionDescription as a0, getActionLabel as a1, isPositionInRange as a2, type BookmarkEnd as a3, type BookmarkStart as a4, type Field as a5, type FooterReference as a6, type HeaderFooter as a7, type HeaderReference as a8, type Shape as a9, type TextBox as aa, type ThemeColorScheme as ab, type ThemeFont as ac, type ThemeFontScheme as ad, type ColorValue as ae, type ThemeColorSlot as af, type ParagraphAlignment as ag, type StyleType as ah, type TabStop as ai, type Run as b, type RunContent as c, type DocumentBody as d, type Table as e, type AIAction as f, type AIActionRequest as g, type AgentContext as h, type AgentResponse as i, type ApplyStyleCommand as j, type ApplyVariablesCommand as k, type BlockContent as l, DEFAULT_AI_ACTIONS as m, type DeleteTextCommand as n, type DocxPackage as o, type FormatParagraphCommand as p, type FormatTextCommand as q, type InsertHyperlinkCommand as r, type InsertImageCommand as s, type InsertTableCommand as t, type InsertTextCommand as u, type ParagraphContext as v, type ParagraphFormatting as w, type ParagraphOutline as x, type Relationship as y, type ReplaceTextCommand as z };
2239
+ export { type SuggestedAction as $, type AgentCommand as A, type BreakContent as B, type Comment as C, type Document as D, type Endnote as E, type Footnote as F, type ParagraphContent as G, type Hyperlink as H, type Image as I, type ParagraphContext as J, type ParagraphFormatting as K, type ListLevel as L, type MoveFrom as M, type NumberingDefinitions as N, type ParagraphOutline as O, type Position as P, type Relationship as Q, type Range as R, type ReplaceTextCommand as S, type TextFormatting as T, type SectionInfo as U, type SectionProperties as V, type SelectionContext as W, type SetVariableCommand as X, type Style as Y, type StyleDefinitions as Z, type StyleInfo as _, type Paragraph as a, type TableCell as a0, type TableRow as a1, type TextContent as a2, type Theme as a3, type TrackedChangeInfo as a4, type TrackedRunChange as a5, comparePositions as a6, createCollapsedRange as a7, createCommand as a8, createRange as a9, getActionDescription as aa, getActionLabel as ab, isPositionInRange as ac, type BookmarkEnd as ad, type BookmarkStart as ae, type Field as af, type FooterReference as ag, type HeaderFooter as ah, type HeaderReference as ai, type Shape as aj, type TextBox as ak, type ThemeColorScheme as al, type ThemeFont as am, type ThemeFontScheme as an, type ColorValue as ao, type ThemeColorSlot as ap, type ParagraphAlignment as aq, type StyleType as ar, type TabStop as as, type Run as b, type RunContent as c, type DocumentBody as d, type Table as e, type AIAction as f, type AIActionRequest as g, type AgentContext as h, type AgentResponse as i, type ApplyStyleCommand as j, type ApplyVariablesCommand as k, type BlockContent as l, type CommentRangeEnd as m, type CommentRangeStart as n, DEFAULT_AI_ACTIONS as o, type DeleteTextCommand as p, type Deletion as q, type DocxPackage as r, type FormatParagraphCommand as s, type FormatTextCommand as t, type InsertHyperlinkCommand as u, type InsertImageCommand as v, type InsertTableCommand as w, type InsertTextCommand as x, type Insertion as y, type MoveTo as z };
@@ -520,6 +520,12 @@ interface ListRendering {
520
520
  isBullet: boolean;
521
521
  /** Number format type (decimal, lowerRoman, upperRoman, etc.) */
522
522
  numFmt?: NumberFormat;
523
+ /** Whether the list marker is hidden (w:vanish on level rPr) */
524
+ markerHidden?: boolean;
525
+ /** Marker font family from numbering level rPr (ascii name) */
526
+ markerFontFamily?: string;
527
+ /** Marker font size from numbering level rPr, in points */
528
+ markerFontSize?: number;
523
529
  }
524
530
  /**
525
531
  * Complete numbering definitions
@@ -1139,6 +1145,10 @@ interface MoveToRangeEnd {
1139
1145
  type: 'moveToRangeEnd';
1140
1146
  id: number;
1141
1147
  }
1148
+ /**
1149
+ * Run-level tracked wrappers represented in WordprocessingML.
1150
+ */
1151
+ type TrackedRunChange = Insertion | Deletion | MoveFrom | MoveTo;
1142
1152
  /**
1143
1153
  * Run property change (w:rPrChange)
1144
1154
  */
@@ -2226,4 +2236,4 @@ declare const DEFAULT_AI_ACTIONS: AIAction[];
2226
2236
  */
2227
2237
  declare function createCommand<T extends AgentCommand>(command: Omit<T, 'id'>): T;
2228
2238
 
2229
- export { createRange as $, type AgentCommand as A, type BreakContent as B, type SectionProperties as C, type Document as D, type Endnote as E, type Footnote as F, type SelectionContext as G, type Hyperlink as H, type Image as I, type SetVariableCommand as J, type Style as K, type ListLevel as L, type StyleDefinitions as M, type NumberingDefinitions as N, type StyleInfo as O, type Position as P, type SuggestedAction as Q, type Range as R, type SectionInfo as S, type TextFormatting as T, type TableCell as U, type TableRow as V, type TextContent as W, type Theme as X, comparePositions as Y, createCollapsedRange as Z, createCommand as _, type Paragraph as a, getActionDescription as a0, getActionLabel as a1, isPositionInRange as a2, type BookmarkEnd as a3, type BookmarkStart as a4, type Field as a5, type FooterReference as a6, type HeaderFooter as a7, type HeaderReference as a8, type Shape as a9, type TextBox as aa, type ThemeColorScheme as ab, type ThemeFont as ac, type ThemeFontScheme as ad, type ColorValue as ae, type ThemeColorSlot as af, type ParagraphAlignment as ag, type StyleType as ah, type TabStop as ai, type Run as b, type RunContent as c, type DocumentBody as d, type Table as e, type AIAction as f, type AIActionRequest as g, type AgentContext as h, type AgentResponse as i, type ApplyStyleCommand as j, type ApplyVariablesCommand as k, type BlockContent as l, DEFAULT_AI_ACTIONS as m, type DeleteTextCommand as n, type DocxPackage as o, type FormatParagraphCommand as p, type FormatTextCommand as q, type InsertHyperlinkCommand as r, type InsertImageCommand as s, type InsertTableCommand as t, type InsertTextCommand as u, type ParagraphContext as v, type ParagraphFormatting as w, type ParagraphOutline as x, type Relationship as y, type ReplaceTextCommand as z };
2239
+ export { type SuggestedAction as $, type AgentCommand as A, type BreakContent as B, type Comment as C, type Document as D, type Endnote as E, type Footnote as F, type ParagraphContent as G, type Hyperlink as H, type Image as I, type ParagraphContext as J, type ParagraphFormatting as K, type ListLevel as L, type MoveFrom as M, type NumberingDefinitions as N, type ParagraphOutline as O, type Position as P, type Relationship as Q, type Range as R, type ReplaceTextCommand as S, type TextFormatting as T, type SectionInfo as U, type SectionProperties as V, type SelectionContext as W, type SetVariableCommand as X, type Style as Y, type StyleDefinitions as Z, type StyleInfo as _, type Paragraph as a, type TableCell as a0, type TableRow as a1, type TextContent as a2, type Theme as a3, type TrackedChangeInfo as a4, type TrackedRunChange as a5, comparePositions as a6, createCollapsedRange as a7, createCommand as a8, createRange as a9, getActionDescription as aa, getActionLabel as ab, isPositionInRange as ac, type BookmarkEnd as ad, type BookmarkStart as ae, type Field as af, type FooterReference as ag, type HeaderFooter as ah, type HeaderReference as ai, type Shape as aj, type TextBox as ak, type ThemeColorScheme as al, type ThemeFont as am, type ThemeFontScheme as an, type ColorValue as ao, type ThemeColorSlot as ap, type ParagraphAlignment as aq, type StyleType as ar, type TabStop as as, type Run as b, type RunContent as c, type DocumentBody as d, type Table as e, type AIAction as f, type AIActionRequest as g, type AgentContext as h, type AgentResponse as i, type ApplyStyleCommand as j, type ApplyVariablesCommand as k, type BlockContent as l, type CommentRangeEnd as m, type CommentRangeStart as n, DEFAULT_AI_ACTIONS as o, type DeleteTextCommand as p, type Deletion as q, type DocxPackage as r, type FormatParagraphCommand as s, type FormatTextCommand as t, type InsertHyperlinkCommand as u, type InsertImageCommand as v, type InsertTableCommand as w, type InsertTextCommand as x, type Insertion as y, type MoveTo as z };
@@ -0,0 +1,111 @@
1
+ 'use strict';var chunkHE3SUXOQ_cjs=require('./chunk-HE3SUXOQ.cjs'),chunkNVAQQYBJ_cjs=require('./chunk-NVAQQYBJ.cjs'),chunkIA4LPH2A_cjs=require('./chunk-IA4LPH2A.cjs'),or=require('react'),jsxRuntime=require('react/jsx-runtime');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var or__default=/*#__PURE__*/_interopDefault(or);var $t=()=>jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"7",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M8 4v4M8 10v1",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),Gt=()=>jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M13 3L3 13M3 3h4v4M13 13h-4v-4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),jt=()=>jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M8 3v10M3 8h10",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})}),Zt=()=>jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M3 4h10M3 8h7M3 12h4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})}),Xt=()=>jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M2 3h6M5 3v6M3 5c0 2 1 4 2 4s2-2 2-4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsxRuntime.jsx("path",{d:"M9 7l3 6M15 7l-3 6M10 11h4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),Jt=()=>jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M6 6c0-1.1.9-2 2-2s2 .9 2 2c0 1.5-2 1.5-2 3",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsxRuntime.jsx("circle",{cx:"8",cy:"12",r:"0.5",fill:"currentColor"})]}),Qt=()=>jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M4 12l3-8 3 8M5 10h4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M12 6l2 2-2 2",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),qt=()=>jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("rect",{x:"3",y:"3",width:"10",height:"10",rx:"1",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M6 7h4M6 9h4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),eo=()=>jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"5",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M6 9c.5.5 1 1 2 1s1.5-.5 2-1",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsxRuntime.jsx("circle",{cx:"6",cy:"7",r:"0.5",fill:"currentColor"}),jsxRuntime.jsx("circle",{cx:"10",cy:"7",r:"0.5",fill:"currentColor"})]}),to=()=>jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M12 4L4 12M4 4l8 8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})});function oo(e){switch(e){case "askAI":return jsxRuntime.jsx($t,{});case "rewrite":return jsxRuntime.jsx(Gt,{});case "expand":return jsxRuntime.jsx(jt,{});case "summarize":return jsxRuntime.jsx(Zt,{});case "translate":return jsxRuntime.jsx(Xt,{});case "explain":return jsxRuntime.jsx(Jt,{});case "fixGrammar":return jsxRuntime.jsx(Qt,{});case "makeFormal":return jsxRuntime.jsx(qt,{});case "makeCasual":return jsxRuntime.jsx(eo,{});case "custom":return jsxRuntime.jsx(to,{});default:return null}}var ro=({action:e,onClick:t,isHighlighted:o,onMouseEnter:n})=>{let r=chunkNVAQQYBJ_cjs.e(e),i=chunkNVAQQYBJ_cjs.f(e),a=oo(e);return jsxRuntime.jsxs("button",{type:"button",className:`docx-context-menu-item ${o?"docx-context-menu-item-highlighted":""}`,onClick:t,onMouseEnter:n,title:i,role:"menuitem",style:{display:"flex",alignItems:"center",gap:"8px",width:"100%",padding:"8px 12px",border:"none",background:o?"var(--doc-primary-light)":"transparent",cursor:"pointer",fontSize:"13px",color:"var(--doc-text)",textAlign:"left"},children:[jsxRuntime.jsx("span",{style:{display:"flex",color:"var(--doc-text-muted)"},children:a}),jsxRuntime.jsx("span",{children:r})]})},no=({isOpen:e,onSubmit:t,onClose:o,selectedText:n})=>{let[r,i]=or.useState(""),a=or.useRef(null);or.useEffect(()=>{e&&a.current&&a.current.focus();},[e]);let d=l=>{l.preventDefault(),r.trim()&&(t(r.trim()),i(""));},s=l=>{l.key==="Escape"&&o();};return e?jsxRuntime.jsx("div",{className:"docx-custom-prompt-dialog",style:{position:"absolute",top:"100%",left:0,right:0,padding:"8px",background:"white",borderTop:"1px solid var(--doc-border)"},children:jsxRuntime.jsxs("form",{onSubmit:d,children:[jsxRuntime.jsxs("div",{style:{marginBottom:"8px",fontSize:"12px",color:"var(--doc-text-muted)"},children:['Selected: "',n.slice(0,50),n.length>50?"...":"",'"']}),jsxRuntime.jsx("input",{ref:a,type:"text",value:r,onChange:l=>i(l.target.value),onKeyDown:s,placeholder:"Enter custom prompt...",style:{width:"100%",padding:"8px",border:"1px solid var(--doc-border-light)",borderRadius:"4px",fontSize:"13px"}}),jsxRuntime.jsxs("div",{style:{marginTop:"8px",display:"flex",gap:"8px",justifyContent:"flex-end"},children:[jsxRuntime.jsx("button",{type:"button",onClick:o,style:{padding:"6px 12px",border:"1px solid var(--doc-border-light)",borderRadius:"4px",background:"white",cursor:"pointer",fontSize:"12px"},children:"Cancel"}),jsxRuntime.jsx("button",{type:"submit",disabled:!r.trim(),style:{padding:"6px 12px",border:"none",borderRadius:"4px",background:r.trim()?"var(--doc-primary)":"var(--doc-border)",color:r.trim()?"white":"var(--doc-text-placeholder)",cursor:r.trim()?"pointer":"not-allowed",fontSize:"12px"},children:"Send"})]})]})}):null},Rn=({isOpen:e,position:t,selectedText:o,selectionContext:n,onAction:r,onClose:i,actions:a=chunkNVAQQYBJ_cjs.g,showCustomPrompt:d=true,className:s=""})=>{let l=or.useRef(null),[x,g]=or.useState(0),[c,u]=or.useState(false),m=d?[...a,"custom"]:a;or.useEffect(()=>{if(!e)return;let p=v=>{l.current&&!l.current.contains(v.target)&&i();};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[e,i]),or.useEffect(()=>{if(!e)return;let p=v=>{switch(v.key){case "Escape":c?u(false):i();break;case "ArrowDown":v.preventDefault(),g(P=>(P+1)%m.length);break;case "ArrowUp":v.preventDefault(),g(P=>(P-1+m.length)%m.length);break;case "Enter":v.preventDefault();let k=m[x];k==="custom"?u(true):(r(k),i());break}};return document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},[e,x,m,r,i,c]),or.useEffect(()=>{e&&(g(0),u(false));},[e]);let b=or.useCallback(()=>{let v=m.length*36+16,k=t.x,P=t.y;return typeof window<"u"&&(k+200>window.innerWidth&&(k=window.innerWidth-200-10),P+v>window.innerHeight&&(P=window.innerHeight-v-10),k<10&&(k=10),P<10&&(P=10)),{position:"fixed",top:P,left:k,minWidth:200,background:"white",border:"1px solid var(--doc-border-light)",borderRadius:"8px",boxShadow:"0 2px 10px rgba(0, 0, 0, 0.15)",zIndex:1e4,padding:"4px 0",overflow:"hidden"}},[t,m.length]),f=p=>{p==="custom"?u(true):(r(p),i());},h=p=>{r("custom",p),i();};return !e||!o?null:jsxRuntime.jsxs("div",{ref:l,className:`docx-context-menu ${s}`,style:b(),role:"menu","aria-label":"AI actions menu",children:[jsxRuntime.jsxs("div",{style:{padding:"8px 12px",borderBottom:"1px solid var(--doc-border)",fontSize:"11px",color:"var(--doc-text-muted)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:['"',o.slice(0,30),o.length>30?"...":"",'"']}),jsxRuntime.jsx("div",{role:"group",children:m.map((p,v)=>jsxRuntime.jsx(ro,{action:p,onClick:()=>f(p),isHighlighted:v===x,onMouseEnter:()=>g(v)},p))}),d&&jsxRuntime.jsx(no,{isOpen:c,onSubmit:h,onClose:()=>u(false),selectedText:o})]})};function Dn(){let[e,t]=or.useState(false),[o,n]=or.useState({x:0,y:0}),[r,i]=or.useState(""),[a,d]=or.useState(),s=or.useCallback((x,g,c)=>{x.preventDefault(),n({x:x.clientX,y:x.clientY}),i(g),d(c),t(true);},[]),l=or.useCallback(()=>{t(false);},[]);return {isOpen:e,position:o,selectedText:r,selectionContext:a,openMenu:s,closeMenu:l}}function On(e){return {rewrite:"Ctrl+Shift+R",summarize:"Ctrl+Shift+S",translate:"Ctrl+Shift+T",fixGrammar:"Ctrl+Shift+G"}[e]}function An(e,t,o){return !(!t||t.trim().length===0)}function _n(){return [...chunkNVAQQYBJ_cjs.g]}function Mn(){return ["askAI","rewrite","expand","summarize","translate","explain","fixGrammar","makeFormal","makeCasual","custom"]}var io=()=>jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M3 8l4 4 6-8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),lt=()=>jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M4 4l8 8M12 4l-8 8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})}),ao=()=>jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M2 8a6 6 0 0111.318-2.828M14 8a6 6 0 01-11.318 2.828",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsxRuntime.jsx("path",{d:"M13 2v4h-4M3 14v-4h4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),so=()=>jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M11 2l3 3-9 9H2v-3l9-9z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),lo=()=>jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{animation:"spin 1s linear infinite"},children:[jsxRuntime.jsx("circle",{cx:"10",cy:"10",r:"8",stroke:"var(--doc-border)",strokeWidth:"2",fill:"none"}),jsxRuntime.jsx("path",{d:"M10 2a8 8 0 018 8",stroke:"var(--doc-primary)",strokeWidth:"2",strokeLinecap:"round",fill:"none"}),jsxRuntime.jsx("style",{children:`
2
+ @keyframes spin {
3
+ from { transform: rotate(0deg); }
4
+ to { transform: rotate(360deg); }
5
+ }
6
+ `})]});function co(e,t){let o=[],n=e.split(/(\s+)/),r=t.split(/(\s+)/),i=0,a=0;for(;i<n.length||a<r.length;){if(i>=n.length){o.push({type:"added",text:r.slice(a).join("")});break}if(a>=r.length){o.push({type:"removed",text:n.slice(i).join("")});break}if(n[i]===r[a])o.push({type:"same",text:n[i]}),i++,a++;else {let s=r.indexOf(n[i],a),l=n.indexOf(r[a],i);s===-1&&l===-1?(o.push({type:"removed",text:n[i]}),o.push({type:"added",text:r[a]}),i++,a++):l!==-1&&(s===-1||l-i<=s-a)?(o.push({type:"added",text:r[a]}),a++):(o.push({type:"removed",text:n[i]}),i++);}}let d=[];for(let s of o)d.length>0&&d[d.length-1].type===s.type?d[d.length-1].text+=s.text:d.push(s);return d}var po=({original:e,modified:t})=>{let o=co(e,t);return jsxRuntime.jsx("div",{className:"docx-response-diff",style:{lineHeight:1.6,fontSize:"14px"},children:o.map((n,r)=>{let i={};switch(n.type){case "removed":i={textDecoration:"line-through",color:"#d32f2f",backgroundColor:"#ffebee"};break;case "added":i={color:"#2e7d32",backgroundColor:"#e8f5e9"};break;}return jsxRuntime.jsx("span",{style:i,children:n.text},r)})})},Yn=({originalText:e,response:t,action:o,isLoading:n,error:r,onAccept:i,onReject:a,onRetry:d,allowEdit:s=true,showDiff:l=true,className:x="",position:g})=>{let[c,u]=or.useState(false),[m,b]=or.useState(""),f=or.useRef(null),h=or.useRef(null),p=t?.newText||"";or.useEffect(()=>{p&&b(p);},[p]),or.useEffect(()=>{c&&f.current&&(f.current.focus(),f.current.select());},[c]),or.useEffect(()=>{let I=R=>{R.key==="Escape"?c?(u(false),b(p)):a():R.key==="Enter"&&(R.metaKey||R.ctrlKey)&&(R.preventDefault(),v());};return document.addEventListener("keydown",I),()=>document.removeEventListener("keydown",I)},[c,p,a]);let v=or.useCallback(()=>{i(c?m:p);},[c,m,p,i]),k=or.useCallback(()=>{u(true);},[]),P=or.useCallback(()=>{u(false),b(p);},[p]),Y={position:g?"fixed":"relative",...g&&{left:g.x,top:g.y},width:"400px",maxWidth:"90vw",maxHeight:"80vh",background:"white",border:"1px solid var(--doc-border-light)",borderRadius:"8px",boxShadow:"0 4px 20px rgba(0, 0, 0, 0.15)",zIndex:1e4,overflow:"hidden",display:"flex",flexDirection:"column"};return n?jsxRuntime.jsx("div",{ref:h,className:`docx-response-preview docx-response-preview-loading ${x}`,style:Y,children:jsxRuntime.jsxs("div",{style:{padding:"24px",display:"flex",flexDirection:"column",alignItems:"center",gap:"16px"},children:[jsxRuntime.jsx(lo,{}),jsxRuntime.jsxs("div",{style:{color:"var(--doc-text-muted)",fontSize:"14px"},children:[chunkNVAQQYBJ_cjs.e(o),"..."]})]})}):r?jsxRuntime.jsx("div",{ref:h,className:`docx-response-preview docx-response-preview-error ${x}`,style:Y,children:jsxRuntime.jsxs("div",{style:{padding:"16px"},children:[jsxRuntime.jsx("div",{style:{padding:"12px",background:"var(--doc-error-bg)",borderRadius:"4px",color:"var(--doc-error)",fontSize:"13px",marginBottom:"16px"},children:r}),jsxRuntime.jsxs("div",{style:{display:"flex",gap:"8px",justifyContent:"flex-end"},children:[d&&jsxRuntime.jsxs("button",{type:"button",onClick:d,style:{display:"flex",alignItems:"center",gap:"4px",padding:"8px 16px",border:"1px solid var(--doc-border-light)",borderRadius:"4px",background:"white",cursor:"pointer",fontSize:"13px"},children:[jsxRuntime.jsx(ao,{}),"Retry"]}),jsxRuntime.jsx("button",{type:"button",onClick:a,style:{padding:"8px 16px",border:"none",borderRadius:"4px",background:"var(--doc-border)",cursor:"pointer",fontSize:"13px"},children:"Close"})]})]})}):!t||!p?null:jsxRuntime.jsxs("div",{ref:h,className:`docx-response-preview ${x}`,style:Y,children:[jsxRuntime.jsxs("div",{style:{padding:"12px 16px",borderBottom:"1px solid var(--doc-border)",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[jsxRuntime.jsxs("div",{style:{fontWeight:500,fontSize:"14px",color:"var(--doc-text)"},children:[chunkNVAQQYBJ_cjs.e(o)," Result"]}),jsxRuntime.jsx("button",{type:"button",onClick:a,style:{display:"flex",padding:"4px",border:"none",background:"transparent",cursor:"pointer",color:"var(--doc-text-muted)"},title:"Close (Esc)",children:jsxRuntime.jsx(lt,{})})]}),jsxRuntime.jsxs("div",{style:{padding:"16px",overflowY:"auto",flex:1},children:[c?jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{style:{marginBottom:"8px",fontSize:"12px",color:"var(--doc-text-muted)"},children:"Edit the result before accepting:"}),jsxRuntime.jsx("textarea",{ref:f,value:m,onChange:I=>b(I.target.value),style:{width:"100%",minHeight:"120px",padding:"12px",border:"1px solid var(--doc-primary)",borderRadius:"4px",fontSize:"14px",lineHeight:1.6,resize:"vertical",fontFamily:"inherit"}})]}):l?jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{style:{marginBottom:"8px",fontSize:"12px",color:"var(--doc-text-muted)"},children:"Changes:"}),jsxRuntime.jsx(po,{original:e,modified:p})]}):jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{style:{marginBottom:"8px",fontSize:"12px",color:"var(--doc-text-muted)"},children:"Original:"}),jsxRuntime.jsx("div",{style:{padding:"8px 12px",background:"var(--doc-bg-subtle)",borderRadius:"4px",marginBottom:"16px",textDecoration:"line-through",color:"var(--doc-text-placeholder)",fontSize:"13px"},children:e}),jsxRuntime.jsx("div",{style:{marginBottom:"8px",fontSize:"12px",color:"var(--doc-text-muted)"},children:"New:"}),jsxRuntime.jsx("div",{style:{padding:"8px 12px",background:"#e8f5e9",borderRadius:"4px",color:"#2e7d32",fontSize:"13px"},children:p})]}),t.warnings&&t.warnings.length>0&&jsxRuntime.jsx("div",{style:{marginTop:"16px",padding:"8px 12px",background:"var(--doc-warning-bg)",borderRadius:"4px",fontSize:"12px",color:"var(--doc-warning)"},children:t.warnings.map((I,R)=>jsxRuntime.jsx("div",{children:I},R))})]}),jsxRuntime.jsxs("div",{style:{padding:"12px 16px",borderTop:"1px solid var(--doc-border)",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[jsxRuntime.jsxs("div",{children:[s&&!c&&jsxRuntime.jsxs("button",{type:"button",onClick:k,style:{display:"flex",alignItems:"center",gap:"4px",padding:"6px 12px",border:"1px solid var(--doc-border-light)",borderRadius:"4px",background:"white",cursor:"pointer",fontSize:"12px",color:"var(--doc-text-muted)"},children:[jsxRuntime.jsx(so,{}),"Edit"]}),c&&jsxRuntime.jsx("button",{type:"button",onClick:P,style:{padding:"6px 12px",border:"1px solid var(--doc-border-light)",borderRadius:"4px",background:"white",cursor:"pointer",fontSize:"12px",color:"var(--doc-text-muted)"},children:"Cancel Edit"})]}),jsxRuntime.jsxs("div",{style:{display:"flex",gap:"8px"},children:[jsxRuntime.jsxs("button",{type:"button",onClick:a,style:{display:"flex",alignItems:"center",gap:"4px",padding:"8px 16px",border:"1px solid var(--doc-border-light)",borderRadius:"4px",background:"white",cursor:"pointer",fontSize:"13px",color:"var(--doc-text-muted)"},children:[jsxRuntime.jsx(lt,{}),"Reject"]}),jsxRuntime.jsxs("button",{type:"button",onClick:v,style:{display:"flex",alignItems:"center",gap:"4px",padding:"8px 16px",border:"none",borderRadius:"4px",background:"var(--doc-primary)",cursor:"pointer",fontSize:"13px",color:"white"},children:[jsxRuntime.jsx(io,{}),"Accept"]})]})]})]})};function Un(){let[e,t]=or.useState({isVisible:false,originalText:"",response:null,action:"rewrite",isLoading:false}),o=or.useCallback((a,d,s)=>{t({isVisible:true,originalText:a,response:null,action:d,isLoading:true,position:s});},[]),n=or.useCallback(a=>{t(d=>({...d,response:a,isLoading:false}));},[]),r=or.useCallback(a=>{t(d=>({...d,error:a,isLoading:false}));},[]),i=or.useCallback(()=>{t(a=>({...a,isVisible:false}));},[]);return {state:e,showPreview:o,setResponse:n,setError:r,hidePreview:i}}function Hn(e,t){return {success:true,newText:e,warnings:t}}function Kn(e){return {success:false,error:e}}var uo=[{name:"Black",hex:"000000"},{name:"Dark Red",hex:"7F0000"},{name:"Dark Orange",hex:"FF6600"},{name:"Dark Yellow",hex:"808000"},{name:"Dark Green",hex:"006400"},{name:"Dark Teal",hex:"008080"},{name:"Dark Blue",hex:"000080"},{name:"Dark Purple",hex:"4B0082"},{name:"Dark Gray",hex:"404040"},{name:"Gray",hex:"808080"},{name:"Red",hex:"FF0000"},{name:"Orange",hex:"FF9900"},{name:"Yellow",hex:"FFFF00"},{name:"Light Green",hex:"00FF00"},{name:"Cyan",hex:"00FFFF"},{name:"Light Blue",hex:"0066FF"},{name:"Blue",hex:"0000FF"},{name:"Purple",hex:"9900FF"},{name:"Magenta",hex:"FF00FF"},{name:"Pink",hex:"FF66FF"},{name:"Light Red",hex:"FFCCCC"},{name:"Light Orange",hex:"FFE5CC"},{name:"Light Yellow",hex:"FFFFCC"},{name:"Pale Green",hex:"CCFFCC"},{name:"Light Cyan",hex:"CCFFFF"},{name:"Sky Blue",hex:"CCE5FF"},{name:"Light Blue 2",hex:"CCCCFF"},{name:"Lavender",hex:"E5CCFF"},{name:"Light Magenta",hex:"FFCCFF"},{name:"White",hex:"FFFFFF"}],go=[{name:"No Color",hex:""},{name:"Yellow",hex:"FFFF00"},{name:"Bright Green",hex:"00FF00"},{name:"Cyan",hex:"00FFFF"},{name:"Magenta",hex:"FF00FF"},{name:"Blue",hex:"0000FF"},{name:"Red",hex:"FF0000"},{name:"Dark Blue",hex:"00008B"},{name:"Teal",hex:"008080"},{name:"Green",hex:"008000"},{name:"Violet",hex:"800080"},{name:"Dark Red",hex:"8B0000"},{name:"Dark Yellow",hex:"808000"},{name:"Gray 50%",hex:"808080"},{name:"Gray 25%",hex:"C0C0C0"},{name:"Black",hex:"000000"}],mo={position:"relative",display:"inline-block"},Ie={display:"flex",alignItems:"center",justifyContent:"center",width:"40px",height:"32px",padding:"2px 6px",border:"none",borderRadius:"4px",backgroundColor:"transparent",cursor:"pointer",transition:"background-color 0.1s",color:"var(--doc-text-muted)"},xo={...Ie,backgroundColor:"var(--doc-bg-hover)"},fo={...Ie,backgroundColor:"var(--doc-primary-light)",color:"var(--doc-primary)"},bo={...Ie,cursor:"default",opacity:.38},ho={display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"0"},vo={width:"14px",height:"3px",borderRadius:"0",marginTop:"-2px"},yo={display:"grid",gap:"2px"},Pe={width:"20px",height:"20px",border:"1px solid #ccc",borderRadius:"2px",cursor:"pointer",transition:"transform 0.1s, border-color 0.1s",padding:0},So={...Pe,transform:"scale(1.1)",borderColor:"#333",zIndex:1},Co={...Pe,borderWidth:"2px",borderColor:"#0066cc",boxShadow:"0 0 0 1px #0066cc"},wo={...Pe,position:"relative",backgroundColor:"#fff"},ko={position:"absolute",top:"50%",left:"-2px",right:"-2px",height:"2px",backgroundColor:"#ff0000",transform:"rotate(-45deg)"},ct={fontSize:"11px",color:"#666",marginBottom:"4px",marginTop:"8px"},To={marginTop:"8px",paddingTop:"8px",borderTop:"1px solid #eee"},Eo={display:"flex",alignItems:"center",gap:"8px"},Io={width:"70px",height:"24px",padding:"2px 6px",border:"1px solid #ccc",borderRadius:"3px",fontSize:"12px"},Po={height:"24px",padding:"0 8px",border:"1px solid #ccc",borderRadius:"3px",backgroundColor:"#f5f5f5",fontSize:"12px",cursor:"pointer"},Lo=()=>jsxRuntime.jsx(chunkHE3SUXOQ_cjs.d,{name:"format_color_text",size:18}),Ro=()=>jsxRuntime.jsx(chunkHE3SUXOQ_cjs.d,{name:"ink_highlighter",size:18}),Do=()=>jsxRuntime.jsx(chunkHE3SUXOQ_cjs.d,{name:"arrow_drop_down",size:14});function Oo({colors:e,selectedColor:t,onSelect:o,columns:n=10,cellSize:r=20}){let[i,a]=or.useState(null),d={...yo,gridTemplateColumns:`repeat(${n}, ${r}px)`};return jsxRuntime.jsx("div",{style:d,className:"docx-color-grid",role:"grid",children:e.map((s,l)=>{let x=t?.toUpperCase()===s.hex.toUpperCase(),g=i===l,c=s.hex==="",u={...x?Co:g?So:Pe,width:`${r}px`,height:`${r}px`};return c||(u.backgroundColor=`#${s.hex}`),jsxRuntime.jsx("button",{type:"button",style:c?{...wo,...u}:u,onClick:()=>o(s),onMouseDown:m=>m.preventDefault(),onMouseEnter:()=>a(l),onMouseLeave:()=>a(null),title:s.name,role:"gridcell","aria-label":s.name,"aria-selected":x,children:c&&jsxRuntime.jsx("span",{style:ko})},`${s.hex}-${l}`)})})}function Jn({value:e,onChange:t,type:o="text",theme:n,colors:r,disabled:i=false,className:a,style:d,title:s,children:l,dropdownWidth:x=230,showNoColor:g=true,showMoreColors:c=true}){let[u,m]=or.useState(false),[b,f]=or.useState(false),[h,p]=or.useState(""),v=or.useCallback(()=>m(false),[]),{containerRef:k,dropdownRef:P,dropdownStyle:Y}=chunkHE3SUXOQ_cjs.h({isOpen:u,onClose:v}),I=or.useMemo(()=>{if(o==="highlight")return go;let O=[...uo];return g&&O.unshift({name:"Automatic",hex:"000000"}),O},[o,g]),R=r||I,M=or.useMemo(()=>e?e.startsWith("#")?e:o==="highlight"?chunkIA4LPH2A_cjs.b(e)||"transparent":`#${e}`:o==="text"?"#000000":"transparent",[e,o]),y=or.useCallback(O=>{t?.(O.hex),m(false);},[t]),U=or.useCallback(()=>{let O=h.replace(/^#/,"").toUpperCase();/^[0-9A-F]{6}$/i.test(O)&&(t?.(O),m(false),p(""));},[h,t]),T=or.useCallback(()=>{i||m(O=>!O);},[i]),L=i?bo:u?fo:b?xo:Ie,te=o==="text"?"Font Color":"Text Highlight Color";return jsxRuntime.jsxs("div",{ref:k,className:`docx-color-picker docx-color-picker-${o} ${a||""}`,style:{...mo,...d},children:[jsxRuntime.jsxs("button",{type:"button",className:"docx-color-picker-button",style:L,onClick:T,onMouseDown:O=>O.preventDefault(),onMouseEnter:()=>f(true),onMouseLeave:()=>f(false),disabled:i,title:s||te,"aria-label":s||te,"aria-haspopup":"true","aria-expanded":u,children:[l||jsxRuntime.jsxs("div",{style:ho,children:[o==="text"?jsxRuntime.jsx(Lo,{}):jsxRuntime.jsx(Ro,{}),jsxRuntime.jsx("div",{style:{...vo,backgroundColor:M==="transparent"?"#fff":M,border:M==="transparent"?"1px solid #ccc":"none"}})]}),jsxRuntime.jsx(Do,{})]}),u&&jsxRuntime.jsxs("div",{ref:P,className:"docx-color-picker-dropdown",style:{...Y,padding:"8px",backgroundColor:"#fff",border:"1px solid #ccc",borderRadius:"4px",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",width:x},role:"dialog","aria-label":`${o==="text"?"Font":"Highlight"} color picker`,onMouseDown:O=>O.preventDefault(),children:[o==="highlight"&&jsxRuntime.jsx("div",{style:ct,children:"Highlight Colors"}),jsxRuntime.jsx(Oo,{colors:R,selectedColor:e,onSelect:y,columns:o==="highlight"?8:10}),c&&o==="text"&&jsxRuntime.jsxs("div",{style:To,children:[jsxRuntime.jsx("div",{style:ct,children:"Custom Color"}),jsxRuntime.jsxs("div",{style:Eo,children:[jsxRuntime.jsx("span",{style:{fontSize:"12px",color:"#666"},children:"#"}),jsxRuntime.jsx("input",{type:"text",style:Io,value:h,onChange:O=>p(O.target.value.replace(/[^0-9A-Fa-f]/g,"").slice(0,6)),onKeyDown:O=>{O.key==="Enter"&&U();},placeholder:"FF0000",maxLength:6,"aria-label":"Custom hex color"}),jsxRuntime.jsx("button",{type:"button",style:Po,onClick:U,disabled:!/^[0-9A-Fa-f]{6}$/.test(h),children:"Apply"})]})]})]})]})}var Ao={includeHeaders:true,includeFooters:true,includePageNumbers:true,pageRange:null,scale:1,printBackground:true,margins:"default"};function ei({onPrint:e,disabled:t=false,label:o="Print",className:n="",style:r,showIcon:i=true,compact:a=false}){let d={display:"flex",alignItems:"center",gap:a?"4px":"6px",padding:a?"4px 8px":"6px 12px",fontSize:a?"13px":"14px",backgroundColor:"white",border:"1px solid var(--doc-border)",borderRadius:"4px",cursor:t?"not-allowed":"pointer",color:t?"var(--doc-text-muted)":"var(--doc-text)",opacity:t?.6:1,transition:"background-color 0.15s, border-color 0.15s",...r};return jsxRuntime.jsxs("button",{className:`docx-print-button ${n}`.trim(),style:d,onClick:e,disabled:t,"aria-label":o,title:o,children:[i&&jsxRuntime.jsx(_o,{size:a?14:16}),!a&&jsxRuntime.jsx("span",{children:o})]})}function ti(){return jsxRuntime.jsx("style",{children:`
7
+ @media print {
8
+ /* Hide everything except print content */
9
+ body * {
10
+ visibility: hidden;
11
+ }
12
+
13
+ .docx-print-pages,
14
+ .docx-print-pages * {
15
+ visibility: visible;
16
+ }
17
+
18
+ .docx-print-pages {
19
+ position: absolute;
20
+ left: 0;
21
+ top: 0;
22
+ }
23
+
24
+ /* Remove shadows and margins in print */
25
+ .docx-print-page {
26
+ box-shadow: none !important;
27
+ margin: 0 !important;
28
+ page-break-after: always;
29
+ page-break-inside: avoid;
30
+ }
31
+
32
+ /* Ensure images print */
33
+ img {
34
+ max-width: 100%;
35
+ page-break-inside: avoid;
36
+ }
37
+
38
+ /* Ensure tables don't break badly */
39
+ table {
40
+ page-break-inside: avoid;
41
+ }
42
+
43
+ tr {
44
+ page-break-inside: avoid;
45
+ }
46
+
47
+ /* Keep headings with content */
48
+ h1, h2, h3, h4, h5, h6 {
49
+ page-break-after: avoid;
50
+ }
51
+
52
+ /* Avoid orphan lines */
53
+ p {
54
+ orphans: 3;
55
+ widows: 3;
56
+ }
57
+ }
58
+
59
+ @page {
60
+ margin: 0;
61
+ size: auto;
62
+ }
63
+ `})}function _o({size:e=18}){return jsxRuntime.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("polyline",{points:"6 9 6 2 18 2 18 9"}),jsxRuntime.jsx("path",{d:"M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2"}),jsxRuntime.jsx("rect",{x:"6",y:"14",width:"12",height:"8"})]})}function oi(){window.print();}function ri(e="Document",t){let o=window.open("","_blank");return o?(o.document.write(`
64
+ <!DOCTYPE html>
65
+ <html>
66
+ <head>
67
+ <title>${e}</title>
68
+ <style>
69
+ @media print {
70
+ body {
71
+ margin: 0;
72
+ padding: 0;
73
+ }
74
+ @page {
75
+ margin: 0;
76
+ }
77
+ }
78
+ </style>
79
+ </head>
80
+ <body>
81
+ ${t}
82
+ </body>
83
+ </html>
84
+ `),o.document.close(),o):null}function ni(){return {...Ao}}function ii(e,t){if(!e||!e.trim())return null;let o=e.trim();if(/^\d+$/.test(o)){let r=parseInt(o,10);return r>=1&&r<=t?{start:r,end:r}:null}let n=o.match(/^(\d+)-(\d+)$/);if(n){let r=parseInt(n[1],10),i=parseInt(n[2],10);return r>=1&&i<=t&&r<=i?{start:r,end:i}:null}return null}function ai(e,t){return e?e.start===e.end?`Page ${e.start}`:`Pages ${e.start}-${e.end}`:`All (${t} pages)`}function si(){return typeof window<"u"&&typeof window.print=="function"}function fi({onAction:e,disabled:t=false,canMerge:o=false,canSplit:n=false}){let r=or.useCallback(l=>{l.preventDefault(),l.stopPropagation();},[]),i=or.useCallback(()=>{o&&e("mergeCells");},[e,o]),a=or.useCallback(()=>{n&&e("splitCell");},[e,n]),d=jsxRuntime.jsx(chunkHE3SUXOQ_cjs.c,{content:"Merge cells",children:jsxRuntime.jsx(chunkHE3SUXOQ_cjs.b,{variant:"ghost",size:"icon-sm",className:chunkHE3SUXOQ_cjs.a("text-slate-500 hover:text-slate-900 hover:bg-slate-100/80",(t||!o)&&"opacity-30 cursor-not-allowed"),onMouseDown:r,onClick:i,disabled:t||!o,"aria-label":"Merge cells","data-testid":"toolbar-table-merge",children:jsxRuntime.jsx(chunkHE3SUXOQ_cjs.d,{name:"call_merge",size:20})})}),s=jsxRuntime.jsx(chunkHE3SUXOQ_cjs.c,{content:"Split cell",children:jsxRuntime.jsx(chunkHE3SUXOQ_cjs.b,{variant:"ghost",size:"icon-sm",className:chunkHE3SUXOQ_cjs.a("text-slate-500 hover:text-slate-900 hover:bg-slate-100/80",(t||!n)&&"opacity-30 cursor-not-allowed"),onMouseDown:r,onClick:a,disabled:t||!n,"aria-label":"Split cell","data-testid":"toolbar-table-split",children:jsxRuntime.jsx(chunkHE3SUXOQ_cjs.d,{name:"call_split",size:20})})});return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[d,s]})}var zo=[{action:"addRowAbove",icon:"keyboard_arrow_up",label:"Insert row above",testId:"toolbar-table-add-row-above"},{action:"addRowBelow",icon:"keyboard_arrow_down",label:"Insert row below",testId:"toolbar-table-add-row-below"},{action:"addColumnLeft",icon:"keyboard_arrow_left",label:"Insert column left",testId:"toolbar-table-add-col-left"},{action:"addColumnRight",icon:"keyboard_arrow_right",label:"Insert column right",testId:"toolbar-table-add-col-right"}];function Ti({onAction:e,disabled:t=false}){let o=or.useCallback(n=>{n.preventDefault(),n.stopPropagation();},[]);return jsxRuntime.jsx(jsxRuntime.Fragment,{children:zo.map(({action:n,icon:r,label:i,testId:a})=>jsxRuntime.jsx(chunkHE3SUXOQ_cjs.c,{content:i,children:jsxRuntime.jsx(chunkHE3SUXOQ_cjs.b,{variant:"ghost",size:"icon-sm",className:chunkHE3SUXOQ_cjs.a("text-slate-500 hover:text-slate-900 hover:bg-slate-100/80",t&&"opacity-30 cursor-not-allowed"),onMouseDown:o,onClick:()=>!t&&e(n),disabled:t,"aria-label":i,"data-testid":a,children:jsxRuntime.jsx(chunkHE3SUXOQ_cjs.d,{name:r,size:20})})},typeof n=="string"?n:n.type))})}var Wo="var(--doc-error)",Yo="var(--doc-success)",Uo="You have unsaved changes. Are you sure you want to leave?",Ho=({size:e=16})=>jsxRuntime.jsxs("svg",{width:e,height:e,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M3 2h8l2 2v9a1 1 0 01-1 1H3a1 1 0 01-1-1V3a1 1 0 011-1z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M5 2v4h5V2",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M5 14v-4h6v4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),Ko=({size:e=16})=>jsxRuntime.jsxs("svg",{width:e,height:e,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("path",{d:"M8 5v4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsxRuntime.jsx("circle",{cx:"8",cy:"11",r:"0.5",fill:"currentColor"})]}),Vo=`
85
+ @keyframes docx-unsaved-pulse {
86
+ 0%, 100% { opacity: 1; }
87
+ 50% { opacity: 0.6; }
88
+ }
89
+ `,$o=(e,t,o,n,r,i,a)=>{let d={display:"inline-flex",alignItems:"center",justifyContent:"center",transition:"all 0.2s ease",animation:o&&n?"docx-unsaved-pulse 2s ease-in-out infinite":"none"};switch(t==="absolute-top-right"?(d.position="absolute",d.top="4px",d.right="4px"):t==="absolute-top-left"&&(d.position="absolute",d.top="4px",d.left="4px"),e){case "dot":return {...d,width:`${a}px`,height:`${a}px`,borderRadius:"50%",backgroundColor:o?r:i};case "badge":return {...d,padding:"2px 8px",borderRadius:"10px",fontSize:"11px",fontWeight:500,backgroundColor:o?r:i,color:"white"};case "text":return {...d,fontSize:"12px",color:o?r:i,fontWeight:500};case "icon":return {...d,color:o?r:i};default:return d}},Ri=({hasUnsavedChanges:e,variant:t="dot",position:o="inline",showPulse:n=true,label:r="Unsaved",savedLabel:i="Saved",showWhenSaved:a=false,unsavedColor:d=Wo,savedColor:s=Yo,size:l=8,className:x="",style:g,onClick:c,title:u})=>{if(or.useEffect(()=>{if(!n||!e)return;let p="docx-unsaved-pulse-keyframes";if(!document.getElementById(p)){let v=document.createElement("style");v.id=p,v.textContent=Vo,document.head.appendChild(v);}},[n,e]),!e&&!a)return null;let b={...$o(t,o,e,n,d,s,l),...g,cursor:c?"pointer":void 0},f=e?"Document has unsaved changes":"All changes saved",h=()=>{switch(t){case "dot":return null;case "badge":return e?r:i;case "text":return e?r:i;case "icon":return e?jsxRuntime.jsx(Ko,{size:l}):jsxRuntime.jsx(Ho,{size:l});default:return null}};return jsxRuntime.jsx("span",{className:`docx-unsaved-indicator docx-unsaved-indicator-${t} ${e?"docx-unsaved":"docx-saved"} ${x}`,style:b,onClick:c,title:u??f,role:c?"button":"status","aria-label":e?"Unsaved changes":"All changes saved",children:h()})};function Di(e={}){let{document:t,warnBeforeLeave:o=true,warningMessage:n=Uo,enabled:r=true,onChangeStatusChange:i}=e,[a,d]=or.useState(false),[s,l]=or.useState(0),[x,g]=or.useState(null),c=or.useRef(null),u=or.useRef(false),m=or.useCallback(p=>{if(!p)return null;try{return JSON.stringify(p.package)}catch{return null}},[]),b=or.useCallback(()=>{r&&(d(false),l(0),g(t??null),c.current=m(t));},[r,t,m]),f=or.useCallback(()=>{r&&(a||(d(true),i?.(true)),l(p=>p+1));},[r,a,i]),h=or.useCallback(p=>{let v=p!==void 0?p:t;d(false),l(0),g(v??null),c.current=m(v),u.current=true;},[t,m]);return or.useEffect(()=>{!r||!t||u.current||h(t);},[r,t,h]),or.useEffect(()=>{if(!r||!t||!u.current)return;let p=m(t),v=c.current;if(p!==v){let k=m(x);p!==k?(a||(d(true),i?.(true)),l(P=>P+1)):a&&(d(false),i?.(false)),c.current=p;}},[r,t,x,a,m,i]),or.useEffect(()=>{if(!r||!o||!a)return;let p=v=>(v.preventDefault(),v.returnValue=n,n);return window.addEventListener("beforeunload",p),()=>window.removeEventListener("beforeunload",p)},[r,o,a,n]),{hasUnsavedChanges:a,markAsSaved:b,markAsChanged:f,resetTracking:h,lastSavedDocument:x,changeCount:s}}function Oi(e){return {dot:"Dot",badge:"Badge",text:"Text",icon:"Icon"}[e]}function Ai(){return ["dot","badge","text","icon"]}function _i(){return ["inline","absolute-top-right","absolute-top-left"]}function Mi(){let e=0,t=null,o=false;return {markChanged:()=>{e++,o=true;},markSaved:()=>{o=false,t=new Date;},getState:()=>({changeCount:e,lastSaveTime:t,hasUnsavedChanges:o}),reset:()=>{e=0,t=null,o=false;}}}var Go={small:{size:16,strokeWidth:2,fontSize:11},medium:{size:32,strokeWidth:3,fontSize:13},large:{size:48,strokeWidth:4,fontSize:14}},jo="var(--doc-primary)",Zo=300,Xo=`
90
+ @keyframes docx-loading-spin {
91
+ 0% { transform: rotate(0deg); }
92
+ 100% { transform: rotate(360deg); }
93
+ }
94
+
95
+ @keyframes docx-loading-pulse {
96
+ 0%, 100% { opacity: 1; transform: scale(1); }
97
+ 50% { opacity: 0.5; transform: scale(0.95); }
98
+ }
99
+
100
+ @keyframes docx-loading-dots {
101
+ 0%, 80%, 100% { transform: scale(0); opacity: 0.5; }
102
+ 40% { transform: scale(1); opacity: 1; }
103
+ }
104
+
105
+ @keyframes docx-loading-bar {
106
+ 0% { left: -35%; right: 100%; }
107
+ 60% { left: 100%; right: -90%; }
108
+ 100% { left: 100%; right: -90%; }
109
+ }
110
+ `,Jo=({size:e,strokeWidth:t,color:o})=>{let n=(e-t)/2,r=n*2*Math.PI;return jsxRuntime.jsxs("svg",{width:e,height:e,viewBox:`0 0 ${e} ${e}`,style:{animation:"docx-loading-spin 1s linear infinite"},children:[jsxRuntime.jsx("circle",{cx:e/2,cy:e/2,r:n,fill:"none",stroke:o,strokeWidth:t,strokeLinecap:"round",strokeDasharray:`${r*.75} ${r}`,opacity:.25}),jsxRuntime.jsx("circle",{cx:e/2,cy:e/2,r:n,fill:"none",stroke:o,strokeWidth:t,strokeLinecap:"round",strokeDasharray:`${r*.25} ${r}`,transform:`rotate(-90 ${e/2} ${e/2})`})]})},Qo=({size:e,color:t})=>{let o=e/4,n=o/2;return jsxRuntime.jsx("div",{style:{display:"flex",gap:`${n}px`},children:[0,1,2].map(r=>jsxRuntime.jsx("div",{style:{width:o,height:o,borderRadius:"50%",backgroundColor:t,animation:`docx-loading-dots 1.4s ease-in-out ${r*.16}s infinite both`}},r))})},qo=({size:e,color:t})=>jsxRuntime.jsx("div",{style:{width:e*3,height:e/4,backgroundColor:`${t}20`,borderRadius:e/8,overflow:"hidden",position:"relative"},children:jsxRuntime.jsx("div",{style:{position:"absolute",top:0,bottom:0,left:0,right:0,backgroundColor:t,borderRadius:e/8,animation:"docx-loading-bar 2.1s cubic-bezier(0.65, 0.815, 0.735, 0.395) infinite"}})}),er=({size:e,color:t})=>jsxRuntime.jsx("div",{style:{width:e,height:e,borderRadius:"50%",backgroundColor:t,animation:"docx-loading-pulse 1.5s ease-in-out infinite"}}),tr=({size:e,color:t,progress:o,showText:n,fontSize:r})=>{let i=Math.max(0,Math.min(100,o));return jsxRuntime.jsxs("div",{style:{width:e*3,height:e/4,backgroundColor:`${t}20`,borderRadius:e/8,overflow:"hidden",position:"relative"},children:[jsxRuntime.jsx("div",{style:{position:"absolute",top:0,bottom:0,left:0,width:`${i}%`,backgroundColor:t,borderRadius:e/8,transition:"width 0.3s ease"}}),n&&jsxRuntime.jsxs("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,display:"flex",alignItems:"center",justifyContent:"center",fontSize:r,fontWeight:500,color:i>50?"#fff":t},children:[Math.round(i),"%"]})]})},Wi=({isLoading:e,variant:t="spinner",size:o="medium",message:n,overlay:r=false,overlayOpacity:i=.5,progress:a=0,showProgressText:d=true,color:s=jo,className:l="",style:x})=>{let g=Go[o];if(or.useEffect(()=>{let m="docx-loading-keyframes";if(!document.getElementById(m)){let b=document.createElement("style");b.id=m,b.textContent=Xo,document.head.appendChild(b);}},[]),!e)return null;let c=()=>{switch(t){case "spinner":return jsxRuntime.jsx(Jo,{size:g.size,strokeWidth:g.strokeWidth,color:s});case "dots":return jsxRuntime.jsx(Qo,{size:g.size,color:s});case "bar":return jsxRuntime.jsx(qo,{size:g.size,color:s});case "pulse":return jsxRuntime.jsx(er,{size:g.size,color:s});case "progress":return jsxRuntime.jsx(tr,{size:g.size,color:s,progress:a,showText:d,fontSize:g.fontSize});default:return null}},u=jsxRuntime.jsxs("div",{className:`docx-loading-content ${l}`,style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"12px",...x},children:[c(),n&&jsxRuntime.jsx("div",{style:{fontSize:g.fontSize,color:r?"white":"var(--doc-text-muted)",textAlign:"center"},children:n})]});return r?jsxRuntime.jsx("div",{className:`docx-loading-overlay ${l}`,style:{position:"fixed",top:0,left:0,right:0,bottom:0,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:`rgba(0, 0, 0, ${i})`,zIndex:1e4,...x},role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":t==="progress"?a:void 0,"aria-busy":"true","aria-label":n||"Loading",children:u}):jsxRuntime.jsx("div",{className:`docx-loading-inline ${l}`,style:{display:"inline-flex",alignItems:"center",...x},role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":t==="progress"?a:void 0,"aria-busy":"true","aria-label":n||"Loading",children:u})};function Yi(e={}){let{initialLoading:t=false,minDuration:o=Zo,onStart:n,onEnd:r}=e,[i,a]=or.useState(t),[d,s]=or.useState(null),[l,x]=or.useState(0),g=or.useRef(null),c=or.useRef(null),u=or.useCallback(f=>{g.current=Date.now(),a(true),s(f||null),x(0),n?.();},[n]),m=or.useCallback(()=>{let f=g.current,h=Date.now(),p=f?h-f:0,v=Math.max(0,o-p);v>0?c.current=setTimeout(()=>{a(false),s(null),x(0),g.current=null,r?.();},v):(a(false),s(null),x(0),g.current=null,r?.());},[o,r]),b=or.useCallback(async(f,h)=>{u(h);try{let p=await f();return m(),p}catch(p){throw m(),p}},[u,m]);return or.useEffect(()=>()=>{c.current&&clearTimeout(c.current);},[]),{isLoading:i,message:d,progress:l,startLoading:u,stopLoading:m,setProgress:x,setMessage:s,withLoading:b}}function Ui(){let[e,t]=or.useState(new Map),o=or.useCallback((d,s)=>{t(l=>{let x=new Map(l);return x.set(d,{id:d,message:s,startTime:Date.now()}),x});},[]),n=or.useCallback((d,s)=>{t(l=>{let x=l.get(d);if(!x)return l;let g=new Map(l);return g.set(d,{...x,...s}),g});},[]),r=or.useCallback(d=>{t(s=>{let l=new Map(s);return l.delete(d),l});},[]),i=e.size>0;return {operations:Array.from(e.values()),isAnyLoading:i,startOperation:o,updateOperation:n,endOperation:r,getOperation:d=>e.get(d)}}function Hi(e){return {spinner:"Spinner",dots:"Dots",bar:"Bar",pulse:"Pulse",progress:"Progress"}[e]}function Ki(){return ["spinner","dots","bar","pulse","progress"]}function Vi(){return ["small","medium","large"]}function $i(e){return new Promise(t=>setTimeout(t,e))}var bt=4,ht=36,ir=32,ar=()=>jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"3",cy:"8",r:"1.5",fill:"currentColor"}),jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"1.5",fill:"currentColor"}),jsxRuntime.jsx("circle",{cx:"13",cy:"8",r:"1.5",fill:"currentColor"})]});function sr(e){let{containerRef:t,items:o,itemGap:n=bt,overflowButtonWidth:r=ht}=e,[i,a]=or.useState(o.length),d=or.useRef(new Map),s=or.useCallback(()=>{let g=t.current;if(!g){a(o.length);return}let c=g.offsetWidth;if(c===0)return;let u=[...o].sort((f,h)=>f.alwaysVisible&&!h.alwaysVisible?-1:!f.alwaysVisible&&h.alwaysVisible?1:(f.priority||3)-(h.priority||3)),m=0,b=0;for(let f of u){let p=(f.minWidth||d.current.get(f.id)||ir)+(b>0?n:0),v=b<o.length-1?r+n:0;if(m+p+v<=c)m+=p,b++;else if(f.alwaysVisible)m+=p,b++;else break}a(Math.max(0,b));},[t,o,n,r]);or.useLayoutEffect(()=>{let g=t.current;if(!g)return;s();let c=new ResizeObserver(()=>{s();});return c.observe(g),()=>{c.disconnect();}},[t,s]),or.useEffect(()=>{s();},[o,s]);let{visibleItems:l,overflowItems:x}=or.useMemo(()=>{let g=[...o].sort((c,u)=>c.alwaysVisible&&!u.alwaysVisible?-1:!c.alwaysVisible&&u.alwaysVisible?1:(c.priority||3)-(u.priority||3));return {visibleItems:g.slice(0,i),overflowItems:g.slice(i)}},[o,i]);return {visibleItems:l,overflowItems:x,hasOverflow:x.length>0,recalculate:s}}var lr=({items:e,isOpen:t,onClose:o,anchorRef:n})=>{let r=or.useRef(null);return or.useEffect(()=>{if(!t)return;let i=a=>{r.current&&!r.current.contains(a.target)&&n.current&&!n.current.contains(a.target)&&o();};return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[t,o,n]),or.useEffect(()=>{if(!t)return;let i=a=>{a.key==="Escape"&&o();};return document.addEventListener("keydown",i),()=>document.removeEventListener("keydown",i)},[t,o]),!t||e.length===0?null:jsxRuntime.jsx("div",{ref:r,className:"docx-responsive-toolbar-overflow-menu",style:{position:"absolute",top:"100%",right:0,marginTop:"4px",backgroundColor:"white",border:"1px solid var(--doc-border)",borderRadius:"8px",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",padding:"8px",zIndex:1e3,display:"flex",flexWrap:"wrap",gap:"4px",maxWidth:"300px"},role:"menu",children:e.map(i=>jsxRuntime.jsx("div",{className:"docx-responsive-toolbar-overflow-item",role:"menuitem",children:i.content},i.id))})},Xi=({items:e,overflowItems:t=[],alwaysShowOverflow:o=false,renderOverflowButton:n,renderOverflowMenu:r,itemGap:i=bt,padding:a="8px 12px",overflowButtonWidth:d=ht,className:s="",style:l,height:x=44,backgroundColor:g="var(--doc-toolbar-bg)",borderBottom:c="1px solid var(--doc-border)"})=>{let u=or.useRef(null),m=or.useRef(null),[b,f]=or.useState(false),{visibleItems:h,overflowItems:p,hasOverflow:v}=sr({containerRef:u,items:e,itemGap:i,overflowButtonWidth:d}),k=[...p,...t],P=v||o||t.length>0,Y=or.useCallback(()=>{f(M=>!M);},[]),I=or.useCallback(()=>{f(false);},[]),R=jsxRuntime.jsx("button",{ref:m,type:"button",className:"docx-responsive-toolbar-overflow-button",onClick:Y,"aria-label":`Show ${k.length} more options`,"aria-expanded":b,"aria-haspopup":"menu",style:{display:"flex",alignItems:"center",justifyContent:"center",width:`${d}px`,height:"32px",border:"none",borderRadius:"4px",backgroundColor:b?"var(--doc-primary-light)":"transparent",color:"var(--doc-text-muted)",cursor:"pointer",transition:"background-color 0.15s ease"},children:jsxRuntime.jsx(ar,{})});return jsxRuntime.jsxs("div",{ref:u,className:`docx-responsive-toolbar ${s}`,style:{display:"flex",alignItems:"center",gap:`${i}px`,height:typeof x=="number"?`${x}px`:x,padding:a,backgroundColor:g,borderBottom:c,position:"relative",...l},children:[h.map(M=>jsxRuntime.jsxs(or__default.default.Fragment,{children:[jsxRuntime.jsx("div",{className:"docx-responsive-toolbar-item","data-item-id":M.id,style:{flexShrink:0},children:M.content}),M.separatorAfter&&jsxRuntime.jsx("div",{className:"docx-responsive-toolbar-separator",style:{width:"1px",height:"24px",backgroundColor:"var(--doc-border)",margin:"0 4px"}})]},M.id)),P&&jsxRuntime.jsx("div",{style:{flex:1,minWidth:0}}),P&&jsxRuntime.jsxs("div",{style:{position:"relative",flexShrink:0},children:[n?n(k.length,b,Y):R,r?b&&r(k,I):jsxRuntime.jsx(lr,{items:k,isOpen:b,onClose:I,anchorRef:m})]})]})},Ji=({children:e,gap:t=2,separatorAfter:o=false,className:n="",style:r})=>jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:`docx-toolbar-group ${n}`,style:{display:"flex",alignItems:"center",gap:`${t}px`,...r},children:e}),o&&jsxRuntime.jsx("div",{className:"docx-toolbar-group-separator",style:{width:"1px",height:"24px",backgroundColor:"var(--doc-border)",margin:"0 4px"}})]});function Qi(e,t,o){return {id:e,content:t,priority:3,...o}}function qi(e){return e.map(t=>({...t,priority:t.priority||3}))}function ea(e){return {undo:1,redo:1,bold:1,italic:1,underline:2,fontFamily:2,fontSize:2,textColor:3,highlightColor:3,alignment:3,lists:4,indent:4,lineSpacing:5,styles:5}[e]||3}var pr={position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.5)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e4},ur={backgroundColor:"white",borderRadius:"8px",boxShadow:"0 4px 20px rgba(0, 0, 0, 0.15)",minWidth:"320px",maxWidth:"400px",width:"100%",margin:"20px"},gr={display:"flex",justifyContent:"space-between",alignItems:"center",padding:"16px 20px",borderBottom:"1px solid var(--doc-border)"},mr={margin:0,fontSize:"18px",fontWeight:600,color:"var(--doc-text)"},xr={background:"none",border:"none",fontSize:"20px",cursor:"pointer",color:"var(--doc-text-muted)",padding:"4px 8px",lineHeight:1},fr={padding:"20px"},br={display:"flex",flexDirection:"column",alignItems:"center",marginBottom:"16px"},hr={display:"grid",gap:"2px",padding:"4px",backgroundColor:"var(--doc-bg-hover)",borderRadius:"4px",cursor:"pointer"},kt={width:"24px",height:"24px",backgroundColor:"white",border:"1px solid var(--doc-border-dark)",borderRadius:"2px",transition:"background-color 0.1s, border-color 0.1s"},vr={...kt,backgroundColor:"var(--doc-primary)",borderColor:"var(--doc-primary)"},yr={marginTop:"8px",fontSize:"14px",fontWeight:500,color:"var(--doc-text)"},Sr={display:"flex",alignItems:"center",gap:"12px",margin:"16px 0",color:"var(--doc-text-muted)",fontSize:"12px"},yt={flex:1,height:"1px",backgroundColor:"var(--doc-border)"},St={display:"flex",alignItems:"center",gap:"12px",marginBottom:"12px"},Ct={fontSize:"14px",fontWeight:500,color:"var(--doc-text)",minWidth:"80px"},wt={width:"80px",padding:"8px 12px",border:"1px solid var(--doc-border-input)",borderRadius:"4px",fontSize:"14px",textAlign:"center"},Cr={display:"flex",justifyContent:"flex-end",gap:"12px",padding:"16px 20px",borderTop:"1px solid var(--doc-border)"},Ge={padding:"10px 20px",borderRadius:"4px",fontSize:"14px",fontWeight:500,cursor:"pointer",border:"none"},wr={...Ge,backgroundColor:"var(--doc-primary)",color:"white"},kr={...Ge,backgroundColor:"var(--doc-bg-hover)",color:"var(--doc-text)",border:"1px solid var(--doc-border-input)"},Tr={...Ge,backgroundColor:"var(--doc-border-input)",color:"var(--doc-text-muted)",cursor:"not-allowed"};function Er(){return jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("rect",{x:"2",y:"2",width:"16",height:"16",stroke:"currentColor",strokeWidth:"1.5",fill:"none",rx:"1"}),jsxRuntime.jsx("line",{x1:"2",y1:"7",x2:"18",y2:"7",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("line",{x1:"2",y1:"12",x2:"18",y2:"12",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("line",{x1:"8",y1:"2",x2:"8",y2:"18",stroke:"currentColor",strokeWidth:"1.5"}),jsxRuntime.jsx("line",{x1:"13",y1:"2",x2:"13",y2:"18",stroke:"currentColor",strokeWidth:"1.5"})]})}function ia({isOpen:e,onClose:t,onInsert:o,maxGridRows:n=8,maxGridColumns:r=10,maxRows:i=100,maxColumns:a=20,className:d,style:s}){let[l,x]=or.useState(0),[g,c]=or.useState(0),[u,m]=or.useState(3),[b,f]=or.useState(3),h=or.useRef(null);or.useEffect(()=>{e&&(x(0),c(0),m(3),f(3));},[e]),or.useEffect(()=>{e&&h.current?.focus();},[e]);let p=or.useCallback((T,L)=>{x(T),c(L);},[]),v=or.useCallback(()=>{l>0&&g>0&&o({rows:l,columns:g});},[l,g,o]),k=or.useCallback(()=>{let T=Math.min(Math.max(1,u),i),L=Math.min(Math.max(1,b),a);o({rows:T,columns:L});},[u,b,i,a,o]),P=or.useCallback(T=>{T.key==="Escape"?t():T.key==="Enter"&&!T.shiftKey&&(T.preventDefault(),k());},[t,k]),Y=or.useCallback(T=>{T.target===T.currentTarget&&t();},[t]),I=or.useCallback(T=>{let L=parseInt(T.target.value,10);isNaN(L)?T.target.value===""&&m(1):m(Math.min(Math.max(1,L),i));},[i]),R=or.useCallback(T=>{let L=parseInt(T.target.value,10);isNaN(L)?T.target.value===""&&f(1):f(Math.min(Math.max(1,L),a));},[a]);if(!e)return null;let M=[];for(let T=1;T<=n;T++)for(let L=1;L<=r;L++){let te=T<=l&&L<=g;M.push(jsxRuntime.jsx("div",{style:te?vr:kt,onMouseEnter:()=>p(T,L),onClick:v,role:"gridcell","aria-selected":te},`${T}-${L}`));}let y=u>=1&&b>=1,U=l>0&&g>0?`${g} x ${l} Table`:"Hover to select size";return jsxRuntime.jsx("div",{className:`docx-insert-table-dialog-overlay ${d||""}`,style:{...pr,...s},onClick:Y,onKeyDown:P,role:"dialog","aria-modal":"true","aria-labelledby":"insert-table-dialog-title",children:jsxRuntime.jsxs("div",{ref:h,className:"docx-insert-table-dialog",style:ur,tabIndex:-1,children:[jsxRuntime.jsxs("div",{className:"docx-insert-table-dialog-header",style:gr,children:[jsxRuntime.jsx("h2",{id:"insert-table-dialog-title",style:mr,children:jsxRuntime.jsxs("span",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[jsxRuntime.jsx(Er,{}),"Insert Table"]})}),jsxRuntime.jsx("button",{type:"button",className:"docx-insert-table-dialog-close",style:xr,onClick:t,"aria-label":"Close dialog",children:"\xD7"})]}),jsxRuntime.jsxs("div",{className:"docx-insert-table-dialog-body",style:fr,children:[jsxRuntime.jsxs("div",{className:"docx-insert-table-grid-container",style:br,children:[jsxRuntime.jsx("div",{className:"docx-insert-table-grid",style:{...hr,gridTemplateColumns:`repeat(${r}, 1fr)`},onMouseLeave:()=>{x(0),c(0);},role:"grid","aria-label":"Table size selector",children:M}),jsxRuntime.jsx("div",{className:"docx-insert-table-grid-label",style:yr,children:U})]}),jsxRuntime.jsxs("div",{className:"docx-insert-table-separator",style:Sr,children:[jsxRuntime.jsx("div",{style:yt}),jsxRuntime.jsx("span",{children:"or specify size"}),jsxRuntime.jsx("div",{style:yt})]}),jsxRuntime.jsxs("div",{className:"docx-insert-table-inputs",children:[jsxRuntime.jsxs("div",{style:St,children:[jsxRuntime.jsx("label",{htmlFor:"insert-table-rows",style:Ct,children:"Rows:"}),jsxRuntime.jsx("input",{id:"insert-table-rows",type:"number",min:1,max:i,value:u,onChange:I,style:wt})]}),jsxRuntime.jsxs("div",{style:St,children:[jsxRuntime.jsx("label",{htmlFor:"insert-table-cols",style:Ct,children:"Columns:"}),jsxRuntime.jsx("input",{id:"insert-table-cols",type:"number",min:1,max:a,value:b,onChange:R,style:wt})]})]})]}),jsxRuntime.jsxs("div",{className:"docx-insert-table-dialog-footer",style:Cr,children:[jsxRuntime.jsx("button",{type:"button",className:"docx-insert-table-dialog-cancel",style:kr,onClick:t,children:"Cancel"}),jsxRuntime.jsx("button",{type:"button",className:"docx-insert-table-dialog-insert",style:y?wr:Tr,onClick:k,disabled:!y,children:"Insert Table"})]})]})})}function aa(){let[e,t]=or.useState(false),o=or.useCallback(()=>t(true),[]),n=or.useCallback(()=>t(false),[]),r=or.useCallback(()=>t(i=>!i),[]);return {isOpen:e,open:o,close:n,toggle:r}}function sa(e=3,t=3){return {rows:e,columns:t}}function la(e,t=100,o=20){return e.rows>=1&&e.rows<=t&&e.columns>=1&&e.columns<=o}function da(e,t=100,o=20){return {rows:Math.min(Math.max(1,e.rows),t),columns:Math.min(Math.max(1,e.columns),o)}}function ca(e){return `${e.columns} x ${e.rows}`}function pa(){return [{label:"2 x 2",config:{rows:2,columns:2}},{label:"3 x 3",config:{rows:3,columns:3}},{label:"4 x 4",config:{rows:4,columns:4}},{label:"2 x 4",config:{rows:2,columns:4}},{label:"4 x 2",config:{rows:4,columns:2}},{label:"5 x 5",config:{rows:5,columns:5}}]}var Pr={position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.5)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e4},Lr={backgroundColor:"white",borderRadius:"8px",boxShadow:"0 4px 20px rgba(0, 0, 0, 0.15)",minWidth:"450px",maxWidth:"600px",width:"100%",margin:"20px",maxHeight:"90vh",overflow:"auto"},Rr={display:"flex",justifyContent:"space-between",alignItems:"center",padding:"16px 20px",borderBottom:"1px solid var(--doc-border)"},Dr={margin:0,fontSize:"18px",fontWeight:600,color:"var(--doc-text)"},Or={background:"none",border:"none",fontSize:"20px",cursor:"pointer",color:"var(--doc-text-muted)",padding:"4px 8px",lineHeight:1},Ar={padding:"20px"},je={border:"2px dashed var(--doc-border-input)",borderRadius:"8px",padding:"40px 20px",textAlign:"center",cursor:"pointer",transition:"border-color 0.2s, background-color 0.2s",marginBottom:"16px"},_r={...je,borderColor:"var(--doc-primary)",backgroundColor:"var(--doc-primary-light)"},Mr={...je,padding:"20px",borderStyle:"solid",borderColor:"var(--doc-primary)"},Nr={display:"flex",justifyContent:"center",alignItems:"center",maxHeight:"250px",overflow:"hidden"},Fr={maxWidth:"100%",maxHeight:"250px",objectFit:"contain",borderRadius:"4px"},zr={fontSize:"48px",color:"var(--doc-text-placeholder)",marginBottom:"12px"},Br={fontSize:"14px",color:"var(--doc-text-muted)",marginBottom:"8px"},Wr={fontSize:"12px",color:"var(--doc-text-placeholder)"},Et={marginBottom:"16px"},It={display:"block",marginBottom:"6px",fontSize:"14px",fontWeight:500,color:"var(--doc-text)"},Yr={width:"100%",padding:"10px 12px",border:"1px solid var(--doc-border-input)",borderRadius:"4px",fontSize:"14px",boxSizing:"border-box"},Ur={display:"flex",alignItems:"center",gap:"12px"},Pt={width:"100px",padding:"8px 12px",border:"1px solid var(--doc-border-input)",borderRadius:"4px",fontSize:"14px",textAlign:"center"},Rt={padding:"6px 10px",border:"1px solid var(--doc-border-input)",borderRadius:"4px",backgroundColor:"white",cursor:"pointer",fontSize:"16px"},Hr={...Rt,backgroundColor:"var(--doc-primary)",borderColor:"var(--doc-primary)",color:"white"},Kr={fontSize:"12px",color:"var(--doc-text-muted)",marginTop:"8px",textAlign:"center"},Vr={display:"flex",justifyContent:"flex-end",gap:"12px",padding:"16px 20px",borderTop:"1px solid var(--doc-border)"},Ze={padding:"10px 20px",borderRadius:"4px",fontSize:"14px",fontWeight:500,cursor:"pointer",border:"none"},$r={...Ze,backgroundColor:"var(--doc-primary)",color:"white"},Gr={...Ze,backgroundColor:"var(--doc-bg-subtle)",color:"var(--doc-text)",border:"1px solid var(--doc-border-input)"},jr={...Ze,backgroundColor:"var(--doc-border-input)",color:"var(--doc-text-muted)",cursor:"not-allowed"};function Zr(){return jsxRuntime.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("rect",{x:"6",y:"10",width:"36",height:"28",rx:"2",stroke:"var(--doc-text-placeholder)",strokeWidth:"2",fill:"none"}),jsxRuntime.jsx("circle",{cx:"16",cy:"20",r:"4",stroke:"var(--doc-text-placeholder)",strokeWidth:"2",fill:"none"}),jsxRuntime.jsx("path",{d:"M6 32L16 24L26 34L36 22L42 28",stroke:"var(--doc-text-placeholder)",strokeWidth:"2",fill:"none"})]})}function Xr({locked:e}){return e?jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M12 6V4a4 4 0 0 0-8 0v2H3v8h10V6h-1zm-6-2a2 2 0 0 1 4 0v2H6V4zm6 8H4V8h8v4z"})}):jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M10 6V4a2 2 0 0 0-4 0v2H4v8h8V6h-2zM6 4a2 2 0 0 1 4 0v2h-2V4H6v2H4v2H6V4zm4 8H6V8h4v4z"})})}function fa({isOpen:e,onClose:t,onInsert:o,maxWidth:n=800,maxHeight:r=600,accept:i="image/*",className:a,style:d}){let[s,l]=or.useState(null),[x,g]=or.useState(false),[c,u]=or.useState(0),[m,b]=or.useState(0),[f,h]=or.useState(""),[p,v]=or.useState(true),[k,P]=or.useState(1),[Y,I]=or.useState(null),R=or.useRef(null),M=or.useRef(null);or.useEffect(()=>{e&&(l(null),g(false),u(0),b(0),h(""),v(true),P(1),I(null));},[e]);let y=or.useCallback(E=>{if(!E.type.startsWith("image/")){I("Please select a valid image file");return}if(E.size>10*1024*1024){I("Image file is too large (max 10MB)");return}I(null);let B=new FileReader;B.onload=Ht=>{let tt=Ht.target?.result,ae=new Image;ae.onload=()=>{let se=ae.width,le=ae.height;if(se>n||le>r){let Kt=n/se,Vt=r/le,ot=Math.min(Kt,Vt);se=Math.round(se*ot),le=Math.round(le*ot);}u(se),b(le),P(ae.width/ae.height),l({src:tt,width:se,height:le,fileName:E.name,mimeType:E.type});},ae.src=tt;},B.onerror=()=>{I("Failed to read image file");},B.readAsDataURL(E);},[n,r]),U=or.useCallback(E=>{let B=E.target.files?.[0];B&&y(B);},[y]),T=or.useCallback(()=>{R.current?.click();},[]),L=or.useCallback(E=>{E.preventDefault(),g(true);},[]),te=or.useCallback(E=>{E.preventDefault(),g(false);},[]),O=or.useCallback(E=>{E.preventDefault(),g(false);let B=E.dataTransfer.files?.[0];B&&y(B);},[y]),Ft=or.useCallback(E=>{let B=parseInt(E.target.value,10)||0;u(B),p&&k&&b(Math.round(B/k));},[p,k]),zt=or.useCallback(E=>{let B=parseInt(E.target.value,10)||0;b(B),p&&k&&u(Math.round(B*k));},[p,k]),Fe=or.useCallback(()=>{s&&o({...s,width:c,height:m,alt:f||void 0});},[s,c,m,f,o]),Bt=or.useCallback(E=>{E.key==="Escape"?t():E.key==="Enter"&&s&&!E.shiftKey&&(E.preventDefault(),Fe());},[t,s,Fe]),Wt=or.useCallback(E=>{E.target===E.currentTarget&&t();},[t]),Yt=or.useCallback(()=>{l(null),u(0),b(0),h(""),I(null),R.current&&(R.current.value="");},[]);if(!e)return null;let et=s!==null&&c>0&&m>0,Ut=()=>s?Mr:x?_r:je;return jsxRuntime.jsx("div",{className:`docx-insert-image-dialog-overlay ${a||""}`,style:{...Pr,...d},onClick:Wt,onKeyDown:Bt,role:"dialog","aria-modal":"true","aria-labelledby":"insert-image-dialog-title",children:jsxRuntime.jsxs("div",{ref:M,className:"docx-insert-image-dialog",style:Lr,tabIndex:-1,children:[jsxRuntime.jsxs("div",{className:"docx-insert-image-dialog-header",style:Rr,children:[jsxRuntime.jsx("h2",{id:"insert-image-dialog-title",style:Dr,children:"Insert Image"}),jsxRuntime.jsx("button",{type:"button",className:"docx-insert-image-dialog-close",style:Or,onClick:t,"aria-label":"Close dialog",children:"\xD7"})]}),jsxRuntime.jsxs("div",{className:"docx-insert-image-dialog-body",style:Ar,children:[jsxRuntime.jsx("input",{ref:R,type:"file",accept:i,onChange:U,style:{display:"none"}}),jsxRuntime.jsx("div",{className:"docx-insert-image-dropzone",style:Ut(),onClick:T,onDragOver:L,onDragLeave:te,onDrop:O,role:"button",tabIndex:0,"aria-label":"Click or drag to upload image",children:s?jsxRuntime.jsx("div",{style:Nr,children:jsxRuntime.jsx("img",{src:s.src,alt:f||"Preview",style:Fr})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{style:zr,children:jsxRuntime.jsx(Zr,{})}),jsxRuntime.jsx("div",{style:Br,children:"Click to select or drag and drop an image"}),jsxRuntime.jsx("div",{style:Wr,children:"PNG, JPG, GIF up to 10MB"})]})}),s?.fileName&&jsxRuntime.jsxs("div",{style:Kr,children:[s.fileName,jsxRuntime.jsx("button",{type:"button",onClick:E=>{E.stopPropagation(),Yt();},style:{marginLeft:"8px",background:"none",border:"none",color:"var(--doc-primary)",cursor:"pointer",fontSize:"12px"},children:"Change"})]}),Y&&jsxRuntime.jsx("div",{style:{color:"var(--doc-error)",fontSize:"14px",marginBottom:"16px",textAlign:"center"},children:Y}),s&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{style:Et,children:[jsxRuntime.jsx("label",{style:It,children:"Dimensions"}),jsxRuntime.jsxs("div",{style:Ur,children:[jsxRuntime.jsx("span",{style:{fontSize:"14px",color:"var(--doc-text-muted)"},children:"Width:"}),jsxRuntime.jsx("input",{type:"number",value:c,onChange:Ft,min:1,max:n,style:Pt}),jsxRuntime.jsx("span",{style:{fontSize:"14px",color:"var(--doc-text-muted)"},children:"px"}),jsxRuntime.jsx("button",{type:"button",onClick:()=>v(!p),style:p?Hr:Rt,title:p?"Aspect ratio locked":"Aspect ratio unlocked",children:jsxRuntime.jsx(Xr,{locked:p})}),jsxRuntime.jsx("span",{style:{fontSize:"14px",color:"var(--doc-text-muted)"},children:"Height:"}),jsxRuntime.jsx("input",{type:"number",value:m,onChange:zt,min:1,max:r,style:Pt}),jsxRuntime.jsx("span",{style:{fontSize:"14px",color:"var(--doc-text-muted)"},children:"px"})]})]}),jsxRuntime.jsxs("div",{style:Et,children:[jsxRuntime.jsx("label",{htmlFor:"insert-image-alt",style:It,children:"Alt Text (optional)"}),jsxRuntime.jsx("input",{id:"insert-image-alt",type:"text",value:f,onChange:E=>h(E.target.value),placeholder:"Describe the image for accessibility",style:Yr})]})]})]}),jsxRuntime.jsxs("div",{className:"docx-insert-image-dialog-footer",style:Vr,children:[jsxRuntime.jsx("button",{type:"button",className:"docx-insert-image-dialog-cancel",style:Gr,onClick:t,children:"Cancel"}),jsxRuntime.jsx("button",{type:"button",className:"docx-insert-image-dialog-insert",style:et?$r:jr,onClick:Fe,disabled:!et,children:"Insert Image"})]})]})})}function ba(){let[e,t]=or.useState(false),o=or.useCallback(()=>t(true),[]),n=or.useCallback(()=>t(false),[]),r=or.useCallback(()=>t(i=>!i),[]);return {isOpen:e,open:o,close:n,toggle:r}}function ha(e){return e.type.startsWith("image/")}function va(){return [".png",".jpg",".jpeg",".gif",".webp",".bmp",".svg"]}function ya(){return "image/png,image/jpeg,image/gif,image/webp,image/bmp,image/svg+xml"}function Sa(e,t,o,n){if(e<=o&&t<=n)return {width:e,height:t};let r=o/e,i=n/t,a=Math.min(r,i);return {width:Math.round(e*a),height:Math.round(t*a)}}function Ca(e){let t=e.split(","),o=t[0].match(/:(.*?);/)?.[1]||"image/png",n=atob(t[1]),r=new Uint8Array(n.length);for(let i=0;i<n.length;i++)r[i]=n.charCodeAt(i);return new Blob([r],{type:o})}function wa(e){return new Promise((t,o)=>{let n=new Image;n.onload=()=>t({width:n.width,height:n.height}),n.onerror=()=>o(new Error("Failed to load image")),n.src=e;})}function ka(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}var en={position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.5)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e4},tn={backgroundColor:"white",borderRadius:"8px",boxShadow:"0 4px 20px rgba(0, 0, 0, 0.15)",minWidth:"450px",maxWidth:"550px",width:"100%",margin:"20px",maxHeight:"80vh",display:"flex",flexDirection:"column"},on={display:"flex",justifyContent:"space-between",alignItems:"center",padding:"16px 20px",borderBottom:"1px solid var(--doc-border)"},rn={margin:0,fontSize:"18px",fontWeight:600,color:"var(--doc-text)"},nn={background:"none",border:"none",fontSize:"20px",cursor:"pointer",color:"var(--doc-text-muted)",padding:"4px 8px",lineHeight:1},an={padding:"20px",flex:1,overflow:"auto"},sn={width:"100%",padding:"10px 12px",border:"1px solid var(--doc-border-input)",borderRadius:"4px",fontSize:"14px",marginBottom:"16px",boxSizing:"border-box"},ln={display:"flex",flexWrap:"wrap",gap:"4px",marginBottom:"16px"},Dt={padding:"6px 12px",border:"1px solid var(--doc-border-input)",borderRadius:"4px",backgroundColor:"white",cursor:"pointer",fontSize:"12px",transition:"all 0.15s"},dn={...Dt,backgroundColor:"var(--doc-primary)",borderColor:"var(--doc-primary)",color:"white"},cn={display:"grid",gridTemplateColumns:"repeat(10, 1fr)",gap:"4px",maxHeight:"250px",overflow:"auto"},pn={width:"36px",height:"36px",display:"flex",alignItems:"center",justifyContent:"center",border:"1px solid var(--doc-border)",borderRadius:"4px",backgroundColor:"white",cursor:"pointer",fontSize:"18px",transition:"all 0.15s"},un={marginTop:"16px",padding:"12px",backgroundColor:"var(--doc-bg-subtle)",borderRadius:"4px",display:"flex",alignItems:"center",gap:"16px"},gn={fontSize:"36px",width:"60px",height:"60px",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"white",borderRadius:"4px",border:"1px solid var(--doc-border)"},mn={flex:1},xn={display:"flex",justifyContent:"flex-end",gap:"12px",padding:"16px 20px",borderTop:"1px solid var(--doc-border)"},Xe={padding:"10px 20px",borderRadius:"4px",fontSize:"14px",fontWeight:500,cursor:"pointer",border:"none"},fn={...Xe,backgroundColor:"var(--doc-primary)",color:"white"},bn={...Xe,backgroundColor:"var(--doc-bg-subtle)",color:"var(--doc-text)",border:"1px solid var(--doc-border-input)"},hn={...Xe,backgroundColor:"var(--doc-border-input)",color:"var(--doc-text-muted)",cursor:"not-allowed"},Se=[{name:"common",label:"Common",symbols:["\xA9","\xAE","\u2122","\u2022","\u2026","\u2014","\u2013","\xB0","\xB1","\xD7","\xF7","\u2260","\u2264","\u2265","\u221E","\u221A","\u2211","\u220F","\u222B","\u03C0","\u20AC","\xA3","\xA5","\xA2","\xA7","\xB6","\u2020","\u2021","\u2030","\u2116"]},{name:"arrows",label:"Arrows",symbols:["\u2190","\u2191","\u2192","\u2193","\u2194","\u2195","\u2196","\u2197","\u2198","\u2199","\u21D0","\u21D1","\u21D2","\u21D3","\u21D4","\u21D5","\u27F5","\u27F6","\u27F7","\u2794","\u279C","\u279E","\u27A1","\u27A2","\u27A3","\u27A4","\u27A5","\u27A6","\u27A7","\u27A8"]},{name:"math",label:"Math",symbols:["+","\u2212","\xD7","\xF7","=","\u2260","<",">","\u2264","\u2265","\xB1","\u2213","\u221E","\u221A","\u221B","\u221C","\u2211","\u220F","\u222B","\u2202","\u2206","\u2207","\u2208","\u2209","\u220B","\u2205","\u2200","\u2203","\u2204","\u2282","\u2283","\u2286","\u2287","\u222A","\u2229","\u2295","\u2297","\u22A5","\u2220","\u221F"]},{name:"greek",label:"Greek",symbols:["\u03B1","\u03B2","\u03B3","\u03B4","\u03B5","\u03B6","\u03B7","\u03B8","\u03B9","\u03BA","\u03BB","\u03BC","\u03BD","\u03BE","\u03BF","\u03C0","\u03C1","\u03C3","\u03C4","\u03C5","\u03C6","\u03C7","\u03C8","\u03C9","\u0391","\u0392","\u0393","\u0394","\u0395","\u0396","\u0397","\u0398","\u0399","\u039A","\u039B","\u039C","\u039D","\u039E","\u039F","\u03A0"]},{name:"shapes",label:"Shapes",symbols:["\u25A0","\u25A1","\u25AA","\u25AB","\u25AC","\u25AD","\u25AE","\u25AF","\u25B0","\u25B1","\u25B2","\u25B3","\u25B4","\u25B5","\u25B6","\u25B7","\u25B8","\u25B9","\u25BA","\u25BB","\u25BC","\u25BD","\u25BE","\u25BF","\u25C0","\u25C1","\u25C2","\u25C3","\u25C4","\u25C5","\u25CF","\u25CB","\u25CE","\u25C9","\u25CC","\u25CD","\u25D0","\u25D1","\u25D2","\u25D3"]},{name:"punctuation",label:"Punctuation",symbols:["\u2013","\u2014","\u2018","\u2019","\u201C","\u201D","\xAB","\xBB","\u2039","\u203A","\u2026","\xB7","\u2022","\u2023","\u2043","\u2010","\u2011","\u2012","\u2015","\u2016","\u2032","\u2033","\u2034","\u2057","\u2035","\u2036","\u2037","\u203B","\u203D","\u2042"]},{name:"currency",label:"Currency",symbols:["$","\xA2","\xA3","\xA4","\xA5","\u20A0","\u20A1","\u20A2","\u20A3","\u20A4","\u20A5","\u20A6","\u20A7","\u20A8","\u20A9","\u20AA","\u20AB","\u20AC","\u20AD","\u20AE","\u20AF","\u20B0","\u20B1","\u20B2","\u20B3","\u20B4","\u20B5","\u20B6","\u20B7","\u20B8"]},{name:"music",label:"Music",symbols:["\u2669","\u266A","\u266B","\u266C","\u266D","\u266E","\u266F","\u{1D11E}","\u{1D122}","\u{1D12A}","\u{1D12B}","\u{1D157}\u{1D165}","\u{1D158}\u{1D165}","\u{1D158}\u{1D165}\u{1D16E}","\u{1D158}\u{1D165}\u{1D16F}","\u{1D158}\u{1D165}\u{1D170}","\u{1D192}","\u{1D193}","\u{1D110}","\u{1D111}"]},{name:"emoji",label:"Emoji",symbols:["\u{1F600}","\u{1F603}","\u{1F604}","\u{1F601}","\u{1F606}","\u{1F605}","\u{1F923}","\u{1F602}","\u{1F642}","\u{1F643}","\u{1F609}","\u{1F60A}","\u{1F607}","\u{1F970}","\u{1F60D}","\u{1F929}","\u{1F618}","\u{1F617}","\u263A","\u{1F61A}","\u2764","\u{1F9E1}","\u{1F49B}","\u{1F49A}","\u{1F499}","\u{1F49C}","\u{1F5A4}","\u{1F90D}","\u{1F494}","\u2763","\u{1F44D}","\u{1F44E}","\u{1F44C}","\u270C","\u{1F91E}","\u{1F91F}","\u{1F918}","\u{1F44B}","\u{1F64F}","\u2705"]}];function Ot(){return Se.flatMap(e=>e.symbols)}function La({isOpen:e,onClose:t,onInsert:o,recentSymbols:n=[],className:r,style:i}){let[a,d]=or.useState("common"),[s,l]=or.useState(null),[x,g]=or.useState(""),[c,u]=or.useState(null),m=or.useRef(null);or.useEffect(()=>{e&&(l(null),g(""),u(null),setTimeout(()=>m.current?.focus(),100));},[e]);let b=or.useMemo(()=>{if(!x.trim())return a==="recent"?n:Se.find(L=>L.name===a)?.symbols||[];let y=x.toLowerCase();return Ot().filter(T=>{let L=T.codePointAt(0)?.toString(16).toUpperCase()||"";return T.includes(y)||L.includes(y.toUpperCase())||`U+${L}`.toLowerCase().includes(y)})},[x,a,n]),f=or.useCallback(y=>{l(y);},[]),h=or.useCallback(y=>{o(y);},[o]),p=or.useCallback(()=>{s&&o(s);},[s,o]),v=or.useCallback(y=>{y.key==="Escape"?t():y.key==="Enter"&&s&&(y.preventDefault(),p());},[t,s,p]),k=or.useCallback(y=>{y.target===y.currentTarget&&t();},[t]),P=y=>{if(!y)return null;let U=y.codePointAt(0);return {character:y,codePoint:U?`U+${U.toString(16).toUpperCase().padStart(4,"0")}`:"",decimal:U||0}};if(!e)return null;let I=P(c||s),R=s!==null,M=[...n.length>0?[{name:"recent",label:"Recent"}]:[],...Se.map(y=>({name:y.name,label:y.label}))];return jsxRuntime.jsx("div",{className:`docx-insert-symbol-dialog-overlay ${r||""}`,style:{...en,...i},onClick:k,onKeyDown:v,role:"dialog","aria-modal":"true","aria-labelledby":"insert-symbol-dialog-title",children:jsxRuntime.jsxs("div",{className:"docx-insert-symbol-dialog",style:tn,children:[jsxRuntime.jsxs("div",{className:"docx-insert-symbol-dialog-header",style:on,children:[jsxRuntime.jsx("h2",{id:"insert-symbol-dialog-title",style:rn,children:"Insert Symbol"}),jsxRuntime.jsx("button",{type:"button",className:"docx-insert-symbol-dialog-close",style:nn,onClick:t,"aria-label":"Close dialog",children:"\xD7"})]}),jsxRuntime.jsxs("div",{className:"docx-insert-symbol-dialog-body",style:an,children:[jsxRuntime.jsx("input",{ref:m,type:"text",placeholder:"Search symbols (character or Unicode)...",value:x,onChange:y=>g(y.target.value),style:sn}),!x&&jsxRuntime.jsx("div",{className:"docx-insert-symbol-categories",style:ln,children:M.map(y=>jsxRuntime.jsx("button",{type:"button",onClick:()=>d(y.name),style:a===y.name?dn:Dt,children:y.label},y.name))}),jsxRuntime.jsx("div",{className:"docx-insert-symbol-grid",style:cn,children:b.map((y,U)=>jsxRuntime.jsx("button",{type:"button",onClick:()=>f(y),onDoubleClick:()=>h(y),onMouseEnter:()=>u(y),onMouseLeave:()=>u(null),style:{...pn,...s===y?{backgroundColor:"var(--doc-primary-light)",borderColor:"var(--doc-primary)"}:{}},title:`${y} - U+${y.codePointAt(0)?.toString(16).toUpperCase()}`,children:y},`${y}-${U}`))}),b.length===0&&jsxRuntime.jsxs("div",{style:{textAlign:"center",padding:"20px",color:"var(--doc-text-muted)"},children:['No symbols found for "',x,'"']}),I&&jsxRuntime.jsxs("div",{className:"docx-insert-symbol-preview",style:un,children:[jsxRuntime.jsx("div",{style:gn,children:I.character}),jsxRuntime.jsxs("div",{style:mn,children:[jsxRuntime.jsx("div",{style:{fontSize:"14px",fontWeight:500,marginBottom:"4px"},children:I.codePoint}),jsxRuntime.jsxs("div",{style:{fontSize:"12px",color:"var(--doc-text-muted)"},children:["Decimal: ",I.decimal]})]})]})]}),jsxRuntime.jsxs("div",{className:"docx-insert-symbol-dialog-footer",style:xn,children:[jsxRuntime.jsx("button",{type:"button",className:"docx-insert-symbol-dialog-cancel",style:bn,onClick:t,children:"Cancel"}),jsxRuntime.jsx("button",{type:"button",className:"docx-insert-symbol-dialog-insert",style:R?fn:hn,onClick:p,disabled:!R,children:"Insert"})]})]})})}function Ra(e=20){let[t,o]=or.useState(false),[n,r]=or.useState([]),i=or.useCallback(()=>o(true),[]),a=or.useCallback(()=>o(false),[]),d=or.useCallback(()=>o(l=>!l),[]),s=or.useCallback(l=>{r(x=>{let g=x.filter(c=>c!==l);return [l,...g].slice(0,e)});},[e]);return {isOpen:t,recentSymbols:n,open:i,close:a,toggle:d,addRecent:s}}function Da(){return Se}function Oa(e){return Se.find(o=>o.name===e)?.symbols||[]}function Aa(e){let t=e.codePointAt(0)||0;return {character:e,codePoint:`U+${t.toString(16).toUpperCase().padStart(4,"0")}`,decimal:t,hex:t.toString(16).toUpperCase()}}function _a(e){if(!e.trim())return [];let t=e.toLowerCase();return Ot().filter(o=>{let n=o.codePointAt(0)?.toString(16).toUpperCase()||"";return o.includes(e)||n.includes(t.toUpperCase())||`U+${n}`.toLowerCase().includes(t)})}function Ma(e){let t=e.replace(/^U\+/i,"").replace(/^0x/i,""),o=parseInt(t,16);return isNaN(o)||o<0||o>1114111?null:String.fromCodePoint(o)}var ne=[{id:"formatted",label:"Keep Source Formatting",description:"Paste with original formatting",shortcut:"Ctrl+V"},{id:"plainText",label:"Paste as Plain Text",description:"Paste without any formatting",shortcut:"Ctrl+Shift+V"}],yn=()=>jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M4 4h12v2H4V4zM4 8h8v2H4V8zM4 12h10v2H4v-2zM4 16h6v2H4v-2z",fill:"currentColor"}),jsxRuntime.jsx("path",{d:"M14 10l3 3-3 3v-2h-2v-2h2v-2z",fill:"currentColor",opacity:"0.6"})]}),Sn=()=>jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M4 4h12v1H4V4zM4 7h12v1H4V7zM4 10h12v1H4v-1zM4 13h12v1H4v-1zM4 16h8v1H4v-1z",fill:"currentColor"})});function Cn(e){switch(e){case "formatted":return jsxRuntime.jsx(yn,{});case "plainText":return jsxRuntime.jsx(Sn,{});default:return null}}var wn=({option:e,isSelected:t,onClick:o,onMouseEnter:n})=>jsxRuntime.jsxs("button",{type:"button",className:`docx-paste-special-option ${t?"docx-paste-special-option-selected":""}`,onClick:o,onMouseEnter:n,role:"menuitem","aria-selected":t,style:{display:"flex",alignItems:"center",gap:"12px",width:"100%",padding:"12px 16px",border:"none",background:t?"var(--doc-primary-light)":"transparent",cursor:"pointer",textAlign:"left",borderRadius:"4px",transition:"background-color 0.15s ease"},children:[jsxRuntime.jsx("span",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",borderRadius:"4px",background:t?"var(--doc-primary)":"var(--doc-bg-hover)",color:t?"white":"var(--doc-text-muted)"},children:Cn(e.id)}),jsxRuntime.jsxs("div",{style:{flex:1},children:[jsxRuntime.jsx("div",{style:{fontSize:"14px",fontWeight:500,color:"var(--doc-text)",marginBottom:"2px"},children:e.label}),jsxRuntime.jsx("div",{style:{fontSize:"12px",color:"var(--doc-text-muted)"},children:e.description})]}),jsxRuntime.jsx("span",{style:{fontSize:"11px",color:"var(--doc-text-subtle)",fontFamily:"monospace"},children:e.shortcut})]}),Ya=({isOpen:e,onClose:t,onPaste:o,position:n,className:r=""})=>{let i=or.useRef(null),[a,d]=or.useState(0),[s,l]=or.useState(null),[x,g]=or.useState(false),[c,u]=or.useState(null);or.useEffect(()=>{if(!e){l(null),u(null),d(0);return}(async()=>{g(true),u(null);try{let h=await chunkHE3SUXOQ_cjs.R({cleanWordFormatting:!0});l(h),h||u("No content available to paste");}catch{u("Unable to read clipboard. Please use Ctrl+V to paste.");}finally{g(false);}})();},[e]),or.useEffect(()=>{if(!e)return;let f=h=>{i.current&&!i.current.contains(h.target)&&t();};return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[e,t]),or.useEffect(()=>{if(!e)return;let f=h=>{switch(h.key){case "Escape":h.preventDefault(),t();break;case "ArrowDown":h.preventDefault(),d(p=>(p+1)%ne.length);break;case "ArrowUp":h.preventDefault(),d(p=>(p-1+ne.length)%ne.length);break;case "Enter":h.preventDefault(),m(ne[a].id);break}};return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[e,a,t]);let m=or.useCallback(f=>{if(!s){u("No content available to paste");return}o(s,f==="plainText"),t();},[s,o,t]),b=or.useCallback(()=>{let p=n?.x??(typeof window<"u"?window.innerWidth/2-160:100),v=n?.y??(typeof window<"u"?window.innerHeight/2-200/2:100);return typeof window<"u"&&(p+320>window.innerWidth&&(p=window.innerWidth-320-10),v+200>window.innerHeight&&(v=window.innerHeight-200-10),p<10&&(p=10),v<10&&(v=10)),{position:"fixed",top:v,left:p,width:320,background:"white",border:"1px solid var(--doc-border-light)",borderRadius:"8px",boxShadow:"0 4px 20px rgba(0, 0, 0, 0.15)",zIndex:10001,overflow:"hidden"}},[n]);return e?jsxRuntime.jsxs("div",{ref:i,className:`docx-paste-special-dialog ${r}`,style:b(),role:"dialog","aria-label":"Paste Special",children:[jsxRuntime.jsxs("div",{style:{padding:"12px 16px",borderBottom:"1px solid var(--doc-border)",display:"flex",alignItems:"center",justifyContent:"space-between"},children:[jsxRuntime.jsx("span",{style:{fontSize:"14px",fontWeight:600,color:"var(--doc-text)"},children:"Paste Special"}),jsxRuntime.jsx("button",{type:"button",onClick:t,"aria-label":"Close",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"24px",height:"24px",border:"none",background:"transparent",cursor:"pointer",borderRadius:"4px",color:"var(--doc-text-muted)"},children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M4 4l8 8M12 4l-8 8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]}),jsxRuntime.jsx("div",{style:{padding:"8px"},children:x?jsxRuntime.jsx("div",{style:{padding:"20px",textAlign:"center",color:"var(--doc-text-muted)",fontSize:"13px"},children:"Reading clipboard..."}):c?jsxRuntime.jsx("div",{style:{padding:"20px",textAlign:"center",color:"var(--doc-error)",fontSize:"13px"},children:c}):jsxRuntime.jsx("div",{role:"menu",children:ne.map((f,h)=>jsxRuntime.jsx(wn,{option:f,isSelected:h===a,onClick:()=>m(f.id),onMouseEnter:()=>d(h)},f.id))})}),s&&!x&&!c&&jsxRuntime.jsxs("div",{style:{padding:"8px 16px 12px",borderTop:"1px solid var(--doc-border)"},children:[jsxRuntime.jsx("div",{style:{fontSize:"11px",color:"var(--doc-text-muted)",marginBottom:"4px"},children:"Preview:"}),jsxRuntime.jsxs("div",{style:{fontSize:"12px",color:"var(--doc-text)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",padding:"6px 8px",background:"var(--doc-bg)",borderRadius:"4px"},children:['"',s.plainText.slice(0,50),s.plainText.length>50?"...":"",'"']})]})]}):null};function Ua(e={}){let{onPaste:t,enabled:o=true}=e,[n,r]=or.useState(false),i=or.useCallback(()=>{o&&r(true);},[o]),a=or.useCallback(()=>{r(false);},[]),d=or.useCallback(async()=>{if(!(!o||!t))try{let l=await chunkHE3SUXOQ_cjs.R({cleanWordFormatting:!0});l&&t(l,!0);}catch(l){console.error("Failed to paste as plain text:",l);}},[o,t]),s=or.useCallback(l=>o&&(l.ctrlKey||l.metaKey)&&l.shiftKey&&l.key.toLowerCase()==="v"?(l.preventDefault(),i(),true):false,[o,i]);return {isOpen:n,openDialog:i,closeDialog:a,handleKeyDown:s,pasteAsPlainText:d}}function Ha(e){return ne.find(t=>t.id===e)}function Ka(){return [...ne]}function Va(){return "formatted"}function $a(e){return (e.ctrlKey||e.metaKey)&&e.shiftKey&&e.key.toLowerCase()==="v"}var Mt={editing:"Editing",formatting:"Formatting",navigation:"Navigation",clipboard:"Clipboard",selection:"Selection",view:"View",file:"File",other:"Other"},Nt=["file","editing","clipboard","formatting","selection","navigation","view","other"],Ne=[{id:"save",name:"Save",description:"Save document",keys:"Ctrl+S",category:"file",common:true},{id:"print",name:"Print",description:"Print document",keys:"Ctrl+P",category:"file"},{id:"undo",name:"Undo",description:"Undo last action",keys:"Ctrl+Z",category:"editing",common:true},{id:"redo",name:"Redo",description:"Redo last action",keys:"Ctrl+Y",altKeys:"Ctrl+Shift+Z",category:"editing",common:true},{id:"delete",name:"Delete",description:"Delete selected text",keys:"Del",altKeys:"Backspace",category:"editing"},{id:"find",name:"Find",description:"Find text in document",keys:"Ctrl+F",category:"editing",common:true},{id:"replace",name:"Find & Replace",description:"Find and replace text",keys:"Ctrl+H",category:"editing"},{id:"cut",name:"Cut",description:"Cut selected text",keys:"Ctrl+X",category:"clipboard",common:true},{id:"copy",name:"Copy",description:"Copy selected text",keys:"Ctrl+C",category:"clipboard",common:true},{id:"paste",name:"Paste",description:"Paste from clipboard",keys:"Ctrl+V",category:"clipboard",common:true},{id:"paste-plain",name:"Paste as Plain Text",description:"Paste without formatting",keys:"Ctrl+Shift+V",category:"clipboard"},{id:"bold",name:"Bold",description:"Toggle bold formatting",keys:"Ctrl+B",category:"formatting",common:true},{id:"italic",name:"Italic",description:"Toggle italic formatting",keys:"Ctrl+I",category:"formatting",common:true},{id:"underline",name:"Underline",description:"Toggle underline formatting",keys:"Ctrl+U",category:"formatting",common:true},{id:"strikethrough",name:"Strikethrough",description:"Toggle strikethrough",keys:"Ctrl+Shift+X",category:"formatting"},{id:"subscript",name:"Subscript",description:"Toggle subscript",keys:"Ctrl+=",category:"formatting"},{id:"superscript",name:"Superscript",description:"Toggle superscript",keys:"Ctrl+Shift+=",category:"formatting"},{id:"align-left",name:"Align Left",description:"Left align paragraph",keys:"Ctrl+L",category:"formatting"},{id:"align-center",name:"Align Center",description:"Center align paragraph",keys:"Ctrl+E",category:"formatting"},{id:"align-right",name:"Align Right",description:"Right align paragraph",keys:"Ctrl+R",category:"formatting"},{id:"align-justify",name:"Justify",description:"Justify paragraph",keys:"Ctrl+J",category:"formatting"},{id:"indent",name:"Increase Indent",description:"Increase paragraph indent",keys:"Tab",category:"formatting"},{id:"outdent",name:"Decrease Indent",description:"Decrease paragraph indent",keys:"Shift+Tab",category:"formatting"},{id:"select-all",name:"Select All",description:"Select all content",keys:"Ctrl+A",category:"selection",common:true},{id:"select-word",name:"Select Word",description:"Select current word",keys:"Double-click",category:"selection"},{id:"select-paragraph",name:"Select Paragraph",description:"Select current paragraph",keys:"Triple-click",category:"selection"},{id:"extend-selection-word",name:"Extend Selection by Word",description:"Extend selection to next/previous word",keys:"Ctrl+Shift+Arrow",category:"selection"},{id:"extend-selection-line",name:"Extend Selection to Line Edge",description:"Extend selection to line start/end",keys:"Shift+Home/End",category:"selection"},{id:"move-word",name:"Move by Word",description:"Move cursor to next/previous word",keys:"Ctrl+Arrow",category:"navigation"},{id:"move-line-start",name:"Move to Line Start",description:"Move cursor to start of line",keys:"Home",category:"navigation"},{id:"move-line-end",name:"Move to Line End",description:"Move cursor to end of line",keys:"End",category:"navigation"},{id:"move-doc-start",name:"Move to Document Start",description:"Move cursor to start of document",keys:"Ctrl+Home",category:"navigation"},{id:"move-doc-end",name:"Move to Document End",description:"Move cursor to end of document",keys:"Ctrl+End",category:"navigation"},{id:"page-up",name:"Page Up",description:"Scroll up one page",keys:"Page Up",category:"navigation"},{id:"page-down",name:"Page Down",description:"Scroll down one page",keys:"Page Down",category:"navigation"},{id:"zoom-in",name:"Zoom In",description:"Increase zoom level",keys:"Ctrl++",altKeys:"Ctrl+Scroll Up",category:"view"},{id:"zoom-out",name:"Zoom Out",description:"Decrease zoom level",keys:"Ctrl+-",altKeys:"Ctrl+Scroll Down",category:"view"},{id:"zoom-reset",name:"Reset Zoom",description:"Reset zoom to 100%",keys:"Ctrl+0",category:"view"},{id:"shortcuts",name:"Keyboard Shortcuts",description:"Show this help dialog",keys:"Ctrl+/",altKeys:"F1",category:"view"}];function kn(){return typeof navigator<"u"&&/Mac|iPod|iPhone|iPad/.test(navigator.platform)}function qe(e){return kn()?e.replace(/Ctrl\+/g,"\u2318").replace(/Alt\+/g,"\u2325").replace(/Shift\+/g,"\u21E7"):e}var Tn=({shortcut:e})=>{let t=qe(e.keys),o=e.altKeys?qe(e.altKeys):null;return jsxRuntime.jsxs("div",{className:"docx-shortcut-item",style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 0",borderBottom:"1px solid var(--doc-border-light)"},children:[jsxRuntime.jsxs("div",{style:{flex:1},children:[jsxRuntime.jsx("div",{style:{fontSize:"13px",fontWeight:500,color:"var(--doc-text)"},children:e.name}),jsxRuntime.jsx("div",{style:{fontSize:"11px",color:"var(--doc-text-muted)",marginTop:"2px"},children:e.description})]}),jsxRuntime.jsxs("div",{style:{display:"flex",gap:"8px",alignItems:"center"},children:[jsxRuntime.jsx("kbd",{style:{display:"inline-flex",alignItems:"center",padding:"4px 8px",fontSize:"12px",fontFamily:"monospace",color:"var(--doc-text)",backgroundColor:"var(--doc-bg-hover)",borderRadius:"4px",border:"1px solid var(--doc-border-light)",boxShadow:"0 1px 1px rgba(0,0,0,0.1)"},children:t}),o&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{style:{color:"var(--doc-text-subtle)",fontSize:"11px"},children:"or"}),jsxRuntime.jsx("kbd",{style:{display:"inline-flex",alignItems:"center",padding:"4px 8px",fontSize:"12px",fontFamily:"monospace",color:"var(--doc-text)",backgroundColor:"var(--doc-bg-hover)",borderRadius:"4px",border:"1px solid var(--doc-border-light)",boxShadow:"0 1px 1px rgba(0,0,0,0.1)"},children:o})]})]})]})},Ja=({isOpen:e,onClose:t,customShortcuts:o=[],showSearch:n=true,className:r=""})=>{let i=or.useRef(null),a=or.useRef(null),[d,s]=or.useState(""),l=or.useMemo(()=>{let c=[...Ne];for(let u of o){let m=c.findIndex(b=>b.id===u.id);m>=0?c[m]=u:c.push(u);}return c},[o]),x=or.useMemo(()=>{if(!d.trim())return l;let c=d.toLowerCase();return l.filter(u=>u.name.toLowerCase().includes(c)||u.description.toLowerCase().includes(c)||u.keys.toLowerCase().includes(c)||u.altKeys&&u.altKeys.toLowerCase().includes(c))},[l,d]),g=or.useMemo(()=>{let c=new Map;for(let m of x){let b=c.get(m.category)||[];b.push(m),c.set(m.category,b);}let u=[];for(let m of Nt){let b=c.get(m);b&&b.length>0&&u.push({category:m,shortcuts:b});}return u},[x]);return or.useEffect(()=>{e&&n&&a.current&&setTimeout(()=>a.current?.focus(),0);},[e,n]),or.useEffect(()=>{e||s("");},[e]),or.useEffect(()=>{if(!e)return;let c=u=>{i.current&&!i.current.contains(u.target)&&t();};return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[e,t]),or.useEffect(()=>{if(!e)return;let c=u=>{u.key==="Escape"&&t();};return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[e,t]),e?jsxRuntime.jsx("div",{className:"docx-shortcuts-overlay",style:{position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.5)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:10001},children:jsxRuntime.jsxs("div",{ref:i,className:`docx-shortcuts-dialog ${r}`,style:{width:"600px",maxWidth:"90vw",maxHeight:"80vh",backgroundColor:"white",borderRadius:"12px",boxShadow:"0 4px 24px rgba(0, 0, 0, 0.2)",display:"flex",flexDirection:"column",overflow:"hidden"},role:"dialog","aria-label":"Keyboard Shortcuts",children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"16px 20px",borderBottom:"1px solid var(--doc-border)"},children:[jsxRuntime.jsx("h2",{style:{margin:0,fontSize:"18px",fontWeight:600,color:"var(--doc-text)"},children:"Keyboard Shortcuts"}),jsxRuntime.jsx("button",{type:"button",onClick:t,"aria-label":"Close",style:{display:"flex",alignItems:"center",justifyContent:"center",width:"32px",height:"32px",border:"none",background:"transparent",cursor:"pointer",borderRadius:"50%",color:"var(--doc-text-muted)"},children:jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsxRuntime.jsx("path",{d:"M5 5l10 10M15 5L5 15",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]}),n&&jsxRuntime.jsx("div",{style:{padding:"12px 20px",borderBottom:"1px solid var(--doc-border)"},children:jsxRuntime.jsx("input",{ref:a,type:"text",value:d,onChange:c=>s(c.target.value),placeholder:"Search shortcuts...",style:{width:"100%",padding:"10px 12px",fontSize:"14px",border:"1px solid var(--doc-border-light)",borderRadius:"6px",outline:"none"}})}),jsxRuntime.jsx("div",{style:{flex:1,overflowY:"auto",padding:"16px 20px"},children:g.length===0?jsxRuntime.jsxs("div",{style:{textAlign:"center",padding:"32px",color:"var(--doc-text-muted)"},children:['No shortcuts found matching "',d,'"']}):g.map(({category:c,shortcuts:u})=>jsxRuntime.jsxs("div",{style:{marginBottom:"24px"},children:[jsxRuntime.jsx("h3",{style:{margin:"0 0 12px 0",fontSize:"13px",fontWeight:600,color:"var(--doc-primary)",textTransform:"uppercase",letterSpacing:"0.5px"},children:Mt[c]}),jsxRuntime.jsx("div",{children:u.map(m=>jsxRuntime.jsx(Tn,{shortcut:m},m.id))})]},c))}),jsxRuntime.jsxs("div",{style:{padding:"12px 20px",borderTop:"1px solid var(--doc-border)",backgroundColor:"var(--doc-bg)",fontSize:"12px",color:"var(--doc-text-muted)",textAlign:"center"},children:["Press"," ",jsxRuntime.jsx("kbd",{style:{padding:"2px 6px",backgroundColor:"white",borderRadius:"4px",border:"1px solid var(--doc-border-light)"},children:"Esc"})," ","to close"]})]})}):null};function Qa(e={}){let{enabled:t=true,openShortcut:o="Ctrl+/"}=e,[n,r]=or.useState(false),i=or.useCallback(()=>{t&&r(true);},[t]),a=or.useCallback(()=>{r(false);},[]),d=or.useCallback(()=>{r(l=>!l);},[]),s=or.useCallback(l=>{if(!t)return;if((l.ctrlKey||l.metaKey)&&(l.key==="/"||l.key==="?")){l.preventDefault(),d();return}if(l.key==="F1"){l.preventDefault(),i();return}},[t,d,i]);return or.useEffect(()=>{if(t)return document.addEventListener("keydown",s),()=>document.removeEventListener("keydown",s)},[t,s]),{isOpen:n,open:i,close:a,toggle:d,handleKeyDown:s}}function qa(){return [...Ne]}function es(e){return Ne.filter(t=>t.category===e)}function ts(){return Ne.filter(e=>e.common)}function os(e){return Mt[e]}function rs(){return [...Nt]}function ns(e){return qe(e)}
111
+ exports.$=Ca;exports.A=Mi;exports.B=Wi;exports.C=Yi;exports.D=Ui;exports.E=Hi;exports.F=Ki;exports.G=Vi;exports.H=$i;exports.I=sr;exports.J=Xi;exports.K=Ji;exports.L=Qi;exports.M=qi;exports.N=ea;exports.O=ia;exports.P=aa;exports.Q=sa;exports.R=la;exports.S=da;exports.T=ca;exports.U=pa;exports.V=fa;exports.W=ba;exports.X=ha;exports.Y=va;exports.Z=ya;exports._=Sa;exports.a=Rn;exports.aa=wa;exports.b=Dn;exports.ba=ka;exports.c=On;exports.ca=Se;exports.d=An;exports.da=La;exports.e=_n;exports.ea=Ra;exports.f=Mn;exports.fa=Da;exports.g=Yn;exports.ga=Oa;exports.h=Un;exports.ha=Aa;exports.i=Hn;exports.ia=_a;exports.j=Kn;exports.ja=Ma;exports.k=Jn;exports.ka=Ya;exports.l=ei;exports.la=Ua;exports.m=ti;exports.ma=Ha;exports.n=oi;exports.na=Ka;exports.o=ri;exports.oa=Va;exports.p=ni;exports.pa=$a;exports.q=ii;exports.qa=Ja;exports.r=ai;exports.ra=Qa;exports.s=si;exports.sa=qa;exports.t=fi;exports.ta=es;exports.u=Ti;exports.ua=ts;exports.v=Ri;exports.va=os;exports.w=Di;exports.wa=rs;exports.x=Oi;exports.xa=ns;exports.y=Ai;exports.z=_i;