Files
open-kimi-ppt-skill/editor/neo-ppt/assets/Presenter-legacy-B8Wyep6G.js
T

1 line
5.0 KiB
JavaScript

System.register(["./vue-legacy-BnJhYd-u.js","./_plugin-vue_export-helper-legacy-DNBbTZ02.js","./index-legacy-Ce-qKpT_.js","./ThumbnailSlide-legacy-CSXTq44l.js","./Screen-legacy-BPLZWaTX.js","./usePPTDTitle-legacy-BtadEyXI.js"],function(e,t){var n,a,r,s,o,i,l,c,u,d,v,p,g,y,f,m,w,h,b,x,L,E,I,P,k,T,j,S,_;return{setters:[function(e){n=e.H,a=e.J,r=e.K,s=e.Nt,o=e.Tt,i=e.U,l=e.W,c=e.Y,u=e.Z,d=e.at,v=e.ct,p=e.k,g=e.kt,y=e.ot,f=e.vt},function(e){m=e.t},function(e){w=e.B,h=e.I,b=e.L,x=e.v},function(e){L=e.ot},function(e){E=e.i,I=e.t},function(e){P=e.t}],execute:function(){(k=document.createElement("style")).textContent=".presenter-page[data-v-65fc3c19]{background:var(--Bg-Secondary);width:100vw;height:100vh;color:var(--Labels-Primary);justify-content:center;align-items:center;display:flex}.presenter-panel[data-v-65fc3c19]{box-sizing:border-box;flex-direction:column;justify-content:center;align-items:center;gap:14px;width:100%;height:100%;display:flex}.presenter-start-button[data-v-65fc3c19]{background:var(--Labels-Secondary);color:#fff;cursor:pointer;border:none;justify-content:center;align-items:center;gap:10px;width:100%;height:100%;padding:0 28px;font-size:18px;font-weight:600;line-height:24px;transition:background-color .18s,opacity .18s,transform .18s;display:inline-flex}.presenter-start-button[data-v-65fc3c19]:hover:not(:disabled){background:var(--Labels-Primary)}.presenter-start-button[data-v-65fc3c19]:disabled{opacity:.45;cursor:not-allowed}.presenter-start-icon[data-v-65fc3c19]{justify-content:center;align-items:center;display:flex}\n/*$vite$:1*/",document.head.appendChild(k),T={key:1,class:"presenter-page"},j={class:"presenter-panel"},S=["disabled"],_={class:"presenter-start-icon"},e("default",m(u({__name:"Presenter",setup(e){const t=p(),{t:u}=b(),{restorePPTD:m,setCurrentPage:k,meta:C,pageOrder:O}=L(),{setPPTDTitle:q}=P(),D=o(!1),J=o(!1),N=o(!1),z=o(),B=o(0);let M=null,W=null;const $=n(()=>{const e=t.query.sessionId;return"string"==typeof e?e:""}),H=n(()=>!!$.value&&!!window.opener);(()=>{const e=w(t.query.lang)??w(t.query.locale)??null;e&&h(e)})(),f(()=>C.value.title,e=>q(e),{immediate:!0});const K=e=>{if(W)try{W.send(JSON.stringify(e))}catch{}else window.opener?.postMessage(e,window.location.origin)},U=()=>{M&&(clearTimeout(M),M=null)},V=()=>{$.value&&(window.opener||W)&&K({type:"connect-failed",source:"presenter",sessionId:$.value}),window.close()},Y=e=>{const t=O.value.includes(e.pageId)?e.pageId:O.value[e.index];if(!t)return;const n=O.value.indexOf(t);z.value=t,B.value=-1===n?0:n,k(t)},Z=e=>{if($.value&&e.sessionId===$.value&&"editor"===e.source)switch(e.type){case"snapshot":U(),m(e.pptd),D.value=!0,Y(e.page),N.value&&(J.value=!0);break;case"content-sync":(e=>{const t=z.value,n=B.value;m(e),D.value=!0;const a=Math.min(n,O.value.length-1),r=t&&O.value.includes(t)?t:O.value[a];if(!r)return z.value=void 0,void(B.value=0);const s=O.value.indexOf(r);z.value=r,B.value=-1===s?0:s,k(r)})(e.pptd);break;case"page-change":Y(e.page);break;case"close":J.value=!1,window.close()}},A=e=>{e.origin===window.location.origin&&(window.opener&&e.source!==window.opener||Z(e.data))},F=e=>{const t=(e=>{if("string"==typeof e)try{return JSON.parse(e)}catch{return null}return"object"==typeof e&&null!==e?e:null})(e.data);t&&Z(t)},G=()=>{window.close()},Q=e=>{W=e,N.value=!0,W.addEventListener("message",F),W.addEventListener("close",G),W.addEventListener("terminate",G),K({type:"presenter-ready",source:"presenter",sessionId:$.value}),M=setTimeout(()=>{D.value||V()},3e3)},R=async()=>{const e=navigator.presentation?.receiver;if(!e)return!1;const t=await e.connectionList,n=t.connections[0];return n?(Q(n),!0):new Promise(e=>{const n=setTimeout(()=>{t.removeEventListener("connectionavailable",a),e(!1)},3e3),a=r=>{clearTimeout(n),t.removeEventListener("connectionavailable",a),Q(r.connection),e(!0)};t.addEventListener("connectionavailable",a)})},X=async()=>{if(!D.value)return;const e=O.value[0];e&&ee({pageId:e,index:0});try{await E()}catch{}J.value=!0},ee=e=>{$.value&&(Y(e),K({type:"page-change",source:"presenter",sessionId:$.value,page:e}))},te=()=>{N.value?(()=>{$.value&&K({type:"close",source:"presenter",sessionId:$.value});try{W?.close()}catch{}window.close()})():J.value=!1};return y(async()=>{if(H.value)return window.addEventListener("message",A),K({type:"presenter-ready",source:"presenter",sessionId:$.value}),void(M=setTimeout(()=>{D.value||V()},3e3));await R()||V()}),d(()=>{window.removeEventListener("message",A),U(),$.value&&K({type:"close",source:"presenter",sessionId:$.value}),W&&(W.removeEventListener("message",F),W.removeEventListener("close",G),W.removeEventListener("terminate",G),W=null)}),(e,t)=>J.value&&D.value?(v(),l(I,{key:0,"start-index":B.value,"current-page-id":z.value,"auto-fullscreen":!1,onPageChange:ee,onExit:te},null,8,["start-index","current-page-id"])):(v(),r("div",T,[i("div",j,[i("button",{type:"button",class:"presenter-start-button",disabled:!D.value,onClick:X},[i("span",_,[c(g(x),{name:"Play",height:24})]),a(" "+s(g(u)("presenter.start")),1)],8,S)])]))}}),[["__scopeId","data-v-65fc3c19"]]))}}});