pptx-vanilla-viewer 3.7.0 → 3.8.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 +66 -0
- package/dist/{ai-panel-7RNRWID6.js → ai-panel-HYSMSKDR.js} +1 -1
- package/dist/{ai-panel-MMWVMXGX.cjs → ai-panel-LYVZCC6W.cjs} +1 -1
- package/dist/{chunk-GX4G423W.cjs → chunk-BAZT6KJZ.cjs} +8 -8
- package/dist/{chunk-HM6ZV75P.js → chunk-DO3P32RM.js} +3 -3
- package/dist/chunk-DXLLCHZP.js +2875 -0
- package/dist/{chunk-LZWQ7EY2.js → chunk-LLTNOSPY.js} +6 -6
- package/dist/{chunk-SD5NVWW4.cjs → chunk-NK7KOKX2.cjs} +3 -3
- package/dist/chunk-Q4GMEOAI.cjs +2875 -0
- package/dist/i18n/de.cjs +64 -96
- package/dist/i18n/de.mjs +64 -96
- package/dist/i18n/es.cjs +64 -96
- package/dist/i18n/es.mjs +64 -96
- package/dist/i18n/fr.cjs +64 -96
- package/dist/i18n/fr.mjs +64 -96
- package/dist/i18n/zh-CN.cjs +63 -95
- package/dist/i18n/zh-CN.mjs +63 -95
- package/dist/index.cjs +12 -12
- package/dist/index.d.ts +1 -1
- package/dist/index.js +11 -11
- package/dist/internals.cjs +1 -1
- package/dist/internals.d.ts +1 -1
- package/dist/internals.js +1 -1
- package/dist/{transition-overlay-ydBEO9eL.d.ts → transition-overlay-DB7RDVkV.d.ts} +102 -6
- package/dist/transition-overlay-DB7RDVkV.d.ts.map +1 -0
- package/package.json +1 -1
- package/dist/chunk-K7SLACZS.js +0 -2866
- package/dist/chunk-TZD4KXQM.cjs +0 -2866
- package/dist/transition-overlay-ydBEO9eL.d.ts.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,72 @@ 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.7.0](https://github.com/ChristopherVR/pptx-viewer/releases/tag/pptx-vanilla-viewer@3.7.0) - 2026-09-25
|
|
11
|
+
|
|
12
|
+
### Features
|
|
13
|
+
|
|
14
|
+
- **shared:** Edit points model, sessions and freeform tools (by @ChristopherVR) ([481dd57](https://github.com/ChristopherVR/pptx-viewer/commit/481dd5758c023d726255cfaab6473e075453ba8a))
|
|
15
|
+
- **locales:** Translate edit points and freeform tool strings (by @ChristopherVR) ([eef2d4a](https://github.com/ChristopherVR/pptx-viewer/commit/eef2d4ab7a099697b9711748d30315e7d0ffd6ac))
|
|
16
|
+
- **shared:** Keep preset text box and place edit points menu in slide space (by @ChristopherVR) ([a4699df](https://github.com/ChristopherVR/pptx-viewer/commit/a4699dfc4ad3ea442ee2d43116b0f620882bb7bc))
|
|
17
|
+
- **vanilla:** Edit points and freeform shape / curve tools (by @ChristopherVR) ([715dc69](https://github.com/ChristopherVR/pptx-viewer/commit/715dc698c5a70ecac92b86a56a9f26556a377c41))
|
|
18
|
+
- **shared:** Merge shapes engine and on-canvas picture crop geometry (by @ChristopherVR) ([0e13020](https://github.com/ChristopherVR/pptx-viewer/commit/0e130203710ff109629330e6cf6efe097e962875))
|
|
19
|
+
- **locales:** Translate merge shapes and picture crop strings (by @ChristopherVR) ([2388efb](https://github.com/ChristopherVR/pptx-viewer/commit/2388efb4d4ed17c3ec212d5f64e9dba3cd18f268))
|
|
20
|
+
- **vanilla:** Merge shapes and on-canvas picture crop (by @ChristopherVR) ([14ab278](https://github.com/ChristopherVR/pptx-viewer/commit/14ab27843aaa73cea8b00d03e6328a8dc37b7624))
|
|
21
|
+
- **core:** Expose the zoom transition's in/out direction (by @ChristopherVR) ([e9d9da5](https://github.com/ChristopherVR/pptx-viewer/commit/e9d9da5a017f42b2318b6a93394dd8c3f6c34051))
|
|
22
|
+
- **core:** Read and write media-bookmark triggers the way PowerPoint does (by @ChristopherVR) ([cbe17f9](https://github.com/ChristopherVR/pptx-viewer/commit/cbe17f9a00c639fb3a5666b41222cc5de21d302e))
|
|
23
|
+
- **shared:** Add the "On bookmark" trigger and its bookmark picker model (by @ChristopherVR) ([95f07a7](https://github.com/ChristopherVR/pptx-viewer/commit/95f07a77ff3d0750acbf7495dc77fe84072817d3))
|
|
24
|
+
- **locales:** Translate the On bookmark trigger picker (by @ChristopherVR) ([e06e9dc](https://github.com/ChristopherVR/pptx-viewer/commit/e06e9dc000158534405c9b372d52a9827447465c))
|
|
25
|
+
- **vanilla:** Pick the media bookmark for an On bookmark trigger (by @ChristopherVR) ([2fcee92](https://github.com/ChristopherVR/pptx-viewer/commit/2fcee92be7e9422cf4140d0c909b97d24420553c))
|
|
26
|
+
- **core:** Break smartart engine-vs-legacy geometry ties on fonts (by @ChristopherVR) ([9b23ac0](https://github.com/ChristopherVR/pptx-viewer/commit/9b23ac04ad4366da7b67c80d1e5222675c564698))
|
|
27
|
+
- **core:** Lay smartart hierarchies out as packed outlines, then scale (by @ChristopherVR) ([74b7bce](https://github.com/ChristopherVR/pptx-viewer/commit/74b7bcea5fe2b985efdf93c0bfd3cfd6b05e04cc))
|
|
28
|
+
- **core:** Lay smartart snake grids out from their cells' own sizes (by @ChristopherVR) ([e9526ff](https://github.com/ChristopherVR/pptx-viewer/commit/e9526ffc30b0829eb2231c693da69c562a0ed454))
|
|
29
|
+
- **core:** Parse chart-area, plot-area and series gradient fills (by @ChristopherVR) ([4db5abc](https://github.com/ChristopherVR/pptx-viewer/commit/4db5abc3c3c57428b231a6cb4aed041b0e4b2d8b))
|
|
30
|
+
- **shared:** Paint chart gradient fills in all five bindings (by @ChristopherVR) ([7f22964](https://github.com/ChristopherVR/pptx-viewer/commit/7f229642cda0b1388df4c6be560478192152f051))
|
|
31
|
+
- **core:** Parse data-label boxes, callout shapes and c15 leader lines (by @ChristopherVR) ([763cadd](https://github.com/ChristopherVR/pptx-viewer/commit/763cadd268d5f57b91129c1597bef610cb7b3bf4))
|
|
32
|
+
|
|
33
|
+
### Bug Fixes
|
|
34
|
+
|
|
35
|
+
- **shared:** Restore absent crop insets as undefined on cancel (by @ChristopherVR) ([33b5094](https://github.com/ChristopherVR/pptx-viewer/commit/33b509485634bfee452e5ce8a9f4fb7acc9bdc6e))
|
|
36
|
+
- **vanilla:** Accept the shared crop cancel update type (by @ChristopherVR) ([5a117a4](https://github.com/ChristopherVR/pptx-viewer/commit/5a117a45c79e09d0c7554f3de2627d3b5d2eaf3b))
|
|
37
|
+
- **core:** Keep runs apart that differ only by an authored baseline="0" (by @ChristopherVR) ([aea3c57](https://github.com/ChristopherVR/pptx-viewer/commit/aea3c57542823e311332a15ac85ff045cfbb3331))
|
|
38
|
+
- **shared:** Play the zoom transition as PowerPoint's box reveal (by @ChristopherVR) ([6194b84](https://github.com/ChristopherVR/pptx-viewer/commit/6194b846fcc7284efe9780d97037bf1e2706136e))
|
|
39
|
+
- **shared:** Fit the Bounce End settle curve to PowerPoint's own frames (by @ChristopherVR) ([5268384](https://github.com/ChristopherVR/pptx-viewer/commit/5268384724177b188da4a47fdf9678f2ba16acdb))
|
|
40
|
+
- **core:** Keep authored buClr on a rewritten paragraph (by @ChristopherVR) ([77f1f86](https://github.com/ChristopherVR/pptx-viewer/commit/77f1f86d946c8f058183f787696198d4035b7a81))
|
|
41
|
+
- **core:** Keep an authored tab-stop algn="l" on rewrite (by @ChristopherVR) ([e6050da](https://github.com/ChristopherVR/pptx-viewer/commit/e6050dae8683be269b1c9675bb195369d5dfda7a))
|
|
42
|
+
- **core:** Stop unedited animation metadata growing on save (by @ChristopherVR) ([d0fce7c](https://github.com/ChristopherVR/pptx-viewer/commit/d0fce7c59c599588dba6e950b66629276d4df481))
|
|
43
|
+
- **core:** Keep a source commentAuthors part nothing removed (by @ChristopherVR) ([03f6967](https://github.com/ChristopherVR/pptx-viewer/commit/03f6967ed3cdd57de1896e03e631c2999716149c))
|
|
44
|
+
- **core:** Read media bookmarks where PowerPoint nests them (by @ChristopherVR) ([7ec0f27](https://github.com/ChristopherVR/pptx-viewer/commit/7ec0f27c35c12458db1d8a480014049c8e81cfcf))
|
|
45
|
+
- **core:** Size smartart engine text from primFontSz rules and groups (by @ChristopherVR) ([e957395](https://github.com/ChristopherVR/pptx-viewer/commit/e957395722c0d80f878f81f282e2e271461d945f))
|
|
46
|
+
- **core:** Measure smartart text with kerned boundwidth aptos metrics (by @ChristopherVR) ([9603333](https://github.com/ChristopherVR/pptx-viewer/commit/960333342c7676a35b9c9e845017615fdd8a0b2a))
|
|
47
|
+
- **core:** Lay smartart engine text out by tx paragraph levels (by @ChristopherVR) ([ff90fd8](https://github.com/ChristopherVR/pptx-viewer/commit/ff90fd8e6277dbc5a396c887ac87f77c2e7d7a65))
|
|
48
|
+
- **core:** Draw smartart engine boxes that present text after a blank (by @ChristopherVR) ([e049efb](https://github.com/ChristopherVR/pptx-viewer/commit/e049efba80b8f79f544cf8223fa33379d11e2e59))
|
|
49
|
+
- **core:** Match PowerPoint's auto-number schemes past the basics (by @ChristopherVR) ([aa10890](https://github.com/ChristopherVR/pptx-viewer/commit/aa10890d99ea75f712170403ab0b1f6a9217d5cd))
|
|
50
|
+
- **core:** Render picture-filled text runs instead of solid black (by @ChristopherVR) ([e1021f9](https://github.com/ChristopherVR/pptx-viewer/commit/e1021f9f4fb8efe07bb0dbb70c63e342ec764d49))
|
|
51
|
+
- **shared:** Draw a dashed text outline for a:ln/a:prstDash (by @ChristopherVR) ([af7eb60](https://github.com/ChristopherVR/pptx-viewer/commit/af7eb60fb210a418ac3fb032039e1ca3b5d4c674))
|
|
52
|
+
- **shared:** Match PowerPoint's underline variants (by @ChristopherVR) ([46ad363](https://github.com/ChristopherVR/pptx-viewer/commit/46ad3637a88ed2d9b18c3fdee0aa98ba57207b3f))
|
|
53
|
+
- **core:** Let a paragraph's own rtl beat the level default on its runs (by @ChristopherVR) ([4ae3d68](https://github.com/ChristopherVR/pptx-viewer/commit/4ae3d68362a956680cfe12bf1022f13c9e877510))
|
|
54
|
+
- **shared:** Align decimal and right-to-left tab stops like PowerPoint (by @ChristopherVR) ([1575f61](https://github.com/ChristopherVR/pptx-viewer/commit/1575f61f3cefa9f703e21d2f914ec567e541f81a))
|
|
55
|
+
- **shared:** Ignore a paragraph's trailing spaces when aligning it (by @ChristopherVR) ([3973465](https://github.com/ChristopherVR/pptx-viewer/commit/39734651a091b43ecc9c41689ce5ce899e91b5ac))
|
|
56
|
+
- **shared:** Clip an overflowing text body at a whole line (by @ChristopherVR) ([7f77dcd](https://github.com/ChristopherVR/pptx-viewer/commit/7f77dcda9d17c9b569c5d2a7fddf2144ef196b6a))
|
|
57
|
+
- **shared:** Colour and label waterfall bars like PowerPoint (by @ChristopherVR) ([44a4fec](https://github.com/ChristopherVR/pptx-viewer/commit/44a4fec1284837b3249202e2a40053ef934ba85f))
|
|
58
|
+
- **shared:** Draw PowerPoint's automatic chart titles (by @ChristopherVR) ([8f435a4](https://github.com/ChristopherVR/pptx-viewer/commit/8f435a4d199250421ab947a12a360bd881273995))
|
|
59
|
+
- **shared:** Lay out pie-of-pie and bar-of-pie like PowerPoint (by @ChristopherVR) ([578d524](https://github.com/ChristopherVR/pptx-viewer/commit/578d524dd7fefcb09a583f0abafb787db866938d))
|
|
60
|
+
- **shared:** Format and place display-unit axis labels like PowerPoint (by @ChristopherVR) ([73acba4](https://github.com/ChristopherVR/pptx-viewer/commit/73acba45b8940cf44fe16164c564ca18661dba36))
|
|
61
|
+
- **shared:** Lay out chart data tables like PowerPoint (by @ChristopherVR) ([0220fd6](https://github.com/ChristopherVR/pptx-viewer/commit/0220fd62c63e1de4febeaeef963ff258b91cbcd4))
|
|
62
|
+
- **shared:** Draw data-label callouts and leader lines on bar charts (by @ChristopherVR) ([68296ef](https://github.com/ChristopherVR/pptx-viewer/commit/68296ef4e729ece9c0a51eff3b9e03b011b986e4))
|
|
63
|
+
- **core:** Parse series gradients through a pure helper (by @ChristopherVR) ([1f83eaf](https://github.com/ChristopherVR/pptx-viewer/commit/1f83eaf9f5c461430e7d54c1e212ee43b7519819))
|
|
64
|
+
|
|
65
|
+
### Documentation
|
|
66
|
+
|
|
67
|
+
- **core:** Describe p14:bounceEnd as the bouncing share of the duration (by @ChristopherVR) ([80caab6](https://github.com/ChristopherVR/pptx-viewer/commit/80caab642e04a548a912fdbe8d937732096792f9))
|
|
68
|
+
- **core:** Record the smartart font, hierarchy and snake measurements (by @ChristopherVR) ([2187e69](https://github.com/ChristopherVR/pptx-viewer/commit/2187e692746fbde2e9f3c6399c1fde6a83ca57cb))
|
|
69
|
+
|
|
70
|
+
### Testing
|
|
71
|
+
|
|
72
|
+
- **e2e:** Cover merge shapes and picture crop in every demo (by @ChristopherVR) ([a7e7bed](https://github.com/ChristopherVR/pptx-viewer/commit/a7e7bed63129981afba50ef12ae2cdd4ee854d3f))
|
|
73
|
+
- **e2e:** Author an On bookmark trigger in every demo and check the save (by @ChristopherVR) ([aa3ff3c](https://github.com/ChristopherVR/pptx-viewer/commit/aa3ff3c9764192dd81b65874668cdb09da0e81ce))
|
|
74
|
+
- **core,vanilla:** Register the edit-points fixture and type the bookmark test store (by @ChristopherVR) ([9114d7c](https://github.com/ChristopherVR/pptx-viewer/commit/9114d7cec7a1f60b44bab5ef21d1cf9bcbccb054))
|
|
75
|
+
|
|
10
76
|
## [3.6.0](https://github.com/ChristopherVR/pptx-viewer/releases/tag/pptx-vanilla-viewer@3.6.0) - 2026-09-25
|
|
11
77
|
|
|
12
78
|
### Features
|
|
@@ -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-LZWQ7EY2.js';import'./chunk-K7SLACZS.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-LLTNOSPY.js';import'./chunk-DXLLCHZP.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 +1 @@
|
|
|
1
|
-
'use strict';var chunkGX4G423W_cjs=require('./chunk-GX4G423W.cjs');require('./chunk-TZD4KXQM.cjs'),require('./chunk-B5PFHICE.cjs');function K(o){let{doc:t,t:n,controller:i}=o,a=chunkGX4G423W_cjs.w(t,"div","pptxv-ai-focus"),h=(p,m,l)=>{let s=chunkGX4G423W_cjs.w(t,"button","pptxv-ai-focus-btn");return s.type="button",s.title=m,s.setAttribute("aria-label",m),s.appendChild(chunkGX4G423W_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=chunkGX4G423W_cjs.w(t,"div","pptxv-ai-focus-row"),f=chunkGX4G423W_cjs.w(t,"span","pptxv-ai-focus-label");f.textContent=n("pptx.ai.focusScope"),g.appendChild(f);for(let r of chunkGX4G423W_cjs.j(p,o.getSlides())){let b=chunkGX4G423W_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=chunkGX4G423W_cjs.w(t,"span","pptxv-ai-focus-pinned");r.textContent=n("pptx.ai.pinnedFocus"),g.appendChild(r);}let C=chunkGX4G423W_cjs.w(t,"div","pptxv-ai-focus-actions"),d=chunkGX4G423W_cjs.k(p,o.getSlides());if(d){let r=chunkGX4G423W_cjs.w(t,"button","pptxv-ai-focus-merge");r.type="button",r.append(chunkGX4G423W_cjs.K(t,"git-merge"),t.createTextNode(n("pptx.ai.mergeSelectedTables"))),r.addEventListener("click",()=>o.onSendDirective(chunkGX4G423W_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=chunkGX4G423W_cjs.w(t,"div","pptxv-ai-focus-pick"),b=chunkGX4G423W_cjs.K(t,"crosshair");b.classList.add("pptxv-ai-focus-pick-icon");let k=chunkGX4G423W_cjs.w(t,"span","pptxv-ai-focus-pick-hint");k.textContent=n("pptx.ai.pickElementHint");let T=chunkGX4G423W_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=chunkGX4G423W_cjs.w(t,"button","pptxv-ai-chats");i.type="button",i.append(chunkGX4G423W_cjs.K(t,"history"),t.createTextNode(n("pptx.ai.chats")));let a=chunkGX4G423W_cjs.w(t,"div","pptxv-ai-history");a.hidden=true;let h=chunkGX4G423W_cjs.w(t,"div","pptxv-ai-history-head"),x=chunkGX4G423W_cjs.w(t,"span","pptxv-ai-history-title");x.textContent=n("pptx.ai.historyTitle");let c=chunkGX4G423W_cjs.w(t,"button","pptxv-ai-history-new");c.type="button",c.append(chunkGX4G423W_cjs.K(t,"plus"),t.createTextNode(n("pptx.ai.newChat"))),h.append(x,c);let p=chunkGX4G423W_cjs.w(t,"div","pptxv-ai-history-body"),m=chunkGX4G423W_cjs.w(t,"p","pptxv-ai-history-hint");m.textContent=n("pptx.ai.historyHint"),a.append(h,p,m);let l=chunkGX4G423W_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=chunkGX4G423W_cjs.w(t,"p","pptxv-ai-history-empty");d.textContent=n("pptx.ai.historyEmpty"),p.appendChild(d);return}let C=chunkGX4G423W_cjs.w(t,"ul","pptxv-ai-history-list");for(let d of f){let y=chunkGX4G423W_cjs.w(t,"li","pptxv-ai-history-row"),r=chunkGX4G423W_cjs.w(t,"button","pptxv-ai-history-resume");r.type="button",r.classList.toggle("is-active",d.id===l.activeChatId());let b=chunkGX4G423W_cjs.w(t,"span","pptxv-ai-history-text"),k=chunkGX4G423W_cjs.w(t,"span","pptxv-ai-history-name");k.textContent=d.title||n("pptx.ai.untitledChat");let T=chunkGX4G423W_cjs.w(t,"span","pptxv-ai-history-meta");T.textContent=n("pptx.ai.messageCount",{count:d.messageCount}),b.append(k,T),r.append(chunkGX4G423W_cjs.K(t,"comment"),b),r.addEventListener("click",()=>{l.resumeChat(d.id),a.hidden=true;});let P=chunkGX4G423W_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(chunkGX4G423W_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=chunkGX4G423W_cjs.s(t.toolName,t.input,h?"present":"past"),c=chunkGX4G423W_cjs.w(o,"div","pptxv-ai-tool"),p=chunkGX4G423W_cjs.w(o,"div","pptxv-ai-tool-head"),m=chunkGX4G423W_cjs.K(o,_[x.icon]??"wrench");m.classList.add("pptxv-ai-tool-icon");let l=chunkGX4G423W_cjs.w(o,"span","pptxv-ai-tool-name");l.textContent=x.label;let s=chunkGX4G423W_cjs.w(o,"span","pptxv-ai-tool-state");if(i?(s.classList.add("is-error"),s.append(chunkGX4G423W_cjs.K(o,"alert"),o.createTextNode(n("pptx.ai.toolFailed")))):a?(s.classList.add("is-done"),s.append(chunkGX4G423W_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=chunkGX4G423W_cjs.w(o,"div","pptxv-ai-tool-error");f.textContent=t.errorText,c.appendChild(f);}let g=chunkGX4G423W_cjs.r(t.input);if(g){let f=chunkGX4G423W_cjs.w(o,"details","pptxv-ai-tool-details"),C=chunkGX4G423W_cjs.w(o,"summary");C.textContent=n("pptx.ai.toolDetails");let d=chunkGX4G423W_cjs.w(o,"div","pptxv-ai-tool-raw");d.textContent=`${chunkGX4G423W_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=chunkGX4G423W_cjs.f(a);if(x.length===0&&!h)continue;let c=chunkGX4G423W_cjs.w(o,"div",`pptxv-ai-msg pptxv-ai-msg-${a.role}`),p=chunkGX4G423W_cjs.w(o,"div","pptxv-ai-msg-avatar");p.setAttribute("aria-label",i(h?"pptx.ai.you":"pptx.ai.assistant")),p.appendChild(chunkGX4G423W_cjs.K(o,h?"comment":"sparkles"));let m=chunkGX4G423W_cjs.w(o,"div","pptxv-ai-msg-body");for(let l of x)if(l.kind==="text"){let s=chunkGX4G423W_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=chunkGX4G423W_cjs.w(o,"div","pptxv-ai-proposals-header"),x=chunkGX4G423W_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=chunkGX4G423W_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=chunkGX4G423W_cjs.w(o,"div","pptxv-ai-proposal");a.dataset.proposalId=t.id;let h=chunkGX4G423W_cjs.w(o,"div","pptxv-ai-proposal-eyebrow");h.textContent=n("pptx.ai.proposedChange"),a.appendChild(h);let x=chunkGX4G423W_cjs.w(o,"div","pptxv-ai-proposal-label");if(x.textContent=t.label,a.appendChild(x),t.summary.length>0){let l=chunkGX4G423W_cjs.w(o,"ul","pptxv-ai-proposal-summary");for(let s of t.summary){let g=chunkGX4G423W_cjs.w(o,"li");g.textContent=chunkGX4G423W_cjs.c(s),l.appendChild(g);}a.appendChild(l);}let c=chunkGX4G423W_cjs.w(o,"div","pptxv-ai-proposal-actions"),p=chunkGX4G423W_cjs.w(o,"button","pptxv-ai-proposal-btn is-accept");p.type="button",p.append(chunkGX4G423W_cjs.K(o,"check"),o.createTextNode(n("pptx.ai.accept"))),p.addEventListener("click",()=>i.accept(t.id));let m=chunkGX4G423W_cjs.w(o,"button","pptxv-ai-proposal-btn is-reject");return m.type="button",m.append(chunkGX4G423W_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=chunkGX4G423W_cjs.w(t,"div","pptxv-ai-header"),h=chunkGX4G423W_cjs.w(t,"span","pptxv-ai-title");h.textContent=i("pptx.ai.title");let x=chunkGX4G423W_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(chunkGX4G423W_cjs.K(t,"close")),x.addEventListener("click",()=>o.onClose?.()),a.append(chunkGX4G423W_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=chunkGX4G423W_cjs.w(t,"div","pptxv-ai-messages");l.setAttribute("role","log"),l.setAttribute("aria-live","polite");let s=chunkGX4G423W_cjs.w(t,"div","pptxv-ai-empty");s.textContent=i("pptx.ai.emptyHint"),l.appendChild(s);let g=chunkGX4G423W_cjs.w(t,"div","pptxv-ai-proposals");g.hidden=true;let f=chunkGX4G423W_cjs.w(t,"div","pptxv-ai-error");f.setAttribute("role","alert"),f.hidden=true;let C=chunkGX4G423W_cjs.w(t,"form","pptxv-ai-composer"),d=chunkGX4G423W_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=chunkGX4G423W_cjs.w(t,"button","pptxv-ai-send");y.type="submit",y.setAttribute("aria-label",i("pptx.ai.send")),y.appendChild(chunkGX4G423W_cjs.K(t,"send")),C.append(d,y),n.append(a,...m?[m.el]:[],l,g,f,C);try{c=await(o.createChat??chunkGX4G423W_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:chunkGX4G423W_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=>chunkGX4G423W_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=chunkGX4G423W_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 chunkBAZT6KJZ_cjs=require('./chunk-BAZT6KJZ.cjs');require('./chunk-Q4GMEOAI.cjs'),require('./chunk-B5PFHICE.cjs');function K(o){let{doc:t,t:n,controller:i}=o,a=chunkBAZT6KJZ_cjs.w(t,"div","pptxv-ai-focus"),h=(p,m,l)=>{let s=chunkBAZT6KJZ_cjs.w(t,"button","pptxv-ai-focus-btn");return s.type="button",s.title=m,s.setAttribute("aria-label",m),s.appendChild(chunkBAZT6KJZ_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=chunkBAZT6KJZ_cjs.w(t,"div","pptxv-ai-focus-row"),f=chunkBAZT6KJZ_cjs.w(t,"span","pptxv-ai-focus-label");f.textContent=n("pptx.ai.focusScope"),g.appendChild(f);for(let r of chunkBAZT6KJZ_cjs.j(p,o.getSlides())){let b=chunkBAZT6KJZ_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=chunkBAZT6KJZ_cjs.w(t,"span","pptxv-ai-focus-pinned");r.textContent=n("pptx.ai.pinnedFocus"),g.appendChild(r);}let C=chunkBAZT6KJZ_cjs.w(t,"div","pptxv-ai-focus-actions"),d=chunkBAZT6KJZ_cjs.k(p,o.getSlides());if(d){let r=chunkBAZT6KJZ_cjs.w(t,"button","pptxv-ai-focus-merge");r.type="button",r.append(chunkBAZT6KJZ_cjs.K(t,"git-merge"),t.createTextNode(n("pptx.ai.mergeSelectedTables"))),r.addEventListener("click",()=>o.onSendDirective(chunkBAZT6KJZ_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=chunkBAZT6KJZ_cjs.w(t,"div","pptxv-ai-focus-pick"),b=chunkBAZT6KJZ_cjs.K(t,"crosshair");b.classList.add("pptxv-ai-focus-pick-icon");let k=chunkBAZT6KJZ_cjs.w(t,"span","pptxv-ai-focus-pick-hint");k.textContent=n("pptx.ai.pickElementHint");let T=chunkBAZT6KJZ_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=chunkBAZT6KJZ_cjs.w(t,"button","pptxv-ai-chats");i.type="button",i.append(chunkBAZT6KJZ_cjs.K(t,"history"),t.createTextNode(n("pptx.ai.chats")));let a=chunkBAZT6KJZ_cjs.w(t,"div","pptxv-ai-history");a.hidden=true;let h=chunkBAZT6KJZ_cjs.w(t,"div","pptxv-ai-history-head"),x=chunkBAZT6KJZ_cjs.w(t,"span","pptxv-ai-history-title");x.textContent=n("pptx.ai.historyTitle");let c=chunkBAZT6KJZ_cjs.w(t,"button","pptxv-ai-history-new");c.type="button",c.append(chunkBAZT6KJZ_cjs.K(t,"plus"),t.createTextNode(n("pptx.ai.newChat"))),h.append(x,c);let p=chunkBAZT6KJZ_cjs.w(t,"div","pptxv-ai-history-body"),m=chunkBAZT6KJZ_cjs.w(t,"p","pptxv-ai-history-hint");m.textContent=n("pptx.ai.historyHint"),a.append(h,p,m);let l=chunkBAZT6KJZ_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=chunkBAZT6KJZ_cjs.w(t,"p","pptxv-ai-history-empty");d.textContent=n("pptx.ai.historyEmpty"),p.appendChild(d);return}let C=chunkBAZT6KJZ_cjs.w(t,"ul","pptxv-ai-history-list");for(let d of f){let y=chunkBAZT6KJZ_cjs.w(t,"li","pptxv-ai-history-row"),r=chunkBAZT6KJZ_cjs.w(t,"button","pptxv-ai-history-resume");r.type="button",r.classList.toggle("is-active",d.id===l.activeChatId());let b=chunkBAZT6KJZ_cjs.w(t,"span","pptxv-ai-history-text"),k=chunkBAZT6KJZ_cjs.w(t,"span","pptxv-ai-history-name");k.textContent=d.title||n("pptx.ai.untitledChat");let T=chunkBAZT6KJZ_cjs.w(t,"span","pptxv-ai-history-meta");T.textContent=n("pptx.ai.messageCount",{count:d.messageCount}),b.append(k,T),r.append(chunkBAZT6KJZ_cjs.K(t,"comment"),b),r.addEventListener("click",()=>{l.resumeChat(d.id),a.hidden=true;});let P=chunkBAZT6KJZ_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(chunkBAZT6KJZ_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=chunkBAZT6KJZ_cjs.s(t.toolName,t.input,h?"present":"past"),c=chunkBAZT6KJZ_cjs.w(o,"div","pptxv-ai-tool"),p=chunkBAZT6KJZ_cjs.w(o,"div","pptxv-ai-tool-head"),m=chunkBAZT6KJZ_cjs.K(o,_[x.icon]??"wrench");m.classList.add("pptxv-ai-tool-icon");let l=chunkBAZT6KJZ_cjs.w(o,"span","pptxv-ai-tool-name");l.textContent=x.label;let s=chunkBAZT6KJZ_cjs.w(o,"span","pptxv-ai-tool-state");if(i?(s.classList.add("is-error"),s.append(chunkBAZT6KJZ_cjs.K(o,"alert"),o.createTextNode(n("pptx.ai.toolFailed")))):a?(s.classList.add("is-done"),s.append(chunkBAZT6KJZ_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=chunkBAZT6KJZ_cjs.w(o,"div","pptxv-ai-tool-error");f.textContent=t.errorText,c.appendChild(f);}let g=chunkBAZT6KJZ_cjs.r(t.input);if(g){let f=chunkBAZT6KJZ_cjs.w(o,"details","pptxv-ai-tool-details"),C=chunkBAZT6KJZ_cjs.w(o,"summary");C.textContent=n("pptx.ai.toolDetails");let d=chunkBAZT6KJZ_cjs.w(o,"div","pptxv-ai-tool-raw");d.textContent=`${chunkBAZT6KJZ_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=chunkBAZT6KJZ_cjs.f(a);if(x.length===0&&!h)continue;let c=chunkBAZT6KJZ_cjs.w(o,"div",`pptxv-ai-msg pptxv-ai-msg-${a.role}`),p=chunkBAZT6KJZ_cjs.w(o,"div","pptxv-ai-msg-avatar");p.setAttribute("aria-label",i(h?"pptx.ai.you":"pptx.ai.assistant")),p.appendChild(chunkBAZT6KJZ_cjs.K(o,h?"comment":"sparkles"));let m=chunkBAZT6KJZ_cjs.w(o,"div","pptxv-ai-msg-body");for(let l of x)if(l.kind==="text"){let s=chunkBAZT6KJZ_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=chunkBAZT6KJZ_cjs.w(o,"div","pptxv-ai-proposals-header"),x=chunkBAZT6KJZ_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=chunkBAZT6KJZ_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=chunkBAZT6KJZ_cjs.w(o,"div","pptxv-ai-proposal");a.dataset.proposalId=t.id;let h=chunkBAZT6KJZ_cjs.w(o,"div","pptxv-ai-proposal-eyebrow");h.textContent=n("pptx.ai.proposedChange"),a.appendChild(h);let x=chunkBAZT6KJZ_cjs.w(o,"div","pptxv-ai-proposal-label");if(x.textContent=t.label,a.appendChild(x),t.summary.length>0){let l=chunkBAZT6KJZ_cjs.w(o,"ul","pptxv-ai-proposal-summary");for(let s of t.summary){let g=chunkBAZT6KJZ_cjs.w(o,"li");g.textContent=chunkBAZT6KJZ_cjs.c(s),l.appendChild(g);}a.appendChild(l);}let c=chunkBAZT6KJZ_cjs.w(o,"div","pptxv-ai-proposal-actions"),p=chunkBAZT6KJZ_cjs.w(o,"button","pptxv-ai-proposal-btn is-accept");p.type="button",p.append(chunkBAZT6KJZ_cjs.K(o,"check"),o.createTextNode(n("pptx.ai.accept"))),p.addEventListener("click",()=>i.accept(t.id));let m=chunkBAZT6KJZ_cjs.w(o,"button","pptxv-ai-proposal-btn is-reject");return m.type="button",m.append(chunkBAZT6KJZ_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=chunkBAZT6KJZ_cjs.w(t,"div","pptxv-ai-header"),h=chunkBAZT6KJZ_cjs.w(t,"span","pptxv-ai-title");h.textContent=i("pptx.ai.title");let x=chunkBAZT6KJZ_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(chunkBAZT6KJZ_cjs.K(t,"close")),x.addEventListener("click",()=>o.onClose?.()),a.append(chunkBAZT6KJZ_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=chunkBAZT6KJZ_cjs.w(t,"div","pptxv-ai-messages");l.setAttribute("role","log"),l.setAttribute("aria-live","polite");let s=chunkBAZT6KJZ_cjs.w(t,"div","pptxv-ai-empty");s.textContent=i("pptx.ai.emptyHint"),l.appendChild(s);let g=chunkBAZT6KJZ_cjs.w(t,"div","pptxv-ai-proposals");g.hidden=true;let f=chunkBAZT6KJZ_cjs.w(t,"div","pptxv-ai-error");f.setAttribute("role","alert"),f.hidden=true;let C=chunkBAZT6KJZ_cjs.w(t,"form","pptxv-ai-composer"),d=chunkBAZT6KJZ_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=chunkBAZT6KJZ_cjs.w(t,"button","pptxv-ai-send");y.type="submit",y.setAttribute("aria-label",i("pptx.ai.send")),y.appendChild(chunkBAZT6KJZ_cjs.K(t,"send")),C.append(d,y),n.append(a,...m?[m.el]:[],l,g,f,C);try{c=await(o.createChat??chunkBAZT6KJZ_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:chunkBAZT6KJZ_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=>chunkBAZT6KJZ_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=chunkBAZT6KJZ_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;
|