pptx-vanilla-viewer 3.4.0 → 3.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +81 -0
- package/README.md +27 -26
- package/dist/{ai-panel-SKJEEM6W.cjs → ai-panel-TCTSMPIH.cjs} +1 -1
- package/dist/{ai-panel-ZJNNRCQC.js → ai-panel-YJVXQDT7.js} +1 -1
- package/dist/{chunk-LQ4JI3WP.js → chunk-6FHDGBUS.js} +2 -2
- package/dist/{chunk-E6UE4V7R.js → chunk-CBPWYT4I.js} +6 -6
- package/dist/{chunk-KR4EBOP3.js → chunk-F3LDPYKE.js} +417 -417
- package/dist/{chunk-DCFIS6IJ.cjs → chunk-G2XAI7GR.cjs} +8 -8
- package/dist/{chunk-TOWHSYAL.cjs → chunk-OQDW73SM.cjs} +417 -417
- package/dist/{chunk-FDZBDXQW.cjs → chunk-QKFFUGWO.cjs} +3 -3
- package/dist/i18n/de.cjs +11 -0
- package/dist/i18n/de.mjs +11 -0
- package/dist/i18n/es.cjs +11 -0
- package/dist/i18n/es.mjs +11 -0
- package/dist/i18n/fr.cjs +11 -0
- package/dist/i18n/fr.mjs +11 -0
- package/dist/i18n/zh-CN.cjs +11 -0
- package/dist/i18n/zh-CN.mjs +11 -0
- package/dist/index.cjs +66 -64
- package/dist/index.d.ts +211 -118
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +65 -63
- package/dist/internals.cjs +1 -1
- package/dist/internals.d.ts +1 -1
- package/dist/internals.js +1 -1
- package/dist/styles.css +2 -0
- package/dist/{transition-overlay-_0B-nMEW.d.ts → transition-overlay-C2lOs9rM.d.ts} +523 -5
- package/dist/transition-overlay-C2lOs9rM.d.ts.map +1 -0
- package/package.json +1 -1
- package/dist/transition-overlay-_0B-nMEW.d.ts.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,87 @@ A release listed with no entries carried no Conventional Commit in this package'
|
|
|
7
7
|
scope: scripts/release-plan.mjs re-releases a package whenever any of its files
|
|
8
8
|
change, not only on conventional ones.
|
|
9
9
|
|
|
10
|
+
## [3.5.0](https://github.com/ChristopherVR/pptx-viewer/releases/tag/pptx-vanilla-viewer@3.5.0) - 2026-09-24
|
|
11
|
+
|
|
12
|
+
### Features
|
|
13
|
+
|
|
14
|
+
- **shared,react,vue,angular,svelte,vanilla:** Empty-canvas context menu (by @ChristopherVR) ([15b9a88](https://github.com/ChristopherVR/pptx-viewer/commit/15b9a88356ef91fda565d65ee107249d32aeb0b8))
|
|
15
|
+
- **shared,react,vue,angular,svelte,vanilla:** Slides pane multi-select + thumbnail menu (by @ChristopherVR) ([4078a33](https://github.com/ChristopherVR/pptx-viewer/commit/4078a33160a1edbabdf37ac7f3163bad37898752))
|
|
16
|
+
- **shared,react,vue,angular,svelte,vanilla:** Real in-place ribbon animation preview (by @ChristopherVR) ([9b98bac](https://github.com/ChristopherVR/pptx-viewer/commit/9b98bac62f90c02c78afe0fa2989ab57dc9e7928))
|
|
17
|
+
|
|
18
|
+
### Bug Fixes
|
|
19
|
+
|
|
20
|
+
- **core:** Stop materializing mc:Ignorable for self-declaring a16 elements (by @ChristopherVR) ([0e9a23a](https://github.com/ChristopherVR/pptx-viewer/commit/0e9a23a9bca70c60974babd4c64abe11c9a2b0e9))
|
|
21
|
+
- **core:** Stop materializing empty a:pPr / a:endParaRPr on real paragraphs (by @ChristopherVR) ([d50a8b6](https://github.com/ChristopherVR/pptx-viewer/commit/d50a8b65ab63bacc10d39eac489899297989e265))
|
|
22
|
+
- **core:** Stop materializing a:rPr@dirty / @smtClean on runs that never authored them (by @ChristopherVR) ([d14f95d](https://github.com/ChristopherVR/pptx-viewer/commit/d14f95d9c56663ecd189f511fbc27ec3210df283))
|
|
23
|
+
- **core:** Stop materializing a:t@xml:space and leaked font @panose (by @ChristopherVR) ([2ce4d43](https://github.com/ChristopherVR/pptx-viewer/commit/2ce4d433a9d7b896b546ad44b6216f416561c0f0))
|
|
24
|
+
- **core:** Stop dropping authored schema-default line/gradient/transition values (by @ChristopherVR) ([374ba48](https://github.com/ChristopherVR/pptx-viewer/commit/374ba4818babfbe72b5ce600b187ccb32a0e3444))
|
|
25
|
+
- **core:** Stop dropping connector arrow-end/dash and ink fallback content (by @ChristopherVR) ([de2a0d1](https://github.com/ChristopherVR/pptx-viewer/commit/de2a0d12054d9007299b445853743fa177322c7f))
|
|
26
|
+
- **core:** Resolve font @panose/@pitchFamily/@charset from the run's own scope (by @ChristopherVR) ([751d9fb](https://github.com/ChristopherVR/pptx-viewer/commit/751d9fbe237f66dd23a7c6b376ef7e6088d98dd6))
|
|
27
|
+
- **core:** Match typeface before trusting the baseline font metadata (by @ChristopherVR) ([7c5f915](https://github.com/ChristopherVR/pptx-viewer/commit/7c5f9151a60fb03d6ae411b4678e51e79364afb8))
|
|
28
|
+
- **core:** Port pyraAcctRatio accent-column split into alg-pyra (by @ChristopherVR) ([08792ef](https://github.com/ChristopherVR/pptx-viewer/commit/08792ef0c9c896d752286ba889a730035e3defda))
|
|
29
|
+
- **core:** Resolve sibTrans transition-point labels in the smartart engine (by @ChristopherVR) ([7a353f0](https://github.com/ChristopherVR/pptx-viewer/commit/7a353f02193766a628496d0ced053cd0d16a4149))
|
|
30
|
+
- **core:** Stop declining SmartArt diagrams over zero-area shapes; port hierRoot/hierChild (by @ChristopherVR) ([2dae123](https://github.com/ChristopherVR/pptx-viewer/commit/2dae123426c79a484a5cc7b37a608898d2080034))
|
|
31
|
+
- **core,shared:** Render surface charts as PowerPoint's four surface types (by @ChristopherVR) ([4a0232b](https://github.com/ChristopherVR/pptx-viewer/commit/4a0232bb0e5dd19490731f31f30c73f3d97e898f))
|
|
32
|
+
- **shared:** Group box-whisker boxes by repeated category, not by series (by @ChristopherVR) ([076ba4c](https://github.com/ChristopherVR/pptx-viewer/commit/076ba4c3ac2ec269ca42a11ec27034df1c3068a4))
|
|
33
|
+
- **core,shared:** Aggregate Pareto bars by category, not by value bin (by @ChristopherVR) ([67ec333](https://github.com/ChristopherVR/pptx-viewer/commit/67ec333a0c32af900213c591a980107c8d8b2e1f))
|
|
34
|
+
- **shared:** Bin histograms with Scott's rule, paint bars one colour (by @ChristopherVR) ([4bae8f0](https://github.com/ChristopherVR/pptx-viewer/commit/4bae8f06d0c54a3e9a46ed3446e17c7a433c761d))
|
|
35
|
+
- **shared:** Draw funnel bars flat and single-coloured, not tapered (by @ChristopherVR) ([82b349a](https://github.com/ChristopherVR/pptx-viewer/commit/82b349a4bc098f9cb13788375c84ebe6cd7cf272))
|
|
36
|
+
- **shared:** Squarify treemap layout, colour by branch, sunburst labels (by @ChristopherVR) ([2b34646](https://github.com/ChristopherVR/pptx-viewer/commit/2b34646ae16a80af25c618a2c747990e47bf208a))
|
|
37
|
+
- **core:** Honor dgm:layoutNode moveWith to stop numbered-list phantom shapes (by @ChristopherVR) ([2c247e9](https://github.com/ChristopherVR/pptx-viewer/commit/2c247e9a96b5356b1e2a88abcdbf503e238ff689))
|
|
38
|
+
- **core:** Stop fabricating a:rPr lang on runs that authored none (by @ChristopherVR) ([ad495de](https://github.com/ChristopherVR/pptx-viewer/commit/ad495ded1cc98e2962f151cadb0e05bb998c71b1))
|
|
39
|
+
- **core:** Preserve text run inner-shadow preset/theme colour choice (by @ChristopherVR) ([6a48785](https://github.com/ChristopherVR/pptx-viewer/commit/6a48785ac9f140d6a85e6dfc9365d122ed2684c0))
|
|
40
|
+
- **core:** Stop padding partial gradFill fillToRect/tileRect with zeros (by @ChristopherVR) ([2dc54d2](https://github.com/ChristopherVR/pptx-viewer/commit/2dc54d2115258091d0f930d4b573a659af6f68b0))
|
|
41
|
+
- **core:** Stop dropping a tiny but authored blipFill a:srcRect crop (by @ChristopherVR) ([3753725](https://github.com/ChristopherVR/pptx-viewer/commit/37537258e2452f5b83d3d5cf27372946e69c0f53))
|
|
42
|
+
- **shared,react:** Round normAutofit fontScale to a whole point (by @ChristopherVR) ([cda09e4](https://github.com/ChristopherVR/pptx-viewer/commit/cda09e4eb35619701663fbfcb81892ef23ee377c))
|
|
43
|
+
- **shared,core:** Fix text reflection mirror, inner shadow, glow, soft edge (by @ChristopherVR) ([1796d14](https://github.com/ChristopherVR/pptx-viewer/commit/1796d14015e6d1a1db2221bcfc90bf446536a453))
|
|
44
|
+
- **core,shared,react:** Size inline equations from their own paragraph; assert anchorCtr on painted text (by @ChristopherVR) ([16ecb59](https://github.com/ChristopherVR/pptx-viewer/commit/16ecb593ba301bced3d68bfb323d1040b1874904))
|
|
45
|
+
|
|
46
|
+
### Testing
|
|
47
|
+
|
|
48
|
+
- **core:** Fix stale coverage evidence anchors after test renames (by @ChristopherVR) ([87c17c6](https://github.com/ChristopherVR/pptx-viewer/commit/87c17c664805806bbcfd90f40e74035a4cca37c9))
|
|
49
|
+
- **core:** Give the salt-less WHIRLPOOL verifier fixture a CI-safe timeout (by @ChristopherVR) ([560c120](https://github.com/ChristopherVR/pptx-viewer/commit/560c12079514f9b0089f6ceceecdd633fda842ea))
|
|
50
|
+
- **shared:** Give the salt-less modify-password check a CI-safe timeout (by @ChristopherVR) ([9ff5b84](https://github.com/ChristopherVR/pptx-viewer/commit/9ff5b84473800b77773c123a819e30c8a02d5097))
|
|
51
|
+
- **core:** Lock in a:blip/a:extLst vendor-extension preservation (by @ChristopherVR) ([d2fad1a](https://github.com/ChristopherVR/pptx-viewer/commit/d2fad1a5a191a7779b99101537294a571224e45a))
|
|
52
|
+
- **shared:** Round the normAutofit fixture in buildParagraphs coverage (by @ChristopherVR) ([a88422d](https://github.com/ChristopherVR/pptx-viewer/commit/a88422dcdf9162e72f1528eae16a16891dfb13bd))
|
|
53
|
+
- **vanilla:** Expect the shared reflection mirror as scale(1, -1) (by @ChristopherVR) ([5758ef6](https://github.com/ChristopherVR/pptx-viewer/commit/5758ef67a7ea60c580311e2312e54c371049ccfb))
|
|
54
|
+
|
|
55
|
+
## [3.4.0](https://github.com/ChristopherVR/pptx-viewer/releases/tag/pptx-vanilla-viewer@3.4.0) - 2026-09-24
|
|
56
|
+
|
|
57
|
+
### Features
|
|
58
|
+
|
|
59
|
+
- **shared,react,vue,angular,svelte,vanilla:** Element context menu format commands + Paste Special (by @ChristopherVR) ([ae48518](https://github.com/ChristopherVR/pptx-viewer/commit/ae485188df20eb0c309a6a4f2ee8b4302d7e7024))
|
|
60
|
+
- **shared,react,vue,angular,svelte,vanilla:** Render online video links as an iframe embed (by @ChristopherVR) ([6ba33e2](https://github.com/ChristopherVR/pptx-viewer/commit/6ba33e26119e20393984625c0e7a7958da5ec466))
|
|
61
|
+
- **shared,react,vue,angular,svelte,vanilla:** Apply Zoom returnToParent/transitionDur during slide-show playback (by @ChristopherVR) ([673afa5](https://github.com/ChristopherVR/pptx-viewer/commit/673afa5c7b62ff61378588b87ddbc1c7b433067e))
|
|
62
|
+
- **core,shared,react,vue,angular,svelte,vanilla:** P15/p14 transition direction, pattern and Through Black options (by @ChristopherVR) ([8b5ec7e](https://github.com/ChristopherVR/pptx-viewer/commit/8b5ec7ec976ad2779bec48d92a7177ad6fe92d38))
|
|
63
|
+
|
|
64
|
+
### Bug Fixes
|
|
65
|
+
|
|
66
|
+
- **core:** Preserve blipFill and exact EMU on shape-with-image-fill save (by @ChristopherVR) ([8cd7a59](https://github.com/ChristopherVR/pptx-viewer/commit/8cd7a59e992e9ca6d4d6eb75756ff50294f346d8))
|
|
67
|
+
- **core:** Parse and re-emit ppaction://media hlinkClick on media pics (by @ChristopherVR) ([ea64525](https://github.com/ChristopherVR/pptx-viewer/commit/ea64525bfbac444c92337159082ccffe06181ce4))
|
|
68
|
+
- **core:** Stop merging authored runs and losing rPr/hlinkClick data (by @ChristopherVR) ([aad7ac3](https://github.com/ChristopherVR/pptx-viewer/commit/aad7ac3d5a31bd0ffbf8718bb5f7db02d09895b9))
|
|
69
|
+
- **core:** Pass untouched chart parts through unchanged on save (by @ChristopherVR) ([3094513](https://github.com/ChristopherVR/pptx-viewer/commit/3094513eec2ab008fcce78c6ac041fcd815169c1))
|
|
70
|
+
- **core:** Stop inventing a bare shape's p:txBody; keep bullet buFont hints (by @ChristopherVR) ([1773570](https://github.com/ChristopherVR/pptx-viewer/commit/1773570a5081cb478c4e38c7f735a1566934b4bf))
|
|
71
|
+
- **core:** Stop fabricating docProps identity, keep comment authors (by @ChristopherVR) ([47a60d8](https://github.com/ChristopherVR/pptx-viewer/commit/47a60d80ea0e3f14854b609abfaf466abb05e159))
|
|
72
|
+
- **shared,react:** Correct Box/Circle/Diamond/Plus entrance "In" mask reveal (by @ChristopherVR) ([cf6ddcf](https://github.com/ChristopherVR/pptx-viewer/commit/cf6ddcf8876cfed3743b6de5a3fb12695aeb5f10))
|
|
73
|
+
- **react,vue,angular,svelte,vanilla,shared:** Stop OLE actions nesting a <button> inside slide thumbnails (by @ChristopherVR) ([82da5a7](https://github.com/ChristopherVR/pptx-viewer/commit/82da5a73896a8498318882051078d65d38e5cb41))
|
|
74
|
+
|
|
75
|
+
### Reverts
|
|
76
|
+
|
|
77
|
+
- **core:** Keep commentAuthors.xml deletion; it was correct behavior (by @ChristopherVR) ([93e4f73](https://github.com/ChristopherVR/pptx-viewer/commit/93e4f73d74ab6247acbc2df9aa2cef6ca9a4ce4d))
|
|
78
|
+
|
|
79
|
+
### Refactor
|
|
80
|
+
|
|
81
|
+
- **shared,react,angular,svelte,vue:** Consolidate trigger options into shared, add afterDelay parity (by @ChristopherVR) ([819582f](https://github.com/ChristopherVR/pptx-viewer/commit/819582f5713c050c7e646385f17c40f9d8a41027))
|
|
82
|
+
|
|
83
|
+
### Documentation
|
|
84
|
+
|
|
85
|
+
- **shared:** Record an inconclusive bounceEnd COM ground-truth attempt (by @ChristopherVR) ([6381b47](https://github.com/ChristopherVR/pptx-viewer/commit/6381b47521f45027cee9eb5c7de48036167bc90b))
|
|
86
|
+
|
|
87
|
+
### Testing
|
|
88
|
+
|
|
89
|
+
- **core,shared:** Lock the COM-verified SVG srcRect stretch rule (by @ChristopherVR) ([f9029d4](https://github.com/ChristopherVR/pptx-viewer/commit/f9029d4dee1b89febc468e2ab3f568ff99f4f603))
|
|
90
|
+
|
|
10
91
|
## [3.3.0](https://github.com/ChristopherVR/pptx-viewer/releases/tag/pptx-vanilla-viewer@3.3.0) - 2026-09-24
|
|
11
92
|
|
|
12
93
|
### Features
|
package/README.md
CHANGED
|
@@ -103,32 +103,33 @@ See the [cross-binding defaults](../../docs/guide/viewport-fit.md).
|
|
|
103
103
|
All options are optional except the container element itself. Beyond the ones
|
|
104
104
|
shown above:
|
|
105
105
|
|
|
106
|
-
| Option | Type | Default | Description
|
|
107
|
-
| -------------------------------------------------------------------------- | ----------------------------------------------------- | ---------------------- |
|
|
108
|
-
| `source` | `string \| ArrayBuffer \| Uint8Array \| Blob \| File` | - | The presentation to open (URL or bytes). Omit to start empty and call `loadFile`/`loadUrl`.
|
|
109
|
-
| `fonts` | `ViewerFontSource[]` | - | Licensed font sources supplied by the host application.
|
|
110
|
-
| `theme` | `ViewerTheme` | - | Chrome theme (colors, radius, CSS vars).
|
|
111
|
-
| `fileName` | `string` | - | Display name shown in the title bar.
|
|
112
|
-
| `locale` / `messages` | `string` / `TranslationMessages` | `'en'` | UI locale and per-locale `pptx.*` dictionaries (see [i18n](#i18n)).
|
|
113
|
-
| `initialSlide` | `number` | `0` | Zero-based slide shown after load.
|
|
114
|
-
| `editable` | `boolean` | `false` | Enable editing (see [Editing](#editing)).
|
|
115
|
-
| `showToolbar` | `boolean` | `true` | Whole ribbon/title-bar/status-bar chrome.
|
|
116
|
-
| `showThumbnails` | `boolean` | `true` | Thumbnail sidebar.
|
|
117
|
-
| `showFormatToolbar` | `boolean` | `true` | Editing format toolbar row (visible only while editing).
|
|
118
|
-
| `showInspector` | `boolean` | `true` | Property inspector panel (visible only while editing).
|
|
119
|
-
| `hiddenActions` | `ToolbarActionId[]` | - | Hide individual buttons/tabs (see [Toolbar customization](#toolbar-customization)).
|
|
120
|
-
| `
|
|
121
|
-
| `
|
|
122
|
-
| `
|
|
123
|
-
| `
|
|
124
|
-
| `
|
|
125
|
-
| `
|
|
126
|
-
| `
|
|
127
|
-
| `
|
|
128
|
-
| `
|
|
129
|
-
| `
|
|
130
|
-
| `
|
|
131
|
-
| `
|
|
106
|
+
| Option | Type | Default | Description |
|
|
107
|
+
| -------------------------------------------------------------------------- | ----------------------------------------------------- | ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
108
|
+
| `source` | `string \| ArrayBuffer \| Uint8Array \| Blob \| File` | - | The presentation to open (URL or bytes). Omit to start empty and call `loadFile`/`loadUrl`. |
|
|
109
|
+
| `fonts` | `ViewerFontSource[]` | - | Licensed font sources supplied by the host application. |
|
|
110
|
+
| `theme` | `ViewerTheme` | - | Chrome theme (colors, radius, CSS vars). |
|
|
111
|
+
| `fileName` | `string` | - | Display name shown in the title bar. |
|
|
112
|
+
| `locale` / `messages` | `string` / `TranslationMessages` | `'en'` | UI locale and per-locale `pptx.*` dictionaries (see [i18n](#i18n)). |
|
|
113
|
+
| `initialSlide` | `number` | `0` | Zero-based slide shown after load. |
|
|
114
|
+
| `editable` | `boolean` | `false` | Enable editing (see [Editing](#editing)). |
|
|
115
|
+
| `showToolbar` | `boolean` | `true` | Whole ribbon/title-bar/status-bar chrome. |
|
|
116
|
+
| `showThumbnails` | `boolean` | `true` | Thumbnail sidebar. |
|
|
117
|
+
| `showFormatToolbar` | `boolean` | `true` | Editing format toolbar row (visible only while editing). |
|
|
118
|
+
| `showInspector` | `boolean` | `true` | Property inspector panel (visible only while editing). |
|
|
119
|
+
| `hiddenActions` | `ToolbarActionId[]` | - | Hide individual buttons/tabs (see [Toolbar customization](#toolbar-customization)). |
|
|
120
|
+
| `customization` | `ViewerCustomization` | - | Hide, lock or remap any part of the UI (ribbon tabs/buttons, File > Options pages/sections/settings, File tab, context menus, shortcuts, panels, AI/collaboration, dialogs); the same helpers (`hideRibbonTab`, `lockSetting`, ...) are on the viewer instance. See the [UI Customization guide](https://christophervr.github.io/pptx-viewer/guide/customization). |
|
|
121
|
+
| `registry` | `ElementRendererRegistry` | - | Custom element-renderer registry (see [Element coverage](#element-coverage)). |
|
|
122
|
+
| `smartArt3D` | `boolean` | `false` | Opt-in Three.js 3D SmartArt renderer (optional `three` peer, lazily imported). |
|
|
123
|
+
| `surfaceChart3D`, `barChart3D`, `lineChart3D`, `areaChart3D`, `pieChart3D` | `boolean` | `false` | Independently opt in to interactive Three.js renderers for the matching 3D chart kinds; each falls back to SVG when WebGL is unavailable. |
|
|
124
|
+
| `ai` | `PptxAiConfig` | - | Optional AI assistant configuration. The SDK peer loads only when its panel is opened. |
|
|
125
|
+
| `autosave` | `boolean` | `true` | Debounced crash-recovery autosave to IndexedDB. |
|
|
126
|
+
| `autosaveIntervalMs` | `number` | File > Options cadence | Autosave debounce window. |
|
|
127
|
+
| `autosaveFilePath` | `string` | `'presentation.pptx'` | IndexedDB recovery key for autosave snapshots. |
|
|
128
|
+
| `collaboration` | `CollaborationConfig` | - | Start a Yjs collaboration session immediately (y-websocket or serverless y-webrtc). |
|
|
129
|
+
| `shareDefaults` | `{ roomId?, userName?, serverUrl? }` | - | Prefilled values for the Share/Broadcast dialogs. |
|
|
130
|
+
| `availableThemes` / `availableLocales` | catalog entries | - | Choices offered by File > Options. |
|
|
131
|
+
| `onThemeChange` / `onLocaleChange` | `(key: string) => void` | - | Host hooks for the File > Options pickers (host owns persistence when supplied). |
|
|
132
|
+
| `accountAuth` | `AccountAuthConfig` | - | Optional sign-in hook point for File > Account. |
|
|
132
133
|
|
|
133
134
|
Callbacks: `onLoad`, `onError`, `onSlideChange`, `onZoomChange`,
|
|
134
135
|
`onPresentationChange`, `onChange` (any document mutation), `onDirtyChange`,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';var chunkDCFIS6IJ_cjs=require('./chunk-DCFIS6IJ.cjs');require('./chunk-TOWHSYAL.cjs'),require('./chunk-B5PFHICE.cjs');function K(o){let{doc:t,t:n,controller:i}=o,a=chunkDCFIS6IJ_cjs.w(t,"div","pptxv-ai-focus"),h=(p,m,l)=>{let s=chunkDCFIS6IJ_cjs.w(t,"button","pptxv-ai-focus-btn");return s.type="button",s.title=m,s.setAttribute("aria-label",m),s.appendChild(chunkDCFIS6IJ_cjs.K(t,p)),s.addEventListener("click",l),s},x=()=>{a.replaceChildren();let p=i.getEffectiveTargets(),m=i.hasPicks(),l=i.isPinned(),s=i.isPicking(),g=chunkDCFIS6IJ_cjs.w(t,"div","pptxv-ai-focus-row"),f=chunkDCFIS6IJ_cjs.w(t,"span","pptxv-ai-focus-label");f.textContent=n("pptx.ai.focusScope"),g.appendChild(f);for(let r of chunkDCFIS6IJ_cjs.j(p,o.getSlides())){let b=chunkDCFIS6IJ_cjs.w(t,"span","pptxv-ai-focus-chip");(m||l)&&b.classList.add("is-strong"),b.title=r.title,b.textContent=r.label,g.appendChild(b);}if(l){let r=chunkDCFIS6IJ_cjs.w(t,"span","pptxv-ai-focus-pinned");r.textContent=n("pptx.ai.pinnedFocus"),g.appendChild(r);}let C=chunkDCFIS6IJ_cjs.w(t,"div","pptxv-ai-focus-actions"),d=chunkDCFIS6IJ_cjs.k(p,o.getSlides());if(d){let r=chunkDCFIS6IJ_cjs.w(t,"button","pptxv-ai-focus-merge");r.type="button",r.append(chunkDCFIS6IJ_cjs.K(t,"git-merge"),t.createTextNode(n("pptx.ai.mergeSelectedTables"))),r.addEventListener("click",()=>o.onSendDirective(chunkDCFIS6IJ_cjs.l(d.slideIndex,d.elementIdA,d.elementIdB))),C.appendChild(r);}let y=h("crosshair",n("pptx.ai.pickElement"),()=>s?i.stopPicking():i.startPicking());if(y.setAttribute("aria-pressed",String(s)),y.classList.toggle("is-active",s),C.appendChild(y),m?C.appendChild(h("close",n("pptx.ai.pickClear"),()=>i.clearPicks())):l?C.appendChild(h("pin-off",n("pptx.ai.clearFocus"),()=>i.clearPinnedFocus())):C.appendChild(h("pin",n("pptx.ai.pinFocus"),()=>i.pinFocus())),g.appendChild(C),a.appendChild(g),s){let r=chunkDCFIS6IJ_cjs.w(t,"div","pptxv-ai-focus-pick"),b=chunkDCFIS6IJ_cjs.K(t,"crosshair");b.classList.add("pptxv-ai-focus-pick-icon");let k=chunkDCFIS6IJ_cjs.w(t,"span","pptxv-ai-focus-pick-hint");k.textContent=n("pptx.ai.pickElementHint");let T=chunkDCFIS6IJ_cjs.w(t,"button","pptxv-ai-focus-pick-done");T.type="button",T.textContent=n("pptx.ai.pickDone"),T.addEventListener("click",()=>i.stopPicking()),r.append(b,k,T),a.appendChild(r);}},c=i.subscribe(x);return x(),{el:a,destroy(){c(),a.remove();}}}function O(o){let{doc:t,t:n}=o,i=chunkDCFIS6IJ_cjs.w(t,"button","pptxv-ai-chats");i.type="button",i.append(chunkDCFIS6IJ_cjs.K(t,"history"),t.createTextNode(n("pptx.ai.chats")));let a=chunkDCFIS6IJ_cjs.w(t,"div","pptxv-ai-history");a.hidden=true;let h=chunkDCFIS6IJ_cjs.w(t,"div","pptxv-ai-history-head"),x=chunkDCFIS6IJ_cjs.w(t,"span","pptxv-ai-history-title");x.textContent=n("pptx.ai.historyTitle");let c=chunkDCFIS6IJ_cjs.w(t,"button","pptxv-ai-history-new");c.type="button",c.append(chunkDCFIS6IJ_cjs.K(t,"plus"),t.createTextNode(n("pptx.ai.newChat"))),h.append(x,c);let p=chunkDCFIS6IJ_cjs.w(t,"div","pptxv-ai-history-body"),m=chunkDCFIS6IJ_cjs.w(t,"p","pptxv-ai-history-hint");m.textContent=n("pptx.ai.historyHint"),a.append(h,p,m);let l=chunkDCFIS6IJ_cjs.n({deckId:o.deckId,store:o.store,getMessages:o.getMessages,setMessages:o.setMessages,untitledLabel:n("pptx.ai.untitledChat"),onChatsChanged:()=>s()});function s(){p.replaceChildren();let f=l.chats();if(f.length===0){let d=chunkDCFIS6IJ_cjs.w(t,"p","pptxv-ai-history-empty");d.textContent=n("pptx.ai.historyEmpty"),p.appendChild(d);return}let C=chunkDCFIS6IJ_cjs.w(t,"ul","pptxv-ai-history-list");for(let d of f){let y=chunkDCFIS6IJ_cjs.w(t,"li","pptxv-ai-history-row"),r=chunkDCFIS6IJ_cjs.w(t,"button","pptxv-ai-history-resume");r.type="button",r.classList.toggle("is-active",d.id===l.activeChatId());let b=chunkDCFIS6IJ_cjs.w(t,"span","pptxv-ai-history-text"),k=chunkDCFIS6IJ_cjs.w(t,"span","pptxv-ai-history-name");k.textContent=d.title||n("pptx.ai.untitledChat");let T=chunkDCFIS6IJ_cjs.w(t,"span","pptxv-ai-history-meta");T.textContent=n("pptx.ai.messageCount",{count:d.messageCount}),b.append(k,T),r.append(chunkDCFIS6IJ_cjs.K(t,"comment"),b),r.addEventListener("click",()=>{l.resumeChat(d.id),a.hidden=true;});let P=chunkDCFIS6IJ_cjs.w(t,"button","pptxv-ai-history-delete");P.type="button",P.title=n("pptx.ai.deleteChat"),P.setAttribute("aria-label",n("pptx.ai.deleteChat")),P.appendChild(chunkDCFIS6IJ_cjs.K(t,"trash")),P.addEventListener("click",()=>{l.deleteChat(d.id);}),y.append(r,P),C.appendChild(y);}p.appendChild(C);}s(),i.addEventListener("click",()=>{a.hidden=!a.hidden;}),c.addEventListener("click",()=>{l.newChat(),a.hidden=true;});let g=f=>{a.hidden||!(f.target instanceof Node)||!a.contains(f.target)&&!i.contains(f.target)&&(a.hidden=true);};return t.addEventListener("mousedown",g),{button:i,el:a,notifyMessagesChanged:()=>l.notifyMessagesChanged(),destroy(){t.removeEventListener("mousedown",g),l.dispose(),i.remove(),a.remove();}}}var _={view:"eye",text:"text-box",shape:"shapes",theme:"font-color",table:"table",slide:"layout",chart:"chart",move:"move-right",delete:"trash",search:"search",nav:"move-right",animation:"play",notes:"sticky-note",tool:"wrench"};function W(o,t,n){let i=t.state==="output-error",a=t.state==="output-available",h=!i&&!a,x=chunkDCFIS6IJ_cjs.s(t.toolName,t.input,h?"present":"past"),c=chunkDCFIS6IJ_cjs.w(o,"div","pptxv-ai-tool"),p=chunkDCFIS6IJ_cjs.w(o,"div","pptxv-ai-tool-head"),m=chunkDCFIS6IJ_cjs.K(o,_[x.icon]??"wrench");m.classList.add("pptxv-ai-tool-icon");let l=chunkDCFIS6IJ_cjs.w(o,"span","pptxv-ai-tool-name");l.textContent=x.label;let s=chunkDCFIS6IJ_cjs.w(o,"span","pptxv-ai-tool-state");if(i?(s.classList.add("is-error"),s.append(chunkDCFIS6IJ_cjs.K(o,"alert"),o.createTextNode(n("pptx.ai.toolFailed")))):a?(s.classList.add("is-done"),s.append(chunkDCFIS6IJ_cjs.K(o,"check"),o.createTextNode(n("pptx.ai.toolDone")))):(s.classList.add("is-running"),s.textContent=n("pptx.ai.toolRunning")),p.append(m,l,s),c.appendChild(p),i&&t.errorText){let f=chunkDCFIS6IJ_cjs.w(o,"div","pptxv-ai-tool-error");f.textContent=t.errorText,c.appendChild(f);}let g=chunkDCFIS6IJ_cjs.r(t.input);if(g){let f=chunkDCFIS6IJ_cjs.w(o,"details","pptxv-ai-tool-details"),C=chunkDCFIS6IJ_cjs.w(o,"summary");C.textContent=n("pptx.ai.toolDetails");let d=chunkDCFIS6IJ_cjs.w(o,"div","pptxv-ai-tool-raw");d.textContent=`${chunkDCFIS6IJ_cjs.q(t.toolName)}: ${g}`,f.append(C,d),c.appendChild(f);}return c}function q(o,t,n,i){t.replaceChildren();for(let a of n){if(a.role==="system")continue;let h=a.role==="user",x=chunkDCFIS6IJ_cjs.f(a);if(x.length===0&&!h)continue;let c=chunkDCFIS6IJ_cjs.w(o,"div",`pptxv-ai-msg pptxv-ai-msg-${a.role}`),p=chunkDCFIS6IJ_cjs.w(o,"div","pptxv-ai-msg-avatar");p.setAttribute("aria-label",i(h?"pptx.ai.you":"pptx.ai.assistant")),p.appendChild(chunkDCFIS6IJ_cjs.K(o,h?"comment":"sparkles"));let m=chunkDCFIS6IJ_cjs.w(o,"div","pptxv-ai-msg-body");for(let l of x)if(l.kind==="text"){let s=chunkDCFIS6IJ_cjs.w(o,"div","pptxv-ai-msg-text");s.textContent=l.text,m.appendChild(s);}else m.appendChild(W(o,l,i));c.append(p,m),t.appendChild(c);}}function G(o,t,n,i,a){if(t.replaceChildren(),t.hidden=n.length===0,n.length===0)return;let h=chunkDCFIS6IJ_cjs.w(o,"div","pptxv-ai-proposals-header"),x=chunkDCFIS6IJ_cjs.w(o,"span","pptxv-ai-proposals-title");if(x.textContent=i("pptx.ai.pendingChanges",{count:n.length}),h.appendChild(x),n.length>1){let c=chunkDCFIS6IJ_cjs.w(o,"button","pptxv-ai-proposal-btn is-accept-all");c.type="button",c.textContent=i("pptx.ai.acceptAll"),c.addEventListener("click",()=>a.acceptAll()),h.appendChild(c);}t.appendChild(h);for(let c of n)t.appendChild(tt(o,c,i,a));}function tt(o,t,n,i){let a=chunkDCFIS6IJ_cjs.w(o,"div","pptxv-ai-proposal");a.dataset.proposalId=t.id;let h=chunkDCFIS6IJ_cjs.w(o,"div","pptxv-ai-proposal-eyebrow");h.textContent=n("pptx.ai.proposedChange"),a.appendChild(h);let x=chunkDCFIS6IJ_cjs.w(o,"div","pptxv-ai-proposal-label");if(x.textContent=t.label,a.appendChild(x),t.summary.length>0){let l=chunkDCFIS6IJ_cjs.w(o,"ul","pptxv-ai-proposal-summary");for(let s of t.summary){let g=chunkDCFIS6IJ_cjs.w(o,"li");g.textContent=chunkDCFIS6IJ_cjs.c(s),l.appendChild(g);}a.appendChild(l);}let c=chunkDCFIS6IJ_cjs.w(o,"div","pptxv-ai-proposal-actions"),p=chunkDCFIS6IJ_cjs.w(o,"button","pptxv-ai-proposal-btn is-accept");p.type="button",p.append(chunkDCFIS6IJ_cjs.K(o,"check"),o.createTextNode(n("pptx.ai.accept"))),p.addEventListener("click",()=>i.accept(t.id));let m=chunkDCFIS6IJ_cjs.w(o,"button","pptxv-ai-proposal-btn is-reject");return m.type="button",m.append(chunkDCFIS6IJ_cjs.K(o,"close"),o.createTextNode(n("pptx.ai.reject"))),m.addEventListener("click",()=>i.reject(t.id)),c.append(p,m),a.appendChild(c),a}async function wt(o){let{doc:t,host:n,t:i}=o;n.replaceChildren();let a=chunkDCFIS6IJ_cjs.w(t,"div","pptxv-ai-header"),h=chunkDCFIS6IJ_cjs.w(t,"span","pptxv-ai-title");h.textContent=i("pptx.ai.title");let x=chunkDCFIS6IJ_cjs.w(t,"button","pptxv-ai-close");x.type="button",x.title=i("pptx.ai.close"),x.setAttribute("aria-label",i("pptx.ai.close")),x.appendChild(chunkDCFIS6IJ_cjs.K(t,"close")),x.addEventListener("click",()=>o.onClose?.()),a.append(chunkDCFIS6IJ_cjs.K(t,"sparkles"),h,x);let c,p=o.controller,m=p?K({doc:t,t:i,controller:p,getSlides:()=>o.bridge.getSlides(),onSendDirective:u=>{c?.sendMessage(u);}}):null,l=chunkDCFIS6IJ_cjs.w(t,"div","pptxv-ai-messages");l.setAttribute("role","log"),l.setAttribute("aria-live","polite");let s=chunkDCFIS6IJ_cjs.w(t,"div","pptxv-ai-empty");s.textContent=i("pptx.ai.emptyHint"),l.appendChild(s);let g=chunkDCFIS6IJ_cjs.w(t,"div","pptxv-ai-proposals");g.hidden=true;let f=chunkDCFIS6IJ_cjs.w(t,"div","pptxv-ai-error");f.setAttribute("role","alert"),f.hidden=true;let C=chunkDCFIS6IJ_cjs.w(t,"form","pptxv-ai-composer"),d=chunkDCFIS6IJ_cjs.w(t,"textarea","pptxv-ai-input");d.rows=2,d.placeholder=i("pptx.ai.placeholder"),d.setAttribute("aria-label",i("pptx.ai.placeholder"));let y=chunkDCFIS6IJ_cjs.w(t,"button","pptxv-ai-send");y.type="submit",y.setAttribute("aria-label",i("pptx.ai.send")),y.appendChild(chunkDCFIS6IJ_cjs.K(t,"send")),C.append(d,y),n.append(a,...m?[m.el]:[],l,g,f,C);try{c=await(o.createChat??chunkDCFIS6IJ_cjs.o)({bridge:o.bridge,config:o.config});}catch{return s.textContent=i("pptx.ai.unavailableTitle"),d.disabled=true,y.disabled=true,m?.destroy(),{destroy:()=>n.replaceChildren()}}let r=c,b=O({doc:t,t:i,deckId:chunkDCFIS6IJ_cjs.m(o.bridge),store:o.historyStore,getMessages:()=>r.getSnapshot().messages,setMessages:u=>r.setMessages(u)});a.insertBefore(b.button,x),n.appendChild(b.el);let k=r.subscribe(()=>b.notifyMessagesChanged()),T=new Set,P=u=>{if(!p)return;let A=u.messages.flatMap(Y=>chunkDCFIS6IJ_cjs.f(Y).filter(Z=>Z.kind==="tool")).at(-1);if(!A||A.kind!=="tool"||A.state==="input-streaming"||T.has(A.toolCallId))return;T.add(A.toolCallId);let L=chunkDCFIS6IJ_cjs.t(A.toolName,A.input);L&&L.slideIndex!==void 0&&o.goToSlide?.(L.slideIndex),p.flashToolTarget(L);},M=u=>{q(t,l,u.messages,i),s.hidden=u.messages.length>0,u.messages.length===0&&l.appendChild(s),G(t,g,r.proposals.list(),i,{accept:A=>{p?.flashToolTarget(null),r.proposals.apply(A),M(r.getSnapshot());},reject:A=>{r.proposals.revert(A),M(r.getSnapshot());},acceptAll:()=>{p?.flashToolTarget(null),r.proposals.acceptAll(),M(r.getSnapshot());}});let w=u.status==="submitted"||u.status==="streaming";n.classList.toggle("is-busy",w),y.setAttribute("aria-label",i(w?"pptx.ai.stop":"pptx.ai.send")),f.hidden=!u.error,f.textContent=u.error?i("pptx.ai.errorPrefix"):"",l.scrollTop=l.scrollHeight,P(u);},S=()=>{if(n.classList.contains("is-busy")){r.stop();return}let u=d.value.trim();u&&(d.value="",r.sendMessage(u));};C.addEventListener("submit",u=>{u.preventDefault(),S();}),d.addEventListener("keydown",u=>{u.key==="Enter"&&!u.shiftKey&&(u.preventDefault(),S());});let I=p?.getPrefill().nonce??0,J=()=>{if(!p)return;let u=p.getPrefill();u.nonce!==I&&(I=u.nonce,d.value=u.text,d.focus());},Q=p?.subscribe(J),X=r.subscribe(M);return M(r.getSnapshot()),{changeAnimator:r.changeAnimator,destroy(){X(),k(),b.destroy(),Q?.(),m?.destroy(),n.replaceChildren();}}}exports.createAiPanel=wt;
|
|
1
|
+
'use strict';var chunkG2XAI7GR_cjs=require('./chunk-G2XAI7GR.cjs');require('./chunk-OQDW73SM.cjs'),require('./chunk-B5PFHICE.cjs');function K(o){let{doc:t,t:n,controller:i}=o,a=chunkG2XAI7GR_cjs.w(t,"div","pptxv-ai-focus"),h=(p,m,l)=>{let s=chunkG2XAI7GR_cjs.w(t,"button","pptxv-ai-focus-btn");return s.type="button",s.title=m,s.setAttribute("aria-label",m),s.appendChild(chunkG2XAI7GR_cjs.K(t,p)),s.addEventListener("click",l),s},x=()=>{a.replaceChildren();let p=i.getEffectiveTargets(),m=i.hasPicks(),l=i.isPinned(),s=i.isPicking(),g=chunkG2XAI7GR_cjs.w(t,"div","pptxv-ai-focus-row"),f=chunkG2XAI7GR_cjs.w(t,"span","pptxv-ai-focus-label");f.textContent=n("pptx.ai.focusScope"),g.appendChild(f);for(let r of chunkG2XAI7GR_cjs.j(p,o.getSlides())){let b=chunkG2XAI7GR_cjs.w(t,"span","pptxv-ai-focus-chip");(m||l)&&b.classList.add("is-strong"),b.title=r.title,b.textContent=r.label,g.appendChild(b);}if(l){let r=chunkG2XAI7GR_cjs.w(t,"span","pptxv-ai-focus-pinned");r.textContent=n("pptx.ai.pinnedFocus"),g.appendChild(r);}let C=chunkG2XAI7GR_cjs.w(t,"div","pptxv-ai-focus-actions"),d=chunkG2XAI7GR_cjs.k(p,o.getSlides());if(d){let r=chunkG2XAI7GR_cjs.w(t,"button","pptxv-ai-focus-merge");r.type="button",r.append(chunkG2XAI7GR_cjs.K(t,"git-merge"),t.createTextNode(n("pptx.ai.mergeSelectedTables"))),r.addEventListener("click",()=>o.onSendDirective(chunkG2XAI7GR_cjs.l(d.slideIndex,d.elementIdA,d.elementIdB))),C.appendChild(r);}let y=h("crosshair",n("pptx.ai.pickElement"),()=>s?i.stopPicking():i.startPicking());if(y.setAttribute("aria-pressed",String(s)),y.classList.toggle("is-active",s),C.appendChild(y),m?C.appendChild(h("close",n("pptx.ai.pickClear"),()=>i.clearPicks())):l?C.appendChild(h("pin-off",n("pptx.ai.clearFocus"),()=>i.clearPinnedFocus())):C.appendChild(h("pin",n("pptx.ai.pinFocus"),()=>i.pinFocus())),g.appendChild(C),a.appendChild(g),s){let r=chunkG2XAI7GR_cjs.w(t,"div","pptxv-ai-focus-pick"),b=chunkG2XAI7GR_cjs.K(t,"crosshair");b.classList.add("pptxv-ai-focus-pick-icon");let k=chunkG2XAI7GR_cjs.w(t,"span","pptxv-ai-focus-pick-hint");k.textContent=n("pptx.ai.pickElementHint");let T=chunkG2XAI7GR_cjs.w(t,"button","pptxv-ai-focus-pick-done");T.type="button",T.textContent=n("pptx.ai.pickDone"),T.addEventListener("click",()=>i.stopPicking()),r.append(b,k,T),a.appendChild(r);}},c=i.subscribe(x);return x(),{el:a,destroy(){c(),a.remove();}}}function O(o){let{doc:t,t:n}=o,i=chunkG2XAI7GR_cjs.w(t,"button","pptxv-ai-chats");i.type="button",i.append(chunkG2XAI7GR_cjs.K(t,"history"),t.createTextNode(n("pptx.ai.chats")));let a=chunkG2XAI7GR_cjs.w(t,"div","pptxv-ai-history");a.hidden=true;let h=chunkG2XAI7GR_cjs.w(t,"div","pptxv-ai-history-head"),x=chunkG2XAI7GR_cjs.w(t,"span","pptxv-ai-history-title");x.textContent=n("pptx.ai.historyTitle");let c=chunkG2XAI7GR_cjs.w(t,"button","pptxv-ai-history-new");c.type="button",c.append(chunkG2XAI7GR_cjs.K(t,"plus"),t.createTextNode(n("pptx.ai.newChat"))),h.append(x,c);let p=chunkG2XAI7GR_cjs.w(t,"div","pptxv-ai-history-body"),m=chunkG2XAI7GR_cjs.w(t,"p","pptxv-ai-history-hint");m.textContent=n("pptx.ai.historyHint"),a.append(h,p,m);let l=chunkG2XAI7GR_cjs.n({deckId:o.deckId,store:o.store,getMessages:o.getMessages,setMessages:o.setMessages,untitledLabel:n("pptx.ai.untitledChat"),onChatsChanged:()=>s()});function s(){p.replaceChildren();let f=l.chats();if(f.length===0){let d=chunkG2XAI7GR_cjs.w(t,"p","pptxv-ai-history-empty");d.textContent=n("pptx.ai.historyEmpty"),p.appendChild(d);return}let C=chunkG2XAI7GR_cjs.w(t,"ul","pptxv-ai-history-list");for(let d of f){let y=chunkG2XAI7GR_cjs.w(t,"li","pptxv-ai-history-row"),r=chunkG2XAI7GR_cjs.w(t,"button","pptxv-ai-history-resume");r.type="button",r.classList.toggle("is-active",d.id===l.activeChatId());let b=chunkG2XAI7GR_cjs.w(t,"span","pptxv-ai-history-text"),k=chunkG2XAI7GR_cjs.w(t,"span","pptxv-ai-history-name");k.textContent=d.title||n("pptx.ai.untitledChat");let T=chunkG2XAI7GR_cjs.w(t,"span","pptxv-ai-history-meta");T.textContent=n("pptx.ai.messageCount",{count:d.messageCount}),b.append(k,T),r.append(chunkG2XAI7GR_cjs.K(t,"comment"),b),r.addEventListener("click",()=>{l.resumeChat(d.id),a.hidden=true;});let P=chunkG2XAI7GR_cjs.w(t,"button","pptxv-ai-history-delete");P.type="button",P.title=n("pptx.ai.deleteChat"),P.setAttribute("aria-label",n("pptx.ai.deleteChat")),P.appendChild(chunkG2XAI7GR_cjs.K(t,"trash")),P.addEventListener("click",()=>{l.deleteChat(d.id);}),y.append(r,P),C.appendChild(y);}p.appendChild(C);}s(),i.addEventListener("click",()=>{a.hidden=!a.hidden;}),c.addEventListener("click",()=>{l.newChat(),a.hidden=true;});let g=f=>{a.hidden||!(f.target instanceof Node)||!a.contains(f.target)&&!i.contains(f.target)&&(a.hidden=true);};return t.addEventListener("mousedown",g),{button:i,el:a,notifyMessagesChanged:()=>l.notifyMessagesChanged(),destroy(){t.removeEventListener("mousedown",g),l.dispose(),i.remove(),a.remove();}}}var _={view:"eye",text:"text-box",shape:"shapes",theme:"font-color",table:"table",slide:"layout",chart:"chart",move:"move-right",delete:"trash",search:"search",nav:"move-right",animation:"play",notes:"sticky-note",tool:"wrench"};function W(o,t,n){let i=t.state==="output-error",a=t.state==="output-available",h=!i&&!a,x=chunkG2XAI7GR_cjs.s(t.toolName,t.input,h?"present":"past"),c=chunkG2XAI7GR_cjs.w(o,"div","pptxv-ai-tool"),p=chunkG2XAI7GR_cjs.w(o,"div","pptxv-ai-tool-head"),m=chunkG2XAI7GR_cjs.K(o,_[x.icon]??"wrench");m.classList.add("pptxv-ai-tool-icon");let l=chunkG2XAI7GR_cjs.w(o,"span","pptxv-ai-tool-name");l.textContent=x.label;let s=chunkG2XAI7GR_cjs.w(o,"span","pptxv-ai-tool-state");if(i?(s.classList.add("is-error"),s.append(chunkG2XAI7GR_cjs.K(o,"alert"),o.createTextNode(n("pptx.ai.toolFailed")))):a?(s.classList.add("is-done"),s.append(chunkG2XAI7GR_cjs.K(o,"check"),o.createTextNode(n("pptx.ai.toolDone")))):(s.classList.add("is-running"),s.textContent=n("pptx.ai.toolRunning")),p.append(m,l,s),c.appendChild(p),i&&t.errorText){let f=chunkG2XAI7GR_cjs.w(o,"div","pptxv-ai-tool-error");f.textContent=t.errorText,c.appendChild(f);}let g=chunkG2XAI7GR_cjs.r(t.input);if(g){let f=chunkG2XAI7GR_cjs.w(o,"details","pptxv-ai-tool-details"),C=chunkG2XAI7GR_cjs.w(o,"summary");C.textContent=n("pptx.ai.toolDetails");let d=chunkG2XAI7GR_cjs.w(o,"div","pptxv-ai-tool-raw");d.textContent=`${chunkG2XAI7GR_cjs.q(t.toolName)}: ${g}`,f.append(C,d),c.appendChild(f);}return c}function q(o,t,n,i){t.replaceChildren();for(let a of n){if(a.role==="system")continue;let h=a.role==="user",x=chunkG2XAI7GR_cjs.f(a);if(x.length===0&&!h)continue;let c=chunkG2XAI7GR_cjs.w(o,"div",`pptxv-ai-msg pptxv-ai-msg-${a.role}`),p=chunkG2XAI7GR_cjs.w(o,"div","pptxv-ai-msg-avatar");p.setAttribute("aria-label",i(h?"pptx.ai.you":"pptx.ai.assistant")),p.appendChild(chunkG2XAI7GR_cjs.K(o,h?"comment":"sparkles"));let m=chunkG2XAI7GR_cjs.w(o,"div","pptxv-ai-msg-body");for(let l of x)if(l.kind==="text"){let s=chunkG2XAI7GR_cjs.w(o,"div","pptxv-ai-msg-text");s.textContent=l.text,m.appendChild(s);}else m.appendChild(W(o,l,i));c.append(p,m),t.appendChild(c);}}function G(o,t,n,i,a){if(t.replaceChildren(),t.hidden=n.length===0,n.length===0)return;let h=chunkG2XAI7GR_cjs.w(o,"div","pptxv-ai-proposals-header"),x=chunkG2XAI7GR_cjs.w(o,"span","pptxv-ai-proposals-title");if(x.textContent=i("pptx.ai.pendingChanges",{count:n.length}),h.appendChild(x),n.length>1){let c=chunkG2XAI7GR_cjs.w(o,"button","pptxv-ai-proposal-btn is-accept-all");c.type="button",c.textContent=i("pptx.ai.acceptAll"),c.addEventListener("click",()=>a.acceptAll()),h.appendChild(c);}t.appendChild(h);for(let c of n)t.appendChild(tt(o,c,i,a));}function tt(o,t,n,i){let a=chunkG2XAI7GR_cjs.w(o,"div","pptxv-ai-proposal");a.dataset.proposalId=t.id;let h=chunkG2XAI7GR_cjs.w(o,"div","pptxv-ai-proposal-eyebrow");h.textContent=n("pptx.ai.proposedChange"),a.appendChild(h);let x=chunkG2XAI7GR_cjs.w(o,"div","pptxv-ai-proposal-label");if(x.textContent=t.label,a.appendChild(x),t.summary.length>0){let l=chunkG2XAI7GR_cjs.w(o,"ul","pptxv-ai-proposal-summary");for(let s of t.summary){let g=chunkG2XAI7GR_cjs.w(o,"li");g.textContent=chunkG2XAI7GR_cjs.c(s),l.appendChild(g);}a.appendChild(l);}let c=chunkG2XAI7GR_cjs.w(o,"div","pptxv-ai-proposal-actions"),p=chunkG2XAI7GR_cjs.w(o,"button","pptxv-ai-proposal-btn is-accept");p.type="button",p.append(chunkG2XAI7GR_cjs.K(o,"check"),o.createTextNode(n("pptx.ai.accept"))),p.addEventListener("click",()=>i.accept(t.id));let m=chunkG2XAI7GR_cjs.w(o,"button","pptxv-ai-proposal-btn is-reject");return m.type="button",m.append(chunkG2XAI7GR_cjs.K(o,"close"),o.createTextNode(n("pptx.ai.reject"))),m.addEventListener("click",()=>i.reject(t.id)),c.append(p,m),a.appendChild(c),a}async function wt(o){let{doc:t,host:n,t:i}=o;n.replaceChildren();let a=chunkG2XAI7GR_cjs.w(t,"div","pptxv-ai-header"),h=chunkG2XAI7GR_cjs.w(t,"span","pptxv-ai-title");h.textContent=i("pptx.ai.title");let x=chunkG2XAI7GR_cjs.w(t,"button","pptxv-ai-close");x.type="button",x.title=i("pptx.ai.close"),x.setAttribute("aria-label",i("pptx.ai.close")),x.appendChild(chunkG2XAI7GR_cjs.K(t,"close")),x.addEventListener("click",()=>o.onClose?.()),a.append(chunkG2XAI7GR_cjs.K(t,"sparkles"),h,x);let c,p=o.controller,m=p?K({doc:t,t:i,controller:p,getSlides:()=>o.bridge.getSlides(),onSendDirective:u=>{c?.sendMessage(u);}}):null,l=chunkG2XAI7GR_cjs.w(t,"div","pptxv-ai-messages");l.setAttribute("role","log"),l.setAttribute("aria-live","polite");let s=chunkG2XAI7GR_cjs.w(t,"div","pptxv-ai-empty");s.textContent=i("pptx.ai.emptyHint"),l.appendChild(s);let g=chunkG2XAI7GR_cjs.w(t,"div","pptxv-ai-proposals");g.hidden=true;let f=chunkG2XAI7GR_cjs.w(t,"div","pptxv-ai-error");f.setAttribute("role","alert"),f.hidden=true;let C=chunkG2XAI7GR_cjs.w(t,"form","pptxv-ai-composer"),d=chunkG2XAI7GR_cjs.w(t,"textarea","pptxv-ai-input");d.rows=2,d.placeholder=i("pptx.ai.placeholder"),d.setAttribute("aria-label",i("pptx.ai.placeholder"));let y=chunkG2XAI7GR_cjs.w(t,"button","pptxv-ai-send");y.type="submit",y.setAttribute("aria-label",i("pptx.ai.send")),y.appendChild(chunkG2XAI7GR_cjs.K(t,"send")),C.append(d,y),n.append(a,...m?[m.el]:[],l,g,f,C);try{c=await(o.createChat??chunkG2XAI7GR_cjs.o)({bridge:o.bridge,config:o.config});}catch{return s.textContent=i("pptx.ai.unavailableTitle"),d.disabled=true,y.disabled=true,m?.destroy(),{destroy:()=>n.replaceChildren()}}let r=c,b=O({doc:t,t:i,deckId:chunkG2XAI7GR_cjs.m(o.bridge),store:o.historyStore,getMessages:()=>r.getSnapshot().messages,setMessages:u=>r.setMessages(u)});a.insertBefore(b.button,x),n.appendChild(b.el);let k=r.subscribe(()=>b.notifyMessagesChanged()),T=new Set,P=u=>{if(!p)return;let A=u.messages.flatMap(Y=>chunkG2XAI7GR_cjs.f(Y).filter(Z=>Z.kind==="tool")).at(-1);if(!A||A.kind!=="tool"||A.state==="input-streaming"||T.has(A.toolCallId))return;T.add(A.toolCallId);let L=chunkG2XAI7GR_cjs.t(A.toolName,A.input);L&&L.slideIndex!==void 0&&o.goToSlide?.(L.slideIndex),p.flashToolTarget(L);},M=u=>{q(t,l,u.messages,i),s.hidden=u.messages.length>0,u.messages.length===0&&l.appendChild(s),G(t,g,r.proposals.list(),i,{accept:A=>{p?.flashToolTarget(null),r.proposals.apply(A),M(r.getSnapshot());},reject:A=>{r.proposals.revert(A),M(r.getSnapshot());},acceptAll:()=>{p?.flashToolTarget(null),r.proposals.acceptAll(),M(r.getSnapshot());}});let w=u.status==="submitted"||u.status==="streaming";n.classList.toggle("is-busy",w),y.setAttribute("aria-label",i(w?"pptx.ai.stop":"pptx.ai.send")),f.hidden=!u.error,f.textContent=u.error?i("pptx.ai.errorPrefix"):"",l.scrollTop=l.scrollHeight,P(u);},S=()=>{if(n.classList.contains("is-busy")){r.stop();return}let u=d.value.trim();u&&(d.value="",r.sendMessage(u));};C.addEventListener("submit",u=>{u.preventDefault(),S();}),d.addEventListener("keydown",u=>{u.key==="Enter"&&!u.shiftKey&&(u.preventDefault(),S());});let I=p?.getPrefill().nonce??0,J=()=>{if(!p)return;let u=p.getPrefill();u.nonce!==I&&(I=u.nonce,d.value=u.text,d.focus());},Q=p?.subscribe(J),X=r.subscribe(M);return M(r.getSnapshot()),{changeAnimator:r.changeAnimator,destroy(){X(),k(),b.destroy(),Q?.(),m?.destroy(),n.replaceChildren();}}}exports.createAiPanel=wt;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {w,K as K$1,o,m,n,f,t,j,k,l,s,r,q as q$1,c}from'./chunk-E6UE4V7R.js';import'./chunk-KR4EBOP3.js';import'./chunk-62D2TNHX.js';function K(o){let{doc:t,t:n,controller:i}=o,a=w(t,"div","pptxv-ai-focus"),h=(p,m,l)=>{let s=w(t,"button","pptxv-ai-focus-btn");return s.type="button",s.title=m,s.setAttribute("aria-label",m),s.appendChild(K$1(t,p)),s.addEventListener("click",l),s},x=()=>{a.replaceChildren();let p=i.getEffectiveTargets(),m=i.hasPicks(),l$1=i.isPinned(),s=i.isPicking(),g=w(t,"div","pptxv-ai-focus-row"),f=w(t,"span","pptxv-ai-focus-label");f.textContent=n("pptx.ai.focusScope"),g.appendChild(f);for(let r of j(p,o.getSlides())){let b=w(t,"span","pptxv-ai-focus-chip");(m||l$1)&&b.classList.add("is-strong"),b.title=r.title,b.textContent=r.label,g.appendChild(b);}if(l$1){let r=w(t,"span","pptxv-ai-focus-pinned");r.textContent=n("pptx.ai.pinnedFocus"),g.appendChild(r);}let C=w(t,"div","pptxv-ai-focus-actions"),d=k(p,o.getSlides());if(d){let r=w(t,"button","pptxv-ai-focus-merge");r.type="button",r.append(K$1(t,"git-merge"),t.createTextNode(n("pptx.ai.mergeSelectedTables"))),r.addEventListener("click",()=>o.onSendDirective(l(d.slideIndex,d.elementIdA,d.elementIdB))),C.appendChild(r);}let y=h("crosshair",n("pptx.ai.pickElement"),()=>s?i.stopPicking():i.startPicking());if(y.setAttribute("aria-pressed",String(s)),y.classList.toggle("is-active",s),C.appendChild(y),m?C.appendChild(h("close",n("pptx.ai.pickClear"),()=>i.clearPicks())):l$1?C.appendChild(h("pin-off",n("pptx.ai.clearFocus"),()=>i.clearPinnedFocus())):C.appendChild(h("pin",n("pptx.ai.pinFocus"),()=>i.pinFocus())),g.appendChild(C),a.appendChild(g),s){let r=w(t,"div","pptxv-ai-focus-pick"),b=K$1(t,"crosshair");b.classList.add("pptxv-ai-focus-pick-icon");let k=w(t,"span","pptxv-ai-focus-pick-hint");k.textContent=n("pptx.ai.pickElementHint");let T=w(t,"button","pptxv-ai-focus-pick-done");T.type="button",T.textContent=n("pptx.ai.pickDone"),T.addEventListener("click",()=>i.stopPicking()),r.append(b,k,T),a.appendChild(r);}},c=i.subscribe(x);return x(),{el:a,destroy(){c(),a.remove();}}}function O(o){let{doc:t,t:n$1}=o,i=w(t,"button","pptxv-ai-chats");i.type="button",i.append(K$1(t,"history"),t.createTextNode(n$1("pptx.ai.chats")));let a=w(t,"div","pptxv-ai-history");a.hidden=true;let h=w(t,"div","pptxv-ai-history-head"),x=w(t,"span","pptxv-ai-history-title");x.textContent=n$1("pptx.ai.historyTitle");let c=w(t,"button","pptxv-ai-history-new");c.type="button",c.append(K$1(t,"plus"),t.createTextNode(n$1("pptx.ai.newChat"))),h.append(x,c);let p=w(t,"div","pptxv-ai-history-body"),m=w(t,"p","pptxv-ai-history-hint");m.textContent=n$1("pptx.ai.historyHint"),a.append(h,p,m);let l=n({deckId:o.deckId,store:o.store,getMessages:o.getMessages,setMessages:o.setMessages,untitledLabel:n$1("pptx.ai.untitledChat"),onChatsChanged:()=>s()});function s(){p.replaceChildren();let f=l.chats();if(f.length===0){let d=w(t,"p","pptxv-ai-history-empty");d.textContent=n$1("pptx.ai.historyEmpty"),p.appendChild(d);return}let C=w(t,"ul","pptxv-ai-history-list");for(let d of f){let y=w(t,"li","pptxv-ai-history-row"),r=w(t,"button","pptxv-ai-history-resume");r.type="button",r.classList.toggle("is-active",d.id===l.activeChatId());let b=w(t,"span","pptxv-ai-history-text"),k=w(t,"span","pptxv-ai-history-name");k.textContent=d.title||n$1("pptx.ai.untitledChat");let T=w(t,"span","pptxv-ai-history-meta");T.textContent=n$1("pptx.ai.messageCount",{count:d.messageCount}),b.append(k,T),r.append(K$1(t,"comment"),b),r.addEventListener("click",()=>{l.resumeChat(d.id),a.hidden=true;});let P=w(t,"button","pptxv-ai-history-delete");P.type="button",P.title=n$1("pptx.ai.deleteChat"),P.setAttribute("aria-label",n$1("pptx.ai.deleteChat")),P.appendChild(K$1(t,"trash")),P.addEventListener("click",()=>{l.deleteChat(d.id);}),y.append(r,P),C.appendChild(y);}p.appendChild(C);}s(),i.addEventListener("click",()=>{a.hidden=!a.hidden;}),c.addEventListener("click",()=>{l.newChat(),a.hidden=true;});let g=f=>{a.hidden||!(f.target instanceof Node)||!a.contains(f.target)&&!i.contains(f.target)&&(a.hidden=true);};return t.addEventListener("mousedown",g),{button:i,el:a,notifyMessagesChanged:()=>l.notifyMessagesChanged(),destroy(){t.removeEventListener("mousedown",g),l.dispose(),i.remove(),a.remove();}}}var _={view:"eye",text:"text-box",shape:"shapes",theme:"font-color",table:"table",slide:"layout",chart:"chart",move:"move-right",delete:"trash",search:"search",nav:"move-right",animation:"play",notes:"sticky-note",tool:"wrench"};function W(o,t,n){let i=t.state==="output-error",a=t.state==="output-available",h=!i&&!a,x=s(t.toolName,t.input,h?"present":"past"),c=w(o,"div","pptxv-ai-tool"),p=w(o,"div","pptxv-ai-tool-head"),m=K$1(o,_[x.icon]??"wrench");m.classList.add("pptxv-ai-tool-icon");let l=w(o,"span","pptxv-ai-tool-name");l.textContent=x.label;let s$1=w(o,"span","pptxv-ai-tool-state");if(i?(s$1.classList.add("is-error"),s$1.append(K$1(o,"alert"),o.createTextNode(n("pptx.ai.toolFailed")))):a?(s$1.classList.add("is-done"),s$1.append(K$1(o,"check"),o.createTextNode(n("pptx.ai.toolDone")))):(s$1.classList.add("is-running"),s$1.textContent=n("pptx.ai.toolRunning")),p.append(m,l,s$1),c.appendChild(p),i&&t.errorText){let f=w(o,"div","pptxv-ai-tool-error");f.textContent=t.errorText,c.appendChild(f);}let g=r(t.input);if(g){let f=w(o,"details","pptxv-ai-tool-details"),C=w(o,"summary");C.textContent=n("pptx.ai.toolDetails");let d=w(o,"div","pptxv-ai-tool-raw");d.textContent=`${q$1(t.toolName)}: ${g}`,f.append(C,d),c.appendChild(f);}return c}function q(o,t,n,i){t.replaceChildren();for(let a of n){if(a.role==="system")continue;let h=a.role==="user",x=f(a);if(x.length===0&&!h)continue;let c=w(o,"div",`pptxv-ai-msg pptxv-ai-msg-${a.role}`),p=w(o,"div","pptxv-ai-msg-avatar");p.setAttribute("aria-label",i(h?"pptx.ai.you":"pptx.ai.assistant")),p.appendChild(K$1(o,h?"comment":"sparkles"));let m=w(o,"div","pptxv-ai-msg-body");for(let l of x)if(l.kind==="text"){let s=w(o,"div","pptxv-ai-msg-text");s.textContent=l.text,m.appendChild(s);}else m.appendChild(W(o,l,i));c.append(p,m),t.appendChild(c);}}function G(o,t,n,i,a){if(t.replaceChildren(),t.hidden=n.length===0,n.length===0)return;let h=w(o,"div","pptxv-ai-proposals-header"),x=w(o,"span","pptxv-ai-proposals-title");if(x.textContent=i("pptx.ai.pendingChanges",{count:n.length}),h.appendChild(x),n.length>1){let c=w(o,"button","pptxv-ai-proposal-btn is-accept-all");c.type="button",c.textContent=i("pptx.ai.acceptAll"),c.addEventListener("click",()=>a.acceptAll()),h.appendChild(c);}t.appendChild(h);for(let c of n)t.appendChild(tt(o,c,i,a));}function tt(o,t,n,i){let a=w(o,"div","pptxv-ai-proposal");a.dataset.proposalId=t.id;let h=w(o,"div","pptxv-ai-proposal-eyebrow");h.textContent=n("pptx.ai.proposedChange"),a.appendChild(h);let x=w(o,"div","pptxv-ai-proposal-label");if(x.textContent=t.label,a.appendChild(x),t.summary.length>0){let l=w(o,"ul","pptxv-ai-proposal-summary");for(let s of t.summary){let g=w(o,"li");g.textContent=c(s),l.appendChild(g);}a.appendChild(l);}let c$1=w(o,"div","pptxv-ai-proposal-actions"),p=w(o,"button","pptxv-ai-proposal-btn is-accept");p.type="button",p.append(K$1(o,"check"),o.createTextNode(n("pptx.ai.accept"))),p.addEventListener("click",()=>i.accept(t.id));let m=w(o,"button","pptxv-ai-proposal-btn is-reject");return m.type="button",m.append(K$1(o,"close"),o.createTextNode(n("pptx.ai.reject"))),m.addEventListener("click",()=>i.reject(t.id)),c$1.append(p,m),a.appendChild(c$1),a}async function wt(o$1){let{doc:t$1,host:n,t:i}=o$1;n.replaceChildren();let a=w(t$1,"div","pptxv-ai-header"),h=w(t$1,"span","pptxv-ai-title");h.textContent=i("pptx.ai.title");let x=w(t$1,"button","pptxv-ai-close");x.type="button",x.title=i("pptx.ai.close"),x.setAttribute("aria-label",i("pptx.ai.close")),x.appendChild(K$1(t$1,"close")),x.addEventListener("click",()=>o$1.onClose?.()),a.append(K$1(t$1,"sparkles"),h,x);let c,p=o$1.controller,m$1=p?K({doc:t$1,t:i,controller:p,getSlides:()=>o$1.bridge.getSlides(),onSendDirective:u=>{c?.sendMessage(u);}}):null,l=w(t$1,"div","pptxv-ai-messages");l.setAttribute("role","log"),l.setAttribute("aria-live","polite");let s=w(t$1,"div","pptxv-ai-empty");s.textContent=i("pptx.ai.emptyHint"),l.appendChild(s);let g=w(t$1,"div","pptxv-ai-proposals");g.hidden=true;let f$1=w(t$1,"div","pptxv-ai-error");f$1.setAttribute("role","alert"),f$1.hidden=true;let C=w(t$1,"form","pptxv-ai-composer"),d=w(t$1,"textarea","pptxv-ai-input");d.rows=2,d.placeholder=i("pptx.ai.placeholder"),d.setAttribute("aria-label",i("pptx.ai.placeholder"));let y=w(t$1,"button","pptxv-ai-send");y.type="submit",y.setAttribute("aria-label",i("pptx.ai.send")),y.appendChild(K$1(t$1,"send")),C.append(d,y),n.append(a,...m$1?[m$1.el]:[],l,g,f$1,C);try{c=await(o$1.createChat??o)({bridge:o$1.bridge,config:o$1.config});}catch{return s.textContent=i("pptx.ai.unavailableTitle"),d.disabled=true,y.disabled=true,m$1?.destroy(),{destroy:()=>n.replaceChildren()}}let r=c,b=O({doc:t$1,t:i,deckId:m(o$1.bridge),store:o$1.historyStore,getMessages:()=>r.getSnapshot().messages,setMessages:u=>r.setMessages(u)});a.insertBefore(b.button,x),n.appendChild(b.el);let k=r.subscribe(()=>b.notifyMessagesChanged()),T=new Set,P=u=>{if(!p)return;let A=u.messages.flatMap(Y=>f(Y).filter(Z=>Z.kind==="tool")).at(-1);if(!A||A.kind!=="tool"||A.state==="input-streaming"||T.has(A.toolCallId))return;T.add(A.toolCallId);let L=t(A.toolName,A.input);L&&L.slideIndex!==void 0&&o$1.goToSlide?.(L.slideIndex),p.flashToolTarget(L);},M=u=>{q(t$1,l,u.messages,i),s.hidden=u.messages.length>0,u.messages.length===0&&l.appendChild(s),G(t$1,g,r.proposals.list(),i,{accept:A=>{p?.flashToolTarget(null),r.proposals.apply(A),M(r.getSnapshot());},reject:A=>{r.proposals.revert(A),M(r.getSnapshot());},acceptAll:()=>{p?.flashToolTarget(null),r.proposals.acceptAll(),M(r.getSnapshot());}});let w=u.status==="submitted"||u.status==="streaming";n.classList.toggle("is-busy",w),y.setAttribute("aria-label",i(w?"pptx.ai.stop":"pptx.ai.send")),f$1.hidden=!u.error,f$1.textContent=u.error?i("pptx.ai.errorPrefix"):"",l.scrollTop=l.scrollHeight,P(u);},S=()=>{if(n.classList.contains("is-busy")){r.stop();return}let u=d.value.trim();u&&(d.value="",r.sendMessage(u));};C.addEventListener("submit",u=>{u.preventDefault(),S();}),d.addEventListener("keydown",u=>{u.key==="Enter"&&!u.shiftKey&&(u.preventDefault(),S());});let I=p?.getPrefill().nonce??0,J=()=>{if(!p)return;let u=p.getPrefill();u.nonce!==I&&(I=u.nonce,d.value=u.text,d.focus());},Q=p?.subscribe(J),X=r.subscribe(M);return M(r.getSnapshot()),{changeAnimator:r.changeAnimator,destroy(){X(),k(),b.destroy(),Q?.(),m$1?.destroy(),n.replaceChildren();}}}export{wt as createAiPanel};
|
|
1
|
+
import {w,K as K$1,o,m,n,f,t,j,k,l,s,r,q as q$1,c}from'./chunk-CBPWYT4I.js';import'./chunk-F3LDPYKE.js';import'./chunk-62D2TNHX.js';function K(o){let{doc:t,t:n,controller:i}=o,a=w(t,"div","pptxv-ai-focus"),h=(p,m,l)=>{let s=w(t,"button","pptxv-ai-focus-btn");return s.type="button",s.title=m,s.setAttribute("aria-label",m),s.appendChild(K$1(t,p)),s.addEventListener("click",l),s},x=()=>{a.replaceChildren();let p=i.getEffectiveTargets(),m=i.hasPicks(),l$1=i.isPinned(),s=i.isPicking(),g=w(t,"div","pptxv-ai-focus-row"),f=w(t,"span","pptxv-ai-focus-label");f.textContent=n("pptx.ai.focusScope"),g.appendChild(f);for(let r of j(p,o.getSlides())){let b=w(t,"span","pptxv-ai-focus-chip");(m||l$1)&&b.classList.add("is-strong"),b.title=r.title,b.textContent=r.label,g.appendChild(b);}if(l$1){let r=w(t,"span","pptxv-ai-focus-pinned");r.textContent=n("pptx.ai.pinnedFocus"),g.appendChild(r);}let C=w(t,"div","pptxv-ai-focus-actions"),d=k(p,o.getSlides());if(d){let r=w(t,"button","pptxv-ai-focus-merge");r.type="button",r.append(K$1(t,"git-merge"),t.createTextNode(n("pptx.ai.mergeSelectedTables"))),r.addEventListener("click",()=>o.onSendDirective(l(d.slideIndex,d.elementIdA,d.elementIdB))),C.appendChild(r);}let y=h("crosshair",n("pptx.ai.pickElement"),()=>s?i.stopPicking():i.startPicking());if(y.setAttribute("aria-pressed",String(s)),y.classList.toggle("is-active",s),C.appendChild(y),m?C.appendChild(h("close",n("pptx.ai.pickClear"),()=>i.clearPicks())):l$1?C.appendChild(h("pin-off",n("pptx.ai.clearFocus"),()=>i.clearPinnedFocus())):C.appendChild(h("pin",n("pptx.ai.pinFocus"),()=>i.pinFocus())),g.appendChild(C),a.appendChild(g),s){let r=w(t,"div","pptxv-ai-focus-pick"),b=K$1(t,"crosshair");b.classList.add("pptxv-ai-focus-pick-icon");let k=w(t,"span","pptxv-ai-focus-pick-hint");k.textContent=n("pptx.ai.pickElementHint");let T=w(t,"button","pptxv-ai-focus-pick-done");T.type="button",T.textContent=n("pptx.ai.pickDone"),T.addEventListener("click",()=>i.stopPicking()),r.append(b,k,T),a.appendChild(r);}},c=i.subscribe(x);return x(),{el:a,destroy(){c(),a.remove();}}}function O(o){let{doc:t,t:n$1}=o,i=w(t,"button","pptxv-ai-chats");i.type="button",i.append(K$1(t,"history"),t.createTextNode(n$1("pptx.ai.chats")));let a=w(t,"div","pptxv-ai-history");a.hidden=true;let h=w(t,"div","pptxv-ai-history-head"),x=w(t,"span","pptxv-ai-history-title");x.textContent=n$1("pptx.ai.historyTitle");let c=w(t,"button","pptxv-ai-history-new");c.type="button",c.append(K$1(t,"plus"),t.createTextNode(n$1("pptx.ai.newChat"))),h.append(x,c);let p=w(t,"div","pptxv-ai-history-body"),m=w(t,"p","pptxv-ai-history-hint");m.textContent=n$1("pptx.ai.historyHint"),a.append(h,p,m);let l=n({deckId:o.deckId,store:o.store,getMessages:o.getMessages,setMessages:o.setMessages,untitledLabel:n$1("pptx.ai.untitledChat"),onChatsChanged:()=>s()});function s(){p.replaceChildren();let f=l.chats();if(f.length===0){let d=w(t,"p","pptxv-ai-history-empty");d.textContent=n$1("pptx.ai.historyEmpty"),p.appendChild(d);return}let C=w(t,"ul","pptxv-ai-history-list");for(let d of f){let y=w(t,"li","pptxv-ai-history-row"),r=w(t,"button","pptxv-ai-history-resume");r.type="button",r.classList.toggle("is-active",d.id===l.activeChatId());let b=w(t,"span","pptxv-ai-history-text"),k=w(t,"span","pptxv-ai-history-name");k.textContent=d.title||n$1("pptx.ai.untitledChat");let T=w(t,"span","pptxv-ai-history-meta");T.textContent=n$1("pptx.ai.messageCount",{count:d.messageCount}),b.append(k,T),r.append(K$1(t,"comment"),b),r.addEventListener("click",()=>{l.resumeChat(d.id),a.hidden=true;});let P=w(t,"button","pptxv-ai-history-delete");P.type="button",P.title=n$1("pptx.ai.deleteChat"),P.setAttribute("aria-label",n$1("pptx.ai.deleteChat")),P.appendChild(K$1(t,"trash")),P.addEventListener("click",()=>{l.deleteChat(d.id);}),y.append(r,P),C.appendChild(y);}p.appendChild(C);}s(),i.addEventListener("click",()=>{a.hidden=!a.hidden;}),c.addEventListener("click",()=>{l.newChat(),a.hidden=true;});let g=f=>{a.hidden||!(f.target instanceof Node)||!a.contains(f.target)&&!i.contains(f.target)&&(a.hidden=true);};return t.addEventListener("mousedown",g),{button:i,el:a,notifyMessagesChanged:()=>l.notifyMessagesChanged(),destroy(){t.removeEventListener("mousedown",g),l.dispose(),i.remove(),a.remove();}}}var _={view:"eye",text:"text-box",shape:"shapes",theme:"font-color",table:"table",slide:"layout",chart:"chart",move:"move-right",delete:"trash",search:"search",nav:"move-right",animation:"play",notes:"sticky-note",tool:"wrench"};function W(o,t,n){let i=t.state==="output-error",a=t.state==="output-available",h=!i&&!a,x=s(t.toolName,t.input,h?"present":"past"),c=w(o,"div","pptxv-ai-tool"),p=w(o,"div","pptxv-ai-tool-head"),m=K$1(o,_[x.icon]??"wrench");m.classList.add("pptxv-ai-tool-icon");let l=w(o,"span","pptxv-ai-tool-name");l.textContent=x.label;let s$1=w(o,"span","pptxv-ai-tool-state");if(i?(s$1.classList.add("is-error"),s$1.append(K$1(o,"alert"),o.createTextNode(n("pptx.ai.toolFailed")))):a?(s$1.classList.add("is-done"),s$1.append(K$1(o,"check"),o.createTextNode(n("pptx.ai.toolDone")))):(s$1.classList.add("is-running"),s$1.textContent=n("pptx.ai.toolRunning")),p.append(m,l,s$1),c.appendChild(p),i&&t.errorText){let f=w(o,"div","pptxv-ai-tool-error");f.textContent=t.errorText,c.appendChild(f);}let g=r(t.input);if(g){let f=w(o,"details","pptxv-ai-tool-details"),C=w(o,"summary");C.textContent=n("pptx.ai.toolDetails");let d=w(o,"div","pptxv-ai-tool-raw");d.textContent=`${q$1(t.toolName)}: ${g}`,f.append(C,d),c.appendChild(f);}return c}function q(o,t,n,i){t.replaceChildren();for(let a of n){if(a.role==="system")continue;let h=a.role==="user",x=f(a);if(x.length===0&&!h)continue;let c=w(o,"div",`pptxv-ai-msg pptxv-ai-msg-${a.role}`),p=w(o,"div","pptxv-ai-msg-avatar");p.setAttribute("aria-label",i(h?"pptx.ai.you":"pptx.ai.assistant")),p.appendChild(K$1(o,h?"comment":"sparkles"));let m=w(o,"div","pptxv-ai-msg-body");for(let l of x)if(l.kind==="text"){let s=w(o,"div","pptxv-ai-msg-text");s.textContent=l.text,m.appendChild(s);}else m.appendChild(W(o,l,i));c.append(p,m),t.appendChild(c);}}function G(o,t,n,i,a){if(t.replaceChildren(),t.hidden=n.length===0,n.length===0)return;let h=w(o,"div","pptxv-ai-proposals-header"),x=w(o,"span","pptxv-ai-proposals-title");if(x.textContent=i("pptx.ai.pendingChanges",{count:n.length}),h.appendChild(x),n.length>1){let c=w(o,"button","pptxv-ai-proposal-btn is-accept-all");c.type="button",c.textContent=i("pptx.ai.acceptAll"),c.addEventListener("click",()=>a.acceptAll()),h.appendChild(c);}t.appendChild(h);for(let c of n)t.appendChild(tt(o,c,i,a));}function tt(o,t,n,i){let a=w(o,"div","pptxv-ai-proposal");a.dataset.proposalId=t.id;let h=w(o,"div","pptxv-ai-proposal-eyebrow");h.textContent=n("pptx.ai.proposedChange"),a.appendChild(h);let x=w(o,"div","pptxv-ai-proposal-label");if(x.textContent=t.label,a.appendChild(x),t.summary.length>0){let l=w(o,"ul","pptxv-ai-proposal-summary");for(let s of t.summary){let g=w(o,"li");g.textContent=c(s),l.appendChild(g);}a.appendChild(l);}let c$1=w(o,"div","pptxv-ai-proposal-actions"),p=w(o,"button","pptxv-ai-proposal-btn is-accept");p.type="button",p.append(K$1(o,"check"),o.createTextNode(n("pptx.ai.accept"))),p.addEventListener("click",()=>i.accept(t.id));let m=w(o,"button","pptxv-ai-proposal-btn is-reject");return m.type="button",m.append(K$1(o,"close"),o.createTextNode(n("pptx.ai.reject"))),m.addEventListener("click",()=>i.reject(t.id)),c$1.append(p,m),a.appendChild(c$1),a}async function wt(o$1){let{doc:t$1,host:n,t:i}=o$1;n.replaceChildren();let a=w(t$1,"div","pptxv-ai-header"),h=w(t$1,"span","pptxv-ai-title");h.textContent=i("pptx.ai.title");let x=w(t$1,"button","pptxv-ai-close");x.type="button",x.title=i("pptx.ai.close"),x.setAttribute("aria-label",i("pptx.ai.close")),x.appendChild(K$1(t$1,"close")),x.addEventListener("click",()=>o$1.onClose?.()),a.append(K$1(t$1,"sparkles"),h,x);let c,p=o$1.controller,m$1=p?K({doc:t$1,t:i,controller:p,getSlides:()=>o$1.bridge.getSlides(),onSendDirective:u=>{c?.sendMessage(u);}}):null,l=w(t$1,"div","pptxv-ai-messages");l.setAttribute("role","log"),l.setAttribute("aria-live","polite");let s=w(t$1,"div","pptxv-ai-empty");s.textContent=i("pptx.ai.emptyHint"),l.appendChild(s);let g=w(t$1,"div","pptxv-ai-proposals");g.hidden=true;let f$1=w(t$1,"div","pptxv-ai-error");f$1.setAttribute("role","alert"),f$1.hidden=true;let C=w(t$1,"form","pptxv-ai-composer"),d=w(t$1,"textarea","pptxv-ai-input");d.rows=2,d.placeholder=i("pptx.ai.placeholder"),d.setAttribute("aria-label",i("pptx.ai.placeholder"));let y=w(t$1,"button","pptxv-ai-send");y.type="submit",y.setAttribute("aria-label",i("pptx.ai.send")),y.appendChild(K$1(t$1,"send")),C.append(d,y),n.append(a,...m$1?[m$1.el]:[],l,g,f$1,C);try{c=await(o$1.createChat??o)({bridge:o$1.bridge,config:o$1.config});}catch{return s.textContent=i("pptx.ai.unavailableTitle"),d.disabled=true,y.disabled=true,m$1?.destroy(),{destroy:()=>n.replaceChildren()}}let r=c,b=O({doc:t$1,t:i,deckId:m(o$1.bridge),store:o$1.historyStore,getMessages:()=>r.getSnapshot().messages,setMessages:u=>r.setMessages(u)});a.insertBefore(b.button,x),n.appendChild(b.el);let k=r.subscribe(()=>b.notifyMessagesChanged()),T=new Set,P=u=>{if(!p)return;let A=u.messages.flatMap(Y=>f(Y).filter(Z=>Z.kind==="tool")).at(-1);if(!A||A.kind!=="tool"||A.state==="input-streaming"||T.has(A.toolCallId))return;T.add(A.toolCallId);let L=t(A.toolName,A.input);L&&L.slideIndex!==void 0&&o$1.goToSlide?.(L.slideIndex),p.flashToolTarget(L);},M=u=>{q(t$1,l,u.messages,i),s.hidden=u.messages.length>0,u.messages.length===0&&l.appendChild(s),G(t$1,g,r.proposals.list(),i,{accept:A=>{p?.flashToolTarget(null),r.proposals.apply(A),M(r.getSnapshot());},reject:A=>{r.proposals.revert(A),M(r.getSnapshot());},acceptAll:()=>{p?.flashToolTarget(null),r.proposals.acceptAll(),M(r.getSnapshot());}});let w=u.status==="submitted"||u.status==="streaming";n.classList.toggle("is-busy",w),y.setAttribute("aria-label",i(w?"pptx.ai.stop":"pptx.ai.send")),f$1.hidden=!u.error,f$1.textContent=u.error?i("pptx.ai.errorPrefix"):"",l.scrollTop=l.scrollHeight,P(u);},S=()=>{if(n.classList.contains("is-busy")){r.stop();return}let u=d.value.trim();u&&(d.value="",r.sendMessage(u));};C.addEventListener("submit",u=>{u.preventDefault(),S();}),d.addEventListener("keydown",u=>{u.key==="Enter"&&!u.shiftKey&&(u.preventDefault(),S());});let I=p?.getPrefill().nonce??0,J=()=>{if(!p)return;let u=p.getPrefill();u.nonce!==I&&(I=u.nonce,d.value=u.text,d.focus());},Q=p?.subscribe(J),X=r.subscribe(M);return M(r.getSnapshot()),{changeAnimator:r.changeAnimator,destroy(){X(),k(),b.destroy(),Q?.(),m$1?.destroy(),n.replaceChildren();}}}export{wt as createAiPanel};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {Cc,Yh,
|
|
1
|
+
import {Cc,Yh,nm,$h,ai,Wh,Cg,Bg,Dg,Ms,ud,zg,Ag}from'./chunk-F3LDPYKE.js';var R="data-pptx-text-style-override";function z(n,i,r){Ms(n,r?.textStyle);let a=ud(i,r?.textStyle),e=n.querySelector(`:scope > style[${R}]`);if(!a){e?.remove();return}e||(e=n.ownerDocument.createElement("style"),e.setAttribute(R,""),n.prepend(e)),e.textContent=a;}var w="pptx-vanilla-presentation-keyframes",k="pptx-vanilla-slide-keyframes";function K(n){if(n.getElementById(w))return;let i=n.createElement("style");i.id=w,i.textContent=`${Cc}
|
|
2
2
|
${Yh}
|
|
3
|
-
${
|
|
3
|
+
${nm}`,(n.head??n.documentElement).appendChild(i);}function W(n,i){let r=n.getElementById(k);if(!i){r?.remove();return}r||(r=n.createElement("style"),r.id=k,(n.head??n.documentElement).appendChild(r)),r.textContent=i;}function X(n,i,r,a){n.querySelectorAll("[data-element-id]").forEach(e=>{let t=e.dataset.elementId;if(!t)return;let o=i.get(t);e.style.animation=o?.cssAnimation??"",e.style.visibility=o?.visible===false?"hidden":"",e.style.cursor=r.has(t)||a.has(t)?"pointer":"",z(e,t,o);}),n.querySelectorAll("[data-anim-id]").forEach(e=>{let t=e.dataset.animId;if(!t)return;let o=i.get(t);e.style.animation=o?.cssAnimation??"",e.style.visibility=o?.visible===false?"hidden":"";});}function M(n,i,r,a,e){let t=n.createElement("div");t.className="pptxv-transition-layer",t.dataset.pptxTransitionLayer=e,t.dataset.pptxTransitionFragments=r.keyframesName,t.style.position="absolute",t.style.inset="0",t.style.overflow="hidden",t.style.pointerEvents="none",t.style.zIndex=String(a);for(let o of r.fragments)t.appendChild(B(n,i,r,o));return t}function B(n,i,r,a){let e=n.createElement("div");e.dataset.pptxTransitionFragment=a.id,e.style.position="absolute",e.style.inset="0",e.style.clipPath=a.clipPath,e.style.transformOrigin=a.transformOrigin,e.style.animationName=r.keyframesName,e.style.animationDuration=`${r.durationMs}ms`,e.style.animationTimingFunction=r.easing,e.style.animationDelay=`${a.delayMs}ms`,e.style.animationFillMode="forwards",e.style.willChange="transform, opacity";for(let[t,o]of Object.entries(a.vars))e.style.setProperty(t,o);return e.appendChild(i.cloneNode(true)),e}function u(n,i,r,a,e){let t=n.createElement("div");return t.className="pptxv-transition-layer",t.dataset.pptxTransitionLayer=e,t.style.position="absolute",t.style.inset="0",t.style.overflow="hidden",t.style.zIndex=String(r),t.style.willChange="transform, opacity, clip-path, filter",a!=="none"&&(t.style.animation=a),t.appendChild(i),t}function T(n,i){n.style.background="none",n.style.backgroundColor="transparent";let r=new Set(i),a=new Set;for(let e of n.querySelectorAll("[data-element-id]")){let t=e.dataset.elementId;if(!(t===void 0||!r.has(t))){for(let o=e;o&&o!==n;)a.add(o),o=o.parentElement;for(let o of e.querySelectorAll("[data-element-id]"))a.add(o);}}for(let e of [...n.querySelectorAll("[data-element-id]")])a.has(e)||e.remove();return n}function q(n,i,r,a){return (a?.crossfadeGroups??[]).map((e,t)=>{let o=n.createElement("div");o.dataset.pptxMorphCrossfade=e.incoming.id,o.style.cssText=zg,o.style.zIndex=String(4+t);let m=(p,l,s,y,g)=>{let d=u(n,T(p,[l]),y,g??"none",s);return s==="outgoing"?d.dataset.pptxMorphOutgoing="true":d.dataset.pptxMorphLifted="true",d.style.mixBlendMode=Ag,d};return o.append(m(i.cloneNode(true),e.outgoing.id,"outgoing",0,e.outgoingAnimation),m(r.cloneNode(true),e.incoming.id,"lifted",1,e.incomingAnimation)),o})}function se(n){let{doc:i,stageWrap:r,outgoing:a,incoming:e,transition:t}=n;K(i);let o=$h(t),m=ai(t),p=Wh(t.type,m,t.direction,t.spokes,t.pattern),l=i.createElement("div");l.className="pptxv-transition-overlay",l.dataset.pptxTransitionOverlay="",l.dataset.pptxTransitionOverlay="",l.style.position="absolute",l.style.inset="0",l.style.overflow="hidden",l.style.pointerEvents="none",l.style.zIndex="30";let s=t.type==="morph"?Cg(n.outgoingSlide,n.incomingSlide,m,Bg(t.morphOption)):void 0,y=s||o.outgoingOnTop?2:1,g=s||o.outgoingOnTop?1:2,d=!s&&p?.outgoing?M(i,a,p.outgoing,y,"outgoing"):u(i,a,y,s?"none":o.outgoing,"outgoing"),x=!s&&p?.incoming?M(i,e,p.incoming,g,"incoming"):u(i,e,g,s?"none":o.incoming,"incoming"),S=s&&s.overlayIncomingElements.length>0?T(e.cloneNode(true),s.overlayIncomingElements.map(c=>c.id)):void 0,f=S?u(i,S,3,"none","lifted"):void 0,$=q(i,a,e,s);if(s){x.dataset.pptxMorphIncoming="true",d.dataset.pptxMorphOutgoing="true",T(a,s.outgoingElements.map(Y=>Y.id)),f&&(f.dataset.pptxMorphLifted="true");let c=i.createElement("style");c.textContent=[Dg(s,"data-pptx-morph-incoming","incoming"),Dg(s,"data-pptx-morph-outgoing","outgoing"),Dg(s,"data-pptx-morph-lifted","lifted")].join(`
|
|
4
4
|
`),l.appendChild(c);}l.append(d,x),f&&l.appendChild(f);for(let c of $)l.appendChild(c);r.appendChild(l);let h=false,v=()=>{h||(h=true,clearTimeout(G),l.remove(),n.onDone());},G=setTimeout(v,Math.max(0,m)+50);return v}export{K as a,W as b,X as c,se as d};
|