pptx-vanilla-viewer 2.0.3 → 2.1.1

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,67 @@ 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.1.0](https://github.com/ChristopherVR/pptx-viewer/releases/tag/pptx-vanilla-viewer@2.1.0) - 2026-08-28
11
+
12
+ ### Features
13
+
14
+ - **core:** Decrypt RC4-encrypted legacy .ppt files (by @ChristopherVR) ([b95adc7](https://github.com/ChristopherVR/pptx-viewer/commit/b95adc74f036eefd4d44af441fa600512ff44282))
15
+ - **ole:** Make embedded OLE objects' Object Name editable (by @ChristopherVR) ([e06b32c](https://github.com/ChristopherVR/pptx-viewer/commit/e06b32c1b4e9375c37916097b494ab05bf4b7850))
16
+ - **shared:** Add Pareto as an insertable chart type (by @ChristopherVR) ([8fea110](https://github.com/ChristopherVR/pptx-viewer/commit/8fea110ef6aa4036fee97f232f4f7d8ecd5f7b94))
17
+ - **core:** Support writing ECMA-376 Standard scheme encryption (by @ChristopherVR) ([210d2a2](https://github.com/ChristopherVR/pptx-viewer/commit/210d2a22603467092f667f031bc7881f7e7833bf))
18
+ - **shared:** Apply the shadeToTitle background gradient effect (by @ChristopherVR) ([f287389](https://github.com/ChristopherVR/pptx-viewer/commit/f2873891828125b315f2cae2155824c84609626f))
19
+ - **core:** Allow animation drag-to-reorder across deck-native effects (by @ChristopherVR) ([6f48a34](https://github.com/ChristopherVR/pptx-viewer/commit/6f48a3455338c78f34c4d0978bcc4cf0be075db2))
20
+ - Author animation effect sound and after-animation controls (by @ChristopherVR) ([78daeb4](https://github.com/ChristopherVR/pptx-viewer/commit/78daeb4276733fe5ed048872d262a8cf080bfc3b))
21
+ - **shared:** Honour p:seq @concurrent/@nextAc/@prevAc and p:cTn @restart (by @ChristopherVR) ([3e3427d](https://github.com/ChristopherVR/pptx-viewer/commit/3e3427d9d747ae97485a5186b59e3d5aa80c1579))
22
+ - **shared:** Honour animRot/animScale absolute values, tavLst, txEl ranges, p:excl and bldLvl in playback (by @ChristopherVR) ([f71396b](https://github.com/ChristopherVR/pptx-viewer/commit/f71396bbc1309909aa3eecfd4855268f4e6fbfac))
23
+ - **shared:** Resolve 9 more SMIL animEffect filter families to real reveals (by @ChristopherVR) ([e47aa40](https://github.com/ChristopherVR/pptx-viewer/commit/e47aa409b5bcd10c24eadad3fb9aa8ab8f055fbd))
24
+ - Author and embed transition sounds from the ribbon Sound picker (by @ChristopherVR) ([ada8cdb](https://github.com/ChristopherVR/pptx-viewer/commit/ada8cdb65a0689660b9afc852d0a85e2a1b04534))
25
+ - Expose transition speed and morph-option controls in all five bindings (by @ChristopherVR) ([122894d](https://github.com/ChristopherVR/pptx-viewer/commit/122894db9366c91a87371311bf4f69ccbf53ffb4))
26
+ - **ink:** Retain pen-tilt InkML channels and render a calligraphic nib (by @ChristopherVR) ([6adab79](https://github.com/ChristopherVR/pptx-viewer/commit/6adab79f7cf8ae19346c3e74d34413cccd2eb08f))
27
+ - **shared:** Raycast hover tooltip for surface chart marks (by @ChristopherVR) ([c943646](https://github.com/ChristopherVR/pptx-viewer/commit/c9436468d2a1997168f12d079e0da758ab488758))
28
+ - **shared:** Resolve stretch, newsflash and random animEffect filters (by @ChristopherVR) ([58c898e](https://github.com/ChristopherVR/pptx-viewer/commit/58c898e55c2fb520cde7845baf8ae4b2e7a1c224))
29
+ - **core,shared:** Surface p:tavLst attrName, honour colour ramps (by @ChristopherVR) ([2ccf45f](https://github.com/ChristopherVR/pptx-viewer/commit/2ccf45fbcb23da9e0084769c0895b35cfc027326))
30
+ - **shared:** Widen native-animation preset playback coverage to 54/200 (by @ChristopherVR) ([41e2b52](https://github.com/ChristopherVR/pptx-viewer/commit/41e2b526dc654e4f7c24f3dd9026eb3124c47dd5))
31
+ - **shared:** True 3D bar3D chart scene via three.js, opt-in all bindings (by @ChristopherVR) ([ac920da](https://github.com/ChristopherVR/pptx-viewer/commit/ac920da1d2cc302f36ba7b2b19dc4011ac5aae07))
32
+ - **shared:** True 3D line3D/area3D chart scenes via three.js, opt-in all bindings (by @ChristopherVR) ([1447517](https://github.com/ChristopherVR/pptx-viewer/commit/1447517ee8c95ca958146f668a5cd0f64616b473))
33
+ - **charts:** Give pie3D charts true 3D rendering across all bindings (by @ChristopherVR) ([a1b32e7](https://github.com/ChristopherVR/pptx-viewer/commit/a1b32e7b9c44230f35d9c73cf786f8594b4b4157))
34
+
35
+ ### Bug Fixes
36
+
37
+ - Author Draw-tab ink as a PowerPoint-compatible content part (by @ChristopherVR) ([d91ce08](https://github.com/ChristopherVR/pptx-viewer/commit/d91ce08757c3697eab6891808e527c5e1eaea555))
38
+ - **animation:** Correct swapped exit/emphasis presets, cover 4 more IDs (by @ChristopherVR) ([11c2d2e](https://github.com/ChristopherVR/pptx-viewer/commit/11c2d2e8e68b0539c9920d8c6de4de93ca2cc5e1))
39
+ - **shared:** Capture Draw tool pressure in all five bindings (by @ChristopherVR) ([b8a124a](https://github.com/ChristopherVR/pptx-viewer/commit/b8a124ae7cd48733b00baac11dda325eeefeea43))
40
+ - **shared:** Sample ink pressure curves along the actual Bezier path (by @ChristopherVR) ([629ab5d](https://github.com/ChristopherVR/pptx-viewer/commit/629ab5dc8af3fee409376176a2b92e0e0ed26c12))
41
+ - **core:** Honour text-run reflection scale/skew/rotation/fade/anchor (by @ChristopherVR) ([41dfa76](https://github.com/ChristopherVR/pptx-viewer/commit/41dfa76c9540136b5c09fee52e21d8d0bc3e079c))
42
+ - **shared:** Render rect path gradients as nested rectangles, not an ellipse (by @ChristopherVR) ([f6f479e](https://github.com/ChristopherVR/pptx-viewer/commit/f6f479ece08a4c632db8bb4840377641079dcf3b))
43
+ - **shared:** Add elliptical tilt foreshortening to pie3D charts (by @ChristopherVR) ([63f57ba](https://github.com/ChristopherVR/pptx-viewer/commit/63f57ba146b6918e068ace19449ce3964140968a))
44
+ - **shared:** Claim morph proximity pairs closest-first, not by document order (by @ChristopherVR) ([b68a04d](https://github.com/ChristopherVR/pptx-viewer/commit/b68a04d120f15db4d2fd4c2f2c33ac31761f208b))
45
+ - **deps:** Converge ai-sdk adapters on a single ai package version, fix two flaky tests (by @ChristopherVR) ([4365a02](https://github.com/ChristopherVR/pptx-viewer/commit/4365a0222d80abc4ba2d651a464dfb353f882656))
46
+ - **core:** Author Draw-tab ink InkML that real PowerPoint actually opens (by @ChristopherVR) ([38633c7](https://github.com/ChristopherVR/pptx-viewer/commit/38633c7f25af358c24ea91c42019ad76b786ca54))
47
+ - **animation:** Correct tests left stale by combining independent preset fix waves (by @ChristopherVR) ([02371bb](https://github.com/ChristopherVR/pptx-viewer/commit/02371bbdb1b6124b47be1932a7af80c5ddfbee20))
48
+ - **charts:** Repair merge conflicts left broken by a diff3 edge case, wire remaining demos (by @ChristopherVR) ([42d550d](https://github.com/ChristopherVR/pptx-viewer/commit/42d550d6016ab0fc8ae2b5c643958cdf43f1020b))
49
+
50
+ ### Testing
51
+
52
+ - **core:** Cover lte/equ ops and multi-hop bounds for SmartArt constraints (by @ChristopherVR) ([3d8c5a0](https://github.com/ChristopherVR/pptx-viewer/commit/3d8c5a08c85f7652dd2ba08cf9e345f98a767f8c))
53
+
54
+ ### Chores
55
+
56
+ - Reformat limitations.md table and a core test after merge (by @ChristopherVR) ([d9db1f7](https://github.com/ChristopherVR/pptx-viewer/commit/d9db1f7c32e0ee7383837ac6db668e10a6060752))
57
+ - Fix oxfmt comment placement in ppt-import.test.ts (by @ChristopherVR) ([7cb2d3d](https://github.com/ChristopherVR/pptx-viewer/commit/7cb2d3dabe470f4a0ad2a2023d90a1f9642d2c28))
58
+
59
+ ## [2.0.3](https://github.com/ChristopherVR/pptx-viewer/releases/tag/pptx-vanilla-viewer@2.0.3) - 2026-08-26
60
+
61
+ ### Bug Fixes
62
+
63
+ - Stop duplicate inline-edit text render and fix ribbon popup clipping (by @ChristopherVR) ([f084c64](https://github.com/ChristopherVR/pptx-viewer/commit/f084c64c6bb69135b60f083200180933a7f770f7))
64
+ - Derive mobile chrome from the browser viewport, not the container (by @ChristopherVR) ([29e5ea1](https://github.com/ChristopherVR/pptx-viewer/commit/29e5ea17b87411fa2058e2d0a25a2323ce6a1133))
65
+
66
+ ### Dependencies
67
+
68
+ - **deps:** Update fast-xml-parser requirement from ^5.10.1 to ^5.11.0 ([#177](https://github.com/ChristopherVR/pptx-viewer/issues/177)) (by @dependabot[bot]) ([a876e0f](https://github.com/ChristopherVR/pptx-viewer/commit/a876e0f5fd07fd2e7063619882313cc23c4a0162))
69
+ - **deps:** Update dompurify requirement from ^3.4.13 to ^3.4.14 ([#173](https://github.com/ChristopherVR/pptx-viewer/issues/173)) (by @dependabot[bot]) ([19afbe1](https://github.com/ChristopherVR/pptx-viewer/commit/19afbe117520bbdeb2c8e930332ae5133df21c30))
70
+
10
71
  ## [2.0.2](https://github.com/ChristopherVR/pptx-viewer/releases/tag/pptx-vanilla-viewer@2.0.2) - 2026-08-22
11
72
 
12
73
  ### Bug Fixes
@@ -1 +1 @@
1
- import {Pk,_k,fl,dl,el,gl,kl,Kk,Lk,Mk,jl,il,hl,al}from'./chunk-CWN3SBBP.js';import'./chunk-WOT6VMZA.js';function K(o){let{doc:t,t:n,controller:i}=o,a=Pk(t,"div","pptxv-ai-focus"),h=(p,m,l)=>{let s=Pk(t,"button","pptxv-ai-focus-btn");return s.type="button",s.title=m,s.setAttribute("aria-label",m),s.appendChild(_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=Pk(t,"div","pptxv-ai-focus-row"),f=Pk(t,"span","pptxv-ai-focus-label");f.textContent=n("pptx.ai.focusScope"),g.appendChild(f);for(let r of Kk(p,o.getSlides())){let b=Pk(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=Pk(t,"span","pptxv-ai-focus-pinned");r.textContent=n("pptx.ai.pinnedFocus"),g.appendChild(r);}let C=Pk(t,"div","pptxv-ai-focus-actions"),d=Lk(p,o.getSlides());if(d){let r=Pk(t,"button","pptxv-ai-focus-merge");r.type="button",r.append(_k(t,"git-merge"),t.createTextNode(n("pptx.ai.mergeSelectedTables"))),r.addEventListener("click",()=>o.onSendDirective(Mk(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=Pk(t,"div","pptxv-ai-focus-pick"),b=_k(t,"crosshair");b.classList.add("pptxv-ai-focus-pick-icon");let k=Pk(t,"span","pptxv-ai-focus-pick-hint");k.textContent=n("pptx.ai.pickElementHint");let T=Pk(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=Pk(t,"button","pptxv-ai-chats");i.type="button",i.append(_k(t,"history"),t.createTextNode(n("pptx.ai.chats")));let a=Pk(t,"div","pptxv-ai-history");a.hidden=true;let h=Pk(t,"div","pptxv-ai-history-head"),x=Pk(t,"span","pptxv-ai-history-title");x.textContent=n("pptx.ai.historyTitle");let c=Pk(t,"button","pptxv-ai-history-new");c.type="button",c.append(_k(t,"plus"),t.createTextNode(n("pptx.ai.newChat"))),h.append(x,c);let p=Pk(t,"div","pptxv-ai-history-body"),m=Pk(t,"p","pptxv-ai-history-hint");m.textContent=n("pptx.ai.historyHint"),a.append(h,p,m);let l=el({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=Pk(t,"p","pptxv-ai-history-empty");d.textContent=n("pptx.ai.historyEmpty"),p.appendChild(d);return}let C=Pk(t,"ul","pptxv-ai-history-list");for(let d of f){let y=Pk(t,"li","pptxv-ai-history-row"),r=Pk(t,"button","pptxv-ai-history-resume");r.type="button",r.classList.toggle("is-active",d.id===l.activeChatId());let b=Pk(t,"span","pptxv-ai-history-text"),k=Pk(t,"span","pptxv-ai-history-name");k.textContent=d.title||n("pptx.ai.untitledChat");let T=Pk(t,"span","pptxv-ai-history-meta");T.textContent=n("pptx.ai.messageCount",{count:d.messageCount}),b.append(k,T),r.append(_k(t,"comment"),b),r.addEventListener("click",()=>{l.resumeChat(d.id),a.hidden=true;});let P=Pk(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(_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=jl(t.toolName,t.input,h?"present":"past"),c=Pk(o,"div","pptxv-ai-tool"),p=Pk(o,"div","pptxv-ai-tool-head"),m=_k(o,_[x.icon]??"wrench");m.classList.add("pptxv-ai-tool-icon");let l=Pk(o,"span","pptxv-ai-tool-name");l.textContent=x.label;let s=Pk(o,"span","pptxv-ai-tool-state");if(i?(s.classList.add("is-error"),s.append(_k(o,"alert"),o.createTextNode(n("pptx.ai.toolFailed")))):a?(s.classList.add("is-done"),s.append(_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=Pk(o,"div","pptxv-ai-tool-error");f.textContent=t.errorText,c.appendChild(f);}let g=il(t.input);if(g){let f=Pk(o,"details","pptxv-ai-tool-details"),C=Pk(o,"summary");C.textContent=n("pptx.ai.toolDetails");let d=Pk(o,"div","pptxv-ai-tool-raw");d.textContent=`${hl(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=gl(a);if(x.length===0&&!h)continue;let c=Pk(o,"div",`pptxv-ai-msg pptxv-ai-msg-${a.role}`),p=Pk(o,"div","pptxv-ai-msg-avatar");p.setAttribute("aria-label",i(h?"pptx.ai.you":"pptx.ai.assistant")),p.appendChild(_k(o,h?"comment":"sparkles"));let m=Pk(o,"div","pptxv-ai-msg-body");for(let l of x)if(l.kind==="text"){let s=Pk(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=Pk(o,"div","pptxv-ai-proposals-header"),x=Pk(o,"span","pptxv-ai-proposals-title");if(x.textContent=i("pptx.ai.pendingChanges",{count:n.length}),h.appendChild(x),n.length>1){let c=Pk(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=Pk(o,"div","pptxv-ai-proposal");a.dataset.proposalId=t.id;let h=Pk(o,"div","pptxv-ai-proposal-eyebrow");h.textContent=n("pptx.ai.proposedChange"),a.appendChild(h);let x=Pk(o,"div","pptxv-ai-proposal-label");if(x.textContent=t.label,a.appendChild(x),t.summary.length>0){let l=Pk(o,"ul","pptxv-ai-proposal-summary");for(let s of t.summary){let g=Pk(o,"li");g.textContent=al(s),l.appendChild(g);}a.appendChild(l);}let c=Pk(o,"div","pptxv-ai-proposal-actions"),p=Pk(o,"button","pptxv-ai-proposal-btn is-accept");p.type="button",p.append(_k(o,"check"),o.createTextNode(n("pptx.ai.accept"))),p.addEventListener("click",()=>i.accept(t.id));let m=Pk(o,"button","pptxv-ai-proposal-btn is-reject");return m.type="button",m.append(_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=Pk(t,"div","pptxv-ai-header"),h=Pk(t,"span","pptxv-ai-title");h.textContent=i("pptx.ai.title");let x=Pk(t,"button","pptxv-ai-close");x.type="button",x.title=i("pptx.ai.close"),x.setAttribute("aria-label",i("pptx.ai.close")),x.appendChild(_k(t,"close")),x.addEventListener("click",()=>o.onClose?.()),a.append(_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=Pk(t,"div","pptxv-ai-messages");l.setAttribute("role","log"),l.setAttribute("aria-live","polite");let s=Pk(t,"div","pptxv-ai-empty");s.textContent=i("pptx.ai.emptyHint"),l.appendChild(s);let g=Pk(t,"div","pptxv-ai-proposals");g.hidden=true;let f=Pk(t,"div","pptxv-ai-error");f.setAttribute("role","alert"),f.hidden=true;let C=Pk(t,"form","pptxv-ai-composer"),d=Pk(t,"textarea","pptxv-ai-input");d.rows=2,d.placeholder=i("pptx.ai.placeholder"),d.setAttribute("aria-label",i("pptx.ai.placeholder"));let y=Pk(t,"button","pptxv-ai-send");y.type="submit",y.setAttribute("aria-label",i("pptx.ai.send")),y.appendChild(_k(t,"send")),C.append(d,y),n.append(a,...m?[m.el]:[],l,g,f,C);try{c=await(o.createChat??fl)({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:dl(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=>gl(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=kl(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};
1
+ import {fl,ql,xl,vl,wl,yl,Cl,al,bl,cl,Bl,Al,zl,sl}from'./chunk-7XCQLR2S.js';import'./chunk-WOT6VMZA.js';function K(o){let{doc:t,t:n,controller:i}=o,a=fl(t,"div","pptxv-ai-focus"),h=(p,m,l)=>{let s=fl(t,"button","pptxv-ai-focus-btn");return s.type="button",s.title=m,s.setAttribute("aria-label",m),s.appendChild(ql(t,p)),s.addEventListener("click",l),s},x=()=>{a.replaceChildren();let p=i.getEffectiveTargets(),m=i.hasPicks(),l=i.isPinned(),s=i.isPicking(),g=fl(t,"div","pptxv-ai-focus-row"),f=fl(t,"span","pptxv-ai-focus-label");f.textContent=n("pptx.ai.focusScope"),g.appendChild(f);for(let r of al(p,o.getSlides())){let b=fl(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=fl(t,"span","pptxv-ai-focus-pinned");r.textContent=n("pptx.ai.pinnedFocus"),g.appendChild(r);}let C=fl(t,"div","pptxv-ai-focus-actions"),d=bl(p,o.getSlides());if(d){let r=fl(t,"button","pptxv-ai-focus-merge");r.type="button",r.append(ql(t,"git-merge"),t.createTextNode(n("pptx.ai.mergeSelectedTables"))),r.addEventListener("click",()=>o.onSendDirective(cl(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=fl(t,"div","pptxv-ai-focus-pick"),b=ql(t,"crosshair");b.classList.add("pptxv-ai-focus-pick-icon");let k=fl(t,"span","pptxv-ai-focus-pick-hint");k.textContent=n("pptx.ai.pickElementHint");let T=fl(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=fl(t,"button","pptxv-ai-chats");i.type="button",i.append(ql(t,"history"),t.createTextNode(n("pptx.ai.chats")));let a=fl(t,"div","pptxv-ai-history");a.hidden=true;let h=fl(t,"div","pptxv-ai-history-head"),x=fl(t,"span","pptxv-ai-history-title");x.textContent=n("pptx.ai.historyTitle");let c=fl(t,"button","pptxv-ai-history-new");c.type="button",c.append(ql(t,"plus"),t.createTextNode(n("pptx.ai.newChat"))),h.append(x,c);let p=fl(t,"div","pptxv-ai-history-body"),m=fl(t,"p","pptxv-ai-history-hint");m.textContent=n("pptx.ai.historyHint"),a.append(h,p,m);let l=wl({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=fl(t,"p","pptxv-ai-history-empty");d.textContent=n("pptx.ai.historyEmpty"),p.appendChild(d);return}let C=fl(t,"ul","pptxv-ai-history-list");for(let d of f){let y=fl(t,"li","pptxv-ai-history-row"),r=fl(t,"button","pptxv-ai-history-resume");r.type="button",r.classList.toggle("is-active",d.id===l.activeChatId());let b=fl(t,"span","pptxv-ai-history-text"),k=fl(t,"span","pptxv-ai-history-name");k.textContent=d.title||n("pptx.ai.untitledChat");let T=fl(t,"span","pptxv-ai-history-meta");T.textContent=n("pptx.ai.messageCount",{count:d.messageCount}),b.append(k,T),r.append(ql(t,"comment"),b),r.addEventListener("click",()=>{l.resumeChat(d.id),a.hidden=true;});let P=fl(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(ql(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=Bl(t.toolName,t.input,h?"present":"past"),c=fl(o,"div","pptxv-ai-tool"),p=fl(o,"div","pptxv-ai-tool-head"),m=ql(o,_[x.icon]??"wrench");m.classList.add("pptxv-ai-tool-icon");let l=fl(o,"span","pptxv-ai-tool-name");l.textContent=x.label;let s=fl(o,"span","pptxv-ai-tool-state");if(i?(s.classList.add("is-error"),s.append(ql(o,"alert"),o.createTextNode(n("pptx.ai.toolFailed")))):a?(s.classList.add("is-done"),s.append(ql(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=fl(o,"div","pptxv-ai-tool-error");f.textContent=t.errorText,c.appendChild(f);}let g=Al(t.input);if(g){let f=fl(o,"details","pptxv-ai-tool-details"),C=fl(o,"summary");C.textContent=n("pptx.ai.toolDetails");let d=fl(o,"div","pptxv-ai-tool-raw");d.textContent=`${zl(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=yl(a);if(x.length===0&&!h)continue;let c=fl(o,"div",`pptxv-ai-msg pptxv-ai-msg-${a.role}`),p=fl(o,"div","pptxv-ai-msg-avatar");p.setAttribute("aria-label",i(h?"pptx.ai.you":"pptx.ai.assistant")),p.appendChild(ql(o,h?"comment":"sparkles"));let m=fl(o,"div","pptxv-ai-msg-body");for(let l of x)if(l.kind==="text"){let s=fl(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=fl(o,"div","pptxv-ai-proposals-header"),x=fl(o,"span","pptxv-ai-proposals-title");if(x.textContent=i("pptx.ai.pendingChanges",{count:n.length}),h.appendChild(x),n.length>1){let c=fl(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=fl(o,"div","pptxv-ai-proposal");a.dataset.proposalId=t.id;let h=fl(o,"div","pptxv-ai-proposal-eyebrow");h.textContent=n("pptx.ai.proposedChange"),a.appendChild(h);let x=fl(o,"div","pptxv-ai-proposal-label");if(x.textContent=t.label,a.appendChild(x),t.summary.length>0){let l=fl(o,"ul","pptxv-ai-proposal-summary");for(let s of t.summary){let g=fl(o,"li");g.textContent=sl(s),l.appendChild(g);}a.appendChild(l);}let c=fl(o,"div","pptxv-ai-proposal-actions"),p=fl(o,"button","pptxv-ai-proposal-btn is-accept");p.type="button",p.append(ql(o,"check"),o.createTextNode(n("pptx.ai.accept"))),p.addEventListener("click",()=>i.accept(t.id));let m=fl(o,"button","pptxv-ai-proposal-btn is-reject");return m.type="button",m.append(ql(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=fl(t,"div","pptxv-ai-header"),h=fl(t,"span","pptxv-ai-title");h.textContent=i("pptx.ai.title");let x=fl(t,"button","pptxv-ai-close");x.type="button",x.title=i("pptx.ai.close"),x.setAttribute("aria-label",i("pptx.ai.close")),x.appendChild(ql(t,"close")),x.addEventListener("click",()=>o.onClose?.()),a.append(ql(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=fl(t,"div","pptxv-ai-messages");l.setAttribute("role","log"),l.setAttribute("aria-live","polite");let s=fl(t,"div","pptxv-ai-empty");s.textContent=i("pptx.ai.emptyHint"),l.appendChild(s);let g=fl(t,"div","pptxv-ai-proposals");g.hidden=true;let f=fl(t,"div","pptxv-ai-error");f.setAttribute("role","alert"),f.hidden=true;let C=fl(t,"form","pptxv-ai-composer"),d=fl(t,"textarea","pptxv-ai-input");d.rows=2,d.placeholder=i("pptx.ai.placeholder"),d.setAttribute("aria-label",i("pptx.ai.placeholder"));let y=fl(t,"button","pptxv-ai-send");y.type="submit",y.setAttribute("aria-label",i("pptx.ai.send")),y.appendChild(ql(t,"send")),C.append(d,y),n.append(a,...m?[m.el]:[],l,g,f,C);try{c=await(o.createChat??xl)({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:vl(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=>yl(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=Cl(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 chunkUWGSLLDO_cjs=require('./chunk-UWGSLLDO.cjs');require('./chunk-4VDLQK6F.cjs');function K(o){let{doc:t,t:n,controller:i}=o,a=chunkUWGSLLDO_cjs.fl(t,"div","pptxv-ai-focus"),h=(p,m,l)=>{let s=chunkUWGSLLDO_cjs.fl(t,"button","pptxv-ai-focus-btn");return s.type="button",s.title=m,s.setAttribute("aria-label",m),s.appendChild(chunkUWGSLLDO_cjs.ql(t,p)),s.addEventListener("click",l),s},x=()=>{a.replaceChildren();let p=i.getEffectiveTargets(),m=i.hasPicks(),l=i.isPinned(),s=i.isPicking(),g=chunkUWGSLLDO_cjs.fl(t,"div","pptxv-ai-focus-row"),f=chunkUWGSLLDO_cjs.fl(t,"span","pptxv-ai-focus-label");f.textContent=n("pptx.ai.focusScope"),g.appendChild(f);for(let r of chunkUWGSLLDO_cjs.al(p,o.getSlides())){let b=chunkUWGSLLDO_cjs.fl(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=chunkUWGSLLDO_cjs.fl(t,"span","pptxv-ai-focus-pinned");r.textContent=n("pptx.ai.pinnedFocus"),g.appendChild(r);}let C=chunkUWGSLLDO_cjs.fl(t,"div","pptxv-ai-focus-actions"),d=chunkUWGSLLDO_cjs.bl(p,o.getSlides());if(d){let r=chunkUWGSLLDO_cjs.fl(t,"button","pptxv-ai-focus-merge");r.type="button",r.append(chunkUWGSLLDO_cjs.ql(t,"git-merge"),t.createTextNode(n("pptx.ai.mergeSelectedTables"))),r.addEventListener("click",()=>o.onSendDirective(chunkUWGSLLDO_cjs.cl(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=chunkUWGSLLDO_cjs.fl(t,"div","pptxv-ai-focus-pick"),b=chunkUWGSLLDO_cjs.ql(t,"crosshair");b.classList.add("pptxv-ai-focus-pick-icon");let k=chunkUWGSLLDO_cjs.fl(t,"span","pptxv-ai-focus-pick-hint");k.textContent=n("pptx.ai.pickElementHint");let T=chunkUWGSLLDO_cjs.fl(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=chunkUWGSLLDO_cjs.fl(t,"button","pptxv-ai-chats");i.type="button",i.append(chunkUWGSLLDO_cjs.ql(t,"history"),t.createTextNode(n("pptx.ai.chats")));let a=chunkUWGSLLDO_cjs.fl(t,"div","pptxv-ai-history");a.hidden=true;let h=chunkUWGSLLDO_cjs.fl(t,"div","pptxv-ai-history-head"),x=chunkUWGSLLDO_cjs.fl(t,"span","pptxv-ai-history-title");x.textContent=n("pptx.ai.historyTitle");let c=chunkUWGSLLDO_cjs.fl(t,"button","pptxv-ai-history-new");c.type="button",c.append(chunkUWGSLLDO_cjs.ql(t,"plus"),t.createTextNode(n("pptx.ai.newChat"))),h.append(x,c);let p=chunkUWGSLLDO_cjs.fl(t,"div","pptxv-ai-history-body"),m=chunkUWGSLLDO_cjs.fl(t,"p","pptxv-ai-history-hint");m.textContent=n("pptx.ai.historyHint"),a.append(h,p,m);let l=chunkUWGSLLDO_cjs.wl({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=chunkUWGSLLDO_cjs.fl(t,"p","pptxv-ai-history-empty");d.textContent=n("pptx.ai.historyEmpty"),p.appendChild(d);return}let C=chunkUWGSLLDO_cjs.fl(t,"ul","pptxv-ai-history-list");for(let d of f){let y=chunkUWGSLLDO_cjs.fl(t,"li","pptxv-ai-history-row"),r=chunkUWGSLLDO_cjs.fl(t,"button","pptxv-ai-history-resume");r.type="button",r.classList.toggle("is-active",d.id===l.activeChatId());let b=chunkUWGSLLDO_cjs.fl(t,"span","pptxv-ai-history-text"),k=chunkUWGSLLDO_cjs.fl(t,"span","pptxv-ai-history-name");k.textContent=d.title||n("pptx.ai.untitledChat");let T=chunkUWGSLLDO_cjs.fl(t,"span","pptxv-ai-history-meta");T.textContent=n("pptx.ai.messageCount",{count:d.messageCount}),b.append(k,T),r.append(chunkUWGSLLDO_cjs.ql(t,"comment"),b),r.addEventListener("click",()=>{l.resumeChat(d.id),a.hidden=true;});let P=chunkUWGSLLDO_cjs.fl(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(chunkUWGSLLDO_cjs.ql(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=chunkUWGSLLDO_cjs.Bl(t.toolName,t.input,h?"present":"past"),c=chunkUWGSLLDO_cjs.fl(o,"div","pptxv-ai-tool"),p=chunkUWGSLLDO_cjs.fl(o,"div","pptxv-ai-tool-head"),m=chunkUWGSLLDO_cjs.ql(o,_[x.icon]??"wrench");m.classList.add("pptxv-ai-tool-icon");let l=chunkUWGSLLDO_cjs.fl(o,"span","pptxv-ai-tool-name");l.textContent=x.label;let s=chunkUWGSLLDO_cjs.fl(o,"span","pptxv-ai-tool-state");if(i?(s.classList.add("is-error"),s.append(chunkUWGSLLDO_cjs.ql(o,"alert"),o.createTextNode(n("pptx.ai.toolFailed")))):a?(s.classList.add("is-done"),s.append(chunkUWGSLLDO_cjs.ql(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=chunkUWGSLLDO_cjs.fl(o,"div","pptxv-ai-tool-error");f.textContent=t.errorText,c.appendChild(f);}let g=chunkUWGSLLDO_cjs.Al(t.input);if(g){let f=chunkUWGSLLDO_cjs.fl(o,"details","pptxv-ai-tool-details"),C=chunkUWGSLLDO_cjs.fl(o,"summary");C.textContent=n("pptx.ai.toolDetails");let d=chunkUWGSLLDO_cjs.fl(o,"div","pptxv-ai-tool-raw");d.textContent=`${chunkUWGSLLDO_cjs.zl(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=chunkUWGSLLDO_cjs.yl(a);if(x.length===0&&!h)continue;let c=chunkUWGSLLDO_cjs.fl(o,"div",`pptxv-ai-msg pptxv-ai-msg-${a.role}`),p=chunkUWGSLLDO_cjs.fl(o,"div","pptxv-ai-msg-avatar");p.setAttribute("aria-label",i(h?"pptx.ai.you":"pptx.ai.assistant")),p.appendChild(chunkUWGSLLDO_cjs.ql(o,h?"comment":"sparkles"));let m=chunkUWGSLLDO_cjs.fl(o,"div","pptxv-ai-msg-body");for(let l of x)if(l.kind==="text"){let s=chunkUWGSLLDO_cjs.fl(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=chunkUWGSLLDO_cjs.fl(o,"div","pptxv-ai-proposals-header"),x=chunkUWGSLLDO_cjs.fl(o,"span","pptxv-ai-proposals-title");if(x.textContent=i("pptx.ai.pendingChanges",{count:n.length}),h.appendChild(x),n.length>1){let c=chunkUWGSLLDO_cjs.fl(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=chunkUWGSLLDO_cjs.fl(o,"div","pptxv-ai-proposal");a.dataset.proposalId=t.id;let h=chunkUWGSLLDO_cjs.fl(o,"div","pptxv-ai-proposal-eyebrow");h.textContent=n("pptx.ai.proposedChange"),a.appendChild(h);let x=chunkUWGSLLDO_cjs.fl(o,"div","pptxv-ai-proposal-label");if(x.textContent=t.label,a.appendChild(x),t.summary.length>0){let l=chunkUWGSLLDO_cjs.fl(o,"ul","pptxv-ai-proposal-summary");for(let s of t.summary){let g=chunkUWGSLLDO_cjs.fl(o,"li");g.textContent=chunkUWGSLLDO_cjs.sl(s),l.appendChild(g);}a.appendChild(l);}let c=chunkUWGSLLDO_cjs.fl(o,"div","pptxv-ai-proposal-actions"),p=chunkUWGSLLDO_cjs.fl(o,"button","pptxv-ai-proposal-btn is-accept");p.type="button",p.append(chunkUWGSLLDO_cjs.ql(o,"check"),o.createTextNode(n("pptx.ai.accept"))),p.addEventListener("click",()=>i.accept(t.id));let m=chunkUWGSLLDO_cjs.fl(o,"button","pptxv-ai-proposal-btn is-reject");return m.type="button",m.append(chunkUWGSLLDO_cjs.ql(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=chunkUWGSLLDO_cjs.fl(t,"div","pptxv-ai-header"),h=chunkUWGSLLDO_cjs.fl(t,"span","pptxv-ai-title");h.textContent=i("pptx.ai.title");let x=chunkUWGSLLDO_cjs.fl(t,"button","pptxv-ai-close");x.type="button",x.title=i("pptx.ai.close"),x.setAttribute("aria-label",i("pptx.ai.close")),x.appendChild(chunkUWGSLLDO_cjs.ql(t,"close")),x.addEventListener("click",()=>o.onClose?.()),a.append(chunkUWGSLLDO_cjs.ql(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=chunkUWGSLLDO_cjs.fl(t,"div","pptxv-ai-messages");l.setAttribute("role","log"),l.setAttribute("aria-live","polite");let s=chunkUWGSLLDO_cjs.fl(t,"div","pptxv-ai-empty");s.textContent=i("pptx.ai.emptyHint"),l.appendChild(s);let g=chunkUWGSLLDO_cjs.fl(t,"div","pptxv-ai-proposals");g.hidden=true;let f=chunkUWGSLLDO_cjs.fl(t,"div","pptxv-ai-error");f.setAttribute("role","alert"),f.hidden=true;let C=chunkUWGSLLDO_cjs.fl(t,"form","pptxv-ai-composer"),d=chunkUWGSLLDO_cjs.fl(t,"textarea","pptxv-ai-input");d.rows=2,d.placeholder=i("pptx.ai.placeholder"),d.setAttribute("aria-label",i("pptx.ai.placeholder"));let y=chunkUWGSLLDO_cjs.fl(t,"button","pptxv-ai-send");y.type="submit",y.setAttribute("aria-label",i("pptx.ai.send")),y.appendChild(chunkUWGSLLDO_cjs.ql(t,"send")),C.append(d,y),n.append(a,...m?[m.el]:[],l,g,f,C);try{c=await(o.createChat??chunkUWGSLLDO_cjs.xl)({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:chunkUWGSLLDO_cjs.vl(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=>chunkUWGSLLDO_cjs.yl(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=chunkUWGSLLDO_cjs.Cl(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;