pptx-vanilla-viewer 2.0.0 → 2.0.2

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,56 @@ 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.0.1](https://github.com/ChristopherVR/pptx-viewer/releases/tag/pptx-vanilla-viewer@2.0.1) - 2026-08-22
11
+
12
+ ### Bug Fixes
13
+
14
+ - **core:** Spell the SmartArt role sentinel as a unicode escape (by @ChristopherVR) ([a2d4993](https://github.com/ChristopherVR/pptx-viewer/commit/a2d4993390bcdc28a3b24c1bf501c64f638f68d9))
15
+
16
+ ## [2.0.0](https://github.com/ChristopherVR/pptx-viewer/releases/tag/pptx-vanilla-viewer@2.0.0) - 2026-08-22
17
+
18
+ ### Features
19
+
20
+ - **core:** Unify SmartArt layout onto one DiagramML interpreter (by @ChristopherVR) ([89116b1](https://github.com/ChristopherVR/pptx-viewer/commit/89116b131a3f13fb6b65789c46d3f9a7814d04db))
21
+ - **core:** Write chart edits back to the embedded workbook (by @ChristopherVR) ([dee19fc](https://github.com/ChristopherVR/pptx-viewer/commit/dee19fc69b02ad36eadd39f48e589de9e76689fa))
22
+ - **core:** Solve relative SmartArt constraints and apply org-chart hints (by @ChristopherVR) ([65eee20](https://github.com/ChristopherVR/pptx-viewer/commit/65eee20e9e772ab40317df0ba1acf0c26a412973))
23
+ - **shared:** Print notes pages in every binding, and honour notesStyle in the master preview (by @ChristopherVR) ([6f2f54d](https://github.com/ChristopherVR/pptx-viewer/commit/6f2f54d503806054ae48bfc8f0d0c0ee565977ce))
24
+ - **core:** Author tag elements, model embedTrueTypeFonts, and add a text-style edit path (by @ChristopherVR) ([0048d16](https://github.com/ChristopherVR/pptx-viewer/commit/0048d163c6dd87d7a0bdc3207cbcbd4db39f8d0e))
25
+ - **core,shared:** Serialize data-table styling, and paint 3D chart surfaces (by @ChristopherVR) ([bd9595a](https://github.com/ChristopherVR/pptx-viewer/commit/bd9595a7bae6c545a649ff8e1929b27a638fcb5b))
26
+ - **core:** Honour per-node shapes, style roles and connector text in SmartArt (by @ChristopherVR) ([c823fca](https://github.com/ChristopherVR/pptx-viewer/commit/c823fca506f99e3c4f42ec11513e56cdb30f9a68))
27
+ - **core,shared:** Model timing templates and play animEffect filters (by @ChristopherVR) ([8bf91f2](https://github.com/ChristopherVR/pptx-viewer/commit/8bf91f20c907f9d92abbcd5a59fb424ddfabdbd8))
28
+ - **core,shared:** Cross-browser reflections, overlay fills, and remaining text gaps (by @ChristopherVR) ([c0b0d6d](https://github.com/ChristopherVR/pptx-viewer/commit/c0b0d6d6805c6383ba2a01da3c8a22792eb22cdb))
29
+
30
+ ### Bug Fixes
31
+
32
+ - **core:** Close five OpenXML parse and serialize fidelity gaps (by @ChristopherVR) ([641b0b2](https://github.com/ChristopherVR/pptx-viewer/commit/641b0b21d82442262f3f2d0e4ed2894cd71c07e9))
33
+ - **core,shared:** Correct animation preset IDs against PowerPoint COM ground truth (by @ChristopherVR) ([61b0014](https://github.com/ChristopherVR/pptx-viewer/commit/61b001440de0bf73bfcd6efd21c8df21bd47e5c8))
34
+ - **shared:** Honour a:ln/@algn and per-subpath fill modes (by @ChristopherVR) ([d049a8f](https://github.com/ChristopherVR/pptx-viewer/commit/d049a8f7806b7efb85e643e12643393372ccf603))
35
+ - **shared:** Correct autofit and paragraph-spacing semantics (by @ChristopherVR) ([86f61e9](https://github.com/ChristopherVR/pptx-viewer/commit/86f61e9b6e2cb0fe34f2e958273f35702f58fc6a))
36
+ - **shared:** Move per-script fonts and measured tab layout out of React (by @ChristopherVR) ([dbd3442](https://github.com/ChristopherVR/pptx-viewer/commit/dbd3442e2173a8b8b397af592f01e39daad95ff8))
37
+ - **shared:** Render table cell image fill, zero margins and authored grid spacing (by @ChristopherVR) ([d4079d2](https://github.com/ChristopherVR/pptx-viewer/commit/d4079d20b6517a0aac4655882e27228abc06ae09))
38
+ - **vanilla:** Consume the shared render decisions and fix two gesture bugs (by @ChristopherVR) ([d818d8b](https://github.com/ChristopherVR/pptx-viewer/commit/d818d8b060b9165eef6817db9c7bafa42300320f))
39
+ - **core,shared:** Honour cTn timing attributes, after-animation and effect sound (by @ChristopherVR) ([07ee51f](https://github.com/ChristopherVR/pptx-viewer/commit/07ee51f8b11431153e9ce2553c4c11a51e15316e))
40
+ - **core:** Close slide-structure, notes-style and DrawingML parse gaps (by @ChristopherVR) ([ee1dbcd](https://github.com/ChristopherVR/pptx-viewer/commit/ee1dbcd3278e2bde7b066c4085a82f56cc818f6a))
41
+ - **shared:** Render data tables, legend entries, image overlays and 3D text (by @ChristopherVR) ([ecec502](https://github.com/ChristopherVR/pptx-viewer/commit/ecec502e205f06c1bb7dec042f7693ac4fd8a74e))
42
+ - **vanilla:** Consume the shared decisions for the second parity wave (by @ChristopherVR) ([a52a09a](https://github.com/ChristopherVR/pptx-viewer/commit/a52a09a7d96670e934b14fa324a33015d9a105c0))
43
+
44
+ ### Refactor
45
+
46
+ - **shared:** Split oversized text modules and add the circle-in keyframe (by @ChristopherVR) ([1c0797f](https://github.com/ChristopherVR/pptx-viewer/commit/1c0797f7d5468dca16f6cb53c1ad413db4fc29e0))
47
+
48
+ ### Documentation
49
+
50
+ - **core:** Record audited OpenXML construct coverage in the manifest (by @ChristopherVR) ([812fe61](https://github.com/ChristopherVR/pptx-viewer/commit/812fe61e66687a48c2cd19eeb0c502767c25e3c1))
51
+
52
+ ### Testing
53
+
54
+ - **core:** Evidence previously unverified OpenXML constructs, and record what is not implemented (by @ChristopherVR) ([4dc6028](https://github.com/ChristopherVR/pptx-viewer/commit/4dc602876bd49cdb03b084f9f4fa2268aa01f22f))
55
+
56
+ ### Chores
57
+
58
+ - **core:** Complete barrel and runtime wiring for the preceding two changes (by @ChristopherVR) ([115379e](https://github.com/ChristopherVR/pptx-viewer/commit/115379e9a757b029fbc0cbb74ae51628f7fb3e27))
59
+
10
60
  ## [1.24.0](https://github.com/ChristopherVR/pptx-viewer/releases/tag/pptx-vanilla-viewer@1.24.0) - 2026-08-21
11
61
 
12
62
  ### Features
@@ -1 +1 @@
1
- 'use strict';var chunkR2NUNRIB_cjs=require('./chunk-R2NUNRIB.cjs');require('./chunk-4VDLQK6F.cjs');function K(o){let{doc:t,t:n,controller:i}=o,a=chunkR2NUNRIB_cjs.Ok(t,"div","pptxv-ai-focus"),h=(p,m,l)=>{let s=chunkR2NUNRIB_cjs.Ok(t,"button","pptxv-ai-focus-btn");return s.type="button",s.title=m,s.setAttribute("aria-label",m),s.appendChild(chunkR2NUNRIB_cjs.Zk(t,p)),s.addEventListener("click",l),s},x=()=>{a.replaceChildren();let p=i.getEffectiveTargets(),m=i.hasPicks(),l=i.isPinned(),s=i.isPicking(),g=chunkR2NUNRIB_cjs.Ok(t,"div","pptxv-ai-focus-row"),f=chunkR2NUNRIB_cjs.Ok(t,"span","pptxv-ai-focus-label");f.textContent=n("pptx.ai.focusScope"),g.appendChild(f);for(let r of chunkR2NUNRIB_cjs.Jk(p,o.getSlides())){let b=chunkR2NUNRIB_cjs.Ok(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=chunkR2NUNRIB_cjs.Ok(t,"span","pptxv-ai-focus-pinned");r.textContent=n("pptx.ai.pinnedFocus"),g.appendChild(r);}let C=chunkR2NUNRIB_cjs.Ok(t,"div","pptxv-ai-focus-actions"),d=chunkR2NUNRIB_cjs.Kk(p,o.getSlides());if(d){let r=chunkR2NUNRIB_cjs.Ok(t,"button","pptxv-ai-focus-merge");r.type="button",r.append(chunkR2NUNRIB_cjs.Zk(t,"git-merge"),t.createTextNode(n("pptx.ai.mergeSelectedTables"))),r.addEventListener("click",()=>o.onSendDirective(chunkR2NUNRIB_cjs.Lk(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=chunkR2NUNRIB_cjs.Ok(t,"div","pptxv-ai-focus-pick"),b=chunkR2NUNRIB_cjs.Zk(t,"crosshair");b.classList.add("pptxv-ai-focus-pick-icon");let k=chunkR2NUNRIB_cjs.Ok(t,"span","pptxv-ai-focus-pick-hint");k.textContent=n("pptx.ai.pickElementHint");let T=chunkR2NUNRIB_cjs.Ok(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=chunkR2NUNRIB_cjs.Ok(t,"button","pptxv-ai-chats");i.type="button",i.append(chunkR2NUNRIB_cjs.Zk(t,"history"),t.createTextNode(n("pptx.ai.chats")));let a=chunkR2NUNRIB_cjs.Ok(t,"div","pptxv-ai-history");a.hidden=true;let h=chunkR2NUNRIB_cjs.Ok(t,"div","pptxv-ai-history-head"),x=chunkR2NUNRIB_cjs.Ok(t,"span","pptxv-ai-history-title");x.textContent=n("pptx.ai.historyTitle");let c=chunkR2NUNRIB_cjs.Ok(t,"button","pptxv-ai-history-new");c.type="button",c.append(chunkR2NUNRIB_cjs.Zk(t,"plus"),t.createTextNode(n("pptx.ai.newChat"))),h.append(x,c);let p=chunkR2NUNRIB_cjs.Ok(t,"div","pptxv-ai-history-body"),m=chunkR2NUNRIB_cjs.Ok(t,"p","pptxv-ai-history-hint");m.textContent=n("pptx.ai.historyHint"),a.append(h,p,m);let l=chunkR2NUNRIB_cjs.dl({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=chunkR2NUNRIB_cjs.Ok(t,"p","pptxv-ai-history-empty");d.textContent=n("pptx.ai.historyEmpty"),p.appendChild(d);return}let C=chunkR2NUNRIB_cjs.Ok(t,"ul","pptxv-ai-history-list");for(let d of f){let y=chunkR2NUNRIB_cjs.Ok(t,"li","pptxv-ai-history-row"),r=chunkR2NUNRIB_cjs.Ok(t,"button","pptxv-ai-history-resume");r.type="button",r.classList.toggle("is-active",d.id===l.activeChatId());let b=chunkR2NUNRIB_cjs.Ok(t,"span","pptxv-ai-history-text"),k=chunkR2NUNRIB_cjs.Ok(t,"span","pptxv-ai-history-name");k.textContent=d.title||n("pptx.ai.untitledChat");let T=chunkR2NUNRIB_cjs.Ok(t,"span","pptxv-ai-history-meta");T.textContent=n("pptx.ai.messageCount",{count:d.messageCount}),b.append(k,T),r.append(chunkR2NUNRIB_cjs.Zk(t,"comment"),b),r.addEventListener("click",()=>{l.resumeChat(d.id),a.hidden=true;});let P=chunkR2NUNRIB_cjs.Ok(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(chunkR2NUNRIB_cjs.Zk(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=chunkR2NUNRIB_cjs.il(t.toolName,t.input,h?"present":"past"),c=chunkR2NUNRIB_cjs.Ok(o,"div","pptxv-ai-tool"),p=chunkR2NUNRIB_cjs.Ok(o,"div","pptxv-ai-tool-head"),m=chunkR2NUNRIB_cjs.Zk(o,_[x.icon]??"wrench");m.classList.add("pptxv-ai-tool-icon");let l=chunkR2NUNRIB_cjs.Ok(o,"span","pptxv-ai-tool-name");l.textContent=x.label;let s=chunkR2NUNRIB_cjs.Ok(o,"span","pptxv-ai-tool-state");if(i?(s.classList.add("is-error"),s.append(chunkR2NUNRIB_cjs.Zk(o,"alert"),o.createTextNode(n("pptx.ai.toolFailed")))):a?(s.classList.add("is-done"),s.append(chunkR2NUNRIB_cjs.Zk(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=chunkR2NUNRIB_cjs.Ok(o,"div","pptxv-ai-tool-error");f.textContent=t.errorText,c.appendChild(f);}let g=chunkR2NUNRIB_cjs.hl(t.input);if(g){let f=chunkR2NUNRIB_cjs.Ok(o,"details","pptxv-ai-tool-details"),C=chunkR2NUNRIB_cjs.Ok(o,"summary");C.textContent=n("pptx.ai.toolDetails");let d=chunkR2NUNRIB_cjs.Ok(o,"div","pptxv-ai-tool-raw");d.textContent=`${chunkR2NUNRIB_cjs.gl(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=chunkR2NUNRIB_cjs.fl(a);if(x.length===0&&!h)continue;let c=chunkR2NUNRIB_cjs.Ok(o,"div",`pptxv-ai-msg pptxv-ai-msg-${a.role}`),p=chunkR2NUNRIB_cjs.Ok(o,"div","pptxv-ai-msg-avatar");p.setAttribute("aria-label",i(h?"pptx.ai.you":"pptx.ai.assistant")),p.appendChild(chunkR2NUNRIB_cjs.Zk(o,h?"comment":"sparkles"));let m=chunkR2NUNRIB_cjs.Ok(o,"div","pptxv-ai-msg-body");for(let l of x)if(l.kind==="text"){let s=chunkR2NUNRIB_cjs.Ok(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=chunkR2NUNRIB_cjs.Ok(o,"div","pptxv-ai-proposals-header"),x=chunkR2NUNRIB_cjs.Ok(o,"span","pptxv-ai-proposals-title");if(x.textContent=i("pptx.ai.pendingChanges",{count:n.length}),h.appendChild(x),n.length>1){let c=chunkR2NUNRIB_cjs.Ok(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=chunkR2NUNRIB_cjs.Ok(o,"div","pptxv-ai-proposal");a.dataset.proposalId=t.id;let h=chunkR2NUNRIB_cjs.Ok(o,"div","pptxv-ai-proposal-eyebrow");h.textContent=n("pptx.ai.proposedChange"),a.appendChild(h);let x=chunkR2NUNRIB_cjs.Ok(o,"div","pptxv-ai-proposal-label");if(x.textContent=t.label,a.appendChild(x),t.summary.length>0){let l=chunkR2NUNRIB_cjs.Ok(o,"ul","pptxv-ai-proposal-summary");for(let s of t.summary){let g=chunkR2NUNRIB_cjs.Ok(o,"li");g.textContent=chunkR2NUNRIB_cjs.$k(s),l.appendChild(g);}a.appendChild(l);}let c=chunkR2NUNRIB_cjs.Ok(o,"div","pptxv-ai-proposal-actions"),p=chunkR2NUNRIB_cjs.Ok(o,"button","pptxv-ai-proposal-btn is-accept");p.type="button",p.append(chunkR2NUNRIB_cjs.Zk(o,"check"),o.createTextNode(n("pptx.ai.accept"))),p.addEventListener("click",()=>i.accept(t.id));let m=chunkR2NUNRIB_cjs.Ok(o,"button","pptxv-ai-proposal-btn is-reject");return m.type="button",m.append(chunkR2NUNRIB_cjs.Zk(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=chunkR2NUNRIB_cjs.Ok(t,"div","pptxv-ai-header"),h=chunkR2NUNRIB_cjs.Ok(t,"span","pptxv-ai-title");h.textContent=i("pptx.ai.title");let x=chunkR2NUNRIB_cjs.Ok(t,"button","pptxv-ai-close");x.type="button",x.title=i("pptx.ai.close"),x.setAttribute("aria-label",i("pptx.ai.close")),x.appendChild(chunkR2NUNRIB_cjs.Zk(t,"close")),x.addEventListener("click",()=>o.onClose?.()),a.append(chunkR2NUNRIB_cjs.Zk(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=chunkR2NUNRIB_cjs.Ok(t,"div","pptxv-ai-messages");l.setAttribute("role","log"),l.setAttribute("aria-live","polite");let s=chunkR2NUNRIB_cjs.Ok(t,"div","pptxv-ai-empty");s.textContent=i("pptx.ai.emptyHint"),l.appendChild(s);let g=chunkR2NUNRIB_cjs.Ok(t,"div","pptxv-ai-proposals");g.hidden=true;let f=chunkR2NUNRIB_cjs.Ok(t,"div","pptxv-ai-error");f.setAttribute("role","alert"),f.hidden=true;let C=chunkR2NUNRIB_cjs.Ok(t,"form","pptxv-ai-composer"),d=chunkR2NUNRIB_cjs.Ok(t,"textarea","pptxv-ai-input");d.rows=2,d.placeholder=i("pptx.ai.placeholder"),d.setAttribute("aria-label",i("pptx.ai.placeholder"));let y=chunkR2NUNRIB_cjs.Ok(t,"button","pptxv-ai-send");y.type="submit",y.setAttribute("aria-label",i("pptx.ai.send")),y.appendChild(chunkR2NUNRIB_cjs.Zk(t,"send")),C.append(d,y),n.append(a,...m?[m.el]:[],l,g,f,C);try{c=await(o.createChat??chunkR2NUNRIB_cjs.el)({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:chunkR2NUNRIB_cjs.cl(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=>chunkR2NUNRIB_cjs.fl(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=chunkR2NUNRIB_cjs.jl(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 chunkQOZR2M2P_cjs=require('./chunk-QOZR2M2P.cjs');require('./chunk-4VDLQK6F.cjs');function K(o){let{doc:t,t:n,controller:i}=o,a=chunkQOZR2M2P_cjs.Ok(t,"div","pptxv-ai-focus"),h=(p,m,l)=>{let s=chunkQOZR2M2P_cjs.Ok(t,"button","pptxv-ai-focus-btn");return s.type="button",s.title=m,s.setAttribute("aria-label",m),s.appendChild(chunkQOZR2M2P_cjs.Zk(t,p)),s.addEventListener("click",l),s},x=()=>{a.replaceChildren();let p=i.getEffectiveTargets(),m=i.hasPicks(),l=i.isPinned(),s=i.isPicking(),g=chunkQOZR2M2P_cjs.Ok(t,"div","pptxv-ai-focus-row"),f=chunkQOZR2M2P_cjs.Ok(t,"span","pptxv-ai-focus-label");f.textContent=n("pptx.ai.focusScope"),g.appendChild(f);for(let r of chunkQOZR2M2P_cjs.Jk(p,o.getSlides())){let b=chunkQOZR2M2P_cjs.Ok(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=chunkQOZR2M2P_cjs.Ok(t,"span","pptxv-ai-focus-pinned");r.textContent=n("pptx.ai.pinnedFocus"),g.appendChild(r);}let C=chunkQOZR2M2P_cjs.Ok(t,"div","pptxv-ai-focus-actions"),d=chunkQOZR2M2P_cjs.Kk(p,o.getSlides());if(d){let r=chunkQOZR2M2P_cjs.Ok(t,"button","pptxv-ai-focus-merge");r.type="button",r.append(chunkQOZR2M2P_cjs.Zk(t,"git-merge"),t.createTextNode(n("pptx.ai.mergeSelectedTables"))),r.addEventListener("click",()=>o.onSendDirective(chunkQOZR2M2P_cjs.Lk(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=chunkQOZR2M2P_cjs.Ok(t,"div","pptxv-ai-focus-pick"),b=chunkQOZR2M2P_cjs.Zk(t,"crosshair");b.classList.add("pptxv-ai-focus-pick-icon");let k=chunkQOZR2M2P_cjs.Ok(t,"span","pptxv-ai-focus-pick-hint");k.textContent=n("pptx.ai.pickElementHint");let T=chunkQOZR2M2P_cjs.Ok(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=chunkQOZR2M2P_cjs.Ok(t,"button","pptxv-ai-chats");i.type="button",i.append(chunkQOZR2M2P_cjs.Zk(t,"history"),t.createTextNode(n("pptx.ai.chats")));let a=chunkQOZR2M2P_cjs.Ok(t,"div","pptxv-ai-history");a.hidden=true;let h=chunkQOZR2M2P_cjs.Ok(t,"div","pptxv-ai-history-head"),x=chunkQOZR2M2P_cjs.Ok(t,"span","pptxv-ai-history-title");x.textContent=n("pptx.ai.historyTitle");let c=chunkQOZR2M2P_cjs.Ok(t,"button","pptxv-ai-history-new");c.type="button",c.append(chunkQOZR2M2P_cjs.Zk(t,"plus"),t.createTextNode(n("pptx.ai.newChat"))),h.append(x,c);let p=chunkQOZR2M2P_cjs.Ok(t,"div","pptxv-ai-history-body"),m=chunkQOZR2M2P_cjs.Ok(t,"p","pptxv-ai-history-hint");m.textContent=n("pptx.ai.historyHint"),a.append(h,p,m);let l=chunkQOZR2M2P_cjs.dl({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=chunkQOZR2M2P_cjs.Ok(t,"p","pptxv-ai-history-empty");d.textContent=n("pptx.ai.historyEmpty"),p.appendChild(d);return}let C=chunkQOZR2M2P_cjs.Ok(t,"ul","pptxv-ai-history-list");for(let d of f){let y=chunkQOZR2M2P_cjs.Ok(t,"li","pptxv-ai-history-row"),r=chunkQOZR2M2P_cjs.Ok(t,"button","pptxv-ai-history-resume");r.type="button",r.classList.toggle("is-active",d.id===l.activeChatId());let b=chunkQOZR2M2P_cjs.Ok(t,"span","pptxv-ai-history-text"),k=chunkQOZR2M2P_cjs.Ok(t,"span","pptxv-ai-history-name");k.textContent=d.title||n("pptx.ai.untitledChat");let T=chunkQOZR2M2P_cjs.Ok(t,"span","pptxv-ai-history-meta");T.textContent=n("pptx.ai.messageCount",{count:d.messageCount}),b.append(k,T),r.append(chunkQOZR2M2P_cjs.Zk(t,"comment"),b),r.addEventListener("click",()=>{l.resumeChat(d.id),a.hidden=true;});let P=chunkQOZR2M2P_cjs.Ok(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(chunkQOZR2M2P_cjs.Zk(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=chunkQOZR2M2P_cjs.il(t.toolName,t.input,h?"present":"past"),c=chunkQOZR2M2P_cjs.Ok(o,"div","pptxv-ai-tool"),p=chunkQOZR2M2P_cjs.Ok(o,"div","pptxv-ai-tool-head"),m=chunkQOZR2M2P_cjs.Zk(o,_[x.icon]??"wrench");m.classList.add("pptxv-ai-tool-icon");let l=chunkQOZR2M2P_cjs.Ok(o,"span","pptxv-ai-tool-name");l.textContent=x.label;let s=chunkQOZR2M2P_cjs.Ok(o,"span","pptxv-ai-tool-state");if(i?(s.classList.add("is-error"),s.append(chunkQOZR2M2P_cjs.Zk(o,"alert"),o.createTextNode(n("pptx.ai.toolFailed")))):a?(s.classList.add("is-done"),s.append(chunkQOZR2M2P_cjs.Zk(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=chunkQOZR2M2P_cjs.Ok(o,"div","pptxv-ai-tool-error");f.textContent=t.errorText,c.appendChild(f);}let g=chunkQOZR2M2P_cjs.hl(t.input);if(g){let f=chunkQOZR2M2P_cjs.Ok(o,"details","pptxv-ai-tool-details"),C=chunkQOZR2M2P_cjs.Ok(o,"summary");C.textContent=n("pptx.ai.toolDetails");let d=chunkQOZR2M2P_cjs.Ok(o,"div","pptxv-ai-tool-raw");d.textContent=`${chunkQOZR2M2P_cjs.gl(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=chunkQOZR2M2P_cjs.fl(a);if(x.length===0&&!h)continue;let c=chunkQOZR2M2P_cjs.Ok(o,"div",`pptxv-ai-msg pptxv-ai-msg-${a.role}`),p=chunkQOZR2M2P_cjs.Ok(o,"div","pptxv-ai-msg-avatar");p.setAttribute("aria-label",i(h?"pptx.ai.you":"pptx.ai.assistant")),p.appendChild(chunkQOZR2M2P_cjs.Zk(o,h?"comment":"sparkles"));let m=chunkQOZR2M2P_cjs.Ok(o,"div","pptxv-ai-msg-body");for(let l of x)if(l.kind==="text"){let s=chunkQOZR2M2P_cjs.Ok(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=chunkQOZR2M2P_cjs.Ok(o,"div","pptxv-ai-proposals-header"),x=chunkQOZR2M2P_cjs.Ok(o,"span","pptxv-ai-proposals-title");if(x.textContent=i("pptx.ai.pendingChanges",{count:n.length}),h.appendChild(x),n.length>1){let c=chunkQOZR2M2P_cjs.Ok(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=chunkQOZR2M2P_cjs.Ok(o,"div","pptxv-ai-proposal");a.dataset.proposalId=t.id;let h=chunkQOZR2M2P_cjs.Ok(o,"div","pptxv-ai-proposal-eyebrow");h.textContent=n("pptx.ai.proposedChange"),a.appendChild(h);let x=chunkQOZR2M2P_cjs.Ok(o,"div","pptxv-ai-proposal-label");if(x.textContent=t.label,a.appendChild(x),t.summary.length>0){let l=chunkQOZR2M2P_cjs.Ok(o,"ul","pptxv-ai-proposal-summary");for(let s of t.summary){let g=chunkQOZR2M2P_cjs.Ok(o,"li");g.textContent=chunkQOZR2M2P_cjs.$k(s),l.appendChild(g);}a.appendChild(l);}let c=chunkQOZR2M2P_cjs.Ok(o,"div","pptxv-ai-proposal-actions"),p=chunkQOZR2M2P_cjs.Ok(o,"button","pptxv-ai-proposal-btn is-accept");p.type="button",p.append(chunkQOZR2M2P_cjs.Zk(o,"check"),o.createTextNode(n("pptx.ai.accept"))),p.addEventListener("click",()=>i.accept(t.id));let m=chunkQOZR2M2P_cjs.Ok(o,"button","pptxv-ai-proposal-btn is-reject");return m.type="button",m.append(chunkQOZR2M2P_cjs.Zk(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=chunkQOZR2M2P_cjs.Ok(t,"div","pptxv-ai-header"),h=chunkQOZR2M2P_cjs.Ok(t,"span","pptxv-ai-title");h.textContent=i("pptx.ai.title");let x=chunkQOZR2M2P_cjs.Ok(t,"button","pptxv-ai-close");x.type="button",x.title=i("pptx.ai.close"),x.setAttribute("aria-label",i("pptx.ai.close")),x.appendChild(chunkQOZR2M2P_cjs.Zk(t,"close")),x.addEventListener("click",()=>o.onClose?.()),a.append(chunkQOZR2M2P_cjs.Zk(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=chunkQOZR2M2P_cjs.Ok(t,"div","pptxv-ai-messages");l.setAttribute("role","log"),l.setAttribute("aria-live","polite");let s=chunkQOZR2M2P_cjs.Ok(t,"div","pptxv-ai-empty");s.textContent=i("pptx.ai.emptyHint"),l.appendChild(s);let g=chunkQOZR2M2P_cjs.Ok(t,"div","pptxv-ai-proposals");g.hidden=true;let f=chunkQOZR2M2P_cjs.Ok(t,"div","pptxv-ai-error");f.setAttribute("role","alert"),f.hidden=true;let C=chunkQOZR2M2P_cjs.Ok(t,"form","pptxv-ai-composer"),d=chunkQOZR2M2P_cjs.Ok(t,"textarea","pptxv-ai-input");d.rows=2,d.placeholder=i("pptx.ai.placeholder"),d.setAttribute("aria-label",i("pptx.ai.placeholder"));let y=chunkQOZR2M2P_cjs.Ok(t,"button","pptxv-ai-send");y.type="submit",y.setAttribute("aria-label",i("pptx.ai.send")),y.appendChild(chunkQOZR2M2P_cjs.Zk(t,"send")),C.append(d,y),n.append(a,...m?[m.el]:[],l,g,f,C);try{c=await(o.createChat??chunkQOZR2M2P_cjs.el)({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:chunkQOZR2M2P_cjs.cl(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=>chunkQOZR2M2P_cjs.fl(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=chunkQOZR2M2P_cjs.jl(A.toolName,A.input);L&&L.slideIndex!==void 0&&o.goToSlide?.(L.slideIndex),p.flashToolTarget(L);},M=u=>{q(t,l,u.messages,i),s.hidden=u.messages.length>0,u.messages.length===0&&l.appendChild(s),G(t,g,r.proposals.list(),i,{accept:A=>{p?.flashToolTarget(null),r.proposals.apply(A),M(r.getSnapshot());},reject:A=>{r.proposals.revert(A),M(r.getSnapshot());},acceptAll:()=>{p?.flashToolTarget(null),r.proposals.acceptAll(),M(r.getSnapshot());}});let w=u.status==="submitted"||u.status==="streaming";n.classList.toggle("is-busy",w),y.setAttribute("aria-label",i(w?"pptx.ai.stop":"pptx.ai.send")),f.hidden=!u.error,f.textContent=u.error?i("pptx.ai.errorPrefix"):"",l.scrollTop=l.scrollHeight,P(u);},S=()=>{if(n.classList.contains("is-busy")){r.stop();return}let u=d.value.trim();u&&(d.value="",r.sendMessage(u));};C.addEventListener("submit",u=>{u.preventDefault(),S();}),d.addEventListener("keydown",u=>{u.key==="Enter"&&!u.shiftKey&&(u.preventDefault(),S());});let I=p?.getPrefill().nonce??0,J=()=>{if(!p)return;let u=p.getPrefill();u.nonce!==I&&(I=u.nonce,d.value=u.text,d.focus());},Q=p?.subscribe(J),X=r.subscribe(M);return M(r.getSnapshot()),{changeAnimator:r.changeAnimator,destroy(){X(),k(),b.destroy(),Q?.(),m?.destroy(),n.replaceChildren();}}}exports.createAiPanel=wt;
@@ -1 +1 @@
1
- import {Ok,Zk,el,cl,dl,fl,jl,Jk,Kk,Lk,il,hl,gl,$k}from'./chunk-YL7ZWNXW.js';import'./chunk-WOT6VMZA.js';function K(o){let{doc:t,t:n,controller:i}=o,a=Ok(t,"div","pptxv-ai-focus"),h=(p,m,l)=>{let s=Ok(t,"button","pptxv-ai-focus-btn");return s.type="button",s.title=m,s.setAttribute("aria-label",m),s.appendChild(Zk(t,p)),s.addEventListener("click",l),s},x=()=>{a.replaceChildren();let p=i.getEffectiveTargets(),m=i.hasPicks(),l=i.isPinned(),s=i.isPicking(),g=Ok(t,"div","pptxv-ai-focus-row"),f=Ok(t,"span","pptxv-ai-focus-label");f.textContent=n("pptx.ai.focusScope"),g.appendChild(f);for(let r of Jk(p,o.getSlides())){let b=Ok(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=Ok(t,"span","pptxv-ai-focus-pinned");r.textContent=n("pptx.ai.pinnedFocus"),g.appendChild(r);}let C=Ok(t,"div","pptxv-ai-focus-actions"),d=Kk(p,o.getSlides());if(d){let r=Ok(t,"button","pptxv-ai-focus-merge");r.type="button",r.append(Zk(t,"git-merge"),t.createTextNode(n("pptx.ai.mergeSelectedTables"))),r.addEventListener("click",()=>o.onSendDirective(Lk(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=Ok(t,"div","pptxv-ai-focus-pick"),b=Zk(t,"crosshair");b.classList.add("pptxv-ai-focus-pick-icon");let k=Ok(t,"span","pptxv-ai-focus-pick-hint");k.textContent=n("pptx.ai.pickElementHint");let T=Ok(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=Ok(t,"button","pptxv-ai-chats");i.type="button",i.append(Zk(t,"history"),t.createTextNode(n("pptx.ai.chats")));let a=Ok(t,"div","pptxv-ai-history");a.hidden=true;let h=Ok(t,"div","pptxv-ai-history-head"),x=Ok(t,"span","pptxv-ai-history-title");x.textContent=n("pptx.ai.historyTitle");let c=Ok(t,"button","pptxv-ai-history-new");c.type="button",c.append(Zk(t,"plus"),t.createTextNode(n("pptx.ai.newChat"))),h.append(x,c);let p=Ok(t,"div","pptxv-ai-history-body"),m=Ok(t,"p","pptxv-ai-history-hint");m.textContent=n("pptx.ai.historyHint"),a.append(h,p,m);let l=dl({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=Ok(t,"p","pptxv-ai-history-empty");d.textContent=n("pptx.ai.historyEmpty"),p.appendChild(d);return}let C=Ok(t,"ul","pptxv-ai-history-list");for(let d of f){let y=Ok(t,"li","pptxv-ai-history-row"),r=Ok(t,"button","pptxv-ai-history-resume");r.type="button",r.classList.toggle("is-active",d.id===l.activeChatId());let b=Ok(t,"span","pptxv-ai-history-text"),k=Ok(t,"span","pptxv-ai-history-name");k.textContent=d.title||n("pptx.ai.untitledChat");let T=Ok(t,"span","pptxv-ai-history-meta");T.textContent=n("pptx.ai.messageCount",{count:d.messageCount}),b.append(k,T),r.append(Zk(t,"comment"),b),r.addEventListener("click",()=>{l.resumeChat(d.id),a.hidden=true;});let P=Ok(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(Zk(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=il(t.toolName,t.input,h?"present":"past"),c=Ok(o,"div","pptxv-ai-tool"),p=Ok(o,"div","pptxv-ai-tool-head"),m=Zk(o,_[x.icon]??"wrench");m.classList.add("pptxv-ai-tool-icon");let l=Ok(o,"span","pptxv-ai-tool-name");l.textContent=x.label;let s=Ok(o,"span","pptxv-ai-tool-state");if(i?(s.classList.add("is-error"),s.append(Zk(o,"alert"),o.createTextNode(n("pptx.ai.toolFailed")))):a?(s.classList.add("is-done"),s.append(Zk(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=Ok(o,"div","pptxv-ai-tool-error");f.textContent=t.errorText,c.appendChild(f);}let g=hl(t.input);if(g){let f=Ok(o,"details","pptxv-ai-tool-details"),C=Ok(o,"summary");C.textContent=n("pptx.ai.toolDetails");let d=Ok(o,"div","pptxv-ai-tool-raw");d.textContent=`${gl(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=fl(a);if(x.length===0&&!h)continue;let c=Ok(o,"div",`pptxv-ai-msg pptxv-ai-msg-${a.role}`),p=Ok(o,"div","pptxv-ai-msg-avatar");p.setAttribute("aria-label",i(h?"pptx.ai.you":"pptx.ai.assistant")),p.appendChild(Zk(o,h?"comment":"sparkles"));let m=Ok(o,"div","pptxv-ai-msg-body");for(let l of x)if(l.kind==="text"){let s=Ok(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=Ok(o,"div","pptxv-ai-proposals-header"),x=Ok(o,"span","pptxv-ai-proposals-title");if(x.textContent=i("pptx.ai.pendingChanges",{count:n.length}),h.appendChild(x),n.length>1){let c=Ok(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=Ok(o,"div","pptxv-ai-proposal");a.dataset.proposalId=t.id;let h=Ok(o,"div","pptxv-ai-proposal-eyebrow");h.textContent=n("pptx.ai.proposedChange"),a.appendChild(h);let x=Ok(o,"div","pptxv-ai-proposal-label");if(x.textContent=t.label,a.appendChild(x),t.summary.length>0){let l=Ok(o,"ul","pptxv-ai-proposal-summary");for(let s of t.summary){let g=Ok(o,"li");g.textContent=$k(s),l.appendChild(g);}a.appendChild(l);}let c=Ok(o,"div","pptxv-ai-proposal-actions"),p=Ok(o,"button","pptxv-ai-proposal-btn is-accept");p.type="button",p.append(Zk(o,"check"),o.createTextNode(n("pptx.ai.accept"))),p.addEventListener("click",()=>i.accept(t.id));let m=Ok(o,"button","pptxv-ai-proposal-btn is-reject");return m.type="button",m.append(Zk(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=Ok(t,"div","pptxv-ai-header"),h=Ok(t,"span","pptxv-ai-title");h.textContent=i("pptx.ai.title");let x=Ok(t,"button","pptxv-ai-close");x.type="button",x.title=i("pptx.ai.close"),x.setAttribute("aria-label",i("pptx.ai.close")),x.appendChild(Zk(t,"close")),x.addEventListener("click",()=>o.onClose?.()),a.append(Zk(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=Ok(t,"div","pptxv-ai-messages");l.setAttribute("role","log"),l.setAttribute("aria-live","polite");let s=Ok(t,"div","pptxv-ai-empty");s.textContent=i("pptx.ai.emptyHint"),l.appendChild(s);let g=Ok(t,"div","pptxv-ai-proposals");g.hidden=true;let f=Ok(t,"div","pptxv-ai-error");f.setAttribute("role","alert"),f.hidden=true;let C=Ok(t,"form","pptxv-ai-composer"),d=Ok(t,"textarea","pptxv-ai-input");d.rows=2,d.placeholder=i("pptx.ai.placeholder"),d.setAttribute("aria-label",i("pptx.ai.placeholder"));let y=Ok(t,"button","pptxv-ai-send");y.type="submit",y.setAttribute("aria-label",i("pptx.ai.send")),y.appendChild(Zk(t,"send")),C.append(d,y),n.append(a,...m?[m.el]:[],l,g,f,C);try{c=await(o.createChat??el)({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:cl(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=>fl(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=jl(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 {Ok,Zk,el,cl,dl,fl,jl,Jk,Kk,Lk,il,hl,gl,$k}from'./chunk-F3X63X7H.js';import'./chunk-WOT6VMZA.js';function K(o){let{doc:t,t:n,controller:i}=o,a=Ok(t,"div","pptxv-ai-focus"),h=(p,m,l)=>{let s=Ok(t,"button","pptxv-ai-focus-btn");return s.type="button",s.title=m,s.setAttribute("aria-label",m),s.appendChild(Zk(t,p)),s.addEventListener("click",l),s},x=()=>{a.replaceChildren();let p=i.getEffectiveTargets(),m=i.hasPicks(),l=i.isPinned(),s=i.isPicking(),g=Ok(t,"div","pptxv-ai-focus-row"),f=Ok(t,"span","pptxv-ai-focus-label");f.textContent=n("pptx.ai.focusScope"),g.appendChild(f);for(let r of Jk(p,o.getSlides())){let b=Ok(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=Ok(t,"span","pptxv-ai-focus-pinned");r.textContent=n("pptx.ai.pinnedFocus"),g.appendChild(r);}let C=Ok(t,"div","pptxv-ai-focus-actions"),d=Kk(p,o.getSlides());if(d){let r=Ok(t,"button","pptxv-ai-focus-merge");r.type="button",r.append(Zk(t,"git-merge"),t.createTextNode(n("pptx.ai.mergeSelectedTables"))),r.addEventListener("click",()=>o.onSendDirective(Lk(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=Ok(t,"div","pptxv-ai-focus-pick"),b=Zk(t,"crosshair");b.classList.add("pptxv-ai-focus-pick-icon");let k=Ok(t,"span","pptxv-ai-focus-pick-hint");k.textContent=n("pptx.ai.pickElementHint");let T=Ok(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=Ok(t,"button","pptxv-ai-chats");i.type="button",i.append(Zk(t,"history"),t.createTextNode(n("pptx.ai.chats")));let a=Ok(t,"div","pptxv-ai-history");a.hidden=true;let h=Ok(t,"div","pptxv-ai-history-head"),x=Ok(t,"span","pptxv-ai-history-title");x.textContent=n("pptx.ai.historyTitle");let c=Ok(t,"button","pptxv-ai-history-new");c.type="button",c.append(Zk(t,"plus"),t.createTextNode(n("pptx.ai.newChat"))),h.append(x,c);let p=Ok(t,"div","pptxv-ai-history-body"),m=Ok(t,"p","pptxv-ai-history-hint");m.textContent=n("pptx.ai.historyHint"),a.append(h,p,m);let l=dl({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=Ok(t,"p","pptxv-ai-history-empty");d.textContent=n("pptx.ai.historyEmpty"),p.appendChild(d);return}let C=Ok(t,"ul","pptxv-ai-history-list");for(let d of f){let y=Ok(t,"li","pptxv-ai-history-row"),r=Ok(t,"button","pptxv-ai-history-resume");r.type="button",r.classList.toggle("is-active",d.id===l.activeChatId());let b=Ok(t,"span","pptxv-ai-history-text"),k=Ok(t,"span","pptxv-ai-history-name");k.textContent=d.title||n("pptx.ai.untitledChat");let T=Ok(t,"span","pptxv-ai-history-meta");T.textContent=n("pptx.ai.messageCount",{count:d.messageCount}),b.append(k,T),r.append(Zk(t,"comment"),b),r.addEventListener("click",()=>{l.resumeChat(d.id),a.hidden=true;});let P=Ok(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(Zk(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=il(t.toolName,t.input,h?"present":"past"),c=Ok(o,"div","pptxv-ai-tool"),p=Ok(o,"div","pptxv-ai-tool-head"),m=Zk(o,_[x.icon]??"wrench");m.classList.add("pptxv-ai-tool-icon");let l=Ok(o,"span","pptxv-ai-tool-name");l.textContent=x.label;let s=Ok(o,"span","pptxv-ai-tool-state");if(i?(s.classList.add("is-error"),s.append(Zk(o,"alert"),o.createTextNode(n("pptx.ai.toolFailed")))):a?(s.classList.add("is-done"),s.append(Zk(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=Ok(o,"div","pptxv-ai-tool-error");f.textContent=t.errorText,c.appendChild(f);}let g=hl(t.input);if(g){let f=Ok(o,"details","pptxv-ai-tool-details"),C=Ok(o,"summary");C.textContent=n("pptx.ai.toolDetails");let d=Ok(o,"div","pptxv-ai-tool-raw");d.textContent=`${gl(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=fl(a);if(x.length===0&&!h)continue;let c=Ok(o,"div",`pptxv-ai-msg pptxv-ai-msg-${a.role}`),p=Ok(o,"div","pptxv-ai-msg-avatar");p.setAttribute("aria-label",i(h?"pptx.ai.you":"pptx.ai.assistant")),p.appendChild(Zk(o,h?"comment":"sparkles"));let m=Ok(o,"div","pptxv-ai-msg-body");for(let l of x)if(l.kind==="text"){let s=Ok(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=Ok(o,"div","pptxv-ai-proposals-header"),x=Ok(o,"span","pptxv-ai-proposals-title");if(x.textContent=i("pptx.ai.pendingChanges",{count:n.length}),h.appendChild(x),n.length>1){let c=Ok(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=Ok(o,"div","pptxv-ai-proposal");a.dataset.proposalId=t.id;let h=Ok(o,"div","pptxv-ai-proposal-eyebrow");h.textContent=n("pptx.ai.proposedChange"),a.appendChild(h);let x=Ok(o,"div","pptxv-ai-proposal-label");if(x.textContent=t.label,a.appendChild(x),t.summary.length>0){let l=Ok(o,"ul","pptxv-ai-proposal-summary");for(let s of t.summary){let g=Ok(o,"li");g.textContent=$k(s),l.appendChild(g);}a.appendChild(l);}let c=Ok(o,"div","pptxv-ai-proposal-actions"),p=Ok(o,"button","pptxv-ai-proposal-btn is-accept");p.type="button",p.append(Zk(o,"check"),o.createTextNode(n("pptx.ai.accept"))),p.addEventListener("click",()=>i.accept(t.id));let m=Ok(o,"button","pptxv-ai-proposal-btn is-reject");return m.type="button",m.append(Zk(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=Ok(t,"div","pptxv-ai-header"),h=Ok(t,"span","pptxv-ai-title");h.textContent=i("pptx.ai.title");let x=Ok(t,"button","pptxv-ai-close");x.type="button",x.title=i("pptx.ai.close"),x.setAttribute("aria-label",i("pptx.ai.close")),x.appendChild(Zk(t,"close")),x.addEventListener("click",()=>o.onClose?.()),a.append(Zk(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=Ok(t,"div","pptxv-ai-messages");l.setAttribute("role","log"),l.setAttribute("aria-live","polite");let s=Ok(t,"div","pptxv-ai-empty");s.textContent=i("pptx.ai.emptyHint"),l.appendChild(s);let g=Ok(t,"div","pptxv-ai-proposals");g.hidden=true;let f=Ok(t,"div","pptxv-ai-error");f.setAttribute("role","alert"),f.hidden=true;let C=Ok(t,"form","pptxv-ai-composer"),d=Ok(t,"textarea","pptxv-ai-input");d.rows=2,d.placeholder=i("pptx.ai.placeholder"),d.setAttribute("aria-label",i("pptx.ai.placeholder"));let y=Ok(t,"button","pptxv-ai-send");y.type="submit",y.setAttribute("aria-label",i("pptx.ai.send")),y.appendChild(Zk(t,"send")),C.append(d,y),n.append(a,...m?[m.el]:[],l,g,f,C);try{c=await(o.createChat??el)({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:cl(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=>fl(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=jl(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};