pptx-vanilla-viewer 2.12.0 → 2.14.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 CHANGED
@@ -7,6 +7,55 @@ 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
+ ## [2.13.0](https://github.com/ChristopherVR/pptx-viewer/releases/tag/pptx-vanilla-viewer@2.13.0) - 2026-09-10
11
+
12
+ ### Features
13
+
14
+ - **core:** SmartArt composite shape dispatch, per-role font fit and hang ratio (by @ChristopherVR) ([b2d985f](https://github.com/ChristopherVR/pptx-viewer/commit/b2d985f0d5c593c4cca231655d02fed828b548ce))
15
+ - **shared:** Route every raster export through the foreignObject tiled pipeline (by @ChristopherVR) ([1ad1993](https://github.com/ChristopherVR/pptx-viewer/commit/1ad19930714668dba87af52e38872d64e7ad4f9d))
16
+ - **shared:** Sample a bar3D picture fill's first pixel on the first paint (by @ChristopherVR) ([8bdb1bc](https://github.com/ChristopherVR/pptx-viewer/commit/8bdb1bc995e92390f6e622f146e9c5abd623d047))
17
+ - **core:** SmartArt repeated-template slots, table hierarchies and cascades (by @ChristopherVR) ([725033d](https://github.com/ChristopherVR/pptx-viewer/commit/725033db29d984d1d9078224a68cb0ccf590fbba))
18
+
19
+ ### Bug Fixes
20
+
21
+ - **core:** Preserve fractional table row heights ([#224](https://github.com/ChristopherVR/pptx-viewer/issues/224)) (by @Sudhansh6) ([aaa621f](https://github.com/ChristopherVR/pptx-viewer/commit/aaa621f9f3838a84a13b2422c1888454e592a18f))
22
+ - **angular,core:** Land the transition-split component and media-duration wiring (by @ChristopherVR) ([3d0c8c7](https://github.com/ChristopherVR/pptx-viewer/commit/3d0c8c7b6a68c94f6f9a1258342dd43b6f524503))
23
+ - **vanilla:** Mount the fragmented transition layer in the overlay (by @ChristopherVR) ([2e9525c](https://github.com/ChristopherVR/pptx-viewer/commit/2e9525c8362a347182cbe31b60d06b26f807518d))
24
+
25
+ ### Testing
26
+
27
+ - **react,svelte,angular,shared:** Update assertions to the camera-matrix and webfont contracts (by @ChristopherVR) ([f2edef8](https://github.com/ChristopherVR/pptx-viewer/commit/f2edef846a5ffb607fb15985512a1142bb47e570))
28
+
29
+ ## [2.12.0](https://github.com/ChristopherVR/pptx-viewer/releases/tag/pptx-vanilla-viewer@2.12.0) - 2026-09-10
30
+
31
+ ### Features
32
+
33
+ - **core:** Fit SmartArt text and structure from the corpus rules (by @ChristopherVR) ([c29d1d1](https://github.com/ChristopherVR/pptx-viewer/commit/c29d1d153ae0b0b420aa0da3312a4399a68ec3bb))
34
+ - **shared:** Load a metric-compatible web font when a deck's font is missing (by @ChristopherVR) ([75a1874](https://github.com/ChristopherVR/pptx-viewer/commit/75a1874a63d89716b109b94b29b23b951cf2bd1a))
35
+ - **shared:** Light 3D bevels with SVG lighting filters and derive explicit camera overrides (by @ChristopherVR) ([a36c635](https://github.com/ChristopherVR/pptx-viewer/commit/a36c635acb78a7eab7e85293e6a01116ad56a642))
36
+ - **core:** Decode a picture fill's first pixel and a media file's duration without the DOM (by @ChristopherVR) ([a9136fa](https://github.com/ChristopherVR/pptx-viewer/commit/a9136fa1468f026cb56d21c78824a7d8646a231c))
37
+ - **core:** Write hyperlinks, click actions and OLE embeds into legacy .ppt (by @ChristopherVR) ([b8a46fa](https://github.com/ChristopherVR/pptx-viewer/commit/b8a46faef3ac906ea8ab87a0fa145c3aeb527ee9))
38
+ - **shared:** Render fragment-based cinematic transitions in every binding (by @ChristopherVR) ([4aee13e](https://github.com/ChristopherVR/pptx-viewer/commit/4aee13eb6a8eb7e83f13e42e74e5242427aaad2c))
39
+ - **core:** Fourth SmartArt interpreter snapshot against the COM corpus (by @ChristopherVR) ([7b29670](https://github.com/ChristopherVR/pptx-viewer/commit/7b29670ef2f9fb141d30b992a72c2af7476065d8))
40
+ - **shared:** Match PowerPoint on soft edges, pixelate and run-program actions (by @ChristopherVR) ([d4339c2](https://github.com/ChristopherVR/pptx-viewer/commit/d4339c28a939350887f536c1d8053fb00ddc55a2))
41
+ - **core:** Embed real WAV audio in legacy .ppt output (by @ChristopherVR) ([dfebe92](https://github.com/ChristopherVR/pptx-viewer/commit/dfebe92645b500228f6bf37a0ef34699e290df45))
42
+
43
+ ### Bug Fixes
44
+
45
+ - **core:** Resize a rotated shape or group child axis by axis, as PowerPoint does (by @ChristopherVR) ([012929e](https://github.com/ChristopherVR/pptx-viewer/commit/012929ed75310ef664da306082314fe9cd0a7ac8))
46
+ - **core:** Re-enable the hierarchy-descendant dispatch guard (by @ChristopherVR) ([8d3d462](https://github.com/ChristopherVR/pptx-viewer/commit/8d3d462f9424092ec9bf9be60cc5d7860a7acb33))
47
+ - **shared:** Export the fragment transition descriptor and keyframes (by @ChristopherVR) ([306c8ff](https://github.com/ChristopherVR/pptx-viewer/commit/306c8ffdab542dd260ba4a0c4558765cf57869ba))
48
+ - **core:** Export readCnvPrId and track the two generated fixtures CI needs (by @ChristopherVR) ([13bff65](https://github.com/ChristopherVR/pptx-viewer/commit/13bff654b33fc1fbec20384dcd52ad5a86c6b65d))
49
+ - **vanilla:** Keep rich text runs inline while editing ([#223](https://github.com/ChristopherVR/pptx-viewer/issues/223)) (by @Sudhansh6) ([45ec48c](https://github.com/ChristopherVR/pptx-viewer/commit/45ec48ce290368856b52da5bdd4df1c72eb273b9))
50
+
51
+ ### Documentation
52
+
53
+ - State the measured SmartArt interpreter status in the limitations row (by @ChristopherVR) ([de5c891](https://github.com/ChristopherVR/pptx-viewer/commit/de5c8911ebd90c0a2c859715d982481515c54c1d))
54
+
55
+ ### Testing
56
+
57
+ - **core:** Declare the two generated fixtures the decoding stream added (by @ChristopherVR) ([acda9bf](https://github.com/ChristopherVR/pptx-viewer/commit/acda9bfac0cf98a9ddd1fc692b4301e10b268b7f))
58
+
10
59
  ## [2.11.0](https://github.com/ChristopherVR/pptx-viewer/releases/tag/pptx-vanilla-viewer@2.11.0) - 2026-09-10
11
60
 
12
61
  ### Features
@@ -0,0 +1 @@
1
+ import {go,uo,_n,Yn,Zn,Rn,do as _do,Vn,Wn,Xn,co,bo,ao,On}from'./chunk-TKGE7AOK.js';import'./chunk-62D2TNHX.js';function K(o){let{doc:t,t:n,controller:i}=o,a=go(t,"div","pptxv-ai-focus"),h=(p,m,l)=>{let s=go(t,"button","pptxv-ai-focus-btn");return s.type="button",s.title=m,s.setAttribute("aria-label",m),s.appendChild(uo(t,p)),s.addEventListener("click",l),s},x=()=>{a.replaceChildren();let p=i.getEffectiveTargets(),m=i.hasPicks(),l=i.isPinned(),s=i.isPicking(),g=go(t,"div","pptxv-ai-focus-row"),f=go(t,"span","pptxv-ai-focus-label");f.textContent=n("pptx.ai.focusScope"),g.appendChild(f);for(let r of Vn(p,o.getSlides())){let b=go(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=go(t,"span","pptxv-ai-focus-pinned");r.textContent=n("pptx.ai.pinnedFocus"),g.appendChild(r);}let C=go(t,"div","pptxv-ai-focus-actions"),d=Wn(p,o.getSlides());if(d){let r=go(t,"button","pptxv-ai-focus-merge");r.type="button",r.append(uo(t,"git-merge"),t.createTextNode(n("pptx.ai.mergeSelectedTables"))),r.addEventListener("click",()=>o.onSendDirective(Xn(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=go(t,"div","pptxv-ai-focus-pick"),b=uo(t,"crosshair");b.classList.add("pptxv-ai-focus-pick-icon");let k=go(t,"span","pptxv-ai-focus-pick-hint");k.textContent=n("pptx.ai.pickElementHint");let T=go(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=go(t,"button","pptxv-ai-chats");i.type="button",i.append(uo(t,"history"),t.createTextNode(n("pptx.ai.chats")));let a=go(t,"div","pptxv-ai-history");a.hidden=true;let h=go(t,"div","pptxv-ai-history-head"),x=go(t,"span","pptxv-ai-history-title");x.textContent=n("pptx.ai.historyTitle");let c=go(t,"button","pptxv-ai-history-new");c.type="button",c.append(uo(t,"plus"),t.createTextNode(n("pptx.ai.newChat"))),h.append(x,c);let p=go(t,"div","pptxv-ai-history-body"),m=go(t,"p","pptxv-ai-history-hint");m.textContent=n("pptx.ai.historyHint"),a.append(h,p,m);let l=Zn({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=go(t,"p","pptxv-ai-history-empty");d.textContent=n("pptx.ai.historyEmpty"),p.appendChild(d);return}let C=go(t,"ul","pptxv-ai-history-list");for(let d of f){let y=go(t,"li","pptxv-ai-history-row"),r=go(t,"button","pptxv-ai-history-resume");r.type="button",r.classList.toggle("is-active",d.id===l.activeChatId());let b=go(t,"span","pptxv-ai-history-text"),k=go(t,"span","pptxv-ai-history-name");k.textContent=d.title||n("pptx.ai.untitledChat");let T=go(t,"span","pptxv-ai-history-meta");T.textContent=n("pptx.ai.messageCount",{count:d.messageCount}),b.append(k,T),r.append(uo(t,"comment"),b),r.addEventListener("click",()=>{l.resumeChat(d.id),a.hidden=true;});let P=go(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(uo(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=co(t.toolName,t.input,h?"present":"past"),c=go(o,"div","pptxv-ai-tool"),p=go(o,"div","pptxv-ai-tool-head"),m=uo(o,_[x.icon]??"wrench");m.classList.add("pptxv-ai-tool-icon");let l=go(o,"span","pptxv-ai-tool-name");l.textContent=x.label;let s=go(o,"span","pptxv-ai-tool-state");if(i?(s.classList.add("is-error"),s.append(uo(o,"alert"),o.createTextNode(n("pptx.ai.toolFailed")))):a?(s.classList.add("is-done"),s.append(uo(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=go(o,"div","pptxv-ai-tool-error");f.textContent=t.errorText,c.appendChild(f);}let g=bo(t.input);if(g){let f=go(o,"details","pptxv-ai-tool-details"),C=go(o,"summary");C.textContent=n("pptx.ai.toolDetails");let d=go(o,"div","pptxv-ai-tool-raw");d.textContent=`${ao(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=Rn(a);if(x.length===0&&!h)continue;let c=go(o,"div",`pptxv-ai-msg pptxv-ai-msg-${a.role}`),p=go(o,"div","pptxv-ai-msg-avatar");p.setAttribute("aria-label",i(h?"pptx.ai.you":"pptx.ai.assistant")),p.appendChild(uo(o,h?"comment":"sparkles"));let m=go(o,"div","pptxv-ai-msg-body");for(let l of x)if(l.kind==="text"){let s=go(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=go(o,"div","pptxv-ai-proposals-header"),x=go(o,"span","pptxv-ai-proposals-title");if(x.textContent=i("pptx.ai.pendingChanges",{count:n.length}),h.appendChild(x),n.length>1){let c=go(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=go(o,"div","pptxv-ai-proposal");a.dataset.proposalId=t.id;let h=go(o,"div","pptxv-ai-proposal-eyebrow");h.textContent=n("pptx.ai.proposedChange"),a.appendChild(h);let x=go(o,"div","pptxv-ai-proposal-label");if(x.textContent=t.label,a.appendChild(x),t.summary.length>0){let l=go(o,"ul","pptxv-ai-proposal-summary");for(let s of t.summary){let g=go(o,"li");g.textContent=On(s),l.appendChild(g);}a.appendChild(l);}let c=go(o,"div","pptxv-ai-proposal-actions"),p=go(o,"button","pptxv-ai-proposal-btn is-accept");p.type="button",p.append(uo(o,"check"),o.createTextNode(n("pptx.ai.accept"))),p.addEventListener("click",()=>i.accept(t.id));let m=go(o,"button","pptxv-ai-proposal-btn is-reject");return m.type="button",m.append(uo(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=go(t,"div","pptxv-ai-header"),h=go(t,"span","pptxv-ai-title");h.textContent=i("pptx.ai.title");let x=go(t,"button","pptxv-ai-close");x.type="button",x.title=i("pptx.ai.close"),x.setAttribute("aria-label",i("pptx.ai.close")),x.appendChild(uo(t,"close")),x.addEventListener("click",()=>o.onClose?.()),a.append(uo(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=go(t,"div","pptxv-ai-messages");l.setAttribute("role","log"),l.setAttribute("aria-live","polite");let s=go(t,"div","pptxv-ai-empty");s.textContent=i("pptx.ai.emptyHint"),l.appendChild(s);let g=go(t,"div","pptxv-ai-proposals");g.hidden=true;let f=go(t,"div","pptxv-ai-error");f.setAttribute("role","alert"),f.hidden=true;let C=go(t,"form","pptxv-ai-composer"),d=go(t,"textarea","pptxv-ai-input");d.rows=2,d.placeholder=i("pptx.ai.placeholder"),d.setAttribute("aria-label",i("pptx.ai.placeholder"));let y=go(t,"button","pptxv-ai-send");y.type="submit",y.setAttribute("aria-label",i("pptx.ai.send")),y.appendChild(uo(t,"send")),C.append(d,y),n.append(a,...m?[m.el]:[],l,g,f,C);try{c=await(o.createChat??_n)({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:Yn(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=>Rn(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=_do(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();}}}export{wt as createAiPanel};
@@ -0,0 +1 @@
1
+ 'use strict';var chunkXNBL4IIF_cjs=require('./chunk-XNBL4IIF.cjs');require('./chunk-B5PFHICE.cjs');function K(o){let{doc:t,t:n,controller:i}=o,a=chunkXNBL4IIF_cjs.go(t,"div","pptxv-ai-focus"),h=(p,m,l)=>{let s=chunkXNBL4IIF_cjs.go(t,"button","pptxv-ai-focus-btn");return s.type="button",s.title=m,s.setAttribute("aria-label",m),s.appendChild(chunkXNBL4IIF_cjs.uo(t,p)),s.addEventListener("click",l),s},x=()=>{a.replaceChildren();let p=i.getEffectiveTargets(),m=i.hasPicks(),l=i.isPinned(),s=i.isPicking(),g=chunkXNBL4IIF_cjs.go(t,"div","pptxv-ai-focus-row"),f=chunkXNBL4IIF_cjs.go(t,"span","pptxv-ai-focus-label");f.textContent=n("pptx.ai.focusScope"),g.appendChild(f);for(let r of chunkXNBL4IIF_cjs.Vn(p,o.getSlides())){let b=chunkXNBL4IIF_cjs.go(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=chunkXNBL4IIF_cjs.go(t,"span","pptxv-ai-focus-pinned");r.textContent=n("pptx.ai.pinnedFocus"),g.appendChild(r);}let C=chunkXNBL4IIF_cjs.go(t,"div","pptxv-ai-focus-actions"),d=chunkXNBL4IIF_cjs.Wn(p,o.getSlides());if(d){let r=chunkXNBL4IIF_cjs.go(t,"button","pptxv-ai-focus-merge");r.type="button",r.append(chunkXNBL4IIF_cjs.uo(t,"git-merge"),t.createTextNode(n("pptx.ai.mergeSelectedTables"))),r.addEventListener("click",()=>o.onSendDirective(chunkXNBL4IIF_cjs.Xn(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=chunkXNBL4IIF_cjs.go(t,"div","pptxv-ai-focus-pick"),b=chunkXNBL4IIF_cjs.uo(t,"crosshair");b.classList.add("pptxv-ai-focus-pick-icon");let k=chunkXNBL4IIF_cjs.go(t,"span","pptxv-ai-focus-pick-hint");k.textContent=n("pptx.ai.pickElementHint");let T=chunkXNBL4IIF_cjs.go(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=chunkXNBL4IIF_cjs.go(t,"button","pptxv-ai-chats");i.type="button",i.append(chunkXNBL4IIF_cjs.uo(t,"history"),t.createTextNode(n("pptx.ai.chats")));let a=chunkXNBL4IIF_cjs.go(t,"div","pptxv-ai-history");a.hidden=true;let h=chunkXNBL4IIF_cjs.go(t,"div","pptxv-ai-history-head"),x=chunkXNBL4IIF_cjs.go(t,"span","pptxv-ai-history-title");x.textContent=n("pptx.ai.historyTitle");let c=chunkXNBL4IIF_cjs.go(t,"button","pptxv-ai-history-new");c.type="button",c.append(chunkXNBL4IIF_cjs.uo(t,"plus"),t.createTextNode(n("pptx.ai.newChat"))),h.append(x,c);let p=chunkXNBL4IIF_cjs.go(t,"div","pptxv-ai-history-body"),m=chunkXNBL4IIF_cjs.go(t,"p","pptxv-ai-history-hint");m.textContent=n("pptx.ai.historyHint"),a.append(h,p,m);let l=chunkXNBL4IIF_cjs.Zn({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=chunkXNBL4IIF_cjs.go(t,"p","pptxv-ai-history-empty");d.textContent=n("pptx.ai.historyEmpty"),p.appendChild(d);return}let C=chunkXNBL4IIF_cjs.go(t,"ul","pptxv-ai-history-list");for(let d of f){let y=chunkXNBL4IIF_cjs.go(t,"li","pptxv-ai-history-row"),r=chunkXNBL4IIF_cjs.go(t,"button","pptxv-ai-history-resume");r.type="button",r.classList.toggle("is-active",d.id===l.activeChatId());let b=chunkXNBL4IIF_cjs.go(t,"span","pptxv-ai-history-text"),k=chunkXNBL4IIF_cjs.go(t,"span","pptxv-ai-history-name");k.textContent=d.title||n("pptx.ai.untitledChat");let T=chunkXNBL4IIF_cjs.go(t,"span","pptxv-ai-history-meta");T.textContent=n("pptx.ai.messageCount",{count:d.messageCount}),b.append(k,T),r.append(chunkXNBL4IIF_cjs.uo(t,"comment"),b),r.addEventListener("click",()=>{l.resumeChat(d.id),a.hidden=true;});let P=chunkXNBL4IIF_cjs.go(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(chunkXNBL4IIF_cjs.uo(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=chunkXNBL4IIF_cjs.co(t.toolName,t.input,h?"present":"past"),c=chunkXNBL4IIF_cjs.go(o,"div","pptxv-ai-tool"),p=chunkXNBL4IIF_cjs.go(o,"div","pptxv-ai-tool-head"),m=chunkXNBL4IIF_cjs.uo(o,_[x.icon]??"wrench");m.classList.add("pptxv-ai-tool-icon");let l=chunkXNBL4IIF_cjs.go(o,"span","pptxv-ai-tool-name");l.textContent=x.label;let s=chunkXNBL4IIF_cjs.go(o,"span","pptxv-ai-tool-state");if(i?(s.classList.add("is-error"),s.append(chunkXNBL4IIF_cjs.uo(o,"alert"),o.createTextNode(n("pptx.ai.toolFailed")))):a?(s.classList.add("is-done"),s.append(chunkXNBL4IIF_cjs.uo(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=chunkXNBL4IIF_cjs.go(o,"div","pptxv-ai-tool-error");f.textContent=t.errorText,c.appendChild(f);}let g=chunkXNBL4IIF_cjs.bo(t.input);if(g){let f=chunkXNBL4IIF_cjs.go(o,"details","pptxv-ai-tool-details"),C=chunkXNBL4IIF_cjs.go(o,"summary");C.textContent=n("pptx.ai.toolDetails");let d=chunkXNBL4IIF_cjs.go(o,"div","pptxv-ai-tool-raw");d.textContent=`${chunkXNBL4IIF_cjs.ao(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=chunkXNBL4IIF_cjs.Rn(a);if(x.length===0&&!h)continue;let c=chunkXNBL4IIF_cjs.go(o,"div",`pptxv-ai-msg pptxv-ai-msg-${a.role}`),p=chunkXNBL4IIF_cjs.go(o,"div","pptxv-ai-msg-avatar");p.setAttribute("aria-label",i(h?"pptx.ai.you":"pptx.ai.assistant")),p.appendChild(chunkXNBL4IIF_cjs.uo(o,h?"comment":"sparkles"));let m=chunkXNBL4IIF_cjs.go(o,"div","pptxv-ai-msg-body");for(let l of x)if(l.kind==="text"){let s=chunkXNBL4IIF_cjs.go(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=chunkXNBL4IIF_cjs.go(o,"div","pptxv-ai-proposals-header"),x=chunkXNBL4IIF_cjs.go(o,"span","pptxv-ai-proposals-title");if(x.textContent=i("pptx.ai.pendingChanges",{count:n.length}),h.appendChild(x),n.length>1){let c=chunkXNBL4IIF_cjs.go(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=chunkXNBL4IIF_cjs.go(o,"div","pptxv-ai-proposal");a.dataset.proposalId=t.id;let h=chunkXNBL4IIF_cjs.go(o,"div","pptxv-ai-proposal-eyebrow");h.textContent=n("pptx.ai.proposedChange"),a.appendChild(h);let x=chunkXNBL4IIF_cjs.go(o,"div","pptxv-ai-proposal-label");if(x.textContent=t.label,a.appendChild(x),t.summary.length>0){let l=chunkXNBL4IIF_cjs.go(o,"ul","pptxv-ai-proposal-summary");for(let s of t.summary){let g=chunkXNBL4IIF_cjs.go(o,"li");g.textContent=chunkXNBL4IIF_cjs.On(s),l.appendChild(g);}a.appendChild(l);}let c=chunkXNBL4IIF_cjs.go(o,"div","pptxv-ai-proposal-actions"),p=chunkXNBL4IIF_cjs.go(o,"button","pptxv-ai-proposal-btn is-accept");p.type="button",p.append(chunkXNBL4IIF_cjs.uo(o,"check"),o.createTextNode(n("pptx.ai.accept"))),p.addEventListener("click",()=>i.accept(t.id));let m=chunkXNBL4IIF_cjs.go(o,"button","pptxv-ai-proposal-btn is-reject");return m.type="button",m.append(chunkXNBL4IIF_cjs.uo(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=chunkXNBL4IIF_cjs.go(t,"div","pptxv-ai-header"),h=chunkXNBL4IIF_cjs.go(t,"span","pptxv-ai-title");h.textContent=i("pptx.ai.title");let x=chunkXNBL4IIF_cjs.go(t,"button","pptxv-ai-close");x.type="button",x.title=i("pptx.ai.close"),x.setAttribute("aria-label",i("pptx.ai.close")),x.appendChild(chunkXNBL4IIF_cjs.uo(t,"close")),x.addEventListener("click",()=>o.onClose?.()),a.append(chunkXNBL4IIF_cjs.uo(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=chunkXNBL4IIF_cjs.go(t,"div","pptxv-ai-messages");l.setAttribute("role","log"),l.setAttribute("aria-live","polite");let s=chunkXNBL4IIF_cjs.go(t,"div","pptxv-ai-empty");s.textContent=i("pptx.ai.emptyHint"),l.appendChild(s);let g=chunkXNBL4IIF_cjs.go(t,"div","pptxv-ai-proposals");g.hidden=true;let f=chunkXNBL4IIF_cjs.go(t,"div","pptxv-ai-error");f.setAttribute("role","alert"),f.hidden=true;let C=chunkXNBL4IIF_cjs.go(t,"form","pptxv-ai-composer"),d=chunkXNBL4IIF_cjs.go(t,"textarea","pptxv-ai-input");d.rows=2,d.placeholder=i("pptx.ai.placeholder"),d.setAttribute("aria-label",i("pptx.ai.placeholder"));let y=chunkXNBL4IIF_cjs.go(t,"button","pptxv-ai-send");y.type="submit",y.setAttribute("aria-label",i("pptx.ai.send")),y.appendChild(chunkXNBL4IIF_cjs.uo(t,"send")),C.append(d,y),n.append(a,...m?[m.el]:[],l,g,f,C);try{c=await(o.createChat??chunkXNBL4IIF_cjs._n)({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:chunkXNBL4IIF_cjs.Yn(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=>chunkXNBL4IIF_cjs.Rn(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=chunkXNBL4IIF_cjs.do(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;