pptx-vanilla-viewer 2.7.0 → 2.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +21 -0
- package/dist/ai-panel-OJWWPQW3.cjs +1 -0
- package/dist/{ai-panel-AUKGON6W.js → ai-panel-P3F5MPDN.js} +1 -1
- package/dist/chunk-H54T5LVL.js +2579 -0
- package/dist/chunk-O224FLRL.cjs +2579 -0
- package/dist/index.cjs +123 -70
- package/dist/index.d.ts +675 -84
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +123 -70
- package/dist/smartart-3d-4XR267AX.cjs +1 -0
- package/dist/smartart-3d-5ELDYNIY.js +1 -0
- package/dist/styles.css +53 -0
- package/package.json +2 -2
- package/dist/ai-panel-AUEUQB4P.cjs +0 -1
- package/dist/chunk-GH6VDNPP.js +0 -2466
- package/dist/chunk-HTQCNJMD.cjs +0 -2466
- package/dist/smartart-3d-KGBJA3DV.js +0 -1
- package/dist/smartart-3d-OMEUBRBB.cjs +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,27 @@ 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.8.0](https://github.com/ChristopherVR/pptx-viewer/releases/tag/pptx-vanilla-viewer@2.8.0) - 2026-09-05
|
|
11
|
+
|
|
12
|
+
### Features
|
|
13
|
+
|
|
14
|
+
- **core:** Openxml parity wave 4/5 (table styles, userShapes, alt text, bldLst) (by @ChristopherVR) ([bfd2af8](https://github.com/ChristopherVR/pptx-viewer/commit/bfd2af899ea78a50e88762a3278756b9c7bcf8b5))
|
|
15
|
+
- **shared:** Parity wave 4/5 decision modules for all five bindings (by @ChristopherVR) ([16c6147](https://github.com/ChristopherVR/pptx-viewer/commit/16c61473d8ac16c396a1fab347afb9ab98879b6b))
|
|
16
|
+
- **vanilla:** Parity wave 4/5 (accessibility, table styles, chart runs, save options) (by @ChristopherVR) ([c3b380d](https://github.com/ChristopherVR/pptx-viewer/commit/c3b380ddb414a11e1a4b3fd98c6b2347ec4f3589))
|
|
17
|
+
|
|
18
|
+
## [2.7.0](https://github.com/ChristopherVR/pptx-viewer/releases/tag/pptx-vanilla-viewer@2.7.0) - 2026-09-05
|
|
19
|
+
|
|
20
|
+
### Features
|
|
21
|
+
|
|
22
|
+
- **core:** Wave-3 OpenXML parity (chart formatting, table styles, theme refs) (by @ChristopherVR) ([1da1637](https://github.com/ChristopherVR/pptx-viewer/commit/1da163776cf7694488a24f9074ed6bc5180c0d77))
|
|
23
|
+
- **shared:** Wave-3 playback, reveal, chart render and theme swatch logic (by @ChristopherVR) ([52e2a16](https://github.com/ChristopherVR/pptx-viewer/commit/52e2a16b3fb5efb6ebbb946e214ed45b899f4519))
|
|
24
|
+
- **vanilla:** Wave-3 parity (staged SmartArt reveal, theme swatches, u=words) (by @ChristopherVR) ([2099fc6](https://github.com/ChristopherVR/pptx-viewer/commit/2099fc63739a6d4020cef827e4a7e685f6cecb52))
|
|
25
|
+
- **shared:** Extract p:seq nextAc="seek" click handling (by @ChristopherVR) ([66e293b](https://github.com/ChristopherVR/pptx-viewer/commit/66e293bad91b1a2055df31cafae785fe958b87ea))
|
|
26
|
+
|
|
27
|
+
### Bug Fixes
|
|
28
|
+
|
|
29
|
+
- **vanilla:** Honour p:seq nextAc="seek" on a mid-flight click (by @ChristopherVR) ([91fb0e8](https://github.com/ChristopherVR/pptx-viewer/commit/91fb0e8689d8b36eef87a78e63491abb1031045a))
|
|
30
|
+
|
|
10
31
|
## [2.6.0](https://github.com/ChristopherVR/pptx-viewer/releases/tag/pptx-vanilla-viewer@2.6.0) - 2026-09-05
|
|
11
32
|
|
|
12
33
|
### Features
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var chunkO224FLRL_cjs=require('./chunk-O224FLRL.cjs');require('./chunk-B5PFHICE.cjs');function K(o){let{doc:t,t:n,controller:i}=o,a=chunkO224FLRL_cjs.Fn(t,"div","pptxv-ai-focus"),h=(p,m,l)=>{let s=chunkO224FLRL_cjs.Fn(t,"button","pptxv-ai-focus-btn");return s.type="button",s.title=m,s.setAttribute("aria-label",m),s.appendChild(chunkO224FLRL_cjs.Sn(t,p)),s.addEventListener("click",l),s},x=()=>{a.replaceChildren();let p=i.getEffectiveTargets(),m=i.hasPicks(),l=i.isPinned(),s=i.isPicking(),g=chunkO224FLRL_cjs.Fn(t,"div","pptxv-ai-focus-row"),f=chunkO224FLRL_cjs.Fn(t,"span","pptxv-ai-focus-label");f.textContent=n("pptx.ai.focusScope"),g.appendChild(f);for(let r of chunkO224FLRL_cjs.sn(p,o.getSlides())){let b=chunkO224FLRL_cjs.Fn(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=chunkO224FLRL_cjs.Fn(t,"span","pptxv-ai-focus-pinned");r.textContent=n("pptx.ai.pinnedFocus"),g.appendChild(r);}let C=chunkO224FLRL_cjs.Fn(t,"div","pptxv-ai-focus-actions"),d=chunkO224FLRL_cjs.tn(p,o.getSlides());if(d){let r=chunkO224FLRL_cjs.Fn(t,"button","pptxv-ai-focus-merge");r.type="button",r.append(chunkO224FLRL_cjs.Sn(t,"git-merge"),t.createTextNode(n("pptx.ai.mergeSelectedTables"))),r.addEventListener("click",()=>o.onSendDirective(chunkO224FLRL_cjs.un(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=chunkO224FLRL_cjs.Fn(t,"div","pptxv-ai-focus-pick"),b=chunkO224FLRL_cjs.Sn(t,"crosshair");b.classList.add("pptxv-ai-focus-pick-icon");let k=chunkO224FLRL_cjs.Fn(t,"span","pptxv-ai-focus-pick-hint");k.textContent=n("pptx.ai.pickElementHint");let T=chunkO224FLRL_cjs.Fn(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=chunkO224FLRL_cjs.Fn(t,"button","pptxv-ai-chats");i.type="button",i.append(chunkO224FLRL_cjs.Sn(t,"history"),t.createTextNode(n("pptx.ai.chats")));let a=chunkO224FLRL_cjs.Fn(t,"div","pptxv-ai-history");a.hidden=true;let h=chunkO224FLRL_cjs.Fn(t,"div","pptxv-ai-history-head"),x=chunkO224FLRL_cjs.Fn(t,"span","pptxv-ai-history-title");x.textContent=n("pptx.ai.historyTitle");let c=chunkO224FLRL_cjs.Fn(t,"button","pptxv-ai-history-new");c.type="button",c.append(chunkO224FLRL_cjs.Sn(t,"plus"),t.createTextNode(n("pptx.ai.newChat"))),h.append(x,c);let p=chunkO224FLRL_cjs.Fn(t,"div","pptxv-ai-history-body"),m=chunkO224FLRL_cjs.Fn(t,"p","pptxv-ai-history-hint");m.textContent=n("pptx.ai.historyHint"),a.append(h,p,m);let l=chunkO224FLRL_cjs.wn({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=chunkO224FLRL_cjs.Fn(t,"p","pptxv-ai-history-empty");d.textContent=n("pptx.ai.historyEmpty"),p.appendChild(d);return}let C=chunkO224FLRL_cjs.Fn(t,"ul","pptxv-ai-history-list");for(let d of f){let y=chunkO224FLRL_cjs.Fn(t,"li","pptxv-ai-history-row"),r=chunkO224FLRL_cjs.Fn(t,"button","pptxv-ai-history-resume");r.type="button",r.classList.toggle("is-active",d.id===l.activeChatId());let b=chunkO224FLRL_cjs.Fn(t,"span","pptxv-ai-history-text"),k=chunkO224FLRL_cjs.Fn(t,"span","pptxv-ai-history-name");k.textContent=d.title||n("pptx.ai.untitledChat");let T=chunkO224FLRL_cjs.Fn(t,"span","pptxv-ai-history-meta");T.textContent=n("pptx.ai.messageCount",{count:d.messageCount}),b.append(k,T),r.append(chunkO224FLRL_cjs.Sn(t,"comment"),b),r.addEventListener("click",()=>{l.resumeChat(d.id),a.hidden=true;});let P=chunkO224FLRL_cjs.Fn(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(chunkO224FLRL_cjs.Sn(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=chunkO224FLRL_cjs.Bn(t.toolName,t.input,h?"present":"past"),c=chunkO224FLRL_cjs.Fn(o,"div","pptxv-ai-tool"),p=chunkO224FLRL_cjs.Fn(o,"div","pptxv-ai-tool-head"),m=chunkO224FLRL_cjs.Sn(o,_[x.icon]??"wrench");m.classList.add("pptxv-ai-tool-icon");let l=chunkO224FLRL_cjs.Fn(o,"span","pptxv-ai-tool-name");l.textContent=x.label;let s=chunkO224FLRL_cjs.Fn(o,"span","pptxv-ai-tool-state");if(i?(s.classList.add("is-error"),s.append(chunkO224FLRL_cjs.Sn(o,"alert"),o.createTextNode(n("pptx.ai.toolFailed")))):a?(s.classList.add("is-done"),s.append(chunkO224FLRL_cjs.Sn(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=chunkO224FLRL_cjs.Fn(o,"div","pptxv-ai-tool-error");f.textContent=t.errorText,c.appendChild(f);}let g=chunkO224FLRL_cjs.An(t.input);if(g){let f=chunkO224FLRL_cjs.Fn(o,"details","pptxv-ai-tool-details"),C=chunkO224FLRL_cjs.Fn(o,"summary");C.textContent=n("pptx.ai.toolDetails");let d=chunkO224FLRL_cjs.Fn(o,"div","pptxv-ai-tool-raw");d.textContent=`${chunkO224FLRL_cjs.zn(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=chunkO224FLRL_cjs.on(a);if(x.length===0&&!h)continue;let c=chunkO224FLRL_cjs.Fn(o,"div",`pptxv-ai-msg pptxv-ai-msg-${a.role}`),p=chunkO224FLRL_cjs.Fn(o,"div","pptxv-ai-msg-avatar");p.setAttribute("aria-label",i(h?"pptx.ai.you":"pptx.ai.assistant")),p.appendChild(chunkO224FLRL_cjs.Sn(o,h?"comment":"sparkles"));let m=chunkO224FLRL_cjs.Fn(o,"div","pptxv-ai-msg-body");for(let l of x)if(l.kind==="text"){let s=chunkO224FLRL_cjs.Fn(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=chunkO224FLRL_cjs.Fn(o,"div","pptxv-ai-proposals-header"),x=chunkO224FLRL_cjs.Fn(o,"span","pptxv-ai-proposals-title");if(x.textContent=i("pptx.ai.pendingChanges",{count:n.length}),h.appendChild(x),n.length>1){let c=chunkO224FLRL_cjs.Fn(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=chunkO224FLRL_cjs.Fn(o,"div","pptxv-ai-proposal");a.dataset.proposalId=t.id;let h=chunkO224FLRL_cjs.Fn(o,"div","pptxv-ai-proposal-eyebrow");h.textContent=n("pptx.ai.proposedChange"),a.appendChild(h);let x=chunkO224FLRL_cjs.Fn(o,"div","pptxv-ai-proposal-label");if(x.textContent=t.label,a.appendChild(x),t.summary.length>0){let l=chunkO224FLRL_cjs.Fn(o,"ul","pptxv-ai-proposal-summary");for(let s of t.summary){let g=chunkO224FLRL_cjs.Fn(o,"li");g.textContent=chunkO224FLRL_cjs.ln(s),l.appendChild(g);}a.appendChild(l);}let c=chunkO224FLRL_cjs.Fn(o,"div","pptxv-ai-proposal-actions"),p=chunkO224FLRL_cjs.Fn(o,"button","pptxv-ai-proposal-btn is-accept");p.type="button",p.append(chunkO224FLRL_cjs.Sn(o,"check"),o.createTextNode(n("pptx.ai.accept"))),p.addEventListener("click",()=>i.accept(t.id));let m=chunkO224FLRL_cjs.Fn(o,"button","pptxv-ai-proposal-btn is-reject");return m.type="button",m.append(chunkO224FLRL_cjs.Sn(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=chunkO224FLRL_cjs.Fn(t,"div","pptxv-ai-header"),h=chunkO224FLRL_cjs.Fn(t,"span","pptxv-ai-title");h.textContent=i("pptx.ai.title");let x=chunkO224FLRL_cjs.Fn(t,"button","pptxv-ai-close");x.type="button",x.title=i("pptx.ai.close"),x.setAttribute("aria-label",i("pptx.ai.close")),x.appendChild(chunkO224FLRL_cjs.Sn(t,"close")),x.addEventListener("click",()=>o.onClose?.()),a.append(chunkO224FLRL_cjs.Sn(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=chunkO224FLRL_cjs.Fn(t,"div","pptxv-ai-messages");l.setAttribute("role","log"),l.setAttribute("aria-live","polite");let s=chunkO224FLRL_cjs.Fn(t,"div","pptxv-ai-empty");s.textContent=i("pptx.ai.emptyHint"),l.appendChild(s);let g=chunkO224FLRL_cjs.Fn(t,"div","pptxv-ai-proposals");g.hidden=true;let f=chunkO224FLRL_cjs.Fn(t,"div","pptxv-ai-error");f.setAttribute("role","alert"),f.hidden=true;let C=chunkO224FLRL_cjs.Fn(t,"form","pptxv-ai-composer"),d=chunkO224FLRL_cjs.Fn(t,"textarea","pptxv-ai-input");d.rows=2,d.placeholder=i("pptx.ai.placeholder"),d.setAttribute("aria-label",i("pptx.ai.placeholder"));let y=chunkO224FLRL_cjs.Fn(t,"button","pptxv-ai-send");y.type="submit",y.setAttribute("aria-label",i("pptx.ai.send")),y.appendChild(chunkO224FLRL_cjs.Sn(t,"send")),C.append(d,y),n.append(a,...m?[m.el]:[],l,g,f,C);try{c=await(o.createChat??chunkO224FLRL_cjs.xn)({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:chunkO224FLRL_cjs.vn(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=>chunkO224FLRL_cjs.on(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=chunkO224FLRL_cjs.Cn(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 {bn,mn,Vm,Tm,Um,Mm,_m,Qm,Rm,Sm,Zm,Ym,Xm,Jm}from'./chunk-GH6VDNPP.js';import'./chunk-62D2TNHX.js';function K(o){let{doc:t,t:n,controller:i}=o,a=bn(t,"div","pptxv-ai-focus"),h=(p,m,l)=>{let s=bn(t,"button","pptxv-ai-focus-btn");return s.type="button",s.title=m,s.setAttribute("aria-label",m),s.appendChild(mn(t,p)),s.addEventListener("click",l),s},x=()=>{a.replaceChildren();let p=i.getEffectiveTargets(),m=i.hasPicks(),l=i.isPinned(),s=i.isPicking(),g=bn(t,"div","pptxv-ai-focus-row"),f=bn(t,"span","pptxv-ai-focus-label");f.textContent=n("pptx.ai.focusScope"),g.appendChild(f);for(let r of Qm(p,o.getSlides())){let b=bn(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=bn(t,"span","pptxv-ai-focus-pinned");r.textContent=n("pptx.ai.pinnedFocus"),g.appendChild(r);}let C=bn(t,"div","pptxv-ai-focus-actions"),d=Rm(p,o.getSlides());if(d){let r=bn(t,"button","pptxv-ai-focus-merge");r.type="button",r.append(mn(t,"git-merge"),t.createTextNode(n("pptx.ai.mergeSelectedTables"))),r.addEventListener("click",()=>o.onSendDirective(Sm(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=bn(t,"div","pptxv-ai-focus-pick"),b=mn(t,"crosshair");b.classList.add("pptxv-ai-focus-pick-icon");let k=bn(t,"span","pptxv-ai-focus-pick-hint");k.textContent=n("pptx.ai.pickElementHint");let T=bn(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=bn(t,"button","pptxv-ai-chats");i.type="button",i.append(mn(t,"history"),t.createTextNode(n("pptx.ai.chats")));let a=bn(t,"div","pptxv-ai-history");a.hidden=true;let h=bn(t,"div","pptxv-ai-history-head"),x=bn(t,"span","pptxv-ai-history-title");x.textContent=n("pptx.ai.historyTitle");let c=bn(t,"button","pptxv-ai-history-new");c.type="button",c.append(mn(t,"plus"),t.createTextNode(n("pptx.ai.newChat"))),h.append(x,c);let p=bn(t,"div","pptxv-ai-history-body"),m=bn(t,"p","pptxv-ai-history-hint");m.textContent=n("pptx.ai.historyHint"),a.append(h,p,m);let l=Um({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=bn(t,"p","pptxv-ai-history-empty");d.textContent=n("pptx.ai.historyEmpty"),p.appendChild(d);return}let C=bn(t,"ul","pptxv-ai-history-list");for(let d of f){let y=bn(t,"li","pptxv-ai-history-row"),r=bn(t,"button","pptxv-ai-history-resume");r.type="button",r.classList.toggle("is-active",d.id===l.activeChatId());let b=bn(t,"span","pptxv-ai-history-text"),k=bn(t,"span","pptxv-ai-history-name");k.textContent=d.title||n("pptx.ai.untitledChat");let T=bn(t,"span","pptxv-ai-history-meta");T.textContent=n("pptx.ai.messageCount",{count:d.messageCount}),b.append(k,T),r.append(mn(t,"comment"),b),r.addEventListener("click",()=>{l.resumeChat(d.id),a.hidden=true;});let P=bn(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(mn(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=Zm(t.toolName,t.input,h?"present":"past"),c=bn(o,"div","pptxv-ai-tool"),p=bn(o,"div","pptxv-ai-tool-head"),m=mn(o,_[x.icon]??"wrench");m.classList.add("pptxv-ai-tool-icon");let l=bn(o,"span","pptxv-ai-tool-name");l.textContent=x.label;let s=bn(o,"span","pptxv-ai-tool-state");if(i?(s.classList.add("is-error"),s.append(mn(o,"alert"),o.createTextNode(n("pptx.ai.toolFailed")))):a?(s.classList.add("is-done"),s.append(mn(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=bn(o,"div","pptxv-ai-tool-error");f.textContent=t.errorText,c.appendChild(f);}let g=Ym(t.input);if(g){let f=bn(o,"details","pptxv-ai-tool-details"),C=bn(o,"summary");C.textContent=n("pptx.ai.toolDetails");let d=bn(o,"div","pptxv-ai-tool-raw");d.textContent=`${Xm(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=Mm(a);if(x.length===0&&!h)continue;let c=bn(o,"div",`pptxv-ai-msg pptxv-ai-msg-${a.role}`),p=bn(o,"div","pptxv-ai-msg-avatar");p.setAttribute("aria-label",i(h?"pptx.ai.you":"pptx.ai.assistant")),p.appendChild(mn(o,h?"comment":"sparkles"));let m=bn(o,"div","pptxv-ai-msg-body");for(let l of x)if(l.kind==="text"){let s=bn(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=bn(o,"div","pptxv-ai-proposals-header"),x=bn(o,"span","pptxv-ai-proposals-title");if(x.textContent=i("pptx.ai.pendingChanges",{count:n.length}),h.appendChild(x),n.length>1){let c=bn(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=bn(o,"div","pptxv-ai-proposal");a.dataset.proposalId=t.id;let h=bn(o,"div","pptxv-ai-proposal-eyebrow");h.textContent=n("pptx.ai.proposedChange"),a.appendChild(h);let x=bn(o,"div","pptxv-ai-proposal-label");if(x.textContent=t.label,a.appendChild(x),t.summary.length>0){let l=bn(o,"ul","pptxv-ai-proposal-summary");for(let s of t.summary){let g=bn(o,"li");g.textContent=Jm(s),l.appendChild(g);}a.appendChild(l);}let c=bn(o,"div","pptxv-ai-proposal-actions"),p=bn(o,"button","pptxv-ai-proposal-btn is-accept");p.type="button",p.append(mn(o,"check"),o.createTextNode(n("pptx.ai.accept"))),p.addEventListener("click",()=>i.accept(t.id));let m=bn(o,"button","pptxv-ai-proposal-btn is-reject");return m.type="button",m.append(mn(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=bn(t,"div","pptxv-ai-header"),h=bn(t,"span","pptxv-ai-title");h.textContent=i("pptx.ai.title");let x=bn(t,"button","pptxv-ai-close");x.type="button",x.title=i("pptx.ai.close"),x.setAttribute("aria-label",i("pptx.ai.close")),x.appendChild(mn(t,"close")),x.addEventListener("click",()=>o.onClose?.()),a.append(mn(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=bn(t,"div","pptxv-ai-messages");l.setAttribute("role","log"),l.setAttribute("aria-live","polite");let s=bn(t,"div","pptxv-ai-empty");s.textContent=i("pptx.ai.emptyHint"),l.appendChild(s);let g=bn(t,"div","pptxv-ai-proposals");g.hidden=true;let f=bn(t,"div","pptxv-ai-error");f.setAttribute("role","alert"),f.hidden=true;let C=bn(t,"form","pptxv-ai-composer"),d=bn(t,"textarea","pptxv-ai-input");d.rows=2,d.placeholder=i("pptx.ai.placeholder"),d.setAttribute("aria-label",i("pptx.ai.placeholder"));let y=bn(t,"button","pptxv-ai-send");y.type="submit",y.setAttribute("aria-label",i("pptx.ai.send")),y.appendChild(mn(t,"send")),C.append(d,y),n.append(a,...m?[m.el]:[],l,g,f,C);try{c=await(o.createChat??Vm)({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:Tm(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=>Mm(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=_m(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 {Fn,Sn,xn,vn,wn,on,Cn,sn,tn,un,Bn,An,zn,ln}from'./chunk-H54T5LVL.js';import'./chunk-62D2TNHX.js';function K(o){let{doc:t,t:n,controller:i}=o,a=Fn(t,"div","pptxv-ai-focus"),h=(p,m,l)=>{let s=Fn(t,"button","pptxv-ai-focus-btn");return s.type="button",s.title=m,s.setAttribute("aria-label",m),s.appendChild(Sn(t,p)),s.addEventListener("click",l),s},x=()=>{a.replaceChildren();let p=i.getEffectiveTargets(),m=i.hasPicks(),l=i.isPinned(),s=i.isPicking(),g=Fn(t,"div","pptxv-ai-focus-row"),f=Fn(t,"span","pptxv-ai-focus-label");f.textContent=n("pptx.ai.focusScope"),g.appendChild(f);for(let r of sn(p,o.getSlides())){let b=Fn(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=Fn(t,"span","pptxv-ai-focus-pinned");r.textContent=n("pptx.ai.pinnedFocus"),g.appendChild(r);}let C=Fn(t,"div","pptxv-ai-focus-actions"),d=tn(p,o.getSlides());if(d){let r=Fn(t,"button","pptxv-ai-focus-merge");r.type="button",r.append(Sn(t,"git-merge"),t.createTextNode(n("pptx.ai.mergeSelectedTables"))),r.addEventListener("click",()=>o.onSendDirective(un(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=Fn(t,"div","pptxv-ai-focus-pick"),b=Sn(t,"crosshair");b.classList.add("pptxv-ai-focus-pick-icon");let k=Fn(t,"span","pptxv-ai-focus-pick-hint");k.textContent=n("pptx.ai.pickElementHint");let T=Fn(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=Fn(t,"button","pptxv-ai-chats");i.type="button",i.append(Sn(t,"history"),t.createTextNode(n("pptx.ai.chats")));let a=Fn(t,"div","pptxv-ai-history");a.hidden=true;let h=Fn(t,"div","pptxv-ai-history-head"),x=Fn(t,"span","pptxv-ai-history-title");x.textContent=n("pptx.ai.historyTitle");let c=Fn(t,"button","pptxv-ai-history-new");c.type="button",c.append(Sn(t,"plus"),t.createTextNode(n("pptx.ai.newChat"))),h.append(x,c);let p=Fn(t,"div","pptxv-ai-history-body"),m=Fn(t,"p","pptxv-ai-history-hint");m.textContent=n("pptx.ai.historyHint"),a.append(h,p,m);let l=wn({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=Fn(t,"p","pptxv-ai-history-empty");d.textContent=n("pptx.ai.historyEmpty"),p.appendChild(d);return}let C=Fn(t,"ul","pptxv-ai-history-list");for(let d of f){let y=Fn(t,"li","pptxv-ai-history-row"),r=Fn(t,"button","pptxv-ai-history-resume");r.type="button",r.classList.toggle("is-active",d.id===l.activeChatId());let b=Fn(t,"span","pptxv-ai-history-text"),k=Fn(t,"span","pptxv-ai-history-name");k.textContent=d.title||n("pptx.ai.untitledChat");let T=Fn(t,"span","pptxv-ai-history-meta");T.textContent=n("pptx.ai.messageCount",{count:d.messageCount}),b.append(k,T),r.append(Sn(t,"comment"),b),r.addEventListener("click",()=>{l.resumeChat(d.id),a.hidden=true;});let P=Fn(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(Sn(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=Bn(t.toolName,t.input,h?"present":"past"),c=Fn(o,"div","pptxv-ai-tool"),p=Fn(o,"div","pptxv-ai-tool-head"),m=Sn(o,_[x.icon]??"wrench");m.classList.add("pptxv-ai-tool-icon");let l=Fn(o,"span","pptxv-ai-tool-name");l.textContent=x.label;let s=Fn(o,"span","pptxv-ai-tool-state");if(i?(s.classList.add("is-error"),s.append(Sn(o,"alert"),o.createTextNode(n("pptx.ai.toolFailed")))):a?(s.classList.add("is-done"),s.append(Sn(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=Fn(o,"div","pptxv-ai-tool-error");f.textContent=t.errorText,c.appendChild(f);}let g=An(t.input);if(g){let f=Fn(o,"details","pptxv-ai-tool-details"),C=Fn(o,"summary");C.textContent=n("pptx.ai.toolDetails");let d=Fn(o,"div","pptxv-ai-tool-raw");d.textContent=`${zn(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=on(a);if(x.length===0&&!h)continue;let c=Fn(o,"div",`pptxv-ai-msg pptxv-ai-msg-${a.role}`),p=Fn(o,"div","pptxv-ai-msg-avatar");p.setAttribute("aria-label",i(h?"pptx.ai.you":"pptx.ai.assistant")),p.appendChild(Sn(o,h?"comment":"sparkles"));let m=Fn(o,"div","pptxv-ai-msg-body");for(let l of x)if(l.kind==="text"){let s=Fn(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=Fn(o,"div","pptxv-ai-proposals-header"),x=Fn(o,"span","pptxv-ai-proposals-title");if(x.textContent=i("pptx.ai.pendingChanges",{count:n.length}),h.appendChild(x),n.length>1){let c=Fn(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=Fn(o,"div","pptxv-ai-proposal");a.dataset.proposalId=t.id;let h=Fn(o,"div","pptxv-ai-proposal-eyebrow");h.textContent=n("pptx.ai.proposedChange"),a.appendChild(h);let x=Fn(o,"div","pptxv-ai-proposal-label");if(x.textContent=t.label,a.appendChild(x),t.summary.length>0){let l=Fn(o,"ul","pptxv-ai-proposal-summary");for(let s of t.summary){let g=Fn(o,"li");g.textContent=ln(s),l.appendChild(g);}a.appendChild(l);}let c=Fn(o,"div","pptxv-ai-proposal-actions"),p=Fn(o,"button","pptxv-ai-proposal-btn is-accept");p.type="button",p.append(Sn(o,"check"),o.createTextNode(n("pptx.ai.accept"))),p.addEventListener("click",()=>i.accept(t.id));let m=Fn(o,"button","pptxv-ai-proposal-btn is-reject");return m.type="button",m.append(Sn(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=Fn(t,"div","pptxv-ai-header"),h=Fn(t,"span","pptxv-ai-title");h.textContent=i("pptx.ai.title");let x=Fn(t,"button","pptxv-ai-close");x.type="button",x.title=i("pptx.ai.close"),x.setAttribute("aria-label",i("pptx.ai.close")),x.appendChild(Sn(t,"close")),x.addEventListener("click",()=>o.onClose?.()),a.append(Sn(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=Fn(t,"div","pptxv-ai-messages");l.setAttribute("role","log"),l.setAttribute("aria-live","polite");let s=Fn(t,"div","pptxv-ai-empty");s.textContent=i("pptx.ai.emptyHint"),l.appendChild(s);let g=Fn(t,"div","pptxv-ai-proposals");g.hidden=true;let f=Fn(t,"div","pptxv-ai-error");f.setAttribute("role","alert"),f.hidden=true;let C=Fn(t,"form","pptxv-ai-composer"),d=Fn(t,"textarea","pptxv-ai-input");d.rows=2,d.placeholder=i("pptx.ai.placeholder"),d.setAttribute("aria-label",i("pptx.ai.placeholder"));let y=Fn(t,"button","pptxv-ai-send");y.type="submit",y.setAttribute("aria-label",i("pptx.ai.send")),y.appendChild(Sn(t,"send")),C.append(d,y),n.append(a,...m?[m.el]:[],l,g,f,C);try{c=await(o.createChat??xn)({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:vn(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=>on(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=Cn(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};
|