efficient-office 0.7.0 → 0.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.
@@ -0,0 +1 @@
1
+ import{DECK_FONT as t,NO_FILL as e,SLIDE_H as n,SLIDE_W as r,newId as o}from"./chunk-PXOQN7D6.js";var i=t=>`M${t.map(([t,e])=>`${t},${e}`).join(" L")} Z`,a=(t,e,n,r=-Math.PI/2)=>i(Array.from({length:t},(o,i)=>{const a=r+2*i*Math.PI/t;return[e/2+e/2*Math.cos(a),n/2+n/2*Math.sin(a)]})),l={rect:(t,e)=>i([[0,0],[t,0],[t,e],[0,e]]),roundRect:(t,e,n)=>{const r=Math.min(n??Math.min(t,e)/6,t/2,e/2);return`M${r},0 H${t-r} A${r},${r} 0 0 1 ${t},${r} V${e-r} A${r},${r} 0 0 1 ${t-r},${e} H${r} A${r},${r} 0 0 1 0,${e-r} V${r} A${r},${r} 0 0 1 ${r},0 Z`},ellipse:(t,e)=>`M0,${e/2} A${t/2},${e/2} 0 1 1 ${t},${e/2} A${t/2},${e/2} 0 1 1 0,${e/2} Z`,triangle:(t,e)=>i([[t/2,0],[t,e],[0,e]]),rightTriangle:(t,e)=>i([[0,0],[t,e],[0,e]]),diamond:(t,e)=>i([[t/2,0],[t,e/2],[t/2,e],[0,e/2]]),pentagon:(t,e)=>a(5,t,e),hexagon:(t,e)=>a(6,t,e,0),octagon:(t,e)=>a(8,t,e,Math.PI/8),star:(t,e)=>i(Array.from({length:10},(n,r)=>{const o=-Math.PI/2+r*Math.PI/5,i=r%2==0?.5:.2;return[t/2+t*i*Math.cos(o),e/2+e*i*Math.sin(o)+.04*e]})),heart:(t,e)=>`M${t/2},${e} C${.1*t},${.7*e} 0,${.45*e} 0,${.28*e} C0,${.05*e} ${.25*t},0 ${.5*t},${.2*e} C${.75*t},0 ${t},${.05*e} ${t},${.28*e} C${t},${.45*e} ${.9*t},${.7*e} ${t/2},${e} Z`,cloud:(t,e)=>`M${.25*t},${.85*e} C${.05*t},${.85*e} 0,${.6*e} ${.12*t},${.5*e} C${.05*t},${.25*e} ${.3*t},${.15*e} ${.4*t},${.25*e} C${.45*t},${.05*e} ${.75*t},${.05*e} ${.75*t},${.3*e} C${.95*t},${.25*e} ${t},${.55*e} ${.88*t},${.65*e} C${t},${.8*e} ${.85*t},${.9*e} ${.72*t},${.85*e} Z`,bolt:(t,e)=>i([[.55*t,0],[.15*t,.55*e],[.45*t,.55*e],[.35*t,e],[.85*t,.4*e],[.55*t,.4*e],[.75*t,0]]),parallelogram:(t,e)=>i([[.25*t,0],[t,0],[.75*t,e],[0,e]]),trapezoid:(t,e)=>i([[.2*t,0],[.8*t,0],[t,e],[0,e]]),cylinder:(t,e)=>{const n=Math.min(.15*e,t/4);return`M0,${n} A${t/2},${n} 0 0 1 ${t},${n} V${e-n} A${t/2},${n} 0 0 1 0,${e-n} Z M0,${n} A${t/2},${n} 0 0 0 ${t},${n}`},plus:(t,e)=>{const n=t/3,r=e/3;return i([[n,0],[2*n,0],[2*n,r],[t,r],[t,2*r],[2*n,2*r],[2*n,e],[n,e],[n,2*r],[0,2*r],[0,r],[n,r]])},arrowRight:(t,e)=>i([[0,.25*e],[.6*t,.25*e],[.6*t,0],[t,e/2],[.6*t,e],[.6*t,.75*e],[0,.75*e]]),arrowLeft:(t,e)=>i([[t,.25*e],[.4*t,.25*e],[.4*t,0],[0,e/2],[.4*t,e],[.4*t,.75*e],[t,.75*e]]),arrowUp:(t,e)=>i([[.25*t,e],[.25*t,.4*e],[0,.4*e],[t/2,0],[t,.4*e],[.75*t,.4*e],[.75*t,e]]),arrowDown:(t,e)=>i([[.25*t,0],[.25*t,.6*e],[0,.6*e],[t/2,e],[t,.6*e],[.75*t,.6*e],[.75*t,0]]),arrowLeftRight:(t,e)=>i([[0,e/2],[.25*t,0],[.25*t,.25*e],[.75*t,.25*e],[.75*t,0],[t,e/2],[.75*t,e],[.75*t,.75*e],[.25*t,.75*e],[.25*t,e]]),chevron:(t,e)=>i([[0,0],[.7*t,0],[t,e/2],[.7*t,e],[0,e],[.3*t,e/2]]),callout:(t,e)=>i([[0,0],[t,0],[t,.75*e],[.4*t,.75*e],[.2*t,e],[.25*t,.75*e],[0,.75*e]]),calloutRound:(t,e)=>{const n=.12*Math.min(t,e),r=.75*e;return`M${n},0 H${t-n} A${n},${n} 0 0 1 ${t},${n} V${r-n} A${n},${n} 0 0 1 ${t-n},${r} H${.4*t} L${.2*t},${e} L${.25*t},${r} H${n} A${n},${n} 0 0 1 0,${r-n} V${n} A${n},${n} 0 0 1 ${n},0 Z`}};function s(t,e,n,r){return(l[t]??l.rect)(e,n,r)}var c={rect:"rect",roundRect:"roundRect",ellipse:"ellipse",triangle:"triangle",rightTriangle:"rtTriangle",diamond:"diamond",pentagon:"pentagon",hexagon:"hexagon",octagon:"octagon",star:"star5",heart:"heart",cloud:"cloud",bolt:"lightningBolt",parallelogram:"parallelogram",trapezoid:"trapezoid",cylinder:"can",plus:"plus",arrowRight:"rightArrow",arrowLeft:"leftArrow",arrowUp:"upArrow",arrowDown:"downArrow",arrowLeftRight:"leftRightArrow",chevron:"chevron",callout:"wedgeRectCallout",calloutRound:"wedgeRoundRectCallout",line:"line"},h=["bold","italic","underline","strike","color","highlight","size","font","link"];function u(t){return t.paragraphs&&t.paragraphs.length>0?t.paragraphs:t.text.split("\n").map(t=>({runs:[{text:t}]}))}function d(t){return t.map(t=>t.runs.map(t=>t.text).join("")).join("\n")}function f(t,e){const n=e.map(m);return{...t,paragraphs:n,text:d(n)}}var p=(t,e)=>h.every(n=>(t[n]??void 0)===(e[n]??void 0));function g(t){const e={};for(const n of h){const r=t[n];void 0!==r&&!1!==r&&""!==r&&(e[n]=r)}return e}function m(t){const e=[];for(const n of t.runs){const t=g(n),r=e[e.length-1];n.text&&(r&&p(g(r),t)?r.text+=n.text:e.push({text:n.text,...t}))}const n={};t.align&&"left"!==t.align&&(n.align=t.align),t.list&&(n.list=t.list),t.level&&(n.level=Math.max(0,Math.min(4,t.level))),t.lineHeight&&(n.lineHeight=t.lineHeight);const r=t.runs[0]?[{...g(t.runs[0]),text:""}]:[{text:""}];return{...n,runs:e.length>0?e:r}}function $(t){const e=[];let n=0;for(const r of t)e.push(n),n+=r.runs.reduce((t,e)=>t+e.text.length,0)+1;return e}function y(t,e,n,r){return function(t,e,n,r){const o=$(t);return t.map((t,i)=>{const a=o[i],l=t.runs.reduce((t,e)=>t+e.text.length,0),s=Math.max(e-a,0),c=Math.min(n-a,l);if(c<=s)return t;let h=0;const u=function(t,e,n){const r=[];let o=0;for(const i of t){const t=o+i.text.length,a=[e,n].filter(e=>e>o&&e<t).map(t=>t-o);let l=0;for(const t of[...a,i.text.length])t>l&&r.push({...i,text:i.text.slice(l,t)}),l=t;o=t}return r}(t.runs,s,c).map(t=>{const e=h>=s&&h+t.text.length<=c;return h+=t.text.length,e?r(t):t});return m({...t,runs:u})})}(t,e,n,t=>{const e={...t,...r};for(const t of h)void 0===e[t]&&delete e[t];return e})}function w(t,e,n){const r=[],o=$(t);if(t.forEach((t,i)=>{let a=o[i];for(const o of t.runs){const t=a+o.text.length;(e===n?e>a&&e<=t||e===a&&""===o.text:t>e&&a<n)&&r.push(g(o)),a=t}}),0===r.length){let n=0;o.forEach((t,r)=>{t<=e&&(n=r)}),r.push(g(t[n]?.runs[0]??{text:""}))}const i={};for(const t of h){const e=r[0][t];void 0!==e&&r.every(n=>n[t]===e)&&(i[t]=e)}return i}function x(t,e,n){const r=$(t);return t.map((t,e)=>e).filter(o=>r[o]+t[o].runs.reduce((t,e)=>t+e.text.length,0)>=e&&r[o]<=n)}function v(t,e,n,r){const o=new Set(x(t,e,n));return t.map((t,e)=>o.has(e)?m(r(t)):t)}function b(t,e,n,r){const o=x(t,e,n).every(e=>t[e].list===r);return v(t,e,n,t=>({...t,list:o?void 0:r}))}function M(t,e,n,r){return v(t,e,n,t=>({...t,level:Math.max(0,Math.min(4,(t.level??0)+r))}))}function k(t){const e=[];return t.map(t=>{const n=t.level??0;return e.length=n+1,"number"!==t.list?(t.list?e[n]=0:e.length=0,"bullet"===t.list?["•","◦","▪"][n%3]:null):(e[n]=(e[n]??0)+1,`${e[n]}.`)})}var S="data-run",C="data-paragraph",A=t=>t instanceof HTMLElement&&"false"===t.getAttribute("contenteditable");function I(t,e=[]){return A(t)||(t.nodeType===Node.TEXT_NODE?e.push(t):t.childNodes.forEach(t=>I(t,e))),e}var H=t=>I(t).reduce((t,e)=>t+e.data.replace(/\u200b/g,"").length,0);function j(t){const e=[...t.childNodes],n=[];let r=null;const o=(e,n)=>{if(!A(e))if(e.nodeType===Node.TEXT_NODE){const r=e.parentElement?.closest(`[${S}]`),o=r&&t.contains(r)?JSON.parse(r.getAttribute(S)||"{}"):{};n.push({...o,text:(e.textContent??"").replace(/​/g,"")})}else e.childNodes.forEach(t=>o(t,n))};for(const t of e){if(!(t instanceof HTMLElement&&(t.hasAttribute(C)||/^(DIV|P)$/.test(t.tagName)))){if(t instanceof HTMLElement&&"BR"===t.tagName){r=null;continue}r||(r={runs:[]},n.push(r)),o(t,r.runs);continue}r=null;const e=JSON.parse(t.getAttribute(C)||"{}"),i=[];o(t,i),n.push({...e,runs:i})}return(n.length>0?n:[{runs:[{text:""}]}]).map(m)}function z(t){const e=t.ownerDocument.getSelection();if(!e||0===e.rangeCount)return null;const n=e.getRangeAt(0);if(!t.contains(n.startContainer)||!t.contains(n.endContainer))return null;const r=(e,n)=>{const r=t.ownerDocument.createRange();r.setStart(t,0),r.setEnd(e,n);const o=[...t.childNodes];let i=0;return o.forEach((t,o)=>{if(r.intersectsNode(t)){o>0&&(i+=1);for(const o of I(t))o===e?i+=o.data.slice(0,n).replace(/\u200b/g,"").length:r.isPointInRange(o,o.data.length)&&(i+=o.data.replace(/\u200b/g,"").length)}}),i},o=r(n.startContainer,n.startOffset),i=r(n.endContainer,n.endOffset);return{start:Math.min(o,i),end:Math.max(o,i)}}function L(t,e,n){const r=e=>{const n=[...t.childNodes];let r=0;for(let t=0;t<n.length;t+=1){t>0&&(r+=1);const o=I(n[t]);if(e<=r+H(n[t])){let i=r;for(const t of o){const n=t.data.replace(/\u200b/g,"").length;if(e<=i+n)return[t,0===n?t.data.length:e-i];i+=n}return[n[t],n[t].childNodes.length]}r+=H(n[t])}return[t,t.childNodes.length]},o=t.ownerDocument.getSelection();if(!o)return;const i=t.ownerDocument.createRange(),[a,l]=r(e),[s,c]=r(n);i.setStart(a,l),i.setEnd(s,c),o.removeAllRanges(),o.addRange(i)}var E=24;function F(t,e){const n=t.x+t.w/2,r=t.y+t.h/2,o={n:[0,-t.h/2],e:[t.w/2,0],s:[0,t.h/2],w:[-t.w/2,0]}[e],i=t.rotation*Math.PI/180;return{x:n+o[0]*Math.cos(i)-o[1]*Math.sin(i),y:r+o[0]*Math.sin(i)+o[1]*Math.cos(i)}}function N(t,e,n,r){let o=null;for(const i of t)if(i.id!==r&&"connector"!==i.type)for(const t of["n","e","s","w"]){const r=F(i,t),a=Math.hypot(r.x-e,r.y-n);a<=40&&(!o||a<o.d)&&(o={id:i.id,side:t,...r,d:a})}return o&&{id:o.id,side:o.side,x:o.x,y:o.y}}function P(t,e){const n=Math.min(t.x,e.x),r=Math.min(t.y,e.y),o=Math.max(Math.abs(e.x-t.x),E),i=Math.max(Math.abs(e.y-t.y),E);return{x:n-(o===E?12:0),y:r-(i===E?12:0),w:o,h:i}}function R(t,e,n){return{...t,start:e,end:n,...P(e,n),rotation:0}}function W(t,e){const n=new Map(t.elements.map(t=>[t.id,t]));let r=!1;const o=t.elements.map(t=>{if("connector"!==t.type)return t;const o=r=>{if(!r.attach)return r;const o=n.get(r.attach.id);return o&&"connector"!==o.type?e?.has(t.id)&&!e.has(o.id)?{x:r.x,y:r.y}:{...F(o,r.attach.side),attach:r.attach}:{x:r.x,y:r.y}},i=R(t,o(t.start),o(t.end));return JSON.stringify(i)!==JSON.stringify(t)&&(r=!0),i});return r?{...t,elements:o}:t}function O(t){const e=t.start.x-t.x,n=t.start.y-t.y,r=t.end.x-t.x,o=t.end.y-t.y;if("straight"===t.route)return`M${e},${n} L${r},${o}`;if("elbow"===t.route){if(t.start.attach?"e"===(i=t.start.attach.side)||"w"===i:Math.abs(r-e)>=Math.abs(o-n)){return`M${e},${n} H${(e+r)/2} V${o} H${r}`}return`M${e},${n} V${(n+o)/2} H${r} V${o}`}var i;const a=Math.max(Math.abs(r-e),Math.abs(o-n))/2,l=(t,i,l,s=1)=>{if(!l)return Math.abs(r-e)>=Math.abs(o-n)?[t+s*a,i]:[t,i+s*a];const c={n:[0,-a],e:[a,0],s:[0,a],w:[-a,0]}[l];return[t+c[0],i+c[1]]},[s,c]=l(e,n,t.start.attach?.side,1),[h,u]=l(r,o,t.end.attach?.side,-1);return`M${e},${n} C${s},${c} ${h},${u} ${r},${o}`}import{Fragment as D,useLayoutEffect as T,useRef as V}from"react";import{Fragment as X,jsx as B,jsxs as Z}from"react/jsx-runtime";function Y({shape:t}){const{w:n,h:r,arrowEnd:o,arrowStart:i}=t,a=t.stroke??(t.fill===e?"#2c2c2a":t.fill),l=t.strokeWidth??4,s=r/2,c=Math.min(Math.max(4*l,14),n/2),h=c/2;return Z(X,{children:[B("line",{x1:i?c:0,y1:s,x2:o?n-c:n,y2:s,stroke:a,strokeWidth:l}),i&&B("polygon",{points:`0,${s} ${c},${s-h} ${c},${s+h}`,fill:a}),o&&B("polygon",{points:`${n},${s} ${n-c},${s-h} ${n-c},${s+h}`,fill:a})]})}function J({shape:t}){const{w:e,h:n,fill:r,stroke:o,strokeWidth:i}=t,a={fill:r,stroke:o,strokeWidth:o?i??4:void 0};switch(t.shape){case"line":return null;case"rect":return B("rect",{width:e,height:n,...a});case"ellipse":return B("ellipse",{cx:e/2,cy:n/2,rx:e/2,ry:n/2,...a});case"diamond":return B("polygon",{points:`${e/2},0 ${e},${n/2} ${e/2},${n} 0,${n/2}`,...a});case"roundRect":return B("rect",{width:e,height:n,rx:Math.min(t.radius??Math.min(e,n)/6,e/2,n/2),...a});default:return B("path",{d:s(t.shape,e,n,t.radius),...a,strokeLinejoin:"round"})}}function q({shape:t}){const e=Math.max(t.w,1),n=Math.max(t.h,1);return B("svg",{width:e,height:n,viewBox:`0 0 ${e} ${n}`,"aria-hidden":"true",style:{display:"block",overflow:"visible"},children:"line"===t.shape?B(Y,{shape:t}):B(J,{shape:t})})}import{useLayoutEffect as U,useRef as _,useState as Q}from"react";import{jsx as G,jsxs as K}from"react/jsx-runtime";var tt=e=>`${e?`'${e}', `:""}${t}, ui-sans-serif, system-ui, sans-serif`,et=1.4;function nt(t,e,n=1){const r=[e.underline||e.link?"underline":"",e.strike?"line-through":""].filter(Boolean).join(" ");return{fontFamily:e.font||t.font?tt(e.font??t.font):void 0,fontSize:e.size?e.size*n:void 0,fontWeight:void 0===e.bold?void 0:e.bold?700:400,fontStyle:e.italic?"italic":void 0,textDecoration:r||void 0,color:e.color,background:e.highlight}}function rt(t,e){const n=e.level??0,r=e.list?1:0;return{margin:0,textAlign:e.align??t.align,lineHeight:e.lineHeight??1.25,paddingLeft:n*et+r*et+"em",position:"relative",minHeight:`${e.lineHeight??1.25}em`}}function ot(t,e=1){return{fontFamily:tt(t.font),fontSize:t.fontSize*e,fontWeight:t.bold?700:400,color:t.color,whiteSpace:"pre-wrap",overflowWrap:"break-word"}}var it={position:"absolute",left:0,width:"1.4em",textAlign:"left"};function at({marker:t,level:e}){return t?G("span",{"aria-hidden":"true",contentEditable:!1,style:{...it,left:e*et+"em"},children:t}):null}function lt({el:t,run:e,scale:n,onLink:r}){const o=nt(t,e,n);return e.link&&r?G("a",{href:e.link,style:{...o,color:o.color??"inherit",cursor:"pointer"},onClick:t=>{t.preventDefault(),t.stopPropagation(),r(e.link)},children:e.text}):G("span",{style:o,children:e.text})}function st({element:t,onLink:e}){const n=u(t),r=k(n),o=_(null),[i,a]=Q(1),l=t.autofit,s=JSON.stringify([n,t.fontSize,t.w,t.h,t.font]);U(()=>{if(!l)return void a(1);const e=o.current;if(!e)return;let n=.2,r=1;if(e.style.fontSize=`${t.fontSize}px`,e.scrollHeight<=t.h+1)a(1);else{for(let o=0;o<8;o+=1){const o=(n+r)/2;e.style.fontSize=t.fontSize*o+"px",e.scrollHeight<=t.h+1?n=o:r=o}e.style.fontSize="",a(n)}},[l,s]);const c={top:"flex-start",middle:"center",bottom:"flex-end"}[t.anchor??"top"];return G("div",{style:{width:"100%",height:"100%",display:"flex",flexDirection:"column",justifyContent:c,overflow:l?"hidden":void 0},children:G("div",{ref:o,style:ot(t,i),children:n.map((n,o)=>K("div",{"data-slide-paragraph":"",style:rt(t,n),children:[G(at,{marker:r[o],level:n.level??0}),n.runs.map((n,r)=>G(lt,{el:t,run:n,scale:i,onLink:e},r)),n.runs.every(t=>!t.text)&&"​"]},o))})})}function ct(t,e){const n=k(e),r=t=>Object.entries(t).filter(([,t])=>void 0!==t&&""!==t).map(([t,e])=>`${t.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}:${"number"!=typeof e||/weight|height/i.test(t)?e:`${e}px`}`).join(";"),o=t=>t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;");return e.map((e,i)=>{const{runs:a,...l}=e,s=e.level??0,c=n[i]?`<span contenteditable="false" aria-hidden="true" style="${r({...it,left:s*et+"em"})}">${o(n[i])}</span>`:"",h=a.map(e=>`<span ${S}="${o(JSON.stringify(g(e)))}" style="${r(nt(t,e))}">${o(e.text)||"​"}</span>`).join("");return`<div ${C}="${o(JSON.stringify(l))}" style="${r(rt(t,e))}">${c}${h}</div>`}).join("")}function ht(t){return t.series&&t.series.length>0&&t.categories?{categories:t.categories,series:t.series}:{categories:t.points.map(t=>t.label),series:[{name:"",color:t.color,values:t.points.map(t=>t.value)}]}}function ut(t){const{categories:e,series:n}=ht(t);return[["",...n.map(t=>t.name)],...e.map((t,e)=>[t,...n.map(t=>String(t.values[e]??""))])]}function dt(t,e,n){const r=ht(t).series,o=Math.max(1,...e.map(t=>t.length)),i=(e[0]??[]).slice(1),a=e.slice(1),l=Array.from({length:o-1},(t,e)=>({name:i[e]?.trim()??"",color:r[e]?.color??n[e%n.length],values:a.map(t=>{const n=Number((t[e+1]??"").trim());return Number.isFinite(n)?n:0})}));return function(t,e,n){const r=n[0]??{name:"",color:t.color,values:[]};return{...t,categories:e,series:n.map(t=>({...t,values:e.map((e,n)=>t.values[n]??0)})),color:r.color,points:e.map((t,e)=>({label:t,value:r.values[e]??0}))}}(t,a.map(t=>(t[0]??"").trim()),l)}var ft=.5;function pt(t,e="fadeIn"){return{id:o(),elementId:t,effect:e,start:"click",duration:.5,..."flyIn"===e?{from:"bottom"}:{}}}function gt(t){const e=(t.animations??[]).filter(e=>t.elements.some(t=>t.id===e.elementId)),n=[[]];let r=0,o=0;for(const t of e){if("click"===t.start){n.push([{animation:t,delay:0}]),o=0,r=t.duration;continue}const e=n[n.length-1],i="withPrevious"===t.start?o:r;e.push({animation:t,delay:i}),o=i,r=Math.max(r,i+t.duration)}return n}var mt=t=>gt(t).length-1,$t=new Set(["appear","fadeIn","flyIn","zoomIn"]),yt=t=>$t.has(t);function wt(t,e){const n=gt(t),r=new Set;return n.forEach((t,n)=>{for(const{animation:o}of t)yt(o.effect)&&n>e&&r.add(o.elementId),!yt(o.effect)&&n<e&&r.add(o.elementId)}),{hidden:r,playing:n[Math.min(e,n.length-1)]??[]}}function xt(t){switch(t.effect){case"appear":return[{opacity:0},{opacity:0,offset:.99},{opacity:1}];case"fadeIn":return[{opacity:0},{opacity:1}];case"zoomIn":return[{opacity:0,transform:"scale(0.3)"},{opacity:1,transform:"scale(1)"}];case"fadeOut":return[{opacity:1},{opacity:0}];case"flyIn":return[{opacity:0,transform:{left:"translateX(-1200px)",right:"translateX(1200px)",top:"translateY(-900px)",bottom:"translateY(900px)"}[t.from??"bottom"]},{opacity:1,transform:"translate(0, 0)"}]}}function vt(t){switch(t.kind){case"fade":return{incoming:[{opacity:0},{opacity:1}],outgoing:[{opacity:1},{opacity:1}]};case"slide":return{incoming:[{transform:"translateX(100%)"},{transform:"translateX(0)"}],outgoing:[{opacity:1},{opacity:1}]};case"push":return{incoming:[{transform:"translateX(100%)"},{transform:"translateX(0)"}],outgoing:[{transform:"translateX(0)"},{transform:"translateX(-100%)"}]};case"zoom":return{incoming:[{opacity:0,transform:"scale(0.6)"},{opacity:1,transform:"scale(1)"}],outgoing:[{opacity:1},{opacity:0}]};case"flip":return{incoming:[{transform:"perspective(2000px) rotateY(-90deg)",offset:0},{transform:"perspective(2000px) rotateY(-90deg)",offset:.5},{transform:"perspective(2000px) rotateY(0deg)"}],outgoing:[{transform:"perspective(2000px) rotateY(0deg)"},{transform:"perspective(2000px) rotateY(90deg)",offset:.5},{transform:"perspective(2000px) rotateY(90deg)"}]}}}function bt(t){const e=t.map((t,e)=>t.skip?-1:e).filter(t=>-1!==t);return e.length>0?e:t.map((t,e)=>e)}function Mt(t,e,n){const r=[...t],[o]=r.splice(e,1);return r.splice(Math.max(0,Math.min(n,r.length)),0,o),r}var kt=(t,e,n)=>t&&[...t.slice(0,e),n,...t.slice(e)],St=(t,e)=>t&&t.filter((t,n)=>n!==e);function Ct(t,e,n,r){if(!t)return t;const o="row"===e?"rows":"cols";return t.flatMap(t=>{const i=t[e],a=i+t[o];return 1===r?n<=i?[{...t,[e]:i+1}]:n<a?[{...t,[o]:t[o]+1}]:[t]:n<i?[{...t,[e]:i-1}]:n<a?t[o]>2?[{...t,[o]:t[o]-1}]:[]:[t]})}function At(t,e){const n=t.rows[0]?.length??1,r=t.rowHeights&&kt(t.rowHeights,e,t.rowHeights[Math.max(0,e-1)]??80);return{...t,rows:kt(t.rows,e,Array(n).fill("")),rowHeights:r,cellFills:kt(t.cellFills,e,Array(n).fill(null)),cellColors:kt(t.cellColors,e,Array(n).fill(null)),merges:Ct(t.merges,"row",e,1)}}function It(t,e){return t.rows.length<=1?t:{...t,rows:St(t.rows,e),rowHeights:St(t.rowHeights,e),cellFills:St(t.cellFills,e),cellColors:St(t.cellColors,e),merges:Ct(t.merges,"row",e,-1)}}function Ht(t,e){const n=(t.rows[0]?.length??0)+1;return{...t,rows:t.rows.map(t=>kt(t,e,"")),columnWidths:t.columnWidths&&(r=n,Array(r).fill(1/r)),cellFills:t.cellFills?.map(t=>kt(t,e,null)),cellColors:t.cellColors?.map(t=>kt(t,e,null)),merges:Ct(t.merges,"col",e,1)};var r}function jt(t,e){if((t.rows[0]?.length??0)<=1)return t;const n=t.columnWidths&&St(t.columnWidths,e),r=n?.reduce((t,e)=>t+e,0)||1;return{...t,rows:t.rows.map(t=>St(t,e)),columnWidths:n?.map(t=>t/r),cellFills:t.cellFills?.map(t=>St(t,e)),cellColors:t.cellColors?.map(t=>St(t,e)),merges:Ct(t.merges,"col",e,-1)}}var zt=(t,e,n)=>t.merges?.find(t=>e>=t.row&&e<t.row+t.rows&&n>=t.col&&n<t.col+t.cols);function Lt(t,e){if(e.rows*e.cols<2)return t;let{row:n,col:r,rows:o,cols:i}=e;const a=(t.merges??[]).filter(t=>t.row<n+o&&n<t.row+t.rows&&t.col<r+i&&r<t.col+t.cols);for(const t of a){const e=Math.max(n+o,t.row+t.rows),a=Math.max(r+i,t.col+t.cols);n=Math.min(n,t.row),r=Math.min(r,t.col),o=e-n,i=a-r}const l=[],s=t.rows.map((t,e)=>t.map((t,a)=>e>=n&&e<n+o&&a>=r&&a<r+i?(t.trim()&&l.push(t.trim()),""):t));s[n][r]=l.join(" ");const c=(t.merges??[]).filter(t=>!a.includes(t));return{...t,rows:s,merges:[...c,{row:n,col:r,rows:o,cols:i}]}}function Et(t,e,n){const r=zt(t,e,n);if(!r)return t;const o=t.merges.filter(t=>t!==r);return{...t,merges:o.length>0?o:void 0}}function Ft(t,e,n,r){return{...t,rows:t.rows.map((t,o)=>o===e?t.map((t,e)=>e===n?r:t):t)}}import{jsx as Nt,jsxs as Pt}from"react/jsx-runtime";var Rt=tt();function Wt(t){return{position:"absolute",left:t.x,top:t.y,width:t.w,height:t.h,transform:t.rotation?`rotate(${t.rotation}deg)`:void 0}}var Ot="#444441";function Dt(t){const e=/^#?([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})/i.exec(t);if(!e)return Ot;const[n,r,o]=[e[1],e[2],e[3]].map(t=>parseInt(t,16)/255).map(t=>t<=.03928?t/12.92:((t+.055)/1.055)**2.4);return.2126*n+.7152*r+.0722*o<.25?"#f1efe8":Ot}function Tt({names:t,colors:e,side:n,ink:r}){return Nt("div",{style:{display:"flex",flexDirection:"right"===n?"column":"row",gap:24,justifyContent:"center",fontFamily:Rt,fontSize:28,color:r,padding:8},children:t.map((t,n)=>Pt("span",{style:{display:"inline-flex",alignItems:"center",gap:10,whiteSpace:"nowrap"},children:[Nt("span",{style:{width:22,height:22,background:e[n],display:"inline-block"}}),t]},n))})}function Vt({chart:t,w:e,h:n,ink:r}){const{categories:o,series:i}=ht(t),{kind:a}=t;if("pie"===a||"donut"===a){const r=i[0]?.values??[],l=r.reduce((t,e)=>t+Math.max(e,0),0)||1,s=Math.min(e,n)/2-8,c=e/2,h=n/2;let u=-Math.PI/2;const d=Bt(t,o.length);return Pt("svg",{width:e,height:n,viewBox:`0 0 ${e} ${n}`,role:"img","aria-label":"Chart",style:{display:"block"},children:[r.map((t,e)=>{const n=Math.max(t,0)/l*Math.PI*2,r=u;if(u+=n,n>=2*Math.PI-1e-6)return Nt("circle",{cx:c,cy:h,r:s,fill:d[e]},e);const o=n>Math.PI?1:0,i=t=>`${c+s*Math.cos(t)},${h+s*Math.sin(t)}`;return Nt("path",{d:`M${c},${h} L${i(r)} A${s},${s} 0 ${o} 1 ${i(u)} Z`,fill:d[e],stroke:"#ffffff",strokeWidth:4},e)}),"donut"===a&&Nt("circle",{cx:c,cy:h,r:.55*s,fill:"#ffffff"})]})}const l=(t=>Math.max(1,...t.flatMap(t=>t.values)))(i),s=Math.max(o.length,1);if("hbar"===a){const t=Math.min(240,.25*e),a=n/s,c=.7*a/Math.max(i.length,1),h=n=>Math.max(n,0)/l*(e-t-90);return Nt("svg",{width:e,height:n,viewBox:`0 0 ${e} ${n}`,role:"img","aria-label":"Chart",style:{display:"block"},children:o.map((e,n)=>Pt("g",{fontFamily:Rt,fontSize:30,fill:r,children:[Nt("text",{x:t-12,y:a*n+a/2+10,textAnchor:"end",children:e}),i.map((e,r)=>Pt(D,{children:[Nt("rect",{x:t,y:a*n+.15*a+c*r,width:h(e.values[n]??0),height:c,fill:e.color}),1===i.length&&Nt("text",{x:t+h(e.values[n]??0)+12,y:a*n+a/2+10,children:e.values[n]})]},r))]},n))})}const c=n-56,h=e/s,u=t=>c-Math.max(t,0)/l*(c-40),d=t=>h*t+h/2;return Pt("svg",{width:e,height:n,viewBox:`0 0 ${e} ${n}`,role:"img","aria-label":"Chart",style:{display:"block"},children:[i.map((t,e)=>{if("line"===a||"area"===a){const n=t.values.map((t,e)=>`${d(e)},${u(t)}`).join(" ");return Pt("g",{children:["area"===a&&Nt("polygon",{points:`${d(0)},${c} ${n} ${d(t.values.length-1)},${c}`,fill:t.color,fillOpacity:.35}),Nt("polyline",{fill:"none",stroke:t.color,strokeWidth:8,points:n})]},e)}const n=.7*h/i.length;return t.values.map((r,o)=>Nt("rect",{x:h*o+.15*h+n*e,y:u(r),width:n,height:c-u(r),fill:t.color},`${e}-${o}`))}),o.map((t,e)=>Pt("g",{fontFamily:Rt,fontSize:30,fill:r,textAnchor:"middle",children:[Nt("text",{x:d(e),y:n-14,children:t}),1===i.length&&Nt("text",{x:d(e),y:u(i[0].values[e]??0)-12,children:i[0].values[e]})]},e))]})}var Xt=["#534ab7","#1d9e75","#d85a30","#ef9f27","#378add","#d4537e","#5f5e5a","#97c459"];function Bt(t,e){const n=ht(t).series[0]?.color??t.color,r=Xt.filter(t=>t.toLowerCase()!==n.toLowerCase());return Array.from({length:e},(t,e)=>0===e?n:r[(e-1)%r.length])}function Zt({chart:t,ink:e=Ot}){const{categories:n,series:r}=ht(t),o="pie"===t.kind||"donut"===t.kind,i=t.legend??(o||r.length>1?"bottom":"none"),a=o?n:r.map(t=>t.name),l=o?Bt(t,n.length):r.map(t=>t.color);if("none"===i)return Nt(Vt,{chart:t,w:t.w,h:t.h,ink:e});const s="right"===i,c=s?Math.min(360,.3*t.w):t.w,h=s?t.h:64;return Pt("div",{style:{display:"flex",flexDirection:s?"row":"column",width:t.w,height:t.h},children:[Nt(Vt,{chart:t,w:s?t.w-c:t.w,h:s?t.h:t.h-h,ink:e}),Nt("div",{style:{width:s?c:"100%",display:"flex",alignItems:"center",justifyContent:"center"},children:Nt(Tt,{names:a,colors:l,side:i,ink:e})})]})}var Yt="#2c2c2a";function Jt({table:t,cellEditor:e,ink:n}){const r=t.fontSize??32,o=t.borderWidth??2,i=t.borderColor??"#b4b2a9",a=t.rows[0]?.length??0,{columnWidths:l,rowHeights:s}=t,c=s?.slice(0,t.rows.length).reduce((t,e)=>t+e,0)??0,h=e=>s?.[e]&&c?s[e]*(t.h-o)/c:void 0;return Pt("table",{style:{width:"100%",height:"100%",borderCollapse:"collapse",fontFamily:Rt,fontSize:r,lineHeight:t.fontSize?1.2:void 0,color:n&&n!==Ot?n:Yt,tableLayout:"fixed"},children:[l?.length===a&&Nt("colgroup",{children:l.map((t,e)=>Nt("col",{style:{width:100*t+"%"}},e))}),Nt("tbody",{children:t.rows.map((a,l)=>Nt("tr",{style:{height:h(l),background:0===l?t.headerFill:void 0,color:0===l?t.headerColor??(n&&n!==Ot?Yt:void 0):void 0,fontWeight:0===l?500:400},children:a.map((n,a)=>{const s=zt(t,l,a);return!s||s.row===l&&s.col===a?Nt("td",{"data-cell":`${l}:${a}`,rowSpan:s?.rows,colSpan:s?.cols,style:{border:o?`${o}px solid ${i}`:"none",padding:`${.25*r}px ${.5*r}px`,overflow:"hidden",background:t.cellFills?.[l]?.[a]??void 0,color:t.cellColors?.[l]?.[a]??void 0,verticalAlign:"top"},children:e?.(l,a)??n},a):null})},l))})]})}function qt({image:t}){if(!t.src)return Nt("div",{style:{width:"100%",height:"100%",background:"#f1efe8",border:"4px dashed #b4b2a9",boxSizing:"border-box"}});const e=t.crop??{left:0,top:0,right:0,bottom:0},n=Math.max(.05,1-e.left-e.right),r=Math.max(.05,1-e.top-e.bottom),o=e.left||e.top||e.right||e.bottom,i=Nt("img",{src:t.src,alt:t.alt,draggable:!1,style:o?{position:"absolute",width:100/n+"%",height:100/r+"%",left:-e.left/n*100+"%",top:-e.top/r*100+"%",objectFit:"fill",display:"block"}:{width:"100%",height:"100%",objectFit:"contain",display:"block"}});return Nt("div",{style:{position:"relative",width:"100%",height:"100%",overflow:"hidden",opacity:t.opacity??1},children:i})}function Ut(t){if(!t)return null;const e=t.match(/(?:youtube\.com\/(?:watch\?(?:.*&)?v=|embed\/|shorts\/)|youtu\.be\/)([\w-]{6,})/);if(e)return{kind:"youtube",id:e[1]};const n=t.match(/vimeo\.com\/(?:video\/)?(\d+)/);return n?{kind:"vimeo",id:n[1]}:{kind:"file"}}function _t({video:t,live:e}){const n=Ut(t.src),r={width:"100%",height:"100%",border:0,display:"block",background:"#000"};if(e&&"youtube"===n?.kind)return Nt("iframe",{title:t.alt||"Video",src:`https://www.youtube-nocookie.com/embed/${n.id}`,style:r,allow:"autoplay; fullscreen; picture-in-picture",allowFullScreen:!0});if(e&&"vimeo"===n?.kind)return Nt("iframe",{title:t.alt||"Video",src:`https://player.vimeo.com/video/${n.id}`,style:r,allow:"autoplay; fullscreen; picture-in-picture",allowFullScreen:!0});if(e&&"file"===n?.kind)return Nt("video",{src:t.src,controls:!0,style:r,"aria-label":t.alt||"Video"});const o="youtube"===n?.kind?`https://img.youtube.com/vi/${n.id}/hqdefault.jpg`:null;return Pt("div",{style:{position:"relative",width:"100%",height:"100%",background:"#2c2c2a",overflow:"hidden"},children:[o&&Nt("img",{src:o,alt:t.alt,draggable:!1,style:{width:"100%",height:"100%",objectFit:"cover",display:"block"}}),Pt("svg",{viewBox:"0 0 100 100","aria-hidden":"true",style:{position:"absolute",left:"50%",top:"50%",width:140,height:140,marginLeft:-70,marginTop:-70},children:[Nt("circle",{cx:"50",cy:"50",r:"48",fill:"rgba(0,0,0,0.55)"}),Nt("polygon",{points:"40,30 72,50 40,70",fill:"#ffffff"})]})]})}function Qt({connector:t}){const{w:e,h:n,stroke:r,strokeWidth:o}=t,i=Math.max(4*o,14),a=e=>{const n="end"===e?t.end:t.start,o=function(t,e){const n="end"===e?t.end:t.start,r=n.attach?.side;if("straight"!==t.route&&r)return{n:Math.PI/2,e:Math.PI,s:-Math.PI/2,w:0}[r];const o="end"===e?t.start:t.end;if("elbow"===t.route){return(t.start.attach?"e"===t.start.attach.side||"w"===t.start.attach.side:Math.abs(t.end.x-t.start.x)>=Math.abs(t.end.y-t.start.y))?n.x>=o.x?0:Math.PI:n.y>=o.y?Math.PI/2:-Math.PI/2}return Math.atan2(n.y-o.y,n.x-o.x)}(t,e)+("start"===e?Math.PI:0),a=n.x-t.x,l=n.y-t.y,s=t=>`${a-i*Math.cos(o)+t*(i/2)*Math.sin(o)},${l-i*Math.sin(o)-t*(i/2)*Math.cos(o)}`;return Nt("polygon",{points:`${a},${l} ${s(1)} ${s(-1)}`,fill:r})};return Pt("svg",{width:Math.max(e,1),height:Math.max(n,1),viewBox:`0 0 ${Math.max(e,1)} ${Math.max(n,1)}`,"aria-hidden":"true",style:{display:"block",overflow:"visible"},children:[Nt("path",{d:O(t),fill:"none",stroke:r,strokeWidth:o,strokeLinejoin:"round"}),t.arrowStart&&a("start"),t.arrowEnd&&a("end")]})}function Gt({element:t,options:e={}}){switch(t.type){case"text":return Nt(st,{element:t,onLink:e.onLink});case"shape":return Nt(q,{shape:t});case"image":return Nt(qt,{image:t});case"video":return Nt(_t,{video:t,live:e.live});case"connector":return Nt(Qt,{connector:t});case"chart":return Nt(Zt,{chart:t,ink:e.ink});case"table":return Nt(Jt,{table:t,cellEditor:e.cellEditor,ink:e.ink})}}function Kt({slide:e,width:o,editingId:i,editor:a,number:l,motion:s,options:c}){const h=o/r,u=V(null);return function(t,e){T(()=>{const n=t.current;if(!n||!e)return;const r=[];for(const{animation:t,delay:o}of e.playing){const e=n.querySelector(`[data-element="${CSS.escape(t.elementId)}"]`);if(!e)continue;const i=xt(t),a={duration:1e3*t.duration,delay:1e3*o,fill:"both",easing:"ease-out"},l=t.byParagraph?[...e.querySelectorAll("[data-slide-paragraph]")]:[];l.length>1?(l.forEach((e,n)=>r.push(e.animate(i,{...a,delay:1e3*(o+n*t.duration)}))),e.style.visibility="visible"):r.push(e.animate(i,a))}return()=>r.forEach(t=>t.cancel())},[t,e])}(u,s),Nt("div",{style:{width:o,height:n*h,overflow:"hidden",position:"relative",background:e.background},children:Pt("div",{ref:u,style:{width:r,height:n,transform:`scale(${h})`,transformOrigin:"0 0",position:"absolute",left:0,top:0},children:[e.elements.map(t=>Nt("div",{"data-element":t.id,style:{...Wt(t),visibility:s?.hidden.has(t.id)?"hidden":void 0},children:t.id===i?a:Nt(Gt,{element:t,options:{...c,ink:Dt(e.background)}})},t.id)),void 0!==l&&Nt("div",{style:{position:"absolute",right:60,bottom:36,fontFamily:`${t}, sans-serif`,fontSize:28,color:Dt(e.background)===Ot?"#888780":"#b4b2a9"},children:l})]})})}export{s as shapePath,c as PPTX_SHAPES,u as paragraphsOf,d as plainText,f as withParagraphs,y as applyStyle,w as styleAt,x as paragraphsIn,v as setParagraphs,b as toggleList,M as indent,k as listMarkers,j as readParagraphs,z as selectionOffsets,L as restoreSelection,ot as boxStyle,ct as editorHtml,ht as seriesOf,ut as chartToGrid,dt as gridToChart,N as nearestSide,R as withEnds,W as relayConnectors,O as connectorPath,ft as DEFAULT_TRANSITION_SECONDS,pt as newAnimation,mt as clicksOf,wt as stateAt,vt as transitionKeyframes,bt as shownSlides,Mt as moveAnimation,At as insertRow,It as removeRow,Ht as insertColumn,jt as removeColumn,zt as mergeAt,Lt as mergeCells,Et as unmergeCell,Ft as setCell,Rt as SLIDE_FONT,Ut as videoSource,Kt as SlideView};
@@ -1 +1 @@
1
- import{ENGLISH_WORDS as t}from"./chunk-X6F3Z4KZ.js";import{createContext as e,useContext as r}from"react";import{jsx as o}from"react/jsx-runtime";var n=class extends Error{},a="efficient-office:slides",c=()=>{try{return JSON.parse(localStorage.getItem(a)??"{}")}catch{return{}}},s=t=>localStorage.setItem(a,JSON.stringify(t)),i={list:async()=>Object.values(c()).map(({id:t,title:e,updatedAt:r})=>({id:t,title:e,updatedAt:r})).sort((t,e)=>e.updatedAt.localeCompare(t.updatedAt)),get:async t=>{const e=c()[t];if(!e)throw new Error("No such deck");return e},create:async t=>{const e=(new Date).toISOString(),r={id:crypto.randomUUID(),title:t,document:{},version:crypto.randomUUID(),updatedAt:e};return s({...c(),[r.id]:r}),r},rename:async(t,e)=>{const r=c();r[t]&&s({...r,[t]:{...r[t],title:e,updatedAt:(new Date).toISOString()}})},save:async(t,e,r)=>{const o=c();if(!o[t]||o[t].version!==r)throw new n;const a=crypto.randomUUID();return s({...o,[t]:{...o[t],document:e,version:a,updatedAt:(new Date).toISOString()}}),a},remove:async t=>{const{[t]:e,...r}=c();s(r)}},d=e({store:i});function u({value:t,children:e}){return o(d.Provider,{value:t,children:e})}var l=()=>r(d),m=()=>r(d).words??t;export{n as SlidesConflict,i as browserSlidesStore,u as SlidesProvider,l as useSlidesHost,m as useSlidesWords};
1
+ import{ENGLISH_WORDS as t}from"./chunk-PXOQN7D6.js";import{createContext as e,useContext as r}from"react";import{jsx as o}from"react/jsx-runtime";var n=class extends Error{},a="efficient-office:slides",c=()=>{try{return JSON.parse(localStorage.getItem(a)??"{}")}catch{return{}}},s=t=>localStorage.setItem(a,JSON.stringify(t)),i={list:async()=>Object.values(c()).map(({id:t,title:e,updatedAt:r})=>({id:t,title:e,updatedAt:r})).sort((t,e)=>e.updatedAt.localeCompare(t.updatedAt)),get:async t=>{const e=c()[t];if(!e)throw new Error("No such deck");return e},create:async t=>{const e=(new Date).toISOString(),r={id:crypto.randomUUID(),title:t,document:{},version:crypto.randomUUID(),updatedAt:e};return s({...c(),[r.id]:r}),r},rename:async(t,e)=>{const r=c();r[t]&&s({...r,[t]:{...r[t],title:e,updatedAt:(new Date).toISOString()}})},save:async(t,e,r)=>{const o=c();if(!o[t]||o[t].version!==r)throw new n;const a=crypto.randomUUID();return s({...o,[t]:{...o[t],document:e,version:a,updatedAt:(new Date).toISOString()}}),a},remove:async t=>{const{[t]:e,...r}=c();s(r)}},d=e({store:i});function u({value:t,children:e}){return o(d.Provider,{value:t,children:e})}var l=()=>r(d),m=()=>r(d).words??t;export{n as SlidesConflict,i as browserSlidesStore,u as SlidesProvider,l as useSlidesHost,m as useSlidesWords};
@@ -1 +1 @@
1
- import{ENGLISH_WORDS as r}from"./chunk-X6F3Z4KZ.js";var s=class extends Error{constructor(s=r.pptxPasswordProtected){super(s),this.name="PptxPasswordError"}},t=class extends Error{constructor(s=r.pptxUnreadable){super(s),this.name="PptxUnreadableError"}};export{s as PptxPasswordError,t as PptxUnreadableError};
1
+ import{ENGLISH_WORDS as r}from"./chunk-PXOQN7D6.js";var s=class extends Error{constructor(s=r.pptxPasswordProtected){super(s),this.name="PptxPasswordError"}},t=class extends Error{constructor(s=r.pptxUnreadable){super(s),this.name="PptxUnreadableError"}};export{s as PptxPasswordError,t as PptxUnreadableError};
@@ -0,0 +1 @@
1
+ import{useCallback as e,useEffect as t,useRef as i,useState as n}from"react";import{WindowTitle as l,activateWindowById as r}from"efficient-shell";import{Icon as a}from"efficient-shell/icons";import{Button as o,ContextMenu as c,buttonClasses as s,DropdownMenu as d,EmptyState as f,Input as m,confirmDestructive as u,registerModalEscapeInterceptor as p,toast as h,useContextMenu as g}from"efficient-shell/ui";import{jsx as v,jsxs as y}from"react/jsx-runtime";function w({words:m,files:p,list:w,create:b,rename:C,remove:N,canCreate:D,canDelete:F,canRename:S=!0,accept:x,choose:z,onOpen:A,onOpenFile:I,busy:T,extra:q}){const[B,E]=n(null),[O,P]=n(null),j=i(null),K=i(null),L=g(),M=e(()=>{w().then(E,()=>E([]))},[w]);t(M,[M]);const R=()=>j.current?.click(),W=async e=>{await u({message:m.deleteConfirm(e.title),confirmWord:p.delete})&&N(e.id).then(M,()=>h.error(m.deleteFailed))},G=D&&v(o,{onClick:()=>{b().then(({id:e})=>A(e),()=>h.error(m.createFailed))},children:m.newFile}),H=v(a,{name:"folder-open",size:16}),J=z?v(d,{align:"end",triggerClassName:s({variant:"ghost"}),trigger:y("span",{className:"office-filelist-open",children:[H,p.open,v(a,{name:"chevron-down",size:14})]}),items:[{key:"computer",label:p.fromComputer,icon:v(a,{name:"desktop",size:16}),onSelect:R},{key:"drive",label:p.fromDrive,icon:v(a,{name:"cloud",size:16}),onSelect:()=>{(async()=>{z&&(await new Promise(e=>requestAnimationFrame(()=>setTimeout(e,0))),z.run(z.request).then(e=>{if(!e)return;const t=K.current?.closest("[data-modal-panel]"),i=t?.getAttribute("data-window-key")??t?.getAttribute("data-window-owner");i&&r(i),K.current?.focus({preventScroll:!0}),I(e.file,e)},()=>h.error(p.openFailed(p.fromDrive))))})()}}]}):v(o,{variant:"ghost",leftIcon:H,onClick:R,children:p.open});return y("div",{className:"office-filelist",ref:K,tabIndex:-1,children:[v(l,{title:m.windowTitle}),v("input",{ref:j,type:"file",accept:x,className:"office-filelist-input",onChange:e=>{const t=e.target.files?.[0];e.target.value="",t&&I(t)}}),y("div",{className:"office-filelist-head",children:[v("h2",{children:m.heading}),J,B&&B.length>0&&G]}),q,T&&v("div",{className:"office-filelist-busy",role:"status",children:T}),0===B?.length?v("div",{className:"office-filelist-empty",children:v(f,{title:m.emptyTitle,description:m.emptyBody,children:G})}):v("ul",{className:"office-filelist-rows",children:B?.map(e=>y("li",{className:"office-filelist-row",onContextMenu:t=>L.open(t,e),children:[O===e.id?v(k,{title:e.title,label:p.name,onDone:t=>((e,t)=>{P(null);const i=t?.trim();i&&i!==e.title&&(E(t=>t?.map(t=>t.id===e.id?{...t,title:i}:t)??t),C(e.id,i).then(M,()=>{h.error(p.renameFailed),M()}))})(e,t)}):v(o,{variant:"link",onClick:()=>A(e.id),children:e.title}),v("span",{className:"office-filelist-date",children:new Date(e.updatedAt).toLocaleDateString()}),F&&v(o,{variant:"ghost",leftIcon:v(a,{name:"trash",size:16}),onClick:()=>{W(e)},children:p.delete})]},e.id))}),L.state&&v(c,{...L.props,items:(Q=L.state.data,[{key:"open",label:p.open,onSelect:()=>A(Q.id)},...S?[{key:"rename",label:p.rename,onSelect:()=>P(Q.id)}]:[],...F?[{key:"divider",type:"divider"},{key:"delete",label:p.delete,danger:!0,onSelect:()=>{W(Q)}}]:[]])})]});var Q}function k({title:e,label:l,onDone:r}){const[a,o]=n(e),c=i(null),s=i(!1),d=e=>{s.current||(s.current=!0,r(e))},f=i(d);return f.current=d,t(()=>{c.current?.focus(),c.current?.select()},[]),t(()=>p(()=>(f.current(null),!0)),[]),v("div",{className:"office-filelist-rename",children:v(m,{ref:c,"aria-label":l,value:a,onChange:e=>o(e.target.value),onKeyDown:e=>{"Enter"===e.key?d(a):"Escape"===e.key&&(e.stopPropagation(),d(null))},onBlur:()=>d(a)})})}export{w as FileList};
@@ -0,0 +1 @@
1
+ import{ENGLISH_FILE_WORDS as e,ZH_HANS_FILE_WORDS as t}from"./chunk-B32ASXHM.js";var o={rect:"Rectangle",roundRect:"Rounded rectangle",ellipse:"Ellipse",triangle:"Triangle",rightTriangle:"Right triangle",diamond:"Diamond",pentagon:"Pentagon",hexagon:"Hexagon",octagon:"Octagon",star:"Star",heart:"Heart",cloud:"Cloud",bolt:"Lightning bolt",parallelogram:"Parallelogram",trapezoid:"Trapezoid",cylinder:"Cylinder",plus:"Plus",arrowRight:"Right arrow",arrowLeft:"Left arrow",arrowUp:"Up arrow",arrowDown:"Down arrow",arrowLeftRight:"Left-right arrow",chevron:"Chevron",callout:"Callout",calloutRound:"Rounded callout",line:"Line"},n={rect:"矩形",roundRect:"圆角矩形",ellipse:"椭圆",triangle:"三角形",rightTriangle:"直角三角形",diamond:"菱形",pentagon:"五边形",hexagon:"六边形",octagon:"八边形",star:"星形",heart:"心形",cloud:"云形",bolt:"闪电形",parallelogram:"平行四边形",trapezoid:"梯形",cylinder:"圆柱形",plus:"加号",arrowRight:"右箭头",arrowLeft:"左箭头",arrowUp:"上箭头",arrowDown:"下箭头",arrowLeftRight:"左右箭头",chevron:"燕尾形",callout:"标注",calloutRound:"圆角标注",line:"线条"},i={blank:"Blank",simple:"Simple",midnight:"Midnight",editorial:"Editorial",dealerPitch:"Dealer pitch",monthlyReport:"Monthly report"},r={blank:"空白",simple:"简约",midnight:"午夜",editorial:"杂志",dealerPitch:"经销商推介",monthlyReport:"月度报告"},a={decks:"Decks",newDeck:"New deck",untitledDeck:"Untitled deck",emptyTitle:"Make your first deck",emptyBody:"Build slides here, then present them or export to PowerPoint.",openFailed:"Couldn't open this deck",createFailed:"Could not create a deck.",deleteFailed:"Could not delete this deck.",backToDecks:"Back to decks",deleteConfirm:e=>`Delete "${e}"? This can't be undone.`,delete:"Delete",deckName:"Deck name",slidesPanel:"Slides",slideNumber:e=>`Slide ${e}`,slideOf:(e,t)=>`Slide ${e} of ${t}`,addSlide:"Add slide",duplicateSlide:"Duplicate slide",deleteSlide:"Delete slide",slideText:"Slide text",undo:"Undo",redo:"Redo",export:"Export",exportFailed:"Could not export this deck.",present:"Present",endShow:"End show",popupBlocked:"Your browser blocked the audience window. Allow pop-ups for this site, then end the show and present again.",back:"Back",next:"Next",nextSlide:"Next slide",endOfDeck:"End of the deck.",notes:"Notes",noNotes:"No notes for this slide.",speakerNotes:"Speaker notes",saveFailed:"Could not save this deck. Trying again.",renameFailed:"Could not rename this deck.",conflict:"Somebody else changed this deck. Your latest edits aren't saved. Reload to see their version.",reload:"Reload",addText:"Add text",addShape:"Add shape",addImage:"Add image",addChart:"Add chart",addTable:"Add table",elementText:"Text",elementShape:"Shape",elementImage:"Image",elementChart:"Chart",elementTable:"Table",slide:"Slide",objects:e=>`${e} objects`,background:"Background",positionAndSize:"Position and size",width:"W",height:"H",angle:"Angle",align:"Align",alignLeft:"Align left",alignCentre:"Align centre",alignRight:"Align right",bringForward:"Bring forward",size:"Size",weight:"Weight",regular:"Regular",bold:"Bold",textAlignment:"Text alignment",left:"Left",centre:"Centre",right:"Right",colour:"Colour",rectangle:"Rectangle",ellipse:"Ellipse",roundedRectangle:"Rounded rectangle",diamond:"Diamond",lineShape:"Line",outlineColour:"Outline colour",imageAddress:"Image address",chooseImage:"Choose image",imageTitle:"Slide image",description:"Description",data:"Data",chartType:"Chart type",bar:"Bar",line:"Line",values:"Values",valuesHint:"One label and number a line, like Sept, 42.",rows:"Rows",rowsHint:"One row a line, with commas between cells.",headingColour:"Heading colour",pptxPasswordProtected:"This file has a password. Remove it in PowerPoint, then import the file again.",pptxUnreadable:"This file can't be read as a PowerPoint (.pptx) file.",pptxLegacyFormat:"This is an older Office file. Save it as .pptx in PowerPoint, then import it again.",pptxTooManySlides:(e,t)=>`This deck has ${e} slides, and a deck can have at most ${t}.`,pptxTooLarge:(e,t)=>`This deck comes to ${e} MiB without its pictures, and a deck can be at most ${t} MiB. Split it into smaller decks.`,pdfSlideFailed:e=>`Slide ${e} couldn't be drawn for the PDF.`,files:e,fileKind:"PowerPoint",importNotes:({skipped:e,animations:t,fonts:o})=>{const n=[e&&(1===e?"a chart, video or custom shape was":`${e} charts, videos or custom shapes were`)+" left out",t&&`animations on ${1===t?"1 slide were":`${t} slides were`} dropped`,o.length&&`${o.join(", ")} ${1===o.length?"is":"are"} shown in the deck's font`].filter(Boolean);return n.length?`Some things didn't come across: ${n.join("; ")}.`:null},dismiss:"Dismiss",newSlide:"New slide",layouts:"Layouts",layoutTitle:"Title",layoutTitleBody:"Title and body",layoutSection:"Section",layoutTwoColumns:"Two columns",layoutTitleOnly:"Title only",layoutBlank:"Blank",placeholderTitle:"Click to add a title",placeholderSubtitle:"Click to add a subtitle",placeholderBody:"Click to add text",addVideo:"Add video",addLine:"Add line or connector",elementVideo:"Video",elementConnector:"Connector",lineStraight:"Line",lineArrow:"Arrow",lineDoubleArrow:"Double arrow",connectorElbow:"Elbow connector",connectorCurved:"Curved connector",arrange:"Arrange",theme:"Theme",motion:"Motion",comments:"Comments",versionHistory:"Version history",font:"Font",fontSize:"Font size",smaller:"Smaller",larger:"Larger",italic:"Italic",underline:"Underline",strikethrough:"Strikethrough",textColour:"Text colour",highlight:"Highlight",link:"Link",linkPrompt:"Link to a web address, an email address, or a slide number",removeLink:"Remove link",badLink:"That link isn’t a web address, an email address or a slide number.",alignJustify:"Justify",bulletList:"Bulleted list",numberedList:"Numbered list",indentLess:"Decrease indent",indentMore:"Increase indent",lineSpacing:"Line spacing",verticalAlign:"Vertical alignment",top:"Top",middle:"Middle",bottom:"Bottom",shrinkToFit:"Shrink text to fit",cut:"Cut",copy:"Copy",paste:"Paste",duplicate:"Duplicate",copyStyle:"Copy style",pasteStyle:"Paste style",order:"Order",bringToFront:"Bring to front",sendBackward:"Send backward",sendToBack:"Send to back",alignTop:"Align top",alignMiddle:"Align middle",alignBottom:"Align bottom",distributeAcross:"Distribute horizontally",distributeDown:"Distribute vertically",distribute:"Distribute",group:"Group",ungroup:"Ungroup",lock:"Lock",unlock:"Unlock",locked:"Locked",comment:"Comment",grid:"Grid",crop:"Crop",cropLeft:"Left",cropTop:"Top",cropRight:"Right",cropBottom:"Bottom",opacity:"Opacity",replaceImage:"Replace image",videoAddress:"Video address",videoHint:"A YouTube or Vimeo link, or a video file.",chooseVideo:"Choose from Media Library",videoUnsupported:"This video can’t be played here. Open it from its link.",route:"Route",routeStraight:"Straight",routeElbow:"Elbow",routeCurved:"Curved",arrowStart:"Arrow at start",arrowEnd:"Arrow at end",lineWidth:"Line width",fill:"Fill",noFill:"No fill",outline:"Outline",chartBar:"Column",chartHbar:"Bar",chartArea:"Area",chartPie:"Pie",chartDonut:"Donut",legend:"Legend",legendBottom:"Bottom",legendRight:"Right",legendNone:"None",addSeries:"Series",addCategory:"Row",seriesName:"Series name",borders:"Borders",borderColour:"Border colour",borderWidth:"Border width",insertRowAbove:"Insert row above",insertRowBelow:"Insert row below",insertColumnLeft:"Insert column left",insertColumnRight:"Insert column right",deleteRow:"Delete row",deleteColumn:"Delete column",mergeCells:"Merge cells",unmergeCells:"Unmerge cells",cellEditHint:"Double-click a cell to type in it. Shift-click to choose several.",colours:"Colours",headingFont:"Headings",bodyFont:"Body",slideNumbers:"Slide numbers",skipSlide:"Skip slide",unskipSlide:"Don’t skip slide",skipped:"Skipped in the show",transition:"Transition",transitionNone:"None",transitionFade:"Fade",transitionSlide:"Slide from right",transitionPush:"Push",transitionZoom:"Zoom",transitionFlip:"Flip",duration:"Duration",applyToAll:"Apply to all slides",play:"Play",animations:"Object animations",addAnimation:"Add animation",removeAnimation:"Remove animation",selectToAnimate:"Select an object on the slide to animate it.",noAnimations:"No animations on this slide.",effectAppear:"Appear",effectFadeIn:"Fade in",effectFlyIn:"Fly in",effectZoomIn:"Zoom in",effectFadeOut:"Fade out",startClick:"On click",startWithPrevious:"With previous",startAfterPrevious:"After previous",fromLeft:"From left",fromRight:"From right",fromTop:"From top",fromBottom:"From bottom",byParagraph:"By paragraph",moveEarlier:"Earlier",moveLater:"Later",commentPlaceholder:"Comment or add others with @",replyPlaceholder:"Reply",post:"Comment",reply:"Reply",resolve:"Resolve",reopen:"Reopen",showResolved:"Show resolved",noComments:"No comments yet. Select something and choose Comment.",editComment:"Edit",deleteComment:"Delete",save:"Save",cancel:"Cancel",commentFailed:"Could not save this comment.",onSlide:"On the slide",objectGone:"The object it was on is gone.",resolvedBy:"Resolved",nameVersion:"Name this version",versionName:"Version name",restore:"Restore",previewVersion:"Preview",noVersions:"No earlier versions yet.",restoreFailed:"Could not restore this version.",closePreview:"Back to the deck",versionsFailed:"Could not load the history.",startFrom:"Start from",exportPptx:"PowerPoint (.pptx)",exportPdf:"PDF",exporting:"Exporting…",merged:"Somebody else changed this deck too. Their changes are in.",editingNow:e=>`${e} also here`,commentCount:e=>`${e} comments`,restoreConfirm:e=>`Restore the deck as it was on ${e}? You can undo this.`,shapeName:e=>o[e],starterName:e=>i[e],themeName:e=>({simple:"Simple",midnight:"Midnight",editorial:"Editorial"}[e]??e),presenterStep:(e,t)=>`Click ${e} of ${t}`,dealerPitch:[["Wheel and Tyre Haus","Dealer programme 2026"],["Why stock us","Fast restock from three warehouses"],["The range","Wheels, tyres and fitting kits"],["Margins and support","Tiered pricing and co-op marketing"],["Next steps","Book a range review"]],monthlyReport:[["Monthly report","October 2026"],["Highlights","What went well this month"],["Numbers","Sales, margin and stock"],["Risks","What needs attention"],["Next month","Priorities and owners"]]},l={decks:"演示文稿",newDeck:"新建演示文稿",untitledDeck:"未命名演示文稿",emptyTitle:"制作第一份演示文稿",emptyBody:"在这里制作幻灯片,然后放映或导出为 PowerPoint。",openFailed:"无法打开此演示文稿",createFailed:"无法创建演示文稿。",deleteFailed:"无法删除此演示文稿。",backToDecks:"返回演示文稿列表",deleteConfirm:e=>`要删除“${e}”吗?此操作无法撤销。`,delete:"删除",deckName:"演示文稿名称",slidesPanel:"幻灯片",slideNumber:e=>`第 ${e} 张幻灯片`,slideOf:(e,t)=>`第 ${e} 张,共 ${t} 张`,addSlide:"添加幻灯片",duplicateSlide:"复制幻灯片",deleteSlide:"删除幻灯片",slideText:"幻灯片文字",undo:"撤销",redo:"重做",export:"导出",exportFailed:"无法导出此演示文稿。",present:"放映",endShow:"结束放映",popupBlocked:"浏览器阻止了观众窗口。请允许此网站的弹出窗口,然后结束放映并重新放映。",back:"上一张",next:"下一张",nextSlide:"下一张幻灯片",endOfDeck:"演示文稿已结束。",notes:"备注",noNotes:"此幻灯片没有备注。",speakerNotes:"演讲者备注",saveFailed:"无法保存此演示文稿,正在重试。",renameFailed:"无法重命名此演示文稿。",conflict:"其他人修改了此演示文稿,您最近的编辑未保存。请重新加载以查看对方的版本。",reload:"重新加载",addText:"添加文字",addShape:"添加形状",addImage:"添加图片",addChart:"添加图表",addTable:"添加表格",elementText:"文字",elementShape:"形状",elementImage:"图片",elementChart:"图表",elementTable:"表格",slide:"幻灯片",objects:e=>`${e} 个对象`,background:"背景",positionAndSize:"位置和大小",width:"宽",height:"高",angle:"角度",align:"对齐",alignLeft:"左对齐",alignCentre:"居中对齐",alignRight:"右对齐",bringForward:"上移一层",size:"字号",weight:"字重",regular:"常规",bold:"粗体",textAlignment:"文字对齐",left:"左",centre:"中",right:"右",colour:"颜色",rectangle:"矩形",ellipse:"椭圆",roundedRectangle:"圆角矩形",diamond:"菱形",lineShape:"线条",outlineColour:"轮廓颜色",imageAddress:"图片地址",chooseImage:"选择图片",imageTitle:"幻灯片图片",description:"描述",data:"数据",chartType:"图表类型",bar:"柱形图",line:"折线图",values:"数值",valuesHint:"每行一个标签和数字,例如 九月, 42。",rows:"行",rowsHint:"每行一行数据,单元格之间用逗号分隔。",headingColour:"标题颜色",pptxPasswordProtected:"此文件设有密码。请先在 PowerPoint 中移除密码,再重新导入。",pptxUnreadable:"无法将此文件读取为 PowerPoint (.pptx) 文件。",pptxLegacyFormat:"这是旧版 Office 文件。请先在 PowerPoint 中另存为 .pptx,再重新导入。",pptxTooManySlides:(e,t)=>`此演示文稿有 ${e} 张幻灯片,最多只能有 ${t} 张。`,pptxTooLarge:(e,t)=>`此演示文稿不计图片已达 ${e} MiB,上限为 ${t} MiB。请拆分成较小的演示文稿。`,pdfSlideFailed:e=>`第 ${e} 张幻灯片无法绘制到 PDF。`,files:t,fileKind:"PowerPoint",importNotes:({skipped:e,animations:t,fonts:o})=>{const n=[e&&`${e} 个图表、视频或自定义形状未能导入`,t&&`${t} 张幻灯片的动画已移除`,o.length&&`${o.join("、")} 以演示文稿字体显示`].filter(Boolean);return n.length?`部分内容未能导入:${n.join(";")}。`:null},dismiss:"关闭",newSlide:"新建幻灯片",layouts:"版式",layoutTitle:"标题",layoutTitleBody:"标题和正文",layoutSection:"节标题",layoutTwoColumns:"两栏",layoutTitleOnly:"仅标题",layoutBlank:"空白",placeholderTitle:"单击添加标题",placeholderSubtitle:"单击添加副标题",placeholderBody:"单击添加文本",addVideo:"添加视频",addLine:"添加线条或连接线",elementVideo:"视频",elementConnector:"连接线",lineStraight:"直线",lineArrow:"箭头",lineDoubleArrow:"双向箭头",connectorElbow:"肘形连接线",connectorCurved:"曲线连接线",arrange:"排列",theme:"主题",motion:"动画",comments:"评论",versionHistory:"版本历史记录",font:"字体",fontSize:"字号",smaller:"减小字号",larger:"增大字号",italic:"斜体",underline:"下划线",strikethrough:"删除线",textColour:"文字颜色",highlight:"突出显示",link:"链接",linkPrompt:"链接到网址、电子邮件地址或幻灯片编号",removeLink:"移除链接",badLink:"该链接不是网址、电子邮件地址或幻灯片编号。",alignJustify:"两端对齐",bulletList:"项目符号列表",numberedList:"编号列表",indentLess:"减少缩进",indentMore:"增加缩进",lineSpacing:"行距",verticalAlign:"垂直对齐",top:"顶端",middle:"居中",bottom:"底端",shrinkToFit:"缩小文字以适应",cut:"剪切",copy:"复制",paste:"粘贴",duplicate:"创建副本",copyStyle:"复制格式",pasteStyle:"粘贴格式",order:"顺序",bringToFront:"置于顶层",sendBackward:"下移一层",sendToBack:"置于底层",alignTop:"顶端对齐",alignMiddle:"垂直居中",alignBottom:"底端对齐",distributeAcross:"横向分布",distributeDown:"纵向分布",distribute:"分布",group:"组合",ungroup:"取消组合",lock:"锁定",unlock:"解锁",locked:"已锁定",comment:"评论",grid:"网格",crop:"裁剪",cropLeft:"左",cropTop:"上",cropRight:"右",cropBottom:"下",opacity:"不透明度",replaceImage:"替换图片",videoAddress:"视频地址",videoHint:"YouTube 或 Vimeo 链接,或视频文件。",chooseVideo:"从媒体库选择",videoUnsupported:"此视频无法在此播放。请通过其链接打开。",route:"路线",routeStraight:"直线",routeElbow:"肘形",routeCurved:"曲线",arrowStart:"起点箭头",arrowEnd:"终点箭头",lineWidth:"线条粗细",fill:"填充",noFill:"无填充",outline:"轮廓",chartBar:"柱形图",chartHbar:"条形图",chartArea:"面积图",chartPie:"饼图",chartDonut:"圆环图",legend:"图例",legendBottom:"底部",legendRight:"右侧",legendNone:"无",addSeries:"系列",addCategory:"行",seriesName:"系列名称",borders:"边框",borderColour:"边框颜色",borderWidth:"边框粗细",insertRowAbove:"在上方插入行",insertRowBelow:"在下方插入行",insertColumnLeft:"在左侧插入列",insertColumnRight:"在右侧插入列",deleteRow:"删除行",deleteColumn:"删除列",mergeCells:"合并单元格",unmergeCells:"取消合并单元格",cellEditHint:"双击单元格即可输入。按住 Shift 单击可选择多个。",colours:"颜色",headingFont:"标题",bodyFont:"正文",slideNumbers:"幻灯片编号",skipSlide:"跳过幻灯片",unskipSlide:"不跳过幻灯片",skipped:"放映时跳过",transition:"切换效果",transitionNone:"无",transitionFade:"淡出",transitionSlide:"从右侧滑入",transitionPush:"推入",transitionZoom:"缩放",transitionFlip:"翻转",duration:"持续时间",applyToAll:"应用于所有幻灯片",play:"播放",animations:"对象动画",addAnimation:"添加动画",removeAnimation:"删除动画",selectToAnimate:"选择幻灯片上的对象以添加动画。",noAnimations:"此幻灯片没有动画。",effectAppear:"出现",effectFadeIn:"淡入",effectFlyIn:"飞入",effectZoomIn:"放大",effectFadeOut:"淡出",startClick:"单击时",startWithPrevious:"与上一动画同时",startAfterPrevious:"上一动画之后",fromLeft:"自左侧",fromRight:"自右侧",fromTop:"自顶部",fromBottom:"自底部",byParagraph:"按段落",moveEarlier:"提前",moveLater:"延后",commentPlaceholder:"发表评论,或使用 @ 添加其他人",replyPlaceholder:"回复",post:"评论",reply:"回复",resolve:"解决",reopen:"重新打开",showResolved:"显示已解决",noComments:"还没有评论。选择内容后选择“评论”。",editComment:"编辑",deleteComment:"删除",save:"保存",cancel:"取消",commentFailed:"无法保存此评论。",onSlide:"在幻灯片上",objectGone:"所评论的对象已被删除。",resolvedBy:"已解决",nameVersion:"命名此版本",versionName:"版本名称",restore:"恢复",previewVersion:"预览",noVersions:"还没有较早的版本。",restoreFailed:"无法恢复此版本。",closePreview:"返回演示文稿",versionsFailed:"无法加载历史记录。",startFrom:"开始于",exportPptx:"PowerPoint (.pptx)",exportPdf:"PDF",exporting:"正在导出…",merged:"其他人也修改了此演示文稿,其更改已合并。",editingNow:e=>`${e} 也在此处`,commentCount:e=>`${e} 条评论`,restoreConfirm:e=>`将演示文稿恢复为 ${e} 时的版本?此操作可以撤销。`,shapeName:e=>n[e],starterName:e=>r[e],themeName:e=>({simple:"简约",midnight:"午夜",editorial:"杂志"}[e]??e),presenterStep:(e,t)=>`第 ${e} 次单击,共 ${t} 次`,dealerPitch:[["Wheel and Tyre Haus","2026 年经销商计划"],["为何选择我们","三个仓库快速补货"],["产品系列","轮毂、轮胎和安装套件"],["利润与支持","阶梯定价和联合营销"],["后续步骤","预约产品系列评审"]],monthlyReport:[["月度报告","2026 年 10 月"],["亮点","本月进展顺利的方面"],["数据","销售、利润和库存"],["风险","需要关注的事项"],["下月","重点工作和负责人"]]},s=1920,d=1080,c="Inter",p=["Inter","Roboto","Montserrat","Lora","Playfair Display","JetBrains Mono"],m="transparent",h=20,u=["rect","roundRect","ellipse","triangle","rightTriangle","diamond","pentagon","hexagon","octagon","star","heart","cloud","bolt","parallelogram","trapezoid","cylinder","plus","arrowRight","arrowLeft","arrowUp","arrowDown","arrowLeftRight","chevron","callout","calloutRound","line"],g=()=>crypto.randomUUID();function f(){return{id:g(),background:"#ffffff",notes:"",elements:[]}}function w(e){const t=e,o=t?.slides;return Array.isArray(o)&&o.length>0?{...t,slides:o}:{slides:[f()]}}var y={text:"#2c2c2a",accents:["#534ab7","#1d9e75","#d85a30"],shapeFill:"#afa9ec"};function b(e,t=y){const o=(e,t)=>({id:g(),x:(s-e)/2,y:(d-t)/2,w:e,h:t,rotation:0}),n=t.accents[0]??y.accents[0];switch(e){case"text":return{...o(800,160),type:e,text:"Text",fontSize:64,bold:!1,color:t.text,align:"left",...t.bodyFont&&t.bodyFont!==c?{font:t.bodyFont}:{}};case"shape":return{...o(400,400),type:e,shape:"rect",fill:t.shapeFill};case"image":return{...o(800,450),type:e,src:"",alt:""};case"video":return{...o(960,540),type:e,src:"",alt:""};case"connector":{const n={x:760,y:540},i={x:1160,y:540};return{...o(400,24),y:528,type:e,start:n,end:i,route:"straight",stroke:t.text,strokeWidth:4,arrowEnd:!0}}case"chart":return{...o(900,600),type:e,kind:"bar",color:n,points:[{label:"A",value:40},{label:"B",value:65},{label:"C",value:90}]};case"table":return{...o(1e3,400),type:e,headerFill:"#eeedfe",rows:[["Heading","Heading"],["Cell","Cell"]]}}}function k(e,t,o){return{...e,slides:e.slides.map(e=>e.id===t?o(e):e)}}function x(e,t,o){const n=e.slides.findIndex(e=>e.id===t),i=[...e.slides];return i.splice(-1===n?i.length:n+1,0,o),{...e,slides:i}}function S(e){return{...e,id:g(),elements:e.elements.map(e=>({...e,id:g()}))}}function v(e,t){const o=e.slides.filter(e=>e.id!==t);return{...e,slides:o.length>0?o:[f()]}}function C(e,t,o){const n=e.slides.findIndex(e=>e.id===t);if(-1===n)return e;const i=[...e.slides],[r]=i.splice(n,1);return i.splice(Math.max(0,Math.min(o,i.length)),0,r),{...e,slides:i}}function T(e,t,o){return{...e,elements:e.elements.map(e=>t.has(e.id)?o(e):e)}}function P(e,t){return{...e,elements:e.elements.filter(e=>!t.has(e.id))}}function F(e,t,o){const n={...e,x:e.x+t,y:e.y+o};if("connector"!==n.type)return n;const i=e=>({...e,x:e.x+t,y:e.y+o});return{...n,start:i(n.start),end:i(n.end)}}function R(e,t){const o=[...e.elements];for(let e=o.length-2;e>=0;e-=1)t.has(o[e].id)&&!t.has(o[e+1].id)&&([o[e],o[e+1]]=[o[e+1],o[e]]);return{...e,elements:o}}function A(e){const t=Math.min(...e.map(e=>e.x)),o=Math.min(...e.map(e=>e.y));return{x:t,y:o,w:Math.max(...e.map(e=>e.x+e.w))-t,h:Math.max(...e.map(e=>e.y+e.h))-o}}function B(e,t){const o=[{x:0,y:0,w:s,h:d},...t],n=(e,t,o)=>{let n=null;for(const i of[e,e+t/2,e+t])for(const e of o){const t=e-i;Math.abs(t)<=8&&(!n||Math.abs(t)<Math.abs(n.shift))&&(n={shift:t,at:e})}return n},i=n(e.x,e.w,o.flatMap(e=>[e.x,e.x+e.w/2,e.x+e.w])),r=n(e.y,e.h,o.flatMap(e=>[e.y,e.y+e.h/2,e.y+e.h]));return{box:{...e,x:e.x+(i?.shift??0),y:e.y+(r?.shift??0)},guides:{x:i?[i.at]:[],y:r?[r.at]:[]}}}var L=["nw","n","ne","e","se","s","sw","w"];function D(e,t,o,n,i=!1){let{x:r,y:a,w:l,h:s}=e;if(t.includes("e")&&(l=Math.max(20,e.w+o)),t.includes("s")&&(s=Math.max(20,e.h+n)),t.includes("w")&&(l=Math.max(20,e.w-o),r=e.x+e.w-l),t.includes("n")&&(s=Math.max(20,e.h-n),a=e.y+e.h-s),i&&2===t.length){const o=Math.max(l/e.w,s/e.h);l=e.w*o,s=e.h*o,t.includes("w")&&(r=e.x+e.w-l),t.includes("n")&&(a=e.y+e.h-s)}return{x:r,y:a,w:l,h:s}}function N(e,t,o,n=!1){const i=180*Math.atan2(o-(e.y+e.h/2),t-(e.x+e.w/2))/Math.PI+90;return((n?15*Math.round(i/15):Math.round(i))%360+360)%360}function M(e,t){return e.x<t.x+t.w&&t.x<e.x+e.w&&e.y<t.y+t.h&&t.y<e.y+e.h}function $(e,t){switch(t.type){case"commit":return t.doc===e.present?e:{past:[...e.past,e.present].slice(-200),present:t.doc,future:[]};case"live":return{...e,present:t.doc};case"settle":return t.from===e.present?e:{past:[...e.past,t.from].slice(-200),present:e.present,future:[]};case"undo":{const t=e.past[e.past.length-1];return t?{past:e.past.slice(0,-1),present:t,future:[e.present,...e.future]}:e}case"redo":{const[t,...o]=e.future;return t?{past:[...e.past,e.present],present:t,future:o}:e}case"rebase":return{past:e.past.map(t.rebase),present:t.rebase(e.present),future:e.future.map(t.rebase)}}}export{a as ENGLISH_WORDS,l as ZH_HANS_WORDS,s as SLIDE_W,d as SLIDE_H,c as DECK_FONT,p as DECK_FONTS,m as NO_FILL,h as MIN_SIZE,u as SHAPE_KINDS,g as newId,f as newSlide,w as asDocument,b as newElement,k as updateSlide,x as insertSlideAfter,S as copySlide,v as removeSlide,C as moveSlide,T as updateElements,P as removeElements,F as shiftElement,R as bringForward,A as boundsOf,B as snapBox,L as HANDLES,D as resizeBox,N as angleTo,M as boxesTouch,$ as historyReducer};
@@ -0,0 +1 @@
1
+ import{paragraphsOf as t,withParagraphs as e}from"./chunk-B2X3NIQR.js";import{DECK_FONT as o,DECK_FONTS as n,SLIDE_H as r,SLIDE_W as i,newId as a,newSlide as l}from"./chunk-PXOQN7D6.js";var s=[{id:"simple",name:"Simple",background:"#ffffff",text:"#2c2c2a",heading:"#26215c",accents:["#534ab7","#1d9e75","#d85a30","#ef9f27","#378add","#d4537e"],headingFont:o,bodyFont:o},{id:"midnight",name:"Midnight",background:"#26215c",text:"#eeedfe",heading:"#ffffff",accents:["#afa9ec","#5dcaa5","#f0997b","#fac775","#85b7eb","#ed93b1"],headingFont:"Montserrat",bodyFont:o},{id:"editorial",name:"Editorial",background:"#f1efe8",text:"#444441",heading:"#2c2c2a",accents:["#993c1d","#5f5e5a","#0f6e56","#854f0b","#185fa5","#993556"],headingFont:"Playfair Display",bodyFont:"Lora"}],c=s[0],d=t=>t.theme??c,f={title:96,subtitle:48,body:44};function u(t,e,o,n){return{id:a(),type:"text",...e,rotation:0,text:o,fontSize:f[t],bold:"title"===t,color:"title"===t?n.heading:n.text,font:"title"===t?n.headingFont:n.bodyFont,align:"left",anchor:"body"===t?"top":"bottom",placeholder:t,..."body"===t?{paragraphs:[{list:"bullet",runs:[{text:o}]}]}:{}}}var h=120,b={x:h,y:80,w:i-240,h:180},m={x:h,y:300,w:i-240,h:r-300-100},p=["title","titleBody","section","twoColumns","titleOnly","blank"];function y(t,e,o){const n={...l(),background:e.background,layout:t},r=(m.w-80)/2;return{...n,elements:(()=>{switch(t){case"title":return[{...u("title",{x:h,y:340,w:i-240,h:220},o.title,e),align:"center"},{...u("subtitle",{x:h,y:580,w:i-240,h:120},o.subtitle,e),align:"center",anchor:"top"}];case"titleBody":return[u("title",b,o.title,e),u("body",m,o.body,e)];case"section":return[u("title",{x:h,y:520,w:i-240,h:200},o.title,e)];case"twoColumns":return[u("title",b,o.title,e),u("body",{...m,w:r},o.body,e),u("body",{...m,x:m.x+r+80,w:r},o.body,e)];case"titleOnly":return[u("title",b,o.title,e)];case"blank":return[]}})()}}function g(n,r){const i=d(n),a=(t,e)=>!!t&&t.toLowerCase()===e.toLowerCase(),l=t=>{const e=i.accents.findIndex(e=>a(t,e));return-1===e?t:r.accents[e]??t},s=n=>{switch(n.type){case"text":{const l="title"===n.placeholder||!n.placeholder&&a(n.color,i.heading),s=t=>a(t,i.heading)?r.heading:a(t,i.text)?r.text:t,c=l?i.headingFont:i.bodyFont,d=l?r.headingFont:r.bodyFont,f=n.placeholder||(n.font??o)===c?d===o?void 0:d:n.font,u=t(n).map(t=>({...t,runs:t.runs.map(t=>({...t,color:s(t.color),font:t.font===c?void 0:t.font}))}));return e({...n,color:s(n.color)??n.color,font:f},u)}case"shape":return{...n,fill:l(n.fill),stroke:n.stroke&&(a(n.stroke,i.text)?r.text:l(n.stroke))};case"connector":return{...n,stroke:a(n.stroke,i.text)?r.text:l(n.stroke)};case"chart":return{...n,color:l(n.color),series:n.series?.map(t=>({...t,color:l(t.color)}))};default:return n}};return{...n,theme:r,slides:n.slides.map(t=>({...t,background:a(t.background,i.background)?r.background:t.background,elements:t.elements.map(s)}))}}var x=["blank","simple","midnight","editorial","dealerPitch","monthlyReport"];function k(o,n){if("blank"===o)return{slides:[l()]};const r=s.find(t=>t.id===o)??("dealerPitch"===o?s[1]:c);if("simple"===o||"midnight"===o||"editorial"===o)return{theme:r,slides:[y("title",r,n)]};const i="dealerPitch"===o?n.dealerPitch:n.monthlyReport,a=i.map(([o,a],l)=>((o,n,r)=>({...o,elements:o.elements.map(o=>{if("text"!==o.type)return o;const i="title"===o.placeholder?n:r;return e(o,t(o).slice(0,1).map(t=>({...t,runs:[{...t.runs[0],text:i}]})))})}))(y(0===l?"title":l===i.length-1?"section":"titleBody",r,n),o,a));return{theme:r,slideNumbers:!0,slides:a}}function w(t){const e=d(t),o=new Set([e.headingFont,e.bodyFont]);for(const e of t.slides)for(const t of e.elements)if("text"===t.type){t.font&&o.add(t.font);for(const e of t.paragraphs??[])for(const t of e.runs)t.font&&o.add(t.font)}return[...o].filter(t=>n.includes(t))}var F="data-slides-fonts";function v(t,e){const n=function(t){return`https://fonts.googleapis.com/css2?${[...t].sort().map(t=>`family=${t.replace(/ /g,"+")}:ital,wght@0,400;0,700;1,400;1,700`).join("&")}&display=swap`}([...new Set([o,...e])]),r=t.head.querySelector(`link[${F}]`);if(r?.href===n)return;const i=t.createElement("link");i.rel="stylesheet",i.crossOrigin="anonymous",i.href=n,i.setAttribute(F,""),t.head.appendChild(i),r?.remove()}export{s as THEMES,d as themeOf,p as LAYOUTS,y as slideFromLayout,g as applyTheme,x as STARTERS,k as starterDeck,w as fontsOf,v as ensureFonts};
@@ -0,0 +1 @@
1
+ import{drawJpeg as t,embeddedFonts as o,jpegPdf as r,openStage as n,settled as e}from"./chunk-JKYJGXJE.js";import{SLIDE_FONT as i,SlideView as a}from"./chunk-B2X3NIQR.js";import{ENGLISH_WORDS as c}from"./chunk-PXOQN7D6.js";import"./chunk-B32ASXHM.js";import{flushSync as s}from"react-dom";import{createRoot as m}from"react-dom/client";import{jsx as l}from"react/jsx-runtime";async function d(o,r,n,i){const c=document.createElement("div");r.root.append(c);const d=m(c);try{s(()=>d.render(l(a,{slide:o,width:1600})));const r=c.firstElementChild;await e(r);return{jpeg:await t(r,{width:1600,height:900,pixelRatio:1,quality:i,fontCss:n,background:o.background}),width:720,height:405}}finally{d.unmount(),c.remove()}}async function u(t,e={}){const{signal:a,onProgress:s,quality:m}=e;a?.throwIfAborted();const l=n();try{const n=await async function(t){const r=document.createElement("div");r.style.fontFamily=i,t.root.append(r);try{return await o(r)}finally{r.remove()}}(l),e=[];for(const[o,r]of t.slides.entries()){a?.throwIfAborted();const i=await d(r,l,n,m).catch(t=>{throw new Error(c.pdfSlideFailed(o+1),{cause:t})});e.push(i),s?.(o+1,t.slides.length)}return r(e)}finally{l.close()}}export{u as deckToPdf};
@@ -1 +1 @@
1
- import{DocumentsConflict as t,DocumentsProvider as o,DocumentsWordsProvider as n}from"../chunk-HU4RI2OM.js";import{ENGLISH_WORDS as m,ZH_HANS_WORDS as r}from"../chunk-I3AC6PYR.js";import{ENGLISH_FILE_WORDS as c,ZH_HANS_FILE_WORDS as e}from"../chunk-B32ASXHM.js";import{hasExtension as i}from"../chunk-XYVQTQ6N.js";import{lazy as s}from"react";var u=s(()=>import("../Documents-CVV64UEH.js")),p=s(()=>import("../Documents-CVV64UEH.js").then(t=>({default:t.OpenDocument}))),a={"/documents":{component:u,label:"Documents",size:"xl",appStyle:!0,multiInstance:!0}};async function f(t,o){const{docxToPdf:n}=await(import("../docxPdf-EW5I5JR3.js"));return n(t,o)}async function j(t,o){const{importDocumentFile:n}=await(import("../importDocument-274VK7OM.js"));return n(t,o)}export{p as DocumentEditor,u as Documents,t as DocumentsConflict,o as DocumentsProvider,n as DocumentsWordsProvider,c as ENGLISH_FILE_WORDS,m as ENGLISH_WORDS,e as ZH_HANS_FILE_WORDS,r as ZH_HANS_WORDS,a as documentsApp,f as docxToPdf,i as hasExtension,j as importDocumentFile};
1
+ import{DocumentsConflict as t,DocumentsProvider as o,DocumentsWordsProvider as n}from"../chunk-HU4RI2OM.js";import{ENGLISH_WORDS as m,ZH_HANS_WORDS as r}from"../chunk-I3AC6PYR.js";import{ENGLISH_FILE_WORDS as c,ZH_HANS_FILE_WORDS as e}from"../chunk-B32ASXHM.js";import{hasExtension as i}from"../chunk-XYVQTQ6N.js";import{lazy as s}from"react";var u=s(()=>import("../Documents-ISV66NLW.js")),p=s(()=>import("../Documents-ISV66NLW.js").then(t=>({default:t.OpenDocument}))),a={"/documents":{component:u,label:"Documents",size:"xl",appStyle:!0,multiInstance:!0}};async function f(t,o){const{docxToPdf:n}=await(import("../docxPdf-EW5I5JR3.js"));return n(t,o)}async function j(t,o){const{importDocumentFile:n}=await(import("../importDocument-274VK7OM.js"));return n(t,o)}export{p as DocumentEditor,u as Documents,t as DocumentsConflict,o as DocumentsProvider,n as DocumentsWordsProvider,c as ENGLISH_FILE_WORDS,m as ENGLISH_WORDS,e as ZH_HANS_FILE_WORDS,r as ZH_HANS_WORDS,a as documentsApp,f as docxToPdf,i as hasExtension,j as importDocumentFile};
@@ -0,0 +1 @@
1
+ import{PptxPasswordError as t,PptxUnreadableError as e}from"./chunk-MDG2ADZ7.js";import{DECK_FONT as n,ENGLISH_WORDS as r,MIN_SIZE as a,NO_FILL as o,SLIDE_H as s,SLIDE_W as i,newId as l,newSlide as c}from"./chunk-PXOQN7D6.js";import"./chunk-B32ASXHM.js";import{child as p,childrenOf as f,descendants as u,openZip as d,parseXml as m,partText as h,readRels as y,readThemeFonts as g,resolveTarget as w}from"./chunk-RHW2M2UY.js";var x=2097152;function b(t){if(Array.isArray(t))return t.reduce((t,e)=>t+b(e)+2,t.length?0:2);if(t&&"object"==typeof t){const e=Object.entries(t).filter(([,t])=>void 0!==t);return e.reduce((t,[e,n])=>t+b(e)+2+b(n)+2,e.length?0:2)}const e=JSON.stringify(t)??"null";return e.length+5*(e.match(/[^\x20-\x7e]/g)?.length??0)}var v=[208,207,17,224],M=Array.from("EncryptedPackage").flatMap(t=>[t.charCodeAt(0),0]),k=4194304;function P(t){for(let e=t.indexOf(M[0]);e>=0;e=t.indexOf(M[0],e+1))if(M.every((n,r)=>t[e+r]===n))return!0;return!1}var S={black:"000000",white:"ffffff",red:"ff0000",green:"008000",blue:"0000ff",yellow:"ffff00",gray:"808080",grey:"808080"},N={bg1:"lt1",tx1:"dk1",bg2:"lt2",tx2:"dk2"};function C(t){const e=t.children[0];return e?.attrs.lastClr??e?.attrs.val}function A(t,e){const n=new Map,r=p(p(t,"a:themeElements"),"a:clrScheme")?.children??[];for(const t of r){const e=C(t);e&&n.set(t.name.replace(/^a:/,""),e)}return{scheme:n,map:{...N,...e?.attrs}}}function B(t,e){const n=p(p(e,"p:clrMapOvr"),"a:overrideClrMapping");return n?{...t,map:{...t.map,...n.attrs}}:t}var I=t=>[0,2,4].map(e=>parseInt(t.slice(e,e+2),16)),F=t=>t.map(t=>{return(e=t,Math.max(0,Math.min(255,Math.round(e)))).toString(16).padStart(2,"0");var e}).join("");function T(t,e,n){const[r,a,o]=function([t,e,n]){const[r,a,o]=[t/255,e/255,n/255],s=Math.max(r,a,o),i=Math.min(r,a,o),l=(s+i)/2;if(s===i)return[0,0,l];const c=s-i;return[(s===r?(a-o)/c+(a<o?6:0):s===a?(o-r)/c+2:(r-a)/c+4)/6,l>.5?c/(2-s-i):c/(s+i),l]}(I(t));return F(function([t,e,n]){if(0===e)return[255*n,255*n,255*n];const r=n<.5?n*(1+e):n+e-n*e,a=2*n-r,o=t=>{const e=(t+1)%1;return e<1/6?a+6*(r-a)*e:e<.5?r:e<2/3?a+(r-a)*(2/3-e)*6:a};return[o(t+1/3),o(t),o(t-1/3)].map(t=>255*t)}([r,a,Math.max(0,Math.min(1,o*e+n))]))}function $(t,e){const n=Number(e.attrs.val)/1e5;if(!Number.isFinite(n))return t;switch(e.name){case"a:lumMod":return T(t,n,0);case"a:lumOff":return T(t,1,n);case"a:tint":return F(I(t).map(t=>t+(255-t)*(1-n)));case"a:shade":return F(I(t).map(t=>t*n));default:return t}}function j(t,e){const n=e.scheme.get(e.map[t]??t);return n?`#${n.toLowerCase()}`:void 0}function z(t,e){const n=t&&function(t,e){switch(t.name){case"a:srgbClr":return t.attrs.val;case"a:sysClr":return t.attrs.lastClr;case"a:prstClr":return S[t.attrs.val];case"a:schemeClr":return e.scheme.get(e.map[t.attrs.val]??t.attrs.val);default:return}}(t,e);if(t&&n&&/^[0-9a-f]{6}$/i.test(n)&&"0"!==p(t,"a:alpha")?.attrs.val)return`#${t.children.reduce($,n).toLowerCase()}`}function O(t,e){return z(p(t,"a:solidFill")?.children[0],e)}var R=t=>"1"===t||"true"===t,D=t=>Math.round(100*t)/100+0,H=(t,e)=>D(12700*t*e.scale),L=t=>t*Math.PI/180;function E(t){const e=p(t,"a:off")?.attrs,n=p(t,"a:ext")?.attrs;if(t&&e&&n)return{x:Number(e.x)||0,y:Number(e.y)||0,w:Number(n.cx)||0,h:Number(n.cy)||0,rotation:(Number(t.attrs.rot)||0)/6e4}}function V(t){const e=p(p(t,"p:grpSpPr"),"a:xfrm"),n=E(e),r=p(e,"a:chOff")?.attrs,a=p(e,"a:chExt")?.attrs;if(n&&r&&a)return{box:n,childX:Number(r.x)||0,childY:Number(r.y)||0,scaleX:Number(a.cx)?n.w/Number(a.cx):1,scaleY:Number(a.cy)?n.h/Number(a.cy):1,flipH:R(e?.attrs.flipH),flipV:R(e?.attrs.flipV)}}function X(t,e){const{box:n}=e,r=n.x+n.w/2,a=n.y+n.h/2;let o=n.x+(t.x-e.childX)*e.scaleX,s=n.y+(t.y-e.childY)*e.scaleY;e.flipH&&(o=2*r-o),e.flipV&&(s=2*a-s);const i=L(n.rotation),l=o-r,c=s-a;return{x:r+l*Math.cos(i)-c*Math.sin(i),y:a+l*Math.sin(i)+c*Math.cos(i)}}function W(t,e){const n=X({x:t.x+t.w/2,y:t.y+t.h/2},e),r=t.w*e.scaleX,a=t.h*e.scaleY,o=e.flipH!==e.flipV;return{x:n.x-r/2,y:n.y-a/2,w:r,h:a,rotation:(o?-t.rotation:t.rotation)+e.box.rotation}}var Y=t=>D((t%360+360)%360);function G(t,e,n){const r=e.reduce(W,t);return{id:l(),x:D(n.left+r.x*n.scale),y:D(n.top+r.y*n.scale),w:D(r.w*n.scale),h:D(r.h*n.scale),rotation:Y(r.rotation)}}function U(t,e,n,r){const o=t.x+t.w/2,s=t.y+t.h/2,i=L(t.rotation),c=a=>{const l=a*(e.flipH?-1:1)*t.w/2,c=a*(e.flipV?-1:1)*t.h/2,p={x:o+l*Math.cos(i)-c*Math.sin(i),y:s+l*Math.sin(i)+c*Math.cos(i)},f=n.reduce(X,p);return{x:r.left+f.x*r.scale,y:r.top+f.y*r.scale}},p=c(-1),f=c(1),u=Math.hypot(f.x-p.x,f.y-p.y);return{id:l(),x:D((p.x+f.x-u)/2),y:D((p.y+f.y-a)/2),w:D(u),h:a,rotation:Y(180*Math.atan2(f.y-p.y,f.x-p.x)/Math.PI)}}var q={scheme:new Map,map:{}},Q=(t,e)=>[...t.rels.values()].find(t=>t.type.endsWith(e)),J=t=>p(p(t,"p:cSld"),"p:spTree");function Z(t,e){const n=h(t,e);if(n)return{part:e,root:m(n),rels:new Map(y(t,e).map(t=>[t.id,t]))}}function _(t,e,n){const r=Z(t,e);if(!r)return;const a=Q(r,"/slideMaster"),o=a&&w(e,a.target);return o&&!n.has(o)&&n.set(o,function(t,e){const n=Z(t,e);if(!n)return;const r=Q(n,"/theme"),a=r?h(t,w(e,r.target)):void 0;return{...n,palette:A(a?m(a):void 0,p(n.root,"p:clrMap")),fonts:g(a)}}(t,o)),{...r,master:o?n.get(o):void 0}}var K={png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",webp:"image/webp",bmp:"image/bmp"};var tt=t=>p(p(p(t,"p:nvSpPr"),"p:nvPr"),"p:ph")??p(p(p(t,"p:nvPicPr"),"p:nvPr"),"p:ph"),et=t=>!!tt(t),nt=t=>(J(t.root)?.children??[]).filter(t=>"p:sp"===t.name&&tt(t)),rt=new Set(["title","ctrTitle"]),at=new Set(["dt","ftr","sldNum"]);function ot(t){return t&&rt.has(t)?"title":t&&at.has(t)?t:"body"}function st(t,e){const n=tt(t);if(!n)return{shapes:[],style:"p:otherStyle",isPlaceholder:!1};const r=e.layout&&function(t,e){const n=nt(t),{idx:r,type:a}=e.attrs;return(void 0!==r?n.find(t=>tt(t)?.attrs.idx===r):void 0)??(void 0!==a?n.find(t=>tt(t)?.attrs.type===a):void 0)}(e.layout,n),a=r?tt(r)??n:n,o=e.master&&function(t,e){const n=ot(e.attrs.type);return nt(t).find(t=>ot(tt(t)?.attrs.type)===n)}(e.master,a),s=ot(a.attrs.type);return{shapes:[r,o].filter(t=>!!t),style:"title"===s?"p:titleStyle":"body"===s?"p:bodyStyle":"p:otherStyle",isPlaceholder:!0}}function it(t,e,n,r){const a=t=>p(p(t,"p:txBody"),"a:lstStyle"),o=p(p(n.master?.root,"p:txStyles"),e.style),s=e.isPlaceholder?[o,r]:[r,o];return[a(t),...e.shapes.map(a),...s]}function lt(t,e,n){for(const r of[t,...e.shapes]){const t=p(p(r,"p:txBody"),"a:bodyPr")?.attrs[n];if(void 0!==t)return t}}var ct={l:"left",ctr:"center",r:"right"},pt=(t,e)=>t.lists.flatMap(t=>{const n=p(t,`a:lvl${e+1}pPr`);return n?[n]:[]});function ft(t,e){return"+mj-lt"===t?e.fonts.major:"+mn-lt"===t?e.fonts.minor:t}function ut(t,e,n,r){const a=[t,p(e,"a:defRPr"),...n.map(t=>p(t,"a:defRPr"))].filter(t=>!!t),o=t=>a.find(e=>void 0!==e.attrs[t])?.attrs[t],s=Number(o("sz")),i=o("b"),l=a.map(t=>O(t,r.palette)),c=a.map(t=>p(t,"a:latin")?.attrs.typeface).find(Boolean);return{sizePt:Number.isFinite(s)&&s>0?s/100:18,bold:"1"===i||"true"===i,colour:l.find(Boolean)??r.styleColour??j("tx1",r.palette)??"#000000",typeface:ft(c,r)??(r.isTitle?r.fonts.major:r.fonts.minor)}}function dt(t,e){for(const n of[t,...e]){if(p(n,"a:buNone"))return{kind:"none"};if(p(n,"a:buChar")||p(n,"a:buBlip"))return{kind:"bullet"};const t=p(n,"a:buAutoNum");if(t)return{kind:"number",startAt:Number(t.attrs.startAt)||1}}return{kind:"none"}}function mt(t,e){const n=[t,...e].map(t=>t?.attrs.algn).find(Boolean);return n&&ct[n]||"left"}function ht(t,e,n){const r=p(t,"a:pPr"),a=[];let o="";for(const s of t.children){if("a:br"===s.name&&(o+="\n"),"a:r"!==s.name&&"a:fld"!==s.name)continue;const t=p(s,"a:t")?.text??"";o+=t,t.trim()&&a.push({text:t,style:ut(p(s,"a:rPr"),r,e,n)})}return{text:o,runs:a}}var yt=(t,e)=>t.sizePt===e.sizePt&&t.bold===e.bold&&t.colour===e.colour;function gt(t,e){const n=[],r=[],a=function(){const t=[];return(e,n)=>"bullet"===e.kind?"• ":"none"===e.kind?(t.length=Math.min(t.length,n),""):(t.length=Math.min(t.length,n+1),t[n]=(t[n]??e.startAt-1)+1,`${t[n]}. `)}();let o;for(const s of f(t,"a:p")){const t=p(s,"a:pPr"),i=Number(t?.attrs.lvl)||0,l=pt(e,i),c=ht(s,l,e),f=dt(t,l),u=c.text.trim()?a(f,i):"";n.push(u?`${" ".repeat(i)}${u}${c.text}`:c.text),c.runs.length&&!o&&(o=mt(t,l)),r.push(...c.runs)}if(!r[0])return null;const s=function(t){const e=[];for(const n of t){const t=e.find(t=>yt(t.style,n.style));t?t.length+=n.text.length:e.push({style:n.style,length:n.text.length})}return e.reduce((t,e)=>e.length>t.length?e:t).style}(r),i=Number(p(p(t,"a:bodyPr"),"a:normAutofit")?.attrs.fontScale);return{text:n.join("\n").trimEnd(),sizePt:s.sizePt*(i>0?i/1e5:1),bold:s.bold,colour:s.colour,align:o??"left",mixed:r.some(t=>!yt(t.style,s)),typefaces:new Set(r.flatMap(t=>t.style.typeface?[t.style.typeface]:[]))}}function wt(t,e){const n=t.map(t=>t.map(e));return n.some(t=>t.some(Boolean))?n:void 0}var xt=t=>t.reduce((t,e)=>t+e,0);function bt(t,e,n,r){const a=E(p(t,"p:xfrm")),s=f(e,"a:tr");if(!a||!s.length)return void(n.tally.skipped+=1);const i=f(p(e,"a:tblGrid"),"a:gridCol").map(t=>Number(t.attrs.w)||0),l=s.map(t=>Number(t.attrs.h)||0),c=s.map(t=>f(t,"a:tc").map(t=>function(t,e){const n=p(t,"a:txBody"),r=gt(n,{palette:e.palette,fonts:e.master?.fonts??{},lists:[p(n,"a:lstStyle"),e.presentation.defaultTextStyle],isTitle:!1});for(const t of r?.typefaces??[])e.tally.typefaces.add(t);return{text:r?.text.replace(/\s*\n\s*/g," ")??"",block:r,fill:O(p(t,"a:tcPr"),e.palette)??null}}(t,n))),u=G({...a,w:xt(i)||a.w,h:xt(l)||a.h},r,n.frame),d=function(t){const e=new Map;for(const{block:n}of t)n&&e.set(n.sizePt,(e.get(n.sizePt)??0)+1);return[...e].sort((t,e)=>e[1]-t[1])[0]?.[0]}(c.flat()),m={...u,type:"table",rows:c.map(t=>t.map(t=>t.text)),headerFill:c[0].map(t=>t.fill).find(Boolean)??o,headerColor:c[0].map(t=>t.block?.colour).find(Boolean),fontSize:void 0===d?void 0:H(d,n.frame),columnWidths:xt(i)?i.map(t=>{return e=t,n=xt(i),Math.round(e/n*1e4)/1e4;var e,n}):void 0,rowHeights:xt(l)?l.map(t=>Math.round(t/xt(l)*u.h*100)/100):void 0,cellFills:wt(c,t=>t.fill),cellColors:wt(c,t=>t.block?.colour??null)};n.elements.push(m)}var vt={rect:"rect",ellipse:"ellipse",roundRect:"roundRect",diamond:"diamond",line:"line",straightConnector1:"line",flowChartProcess:"rect",flowChartAlternateProcess:"roundRect",flowChartDecision:"diamond",flowChartConnector:"ellipse"},Mt=new Set(["a:videoFile","a:audioFile","a:quickTimeFile","p14:media"]);function kt(t,e,n,r){const a=gt(p(t,"p:txBody"),function(t,e,n){const r=p(p(t,"p:style"),"a:fontRef")?.children[0];return{palette:n.palette,fonts:n.master?.fonts??{},lists:it(t,e,n,n.presentation.defaultTextStyle),isTitle:"p:titleStyle"===e.style,styleColour:z(r,n.palette)}}(t,n,r));if(!a)return;const{scale:o}=r.frame,s=(e,r)=>(Number(lt(t,n,e)??r)||0)*o,i=H(a.sizePt,r.frame),c=s("lIns",91440),f=s("tIns",45720),u=Math.max(e.w-c-s("rIns",91440),1),d=Math.max(e.h-f-s("bIns",45720),1),m=lt(t,n,"anchor"),h=Math.max(d-function(t,e,n){const r=Math.max(1,Math.floor(n/(.52*e)));return t.split("\n").reduce((t,e)=>t+Math.max(1,Math.ceil(e.length/r)),0)*e*1.25}(a.text,i,u),0),y="ctr"===m?h/2:"b"===m?h:0;r.elements.push({id:l(),type:"text",rotation:e.rotation,x:D(e.x+c),y:D(e.y+f+y),w:D(u),h:D(d-y),text:a.text,fontSize:i,bold:a.bold,color:a.colour,align:a.align});for(const t of a.typefaces)r.tally.typefaces.add(t);a.mixed&&(r.tally.mixedTextSimplified+=1)}function Pt(t,e){const n=p(t,"p:spPr");if(p(n,"a:noFill"))return{kind:"none"};if(p(n,"a:solidFill")){const t=O(n,e.palette);return t?{kind:"colour",colour:t}:{kind:"none"}}if(["a:gradFill","a:blipFill","a:pattFill","a:grpFill"].some(t=>p(n,t))){const t=function(t,e){const n=p(p(p(t,"a:gradFill"),"a:gsLst"),"a:gs")?.children[0],r=p(p(t,"a:pattFill"),"a:fgClr")?.children[0];return z(n??r,e.palette)}(n,e);return t?{kind:"colour",colour:t}:{kind:"undrawable"}}const r=p(p(t,"p:style"),"a:fillRef"),a=r&&"0"!==r.attrs.idx?z(r.children[0],e.palette):void 0;return a?{kind:"colour",colour:a}:{kind:"none"}}function St(t,e){const n=p(p(t,"p:spPr"),"a:ln");if(p(n,"a:noFill"))return;const r=p(p(t,"p:style"),"a:lnRef"),a=O(n,e.palette)??(r&&"0"!==r.attrs.idx?z(r.children[0],e.palette):void 0);return a?{stroke:a,strokeWidth:D((Number(n?.attrs.w)||9525)*e.frame.scale)}:void 0}function Nt(t,e){const n=p(p(p(t,"a:prstGeom"),"a:avLst"),"a:gd")?.attrs.fmla,r=Number(n?.replace("val ",""));return D((Number.isFinite(r)?r:16667)/1e5*Math.min(e.w,e.h))}var Ct=t=>!!t?.attrs.type&&"none"!==t.attrs.type;function At(t,e,n){const r=p(t,"p:spPr"),a=p(r,"a:xfrm"),s=E(a);if(!s)return void(e.tally.skipped+=1);const i=St(t,e);if(!i)return;const l=p(r,"a:ln");e.elements.push({...U(s,{flipH:R(a?.attrs.flipH),flipV:R(a?.attrs.flipV)},n,e.frame),type:"shape",shape:"line",fill:o,...i,...Ct(p(l,"a:tailEnd"))?{arrowEnd:!0}:{},...Ct(p(l,"a:headEnd"))?{arrowStart:!0}:{}})}function Bt(t,e,n){const r=st(t,e),a=p(t,"p:spPr"),s=function(t){return vt[p(t,"a:prstGeom")?.attrs.prst??"rect"]??"rect"}(a);if("line"===s)return void At(t,e,n);const i=E(p(a,"a:xfrm"))??r.shapes.map(t=>E(p(p(t,"p:spPr"),"a:xfrm"))).find(Boolean);if(!i)return void(p(t,"p:txBody")&&u(t,new Set(["a:t"])).length&&(e.tally.skipped+=1));const l=G(i,n,e.frame),c=Pt(t,e),f=St(t,e),d="colour"===c.kind||!!f;d&&function(t,e,n,r,a,s){s.elements.push({...t,type:"shape",shape:e,fill:"colour"===n.kind?n.colour:o,...r,..."roundRect"===e?{radius:Nt(a,t)}:{}})}(l,s,c,f,a,e),kt(t,l,r,e),"undrawable"!==c.kind||d||(e.tally.skipped+=1)}function It(t,e){const n=e.rels.get(t?.attrs["r:embed"]??"");return n&&!n.external?w(e.part,n.target):void 0}function Ft(t,e,n){const r=p(t,"p:nvPicPr"),a=st(t,e),o=E(p(p(t,"p:spPr"),"a:xfrm"))??a.shapes.map(t=>E(p(p(t,"p:spPr"),"a:xfrm"))).find(Boolean),s=p(t,"p:blipFill"),i=It(p(s,"a:blip"),e.slide),l=i&&!u(t,Mt).length?e.useImage(i,function(t){const e=e=>(Number(t?.attrs[e])||0)/1e5,n={left:e("l"),top:e("t"),right:e("r"),bottom:e("b")},r=Object.values(n);if(!r.every(t=>0===t)&&!r.some(t=>t<0))return n.left+n.right<1&&n.top+n.bottom<1?n:void 0}(p(s,"a:srcRect"))):void 0;o&&l?e.elements.push({...G(o,n,e.frame),type:"image",src:l,alt:p(r,"p:cNvPr")?.attrs.descr??""}):e.tally.skipped+=1}function Tt(t,e,n){const r=p(p(p(t,"a:graphic"),"a:graphicData"),"a:tbl");r?bt(t,r,e,n):e.tally.skipped+=1}function $t(t,e,n=[]){for(const r of t)switch(r.name){case"p:sp":Bt(r,e,n);break;case"p:pic":Ft(r,e,n);break;case"p:graphicFrame":Tt(r,e,n);break;case"p:cxnSp":At(r,e,n);break;case"p:contentPart":e.tally.skipped+=1;break;case"p:grpSp":{const t=V(r);$t(r.children,e,t?[t,...n]:n);break}case"mc:AlternateContent":$t(p(r,"mc:Fallback")?.children??[],e,n)}}function jt(t){const e=function(t){const e=h(t,"[Content_Types].xml"),n=e?m(e):void 0,r=new Map(f(n,"Override").map(t=>[t.attrs.PartName,t.attrs.ContentType])),a=new Map(f(n,"Default").map(t=>[t.attrs.Extension?.toLowerCase(),t.attrs.ContentType]));return t=>{const e=t.slice(t.lastIndexOf(".")+1).toLowerCase();return r.get(`/${t}`)??a.get(e)??K[e]??"application/octet-stream"}}(t),n=new Map;return{use:(t,r)=>{const a=e(t);if(!a.startsWith("image/"))return;const o=`${t}${function(t){return t?`#${t.left},${t.top},${t.right},${t.bottom}`:""}(r)}`;return n.has(o)||n.set(o,{key:o,part:t,contentType:a,crop:r}),o},uses:n}}function zt(t){return t.children.map(t=>"a:br"===t.name?"\n":"a:r"===t.name||"a:fld"===t.name?p(t,"a:t")?.text??"":"").join("")}function Ot(t,e){const n=Q(e,"/notesSlide"),r=n&&Z(t,w(e.part,n.target)),a=((r&&J(r.root)?.children)??[]).find(t=>"body"===p(p(p(t,"p:nvSpPr"),"p:nvPr"),"p:ph")?.attrs.type);return f(p(a,"p:txBody"),"a:p").map(zt).join("\n").trim()}function Rt(t,e){const n=p(p(t.root,"p:cSld"),"p:bg");if(!n)return;const r=p(n,"p:bgPr"),a=O(r,e.palette)??z(p(n,"p:bgRef")?.children[0],e.palette);if(a)return{colour:a};const o=It(p(p(r,"a:blipFill"),"a:blip"),t);return o?{picture:o}:void 0}var Dt=t=>"0"===t.root.attrs.showMasterSp||"false"===t.root.attrs.showMasterSp;function Ht(t,e){const n=function(t){for(const e of[t.slide,t.layout,t.master]){const n=e&&Rt(e,t);if(n)return n}return{}}(t);return n.picture&&function(t,e){const n=e.useImage(t,void 0);if(!n)return void(e.tally.skipped+=1);const{left:r,top:a,width:o,height:s}=e.frame;e.elements.push({id:l(),type:"image",x:r,y:a,w:o,h:s,rotation:0,src:n,alt:""})}(n.picture,t),function(t){const{layout:e,master:n,slide:r}=t;if(!Dt(r))for(const r of[e&&Dt(e)?void 0:n,e]){const e=r?J(r.root)?.children??[]:[];r&&$t(e.filter(t=>!et(t)),{...t,slide:r})}}(t),$t(J(t.slide.root)?.children??[],t),{id:l(),background:n.colour??"#ffffff",notes:Ot(e,t.slide),elements:(r=t.elements,a=t.tally,a.skipped+=Math.max(r.length-200,0),r.slice(0,200))};var r,a}var Lt=t=>"0"===t.root.attrs.show||"false"===t.root.attrs.show;function Et(t){const n=function(t){const n=y(t,"").find(t=>t.type.endsWith("/officeDocument")),r=Z(t,n?w("",n.target):"ppt/presentation.xml");if(!r||"p:presentation"!==r.root.name)throw new e;const a=f(p(r.root,"p:sldIdLst"),"p:sldId").flatMap(t=>{const e=r.rels.get(t.attrs["r:id"]);return e?[w(r.part,e.target)]:[]}),o=p(r.root,"p:sldSz")?.attrs;return{width:Number(o?.cx)||9144e3,height:Number(o?.cy)||5143500,slides:a,defaultTextStyle:p(r.root,"p:defaultTextStyle")}}(t),r=function(t){const e=new Map,n=new Map;return r=>{const a=Q(r,"/slideLayout"),o=a&&w(r.part,a.target);o&&!n.has(o)&&n.set(o,_(t,o,e));const s=o?n.get(o):void 0,i=s?.master,l=i?.palette??q;return{slide:r,layout:s,master:i,palette:B(s?B(l,s.root):l,r.root)}}}(t),a=jt(t),o=function(t,e){const n=Math.min(i/t,s/e);return{scale:n,left:(i-t*n)/2,top:(s-e*n)/2,width:t*n,height:e*n}}(n.width,n.height),l={skipped:0,mixedTextSimplified:0,typefaces:new Set},u=[];let d=0;for(const e of n.slides){const s=Z(t,e);s&&!Lt(s)&&(p(s.root,"p:timing")&&(d+=1),u.push(Ht({...r(s),presentation:n,frame:o,tally:l,elements:[],useImage:a.use},t)))}const m=new Set(u.flatMap(t=>t.elements.flatMap(t=>"image"===t.type?[t.src]:[])));return{document:{slides:u.length?u:[c()]},slideCount:u.length,images:[...a.uses.values()].filter(t=>m.has(t.key)),animationsDropped:d,tally:l}}var Vt=.15,Xt=1048576,Wt=/\.(xml|rels)$/i;async function Yt(n,a){if(await async function(t){const e=new Uint8Array(await t.slice(0,v.length).arrayBuffer());return v.every((t,n)=>e[n]===t)}(n))throw await async function(t,e){for(let n=0;n<t.size;n+=k-M.length)if(e?.throwIfAborted(),P(new Uint8Array(await t.slice(n,n+k).arrayBuffer())))return!0;return!1}(n,a)?new t:new e(r.pptxLegacyFormat)}function Gt(t){if(t.slides.length>300)throw new e(r.pptxTooManySlides(t.slides.length,300));const n=b(t);if(n>x)throw new e(r.pptxTooLarge((n/Xt).toFixed(1),2))}var Ut={"image/webp":"webp","image/png":"png","image/jpeg":"jpg","image/gif":"gif"};async function qt(t,e,n){try{return await(n.prepareImage?n.prepareImage(e,t.contentType):async function(t,e,n){const r=await createImageBitmap(new Blob([t],{type:e}));try{const t=r.width*(n?.left??0),e=r.height*(n?.top??0),a=r.width-t-r.width*(n?.right??0),o=r.height-e-r.height*(n?.bottom??0),s=Math.min(1,1920/Math.max(a,o)),i=new OffscreenCanvas(Math.max(1,Math.round(a*s)),Math.max(1,Math.round(o*s))),l=i.getContext("2d");if(!l)throw new Error("No drawing context");return l.imageSmoothingQuality="high",l.drawImage(r,t,e,a,o,0,0,i.width,i.height),await i.convertToBlob({type:"image/webp",quality:.85})}finally{r.close()}}(e,t.contentType,t.crop))}catch(e){return n.signal?.throwIfAborted(),console.warn("A picture in the deck could not be read",t.part,e),null}}async function Qt(t,e,n){const r={addresses:new Map,count:0,bytesBefore:0,bytesAfter:0},a=function(t,e){const n=new Map;for(const r of t){const t=e.prepareImage?r.part:r.key;n.set(t,[...n.get(t)??[],r])}return[...n.values()]}(t,n),o=new Map;let s=0;return await async function(t,e,n){let r=0,a=!1;await Promise.all(Array.from({length:Math.min(e,t.length)},async()=>{for(;!a&&r<t.length;){const e=t[r];r+=1;try{await n(e)}catch(t){throw a=!0,t}}}))}(a,4,async t=>{n.signal?.throwIfAborted();const[i]=t,l=o.get(i.part)??0;o.set(i.part,l+1);const c=await e.read(i.part).catch(()=>null),p=c&&await qt(i,c,n);if(c&&p){n.signal?.throwIfAborted();const e=await n.storeImage(p,function(t,e,n){return`${t.slice(t.lastIndexOf("/")+1).replace(/\.[^.]*$/,"")}${n?`-${n}`:""}.${Ut[e.type]??"img"}`}(i.part,p,l));for(const{key:n}of t)r.addresses.set(n,e);r.count+=1,r.bytesBefore+=c.length,r.bytesAfter+=p.size}s+=1,n.onProgress?.(Vt+.85*s/a.length)}),r}async function Jt(t,r){r.signal?.throwIfAborted(),await Yt(t,r.signal);const a=await async function(t){try{return await d(t)}catch{throw new e}}(t),o=await async function(t,e){const n=new Map,r=t.names.filter(t=>Wt.test(t));for(const[a,o]of r.entries())e.signal?.throwIfAborted(),n.set(o,await t.read(o)),e.onProgress?.(Vt*(a+1)/r.length);return n}(a,r).catch(t=>{throw r.signal?.throwIfAborted(),t instanceof e?t:new e}),s=function(t){try{return Et(t)}catch(t){if(t instanceof e)throw t;throw new e}}(o);Gt(s.document);const i=await Qt(s.images,a,r),l=function(t,e,n){const r=t=>{if("image"!==t.type)return[t];const r=e.get(t.src);return void 0===r&&(n.skipped+=1),void 0===r?[]:[{...t,src:r}]};return{slides:t.slides.map(t=>({...t,elements:t.elements.flatMap(r)}))}}(s.document,i.addresses,s.tally);return Gt(l),r.onProgress?.(1),{document:l,notes:{slides:s.slideCount,images:i.count,imageBytesBefore:i.bytesBefore,imageBytesAfter:i.bytesAfter,fontsReplaced:[...s.tally.typefaces].filter(t=>t!==n).sort(),animationsDropped:s.animationsDropped,mixedTextSimplified:s.tally.mixedTextSimplified,skipped:s.tally.skipped}}}export{Jt as importPptx};